// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
//
void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
- Paragraph * endpar, TexRow & texrow) const
+ Paragraph * endpar, TexRow & texrow) const
{
bool was_title = false;
bool already_title = false;
// if only_body
while (par != endpar) {
- LyXLayout const & layout =
- textclasslist.Style(params.textclass,
- par->layout);
+ Inset * in = par->inInset();
+ // well we have to check if we are in an inset with unlimited
+ // lenght (all in one row) if that is true then we don't allow
+ // any special options in the paragraph and also we don't allow
+ // any environment other then "Standard" to be valid!
+ if ((in == 0) || !in->forceDefaultParagraphs(in)) {
+ LyXLayout const & layout =
+ textclasslist.Style(params.textclass, par->layout);
if (layout.intitle) {
- if (already_title) {
- lyxerr <<"Error in latexParagraphs: You"
- " should not mix title layouts"
- " with normal ones." << endl;
- } else
- was_title = true;
+ if (already_title) {
+ lyxerr <<"Error in latexParagraphs: You"
+ " should not mix title layouts"
+ " with normal ones." << endl;
+ } else
+ was_title = true;
} else if (was_title && !already_title) {
- ofs << "\\maketitle\n";
- texrow.newline();
- already_title = true;
- was_title = false;
- }
-
- if (layout.isEnvironment()) {
- par = par->TeXEnvironment(this, params, ofs, texrow);
+ ofs << "\\maketitle\n";
+ texrow.newline();
+ already_title = true;
+ was_title = false;
+ }
+
+ if (layout.isEnvironment()) {
+ par = par->TeXEnvironment(this, params, ofs, texrow);
+ } else {
+ par = par->TeXOnePar(this, params, ofs, texrow, false);
+ }
} else {
par = par->TeXOnePar(this, params, ofs, texrow, false);
}
Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
- BufferParams const & bparams,
- ostream & os, TexRow & texrow,
- bool moving_arg)
+ BufferParams const & bparams,
+ ostream & os, TexRow & texrow,
+ bool moving_arg)
{
lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
- LyXLayout const & style =
- textclasslist.Style(bparams.textclass,
- layout);
-
+ Inset const * in = inInset();
bool further_blank_line = false;
+ LyXLayout style;
+
+ // well we have to check if we are in an inset with unlimited
+ // lenght (all in one row) if that is true then we don't allow
+ // any special options in the paragraph and also we don't allow
+ // any environment other then "Standard" to be valid!
+ if ((in == 0) || !in->forceDefaultParagraphs(in)) {
+ style = textclasslist.Style(bparams.textclass, layout);
+
+ if (params().startOfAppendix()) {
+ os << "\\appendix\n";
+ texrow.newline();
+ }
- if (params().startOfAppendix()) {
- os << "\\appendix\n";
- texrow.newline();
- }
-
- if (!params().spacing().isDefault()
- && (!previous() || !previous()->hasSameLayout(this))) {
- os << params().spacing().writeEnvirBegin() << "\n";
- texrow.newline();
- }
+ if (!params().spacing().isDefault()
+ && (!previous() || !previous()->hasSameLayout(this))) {
+ os << params().spacing().writeEnvirBegin() << "\n";
+ texrow.newline();
+ }
- if (tex_code_break_column && style.isCommand()){
- os << '\n';
- texrow.newline();
- }
+ if (tex_code_break_column && style.isCommand()){
+ os << '\n';
+ texrow.newline();
+ }
- if (params().pagebreakTop()) {
- os << "\\newpage";
- further_blank_line = true;
- }
- if (params().spaceTop().kind() != VSpace::NONE) {
- os << params().spaceTop().asLatexCommand(bparams);
- further_blank_line = true;
- }
+ if (params().pagebreakTop()) {
+ os << "\\newpage";
+ further_blank_line = true;
+ }
+ if (params().spaceTop().kind() != VSpace::NONE) {
+ os << params().spaceTop().asLatexCommand(bparams);
+ further_blank_line = true;
+ }
- if (params().lineTop()) {
- os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}'
- << "\\vspace{-1\\parskip}";
- further_blank_line = true;
- }
+ if (params().lineTop()) {
+ os << "\\lyxline{\\" << getFont(bparams, 0).latexSize() << '}'
+ << "\\vspace{-1\\parskip}";
+ further_blank_line = true;
+ }
- if (further_blank_line){
- os << '\n';
- texrow.newline();
+ if (further_blank_line){
+ os << '\n';
+ texrow.newline();
+ }
+ } else {
+ style = textclasslist.Style(bparams.textclass, 0);
}
Language const * language = getParLanguage(bparams);
if (language->babel() != previous_language->babel()
// check if we already put language command in TeXEnvironment()
- && !(textclasslist.Style(bparams.textclass, layout).isEnvironment()
- && (!previous() || previous()->layout != layout ||
- previous()->params().depth() != params().depth()))) {
-
+ && !(style.isEnvironment()
+ && (!previous() || previous()->layout != layout ||
+ previous()->params().depth() != params().depth())))
+ {
if (!lyxrc.language_command_end.empty() &&
- previous_language->babel() != doc_language->babel()) {
+ previous_language->babel() != doc_language->babel())
+ {
os << subst(lyxrc.language_command_end, "$$lang",
- previous_language->babel())
+ previous_language->babel())
<< endl;
texrow.newline();
}
if (lyxrc.language_command_end.empty() ||
- language->babel() != doc_language->babel()) {
+ language->babel() != doc_language->babel())
+ {
os << subst(lyxrc.language_command_begin, "$$lang",
- language->babel())
+ language->babel())
<< endl;
texrow.newline();
}
// or for a command.
LyXFont const font =
(size() == 0
- ? getLayoutFont(bparams)
- : getFont(bparams, size() - 1));
+ ? getLayoutFont(bparams) : getFont(bparams, size() - 1));
- bool is_command = textclasslist.Style(bparams.textclass,
- getLayout()).isCommand();
+ bool is_command = style.isCommand();
+
if (style.resfont.size() != font.size() && next_ && !is_command) {
if (!need_par)
os << "{";
}
}
- further_blank_line = false;
- if (params().lineBottom()) {
- os << "\\lyxline{\\" << font.latexSize() << '}';
- further_blank_line = true;
- }
+ if ((in == 0) || !in->forceDefaultParagraphs(in)) {
+ further_blank_line = false;
+ if (params().lineBottom()) {
+ os << "\\lyxline{\\" << font.latexSize() << '}';
+ further_blank_line = true;
+ }
- if (params().spaceBottom().kind() != VSpace::NONE) {
- os << params().spaceBottom().asLatexCommand(bparams);
- further_blank_line = true;
- }
+ if (params().spaceBottom().kind() != VSpace::NONE) {
+ os << params().spaceBottom().asLatexCommand(bparams);
+ further_blank_line = true;
+ }
- if (params().pagebreakBottom()) {
- os << "\\newpage";
- further_blank_line = true;
- }
+ if (params().pagebreakBottom()) {
+ os << "\\newpage";
+ further_blank_line = true;
+ }
- if (further_blank_line){
- os << '\n';
- texrow.newline();
- }
+ if (further_blank_line){
+ os << '\n';
+ texrow.newline();
+ }
- if (!params().spacing().isDefault()
- && (!next_ || !next_->hasSameLayout(this))) {
- os << params().spacing().writeEnvirEnd() << "\n";
- texrow.newline();
+ if (!params().spacing().isDefault()
+ && (!next_ || !next_->hasSameLayout(this))) {
+ os << params().spacing().writeEnvirEnd() << "\n";
+ texrow.newline();
+ }
}
// we don't need it for the last paragraph!!!
// This one spits out the text of the paragraph
bool Paragraph::simpleTeXOnePar(Buffer const * buf,
- BufferParams const & bparams,
- ostream & os, TexRow & texrow,
- bool moving_arg)
+ BufferParams const & bparams,
+ ostream & os, TexRow & texrow,
+ bool moving_arg)
{
lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
bool return_value = false;
- LyXLayout const & style =
- textclasslist.Style(bparams.textclass,
- getLayout());
+ LyXLayout style;
+
+ // well we have to check if we are in an inset with unlimited
+ // lenght (all in one row) if that is true then we don't allow
+ // any special options in the paragraph and also we don't allow
+ // any environment other then "Standard" to be valid!
+ bool asdefault =
+ (inInset() && inInset()->forceDefaultParagraphs(inInset()));
+
+ if (asdefault) {
+ style = textclasslist.Style(bparams.textclass, 0);
+ } else {
+ style = textclasslist.Style(bparams.textclass, layout);
+ }
+
LyXFont basefont;
// Maybe we have to create a optional argument.
++column;
}
- if (params().noindent()) {
- os << "\\noindent ";
- column += 10;
- }
- switch (params().align()) {
- case LYX_ALIGN_NONE:
- case LYX_ALIGN_BLOCK:
- case LYX_ALIGN_LAYOUT:
- case LYX_ALIGN_SPECIAL:
- break;
- case LYX_ALIGN_LEFT:
- if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\begin{flushleft}";
- column += 17;
- } else {
- os << "\\begin{flushright}";
- column += 18;
+ if (!asdefault) {
+ if (params().noindent()) {
+ os << "\\noindent ";
+ column += 10;
}
- break;
- case LYX_ALIGN_RIGHT:
- if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\begin{flushright}";
- column += 18;
- } else {
- os << "\\begin{flushleft}";
- column += 17;
+
+ switch (params().align()) {
+ case LYX_ALIGN_NONE:
+ case LYX_ALIGN_BLOCK:
+ case LYX_ALIGN_LAYOUT:
+ case LYX_ALIGN_SPECIAL:
+ break;
+ case LYX_ALIGN_LEFT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\begin{flushleft}";
+ column += 17;
+ } else {
+ os << "\\begin{flushright}";
+ column += 18;
+ }
+ break;
+ case LYX_ALIGN_RIGHT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\begin{flushright}";
+ column += 18;
+ } else {
+ os << "\\begin{flushleft}";
+ column += 17;
+ }
+ break;
+ case LYX_ALIGN_CENTER:
+ os << "\\begin{center}";
+ column += 14;
+ break;
}
- break;
- case LYX_ALIGN_CENTER:
- os << "\\begin{center}";
- column += 14;
- break;
- }
+ }
}
value_type c = getChar(i);
return_value = false;
}
- switch (params().align()) {
- case LYX_ALIGN_NONE:
- case LYX_ALIGN_BLOCK:
- case LYX_ALIGN_LAYOUT:
- case LYX_ALIGN_SPECIAL:
- break;
- case LYX_ALIGN_LEFT:
- if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\end{flushleft}";
- column+= 15;
- } else {
- os << "\\end{flushright}";
- column+= 16;
- }
- break;
- case LYX_ALIGN_RIGHT:
- if (getParLanguage(bparams)->babel() != "hebrew") {
- os << "\\end{flushright}";
- column+= 16;
- } else {
- os << "\\end{flushleft}";
- column+= 15;
+ if (!asdefault) {
+ switch (params().align()) {
+ case LYX_ALIGN_NONE:
+ case LYX_ALIGN_BLOCK:
+ case LYX_ALIGN_LAYOUT:
+ case LYX_ALIGN_SPECIAL:
+ break;
+ case LYX_ALIGN_LEFT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\end{flushleft}";
+ column+= 15;
+ } else {
+ os << "\\end{flushright}";
+ column+= 16;
+ }
+ break;
+ case LYX_ALIGN_RIGHT:
+ if (getParLanguage(bparams)->babel() != "hebrew") {
+ os << "\\end{flushright}";
+ column+= 16;
+ } else {
+ os << "\\end{flushleft}";
+ column+= 15;
+ }
+ break;
+ case LYX_ALIGN_CENTER:
+ os << "\\end{center}";
+ column+= 12;
+ break;
}
- break;
- case LYX_ALIGN_CENTER:
- os << "\\end{center}";
- column+= 12;
- break;
- }
+ }
lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
return return_value;