sdext/source/minimizer/configurationaccess.cxx | 49 +++------ sdext/source/minimizer/impoptimizer.cxx | 62 ++++------- sdext/source/minimizer/optimizationstats.cxx | 13 +- sdext/source/minimizer/optimizerdialog.cxx | 15 +- sdext/source/minimizer/optimizerdialogcontrols.cxx | 20 ++- sdext/source/pdfimport/filterdet.cxx | 27 +++-- sdext/source/pdfimport/misc/pwdinteract.cxx | 4 sdext/source/pdfimport/odf/odfemitter.cxx | 3 sdext/source/pdfimport/pdfiadaptor.cxx | 8 - sdext/source/pdfimport/wrapper/wrapper.cxx | 15 +- sdext/source/presenter/PresenterAccessibility.cxx | 3 sdext/source/presenter/PresenterCanvasHelper.cxx | 9 - sdext/source/presenter/PresenterGeometryHelper.cxx | 3 sdext/source/presenter/PresenterPaneFactory.cxx | 15 +- sdext/source/presenter/PresenterSlideShowView.cxx | 4 sdext/source/presenter/PresenterWindowManager.cxx | 9 - sfx2/source/appl/appopen.cxx | 5 sfx2/source/appl/appserv.cxx | 6 - sfx2/source/appl/newhelp.cxx | 7 - sfx2/source/appl/shutdownicon.cxx | 33 +++--- sfx2/source/appl/shutdowniconaqua.mm | 18 +-- sfx2/source/control/charwin.cxx | 10 - sfx2/source/control/dispatch.cxx | 9 - sfx2/source/control/recentdocsview.cxx | 4 sfx2/source/control/recentdocsviewitem.cxx | 12 -- sfx2/source/control/request.cxx | 2 sfx2/source/control/thumbnailview.cxx | 4 sfx2/source/control/unoctitm.cxx | 28 ++--- sfx2/source/dialog/backingwindow.cxx | 28 ++--- sfx2/source/dialog/dinfdlg.cxx | 50 +++++---- sfx2/source/dialog/filedlghelper.cxx | 23 ++-- sfx2/source/dialog/filtergrouping.cxx | 10 + sfx2/source/dialog/mailmodel.cxx | 53 +++++---- sfx2/source/dialog/templdlg.cxx | 6 - sfx2/source/doc/SfxDocumentMetaData.cxx | 44 +++----- sfx2/source/doc/docfac.cxx | 18 +-- sfx2/source/doc/docfile.cxx | 81 ++++++++------- sfx2/source/doc/doctempl.cxx | 5 sfx2/source/doc/doctemplates.cxx | 30 +---- sfx2/source/doc/exoticfileloadexception.cxx | 5 sfx2/source/doc/exoticfileloadexception.hxx | 2 sfx2/source/doc/graphhelp.cxx | 15 +- sfx2/source/doc/guisaveas.cxx | 7 - sfx2/source/doc/iframe.cxx | 10 - sfx2/source/doc/objmisc.cxx | 9 - sfx2/source/doc/objstor.cxx | 68 +++++++----- sfx2/source/doc/printhelper.cxx | 51 +++++---- sfx2/source/doc/sfxbasemodel.cxx | 112 +++++++++++---------- sfx2/source/doc/templatedlg.cxx | 36 ++---- sfx2/source/doc/zoomitem.cxx | 17 +-- sfx2/source/inet/inettbc.cxx | 11 +- sfx2/source/notify/globalevents.cxx | 3 sfx2/source/sidebar/ResourceManager.cxx | 3 sfx2/source/sidebar/UnoDecks.cxx | 12 -- sfx2/source/sidebar/UnoPanels.cxx | 12 -- sfx2/source/view/ipclient.cxx | 7 - sfx2/source/view/lokcharthelper.cxx | 10 + sfx2/source/view/viewprn.cxx | 27 ++--- sfx2/source/view/viewsh.cxx | 7 - 59 files changed, 574 insertions(+), 595 deletions(-)
New commits: commit 8b9e502480812f61a1c8d37c465aaf93763fe156 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 29 10:02:46 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Oct 31 06:56:57 2021 +0100 Prepare for removal of non-const operator[] from Sequence in sdext Change-Id: I1992d1ffbbc80efe9749ebd254971a0a92a10019 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124386 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx index 0ed089e341a2..3479918c2dc9 100644 --- a/sdext/source/minimizer/configurationaccess.cxx +++ b/sdext/source/minimizer/configurationaccess.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <sal/macros.h> #include <sal/log.hxx> #include <tools/diagnose_ex.h> @@ -427,38 +428,24 @@ sal_Int32 ConfigurationAccess::GetConfigProperty( const PPPOptimizerTokenEnum eP Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence() { - Sequence< PropertyValue > aRet( 15 ); OptimizerSettings& rSettings( maSettings.front() ); - aRet[ 0 ].Name = "JPEGCompression"; - aRet[ 0 ].Value <<= rSettings.mbJPEGCompression; - aRet[ 1 ].Name = "JPEGQuality"; - aRet[ 1 ].Value <<= rSettings.mnJPEGQuality; - aRet[ 2 ].Name = "RemoveCropArea"; - aRet[ 2 ].Value <<= rSettings.mbRemoveCropArea; - aRet[ 3 ].Name = "ImageResolution"; - aRet[ 3 ].Value <<= rSettings.mnImageResolution; - aRet[ 4 ].Name = "EmbedLinkedGraphics"; - aRet[ 4 ].Value <<= rSettings.mbEmbedLinkedGraphics; - aRet[ 5 ].Name = "OLEOptimization"; - aRet[ 5 ].Value <<= rSettings.mbOLEOptimization; - aRet[ 6 ].Name = "OLEOptimizationType"; - aRet[ 6 ].Value <<= rSettings.mnOLEOptimizationType; - aRet[ 7 ].Name = "DeleteUnusedMasterPages"; - aRet[ 7 ].Value <<= rSettings.mbDeleteUnusedMasterPages; - aRet[ 8 ].Name = "DeleteHiddenSlides"; - aRet[ 8 ].Value <<= rSettings.mbDeleteHiddenSlides; - aRet[ 9 ].Name = "DeleteNotesPages"; - aRet[ 9 ].Value <<= rSettings.mbDeleteNotesPages; - aRet[ 10].Name = "CustomShowName"; - aRet[ 10].Value <<= rSettings.maCustomShowName; - aRet[ 11].Name = "SaveAsURL"; - aRet[ 11].Value <<= rSettings.maSaveAsURL; - aRet[ 12].Name = "FilterName"; - aRet[ 12].Value <<= rSettings.maFilterName; - aRet[ 13].Name = "OpenNewDocument"; - aRet[ 13].Value <<= rSettings.mbOpenNewDocument; - aRet[ 14].Name = "EstimatedFileSize"; - aRet[ 14].Value <<= rSettings.mnEstimatedFileSize; + Sequence< PropertyValue > aRet{ + comphelper::makePropertyValue("JPEGCompression", rSettings.mbJPEGCompression), + comphelper::makePropertyValue("JPEGQuality", rSettings.mnJPEGQuality), + comphelper::makePropertyValue("RemoveCropArea", rSettings.mbRemoveCropArea), + comphelper::makePropertyValue("ImageResolution", rSettings.mnImageResolution), + comphelper::makePropertyValue("EmbedLinkedGraphics", rSettings.mbEmbedLinkedGraphics), + comphelper::makePropertyValue("OLEOptimization", rSettings.mbOLEOptimization), + comphelper::makePropertyValue("OLEOptimizationType", rSettings.mnOLEOptimizationType), + comphelper::makePropertyValue("DeleteUnusedMasterPages", rSettings.mbDeleteUnusedMasterPages), + comphelper::makePropertyValue("DeleteHiddenSlides", rSettings.mbDeleteHiddenSlides), + comphelper::makePropertyValue("DeleteNotesPages", rSettings.mbDeleteNotesPages), + comphelper::makePropertyValue("CustomShowName", rSettings.maCustomShowName), + comphelper::makePropertyValue("SaveAsURL", rSettings.maSaveAsURL), + comphelper::makePropertyValue("FilterName", rSettings.maFilterName), + comphelper::makePropertyValue("OpenNewDocument", rSettings.mbOpenNewDocument), + comphelper::makePropertyValue("EstimatedFileSize", rSettings.mnEstimatedFileSize) + }; return aRet; } diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 6f9e2416ac94..cf8b875ebe21 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -50,6 +50,8 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/util/URLTransformer.hpp> +#include <comphelper/propertyvalue.hxx> + using namespace ::std; using namespace ::com::sun::star; using namespace ::com::sun::star::io; @@ -202,31 +204,22 @@ static void ImpCompressGraphic( Reference< XGraphicProvider > const & rxGraphicP { if ( rxGraphicProvider.is() && rxOutputStream.is() ) { - Sequence< PropertyValue > aFilterData( 8 ); - aFilterData[ 0 ].Name = "ImageResolution"; - aFilterData[ 0 ].Value <<= nImageResolution; - aFilterData[ 1 ].Name = "ColorMode"; // todo: jpeg color mode (0->true color, 1->greyscale) - aFilterData[ 1 ].Value <<= sal_Int32(0); - aFilterData[ 2 ].Name = "Quality"; // quality that is used if we export to jpeg - aFilterData[ 2 ].Value <<= nJPEGQuality; - aFilterData[ 3 ].Name = "Compression"; // compression that is used if we export to png - aFilterData[ 3 ].Value <<= sal_Int32(6); - aFilterData[ 4 ].Name = "Interlaced"; // interlaced is turned off if we export to png - aFilterData[ 4 ].Value <<= sal_Int32(0); - aFilterData[ 5 ].Name = "LogicalSize"; - aFilterData[ 5 ].Value <<= rLogicalSize; - aFilterData[ 6 ].Name = "RemoveCropArea"; - aFilterData[ 6 ].Value <<= bRemoveCropping; - aFilterData[ 7 ].Name = "GraphicCropLogic"; - aFilterData[ 7 ].Value <<= rGraphicCropLogic; - - Sequence< PropertyValue > aArgs( 3 ); - aArgs[ 0 ].Name = "MimeType"; // the GraphicProvider is using "MimeType", the GraphicExporter "MediaType"... - aArgs[ 0 ].Value <<= rDestMimeType; - aArgs[ 1 ].Name = "OutputStream"; - aArgs[ 1 ].Value <<= rxOutputStream; - aArgs[ 2 ].Name = "FilterData"; - aArgs[ 2 ].Value <<= aFilterData; + Sequence< PropertyValue > aFilterData{ + comphelper::makePropertyValue("ImageResolution", nImageResolution), + comphelper::makePropertyValue("ColorMode", sal_Int32(0)), // todo: jpeg color mode (0->true color, 1->greyscale) + comphelper::makePropertyValue("Quality", nJPEGQuality), // quality that is used if we export to jpeg + comphelper::makePropertyValue("Compression", sal_Int32(6)), // compression that is used if we export to png + comphelper::makePropertyValue("Interlaced", sal_Int32(0)), // interlaced is turned off if we export to png + comphelper::makePropertyValue("LogicalSize", rLogicalSize), + comphelper::makePropertyValue("RemoveCropArea", bRemoveCropping), + comphelper::makePropertyValue("GraphicCropLogic", rGraphicCropLogic) + }; + + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("MimeType", rDestMimeType), // the GraphicProvider is using "MimeType", the GraphicExporter "MediaType"... + comphelper::makePropertyValue("OutputStream", rxOutputStream), + comphelper::makePropertyValue("FilterData", aFilterData) + }; rxGraphicProvider->storeGraphic( rxGraphic, aArgs ); } @@ -328,9 +321,8 @@ static Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentCont Reference< XInputStream > xInputStream( xTempFile->getInputStream() ); Reference< XSeekable > xSeekable( xInputStream, UNO_QUERY_THROW ); xSeekable->seek( 0 ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[ 0 ].Name = "InputStream"; - aArgs[ 0 ].Value <<= xInputStream; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( + "InputStream", xInputStream) }; xNewGraphic = xGraphicProvider->queryGraphic( aArgs ); } } @@ -347,9 +339,8 @@ static Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentCont Reference< XInputStream > xInputStream( xTempFile->getInputStream() ); Reference< XSeekable > xSeekable( xInputStream, UNO_QUERY_THROW ); xSeekable->seek( 0 ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[ 0 ].Name = "InputStream"; - aArgs[ 0 ].Value <<= xInputStream; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", + xInputStream) }; xNewGraphic = xGraphicProvider->queryGraphic( aArgs ); } } @@ -633,8 +624,9 @@ void ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments ) { int nLength = aArguments.getLength(); aArguments.realloc( nLength + 1 ); - aArguments[ nLength ].Name = "FilterName"; - aArguments[ nLength ].Value <<= maFilterName; + auto pArguments = aArguments.getArray(); + pArguments[ nLength ].Name = "FilterName"; + pArguments[ nLength ].Value <<= maFilterName; } xStorable->storeToURL( maSaveAsURL, aArguments ); if ( !nSourceSize ) @@ -648,9 +640,7 @@ void ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments ) xSelf = xDesktop->findFrame( "_blank", FrameSearchFlag::CREATE ); Reference< XComponentLoader > xComponentLoader( xSelf, UNO_QUERY ); - Sequence< PropertyValue > aLoadProps( 1 ); - aLoadProps[ 0 ].Name = "Hidden"; - aLoadProps[ 0 ].Value <<= true; + Sequence< PropertyValue > aLoadProps{ comphelper::makePropertyValue("Hidden", true) }; mxModel.set( xComponentLoader->loadComponentFromURL( maSaveAsURL, "_self", 0, aLoadProps ), UNO_QUERY ); } diff --git a/sdext/source/minimizer/optimizationstats.cxx b/sdext/source/minimizer/optimizationstats.cxx index deed337c712a..1deef26ac059 100644 --- a/sdext/source/minimizer/optimizationstats.cxx +++ b/sdext/source/minimizer/optimizationstats.cxx @@ -23,6 +23,10 @@ #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <comphelper/propertyvalue.hxx> + +#include <algorithm> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -51,13 +55,10 @@ const uno::Any* OptimizationStats::GetStatusValue( const PPPOptimizerTokenEnum e css::beans::PropertyValues OptimizationStats::GetStatusSequence() { - int i = 0; uno::Sequence< PropertyValue > aStatsSequence( maStats.size() ); - for( const auto& rEntry : maStats ) - { - aStatsSequence[ i ].Name = TKGet( rEntry.first ); - aStatsSequence[ i++ ].Value = rEntry.second; - } + std::transform(maStats.begin(), maStats.end(), aStatsSequence.getArray(), + [](const auto& rEntry) + { return comphelper::makePropertyValue(TKGet( rEntry.first ), rEntry.second); }); return aStatsSequence; } diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index ab392266e56d..bdfca5f326cd 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -31,6 +31,8 @@ #include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/util/XModifiable.hpp> + +#include <comphelper/propertyvalue.hxx> #include <sal/macros.h> #include <osl/time.h> #include <vcl/errinf.hxx> @@ -595,14 +597,11 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) aURL.Protocol = "vnd.com.sun.star.comp.PPPOptimizer:"; aURL.Path = "optimize"; - Sequence< PropertyValue > lArguments( 3 ); - lArguments[ 0 ].Name = "Settings"; - lArguments[ 0 ].Value <<= mrOptimizerDialog.GetConfigurationSequence(); - lArguments[ 1 ].Name = "StatusDispatcher"; - lArguments[ 1 ].Value <<= mrOptimizerDialog.GetStatusDispatcher(); - lArguments[ 2 ].Name = "InformationDialog"; - lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame(); - + Sequence< PropertyValue > lArguments{ + comphelper::makePropertyValue("Settings", mrOptimizerDialog.GetConfigurationSequence()), + comphelper::makePropertyValue("StatusDispatcher", mrOptimizerDialog.GetStatusDispatcher()), + comphelper::makePropertyValue("InformationDialog", mrOptimizerDialog.GetFrame()) + }; ErrCode errorCode; try diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx b/sdext/source/minimizer/optimizerdialogcontrols.cxx index 23011e50716b..8b98f2a5faaf 100644 --- a/sdext/source/minimizer/optimizerdialogcontrols.cxx +++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx @@ -393,9 +393,10 @@ void OptimizerDialog::UpdateControlStatesPage0() if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one { aItemList.realloc( rList.size() - 1 ); + auto pItemList = aItemList.getArray(); for ( std::vector<OptimizerSettings>::size_type i = 1; i < rList.size(); i++ ) { - aItemList[ i - 1 ] = rList[ i ].maName; + pItemList[ i - 1 ] = rList[ i ].maName; if ( nSelectedItem < 0 ) { if ( rList[ i ] == rList[ 0 ] ) @@ -407,8 +408,7 @@ void OptimizerDialog::UpdateControlStatesPage0() Sequence< short > aSelectedItems; if ( nSelectedItem >= 0 ) { - aSelectedItems.realloc( 1 ); - aSelectedItems[ 0 ] = nSelectedItem; + aSelectedItems = { nSelectedItem }; if ( nSelectedItem > 2 ) // only allowing to delete custom themes, the first can|t be deleted bRemoveButtonEnabled = true; } @@ -517,11 +517,12 @@ void OptimizerDialog::UpdateControlStatesPage2() } void OptimizerDialog::InitPage2() { - Sequence< OUString > aResolutionItemList( 4 ); - aResolutionItemList[ 0 ] = getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';' ); - aResolutionItemList[ 1 ] = getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';' ); - aResolutionItemList[ 2 ] = getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';' ); - aResolutionItemList[ 3 ] = getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';' ); + Sequence< OUString > aResolutionItemList{ + getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';' ), + getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';' ), + getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';' ), + getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';' ) + }; std::vector< OUString > aControlList { @@ -619,8 +620,9 @@ void OptimizerDialog::UpdateControlStatesPage4() if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one { aItemList.realloc( rList.size() - 1 ); + auto pItemList = aItemList.getArray(); for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ ) - aItemList[ w - 1 ] = rList[ w ].maName; + pItemList[ w - 1 ] = rList[ w ].maName; } setControlProperty( "ComboBox0Pg4", "StringItemList", Any( aItemList ) ); diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index dcda24fe2184..18751a00490a 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -320,16 +320,18 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF { nFilterNamePos = nAttribs; rFilterData.realloc( ++nAttribs ); - rFilterData[ nFilterNamePos ].Name = "FilterName"; + rFilterData.getArray()[ nFilterNamePos ].Name = "FilterName"; } + auto pFilterData = rFilterData.getArray(); aOutTypeName = "pdf_Portable_Document_Format"; - rFilterData[nFilterNamePos].Value <<= aOutFilterName; + pFilterData[nFilterNamePos].Value <<= aOutFilterName; if( xEmbedStream.is() ) { rFilterData.realloc( ++nAttribs ); - rFilterData[nAttribs-1].Name = "EmbeddedSubstream"; - rFilterData[nAttribs-1].Value <<= xEmbedStream; + pFilterData = rFilterData.getArray(); + pFilterData[nAttribs-1].Name = "EmbeddedSubstream"; + pFilterData[nAttribs-1].Value <<= xEmbedStream; } if( !aPwd.isEmpty() ) { @@ -337,19 +339,24 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF { nPwdPos = nAttribs; rFilterData.realloc( ++nAttribs ); - rFilterData[ nPwdPos ].Name = "Password"; + pFilterData = rFilterData.getArray(); + pFilterData[ nPwdPos ].Name = "Password"; } - rFilterData[ nPwdPos ].Value <<= aPwd; + pFilterData[ nPwdPos ].Value <<= aPwd; } } else { + css::beans::PropertyValue* pFilterData; if( nFilterNamePos == -1 ) { nFilterNamePos = nAttribs; rFilterData.realloc( ++nAttribs ); - rFilterData[ nFilterNamePos ].Name = "FilterName"; + pFilterData = rFilterData.getArray(); + pFilterData[ nFilterNamePos ].Name = "FilterName"; } + else + pFilterData = rFilterData.getArray(); const sal_Int32 nDocumentType = 0; //const sal_Int32 nDocumentType = queryDocumentTypeDialog(m_xContext,aURL); if( nDocumentType < 0 ) @@ -359,15 +366,15 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF else switch( nDocumentType ) { case 0: - rFilterData[nFilterNamePos].Value <<= OUString( "draw_pdf_import" ); + pFilterData[nFilterNamePos].Value <<= OUString( "draw_pdf_import" ); break; case 1: - rFilterData[nFilterNamePos].Value <<= OUString( "impress_pdf_import" ); + pFilterData[nFilterNamePos].Value <<= OUString( "impress_pdf_import" ); break; case 2: - rFilterData[nFilterNamePos].Value <<= OUString( "writer_pdf_import" ); + pFilterData[nFilterNamePos].Value <<= OUString( "writer_pdf_import" ); break; default: diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx b/sdext/source/pdfimport/misc/pwdinteract.cxx index 9885a6606a54..8bf54bddb99f 100644 --- a/sdext/source/pdfimport/misc/pwdinteract.cxx +++ b/sdext/source/pdfimport/misc/pwdinteract.cxx @@ -92,9 +92,7 @@ uno::Any PDFPasswordRequest::getRequest() uno::Sequence< uno::Reference< task::XInteractionContinuation > > PDFPasswordRequest::getContinuations() { - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aRet( 1 ); - aRet[0] = this; - return aRet; + return { this }; } void PDFPasswordRequest::setPassword( const OUString& rPwd ) diff --git a/sdext/source/pdfimport/odf/odfemitter.cxx b/sdext/source/pdfimport/odf/odfemitter.cxx index aa993ae1fa6a..e38e81fce917 100644 --- a/sdext/source/pdfimport/odf/odfemitter.cxx +++ b/sdext/source/pdfimport/odf/odfemitter.cxx @@ -52,10 +52,9 @@ public: OdfEmitter::OdfEmitter( const uno::Reference<io::XOutputStream>& xOutput ) : m_xOutput( xOutput ), - m_aLineFeed(1) + m_aLineFeed{ '\n' } { OSL_PRECOND(m_xOutput.is(), "OdfEmitter(): invalid output stream"); - m_aLineFeed[0] = '\n'; write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); } diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx index 14060715c83c..dc2def1c58e3 100644 --- a/sdext/source/pdfimport/pdfiadaptor.cxx +++ b/sdext/source/pdfimport/pdfiadaptor.cxx @@ -129,9 +129,7 @@ sal_Bool SAL_CALL PDFIHybridAdaptor::filter( const uno::Sequence< beans::Propert } if( xSubStream.is() ) { - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= m_xModel; - aArgs[1] <<= xSubStream; + uno::Sequence< uno::Any > aArgs{ uno::Any(m_xModel), uno::Any(xSubStream) }; SAL_INFO("sdext.pdfimport", "try to instantiate subfilter" ); uno::Reference< document::XFilter > xSubFilter; @@ -158,9 +156,9 @@ sal_Bool SAL_CALL PDFIHybridAdaptor::filter( const uno::Sequence< beans::Propert { nPwPos = aFilterData.getLength(); aFilterData.realloc( nPwPos+1 ); - aFilterData[nPwPos].Name = "Password"; + aFilterData.getArray()[nPwPos].Name = "Password"; } - aFilterData[nPwPos].Value <<= aPwd; + aFilterData.getArray()[nPwPos].Value <<= aPwd; bRet = xSubFilter->filter( aFilterData ); } else diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 3553a588802c..0560826d5727 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -697,8 +697,7 @@ uno::Sequence<beans::PropertyValue> LineParser::readImageImpl() uno::Sequence<sal_Int8> aDataSequence(nImageSize); readBinaryData( aDataSequence ); - uno::Sequence< uno::Any > aStreamCreationArgs(1); - aStreamCreationArgs[0] <<= aDataSequence; + uno::Sequence< uno::Any > aStreamCreationArgs{ uno::Any(aDataSequence) }; uno::Reference< uno::XComponentContext > xContext( m_parser.m_xContext, uno::UNO_SET_THROW ); uno::Reference< lang::XMultiComponentFactory > xFactory( xContext->getServiceManager(), uno::UNO_SET_THROW ); @@ -729,19 +728,17 @@ void LineParser::readImage() uno::Sequence<sal_Int8> aDataSequence(nMaskColors); readBinaryData( aDataSequence ); - uno::Sequence<uno::Any> aMaskRanges(2); - uno::Sequence<double> aMinRange(nMaskColors/2); + auto pMinRange = aMinRange.getArray(); uno::Sequence<double> aMaxRange(nMaskColors/2); + auto pMaxRange = aMaxRange.getArray(); for( sal_Int32 i=0; i<nMaskColors/2; ++i ) { - aMinRange[i] = aDataSequence[i] / 255.0; - aMaxRange[i] = aDataSequence[i+nMaskColors/2] / 255.0; + pMinRange[i] = aDataSequence[i] / 255.0; + pMaxRange[i] = aDataSequence[i+nMaskColors/2] / 255.0; } - aMaskRanges[0] <<= aMinRange; - aMaskRanges[1] <<= aMaxRange; - + uno::Sequence<uno::Any> aMaskRanges{ uno::Any(aMinRange), uno::Any(aMaxRange) }; m_parser.m_pSink->drawColorMaskedImage( aImg, aMaskRanges ); } else diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index 5c3a3efb20d6..10d73b88d898 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -1278,8 +1278,7 @@ void AccessibleRelationSet::AddRelation ( { maRelations.emplace_back(); maRelations.back().RelationType = nRelationType; - maRelations.back().TargetSet.realloc(1); - maRelations.back().TargetSet[0] = rxObject; + maRelations.back().TargetSet = { rxObject }; } //----- XAccessibleRelationSet ------------------------------------------------ diff --git a/sdext/source/presenter/PresenterCanvasHelper.cxx b/sdext/source/presenter/PresenterCanvasHelper.cxx index 8381f8d5aabd..4ff103958e1a 100644 --- a/sdext/source/presenter/PresenterCanvasHelper.cxx +++ b/sdext/source/presenter/PresenterCanvasHelper.cxx @@ -250,10 +250,11 @@ void PresenterCanvasHelper::SetDeviceColor( OSL_ASSERT(rRenderState.DeviceColor.getLength() == 4); if (rRenderState.DeviceColor.getLength() == 4) { - rRenderState.DeviceColor[0] = ((aColor >> 16) & 0x0ff) / 255.0; - rRenderState.DeviceColor[1] = ((aColor >> 8) & 0x0ff) / 255.0; - rRenderState.DeviceColor[2] = ((aColor >> 0) & 0x0ff) / 255.0; - rRenderState.DeviceColor[3] = 1.0 - ((aColor >> 24) & 0x0ff) / 255.0; + auto pDeviceColor = rRenderState.DeviceColor.getArray(); + pDeviceColor[0] = ((aColor >> 16) & 0x0ff) / 255.0; + pDeviceColor[1] = ((aColor >> 8) & 0x0ff) / 255.0; + pDeviceColor[2] = ((aColor >> 0) & 0x0ff) / 255.0; + pDeviceColor[3] = 1.0 - ((aColor >> 24) & 0x0ff) / 255.0; } } diff --git a/sdext/source/presenter/PresenterGeometryHelper.cxx b/sdext/source/presenter/PresenterGeometryHelper.cxx index 67a81d63c766..b2ad35c63e94 100644 --- a/sdext/source/presenter/PresenterGeometryHelper.cxx +++ b/sdext/source/presenter/PresenterGeometryHelper.cxx @@ -235,10 +235,11 @@ Reference<rendering::XPolyPolygon2D> PresenterGeometryHelper::CreatePolygon( const sal_Int32 nCount (rBoxes.size()); Sequence<Sequence<geometry::RealPoint2D> > aPoints(nCount); + auto aPointsRange = asNonConstRange(aPoints); for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) { const awt::Rectangle& rBox (rBoxes[nIndex]); - aPoints[nIndex] = Sequence<geometry::RealPoint2D> + aPointsRange[nIndex] = Sequence<geometry::RealPoint2D> { { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y) }, { o3tl::narrowing<double>(rBox.X), o3tl::narrowing<double>(rBox.Y+rBox.Height) }, diff --git a/sdext/source/presenter/PresenterPaneFactory.cxx b/sdext/source/presenter/PresenterPaneFactory.cxx index 258f956d00a1..b4aadc771f2c 100644 --- a/sdext/source/presenter/PresenterPaneFactory.cxx +++ b/sdext/source/presenter/PresenterPaneFactory.cxx @@ -241,14 +241,13 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( } // Supply arguments. - Sequence<Any> aArguments (6); - aArguments[0] <<= rxPaneId; - aArguments[1] <<= rxParentPane->getWindow(); - aArguments[2] <<= rxParentPane->getCanvas(); - aArguments[3] <<= OUString(); - aArguments[4] <<= Reference<drawing::framework::XPaneBorderPainter>( - mpPresenterController->GetPaneBorderPainter()); - aArguments[5] <<= !bIsSpritePane; + Sequence<Any> aArguments{ Any(rxPaneId), + Any(rxParentPane->getWindow()), + Any(rxParentPane->getCanvas()), + Any(OUString()), + Any(Reference<drawing::framework::XPaneBorderPainter>( + mpPresenterController->GetPaneBorderPainter())), + Any(!bIsSpritePane) }; xPane->initialize(aArguments); // Store pane and canvases and windows in container. diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx index b1ae31bad822..5ca0ee630ca0 100644 --- a/sdext/source/presenter/PresenterSlideShowView.cxx +++ b/sdext/source/presenter/PresenterSlideShowView.cxx @@ -943,9 +943,7 @@ void PresenterSlideShowView::impl_addAndConfigureView() // disabling sound for the new slide show view. beans::PropertyValue aProperty; aProperty.Name = "IsSoundEnabled"; - Sequence<Any> aValues (2); - aValues[0] <<= xView; - aValues[1] <<= false; + Sequence<Any> aValues{ Any(xView), Any(false) }; aProperty.Value <<= aValues; mxSlideShow->setProperty(aProperty); } diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx index 24115fa52523..d1ccaadc75d6 100644 --- a/sdext/source/presenter/PresenterWindowManager.cxx +++ b/sdext/source/presenter/PresenterWindowManager.cxx @@ -941,10 +941,11 @@ void PresenterWindowManager::PaintBackground (const awt::Rectangle& rUpdateBox) else { const util::Color aBackgroundColor (mpBackgroundBitmap->maReplacementColor); - aRenderState.DeviceColor[0] = ((aBackgroundColor >> 16) & 0x0ff) / 255.0; - aRenderState.DeviceColor[1] = ((aBackgroundColor >> 8) & 0x0ff) / 255.0; - aRenderState.DeviceColor[2] = ((aBackgroundColor >> 0) & 0x0ff) / 255.0; - aRenderState.DeviceColor[3] = ((aBackgroundColor >> 24) & 0x0ff) / 255.0; + auto pDeviceColor = aRenderState.DeviceColor.getArray(); + pDeviceColor[0] = ((aBackgroundColor >> 16) & 0x0ff) / 255.0; + pDeviceColor[1] = ((aBackgroundColor >> 8) & 0x0ff) / 255.0; + pDeviceColor[2] = ((aBackgroundColor >> 0) & 0x0ff) / 255.0; + pDeviceColor[3] = ((aBackgroundColor >> 24) & 0x0ff) / 255.0; mxParentCanvas->fillPolyPolygon( xBackgroundPolygon, aViewState, commit ce22935a8586eda71fd29d4ff969d9cd7a2ec15b Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 29 10:03:36 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Oct 31 06:56:49 2021 +0100 Prepare for removal of non-const operator[] from Sequence in sfx2 Change-Id: I0cdce64983901a6cc3b50dc9873a370ff08b9eb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124387 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 4bae1c14a570..fa95d74ca458 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -395,8 +395,9 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString & TransformItems( SID_OPENDOC, *pNew, aArgs ); sal_Int32 nLength = aArgs.getLength(); aArgs.realloc( nLength + 1 ); - aArgs[nLength].Name = "Title"; - aArgs[nLength].Value <<= xDoc->GetTitle( SFX_TITLE_DETECT ); + auto pArgs = aArgs.getArray(); + pArgs[nLength].Name = "Title"; + pArgs[nLength].Value <<= xDoc->GetTitle( SFX_TITLE_DETECT ); xModel->attachResource( OUString(), aArgs ); } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 830ad973cd25..6be2bfc85d40 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -43,6 +43,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <svtools/addresstemplate.hxx> @@ -1404,9 +1405,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_MORE_DICTIONARIES: { - uno::Sequence<beans::PropertyValue> aArgs(1); - aArgs[0].Name = "AdditionsTag"; - aArgs[0].Value <<= OUString("Dictionary"); + uno::Sequence<beans::PropertyValue> aArgs{ comphelper::makePropertyValue( + "AdditionsTag", OUString("Dictionary")) }; comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs); break; } diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 5d0e582b03a6..ee4e2c32b955 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -566,11 +566,8 @@ void IndexTabPage_Impl::InitializeIndex() css::uno::Reference< css::beans::XPropertySetInfo > xInfo = aCnt.getProperties(); if ( xInfo->hasPropertyByName( PROPERTY_ANCHORREF ) ) { - css::uno::Sequence< OUString > aPropSeq( 4 ); - aPropSeq[0] = PROPERTY_KEYWORDLIST; - aPropSeq[1] = PROPERTY_KEYWORDREF; - aPropSeq[2] = PROPERTY_ANCHORREF; - aPropSeq[3] = PROPERTY_TITLEREF; + css::uno::Sequence< OUString > aPropSeq{ PROPERTY_KEYWORDLIST, PROPERTY_KEYWORDREF, + PROPERTY_ANCHORREF, PROPERTY_TITLEREF }; // abi: use one possibly remote call only css::uno::Sequence< css::uno::Any > aAnySeq = diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index b6be7cad2fc6..8d221e07d90e 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -46,6 +46,7 @@ #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/extract.hxx> @@ -283,20 +284,15 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo Sequence< OUString > sFiles = xPicker->getSelectedFiles(); int nFiles = sFiles.getLength(); - int nArgs=3; - Sequence< PropertyValue > aArgs(3); - css::uno::Reference < css::task::XInteractionHandler2 > xInteraction( task::InteractionHandler::createWithParent(::comphelper::getProcessComponentContext(), nullptr) ); - aArgs[0].Name = "InteractionHandler"; - aArgs[0].Value <<= xInteraction; - - aArgs[1].Name = "MacroExecutionMode"; - aArgs[1].Value <<= sal_Int16(css::document::MacroExecMode::USE_CONFIG); - - aArgs[2].Name = "UpdateDocMode"; - aArgs[2].Value <<= sal_Int16(css::document::UpdateDocMode::ACCORDING_TO_CONFIG); + int nArgs=3; + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("InteractionHandler", xInteraction), + comphelper::makePropertyValue("MacroExecutionMode", sal_Int16(css::document::MacroExecMode::USE_CONFIG)), + comphelper::makePropertyValue("UpdateDocMode", sal_Int16(css::document::UpdateDocMode::ACCORDING_TO_CONFIG)) + }; // use the filedlghelper to get the current filter name, // because it removes the extensions before you get the filter name. @@ -317,8 +313,9 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo if ( bReadOnly ) { aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = "ReadOnly"; - aArgs[nArgs-1].Value <<= bReadOnly; + auto pArgs = aArgs.getArray(); + pArgs[nArgs-1].Name = "ReadOnly"; + pArgs[nArgs-1].Value <<= bReadOnly; } // Get version string @@ -332,8 +329,9 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo sal_Int16 uVersion = static_cast<sal_Int16>(iVersion); aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = "Version"; - aArgs[nArgs-1].Value <<= uVersion; + auto pArgs = aArgs.getArray(); + pArgs[nArgs-1].Name = "Version"; + pArgs[nArgs-1].Value <<= uVersion; } // Retrieve the current filter @@ -357,8 +355,9 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo if ( !aFilterName.isEmpty() ) { aArgs.realloc( ++nArgs ); - aArgs[nArgs-1].Name = "FilterName"; - aArgs[nArgs-1].Value <<= aFilterName; + auto pArgs = aArgs.getArray(); + pArgs[nArgs-1].Name = "FilterName"; + pArgs[nArgs-1].Value <<= aFilterName; } } } diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm index e36958ec3740..7e8bf071c95f 100644 --- a/sfx2/source/appl/shutdowniconaqua.mm +++ b/sfx2/source/appl/shutdowniconaqua.mm @@ -244,13 +244,14 @@ class RecentFilesStringLength : public ::cppu::WeakImplHelper< css::util::XStrin const RecentMenuEntry& rRecentFile = (*m_pRecentFilesItems)[ nIndex ]; int NUM_OF_PICKLIST_ARGS = 3; css::uno::Sequence< css::beans::PropertyValue > aArgsList( NUM_OF_PICKLIST_ARGS ); + css::beans::PropertyValue* pArgsList = aArgsList.getArray(); - aArgsList[0].Name = "Referer"; - aArgsList[0].Value <<= OUString( "private:user" ); + pArgsList[0].Name = "Referer"; + pArgsList[0].Value <<= OUString( "private:user" ); // documents in the picklist will never be opened as templates - aArgsList[1].Name = "AsTemplate"; - aArgsList[1].Value <<= false; + pArgsList[1].Name = "AsTemplate"; + pArgsList[1].Value <<= false; OUString aFilter( rRecentFile.aFilter ); sal_Int32 nPos = aFilter.indexOf( '|' ); @@ -261,15 +262,16 @@ class RecentFilesStringLength : public ::cppu::WeakImplHelper< css::util::XStrin if ( nPos < ( aFilter.getLength() - 1 ) ) aFilterOptions = aFilter.copy( nPos+1 ); - aArgsList[2].Name = "FilterOptions"; - aArgsList[2].Value <<= aFilterOptions; + pArgsList[2].Name = "FilterOptions"; + pArgsList[2].Value <<= aFilterOptions; aFilter = aFilter.copy( 0, nPos-1 ); aArgsList.realloc( ++NUM_OF_PICKLIST_ARGS ); + pArgsList = aArgsList.getArray(); } - aArgsList[NUM_OF_PICKLIST_ARGS-1].Name = "FilterName"; - aArgsList[NUM_OF_PICKLIST_ARGS-1].Value <<= aFilter; + pArgsList[NUM_OF_PICKLIST_ARGS-1].Name = "FilterName"; + pArgsList[NUM_OF_PICKLIST_ARGS-1].Value <<= aFilter; ShutdownIcon::OpenURL( rRecentFile.aURL, "_default", aArgsList ); } diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 99f5c5796d08..eb5b5662a817 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -23,6 +23,7 @@ #include <vcl/svapp.hxx> #include <sfx2/charwin.hxx> #include <comphelper/dispatchcommand.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -98,12 +99,9 @@ void SvxCharView::InsertCharToDoc() if (GetText().isEmpty()) return; - uno::Sequence<beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Symbols"; - aArgs[0].Value <<= GetText(); - - aArgs[1].Name = "FontName"; - aArgs[1].Value <<= maFont.GetFamilyName(); + uno::Sequence<beans::PropertyValue> aArgs{ comphelper::makePropertyValue("Symbols", GetText()), + comphelper::makePropertyValue( + "FontName", maFont.GetFamilyName()) }; comphelper::dispatchCommand(".uno:InsertSymbol", aArgs); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index e4965467ed0e..6c6b3134404d 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1706,10 +1706,11 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos ) void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, const Point* pPos ) { - css::uno::Sequence< css::uno::Any > aArgs( 3 ); - aArgs[0] <<= comphelper::makePropertyValue( "Value", rResName ); - aArgs[1] <<= comphelper::makePropertyValue( "Frame", GetFrame()->GetFrame().GetFrameInterface() ); - aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true ); + css::uno::Sequence< css::uno::Any > aArgs{ + css::uno::Any(comphelper::makePropertyValue( "Value", rResName )), + css::uno::Any(comphelper::makePropertyValue( "Frame", GetFrame()->GetFrame().GetFrameInterface() )), + css::uno::Any(comphelper::makePropertyValue( "IsContextMenu", true )) + }; css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XPopupMenuController > xPopupController( diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 3da4bfb88818..f942b1ffbb15 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -68,9 +68,7 @@ bool IsDocEncrypted(const OUString& rURL) { uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext); - uno::Sequence<uno::Any> aArgs (2); - aArgs[0] <<= rURL; - aArgs[1] <<= embed::ElementModes::READ; + uno::Sequence<uno::Any> aArgs{ uno::Any(rURL), uno::Any(embed::ElementModes::READ) }; uno::Reference<embed::XStorage> xDocStorage ( xStorageFactory->createInstanceWithArguments(aArgs), uno::UNO_QUERY); diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx index 0d0648f222a8..6f046e3dc6e8 100644 --- a/sfx2/source/control/recentdocsviewitem.cxx +++ b/sfx2/source/control/recentdocsviewitem.cxx @@ -9,6 +9,8 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/util/URLTransformer.hpp> + +#include <comphelper/propertyvalue.hxx> #include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <i18nutil/paper.hxx> @@ -189,13 +191,9 @@ void RecentDocsViewItem::OpenDocument() Reference<util::XURLTransformer> xTrans(util::URLTransformer::create(::comphelper::getProcessComponentContext())); xTrans->parseStrict(aTargetURL); - aArgsList.realloc(2); - aArgsList[0].Name = "Referer"; - aArgsList[0].Value <<= OUString("private:user"); - - // documents will never be opened as templates - aArgsList[1].Name = "AsTemplate"; - aArgsList[1].Value <<= false; + aArgsList = { comphelper::makePropertyValue("Referer", OUString("private:user")), + // documents will never be opened as templates + comphelper::makePropertyValue("AsTemplate", false) }; xDispatch = xDesktop->queryDispatch(aTargetURL, "_default", 0); diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index cac6ad5175a0..964a256b19a7 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -355,7 +355,7 @@ void SfxRequest_Impl::Record aStatement.aArgs[0].Value >>= aStr; rArgs[0].Value >>= aNew; aStr += aNew; - aStatement.aArgs[0].Value <<= aStr; + aStatement.aArgs.getArray()[0].Value <<= aStr; aElement <<= aStatement; xReplace->replaceByIndex( nCount-1, aElement ); return; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 284376d974fd..04de9a437550 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -66,9 +66,7 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) { uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext); - uno::Sequence<uno::Any> aArgs (2); - aArgs[0] <<= msURL; - aArgs[1] <<= embed::ElementModes::READ; + uno::Sequence<uno::Any> aArgs{ uno::Any(msURL), uno::Any(embed::ElementModes::READ) }; uno::Reference<embed::XStorage> xDocStorage ( xStorageFactory->createInstanceWithArguments(aArgs), uno::UNO_QUERY); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index a095d5a656fb..b01500814bc9 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -437,52 +437,53 @@ void SfxDispatchController_Impl::addParametersToArgs( const css::util::URL& aURL sal_Int32 nLen = rArgs.getLength(); rArgs.realloc( nLen+1 ); - rArgs[nLen].Name = aParamName; + auto pArgs = rArgs.getArray(); + pArgs[nLen].Name = aParamName; if ( aParamType.isEmpty() ) { // Default: LONG - rArgs[nLen].Value <<= aValue.toInt32(); + pArgs[nLen].Value <<= aValue.toInt32(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_BOOL], 4 )) { // sal_Bool support - rArgs[nLen].Value <<= aValue.toBoolean(); + pArgs[nLen].Value <<= aValue.toBoolean(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_BYTE], 4 )) { // sal_uInt8 support - rArgs[nLen].Value <<= sal_Int8( aValue.toInt32() ); + pArgs[nLen].Value <<= sal_Int8( aValue.toInt32() ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_LONG], 4 )) { // LONG support - rArgs[nLen].Value <<= aValue.toInt32(); + pArgs[nLen].Value <<= aValue.toInt32(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_SHORT], 5 )) { // SHORT support - rArgs[nLen].Value <<= sal_Int16( aValue.toInt32() ); + pArgs[nLen].Value <<= sal_Int16( aValue.toInt32() ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_HYPER], 5 )) { // HYPER support - rArgs[nLen].Value <<= aValue.toInt64(); + pArgs[nLen].Value <<= aValue.toInt64(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_FLOAT], 5 )) { // FLOAT support - rArgs[nLen].Value <<= aValue.toFloat(); + pArgs[nLen].Value <<= aValue.toFloat(); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_STRING], 6 )) { // STRING support - rArgs[nLen].Value <<= INetURLObject::decode( aValue, INetURLObject::DecodeMechanism::WithCharset ); + pArgs[nLen].Value <<= INetURLObject::decode( aValue, INetURLObject::DecodeMechanism::WithCharset ); } else if ( aParamType.equalsAsciiL( URLTypeNames[URLType_DOUBLE], 6)) { // DOUBLE support - rArgs[nLen].Value <<= aValue.toDouble(); + pArgs[nLen].Value <<= aValue.toDouble(); } } while ( nIndex >= 0 ); @@ -609,7 +610,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, // we offer dispatches for SID_JUMPTOMARK if the URL points to a bookmark inside the document // so we must retrieve this as an argument from the parsed URL lNewArgs.realloc( lNewArgs.getLength()+1 ); - auto& el = lNewArgs[lNewArgs.getLength()-1]; + auto& el = lNewArgs.getArray()[lNewArgs.getLength()-1]; el.Name = "Bookmark"; el.Value <<= aURL.Mark; } @@ -651,8 +652,9 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, // have an argument that has the same name as the master slot and type is SfxStringItem. sal_Int32 nIndex = lNewArgs.getLength(); lNewArgs.realloc( nIndex+1 ); - lNewArgs[nIndex].Name = OUString::createFromAscii( pSlot->pUnoName ); - lNewArgs[nIndex].Value <<= SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ); + auto plNewArgs = lNewArgs.getArray(); + plNewArgs[nIndex].Name = OUString::createFromAscii( pSlot->pUnoName ); + plNewArgs[nIndex].Value <<= SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ); } eMapUnit = GetCoreMetric( pShell->GetPool(), GetId() ); diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 3a95cef10e51..e67eeee27c6b 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -35,6 +35,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <sfx2/app.hxx> #include <officecfg/Office/Common.hxx> @@ -658,15 +659,12 @@ IMPL_LINK(BackingWindow, CreateContextMenuHdl, ThumbnailViewItem*, pItem, void) IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem, void) { - uno::Sequence< PropertyValue > aArgs(4); - aArgs[0].Name = "AsTemplate"; - aArgs[0].Value <<= true; - aArgs[1].Name = "MacroExecutionMode"; - aArgs[1].Value <<= MacroExecMode::USE_CONFIG; - aArgs[2].Name = "UpdateDocMode"; - aArgs[2].Value <<= UpdateDocMode::ACCORDING_TO_CONFIG; - aArgs[3].Name = "InteractionHandler"; - aArgs[3].Value <<= task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), nullptr ); + uno::Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("AsTemplate", true), + comphelper::makePropertyValue("MacroExecutionMode", MacroExecMode::USE_CONFIG), + comphelper::makePropertyValue("UpdateDocMode", UpdateDocMode::ACCORDING_TO_CONFIG), + comphelper::makePropertyValue("InteractionHandler", task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), nullptr )) + }; TemplateViewItem *pTemplateItem = static_cast<TemplateViewItem*>(pItem); @@ -683,13 +681,11 @@ IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem, void) IMPL_LINK(BackingWindow, EditTemplateHdl, ThumbnailViewItem*, pItem, void) { - uno::Sequence< PropertyValue > aArgs(3); - aArgs[0].Name = "AsTemplate"; - aArgs[0].Value <<= false; - aArgs[1].Name = "MacroExecutionMode"; - aArgs[1].Value <<= MacroExecMode::USE_CONFIG; - aArgs[2].Name = "UpdateDocMode"; - aArgs[2].Value <<= UpdateDocMode::ACCORDING_TO_CONFIG; + uno::Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue("AsTemplate", false), + comphelper::makePropertyValue("MacroExecutionMode", MacroExecMode::USE_CONFIG), + comphelper::makePropertyValue("UpdateDocMode", UpdateDocMode::ACCORDING_TO_CONFIG), + }; TemplateViewItem *pViewItem = static_cast<TemplateViewItem*>(pItem); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 7462f840d1ec..e702c7c9457f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -28,6 +28,7 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/cmdoptions.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/stl_types.hxx> #include <comphelper/xmlsechelper.hxx> #include <unotools/useroptions.hxx> @@ -1519,12 +1520,9 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() StoreCustomProperties(); Sequence< beans::PropertyValue > aPropertiesSeq(GetTotalLineCount()); - - for (sal_uInt32 i = 0; i < GetTotalLineCount(); ++i) - { - aPropertiesSeq[i].Name = m_aCustomProperties[i]->m_sName; - aPropertiesSeq[i].Value = m_aCustomProperties[i]->m_aValue; - } + std::transform( + m_aCustomProperties.begin(), m_aCustomProperties.end(), aPropertiesSeq.getArray(), + [](const auto& el) { return comphelper::makePropertyValue(el->m_sName, el->m_aValue); }); return aPropertiesSeq; } @@ -2150,28 +2148,30 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() const { Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() ); + auto aPropertiesSeqRange = asNonConstRange(aPropertiesSeq); sal_Int32 i = 0; for ( auto& rxLine : m_aCmisPropertiesLines ) { CmisPropertyLine* pLine = rxLine.get(); - aPropertiesSeq[i].Id = pLine->m_sId; - aPropertiesSeq[i].Type = pLine->m_sType; - aPropertiesSeq[i].Updatable = pLine->m_bUpdatable; - aPropertiesSeq[i].Required = pLine->m_bRequired; - aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice; - aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued; + aPropertiesSeqRange[i].Id = pLine->m_sId; + aPropertiesSeqRange[i].Type = pLine->m_sType; + aPropertiesSeqRange[i].Updatable = pLine->m_bUpdatable; + aPropertiesSeqRange[i].Required = pLine->m_bRequired; + aPropertiesSeqRange[i].OpenChoice = pLine->m_bOpenChoice; + aPropertiesSeqRange[i].MultiValued = pLine->m_bMultiValued; OUString sPropertyName = pLine->m_xName->get_label(); if ( !sPropertyName.isEmpty() ) { - aPropertiesSeq[i].Name = sPropertyName; + aPropertiesSeqRange[i].Name = sPropertyName; OUString sType = pLine->m_xType->get_label(); if ( CMIS_TYPE_DECIMAL == sType ) { sal_uInt32 nIndex = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); Sequence< double > seqValue( pLine->m_aValues.size( ) ); + auto seqValueRange = asNonConstRange(seqValue); sal_Int32 k = 0; for ( const auto& rxValue : pLine->m_aValues ) { @@ -2180,16 +2180,17 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). IsNumberFormat( sValue, nIndex, dValue ); if ( bIsNum ) - seqValue[k] = dValue; + seqValueRange[k] = dValue; ++k; } - aPropertiesSeq[i].Value <<= seqValue; + aPropertiesSeqRange[i].Value <<= seqValue; } else if ( CMIS_TYPE_INTEGER == sType ) { sal_uInt32 nIndex = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM ); Sequence< sal_Int64 > seqValue( pLine->m_aValues.size( ) ); + auto seqValueRange = asNonConstRange(seqValue); sal_Int32 k = 0; for ( const auto& rxValue : pLine->m_aValues ) { @@ -2198,27 +2199,29 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). IsNumberFormat( sValue, nIndex, dValue ); if ( bIsNum ) - seqValue[k] = static_cast<sal_Int64>(dValue); + seqValueRange[k] = static_cast<sal_Int64>(dValue); ++k; } - aPropertiesSeq[i].Value <<= seqValue; + aPropertiesSeqRange[i].Value <<= seqValue; } else if ( CMIS_TYPE_BOOL == sType ) { Sequence<sal_Bool> seqValue( pLine->m_aYesNos.size( ) ); + sal_Bool* pseqValue = seqValue.getArray(); sal_Int32 k = 0; for ( const auto& rxYesNo : pLine->m_aYesNos ) { bool bValue = rxYesNo->m_xYesButton->get_active(); - seqValue[k] = bValue; + pseqValue[k] = bValue; ++k; } - aPropertiesSeq[i].Value <<= seqValue; + aPropertiesSeqRange[i].Value <<= seqValue; } else if ( CMIS_TYPE_DATETIME == sType ) { Sequence< util::DateTime > seqValue( pLine->m_aDateTimes.size( ) ); + auto seqValueRange = asNonConstRange(seqValue); sal_Int32 k = 0; for ( const auto& rxDateTime : pLine->m_aDateTimes ) { @@ -2228,22 +2231,23 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con aTmpTime.GetMin(), aTmpTime.GetHour(), aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(), true ); - seqValue[k] = aDateTime; + seqValueRange[k] = aDateTime; ++k; } - aPropertiesSeq[i].Value <<= seqValue; + aPropertiesSeqRange[i].Value <<= seqValue; } else { Sequence< OUString > seqValue( pLine->m_aValues.size( ) ); + auto seqValueRange = asNonConstRange(seqValue); sal_Int32 k = 0; for ( const auto& rxValue : pLine->m_aValues ) { OUString sValue( rxValue->m_xValueEdit->get_text() ); - seqValue[k] = sValue; + seqValueRange[k] = sValue; ++k; } - aPropertiesSeq[i].Value <<= seqValue; + aPropertiesSeqRange[i].Value <<= seqValue; } } ++i; diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 35fc5d166e11..23c2b097a23c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -611,7 +611,7 @@ void FileDialogHelper_Impl::updateVersions() const uno::Sequence < util::RevisionTag > xVersions = SfxMedium::GetVersionList( xStorage ); aEntries.realloc( xVersions.getLength() + 1 ); - aEntries[0] = SfxResId( STR_SFX_FILEDLG_ACTUALVERSION ); + aEntries.getArray()[0] = SfxResId( STR_SFX_FILEDLG_ACTUALVERSION ); std::transform(xVersions.begin(), xVersions.end(), std::next(aEntries.getArray()), [](const util::RevisionTag& rVersion) -> OUString { return rVersion.Identifier; }); @@ -1036,6 +1036,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( auto xWindow = GetFrameInterface(); Sequence < Any > aInitArguments(!xWindow.is() ? 3 : 4); + auto pInitArguments = aInitArguments.getArray(); // This is a hack. We currently know that the internal file picker implementation // supports the extended arguments as specified below. @@ -1044,30 +1045,30 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( // b) adjust the implementation of the system file picker to that it recognizes it if ( mbSystemPicker ) { - aInitArguments[0] <<= nTemplateDescription; + pInitArguments[0] <<= nTemplateDescription; if (xWindow.is()) - aInitArguments[1] <<= xWindow; + pInitArguments[1] <<= xWindow; } else { - aInitArguments[0] <<= NamedValue( + pInitArguments[0] <<= NamedValue( "TemplateDescription", makeAny( nTemplateDescription ) ); - aInitArguments[1] <<= NamedValue( + pInitArguments[1] <<= NamedValue( "StandardDir", makeAny( sStandardDir ) ); - aInitArguments[2] <<= NamedValue( + pInitArguments[2] <<= NamedValue( "DenyList", makeAny( rDenyList ) ); if (xWindow.is()) - aInitArguments[3] <<= NamedValue("ParentWindow", makeAny(xWindow)); + pInitArguments[3] <<= NamedValue("ParentWindow", makeAny(xWindow)); } try @@ -1149,10 +1150,7 @@ css::uno::Reference<css::ui::dialogs::XFolderPicker2> createFolderPicker(const c uno::Reference< XInitialization > xInit(xRet, UNO_QUERY); if (xInit.is()) { - Sequence<Any> aInitArguments(2); - - aInitArguments[0] <<= sal_Int32(0); - aInitArguments[1] <<= pPreferredParent->GetXWindow(); + Sequence<Any> aInitArguments{ Any(sal_Int32(0)), Any(pPreferredParent->GetXWindow()) }; try { @@ -2672,6 +2670,7 @@ Sequence< OUString > FileDialogHelper::GetSelectedFiles() const if ( nFiles > 1 ) { aResultSeq = Sequence< OUString >( nFiles-1 ); + auto pResultSeq = aResultSeq.getArray(); INetURLObject aPath( lFiles[0] ); aPath.setFinalSlash(); @@ -2683,7 +2682,7 @@ Sequence< OUString > FileDialogHelper::GetSelectedFiles() const else aPath.setName( lFiles[i] ); - aResultSeq[i-1] = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ); + pResultSeq[i-1] = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ); } } else diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index dcdc1a1a32c3..195fa09dd9bc 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -1016,12 +1016,13 @@ namespace sfx2 if ( !aImportantFilterGroup.empty() ) { Sequence< StringPair > aFilters( aImportantFilterGroup.size() ); + auto pFilters = aFilters.getArray(); for ( sal_Int32 i = 0; i < static_cast<sal_Int32>(aImportantFilterGroup.size()); i++ ) { - aFilters[i].First = addExtension( aImportantFilterGroup[i].aUIName, + pFilters[i].First = addExtension( aImportantFilterGroup[i].aUIName, aImportantFilterGroup[i].aWildcard, false, _rFileDlgImpl ); - aFilters[i].Second = aImportantFilterGroup[i].aWildcard; + pFilters[i].Second = aImportantFilterGroup[i].aWildcard; } try @@ -1036,12 +1037,13 @@ namespace sfx2 if ( !aFilterGroup.empty() ) { Sequence< StringPair > aFilters( aFilterGroup.size() ); + auto pFilters = aFilters.getArray(); for ( sal_Int32 i = 0; i < static_cast<sal_Int32>(aFilterGroup.size()); i++ ) { - aFilters[i].First = addExtension( aFilterGroup[i].aUIName, + pFilters[i].First = addExtension( aFilterGroup[i].aUIName, aFilterGroup[i].aWildcard, false, _rFileDlgImpl ); - aFilters[i].Second = aFilterGroup[i].aWildcard; + pFilters[i].Second = aFilterGroup[i].aWildcard; } try diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 503efaae7ecf..382a677369f4 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -52,6 +52,7 @@ #include <tools/urlobj.hxx> #include <unotools/useroptions.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/string.hxx> #include <vcl/svapp.hxx> @@ -149,7 +150,6 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( if( xFilterDialog.is() && xFilterProperties.is() ) { - uno::Sequence< beans::PropertyValue > aPropsForDialog(1); uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY ); if ( rType == PDF_DOCUMENT_TYPE ) @@ -157,13 +157,15 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( //add an internal property, used to tell the dialog we want to set a different //string for the ok button //used in filter/source/pdf/impdialog.cxx - uno::Sequence< beans::PropertyValue > aFilterDataValue(1); - aFilterDataValue[0].Name = "_OkButtonString"; - aFilterDataValue[0].Value <<= SfxResId(STR_PDF_EXPORT_SEND ); + uno::Sequence< beans::PropertyValue > aFilterDataValue{ + comphelper::makePropertyValue("_OkButtonString", + SfxResId(STR_PDF_EXPORT_SEND )) + }; //add to the filterdata property, the only one the PDF export filter dialog will care for - aPropsForDialog[0].Name = "FilterData"; - aPropsForDialog[0].Value <<= aFilterDataValue; + uno::Sequence< beans::PropertyValue > aPropsForDialog{ + comphelper::makePropertyValue("FilterData", aFilterDataValue) + }; //when executing the dialog will merge the persistent FilterData properties xFilterProperties->setPropertyValues( aPropsForDialog ); @@ -184,8 +186,9 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( { //found the filterdata, add to the storing argument rArgs.realloc( ++rNumArgs ); - rArgs[rNumArgs-1].Name = pProp->Name; - rArgs[rNumArgs-1].Value = pProp->Value; + auto pArgs = rArgs.getArray(); + pArgs[rNumArgs-1].Name = pProp->Name; + pArgs[rNumArgs-1].Value = pProp->Value; } eRet = SAVE_SUCCESSFUL; } @@ -308,10 +311,11 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { // Retrieve filter from type css::uno::Sequence< css::beans::NamedValue > aQuery( bSendAsPDF ? 3 : 2 ); - aQuery[0].Name = "Type"; - aQuery[0].Value <<= aTypeName; - aQuery[1].Name = "DocumentService"; - aQuery[1].Value <<= aModule; + auto pQuery = aQuery.getArray(); + pQuery[0].Name = "Type"; + pQuery[0].Value <<= aTypeName; + pQuery[1].Name = "DocumentService"; + pQuery[1].Value <<= aModule; if( bSendAsPDF ) { // #i91419# @@ -319,8 +323,8 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( // exact flag value as detailed in the filter configuration to get it // this seems to be a bug // without flags we get an import filter here, which is also unwanted - aQuery[2].Name = "Flags"; - aQuery[2].Value <<= sal_Int32(0x80042); // EXPORT ALIEN 3RDPARTY + pQuery[2].Name = "Flags"; + pQuery[2].Value <<= sal_Int32(0x80042); // SfxFilterFlags: EXPORT ALIEN 3RDPARTY } css::uno::Reference< css::container::XEnumeration > xEnumeration = @@ -461,11 +465,10 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - sal_Int32 nNumArgs(0); + sal_Int32 nNumArgs(1); static const OUStringLiteral aPasswordPropName( u"Password" ); - css::uno::Sequence< css::beans::PropertyValue > aArgs( ++nNumArgs ); - aArgs[nNumArgs-1].Name = "FilterName"; - aArgs[nNumArgs-1].Value <<= aFilterName; + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + "FilterName", aFilterName) }; ::comphelper::SequenceAsHashMap aMediaDescrPropsHM( xModel->getArgs() ); OUString aPassword = aMediaDescrPropsHM.getUnpackedValueOrDefault( @@ -474,8 +477,9 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if ( !aPassword.isEmpty() ) { aArgs.realloc( ++nNumArgs ); - aArgs[nNumArgs-1].Name = aPasswordPropName; - aArgs[nNumArgs-1].Value <<= aPassword; + auto pArgs = aArgs.getArray(); + pArgs[nNumArgs-1].Name = aPasswordPropName; + pArgs[nNumArgs-1].Value <<= aPassword; } bool bNeedsPreparation = false; @@ -600,8 +604,9 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { // We need 1:1 copy of the document to preserve an added signature. aArgs.realloc( ++nNumArgs ); - aArgs[nNumArgs-1].Name = "CopyStreamIfPossible"; - aArgs[nNumArgs-1].Value <<= true; + auto pArgs = aArgs.getArray(); + pArgs[nNumArgs-1].Name = "CopyStreamIfPossible"; + pArgs[nNumArgs-1].Value <<= true; try { @@ -715,8 +720,8 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: if ( nToCount > 1 ) { Sequence< OUString > aCcRecipientSeq( nToCount - 1 ); - for ( size_t i = 1; i < nToCount; ++i ) - aCcRecipientSeq[i - 1] = mpToList->at(i); + std::copy_n(std::next(mpToList->begin()), aCcRecipientSeq.getLength(), + aCcRecipientSeq.getArray()); xSimpleMailMessage->setCcRecipient( aCcRecipientSeq ); } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index ef056973efe6..12a8f9ff3a51 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -32,6 +32,7 @@ #include <svl/stritem.hxx> #include <svl/style.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/ModuleManager.hpp> @@ -633,9 +634,8 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, LoadFactoryStyleFilter_Hdl, SfxObjectShe void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell const * i_pObjSh, sal_Int32 i_nFilter ) { OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); - Sequence< PropertyValue > lProps(1); - lProps[0].Name = "ooSetupFactoryStyleFilter"; - lProps[0].Value <<= i_nFilter | (m_bWantHierarchical ? 0x1000 : 0); + Sequence< PropertyValue > lProps{ comphelper::makePropertyValue( + "ooSetupFactoryStyleFilter", i_nFilter | (m_bWantHierarchical ? 0x1000 : 0)) }; xModuleManager->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) ); } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index fd31efd621a9..2c57215c39fd 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -77,6 +77,7 @@ #include <i18nlangtag/languagetag.hxx> #include <optional> +#include <algorithm> #include <utility> #include <vector> #include <map> @@ -724,9 +725,8 @@ SfxDocumentMetaData::getMetaList(const char* i_name) const std::vector<css::uno::Reference<css::xml::dom::XNode> > const & vec = m_metaList.find(name)->second; css::uno::Sequence< OUString> ret(vec.size()); - for (size_t i = 0; i < vec.size(); ++i) { - ret[i] = getNodeText(vec.at(i)); - } + std::transform(vec.begin(), vec.end(), ret.getArray(), + [](const auto& node) { return getNodeText(node); }); return ret; } @@ -1757,8 +1757,7 @@ SfxDocumentMetaData::loadFromStorage( } catch (const css::uno::Exception &) { input.sSystemId = s_meta; } - css::uno::Sequence< css::uno::Any > args(1); - args[0] <<= xPropArg; + css::uno::Sequence< css::uno::Any > args{ css::uno::Any(xPropArg) }; // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler css::uno::Reference<XInterface> xFilter = @@ -1837,9 +1836,7 @@ SfxDocumentMetaData::storeToStorage( // set base URL css::uno::Reference<css::beans::XPropertySet> xPropArg = getURLProperties(Medium); - css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= xSaxWriter; - args[1] <<= xPropArg; + css::uno::Sequence< css::uno::Any > args{ css::uno::Any(xSaxWriter), css::uno::Any(xPropArg) }; css::uno::Reference<css::document::XExporter> xExp( xMsf->createInstanceWithArgumentsAndContext( @@ -2101,21 +2098,22 @@ void SfxDocumentMetaData::createUserDefined() if ( m_xUserDefined.is() ) return; - css::uno::Sequence<css::uno::Type> types(13); - types[ 0] = ::cppu::UnoType<bool>::get(); - types[ 1] = ::cppu::UnoType< OUString>::get(); - types[ 2] = ::cppu::UnoType<css::util::DateTime>::get(); - types[ 3] = ::cppu::UnoType<css::util::Date>::get(); - types[ 4] = ::cppu::UnoType<css::util::DateTimeWithTimezone>::get(); - types[ 5] = ::cppu::UnoType<css::util::DateWithTimezone>::get(); - types[ 6] = ::cppu::UnoType<css::util::Duration>::get(); - types[ 7] = ::cppu::UnoType<float>::get(); - types[ 8] = ::cppu::UnoType<double>::get(); - types[ 9] = ::cppu::UnoType<sal_Int16>::get(); - types[10] = ::cppu::UnoType<sal_Int32>::get(); - types[11] = ::cppu::UnoType<sal_Int64>::get(); - // Time is supported for backward compatibility with OOo 3.x, x<=2 - types[12] = ::cppu::UnoType<css::util::Time>::get(); + css::uno::Sequence<css::uno::Type> types{ + ::cppu::UnoType<bool>::get(), + ::cppu::UnoType< OUString>::get(), + ::cppu::UnoType<css::util::DateTime>::get(), + ::cppu::UnoType<css::util::Date>::get(), + ::cppu::UnoType<css::util::DateTimeWithTimezone>::get(), + ::cppu::UnoType<css::util::DateWithTimezone>::get(), + ::cppu::UnoType<css::util::Duration>::get(), + ::cppu::UnoType<float>::get(), + ::cppu::UnoType<double>::get(), + ::cppu::UnoType<sal_Int16>::get(), + ::cppu::UnoType<sal_Int32>::get(), + ::cppu::UnoType<sal_Int64>::get(), + // Time is supported for backward compatibility with OOo 3.x, x<=2 + ::cppu::UnoType<css::util::Time>::get() + }; // #i94175#: ODF allows empty user-defined property names! m_xUserDefined.set( css::beans::PropertyBag::createWithTypes( m_xContext, types, true/*AllowEmptyPropertyName*/, false/*AutomaticAddition*/ ), diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 93c5ab52ab47..cc041670f997 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/moduleoptions.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/configurationhelper.hxx> @@ -200,20 +201,19 @@ void SfxObjectFactory::SetSystemTemplate( const OUString& rServiceName, const OU OUString aFilterName = aProps2.getUnpackedValueOrDefault("PreferredFilter", OUString() ); - uno::Sequence< beans::PropertyValue > aArgs( 3 ); - aArgs[0].Name = "FilterName"; - aArgs[0].Value <<= aFilterName; - aArgs[1].Name = "AsTemplate"; - aArgs[1].Value <<= true; - aArgs[2].Name = "URL"; - aArgs[2].Value <<= rTemplateName; + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue("FilterName", aFilterName), + comphelper::makePropertyValue("AsTemplate", true), + comphelper::makePropertyValue("URL", rTemplateName) + }; uno::Reference< frame::XLoadable > xLoadable( xFactory->createInstance( rServiceName ), uno::UNO_QUERY ); xLoadable->load( aArgs ); aArgs.realloc( 2 ); - aArgs[1].Name = "Overwrite"; - aArgs[1].Value <<= true; + auto pArgs = aArgs.getArray(); + pArgs[1].Name = "Overwrite"; + pArgs[1].Value <<= true; uno::Reference< frame::XStorable > xStorable( xLoadable, uno::UNO_QUERY ); xStorable->storeToURL( sUserTemplateURL, aArgs ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index fde26ee2911a..374ca83a81eb 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -75,6 +75,7 @@ #include <unotools/tempfile.hxx> #include <comphelper/fileurl.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/interaction.hxx> #include <comphelper/sequence.hxx> #include <comphelper/simplefileaccessinteraction.hxx> @@ -526,9 +527,10 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate ) { ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( document::ChangedByOthersRequest() ) ); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations{ + new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ), + new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ) + }; xInteractionRequestImpl->setContinuations( aContinuations ); xHandler->handle( xInteractionRequestImpl ); @@ -1096,14 +1098,15 @@ SfxMedium::ShowLockResult SfxMedium::ShowLockedDocumentDialog(const LockFileEntr } uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations(nContinuations); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); - aContinuations[2] = new ::ucbhelper::InteractionDisapprove( xInteractionRequestImpl.get() ); + auto pContinuations = aContinuations.getArray(); + pContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); + pContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); + pContinuations[2] = new ::ucbhelper::InteractionDisapprove( xInteractionRequestImpl.get() ); if (nContinuations > 3) { // We use InteractionRetry to reflect that user wants to // ignore the (stale?) alien lock file and open/overwrite the document - aContinuations[3] = new ::ucbhelper::InteractionRetry(xInteractionRequestImpl.get()); + pContinuations[3] = new ::ucbhelper::InteractionRetry(xInteractionRequestImpl.get()); } xInteractionRequestImpl->setContinuations( aContinuations ); @@ -1187,11 +1190,10 @@ bool SfxMedium::ShowReadOnlyOpenDialog() OUString(), uno::Reference<uno::XInterface>(), aDocumentURL))); if (xInteractionRequestImpl != nullptr) { - sal_Int32 nContinuations = 2; - uno::Sequence<uno::Reference<task::XInteractionContinuation>> aContinuations( - nContinuations); - aContinuations[0] = new ::ucbhelper::InteractionAbort(xInteractionRequestImpl.get()); - aContinuations[1] = new ::ucbhelper::InteractionApprove(xInteractionRequestImpl.get()); + uno::Sequence<uno::Reference<task::XInteractionContinuation>> aContinuations{ + new ::ucbhelper::InteractionAbort(xInteractionRequestImpl.get()), + new ::ucbhelper::InteractionApprove(xInteractionRequestImpl.get()) + }; xInteractionRequestImpl->setContinuations(aContinuations); xHandler->handle(xInteractionRequestImpl); ::rtl::Reference<::ucbhelper::InteractionContinuation> xSelected @@ -1231,9 +1233,10 @@ bool SfxMedium::ShowLockFileProblemDialog(MessageDlg nWhichDlg) break; } - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations(2); - aContinuations[0] = new ::ucbhelper::InteractionAbort(xIgnoreRequestImpl.get()); - aContinuations[1] = new ::ucbhelper::InteractionApprove(xIgnoreRequestImpl.get()); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations{ + new ::ucbhelper::InteractionAbort(xIgnoreRequestImpl.get()), + new ::ucbhelper::InteractionApprove(xIgnoreRequestImpl.get()) + }; xIgnoreRequestImpl->setContinuations(aContinuations); xHandler->handle(xIgnoreRequestImpl); @@ -1693,6 +1696,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempFile ) return pImpl->xStorage; uno::Sequence< uno::Any > aArgs( 2 ); + auto pArgs = aArgs.getArray(); // the medium should be retrieved before temporary file creation // to let the MediaDescriptor be filled with the streams @@ -1720,44 +1724,45 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempFile ) if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) ) xProgressHandler.set( new utl::ProgressHandlerWrap( xStatusIndicator ) ); - uno::Sequence< beans::PropertyValue > aAddProps( 2 ); - aAddProps[0].Name = "RepairPackage"; - aAddProps[0].Value <<= true; - aAddProps[1].Name = "StatusIndicator"; - aAddProps[1].Value <<= xProgressHandler; + uno::Sequence< beans::PropertyValue > aAddProps{ + comphelper::makePropertyValue("RepairPackage", true), + comphelper::makePropertyValue("StatusIndicator", xProgressHandler) + }; // the first arguments will be filled later aArgs.realloc( 3 ); - aArgs[2] <<= aAddProps; + pArgs = aArgs.getArray(); + pArgs[2] <<= aAddProps; } if ( pImpl->xStream.is() ) { // since the storage is based on temporary stream we open it always read-write - aArgs[0] <<= pImpl->xStream; - aArgs[1] <<= embed::ElementModes::READWRITE; + pArgs[0] <<= pImpl->xStream; + pArgs[1] <<= embed::ElementModes::READWRITE; pImpl->bStorageBasedOnInStream = true; if (pImpl->m_bDisableFileSync) { // Forward NoFileSync to the storage factory. - aArgs.realloc(3); + aArgs.realloc(3); // ??? this may re-write the data added above for pRepairItem + pArgs = aArgs.getArray(); uno::Sequence<beans::PropertyValue> aProperties( comphelper::InitPropertySequence({ { "NoFileSync", uno::makeAny(true) } })); - aArgs[2] <<= aProperties; + pArgs[2] <<= aProperties; } } else if ( pImpl->xInputStream.is() ) { // since the storage is based on temporary stream we open it always read-write - aArgs[0] <<= pImpl->xInputStream; - aArgs[1] <<= embed::ElementModes::READ; + pArgs[0] <<= pImpl->xInputStream; + pArgs[1] <<= embed::ElementModes::READ; pImpl->bStorageBasedOnInStream = true; } else { CloseStreams_Impl(); - aArgs[0] <<= pImpl->m_aName; - aArgs[1] <<= embed::ElementModes::READ; + pArgs[0] <<= pImpl->m_aName; + pArgs[1] <<= embed::ElementModes::READ; pImpl->bStorageBasedOnInStream = false; } @@ -1806,7 +1811,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempFile ) else // nVersion > 0; pVersion->GetValue() != 0 was the condition to this block nVersion--; - util::RevisionTag& rTag = pImpl->aVersions[nVersion]; + const util::RevisionTag& rTag = pImpl->aVersions[nVersion]; { // Open SubStorage for all versions uno::Reference < embed::XStorage > xSub = pImpl->xStorage->openStorageElement( "Versions", @@ -3715,7 +3720,7 @@ void SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision ) OUString aRevName = "Version" + OUString::number( nKey + 1 ); pImpl->aVersions.realloc( nLength+1 ); rRevision.Identifier = aRevName; - pImpl->aVersions[nLength] = rRevision; + pImpl->aVersions.getArray()[nLength] = rRevision; } void SfxMedium::RemoveVersion_Impl( const OUString& rName ) @@ -4348,14 +4353,15 @@ bool SfxMedium::CallApproveHandler(const uno::Reference< task::XInteractionHandl try { uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( bAllowAbort ? 2 : 1 ); + auto pContinuations = aContinuations.getArray(); ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); - aContinuations[ 0 ] = pApprove.get(); + pContinuations[ 0 ] = pApprove.get(); if ( bAllowAbort ) { ::rtl::Reference< ::comphelper::OInteractionAbort > pAbort( new ::comphelper::OInteractionAbort ); - aContinuations[ 1 ] = pAbort.get(); + pContinuations[ 1 ] = pAbort.get(); } xHandler->handle(::framework::InteractionRequest::CreateRequest(rRequest, aContinuations)); @@ -4620,11 +4626,10 @@ IMPL_STATIC_LINK(SfxMedium, ShowReloadEditableDialog, void*, p, void) OUString(), uno::Reference<uno::XInterface>(), aDocumentURL))); if (xInteractionRequestImpl != nullptr) { - sal_Int32 nContinuations = 2; - uno::Sequence<uno::Reference<task::XInteractionContinuation>> aContinuations( - nContinuations); - aContinuations[0] = new ::ucbhelper::InteractionAbort(xInteractionRequestImpl.get()); - aContinuations[1] = new ::ucbhelper::InteractionApprove(xInteractionRequestImpl.get()); + uno::Sequence<uno::Reference<task::XInteractionContinuation>> aContinuations{ + new ::ucbhelper::InteractionAbort(xInteractionRequestImpl.get()), + new ::ucbhelper::InteractionApprove(xInteractionRequestImpl.get()) + }; xInteractionRequestImpl->setContinuations(aContinuations); xHandler->handle(xInteractionRequestImpl); ::rtl::Reference<::ucbhelper::InteractionContinuation> xSelected diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index bc2a2b34570c..04c997564405 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -30,6 +30,7 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <ucbhelper/content.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -823,9 +824,7 @@ bool SfxDocumentTemplates::CopyFrom { uno::Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = "Hidden"; - aArgs[0].Value <<= true; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("Hidden", true) }; INetURLObject aTemplURL( rName ); uno::Reference< XDocumentPropertiesSupplier > xDocPropsSupplier; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 7a036226bbec..41aff2bd93c7 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -27,6 +27,7 @@ #include <unotools/pathoptions.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/string.hxx> @@ -699,10 +700,7 @@ bool SfxDocTplService_Impl::addEntry( Content& rParentFolder, if ( ! Content::create( aLinkURL, maCmdEnv, comphelper::getProcessComponentContext(), aLink ) ) { - Sequence< Any > aValues(3); - aValues[0] <<= rTitle; - aValues[1] <<= false; - aValues[2] <<= rTargetURL; + Sequence< Any > aValues{ Any(rTitle), Any(false), Any(rTargetURL) }; try { @@ -742,10 +740,7 @@ bool SfxDocTplService_Impl::createFolder( const OUString& rNewFolderURL, { try { - Sequence< Any > aValues(2); - aValues[0] <<= aFolderName; - aValues[1] <<= true; - + Sequence< Any > aValues{ Any(aFolderName), Any(true) }; OUString aType; if ( bFsysFolder ) @@ -799,10 +794,7 @@ bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const OUString& aPa try { - Sequence< Any > aValues(2); - aValues[0] <<= aTryName; - aValues[1] <<= true; - + Sequence< Any > aValues{ Any(aTryName), Any(true) }; bCreated = aParent.insertNewContent( TYPE_FSYS_FOLDER, { TITLE, IS_FOLDER }, aValues, aNewFolder ); } catch( ucb::NameClashException& ) @@ -859,10 +851,7 @@ OUString SfxDocTplService_Impl::CreateNewUniqueFileWithPrefix( const OUString& a try { - Sequence< Any > aValues(2); - aValues[0] <<= aTryName; - aValues[1] <<= true; - + Sequence< Any > aValues{ Any(aTryName), Any(true) }; bCreated = aParent.insertNewContent( TYPE_FSYS_FILE, { TITLE, IS_DOCUMENT }, aValues, aNewFile ); } catch( ucb::NameClashException& ) @@ -1785,11 +1774,10 @@ bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, } // store template - uno::Sequence< PropertyValue > aStoreArgs( 2 ); - aStoreArgs[0].Name = "FilterName"; - aStoreArgs[0].Value <<= aFilterName; - aStoreArgs[1].Name = "DocumentTitle"; - aStoreArgs[1].Value <<= rTemplateName; + uno::Sequence< PropertyValue > aStoreArgs{ + comphelper::makePropertyValue("FilterName", aFilterName), + comphelper::makePropertyValue("DocumentTitle", rTemplateName) + }; if( !::utl::UCBContentHelper::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() )) rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); diff --git a/sfx2/source/doc/exoticfileloadexception.cxx b/sfx2/source/doc/exoticfileloadexception.cxx index 4993c0640a47..91dc9c273929 100644 --- a/sfx2/source/doc/exoticfileloadexception.cxx +++ b/sfx2/source/doc/exoticfileloadexception.cxx @@ -18,16 +18,13 @@ ExoticFileLoadException::ExoticFileLoadException(const OUString& rURL, const OUString& rFilterUIName) : m_xAbort(new comphelper::OInteractionAbort) , m_xApprove(new comphelper::OInteractionApprove) + , m_lContinuations{ m_xApprove, m_xAbort } { document::ExoticFileLoadException aReq; aReq.URL = rURL; aReq.FilterUIName = rFilterUIName; m_aRequest <<= aReq; - - m_lContinuations.realloc(2); - m_lContinuations[0] = m_xApprove; - m_lContinuations[1] = m_xAbort; } bool ExoticFileLoadException::isApprove() const diff --git a/sfx2/source/doc/exoticfileloadexception.hxx b/sfx2/source/doc/exoticfileloadexception.hxx index 99cb542e2a27..8204d6f55426 100644 --- a/sfx2/source/doc/exoticfileloadexception.hxx +++ b/sfx2/source/doc/exoticfileloadexception.hxx @@ -33,9 +33,9 @@ public: // member private: css::uno::Any m_aRequest; - css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> m_lContinuations; css::uno::Reference<css::task::XInteractionContinuation> m_xAbort; css::uno::Reference<css::task::XInteractionContinuation> m_xApprove; + css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> m_lContinuations; }; #endif diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 6371d10112e4..b309625206a5 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -38,6 +38,7 @@ #include <tools/stream.hxx> #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <o3tl/char16_t2wchar_t.hxx> #include <o3tl/string_view.hxx> @@ -210,18 +211,16 @@ bool GraphicHelper::getThumbnailReplacement_Impl(std::u16string_view rResID, con uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext)); const OUString aURL{OUString::Concat("private:graphicrepository/") + rResID}; - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = "URL"; - aMediaProps[0].Value <<= aURL; + uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue("URL", + aURL) }; uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); if ( xGraphic.is() ) { - uno::Sequence< beans::PropertyValue > aStoreProps( 2 ); - aStoreProps[0].Name = "OutputStream"; - aStoreProps[0].Value <<= xStream; - aStoreProps[1].Name = "MimeType"; - aStoreProps[1].Value <<= OUString("image/png"); + uno::Sequence< beans::PropertyValue > aStoreProps{ + comphelper::makePropertyValue("OutputStream", xStream), + comphelper::makePropertyValue("MimeType", OUString("image/png")) + }; xGraphProvider->storeGraphic( xGraphic, aStoreProps ); bResult = true; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3a2b5a7b3da9..4c50b5e19f27 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -59,6 +59,7 @@ #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/lok.hxx> @@ -1124,10 +1125,10 @@ bool ModelData_Impl::ShowDocumentInfoDialog(const std::function< void () >& aFun 0 ); if ( xDispatch.is() ) { - uno::Sequence< beans::PropertyValue > aProperties(1); uno::Reference< lang::XUnoTunnel > aAsyncFunc(new AsyncFunc(aFunc)); - aProperties[0].Name = "AsyncFunc"; - aProperties[0].Value <<= aAsyncFunc; + uno::Sequence< beans::PropertyValue > aProperties{ + comphelper::makePropertyValue("AsyncFunc", aAsyncFunc) + }; xDispatch->dispatch( aURL, aProperties ); bDialogUsed = true; } diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index eff4588b3b5f..58a387527e4a 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <officecfg/Office/Common.hxx> @@ -184,11 +185,10 @@ sal_Bool SAL_CALL IFrameObject::load( uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( mxContext ) ); xTrans->parseStrict( aTargetURL ); - uno::Sequence < beans::PropertyValue > aProps(2); - aProps[0].Name = "PluginMode"; - aProps[0].Value <<= sal_Int16(2); - aProps[1].Name = "ReadOnly"; - aProps[1].Value <<= true; + uno::Sequence < beans::PropertyValue > aProps{ + comphelper::makePropertyValue("PluginMode", sal_Int16(2)), + comphelper::makePropertyValue("ReadOnly", true) + }; uno::Reference < frame::XDispatch > xDisp = mxFrame->queryDispatch( aTargetURL, "_self", 0 ); if ( xDisp.is() ) xDisp->dispatch( aTargetURL, aProps ); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 07d889a4f47b..da72e53b2118 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1419,8 +1419,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); if ( xProps.is() ) { - Sequence< uno::Any > aArgs( 1 ); - aArgs[ 0 ] = *pCaller; + Sequence< uno::Any > aArgs{ *pCaller }; ... etc. - the rest is truncated