* and for detached paragraphs in "indented" documents.
*/
VSpace defskip;
+ HSpace math_indentation;
PDFOptions pdfoptions;
LayoutFileIndex baseClass_;
FormatList exportableFormatList;
}
+HSpace const & BufferParams::getMathIndentation() const
+{
+ return pimpl_->math_indentation;
+}
+
+
+void BufferParams::setMathIndentation(HSpace const & indent)
+{
+ pimpl_->math_indentation = indent;
+}
+
+
Length const & BufferParams::getParIndent() const
{
return pimpl_->parindent;
} else if (token == "\\is_math_indent") {
lex >> is_math_indent;
} else if (token == "\\math_indentation") {
- lex >> math_indentation;
+ lex.next();
+ string math_indentation = lex.getString();
+ pimpl_->math_indentation = HSpace(math_indentation);
} else if (token == "\\quotes_style") {
string qstyle;
lex >> qstyle;
else
os << "\n\\defskip " << getDefSkip().asLyXCommand();
os << "\n\\is_math_indent " << is_math_indent;
- if (is_math_indent && math_indentation != "default")
- os << "\n\\math_indentation " << math_indentation;
+ if (is_math_indent && getMathIndentation().asLyXCommand() != "default")
+ os << "\n\\math_indentation " << getMathIndentation().asLyXCommand();
os << "\n\\quotes_style "
<< string_quotes_style[quotes_style]
<< "\n\\dynamic_quotes " << dynamic_quotes
if (is_math_indent) {
// when formula indentation
// only output something when it is not the default
- if (math_indentation != "default") {
+ if (getMathIndentation().asLyXCommand() != "default") {
os << "\\setlength{\\mathindent}{"
- << from_utf8(math_indentation)
+ << from_utf8(getMathIndentation().asLatexCommand())
<< "}\n";
}
}
connect(textLayoutModule->MathIndentCB, SIGNAL(toggled(bool)),
this, SLOT(change_adaptor()));
- connect(textLayoutModule->MathIndentCB, SIGNAL(toggled(bool)),
- this, SLOT(allowMathIndent()));
connect(textLayoutModule->MathIndentCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
connect(textLayoutModule->MathIndentCO, SIGNAL(activated(int)),
setSkip(textLayoutModule->skipCO->currentIndex());
}
-void GuiDocument::allowMathIndent()
-{
- // only disable when not checked, checked does not always allow enabling
- if (!textLayoutModule->MathIndentCB->isChecked()) {
- textLayoutModule->MathIndentLE->setEnabled(false);
- textLayoutModule->MathIndentLengthCO->setEnabled(false);
- }
- if (textLayoutModule->MathIndentCB->isChecked()
- && textLayoutModule->MathIndentCO->currentIndex() == 1) {
- textLayoutModule->MathIndentLE->setEnabled(true);
- textLayoutModule->MathIndentLengthCO->setEnabled(true);
-
- }
- isValid();
-}
-
void GuiDocument::setMathIndent(int item)
{
bool const enable = (item == 1);
if (rb->isChecked())
bp_.use_package(it->first, BufferParams::package_off);
}
-
+ bp_.is_math_indent = textLayoutModule->MathIndentCB->isChecked();
+ // if math is indented
+ if (bp_.is_math_indent) {
+ HSpace MathIndentation = HSpace(
+ widgetsToLength(textLayoutModule->MathIndentLE,
+ textLayoutModule->MathIndentLengthCO)
+ );
+ bp_.setMathIndentation(MathIndentation);
+ }
+
// Page Layout
if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
bp_.pagestyle = "default";
}
}
- bp_.is_math_indent = textLayoutModule->MathIndentCB->isChecked();
- if (bp_.is_math_indent) {
- // if math is indented
+ if (textLayoutModule->MathIndentCB->isChecked()) {
+ // if formulas are indented
switch (textLayoutModule->MathIndentCO->currentIndex()) {
case 0:
- bp_.math_indentation = "default";
+ bp_.setMathIndentation(HSpace(HSpace::DEFAULT));
break;
- case 1:
- bp_.math_indentation = widgetsToLength(textLayoutModule->MathIndentLE,
- textLayoutModule->MathIndentLengthCO);
+ case 1: {
+ HSpace MathIndent = HSpace(
+ widgetsToLength(textLayoutModule->MathIndentLE,
+ textLayoutModule->MathIndentLengthCO)
+ );
+ bp_.setMathIndentation(MathIndent);
break;
+ }
default:
// this should never happen
- bp_.math_indentation = "default";
+ bp_.setMathIndentation(HSpace(HSpace::DEFAULT));
break;
}
- } else
- bp_.math_indentation = "default";
+ }
bp_.options =
fromqstr(latexModule->optionsLE->text());
// math
if (bp_.is_math_indent) {
textLayoutModule->MathIndentCB->setChecked(bp_.is_math_indent);
+ string MathIndentation = bp_.getMathIndentation().asLyXCommand();
int MathIndent = 0;
- if (bp_.math_indentation != "default") {
+ if (MathIndentation != "default") {
lengthToWidgets(textLayoutModule->MathIndentLE,
textLayoutModule->MathIndentLengthCO,
- bp_.math_indentation, default_unit);
+ MathIndentation, default_unit);
MathIndent = 1;
}
textLayoutModule->MathIndentCO->setCurrentIndex(MathIndent);