]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Fix functions that used functions but did not defined it
[lyx.git] / src / TextClass.cpp
index 4054b98fd4d0b49e2038c0eb27792a80793796bf..b9c75259b4acc940192a66df2f6e45da48f75a2e 100644 (file)
@@ -22,7 +22,6 @@
 #include "FloatList.h"
 #include "Layout.h"
 #include "LayoutFile.h"
-#include "Lexer.h"
 #include "ModuleList.h"
 
 #include "frontends/alert.h"
@@ -32,6 +31,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
+#include "support/Lexer.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 #include "support/TempFile.h"
@@ -59,7 +59,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 92; // spitz: ProvideInsetLayout and ModifyInsetLayout
+int const LAYOUT_FORMAT = 105; // spitz: ParskipHalf and ParskipFull class options
 
 
 // Layout format for the current lyx file format. Controls which format is
@@ -135,8 +135,8 @@ TextClass::TextClass()
          opt_enginetype_("authoryear|numerical"), opt_fontsize_("10|11|12"),
          opt_pagesize_("default|a4|a5|b5|letter|legal|executive"),
          opt_pagestyle_("empty|plain|headings|fancy"), fontsize_format_("$$spt"), pagesize_("default"),
-         pagesize_format_("$$spaper"), pagestyle_("default"), tablestyle_("default"),
-         docbookroot_("article"), docbookforceabstract_(false),
+         pagesize_format_("$$spaper"), pagestyle_("default"), parskip_full_(""), parskip_half_(""),
+         tablestyle_("default"), docbookroot_("article"), docbookforceabstract_(false),
          columns_(1), sides_(OneSide), secnumdepth_(3), tocdepth_(3), outputType_(LATEX),
          outputFormat_("latex"), has_output_format_(false), defaultfont_(sane_font), 
          titletype_(TITLE_COMMAND_AFTER), titlename_("maketitle"),
@@ -691,9 +691,9 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
                case TC_PKGOPTS : {
                        lexrc.next();
                        string const pkg = lexrc.getString();
-                       lexrc.next();
+                       lexrc.eatLine();
                        string const options = lexrc.getString();
-                       package_options_[pkg] = options;
+                       package_options_[pkg] = trim(options, "\"");
                        break;
                }
 
@@ -894,7 +894,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
                        error = !readOutlinerName(lexrc);
                        break;
 
-        case TC_TABLESTYLE:
+               case TC_TABLESTYLE:
                        lexrc.next();
                        tablestyle_ = rtrim(lexrc.getString());
                        break;
@@ -1027,6 +1027,8 @@ void TextClass::readClassOptions(Lexer & lexrc)
                CO_PAGESIZE,
                CO_PAGESIZE_FORMAT,
                CO_PAGESTYLE,
+               CO_PARSKIP_FULL,
+               CO_PARSKIP_HALF,
                CO_OTHER,
                CO_END
        };
@@ -1038,7 +1040,9 @@ void TextClass::readClassOptions(Lexer & lexrc)
                {"other",     CO_OTHER },
                {"pagesize",  CO_PAGESIZE },
                {"pagesizeformat", CO_PAGESIZE_FORMAT },
-               {"pagestyle", CO_PAGESTYLE }
+               {"pagestyle", CO_PAGESTYLE },
+               {"parskipfull", CO_PARSKIP_FULL },
+               {"parskiphalf", CO_PARSKIP_HALF }
        };
 
        lexrc.pushTable(classOptionsTags);
@@ -1073,6 +1077,14 @@ void TextClass::readClassOptions(Lexer & lexrc)
                        lexrc.next();
                        opt_pagestyle_ = rtrim(lexrc.getString());
                        break;
+               case CO_PARSKIP_FULL:
+                       lexrc.next();
+                       parskip_full_ = rtrim(lexrc.getString());
+                       break;
+               case CO_PARSKIP_HALF:
+                       lexrc.next();
+                       parskip_half_ = rtrim(lexrc.getString());
+                       break;
                case CO_OTHER:
                        lexrc.next();
                        if (options_.empty())
@@ -1402,14 +1414,17 @@ bool TextClass::readFloat(Lexer & lexrc)
                FT_HTMLATTR,
                FT_HTMLTAG,
                FT_DOCBOOKATTR,
+               FT_DOCBOOKFLOATTYPE,
                FT_DOCBOOKTAG,
                FT_DOCBOOKTAGTYPE,
