summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-10-04 10:18:22 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-04 10:20:30 +0200
commitfd2d14d5543c82eb875e720c98b51518699a8fbc (patch)
treeaa2db705f4ce2906290687c0a758b3932544eb6c
parent050248fea53adb6a14b649c5f84dd69a8faff997 (diff)
Implement DOCX export of paragraph outline level
Change-Id: I5648454d50f1df61962fa1516ea62aee5cb3777e
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx4
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx21
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx4
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx7
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
8 files changed, 44 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0e19fcd60109..49f90e634d4b 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 4c94fb2acfe4..9ead90851679 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 2b5b8c878ba7..b1e287b9025c 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 50db15b6c75c..a7242e3ee025 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 f31869970ed8..953f416ba15a 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 affda614c1aa..fc2f3ce5c422 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 e5fa946110ad..32f46b8acc2c 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 cd198abffebe..bcb5f17a74c0 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 );