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

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 17 08:59:25 PDT 2013


 sw/source/filter/ww8/attributeoutputbase.hxx |    9 ++++++++-
 sw/source/filter/ww8/docxattributeoutput.cxx |    4 ++--
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    4 ++--
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    2 +-
 sw/source/filter/ww8/wrtw8sty.cxx            |    8 ++++----
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    2 +-
 7 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 2ed29702ab29240e8e68c9c0f168a551d17f79f6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 17 17:56:10 2013 +0200

    sw: bool -> enum for style type in AttributeOutputBase
    
    For now just use what we have already: paragraph and character styles.
    But it enum should contain numbering styles as well in the future.
    
    Change-Id: Ifd2f918446537e04cb5ba2cd8df822c5a1f9099c

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 1ff4474..fc04861 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -132,6 +132,13 @@ namespace msword {
     const sal_uInt8 PageBreak   = 0xC;
 }
 
+/// Type of a style in the style table.
+enum StyleType
+{
+    STYLE_TYPE_PARA,
+    STYLE_TYPE_CHAR
+};
+
 class AttributeOutputBase
 {
 public:
@@ -260,7 +267,7 @@ public:
     virtual void DefaultStyle( sal_uInt16 nStyle ) = 0;
 
     /// Start of a style in the styles table.
-    virtual void StartStyle( const OUString& rName, bool bPapFmt,
+    virtual void StartStyle( const OUString& rName, StyleType eType,
             sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId,
             bool bAutoUpdate ) = 0;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5821bfc..4a1cdcf 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3596,11 +3596,11 @@ oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML()
     return m_rDrawingML;
 }
 
-void DocxAttributeOutput::StartStyle( const OUString& rName, bool bPapFmt,
+void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
         sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 /*nWwId*/, sal_uInt16 nId, bool bAutoUpdate )
 {
     m_pSerializer->startElementNS( XML_w, XML_style,
-            FSNS( XML_w, XML_type ), bPapFmt? "paragraph": "character", // FIXME is this correct?
+            FSNS( XML_w, XML_type ), (eType == STYLE_TYPE_PARA ? "paragraph": "character"),
             FSNS( XML_w, XML_styleId ), m_rExport.pStyles->GetStyleId(nId).getStr(),
             FSEND );
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 5a53d34..29dec70 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -225,7 +225,7 @@ public:
     void OutputDefaultItem(const SfxPoolItem& rHt);
 
     /// Start of a style in the styles table.
-    virtual void StartStyle( const OUString& rName, bool bPapFmt,
+    virtual void StartStyle( const OUString& rName, StyleType eType,
             sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId,
             bool bAutoUpdate );
 
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 47b66e7..a0ce1d7 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1061,14 +1061,14 @@ void RtfAttributeOutput::DefaultStyle( sal_uInt16 /*nStyle*/ )
     /* noop, the default style is always 0 in RTF */
 }
 
-void RtfAttributeOutput::StartStyle( const OUString& rName, bool bPapFmt,
+void RtfAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
         sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 /*nWwId*/, sal_uInt16 nId,
         bool /* bAutoUpdate */ )
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", rName = '" << rName << "'");
 
     m_aStylesheet.append('{');
-    if (bPapFmt)
+    if (eType == STYLE_TYPE_PARA)
         m_aStylesheet.append(OOO_STRING_SVTOOLS_RTF_S);
     else
         m_aStylesheet.append( OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_CS);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 708a406..0ec6cbf 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -134,7 +134,7 @@ public:
     virtual void DefaultStyle( sal_uInt16 nStyle );
 
     /// Start of a style in the styles table.
-    virtual void StartStyle( const OUString& rName, bool bPapFmt,
+    virtual void StartStyle( const OUString& rName, StyleType eType,
             sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId,
             bool bAutoUpdate );
 
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 4acb308..52ac302 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -372,7 +372,7 @@ void WW8AttributeOutput::EndStyle()
     m_rWW8Export.pO->clear();
 }
 
-void WW8AttributeOutput::StartStyle( const OUString& rName, bool bPapFmt, sal_uInt16 nWwBase,
+void WW8AttributeOutput::StartStyle( const OUString& rName, StyleType eType, sal_uInt16 nWwBase,
     sal_uInt16 nWwNext, sal_uInt16 nWwId, sal_uInt16 /*nId*/, bool bAutoUpdate )
 {
     sal_uInt8 aWW8_STD[ sizeof( WW8_STD ) ];
@@ -384,11 +384,11 @@ void WW8AttributeOutput::StartStyle( const OUString& rName, bool bPapFmt, sal_uI
     Set_UInt16( pData, nBit16 );
 
     nBit16 = nWwBase << 4;          // istdBase
-    nBit16 |= bPapFmt ? 1 : 2;      // sgc
+    nBit16 |= (eType == STYLE_TYPE_PARA ? 1 : 2);      // sgc
     Set_UInt16( pData, nBit16 );
 
     nBit16 = nWwNext << 4;          // istdNext
-    nBit16 |= bPapFmt ? 2 : 1;      // cupx
+    nBit16 |= (eType == STYLE_TYPE_PARA ? 2 : 1);      // cupx
     Set_UInt16( pData, nBit16 );
 
     pData += sizeof( sal_uInt16 );      // bchUpe
@@ -615,7 +615,7 @@ void MSWordStyles::OutputStyle( SwFmt* pFmt, sal_uInt16 nPos )
             }
         }
 
-        m_rExport.AttrOutput().StartStyle( aName, bFmtColl,
+        m_rExport.AttrOutput().StartStyle( aName, (bFmtColl ? STYLE_TYPE_PARA : STYLE_TYPE_CHAR),
                 nBase, nWwNext, GetWWId( *pFmt ), nPos,
                 pFmt->IsAutoUpdateFmt() );
 
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 537db89..d1f4c9b 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -120,7 +120,7 @@ public:
     virtual void DefaultStyle( sal_uInt16 nStyle );
 
     /// Start of a style in the styles table.
-    virtual void StartStyle( const OUString& rName, bool bPapFmt,
+    virtual void StartStyle( const OUString& rName, StyleType eType,
             sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwIdi, sal_uInt16 nId,
             bool bAutoUpdate );
 


More information about the Libreoffice-commits mailing list