mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix right and left layout alignment (in workarea) with RTL
Fixes: #11606
(cherry picked from commit b6f0c1de3d
)
This commit is contained in:
parent
6afe258453
commit
2208f4f519
@ -2032,15 +2032,29 @@ depth_type Paragraph::getMaxDepthAfter() const
|
||||
}
|
||||
|
||||
|
||||
LyXAlignment Paragraph::getAlign() const
|
||||
LyXAlignment Paragraph::getAlign(BufferParams const & bparams) const
|
||||
{
|
||||
if (d->params_.align() == LYX_ALIGN_LAYOUT)
|
||||
return d->layout_->align;
|
||||
return getDefaultAlign(bparams);
|
||||
else
|
||||
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
|
||||
{
|
||||
return d->params_.labelString();
|
||||
|
@ -312,7 +312,9 @@ public:
|
||||
/// Set label width string.
|
||||
void setLabelWidthString(docstring const & s);
|
||||
/// 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
|
||||
depth_type getDepth() const;
|
||||
/// The maximal possible depth of a paragraph after this one
|
||||
|
@ -537,7 +537,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
||||
|
||||
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
|
||||
Inset const & owner = text_->inset();
|
||||
@ -1749,7 +1749,7 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
|
||||
if (!par.params().leftIndent().zero())
|
||||
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
|
||||
if (pos == 0
|
||||
|
@ -122,7 +122,7 @@ void GuiParagraph::checkAlignmentRadioButtons()
|
||||
alignDefaultRB->setText(alignDefaultLabel_);
|
||||
else
|
||||
alignDefaultRB->setText(alignDefaultLabel_ + " ("
|
||||
+ labelMap_[alignDefault()] + ")");
|
||||
+ labelMap_[bufferview()->cursor().innerParagraph().getDefaultAlign(buffer().params())] + ")");
|
||||
}
|
||||
|
||||
|
||||
@ -370,12 +370,6 @@ LyXAlignment GuiParagraph::alignPossible() const
|
||||
}
|
||||
|
||||
|
||||
LyXAlignment GuiParagraph::alignDefault() const
|
||||
{
|
||||
return bufferview()->cursor().innerParagraph().layout().align;
|
||||
}
|
||||
|
||||
|
||||
bool GuiParagraph::hasLabelwidth() const
|
||||
{
|
||||
Layout layout = bufferview()->cursor().innerParagraph().layout();
|
||||
|
@ -60,8 +60,6 @@ private:
|
||||
bool hasLabelwidth() const;
|
||||
///
|
||||
LyXAlignment alignPossible() const;
|
||||
///
|
||||
LyXAlignment alignDefault() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
|
@ -1328,20 +1328,20 @@ void TeXOnePar(Buffer const & buf,
|
||||
&& !text.inset().getLayout().parbreakIsNewline()
|
||||
&& style.latextype != LATEX_ITEM_ENVIRONMENT
|
||||
&& style.latextype != LATEX_LIST_ENVIRONMENT
|
||||
&& style.align == par.getAlign()
|
||||
&& style.align == par.getAlign(bparams)
|
||||
&& nextpar->getDepth() == par.getDepth()
|
||||
&& nextpar->getAlign() == par.getAlign())
|
||||
&& nextpar->getAlign(bparams) == par.getAlign(bparams))
|
||||
|| (!next_layout.isEnvironment()
|
||||
&& nextpar->getDepth() > par.getDepth()
|
||||
&& nextpar->getAlign() == next_layout.align)
|
||||
&& nextpar->getAlign(bparams) == next_layout.align)
|
||||
|| (!style.isEnvironment()
|
||||
&& next_layout.latextype == LATEX_ENVIRONMENT
|
||||
&& nextpar->getDepth() < par.getDepth())
|
||||
|| (style.isCommand()
|
||||
&& !next_layout.isEnvironment()
|
||||
&& style.align == par.getAlign()
|
||||
&& next_layout.align == nextpar->getAlign())
|
||||
|| (style.align != par.getAlign()
|
||||
&& style.align == par.getAlign(bparams)
|
||||
&& next_layout.align == nextpar->getAlign(bparams))
|
||||
|| (style.align != par.getAlign(bparams)
|
||||
&& tclass.isDefaultLayout(next_layout))) {
|
||||
os << '\n';
|
||||
}
|
||||
|
@ -90,6 +90,8 @@ What's new
|
||||
- Preserve "all authors" state when switching citation style via context
|
||||
menu (bug 11439).
|
||||
|
||||
- Fix right and left layout alignment (in workarea) with RTL (bug 11606).
|
||||
|
||||
|
||||
* INTERNALS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user