diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:02:01 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 23:13:41 +0200 |
commit | 94f34c57be79187c7108eea845e1303ddc6319e5 (patch) | |
tree | ddf02496de0ce17308246d0a54c8678fa5e76e9e /sd/source | |
parent | 2afbef0037f022a59ed1198f1f84e454d070df92 (diff) |
Prepare for removal of non-const operator[] from Sequence in sd
Change-Id: I82dc012188f846161beeb54901c2f5d298e5c3b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124385
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source')
33 files changed, 246 insertions, 289 deletions
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index cb4e7db67b92..ee6317916f23 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -440,7 +440,7 @@ void CustomAnimationEffect::setPresetClassAndId( sal_Int16 nPresetClass, const O if( !bFoundPresetClass ) { aUserData.realloc( nLength + 1); - auto& el = aUserData[nLength]; + auto& el = aUserData.getArray()[nLength]; el.Name = "preset-class"; el.Value <<= mnPresetClass; ++nLength; @@ -449,7 +449,7 @@ void CustomAnimationEffect::setPresetClassAndId( sal_Int16 nPresetClass, const O if( !bFoundPresetId && maPresetId.getLength() > 0 ) { aUserData.realloc( nLength + 1); - auto& el = aUserData[nLength]; + auto& el = aUserData.getArray()[nLength]; el.Name = "preset-id"; el.Value <<= maPresetId; } @@ -487,7 +487,7 @@ void CustomAnimationEffect::setNodeType( sal_Int16 nNodeType ) if( !bFound ) { aUserData.realloc( nLength + 1); - auto& el = aUserData[nLength]; + auto& el = aUserData.getArray()[nLength]; el.Name = "node-type"; el.Value <<= mnNodeType; } @@ -522,7 +522,7 @@ void CustomAnimationEffect::setGroupId( sal_Int32 nGroupId ) if( !bFound ) { aUserData.realloc( nLength + 1); - auto& el = aUserData[nLength]; + auto& el = aUserData.getArray()[nLength]; el.Name = "group-id"; el.Value <<= mnGroupId; } @@ -1333,7 +1333,7 @@ void CustomAnimationEffect::setColor( sal_Int32 nIndex, const Any& rColor ) { if( aValues.getLength() > nIndex ) { - aValues[nIndex] = rColor; + aValues.getArray()[nIndex] = rColor; xAnimate->setValues( aValues ); } } @@ -2000,8 +2000,9 @@ void stl_process_after_effect_node_func(AfterEffectNode const & rNode) Sequence< NamedValue > aUserData( rNode.mxNode->getUserData() ); sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "master-element"; - aUserData[nSize].Value <<= xMasterNode; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "master-element"; + pUserData[nSize].Value <<= xMasterNode; rNode.mxNode->setUserData( aUserData ); // insert after effect node into timeline diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index e5ed520d9895..fe531f2b9667 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -1299,11 +1299,10 @@ static void createVisibilityOnOffNode(Reference< XTimeContainer > const & rxPare xOuterSeqTimeContainer->setFill(AnimationFill::HOLD); // set named values - Sequence< NamedValue > aUserDataSequence; - aUserDataSequence.realloc(1); - - aUserDataSequence[0].Name = "node-type"; - aUserDataSequence[0].Value <<= bOnClick ? EffectNodeType::ON_CLICK : EffectNodeType::AFTER_PREVIOUS; + Sequence< NamedValue > aUserDataSequence{ + { /* Name */ "node-type", + /* Value */ Any(bOnClick ? EffectNodeType::ON_CLICK : EffectNodeType::AFTER_PREVIOUS) } + }; xOuterSeqTimeContainer->setUserData(aUserDataSequence); diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 4e3fefb797ea..46ed24f3b412 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -268,8 +268,9 @@ bool SdGRFFilter::Export() { sal_Int32 nCount = aArgs.getLength(); aArgs.realloc( nCount + 1 ); - aArgs[ nCount ].Name = sFilterName; - aArgs[ nCount ].Value <<= sShortName; + auto pArgs = aArgs.getArray(); + pArgs[ nCount ].Name = sFilterName; + pArgs[ nCount ].Value <<= sShortName; } // take selection if needed diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx index daa5e7362a39..78939dc4ddac 100644 --- a/sd/source/filter/html/HtmlOptionsDialog.cxx +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -131,7 +131,7 @@ Sequence< PropertyValue > SdHtmlOptionsDialog::getPropertyValues() maMediaDescriptor.realloc( ++nCount ); // the "FilterData" Property is an Any that will contain our PropertySequence of Values - auto& el = maMediaDescriptor[ i ]; + auto& el = maMediaDescriptor.getArray()[ i ]; el.Name = "FilterData"; el.Value <<= maFilterDataSequence; return maMediaDescriptor; diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx index ec35118ceb0b..1bc24a7e33cd 100644 --- a/sd/source/filter/html/buttonset.cxx +++ b/sd/source/filter/html/buttonset.cxx @@ -29,6 +29,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/oslfile2streamwrap.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/graph.hxx> #include <vcl/virdev.hxx> #include <vcl/image.hxx> @@ -98,9 +99,8 @@ bool ButtonsImpl::getGraphic( const Reference< XGraphicProvider >& xGraphicProvi Reference< XInputStream > xInputStream( getInputStream( rName ) ); if( xInputStream.is() && xGraphicProvider.is() ) try { - Sequence< PropertyValue > aMediaProperties( 1 ); - aMediaProperties[0].Name = "InputStream"; - aMediaProperties[0].Value <<= xInputStream; + Sequence< PropertyValue > aMediaProperties{ comphelper::makePropertyValue( + "InputStream", xInputStream) }; Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ) ); if( xGraphic.is() ) diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index e357bba348a6..13f12dc69c2f 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -26,6 +26,7 @@ #include <sal/log.hxx> #include <rtl/tencinfo.h> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <o3tl/safeint.hxx> #include <osl/file.hxx> #include <unotools/pathoptions.hxx> @@ -933,11 +934,10 @@ bool HtmlExport::SavePresentation() uno::Reference< frame::XStorable > xStorable( mpDoc->getUnoModel(), uno::UNO_QUERY ); if( xStorable.is() ) { - uno::Sequence< beans::PropertyValue > aProperties( 2 ); - aProperties[ 0 ].Name = "Overwrite"; - aProperties[ 0 ].Value <<= true; - aProperties[ 1 ].Name = "FilterName"; - aProperties[ 1 ].Value <<= OUString("impress8"); + uno::Sequence< beans::PropertyValue > aProperties{ + comphelper::makePropertyValue("Overwrite", true), + comphelper::makePropertyValue("FilterName", OUString("impress8")) + }; xStorable->storeToURL( aURL, aProperties ); mpDocSh->EnableSetModified( false ); @@ -964,19 +964,17 @@ bool HtmlExport::CreateImagesForPresPages( bool bThumbnail) Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create( xContext ); Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 : 2); - aFilterData[0].Name = "PixelWidth"; - aFilterData[0].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel ); - aFilterData[1].Name = "PixelHeight"; - aFilterData[1].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel); + auto pFilterData = aFilterData.getArray(); + pFilterData[0].Name = "PixelWidth"; + pFilterData[0].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel ); + pFilterData[1].Name = "PixelHeight"; + pFilterData[1].Value <<= static_cast<sal_Int32>(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel); if((meFormat==FORMAT_JPG)&&(mnCompression != -1)) { - aFilterData[2].Name = "Quality"; - aFilterData[2].Value <<= static_cast<sal_Int32>(mnCompression); + pFilterData[2].Name = "Quality"; + pFilterData[2].Value <<= static_cast<sal_Int32>(mnCompression); } - Sequence< PropertyValue > aDescriptor( 3 ); - aDescriptor[0].Name = "URL"; - aDescriptor[1].Name = "FilterName"; OUString sFormat; if( meFormat == FORMAT_PNG ) sFormat = "PNG"; @@ -985,9 +983,12 @@ bool HtmlExport::CreateImagesForPresPages( bool bThumbnail) else sFormat = "JPG"; - aDescriptor[1].Value <<= sFormat; - aDescriptor[2].Name = "FilterData"; - aDescriptor[2].Value <<= aFilterData; + Sequence< PropertyValue > aDescriptor{ + comphelper::makePropertyValue("URL", Any()), + comphelper::makePropertyValue("FilterName", sFormat), + comphelper::makePropertyValue("FilterData", aFilterData) + }; + auto pDescriptor = aDescriptor.getArray(); for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++) { @@ -999,7 +1000,7 @@ bool HtmlExport::CreateImagesForPresPages( bool bThumbnail) else aFull += maImageFiles[nSdPage]; - aDescriptor[0].Value <<= aFull; + pDescriptor[0].Value <<= aFull; Reference< XComponent > xPage( pPage->getUnoPage(), UNO_QUERY ); xGraphicExporter->setSourceDocument( xPage ); diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 2d8a5ef17103..3b80cacc985a 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -681,8 +681,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "node-type"; - aUserData[nSize].Value <<= nNodeType; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "node-type"; + pUserData[nSize].Value <<= nNodeType; } } @@ -693,8 +694,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con { sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "group-id"; - aUserData[nSize].Value <<= nGroupId; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "group-id"; + pUserData[nSize].Value <<= nGroupId; } } @@ -717,8 +719,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con } sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "preset-class"; - aUserData[nSize].Value <<= nEffectPresetClass; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "preset-class"; + pUserData[nSize].Value <<= nEffectPresetClass; } } @@ -728,7 +731,8 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con { sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "preset-id"; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "preset-id"; const oox::ppt::preset_mapping* p = oox::ppt::preset_mapping::getList(); while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) ) @@ -736,7 +740,7 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con if( p->mpStrPresetId ) { - aUserData[nSize].Value <<= OUString::createFromAscii( p->mpStrPresetId ); + pUserData[nSize].Value <<= OUString::createFromAscii( p->mpStrPresetId ); } else { @@ -753,7 +757,7 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con } sBuffer.append( nPresetId ); - aUserData[nSize].Value <<= sBuffer.makeStringAndClear(); + pUserData[nSize].Value <<= sBuffer.makeStringAndClear(); } } } @@ -767,8 +771,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con { sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "preset-sub-type"; - aUserData[nSize].Value <<= oox::ppt::getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType ); + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "preset-sub-type"; + pUserData[nSize].Value <<= oox::ppt::getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType ); } } } @@ -779,8 +784,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con { sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "after-effect"; - aUserData[nSize].Value <<= bAfterEffect; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "after-effect"; + pUserData[nSize].Value <<= bAfterEffect; } } @@ -791,8 +797,9 @@ void AnimationImporter::fillNode( Reference< XAnimationNode > const & xNode, con { sal_Int32 nSize = aUserData.getLength(); aUserData.realloc(nSize+1); - aUserData[nSize].Name = "master-rel"; - aUserData[nSize].Value <<= nMasterRel; + auto pUserData = aUserData.getArray(); + pUserData[nSize].Name = "master-rel"; + pUserData[nSize].Value <<= nMasterRel; } } @@ -1315,10 +1322,9 @@ Any AnimationImporter::implGetColorAny( sal_Int32 nMode, sal_Int32 nA, sal_Int3 dump( "hsl(%ld", nA ); dump( ",%ld", nB ); dump( ",%ld)", nC ); - Sequence< double > aHSL( 3 ); - aHSL[0] = nA * 360.0/255.0; - aHSL[1] = nB / 255.0; - aHSL[2] = nC / 255.0; + Sequence< double > aHSL{ nA * 360.0/255.0, + nB / 255.0, + nC / 255.0 }; return makeAny( aHSL ); } @@ -2125,7 +2131,9 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen nKeyTimes++; Sequence< double > aKeyTimes( nKeyTimes ); + auto aKeyTimesRange = asNonConstRange(aKeyTimes); Sequence< Any > aValues( nKeyTimes ); + auto aValuesRange = asNonConstRange(aValues); OUString aFormula; pIter = pAtom->findFirstChildAtom(DFF_msofbtAnimKeyTime); @@ -2137,7 +2145,7 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen sal_Int32 nTemp(0); mrStCtrl.ReadInt32(nTemp); double fTemp = static_cast<double>(nTemp) / 1000.0; - aKeyTimes[nKeyTime] = fTemp; + aKeyTimesRange[nKeyTime] = fTemp; if( fTemp == -1 ) bToNormalize = true; @@ -2154,7 +2162,7 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen if (importAttributeValue(pValue, aValue2) && aFormula.isEmpty()) aValue2 >>= aFormula; } - aValues[nKeyTime] = aValue1; + aValuesRange[nKeyTime] = aValue1; } } } @@ -2218,7 +2226,7 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen // if TimeAnimationValueList contains time -1000, key points must be evenly distributed between 0 and 1 ([MS-PPT] 2.8.31) for( int nKeyTime = 0; nKeyTime < nKeyTimes; ++nKeyTime ) { - aKeyTimes[nKeyTime] = static_cast<double>(nKeyTime) / static_cast<double>(nKeyTimes - 1); + aKeyTimesRange[nKeyTime] = static_cast<double>(nKeyTime) / static_cast<double>(nKeyTimes - 1); } } diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 90dc2c589e07..bc757626df3c 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -987,8 +987,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODP(SvStream &rStream) { { "UserData", uno::Any(aUserData) }, })); - css::uno::Sequence<uno::Any> aOuterArgs(1); - aOuterArgs[0] <<= aAdaptorArgs; + css::uno::Sequence<uno::Any> aOuterArgs{ uno::Any(aAdaptorArgs) }; uno::Reference<lang::XInitialization> xInit(xInterface, uno::UNO_QUERY_THROW); xInit->initialize(aOuterArgs); diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index b888d92926f4..58e595e75877 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -861,10 +861,7 @@ void SdFontStylePropertyBox::setValue( const Any& rValue, const OUString& ) Any SdFontStylePropertyBox::getValue() { - Sequence<Any> aValues(3); - aValues[0] <<= mfFontWeight; - aValues[1] <<= meFontSlant; - aValues[2] <<= mnFontUnderline; + Sequence<Any> aValues{ Any(mfFontWeight), Any(meFontSlant), Any(mnFontUnderline) }; return makeAny( aValues ); } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 73d4b581cfbd..b604824f694f 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -951,10 +951,11 @@ Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, const CustomAnimati case nPropertyTypeCharDecoration: { - Sequence< Any > aValues(3); - aValues[0] = pEffect->getProperty( AnimationNodeType::SET, u"CharWeight" , EValue::To ); - aValues[1] = pEffect->getProperty( AnimationNodeType::SET, u"CharPosture" , EValue::To ); - aValues[2] = pEffect->getProperty( AnimationNodeType::SET, u"CharUnderline" , EValue::To ); + Sequence< Any > aValues{ + pEffect->getProperty( AnimationNodeType::SET, u"CharWeight" , EValue::To ), + pEffect->getProperty( AnimationNodeType::SET, u"CharPosture" , EValue::To ), + pEffect->getProperty( AnimationNodeType::SET, u"CharUnderline" , EValue::To ) + }; return makeAny( aValues ); } } diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 26c0d5bebcb2..cbfd847204b8 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/DrawViewMode.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/toolbox.hxx> @@ -265,9 +266,7 @@ void LayoutToolbarMenu::SelectHdl(AutoLayout eLayout) if( eLayout != AUTOLAYOUT_END ) { - aArgs = Sequence< PropertyValue >(1); - aArgs[0].Name = "WhatLayout"; - aArgs[0].Value <<= static_cast<sal_Int32>(eLayout); + aArgs = { comphelper::makePropertyValue("WhatLayout", static_cast<sal_Int32>(eLayout)) }; } else if( mbInsertPage ) { diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index aa2296edeb5d..2335508091b6 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <comphelper/propertyvalue.hxx> #include <vcl/fieldvalues.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -129,11 +132,9 @@ IMPL_LINK_NOARG(SdPagesField, ModifyHdl, weld::SpinButton&, void) { SfxUInt16Item aItem(SID_PAGES_PER_ROW, m_xWidget->get_value()); - ::uno::Any a; - ::uno::Sequence< ::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "PagesPerRow"; + uno::Any a; aItem.QueryValue( a ); - aArgs[0].Value = a; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue("PagesPerRow", a) }; SfxToolBoxControl::Dispatch( ::uno::Reference< ::frame::XDispatchProvider >( m_xFrame->getController(), ::uno::UNO_QUERY ), ".uno:PagesPerRow", aArgs ); diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx index 171d475c87af..a6baf3e920b6 100644 --- a/sd/source/ui/dlg/gluectrl.cxx +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <comphelper/propertyvalue.hxx> #include <svx/svdglue.hxx> #include <svl/intitem.hxx> #include <vcl/toolbox.hxx> @@ -99,10 +102,8 @@ IMPL_LINK(GlueEscDirLB, SelectHdl, weld::ComboBox&, rBox, void) if ( m_xFrame.is() ) { Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "GlueEscapeDirection"; aItem.QueryValue( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("GlueEscapeDirection", a) }; SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), ".uno:GlueEscapeDirection", aArgs ); diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index ceb5693275a1..96ac74186b6d 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -277,6 +277,7 @@ void ConfigurationUpdater::CheckPureAnchors ( Sequence<Reference<XResourceId> > aResources( rxConfiguration->getResources( nullptr, OUString(), AnchorBindingMode_INDIRECT)); + auto aResourcesRange = asNonConstRange(aResources); sal_Int32 nCount (aResources.getLength()); // Prepare the list of pure anchors that have to be deactivated. @@ -324,7 +325,7 @@ void ConfigurationUpdater::CheckPureAnchors ( "because it has no children"); // Erase element from current configuration. for (sal_Int32 nI=nIndex; nI<nCount-2; ++nI) - aResources[nI] = aResources[nI+1]; + aResourcesRange[nI] = aResources[nI+1]; nCount -= 1; rResourcesToDeactivate.push_back(xResourceId); diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx index 9afc594cd7e9..1845b353f168 100644 --- a/sd/source/ui/framework/configuration/ResourceId.cxx +++ b/sd/source/ui/framework/configuration/ResourceId.cxx @@ -25,6 +25,8 @@ #include <cppuhelper/weakref.hxx> #include <rtl/ref.hxx> +#include <algorithm> + namespace com::sun::star::uno { class XComponentContext; } using namespace ::com::sun::star; @@ -152,8 +154,7 @@ Sequence<OUString> SAL_CALL if (nAnchorCount > 0) { Sequence<OUString> aAnchorURLs (nAnchorCount); - for (sal_Int32 nIndex=0; nIndex<nAnchorCount; ++nIndex) - aAnchorURLs[nIndex] = maResourceURLs[nIndex+1]; + std::copy_n(maResourceURLs.begin() + 1, nAnchorCount, aAnchorURLs.getArray()); return aAnchorURLs; } else diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index b63da87397b3..6d5f8ee121ce 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -157,8 +157,7 @@ void SAL_CALL FullScreenPane::setAccessible ( Reference<css::accessibility::XAccessible> xAccessibleParent; if (pParentWindow != nullptr) xAccessibleParent = pParentWindow->GetAccessible(); - Sequence<Any> aArguments (1); - aArguments[0] <<= xAccessibleParent; + Sequence<Any> aArguments{ Any(xAccessibleParent) }; xInitializable->initialize(aArguments); } GetWindow()->SetAccessible(rxAccessible); @@ -189,13 +188,12 @@ Reference<rendering::XCanvas> FullScreenPane::CreateCanvas() if (!pWindow) throw RuntimeException(); - Sequence<Any> aArg(4); - - // common: first any is VCL pointer to window (for VCL canvas) - aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get()); - aArg[1] <<= css::awt::Rectangle(); - aArg[2] <<= false; - aArg[3] <<= mxWindow; + Sequence<Any> aArg{ // common: first any is VCL pointer to window (for VCL canvas) + Any(reinterpret_cast<sal_Int64>(pWindow.get())), + Any(css::awt::Rectangle()), + Any(false), + Any(mxWindow) + }; Reference<lang::XMultiServiceFactory> xFactory ( mxComponentContext->getServiceManager(), UNO_QUERY_THROW); diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index d5604e79d5cb..dcca52ae3a78 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -153,11 +153,12 @@ uno::Any SAL_CALL ViewShellWrapper::getSelection() mpSlideSorterViewShell->GetSlideSorter().GetController().GetPageSelector().GetSelectedPageCount()); Sequence<Reference<XInterface> > aPages(nSelectedPageCount); + auto aPagesRange = asNonConstRange(aPages); int nIndex = 0; while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount) { slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement()); - aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage(); + aPagesRange[nIndex++] = pDescriptor->GetPage()->getUnoPage(); } aResult <<= aPages; diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index 93d1efa9dbdf..07c02ee57d4b 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -177,8 +177,7 @@ void ModuleController::ProcessStartupService (const ::std::vector<Any>& rValues) ::comphelper::getProcessComponentContext(); // Create the startup service. - Sequence<Any> aArguments(1); - aArguments[0] <<= mxController; + Sequence<Any> aArguments{ Any(mxController) }; // Note that when the new object will be destroyed at the end of // this scope when it does not register itself anywhere. // Typically it will add itself as ConfigurationChangeListener @@ -216,8 +215,7 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) ::comphelper::getProcessComponentContext(); // Create the factory service. - Sequence<Any> aArguments(1); - aArguments[0] <<= mxController; + Sequence<Any> aArguments{ Any(mxController) }; try { xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx index 7504e914e475..7cc32eae1db1 100644 --- a/sd/source/ui/presenter/PresenterHelper.cxx +++ b/sd/source/ui/presenter/PresenterHelper.cxx @@ -140,13 +140,12 @@ Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas ( if (!pWindow) throw RuntimeException(); - Sequence<Any> aArg(4); - - // common: first any is VCL pointer to window (for VCL canvas) - aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get()); - aArg[1] <<= css::awt::Rectangle(); - aArg[2] <<= false; - aArg[3] <<= rxWindow; + Sequence<Any> aArg{ // common: first any is VCL pointer to window (for VCL canvas) + Any(reinterpret_cast<sal_Int64>(pWindow.get())), + Any(css::awt::Rectangle()), + Any(false), + Any(rxWindow) + }; Reference<lang::XMultiServiceFactory> xFactory ( mxComponentContext->getServiceManager(), UNO_QUERY_THROW); diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index 2647b213884e..860dc394649a 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -22,6 +22,7 @@ #include <comphelper/base64.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <osl/file.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> @@ -117,27 +118,17 @@ uno::Sequence<sal_Int8> ImagePreparer::preparePreview( xFilter->setSourceDocument( xSourceDoc ); - uno::Sequence< beans::PropertyValue > aFilterData(3); - - aFilterData[0].Name = "PixelWidth"; - aFilterData[0].Value <<= aWidth; - - aFilterData[1].Name = "PixelHeight"; - aFilterData[1].Value <<= aHeight; - - aFilterData[2].Name = "ColorMode"; - aFilterData[2].Value <<= sal_Int32(0); // 0: Color, 1: B&W - - uno::Sequence< beans::PropertyValue > aProps(3); - - aProps[0].Name = "MediaType"; - aProps[0].Value <<= OUString( "image/png" ); - - aProps[1].Name = "URL"; - aProps[1].Value <<= aFileURL; - - aProps[2].Name = "FilterData"; - aProps[2].Value <<= aFilterData; + uno::Sequence< beans::PropertyValue > aFilterData{ + comphelper::makePropertyValue("PixelWidth", aWidth), + comphelper::makePropertyValue("PixelHeight", aHeight), + comphelper::makePropertyValue("ColorMode", sal_Int32(0)) // 0: Color, 1: B&W + }; + + uno::Sequence< beans::PropertyValue > aProps{ + comphelper::makePropertyValue("MediaType", OUString( "image/png" )), + comphelper::makePropertyValue("URL", aFileURL), + comphelper::makePropertyValue("FilterData", aFilterData) + }; xFilter->filter( aProps ); diff --git a/sd/source/ui/slideshow/SlideShowRestarter.cxx b/sd/source/ui/slideshow/SlideShowRestarter.cxx index cf05679c25af..b8c61ba48515 100644 --- a/sd/source/ui/slideshow/SlideShowRestarter.cxx +++ b/sd/source/ui/slideshow/SlideShowRestarter.cxx @@ -21,6 +21,8 @@ #include <ViewShellBase.hxx> #include <slideshow.hxx> #include "SlideShowRestarter.hxx" + +#include <comphelper/propertyvalue.hxx> #include <framework/ConfigurationController.hxx> #include <framework/FrameworkHelper.hxx> #include <sfx2/dispatch.hxx> @@ -141,9 +143,8 @@ void SlideShowRestarter::StartPresentation() mpDispatcher->Execute(SID_PRESENTATION, SfxCallMode::ASYNCHRON); if (mpSlideShow.is()) { - Sequence<css::beans::PropertyValue> aProperties (1); - aProperties[0].Name = "FirstPage"; - aProperties[0].Value <<= "page" + OUString::number(mnCurrentSlideNumber+1); + Sequence aProperties{ comphelper::makePropertyValue("FirstPage", + "page" + OUString::number(mnCurrentSlideNumber+1)) }; mpSlideShow->startWithArguments(aProperties); } mpSelf.reset(); diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 9f90799f8ddd..e6bb3f334e85 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/util/URL.hpp> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/supportsservice.hxx> #include <sal/log.hxx> @@ -803,9 +804,7 @@ void SAL_CALL SlideShow::end() void SAL_CALL SlideShow::rehearseTimings() { - Sequence< PropertyValue > aArguments(1); - aArguments[0].Name = "RehearseTimings"; - aArguments[0].Value <<= true; + Sequence< PropertyValue > aArguments{ comphelper::makePropertyValue("RehearseTimings", true) }; startWithArguments( aArguments ); } @@ -910,19 +909,12 @@ void SAL_CALL SlideShow::disposing() void SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Reference< XAnimationNode >& xAnimationNode ) { - Sequence< PropertyValue > aArguments(4); - - aArguments[0].Name = "Preview"; - aArguments[0].Value <<= true; - - aArguments[1].Name = "FirstPage"; - aArguments[1].Value <<= xDrawPage; - - aArguments[2].Name = "AnimationNode"; - aArguments[2].Value <<= xAnimationNode; - - aArguments[3].Name = "ParentWindow"; - aArguments[3].Value <<= Reference< XWindow >(); + Sequence< PropertyValue > aArguments{ + comphelper::makePropertyValue("Preview", true), + comphelper::makePropertyValue("FirstPage", xDrawPage), + comphelper::makePropertyValue("AnimationNode", xAnimationNode), + comphelper::makePropertyValue("ParentWindow", Reference< XWindow >()), + }; startWithArguments( aArguments ); } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index b199bd03ddf0..0c775d275913 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -80,6 +80,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <rtl/ref.hxx> #include <avmedia/mediawindow.hxx> #include <svtools/colrdlg.hxx> @@ -455,9 +456,7 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow const sal_Int32 nNextSlideNumber = getNextSlideNumber(); if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode ) ) { - Sequence< Any > aValue(2); - aValue[0] <<= xSlide; - aValue[1] <<= xAnimNode; + Sequence< Any > aValue{ Any(xSlide), Any(xAnimNode) }; aProperties.emplace_back( "Prefetch" , -1, Any(aValue), @@ -814,13 +813,14 @@ bool SlideshowImpl::startPreview( nPropertyCount++; Sequence< beans::PropertyValue > aProperties(nPropertyCount); - aProperties[0].Name = "AutomaticAdvancement"; - aProperties[0].Value <<= 1.0; // one second timeout + auto pProperties = aProperties.getArray(); + pProperties[0].Name = "AutomaticAdvancement"; + pProperties[0].Value <<= 1.0; // one second timeout if( mxPreviewAnimationNode.is() ) { - aProperties[1].Name = "NoSlideTransitions"; - aProperties[1].Value <<= true; + pProperties[1].Name = "NoSlideTransitions"; + pProperties[1].Value <<= true; } bRet = startShowImpl( aProperties ); @@ -2503,9 +2503,7 @@ void SlideshowImpl::setAutoSaveState( bool bOn) aURL.Complete = "vnd.sun.star.autorecovery:/setAutoSaveState"; xParser->parseStrict(aURL); - Sequence< beans::PropertyValue > aArgs(1); - aArgs[0].Name = "AutoSaveState"; - aArgs[0].Value <<= bOn; + Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue("AutoSaveState", bOn) }; uno::Reference< frame::XDispatch > xAutoSave = frame::theAutoRecovery::get(xContext); xAutoSave->dispatch(aURL, aArgs); diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx index 1055d51b1cc3..c30962ed766b 100644 --- a/sd/source/ui/unoidl/SdUnoSlideView.cxx +++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx @@ -90,11 +90,12 @@ Any SAL_CALL SdUnoSlideView::getSelection() mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount()); Sequence<Reference<XInterface> > aPages(nSelectedPageCount); + auto aPagesRange = asNonConstRange(aPages); int nIndex = 0; while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount) { slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement()); - aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage(); + aPagesRange[nIndex++] = pDescriptor->GetPage()->getUnoPage(); } aResult <<= aPages; diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 16d6557bca14..ec168b7e42d6 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -314,12 +314,13 @@ uno::Sequence<beans::PropertyValue> const uno::Sequence<beans::PropertyValue>& aConfigProps ) { uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() ); + auto aRetRange = asNonConstRange(aRet); int nRet = 0; for( const auto& rConfigProp : aConfigProps ) { XPropertyListType t = getTypeOfName( rConfigProp.Name ); if (t == XPropertyListType::Unknown) - aRet[nRet++] = rConfigProp; + aRetRange[nRet++] = rConfigProp; else { OUString aURL; @@ -357,11 +358,12 @@ uno::Sequence<beans::PropertyValue> if( !xSubStorage.is() ) return aRet; + auto aRetRange = asNonConstRange(aRet); // now populate it for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ ) { XPropertyListType t = getTypeOfName( aConfigProps[i].Name ); - aRet[i] = aConfigProps[i]; + aRetRange[i] = aConfigProps[i]; if (t != XPropertyListType::Unknown) { const XPropertyListRef& pList = pDoc->GetPropertyList( t ); if( !pList.is() || !pList->IsEmbedInDocument() ) @@ -375,7 +377,7 @@ uno::Sequence<beans::PropertyValue> if( pList->SaveTo( xSubStorage, aName, &aResult ) ) { OUString aRealPath = "Settings/" + aResult; - aRet[i].Value <<= aRealPath; + aRetRange[i].Value <<= aRealPath; } } } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index a7d1e8568168..c629f2ca87d0 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -33,6 +33,7 @@ #include <officecfg/Office/Common.hxx> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> @@ -1093,60 +1094,52 @@ uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames( const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); - uno::Sequence< OUString > aSNS( mbImpressDoc ? 36 : 19 ); - - sal_uInt16 i(0); - - aSNS[i++] = "com.sun.star.drawing.DashTable"; - aSNS[i++] = "com.sun.star.drawing.GradientTable"; - aSNS[i++] = "com.sun.star.drawing.HatchTable"; - aSNS[i++] = "com.sun.star.drawing.BitmapTable"; - aSNS[i++] = "com.sun.star.drawing.TransparencyGradientTable"; - aSNS[i++] = "com.sun.star.drawing.MarkerTable"; - aSNS[i++] = "com.sun.star.text.NumberingRules"; - aSNS[i++] = "com.sun.star.drawing.Background"; - aSNS[i++] = "com.sun.star.document.Settings"; - aSNS[i++] = sUNO_Service_ImageMapRectangleObject; - aSNS[i++] = sUNO_Service_ImageMapCircleObject; - aSNS[i++] = sUNO_Service_ImageMapPolygonObject; - aSNS[i++] = "com.sun.star.xml.NamespaceMap"; - - // Support creation of GraphicStorageHandler and EmbeddedObjectResolver - aSNS[i++] = "com.sun.star.document.ExportGraphicStorageHandler"; - aSNS[i++] = "com.sun.star.document.ImportGraphicStorageHandler"; - aSNS[i++] = "com.sun.star.document.ExportEmbeddedObjectResolver"; - aSNS[i++] = "com.sun.star.document.ImportEmbeddedObjectResolver"; - aSNS[i++] = "com.sun.star.drawing.TableShape"; + uno::Sequence< OUString > aSNS_Common{ "com.sun.star.drawing.DashTable", + "com.sun.star.drawing.GradientTable", + "com.sun.star.drawing.HatchTable", + "com.sun.star.drawing.BitmapTable", + "com.sun.star.drawing.TransparencyGradientTable", + "com.sun.star.drawing.MarkerTable", + "com.sun.star.text.NumberingRules", + "com.sun.star.drawing.Background", + "com.sun.star.document.Settings", + sUNO_Service_ImageMapRectangleObject, + sUNO_Service_ImageMapCircleObject, + sUNO_Service_ImageMapPolygonObject, + "com.sun.star.xml.NamespaceMap", + + // Support creation of GraphicStorageHandler and EmbeddedObjectResolver + "com.sun.star.document.ExportGraphicStorageHandler", + "com.sun.star.document.ImportGraphicStorageHandler", + "com.sun.star.document.ExportEmbeddedObjectResolver", + "com.sun.star.document.ImportEmbeddedObjectResolver", + "com.sun.star.drawing.TableShape" }; + + uno::Sequence< OUString > aSNS_Specific; if(mbImpressDoc) - { - aSNS[i++] = "com.sun.star.presentation.TitleTextShape"; - aSNS[i++] = "com.sun.star.presentation.OutlinerShape"; - aSNS[i++] = "com.sun.star.presentation.SubtitleShape"; - aSNS[i++] = "com.sun.star.presentation.GraphicObjectShape"; - aSNS[i++] = "com.sun.star.presentation.ChartShape"; - aSNS[i++] = "com.sun.star.presentation.PageShape"; - aSNS[i++] = "com.sun.star.presentation.OLE2Shape"; - aSNS[i++] = "com.sun.star.presentation.TableShape"; - aSNS[i++] = "com.sun.star.presentation.OrgChartShape"; - aSNS[i++] = "com.sun.star.presentation.NotesShape"; - aSNS[i++] = "com.sun.star.presentation.HandoutShape"; - aSNS[i++] = "com.sun.star.presentation.DocumentSettings"; - aSNS[i++] = "com.sun.star.presentation.FooterShape"; - aSNS[i++] = "com.sun.star.presentation.HeaderShape"; - aSNS[i++] = "com.sun.star.presentation.SlideNumberShape"; - aSNS[i++] = "com.sun.star.presentation.DateTimeShape"; - aSNS[i++] = "com.sun.star.presentation.CalcShape"; - aSNS[i++] = "com.sun.star.presentation.MediaShape"; - } + aSNS_Specific = { "com.sun.star.presentation.TitleTextShape", + "com.sun.star.presentation.OutlinerShape", + "com.sun.star.presentation.SubtitleShape", + "com.sun.star.presentation.GraphicObjectShape", + "com.sun.star.presentation.ChartShape", + "com.sun.star.presentation.PageShape", + "com.sun.star.presentation.OLE2Shape", + "com.sun.star.presentation.TableShape", + "com.sun.star.presentation.OrgChartShape", + "com.sun.star.presentation.NotesShape", + "com.sun.star.presentation.HandoutShape", + "com.sun.star.presentation.DocumentSettings", + "com.sun.star.presentation.FooterShape", + "com.sun.star.presentation.HeaderShape", + "com.sun.star.presentation.SlideNumberShape", + "com.sun.star.presentation.DateTimeShape", + "com.sun.star.presentation.CalcShape", + "com.sun.star.presentation.MediaShape" }; else - { - aSNS[i++] = "com.sun.star.drawing.DocumentSettings"; - } + aSNS_Specific = { "com.sun.star.drawing.DocumentSettings" }; - DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" ); - - return comphelper::concatSequences( aSNS_ORG, aSNS ); + return comphelper::concatSequences( aSNS_ORG, aSNS_Common, aSNS_Specific ); } // lang::XServiceInfo @@ -1346,25 +1339,26 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property sal_uInt32 nItems = rPool.GetItemCount2( nWhichId ); aSeq.realloc( aSeq.getLength() + nItems*5 + 5 ); + auto pSeq = aSeq.getArray(); for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId)) { const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem); - aSeq[nSeqIndex++] <<= pFont->GetFamilyName(); - aSeq[nSeqIndex++] <<= pFont->GetStyleName(); - aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily()); - aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch()); - aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet()); + pSeq[nSeqIndex++] <<= pFont->GetFamilyName(); + pSeq[nSeqIndex++] <<= pFont->GetStyleName(); + pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily()); + pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch()); + pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet()); } const SvxFontItem& rFont = static_cast<const SvxFontItem&>(rPool.GetDefaultItem( nWhichId )); - aSeq[nSeqIndex++] <<= rFont.GetFamilyName(); - aSeq[nSeqIndex++] <<= rFont.GetStyleName(); - aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetFamily()); - aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetPitch()); - aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetCharSet()); + pSeq[nSeqIndex++] <<= rFont.GetFamilyName(); + pSeq[nSeqIndex++] <<= rFont.GetStyleName(); + pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetFamily()); + pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetPitch()); + pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetCharSet()); } @@ -1478,10 +1472,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( const ::tools::Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) ); aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() ); } - aRenderer.realloc( 1 ); - - aRenderer[ 0 ].Name = "PageSize" ; - aRenderer[ 0 ].Value <<= aPageSize; + aRenderer = { comphelper::makePropertyValue("PageSize", aPageSize) }; } return aRenderer; } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 4e4a07c1389c..d17345234e56 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -324,7 +324,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes() aTypes = mpShape->_getTypes(); sal_uInt32 nCount = aTypes.getLength(); aTypes.realloc( nCount+1 ); - aTypes[nCount] = cppu::UnoType<lang::XTypeProvider>::get(); + aTypes.getArray()[nCount] = cppu::UnoType<lang::XTypeProvider>::get(); gImplTypesCache.insert(std::make_pair(nObjId, aTypes)); } diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 3af73d2c22cb..b7153faf2f1b 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -39,6 +39,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <rtl/ustrbuf.hxx> #include <editeng/editstat.hxx> @@ -62,6 +63,7 @@ #include <officecfg/Office/Draw.hxx> #include <officecfg/Office/Impress.hxx> +#include <algorithm> #include <memory> #include <vector> @@ -387,8 +389,7 @@ namespace { uno::Sequence< OUString > aHelpIds, aWidgetIds; if( mbImpress ) { - aHelpIds.realloc( 1 ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:PageContentType:ListBox" ; + aHelpIds = { ".HelpID:vcl:PrintDialog:PageContentType:ListBox" }; AddDialogControl( vcl::PrinterOptionsHelper::setChoiceListControlOpt( "impressdocument", SdResId(STR_IMPRESS_PRINT_UI_CONTENT), @@ -398,7 +399,7 @@ namespace { 0) ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:SlidesPerPage:ListBox" ; + aHelpIds = { ".HelpID:vcl:PrintDialog:SlidesPerPage:ListBox" }; vcl::PrinterOptionsHelper::UIControlOptions aContentOpt( "PageContentType" , 1 ); AddDialogControl( vcl::PrinterOptionsHelper::setChoiceListControlOpt( "slidesperpage", @@ -412,7 +413,7 @@ namespace { ) ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:SlidesPerPageOrder:ListBox" ; + aHelpIds = { ".HelpID:vcl:PrintDialog:SlidesPerPageOrder:ListBox" }; vcl::PrinterOptionsHelper::UIControlOptions aSlidesPerPageOpt( "SlidesPerPage" , -1, true ); AddDialogControl( vcl::PrinterOptionsHelper::setChoiceListControlOpt( "slidesperpageorder", @@ -477,14 +478,10 @@ namespace { AddDialogControl( vcl::PrinterOptionsHelper::setSubgroupControlOpt("color", SdResId(STR_IMPRESS_PRINT_UI_QUALITY), "" ) ); - aHelpIds.realloc( 3 ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:Quality:RadioButton:0" ; - aHelpIds[1] = ".HelpID:vcl:PrintDialog:Quality:RadioButton:1" ; - aHelpIds[2] = ".HelpID:vcl:PrintDialog:Quality:RadioButton:2" ; - aWidgetIds.realloc( 3 ); - aWidgetIds[0] = "originalcolors"; - aWidgetIds[1] = "grayscale"; - aWidgetIds[2] = "blackandwhite"; + aHelpIds = { ".HelpID:vcl:PrintDialog:Quality:RadioButton:0", + ".HelpID:vcl:PrintDialog:Quality:RadioButton:1", + ".HelpID:vcl:PrintDialog:Quality:RadioButton:2" }; + aWidgetIds = { "originalcolors", "grayscale", "blackandwhite" }; AddDialogControl( vcl::PrinterOptionsHelper::setChoiceRadiosControlOpt( aWidgetIds, "", @@ -499,16 +496,11 @@ namespace { AddDialogControl( vcl::PrinterOptionsHelper::setSubgroupControlOpt("pagesizes", SdResId(STR_IMPRESS_PRINT_UI_PAGE_OPTIONS), "" ) ); - aHelpIds.realloc( 4 ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:0" ; - aHelpIds[1] = ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:1" ; - aHelpIds[2] = ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:2" ; - aHelpIds[3] = ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:3" ; - aWidgetIds.realloc( 4 ); - aWidgetIds[0] = "originalsize"; - aWidgetIds[1] = "fittoprintable"; - aWidgetIds[2] = "distributeonmultiple"; - aWidgetIds[3] = "tilesheet"; + aHelpIds = { ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:0", + ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:1", + ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:2", + ".HelpID:vcl:PrintDialog:PageOptions:RadioButton:3" }; + aWidgetIds = { "originalsize", "fittoprintable", "distributeonmultiple", "tilesheet" }; // Mutually exclusive page options settings are stored in separate config keys... // TODO: There is no config key to set the distributeonmultiple option as default @@ -557,8 +549,7 @@ namespace { vcl::PrinterOptionsHelper::UIControlOptions aIncludeOpt( "PrintProspect" , -1, false ); aIncludeOpt.maGroupHint = "LayoutPage" ; - aHelpIds.realloc( 1 ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintProspectInclude:ListBox" ; + aHelpIds = { ".HelpID:vcl:PrintDialog:PrintProspectInclude:ListBox" }; AddDialogControl( vcl::PrinterOptionsHelper::setChoiceListControlOpt( "brochureinclude", SdResId(STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE), @@ -629,14 +620,10 @@ namespace { nPrintRange ) ); */ OUString aPrintRangeName( "PrintContent" ); - aHelpIds.realloc( 3 ); - aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ; - aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ; - aHelpIds[2] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ; - aWidgetIds.realloc( 3 ); - aWidgetIds[0] = "rbAllPages"; - aWidgetIds[1] = "rbRangePages"; - aWidgetIds[2] = "rbRangeSelection"; + aHelpIds = { ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0", + ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1", + ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" }; + aWidgetIds = { "rbAllPages", "rbRangePages", "rbRangeSelection" }; AddDialogControl( vcl::PrinterOptionsHelper::setChoiceRadiosControlOpt(aWidgetIds, OUString(), aHelpIds, aPrintRangeName, @@ -665,8 +652,8 @@ namespace { static Sequence<OUString> CreateChoice(const TranslateId* pResourceId, size_t nCount) { Sequence<OUString> aChoices (nCount); - for (size_t nIndex=0; nIndex < nCount; ++nIndex) - aChoices[nIndex] = SdResId(pResourceId[nIndex]); + std::transform(pResourceId, pResourceId + nCount, aChoices.getArray(), + [](const auto& id) { return SdResId(id); }); return aChoices; } @@ -1239,17 +1226,13 @@ public: */ css::uno::Sequence<css::beans::PropertyValue> GetProperties () const { - css::uno::Sequence<css::beans::PropertyValue> aProperties (3); - - aProperties[0].Name = "ExtraPrintUIOptions"; - aProperties[0].Value <<= comphelper::containerToSequence(m_aUIProperties); - - aProperties[1].Name = "PageSize"; - aProperties[1].Value <<= maPrintSize; - - // FIXME: is this always true ? - aProperties[2].Name = "PageIncludesNonprintableArea"; - aProperties[2].Value <<= true; + css::uno::Sequence<css::beans::PropertyValue> aProperties{ + comphelper::makePropertyValue("ExtraPrintUIOptions", + comphelper::containerToSequence(m_aUIProperties)), + comphelper::makePropertyValue("PageSize", maPrintSize), + // FIXME: is this always true ? + comphelper::makePropertyValue("PageIncludesNonprintableArea", true) + }; return aProperties; } diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 6b16f89ec7ea..fd8c83f8841c 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/drawing/framework/XView.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <tools/diagnose_ex.h> @@ -443,14 +444,7 @@ bool ViewTabBar::HasTabBarButton ( css::uno::Sequence<css::drawing::framework::TabBarButton> ViewTabBar::GetTabBarButtons() { - sal_uInt32 nCount (maTabBarButtons.size()); - css::uno::Sequence<css::drawing::framework::TabBarButton> - aList (nCount); - - for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex) - aList[nIndex] = maTabBarButtons[nIndex]; - - return aList; + return comphelper::containerToSequence(maTabBarButtons); } void ViewTabBar::UpdateActiveButton() diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 7347eefbbb84..9c00365be2c2 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -446,8 +446,9 @@ void DrawViewShell::WriteUserDataSequence ( css::uno::Sequence < css::beans::Pro const sal_Int32 nIndex = rSequence.getLength(); rSequence.realloc( nIndex + 1 ); - rSequence[nIndex].Name = sUNO_View_ZoomOnPage ; - rSequence[nIndex].Value <<= mbZoomOnPage; + auto pSequence = rSequence.getArray(); + pSequence[nIndex].Name = sUNO_View_ZoomOnPage ; + pSequence[nIndex].Value <<= mbZoomOnPage; // Common SdrModel processing GetDocSh()->GetDoc()->WriteUserDataSequence(rSequence); diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index dd9d8bb20620..f0e76ec6a32f 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -29,6 +29,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <editeng/editstat.hxx> #include <editeng/outlobj.hxx> #include <vcl/svapp.hxx> @@ -1668,14 +1669,8 @@ namespace slideshowhelp { //Start at page 0, this would blow away any custom //show settings if any were set - Sequence< PropertyValue > aArguments(1); - PropertyValue aPage; - - aPage.Name = "FirstPage"; - aPage.Value <<= OUString("0"); - - aArguments[0] = aPage; - + Sequence< PropertyValue > aArguments{ comphelper::makePropertyValue("FirstPage", + OUString("0")) }; xPresentation->startWithArguments( aArguments ); } sfx2::SfxNotebookBar::UnlockNotebookBar(); diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 0bde5f7b759b..34b1bf322d50 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -20,6 +20,8 @@ #include <config_features.h> #include <View.hxx> + +#include <comphelper/propertyvalue.hxx> #include <osl/file.hxx> #include <editeng/outlobj.hxx> #include <sfx2/bindings.hxx> @@ -509,9 +511,8 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) { //TODO/MBA: testing OUString aName; - uno::Sequence < beans::PropertyValue > aMedium(1); - aMedium[0].Name = "URL" ; - aMedium[0].Value <<= aCurrentDropFile ; + uno::Sequence < beans::PropertyValue > aMedium{ comphelper::makePropertyValue( + "URL", aCurrentDropFile) }; uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer(). InsertEmbeddedObject( aMedium, aName ); diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 607768ec726c..9431efb9eb34 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -889,6 +889,7 @@ void ViewShell::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert { const sal_Int32 nIndex = rSequence.getLength(); rSequence.realloc( nIndex + 1 ); + auto pSequence = rSequence.getArray(); OSL_ASSERT (GetViewShell()!=nullptr); // Get the view id from the view shell in the center pane. This will @@ -897,8 +898,8 @@ void ViewShell::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert SfxInterfaceId nViewID (IMPRESS_FACTORY_ID); if (GetViewShellBase().GetMainViewShell() != nullptr) nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId(); - rSequence[nIndex].Name = sUNO_View_ViewId; - rSequence[nIndex].Value <<= "view" + OUString::number( static_cast<sal_uInt16>(nViewID)); + pSequence[nIndex].Name = sUNO_View_ViewId; + pSequence[nIndex].Value <<= "view" + OUString::number( static_cast<sal_uInt16>(nViewID)); mpFrameView->WriteUserDataSequence( rSequence ); } |