]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfont.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / lyxfont.h
index a626288bfe770ed5743bc5cf9db683bd4f6ddd0b..ad1a4a17f0eba7aa59e5fc2c1a8bf9b3f2404408 100644 (file)
@@ -36,6 +36,7 @@
 #endif
 
 class LyXLex;
+class BufferParams;
 
 ///
 class LyXFont {
@@ -154,7 +155,7 @@ public:
        ///
        LyXFont();
 
-       /// LyXFont x(LyXFont ...) and LyXFont x = LyXFont ...
+       // LyXFont x(LyXFont ...) and LyXFont x = LyXFont ...
        LyXFont(LyXFont const & x);
  
        /// Shortcut initialization
@@ -206,6 +207,9 @@ public:
        ///
        FONT_MISC_STATE latex() const;
 
+       ///
+       FONT_MISC_STATE number() const;
+
        ///
        LColor::color color() const;
 
@@ -235,6 +239,8 @@ public:
        ///
        LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
        ///
+       LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
+       ///
        LyXFont & setColor(LColor::color c);
        ///
        LyXFont & setLanguage(Language const * l);
@@ -256,23 +262,24 @@ public:
 
        /// Sets color after LyX text format
        LyXFont & setLyXColor(string const &);
+
+#if 0
        /// Sets size after GUI name
        LyXFont & setGUISize(string const &);
+#endif
+       
        /// Returns size of font in LaTeX text notation
-       string latexSize() const;
+       string const latexSize() const;
  
-       /** Updates font settings according to request. If an
-           attribute is IGNORE, the attribute is left as it is. */
-       /* 
-        * When toggleall = true, all properties that matches the font in use
-        * will have the effect that the properties is reset to the
-        * default.  If we have a text that is TYPEWRITER_FAMILY, and is
-        * update()'ed with TYPEWRITER_FAMILY, the operation will be as if
-        * a INHERIT_FAMILY was asked for.  This is necessary for the
-        * toggle-user-defined-style button on the toolbar.
-        */
+       /** Updates font settings according to request.
+           If an attribute is IGNORE, the attribute is left as it is.
+           When toggleall = true, all properties that matches the font in use
+           will have the effect that the properties is reset to the
+           default.  If we have a text that is TYPEWRITER_FAMILY, and is
+           update()'ed with TYPEWRITER_FAMILY, the operation will be as if
+           a INHERIT_FAMILY was asked for.  This is necessary for the
+           toggle-user-defined-style button on the toolbar.
+       */
        void update(LyXFont const & newfont, 
                    Language const * default_lang,
                    bool toggleall = false);
@@ -309,24 +316,18 @@ public:
                                 LyXFont const & next) const;
 
        /// Build GUI description of font state
-       string stateText() const;
+       string const stateText(BufferParams * params) const;
 
        ///
        LColor::color realColor() const;
 
        ///
        friend
-       bool operator==(LyXFont const & font1, LyXFont const & font2) {
-               return font1.bits == font2.bits &&
-                       font1.lang == font2.lang;
-       }
+       bool operator==(LyXFont const & font1, LyXFont const & font2);
 
        ///
        friend 
-       bool operator!=(LyXFont const & font1, LyXFont const & font2) {
-               return font1.bits != font2.bits ||
-                       font1.lang != font2.lang;
-       }
+       bool operator!=(LyXFont const & font1, LyXFont const & font2);
 
        /// compares two fonts, ignoring the setting of the Latex part.
        bool equalExceptLatex(LyXFont const &) const;
@@ -363,6 +364,8 @@ private:
        FontBits bits;
        ///
        Language const * lang;
+       ///
+       FONT_MISC_STATE number_;
        
        /// Sane font
        static FontBits sane;
@@ -378,15 +381,30 @@ private:
                                         LyXFont::FONT_MISC_STATE org);
 };
 
-
+///
 std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
 
+///
+inline
+bool operator==(LyXFont const & font1, LyXFont const & font2) {
+       return font1.bits == font2.bits &&
+               font1.lang == font2.lang &&
+               font1.number_ == font2.number_;
+}
+
+///
+inline
+bool operator!=(LyXFont const & font1, LyXFont const & font2) {
+       return !(font1 == font2);
+}
+
 
 inline
 LyXFont::LyXFont()
 {
        bits = sane;
        lang = default_language;
+       number_ = OFF;
 }
 
 
@@ -395,6 +413,7 @@ LyXFont::LyXFont(LyXFont const & x)
 {
        bits = x.bits;
        lang = x.lang;
+       number_ = x.number_;
 }
 
 
@@ -403,6 +422,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT1)
 {
        bits = inherit;
        lang = default_language;
+       number_ = OFF;
 }
 
 
@@ -411,6 +431,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2)
 {
        bits = ignore;
        lang = ignore_language;
+       number_ = IGNORE;
 }
 
 
@@ -419,12 +440,16 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3)
 {
        bits = sane;
        lang = default_language;
+       number_ = OFF;
 }
+
+
 inline
 LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l)
 {
        bits = inherit;
        lang = l;
+       number_ = OFF;
 }
 
 
@@ -433,6 +458,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l)
 {
        bits = ignore;
        lang = l;
+       number_ = IGNORE;
 }
 
 
@@ -441,6 +467,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
 {
        bits = sane;
        lang = l;
+       number_ = OFF;
 }
 
 
@@ -449,6 +476,7 @@ LyXFont & LyXFont::operator=(LyXFont const & x)
 {
        bits = x.bits;
        lang = x.lang;
+       number_ = x.number_;
        return *this;
 }
 
@@ -523,17 +551,24 @@ Language const * LyXFont::language() const
 }
 
 
+inline
+LyXFont::FONT_MISC_STATE LyXFont::number() const 
+{
+       return number_;
+}
+
+
 inline
 bool LyXFont::isRightToLeft() const 
 {
-       return lang->RightToLeft;
+       return lang->RightToLeft();
 }
 
 
 inline
 bool LyXFont::isVisibleRightToLeft() const 
 {
-       return (lang->RightToLeft && latex() != ON);
+       return (lang->RightToLeft() && latex() != ON && number() != ON);
 }
 
 
@@ -615,4 +650,12 @@ LyXFont & LyXFont::setLanguage(Language const * l)
        return *this;
 }
 
+
+inline
+LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n)
+{
+       number_ = n;
+       return *this;
+}
+
 #endif