diff options
-rw-r--r-- | svx/source/form/fmview.cxx | 4 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 17 |
2 files changed, 11 insertions, 10 deletions
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 22681d511b82..d3e8c848b940 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -139,9 +139,7 @@ void FmFormView::Init() const SfxPoolItem *pItem=0; if ( pObjShell->GetMedium()->GetItemSet()->GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - Sequence< PropertyValue > aSeq; - ( ((SfxUnoAnyItem*)pItem)->GetValue() ) >>= aSeq; - ::comphelper::NamedValueCollection aComponentData( aSeq ); + ::comphelper::NamedValueCollection aComponentData( ((SfxUnoAnyItem*)pItem)->GetValue() ); bInitDesignMode = aComponentData.getOrDefault( "ApplyFormDesignMode", bInitDesignMode ); } } diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index f7af3a43d977..e01809d5fbc3 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -25,6 +25,7 @@ * ************************************************************************/ #include <vbahelper/vbadocumentsbase.hxx> +#include <comphelper/mediadescriptor.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase3.hxx> @@ -215,12 +216,6 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP uno::Any SAL_CALL VbaDocumentsBase::Add() throw (uno::RuntimeException) { - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - beans::PropertyValue aArg; - aArg.Name = ::rtl::OUString::createFromAscii("MacroExecutionMode"); - aArg.Value = uno::Any(com::sun::star::document::MacroExecMode::USE_CONFIG); - aArgs[ 0 ] = aArg; - uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); @@ -235,9 +230,17 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ); else throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + + // prepare the media descriptor + ::comphelper::MediaDescriptor aMediaDesc; + aMediaDesc[ ::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE() ] <<= document::MacroExecMode::USE_CONFIG; + aMediaDesc.setComponentDataEntry( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ApplyFormDesignMode" ) ), uno::Any( false ) ); + + // craete the new document uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( sURL , - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, aArgs ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, + aMediaDesc.getAsConstPropertyValueList() ); return uno::makeAny( xComponent ); } |