diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-03-21 10:37:46 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-03-21 12:08:33 +0100 |
commit | cc99bb9f383a65912d004e227a5b6a88b401bbba (patch) | |
tree | e578b001068c9a8a04c6bfbcc355dddb5c95c132 | |
parent | 082906e1f4cf58fdfab1a4064e2b7955fcdaeb8a (diff) |
writerfilter: PropertyMap: speed this up a bit
Using XMultiPropertySet reduces the number of SwTxtNodes created for the
bugdoc from rhbz#789022 from ~5k to ~3k.
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 575730f1bdd3..ee3ba7f5e6eb 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -32,6 +32,7 @@ #include <i18nutil/paper.hxx> #include <rtl/oustringostreaminserter.hxx> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/container/XEnumeration.hpp> @@ -986,6 +987,28 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) void SectionPropertyMap::_ApplyProperties( uno::Reference< beans::XPropertySet > xStyle ) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); + uno::Reference<beans::XMultiPropertySet> const xMultiSet(xStyle, + uno::UNO_QUERY); + if (xMultiSet.is()) + { // FIXME why is "this" a STL container??? + uno::Sequence<rtl::OUString> names(this->size()); + uno::Sequence<uno::Any> values(this->size()); + PropertyMap::iterator it = this->begin(); + for (size_t i = 0; it != this->end(); ++it, ++i) + { + names[i] = rPropNameSupplier.GetName(it->first.eId); + values[i] = it->second; + } + try + { + xMultiSet->setPropertyValues(names, values); + } + catch( const uno::Exception& ) + { + OSL_FAIL( "Exception in <PageStyle>::setPropertyValue"); + } + return; + } PropertyMap::iterator aMapIter = begin(); while( aMapIter != end()) { |