}
-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();
/// 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
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();
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
alignDefaultRB->setText(alignDefaultLabel_);
else
alignDefaultRB->setText(alignDefaultLabel_ + " ("
- + labelMap_[alignDefault()] + ")");
+ + labelMap_[bufferview()->cursor().innerParagraph().getDefaultAlign(buffer().params())] + ")");
}
}
-LyXAlignment GuiParagraph::alignDefault() const
-{
- return bufferview()->cursor().innerParagraph().layout().align;
-}
-
-
bool GuiParagraph::hasLabelwidth() const
{
Layout layout = bufferview()->cursor().innerParagraph().layout();
bool hasLabelwidth() const;
///
LyXAlignment alignPossible() const;
- ///
- LyXAlignment alignDefault() const;
private Q_SLOTS:
///
&& !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';
}
- 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