+               FT_DOCBOOKCAPTION,
                FT_LISTCOMMAND,
                FT_REFPREFIX,
                FT_ALLOWED_PLACEMENT,
                FT_ALLOWS_SIDEWAYS,
                FT_ALLOWS_WIDE,
                FT_REQUIRES,
+               FT_PRETTYFORMAT,
                FT_END
        };
 
@@ -1418,6 +1433,8 @@ bool TextClass::readFloat(Lexer & lexrc)
                { "allowssideways", FT_ALLOWS_SIDEWAYS },
                { "allowswide", FT_ALLOWS_WIDE },
                { "docbookattr", FT_DOCBOOKATTR },
+               { "docbookcaption", FT_DOCBOOKCAPTION },
+               { "docbookfloattype", FT_DOCBOOKFLOATTYPE },
                { "docbooktag", FT_DOCBOOKTAG },
                { "docbooktagtype", FT_DOCBOOKTAGTYPE },
                { "end", FT_END },
@@ -1431,6 +1448,7 @@ bool TextClass::readFloat(Lexer & lexrc)
                { "listname", FT_LISTNAME },
                { "numberwithin", FT_WITHIN },
                { "placement", FT_PLACEMENT },
+               { "prettyformat", FT_PRETTYFORMAT },
                { "refprefix", FT_REFPREFIX },
                { "requires", FT_REQUIRES },
                { "style", FT_STYLE },
@@ -1445,8 +1463,10 @@ bool TextClass::readFloat(Lexer & lexrc)
        docstring htmlstyle;
        string htmltag;
        string docbookattr;
+       string docbookcaption;
        string docbooktag;
        string docbooktagtype;
+       string docbookfloattype;
        string listname;
        string listcommand;
        string name;
@@ -1457,6 +1477,7 @@ bool TextClass::readFloat(Lexer & lexrc)
        string type;
        string within;
        string required;
+       docstring prettyformat;
        bool usesfloat = true;
        bool ispredefined = false;
        bool allowswide = true;
@@ -1560,10 +1581,18 @@ bool TextClass::readFloat(Lexer & lexrc)
                        lexrc.next();
                        htmltag = lexrc.getString();
                        break;
+               case FT_PRETTYFORMAT:
+                       lexrc.next();
+                       prettyformat = lexrc.getDocString();
+                       break;
                case FT_DOCBOOKATTR:
                        lexrc.next();
                        docbookattr = lexrc.getString();
                        break;
+               case FT_DOCBOOKCAPTION:
+                       lexrc.next();
+                       docbookcaption = lexrc.getString();
+                       break;
                case FT_DOCBOOKTAG:
                        lexrc.next();
                        docbooktag = lexrc.getString();
@@ -1572,9 +1601,16 @@ bool TextClass::readFloat(Lexer & lexrc)
                        lexrc.next();
                        docbooktagtype = lexrc.getString();
                        break;
+               case FT_DOCBOOKFLOATTYPE:
+                       lexrc.next();
+                       docbookfloattype = lexrc.getString();
+                       break;
                case FT_END:
                        getout = true;
                        break;
+               default:
+                       LYXERR0("Unhandled value " << le << " in TextClass::readFloat.");
+                       break;
                }
        }
 
@@ -1599,19 +1635,22 @@ bool TextClass::readFloat(Lexer & lexrc)
                }
                Floating fl(type, placement, ext, within, style, name,
                        listname, listcommand, refprefix, allowed_placement,
-                       htmltag, htmlattr, htmlstyle, docbookattr,
-                       docbooktagtype, required, usesfloat, ispredefined,
+                       htmltag, htmlattr, htmlstyle, docbooktag, docbookattr,
+                       docbooktagtype, docbookfloattype, docbookcaption,
+                       required, usesfloat, ispredefined,
                allowswide, allowssideways);
                floatlist_.newFloat(fl);
                // each float has its own counter
                counters_.newCounter(from_ascii(type), from_ascii(within),
                                docstring(), docstring(),
+                               prettyformat.empty() ? bformat(_("%1$s ##"), _(name)) : prettyformat,
                                bformat(_("%1$s (Float)"), _(name)));
                // also define sub-float counters
                docstring const subtype = "sub-" + from_ascii(type);
                counters_.newCounter(subtype, from_ascii(type),
                                "\\alph{" + subtype + "}", docstring(),
-                                bformat(_("Sub-%1$s (Float)"), _(name)));
+                               prettyformat.empty() ? bformat(_("Sub-%1$s ##"), _(name)) : prettyformat,
+                               bformat(_("Sub-%1$s (Float)"), _(name)));
        }
        return getout;
 }