[Libreoffice-commits] core.git: writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 9 23:42:03 PDT 2014


 writerfilter/source/dmapper/StyleSheetTable.cxx |    8 ++++----
 writerfilter/source/ooxml/model.xml             |    8 ++++----
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |    9 +++++----
 3 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 999fb810673f7c1b490cdac1f29c2e931e8e7f2e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 10 08:41:24 2014 +0200

    Use constants for ST_StyleType values
    
    Change-Id: I57ca4ef567126321ab745c8d1d7290b66df23c05

diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 6fee9e2..a8a8a8d 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -422,16 +422,16 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
             StyleType nType(STYLE_TYPE_UNKNOWN);
             switch (nIntValue)
             {
-                case 1:
+                case NS_ooxml::LN_Value_ST_StyleType_paragraph:
                     nType = STYLE_TYPE_PARA;
                     break;
-                case 2:
+                case NS_ooxml::LN_Value_ST_StyleType_character:
                     nType = STYLE_TYPE_CHAR;
                     break;
-                case 3:
+                case NS_ooxml::LN_Value_ST_StyleType_table:
                     nType = STYLE_TYPE_TABLE;
                     break;
-                case 4:
+                case NS_ooxml::LN_Value_ST_StyleType_numbering:
                     nType = STYLE_TYPE_LIST;
                     break;
                 default:
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 0f40a4e..447658f 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -18757,10 +18757,10 @@
       <attribute name="type" tokenid="ooxml:CT_TblStyleOverrideType"/>
     </resource>
     <resource name="ST_StyleType" resource="List">
-      <value tokenid="1">paragraph</value>
-      <value tokenid="2">character</value>
-      <value tokenid="3">table</value>
-      <value tokenid="4">numbering</value>
+      <value tokenid="ooxml:Value_ST_StyleType_paragraph">paragraph</value>
+      <value tokenid="ooxml:Value_ST_StyleType_character">character</value>
+      <value tokenid="ooxml:Value_ST_StyleType_table">table</value>
+      <value tokenid="ooxml:Value_ST_StyleType_numbering">numbering</value>
     </resource>
     <resource name="CT_Style" resource="Properties">
       <element name="name" tokenid="ooxml:CT_Style_name"/>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index df8ade0..2fbf983 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3720,7 +3720,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
         {
             m_nCurrentStyleIndex = nParam;
-            RTFValue::Pointer_t pValue(new RTFValue(1));
+            RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph));
             m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // paragraph style
         }
         else
@@ -3736,7 +3736,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
         {
             m_nCurrentStyleIndex = nParam;
-            RTFValue::Pointer_t pValue(new RTFValue(2));
+            RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_StyleType_character));
             m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // character style
         }
         else
@@ -3758,7 +3758,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
         {
             m_nCurrentStyleIndex = nParam;
-            RTFValue::Pointer_t pValue(new RTFValue(0)); // FIXME the correct value would be 3 but maybe table styles mess things up in dmapper, be cautious and disable them for now
+            // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now
+            RTFValue::Pointer_t pValue(new RTFValue(0));
             m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // table style
         }
         break;
@@ -4837,7 +4838,7 @@ int RTFDocumentImpl::pushState()
             // the *default* is \s0 i.e. paragraph style default
             // this will be overwritten by \sN \csN \dsN \tsN
             m_nCurrentStyleIndex = 0;
-            RTFValue::Pointer_t pValue(new RTFValue(1));
+            RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph));
             m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue);
         }
         break;


More information about the Libreoffice-commits mailing list