[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Sep 13 09:22:05 PDT 2014
writerfilter/source/filter/ImportFilter.cxx | 19 +++++--------------
writerfilter/source/filter/WriterFilter.hxx | 3 ++-
2 files changed, 7 insertions(+), 15 deletions(-)
New commits:
commit 15c2991a6e72bf3b83d846a1155ab8666f4cc424
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Sep 13 18:11:06 2014 +0200
Use comphelper::SequenceAsHashMap
Change-Id: Ib510ce39e83f87c8a9c7a4f5dce4b29b012ce732
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index 811501b..3740b3b 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -133,7 +133,7 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
// Adding the saved compat settings
aGrabBagProperties["CompatSettings"] = uno::makeAny( aDomainMapper->GetCompatSettings() );
- putPropertiesToDocumentGrabBag( aGrabBagProperties.getAsConstPropertyValueList() );
+ putPropertiesToDocumentGrabBag( aGrabBagProperties );
writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream( pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT ));
oox::StorageRef xVbaPrjStrg( new ::oox::ole::OleStorage( m_xContext, pVBAProjectStream->getDocumentStream(), false ) );
@@ -262,7 +262,7 @@ uno::Sequence< OUString > WriterFilter::getSupportedServiceNames( ) throw (uno:
return WriterFilter_getSupportedServiceNames();
}
-void WriterFilter::putPropertiesToDocumentGrabBag( const uno::Sequence< beans::PropertyValue >& aProperties )
+void WriterFilter::putPropertiesToDocumentGrabBag( const comphelper::SequenceAsHashMap& rProperties )
{
try
{
@@ -275,22 +275,13 @@ void WriterFilter::putPropertiesToDocumentGrabBag( const uno::Sequence< beans::P
if( xPropsInfo.is() && xPropsInfo->hasPropertyByName( aGrabBagPropName ) )
{
// get existing grab bag
- uno::Sequence<beans::PropertyValue> aGrabBag;
- xDocProps->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
- sal_Int32 length = aGrabBag.getLength();
-
- // update grab bag size to contain the new items
- aGrabBag.realloc( length + aProperties.getLength() );
+ comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue(aGrabBagPropName));
// put the new items
- for( sal_Int32 i=0; i < aProperties.getLength(); ++i )
- {
- aGrabBag[length + i].Name = aProperties[i].Name;
- aGrabBag[length + i].Value = aProperties[i].Value;
- }
+ aGrabBag.update(rProperties);
// put it back to the document
- xDocProps->setPropertyValue( aGrabBagPropName, uno::Any( aGrabBag ) );
+ xDocProps->setPropertyValue(aGrabBagPropName, uno::Any(aGrabBag.getAsConstPropertyValueList()));
}
}
}
diff --git a/writerfilter/source/filter/WriterFilter.hxx b/writerfilter/source/filter/WriterFilter.hxx
index 6c2a034..8933f18 100644
--- a/writerfilter/source/filter/WriterFilter.hxx
+++ b/writerfilter/source/filter/WriterFilter.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <cppuhelper/implbase5.hxx>
+#include <comphelper/sequenceashashmap.hxx>
/// Common DOC/DOCX filter, calls DocxExportFilter via UNO or does the DOCX import.
class WriterFilter : public cppu::WeakImplHelper5
@@ -76,7 +77,7 @@ public:
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private:
- void putPropertiesToDocumentGrabBag( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties );
+ void putPropertiesToDocumentGrabBag(const comphelper::SequenceAsHashMap& rProperties);
};
More information about the Libreoffice-commits
mailing list