summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-21 09:40:58 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-21 10:12:27 +0100
commit5299cc26d136af179328f6e560040e1eabe8b9c8 (patch)
tree941d9c3412a1e27be350b4abbbbd894afd5dae63
parent258c8cc66ac5a91e4779d47bc3b3eafc7287332a (diff)
DOCX export of paragraph count in app.xml
Change-Id: Ie2fd4af3340c48c915eada74760cb414848f8a8b
-rw-r--r--oox/source/core/xmlfilterbase.cxx17
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx1
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx4
3 files changed, 21 insertions, 1 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 130ae9e0888a..5fc7c87fc337 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -639,7 +639,6 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
writeElement( pAppProps, XML_Characters, "characters" );
writeElement( pAppProps, XML_PresentationFormat, "presentation format" );
writeElement( pAppProps, XML_Lines, "lines" );
- writeElement( pAppProps, XML_Paragraphs, "paragraphs" );
writeElement( pAppProps, XML_Slides, "slides" );
writeElement( pAppProps, XML_Notes, "notes" );
#endif /* def OOXTODO */
@@ -663,6 +662,22 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
writeElement( pAppProps, XML_AppVersion, "app version" );
writeElement( pAppProps, XML_DocSecurity, "doc security" );
#endif /* def OOXTODO */
+
+ uno::Sequence<beans::NamedValue> aStats = xProperties->getDocumentStatistics();
+ for (sal_Int32 i = 0; i < aStats.getLength(); ++i)
+ {
+ sal_Int32 nValue = 0;
+ if (aStats[i].Value >>= nValue)
+ {
+ OUString aValue = OUString::number(nValue);
+ if (aStats[i].Name == "ParagraphCount")
+ {
+ writeElement(pAppProps, XML_Paragraphs, aValue);
+ break;
+ }
+ }
+ }
+
pAppProps->endElement( XML_Properties );
}
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 1fb6c48078f2..20d76cc13438 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -554,6 +554,7 @@ protected:
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("extended-properties"), BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"));
xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx);
return pXmlXpathObj->nodesetval;
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 360c5022226c..a1542d93a1a9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -106,6 +106,10 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
int nNext = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "next");
int nRsid = getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "rsid");
CPPUNIT_ASSERT(nNext < nRsid);
+
+ pXmlDoc = parseExport("docProps/app.xml");
+ // One paragraph in the document.
+ assertXPathContent(pXmlDoc, "/extended-properties:Properties/extended-properties:Paragraphs", "1");
}
DECLARE_OOXMLEXPORT_TEST(defaultTabStopNotInStyles, "empty.odt")