]> git.lyx.org Git - lyx.git/blobdiff - src/layout.h
Just some changes to be able to change TabularFeatures with the Table menu
[lyx.git] / src / layout.h
index 9096380633733b906888c2485c1e0841fae67a34..f29ebb2572af29ea635f69e9ea31c525f1da9386 100644 (file)
@@ -5,33 +5,43 @@
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team.
+ *           Copyright 1995-2000 The LyX Team.
  *
  * ====================================================== */
 
 #ifndef LAYOUT_H
 #define LAYOUT_H
 
+#include <vector>
+
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include <vector>
-using std::vector;
-using std::pair;
-
-#include "definitions.h"
 #include "lyxlex.h"
 #include "lyxfont.h"
 #include "Spacing.h"
 
+
 /// Reads the style files
 extern void LyXSetStyle();
 
+///
+enum { // no good name for this
+       ///
+        LYX_ENVIRONMENT_DEFAULT = 97,
+       ///
+       LYX_LAYOUT_DEFAULT = 99
+};
+// Could this cause confusion that both DUMMY_LAYOUT and  LAYOUT_DEFAULT has
+// the same value? (Lgb)
+///
+#define LYX_DUMMY_LAYOUT 99
+
 /// The different output types
 enum OutputType {
         ///
-        LATEX,
+        LATEX = 1,
        ///
        LINUXDOC,
        ///
@@ -43,7 +53,7 @@ enum OutputType {
 /// The different margin types
 enum LYX_MARGIN_TYPE {
        ///
-       MARGIN_MANUAL,
+       MARGIN_MANUAL = 1,
        ///
        MARGIN_FIRST_DYNAMIC,
        ///
@@ -54,6 +64,7 @@ enum LYX_MARGIN_TYPE {
        MARGIN_RIGHT_ADDRESS_BOX
 };
 
+
 ///
 enum LyXAlignment {
        ///
@@ -71,14 +82,17 @@ enum LyXAlignment {
        ///
         LYX_ALIGN_SPECIAL = 32
 };
-inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
+
+
+inline
+void operator|=(LyXAlignment & la1, LyXAlignment la2) {
        la1 = static_cast<LyXAlignment>(la1 | la2);
 }
 
 /// The different LaTeX-Types
 enum LYX_LATEX_TYPES {
        ///
-       LATEX_PARAGRAPH,
+       LATEX_PARAGRAPH = 1,
        ///
        LATEX_COMMAND,
        ///
@@ -131,7 +145,19 @@ enum LYX_LABEL_TYPES {
        LABEL_FIRST_COUNTER = LABEL_COUNTER_CHAPTER
 };
 
-
+enum LYX_END_LABEL_TYPES {
+       ///
+       END_LABEL_NO_LABEL,
+       ///
+       END_LABEL_BOX,
+       ///
+       END_LABEL_FILLED_BOX,
+       ///
+       END_LABEL_ENUM_FIRST = END_LABEL_NO_LABEL,
+       ///
+       END_LABEL_ENUM_LAST = END_LABEL_FILLED_BOX
+};
+               
 /* 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. 
@@ -163,7 +189,13 @@ public:
 
        ///
        bool Read (LyXLex &, LyXTextClass const &);
-
+       void readAlign(LyXLex &);
+       void readAlignPossible(LyXLex &);
+       void readLabelType(LyXLex &);
+       void readEndLabelType(LyXLex &);
+       void readMargin(LyXLex &);
+       void readLatexType(LyXLex &);
+       void readSpacing(LyXLex &);
        string const & name() const { return name_; }
        void name(string const & n) { name_ = n; }
        string const & obsoleted_by() const { return obsoleted_by_; }
@@ -171,7 +203,9 @@ public:
        string const & labelstring() const { return labelstring_; }
        string const & preamble() const { return preamble_; }
        string const & latexparam() const { return latexparam_; }
-       string const & labelstring_appendix() const { return labelstring_appendix_; }
+       string const & labelstring_appendix() const {
+               return labelstring_appendix_;
+       }
        /** Default font for this layout/environment.
            The main font for this kind of environment. If an attribute has
            LyXFont::INHERITED_*, it means that the value is specified by
@@ -238,16 +272,19 @@ public:
        Spacing spacing;
 
        ///
-       LyXAlignment align; // add approp. signedness
+       LyXAlignment align;
+
+       ///
+       LyXAlignment alignpossible;
 
        ///
-       LyXAlignment alignpossible; // add approp. signedness
+       char labeltype; // add approp. type
 
        ///
-       char labeltype; // add approp. signedness
+       char endlabeltype;
 
        ///
-       char margintype; // add approp. signedness
+       LYX_MARGIN_TYPE margintype;
 
        ///
        bool fill_top;
@@ -274,7 +311,7 @@ public:
        }
        ///
        bool isCommand() const { 
-           return latextype == LATEX_COMMAND;
+               return latextype == LATEX_COMMAND;
        }
        ///
        bool isEnvironment() const {
@@ -317,21 +354,27 @@ private:
 class LyXTextClass {
 public:
        ///
-       typedef vector<LyXLayout> LayoutList;
-
+       typedef std::vector<LyXLayout> LayoutList;
+       ///
+       typedef LayoutList::const_iterator const_iterator;
        ///
+       typedef LayoutList::size_type size_type;
+       ///
+       explicit
        LyXTextClass (string const & = string(), 
                      string const & = string(), 
                      string const & = string());
 
        ///
-       LayoutList::const_iterator begin() const { return layoutlist.begin(); }
+       const_iterator begin() const { return layoutlist.begin(); }
        ///
-       LayoutList::const_iterator end() const { return layoutlist.end(); }
+       const_iterator end() const { return layoutlist.end(); }
        
        ///
        bool Read(string const & filename, bool merge = false);
-
+       void readOutputType(LyXLex &);
+       void readMaxCounter(LyXLex &);
+       void readClassOptions(LyXLex &);
        ///
        bool hasLayout(string const & name) const;
 
@@ -398,9 +441,9 @@ public:
         ///
        int maxcounter() const { return maxcounter_; }
        ///
-       LayoutList::size_type numLayouts() const { return layoutlist.size(); }
+       size_type numLayouts() const { return layoutlist.size(); }
        ///
-       LyXLayout const & operator[](LayoutList::size_type i) const {
+       LyXLayout const & operator[](size_type i) const {
                return layoutlist[i];
        }
 private:
@@ -457,49 +500,64 @@ private:
        bool loaded;
 };
 
+
 ///
-inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
+inline
+void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
 {
        p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
 }
 
 
+///
+std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);
+
+
 ///
 class LyXTextClassList {
 public:
        ///
-       typedef vector<LyXTextClass> ClassList;
+       typedef std::vector<LyXTextClass> ClassList;
+       ///
+       typedef ClassList::const_iterator const_iterator;
+       ///
+       typedef ClassList::size_type size_type;
+       ///
+       const_iterator begin() const { return classlist.begin(); }
+       ///
+       const_iterator end() const { return classlist.end(); }
+       
        /// Gets layout structure from layout number and textclass number
-       LyXLayout const & Style(ClassList::size_type textclass,
-                               LyXTextClass::LayoutList::size_type layout) const;
+       LyXLayout const & Style(size_type textclass,
+                               LyXTextClass::size_type layout) const;
 
        /// Gets layout number from textclass number and layout name
-       pair<bool, LyXTextClass::LayoutList::size_type>
-       NumberOfLayout(ClassList::size_type textclass,
+       std::pair<bool, LyXTextClass::size_type>
+       NumberOfLayout(size_type textclass,
                       string const & name) const;
 
        /// Gets a layout name from layout number and textclass number
        string const &
-       NameOfLayout(ClassList::size_type textclass,
-                    LyXTextClass::LayoutList::size_type layout) const;
+       NameOfLayout(size_type textclass,
+                    LyXTextClass::size_type layout) const;
 
        /** Gets textclass number from name.
            Returns -1 if textclass name does not exist
        */
-       pair<bool, ClassList::size_type>
+       std::pair<bool, size_type>
        NumberOfClass(string const & textclass) const;
 
        ///
-       string const & NameOfClass(ClassList::size_type number) const;
+       string const & NameOfClass(size_type number) const;
 
        ///
-       string const & LatexnameOfClass(ClassList::size_type number) const;
+       string const & LatexnameOfClass(size_type number) const;
 
        ///
-       string const & DescOfClass(ClassList::size_type number) const;
+       string const & DescOfClass(size_type number) const;
 
        ///
-       LyXTextClass const & TextClass(ClassList::size_type textclass) const;
+       LyXTextClass const & TextClass(size_type textclass) const;
 
        /** Read textclass list.
            Returns false if this fails
@@ -509,7 +567,7 @@ public:
        /** Load textclass.
            Returns false if this fails
        */
-       bool Load(ClassList::size_type number) const;
+       bool Load(size_type number) const;
 private:
        ///
        mutable ClassList classlist;