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>
This commit is contained in:
Mike Kaganski
2021-10-29 09:39:59 +03:00
parent 3797007c2f
commit bddfc92022
9 changed files with 33 additions and 39 deletions

View File

@@ -763,7 +763,7 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{ {
sal_Int32 nOldLen = aStringItemList.getLength(); sal_Int32 nOldLen = aStringItemList.getLength();
aStringItemList.realloc( nOldLen + 1 ); aStringItemList.realloc( nOldLen + 1 );
aStringItemList[ nOldLen ] = sNewValue; aStringItemList.getArray()[ nOldLen ] = sNewValue;
setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) ); setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) );
setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) );

View File

@@ -163,10 +163,11 @@ css::uno::Sequence<OUString> OGridControlModel::getSupportedServiceNames()
{ {
css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames(); css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 4); aSupported.realloc(aSupported.getLength() + 4);
aSupported[aSupported.getLength()-4] = "com.sun.star.awt.UnoControlModel"; auto pSupported = aSupported.getArray();
aSupported[aSupported.getLength()-3] = FRM_SUN_COMPONENT_GRIDCONTROL; pSupported[aSupported.getLength()-4] = "com.sun.star.awt.UnoControlModel";
aSupported[aSupported.getLength()-2] = FRM_COMPONENT_GRID; pSupported[aSupported.getLength()-3] = FRM_SUN_COMPONENT_GRIDCONTROL;
aSupported[aSupported.getLength()-1] = FRM_COMPONENT_GRIDCONTROL; pSupported[aSupported.getLength()-2] = FRM_COMPONENT_GRID;
pSupported[aSupported.getLength()-1] = FRM_COMPONENT_GRIDCONTROL;
return aSupported; return aSupported;
} }
Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType )

View File

@@ -1178,8 +1178,7 @@ namespace frm
{ {
if ( m_nNULLPos != -1 ) if ( m_nNULLPos != -1 )
{ {
aSelectionIndicies.realloc(1); aSelectionIndicies = { m_nNULLPos };
aSelectionIndicies[0] = m_nNULLPos;
} }
} }
else else
@@ -1191,8 +1190,7 @@ namespace frm
ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), v ); ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), v );
if ( curValuePos != aValues.end() ) if ( curValuePos != aValues.end() )
{ {
aSelectionIndicies.realloc( 1 ); aSelectionIndicies = { o3tl::narrowing<sal_Int16>(curValuePos - aValues.begin()) };
aSelectionIndicies[0] = curValuePos - aValues.begin();
} }
} }
@@ -1391,8 +1389,7 @@ namespace frm
OSL_VERIFY( _rExternalValue >>= nSelectIndex ); OSL_VERIFY( _rExternalValue >>= nSelectIndex );
if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < static_cast<sal_Int32>(getStringItemList().size()) ) ) if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < static_cast<sal_Int32>(getStringItemList().size()) ) )
{ {
aSelectIndexes.realloc( 1 ); aSelectIndexes = { o3tl::narrowing<sal_Int16>(nSelectIndex) };
aSelectIndexes[ 0 ] = static_cast< sal_Int16 >( nSelectIndex );
} }
} }
break; break;

View File

@@ -44,6 +44,7 @@
#include <services.hxx> #include <services.hxx>
#include <comphelper/interfacecontainer2.hxx> #include <comphelper/interfacecontainer2.hxx>
#include <comphelper/property.hxx> #include <comphelper/property.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <svtools/imageresourceaccess.hxx> #include <svtools/imageresourceaccess.hxx>
@@ -317,15 +318,12 @@ namespace frm
if ( xDisp.is() ) if ( xDisp.is() )
{ {
Sequence<PropertyValue> aProps(3); Sequence<PropertyValue> aProps{
aProps[0].Name = "URL"; comphelper::makePropertyValue("URL", aURL.Complete),
aProps[0].Value <<= aURL.Complete; comphelper::makePropertyValue(
"FrameName", xSet->getPropertyValue(PROPERTY_TARGET_FRAME)),
aProps[1].Name = "FrameName"; comphelper::makePropertyValue("Referer", xModel->getURL())
aProps[1].Value = xSet->getPropertyValue(PROPERTY_TARGET_FRAME); };
aProps[2].Name = "Referer";
aProps[2].Value <<= xModel->getURL();
xDisp->dispatch( aHyperLink, aProps ); xDisp->dispatch( aHyperLink, aProps );
} }

View File

