]> git.lyx.org Git - features.git/blobdiff - src/insets/Inset.h
DocBook: merge code duplicates for HTML and CALS tables.
[features.git] / src / insets / Inset.h
index 8b47a05aa1c9492e56f69fa25ce51ab06f82502b..5d56c10b912991526319aad07608d5539b30ec5d 100644 (file)
 
 #include "ColorCode.h"
 #include "InsetCode.h"
-#include "InsetLayout.h"
 #include "LayoutEnums.h"
 #include "OutputEnums.h"
 #include "OutputParams.h"
+#include "RowFlags.h"
 
+#include "support/docstring.h"
 #include "support/strfwd.h"
 #include "support/types.h"
 
@@ -233,6 +234,12 @@ public:
        virtual void cursorPos(BufferView const & bv,
                CursorSlice const & sl, bool boundary, int & x, int & y) const;
 
+       ///
+       virtual docstring layoutName() const;
+       ///
+       virtual InsetLayout const & getLayout() const;
+       ///
+       virtual bool isPassThru() const;
        /// Allow multiple blanks
        virtual bool isFreeSpacing() const;
        /// Don't eliminate empty paragraphs
@@ -241,6 +248,10 @@ public:
        virtual bool forceLTR(OutputParams const &) const;
        /// whether to include this inset in the strings generated for the TOC
        virtual bool isInToc() const;
+       /// Inset font
+       virtual FontInfo getFont() const;
+       /// Label font
+       virtual FontInfo getLabelfont() const;
 
        /// Where should we go when we press the up or down cursor key?
        virtual bool idxUpDown(Cursor & cur, bool up) const;
@@ -324,7 +335,7 @@ public:
        /// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
        virtual int plaintext(odocstringstream &, OutputParams const &,
                              size_t max_length = INT_MAX) const = 0;
-       /// docbook output
+       /// DocBook output
        virtual void docbook(XMLStream &, OutputParams const &) const;
        /// XHTML output
        /// the inset is expected to write XHTML to the XMLStream
@@ -340,8 +351,8 @@ public:
        /// Appends a potentially abbreviated version of the inset to
        /// \param str. Intended for use by the TOC.
        virtual void forOutliner(docstring & str,
-                                                        size_t const maxlen = TOC_ENTRY_LENGTH,
-                                                        bool const shorten = true) const;
+                                size_t const maxlen = TOC_ENTRY_LENGTH,
+                                bool const shorten = true) const;
 
        /// Can a cursor be put in there ?
        /// Forced to false for insets that have hidden contents, like
@@ -447,12 +458,6 @@ public:
        /// This default implementation returns an empty string.
        virtual std::string contextMenuName() const;
 
-
-       virtual docstring layoutName() const;
-       ///
-       virtual InsetLayout const & getLayout() const;
-       ///
-       virtual bool isPassThru() const { return getLayout().isPassThru(); }
        /// Is this inset embedded in a title?
        virtual bool isInTitle() const { return false; }
        /// Is this inset's layout defined in the document's textclass?
@@ -466,31 +471,16 @@ public:
        /// is this equivalent to a space (which is BTW different from
        /// a line separator)?
        virtual bool isSpace() const { return false; }
+       /// returns chars, words if the inset is equivalent to such, otherwise
+       /// (0,0), which should be interpreted as 'false'
+       virtual std::pair<int, int> isWords() const { return std::pair<int,int>(0, 0); }
        /// does this inset try to use all available space (like \\hfill does)?
        virtual bool isHfill() const { return false; }
 
        virtual CtObject getCtObject(OutputParams const &) const;
 
-       enum RowFlags {
-               Inline = 0,
-               // break row before this inset
-               BreakBefore = 1 << 0,
-               // break row after this inset
-               BreakAfter = 1 << 1,
-               // it is possible to break after this inset
-               CanBreakAfter = 1 << 2,
-               // force new (maybe empty) row after this inset
-               RowAfter = 1 << 3,
-               // specify an alignment (left, right) for a display inset
-               // (default is center)
-               AlignLeft = 1 << 4,
-               AlignRight = 1 << 5,
-               // A display inset breaks row at both ends
-               Display = BreakBefore | BreakAfter
-       };
-
-       /// How should this inset be displayed in its row?
-       virtual RowFlags rowFlags() const { return Inline; }
+       // properties with respect to row breaking (made of RowFLag enums)
+       virtual int rowFlags() const { return Inline; }
        /// indentation before this inset (only needed for displayed hull insets with fleqn option)
        virtual int indent(BufferView const &) const { return 0; }
        ///
@@ -579,13 +569,9 @@ public:
        /// returns whether paragraph breaks can occur inside this inset
        virtual bool allowMultiPar() const { return false; }
        /**
-        * The font is inherited from the parent for LaTeX export if this
-        * method returns true. No open font changes are closed in front of
-        * the inset for LaTeX export, and the font is inherited for all other
-        * exports as well as on screen.
-        * If this method returns false all open font changes are closed in
-        * front of the inset for LaTeX export. The default font is used
-        * inside the inset for all exports and on screen.
+        * The font inside the inset is inherited from the parent for
+        * LaTeX export if this method returns true, as well as on screen.
+        * Otherwise the document default font is used.
         */
        virtual bool inheritFont() const { return true; }
        /**
@@ -652,20 +638,6 @@ protected:
 };
 
 
-inline Inset::RowFlags operator|(Inset::RowFlags const d1,
-                                    Inset::RowFlags const d2)
-{
-       return static_cast<Inset::RowFlags>(int(d1) | int(d2));
-}
-
-
-inline Inset::RowFlags operator&(Inset::RowFlags const d1,
-                                    Inset::RowFlags const d2)
-{
-       return static_cast<Inset::RowFlags>(int(d1) & int(d2));
-}
-
-
 } // namespace lyx
 
 #endif