X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbuffer.C;h=77851ce8d3005b65e76321a391f650b7942c388d;hb=9dafe9b9a5cb12e19e0f3a1a9669d81dc140b0e3;hp=3e6a4e3a2b11cf6e0d61de0627490985655117af;hpb=f09619a7e8808cd083a980a4ca13dd64f330b054;p=lyx.git
diff --git a/src/buffer.C b/src/buffer.C
index 3e6a4e3a2b..77851ce8d3 100644
--- a/src/buffer.C
+++ b/src/buffer.C
@@ -66,7 +66,6 @@
#include "insets/insettoc.h"
#include "insets/insetparent.h"
#include "insets/insetspecialchar.h"
-#include "insets/figinset.h"
#include "insets/insettext.h"
#include "insets/insetert.h"
#include "insets/insetgraphics.h"
@@ -89,7 +88,6 @@
#include "support/filetools.h"
#include "support/path.h"
#include "support/os.h"
-#include "support/syscall.h"
#include "support/lyxlib.h"
#include "support/FileInfo.h"
#include "support/lyxmanip.h"
@@ -300,7 +298,9 @@ std::stack ert_stack;
ErtComp ert_comp;
#endif
+#ifdef WITH_WARNINGS
#warning And _why_ is this here? (Lgb)
+#endif
int unknown_layouts;
int unknown_tokens;
@@ -407,7 +407,7 @@ void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive)
if (!ert_comp.contents.empty()) {
lyxerr[Debug::INSETS] << "ERT contents:\n'"
<< ert_comp.contents << "'" << endl;
- Inset * inset = new InsetERT(ert_comp.contents, true);
+ Inset * inset = new InsetERT(params.language, ert_comp.contents, true);
par->insertInset(pos++, inset, ert_comp.font);
ert_comp.contents.erase();
}
@@ -1041,10 +1041,16 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
}
} else if (token == "\\added_space_top") {
lex.nextToken();
- par->params().spaceTop(VSpace(lex.getString()));
+ VSpace value = VSpace(lex.getString());
+ if ((value.length().len().value() != 0) ||
+ (value.kind() != VSpace::LENGTH))
+ par->params().spaceTop(value);
} else if (token == "\\added_space_bottom") {
lex.nextToken();
- par->params().spaceBottom(VSpace(lex.getString()));
+ VSpace value = VSpace(lex.getString());
+ if ((value.length().len().value() != 0) ||
+ (value.kind() != VSpace::LENGTH))
+ par->params().spaceBottom(value);
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
} else if (token == "\\pextra_type") {
@@ -1525,7 +1531,7 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
} else if (tmptok == "Note") {
inset = new InsetNote;
} else if (tmptok == "Include") {
- InsetCommandParams p( "Include" );
+ InsetCommandParams p("Include");
inset = new InsetInclude(p, *this);
} else if (tmptok == "ERT") {
inset = new InsetERT;
@@ -2081,7 +2087,7 @@ void Buffer::makeLaTeXFile(string const & fname,
// original_path is set. This is done for usual tex-file, but not
// for nice-latex-file. (Matthias 250696)
if (!only_body) {
- if (!nice){
+ if (!nice) {
// code for usual, NOT nice-latex-file
ofs << "\\batchmode\n"; // changed
// from \nonstopmode
@@ -2180,7 +2186,7 @@ void Buffer::makeLaTeXFile(string const & fname,
}
string strOptions(options.str().c_str());
- if (!strOptions.empty()){
+ if (!strOptions.empty()) {
strOptions = strip(strOptions, ',');
ofs << '[' << strOptions << ']';
}
@@ -2687,7 +2693,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
if (par->isInset(0)) {
Inset * inset = par->getInset(0);
Inset::Code lyx_code = inset->lyxCode();
- if (lyx_code == Inset::TOC_CODE){
+ if (lyx_code == Inset::TOC_CODE) {
string const temp = "toc";
sgmlOpenTag(ofs, depth, temp);
@@ -2723,7 +2729,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
_("Error : Wrong depth for"
" LatexType Command.\n"));
- if (!environment_stack[depth].empty()){
+ if (!environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth,
environment_stack[depth]);
ofs << "
";
@@ -2856,7 +2862,7 @@ void operator|=(PAR_TAG & p1, PAR_TAG const & p2)
inline
void reset(PAR_TAG & p1, PAR_TAG const & p2)
{
- p1 = static_cast( p1 & ~p2);
+ p1 = static_cast(p1 & ~p2);
}
} // namespace anon
@@ -2981,7 +2987,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
}
list < PAR_TAG > temp;
- while (!tag_state.empty() && tag_close ) {
+ while (!tag_state.empty() && tag_close) {
PAR_TAG k = tag_state.top();
tag_state.pop();
os << "" << tag_name(k) << ">";
@@ -3222,7 +3228,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (par->isInset(0)) {
Inset * inset = par->getInset(0);
Inset::Code lyx_code = inset->lyxCode();
- if (lyx_code == Inset::LABEL_CODE){
+ if (lyx_code == Inset::LABEL_CODE) {
command_name += " id=\"";
command_name += (static_cast(inset))->getContents();
command_name += "\"";
@@ -3246,7 +3252,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
}
if (environment_stack[depth] != style.latexname()) {
- if(environment_stack.size() == depth + 1) {
+ if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --");
}
@@ -3269,7 +3275,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) {
- if(style.latexparam() == "CDATA")
+ if (style.latexparam() == "CDATA")
ofs << "";
else
sgmlCloseTag(ofs, depth + command_depth,
@@ -3393,18 +3399,23 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (font.emph() == LyXFont::ON) {
os << "";
emph_flag = true;
- }else if(i) {
+ } else if (i) {
os << "";
emph_flag = false;
}
}
- if ( par->isInset(i) ) {
+ if (par->isInset(i)) {
Inset * inset = par->getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label)
- if ( i || desc_on != 3)
+ if ( i || desc_on != 3) {
+ if(style.latexparam() == "CDATA")
+ os << "]]>";
inset->docbook(this, os);
+ if(style.latexparam() == "CDATA")
+ os << "getChar(i);
string sgml_string;
@@ -3412,7 +3423,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (style.pass_thru) {
os << c;
- } else if(style.free_spacing || par->isFreeSpacing() || c != ' ') {
+ } else if (style.free_spacing || par->isFreeSpacing() || c != ' ') {
os << sgml_string;
} else if (desc_on ==1) {
++char_line_count;
@@ -3434,7 +3445,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// not closed...
os << "";
}
- if(style.free_spacing) os << '\n';
+ if (style.free_spacing) os << '\n';
}
@@ -3479,7 +3490,7 @@ int Buffer::runChktex()
// if we removed error insets before we ran chktex or if we inserted
// error insets after we ran chktex, this must be run:
- if (removedErrorInsets || res){
+ if (removedErrorInsets || res) {
users->redraw();
users->fitCursor();
}