@@ -142,16 +142,17 @@ namespace frm
if (_rEvent.Position + _rEvent.Count <= m_aTypedItems.getLength()) if (_rEvent.Position + _rEvent.Count <= m_aTypedItems.getLength())
{ {
Sequence<Any> aTmp( m_aTypedItems.getLength() - _rEvent.Count ); Sequence<Any> aTmp( m_aTypedItems.getLength() - _rEvent.Count );
auto aTmpRange = asNonConstRange(aTmp);
sal_Int32 nStop = _rEvent.Position; sal_Int32 nStop = _rEvent.Position;
sal_Int32 i = 0; sal_Int32 i = 0;
for ( ; i < nStop; ++i) for ( ; i < nStop; ++i)
{ {
aTmp[i] = m_aTypedItems[i]; aTmpRange[i] = m_aTypedItems[i];
} }
nStop = aTmp.getLength(); nStop = aTmp.getLength();
for (sal_Int32 j = _rEvent.Position + _rEvent.Count; i < nStop; ++i, ++j) 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; m_aTypedItems = aTmp;
} }

View File

@@ -24,6 +24,7 @@
#include <com/sun/star/form/runtime/FormFeature.hpp> #include <com/sun/star/form/runtime/FormFeature.hpp>
#include <comphelper/propertyvalue.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
@@ -272,9 +273,8 @@ namespace frm
{ {
if ( aInfo->second.xDispatcher.is() ) if ( aInfo->second.xDispatcher.is() )
{ {
Sequence< PropertyValue > aArgs( 1 ); Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(
aArgs[0].Name = OUString::createFromAscii( _pParamAsciiName ); OUString::createFromAscii( _pParamAsciiName ), _rParamValue) };
aArgs[0].Value = _rParamValue;
aInfo->second.xDispatcher->dispatch( aInfo->second.aURL, aArgs ); aInfo->second.xDispatcher->dispatch( aInfo->second.aURL, aArgs );
} }

View File

@@ -721,15 +721,10 @@ namespace frm
OSL_ENSURE( xProperties.is(), "FormOperations::execute: no multi property access!" ); OSL_ENSURE( xProperties.is(), "FormOperations::execute: no multi property access!" );
if ( xProperties.is() ) if ( xProperties.is() )
{ {
Sequence< OUString > aNames( 3 ); Sequence< OUString > aNames{ PROPERTY_FILTER, PROPERTY_HAVINGCLAUSE,
aNames[0] = PROPERTY_FILTER; PROPERTY_SORT };
aNames[1] = PROPERTY_HAVINGCLAUSE;
aNames[2] = PROPERTY_SORT;
Sequence< Any> aValues( 3 ); Sequence< Any> aValues{ Any(OUString()), Any(OUString()), Any(OUString()) };
aValues[0] <<= OUString();
aValues[1] <<= OUString();
aValues[2] <<= OUString();
weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent())); weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent()));
xProperties->setPropertyValues( aNames, aValues ); xProperties->setPropertyValues( aNames, aValues );

View File

@@ -342,10 +342,11 @@ namespace frm
// translate them into command URLs // translate them into command URLs
css::uno::Sequence< OUString > aCommandURLs( aFormFeatures.size() ); css::uno::Sequence< OUString > aCommandURLs( aFormFeatures.size() );
auto aCommandURLsRange = asNonConstRange(aCommandURLs);
size_t i = 0; size_t i = 0;
for (auto const& formFeature : aFormFeatures) for (auto const& formFeature : aFormFeatures)
{ {
aCommandURLs[i++] = lcl_getCommandURL(formFeature); aCommandURLsRange[i++] = lcl_getCommandURL(formFeature);
} }
// retrieve the images for the command URLs // retrieve the images for the command URLs

View File

@@ -61,11 +61,12 @@ CSubmission::SubmissionResult CSubmission::replace(const OUString& aReplace, con
// open the stream from the result... // open the stream from the result...
// build media descriptor // build media descriptor
Sequence< PropertyValue > descriptor(2); Sequence< PropertyValue > descriptor{
descriptor[0] = PropertyValue("InputStream", PropertyValue("InputStream",
-1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE); -1, makeAny(m_aResultStream), PropertyState_DIRECT_VALUE),
descriptor[1] = PropertyValue("ReadOnly", PropertyValue("ReadOnly",
-1, makeAny(true), PropertyState_DIRECT_VALUE); -1, makeAny(true), PropertyState_DIRECT_VALUE)
};
OUString aURL = m_aURLObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); OUString aURL = m_aURLObj.GetMainURL(INetURLObject::DecodeMechanism::NONE);
xLoader->loadComponentFromURL(aURL, "_default", FrameSearchFlag::ALL, descriptor); xLoader->loadComponentFromURL(aURL, "_default", FrameSearchFlag::ALL, descriptor);