From e3d1fb97fcdff75424d4a116f29e8550f94f8a42 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 29 Oct 2021 09:34:44 +0300 Subject: Prepare for removal of non-const operator[] from Sequence in embeddedobj Change-Id: I19432a1e506526fdc1cd98625d9cfff12ea2f973 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124361 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- embeddedobj/source/commonembedding/embedobj.cxx | 4 +- embeddedobj/source/commonembedding/miscobj.cxx | 46 ++++---- embeddedobj/source/commonembedding/persistence.cxx | 125 +++++++++------------ embeddedobj/source/general/docholder.cxx | 48 ++++---- embeddedobj/source/general/dummyobject.cxx | 5 +- embeddedobj/source/general/intercept.cxx | 37 +++--- embeddedobj/source/inc/intercept.hxx | 2 +- embeddedobj/source/msole/graphconvert.cxx | 15 ++- embeddedobj/source/msole/olecomponent.cxx | 39 ++++--- embeddedobj/source/msole/oleembed.cxx | 38 +++---- embeddedobj/source/msole/olepersist.cxx | 43 ++++--- embeddedobj/source/msole/ownview.cxx | 37 +++--- embeddedobj/source/msole/xdialogcreator.cxx | 13 +-- 13 files changed, 203 insertions(+), 249 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 0b1154394651..223f25e6302c 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -193,8 +193,8 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) else { // objects without persistence will be initialized internally - uno::Sequence < uno::Any > aArgs(1); - aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( this ); + uno::Sequence < uno::Any > aArgs{ uno::Any( + uno::Reference < embed::XEmbeddedObject >( this )) }; uno::Reference< util::XCloseable > xDocument( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( GetDocumentServiceName(), aArgs, m_xContext), uno::UNO_QUERY ); diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 1e107e36c491..9c24185ed184 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -42,6 +42,8 @@ #include "persistence.hxx" +#include + using namespace ::com::sun::star; @@ -123,13 +125,12 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa throw uno::RuntimeException(); // something goes really wrong // accepted states - m_aAcceptedStates.realloc( NUM_SUPPORTED_STATES ); - - m_aAcceptedStates[0] = embed::EmbedStates::LOADED; - m_aAcceptedStates[1] = embed::EmbedStates::RUNNING; - m_aAcceptedStates[2] = embed::EmbedStates::INPLACE_ACTIVE; - m_aAcceptedStates[3] = embed::EmbedStates::UI_ACTIVE; - m_aAcceptedStates[4] = embed::EmbedStates::ACTIVE; + m_aAcceptedStates = { /* [0] */ embed::EmbedStates::LOADED, + /* [1] */ embed::EmbedStates::RUNNING, + /* [2] */ embed::EmbedStates::INPLACE_ACTIVE, + /* [3] */ embed::EmbedStates::UI_ACTIVE, + /* [4] */ embed::EmbedStates::ACTIVE }; + assert(m_aAcceptedStates.getLength() == NUM_SUPPORTED_STATES); // intermediate states @@ -141,31 +142,23 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa // state to the target state is forbidden, only if direct switch is possible // the state can be reached. - m_pIntermediateStatesSeqs[0][2].realloc( 1 ); - m_pIntermediateStatesSeqs[0][2][0] = embed::EmbedStates::RUNNING; + m_pIntermediateStatesSeqs[0][2] = { embed::EmbedStates::RUNNING }; - m_pIntermediateStatesSeqs[0][3].realloc( 2 ); - m_pIntermediateStatesSeqs[0][3][0] = embed::EmbedStates::RUNNING; - m_pIntermediateStatesSeqs[0][3][1] = embed::EmbedStates::INPLACE_ACTIVE; + m_pIntermediateStatesSeqs[0][3] = { embed::EmbedStates::RUNNING, + embed::EmbedStates::INPLACE_ACTIVE }; - m_pIntermediateStatesSeqs[0][4].realloc( 1 ); - m_pIntermediateStatesSeqs[0][4][0] = embed::EmbedStates::RUNNING; + m_pIntermediateStatesSeqs[0][4] = {embed::EmbedStates::RUNNING}; - m_pIntermediateStatesSeqs[1][3].realloc( 1 ); - m_pIntermediateStatesSeqs[1][3][0] = embed::EmbedStates::INPLACE_ACTIVE; + m_pIntermediateStatesSeqs[1][3] = { embed::EmbedStates::INPLACE_ACTIVE }; - m_pIntermediateStatesSeqs[2][0].realloc( 1 ); - m_pIntermediateStatesSeqs[2][0][0] = embed::EmbedStates::RUNNING; + m_pIntermediateStatesSeqs[2][0] = { embed::EmbedStates::RUNNING }; - m_pIntermediateStatesSeqs[3][0].realloc( 2 ); - m_pIntermediateStatesSeqs[3][0][0] = embed::EmbedStates::INPLACE_ACTIVE; - m_pIntermediateStatesSeqs[3][0][1] = embed::EmbedStates::RUNNING; + m_pIntermediateStatesSeqs[3][0] = { embed::EmbedStates::INPLACE_ACTIVE, + embed::EmbedStates::RUNNING }; - m_pIntermediateStatesSeqs[3][1].realloc( 1 ); - m_pIntermediateStatesSeqs[3][1][0] = embed::EmbedStates::INPLACE_ACTIVE; + m_pIntermediateStatesSeqs[3][1] = { embed::EmbedStates::INPLACE_ACTIVE }; - m_pIntermediateStatesSeqs[4][0].realloc( 1 ); - m_pIntermediateStatesSeqs[4][0][0] = embed::EmbedStates::RUNNING; + m_pIntermediateStatesSeqs[4][0] = { embed::EmbedStates::RUNNING }; // verbs table for ( auto const & verb : std::as_const(m_aObjectVerbs) ) @@ -257,11 +250,12 @@ void OCommonEmbeddedObject::LinkInit_Impl( if(m_aLinkTempFile.is()) { uno::Sequence< beans::PropertyValue > aAlternativeMediaDescr(aMediaDescr.getLength()); + auto aAlternativeMediaDescrRange = asNonConstRange(aAlternativeMediaDescr); for ( sal_Int32 a(0); a < aMediaDescr.getLength(); a++ ) { const beans::PropertyValue& rSource(aMediaDescr[a]); - beans::PropertyValue& rDestination(aAlternativeMediaDescr[a]); + beans::PropertyValue& rDestination(aAlternativeMediaDescrRange[a]); rDestination.Name = rSource.Name; if(rSource.Name == "URL") diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 7d7ec8aa8a57..2ed891d33ced 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -82,7 +83,7 @@ uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( const uno::Sequence< || (prop.Name == "DocumentBaseURL" && bCanUseDocumentBaseURL) ) { aResult.realloc( ++nResLen ); - aResult[nResLen-1] = prop; + aResult.getArray()[nResLen-1] = prop; } } @@ -94,25 +95,23 @@ static uno::Sequence< beans::PropertyValue > addAsTemplate( const uno::Sequence< { bool bAsTemplateSet = false; sal_Int32 nLength = aOrig.getLength(); - uno::Sequence< beans::PropertyValue > aResult( nLength ); + uno::Sequence< beans::PropertyValue > aResult( aOrig ); for ( sal_Int32 nInd = 0; nInd < nLength; nInd++ ) { - aResult[nInd].Name = aOrig[nInd].Name; if ( aResult[nInd].Name == "AsTemplate" ) { - aResult[nInd].Value <<= true; + aResult.getArray()[nInd].Value <<= true; bAsTemplateSet = true; } - else - aResult[nInd].Value = aOrig[nInd].Value; } if ( !bAsTemplateSet ) { aResult.realloc( nLength + 1 ); - aResult[nLength].Name = "AsTemplate"; - aResult[nLength].Value <<= true; + auto pResult = aResult.getArray(); + pResult[nLength].Name = "AsTemplate"; + pResult[nLength].Value <<= true; } return aResult; @@ -131,9 +130,8 @@ static uno::Reference< io::XInputStream > createTempInpStreamFromStor( uno::Reference < lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create(xContext) ); - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xTempStream; - aArgs[1] <<= embed::ElementModes::READWRITE; + uno::Sequence< uno::Any > aArgs{ uno::Any(xTempStream), + uno::Any(embed::ElementModes::READWRITE) }; uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW ); @@ -223,9 +221,7 @@ static void SetDocToEmbedded( const uno::Reference< frame::XModel >& rDocument, if (!rDocument.is()) return; - uno::Sequence< beans::PropertyValue > aSeq( 1 ); - aSeq[0].Name = "SetEmbedded"; - aSeq[0].Value <<= true; + uno::Sequence< beans::PropertyValue > aSeq{ comphelper::makePropertyValue("SetEmbedded", true) }; rDocument->attachResource( OUString(), aSeq ); if ( !aModuleName.isEmpty() ) @@ -370,30 +366,29 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW ); - sal_Int32 nLen = 2; - uno::Sequence< beans::PropertyValue > aArgs( nLen ); + sal_Int32 nLen = m_bLinkHasPassword ? 3 : 2; + uno::Sequence< beans::PropertyValue > aArgs( m_aDocMediaDescriptor.getLength() + nLen ); + auto pArgs = aArgs.getArray(); - aArgs[0].Name = "URL"; + pArgs[0].Name = "URL"; if(m_aLinkTempFile.is()) - aArgs[0].Value <<= m_aLinkTempFile->getUri(); + pArgs[0].Value <<= m_aLinkTempFile->getUri(); else - aArgs[0].Value <<= m_aLinkURL; + pArgs[0].Value <<= m_aLinkURL; - aArgs[1].Name = "FilterName"; - aArgs[1].Value <<= m_aLinkFilterName; + pArgs[1].Name = "FilterName"; + pArgs[1].Value <<= m_aLinkFilterName; if ( m_bLinkHasPassword ) { - aArgs.realloc( ++nLen ); - aArgs[nLen-1].Name = "Password"; - aArgs[nLen-1].Value <<= m_aLinkPassword; + pArgs[2].Name = "Password"; + pArgs[2].Value <<= m_aLinkPassword; } - aArgs.realloc( m_aDocMediaDescriptor.getLength() + nLen ); for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) { - aArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name; - aArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value; + pArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name; + pArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value; } try @@ -595,15 +590,12 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr if ( aFilterName.isEmpty() ) throw io::IOException("No filter name provided / Wrong document service name"); // TODO: - uno::Sequence< beans::PropertyValue > aArgs( 4 ); - aArgs[0].Name = "FilterName"; - aArgs[0].Value <<= aFilterName; - aArgs[1].Name = "OutputStream"; - aArgs[1].Value <<= xTempOut; - aArgs[2].Name = "DocumentBaseURL"; - aArgs[2].Value <<= aBaseURL; - aArgs[3].Name = "HierarchicalDocumentName"; - aArgs[3].Value <<= aHierarchName; + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue("FilterName", aFilterName), + comphelper::makePropertyValue("OutputStream", xTempOut), + comphelper::makePropertyValue("DocumentBaseURL", aBaseURL), + comphelper::makePropertyValue("HierarchicalDocumentName", aHierarchName) + }; xStorable->storeToURL( "private:stream", aArgs ); try @@ -776,17 +768,15 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: - uno::Sequence aArgs(5); - aArgs[0].Name = "FilterName"; - aArgs[0].Value <<= aFilterName; - aArgs[1].Name = "HierarchicalDocumentName"; - aArgs[1].Value <<= aHierarchName; - aArgs[2].Name = "DocumentBaseURL"; - aArgs[2].Value <<= aBaseURL; - aArgs[3].Name = "SourceShellID"; - aArgs[3].Value <<= getStringPropertyValue(rObjArgs, u"SourceShellID"); - aArgs[4].Name = "DestinationShellID"; - aArgs[4].Value <<= getStringPropertyValue(rObjArgs, u"DestinationShellID"); + uno::Sequence aArgs{ + comphelper::makePropertyValue("FilterName", aFilterName), + comphelper::makePropertyValue("HierarchicalDocumentName", aHierarchName), + comphelper::makePropertyValue("DocumentBaseURL", aBaseURL), + comphelper::makePropertyValue("SourceShellID", + getStringPropertyValue(rObjArgs, u"SourceShellID")), + comphelper::makePropertyValue( + "DestinationShellID", getStringPropertyValue(rObjArgs, u"DestinationShellID")) + }; xDoc->storeToStorage( xStorage, aArgs ); if ( bAttachToTheStorage ) @@ -802,8 +792,7 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( // open storage based on document temporary file for reading uno::Reference < lang::XSingleServiceFactory > xStorageFactory = embed::StorageFactory::create(m_xContext); - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= xTempIn; + uno::Sequence< uno::Any > aArgs{ uno::Any(xTempIn) }; uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW ); @@ -891,27 +880,19 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateTempDocFromLink_ SAL_WARN_IF( aTempFileURL.isEmpty(), "embeddedobj.common", "Couldn't retrieve temporary file URL!" ); - aTempMediaDescr[0].Name = "URL"; - aTempMediaDescr[0].Value <<= aTempFileURL; - aTempMediaDescr[1].Name = "InputStream"; - aTempMediaDescr[1].Value <<= xTempStream; - aTempMediaDescr[2].Name = "FilterName"; - aTempMediaDescr[2].Value <<= GetFilterName( nStorageFormat ); - aTempMediaDescr[3].Name = "AsTemplate"; - aTempMediaDescr[3].Value <<= true; + aTempMediaDescr + = { comphelper::makePropertyValue("URL", aTempFileURL), + comphelper::makePropertyValue("InputStream", xTempStream), + comphelper::makePropertyValue("FilterName", GetFilterName( nStorageFormat )), + comphelper::makePropertyValue("AsTemplate", true) }; } else { - aTempMediaDescr.realloc( 2 ); - aTempMediaDescr[0].Name = "URL"; - - // tdf#141529 use URL of the linked TempFile if it exists - aTempMediaDescr[0].Value <<= m_aLinkTempFile.is() - ? m_aLinkTempFile->getUri() - : m_aLinkURL; - - aTempMediaDescr[1].Name = "FilterName"; - aTempMediaDescr[1].Value <<= m_aLinkFilterName; + aTempMediaDescr = { comphelper::makePropertyValue( + "URL", + // tdf#141529 use URL of the linked TempFile if it exists + m_aLinkTempFile.is() ? m_aLinkTempFile->getUri() : m_aLinkURL), + comphelper::makePropertyValue("FilterName", m_aLinkFilterName) }; } xResult = CreateDocFromMediaDescr_Impl( aTempMediaDescr ); @@ -1619,9 +1600,8 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn() aGuard.clear(); uno::Sequence aEmpty; - uno::Sequence aMediaArgs(1); - aMediaArgs[0].Name = "DocumentBaseURL"; - aMediaArgs[0].Value <<= GetBaseURL_Impl(); + uno::Sequence aMediaArgs{ comphelper::makePropertyValue( + "DocumentBaseURL", GetBaseURL_Impl()) }; StoreDocToStorage_Impl( m_xObjectStorage, aMediaArgs, aEmpty, nStorageFormat, m_aEntryName, true ); aGuard.reset(); } @@ -1715,9 +1695,8 @@ void SAL_CALL OCommonEmbeddedObject::reload( m_aLinkFilterName = aNewLinkFilter; else { - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "URL"; - aArgs[0].Value <<= m_aLinkURL; + uno::Sequence< beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + "URL", m_aLinkURL) }; m_aLinkFilterName = aHelper.UpdateMediaDescriptorWithFilterName( aArgs, false ); } } diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 66a2290ab639..13e40cf92516 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -110,35 +110,38 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& uno::Sequence< beans::PropertyValue > aSourceProps; xSourceMenu->getByIndex( nSourceIndex ) >>= aSourceProps; uno::Sequence< beans::PropertyValue > aTargetProps( aSourceProps.getLength() ); + auto aTargetPropsRange = asNonConstRange(aTargetProps); for ( nInd = 0; nInd < aSourceProps.getLength(); nInd++ ) { - aTargetProps[nInd].Name = aSourceProps[nInd].Name; + aTargetPropsRange[nInd].Name = aSourceProps[nInd].Name; if ( !aContModuleName.isEmpty() && aTargetProps[nInd].Name == aModuleIdentPropName ) { - aTargetProps[nInd].Value <<= aContModuleName; + aTargetPropsRange[nInd].Value <<= aContModuleName; bModuleNameSet = true; } else if ( aTargetProps[nInd].Name == aDispProvPropName ) { - aTargetProps[nInd].Value <<= xSourceDisp; + aTargetPropsRange[nInd].Value <<= xSourceDisp; bDispProvSet = true; } else - aTargetProps[nInd].Value = aSourceProps[nInd].Value; + aTargetPropsRange[nInd].Value = aSourceProps[nInd].Value; } if ( !bModuleNameSet && !aContModuleName.isEmpty() ) { aTargetProps.realloc( ++nInd ); - aTargetProps[nInd-1].Name = aModuleIdentPropName; - aTargetProps[nInd-1].Value <<= aContModuleName; + auto pTargetProps = aTargetProps.getArray(); + pTargetProps[nInd-1].Name = aModuleIdentPropName; + pTargetProps[nInd-1].Value <<= aContModuleName; } if ( !bDispProvSet && xSourceDisp.is() ) { aTargetProps.realloc( ++nInd ); - aTargetProps[nInd-1].Name = aDispProvPropName; - aTargetProps[nInd-1].Value <<= xSourceDisp; + auto pTargetProps = aTargetProps.getArray(); + pTargetProps[nInd-1].Name = aDispProvPropName; + pTargetProps[nInd-1].Value <<= xSourceDisp; } xTargetMenu->insertByIndex( nTargetIndex, uno::makeAny( aTargetProps ) ); @@ -156,17 +159,6 @@ DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >& m_nNoBorderResizeReact( 0 ), m_nNoResizeReact( 0 ) { - m_aOutplaceFrameProps.realloc( 3 ); - beans::NamedValue aArg; - - aArg.Name = "TopWindow"; - aArg.Value <<= true; - m_aOutplaceFrameProps[0] <<= aArg; - - aArg.Name = "MakeVisible"; - aArg.Value <<= false; - m_aOutplaceFrameProps[1] <<= aArg; - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); osl_atomic_increment(&m_refCount); try @@ -178,9 +170,10 @@ DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >& } osl_atomic_decrement(&m_refCount); - aArg.Name = "ParentFrame"; - aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame - m_aOutplaceFrameProps[2] <<= aArg; + m_aOutplaceFrameProps = { uno::Any(beans::NamedValue{ "TopWindow", uno::Any(true) }), + uno::Any(beans::NamedValue{ "MakeVisible", uno::Any(false) }), + //TODO/LATER: should use parent document frame + uno::Any(beans::NamedValue{ "ParentFrame", uno::Any(xDesktop) }) }; } @@ -430,26 +423,25 @@ bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xPar uno::Reference< awt::XWindowPeer > xNewWinPeer = xToolkit->createWindow( aOwnWinDescriptor ); uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XFrame > xContFrame( xContDisp, uno::UNO_QUERY ); // create a frame based on the specified window uno::Reference< lang::XSingleServiceFactory > xFrameFact = frame::TaskCreator::create(m_xContext); - uno::Sequence< uno::Any > aArgs( 2 ); + uno::Sequence< uno::Any > aArgs( xContFrame.is() ? 2 : 1 ); + auto pArgs = aArgs.getArray(); beans::NamedValue aArg; aArg.Name = "ContainerWindow"; aArg.Value <<= xOwnWindow; - aArgs[0] <<= aArg; + pArgs[0] <<= aArg; - uno::Reference< frame::XFrame > xContFrame( xContDisp, uno::UNO_QUERY ); if ( xContFrame.is() ) { aArg.Name = "ParentFrame"; aArg.Value <<= xContFrame; - aArgs[1] <<= aArg; + pArgs[1] <<= aArg; } - else - aArgs.realloc( 1 ); // the call will create, initialize the frame, and register it in the parent m_xFrame.set( xFrameFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW ); diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index d37d74c524d3..8cf2bd1db489 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -114,10 +114,7 @@ uno::Sequence< sal_Int32 > SAL_CALL ODummyEmbeddedObject::getReachableStates() ::osl::MutexGuard aGuard( m_aMutex ); CheckInit_WrongState(); - uno::Sequence< sal_Int32 > aResult( 1 ); - aResult[0] = embed::EmbedStates::LOADED; - - return aResult; + return { embed::EmbedStates::LOADED }; } diff --git a/embeddedobj/source/general/intercept.cxx b/embeddedobj/source/general/intercept.cxx index 6e5f9099735c..68e9af7e4334 100644 --- a/embeddedobj/source/general/intercept.cxx +++ b/embeddedobj/source/general/intercept.cxx @@ -26,9 +26,13 @@ using namespace ::com::sun::star; -#define IUL 6 - -uno::Sequence< OUString > Interceptor::m_aInterceptedURL(IUL); +constexpr OUStringLiteral IU0 = u".uno:Save"; +constexpr OUStringLiteral IU1 = u".uno:SaveAll"; +constexpr OUStringLiteral IU2 = u".uno:CloseDoc"; +constexpr OUStringLiteral IU3 = u".uno:CloseWin"; +constexpr OUStringLiteral IU4 = u".uno:CloseFrame"; +constexpr OUStringLiteral IU5 = u".uno:SaveAs"; +const uno::Sequence< OUString > Interceptor::m_aInterceptedURL{ IU0, IU1, IU2, IU3, IU4, IU5 }; class StatusChangeListenerContainer : public comphelper::OMultiTypeInterfaceContainerHelperVar2 @@ -49,12 +53,6 @@ void Interceptor::DisconnectDocHolder() Interceptor::Interceptor( DocumentHolder* pDocHolder ) : m_pDocHolder( pDocHolder ) { - m_aInterceptedURL[0] = ".uno:Save"; - m_aInterceptedURL[1] = ".uno:SaveAll"; - m_aInterceptedURL[2] = ".uno:CloseDoc"; - m_aInterceptedURL[3] = ".uno:CloseWin"; - m_aInterceptedURL[4] = ".uno:CloseFrame"; - m_aInterceptedURL[5] = ".uno:SaveAs"; } Interceptor::~Interceptor() @@ -94,7 +92,7 @@ Interceptor::dispatch( { if ( aNewArgs[nInd].Name == "SaveTo" ) { - aNewArgs[nInd].Value <<= true; + aNewArgs.getArray()[nInd].Value <<= true; break; } nInd++; @@ -103,8 +101,9 @@ Interceptor::dispatch( if ( nInd == aNewArgs.getLength() ) { aNewArgs.realloc( nInd + 1 ); - aNewArgs[nInd].Name = "SaveTo"; - aNewArgs[nInd].Value <<= true; + auto pNewArgs = aNewArgs.getArray(); + pNewArgs[nInd].Name = "SaveTo"; + pNewArgs[nInd].Value <<= true; } uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch( @@ -257,20 +256,20 @@ Interceptor::queryDispatches( aRet = m_xSlaveDispatchProvider->queryDispatches(Requests); else aRet.realloc(Requests.getLength()); - + auto aRetRange = asNonConstRange(aRet); for(sal_Int32 i = 0; i < Requests.getLength(); ++i) if(m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete) - aRet[i] = static_cast(this); + aRetRange[i] = static_cast(this); else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete) - aRet[i] = nullptr; + aRetRange[i] = nullptr; else if(m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete) - aRet[i] = static_cast(this); + aRetRange[i] = static_cast(this); else if(m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete) - aRet[i] = static_cast(this); + aRetRange[i] = static_cast(this); else if(m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete) - aRet[i] = static_cast(this); + aRetRange[i] = static_cast(this); else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete) - aRet[i] = static_cast(this); + aRetRange[i] = static_cast(this); return aRet; } diff --git a/embeddedobj/source/inc/intercept.hxx b/embeddedobj/source/inc/intercept.hxx index 8dc0f843959a..2dc14738abe8 100644 --- a/embeddedobj/source/inc/intercept.hxx +++ b/embeddedobj/source/inc/intercept.hxx @@ -109,7 +109,7 @@ private: css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatchProvider; css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatchProvider; - static css::uno::Sequence< OUString > m_aInterceptedURL; + static const css::uno::Sequence< OUString > m_aInterceptedURL; std::unique_ptr m_pStatCL; }; diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx index f5de2b35824d..cadc1f946de9 100644 --- a/embeddedobj/source/msole/graphconvert.cxx +++ b/embeddedobj/source/msole/graphconvert.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -65,19 +66,17 @@ bool ConvertBufferToFormat( void* pBuf, try { uno::Reference < graphic::XGraphicProvider > xGraphicProvider( graphic::GraphicProvider::create(comphelper::getProcessComponentContext())); - uno::Sequence< beans::PropertyValue > aMediaProperties( 1 ); - aMediaProperties[0].Name = "InputStream"; - aMediaProperties[0].Value <<= xIn; + uno::Sequence< beans::PropertyValue > aMediaProperties{ comphelper::makePropertyValue( + "InputStream", xIn) }; uno::Reference< graphic::XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ) ); if( xGraphic.is() ) { SvMemoryStream aNewStream( 65535, 65535 ); uno::Reference < io::XStream > xOut = new utl::OStreamWrapper( aNewStream ); - uno::Sequence< beans::PropertyValue > aOutMediaProperties( 2 ); - aOutMediaProperties[0].Name = "OutputStream"; - aOutMediaProperties[0].Value <<= xOut; - aOutMediaProperties[1].Name = "MimeType"; - aOutMediaProperties[1].Value <<= aMimeType; + uno::Sequence< beans::PropertyValue > aOutMediaProperties{ + comphelper::makePropertyValue("OutputStream", xOut), + comphelper::makePropertyValue("MimeType", aMimeType) + }; xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties ); aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.TellEnd() ); diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 4c44d36636fc..d0b11110e65a 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -77,32 +77,33 @@ struct OleComponentNative_Impl { OleComponentNative_Impl() { // TODO: Extend format list - m_aSupportedGraphFormats.realloc( 5 ); + m_aSupportedGraphFormats = { - m_aSupportedGraphFormats[0] = datatransfer::DataFlavor( + datatransfer::DataFlavor( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"", "Windows Enhanced Metafile", - cppu::UnoType>::get() ); + cppu::UnoType>::get() ), - m_aSupportedGraphFormats[1] = datatransfer::DataFlavor( + datatransfer::DataFlavor( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", "Windows Metafile", - cppu::UnoType>::get() ); + cppu::UnoType>::get() ), - m_aSupportedGraphFormats[2] = datatransfer::DataFlavor( + datatransfer::DataFlavor( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", - cppu::UnoType>::get() ); + cppu::UnoType>::get() ), - m_aSupportedGraphFormats[3] = datatransfer::DataFlavor( + datatransfer::DataFlavor( "image/png", "PNG", - cppu::UnoType>::get() ); + cppu::UnoType>::get() ), - m_aSupportedGraphFormats[4] = datatransfer::DataFlavor( + datatransfer::DataFlavor( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetafile", - cppu::UnoType>::get() ); + cppu::UnoType>::get() ) + }; } bool ConvertDataForFlavor( const STGMEDIUM& aMedium, @@ -463,12 +464,13 @@ uno::Sequence< datatransfer::DataFlavor > OleComponentNative_Impl::GetFlavorsFor sal_Int32 nLength = aResult.getLength(); aResult.realloc( nLength + m_aSupportedGraphFormats.getLength() ); + auto pResult = aResult.getArray(); for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ ) { - aResult[nLength + nInd].MimeType = m_aSupportedGraphFormats[nInd].MimeType + aAspectSuffix; - aResult[nLength + nInd].HumanPresentableName = m_aSupportedGraphFormats[nInd].HumanPresentableName; - aResult[nLength + nInd].DataType = m_aSupportedGraphFormats[nInd].DataType; + pResult[nLength + nInd].MimeType = m_aSupportedGraphFormats[nInd].MimeType + aAspectSuffix; + pResult[nLength + nInd].HumanPresentableName = m_aSupportedGraphFormats[nInd].HumanPresentableName; + pResult[nLength + nInd].DataType = m_aSupportedGraphFormats[nInd].DataType; } } @@ -922,12 +924,13 @@ uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList() if( hr == S_OK || hr == S_FALSE ) { m_aVerbList.realloc( nSeqSize += nNum ); + auto pVerbList = m_aVerbList.getArray(); for( sal_uInt32 nInd = 0; nInd < nNum; nInd++ ) { - m_aVerbList[nSeqSize-nNum+nInd].VerbID = szEle[ nInd ].lVerb; - m_aVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( o3tl::toU(szEle[ nInd ].lpszVerbName) ); - m_aVerbList[nSeqSize-nNum+nInd].VerbFlags = szEle[ nInd ].fuFlags; - m_aVerbList[nSeqSize-nNum+nInd].VerbAttributes = szEle[ nInd ].grfAttribs; + pVerbList[nSeqSize-nNum+nInd].VerbID = szEle[ nInd ].lVerb; + pVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( o3tl::toU(szEle[ nInd ].lpszVerbName) ); + pVerbList[nSeqSize-nNum+nInd].VerbFlags = szEle[ nInd ].fuFlags; + pVerbList[nSeqSize-nNum+nInd].VerbAttributes = szEle[ nInd ].grfAttribs; } } else diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 01cf44b9fcaa..15418042f528 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -96,7 +97,8 @@ uno::Sequence< sal_Int32 > OleEmbeddedObject::GetReachableStatesList_Impl( if ( vd.VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN ) { aStates.realloc(3); - aStates[2] = embed::EmbedStates::ACTIVE; + aStates.getArray()[2] = embed::EmbedStates::ACTIVE; + break; } return aStates; @@ -283,8 +285,8 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >& if ( !aDocServiceName.isEmpty() ) { // create the model - uno::Sequence< uno::Any > aArguments(1); - aArguments[0] <<= beans::NamedValue( "EmbeddedObject", uno::makeAny( true )); + uno::Sequence< uno::Any > aArguments{ uno::Any( + beans::NamedValue( "EmbeddedObject", uno::makeAny( true ))) }; uno::Reference< util::XCloseable > xDocument( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( aDocServiceName, aArguments, m_xContext ), uno::UNO_QUERY_THROW ); uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW ); @@ -292,23 +294,18 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >& // let the model behave as embedded one uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); - uno::Sequence< beans::PropertyValue > aSeq( 1 ); - aSeq[0].Name = "SetEmbedded"; - aSeq[0].Value <<= true; + uno::Sequence< beans::PropertyValue > aSeq{ comphelper::makePropertyValue( + "SetEmbedded", true) }; xModel->attachResource( OUString(), aSeq ); // load the model from the stream - uno::Sequence< beans::PropertyValue > aArgs( 5 ); - aArgs[0].Name = "HierarchicalDocumentName"; - aArgs[0].Value <<= m_aEntryName; - aArgs[1].Name = "ReadOnly"; - aArgs[1].Value <<= true; - aArgs[2].Name = "FilterName"; - aArgs[2].Value <<= m_aFilterName; - aArgs[3].Name = "URL"; - aArgs[3].Value <<= OUString( "private:stream" ); - aArgs[4].Name = "InputStream"; - aArgs[4].Value <<= xStream->getInputStream(); + uno::Sequence< beans::PropertyValue > aArgs{ + comphelper::makePropertyValue("HierarchicalDocumentName", m_aEntryName), + comphelper::makePropertyValue("ReadOnly", true), + comphelper::makePropertyValue("FilterName", m_aFilterName), + comphelper::makePropertyValue("URL", OUString( "private:stream" )), + comphelper::makePropertyValue("InputStream", xStream->getInputStream()) + }; xSeekable->seek( 0 ); xLoadable->load( aArgs ); @@ -689,9 +686,8 @@ namespace uno::UNO_QUERY_THROW); uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW); - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xObjectStream; - aArgs[1] <<= true; // do not create copy + uno::Sequence< uno::Any > aArgs{ uno::Any(xObjectStream), + uno::Any(true) }; // do not create copy uno::Reference< container::XNameContainer > xNameContainer( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.embed.OLESimpleStorage", @@ -1005,7 +1001,7 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL OleEmbeddedObject::getSupportedV // So in SfxViewFrame::GetState_Impl in case SID_OBJECT hasVerbs is not // empty, so that the doVerb attempt with -9 fallback is attempted uno::Sequence aRet(1); - aRet[0].VerbID = -9; + aRet.getArray()[0].VerbID = -9; return aRet; } } diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index 7811566b7965..2686daa2c2c4 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -364,9 +364,8 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea if ( !xTargetStream.is() || !xCachedVisualRepresentation.is() ) throw uno::RuntimeException(); - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xTargetStream; - aArgs[1] <<= true; // do not create copy + uno::Sequence< uno::Any > aArgs{ uno::Any(xTargetStream), + uno::Any(true) }; // do not create copy uno::Reference< container::XNameContainer > xNameContainer( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( @@ -394,7 +393,8 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea // write 0xFFFFFFFF at the beginning uno::Sequence< sal_Int8 > aData( 4 ); - * reinterpret_cast(aData.getArray()) = 0xFFFFFFFF; + auto pData = aData.getArray(); + * reinterpret_cast(pData) = 0xFFFFFFFF; xTempOutStream->writeBytes( aData ); @@ -407,33 +407,33 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea if ( aSigData[0] == 'B' && aSigData[1] == 'M' ) { // it's a bitmap - aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0; + pData[0] = 0x02; pData[1] = 0; pData[2] = 0; pData[3] = 0; } else { // treat it as a metafile - aData[0] = 0x03; aData[1] = 0; aData[2] = 0; aData[3] = 0; + pData[0] = 0x03; pData[1] = 0; pData[2] = 0; pData[3] = 0; } xTempOutStream->writeBytes( aData ); // write job related information - aData[0] = 0x04; aData[1] = 0; aData[2] = 0; aData[3] = 0; + pData[0] = 0x04; pData[1] = 0; pData[2] = 0; pData[3] = 0; xTempOutStream->writeBytes( aData ); // write aspect - aData[0] = 0x01; aData[1] = 0; aData[2] = 0; aData[3] = 0; + pData[0] = 0x01; pData[1] = 0; pData[2] = 0; pData[3] = 0; xTempOutStream->writeBytes( aData ); // write l-index - * reinterpret_cast(aData.getArray()) = 0xFFFFFFFF; + * reinterpret_cast(pData) = 0xFFFFFFFF; xTempOutStream->writeBytes( aData ); // write adv. flags - aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0; + pData[0] = 0x02; pData[1] = 0; pData[2] = 0; pData[3] = 0; xTempOutStream->writeBytes( aData ); // write compression - * reinterpret_cast(aData.getArray()) = 0x0; + * reinterpret_cast(pData) = 0x0; xTempOutStream->writeBytes( aData ); // get the size @@ -443,7 +443,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea // write width for ( nIndex = 0; nIndex < 4; nIndex++ ) { - aData[nIndex] = static_cast( aSize.Width % 0x100 ); + pData[nIndex] = static_cast( aSize.Width % 0x100 ); aSize.Width /= 0x100; } xTempOutStream->writeBytes( aData ); @@ -451,7 +451,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea // write height for ( nIndex = 0; nIndex < 4; nIndex++ ) { - aData[nIndex] = static_cast( aSize.Height % 0x100 ); + pData[nIndex] = static_cast( aSize.Height % 0x100 ); aSize.Height /= 0x100; } xTempOutStream->writeBytes( aData ); @@ -474,7 +474,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea } for ( sal_Int32 nInd = 0; nInd < 4; nInd++ ) { - aData[nInd] = static_cast( static_cast(nLength) % 0x100 ); + pData[nInd] = static_cast( static_cast(nLength) % 0x100 ); nLength /= 0x100; } xTempSeek->seek( 36 ); @@ -504,9 +504,8 @@ void OleEmbeddedObject::RemoveVisualCache_Impl( const uno::Reference< io::XStrea if ( !xTargetStream.is() ) throw uno::RuntimeException(); - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xTargetStream; - aArgs[1] <<= true; // do not create copy + uno::Sequence< uno::Any > aArgs{ uno::Any(xTargetStream), + uno::Any(true) }; // do not create copy uno::Reference< container::XNameContainer > xNameContainer( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.embed.OLESimpleStorage", @@ -566,9 +565,8 @@ bool OleEmbeddedObject::HasVisReplInStream() { bool bExists = false; - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xStream; - aArgs[1] <<= true; // do not create copy + uno::Sequence< uno::Any > aArgs{ uno::Any(xStream), + uno::Any(true) }; // do not create copy uno::Reference< container::XNameContainer > xNameContainer( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.embed.OLESimpleStorage", @@ -610,9 +608,8 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToRetrieveCachedVisualRepres SAL_INFO( "embeddedobj.ole", "embeddedobj (mv76033) OleEmbeddedObject::TryToRetrieveCachedVisualRepresentation, retrieving" ); uno::Reference< container::XNameContainer > xNameContainer; - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[0] <<= xStream; - aArgs[1] <<= true; // do not create copy + uno::Sequence< uno::Any > aArgs{ uno::Any(xStream), + uno::Any(true) }; // do not create copy try { xNameContainer.set( diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 68843ec16cf2..ed794a74e07a 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -104,23 +104,24 @@ bool OwnView_Impl::CreateModelFromURL( const OUString& aFileURL ) uno::Reference < frame::XDesktop2 > xDocumentLoader = frame::Desktop::create(m_xContext); uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.isEmpty() ? 4 : 5 ); + auto pArgs = aArgs.getArray(); - aArgs[0].Name = "URL"; - aArgs[0].Value <<= aFileURL; + pArgs[0].Name = "URL"; + pArgs[0].Value <<= aFileURL; - aArgs[1].Name = "ReadOnly"; - aArgs[1].Value <<= true; + pArgs[1].Name = "ReadOnly"; + pArgs[1].Value <<= true; - aArgs[2].Name = "InteractionHandler"; - aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( new DummyHandler_Impl() ); + pArgs[2].Name = "InteractionHandler"; + pArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( new DummyHandler_Impl() ); - aArgs[3].Name = "DontEdit"; - aArgs[3].Value <<= true; + pArgs[3].Name = "DontEdit"; + pArgs[3].Value <<= true; if ( !m_aFilterName.isEmpty() ) { - aArgs[4].Name = "FilterName"; - aArgs[4].Value <<= m_aFilterName; + pArgs[4].Name = "FilterName"; + pArgs[4].Value <<= m_aFilterName; } uno::Reference< frame::XModel > xModel( xDocumentLoader->loadComponentFromURL( @@ -193,14 +194,15 @@ OUString OwnView_Impl::GetFilterNameFromExtentionAndInStream( } uno::Sequence< beans::PropertyValue > aArgs( aTypeName.isEmpty() ? 2 : 3 ); - aArgs[0].Name = "URL"; - aArgs[0].Value <<= OUString( "private:stream" ); - aArgs[1].Name = "InputStream"; - aArgs[1].Value <<= xInputStream; + auto pArgs = aArgs.getArray(); + pArgs[0].Name = "URL"; + pArgs[0].Value <<= OUString( "private:stream" ); + pArgs[1].Name = "InputStream"; + pArgs[1].Value <<= xInputStream; if ( !aTypeName.isEmpty() ) { - aArgs[2].Name = "TypeName"; - aArgs[2].Value <<= aTypeName; + pArgs[2].Name = "TypeName"; + pArgs[2].Value <<= aTypeName; } aTypeName = xTypeDetection->queryTypeByDescriptor( aArgs, true ); @@ -395,8 +397,7 @@ void OwnView_Impl::CreateNative() if ( !xInStream.is() ) throw uno::RuntimeException(); - uno::Sequence< uno::Any > aArgs( 1 ); - aArgs[0] <<= xInStream; + uno::Sequence< uno::Any > aArgs{ uno::Any(xInStream) }; uno::Reference< container::XNameAccess > xNameAccess( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.embed.OLESimpleStorage", diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx index b6bae52f1e49..7e4e99156291 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -39,6 +39,7 @@ #include "platform.h" #include #include +#include #include #include #include @@ -201,9 +202,8 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL ) != osl::FileBase::E_None ) throw uno::RuntimeException(); - uno::Sequence< beans::PropertyValue > aMediaDescr( 1 ); - aMediaDescr[0].Name = "URL"; - aMediaDescr[0].Value <<= aFileURL; + uno::Sequence< beans::PropertyValue > aMediaDescr{ comphelper::makePropertyValue("URL", + aFileURL) }; // TODO: use config helper for type detection uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator; @@ -266,11 +266,8 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia "Image WMF", cppu::UnoType>::get() ); - aObjectInfo.Options.realloc( 2 ); - aObjectInfo.Options[0].Name = "Icon"; - aObjectInfo.Options[0].Value <<= aMetafile; - aObjectInfo.Options[1].Name = "IconFormat"; - aObjectInfo.Options[1].Value <<= aFlavor; + aObjectInfo.Options = { { "Icon", css::uno::Any(aMetafile) }, + { "IconFormat", css::uno::Any(aFlavor) } }; } GlobalUnlock( io.hMetaPict ); -- cgit