]> git.lyx.org Git - features.git/blobdiff - src/insets/Inset.h
Use new display() values to remove some inset hardcoding.
[features.git] / src / insets / Inset.h
index ecd171dc45de302844373c860c378171d198f662..302c958a1eb756bec50013a1047e514564904dd2 100644 (file)
@@ -467,14 +467,26 @@ public:
        /// does this inset try to use all available space (like \\hfill does)?
        virtual bool isHfill() const { return false; }
 
+       // Describe how the inset should be typeset
        enum DisplayType {
                Inline = 0,
-               AlignLeft,
-               AlignCenter,
-               AlignRight
+               // break row before this inset
+               BreakBefore = 1,
+               // break row after this inset
+               BreakAfter = 2,
+               // optionally break row after this inset (not used yet)
+               CanBreakAfter = 4,
+               // specify an alignment (left, right) for a display inset (default is center)
+               AlignLeft = 8,
+               AlignRight = 16,
+               // do not allow cursor to go at the end of the row before
+               // a display inset (not used yet)
+               NoBoundary = 32,
+               // A display inset breaks row at both ends
+               Display = BreakBefore | BreakAfter
        };
 
-       /// should we have a non-filled line before this inset?
+       /// How should this inset be typeset?
        virtual DisplayType display() const { return Inline; }
        /// indentation before this inset (only needed for displayed hull insets with fleqn option)
        virtual int indent(BufferView const &) const { return 0; }
@@ -594,6 +606,9 @@ public:
        /// reject the changes within the inset
        virtual void rejectChanges() {}
 
+       ///
+       virtual bool needsCProtection(bool const, bool const) const { return false; }
+
        ///
        virtual ColorCode backgroundColor(PainterInfo const &) const;
        ///
@@ -631,6 +646,21 @@ protected:
        Buffer * buffer_;
 };
 
+
+inline Inset::DisplayType operator|(Inset::DisplayType const d1,
+                                    Inset::DisplayType const d2)
+{
+       return static_cast<Inset::DisplayType>(int(d1) | int(d2));
+}
+
+
+inline Inset::DisplayType operator&(Inset::DisplayType const d1,
+                                    Inset::DisplayType const d2)
+{
+       return static_cast<Inset::DisplayType>(int(d1) & int(d2));
+}
+
+
 } // namespace lyx
 
 #endif