From 92889bc98f4e822715874cb80346d8370e9da8e6 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 11 Jun 2021 13:00:59 +0200 Subject: Simplify Sequences initializations (vbahelper) Change-Id: I9bbcf97acd59e7430758e05ae949f7e494afc704 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117051 Tested-by: Jenkins Reviewed-by: Julien Nabet --- vbahelper/source/msforms/vbalistbox.cxx | 3 +-- vbahelper/source/vbahelper/vbadialogbase.cxx | 3 +-- vbahelper/source/vbahelper/vbashape.cxx | 10 ++-------- vbahelper/source/vbahelper/vbashapes.cxx | 3 +-- 4 files changed, 5 insertions(+), 14 deletions(-) (limited to 'vbahelper/source') diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index 8c2ea52332db..9dcef8a77225 100644 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -81,10 +81,9 @@ ScVbaListBox::setValue( const uno::Any& _value ) if( nValue == -1 ) throw uno::RuntimeException( "Attribute use invalid." ); - uno::Sequence< sal_Int16 > nSelectedIndices(1); + uno::Sequence< sal_Int16 > nSelectedIndices { nValue }; uno::Sequence< sal_Int16 > nOldSelectedIndices; m_xProps->getPropertyValue( "SelectedItems" ) >>= nOldSelectedIndices; - nSelectedIndices[ 0 ] = nValue; m_xProps->setPropertyValue( "SelectedItems", uno::makeAny( nSelectedIndices ) ); if ( nSelectedIndices != nOldSelectedIndices ) fireClickEvent(); diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx index a1aa0b053436..9b9087bd264d 100644 --- a/vbahelper/source/vbahelper/vbadialogbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogbase.cxx @@ -31,8 +31,7 @@ void SAL_CALL VbaDialogBase::Show() if (aURL.isEmpty()) throw uno::RuntimeException("Unable to open the specified dialog"); - uno::Sequence dispatchProps(0); - dispatchRequests(m_xModel, aURL, dispatchProps); + dispatchRequests(m_xModel, aURL, {}); } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx index 8f16865eff8c..67998de7f6f3 100644 --- a/vbahelper/source/vbahelper/vbashape.cxx +++ b/vbahelper/source/vbahelper/vbashape.cxx @@ -389,10 +389,7 @@ ScVbaShape::TextFrame() if( xServiceInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) ) { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Sequence< uno::Any > aArgs(2); - aArgs[0] <<= getParent(); - aArgs[1] <<= m_xShape; - uno::Reference< uno::XInterface > xTextFrame = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "ooo.vba.excel.TextFrame" , aArgs, xContext ); + uno::Reference< uno::XInterface > xTextFrame = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "ooo.vba.excel.TextFrame" , { uno::Any(getParent()), uno::Any(m_xShape) }, xContext ); return uno::makeAny( xTextFrame ); } @@ -726,10 +723,7 @@ ScVbaShape::WrapFormat() if( xServiceInfo->supportsService( "com.sun.star.text.TextDocument" )) { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Sequence< uno::Any > aArgs(2); - aArgs[0] <<= getParent(); - aArgs[1] <<= m_xShape; - uno::Reference< uno::XInterface > xWrapFormat = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "ooo.vba.word.WrapFormat" , aArgs, xContext ); + uno::Reference< uno::XInterface > xWrapFormat = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "ooo.vba.word.WrapFormat" ,{ uno::Any(getParent()), uno::Any(m_xShape) }, xContext ); return uno::makeAny( xWrapFormat ); } throw uno::RuntimeException( "Not implemented" ); diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index c14f81791f95..552365da3861 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -180,8 +180,7 @@ ScVbaShapes::Range( const uno::Any& shapes ) else { // wrap single index into a sequence - uno::Sequence< uno::Any > sIndices(1); - sIndices[ 0 ] = shapes; + uno::Sequence< uno::Any > sIndices { shapes }; uno::Any aIndex; aIndex <<= sIndices; xShapes = getShapesByArrayIndices( aIndex ); -- cgit v1.2.3