diff options
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/inc/unotest/macros_test.hxx | 2 | ||||
-rw-r--r-- | unotest/source/cpp/macros_test.cxx | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/unotest/inc/unotest/macros_test.hxx b/unotest/inc/unotest/macros_test.hxx index 1a82b83fc48f..c3eb7ff5629c 100644 --- a/unotest/inc/unotest/macros_test.hxx +++ b/unotest/inc/unotest/macros_test.hxx @@ -46,7 +46,7 @@ namespace unotest { class OOO_DLLPUBLIC_UNOTEST MacrosTest { public: - com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const rtl::OUString& rURL); + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > loadFromDesktop(const OUString& rURL, const char* pDocService = NULL); protected: com::sun::star::uno::Reference< com::sun::star::frame::XDesktop2> mxDesktop; diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 4d08d0488f65..be13798dd7d0 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -38,16 +38,25 @@ using namespace com::sun::star; namespace unotest { -uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const rtl::OUString& rURL) +uno::Reference< com::sun::star::lang::XComponent > MacrosTest::loadFromDesktop(const OUString& rURL, const char* pDocService) { uno::Reference< com::sun::star::frame::XComponentLoader> xLoader = uno::Reference< com::sun::star::frame::XComponentLoader >( mxDesktop, uno::UNO_QUERY ); com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > args(1); - args[0].Name = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); + args[0].Name = "MacroExecutionMode"; args[0].Handle = -1; args[0].Value <<= com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN; args[0].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; + + if (pDocService) + { + args.realloc(2); + args[1].Name = "DocumentService"; + args[1].Handle = -1; + args[1].Value <<= OUString::createFromAscii(pDocService); + args[1].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; + } + uno::Reference< com::sun::star::lang::XComponent> xComponent= xLoader->loadComponentFromURL(rURL, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_default")), 0, args); rtl::OUString sMessage = rtl::OUString( "loading failed: " ) + rURL; CPPUNIT_ASSERT_MESSAGE(rtl::OUStringToOString( sMessage, RTL_TEXTENCODING_UTF8 ).getStr( ), xComponent.is()); |