]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetLayout.cpp
Introduce a RefPrefix tag for Style, InsetLayout, and Float, that
[features.git] / src / insets / InsetLayout.cpp
index b48a0625f51a7846f1e9472b5a07053f5b913a93..3aba74eef0a0d844af6d5e795b6e1fd0bdf7c57e 100644 (file)
@@ -31,13 +31,13 @@ namespace lyx {
 
 InsetLayout::InsetLayout() :
        name_(from_ascii("undefined")), lyxtype_(STANDARD),
-       labelstring_(from_ascii("UNDEFINED")), decoration_(DEFAULT),
-       latextype_(NOLATEXTYPE), font_(sane_font), 
+       labelstring_(from_ascii("UNDEFINED")), contentaslabel_(false),
+       decoration_(DEFAULT), latextype_(NOLATEXTYPE), font_(sane_font), 
        labelfont_(sane_font), bgcolor_(Color_error), 
        htmlforcecss_ (false), htmlisblock_(true),
-       multipar_(false), custompars_(true), forceplain_(false), 
+       multipar_(true), custompars_(true), forceplain_(false), 
        passthru_(false), needprotect_(false), freespacing_(false), 
-       keepempty_(false), forceltr_(false), intoc_(false)
+       keepempty_(false), forceltr_(false), intoc_(false), spellcheck_(true)
 { 
        labelfont_.setColor(Color_error);
 }
@@ -74,6 +74,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
 {
        enum {
                IL_BGCOLOR,
+               IL_CONTENTASLABEL,
                IL_COPYSTYLE,
                IL_COUNTER,
                IL_CUSTOMPARS,
@@ -104,12 +105,15 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_PASSTHRU,
                IL_PREAMBLE,
                IL_REQUIRES,
+               IL_SPELLCHECK,
+               IL_REFPREFIX,
                IL_END
        };
 
 
        LexerKeyword elementTags[] = {
                { "bgcolor", IL_BGCOLOR },
+               { "contentaslabel", IL_CONTENTASLABEL },
                { "copystyle", IL_COPYSTYLE }, 
                { "counter", IL_COUNTER},
                { "custompars", IL_CUSTOMPARS },
@@ -140,7 +144,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "needprotect", IL_NEEDPROTECT },
                { "passthru", IL_PASSTHRU },
                { "preamble", IL_PREAMBLE },
-               { "requires", IL_REQUIRES }
+               { "refprefix", IL_REFPREFIX },
+               { "requires", IL_REQUIRES },
+               { "spellcheck", IL_SPELLCHECK }
        };
 
        lex.pushTable(elementTags);
@@ -174,6 +180,8 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                        lyxtype_ = translateLyXType(lt);
                        if (lyxtype_  == NOLYXTYPE)
                                LYXERR0("Unknown LyXType `" << lt << "'.");
+                       if (lyxtype_ == CHARSTYLE)
+                               multipar_ = false;
                        break;
                }
                case IL_LATEXTYPE:  {
@@ -240,6 +248,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                case IL_NEEDPROTECT:
                        lex >> needprotect_;
                        break;
+               case IL_CONTENTASLABEL:
+                       lex >> contentaslabel_;
+                       break;
                case IL_COPYSTYLE: {     // initialize with a known style
                        docstring style;
                        lex >> style;
@@ -281,6 +292,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                case IL_PREAMBLE:
                        preamble_ = from_utf8(lex.getLongString("EndPreamble"));
                        break;
+               case IL_REFPREFIX:
+                       lex >> refprefix_;
+                       break;
                case IL_HTMLTAG:
                        lex >> htmltag_;
                        break;
@@ -315,6 +329,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                        requires_.insert(req.begin(), req.end());
                        break;
                }
+               case IL_SPELLCHECK:
+                       lex >> spellcheck_;
+                       break;
                case IL_END:
                        getout = true;
                        break;
@@ -354,7 +371,7 @@ InsetLayout::InsetLyXType translateLyXType(std::string const & str)
 string const & InsetLayout::htmltag() const
 {
        if (htmltag_.empty())
-               htmltag_ = "span";
+               htmltag_ = multipar_ ? "div" : "span";
        return htmltag_; 
 }
 
@@ -406,16 +423,6 @@ void InsetLayout::makeDefaultCSS() const
                htmldefaultstyle_ = 
                                from_ascii(htmltag() + "." + defaultCSSClass() + " {\n") +
                                mainfontCSS + from_ascii("\n}\n");
-       /* 
-       At present, we do not have default tags, etc, for the label.
-       if (labelfont_ == font_)
-                       return;
-       docstring const labelfontCSS = labelfont_.asCSS();
-       if (!labelfontCSS.empty())
-               htmldefaultstyle_ +=
-                       from_ascii(htmllabeltag() + "." + defaultCSSLabelClass() + " {\n") +
-                       labelfontCSS + from_ascii("\n}\n");
-       */
 }