diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:03:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-31 06:56:49 +0100 |
commit | ce22935a8586eda71fd29d4ff969d9cd7a2ec15b (patch) | |
tree | ea0e84fe6d4b5b6e6ac5f3cc4ba1295dcf1bcdb1 /sfx2/source/control | |
parent | c6af59b234e8eb8182dc7f686290524feafd6ed6 (diff) |
Prepare for removal of non-const operator[] from Sequence in sfx2
Change-Id: I0cdce64983901a6cc3b50dc9873a370ff08b9eb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124387
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r-- | sfx2/source/control/charwin.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsviewitem.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/control/request.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 28 |
7 files changed, 32 insertions, 37 deletions
diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 99f5c5796d08..eb5b5662a817 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -23,6 +23,7 @@ #include <vcl/svapp.hxx> #include <sfx2/charwin.hxx> #include <comphelper/dispatchcommand.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -98,12 +99,9 @@ void SvxCharView::InsertCharToDoc() if (GetText().isEmpty()) return; - uno::Sequence<beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Symbols"; - aArgs[0].Value <<= GetText(); - - aArgs[1].Name = "FontName"; - aArgs[1].Value <<= maFont.GetFamilyName(); + uno::Sequence<beans::PropertyValue> aArgs{ comphelper::makePropertyValue("Symbols", GetText()), + comphelper::makePropertyValue( + "FontName", maFont.GetFamilyName()) }; comphelper::dispatchCommand(".uno:InsertSymbol", aArgs); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index e4965467ed0e..6c6b3134404d 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1706,10 +1706,11 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos ) void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, const Point* pPos ) { - css::uno::Sequence< css::uno::Any > aArgs( 3 ); - aArgs[0] <<= comphelper::makePropertyValue( "Value", rResName ); - aArgs[1] <<= comphelper::makePropertyValue( "Frame", GetFrame()->GetFrame().GetFrameInterface() ); - aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true ); + css::uno::Sequence< css::uno::Any > aArgs{ + css::uno::Any(comphelper::makePropertyValue( "Value", rResName )), + css::uno::Any(comphelper::makePropertyValue( "Frame", GetFrame()->GetFrame().GetFrameInterface() )), + css::uno::Any(comphelper::makePropertyValue( "IsContextMenu", true )) + }; css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XPopupMenuController > xPopupController( diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 3da4bfb88818..f942b1ffbb15 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -68,9 +68,7 @@ bool IsDocEncrypted(const OUString& rURL) { uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext); - uno::Sequence<uno::Any> aArgs (2); - aArgs[0] <<= rURL; - aArgs[1] <<= embed::ElementModes::READ; + uno::Sequence<uno::Any> aArgs{ uno::Any(rURL), uno::Any(embed::ElementModes::READ) }; uno::Reference<embed::XStorage> xDocStorage ( xStorageFactory->createInstanceWithArguments(aArgs), uno::UNO_QUERY); diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index 0d0648f222a8..6f046e3dc6e8 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -9,6 +9,8 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/util/URLTransformer.hpp> + +#include <comphelper/propertyvalue.hxx> #include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <i18nutil/paper.hxx> @@ -189,13 +191,9 @@ void RecentDocsViewItem::OpenDocument() Reference<util::XURLTransformer> xTrans(util::URLTransformer::create(::comphelper::getProcessComponentContext())); xTrans->parseStrict(aTargetURL); - aArgsList.realloc(2); - aArgsList[0].Name = "Referer"; - aArgsList[0].Value <<= OUString("private:user"); - - // documents will never be opened as templates - aArgsList[1].Name = "AsTemplate"; - aArgsList[1].Value <<= false; + aArgsList = { comphelper::makePropertyValue("Referer", OUString("private:user")), + // documents will never be opened as templates + comphelper::makePropertyValue("AsTemplate", false) }; xDispatch = xDesktop->queryDispatch(aTargetURL, "_default", 0); diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index cac6ad5175a0..964a256b19a7 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -355,7 +355,7 @@ void SfxRequest_Impl::Record aStatement.aArgs[0].Value >>= aStr; rArgs[0].Value >>= aNew; aStr += aNew; - aStatement.aArgs[0].Value <<= aStr; + aStatement.aArgs.getArray()[0].Value <<= aStr; aElement <<= aStatement; xReplace->replaceByIndex( nCount-1, aElement ); return; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 284376d974fd..04de9a437550 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -66,9 +66,7 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) { uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext); - uno::Sequence<uno::Any> aArgs (2); - aArgs[0] <<= msURL; - aArgs[1] <<= embed::ElementModes::READ; + uno::Sequence<uno::Any> aArgs{ uno::Any(msURL), uno::Any(embed::ElementModes::READ) }; uno::Reference<embed::XStorage> xDocStorage ( xStorageFactory->createInstanceWithArguments(aArgs), uno::UNO_QUERY); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index a095d5a656fb..b01500814bc9 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -437,52 +437,53 @@ void SfxDispatchController_Impl::addParametersToArgs( const css::util::URL& aURL sal_Int32 nLen = rArgs.getLength(); rArgs.realloc( nLen+1 ); - rArgs[nLen].Name = aParamName; + auto pArgs = rArgs.getArray(); + pArgs[nLen].Name = aParamName; if ( aParamType.isEmpty() ) { // Default: LONG - rArgs[nLen].Value <<= aValue.toInt32(); + pArgs[nLen].Value <<= aValue.toInt32(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_BOOL], 4 )) { // sal_Bool support - rArgs[nLen].Value <<= aValue.toBoolean(); + pArgs[nLen].Value <<= aValue.toBoolean(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_BYTE], 4 )) { // sal_uInt8 support - rArgs[nLen].Value <<= sal_Int8( aValue.toInt32() ); + pArgs[nLen].Value <<= sal_Int8( aValue.toInt32() ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_LONG], 4 )) { // LONG support - rArgs[nLen].Value <<= aValue.toInt32(); + pArgs[nLen].Value <<= aValue.toInt32(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_SHORT], 5 )) { // SHORT support - rArgs[nLen].Value <<= sal_Int16( aValue.toInt32() ); + pArgs[nLen].Value <<= sal_Int16( aValue.toInt32() ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_HYPER], 5 )) { // HYPER support - rArgs[nLen].Value <<= aValue.toInt64(); + pArgs[nLen].Value <<= aValue.toInt64(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_FLOAT], 5 )) { // FLOAT support - rArgs[nLen].Value <<= aValue.toFloat(); + pArgs[nLen].Value <<= aValue.toFloat(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_STRING], 6 )) { // STRING support - rArgs[nLen].Value <<= INetURLObject::decode( aValue, INetURLObject::DecodeMechanism::WithCharset ); + pArgs[nLen].Value <<= INetURLObject::decode( aValue, INetURLObject::DecodeMechanism::WithCharset ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_DOUBLE], 6)) { // DOUBLE support - rArgs[nLen].Value <<= aValue.toDouble(); + pArgs[nLen].Value <<= aValue.toDouble(); } } while ( nIndex >= 0 ); @@ -609,7 +610,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, // we offer dispatches for SID_JUMPTOMARK if the URL points to a bookmark inside the document // so we must retrieve this as an argument from the parsed URL lNewArgs.realloc( lNewArgs.getLength()+1 ); - auto& el = lNewArgs[lNewArgs.getLength()-1]; + auto& el = lNewArgs.getArray()[lNewArgs.getLength()-1]; el.Name = "Bookmark"; el.Value <<= aURL.Mark; } @@ -651,8 +652,9 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, // have an argument that has the same name as the master slot and type is SfxStringItem. sal_Int32 nIndex = lNewArgs.getLength(); lNewArgs.realloc( nIndex+1 ); - lNewArgs[nIndex].Name = OUString::createFromAscii( pSlot->pUnoName ); - lNewArgs[nIndex].Value <<= SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ); + auto plNewArgs = lNewArgs.getArray(); + plNewArgs[nIndex].Name = OUString::createFromAscii( pSlot->pUnoName ); + plNewArgs[nIndex].Value <<= SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ); } eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() ); |