mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Fix right and left layout alignment (in workarea) with RTL
Fixes: #11606
This commit is contained in:
parent
0922aa0072
commit
b6f0c1de3d
@ -1983,15 +1983,29 @@ depth_type Paragraph::getMaxDepthAfter() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXAlignment Paragraph::getAlign() const
|
LyXAlignment Paragraph::getAlign(BufferParams const & bparams) const
|
||||||
{
|
{
|
||||||
if (d->params_.align() == LYX_ALIGN_LAYOUT)
|
if (d->params_.align() == LYX_ALIGN_LAYOUT)
|
||||||
return d->layout_->align;
|
return getDefaultAlign(bparams);
|
||||||
else
|
else
|
||||||
return d->params_.align();
|
return d->params_.align();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LyXAlignment Paragraph::getDefaultAlign(BufferParams const & bparams) const
|
||||||
|
{
|
||||||
|
LyXAlignment res = layout().align;
|
||||||
|
if (isRTL(bparams)) {
|
||||||
|
// Swap sides
|
||||||
|
if (res == LYX_ALIGN_LEFT)
|
||||||
|
res = LYX_ALIGN_RIGHT;
|
||||||
|
else if (res == LYX_ALIGN_RIGHT)
|
||||||
|
res = LYX_ALIGN_LEFT;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring const & Paragraph::labelString() const
|
docstring const & Paragraph::labelString() const
|
||||||
{
|
{
|
||||||
return d->params_.labelString();
|
return d->params_.labelString();
|
||||||
|
@ -312,7 +312,9 @@ public:
|
|||||||
/// Set label width string.
|
/// Set label width string.
|
||||||
void setLabelWidthString(docstring const & s);
|
void setLabelWidthString(docstring const & s);
|
||||||
/// Actual paragraph alignment used
|
/// Actual paragraph alignment used
|
||||||
LyXAlignment getAlign() const;
|
LyXAlignment getAlign(BufferParams const &) const;
|
||||||
|
/// Default paragraph alignment as determined by layout
|
||||||
|
LyXAlignment getDefaultAlign(BufferParams const &) const;
|
||||||
/// The nesting depth of a paragraph
|
/// The nesting depth of a paragraph
|
||||||
depth_type getDepth() const;
|
depth_type getDepth() const;
|
||||||
/// The maximal possible depth of a paragraph after this one
|
/// The maximal possible depth of a paragraph after this one
|
||||||
|
@ -595,7 +595,7 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool const align_rows)
|
|||||||
|
|
||||||
LyXAlignment TextMetrics::getAlign(Paragraph const & par, Row const & row) const
|
LyXAlignment TextMetrics::getAlign(Paragraph const & par, Row const & row) const
|
||||||
{
|
{
|
||||||
LyXAlignment align = par.getAlign();
|
LyXAlignment align = par.getAlign(bv_->buffer().params());
|
||||||
|
|
||||||
// handle alignment inside tabular cells
|
// handle alignment inside tabular cells
|
||||||
Inset const & owner = text_->inset();
|
Inset const & owner = text_->inset();
|
||||||
@ -1755,7 +1755,7 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
|
|||||||
if (!par.params().leftIndent().zero())
|
if (!par.params().leftIndent().zero())
|
||||||
l_margin += par.params().leftIndent().inPixels(max_width_, lfm.em());
|
l_margin += par.params().leftIndent().inPixels(max_width_, lfm.em());
|
||||||
|
|
||||||
LyXAlignment align = par.getAlign();
|
LyXAlignment align = par.getAlign(bv_->buffer().params());
|
||||||
|
|
||||||
// set the correct parindent
|
// set the correct parindent
|
||||||
if (pos == 0
|
if (pos == 0
|
||||||
|
@ -125,7 +125,7 @@ void GuiParagraph::checkAlignmentRadioButtons()
|
|||||||
alignDefaultRB->setText(alignDefaultLabel_);
|
alignDefaultRB->setText(alignDefaultLabel_);
|
||||||
else
|
else
|
||||||
alignDefaultRB->setText(alignDefaultLabel_ + " ("
|
alignDefaultRB->setText(alignDefaultLabel_ + " ("
|
||||||
+ labelMap_[alignDefault()] + ")");
|
+ labelMap_[bufferview()->cursor().innerParagraph().getDefaultAlign(buffer().params())] + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -372,12 +372,6 @@ LyXAlignment GuiParagraph::alignPossible() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXAlignment GuiParagraph::alignDefault() const
|
|
||||||
{
|
|
||||||
return bufferview()->cursor().innerParagraph().layout().align;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool GuiParagraph::hasLabelwidth() const
|
bool GuiParagraph::hasLabelwidth() const
|
||||||
{
|
{
|
||||||
Layout layout = bufferview()->cursor().innerParagraph().layout();
|
Layout layout = bufferview()->cursor().innerParagraph().layout();
|
||||||
|
@ -60,8 +60,6 @@ private:
|
|||||||
bool hasLabelwidth() const;
|
bool hasLabelwidth() const;
|
||||||
///
|
///
|
||||||
LyXAlignment alignPossible() const;
|
LyXAlignment alignPossible() const;
|
||||||
///
|
|
||||||
LyXAlignment alignDefault() const;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
///
|
///
|
||||||
|
@ -1402,20 +1402,20 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
&& !text.inset().getLayout().parbreakIgnored()
|
&& !text.inset().getLayout().parbreakIgnored()
|
||||||
&& style.latextype != LATEX_ITEM_ENVIRONMENT
|
&& style.latextype != LATEX_ITEM_ENVIRONMENT
|
||||||
&& style.latextype != LATEX_LIST_ENVIRONMENT
|
&& style.latextype != LATEX_LIST_ENVIRONMENT
|
||||||
&& style.align == par.getAlign()
|
&& style.align == par.getAlign(bparams)
|
||||||
&& nextpar->getDepth() == par.getDepth()
|
&& nextpar->getDepth() == par.getDepth()
|
||||||
&& nextpar->getAlign() == par.getAlign())
|
&& nextpar->getAlign(bparams) == par.getAlign(bparams))
|
||||||
|| (!next_layout.isEnvironment()
|
|| (!next_layout.isEnvironment()
|
||||||
&& nextpar->getDepth() > par.getDepth()
|
&& nextpar->getDepth() > par.getDepth()
|
||||||
&& nextpar->getAlign() == next_layout.align)
|
&& nextpar->getAlign(bparams) == next_layout.align)
|
||||||
|| (!style.isEnvironment()
|
|| (!style.isEnvironment()
|
||||||
&& next_layout.latextype == LATEX_ENVIRONMENT
|
&& next_layout.latextype == LATEX_ENVIRONMENT
|
||||||
&& nextpar->getDepth() < par.getDepth())
|
&& nextpar->getDepth() < par.getDepth())
|
||||||
|| (style.isCommand()
|
|| (style.isCommand()
|
||||||
&& !next_layout.isEnvironment()
|
&& !next_layout.isEnvironment()
|
||||||
&& style.align == par.getAlign()
|
&& style.align == par.getAlign(bparams)
|
||||||
&& next_layout.align == nextpar->getAlign())
|
&& next_layout.align == nextpar->getAlign(bparams))
|
||||||
|| (style.align != par.getAlign()
|
|| (style.align != par.getAlign(bparams)
|
||||||
&& tclass.isDefaultLayout(next_layout))) {
|
&& tclass.isDefaultLayout(next_layout))) {
|
||||||
os << '\n';
|
os << '\n';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user