]> git.lyx.org Git - lyx.git/blobdiff - src/Layout.h
LaTeXFeatures.cpp: "wrapfig" has to be loaded after "float"
[lyx.git] / src / Layout.h
index c30744f9263784f1fddfe656cd7e4e79ba8c2ef6..ee5905f141490de89a2050e5f765dfce626a3005 100644 (file)
@@ -15,7 +15,6 @@
 #define LYX_LAYOUT_H
 
 #include "Font.h"
-#include "layout.h"
 #include "Spacing.h"
 #include "support/docstring.h"
 
@@ -27,6 +26,153 @@ namespace lyx {
 class Lexer;
 class TextClass;
 
+
+/// The different output types
+enum OutputType {
+       ///
+       LATEX = 1,
+       ///
+       DOCBOOK,
+       ///
+       LITERATE
+};
+
+
+/// The different margin types
+enum LYX_MARGIN_TYPE {
+       ///
+       MARGIN_MANUAL = 1,
+       ///
+       MARGIN_FIRST_DYNAMIC,
+       ///
+       MARGIN_DYNAMIC,
+       ///
+       MARGIN_STATIC,
+       ///
+       MARGIN_RIGHT_ADDRESS_BOX
+};
+
+
+///
+enum LyXAlignment {
+       ///
+       LYX_ALIGN_NONE = 0,
+       ///
+       LYX_ALIGN_BLOCK = 1,
+       ///
+       LYX_ALIGN_LEFT = 2,
+       ///
+       LYX_ALIGN_RIGHT = 4,
+       ///
+       LYX_ALIGN_CENTER = 8,
+       ///
+       LYX_ALIGN_LAYOUT = 16,
+       ///
+       LYX_ALIGN_SPECIAL = 32
+};
+
+///
+inline
+void operator|=(LyXAlignment & la1, LyXAlignment la2) {
+       la1 = static_cast<LyXAlignment>(la1 | la2);
+}
+
+
+///
+inline
+LyXAlignment operator|(LyXAlignment la1, LyXAlignment la2) {
+       return static_cast<LyXAlignment>(static_cast<int>(la1) | static_cast<int>(la2));
+}
+
+
+/// The different LaTeX-Types
+enum LYX_LATEX_TYPES {
+       ///
+       LATEX_PARAGRAPH = 1,
+       ///
+       LATEX_COMMAND,
+       ///
+       LATEX_ENVIRONMENT,
+       ///
+       LATEX_ITEM_ENVIRONMENT,
+       ///
+       LATEX_BIB_ENVIRONMENT,
+       ///
+       LATEX_LIST_ENVIRONMENT
+};
+
+
+/// The different title types
+enum LYX_TITLE_LATEX_TYPES {
+       ///
+       TITLE_COMMAND_AFTER = 1,
+       ///
+       TITLE_ENVIRONMENT
+};
+
+
+/// The different label types
+enum LYX_LABEL_TYPES {
+       ///
+       LABEL_NO_LABEL,
+       ///
+       LABEL_MANUAL,
+       ///
+       LABEL_BIBLIO,
+       ///
+       LABEL_TOP_ENVIRONMENT,
+       ///
+       LABEL_CENTERED_TOP_ENVIRONMENT,
+
+       // the flushright labels following now must start with LABEL_STATIC
+       ///
+       LABEL_STATIC,
+       ///
+       LABEL_SENSITIVE,
+       ///
+       LABEL_COUNTER,
+       ///
+       LABEL_ENUMERATE,
+       ///
+       LABEL_ITEMIZE
+};
+
+
+///
+enum LYX_END_LABEL_TYPES {
+       ///
+       END_LABEL_NO_LABEL,
+       ///
+       END_LABEL_BOX,
+       ///
+       END_LABEL_FILLED_BOX,
+       ///
+       END_LABEL_STATIC,
+       ///
+       END_LABEL_ENUM_FIRST = END_LABEL_NO_LABEL,
+       ///
+       END_LABEL_ENUM_LAST = END_LABEL_STATIC
+};
+
+/* Fix labels are printed flushright, manual labels flushleft.
+ * MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
+ * MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
+ * This seems a funny restriction, but I think other combinations are
+ * not needed, so I will not change it yet.
+ * Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC
+ */
+
+
+/* There is a parindent and a parskip. Which one is used depends on the
+ * paragraph_separation-flag of the text-object.
+ * BUT: parindent is only thrown away, if a parskip is defined! So if you
+ * want a space between the paragraphs and a parindent at the same time,
+ * you should set parskip to zero and use topsep, parsep and bottomsep.
+ *
+ * The standard layout is an exception: its parindent is only set, if the
+ * previous paragraph is standard too. Well, this is LateX and it is good!
+ */
+
 ///
 class Layout {
 public:
@@ -49,19 +195,19 @@ public:
        ///
        void readSpacing(Lexer &);
        ///
-       std::string const & name() const;
+       docstring const & name() const;
        ///
-       void setName(std::string const & n);
+       void setName(docstring const & n);
        ///
-       std::string const & obsoleted_by() const;
+       docstring const & obsoleted_by() const;
        ///
-       std::string const & depends_on() const;
+       docstring const & depends_on() const;
        ///
        std::string const & latexname() const { return latexname_; }
        ///
-       lyx::docstring const & labelstring() const { return labelstring_; }
+       docstring const & labelstring() const { return labelstring_; }
        ///
-       lyx::docstring const & endlabelstring() const { return endlabelstring_; }
+       docstring const & endlabelstring() const { return endlabelstring_; }
        ///
        docstring const & preamble() const { return preamble_; }
        ///
@@ -73,7 +219,7 @@ public:
        ///
        std::string const & itemtag() const { return itemtag_; }
        ///
-       lyx::docstring const & labelstring_appendix() const {
+       docstring const & labelstring_appendix() const {
                return labelstring_appendix_;
        }
        /** Default font for this layout/environment.
@@ -104,15 +250,15 @@ public:
        Font reslabelfont;
 
        /// Text that dictates how wide the left margin is on the screen
-       std::string leftmargin;
+       docstring leftmargin;
        /// Text that dictates how wide the right margin is on the screen
-       std::string rightmargin;
+       docstring rightmargin;
        /// Text that dictates how much space to leave after a potential label
-       std::string labelsep;
+       docstring labelsep;
        /// Text that dictates how much space to leave before a potential label
-       std::string labelindent;
+       docstring labelindent;
        /// Text that dictates the width of the indentation of indented pars
-       std::string parindent;
+       docstring parindent;
        ///
        double parskip;
        ///
@@ -195,34 +341,39 @@ public:
        /// Does this layout allow for an optional parameter?
        int optionalargs;
        /// Which counter to step
-       lyx::docstring counter;
+       docstring counter;
        /// Depth of XML command
        int commanddepth;
 
+       /// Return a pointer on a new layout suitable to describe a caption.
+       /// FIXME: remove this eventually. This is only for tex2lyx
+       /// until it has proper support for the caption inset (JMarc)
+       static Layout * forCaption();
+
 private:
        /// Name of the layout/paragraph environment
-       std::string name_;
+       docstring name_;
 
        /** Name of an layout that has replaced this layout.
            This is used to rename a layout, while keeping backward
            compatibility
        */
-       std::string obsoleted_by_;
+       docstring obsoleted_by_;
 
        /** Name of an layout which preamble must come before this one
            This is used when the preamble snippet uses macros defined in
            another preamble
         */
-       std::string depends_on_;
+       docstring depends_on_;
 
        /// LaTeX name for environment
        std::string latexname_;
        /// Label string. "Abstract", "Reference", "Caption"...
-       lyx::docstring labelstring_;
+       docstring labelstring_;
        ///
-       lyx::docstring endlabelstring_;
+       docstring endlabelstring_;
        /// Label string inside appendix. "Appendix", ...
-       lyx::docstring labelstring_appendix_;
+       docstring labelstring_appendix_;
        /// LaTeX parameter for environment
        std::string latexparam_;
        /// Internal tag to use (e.g., <title></title> for sect header)