diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:13:01 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-31 15:49:07 +0100 |
commit | 5b54ba7084d6b575814af26be30cf5af5dfca12c (patch) | |
tree | 38f1fd7bfca54886c34f6bcbdd9220d3f1a90f13 | |
parent | 3d469248ada8632a9d86efc80f2ac97dcb617c27 (diff) |
Prepare for removal of non-const operator[] from Sequence in svx
Change-Id: Ib5fda9469f9a1987cf9071c0e228c582cfb3dfa1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124397
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
54 files changed, 472 insertions, 492 deletions
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 0ed06acab198..821fd27864c0 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -1136,10 +1136,7 @@ AccessibleShape::getGroupPosition( const uno::Any& ) // [0] group level // [1] similar items counts in the group // [2] the position of the object in the group - uno::Sequence< sal_Int32 > aRet( 3 ); - aRet[0] = 0; - aRet[1] = 0; - aRet[2] = 0; + uno::Sequence< sal_Int32 > aRet{ 0, 0, 0 }; css::uno::Reference<XAccessible> xParent = getAccessibleParent(); if (!xParent.is()) diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index f67429be20b5..a6b51e62fc5d 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -30,6 +30,7 @@ #include <vcl/weld.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -307,11 +308,10 @@ OUString GraphicHelper::ExportGraphic(weld::Window* pParent, const Graphic& rGra OUString aExportFilter = rGraphicFilter.GetExportInternalFilterName(nFilter); - Sequence< PropertyValue > aPropsForDialog(2); - aPropsForDialog[0].Name = "Graphic"; - aPropsForDialog[0].Value <<= xGraphic; - aPropsForDialog[1].Name = "FilterName"; - aPropsForDialog[1].Value <<= aExportFilter; + Sequence< PropertyValue > aPropsForDialog{ + comphelper::makePropertyValue("Graphic", xGraphic), + comphelper::makePropertyValue("FilterName", aExportFilter) + }; Sequence< PropertyValue > aFilterData; bool bStatus = lcl_ExecuteFilterDialog(aPropsForDialog, aFilterData); @@ -417,11 +417,10 @@ void GraphicHelper::SaveShapeAsGraphic(weld::Window* pParent, const Reference< { Reference<css::drawing::XGraphicExportFilter> xGraphicExporter = css::drawing::GraphicExportFilter::create( xContext ); - Sequence<PropertyValue> aDescriptor( 2 ); - aDescriptor[0].Name = "MediaType"; - aDescriptor[0].Value <<= aExportMimeType; - aDescriptor[1].Name = "URL"; - aDescriptor[1].Value <<= sPath; + Sequence<PropertyValue> aDescriptor{ + comphelper::makePropertyValue("MediaType", aExportMimeType), + comphelper::makePropertyValue("URL", sPath) + }; Reference< XComponent > xSourceDocument( xShape, UNO_QUERY_THROW ); xGraphicExporter->setSourceDocument( xSourceDocument ); diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index aa67d543c1a0..ccd15f479b4f 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -911,8 +911,9 @@ bool EnhancedCustomShape2d::SetAdjustValueAsDouble( const double& rValue, const if ( nIndex < seqAdjustmentValues.getLength() ) { // updating our local adjustment sequence - seqAdjustmentValues[ nIndex ].Value <<= rValue; - seqAdjustmentValues[ nIndex ].State = css::beans::PropertyState_DIRECT_VALUE; + auto pseqAdjustmentValues = seqAdjustmentValues.getArray(); + pseqAdjustmentValues[ nIndex ].Value <<= rValue; + pseqAdjustmentValues[ nIndex ].State = css::beans::PropertyState_DIRECT_VALUE; bRetValue = true; } return bRetValue; diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index a4f3fc922fa0..c2b440d7f13e 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -469,9 +469,10 @@ Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL EnhancedCustomShap } Sequence< Reference< drawing::XCustomShapeHandle > > aSeq( nHdlCount ); + auto aSeqRange = asNonConstRange(aSeq); for ( i = 0; i < nHdlCount; i++ ) - aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i ); + aSeqRange[ i ] = new EnhancedCustomShapeHandle( mxShape, i ); return aSeq; } diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 02d087c98c25..ece0561d18f5 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -290,12 +290,14 @@ void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUStri } css::uno::Sequence< OUString > aFavCharList(maFavCharList.size()); + auto aFavCharListRange = asNonConstRange(aFavCharList); css::uno::Sequence< OUString > aFavCharFontList(maFavCharFontList.size()); + auto aFavCharFontListRange = asNonConstRange(aFavCharFontList); for (size_t i = 0; i < maFavCharList.size(); ++i) { - aFavCharList[i] = maFavCharList[i]; - aFavCharFontList[i] = maFavCharFontList[i]; + aFavCharListRange[i] = maFavCharList[i]; + aFavCharFontListRange[i] = maFavCharFontList[i]; } std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext)); @@ -325,12 +327,14 @@ void SvxShowCharSet::updateFavCharacterList(const OUString& sTitle, const OUStri maFavCharFontList.push_back(rFont); css::uno::Sequence< OUString > aFavCharList(maFavCharList.size()); + auto aFavCharListRange = asNonConstRange(aFavCharList); css::uno::Sequence< OUString > aFavCharFontList(maFavCharFontList.size()); + auto aFavCharFontListRange = asNonConstRange(aFavCharFontList); for (size_t i = 0; i < maFavCharList.size(); ++i) { - aFavCharList[i] = maFavCharList[i]; - aFavCharFontList[i] = maFavCharFontList[i]; + aFavCharListRange[i] = maFavCharList[i]; + aFavCharFontListRange[i] = maFavCharFontList[i]; } std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(mxContext)); diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 30af216be404..1eb6a32501f2 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -34,6 +34,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/module.hxx> #include <comphelper/fileformat.h> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <tools/stream.hxx> #include <unotools/localedatawrapper.hxx> @@ -222,13 +223,11 @@ void CompressGraphicsDialog::Compress(SvStream& aStream) Graphic aScaledGraphic( aBitmap ); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - Sequence< PropertyValue > aFilterData( 3 ); - aFilterData[ 0 ].Name = "Interlaced"; - aFilterData[ 0 ].Value <<= sal_Int32(0); - aFilterData[ 1 ].Name = "Compression"; - aFilterData[ 1 ].Value <<= static_cast<sal_Int32>(m_xCompressionMF->get_value()); - aFilterData[ 2 ].Name = "Quality"; - aFilterData[ 2 ].Value <<= static_cast<sal_Int32>(m_xQualityMF->get_value()); + Sequence< PropertyValue > aFilterData{ + comphelper::makePropertyValue("Interlaced", sal_Int32(0)), + comphelper::makePropertyValue("Compression", static_cast<sal_Int32>(m_xCompressionMF->get_value())), + comphelper::makePropertyValue("Quality", static_cast<sal_Int32>(m_xQualityMF->get_value())) + }; OUString aGraphicFormatName = m_xLosslessRB->get_active() ? OUString( "png" ) : OUString( "jpg" ); diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 94130ae491e7..fa4449c46b95 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -22,6 +22,7 @@ #include <bitmaps.hlst> #include <docrecovery.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/string.hxx> #include <o3tl/safeint.hxx> @@ -101,11 +102,12 @@ void RecoveryCore::saveBrokenTempEntries(const OUString& rPath) // prepare all needed parameters for the following dispatch() request. css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP); css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3); - lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; - lCopyArgs[0].Value <<= false; - lCopyArgs[1].Name = PROP_SAVEPATH; - lCopyArgs[1].Value <<= rPath; - lCopyArgs[2].Name = PROP_ENTRYID; + auto plCopyArgs = lCopyArgs.getArray(); + plCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; + plCopyArgs[0].Value <<= false; + plCopyArgs[1].Name = PROP_SAVEPATH; + plCopyArgs[1].Value <<= rPath; + plCopyArgs[2].Name = PROP_ENTRYID; // lCopyArgs[2].Value will be changed during next loop... // work on a copied list only... @@ -118,7 +120,7 @@ void RecoveryCore::saveBrokenTempEntries(const OUString& rPath) if (!RecoveryCore::isBrokenTempEntry(rInfo)) continue; - lCopyArgs[2].Value <<= rInfo.ID; + plCopyArgs[2].Value <<= rInfo.ID; m_xRealCore->dispatch(aCopyURL, lCopyArgs); } } @@ -135,11 +137,12 @@ void RecoveryCore::saveAllTempEntries(const OUString& rPath) // prepare all needed parameters for the following dispatch() request. css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP); css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3); - lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; - lCopyArgs[0].Value <<= false; - lCopyArgs[1].Name = PROP_SAVEPATH; - lCopyArgs[1].Value <<= rPath; - lCopyArgs[2].Name = PROP_ENTRYID; + auto plCopyArgs = lCopyArgs.getArray(); + plCopyArgs[0].Name = PROP_DISPATCHASYNCHRON; + plCopyArgs[0].Value <<= false; + plCopyArgs[1].Name = PROP_SAVEPATH; + plCopyArgs[1].Value <<= rPath; + plCopyArgs[2].Name = PROP_ENTRYID; // lCopyArgs[2].Value will be changed during next loop ... // work on a copied list only ... @@ -152,7 +155,7 @@ void RecoveryCore::saveAllTempEntries(const OUString& rPath) if (rInfo.TempURL.isEmpty()) continue; - lCopyArgs[2].Value <<= rInfo.ID; + plCopyArgs[2].Value <<= rInfo.ID; m_xRealCore->dispatch(aCopyURL, lCopyArgs); } } @@ -165,9 +168,10 @@ void RecoveryCore::forgetBrokenTempEntries() css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); - lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; - lRemoveArgs[0].Value <<= false; - lRemoveArgs[1].Name = PROP_ENTRYID; + auto plRemoveArgs = lRemoveArgs.getArray(); + plRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; + plRemoveArgs[0].Value <<= false; + plRemoveArgs[1].Name = PROP_ENTRYID; // lRemoveArgs[1].Value will be changed during next loop ... // work on a copied list only ... @@ -180,7 +184,7 @@ void RecoveryCore::forgetBrokenTempEntries() if (!RecoveryCore::isBrokenTempEntry(rInfo)) continue; - lRemoveArgs[1].Value <<= rInfo.ID; + plRemoveArgs[1].Value <<= rInfo.ID; m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); } } @@ -193,9 +197,10 @@ void RecoveryCore::forgetAllRecoveryEntries() css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); - lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; - lRemoveArgs[0].Value <<= false; - lRemoveArgs[1].Name = PROP_ENTRYID; + auto plRemoveArgs = lRemoveArgs.getArray(); + plRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; + plRemoveArgs[0].Value <<= false; + plRemoveArgs[1].Name = PROP_ENTRYID; // lRemoveArgs[1].Value will be changed during next loop ... // work on a copied list only ... @@ -205,7 +210,7 @@ void RecoveryCore::forgetAllRecoveryEntries() TURLList lURLs = m_lURLs; for (const TURLInfo& rInfo : lURLs) { - lRemoveArgs[1].Value <<= rInfo.ID; + plRemoveArgs[1].Value <<= rInfo.ID; m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); } } @@ -218,9 +223,10 @@ void RecoveryCore::forgetBrokenRecoveryEntries() css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP); css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2); - lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; - lRemoveArgs[0].Value <<= false; - lRemoveArgs[1].Name = PROP_ENTRYID; + auto plRemoveArgs = lRemoveArgs.getArray(); + plRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON; + plRemoveArgs[0].Value <<= false; + plRemoveArgs[1].Name = PROP_ENTRYID; // lRemoveArgs[1].Value will be changed during next loop ... // work on a copied list only ... @@ -233,7 +239,7 @@ void RecoveryCore::forgetBrokenRecoveryEntries() if (!RecoveryCore::isBrokenTempEntry(rInfo)) continue; - lRemoveArgs[1].Value <<= rInfo.ID; + plRemoveArgs[1].Value <<= rInfo.ID; m_xRealCore->dispatch(aRemoveURL, lRemoveArgs); } } @@ -258,9 +264,8 @@ void RecoveryCore::doEmergencySavePrepare() css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE); - css::uno::Sequence< css::beans::PropertyValue > lArgs(1); - lArgs[0].Name = PROP_DISPATCHASYNCHRON; - lArgs[0].Value <<= false; + css::uno::Sequence< css::beans::PropertyValue > lArgs{ comphelper::makePropertyValue( + PROP_DISPATCHASYNCHRON, false) }; m_xRealCore->dispatch(aURL, lArgs); } @@ -273,11 +278,10 @@ void RecoveryCore::doEmergencySave() css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_EMERGENCY_SAVE); - css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - lArgs[0].Name = PROP_STATUSINDICATOR; - lArgs[0].Value <<= m_xProgress; - lArgs[1].Name = PROP_DISPATCHASYNCHRON; - lArgs[1].Value <<= true; + css::uno::Sequence< css::beans::PropertyValue > lArgs{ + comphelper::makePropertyValue(PROP_STATUSINDICATOR, m_xProgress), + comphelper::makePropertyValue(PROP_DISPATCHASYNCHRON, true) + }; m_xRealCore->dispatch(aURL, lArgs); } @@ -290,11 +294,10 @@ void RecoveryCore::doRecovery() css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_RECOVERY); - css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - lArgs[0].Name = PROP_STATUSINDICATOR; - lArgs[0].Value <<= m_xProgress; - lArgs[1].Name = PROP_DISPATCHASYNCHRON; - lArgs[1].Value <<= true; + css::uno::Sequence< css::beans::PropertyValue > lArgs{ + comphelper::makePropertyValue(PROP_STATUSINDICATOR, m_xProgress), + comphelper::makePropertyValue(PROP_DISPATCHASYNCHRON, true) + }; m_xRealCore->dispatch(aURL, lArgs); } diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index b10e6deb580e..006b07cc0918 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -378,16 +378,17 @@ void SvxRubyDialog::SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& void SvxRubyDialog::GetRubyText() { tools::Long nTempLastPos = GetLastPos(); + Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); + auto aRubyValuesRange = asNonConstRange(aRubyValues); for (int i = 0; i < 8; i += 2) { if (aEditArr[i]->get_sensitive() && (aEditArr[i]->get_value_changed_from_saved() || aEditArr[i + 1]->get_value_changed_from_saved())) { - Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index"); SetModified(true); - for (PropertyValue& propVal : asNonConstRange(aRubyValues[i / 2 + nTempLastPos])) + for (PropertyValue& propVal : asNonConstRange(aRubyValuesRange[i / 2 + nTempLastPos])) { if (propVal.Name == cRubyBaseText) propVal.Value <<= aEditArr[i]->get_text(); diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index e40cb6885b59..52bead204d28 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/security/DocumentDigitalSignatures.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/xmlsechelper.hxx> @@ -117,9 +118,8 @@ uno::Reference<graphic::XGraphic> importSVG(std::u16string_view rSVG) uno::Reference<graphic::XGraphicProvider> xProvider = graphic::GraphicProvider::create(xContext); - uno::Sequence<beans::PropertyValue> aMediaProperties(1); - aMediaProperties[0].Name = "InputStream"; - aMediaProperties[0].Value <<= xInputStream; + uno::Sequence<beans::PropertyValue> aMediaProperties{ comphelper::makePropertyValue( + "InputStream", xInputStream) }; uno::Reference<graphic::XGraphic> xGraphic(xProvider->queryGraphic(aMediaProperties)); return xGraphic; } diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx index 392dddab607d..018fd3f5e3d5 100644 --- a/svx/source/form/databaselocationinput.cxx +++ b/svx/source/form/databaselocationinput.cxx @@ -171,8 +171,7 @@ namespace svx "DatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow: unable to determine the file extension(s)!" ); if ( !m_aFilterExtensions.hasElements() ) { - m_aFilterExtensions.realloc(1); - m_aFilterExtensions[0] = "*.odb"; + m_aFilterExtensions = { "*.odb" }; } } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 3571e2e71f05..d974e9ad9484 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -3509,8 +3509,7 @@ void FmXFormShell::SetWizardUsing_Lock(bool _bUseThem) m_bUseWizards = _bUseThem; Sequence< OUString > aNames { "FormControlPilotsEnabled" }; - Sequence< Any > aValues(1); - aValues[0] <<= m_bUseWizards; + Sequence< Any > aValues{ Any(m_bUseWizards) }; PutProperties(aNames, aValues); } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index eb13c53a4848..ea676a807cf0 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> @@ -695,9 +696,8 @@ namespace svx DBG_ASSERT( pBoolItem, "FmTextControlShell::executeAttributeDialog: no bool item?!" ); if ( pBoolItem ) { - aArgs.realloc( 1 ); - aArgs[ 0 ].Name = "Enable"; - aArgs[ 0 ].Value <<= pBoolItem->GetValue(); + aArgs = { comphelper::makePropertyValue("Enable", + pBoolItem->GetValue()) }; } } diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index e84ac41a33d0..50e0d4f592d9 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -932,20 +932,22 @@ Sequence< Sequence< OUString > > FormController::getPredicateExpressions() impl_checkDisposed_throw(); Sequence< Sequence< OUString > > aExpressions( m_aFilterRows.size() ); + auto aExpressionsRange = asNonConstRange(aExpressions); sal_Int32 termIndex = 0; for (const FmFilterRow& rRow : m_aFilterRows) { Sequence< OUString > aConjunction( m_aFilterComponents.size() ); + auto aConjunctionRange = asNonConstRange(aConjunction); sal_Int32 componentIndex = 0; for (const auto& rComp : m_aFilterComponents) { FmFilterRow::const_iterator predicate = rRow.find( rComp ); if ( predicate != rRow.end() ) - aConjunction[ componentIndex ] = predicate->second; + aConjunctionRange[ componentIndex ] = predicate->second; ++componentIndex; } - aExpressions[ termIndex ] = aConjunction; + aExpressionsRange[ termIndex ] = aConjunction; ++termIndex; } @@ -2330,7 +2332,7 @@ Reference< XControl > FormController::findControl(Sequence< Reference< XControl if ( _bRemove ) ::comphelper::removeElementAt( _rControls, i ); else if ( _bOverWrite ) - _rControls[i].clear(); + _rControls.getArray()[i].clear(); return xControl; } return Reference< XControl > (); diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index b42709dda10e..05576133d0cd 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.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 <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -45,10 +48,8 @@ void SvxFmAbsRecWin::PositionFired(sal_Int64 nRecord) SfxInt32Item aPositionParam( FN_PARAM_1, static_cast<sal_Int32>(nRecord) ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "Position"; aPositionParam.QueryValue( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("Position", a) }; m_pController->Dispatch( ".uno:AbsoluteRecord", aArgs ); m_pController->updateStatus(); diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 6d8cc179c53b..e33e16974ce3 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -35,6 +35,7 @@ #include <algorithm> #include <svx/dialmgr.hxx> #include <comphelper/dispatchcommand.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <svx/svxdlg.hxx> #include <memory> @@ -362,9 +363,9 @@ void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint ) IMPL_STATIC_LINK_NOARG( GalleryBrowser1, OnMoreGalleriesClick, weld::Button&, void) { - css::uno::Sequence<css::beans::PropertyValue> aArgs(1); - aArgs[0].Name = "AdditionsTag"; - aArgs[0].Value <<= OUString("Gallery"); + css::uno::Sequence<css::beans::PropertyValue> aArgs{ + comphelper::makePropertyValue("AdditionsTag", OUString("Gallery")) + }; comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs); } diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 3990fe4766e0..ffd38f8f45a5 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -39,6 +39,7 @@ #include <svx/svxdlg.hxx> #include <svx/galleryitem.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -46,6 +47,8 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/style/GraphicLocation.hpp> + +#include <cassert> #include <map> #include <memory> #include <cppuhelper/implbase.hxx> @@ -310,19 +313,14 @@ void GalleryThemePopup::BackgroundMenuSelectHdl(sal_uInt16 nPos) OUString aURL( mpBrowser->GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); OUString aFilterName( mpBrowser->GetFilterName() ); - css::uno::Sequence< css::beans::PropertyValue > aArgs( 6 ); - aArgs[0].Name = "Background.Transparent"; - aArgs[0].Value <<= sal_Int32( 0 ); // 0 - 100 - aArgs[1].Name = "Background.BackColor"; - aArgs[1].Value <<= sal_Int32( - 1 ); - aArgs[2].Name = "Background.URL"; - aArgs[2].Value <<= aURL; - aArgs[3].Name = "Background.Filtername"; // FIXME should be FilterName - aArgs[3].Value <<= aFilterName; - aArgs[4].Name = "Background.Position"; - aArgs[4].Value <<= css::style::GraphicLocation_TILED; - aArgs[5].Name = "Position"; - aArgs[5].Value <<= nPos; + css::uno::Sequence< css::beans::PropertyValue > aArgs{ + comphelper::makePropertyValue("Background.Transparent", sal_Int32( 0 )), // 0 - 100 + comphelper::makePropertyValue("Background.BackColor", sal_Int32( - 1 )), + comphelper::makePropertyValue("Background.URL", aURL), + comphelper::makePropertyValue("Background.Filtername", aFilterName), // FIXME name should be FilterName + comphelper::makePropertyValue("Background.Position", css::style::GraphicLocation_TILED), + comphelper::makePropertyValue("Position", nPos) + }; const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_BG_BRUSH ); if ( it != m_aCommandInfo.end() ) @@ -1067,22 +1065,17 @@ void GalleryBrowser2::DispatchAdd( xGraphic.set( aGraphic.GetXGraphic() ); OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" ); - css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS ); - - aSeq[0].Name = SVXGALLERYITEM_TYPE; - aSeq[0].Value <<= nType; - aSeq[1].Name = SVXGALLERYITEM_URL; - aSeq[1].Value <<= OUString(); - aSeq[2].Name = SVXGALLERYITEM_FILTER; - aSeq[2].Value <<= aFilterName; - aSeq[3].Name = SVXGALLERYITEM_DRAWING; - aSeq[3].Value <<= xDrawing; - aSeq[4].Name = SVXGALLERYITEM_GRAPHIC; - aSeq[4].Value <<= xGraphic; - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = SVXGALLERYITEM_ARGNAME; - aArgs[0].Value <<= aSeq; + css::uno::Sequence< css::beans::PropertyValue > aSeq{ + comphelper::makePropertyValue(SVXGALLERYITEM_TYPE, nType), + comphelper::makePropertyValue(SVXGALLERYITEM_URL, OUString()), + comphelper::makePropertyValue(SVXGALLERYITEM_FILTER, aFilterName), + comphelper::makePropertyValue(SVXGALLERYITEM_DRAWING, xDrawing), + comphelper::makePropertyValue(SVXGALLERYITEM_GRAPHIC, xGraphic) + }; + assert(aSeq.getLength() == SVXGALLERYITEM_PARAMS); + + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + SVXGALLERYITEM_ARGNAME, aSeq) }; std::unique_ptr<DispatchInfo> pInfo(new DispatchInfo); pInfo->TargetURL = aURL; diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 7f7ce9980255..9713b82a109e 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -238,11 +238,8 @@ bool CreateDir( const INetURLObject& rURL ) INetURLObject aParentURL( rURL ); aParentURL.removeSegment(); ::ucbhelper::Content aParent( aParentURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aCmdEnv, comphelper::getProcessComponentContext() ); - uno::Sequence< OUString > aProps( 1 ); - uno::Sequence< uno::Any > aValues( 1 ); - - aProps[0] = "Title"; - aValues[0] <<= rURL.GetLastName(); + uno::Sequence< OUString > aProps{ "Title" }; + uno::Sequence< uno::Any > aValues{ uno::Any(rURL.GetLastName()) }; ::ucbhelper::Content aContent( rURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aCmdEnv, comphelper::getProcessComponentContext() ); bRet = aParent.insertNewContent( "application/vnd.sun.staroffice.fsys-folder", aProps, aValues, aContent ); diff --git a/svx/source/items/clipfmtitem.cxx b/svx/source/items/clipfmtitem.cxx index 1842d42dc40e..8ed567cdebcd 100644 --- a/svx/source/items/clipfmtitem.cxx +++ b/svx/source/items/clipfmtitem.cxx @@ -56,11 +56,13 @@ bool SvxClipboardFormatItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMembe css::frame::status::ClipboardFormats aClipFormats; aClipFormats.Identifiers.realloc( nCount ); + auto pIdentifiers = aClipFormats.Identifiers.getArray(); aClipFormats.Names.realloc( nCount ); + auto pNames = aClipFormats.Names.getArray(); for ( sal_uInt16 n=0; n < nCount; n++ ) { - aClipFormats.Identifiers[n] = static_cast<sal_Int64>(GetClipbrdFormatId( n )); - aClipFormats.Names[n] = GetClipbrdFormatName( n ); + pIdentifiers[n] = static_cast<sal_Int64>(GetClipbrdFormatId( n )); + pNames[n] = GetClipbrdFormatName( n ); } rVal <<= aClipFormats; diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index a2cd8c8d32b2..d4e164ff5c88 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -40,7 +40,7 @@ SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< bea for ( i = 0; i < aPropSeq.getLength(); i++ ) { - beans::PropertyValue& rPropVal = aPropSeq[ i ]; + const beans::PropertyValue& rPropVal = aPropSeq[ i ]; std::pair<PropertyHashMap::iterator, bool> const ret( aPropHashMap.insert(std::make_pair(rPropVal.Name, i))); assert(ret.second); // serious bug: duplicate xml attribute exported @@ -66,7 +66,7 @@ css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUStrin css::uno::Any* pRet = nullptr; PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) ); if ( aHashIter != aPropHashMap.end() ) - pRet = &aPropSeq[ (*aHashIter).second ].Value; + pRet = &aPropSeq.getArray()[ (*aHashIter).second ].Value; return pRet; } @@ -90,7 +90,7 @@ css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUStrin PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) ); if ( aHashIter != aPropPairHashMap.end() ) { - pRet = &const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence)[ (*aHashIter).second ].Value; + pRet = &const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence).getArray()[ (*aHashIter).second ].Value; } } } @@ -146,7 +146,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal { return rVal.Name == rPropVal.Name; } )); sal_uInt32 nIndex = aPropSeq.getLength(); aPropSeq.realloc( nIndex + 1 ); - aPropSeq[ nIndex ] = rPropVal ; + aPropSeq.getArray()[ nIndex ] = rPropVal ; aPropHashMap[ rPropVal.Name ] = nIndex; } @@ -172,10 +172,11 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName { return rV.Name == rSequenceName; } )); sal_uInt32 nIndex = aPropSeq.getLength(); aPropSeq.realloc( nIndex + 1 ); - aPropSeq[ nIndex ] = aValue; + auto pPropSeq = aPropSeq.getArray(); + pPropSeq[ nIndex ] = aValue; aPropHashMap[ rSequenceName ] = nIndex; - pSeqAny = &aPropSeq[ nIndex ].Value; + pSeqAny = &pPropSeq[ nIndex ].Value; } if (auto pSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny)) @@ -185,13 +186,13 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName auto& rSeq = const_cast<css::uno::Sequence<css::beans::PropertyValue>&>(*pSecSequence); if (aHashIter != aPropPairHashMap.end()) { - rSeq[(*aHashIter).second].Value = rPropVal.Value; + rSeq.getArray()[(*aHashIter).second].Value = rPropVal.Value; } else { const sal_Int32 nCount = pSecSequence->getLength(); rSeq.realloc(nCount + 1); - rSeq[nCount] = rPropVal; + rSeq.getArray()[nCount] = rPropVal; aPropPairHashMap[PropertyPair(rSequenceName, rPropVal.Name)] = nCount; } @@ -208,7 +209,8 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName ) if ( aHashIter == aPropHashMap.end() ) return; - css::uno::Any& rSeqAny = aPropSeq[(*aHashIter).second].Value; + auto pPropSeq = aPropSeq.getArray(); + css::uno::Any& rSeqAny = pPropSeq[(*aHashIter).second].Value; if (auto pSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(rSeqAny)) { @@ -227,7 +229,7 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName ) { PropertyHashMap::iterator aHashIter2( aPropHashMap.find( aPropSeq[ nLength - 1 ].Name ) ); (*aHashIter2).second = nIndex; - aPropSeq[ nIndex ] = aPropSeq[ nLength - 1 ]; + pPropSeq[ nIndex ] = aPropSeq[ nLength - 1 ]; } aPropSeq.realloc( nLength - 1 ); } diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx index e5c1762c377e..5e50c5efbe3c 100644 --- a/svx/source/items/galleryitem.cxx +++ b/svx/source/items/galleryitem.cxx @@ -24,6 +24,10 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/uno/Sequence.hxx> +#include <comphelper/propertyvalue.hxx> + +#include <cassert> + SfxPoolItem* SvxGalleryItem::CreateDefault() { return new SvxGalleryItem; } @@ -47,18 +51,14 @@ SvxGalleryItem::~SvxGalleryItem() bool SvxGalleryItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberId */ ) const { - css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS ); - - aSeq[0].Name = SVXGALLERYITEM_TYPE; - aSeq[0].Value <<= m_nType; - aSeq[1].Name = SVXGALLERYITEM_URL; - aSeq[1].Value <<= m_aURL; - aSeq[2].Name = SVXGALLERYITEM_FILTER; - aSeq[2].Value <<= m_aURL; - aSeq[3].Name = SVXGALLERYITEM_DRAWING; - aSeq[3].Value <<= m_xDrawing; - aSeq[4].Name = SVXGALLERYITEM_GRAPHIC; - aSeq[4].Value <<= m_xGraphic; + css::uno::Sequence< css::beans::PropertyValue > aSeq{ + comphelper::makePropertyValue(SVXGALLERYITEM_TYPE, m_nType), + comphelper::makePropertyValue(SVXGALLERYITEM_URL, m_aURL), + comphelper::makePropertyValue(SVXGALLERYITEM_FILTER, m_aURL), + comphelper::makePropertyValue(SVXGALLERYITEM_DRAWING, m_xDrawing), + comphelper::makePropertyValue(SVXGALLERYITEM_GRAPHIC, m_xGraphic) + }; + assert(aSeq.getLength() == SVXGALLERYITEM_PARAMS); rVal <<= aSeq; diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx index 32147af1f5a1..4ab6472c0774 100644 --- a/svx/source/items/viewlayoutitem.cxx +++ b/svx/source/items/viewlayoutitem.cxx @@ -21,8 +21,11 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/propertyvalue.hxx> #include <osl/diagnose.h> +#include <cassert> + SfxPoolItem* SvxViewLayoutItem::CreateDefault() { return new SvxViewLayoutItem; } @@ -76,11 +79,11 @@ bool SvxViewLayoutItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c { case 0 : { - css::uno::Sequence< css::beans::PropertyValue > aSeq( VIEWLAYOUT_PARAMS ); - aSeq[0].Name = VIEWLAYOUT_PARAM_COLUMNS; - aSeq[0].Value <<= sal_Int32( GetValue() ); - aSeq[1].Name = VIEWLAYOUT_PARAM_BOOKMODE; - aSeq[1].Value <<= mbBookMode; + css::uno::Sequence< css::beans::PropertyValue > aSeq{ + comphelper::makePropertyValue(VIEWLAYOUT_PARAM_COLUMNS, sal_Int32( GetValue() )), + comphelper::makePropertyValue(VIEWLAYOUT_PARAM_BOOKMODE, mbBookMode) + }; + assert(aSeq.getLength() == VIEWLAYOUT_PARAMS); rVal <<= aSeq; } break; diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx index 40c83cdd1655..94bc8cce7bad 100644 --- a/svx/source/items/zoomslideritem.cxx +++ b/svx/source/items/zoomslideritem.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 <osl/diagnose.h> #include <svx/zoomslideritem.hxx> @@ -59,15 +62,13 @@ bool SvxZoomSliderItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c { case 0 : { - css::uno::Sequence< css::beans::PropertyValue > aSeq( ZOOMSLIDER_PARAMS ); - aSeq[0].Name = ZOOMSLIDER_PARAM_CURRENTZOOM; - aSeq[0].Value <<= sal_Int32( GetValue() ); - aSeq[1].Name = ZOOMSLIDER_PARAM_SNAPPINGPOINTS; - aSeq[1].Value <<= maValues; - aSeq[2].Name = ZOOMSLIDER_PARAM_MINZOOM; - aSeq[2].Value <<= mnMinZoom; - aSeq[3].Name = ZOOMSLIDER_PARAM_MAXZOOM; - aSeq[3].Value <<= mnMaxZoom; + css::uno::Sequence< css::beans::PropertyValue > aSeq{ + comphelper::makePropertyValue(ZOOMSLIDER_PARAM_CURRENTZOOM, sal_Int32( GetValue() )), + comphelper::makePropertyValue(ZOOMSLIDER_PARAM_SNAPPINGPOINTS, maValues), + comphelper::makePropertyValue(ZOOMSLIDER_PARAM_MINZOOM, mnMinZoom), + comphelper::makePropertyValue(ZOOMSLIDER_PARAM_MAXZOOM, mnMaxZoom) + }; + assert(aSeq.getLength() == ZOOMSLIDER_PARAMS); rVal <<= aSeq; } break; diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx index 5726f4c036d2..1633561a5b8d 100644 --- a/svx/source/mnuctrls/clipboardctl.cxx +++ b/svx/source/mnuctrls/clipboardctl.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 <sfx2/tbxctrl.hxx> #include <svl/intitem.hxx> #include <vcl/svapp.hxx> @@ -82,10 +85,8 @@ void SvxClipBoardControl::CreatePopupWindow() SfxUInt32Item aItem(SID_CLIPBOARD_FORMAT_ITEMS, sResult.toUInt32()); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "SelectedFormat"; aItem.QueryValue( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("SelectedFormat", a) }; Dispatch( ".uno:ClipboardFormatItems", aArgs ); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 5a1e500f6c48..86bda89c4282 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -19,6 +19,7 @@ #include <svx/sdr/overlay/overlaymanager.hxx> #include <basegfx/range/b2drange.hxx> +#include <comphelper/propertyvalue.hxx> #include <tools/gen.hxx> #include <vcl/canvastools.hxx> #include <vcl/outdev.hxx> @@ -120,9 +121,9 @@ namespace sdr::overlay { // set Property 'ReducedDisplayQuality' to true to allow simpler interaction // visualisations - uno::Sequence< beans::PropertyValue > xProperties(1); - xProperties[0].Name = "ReducedDisplayQuality"; - xProperties[0].Value <<= true; + uno::Sequence< beans::PropertyValue > xProperties{ + comphelper::makePropertyValue("ReducedDisplayQuality", true) + }; maViewInformation2D = drawinglayer::geometry::createViewInformation2D(xProperties); } diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index 6b28dec427d4..913590833217 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -137,7 +137,9 @@ void SmartTagMgr::GetActionSequences( std::vector< OUString >& rSmartTagTypes, Sequence < Sequence< sal_Int32 > >& rActionIndicesSequence ) const { rActionComponentsSequence.realloc( rSmartTagTypes.size() ); + auto pActionComponentsSequence = rActionComponentsSequence.getArray(); rActionIndicesSequence.realloc( rSmartTagTypes.size() ); + auto pActionIndicesSequence = rActionIndicesSequence.getArray(); for ( size_t j = 0; j < rSmartTagTypes.size(); ++j ) { @@ -146,19 +148,21 @@ void SmartTagMgr::GetActionSequences( std::vector< OUString >& rSmartTagTypes, const sal_Int32 nNumberOfActionRefs = maSmartTagMap.count( rSmartTagType ); Sequence< Reference< smarttags::XSmartTagAction > > aActions( nNumberOfActionRefs ); + auto aActionsRange = asNonConstRange(aActions); Sequence< sal_Int32 > aIndices( nNumberOfActionRefs ); + auto aIndicesRange = asNonConstRange(aIndices); sal_uInt16 i = 0; auto iters = maSmartTagMap.equal_range( rSmartTagType ); for ( auto aActionsIter = iters.first; aActionsIter != iters.second; ++aActionsIter ) { - aActions[ i ] = (*aActionsIter).second.mxSmartTagAction; - aIndices[ i++ ] = (*aActionsIter).second.mnSmartTagIndex; + aActionsRange[ i ] = (*aActionsIter).second.mxSmartTagAction; + aIndicesRange[ i++ ] = (*aActionsIter).second.mnSmartTagIndex; } - rActionComponentsSequence[ j ] = aActions; - rActionIndicesSequence[ j ] = aIndices; + pActionComponentsSequence[ j ] = aActions; + pActionIndicesSequence[ j ] = aIndices; } } @@ -375,8 +379,7 @@ void SmartTagMgr::PrepareConfiguration( std::u16string_view rConfigurationGroupN beans::PropertyValue aPathArgument; aPathArgument.Name = "nodepath"; aPathArgument.Value = aAny; - Sequence< Any > aArguments( 1 ); - aArguments[ 0 ] <<= aPathArgument; + Sequence< Any > aArguments{ Any(aPathArgument) }; Reference< lang::XMultiServiceFactory > xConfProv = configuration::theDefaultProvider::get( mxContext ); // try to get read-write access to configuration: diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index 75f94f8c83c7..f273afcdbc61 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.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/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/fieldvalues.hxx> @@ -366,12 +369,9 @@ void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt ) css::uno::Any a; SfxUInt32Item aItem( SID_PSZ_FUNCTION, nSelect ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "StatusBarFunc"; aItem.QueryValue( a ); - aArgs[0].Value = a; - + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + "StatusBarFunc", a) }; execute( ".uno:StatusBarFunc", aArgs ); } } diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index 9a77a9431225..8c32f3ed842a 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -21,6 +21,7 @@ #include <string_view> +#include <comphelper/propertyvalue.hxx> #include <vcl/event.hxx> #include <vcl/status.hxx> #include <vcl/svapp.hxx> @@ -158,13 +159,11 @@ bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt ) css::uno::Any a; SfxUInt16Item aState( GetSlotId(), mnState ); - INetURLObject aObj( m_aCommandURL ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); aState.QueryValue( a ); - aArgs[0].Value = a; + INetURLObject aObj( m_aCommandURL ); + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aObj.GetURLPath(), a) }; execute( aArgs ); } } diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index e85868cda947..0a26128d940f 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -17,7 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <comphelper/propertyvalue.hxx> #include <vcl/commandevent.hxx> #include <vcl/image.hxx> #include <vcl/event.hxx> @@ -109,13 +111,11 @@ void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt ) { css::uno::Any a; SfxUInt16Item aState( GetSlotId(), 0 ); - INetURLObject aObj( m_aCommandURL ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); aState.QueryValue( a ); - aArgs[0].Value = a; + INetURLObject aObj( m_aCommandURL ); + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aObj.GetURLPath(), a) }; execute( aArgs ); } } diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx index 3e3a91b6957d..57cf99bbde7c 100644 --- a/svx/source/stbctrls/zoomctrl.cxx +++ b/svx/source/stbctrls/zoomctrl.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 <i18nutil/unicode.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> @@ -178,13 +181,11 @@ void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt ) aZoom.SetType(SvxZoomType::WHOLEPAGE); css::uno::Any a; - INetURLObject aObj( m_aCommandURL ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); aZoom.QueryValue( a ); - aArgs[0].Value = a; + INetURLObject aObj( m_aCommandURL ); + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aObj.GetURLPath(), a) }; execute( aArgs ); } } @@ -215,13 +216,11 @@ bool SvxZoomPageStatusBarControl::MouseButtonDown(const MouseEvent&) SvxZoomItem aZoom( SvxZoomType::WHOLEPAGE, 0, GetId() ); css::uno::Any a; - INetURLObject aObj( m_aCommandURL ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); aZoom.QueryValue( a ); - aArgs[0].Value = a; + INetURLObject aObj( m_aCommandURL ); + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aObj.GetURLPath(), a) }; execute( aArgs ); return true; diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index f85bb58a2ed5..c0790b07458a 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -18,6 +18,8 @@ */ #include <svx/zoomsliderctrl.hxx> + +#include <comphelper/propertyvalue.hxx> #include <vcl/status.hxx> #include <vcl/image.hxx> #include <vcl/svapp.hxx> @@ -382,10 +384,8 @@ void SvxZoomSliderControl::repaintAndExecute() css::uno::Any any; aZoomSliderItem.QueryValue(any); - css::uno::Sequence<css::beans::PropertyValue> aArgs(1); - aArgs[0].Name = "ZoomSlider"; - aArgs[0].Value = any; - + css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue("ZoomSlider", + any) }; execute(aArgs); } diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx index c9ca7041f261..3146d62f7df3 100644 --- a/svx/source/svdraw/svdlayer.cxx +++ b/svx/source/svdraw/svdlayer.cxx @@ -22,6 +22,8 @@ #include <svx/svdlayer.hxx> #include <svx/svdmodel.hxx> +#include <algorithm> + bool SdrLayerIDSet::IsEmpty() const { for(sal_uInt8 i : aData) @@ -351,10 +353,8 @@ void SdrLayerAdmin::QueryValue(const SdrLayerIDSet& rViewLayerSet, css::uno::Any } } css::uno::Sequence< sal_Int8 > aSeq( nNumBytesSet ); - for( auto nIndex = 0; nIndex < nNumBytesSet; nIndex++ ) - { - aSeq[nIndex] = static_cast<sal_Int8>(aTmp[nIndex]); - } + std::transform(aTmp, aTmp + nNumBytesSet, aSeq.getArray(), + [](const sal_uInt8 b) { return static_cast<sal_Int8>(b); }); rAny <<= aSeq; } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 1b35ecd272c7..15eed6733ab0 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/uno/Sequence.h> #include <tools/helpers.hxx> @@ -383,11 +384,9 @@ Reference< XCustomShapeEngine > const & SdrObjCustomShape::GetCustomShapeEngine( Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this)); if ( aXShape.is() ) { - Sequence< Any > aArgument( 1 ); - Sequence< PropertyValue > aPropValues( 1 ); - aPropValues[ 0 ].Name = "CustomShape"; - aPropValues[ 0 ].Value <<= aXShape; - aArgument[ 0 ] <<= aPropValues; + Sequence< PropertyValue > aPropValues{ comphelper::makePropertyValue("CustomShape", + aXShape) }; + Sequence< Any > aArgument{ Any(aPropValues) }; try { Reference<XInterface> xInterface(xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext)); @@ -690,29 +689,30 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: { SvxMSDffHandleFlags nFlags = pData->nFlags; sal_Int32 n=0; + auto pPropValues = rPropValues.getArray(); // POSITION { css::drawing::EnhancedCustomShapeParameterPair aPosition; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, true, true ); EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, true, false ); - rPropValues[ n ].Name = "Position"; - rPropValues[ n++ ].Value <<= aPosition; + pPropValues[ n ].Name = "Position"; + pPropValues[ n++ ].Value <<= aPosition; } if ( nFlags & SvxMSDffHandleFlags::MIRRORED_X ) { - rPropValues[ n ].Name = "MirroredX"; - rPropValues[ n++ ].Value <<= true; + pPropValues[ n ].Name = "MirroredX"; + pPropValues[ n++ ].Value <<= true; } if ( nFlags & SvxMSDffHandleFlags::MIRRORED_Y ) { - rPropValues[ n ].Name = "MirroredY"; - rPropValues[ n++ ].Value <<= true; + pPropValues[ n ].Name = "MirroredY"; + pPropValues[ n++ ].Value <<= true; } if ( nFlags & SvxMSDffHandleFlags::SWITCHED ) { - rPropValues[ n ].Name = "Switched"; - rPropValues[ n++ ].Value <<= true; + pPropValues[ n ].Name = "Switched"; + pPropValues[ n++ ].Value <<= true; } if ( nFlags & SvxMSDffHandleFlags::POLAR ) { @@ -721,8 +721,8 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: bool( nFlags & SvxMSDffHandleFlags::CENTER_X_IS_SPECIAL ), true ); EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.Second, pData->nCenterY, bool( nFlags & SvxMSDffHandleFlags::CENTER_Y_IS_SPECIAL ), false ); - rPropValues[ n ].Name = "Polar"; - rPropValues[ n++ ].Value <<= aCenter; + pPropValues[ n ].Name = "Polar"; + pPropValues[ n++ ].Value <<= aCenter; if ( nFlags & SvxMSDffHandleFlags::RADIUS_RANGE ) { if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE ) @@ -730,16 +730,16 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, pData->nRangeXMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = "RadiusRangeMinimum"; - rPropValues[ n++ ].Value <<= aRadiusRangeMinimum; + pPropValues[ n ].Name = "RadiusRangeMinimum"; + pPropValues[ n++ ].Value <<= aRadiusRangeMinimum; } if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, pData->nRangeXMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = "RadiusRangeMaximum"; - rPropValues[ n++ ].Value <<= aRadiusRangeMaximum; + pPropValues[ n ].Name = "RadiusRangeMaximum"; + pPropValues[ n++ ].Value <<= aRadiusRangeMaximum; } } } @@ -750,32 +750,32 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: css::drawing::EnhancedCustomShapeParameter aRangeXMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, pData->nRangeXMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = "RangeXMinimum"; - rPropValues[ n++ ].Value <<= aRangeXMinimum; + pPropValues[ n ].Name = "RangeXMinimum"; + pPropValues[ n++ ].Value <<= aRangeXMinimum; } if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { css::drawing::EnhancedCustomShapeParameter aRangeXMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, pData->nRangeXMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = "RangeXMaximum"; - rPropValues[ n++ ].Value <<= aRangeXMaximum; + pPropValues[ n ].Name = "RangeXMaximum"; + pPropValues[ n++ ].Value <<= aRangeXMaximum; } if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE ) { css::drawing::EnhancedCustomShapeParameter aRangeYMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, pData->nRangeYMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = "RangeYMinimum"; - rPropValues[ n++ ].Value <<= aRangeYMinimum; + pPropValues[ n ].Name = "RangeYMinimum"; + pPropValues[ n++ ].Value <<= aRangeYMinimum; } if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { css::drawing::EnhancedCustomShapeParameter aRangeYMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, pData->nRangeYMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = "RangeYMaximum"; - rPropValues[ n++ ].Value <<= aRangeYMaximum; + pPropValues[ n ].Name = "RangeYMaximum"; + pPropValues[ n++ ].Value <<= aRangeYMaximum; } } } @@ -862,13 +862,12 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) sal_Int32 i, nAdjustmentValues = seqAdjustmentValues.getLength(); sal_Int32 nAdjustmentDefaults = *pDefData++; if ( nAdjustmentDefaults > nAdjustmentValues ) - { seqAdjustmentValues.realloc( nAdjustmentDefaults ); - for ( i = nAdjustmentValues; i < nAdjustmentDefaults; i++ ) - { - seqAdjustmentValues[ i ].Value <<= pDefData[ i ]; - seqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE; - } + auto pseqAdjustmentValues = seqAdjustmentValues.getArray(); + for ( i = nAdjustmentValues; i < nAdjustmentDefaults; i++ ) + { + pseqAdjustmentValues[ i ].Value <<= pDefData[ i ]; + pseqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE; } // check if there are defaulted adjustment values that should be filled the hard coded defaults (pDefValue) sal_Int32 nCount = std::min(nAdjustmentValues, nAdjustmentDefaults); @@ -876,8 +875,8 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) { if ( seqAdjustmentValues[ i ].State != css::beans::PropertyState_DIRECT_VALUE ) { - seqAdjustmentValues[ i ].Value <<= pDefData[ i ]; - seqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE; + pseqAdjustmentValues[ i ].Value <<= pDefData[ i ]; + pseqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE; } } } @@ -914,14 +913,13 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates ); if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates; - sal_Int32 i, nCount = pDefCustomShape->nVertices; - seqCoordinates.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates( nCount ); + auto pseqCoordinates = seqCoordinates.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].First, pDefCustomShape->pVertices[ i ].nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].Second, pDefCustomShape->pVertices[ i ].nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqCoordinates[ i ].First, pDefCustomShape->pVertices[ i ].nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqCoordinates[ i ].Second, pDefCustomShape->pVertices[ i ].nValB ); } aPropVal.Name = sCoordinates; aPropVal.Value <<= seqCoordinates; @@ -933,13 +931,13 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints ); if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints; sal_Int32 i, nCount = pDefCustomShape->nGluePoints; - seqGluePoints.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints( nCount ); + auto pseqGluePoints = seqGluePoints.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqGluePoints[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqGluePoints[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB ); } aPropVal.Name = sGluePoints; aPropVal.Value <<= seqGluePoints; @@ -951,13 +949,12 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments ); if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments; - sal_Int32 i, nCount = pDefCustomShape->nElements; - seqSegments.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments( nCount ); + auto pseqSegments = seqSegments.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShapeSegment& rSegInfo = seqSegments[ i ]; + EnhancedCustomShapeSegment& rSegInfo = pseqSegments[ i ]; sal_uInt16 nSDat = pDefCustomShape->pElements[ i ]; lcl_ShapeSegmentFromBinary( rSegInfo, nSDat ); } @@ -999,17 +996,16 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sPath, sTextFrames ); if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames; - sal_Int32 i, nCount = pDefCustomShape->nTextRect; - seqTextFrames.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames( nCount ); + auto pseqTextFrames = seqTextFrames.getArray(); const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect; for ( i = 0; i < nCount; i++, pRectangles++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.First, pRectangles->nPairA.nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.Second, pRectangles->nPairA.nValB ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.First, pRectangles->nPairB.nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.Second, pRectangles->nPairB.nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames[ i ].TopLeft.First, pRectangles->nPairA.nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames[ i ].TopLeft.Second, pRectangles->nPairA.nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames[ i ].BottomRight.First, pRectangles->nPairB.nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames[ i ].BottomRight.Second, pRectangles->nPairB.nValB ); } aPropVal.Name = sTextFrames; aPropVal.Value <<= seqTextFrames; @@ -1021,13 +1017,12 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sEquations ); if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation ) { - css::uno::Sequence< OUString > seqEquations; - sal_Int32 i, nCount = pDefCustomShape->nCalculation; - seqEquations.realloc( nCount ); + css::uno::Sequence< OUString > seqEquations( nCount ); + auto pseqEquations = seqEquations.getArray(); const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation; for ( i = 0; i < nCount; i++, pData++ ) - seqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] ); + pseqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] ); aPropVal.Name = sEquations; aPropVal.Value <<= seqEquations; aGeometryItem.SetPropertyValue( aPropVal ); @@ -1038,15 +1033,14 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) pAny = aGeometryItem.GetPropertyValueByName( sHandles ); if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles ) { - css::uno::Sequence< css::beans::PropertyValues > seqHandles; - sal_Int32 i, nCount = pDefCustomShape->nHandles; const SvxMSDffHandle* pData = pDefCustomShape->pHandles; - seqHandles.realloc( nCount ); + css::uno::Sequence< css::beans::PropertyValues > seqHandles( nCount ); + auto pseqHandles = seqHandles.getArray(); for ( i = 0; i < nCount; i++, pData++ ) { sal_Int32 nPropertiesNeeded; - css::beans::PropertyValues& rPropValues = seqHandles[ i ]; + css::beans::PropertyValues& rPropValues = pseqHandles[ i ]; nPropertiesNeeded = GetNumberOfProperties( pData ); rPropValues.realloc( nPropertiesNeeded ); lcl_ShapePropertiesFromDFF( pData, rPropValues ); @@ -1063,6 +1057,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) // ooxml preset shapes from their definition. css::uno::Sequence<css::beans::PropertyValues> seqHandles; *pAny >>= seqHandles; + auto seqHandlesRange = asNonConstRange(seqHandles); bool bChanged(false); for (sal_Int32 i = 0; i < seqHandles.getLength(); i++) { @@ -1083,7 +1078,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) { bChanged |= aHandleProps.createItemIfMissing(sSecondRefType, nSecondAdjRef); } - aHandleProps >> seqHandles[i]; + aHandleProps >> seqHandlesRange[i]; } if (bChanged) { @@ -1131,15 +1126,16 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons pAny = rGeometryItem.GetPropertyValueByName( sPath, "Coordinates" ); if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2; + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1; if ( *pAny >>= seqCoordinates1 ) { sal_Int32 i, nCount = pDefCustomShape->nVertices; - seqCoordinates2.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates2( nCount ); + auto pseqCoordinates2 = seqCoordinates2.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].First, pDefCustomShape->pVertices[ i ].nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].Second, pDefCustomShape->pVertices[ i ].nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqCoordinates2[ i ].First, pDefCustomShape->pVertices[ i ].nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqCoordinates2[ i ].Second, pDefCustomShape->pVertices[ i ].nValB ); } if ( seqCoordinates1 == seqCoordinates2 ) bIsDefaultGeometry = true; @@ -1155,15 +1151,16 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons pAny = rGeometryItem.GetPropertyValueByName( sPath, "GluePoints" ); if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2; + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1; if ( *pAny >>= seqGluePoints1 ) { sal_Int32 i, nCount = pDefCustomShape->nGluePoints; - seqGluePoints2.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints2( nCount ); + auto pseqGluePoints2 = seqGluePoints2.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqGluePoints2[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqGluePoints2[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB ); } if ( seqGluePoints1 == seqGluePoints2 ) bIsDefaultGeometry = true; @@ -1180,7 +1177,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons pAny = rGeometryItem.GetPropertyValueByName( sPath, "Segments" ); if ( pAny ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2; + css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments1; if ( *pAny >>= seqSegments1 ) { if ( pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements ) @@ -1188,10 +1185,11 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons sal_Int32 i, nCount = pDefCustomShape->nElements; if ( nCount ) { - seqSegments2.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments2( nCount ); + auto pseqSegments2 = seqSegments2.getArray(); for ( i = 0; i < nCount; i++ ) { - EnhancedCustomShapeSegment& rSegInfo = seqSegments2[ i ]; + EnhancedCustomShapeSegment& rSegInfo = pseqSegments2[ i ]; sal_uInt16 nSDat = pDefCustomShape->pElements[ i ]; lcl_ShapeSegmentFromBinary( rSegInfo, nSDat ); } @@ -1257,15 +1255,16 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons pAny = rGeometryItem.GetPropertyValueByName( "Equations" ); if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation ) { - css::uno::Sequence< OUString > seqEquations1, seqEquations2; + css::uno::Sequence< OUString > seqEquations1; if ( *pAny >>= seqEquations1 ) { sal_Int32 i, nCount = pDefCustomShape->nCalculation; - seqEquations2.realloc( nCount ); + css::uno::Sequence< OUString > seqEquations2( nCount ); + auto pseqEquations2 = seqEquations2.getArray(); const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation; for ( i = 0; i < nCount; i++, pData++ ) - seqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] ); + pseqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] ); if ( seqEquations1 == seqEquations2 ) bIsDefaultGeometry = true; @@ -1281,18 +1280,19 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons pAny = rGeometryItem.GetPropertyValueByName( sPath, "TextFrames" ); if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect ) { - css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2; + css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1; if ( *pAny >>= seqTextFrames1 ) { sal_Int32 i, nCount = pDefCustomShape->nTextRect; - seqTextFrames2.realloc( nCount ); + css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames2( nCount ); + auto pseqTextFrames2 = seqTextFrames2.getArray(); const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect; for ( i = 0; i < nCount; i++, pRectangles++ ) { - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.First, pRectangles->nPairA.nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.Second, pRectangles->nPairA.nValB ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.First, pRectangles->nPairB.nValA ); - EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.Second, pRectangles->nPairB.nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames2[ i ].TopLeft.First, pRectangles->nPairA.nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames2[ i ].TopLeft.Second, pRectangles->nPairA.nValB ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames2[ i ].BottomRight.First, pRectangles->nPairB.nValA ); + EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( pseqTextFrames2[ i ].BottomRight.Second, pRectangles->nPairB.nValB ); } if ( seqTextFrames1 == seqTextFrames2 ) bIsDefaultGeometry = true; diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 77e65b30330f..bc7df6b37513 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -54,6 +54,7 @@ #include <tools/globname.hxx> #include <tools/diagnose_ex.h> #include <comphelper/classids.hxx> +#include <comphelper/propertyvalue.hxx> #include <sot/formats.hxx> #include <cppuhelper/implbase.hxx> @@ -894,9 +895,8 @@ bool SdrOle2Obj::UpdateLinkURL_Impl() mpImpl->mxObjRef->changeState(embed::EmbedStates::LOADED); // TODO/LATER: there should be possible to get current mediadescriptor settings from the object - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "URL"; - aArgs[0].Value <<= aNewLinkURL; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + "URL", aNewLinkURL) }; xPersObj->reload( aArgs, uno::Sequence< beans::PropertyValue >() ); mpImpl->maLinkURL = aNewLinkURL; diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 22ee2ef483a5..d2395778ff8f 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -19,6 +19,8 @@ #include <memory> #include <svx/PaletteManager.hxx> + +#include <comphelper/propertyvalue.hxx> #include <tools/urlobj.hxx> #include <osl/file.hxx> #include <unotools/pathoptions.hxx> @@ -275,11 +277,13 @@ void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& r else maRecentColors.emplace_back(rRecentColor, rName); css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size()); + auto aColorListRange = asNonConstRange(aColorList); css::uno::Sequence< OUString > aColorNameList(maRecentColors.size()); + auto aColorNameListRange = asNonConstRange(aColorNameList); for (size_t i = 0; i < maRecentColors.size(); ++i) { - aColorList[i] = static_cast<sal_Int32>(maRecentColors[i].first); - aColorNameList[i] = maRecentColors[i].second; + aColorListRange[i] = static_cast<sal_Int32>(maRecentColors[i].first); + aColorNameListRange[i] = maRecentColors[i].second; } std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); officecfg::Office::Common::UserColors::RecentColor::set(aColorList, batch); @@ -334,9 +338,8 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC INetURLObject aObj( aCommand ); - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value <<= sal_Int32(rColor.first); + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), + sal_Int32(rColor.first)) }; URL aTargetURL; aTargetURL.Complete = aCommand; diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index d1a43c135848..228e322be50a 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -19,6 +19,7 @@ #include <StylesPreviewWindow.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <sfx2/objsh.hxx> @@ -375,12 +376,10 @@ IMPL_LINK(StylesPreviewWindow_Base, Selected, weld::IconView&, rIconView, void) { OUString sStyleName = rIconView.get_selected_text(); - css::uno::Sequence<css::beans::PropertyValue> aArgs(2); - aArgs[0].Value <<= sStyleName; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para); - - aArgs[0].Name = "Template"; + css::uno::Sequence<css::beans::PropertyValue> aArgs{ + comphelper::makePropertyValue("Template", sStyleName), + comphelper::makePropertyValue("Family", sal_Int16(SfxStyleFamily::Para)) + }; SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs); } @@ -388,12 +387,10 @@ IMPL_LINK(StylesPreviewWindow_Base, DoubleClick, weld::IconView&, rIconView, boo { OUString sStyleName = rIconView.get_selected_text(); - css::uno::Sequence<css::beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Param"; - aArgs[0].Value <<= sStyleName; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para); - + css::uno::Sequence<css::beans::PropertyValue> aArgs{ + comphelper::makePropertyValue("Param", sStyleName), + comphelper::makePropertyValue("Family", sal_Int16(SfxStyleFamily::Para)) + }; SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:EditStyle", aArgs); return true; diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 06b9c87700bc..521b6fb73888 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -162,14 +162,14 @@ bool SvxColorValueSet_docking::StartDrag() ? drawing::FillStyle_NONE : drawing::FillStyle_SOLID); - uno::Sequence<beans::NamedValue> props(2); XFillColorItem const color(sItemText, aItemColor); - props[0].Name = "FillColor"; - color.QueryValue(props[0].Value, 0); XFillStyleItem const style(eStyle); - props[1].Name = "FillStyle"; - style.QueryValue(props[1].Value, 0); + uno::Any c, s; + color.QueryValue(c, 0); + style.QueryValue(s, 0); + uno::Sequence<beans::NamedValue> props{ { "FillColor", std::move(c) }, + { "FillStyle", std::move(s) } }; m_xHelper->SetData(props); return false; diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index face95949f88..f30c123a42b0 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -21,6 +21,7 @@ #include <string_view> +#include <comphelper/propertyvalue.hxx> #include <svtools/toolbarmenu.hxx> #include <vcl/toolbox.hxx> @@ -223,9 +224,9 @@ void ExtrusionDirectionWindow::statusChanged( IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectValueSetHdl, ValueSet*, void) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionDirection).copy(5); - aArgs[0].Value <<= gSkewList[mxDirectionSet->GetSelectedItemId()-1]; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionDirection).copy(5), + gSkewList[mxDirectionSet->GetSelectedItemId()-1]) }; mxControl->dispatchCommand( g_sExtrusionDirection, aArgs ); @@ -236,9 +237,8 @@ IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectToolbarMenuHdl, weld::Toggleable { int nProjection = mxPerspective->get_active() ? 0 : 1; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionProjection).copy(5); - aArgs[0].Value <<= static_cast<sal_Int32>(nProjection); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionProjection).copy(5), static_cast<sal_Int32>(nProjection)) }; mxControl->dispatchCommand( g_sExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); @@ -447,11 +447,10 @@ void ExtrusionDepthWindow::statusChanged( void ExtrusionDepthWindow::DispatchDepthDialog() { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Depth"; - aArgs[0].Value <<= mfDepth; - aArgs[1].Name = "Metric"; - aArgs[1].Value <<= static_cast<sal_Int32>( meUnit ); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("Depth", mfDepth), + comphelper::makePropertyValue("Metric", static_cast<sal_Int32>( meUnit )) + }; rtl::Reference<svt::PopupWindowController> xControl(mxControl); xControl->EndPopupMode(); @@ -497,9 +496,8 @@ IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Toggleable&, rButton, void) fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; } - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsExtrusionDepth).copy(5); - aArgs[0].Value <<= fDepth; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsExtrusionDepth).copy(5), fDepth) }; mxControl->dispatchCommand( gsExtrusionDepth, aArgs ); mbCommandDispatched = true; @@ -728,9 +726,8 @@ IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectValueSetHdl, ValueSet*, void) { nDirection--; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionLightingDirection).copy(5); - aArgs[0].Value <<= nDirection; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionLightingDirection).copy(5), nDirection) }; mxControl->dispatchCommand( g_sExtrusionLightingDirection, aArgs ); @@ -753,9 +750,8 @@ IMPL_LINK(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::Toggleable&, rBut else nLevel = 2; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionLightingIntensity).copy(5); - aArgs[0].Value <<= static_cast<sal_Int32>(nLevel); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionLightingIntensity).copy(5), static_cast<sal_Int32>(nLevel)) }; mxControl->dispatchCommand( g_sExtrusionLightingIntensity, aArgs ); @@ -892,9 +888,8 @@ IMPL_LINK(ExtrusionSurfaceWindow, SelectHdl, weld::Toggleable&, rButton, void) else nSurface = 3; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(g_sExtrusionSurface).copy(5); - aArgs[0].Value <<= nSurface; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(g_sExtrusionSurface).copy(5), nSurface) }; mxControl->dispatchCommand( g_sExtrusionSurface, aArgs ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 7bfec4b860c0..de42c5f639c4 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/text/WritingMode.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/toolbox.hxx> #include <vcl/virdev.hxx> @@ -368,9 +369,8 @@ IMPL_LINK(FontworkAlignmentWindow, SelectHdl, weld::Toggleable&, rButton, void) else nAlignment = 4; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkAlignment).copy(5); - aArgs[0].Value <<= nAlignment; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkAlignment).copy(5), nAlignment) }; mxControl->dispatchCommand( gsFontworkAlignment, aArgs ); @@ -616,10 +616,9 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::Toggleable& if (mbSettingValue) return; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkKernCharacterPairs).copy(5); bool bKernOnOff = mxKernPairs->get_active(); - aArgs[0].Value <<= bKernOnOff; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkKernCharacterPairs).copy(5), bKernOnOff) }; mxControl->dispatchCommand( gsFontworkKernCharacterPairs, aArgs ); mbCommandDispatched = true; @@ -631,9 +630,8 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::Toggleable& void FontworkCharacterSpacingWindow::DispatchSpacingDialog() { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5); - aArgs[0].Value <<= mnCharacterSpacing; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkCharacterSpacing).copy(5), mnCharacterSpacing) }; rtl::Reference<svt::PopupWindowController> xControl(mxControl); xControl->EndPopupMode(); @@ -671,9 +669,8 @@ IMPL_LINK(FontworkCharacterSpacingWindow, SelectHdl, weld::Toggleable&, rButton, else nCharacterSpacing = 100; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString(gsFontworkCharacterSpacing).copy(5); - aArgs[0].Value <<= nCharacterSpacing; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString(gsFontworkCharacterSpacing).copy(5), nCharacterSpacing) }; mxControl->dispatchCommand( gsFontworkCharacterSpacing, aArgs ); mbCommandDispatched = true; diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx index 0089212bdd01..f67efd12c701 100644 --- a/svx/source/tbxctrls/formatpaintbrushctrl.cxx +++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx @@ -20,6 +20,7 @@ #include <svx/formatpaintbrushctrl.hxx> +#include <comphelper/propertyvalue.hxx> #include <svl/eitem.hxx> #include <vcl/toolbox.hxx> #include <vcl/settings.hxx> @@ -54,9 +55,8 @@ FormatPaintBrushToolBoxControl::~FormatPaintBrushToolBoxControl() void FormatPaintBrushToolBoxControl::impl_executePaintBrush() { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "PersistentCopy"; - aArgs[0].Value <<= m_bPersistentCopy; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("PersistentCopy", + m_bPersistentCopy) }; Dispatch( ".uno:FormatPaintbrush" , aArgs ); } diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 3d2cd7218fd3..02fb3d540ba8 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.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/toolbox.hxx> #include <vcl/idle.hxx> #include <svl/intitem.hxx> @@ -121,9 +124,7 @@ IMPL_LINK_NOARG(ImplGrafControl, ImplModifyHdl, Timer*, void) INetURLObject aObj( maCommand ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), a) }; SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), @@ -322,9 +323,8 @@ ImplGrafModeControl::~ImplGrafModeControl() IMPL_LINK(ImplGrafModeControl, SelectHdl, weld::ComboBox&, rBox, void) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "GrafMode"; - aArgs[0].Value <<= sal_Int16(rBox.get_active()); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("GrafMode", + sal_Int16(rBox.get_active())) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index f9612fe008d7..130fba5ae014 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <comphelper/propertyvalue.hxx> #include <sfx2/tbxctrl.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/module.hxx> @@ -104,10 +105,8 @@ IMPL_LINK_NOARG(SvxMetricField, ModifyHdl, weld::MetricSpinButton&, void) XLineWidthItem aLineWidthItem( nTmp ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineWidth"; aLineWidthItem.QueryValue( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineWidth", a) }; SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), ".uno:LineWidth", aArgs ); diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 3741402f1143..e67d77fd59e2 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -27,6 +27,7 @@ #include <layctrl.hxx> #include <svx/dialmgr.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <svtools/colorcfg.hxx> #include <svtools/toolbarmenu.hxx> #include <com/sun/star/util/URLTransformer.hpp> @@ -337,11 +338,8 @@ void TableWidget::InsertTable() { if (nCol && nLine) { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Columns"; - aArgs[0].Value <<= sal_Int16( nCol ); - aArgs[1].Name = "Rows"; - aArgs[1].Value <<= sal_Int16( nLine ); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("Columns", sal_Int16( nCol )), + comphelper::makePropertyValue("Rows", sal_Int16( nLine )) }; mxControl->TableDialog( aArgs ); } @@ -675,11 +673,10 @@ void ColumnsWidget::InsertColumns() { if (nCol) { - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Columns"; - aArgs[0].Value <<= sal_Int16( nCol ); - aArgs[1].Name = "Modifier"; - aArgs[1].Value <<= sal_Int16( m_bMod1 ? KEY_MOD1 : 0 ); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("Columns", sal_Int16( nCol )), + comphelper::makePropertyValue("Modifier", sal_Int16( m_bMod1 ? KEY_MOD1 : 0 )) + }; mxControl->InsertColumns(aArgs); } } diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 7adb99ecaaa2..8f628876f2c4 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -31,6 +31,8 @@ #include <svx/strings.hrc> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> + #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -219,9 +221,7 @@ void SvxUndoRedoControl::Do(sal_Int16 nCount) if ( xDispatch.is() ) { INetURLObject aObj( m_aCommandURL ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value <<= nCount; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(aObj.GetURLPath(), nCount) }; xDispatch->dispatch(aTargetURL, aArgs); } } diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 1771e2f74649..81f064fc78f4 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -47,6 +47,7 @@ #include <memory> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -327,21 +328,20 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void) pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd())); } - Sequence< PropertyValue > aArgs( 1 ); + OUString name; Any a; if ( pLineStartItem ) { - aArgs[0].Name = "LineStart"; + name = "LineStart"; pLineStartItem->QueryValue( a ); - aArgs[0].Value = a; } else { - aArgs[0].Name = "LineEnd"; + name = "LineEnd"; pLineEndItem->QueryValue( a ); - aArgs[0].Value = a; } + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(name, a) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened @@ -611,10 +611,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash()); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineDash"; aLineDashItem.QueryValue ( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineDash", a) }; mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs); // set also cap style using the toolbar line style selection popup @@ -623,10 +621,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE ? css::drawing::LineCap_BUTT : css::drawing::LineCap_ROUND ); - Sequence< PropertyValue > aArgs2( 1 ); - aArgs2[0].Name = "LineCap"; aLineCapItem.QueryValue ( a ); - aArgs2[0].Value = a; + Sequence< PropertyValue > aArgs2{ comphelper::makePropertyValue("LineCap", a) }; mxControl->dispatchLineStyleCommand(".uno:LineCap", aArgs2); } } @@ -635,10 +631,8 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void) XLineStyleItem aLineStyleItem( eXLS ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "XLineStyle"; aLineStyleItem.QueryValue ( a ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("XLineStyle", a) }; mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs); mxControl->EndPopupMode(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 1c816097b3ff..8327fe48cf61 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -21,6 +21,7 @@ #include <comphelper/configurationlistener.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <tools/color.hxx> #include <svl/numformat.hxx> #include <svl/poolitem.hxx> @@ -915,11 +916,9 @@ IMPL_LINK(SvxStyleBox_Base, MenuSelectHdl, const OString&, rMenuIdent, void) OUString sEntry = m_xWidget->get_text(m_nLastItemWithMenu); ReleaseFocus(); // It must be after getting entry pos! - Sequence<PropertyValue> aArgs(2); - aArgs[0].Name = "Param"; - aArgs[0].Value <<= sEntry; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16( eStyleFamily ); + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("Param", sEntry), + comphelper::makePropertyValue("Family", + sal_Int16( eStyleFamily )) }; if (rMenuIdent == "update") { @@ -1015,17 +1014,18 @@ void SvxStyleBox_Base::Select(bool bNonTravelSelect) m_xWidget->save_value(); Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Value <<= aSearchEntry; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16( eStyleFamily ); + auto pArgs = aArgs.getArray(); + pArgs[0].Value <<= aSearchEntry; + pArgs[1].Name = "Family"; + pArgs[1].Value <<= sal_Int16( eStyleFamily ); if( bCreateNew ) { - aArgs[0].Name = "Param"; + pArgs[0].Name = "Param"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs); } else { - aArgs[0].Name = "Template"; + pArgs[0].Name = "Template"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs ); } } @@ -1684,6 +1684,7 @@ IMPL_LINK_NOARG(SvxFontNameBox_Base, ActivateHdl, weld::ComboBox&, bool) void SvxFontNameBox_Base::Select(bool bNonTravelSelect) { Sequence< PropertyValue > aArgs( 1 ); + auto pArgs = aArgs.getArray(); std::unique_ptr<SvxFontItem> pFontItem; if ( pFontList ) { @@ -1701,7 +1702,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) Any a; pFontItem->QueryValue( a ); - aArgs[0].Value = a; + pArgs[0].Value = a; } if (bNonTravelSelect) @@ -1714,7 +1715,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) EndPreview(); if (pFontItem) { - aArgs[0].Name = "CharFontName"; + pArgs[0].Name = "CharFontName"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:CharFontName", aArgs ); @@ -1724,7 +1725,7 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect) { if (pFontItem) { - aArgs[0].Name = "CharPreviewFontName"; + pArgs[0].Name = "CharPreviewFontName"; SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:CharPreviewFontName", aArgs ); @@ -2349,14 +2350,11 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void) aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISTANCE ); aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false ); - Any a; - Sequence< PropertyValue > aArgs( 2 ); - aArgs[0].Name = "OuterBorder"; - aBorderOuter.QueryValue( a ); - aArgs[0].Value = a; - aArgs[1].Name = "InnerBorder"; - aBorderInner.QueryValue( a ); - aArgs[1].Value = a; + Any a1, a2; + aBorderOuter.QueryValue( a1 ); + aBorderInner.QueryValue( a2 ); + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("OuterBorder", a1), + comphelper::makePropertyValue("InnerBorder", a2) }; mxControl->dispatchCommand( ".uno:SetBorderStyle", aArgs ); } @@ -2376,10 +2374,8 @@ void SvxFrameWindow_Impl::SetDiagonalDownBorder(const SvxLineItem& dDownLineItem { // apply diagonal down border Any a; - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = "BorderTLBR"; dDownLineItem.QueryValue(a); - aArgs[0].Value = a; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("BorderTLBR", a) }; mxControl->dispatchCommand(".uno:BorderTLBR", aArgs); } @@ -2388,10 +2384,8 @@ void SvxFrameWindow_Impl::SetDiagonalUpBorder(const SvxLineItem& dUpLineItem) { // apply diagonal up border Any a; - Sequence<PropertyValue> aArgs(1); - aArgs[0].Name = "BorderBLTR"; dUpLineItem.QueryValue(a); - aArgs[0].Value = a; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("BorderBLTR", a) }; mxControl->dispatchCommand(".uno:BorderBLTR", aArgs); } @@ -2547,10 +2541,8 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl, ValueSet*, void) aLineItem.SetLine( nullptr ); Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "LineStyle"; aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 ); - aArgs[0].Value = a; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("LineStyle", a) }; m_xControl->dispatchCommand( ".uno:LineStyle", aArgs ); @@ -3778,9 +3770,8 @@ void SvxCurrencyToolBoxControl::execute( sal_Int16 nSelectModifier ) if( nFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "NumberFormatCurrency"; - aArgs[0].Value <<= nFormatKey; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("NumberFormatCurrency", + nFormatKey) }; dispatchCommand( m_aCommandURL, aArgs ); m_nFormatKey = nFormatKey; } diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 8811d75dc2aa..413b12741ac7 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/propertyvalue.hxx> #include <rtl/math.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> @@ -219,9 +220,8 @@ void SvxFontSizeBox_Base::Select() sal_Int64 nSelVal = m_xWidget->get_value(); float fSelVal = float( nSelVal ) / 10; - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "FontHeight.Height"; - aArgs[0].Value <<= fSelVal; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue("FontHeight.Height", + fSelVal) }; /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 2fc756fa0fdb..73d77cb54ea8 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -591,8 +591,9 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto { int i = rSettings.maFilterData.getLength(); rSettings.maFilterData.realloc( i + 1 ); - rSettings.maFilterData[ i ].Name = "StatusIndicator"; - rSettings.maFilterData[ i ].Value <<= rSettings.mxStatusIndicator; + auto pFilterData = rSettings.maFilterData.getArray(); + pFilterData[ i ].Name = "StatusIndicator"; + pFilterData[ i ].Value <<= rSettings.mxStatusIndicator; } } @@ -1076,8 +1077,9 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes if ( aSettings.mxInteractionHandler.is() && ( nStatus != ERRCODE_NONE ) ) { Any aInteraction; - Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations(1); - lContinuations[0] = new ::comphelper::OInteractionApprove(); + Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations{ + new ::comphelper::OInteractionApprove() + }; GraphicFilterRequest aErrorCode; aErrorCode.ErrCode = sal_uInt32(nStatus); diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index ac45f16acfb5..d69fac8acd7b 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -469,34 +469,30 @@ uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getAvailableServiceNames( { const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); - uno::Sequence< OUString > aSNS( 21 ); - - 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.image.ImageMapRectangleObject"; - aSNS[i++] = "com.sun.star.image.ImageMapCircleObject"; - aSNS[i++] = "com.sun.star.image.ImageMapPolygonObject"; - - 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"; - - DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" ); + uno::Sequence< OUString > aSNS{ + "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.image.ImageMapRectangleObject", + "com.sun.star.image.ImageMapCircleObject", + "com.sun.star.image.ImageMapPolygonObject", + + "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" + }; return comphelper::concatSequences( aSNS_ORG, aSNS ); } diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index ea590892daaa..865ce0a3ee5b 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -32,6 +32,7 @@ #include <comphelper/classids.hxx> #include <comphelper/embeddedobjectcontainer.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/exc_hlp.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -446,16 +447,16 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL ) ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist(); - uno::Sequence< beans::PropertyValue > aMediaDescr( 1 ); - aMediaDescr[0].Name = "URL"; - aMediaDescr[0].Value <<= aLinkURL; + uno::Sequence< beans::PropertyValue > aMediaDescr{ comphelper::makePropertyValue("URL", + aLinkURL) }; uno::Reference< task::XInteractionHandler > xInteraction = pPersist->getInteractionHandler(); if ( xInteraction.is() ) { aMediaDescr.realloc( 2 ); - aMediaDescr[1].Name = "InteractionHandler"; - aMediaDescr[1].Value <<= xInteraction; + auto pMediaDescr = aMediaDescr.getArray(); + pMediaDescr[1].Name = "InteractionHandler"; + pMediaDescr[1].Value <<= xInteraction; } //TODO/LATER: how to cope with creation failure?! diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index c4cdcd701075..638406e4de15 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -170,13 +170,14 @@ uno::Sequence< OUString > SAL_CALL GalleryThemeProvider::getElementNames() const SolarMutexGuard aGuard; sal_uInt32 i = 0, nCount = ( mpGallery ? mpGallery->GetThemeCount() : 0 ), nRealCount = 0; uno::Sequence< OUString > aSeq( nCount ); + auto aSeqRange = asNonConstRange(aSeq); for( ; i < nCount; ++i ) { const GalleryThemeEntry* pEntry = mpGallery->GetThemeInfo( i ); if( mbHiddenThemes || !pEntry->IsHidden() ) - aSeq[ nRealCount++ ] = pEntry->GetThemeName(); + aSeqRange[ nRealCount++ ] = pEntry->GetThemeName(); } aSeq.realloc( nRealCount ); diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index ad9445e4c7f0..6db555d8ddb0 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -35,6 +35,7 @@ #include <svtools/embedhlp.hxx> #include <unotools/ucbstreamhelper.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/embeddedobjectcontainer.hxx> @@ -626,17 +627,18 @@ Any SAL_CALL SvXMLEmbeddedObjectHelper::getByName( if( !mxTempStorage.is() ) mxTempStorage = comphelper::OStorageHelper::GetTemporaryStorage(); - Sequence < beans::PropertyValue > aDummy( 0 ), aEmbDescr( 1 ); - aEmbDescr[0].Name = "StoreVisualReplacement"; - aEmbDescr[0].Value <<= !bOasisFormat; + Sequence < beans::PropertyValue > aDummy, + aEmbDescr{ comphelper::makePropertyValue("StoreVisualReplacement", + !bOasisFormat) }; if ( !bOasisFormat ) { uno::Reference< io::XInputStream > xGrInStream = ImplGetReplacementImage( xObj ); if ( xGrInStream.is() ) { aEmbDescr.realloc( 2 ); - aEmbDescr[1].Name = "VisualReplacement"; - aEmbDescr[1].Value <<= xGrInStream; + auto pEmbDescr = aEmbDescr.getArray(); + pEmbDescr[1].Name = "VisualReplacement"; + pEmbDescr[1].Value <<= xGrInStream; } } diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index c5c7ef7f52a2..1900a9e0bc9f 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -83,10 +83,11 @@ bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputSt xWriter->setOutputStream( xOut ); uno::Sequence< uno::Any > aArgs( xObjectResolver.is() ? 3 : 2 ); - aArgs[0] <<= xHandler; - aArgs[1] <<= xGraphicStorageHandler; + auto pArgs = aArgs.getArray(); + pArgs[0] <<= xHandler; + pArgs[1] <<= xGraphicStorageHandler; if( xObjectResolver.is() ) - aArgs[2] <<= xObjectResolver; + pArgs[2] <<= xObjectResolver; uno::Reference< document::XFilter > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pExportService ), aArgs, xContext ), uno::UNO_QUERY ); if( !xFilter.is() ) diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index ca019097696e..2fcb40379b65 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -30,6 +30,8 @@ #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> + +#include <comphelper/propertyvalue.hxx> #include <o3tl/any.hxx> #include <svl/itempool.hxx> #include <editeng/memberids.h> @@ -632,8 +634,6 @@ bool XLineDashItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const { case 0: { - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - css::drawing::LineDash aLineDash; const XDash& rXD = GetDashValue(); @@ -644,10 +644,10 @@ bool XLineDashItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const aLineDash.DashLen = rXD.GetDashLen(); aLineDash.Distance = rXD.GetDistance(); - aPropSeq[0].Name = "Name"; - aPropSeq[0].Value <<= SvxUnogetApiNameForItem(Which(), GetName()); - aPropSeq[1].Name = "LineDash"; - aPropSeq[1].Value <<= aLineDash; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Name", SvxUnogetApiNameForItem(Which(), GetName())), + comphelper::makePropertyValue("LineDash", aLineDash) + }; rVal <<= aPropSeq; break; } @@ -2185,8 +2185,6 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c { case 0: { - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - css::awt::Gradient aGradient2; const XGradient& aXGradient = GetGradientValue(); @@ -2201,10 +2199,10 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c aGradient2.EndIntensity = aXGradient.GetEndIntens(); aGradient2.StepCount = aXGradient.GetSteps(); - aPropSeq[0].Name = "Name"; - aPropSeq[0].Value <<= SvxUnogetApiNameForItem(Which(), GetName()); - aPropSeq[1].Name = "FillGradient"; - aPropSeq[1].Value <<= aGradient2; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Name", SvxUnogetApiNameForItem(Which(), GetName())), + comphelper::makePropertyValue("FillGradient", aGradient2) + }; rVal <<= aPropSeq; break; } @@ -2629,8 +2627,6 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons { case 0: { - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - css::drawing::Hatch aUnoHatch; aUnoHatch.Style = aHatch.GetHatchStyle(); @@ -2638,10 +2634,10 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons aUnoHatch.Distance = aHatch.GetDistance(); aUnoHatch.Angle = aHatch.GetAngle().get(); - aPropSeq[0].Name = "Name"; - aPropSeq[0].Value <<= SvxUnogetApiNameForItem(Which(), GetName()); - aPropSeq[1].Name = "FillHatch"; - aPropSeq[1].Value <<= aUnoHatch; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Name", SvxUnogetApiNameForItem(Which(), GetName())), + comphelper::makePropertyValue("FillHatch", aUnoHatch) + }; rVal <<= aPropSeq; break; } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 97f0468f3ace..d9856259ffc4 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -19,6 +19,8 @@ #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/graphic/XGraphic.hpp> + +#include <comphelper/propertyvalue.hxx> #include <tools/debug.hxx> #include <vcl/virdev.hxx> #include <vcl/bitmapex.hxx> @@ -209,12 +211,10 @@ bool XFillBitmapItem::QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId) const { // member-id 0 => complete item (e.g. for toolbars) DBG_ASSERT( nMemberId == 0, "invalid member-id" ); - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - - aPropSeq[0].Name = "Name"; - aPropSeq[0].Value <<= aInternalName; - aPropSeq[1].Name = "Bitmap"; - aPropSeq[1].Value <<= xBmp; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Name", aInternalName), + comphelper::makePropertyValue("Bitmap", xBmp) + }; rVal <<= aPropSeq; } |