diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-21 12:55:29 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-21 13:00:59 +0000 |
commit | 40d5a40639da68f0b74d96b6c9e0f30acb571f4b (patch) | |
tree | 16a32e83cfca0a60386c1b9aa451d23562c17785 /writerfilter | |
parent | 794ed9fdd0fb426647c1f9086512fe9c425fb17d (diff) |
Use comphelper::containerToSequence()
Change-Id: I9b7ee5da800f0dd389eedc6b8f4f86d767519b3b
Reviewed-on: https://gerrit.libreoffice.org/14940
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 2fc7567b0f89..dde808edd0d8 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1317,71 +1317,66 @@ void SectionPropertyMap::_ApplyProperties( uno::Reference<beans::XMultiPropertySet> const xMultiSet(xStyle, uno::UNO_QUERY); - uno::Sequence<OUString> vNames; - uno::Sequence<uno::Any> vValues; + std::vector<OUString> vNames; + std::vector<uno::Any> vValues; { //Convert GetPropertyValues() value into something useful uno::Sequence<beans::PropertyValue> vPropVals = GetPropertyValues(); - int nProperties = vPropVals.getLength(); //Temporarily store the items that are in grab bags uno::Sequence<beans::PropertyValue> vCharVals; uno::Sequence<beans::PropertyValue> vParaVals; beans::PropertyValue* pCharGrabBag = std::find_if(vPropVals.begin(),vPropVals.end(),NamedPropertyValue("CharInteropGrabBag") ); - if (pCharGrabBag!=vPropVals.end()) { + if (pCharGrabBag!=vPropVals.end()) (pCharGrabBag->Value)>>=vCharVals; - nProperties += vCharVals.getLength()-1; //-1 to accommodate for grab bag property in vPropVals - } beans::PropertyValue* pParaGrabBag = std::find_if(vPropVals.begin(),vPropVals.end(),NamedPropertyValue("ParaInteropGrabBag") ); - if (pParaGrabBag!=vPropVals.end()) { + if (pParaGrabBag!=vPropVals.end()) (pParaGrabBag->Value)>>=vParaVals; - nProperties += vParaVals.getLength()-1; - } - //Allocate enough space to store the properties - vNames.realloc(nProperties); - vValues.realloc(nProperties); - - int i = 0; - for (beans::PropertyValue* pIter = vPropVals.begin(); pIter!=vPropVals.end(); ++pIter, ++i) { - if(pIter!=pCharGrabBag && pIter!=pParaGrabBag) { - vNames[i] = pIter->Name; - vValues[i] = pIter->Value; + for (beans::PropertyValue* pIter = vPropVals.begin(); pIter!=vPropVals.end(); ++pIter) + { + if(pIter!=pCharGrabBag && pIter!=pParaGrabBag) + { + vNames.push_back(pIter->Name); + vValues.push_back(pIter->Value); } } - for (beans::PropertyValue* iter = vCharVals.begin(); iter!=vCharVals.end(); ++iter, ++i) { - vNames[i] = iter->Name; - vValues[i] = iter->Value; + for (beans::PropertyValue* iter = vCharVals.begin(); iter!=vCharVals.end(); ++iter) + { + vNames.push_back(iter->Name); + vValues.push_back(iter->Value); } - for (beans::PropertyValue* iter = vParaVals.begin(); iter!=vParaVals.end(); ++iter, ++i) { - vNames[i] = iter->Name; - vValues[i] = iter->Value; + for (beans::PropertyValue* iter = vParaVals.begin(); iter!=vParaVals.end(); ++iter) + { + vNames.push_back(iter->Name); + vValues.push_back(iter->Value); } } if (xMultiSet.is()) { try { - xMultiSet->setPropertyValues(vNames, vValues); + xMultiSet->setPropertyValues(comphelper::containerToSequence(vNames), comphelper::containerToSequence(vValues)); } catch( const uno::Exception& ) { - OSL_FAIL( "Exception in <PageStyle>::setPropertyValue"); + OSL_FAIL( "Exception in SectionPropertyMap::_ApplyProperties"); } return; } - for (int i=0; i<vNames.getLength(); ++i) + for (size_t i = 0; i < vNames.size(); ++i) { try { if (xStyle.is()) - xStyle->setPropertyValue( vNames[i], vValues[i] ); + xStyle->setPropertyValue(vNames[i], vValues[i]); } catch( const uno::Exception& ) { - OSL_FAIL( "Exception in <PageStyle>::setPropertyValue"); + OSL_FAIL( "Exception in SectionPropertyMap::_ApplyProperties"); } } } + sal_Int32 lcl_AlignPaperBin( sal_Int32 nSet ) { //default tray numbers are above 0xff |