[Libreoffice-commits] core.git: oox/source
Julien Nabet
serval2412 at yahoo.fr
Mon Mar 9 14:03:17 PDT 2015
oox/source/core/xmlfilterbase.cxx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
New commits:
commit 97c9bc9fada9cdfff956101a4a5e264b4dba58be
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Tue Mar 3 23:46:32 2015 +0100
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 at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index bf83931..5c34ead 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -694,6 +694,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" );
@@ -705,9 +712,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() )
{
More information about the Libreoffice-commits
mailing list