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();
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>() ) );

View File

@@ -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 )

View File

@@ -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;

View File

@@ -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 );
}

View File

@@ -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;
}

View File

@@ -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 );
}

View File

@@ -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< OUString > aNames{ PROPERTY_FILTER, PROPERTY_HAVINGCLAUSE,
PROPERTY_SORT };
Sequence< Any> aValues( 3 );
aValues[0] <<= OUString();
aValues[1] <<= OUString();
aValues[2] <<= OUString();
Sequence< Any> aValues{ Any(OUString()), Any(OUString()), Any(OUString()) };
weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent()));
xProperties->setPropertyValues( aNames, aValues );

View File

@@ -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

View File

@@ -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);