mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Use Paragraph::getAlign in TextMetrics
This avoids some duplicate code. Note that the return value of Paragraph::getAlign had to be changed. I suspect it was set to char to avoid reading one header file in Paragraph.h.
This commit is contained in:
parent
1f352b390c
commit
000832f9d9
@ -1948,7 +1948,7 @@ depth_type Paragraph::getMaxDepthAfter() const
|
||||
}
|
||||
|
||||
|
||||
char Paragraph::getAlign() const
|
||||
LyXAlignment Paragraph::getAlign() const
|
||||
{
|
||||
if (d->params_.align() == LYX_ALIGN_LAYOUT)
|
||||
return d->layout_->align;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define PARAGRAPH_H
|
||||
|
||||
#include "FontEnums.h"
|
||||
#include "LayoutEnums.h"
|
||||
#include "SpellChecker.h"
|
||||
|
||||
#include "support/strfwd.h"
|
||||
@ -309,7 +310,7 @@ public:
|
||||
/// Set label width string.
|
||||
void setLabelWidthString(docstring const & s);
|
||||
/// Actual paragraph alignment used
|
||||
char getAlign() const;
|
||||
LyXAlignment getAlign() const;
|
||||
/// The nesting depth of a paragraph
|
||||
depth_type getDepth() const;
|
||||
/// The maximal possible depth of a paragraph after this one
|
||||
|
@ -514,13 +514,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
||||
|
||||
LyXAlignment TextMetrics::getAlign(Paragraph const & par, Row const & row) const
|
||||
{
|
||||
Layout const & layout = par.layout();
|
||||
|
||||
LyXAlignment align;
|
||||
if (par.params().align() == LYX_ALIGN_LAYOUT)
|
||||
align = layout.align;
|
||||
else
|
||||
align = par.params().align();
|
||||
LyXAlignment align = par.getAlign();
|
||||
|
||||
// handle alignment inside tabular cells
|
||||
Inset const & owner = text_->inset();
|
||||
@ -1788,12 +1782,7 @@ int TextMetrics::leftMargin(int max_width,
|
||||
if (!par.params().leftIndent().zero())
|
||||
l_margin += par.params().leftIndent().inPixels(max_width, lfm.em());
|
||||
|
||||
LyXAlignment align;
|
||||
|
||||
if (par.params().align() == LYX_ALIGN_LAYOUT)
|
||||
align = layout.align;
|
||||
else
|
||||
align = par.params().align();
|
||||
LyXAlignment align = par.getAlign();
|
||||
|
||||
// set the correct parindent
|
||||
if (pos == 0
|
||||
|
Loading…
Reference in New Issue
Block a user