summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2015-03-03 23:46:32 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-03-10 15:03:23 +0000
commitddb0bdef30dfb609378b73eb1a429943078bd611 (patch)
tree51905722cc3ad7e2ca8c213efc90ab5fba62c71c
parentac1d20096f31899db10f86742e422f8e960223d5 (diff)
tdf#89791: DOCX: don't save custom.xml if it's empty
Change-Id: I90f8e6c4de383b05345b8df9118000167bd20d2f Reviewed-on: https://gerrit.libreoffice.org/14735 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr> (cherry picked from commit 97c9bc9fada9cdfff956101a4a5e264b4dba58be) Reviewed-on: https://gerrit.libreoffice.org/14815 Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--oox/source/core/xmlfilterbase.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 842429d8d062..4ca796fbf53f 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -695,6 +695,13 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
static void
writeCustomProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProperties )
{
+ uno::Reference<beans::XPropertyAccess> xUserDefinedProperties( xProperties->getUserDefinedProperties(), uno::UNO_QUERY );
+ Sequence< PropertyValue > aprop( xUserDefinedProperties->getPropertyValues() );
+ sal_Int32 nbCustomProperties = aprop.getLength();
+ // tdf#89791 : if no custom properties, no need to add docProps/custom.x
+ if (!nbCustomProperties)
+ return;
+
rSelf.addRelation(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",
"docProps/custom.xml" );
@@ -706,9 +713,7 @@ writeCustomProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xP
FSNS( XML_xmlns, XML_vt ), "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
FSEND );
- uno::Reference<beans::XPropertyAccess> xUserDefinedProperties( xProperties->getUserDefinedProperties(), uno::UNO_QUERY );
- Sequence< PropertyValue > aprop( xUserDefinedProperties->getPropertyValues() );
- for ( sal_Int32 n = 0; n < aprop.getLength(); ++n )
+ for ( sal_Int32 n = 0; n < nbCustomProperties; ++n )
{
if ( !aprop[n].Name.isEmpty() )
{