diff options
-rw-r--r-- | toolkit/source/awt/vclxfont.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/controls/animatedimages.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 35 | ||||
-rw-r--r-- | toolkit/source/controls/formattedcontrol.cxx | 20 | ||||
-rw-r--r-- | toolkit/source/controls/grid/gridcontrol.hxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/roadmapcontrol.cxx | 10 | ||||
-rw-r--r-- | toolkit/source/controls/stdtabcontroller.cxx | 3 | ||||
-rw-r--r-- | toolkit/source/controls/tabpagecontainer.cxx | 7 | ||||
-rw-r--r-- | toolkit/source/controls/tabpagemodel.cxx | 18 | ||||
-rw-r--r-- | toolkit/source/controls/tkscrollbar.cxx | 10 | ||||
-rw-r--r-- | toolkit/source/controls/tree/treecontrol.hxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/tree/treecontrolpeer.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolcontainer.cxx | 7 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolcontainermodel.cxx | 5 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrols.cxx | 6 |
16 files changed, 68 insertions, 78 deletions
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index 2ae914cca2a7..66e5ba2bdc40 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -20,6 +20,8 @@ #include <memory> #include <com/sun/star/awt/XDevice.hpp> + +#include <comphelper/sequence.hxx> #include <toolkit/awt/vclxfont.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/macros.hxx> @@ -158,11 +160,8 @@ sal_Int32 VCLXFont::getStringWidthArray( const OUString& str, css::uno::Sequence pOutDev->SetFont( maFont ); std::vector<sal_Int32> aDXA; nRet = pOutDev->GetTextArray( str, &aDXA ); - rDXArray = css::uno::Sequence<sal_Int32>( str.getLength() ); - for(int i = 0; i < str.getLength(); i++) - { - rDXArray[i] = aDXA[i]; - } + // I don't know if size of aDXA is guaranteed same as length of str, so use arrayToSequence + rDXArray = comphelper::arrayToSequence<sal_Int32>(aDXA.data(), str.getLength()); pOutDev->SetFont( aOldFont ); } return nRet; diff --git a/toolkit/source/controls/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx index e70fd1ec0cc8..3e335a1a661f 100644 --- a/toolkit/source/controls/animatedimages.cxx +++ b/toolkit/source/controls/animatedimages.cxx @@ -126,7 +126,7 @@ public: { Sequence< OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() ); aServices.realloc( aServices.getLength() + 1 ); - aServices[ aServices.getLength() - 1 ] = "com.sun.star.awt.AnimatedImagesControl"; + aServices.getArray()[ aServices.getLength() - 1 ] = "com.sun.star.awt.AnimatedImagesControl"; return aServices; } diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 96599f3089bb..1172ac5c99a8 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -867,7 +867,7 @@ void ControlModelContainerBase::implNotifyTabModelChange( const OUString& _rAcce aEvent.Source = *this; aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself aEvent.Changes.realloc( 1 ); // exactly one change - aEvent.Changes[ 0 ].Accessor <<= _rAccessor; + aEvent.Changes.getArray()[ 0 ].Accessor <<= _rAccessor; std::vector< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() ); diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 5c5df64850f8..cb5446e7a8ce 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -160,8 +160,9 @@ public: { auto s(ControlModelContainerBase::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlDialogModel"; - s[s.getLength() - 1] = "stardiv.vcl.controlmodel.Dialog"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlDialogModel"; + ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.Dialog"; return s; } }; @@ -509,15 +510,14 @@ void SAL_CALL UnoDialogControl::windowResized( const css::awt::WindowEvent& e ) // Remember that changes have been done by listener. No need to // update the position because of property change event. mbSizeModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); // Properties in a sequence must be sorted! - aProps[0] = "Height"; - aProps[1] = "Width"; - aValues[0] <<= sal_Int32( - std::clamp(aAppFontSize.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); - aValues[1] <<= sal_Int32( - std::clamp(aAppFontSize.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); + Sequence< OUString > aProps{ "Height", "Width" }; + Sequence< Any > aValues{ + Any(sal_Int32( + std::clamp(aAppFontSize.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32)))), + Any(sal_Int32( + std::clamp(aAppFontSize.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32)))) + }; ImplSetPropertyValues( aProps, aValues, true ); mbSizeModified = false; @@ -538,14 +538,13 @@ void SAL_CALL UnoDialogControl::windowMoved( const css::awt::WindowEvent& e ) // Remember that changes have been done by listener. No need to // update the position because of property change event. mbPosModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - aProps[0] = "PositionX"; - aProps[1] = "PositionY"; - aValues[0] <<= sal_Int32( - std::clamp(aTmp.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); - aValues[1] <<= sal_Int32( - std::clamp(aTmp.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32))); + Sequence< OUString > aProps{ "PositionX", "PositionY" }; + Sequence< Any > aValues{ + Any(sal_Int32( + std::clamp(aTmp.Width(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32)))), + Any(sal_Int32( + std::clamp(aTmp.Height(), tools::Long(SAL_MIN_INT32), tools::Long(SAL_MAX_INT32)))) + }; ImplSetPropertyValues( aProps, aValues, true ); mbPosModified = false; diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 23a35e4a2c0b..b21580a0554e 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -403,8 +403,9 @@ namespace toolkit { auto s(UnoControlModel::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlFormattedFieldModel"; - s[s.getLength() - 1] = "stardiv.vcl.controlmodel.FormattedField"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlFormattedFieldModel"; + ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.FormattedField"; return s; } @@ -427,13 +428,11 @@ namespace toolkit Reference< XVclWindowPeer > xPeer(getPeer(), UNO_QUERY); OSL_ENSURE(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?"); - Sequence< OUString > aNames( 2 ); - aNames[0] = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE ); - aNames[1] = GetPropertyName( BASEPROPERTY_TEXT ); + Sequence< OUString > aNames{ GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE ), + GetPropertyName( BASEPROPERTY_TEXT ) }; - Sequence< Any > aValues( 2 ); - aValues[0] = xPeer->getProperty( aNames[0] ); - aValues[1] = xPeer->getProperty( aNames[1] ); + Sequence< Any > aValues{ xPeer->getProperty( aNames[0] ), + xPeer->getProperty( aNames[1] ) }; ImplSetPropertyValues( aNames, aValues, false ); @@ -451,8 +450,9 @@ namespace toolkit { auto s(UnoEditControl::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlFormattedField"; - s[s.getLength() - 1] = "stardiv.vcl.control.FormattedField"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlFormattedField"; + ps[s.getLength() - 1] = "stardiv.vcl.control.FormattedField"; return s; } } // namespace toolkit diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index c5a7459f6b31..e62f706393b6 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -70,7 +70,7 @@ public: { auto s(UnoControlModel::getSupportedServiceNames()); s.realloc(s.getLength() + 1); - s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGridModel"; + s.getArray()[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGridModel"; return s; } }; @@ -121,7 +121,7 @@ public: { auto s(UnoControlBase::getSupportedServiceNames()); s.realloc(s.getLength() + 1); - s[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGrid"; + s.getArray()[s.getLength() - 1] = "com.sun.star.awt.grid.UnoControlGrid"; return s; } diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 4d2e2a1d152a..48dae2ef6748 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -92,8 +92,9 @@ static void lcl_throwIndexOutOfBoundsException( ) { auto s(UnoControlRoadmapModel_Base::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmapModel"; - s[s.getLength() - 1] = "stardiv.vcl.controlmodel.Roadmap"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmapModel"; + ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.Roadmap"; return s; } @@ -486,8 +487,9 @@ css::uno::Sequence<OUString> UnoRoadmapControl::getSupportedServiceNames() { auto s(UnoControlBase::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmap"; - s[s.getLength() - 1] = "stardiv.vcl.control.Roadmap"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlRoadmap"; + ps[s.getLength() - 1] = "stardiv.vcl.control.Roadmap"; return s; } diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx index 54d8a6a93782..119a77c9a497 100644 --- a/toolkit/source/controls/stdtabcontroller.cxx +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -63,6 +63,7 @@ bool StdTabController::ImplCreateComponentSequence( if (nModels != rControls.getLength()) { Sequence< Reference< XControl > > aSeq( nModels ); + auto aSeqRange = asNonConstRange(aSeq); Reference< XControl > xCurrentControl; sal_Int32 nRealControls = 0; @@ -70,7 +71,7 @@ bool StdTabController::ImplCreateComponentSequence( { xCurrentControl = FindControl(rControls, rModel); if (xCurrentControl.is()) - aSeq[nRealControls++] = xCurrentControl; + aSeqRange[nRealControls++] = xCurrentControl; } aSeq.realloc(nRealControls); rControls = aSeq; diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx index 64354b07f5ad..f72ce4b11d3a 100644 --- a/toolkit/source/controls/tabpagecontainer.cxx +++ b/toolkit/source/controls/tabpagecontainer.cxx @@ -123,16 +123,13 @@ namespace Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::createTabPage( ::sal_Int16 i_tabPageID ) { - Sequence< Any > aInitArgs(1); - aInitArgs[0] <<= i_tabPageID; + Sequence< Any > aInitArgs{ Any(i_tabPageID) }; return lcl_createTabPageModel( m_xContext, aInitArgs, this ); } Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::loadTabPage( ::sal_Int16 i_tabPageID, const OUString& i_resourceURL ) { - Sequence< Any > aInitArgs(2); - aInitArgs[0] <<= i_tabPageID; - aInitArgs[1] <<= i_resourceURL; + Sequence< Any > aInitArgs{ Any(i_tabPageID), Any(i_resourceURL) }; return lcl_createTabPageModel( m_xContext, aInitArgs, this ); } diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index ccf320dad8aa..d0de487af394 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -63,7 +63,7 @@ css::uno::Sequence< OUString > SAL_CALL UnoControlTabPageModel::getSupportedServ { css::uno::Sequence< OUString > aNames = ControlModelContainerBase::getSupportedServiceNames( ); aNames.realloc( aNames.getLength() + 1 ); - aNames[ aNames.getLength() - 1 ] = "com.sun.star.awt.tab.UnoControlTabPageModel"; + aNames.getArray()[ aNames.getLength() - 1 ] = "com.sun.star.awt.tab.UnoControlTabPageModel"; return aNames; } @@ -250,13 +250,9 @@ void SAL_CALL UnoControlTabPage::windowResized( const css::awt::WindowEvent& e ) // Remember that changes have been done by listener. No need to // update the position because of property change event. mbSizeModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); // Properties in a sequence must be sorted! - aProps[0] = "Height"; - aProps[1] = "Width"; - aValues[0] <<= aAppFontSize.Height(); - aValues[1] <<= aAppFontSize.Width(); + Sequence< OUString > aProps{ "Height", "Width" }; + Sequence< Any > aValues{ Any(aAppFontSize.Height()), Any(aAppFontSize.Width()) }; ImplSetPropertyValues( aProps, aValues, true ); mbSizeModified = false; @@ -277,12 +273,8 @@ void SAL_CALL UnoControlTabPage::windowMoved( const css::awt::WindowEvent& e ) // Remember that changes have been done by listener. No need to // update the position because of property change event. mbPosModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - aProps[0] = "PositionX"; - aProps[1] = "PositionY"; - aValues[0] <<= aTmp.Width(); - aValues[1] <<= aTmp.Height(); + Sequence< OUString > aProps{ "PositionX", "PositionY" }; + Sequence< Any > aValues{ Any(aTmp.Width()), Any(aTmp.Height()) }; ImplSetPropertyValues( aProps, aValues, true ); mbPosModified = false; diff --git a/toolkit/source/controls/tkscrollbar.cxx b/toolkit/source/controls/tkscrollbar.cxx index 77a26096cedb..4848a109664a 100644 --- a/toolkit/source/controls/tkscrollbar.cxx +++ b/toolkit/source/controls/tkscrollbar.cxx @@ -61,8 +61,9 @@ namespace toolkit { auto s(UnoControlModel::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlScrollBarModel"; - s[s.getLength() - 1] = "stardiv.vcl.controlmodel.ScrollBar"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlScrollBarModel"; + ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.ScrollBar"; return s; } @@ -297,8 +298,9 @@ namespace toolkit { auto s(UnoControlBase::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlScrollBar"; - s[s.getLength() - 1] = "stardiv.vcl.control.ScrollBar"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlScrollBar"; + ps[s.getLength() - 1] = "stardiv.vcl.control.ScrollBar"; return s; } diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx index 4da77731abe3..af4793fe91ec 100644 --- a/toolkit/source/controls/tree/treecontrol.hxx +++ b/toolkit/source/controls/tree/treecontrol.hxx @@ -53,7 +53,7 @@ public: { auto s(UnoControlModel::getSupportedServiceNames()); s.realloc(s.getLength() + 1); - s[s.getLength() - 1] = "com.sun.star.awt.tree.TreeControlModel"; + s.getArray()[s.getLength() - 1] = "com.sun.star.awt.tree.TreeControlModel"; return s; } }; diff --git a/toolkit/source/controls/tree/treecontrolpeer.cxx b/toolkit/source/controls/tree/treecontrolpeer.cxx index 69f994e666e7..fe273e0f6baf 100644 --- a/toolkit/source/controls/tree/treecontrolpeer.cxx +++ b/toolkit/source/controls/tree/treecontrolpeer.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/awt/tree/XMutableTreeNode.hpp> #include <controls/treecontrolpeer.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> @@ -1387,10 +1388,7 @@ bool TreeControlPeer::loadImage( const OUString& rURL, Image& rImage ) try { - css::beans::PropertyValues aProps( 1 ); - aProps[0].Name = "URL"; - aProps[0].Value <<= rURL; - + css::beans::PropertyValues aProps{ comphelper::makePropertyValue("URL", rURL) }; Reference< XGraphic > xGraphic( mxGraphicProvider->queryGraphic( aProps ) ); Graphic aGraphic( xGraphic ); diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx index ae48bbe3c859..e3c6df43571e 100644 --- a/toolkit/source/controls/unocontrolcontainer.cxx +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -693,7 +693,7 @@ void UnoControlContainer::addTabController( const uno::Reference< awt::XTabContr sal_uInt32 nCount = maTabControllers.getLength(); maTabControllers.realloc( nCount + 1 ); - maTabControllers[ nCount ] = TabController; + maTabControllers.getArray()[ nCount ] = TabController; } void UnoControlContainer::removeTabController( const uno::Reference< awt::XTabController >& TabController ) @@ -784,8 +784,9 @@ css::uno::Sequence<OUString> UnoControlContainer::getSupportedServiceNames() { auto s(UnoControlBase::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainer"; - s[s.getLength() - 1] = "stardiv.vcl.control.ControlContainer"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainer"; + ps[s.getLength() - 1] = "stardiv.vcl.control.ControlContainer"; return s; } diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx index 83079df8bdfc..d9272c60fc66 100644 --- a/toolkit/source/controls/unocontrolcontainermodel.cxx +++ b/toolkit/source/controls/unocontrolcontainermodel.cxx @@ -54,8 +54,9 @@ UnoControlContainerModel::getSupportedServiceNames() { auto s(UnoControlModel::getSupportedServiceNames()); s.realloc(s.getLength() + 2); - s[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel"; - s[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer"; + auto ps = s.getArray(); + ps[s.getLength() - 2] = "com.sun.star.awt.UnoControlContainerModel"; + ps[s.getLength() - 1] = "stardiv.vcl.controlmodel.ControlContainer"; return s; } diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index c4f6a1de7640..3d528bd5e68b 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -40,6 +40,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <vcl/window.hxx> @@ -75,10 +76,7 @@ ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL ) { uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); - uno::Sequence< beans::PropertyValue > aMediaProperties(1); - aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= _rURL; - xGraphic = xProvider->queryGraphic( aMediaProperties ); + xGraphic = xProvider->queryGraphic({ comphelper::makePropertyValue("URL", _rURL) }); } catch (const Exception&) { |