summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-08-30 14:34:00 +0200
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-08-30 14:34:00 +0200
commitc14df458b4b7da8da38e9be28db9122ee8765ad2 (patch)
tree4e9c697cda62e3ebb1f60831dc7682ba1a39daca /vbahelper
parente20d0e3eb6dbd05da364c8ec3b71ff4f118dbf48 (diff)
mib19: #163429# switch off form design mode in new documents created with VBA symbol Workbooks.Add
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx17
1 files changed, 10 insertions, 7 deletions
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 );
}