diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:24:51 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-01 05:26:08 +0100 |
commit | 2e29906567cef053e608588830ddfb013cb53682 (patch) | |
tree | cae4aa3aaf9f318ceb6f0a80953d6174e494a394 /vcl/source/gdi | |
parent | 1be268f3ec7661be232b8f5dc18546d1410dfd52 (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/embeddedfontshelper.cxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/oldprintadaptor.cxx | 15 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 27 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 65 |
4 files changed, 53 insertions, 57 deletions
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 <sal/config.h> + +#include <comphelper/propertyvalue.hxx> #include <vcl/oldprintadaptor.hxx> #include <vcl/gdimtf.hxx> @@ -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 <comphelper/fileformat.h> #include <comphelper/hash.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -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 <sal/types.h> #include <sal/log.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <tools/diagnose_ex.h> #include <tools/debug.hxx> @@ -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" ); |