diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:44:28 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 10:31:26 +0200 |
commit | f662ba95361ba6b8eb49e0acd98bf28bc5f21100 (patch) | |
tree | a06ea88459155bb72b3f01dcda1d27f17cc49209 /framework/source/layoutmanager | |
parent | bddfc920220b712c08eda96ac320a274e4bfcee6 (diff) |
Prepare for removal of non-const operator[] from Sequence in framework
Change-Id: Ied2683a0b8a1bab1a7594da1e9bdbd3cb753552c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124370
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'framework/source/layoutmanager')
-rw-r--r-- | framework/source/layoutmanager/helpers.cxx | 6 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 50 | ||||
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 63 |
3 files changed, 52 insertions, 67 deletions
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index f9b319f4e19e..494281f16e5e 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/ui/XUIElement.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/mediadescriptor.hxx> #include <vcl/svapp.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -297,9 +298,8 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComp OUString aDockWinArgName = "DockingWindow" + OUString::number( nIndex ); - css::uno::Sequence< css::beans::PropertyValue > aArgs(1); - aArgs[0].Name = aDockWinArgName; - aArgs[0].Value <<= bVisible; + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aDockWinArgName, bVisible) }; css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index bed044cc5523..e02f57e4345e 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/status.hxx> #include <vcl/settings.hxx> #include <vcl/window.hxx> @@ -672,28 +673,21 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI try { - Sequence< PropertyValue > aWindowState( 8 ); - - aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED; - aWindowState[0].Value <<= !rElementData.m_bFloating; - aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE; - aWindowState[1].Value <<= rElementData.m_bVisible; - - aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA; - aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea; - - aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS; - aWindowState[3].Value <<= rElementData.m_aDockedData.m_aPos; - - aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS; - aWindowState[4].Value <<= rElementData.m_aFloatingData.m_aPos; - - aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE; - aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; - aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME; - aWindowState[6].Value <<= rElementData.m_aUIName; - aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED; - aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked; + Sequence< PropertyValue > aWindowState{ + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKED, !rElementData.m_bFloating), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_VISIBLE, rElementData.m_bVisible), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKINGAREA, + rElementData.m_aDockedData.m_nDockedArea), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKPOS, + rElementData.m_aDockedData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_POS, + rElementData.m_aFloatingData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_SIZE, + rElementData.m_aFloatingData.m_aSize), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_UINAME, rElementData.m_aUIName), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_LOCKED, + rElementData.m_aDockedData.m_bLocked) + }; if ( xPersistentWindowState->hasByName( aName )) { @@ -730,11 +724,8 @@ Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aNa Reference< ui::XUIElement > xUIElement; SolarMutexGuard g; - Sequence< PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= m_xFrame; - aPropSeq[1].Name = "Persistent"; - aPropSeq[1].Value <<= true; + Sequence< PropertyValue > aPropSeq{ comphelper::makePropertyValue("Frame", m_xFrame), + comphelper::makePropertyValue("Persistent", true) }; try { @@ -1681,10 +1672,11 @@ Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements() } aSeq.realloc(nSize); + auto pSeq = aSeq.getArray(); if ( nMenuBarIndex >= 0 ) - aSeq[nMenuBarIndex] = xMenuBar; + pSeq[nMenuBarIndex] = xMenuBar; if ( nStatusBarIndex >= 0 ) - aSeq[nStatusBarIndex] = xStatusBar; + pSeq[nStatusBarIndex] = xStatusBar; return aSeq; } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 97e8e75e5b29..c190b1a40f23 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIFunctionListener.hpp> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/queryinterface.hxx> #include <o3tl/string_view.hxx> #include <unotools/cmdoptions.hxx> @@ -450,11 +451,10 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) { uno::Reference< ui::XUIElement > xUIElement; - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= xFrame; - aPropSeq[1].Name = "Persistent"; - aPropSeq[1].Value <<= true; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Frame", xFrame), + comphelper::makePropertyValue("Persistent", true) + }; uno::Reference<ui::XUIElementFactory> xUIElementFactory; { SolarMutexGuard aReadLock; @@ -1080,15 +1080,16 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= xFrame; - aPropSeq[1].Name = "ConfigurationData"; + auto pPropSeq = aPropSeq.getArray(); + pPropSeq[0].Name = "Frame"; + pPropSeq[0].Value <<= xFrame; + pPropSeq[1].Name = "ConfigurationData"; for ( sal_uInt32 i = 0; i < nCount; i++ ) { OUString aAddonToolBarName( "private:resource/toolbar/addon_" + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i ); - aPropSeq[1].Value <<= aAddonToolBarData; + pPropSeq[1].Value <<= aAddonToolBarData; UIElement aElement = implts_findToolbar( aAddonToolBarName ); @@ -1563,31 +1564,23 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen try { - uno::Sequence< beans::PropertyValue > aWindowState( 9 ); - - aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED; - aWindowState[0].Value <<= !rElementData.m_bFloating; - aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE; - aWindowState[1].Value <<= rElementData.m_bVisible; - aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA; - aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea; - - awt::Point aPos = rElementData.m_aDockedData.m_aPos; - aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS; - aWindowState[3].Value <<= aPos; - - aPos = rElementData.m_aFloatingData.m_aPos; - aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS; - aWindowState[4].Value <<= aPos; - - aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE; - aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; - aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME; - aWindowState[6].Value <<= rElementData.m_aUIName; - aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED; - aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked; - aWindowState[8].Name = WINDOWSTATE_PROPERTY_STYLE; - aWindowState[8].Value <<= static_cast<sal_uInt16>(rElementData.m_nStyle); + uno::Sequence<beans::PropertyValue> aWindowState{ + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKED, !rElementData.m_bFloating), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_VISIBLE, rElementData.m_bVisible), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKINGAREA, + rElementData.m_aDockedData.m_nDockedArea), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKPOS, + rElementData.m_aDockedData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_POS, + rElementData.m_aFloatingData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_SIZE, + rElementData.m_aFloatingData.m_aSize), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_UINAME, rElementData.m_aUIName), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_LOCKED, + rElementData.m_aDockedData.m_bLocked), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_STYLE, + static_cast<sal_uInt16>(rElementData.m_nStyle)) + }; OUString aName = rElementData.m_aName; if ( xPersistentWindowState->hasByName( aName )) @@ -3930,7 +3923,7 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb { ++nCount; aSeq.realloc( nCount ); - aSeq[nCount-1] = elem.m_xUIElement; + aSeq.getArray()[nCount-1] = elem.m_xUIElement; } } } |