[Libreoffice-commits] core.git: 2 commits - oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jul 18 06:12:15 PDT 2014
oox/source/core/xmlfilterbase.cxx | 25 +++++++++++++++----------
sw/qa/extras/ooxmlexport/data/zoom.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 1 +
3 files changed, 16 insertions(+), 10 deletions(-)
New commits:
commit 9f2dc12e611e5706469889c03fa5b11a6ab6e297
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 18 15:04:37 2014 +0200
Use comphelper::SequenceAsHashMap
Change-Id: I5e4dc99c86b696d2c00392fdb47c4d9ebb7f14ff
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index acc8805..f236a9e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -667,33 +667,23 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
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)
+ comphelper::SequenceAsHashMap aStats = xProperties->getDocumentStatistics();
+ comphelper::SequenceAsHashMap::iterator it = aStats.find("ParagraphCount");
+ if (it != aStats.end())
{
- if (aStats[i].Name == "ParagraphCount")
- {
sal_Int32 nValue = 0;
- if (aStats[i].Value >>= nValue)
- {
+ if (it->second >>= nValue)
writeElement(pAppProps, XML_Paragraphs, OUString::number(nValue));
- break;
- }
- }
}
uno::Reference<beans::XPropertyAccess> xUserDefinedProperties(xProperties->getUserDefinedProperties(), uno::UNO_QUERY);
- const uno::Sequence<beans::PropertyValue> aUserDefinedProperties = xUserDefinedProperties->getPropertyValues();
- for (sal_Int32 i = 0; i < aUserDefinedProperties.getLength(); ++i)
+ comphelper::SequenceAsHashMap aUserDefinedProperties(xUserDefinedProperties->getPropertyValues());
+ it = aUserDefinedProperties.find("Company");
+ if (it != aStats.end())
{
- if (aUserDefinedProperties[i].Name == "Company")
- {
- OUString aValue;
- if (aUserDefinedProperties[i].Value >>= aValue)
- {
- writeElement(pAppProps, XML_Company, aValue);
- break;
- }
- }
+ OUString aValue;
+ if (it->second >>= aValue)
+ writeElement(pAppProps, XML_Company, aValue);
}
pAppProps->endElement( XML_Properties );
commit 84a5720f9ae42b98db99e0affd04b7d16ac742cd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 18 14:36:15 2014 +0200
oox: write Company in docProps/app.xml
Change-Id: I8474b8ec7415b4d8e067343295ea985319c34834
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index af0567b..acc8805 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -21,6 +21,7 @@
#include <cstdio>
#include <set>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
@@ -637,7 +638,6 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
writeElement( pAppProps, XML_Template, xProperties->getTemplateName() );
#ifdef OOXTODO
writeElement( pAppProps, XML_Manager, "manager" );
- writeElement( pAppProps, XML_Company, "company" );
writeElement( pAppProps, XML_Pages, "pages" );
writeElement( pAppProps, XML_Words, "words" );
writeElement( pAppProps, XML_Characters, "characters" );
@@ -681,6 +681,21 @@ writeAppProperties( XmlFilterBase& rSelf, Reference< XDocumentProperties > xProp
}
}
+ uno::Reference<beans::XPropertyAccess> xUserDefinedProperties(xProperties->getUserDefinedProperties(), uno::UNO_QUERY);
+ const uno::Sequence<beans::PropertyValue> aUserDefinedProperties = xUserDefinedProperties->getPropertyValues();
+ for (sal_Int32 i = 0; i < aUserDefinedProperties.getLength(); ++i)
+ {
+ if (aUserDefinedProperties[i].Name == "Company")
+ {
+ OUString aValue;
+ if (aUserDefinedProperties[i].Value >>= aValue)
+ {
+ writeElement(pAppProps, XML_Company, aValue);
+ break;
+ }
+ }
+ }
+
pAppProps->endElement( XML_Properties );
}
diff --git a/sw/qa/extras/ooxmlexport/data/zoom.docx b/sw/qa/extras/ooxmlexport/data/zoom.docx
index a61069f..ce93a1a 100644
Binary files a/sw/qa/extras/ooxmlexport/data/zoom.docx and b/sw/qa/extras/ooxmlexport/data/zoom.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2ef9160..e7934b2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -99,6 +99,7 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
pXmlDoc = parseExport("docProps/app.xml");
// One paragraph in the document.
assertXPathContent(pXmlDoc, "/extended-properties:Properties/extended-properties:Paragraphs", "1");
+ assertXPathContent(pXmlDoc, "/extended-properties:Properties/extended-properties:Company", "Example Ltd");
}
DECLARE_OOXMLEXPORT_TEST(defaultTabStopNotInStyles, "empty.odt")
More information about the Libreoffice-commits
mailing list