summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-09-13 18:11:06 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-09-13 18:21:31 +0200
commit15c2991a6e72bf3b83d846a1155ab8666f4cc424 (patch)
treec4f8ed95a8519de1bd680c6170933ec9ed81e25c
parent70a197f28049fcb03655e1f5e480a24a2e6e9291 (diff)
Use comphelper::SequenceAsHashMap
Change-Id: Ib510ce39e83f87c8a9c7a4f5dce4b29b012ce732
-rw-r--r--writerfilter/source/filter/ImportFilter.cxx19
-rw-r--r--writerfilter/source/filter/WriterFilter.hxx3
2 files changed, 7 insertions, 15 deletions
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index 811501b56c3d..3740b3b12b08 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 6c2a034d0ca4..8933f18826f1 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);
};