From c5196e281f51b2894aa903469ba8c15a6723eb4c Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 29 Oct 2021 09:55:58 +0300 Subject: Prepare for removal of non-const operator[] from Sequence in reportdesign Change-Id: I7631aeb90bf224ba7a00025df6e3fa444b216a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124380 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- reportdesign/source/core/api/ReportDefinition.cxx | 20 +++++----- reportdesign/source/core/api/ReportEngineJFree.cxx | 43 ++++++++------------- .../source/filter/xml/xmlControlProperty.cxx | 2 +- .../source/filter/xml/xmlExportDocumentHandler.cxx | 2 +- reportdesign/source/filter/xml/xmlfilter.cxx | 12 +++--- reportdesign/source/ui/dlg/CondFormat.cxx | 16 +++----- reportdesign/source/ui/dlg/DateTime.cxx | 25 ++++++------ reportdesign/source/ui/dlg/GroupsSorting.cxx | 45 ++++++++++------------ reportdesign/source/ui/dlg/Navigator.cxx | 7 ++-- .../source/ui/inspection/GeometryHandler.cxx | 3 +- reportdesign/source/ui/misc/RptUndo.cxx | 23 ++++++----- reportdesign/source/ui/misc/UITools.cxx | 5 ++- reportdesign/source/ui/report/DesignView.cxx | 12 +++--- reportdesign/source/ui/report/ReportController.cxx | 14 +++---- reportdesign/source/ui/report/ReportSection.cxx | 15 ++++---- 15 files changed, 111 insertions(+), 133 deletions(-) (limited to 'reportdesign/source') diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 6e8c0950b72e..36babe9b72a0 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -208,7 +208,7 @@ static void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDe sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= _rxStatusIndicator; + _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator; } } catch (const uno::Exception&) @@ -706,7 +706,7 @@ uno::Sequence< OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); - aSupported[ nLen ] = SERVICE_REPORTDEFINITION; + aSupported.getArray()[ nLen ] = SERVICE_REPORTDEFINITION; } // outta here @@ -1246,7 +1246,7 @@ void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< beans::PropertyValue aPropVal; aPropVal.Name = "Storage"; aPropVal.Value <<= _xStorageToLoadFrom; - aDelegatorArguments[nPos] <<= aPropVal; + aDelegatorArguments.getArray()[nPos] <<= aPropVal; rptui::OXUndoEnvironment& rEnv = m_pImpl->m_pReportModel->GetUndoEnv(); rptui::OXUndoEnvironment::OUndoEnvLock aLock(rEnv); @@ -1328,8 +1328,9 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS sal_Int32 nArgsLen = aDelegatorArguments.getLength(); - aDelegatorArguments.realloc(nArgsLen+1); - aDelegatorArguments[nArgsLen++] <<= xInfoSet; + aDelegatorArguments.realloc(nArgsLen+3); + auto pDelegatorArguments = aDelegatorArguments.getArray(); + pDelegatorArguments[nArgsLen++] <<= xInfoSet; uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver; uno::Reference xGraphicStorageHandler; @@ -1338,9 +1339,8 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS xGraphicHelper.clear(); xObjectResolver = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, SvXMLEmbeddedObjectHelperMode::Write ).get(); - aDelegatorArguments.realloc(nArgsLen+2); - aDelegatorArguments[nArgsLen++] <<= xGraphicStorageHandler; - aDelegatorArguments[nArgsLen++] <<= xObjectResolver; + pDelegatorArguments[nArgsLen++] <<= xGraphicStorageHandler; + pDelegatorArguments[nArgsLen++] <<= xObjectResolver; uno::Reference xCom(static_cast(this),uno::UNO_QUERY); // Try to write to settings.xml, meta.xml, and styles.xml; only really care about success of @@ -1607,9 +1607,7 @@ void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue const size_t nLastOpenMode = SAL_N_ELEMENTS( nOpenModes ) - 1; for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i ) { - uno::Sequence< uno::Any > aStorageCreationArgs(2); - aStorageCreationArgs[0] = aStorageSource; - aStorageCreationArgs[1] <<= nOpenModes[i]; + uno::Sequence< uno::Any > aStorageCreationArgs{ aStorageSource, uno::Any(nOpenModes[i]) }; try { diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index 210bf3705403..01585aebbabf 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -168,12 +168,6 @@ OUString OReportEngineJFree::getNewOutputName() } m_xReport->storeToStorage(xTemp,aEmpty); // store to temp file because it may contain information which isn't in the database yet. - uno::Sequence< beans::NamedValue > aConvertedProperties(8); - sal_Int32 nPos = 0; - aConvertedProperties[nPos].Name = "InputStorage"; - aConvertedProperties[nPos++].Value <<= xTemp; - aConvertedProperties[nPos].Name = "OutputStorage"; - OUString sFileURL; OUString sName = m_xReport->getCaption(); if ( sName.isEmpty() ) @@ -198,27 +192,21 @@ OUString OReportEngineJFree::getNewOutputName() xStorageProp->setPropertyValue( s_sMediaType, uno::makeAny(sMimeType)); } - aConvertedProperties[nPos++].Value <<= xOut; - - aConvertedProperties[nPos].Name = PROPERTY_REPORTDEFINITION; - aConvertedProperties[nPos++].Value <<= m_xReport; - - aConvertedProperties[nPos].Name = PROPERTY_ACTIVECONNECTION; - aConvertedProperties[nPos++].Value <<= m_xActiveConnection; - - aConvertedProperties[nPos].Name = PROPERTY_MAXROWS; - aConvertedProperties[nPos++].Value <<= m_nMaxRows; - // some meta data SvtUserOptions aUserOpts; OUString sAuthor = aUserOpts.GetFirstName() + " " + aUserOpts.GetLastName(); - aConvertedProperties[nPos].Name = "Author"; - aConvertedProperties[nPos++].Value <<= sAuthor; - aConvertedProperties[nPos].Name = "Title"; - aConvertedProperties[nPos++].Value <<= m_xReport->getCaption(); + uno::Sequence< beans::NamedValue > aConvertedProperties{ + {"InputStorage", uno::Any(xTemp) }, + {"OutputStorage", uno::Any(xOut) }, + {PROPERTY_REPORTDEFINITION, uno::Any(m_xReport) }, + {PROPERTY_ACTIVECONNECTION, uno::Any(m_xActiveConnection) }, + {PROPERTY_MAXROWS, uno::Any(m_nMaxRows) }, + {"Author", uno::Any(sAuthor) }, + {"Title", uno::Any(m_xReport->getCaption()) } + }; OUString sOutputName; @@ -276,17 +264,18 @@ uno::Reference< frame::XModel > OReportEngineJFree::createDocumentAlive( const u if ( xFrameLoad.is() ) { uno::Sequence < beans::PropertyValue > aArgs( _bHidden ? 3 : 2 ); + auto pArgs = aArgs.getArray(); sal_Int32 nLen = 0; - aArgs[nLen].Name = "AsTemplate"; - aArgs[nLen++].Value <<= false; + pArgs[nLen].Name = "AsTemplate"; + pArgs[nLen++].Value <<= false; - aArgs[nLen].Name = "ReadOnly"; - aArgs[nLen++].Value <<= true; + pArgs[nLen].Name = "ReadOnly"; + pArgs[nLen++].Value <<= true; if ( _bHidden ) { - aArgs[nLen].Name = "Hidden"; - aArgs[nLen++].Value <<= true; + pArgs[nLen].Name = "Hidden"; + pArgs[nLen++].Value <<= true; } xModel.set( xFrameLoad->loadComponentFromURL( diff --git a/reportdesign/source/filter/xml/xmlControlProperty.cxx b/reportdesign/source/filter/xml/xmlControlProperty.cxx index 4cebfa18a7ea..ca5cba2ae459 100644 --- a/reportdesign/source/filter/xml/xmlControlProperty.cxx +++ b/reportdesign/source/filter/xml/xmlControlProperty.cxx @@ -168,7 +168,7 @@ void OXMLControlProperty::addValue(const OUString& _sValue) { sal_Int32 nPos = m_aSequence.getLength(); m_aSequence.realloc(nPos+1); - m_aSequence[nPos] = aValue; + m_aSequence.getArray()[nPos] = aValue; } } diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx index ec1796a56db1..123e4a1bb888 100644 --- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx @@ -309,7 +309,7 @@ void SAL_CALL ExportDocumentHandler::initialize( const uno::Sequence< uno::Any > { sal_Int32 nCount = m_aColumns.getLength(); m_aColumns.realloc(nCount+1); - m_aColumns[nCount] = rColumnName; + m_aColumns.getArray()[nCount] = rColumnName; } } } diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index e2fe119eea5a..18053c097630 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -213,14 +213,15 @@ static ErrCode ReadThroughComponent( nArgs++; uno::Sequence< uno::Any > aFilterCompArgs( nArgs ); + auto aFilterCompArgsRange = asNonConstRange(aFilterCompArgs); nArgs = 0; if (rxGraphicStorageHandler.is()) - aFilterCompArgs[nArgs++] <<= rxGraphicStorageHandler; + aFilterCompArgsRange[nArgs++] <<= rxGraphicStorageHandler; if( _xEmbeddedObjectResolver.is()) - aFilterCompArgs[ nArgs++ ] <<= _xEmbeddedObjectResolver; + aFilterCompArgsRange[ nArgs++ ] <<= _xEmbeddedObjectResolver; if ( _xProp.is() ) - aFilterCompArgs[ nArgs++ ] <<= _xProp; + aFilterCompArgsRange[ nArgs++ ] <<= _xProp; // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler Reference< XFastParser > xFastParser( @@ -407,14 +408,13 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) uno::Reference xEmbeddedObjectResolver; uno::Reference< uno::XComponentContext > xContext = GetComponentContext(); - uno::Sequence aArgs(1); - aArgs[0] <<= xStorage; + uno::Sequence aArgs{ uno::Any(xStorage) }; xGraphicStorageHandler.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Svx.GraphicImportHelper", aArgs, xContext), uno::UNO_QUERY); uno::Reference< lang::XMultiServiceFactory > xReportServiceFactory( m_xReportDefinition, uno::UNO_QUERY); - aArgs[0] <<= beans::NamedValue("Storage",uno::makeAny(xStorage)); + aArgs.getArray()[0] <<= beans::NamedValue("Storage", uno::makeAny(xStorage)); xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments("com.sun.star.document.ImportEmbeddedObjectResolver",aArgs) , uno::UNO_QUERY); static constexpr OUStringLiteral s_sOld = u"OldFormat"; diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index eb827368b3fe..e9677cf3fa35 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -305,16 +306,11 @@ namespace rptui { Reference< XReportControlFormat > xReportControlFormat( m_xCopy->getByIndex( _nCondIndex ), UNO_QUERY_THROW ); - Sequence< PropertyValue > aArgs(3); - - aArgs[0].Name = REPORTCONTROLFORMAT; - aArgs[0].Value <<= xReportControlFormat; - - aArgs[1].Name = CURRENT_WINDOW; - aArgs[1].Value <<= m_xDialog->GetXWindow(); - - aArgs[2].Name = PROPERTY_FONTCOLOR; - aArgs[2].Value <<= rColor; + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue(REPORTCONTROLFORMAT, xReportControlFormat), + comphelper::makePropertyValue(CURRENT_WINDOW, m_xDialog->GetXWindow()), + comphelper::makePropertyValue(PROPERTY_FONTCOLOR, rColor) + }; // we use this way to create undo actions m_rController.executeUnChecked(_nCommandId,aArgs); diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index fb3c93ef7467..01cc62d1e2a5 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -96,20 +96,21 @@ short ODateTimeDialog::run() { sal_Int32 nLength = 0; uno::Sequence aValues( 6 ); - aValues[nLength].Name = PROPERTY_SECTION; - aValues[nLength++].Value <<= m_xHoldAlive; + auto pValues = aValues.getArray(); + pValues[nLength].Name = PROPERTY_SECTION; + pValues[nLength++].Value <<= m_xHoldAlive; - aValues[nLength].Name = PROPERTY_TIME_STATE; - aValues[nLength++].Value <<= m_xTime->get_active(); + pValues[nLength].Name = PROPERTY_TIME_STATE; + pValues[nLength++].Value <<= m_xTime->get_active(); - aValues[nLength].Name = PROPERTY_DATE_STATE; - aValues[nLength++].Value <<= m_xDate->get_active(); + pValues[nLength].Name = PROPERTY_DATE_STATE; + pValues[nLength++].Value <<= m_xDate->get_active(); - aValues[nLength].Name = PROPERTY_FORMATKEYDATE; - aValues[nLength++].Value <<= getFormatKey(true); + pValues[nLength].Name = PROPERTY_FORMATKEYDATE; + pValues[nLength++].Value <<= getFormatKey(true); - aValues[nLength].Name = PROPERTY_FORMATKEYTIME; - aValues[nLength++].Value <<= getFormatKey(false); + pValues[nLength].Name = PROPERTY_FORMATKEYTIME; + pValues[nLength++].Value <<= getFormatKey(false); OutputDevice* pDefDev = Application::GetDefaultDevice(); sal_Int32 nWidth = 0; @@ -128,8 +129,8 @@ short ODateTimeDialog::run() if ( nWidth > 4000 ) { - aValues[nLength].Name = PROPERTY_WIDTH; - aValues[nLength++].Value <<= nWidth; + pValues[nLength].Name = PROPERTY_WIDTH; + pValues[nLength++].Value <<= nWidth; } m_pController->executeChecked(SID_DATETIME,aValues); diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 0957c3039e39..5bb161d8b5d4 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -318,18 +319,18 @@ void OFieldExpressionControl::moveGroups(const uno::Sequence& _aGroups uno::Reference< report::XGroup> xGroup(rGroup,uno::UNO_QUERY); if ( xGroup.is() ) { - uno::Sequence< beans::PropertyValue > aArgs(1); - aArgs[0].Name = PROPERTY_GROUP; - aArgs[0].Value <<= xGroup; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + PROPERTY_GROUP, xGroup) }; // we use this way to create undo actions m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs); aArgs.realloc(2); + auto pArgs = aArgs.getArray(); if ( nRow > xGroups->getCount() ) nRow = xGroups->getCount(); if ( _bSelect ) SelectRow(nRow); - aArgs[1].Name = PROPERTY_POSITIONY; - aArgs[1].Value <<= nRow; + pArgs[1].Name = PROPERTY_POSITIONY; + pArgs[1].Value <<= nRow; m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs); ++nRow; } @@ -420,9 +421,6 @@ bool OFieldExpressionControl::SaveModified() xGroup = m_pParent->getGroups()->createGroup(); xGroup->setHeaderOn(true); - uno::Sequence< beans::PropertyValue > aArgs(2); - aArgs[0].Name = PROPERTY_GROUP; - aArgs[0].Value <<= xGroup; // find position where to insert the new group sal_Int32 nGroupPos = 0; ::std::vector::iterator aIter = m_aGroupPositions.begin(); @@ -430,8 +428,10 @@ bool OFieldExpressionControl::SaveModified() for(;aIter != aEnd;++aIter) if ( *aIter != NO_GROUP ) nGroupPos = *aIter + 1; - aArgs[1].Name = PROPERTY_POSITIONY; - aArgs[1].Value <<= nGroupPos; + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue(PROPERTY_GROUP, xGroup), + comphelper::makePropertyValue(PROPERTY_POSITIONY, nGroupPos) + }; m_bIgnoreEvent = true; m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs); m_bIgnoreEvent = false; @@ -727,8 +727,6 @@ void OFieldExpressionControl::DeleteRows() bool bFirstTime = true; tools::Long nOldDataPos = nIndex; - uno::Sequence< beans::PropertyValue > aArgs(1); - aArgs[0].Name = PROPERTY_GROUP; m_bIgnoreEvent = true; while( nIndex >= 0 ) { @@ -743,7 +741,8 @@ void OFieldExpressionControl::DeleteRows() sal_Int32 nGroupPos = m_aGroupPositions[nIndex]; uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(nGroupPos); - aArgs[0].Value <<= xGroup; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + PROPERTY_GROUP, xGroup) }; // we use this way to create undo actions m_pParent->m_pController->executeChecked(SID_GROUP_REMOVE,aArgs); @@ -982,8 +981,7 @@ IMPL_LINK(OGroupsSortingDialog, OnFormatAction, const OString&, rCommand, void) uno::Sequence aClipboardList; if ( nIndex >= 0 && nGroupPos != NO_GROUP ) { - aClipboardList.realloc(1); - aClipboardList[0] = m_xGroups->getByIndex(nGroupPos); + aClipboardList = { m_xGroups->getByIndex(nGroupPos) }; } if (rCommand == "up") { @@ -1028,16 +1026,13 @@ IMPL_LINK( OGroupsSortingDialog, LBChangeHdl, weld::ComboBox&, rListBox, void ) else if ( nGroupPos != NO_GROUP ) { uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos); - uno::Sequence< beans::PropertyValue > aArgs(2); - aArgs[1].Name = PROPERTY_GROUP; - aArgs[1].Value <<= xGroup; - - if ( m_xHeaderLst.get() == &rListBox ) - aArgs[0].Name = PROPERTY_HEADERON; - else - aArgs[0].Name = PROPERTY_FOOTERON; - - aArgs[0].Value <<= rListBox.get_active() == 0; + const OUString aHeaderFooterOnName(( m_xHeaderLst.get() == &rListBox ) + ? std::u16string_view(PROPERTY_HEADERON) + : std::u16string_view(PROPERTY_FOOTERON)); + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue(aHeaderFooterOnName, rListBox.get_active() == 0), + comphelper::makePropertyValue(PROPERTY_GROUP, xGroup) + }; m_pController->executeChecked(m_xHeaderLst.get() == &rListBox ? SID_GROUPHEADER : SID_GROUPFOOTER, aArgs); m_xFieldExpression->InvalidateHandleColumn(); } diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index edb4a7eefc15..939a6abc8236 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -307,15 +308,13 @@ IMPL_LINK(NavigatorTree, CommandHdl, const CommandEvent&, rEvt, bool) if ( nId == SID_RPT_NEW_FUNCTION ) { aArgs.realloc(1); - aArgs[0].Value <<= (xFunctions.is() ? xFunctions : xSupplier->getFunctions()); + aArgs.getArray()[0].Value <<= (xFunctions.is() ? xFunctions : xSupplier->getFunctions()); } else if ( nId == SID_DELETE ) { if ( xGroup.is() ) nId = SID_GROUP_REMOVE; - aArgs.realloc(1); - aArgs[0].Name = PROPERTY_GROUP; - aArgs[0].Value <<= pData->getContent(); + aArgs = { comphelper::makePropertyValue(PROPERTY_GROUP, pData->getContent()) }; } m_rController.executeUnChecked(nId,aArgs); } diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 68aa4cabfe37..26a7878cc0ab 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -898,8 +898,9 @@ uno::Any GeometryHandler::getConstantValue(bool _bToControlValue,const Translate for (const TranslateId* pItem = pResId; *pItem; ++pItem) aList.push_back(RptResId(*pItem)); uno::Sequence< OUString > aSeq(aList.size()); + auto aSeqRange = asNonConstRange(aSeq); for (size_t i = 0; i < aList.size(); ++i) - aSeq[i] = aList[i]; + aSeqRange[i] = aList[i]; uno::Reference< inspection::XStringRepresentation > xConversionHelper = inspection::StringRepresentation::createConstant( m_xContext,m_xTypeConverter,_sConstantName,aSeq); if ( _bToControlValue ) diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx index 598669437063..c43d1a3a5ba7 100644 --- a/reportdesign/source/ui/misc/RptUndo.cxx +++ b/reportdesign/source/ui/misc/RptUndo.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -283,12 +284,11 @@ OUString OGroupSectionUndo::GetComment() const void OGroupSectionUndo::implReInsert( ) { - uno::Sequence< beans::PropertyValue > aArgs(2); - - aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? std::u16string_view(u"" PROPERTY_HEADERON) : std::u16string_view(u"" PROPERTY_FOOTERON); - aArgs[0].Value <<= true; - aArgs[1].Name = PROPERTY_GROUP; - aArgs[1].Value <<= m_aGroupHelper.getGroup(); + const OUString aHeaderFooterOnName(SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? std::u16string_view(u"" PROPERTY_HEADERON) : std::u16string_view(u"" PROPERTY_FOOTERON)); + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue(aHeaderFooterOnName, true), + comphelper::makePropertyValue(PROPERTY_GROUP, m_aGroupHelper.getGroup()) + }; m_pController->executeChecked(m_nSlot,aArgs); uno::Reference< report::XSection > xSection = m_pMemberFunction(&m_aGroupHelper); @@ -302,12 +302,11 @@ void OGroupSectionUndo::implReRemove( ) if( m_eAction == Removed ) collectControls(m_pMemberFunction(&m_aGroupHelper)); - uno::Sequence< beans::PropertyValue > aArgs(2); - - aArgs[0].Name = SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? std::u16string_view(u"" PROPERTY_HEADERON) : std::u16string_view(u"" PROPERTY_FOOTERON); - aArgs[0].Value <<= false; - aArgs[1].Name = PROPERTY_GROUP; - aArgs[1].Value <<= m_aGroupHelper.getGroup(); + const OUString aHeaderFooterOnName(SID_GROUPHEADER_WITHOUT_UNDO == m_nSlot? std::u16string_view(u"" PROPERTY_HEADERON) : std::u16string_view(u"" PROPERTY_FOOTERON)); + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue(aHeaderFooterOnName, false), + comphelper::makePropertyValue(PROPERTY_GROUP, m_aGroupHelper.getGroup()) + }; m_pController->executeChecked(m_nSlot,aArgs); m_bInserted = false; diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 25fa8bb255ca..60d3f8745574 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -372,7 +372,7 @@ namespace { sal_Int32 nLen( _out_rProperties.getLength() ); _out_rProperties.realloc( nLen + 1 ); - _out_rProperties[ nLen ] = beans::NamedValue( _sName, _rValue ); + _out_rProperties.getArray()[ nLen ] = beans::NamedValue( _sName, _rValue ); } @@ -958,6 +958,7 @@ uno::Sequence< OUString > getParameterNames( const uno::Reference< sdbc::XRowSet { sal_Int32 count( xParams->getCount() ); aNames.realloc( count ); + auto pNames = aNames.getArray(); uno::Reference< beans::XPropertySet > xParam; OUString sParamName; @@ -965,7 +966,7 @@ uno::Sequence< OUString > getParameterNames( const uno::Reference< sdbc::XRowSet { xParam.set( xParams->getByIndex(i), uno::UNO_QUERY_THROW ); OSL_VERIFY( xParam->getPropertyValue( PROPERTY_NAME ) >>= sParamName ); - aNames[i] = sParamName; + pNames[i] = sParamName; } } } diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index a3027c61287d..c77c6d5a8eaa 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -37,6 +37,8 @@ #include #include +#include + namespace rptui { using namespace ::dbaui; @@ -632,12 +634,10 @@ uno::Any ODesignView::getCurrentlyShownProperty() const if ( !aSelection.empty() ) { uno::Sequence< uno::Reference< report::XReportComponent > > aSeq(aSelection.size()); - sal_Int32 i = 0; - for(const auto& rxInterface : aSelection) - { - aSeq[i].set(rxInterface,uno::UNO_QUERY); - ++i; - } + std::transform( + aSelection.begin(), aSelection.end(), aSeq.getArray(), + [](const auto& rxInterface) + { return uno::Reference(rxInterface, uno::UNO_QUERY); }); aRet <<= aSeq; } } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 886e3390adf6..d765dee29783 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -435,8 +436,9 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const SfxUndoManager& rUndoManager( getUndoManager() ); size_t nCount(( rUndoManager.*retrieveCount )( SfxUndoManager::TopLevel )); Sequence aSeq(nCount); + auto aSeqRange = asNonConstRange(aSeq); for (size_t n = 0; n < nCount; ++n) - aSeq[n] = (rUndoManager.*retrieveComment)( n, SfxUndoManager::TopLevel ); + aSeqRange[n] = (rUndoManager.*retrieveComment)( n, SfxUndoManager::TopLevel ); aReturn.aValue <<= aSeq; aReturn.bEnabled = true; } @@ -1700,7 +1702,7 @@ void OReportController::impl_initialize( ) if ( pPage ) { uno::Sequence< beans::PropertyValue> aArgs(1); - aArgs[0].Value <<= pPage->getSection(); + aArgs.getArray()[0].Value <<= pPage->getSection(); executeUnChecked(SID_SELECT,aArgs); } } @@ -2788,10 +2790,7 @@ void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data) util::URL aCommand; aCommand.Complete = ".uno:" + rCommandName; - Sequence< PropertyValue > aCommandArgs(1); - aCommandArgs[0].Name = "Value"; - aCommandArgs[0].Value = rCommandValue; - + Sequence aCommandArgs{ comphelper::makePropertyValue("Value", rCommandValue) }; executeUnChecked( aCommand, aCommandArgs ); } else @@ -3043,8 +3042,7 @@ sal_Bool SAL_CALL OReportController::select( const Any& aSelection ) if ( xProp.is() ) { getDesignView()->showProperties(xObject); - aElements.realloc(1); - aElements[0] = xProp; + aElements = { xProp }; getDesignView()->setMarked(aElements, true); } else diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index d757fce2de3d..35aff0e6d6b3 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -754,7 +754,7 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt ) svx::ODataAccessDescriptor aDescriptor = svx::OColumnTransferable::extractColumnDescriptor(aDropped); aValues.realloc(1); - aValues[0].Value <<= aDescriptor.createPropertyValueSequence(); + aValues.getArray()[0].Value <<= aDescriptor.createPropertyValueSequence(); } else aValues = svx::OMultiColumnTransferable::extractDescriptor(aDropped); @@ -767,14 +767,15 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt ) if ( nLength ) { aCurrent.realloc(nLength + 3); - aCurrent[nLength].Name = PROPERTY_POSITION; - aCurrent[nLength++].Value <<= AWTPoint(aDropPos); + auto pCurrent = aCurrent.getArray(); + pCurrent[nLength].Name = PROPERTY_POSITION; + pCurrent[nLength++].Value <<= AWTPoint(aDropPos); // give also the DND Action (Shift|Ctrl) Key to really say what we want - aCurrent[nLength].Name = "DNDAction"; - aCurrent[nLength++].Value <<= _rEvt.mnAction; + pCurrent[nLength].Name = "DNDAction"; + pCurrent[nLength++].Value <<= _rEvt.mnAction; - aCurrent[nLength].Name = "Section"; - aCurrent[nLength++].Value <<= getSection(); + pCurrent[nLength].Name = "Section"; + pCurrent[nLength++].Value <<= getSection(); propVal.Value <<= aCurrent; } } -- cgit