diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:11:20 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-31 15:49:34 +0100 |
commit | d4b63c4562ec4c612df675502fd35c7c88bc432d (patch) | |
tree | 3c183240ad085c33ae46f6686a4ab50adbf2c39a /svtools | |
parent | 1a5ddf061ef53fb9feda0ee319fa36cadef020da (diff) |
Prepare for removal of non-const operator[] from Sequence in svtools
Change-Id: I614a97e5e2328c787ce19612a88839e234d54382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124396
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/brwbox/brwbox3.cxx | 8 | ||||
-rw-r--r-- | svtools/source/config/miscopt.cxx | 5 | ||||
-rw-r--r-- | svtools/source/config/slidesorterbaropt.cxx | 13 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 10 | ||||
-rw-r--r-- | svtools/source/dialogs/addresstemplate.cxx | 19 | ||||
-rw-r--r-- | svtools/source/dialogs/colrdlg.cxx | 19 | ||||
-rw-r--r-- | svtools/source/filter/DocumentToGraphicRenderer.cxx | 53 | ||||
-rw-r--r-- | svtools/source/filter/SvFilterOptionsDialog.cxx | 2 | ||||
-rw-r--r-- | svtools/source/filter/exportdialog.cxx | 18 | ||||
-rw-r--r-- | svtools/source/misc/bindablecontrolhelper.cxx | 8 | ||||
-rw-r--r-- | svtools/source/misc/imageresourceaccess.cxx | 14 | ||||
-rw-r--r-- | svtools/source/misc/templatefoldercache.cxx | 7 | ||||
-rw-r--r-- | svtools/source/uno/svtxgridcontrol.cxx | 14 | ||||
-rw-r--r-- | svtools/source/uno/toolboxcontroller.cxx | 5 | ||||
-rw-r--r-- | svtools/source/uno/unoevent.cxx | 69 | ||||
-rw-r--r-- | svtools/source/uno/wizard/unowizard.cxx | 3 |
16 files changed, 104 insertions, 163 deletions
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 5b113724561e..32401d312829 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -482,9 +482,10 @@ void BrowseBox::GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) co if( nCount ) { _rRows.realloc( nCount ); - _rRows[ 0 ] = const_cast< BrowseBox* >( this )->FirstSelectedRow(); + auto pRows = _rRows.getArray(); + pRows[ 0 ] = const_cast< BrowseBox* >( this )->FirstSelectedRow(); for( sal_Int32 nIndex = 1; nIndex < nCount; ++nIndex ) - _rRows[ nIndex ] = const_cast< BrowseBox* >( this )->NextSelectedRow(); + pRows[ nIndex ] = const_cast< BrowseBox* >( this )->NextSelectedRow(); DBG_ASSERT( const_cast< BrowseBox* >( this )->NextSelectedRow() == BROWSER_ENDOFSELECTION, "BrowseBox::GetAllSelectedRows - too many selected rows found" ); } @@ -498,6 +499,7 @@ void BrowseBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumn return; _rColumns.realloc( nCount ); + auto pColumns = _rColumns.getArray(); sal_Int32 nIndex = 0; const size_t nRangeCount = pColumnSel->GetRangeCount(); @@ -509,7 +511,7 @@ void BrowseBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumn { DBG_ASSERT( nIndex < nCount, "GetAllSelectedColumns - range overflow" ); - _rColumns[ nIndex ] = nCol; + pColumns[ nIndex ] = nCol; ++nIndex; } } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 7e05cc030e73..1da6ba473eba 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -310,6 +310,7 @@ void SvtMiscOptions_Impl::ImplCommit() Sequence< OUString > seqNames = GetPropertyNames (); sal_Int32 nCount = seqNames.getLength(); Sequence< Any > seqValues ( nCount ); + auto seqValuesRange = asNonConstRange(seqValues); for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) { switch( nProperty ) @@ -317,7 +318,7 @@ void SvtMiscOptions_Impl::ImplCommit() case PROPERTYHANDLE_SYMBOLSET : { if ( !m_bIsSymbolsSizeRO ) - seqValues[nProperty] <<= m_nSymbolsSize; + seqValuesRange[nProperty] <<= m_nSymbolsSize; break; } @@ -331,7 +332,7 @@ void SvtMiscOptions_Impl::ImplCommit() else { value = GetIconTheme(); } - seqValues[nProperty] <<= value; + seqValuesRange[nProperty] <<= value; } break; } diff --git a/svtools/source/config/slidesorterbaropt.cxx b/svtools/source/config/slidesorterbaropt.cxx index 2e4a4a3da587..1ff23bcaed34 100644 --- a/svtools/source/config/slidesorterbaropt.cxx +++ b/svtools/source/config/slidesorterbaropt.cxx @@ -264,38 +264,39 @@ void SvtSlideSorterBarOptions_Impl::ImplCommit() // Get names of supported properties, create a list for values and copy current values to it. sal_Int32 nCount = m_seqPropertyNames.getLength(); Sequence< Any > seqValues ( nCount ); + auto seqValuesRange = asNonConstRange(seqValues); for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) { switch( nProperty ) { case PROPERTYHANDLE_VISIBLE_IMPRESSVIEW: { - seqValues[nProperty] <<= m_bVisibleImpressView; + seqValuesRange[nProperty] <<= m_bVisibleImpressView; break; } case PROPERTYHANDLE_VISIBLE_OUTLINEVIEW: { - seqValues[nProperty] <<= m_bVisibleOutlineView; + seqValuesRange[nProperty] <<= m_bVisibleOutlineView; break; } case PROPERTYHANDLE_VISIBLE_NOTESVIEW: { - seqValues[nProperty] <<= m_bVisibleNotesView; + seqValuesRange[nProperty] <<= m_bVisibleNotesView; break; } case PROPERTYHANDLE_VISIBLE_HANDOUTVIEW: { - seqValues[nProperty] <<= m_bVisibleHandoutView; + seqValuesRange[nProperty] <<= m_bVisibleHandoutView; break; } case PROPERTYHANDLE_VISIBLE_SLIDESORTERVIEW: { - seqValues[nProperty] <<= m_bVisibleSlideSorterView; + seqValuesRange[nProperty] <<= m_bVisibleSlideSorterView; break; } case PROPERTYHANDLE_VISIBLE_DRAWVIEW: { - seqValues[nProperty] <<= m_bVisibleDrawView; + seqValuesRange[nProperty] <<= m_bVisibleDrawView; break; } diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 9d78a805c18d..147ce77a4b14 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -463,10 +463,12 @@ void SvtMatchContext_Impl::doExecute() css::ucb::XUniversalContentBroker > ucb( css::ucb::UniversalContentBroker::create( ctx)); - css::uno::Sequence< css::beans::Property > prop(1); - prop[0].Name = "IsFolder"; - prop[0].Handle = -1; - prop[0].Type = cppu::UnoType< bool >::get(); + css::uno::Sequence< css::beans::Property > prop{ + { /* Name */ "IsFolder", + /* Handle */ -1, + /* Type */ cppu::UnoType< bool >::get(), + /* Attributes */ {} } + }; css::uno::Any res; css::uno::Reference< css::ucb::XCommandProcessor > proc( diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index b7d787b53aae..6f29151e308f 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -24,6 +24,7 @@ #include <svtools/svtresid.hxx> #include <tools/debug.hxx> #include <comphelper/interaction.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> #include <unotools/configitem.hxx> #include <vcl/stdtext.hxx> @@ -338,8 +339,7 @@ void AssignmentPersistentData::ImplCommit() void AssignmentPersistentData::setStringProperty(const char* _pLocalName, const OUString& _rValue) { Sequence< OUString > aNames { OUString::createFromAscii(_pLocalName) }; - Sequence< Any > aValues(1); - aValues[0] <<= _rValue; + Sequence< Any > aValues{ Any(_rValue) }; PutProperties(aNames, aValues); } @@ -362,13 +362,14 @@ void AssignmentPersistentData::ImplCommit() // Fields/<field> OUString sFieldElementNodePath = sDescriptionNodePath + "/" + _rLogicalName; - Sequence< PropertyValue > aNewFieldDescription(2); - // Fields/<field>/ProgrammaticFieldName - aNewFieldDescription[0].Name = sFieldElementNodePath + "/ProgrammaticFieldName"; - aNewFieldDescription[0].Value <<= _rLogicalName; - // Fields/<field>/AssignedFieldName - aNewFieldDescription[1].Name = sFieldElementNodePath + "/AssignedFieldName"; - aNewFieldDescription[1].Value <<= _rAssignment; + Sequence< PropertyValue > aNewFieldDescription{ + // Fields/<field>/ProgrammaticFieldName + comphelper::makePropertyValue(sFieldElementNodePath + "/ProgrammaticFieldName", + _rLogicalName), + // Fields/<field>/AssignedFieldName + comphelper::makePropertyValue(sFieldElementNodePath + "/AssignedFieldName", + _rAssignment) + }; // just set the new value bool bSuccess = diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index e1966ae382bd..27008ccfcd28 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/cui/ColorPicker.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <svtools/colrdlg.hxx> #include <svtools/dialogclosedlistener.hxx> @@ -71,11 +72,10 @@ short SvColorDialog::Execute(weld::Window* pParent) Reference< XExecutableDialog > xDialog = css::cui::ColorPicker::createWithParent(xContext, xParent); Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW ); - Sequence< PropertyValue > props( 2 ); - props[0].Name = OUString( sColor ); - props[0].Value <<= maColor; - props[1].Name = "Mode"; - props[1].Value <<= static_cast<sal_Int16>(meMode); + Sequence< PropertyValue > props{ + comphelper::makePropertyValue(OUString( sColor ), maColor), + comphelper::makePropertyValue("Mode", static_cast<sal_Int16>(meMode)) + }; xPropertyAccess->setPropertyValues( props ); @@ -116,11 +116,10 @@ void SvColorDialog::ExecuteAsync(weld::Window* pParent, const std::function<void mxDialog = css::cui::AsynchronousColorPicker::createWithParent(xContext, xParent); Reference< XPropertyAccess > xPropertyAccess( mxDialog, UNO_QUERY_THROW ); - Sequence< PropertyValue > props( 2 ); - props[0].Name = OUString( sColor ); - props[0].Value <<= maColor; - props[1].Name = "Mode"; - props[1].Value <<= static_cast<sal_Int16>(meMode); + Sequence< PropertyValue > props{ + comphelper::makePropertyValue(OUString( sColor ), maColor), + comphelper::makePropertyValue("Mode", static_cast<sal_Int16>(meMode)) + }; xPropertyAccess->setPropertyValues( props ); diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 29ec30b94808..af64b7b8496a 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -19,6 +19,7 @@ #include <svtools/DocumentToGraphicRenderer.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/gdimtf.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/svapp.hxx> @@ -131,17 +132,10 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage, uno::Any selection( getSelection()); - PropertyValues renderProperties; - - renderProperties.realloc( 4 ); - renderProperties[0].Name = "IsPrinter"; - renderProperties[0].Value <<= true; - renderProperties[1].Name = "RenderDevice"; - renderProperties[1].Value <<= xDevice; - renderProperties[2].Name = "View"; - renderProperties[2].Value <<= mxController; - renderProperties[3].Name = "RenderToGraphic"; - renderProperties[3].Value <<= true; + PropertyValues renderProperties{ comphelper::makePropertyValue("IsPrinter", true), + comphelper::makePropertyValue("RenderDevice", xDevice), + comphelper::makePropertyValue("View", mxController), + comphelper::makePropertyValue("RenderToGraphic", true) }; awt::Size aSize; awt::Size aCalcPageSize; @@ -209,20 +203,14 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( double fScaleX = aTargetSizePixel.Width() / static_cast<double>(aDocumentSizePixel.Width()); double fScaleY = aTargetSizePixel.Height() / static_cast<double>(aDocumentSizePixel.Height()); - PropertyValues renderProps; - renderProps.realloc( 6 ); - renderProps[0].Name = "IsPrinter"; - renderProps[0].Value <<= true; - renderProps[1].Name = "RenderDevice"; - renderProps[1].Value <<= xDevice; - renderProps[2].Name = "View"; - renderProps[2].Value <<= mxController; - renderProps[3].Name = "RenderToGraphic"; - renderProps[3].Value <<= true; - renderProps[4].Name = "HasPDFExtOutDevData"; - renderProps[4].Value <<= bExtOutDevData; - renderProps[5].Name = "PageRange"; - renderProps[5].Value <<= OUString::number(nCurrentPage); + PropertyValues renderProps{ + comphelper::makePropertyValue("IsPrinter", true), + comphelper::makePropertyValue("RenderDevice", xDevice), + comphelper::makePropertyValue("View", mxController), + comphelper::makePropertyValue("RenderToGraphic", true), + comphelper::makePropertyValue("HasPDFExtOutDevData", bExtOutDevData), + comphelper::makePropertyValue("PageRange", OUString::number(nCurrentPage)) + }; GDIMetaFile aMtf; @@ -285,17 +273,10 @@ sal_Int32 DocumentToGraphicRenderer::getPageCount() uno::Any selection( getSelection() ); - PropertyValues renderProperties; - - renderProperties.realloc( 4 ); - renderProperties[0].Name = "IsPrinter"; - renderProperties[0].Value <<= true; - renderProperties[1].Name = "RenderDevice"; - renderProperties[1].Value <<= xDevice; - renderProperties[2].Name = "View"; - renderProperties[2].Value <<= mxController; - renderProperties[3].Name = "RenderToGraphic"; - renderProperties[3].Value <<= true; + PropertyValues renderProperties{ comphelper::makePropertyValue("IsPrinter", true), + comphelper::makePropertyValue("RenderDevice", xDevice), + comphelper::makePropertyValue("View", mxController), + comphelper::makePropertyValue("RenderToGraphic", true) }; sal_Int32 nPages = mxRenderable->getRendererCount( selection, renderProperties ); diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 698e49e0725a..5d0926ace1ab 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -156,7 +156,7 @@ uno::Sequence< beans::PropertyValue > SvFilterOptionsDialog::getPropertyValues() maMediaDescriptor.realloc( ++nCount ); // the "FilterData" Property is an Any that will contain our PropertySequence of Values - auto& item = maMediaDescriptor[ i ]; + auto& item = maMediaDescriptor.getArray()[ i ]; item.Name = "FilterData"; item.Value <<= maFilterDataSequence; return maMediaDescriptor; diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 5accd1482cd1..76d90f7b8e06 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -21,6 +21,7 @@ #include <algorithm> +#include <comphelper/propertyvalue.hxx> #include <o3tl/safeint.hxx> #include <tools/stream.hxx> #include <tools/fract.hxx> @@ -333,9 +334,8 @@ awt::Size ExportDialog::GetOriginalSize() aTransformation.m11 = aViewTransformation.get(1,1); aTransformation.m12 = aViewTransformation.get(1,2); - uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); - aViewInformation[ 0 ].Value <<= aTransformation; - aViewInformation[ 0 ].Name = "ViewTransformation"; + uno::Sequence< beans::PropertyValue > aViewInformation{ comphelper::makePropertyValue( + "ViewTransformation", aTransformation) }; if ( mxShape.is() ) aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); @@ -480,13 +480,11 @@ void ExportDialog::GetGraphicStream() uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() ); OUString sFormat( maExt ); - uno::Sequence< beans::PropertyValue > aDescriptor( 3 ); - aDescriptor[0].Name = "OutputStream"; - aDescriptor[0].Value <<= xOutputStream; - aDescriptor[1].Name = "FilterName"; - aDescriptor[1].Value <<= sFormat; - aDescriptor[2].Name = "FilterData"; - aDescriptor[2].Value <<= aNewFilterData; + uno::Sequence< beans::PropertyValue > aDescriptor{ + comphelper::makePropertyValue("OutputStream", xOutputStream), + comphelper::makePropertyValue("FilterName", sFormat), + comphelper::makePropertyValue("FilterData", aNewFilterData) + }; uno::Reference< drawing::XGraphicExportFilter > xGraphicExporter = drawing::GraphicExportFilter::create( mxContext ); diff --git a/svtools/source/misc/bindablecontrolhelper.cxx b/svtools/source/misc/bindablecontrolhelper.cxx index 0fe8d85034f4..95cdcca2a431 100644 --- a/svtools/source/misc/bindablecontrolhelper.cxx +++ b/svtools/source/misc/bindablecontrolhelper.cxx @@ -96,9 +96,7 @@ BindableControlHelper::ApplyListSourceAndBindableData( const css::uno::Reference aArg1.Name = "BoundCell"; aArg1.Value <<= aAddress; - uno::Sequence< uno::Any > aArgs(1); - aArgs[ 0 ] <<= aArg1; - + uno::Sequence< uno::Any > aArgs{ uno::Any(aArg1) }; uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( "com.sun.star.table.CellValueBinding", aArgs ), uno::UNO_QUERY ); xBindable->setValueBinding( xBinding ); } @@ -130,9 +128,7 @@ BindableControlHelper::ApplyListSourceAndBindableData( const css::uno::Reference aArg1.Name = "CellRange"; aArg1.Value <<= aAddress; - uno::Sequence< uno::Any > aArgs(1); - aArgs[ 0 ] <<= aArg1; - + uno::Sequence< uno::Any > aArgs{ uno::Any(aArg1) }; uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( "com.sun.star.table.CellRangeListSource", aArgs ), uno::UNO_QUERY ); xListEntrySink->setListEntrySource( xSource ); } diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index fc12981a3460..66c458c911e6 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -25,6 +25,8 @@ #include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/io/XStream.hpp> + +#include <comphelper/propertyvalue.hxx> #include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <tools/stream.hxx> @@ -125,9 +127,8 @@ std::unique_ptr<SvStream> getImageStream(uno::Reference<uno::XComponentContext> uno::Reference<graphic::XGraphicProvider> xProvider = css::graphic::GraphicProvider::create(rxContext); // let it create a graphic from the given URL - uno::Sequence<beans::PropertyValue> aMediaProperties(1); - aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= rImageResourceURL; + uno::Sequence<beans::PropertyValue> aMediaProperties{ comphelper::makePropertyValue( + "URL", rImageResourceURL) }; uno::Reference<graphic::XGraphic> xGraphic(xProvider->queryGraphic(aMediaProperties)); OSL_ENSURE(xGraphic.is(), "GraphicAccess::getImageStream: the provider did not give us a graphic object!"); @@ -140,11 +141,8 @@ std::unique_ptr<SvStream> getImageStream(uno::Reference<uno::XComponentContext> new OSeekableInputStreamWrapper(*pMemBuffer), new OSeekableOutputStreamWrapper(*pMemBuffer)); - aMediaProperties.realloc(2); - aMediaProperties[0].Name = "OutputStream"; - aMediaProperties[0].Value <<= xBufferAccess; - aMediaProperties[1].Name = "MimeType"; - aMediaProperties[1].Value <<= OUString("image/png"); + aMediaProperties = { comphelper::makePropertyValue("OutputStream", xBufferAccess), + comphelper::makePropertyValue("MimeType", OUString("image/png")) }; xProvider->storeGraphic(xGraphic, aMediaProperties); pMemBuffer->Seek(0); diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index cf9d5e5aace6..d92d22d62686 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -535,11 +535,8 @@ namespace svt { // create a content for the current folder root Reference< XResultSet > xResultSet; - Sequence< OUString > aContentProperties( 4); - aContentProperties[0] = "Title"; - aContentProperties[1] = "DateModified"; - aContentProperties[2] = "DateCreated"; - aContentProperties[3] = "IsFolder"; + Sequence< OUString > aContentProperties{ "Title", "DateModified", "DateCreated", + "IsFolder" }; // get the set of sub contents in the folder try diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 91fd08ac18b3..e394c803e42e 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -36,6 +36,8 @@ #include <vcl/svapp.hxx> +#include <algorithm> + using css::uno::Reference; using css::uno::Exception; using css::uno::UNO_QUERY; @@ -540,10 +542,8 @@ Any SVTXGridControl::getProperty( const OUString& PropertyName ) else { Sequence< css::util::Color > aAPIColors( aColors->size() ); - for ( size_t i=0; i<aColors->size(); ++i ) - { - aAPIColors[i] = sal_Int32(aColors->at(i)); - } + std::transform(aColors->begin(), aColors->end(), aAPIColors.getArray(), + [](const auto& color) { return sal_Int32(color); }); aPropertyValue <<= aAPIColors; } } @@ -728,8 +728,9 @@ Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() sal_Int32 selectionCount = pTable->GetSelectedRowCount(); Sequence< sal_Int32 > selectedRows( selectionCount ); + auto selectedRowsRange = asNonConstRange(selectedRows); for ( sal_Int32 i=0; i<selectionCount; ++i ) - selectedRows[i] = pTable->GetSelectedRowIndex(i); + selectedRowsRange[i] = pTable->GetSelectedRowIndex(i); return selectedRows; } @@ -871,8 +872,9 @@ void SVTXGridControl::ImplCallItemListeners() sal_Int32 const nSelectedRowCount( pTable->GetSelectedRowCount() ); aEvent.SelectedRowIndexes.realloc( nSelectedRowCount ); + auto pSelectedRowIndexes = aEvent.SelectedRowIndexes.getArray(); for ( sal_Int32 i=0; i<nSelectedRowCount; ++i ) - aEvent.SelectedRowIndexes[i] = pTable->GetSelectedRowIndex( i ); + pSelectedRowIndexes[i] = pTable->GetSelectedRowIndex( i ); m_aSelectionListeners.selectionChanged( aEvent ); } } diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index c18e4c9abae7..a105bfb3b757 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -31,6 +31,7 @@ #include <vcl/toolbox.hxx> #include <vcl/weldutils.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE = 1; constexpr OUStringLiteral TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE = u"SupportsVisible"; @@ -346,11 +347,9 @@ void SAL_CALL ToolboxController::execute( sal_Int16 KeyModifier ) try { css::util::URL aTargetURL; - Sequence<PropertyValue> aArgs( 1 ); // Provide key modifier information to dispatch function - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier) }; aTargetURL.Complete = aCommandURL; if ( m_xUrlTransformer.is() ) diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 873ef4132300..3a0a9cad75ea 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -18,6 +18,8 @@ */ #include <com/sun/star/beans/PropertyValue.hpp> + +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> #include <sfx2/event.hxx> @@ -54,31 +56,13 @@ void getAnyFromMacro(Any& rAny, const SvxMacro& rMacro) case STARBASIC: { // create sequence - Sequence<PropertyValue> aSequence(3); - Any aTmp; - - // create type - PropertyValue aTypeValue; - aTypeValue.Name = sEventType; - aTmp <<= OUString(sStarBasic); - aTypeValue.Value = aTmp; - aSequence[0] = aTypeValue; - - // macro name - PropertyValue aNameValue; - aNameValue.Name = sMacroName; - const OUString& sNameTmp(rMacro.GetMacName()); - aTmp <<= sNameTmp; - aNameValue.Value = aTmp; - aSequence[1] = aNameValue; - - // library name - PropertyValue aLibValue; - aLibValue.Name = sLibrary; - const OUString& sLibTmp(rMacro.GetLibName()); - aTmp <<= sLibTmp; - aLibValue.Value = aTmp; - aSequence[2] = aLibValue; + Sequence<PropertyValue> aSequence( + // create type + { comphelper::makePropertyValue(sEventType, OUString(sStarBasic)), + // macro name + comphelper::makePropertyValue(sMacroName, rMacro.GetMacName()), + // library name + comphelper::makePropertyValue(sLibrary, rMacro.GetLibName()) }); rAny <<= aSequence; bRetValueOK = true; @@ -87,23 +71,11 @@ void getAnyFromMacro(Any& rAny, const SvxMacro& rMacro) case EXTENDED_STYPE: { // create sequence - Sequence<PropertyValue> aSequence(2); - Any aTmp; - - // create type - PropertyValue aTypeValue; - aTypeValue.Name = sEventType; - aTmp <<= OUString(sScript); - aTypeValue.Value = aTmp; - aSequence[0] = aTypeValue; - - // macro name - PropertyValue aNameValue; - aNameValue.Name = sScript; - const OUString& sNameTmp(rMacro.GetMacName()); - aTmp <<= sNameTmp; - aNameValue.Value = aTmp; - aSequence[1] = aNameValue; + Sequence<PropertyValue> aSequence( + // create type + { comphelper::makePropertyValue(sEventType, OUString(sScript)), + // macro name + comphelper::makePropertyValue(sScript, rMacro.GetMacName()) }); rAny <<= aSequence; bRetValueOK = true; @@ -121,15 +93,7 @@ void getAnyFromMacro(Any& rAny, const SvxMacro& rMacro) return; // create "None" macro - Sequence<PropertyValue> aSequence(1); - - PropertyValue aKindValue; - aKindValue.Name = sEventType; - Any aTmp; - aTmp <<= OUString(sNone); - aKindValue.Value = aTmp; - aSequence[0] = aKindValue; - + Sequence<PropertyValue> aSequence{ comphelper::makePropertyValue(sEventType, OUString(sNone)) }; rAny <<= aSequence; } @@ -284,9 +248,10 @@ Sequence<OUString> SvBaseEventDescriptor::getElementNames() { // create and fill sequence Sequence<OUString> aSequence(mnMacroItems); + auto aSequenceRange = asNonConstRange(aSequence); for( sal_Int16 i = 0; i < mnMacroItems; i++) { - aSequence[i] = OUString::createFromAscii( mpSupportedMacroItems[i].mpEventName ); + aSequenceRange[i] = OUString::createFromAscii( mpSupportedMacroItems[i].mpEventName ); } return aSequence; diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index ea028304737a..9c503d37e114 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -226,8 +226,7 @@ namespace { if ( !aMultiplePaths.hasElements() ) { - aMultiplePaths.realloc(1); - aMultiplePaths[0] = aSinglePath; + aMultiplePaths = { aSinglePath }; } lcl_checkPaths( aMultiplePaths, *this ); // if we survived this, the paths are valid, and we're done here ... |