diff options
Diffstat (limited to 'vbahelper/source/vbahelper/vbadocumentsbase.cxx')
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 2d4175b90939..f2b70ab231c7 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> @@ -212,10 +213,9 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP { } -uno::Any SAL_CALL -VbaDocumentsBase::Add() throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) { - uno::Reference< lang::XMultiComponentFactory > xSMgr( + uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XComponentLoader > xLoader( @@ -229,15 +229,21 @@ 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, - uno::Sequence< beans::PropertyValue >(0) ); + aMediaDesc.getAsConstPropertyValueList() ); return uno::makeAny( xComponent ); } -void -VbaDocumentsBase::Close() throw (uno::RuntimeException) +void VbaDocumentsBase::closeDocuments() throw (uno::RuntimeException) { // #FIXME this *MUST* be wrong documents::close surely closes ALL documents // in the collection, use of getCurrentDocument here is totally wrong @@ -251,8 +257,7 @@ VbaDocumentsBase::Close() throw (uno::RuntimeException) } // #TODO# #FIXME# can any of the unused params below be used? -uno::Any -VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) { // we need to detect if this is a URL, if not then assume its a file path rtl::OUString aURL; |