[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters/kword/rtf/import
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2004-12-11 17:33:28
Message-ID: 20041211173328.E61B91BAD4 () office ! kde ! org
[Download RAW message or body]

CVS commit by goutte: 

Improve portability of setting font style hint:
- remove "offsetof"
- do not assume that the enum is a char 
  (especially that we have no control on this enum, as it is defined in Qt.)


  M +12 -7     rtfimport.cpp   1.129
  M +6 -0      rtfimport.h   1.52


--- koffice/filters/kword/rtf/import/rtfimport.cpp  #1.128:1.129
@@ -148,16 +148,16 @@ static RTFProperty propertyTable[] =
         MEMBER( "@rtf",         "facingp",      setFlagProperty,        facingPages, \
                true ),
         PROP(   0L,             "fcharset",     ignoreKeyword,          0L, 0 ), // \
                Not needed with Qt
-        MEMBER( "@fonttbl",     "fdecor",       setEnumProperty,        \
font.styleHint, QFont::Decorative ), +        PROP(   "@fonttbl",     "fdecor",       \
                setFontStyleHint,       0L, QFont::Decorative ),
         MEMBER( 0L,             "fi",           setNumericProperty,     \
                state.layout.firstIndent, 0 ),
-        MEMBER( "@fonttbl",     "fmodern",      setEnumProperty,        \
                font.styleHint, QFont::TypeWriter ),
-        MEMBER( "@fonttbl",     "fnil",         setEnumProperty,        \
font.styleHint, QFont::AnyStyle ), +        PROP(   "@fonttbl",     "fmodern",      \
setFontStyleHint,       0L, QFont::TypeWriter ), +        PROP(   "@fonttbl",     \
                "fnil",         setFontStyleHint,       0L, QFont::AnyStyle ),
         MEMBER( 0L,             "footery",      setNumericProperty,     \
                state.section.footerMargin, 0 ),
         PROP(   0L,             "formshade",    ignoreKeyword,          0L, 0 ), // \
                Not supported, KWord has no form support
         MEMBER( "@fonttbl",     "fprq",         setNumericProperty,     \
                font.fixedPitch, 0 ),
-        MEMBER( "@fonttbl",     "froman",       setEnumProperty,        \
font.styleHint, QFont::Serif ), +        PROP(   "@fonttbl",     "froman",       \
                setFontStyleHint,       0L, QFont::Serif ),
         MEMBER( 0L,             "fs",           setNumericProperty,     \
                state.format.fontSize, 0 ),
-        MEMBER( "@fonttbl",     "fscript",      setEnumProperty,        \
                font.styleHint, QFont::AnyStyle ),
-        MEMBER( "@fonttbl",     "fswiss",       setEnumProperty,        \
                font.styleHint, QFont::SansSerif ),
-        MEMBER( "@fonttbl",     "ftech",        setEnumProperty,        \
font.styleHint, QFont::AnyStyle ), +        PROP(   "@fonttbl",     "fscript",      \
setFontStyleHint,       0L, QFont::AnyStyle ), +        PROP(   "@fonttbl",     \
"fswiss",       setFontStyleHint,       0L, QFont::SansSerif ), +        PROP(   \
                "@fonttbl",     "ftech",        setFontStyleHint,       0L, \
                QFont::AnyStyle ),
         MEMBER( "@colortbl",    "green",        setNumericProperty,     green, 0 ),
         MEMBER( 0L,             "headery",      setNumericProperty,     \
state.section.headerMargin, 0 ), @@ -921,4 +921,9 @@ void RTFImport::setEnumProperty( \
RTFProp  }
 
+void RTFImport::setFontStyleHint( RTFProperty* property )
+{
+    font.styleHint = QFont::StyleHint( property->value );
+}
+
 void RTFImport::setPictureType( RTFProperty* property )
 {

--- koffice/filters/kword/rtf/import/rtfimport.h  #1.51:1.52
@@ -266,6 +266,12 @@ public:
     void setEnumProperty( RTFProperty *property );
     /**
+     * Set font style hint
+     * @since 1.4
+     */
+    void setFontStyleHint( RTFProperty* property );
+    /**
      * Set the picture type
      * (BMP, PNG...)
+     * @since 1.4
      */
     void setPictureType( RTFProperty* property );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic