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

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 4 01:20:53 PDT 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    4 ++++
 sw/source/filter/ww8/attributeoutputbase.hxx |    4 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   21 ++++++++++++++++-----
 sw/source/filter/ww8/docxattributeoutput.hxx |    3 +++
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    4 ++++
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    3 +++
 sw/source/filter/ww8/ww8atr.cxx              |    7 +++++++
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    3 +++
 8 files changed, 44 insertions(+), 5 deletions(-)

New commits:
commit fd2d14d5543c82eb875e720c98b51518699a8fbc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 4 10:18:22 2013 +0200

    Implement DOCX export of paragraph outline level
    
    Change-Id: I5648454d50f1df61962fa1516ea62aee5cb3777e

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0e19fcd..49f90e6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1391,6 +1391,10 @@ void Test::testStyleInheritance()
     uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles");
     uno::Reference< beans::XPropertySet > properties(paragraphStyles->getByName("Heading 1"), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(properties, "FollowStyle"));
+
+    // This was 0, as export of w:outlineLvl was missing.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(properties, "OutlineLevel"));
+
     properties = uno::Reference< beans::XPropertySet >(paragraphStyles->getByName("Heading 11"), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), getProperty<OUString>(properties, "FollowStyle"));
 
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 4c94fb2..9ead9085 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -104,6 +104,7 @@ class SwTextGridItem;
 class SwFmtLineNumber;
 class SvxFrameDirectionItem;
 class SfxGrabBagItem;
+class SfxUInt16Item;
 class SwFmtRuby;
 class SwTxtNode;
 class SwTOXMark;
@@ -574,6 +575,9 @@ protected:
     /// Sfx item RES_PARATR_GRABBAG
     virtual void ParaGrabBag( const SfxGrabBagItem& ) = 0;
 
+    /// Sfx item RES_PARATR_OUTLINELEVEL
+    virtual void ParaOutlineLevel( const SfxUInt16Item& ) = 0;
+
     /// Write the expanded field
     virtual void WriteExpand( const SwField* pFld ) = 0;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2b5b8c8..b1e287b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3366,14 +3366,25 @@ void DocxAttributeOutput::EndStyleProperties( bool bParProp )
     }
 }
 
+void lcl_OutlineLevel(sax_fastparser::FSHelperPtr pSerializer, sal_uInt16 nLevel)
+{
+    if (nLevel >= WW8ListManager::nMaxLevel)
+        nLevel = WW8ListManager::nMaxLevel - 1;
+
+    pSerializer->singleElementNS(XML_w, XML_outlineLvl,
+            FSNS(XML_w, XML_val), OString::number(nLevel).getStr(),
+            FSEND);
+}
+
 void DocxAttributeOutput::OutlineNumbering( sal_uInt8 nLvl, const SwNumFmt& /*rNFmt*/, const SwFmt& /*rFmt*/ )
 {
-    if ( nLvl >= WW8ListManager::nMaxLevel )
-        nLvl = WW8ListManager::nMaxLevel - 1;
+    lcl_OutlineLevel(m_pSerializer, nLvl);
+}
 
-    m_pSerializer->singleElementNS( XML_w, XML_outlineLvl,
-            FSNS( XML_w, XML_val ), OString::number( nLvl ).getStr( ),
-            FSEND );
+void DocxAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& rItem)
+{
+    if (rItem.GetValue() > 0)
+        lcl_OutlineLevel(m_pSerializer, rItem.GetValue() - 1);
 }
 
 void DocxAttributeOutput::PageBreakBefore( bool bBreak )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 50db15b..a7242e3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -587,6 +587,9 @@ protected:
     /// Sfx item RES_PARATR_GRABBAG
     virtual void ParaGrabBag( const SfxGrabBagItem& );
 
+    // Sfx item RES_PARATR_OUTLINELEVEL
+    virtual void ParaOutlineLevel( const SfxUInt16Item& );
+
     /// Write the expanded field
     virtual void WriteExpand( const SwField* pFld );
 
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index f318699..953f416 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3123,6 +3123,10 @@ void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& /*rItem*/)
 {
 }
 
+void RtfAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& /*rItem*/)
+{
+}
+
 void RtfAttributeOutput::WriteExpand( const SwField* pFld )
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index affda61..fc2f3ce5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -411,6 +411,9 @@ protected:
     /// Sfx item RES_PARATR_GRABBAG
     virtual void ParaGrabBag( const SfxGrabBagItem& );
 
+    /// Sfx item RES_PARATR_OUTLINELEVEL
+    virtual void ParaOutlineLevel( const SfxUInt16Item& );
+
     /// Write the expanded field
     virtual void WriteExpand( const SwField* pFld );
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e5fa946..32f46b8 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4714,6 +4714,10 @@ void WW8AttributeOutput::ParaGrabBag(const SfxGrabBagItem& /*rItem*/)
 {
 }
 
+void WW8AttributeOutput::ParaOutlineLevel(const SfxUInt16Item& /*rItem*/)
+{
+}
+
 // "Separate paragraphs"
 void WW8AttributeOutput::ParaSplit( const SvxFmtSplitItem& rSplit )
 {
@@ -5257,6 +5261,9 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
         case RES_PARATR_GRABBAG:
             ParaGrabBag(static_cast<const SfxGrabBagItem&>(rHt));
             break;
+        case RES_PARATR_OUTLINELEVEL:
+            ParaOutlineLevel(static_cast<const SfxUInt16Item&>(rHt));
+            break;
 
         default:
             SAL_INFO("sw.ww8", "Unhandled SfxPoolItem with id " << rHt.Which() );
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index cd198ab..bcb5f17 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -392,6 +392,9 @@ protected:
     /// Sfx item RES_PARATR_GRABBAG
     virtual void ParaGrabBag( const SfxGrabBagItem& );
 
+    // Sfx item RES_PARATR_OUTLINELEVEL
+    virtual void ParaOutlineLevel( const SfxUInt16Item& );
+
     /// Write the expanded field
     virtual void WriteExpand( const SwField* pFld );
 


More information about the Libreoffice-commits mailing list