diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:39:59 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 09:28:10 +0200 |
commit | bddfc920220b712c08eda96ac320a274e4bfcee6 (patch) | |
tree | 22addf320f016accb768d83f7760768daa1a5bd1 | |
parent | 3797007c2fe143dc3c83c72eeb5cc6d1cb401792 (diff) |
Prepare for removal of non-const operator[] from Sequence in forms
Change-Id: I2b7bd7935d7e620b9f283ec7c0548beeb97c140d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124366
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | forms/source/component/ComboBox.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/Grid.cxx | 9 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 9 | ||||
-rw-r--r-- | forms/source/component/clickableimage.cxx | 16 | ||||
-rw-r--r-- | forms/source/component/entrylisthelper.cxx | 5 | ||||
-rw-r--r-- | forms/source/helper/formnavigation.cxx | 6 | ||||
-rw-r--r-- | forms/source/runtime/formoperations.cxx | 13 | ||||
-rw-r--r-- | forms/source/solar/control/navtoolbar.cxx | 3 | ||||
-rw-r--r-- | forms/source/xforms/submission/replace.cxx | 11 |
9 files changed, 34 insertions, 40 deletions
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index fe3260070d68..fa28816c0890 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -763,7 +763,7 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) { sal_Int32 nOldLen = aStringItemList.getLength(); aStringItemList.realloc( nOldLen + 1 ); - aStringItemList[ nOldLen ] = sNewValue; + aStringItemList.getArray()[ nOldLen ] = sNewValue; setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) ); setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index b92f763d578e..67fb4cba1bbf 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -163,10 +163,11 @@ css::uno::Sequence<OUString> OGridControlModel::getSupportedServiceNames() { css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames(); aSupported.realloc(aSupported.getLength() + 4); - aSupported[aSupported.getLength()-4] = "com.sun.star.awt.UnoControlModel"; - aSupported[aSupported.getLength()-3] = FRM_SUN_COMPONENT_GRIDCONTROL; - aSupported[aSupported.getLength()-2] = FRM_COMPONENT_GRID; - aSupported[aSupported.getLength()-1] = FRM_COMPONENT_GRIDCONTROL; + auto pSupported = aSupported.getArray(); + pSupported[aSupported.getLength()-4] = "com.sun.star.awt.UnoControlModel"; + pSupported[aSupported.getLength()-3] = FRM_SUN_COMPONENT_GRIDCONTROL; + pSupported[aSupported.getLength()-2] = FRM_COMPONENT_GRID; + pSupported[aSupported.getLength()-1] = FRM_COMPONENT_GRIDCONTROL; return aSupported; } Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 2f95f6331f01..4e632d60a07e 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1178,8 +1178,7 @@ namespace frm { if ( m_nNULLPos != -1 ) { - aSelectionIndicies.realloc(1); - aSelectionIndicies[0] = m_nNULLPos; + aSelectionIndicies = { m_nNULLPos }; } } else @@ -1191,8 +1190,7 @@ namespace frm ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), v ); if ( curValuePos != aValues.end() ) { - aSelectionIndicies.realloc( 1 ); - aSelectionIndicies[0] = curValuePos - aValues.begin(); + aSelectionIndicies = { o3tl::narrowing<sal_Int16>(curValuePos - aValues.begin()) }; } } @@ -1391,8 +1389,7 @@ namespace frm OSL_VERIFY( _rExternalValue >>= nSelectIndex ); if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < static_cast<sal_Int32>(getStringItemList().size()) ) ) { - aSelectIndexes.realloc( 1 ); - aSelectIndexes[ 0 ] = static_cast< sal_Int16 >( nSelectIndex ); + aSelectIndexes = { o3tl::narrowing<sal_Int16>(nSelectIndex) }; } } break; diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 8dd3489967f5..77dd6c5943b6 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -44,6 +44,7 @@ #include <services.hxx> #include <comphelper/interfacecontainer2.hxx> #include <comphelper/property.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/types.hxx> #include <cppuhelper/exc_hlp.hxx> #include <svtools/imageresourceaccess.hxx> @@ -317,15 +318,12 @@ namespace frm if ( xDisp.is() ) { - Sequence<PropertyValue> aProps(3); - aProps[0].Name = "URL"; - aProps[0].Value <<= aURL.Complete; - - aProps[1].Name = "FrameName"; - aProps[1].Value = xSet->getPropertyValue(PROPERTY_TARGET_FRAME); - - aProps[2].Name = "Referer"; - aProps[2].Value <<= xModel->getURL(); + Sequence<PropertyValue> aProps{ + comphelper::makePropertyValue("URL", aURL.Complete), + comphelper::makePropertyValue( + "FrameName", xSet->getPropertyValue(PROPERTY_TARGET_FRAME)), + comphelper::makePropertyValue("Referer", xModel->getURL()) + }; xDisp->dispatch( aHyperLink, aProps ); } diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index ef27610006d2..84addb3afb51 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -142,16 +142,17 @@ namespace frm if (_rEvent.Position + _rEvent.Count <= m_aTypedItems.getLength()) { Sequence<Any> aTmp( m_aTypedItems.getLength() - _rEvent.Count ); + auto aTmpRange = asNonConstRange(aTmp); sal_Int32 nStop = _rEvent.Position; sal_Int32 i = 0; for ( ; i < nStop; ++i) { - aTmp[i] = m_aTypedItems[i]; + aTmpRange[i] = m_aTypedItems[i]; } nStop = aTmp.getLength(); for (sal_Int32 j = _rEvent.Position + _rEvent.Count; i < nStop; ++i, ++j) { - aTmp[i] = m_aTypedItems[j]; + aTmpRange[i] = m_aTypedItems[j]; } m_aTypedItems = aTmp; } diff --git a/forms/source/helper/formnavigation.cxx b/forms/source/helper/formnavigation.cxx index 547a5781649a..816c81f314b8 100644 --- a/forms/source/helper/formnavigation.cxx +++ b/forms/source/helper/formnavigation.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/form/runtime/FormFeature.hpp> +#include <comphelper/propertyvalue.hxx> #include <tools/debug.hxx> #include <osl/diagnose.h> @@ -272,9 +273,8 @@ namespace frm { if ( aInfo->second.xDispatcher.is() ) { - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString::createFromAscii( _pParamAsciiName ); - aArgs[0].Value = _rParamValue; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + OUString::createFromAscii( _pParamAsciiName ), _rParamValue) }; aInfo->second.xDispatcher->dispatch( aInfo->second.aURL, aArgs ); } diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 2a87bb2bd2c9..d82c87d050af 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -721,15 +721,10 @@ namespace frm OSL_ENSURE( xProperties.is(), "FormOperations::execute: no multi property access!" ); if ( xProperties.is() ) { - Sequence< OUString > aNames( 3 ); - aNames[0] = PROPERTY_FILTER; - aNames[1] = PROPERTY_HAVINGCLAUSE; - aNames[2] = PROPERTY_SORT; - - Sequence< Any> aValues( 3 ); - aValues[0] <<= OUString(); - aValues[1] <<= OUString(); - aValues[2] <<= OUString(); + Sequence< OUString > aNames{ PROPERTY_FILTER, PROPERTY_HAVINGCLAUSE, + PROPERTY_SORT }; + + Sequence< Any> aValues{ Any(OUString()), Any(OUString()), Any(OUString()) }; weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent())); xProperties->setPropertyValues( aNames, aValues ); diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 909c5d044502..f92c9f93f3da 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -342,10 +342,11 @@ namespace frm // translate them into command URLs css::uno::Sequence< OUString > aCommandURLs( aFormFeatures.size() ); + auto aCommandURLsRange = asNonConstRange(aCommandURLs); size_t i = 0; for (auto const& formFeature : aFormFeatures) { - aCommandURLs[i++] = lcl_getCommandURL(formFeature); + aCommandURLsRange[i++] = lcl_getCommandURL(formFeature); } // retrieve the images for the command URLs diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 27e9fad49ab5..e0595736b712 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -61,11 +61,12 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con // open the stream from the result... // build media descriptor - Sequence< PropertyValue > descriptor(2); - descriptor[0] = PropertyValue("InputStream", - -1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE); - descriptor[1] = PropertyValue("ReadOnly", - -1, makeAny(true), PropertyState_DIRECT_VALUE); + Sequence< PropertyValue > descriptor{ + PropertyValue("InputStream", + -1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE), + PropertyValue("ReadOnly", + -1, makeAny(true), PropertyState_DIRECT_VALUE) + }; OUString aURL = m_aURLObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); xLoader->loadComponentFromURL(aURL, "_default", FrameSearchFlag::ALL, descriptor); |