]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbase.h
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetbase.h
index ae6ac1cf9b8b8c5a874b3abc28a649ab91283b44..09990a217a52890a663f163cb5f14b99af1db5e3 100644 (file)
@@ -31,6 +31,7 @@ class FuncStatus;
 class InsetMath;
 class InsetText;
 class LaTeXFeatures;
+class LColor_color;
 class LCursor;
 class LyXLex;
 class LyXText;
@@ -200,9 +201,13 @@ public:
        /// describe content if cursor behind
        virtual void infoize2(odocstream &) const {}
 
+       enum {
+               PLAINTEXT_NEWLINE = 10000
+       };
+
        /// plain text output in ucs4 encoding
-       /// return the number of characters, in case of multiple lines of
-       /// output, add runparams.linelen to the number of chars in the last line
+       /// return the number of characters; in case of multiple lines of
+       /// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
        virtual int plaintext(Buffer const &, odocstream &,
                              OutputParams const &) const = 0;
        /// docbook output
@@ -353,6 +358,8 @@ public:
        /// if this inset has paragraphs should they be output all as default
        /// paragraphs with the default layout of the text class?
        virtual bool forceDefaultParagraphs(idx_type) const { return false; }
+       /// Is the width forced to some value?
+       virtual bool hasFixedWidth() const { return false; }
 
        ///
        virtual docstring const & getInsetName() const;
@@ -430,15 +437,19 @@ public:
        /// reject the changes within the inset
        virtual void rejectChanges(BufferParams const &) {};
 
-       /// pretty arbitrary
-       virtual int width() const { return 10; }
-       /// pretty arbitrary
-       virtual int ascent() const { return 10; }
-       /// pretty arbitrary
-       virtual int descent() const { return 10; }
+       /// inset width.
+       int width() const { return dim_.wid; }
+       /// inset ascent.
+       int ascent() const { return dim_.asc; }
+       /// inset descent.
+       int descent() const { return dim_.des; }
        ///
        int scroll() const { return 0; }
        ///
+       void setBackgroundColor(LColor_color);
+       ///
+       LColor_color backgroundColor() const;
+       ///
        enum CollapseStatus {
                Collapsed,
                Inlined,
@@ -447,8 +458,8 @@ public:
        ///
        virtual void setStatus(LCursor &, CollapseStatus) {}
 protected:
-       InsetBase() {}
-       InsetBase(InsetBase const &) {}
+       InsetBase();
+       InsetBase(InsetBase const & i);
        /** The real dispatcher.
         *  Gets normally called from LCursor::dispatch(). LCursor::dispatch()
         *  assumes the common case of 'LFUN handled, need update'.
@@ -466,6 +477,10 @@ protected:
        mutable Dimension dim_;
 private:
        virtual std::auto_ptr<InsetBase> doClone() const = 0;
+       /** We store the LColor::color value as an int to get LColor.h out
+        *  of the header file.
+        */
+       int background_color_;
 };