From 2e29906567cef053e608588830ddfb013cb53682 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 29 Oct 2021 10:24:51 +0300 Subject: [PATCH] Prepare for removal of non-const operator[] from Sequence in vcl Change-Id: I65f411affcf0340c054d09426483d57c530edb0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124411 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- vcl/osx/DataFlavorMapping.cxx | 2 +- vcl/qa/cppunit/canvasbitmaptest.cxx | 7 +- vcl/qa/cppunit/graphicfilter/filters-test.cxx | 13 ++-- vcl/qt5/QtFilePicker.cxx | 6 +- vcl/qt5/QtTransferable.cxx | 5 +- vcl/source/filter/FilterConfigCache.cxx | 3 +- vcl/source/filter/FilterConfigItem.cxx | 15 ++--- vcl/source/filter/GraphicNativeTransform.cxx | 13 ++-- vcl/source/filter/graphicfilter.cxx | 15 +++-- vcl/source/filter/wmf/wmfexternal.cxx | 17 ++--- vcl/source/gdi/embeddedfontshelper.cxx | 3 +- vcl/source/gdi/oldprintadaptor.cxx | 15 ++--- vcl/source/gdi/pdfwriter_impl2.cxx | 27 ++++---- vcl/source/gdi/print3.cxx | 65 +++++++++---------- vcl/source/helper/canvasbitmap.cxx | 92 +++++++++++---------------- vcl/source/outdev/outdev.cxx | 13 ++-- vcl/source/treelist/transfer.cxx | 5 +- vcl/source/treelist/transfer2.cxx | 3 +- vcl/source/uitest/uno/uiobject_uno.cxx | 19 ++---- vcl/source/window/mouse.cxx | 18 +++--- vcl/source/window/window.cxx | 16 ++--- vcl/unx/generic/dtrans/X11_service.cxx | 3 +- vcl/unx/generic/gdi/salgdi.cxx | 9 +-- vcl/unx/gtk3/a11y/atktextattributes.cxx | 7 +- vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 8 ++- vcl/unx/gtk3/gtkinst.cxx | 6 +- vcl/win/dtrans/DOTransferable.cxx | 2 +- vcl/workben/fftester.cxx | 3 +- 28 files changed, 189 insertions(+), 221 deletions(-) diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx index 1145c77cfa76..274a2b4a4be7 100644 --- a/vcl/osx/DataFlavorMapping.cxx +++ b/vcl/osx/DataFlavorMapping.cxx @@ -744,7 +744,7 @@ css::uno::Sequence DataFlavorMapper::typesArrayTo if (isValidFlavor(oOOFlavor)) { flavors.realloc(flavors.getLength() + 1); - flavors[flavors.getLength() - 1] = oOOFlavor; + flavors.getArray()[flavors.getLength() - 1] = oOOFlavor; } } diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index 10923d8704f2..91a5cfed4bb8 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -606,11 +606,8 @@ public: { if( bPalette ) { - maComponentTags.realloc(1); - maComponentTags[0] = rendering::ColorComponentTag::INDEX; - - maComponentBitCounts.realloc(1); - maComponentBitCounts[0] = 8; + maComponentTags = { rendering::ColorComponentTag::INDEX }; + maComponentBitCounts = { 8 }; } else { diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index ad5c1be8e8a4..22078cf9de65 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -111,13 +112,11 @@ void VclFiltersTest::checkExportImport(std::u16string_view aFilterShortName) SvMemoryStream aStream; aStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); - css::uno::Sequence< css::beans::PropertyValue > aFilterData( 3 ); - aFilterData[ 0 ].Name = "Interlaced"; - aFilterData[ 0 ].Value <<= sal_Int32(0); - aFilterData[ 1 ].Name = "Compression"; - aFilterData[ 1 ].Value <<= sal_Int32(1); - aFilterData[ 2 ].Name = "Quality"; - aFilterData[ 2 ].Value <<= sal_Int32(90); + css::uno::Sequence< css::beans::PropertyValue > aFilterData{ + comphelper::makePropertyValue("Interlaced", sal_Int32(0)), + comphelper::makePropertyValue("Compression", sal_Int32(1)), + comphelper::makePropertyValue("Quality", sal_Int32(90)) + }; sal_uInt16 aFilterType = mpGraphicFilter->GetExportFormatNumberForShortName(aFilterShortName); mpGraphicFilter->ExportGraphic(BitmapEx(aBitmap), OUString(), aStream, aFilterType, &aFilterData ); diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx index de8b5f4601c3..ca80b61ef101 100644 --- a/vcl/qt5/QtFilePicker.cxx +++ b/vcl/qt5/QtFilePicker.cxx @@ -261,6 +261,7 @@ uno::Sequence SAL_CALL QtFilePicker::getSelectedFiles() pSalInst->RunInMainThread([&urls, this]() { urls = m_pFileDialog->selectedUrls(); }); uno::Sequence seq(urls.size()); + auto seqRange = asNonConstRange(seq); auto const trans = css::uri::ExternalUriReferenceTranslator::create(m_context); size_t i = 0; @@ -283,7 +284,7 @@ uno::Sequence SAL_CALL QtFilePicker::getSelectedFiles() SAL_WARN("vcl.qt", "cannot convert <" << extUrl << "> from locale encoding to UTF-8"); intUrl = extUrl; } - seq[i++] = intUrl; + seqRange[i++] = intUrl; } return seq; @@ -379,8 +380,9 @@ uno::Any QtFilePicker::handleGetListValue(const QComboBox* pWidget, sal_Int16 nC case ControlActions::GET_ITEMS: { Sequence aItemList(pWidget->count()); + auto aItemListRange = asNonConstRange(aItemList); for (sal_Int32 i = 0; i < pWidget->count(); ++i) - aItemList[i] = toOUString(pWidget->itemText(i)); + aItemListRange[i] = toOUString(pWidget->itemText(i)); aAny <<= aItemList; break; } diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 737468c0b5a5..a2483b4b5f3a 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -64,6 +64,7 @@ css::uno::Sequence SAL_CALL QtTransferable::getTr const int nMimeTypeSeqSize = aFormatList.size() + 1; bool bHaveNoCharset = false, bHaveUTF16 = false; css::uno::Sequence aMimeTypeSeq(nMimeTypeSeqSize); + auto pMimeTypeSeq = aMimeTypeSeq.getArray(); css::datatransfer::DataFlavor aFlavor; int nMimeTypeCount = 0; @@ -94,7 +95,7 @@ css::uno::Sequence SAL_CALL QtTransferable::getTr aFlavor.MimeType = toOUString(rMimeType); assert(nMimeTypeCount < nMimeTypeSeqSize); - aMimeTypeSeq[nMimeTypeCount] = aFlavor; + pMimeTypeSeq[nMimeTypeCount] = aFlavor; nMimeTypeCount++; } @@ -104,7 +105,7 @@ css::uno::Sequence SAL_CALL QtTransferable::getTr aFlavor.MimeType = "text/plain;charset=utf-16"; aFlavor.DataType = cppu::UnoType::get(); assert(nMimeTypeCount < nMimeTypeSeqSize); - aMimeTypeSeq[nMimeTypeCount] = aFlavor; + pMimeTypeSeq[nMimeTypeCount] = aFlavor; nMimeTypeCount++; } diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 1783b0f35702..64e4e6929dea 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -96,7 +96,6 @@ static Reference< XInterface > openConfig(const char* sPackage) // get access to config API (not to file!) Reference< XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( xContext ); - Sequence< Any > lParams(1); PropertyValue aParam ; // define cfg path for open @@ -105,7 +104,7 @@ static Reference< XInterface > openConfig(const char* sPackage) aParam.Value <<= OUString( "/org.openoffice.TypeDetection.Types/Types" ); if (rtl_str_compareIgnoreAsciiCase(sPackage, "filters") == 0) aParam.Value <<= OUString( "/org.openoffice.TypeDetection.GraphicFilter/Filters" ); - lParams[0] <<= aParam; + Sequence< Any > lParams{ Any(aParam) }; // get access to file xCfg = xConfigProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", lParams); diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx index 7a2e98aba8bb..962d970bf4ab 100644 --- a/vcl/source/filter/FilterConfigItem.cxx +++ b/vcl/source/filter/FilterConfigItem.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -51,12 +52,9 @@ static bool ImpIsTreeAvailable( Reference< XMultiServiceFactory > const & rXCfgP ++nIdx; // creation arguments: nodepath - PropertyValue aPathArgument; - aPathArgument.Name = "nodepath"; - aPathArgument.Value <<= rTree.getToken(0, '/', nIdx); - - Sequence< Any > aArguments( 1 ); - aArguments[ 0 ] <<= aPathArgument; + PropertyValue aPathArgument = comphelper::makePropertyValue("nodepath", + rTree.getToken(0, '/', nIdx)); + Sequence< Any > aArguments{ Any(aPathArgument) }; Reference< XInterface > xReadAccess; try @@ -113,8 +111,7 @@ void FilterConfigItem::ImpInitTree( std::u16string_view rSubTree ) aPathArgument.Name = "nodepath"; aPathArgument.Value <<= sTree; - Sequence< Any > aArguments( 1 ); - aArguments[ 0 ] <<= aPathArgument; + Sequence< Any > aArguments{ Any(aPathArgument) }; try { @@ -242,7 +239,7 @@ bool FilterConfigItem::WritePropertyValue( Sequence< PropertyValue >& rPropSeq, if ( i == nCount ) rPropSeq.realloc( ++nCount ); - rPropSeq[ i ] = rPropValue; + rPropSeq.getArray()[ i ] = rPropValue; bRet = true; } diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index b591217edd91..230e9891e7b7 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include "jpeg/Exif.hxx" #include "jpeg/JpegTransform.hxx" @@ -94,13 +95,11 @@ bool GraphicNativeTransform::rotateGeneric(Degree10 aRotation, std::u16string_vi GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - css::uno::Sequence aFilterData(3); - aFilterData[0].Name = "Interlaced"; - aFilterData[0].Value <<= sal_Int32(0); - aFilterData[1].Name = "Compression"; - aFilterData[1].Value <<= sal_Int32(9); - aFilterData[2].Name = "Quality"; - aFilterData[2].Value <<= sal_Int32(90); + css::uno::Sequence aFilterData{ + comphelper::makePropertyValue("Interlaced", sal_Int32(0)), + comphelper::makePropertyValue("Compression", sal_Int32(9)), + comphelper::makePropertyValue("Quality", sal_Int32(90)) + }; sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(aType); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 24c1ccd66000..add513e1b72e 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -1805,8 +1806,8 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r css::uno::Reference< css::xml::sax::XDocumentHandler > xSaxWriter( css::xml::sax::Writer::create( xContext ), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > aArguments( 1 ); - aArguments[ 0 ] <<= aConfigItem.GetFilterData(); + css::uno::Sequence< css::uno::Any > aArguments{ css::uno::Any( + aConfigItem.GetFilterData()) }; css::uno::Reference< css::svg::XSVGWriter > xSVGWriter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.svg.SVGWriter", aArguments, xContext), css::uno::UNO_QUERY ); @@ -1898,9 +1899,10 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData&, rData, bool ) if (aShortName == PNG_SHORTNAME) { aFilterData.realloc(aFilterData.getLength() + 1); - aFilterData[aFilterData.getLength() - 1].Name = "Compression"; + auto pFilterData = aFilterData.getArray(); + pFilterData[aFilterData.getLength() - 1].Name = "Compression"; // We "know" that this gets passed to zlib's deflateInit2_(). 1 means best speed. - aFilterData[aFilterData.getLength() - 1].Value <<= static_cast(1); + pFilterData[aFilterData.getLength() - 1].Value <<= static_cast(1); } #endif nFormat = GetExportFormatNumberForShortName( aShortName ); @@ -1981,9 +1983,8 @@ ErrCode GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilt ErrCode GraphicFilter::compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream) { - css::uno::Sequence< css::beans::PropertyValue > aFilterData(1); - aFilterData[0].Name = "Compression"; - aFilterData[0].Value <<= sal_uInt32(9); + css::uno::Sequence< css::beans::PropertyValue > aFilterData{ comphelper::makePropertyValue( + "Compression", sal_uInt32(9)) }; sal_uInt16 nFilterFormat = GetExportFormatNumberForShortName(u"PNG"); return ExportGraphic(rGraphic, OUString(), rOutputStream, nFilterFormat, &aFilterData); diff --git a/vcl/source/filter/wmf/wmfexternal.cxx b/vcl/source/filter/wmf/wmfexternal.cxx index cc7dc3b1e972..c5616beac71e 100644 --- a/vcl/source/filter/wmf/wmfexternal.cxx +++ b/vcl/source/filter/wmf/wmfexternal.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include #include @@ -30,20 +33,14 @@ WmfExternal::WmfExternal() css::uno::Sequence WmfExternal::getSequence() const { - css::uno::Sequence aSequence; - if (0 != xExt || 0 != yExt || 0 != mapMode) { - aSequence.realloc(3); - aSequence[0].Name = "Width"; - aSequence[0].Value <<= static_cast(xExt); - aSequence[1].Name = "Height"; - aSequence[1].Value <<= static_cast(yExt); - aSequence[2].Name = "MapMode"; - aSequence[2].Value <<= static_cast(mapMode); + return { comphelper::makePropertyValue("Width", static_cast(xExt)), + comphelper::makePropertyValue("Height", static_cast(yExt)), + comphelper::makePropertyValue("MapMode", static_cast(mapMode)) }; } - return aSequence; + return {}; } bool WmfExternal::setSequence(const css::uno::Sequence& rSequence) diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 846f23262a03..34d227e5f5b2 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -87,10 +87,11 @@ bool EmbeddedFontsHelper::addEmbeddedFont( const uno::Reference< io::XInputStrea { uno::Sequence< sal_Int8 > buffer; sal_uInt64 read = stream->readBytes( buffer, 1024 ); + auto bufferRange = asNonConstRange(buffer); for( sal_uInt64 pos = 0; pos < read && keyPos < key.size(); ++pos ) - buffer[ pos ] ^= key[ keyPos++ ]; + bufferRange[ pos ] ^= key[ keyPos++ ]; // if eot, don't write the file out yet, since we need to unpack it first. if( !eot && read > 0 ) { diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index 6a07eee9b619..599e1a543f3c 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include #include @@ -88,16 +91,10 @@ int OldStylePrintAdaptor::getPageCount() const Sequence< PropertyValue > OldStylePrintAdaptor::getPageParameters( int i_nPage ) const { - Sequence< PropertyValue > aRet( 1 ); - aRet[0].Name = "PageSize"; + css::awt::Size aSize; if( i_nPage < int(mpData->maPages.size() ) ) - aRet[0].Value <<= mpData->maPages[i_nPage].maPageSize; - else - { - awt::Size aEmpty( 0, 0 ); - aRet[0].Value <<= aEmpty; - } - return aRet; + aSize = mpData->maPages[i_nPage].maPageSize; + return { comphelper::makePropertyValue("PageSize", css::uno::Any(aSize)) }; } void OldStylePrintAdaptor::printPage( int i_nPage ) const diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 8d1cc7310da3..c2fb49e84d87 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -203,11 +204,10 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz aAlphaMask = aBitmapEx.GetAlpha(); Graphic aGraphic(BitmapEx(aBitmapEx.GetBitmap())); - Sequence< PropertyValue > aFilterData( 2 ); - aFilterData[ 0 ].Name = "Quality"; - aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality); - aFilterData[ 1 ].Name = "ColorMode"; - aFilterData[ 1 ].Value <<= sal_Int32(0); + Sequence< PropertyValue > aFilterData{ + comphelper::makePropertyValue("Quality", sal_Int32(i_rContext.m_nJPEGQuality)), + comphelper::makePropertyValue("ColorMode", sal_Int32(0)) + }; try { @@ -217,13 +217,11 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz uno::Reference< graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(xContext) ); uno::Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() ); uno::Reference < io::XOutputStream > xOut( xStream->getOutputStream() ); - uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 ); - aOutMediaProperties[0].Name = "OutputStream"; - aOutMediaProperties[0].Value <<= xOut; - aOutMediaProperties[1].Name = "MimeType"; - aOutMediaProperties[1].Value <<= OUString("image/jpeg"); - aOutMediaProperties[2].Name = "FilterData"; - aOutMediaProperties[2].Value <<= aFilterData; + uno::Sequence< beans::PropertyValue > aOutMediaProperties{ + comphelper::makePropertyValue("OutputStream", xOut), + comphelper::makePropertyValue("MimeType", OUString("image/jpeg")), + comphelper::makePropertyValue("FilterData", aFilterData) + }; xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties ); xOut->flush(); if ( !bIsJpeg && xSeekable->getLength() > nZippedFileSize ) @@ -235,9 +233,8 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz pStrm->Seek( STREAM_SEEK_TO_END ); xSeekable->seek( 0 ); - Sequence< PropertyValue > aArgs( 1 ); - aArgs[ 0 ].Name = "InputStream"; - aArgs[ 0 ].Value <<= xStream; + Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue("InputStream", + xStream) }; uno::Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) ); if ( xPropSet.is() ) { diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index dc48e55efa94..f33d59820caa 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1456,12 +1457,13 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert aMergeSet.insert( rPropVal.Name ); css::uno::Sequence< css::beans::PropertyValue > aResult( nResultLen ); - std::copy(i_rMergeList.begin(), i_rMergeList.end(), aResult.getArray()); + auto pResult = aResult.getArray(); + std::copy(i_rMergeList.begin(), i_rMergeList.end(), pResult); int nCur = i_rMergeList.getLength(); for(const css::beans::PropertyValue & rPropVal : mpImplData->maUIProperties) { if( aMergeSet.find( rPropVal.Name ) == aMergeSet.end() ) - aResult[nCur++] = rPropVal; + pResult[nCur++] = rPropVal; } // append IsFirstPage if( aMergeSet.find( "IsFirstPage" ) == aMergeSet.end() ) @@ -1469,7 +1471,7 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert css::beans::PropertyValue aVal; aVal.Name = "IsFirstPage"; aVal.Value <<= mpImplData->mbFirstPage; - aResult[nCur++] = aVal; + pResult[nCur++] = aVal; } // append IsLastPage if( aMergeSet.find( "IsLastPage" ) == aMergeSet.end() ) @@ -1477,7 +1479,7 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert css::beans::PropertyValue aVal; aVal.Name = "IsLastPage"; aVal.Value <<= mpImplData->mbLastPage; - aResult[nCur++] = aVal; + pResult[nCur++] = aVal; } // append IsPrinter if( aMergeSet.find( "IsPrinter" ) == aMergeSet.end() ) @@ -1485,7 +1487,7 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert css::beans::PropertyValue aVal; aVal.Name = "IsPrinter"; aVal.Value <<= true; - aResult[nCur++] = aVal; + pResult[nCur++] = aVal; } aResult.realloc( nCur ); return aResult; @@ -1880,10 +1882,8 @@ void PrinterOptionsHelper::appendPrintUIOptions( css::uno::Sequence< css::beans: { sal_Int32 nIndex = io_rProps.getLength(); io_rProps.realloc( nIndex+1 ); - css::beans::PropertyValue aVal; - aVal.Name = "ExtraPrintUIOptions"; - aVal.Value <<= comphelper::containerToSequence(m_aUIProperties); - io_rProps[ nIndex ] = aVal; + io_rProps.getArray()[ nIndex ] = comphelper::makePropertyValue( + "ExtraPrintUIOptions", comphelper::containerToSequence(m_aUIProperties)); } } @@ -1914,60 +1914,61 @@ css::uno::Any PrinterOptionsHelper::setUIControlOpt(const css::uno::Sequence< OU } css::uno::Sequence< css::beans::PropertyValue > aCtrl( nElements ); + auto pCtrl = aCtrl.getArray(); sal_Int32 nUsed = 0; if( !i_rTitle.isEmpty() ) { - aCtrl[nUsed ].Name = "Text"; - aCtrl[nUsed++].Value <<= i_rTitle; + pCtrl[nUsed ].Name = "Text"; + pCtrl[nUsed++].Value <<= i_rTitle; } if( i_rHelpIds.hasElements() ) { - aCtrl[nUsed ].Name = "HelpId"; - aCtrl[nUsed++].Value <<= i_rHelpIds; + pCtrl[nUsed ].Name = "HelpId"; + pCtrl[nUsed++].Value <<= i_rHelpIds; } - aCtrl[nUsed ].Name = "ControlType"; - aCtrl[nUsed++].Value <<= i_rType; - aCtrl[nUsed ].Name = "ID"; - aCtrl[nUsed++].Value <<= i_rIDs; + pCtrl[nUsed ].Name = "ControlType"; + pCtrl[nUsed++].Value <<= i_rType; + pCtrl[nUsed ].Name = "ID"; + pCtrl[nUsed++].Value <<= i_rIDs; if( i_pVal ) { - aCtrl[nUsed ].Name = "Property"; - aCtrl[nUsed++].Value <<= *i_pVal; + pCtrl[nUsed ].Name = "Property"; + pCtrl[nUsed++].Value <<= *i_pVal; } if( !i_rControlOptions.maDependsOnName.isEmpty() ) { - aCtrl[nUsed ].Name = "DependsOnName"; - aCtrl[nUsed++].Value <<= i_rControlOptions.maDependsOnName; + pCtrl[nUsed ].Name = "DependsOnName"; + pCtrl[nUsed++].Value <<= i_rControlOptions.maDependsOnName; if( i_rControlOptions.mnDependsOnEntry != -1 ) { - aCtrl[nUsed ].Name = "DependsOnEntry"; - aCtrl[nUsed++].Value <<= i_rControlOptions.mnDependsOnEntry; + pCtrl[nUsed ].Name = "DependsOnEntry"; + pCtrl[nUsed++].Value <<= i_rControlOptions.mnDependsOnEntry; } if( i_rControlOptions.mbAttachToDependency ) { - aCtrl[nUsed ].Name = "AttachToDependency"; - aCtrl[nUsed++].Value <<= i_rControlOptions.mbAttachToDependency; + pCtrl[nUsed ].Name = "AttachToDependency"; + pCtrl[nUsed++].Value <<= i_rControlOptions.mbAttachToDependency; } } if( !i_rControlOptions.maGroupHint.isEmpty() ) { - aCtrl[nUsed ].Name = "GroupingHint"; - aCtrl[nUsed++].Value <<= i_rControlOptions.maGroupHint; + pCtrl[nUsed ].Name = "GroupingHint"; + pCtrl[nUsed++].Value <<= i_rControlOptions.maGroupHint; } if( i_rControlOptions.mbInternalOnly ) { - aCtrl[nUsed ].Name = "InternalUIOnly"; - aCtrl[nUsed++].Value <<= true; + pCtrl[nUsed ].Name = "InternalUIOnly"; + pCtrl[nUsed++].Value <<= true; } if( ! i_rControlOptions.mbEnabled ) { - aCtrl[nUsed ].Name = "Enabled"; - aCtrl[nUsed++].Value <<= false; + pCtrl[nUsed ].Name = "Enabled"; + pCtrl[nUsed++].Value <<= false; } sal_Int32 nAddProps = i_rControlOptions.maAddProps.size(); for( sal_Int32 i = 0; i < nAddProps; i++ ) - aCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i]; + pCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i]; SAL_WARN_IF( nUsed != nElements, "vcl.gdi", "nUsed != nElements, probable heap corruption" ); diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index 68bef1b79b77..2eaa16223789 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -173,19 +173,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::ALPHA; - pTags[1] = rendering::ColorComponentTag::RGB_BLUE; - pTags[2] = rendering::ColorComponentTag::RGB_GREEN; - pTags[3] = rendering::ColorComponentTag::RGB_RED; - - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::ALPHA, + /* 1 */ rendering::ColorComponentTag::RGB_BLUE, + /* 2 */ rendering::ColorComponentTag::RGB_GREEN, + /* 3 */ rendering::ColorComponentTag::RGB_RED }; + + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 3; m_nGreenIndex = 2; @@ -200,19 +196,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::ALPHA; - pTags[1] = rendering::ColorComponentTag::RGB_RED; - pTags[2] = rendering::ColorComponentTag::RGB_GREEN; - pTags[3] = rendering::ColorComponentTag::RGB_BLUE; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::ALPHA, + /* 1 */ rendering::ColorComponentTag::RGB_RED, + /* 2 */ rendering::ColorComponentTag::RGB_GREEN, + /* 3 */ rendering::ColorComponentTag::RGB_BLUE }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 1; m_nGreenIndex = 2; @@ -227,19 +219,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::RGB_BLUE; - pTags[1] = rendering::ColorComponentTag::RGB_GREEN; - pTags[2] = rendering::ColorComponentTag::RGB_RED; - pTags[3] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::RGB_BLUE, + /* 1 */ rendering::ColorComponentTag::RGB_GREEN, + /* 2 */ rendering::ColorComponentTag::RGB_RED, + /* 3 */ rendering::ColorComponentTag::ALPHA }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 2; m_nGreenIndex = 1; @@ -254,19 +242,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::RGB_RED; - pTags[1] = rendering::ColorComponentTag::RGB_GREEN; - pTags[2] = rendering::ColorComponentTag::RGB_BLUE; - pTags[3] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::RGB_RED, + /* 1 */ rendering::ColorComponentTag::RGB_GREEN, + /* 2 */ rendering::ColorComponentTag::RGB_BLUE, + /* 3 */ rendering::ColorComponentTag::ALPHA }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 0; m_nGreenIndex = 1; @@ -291,11 +275,9 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : if( m_bPalette ) { - m_aComponentTags.realloc(1); - m_aComponentTags[0] = rendering::ColorComponentTag::INDEX; + m_aComponentTags = { rendering::ColorComponentTag::INDEX }; - m_aComponentBitCounts.realloc(1); - m_aComponentBitCounts[0] = m_nBitsPerInputPixel; + m_aComponentBitCounts = { m_nBitsPerInputPixel }; m_nIndexIndex = 0; } @@ -318,10 +300,10 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : // BMP_FORMAT_32BIT_XX_ARGB formats, duplicate alpha // channels might happen! m_aComponentTags.realloc(m_aComponentTags.getLength()+1); - m_aComponentTags[m_aComponentTags.getLength()-1] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags.getArray()[m_aComponentTags.getLength()-1] = rendering::ColorComponentTag::ALPHA; m_aComponentBitCounts.realloc(m_aComponentBitCounts.getLength()+1); - m_aComponentBitCounts[m_aComponentBitCounts.getLength()-1] = m_aBmpEx.IsAlpha() ? 8 : 1; + m_aComponentBitCounts.getArray()[m_aComponentBitCounts.getLength()-1] = m_aBmpEx.IsAlpha() ? 8 : 1; // always add a full byte to the pixel size, otherwise // pixel packing hell breaks loose. diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 78c4ff97d3bf..1083ff9b0d04 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -829,12 +829,13 @@ com::sun::star::uno::Reference< css::rendering::XCanvas > OutputDevice::ImplGetC 3: XWindow for creating Window (or empty for VirtualDevice) 4: SystemGraphicsData as a streamed Any */ - Sequence< Any > aArg(5); - aArg[ 0 ] <<= reinterpret_cast(this); - aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); - aArg[ 2 ] <<= false; - aArg[ 3 ] <<= Reference< css::awt::XWindow >(); - aArg[ 4 ] = GetSystemGfxDataAny(); + Sequence< Any > aArg{ + Any(reinterpret_cast(this)), + Any(css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight )), + Any(false), + Any(Reference< css::awt::XWindow >()), + GetSystemGfxDataAny() + }; Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 9d6be1feb0c2..35422acc2273 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -655,9 +655,10 @@ bool TransferableHelper::SetString( const OUString& rString, const DataFlavor& r { const OString aByteStr(OUStringToOString(rString, osl_getThreadTextEncoding())); Sequence< sal_Int8 > aSeq( aByteStr.getLength() + 1 ); + auto pSeq = aSeq.getArray(); - memcpy( aSeq.getArray(), aByteStr.getStr(), aByteStr.getLength() ); - aSeq[ aByteStr.getLength() ] = 0; + memcpy( pSeq, aByteStr.getStr(), aByteStr.getLength() ); + pSeq[ aByteStr.getLength() ] = 0; maAny <<= aSeq; } else diff --git a/vcl/source/treelist/transfer2.cxx b/vcl/source/treelist/transfer2.cxx index 9fdeae5071cc..c63770d8a4cc 100644 --- a/vcl/source/treelist/transfer2.cxx +++ b/vcl/source/treelist/transfer2.cxx @@ -499,8 +499,7 @@ Reference GetSystemPrimarySelection() #if USING_X11 // A hack, making the primary selection available as an instance // of the SystemClipboard service on X11: - Sequence< Any > args(1); - args[0] <<= OUString("PRIMARY"); + Sequence< Any > args{ Any(OUString("PRIMARY")) }; xSelection.set(xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.datatransfer.clipboard.SystemClipboard", args, xContext), UNO_QUERY_THROW); #else diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index 2490a48c479b..d64a595442a4 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -9,12 +9,14 @@ #include +#include #include #include #include #include #include "uiobject_uno.hxx" #include +#include #include #include #include @@ -161,13 +163,9 @@ css::uno::Sequence UIObjectUnoObj::getState() SolarMutexGuard aGuard; StringMap aMap = mpObj->get_state(); css::uno::Sequence aProps(aMap.size()); - sal_Int32 i = 0; - for (auto const& elem : aMap) - { - aProps[i].Name = elem.first; - aProps[i].Value <<= elem.second; - ++i; - } + std::transform(aMap.begin(), aMap.end(), aProps.getArray(), + [](auto const& elem) + { return comphelper::makePropertyValue(elem.first, elem.second); }); return aProps; } @@ -185,12 +183,7 @@ css::uno::Sequence UIObjectUnoObj::getChildren() } css::uno::Sequence aRet(aChildren.size()); - sal_Int32 i = 0; - for (auto const& child : aChildren) - { - aRet[i] = child; - ++i; - } + std::copy(aChildren.begin(), aChildren.end(), aRet.getArray()); return aRet; } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index f443509af71d..dc50e3c11233 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -739,27 +739,29 @@ Reference< css::datatransfer::dnd::XDragSource > Window::GetDragSource() if( pEnvData ) { Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); + auto pDragSourceAL = aDragSourceAL.getArray(); + auto pDropTargetAL = aDropTargetAL.getArray(); OUString aDragSourceSN, aDropTargetSN; #if defined(_WIN32) aDragSourceSN = "com.sun.star.datatransfer.dnd.OleDragSource"; aDropTargetSN = "com.sun.star.datatransfer.dnd.OleDropTarget"; - aDragSourceAL[ 1 ] <<= static_cast( reinterpret_cast(pEnvData->hWnd) ); - aDropTargetAL[ 0 ] <<= static_cast( reinterpret_cast(pEnvData->hWnd) ); + pDragSourceAL[ 1 ] <<= static_cast( reinterpret_cast(pEnvData->hWnd) ); + pDropTargetAL[ 0 ] <<= static_cast( reinterpret_cast(pEnvData->hWnd) ); #elif defined MACOSX /* FIXME: macOS specific dnd interface does not exist! * * Using Windows based dnd as a temporary solution */ aDragSourceSN = "com.sun.star.datatransfer.dnd.OleDragSource"; aDropTargetSN = "com.sun.star.datatransfer.dnd.OleDropTarget"; - aDragSourceAL[ 1 ] <<= static_cast( reinterpret_cast(pEnvData->mpNSView) ); - aDropTargetAL[ 0 ] <<= static_cast( reinterpret_cast(pEnvData->mpNSView) ); + pDragSourceAL[ 1 ] <<= static_cast( reinterpret_cast(pEnvData->mpNSView) ); + pDropTargetAL[ 0 ] <<= static_cast( reinterpret_cast(pEnvData->mpNSView) ); #elif USING_X11 aDragSourceSN = "com.sun.star.datatransfer.dnd.X11DragSource"; aDropTargetSN = "com.sun.star.datatransfer.dnd.X11DropTarget"; - aDragSourceAL[ 0 ] <<= Application::GetDisplayConnection(); - aDragSourceAL[ 1 ] <<= pEnvData->aShellWindow; - aDropTargetAL[ 0 ] <<= Application::GetDisplayConnection(); - aDropTargetAL[ 1 ] <<= pEnvData->aShellWindow; + pDragSourceAL[ 0 ] <<= Application::GetDisplayConnection(); + pDragSourceAL[ 1 ] <<= pEnvData->aShellWindow; + pDropTargetAL[ 0 ] <<= Application::GetDisplayConnection(); + pDropTargetAL[ 1 ] <<= pEnvData->aShellWindow; #endif if( !aDragSourceSN.isEmpty() ) mpWindowImpl->mpFrameData->mxDragSource.set( diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 61eea6837924..bfab65f2fa8a 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3707,18 +3707,18 @@ bool Window::IsNativeWidgetEnabled() const Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSpriteCanvas ) const { - Sequence< Any > aArg(5); - // Feed any with operating system's window handle // common: first any is VCL pointer to window (for VCL canvas) - aArg[ 0 ] <<= reinterpret_cast(this); - aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); - aArg[ 2 ] <<= mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop; - aArg[ 3 ] <<= Reference< css::awt::XWindow >( + Sequence< Any > aArg{ + Any(reinterpret_cast(this)), + Any(css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight )), + Any(mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop), + Any(Reference< css::awt::XWindow >( mxOwnerWindow->GetComponentInterface(), - UNO_QUERY ); - aArg[ 4 ] = GetSystemGfxDataAny(); + UNO_QUERY )), + GetSystemGfxDataAny() + }; Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx index c05773dbad80..6738245cde6c 100644 --- a/vcl/unx/generic/dtrans/X11_service.cxx +++ b/vcl/unx/generic/dtrans/X11_service.cxx @@ -55,8 +55,7 @@ css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequenc return SalInstance::CreateClipboard( arguments ); SelectionManager& rManager = SelectionManager::get(); - css::uno::Sequence mgrArgs(1); - mgrArgs[0] <<= Application::GetDisplayConnection(); + css::uno::Sequence mgrArgs{ css::uno::Any(Application::GetDisplayConnection()) }; rManager.initialize(mgrArgs); OUString sel; diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 31567d63461a..43198c579bae 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -561,10 +561,11 @@ cairo::SurfaceSharedPtr X11SalGraphics::CreateBitmapSurface( const OutputDevice& css::uno::Any X11SalGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& /*rSize*/) const { cairo::X11Surface& rXlibSurface=dynamic_cast(*rSurface); - css::uno::Sequence< css::uno::Any > args( 3 ); - args[0] <<= false; // do not call XFreePixmap on it - args[1] <<= sal_Int64(rXlibSurface.getPixmap()->mhDrawable); - args[2] <<= sal_Int32( rXlibSurface.getDepth() ); + css::uno::Sequence< css::uno::Any > args{ + css::uno::Any(false), // do not call XFreePixmap on it + css::uno::Any(sal_Int64(rXlibSurface.getPixmap()->mhDrawable)), + css::uno::Any(sal_Int32( rXlibSurface.getDepth() )) + }; return css::uno::Any(args); } diff --git a/vcl/unx/gtk3/a11y/atktextattributes.cxx b/vcl/unx/gtk3/a11y/atktextattributes.cxx index 31c5ebd3585b..f73d79aefe3f 100644 --- a/vcl/unx/gtk3/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk3/a11y/atktextattributes.cxx @@ -1351,6 +1351,7 @@ attribute_set_map_to_property_values( { // Ensure enough space .. uno::Sequence< beans::PropertyValue > aAttributeList (SAL_N_ELEMENTS(g_TextAttrMap)); + auto pAttributeList = aAttributeList.getArray(); sal_Int32 nIndex = 0; for( GSList * item = attribute_set; item != nullptr; item = g_slist_next( item ) ) @@ -1362,11 +1363,11 @@ attribute_set_map_to_property_values( { if( g_TextAttrMap[text_attr].name[0] != '\0' ) { - if( ! g_TextAttrMap[text_attr].toPropertyValue( aAttributeList[nIndex].Value, attribute->value) ) + if( ! g_TextAttrMap[text_attr].toPropertyValue( pAttributeList[nIndex].Value, attribute->value) ) return false; - aAttributeList[nIndex].Name = OUString::createFromAscii( g_TextAttrMap[text_attr].name ); - aAttributeList[nIndex].State = beans::PropertyState_DIRECT_VALUE; + pAttributeList[nIndex].Name = OUString::createFromAscii( g_TextAttrMap[text_attr].name ); + pAttributeList[nIndex].State = beans::PropertyState_DIRECT_VALUE; ++nIndex; } } diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index d0d852e99d5d..8c0e638d024b 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -749,6 +749,7 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSelectedFiles() GTK_FILE_CHOOSER( m_pDialog )); uno::Sequence< OUString > aSelectedFiles(nCount); + auto aSelectedFilesRange = asNonConstRange(aSelectedFiles); // Convert to OOo #if !GTK_CHECK_VERSION(4, 0, 0) @@ -761,7 +762,7 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSelectedFiles() gchar *pURI = g_file_get_uri(static_cast(pElem)); #endif - aSelectedFiles[ nIndex ] = uritounicode(pURI); + aSelectedFilesRange[ nIndex ] = uritounicode(pURI); if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction ) { @@ -861,7 +862,7 @@ uno::Sequence SAL_CALL SalGtkFilePicker::getSelectedFiles() { //if the filename does not already have the auto extension, stick it on OUString sExtension = "." + sToken; - OUString &rBase = aSelectedFiles[nIndex]; + OUString &rBase = aSelectedFilesRange[nIndex]; sal_Int32 nExtensionIdx = rBase.getLength() - sExtension.getLength(); SAL_INFO( "vcl.gtk", @@ -1248,12 +1249,13 @@ uno::Any SalGtkFilePicker::HandleGetListValue(GtkComboBox *pWidget, sal_Int16 nC pTree, nullptr); aItemList.realloc(nSize); + auto pItemList = aItemList.getArray(); for (sal_Int32 i=0; i < nSize; ++i) { gchar *item; gtk_tree_model_get(gtk_combo_box_get_model(pWidget), &iter, 0, &item, -1); - aItemList[i] = OUString(item, strlen(item), RTL_TEXTENCODING_UTF8); + pItemList[i] = OUString(item, strlen(item), RTL_TEXTENCODING_UTF8); g_free(item); (void)gtk_tree_model_iter_next(pTree, &iter); } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 504172208e74..30fda52e5c79 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -4605,10 +4606,9 @@ namespace SvMemoryStream aMemStm; - css::uno::Sequence aFilterData(1); - aFilterData[0].Name = "Compression"; // We "know" that this gets passed to zlib's deflateInit2_(). 1 means best speed. - aFilterData[0].Value <<= sal_Int32(1); + css::uno::Sequence aFilterData{ comphelper::makePropertyValue( + "Compression", sal_Int32(1)) }; vcl::PNGWriter aWriter(aImage.GetBitmapEx(), &aFilterData); aWriter.Write(aMemStm); diff --git a/vcl/win/dtrans/DOTransferable.cxx b/vcl/win/dtrans/DOTransferable.cxx index 7b9f28203d7e..363601d7a0d7 100644 --- a/vcl/win/dtrans/DOTransferable.cxx +++ b/vcl/win/dtrans/DOTransferable.cxx @@ -367,7 +367,7 @@ void CDOTransferable::addSupportedFlavor( const DataFlavor& aFlavor ) OSL_ASSERT( isValidFlavor( aFlavor ) ); m_FlavorList.realloc( m_FlavorList.getLength( ) + 1 ); - m_FlavorList[m_FlavorList.getLength( ) - 1] = aFlavor; + m_FlavorList.getArray()[m_FlavorList.getLength( ) - 1] = aFlavor; } } diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index f700b0660f0f..218909dde6c7 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -129,8 +129,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // initialise unconfigured UCB: css::uno::Reference xUcb(comphelper::getProcessServiceFactory()-> createInstance("com.sun.star.ucb.UniversalContentBroker"), css::uno::UNO_QUERY_THROW); - css::uno::Sequence aArgs(1); - aArgs[0] <<= OUString("NoConfig"); + css::uno::Sequence aArgs{ css::uno::Any(OUString("NoConfig")) }; css::uno::Reference xFileProvider(comphelper::getProcessServiceFactory()-> createInstanceWithArguments("com.sun.star.ucb.FileContentProvider", aArgs), css::uno::UNO_QUERY_THROW); xUcb->registerContentProvider(xFileProvider, "file", true); -- 2.11.4.GIT