summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-14 12:58:00 +0200
committerNoel Grandin <noel@peralex.com>2012-12-21 10:57:09 +0200
commitbb121c864cc3c101ef733a4088c7ba3e36eced14 (patch)
tree2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /vbahelper
parent6d818ed651aaafcfb12ebc21449d35947d2e85a9 (diff)
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface because it introduced method name conflicts (addEventListener). Shouldn't be an issue since it was scheduled to be dropped anyhow, and the service implementation still implements it, so existing clients will be fine. I dropped the interface XPropertySet from the combined IDL because nobody seems to be using it, and it's primary purpose appears to be to set weird flags. I dropped the optional interfaces XStatusIndicatorFactory XDispatchInformationProvider from the combined IDL because the service does not implement them, and nobody seems to be using them. I suspect they were mistakenly copied from XFrame. I also did not convert the Title, UserDefinedAttributes and LayoutManager properties to attributes, again because no-one is using them. Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx21
1 files changed, 5 insertions, 16 deletions
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index 479074f72a15..36abda68207d 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XTitle.hpp>
@@ -80,11 +81,7 @@ public:
}
DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext )
{
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XDesktop > xDesktop
- (xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , m_xContext), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext );
uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
while( mxComponents->hasMoreElements() )
{
@@ -243,11 +240,7 @@ uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException)
sal_Bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating();
sal_Bool bInteractive = !xApplication.is() || xApplication->getInteractive();
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XComponentLoader > xLoader(
- xSMgr->createInstanceWithContext("com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create(mxContext);
OUString sURL;
if( meDocType == WORD_DOCUMENT )
sURL = "private:factory/swriter";
@@ -302,11 +295,7 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A
aURL = rFileName;
else
osl::FileBase::getFileURLFromSystemPath( rFileName, aURL );
- uno::Reference< lang::XMultiComponentFactory > xSMgr(
- mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XDesktop > xDesktop(xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XComponentLoader > xLoader(
- xSMgr->createInstanceWithContext( "com.sun.star.frame.Desktop" , mxContext), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( mxContext );
uno::Sequence< beans::PropertyValue > sProps( rProps );
sProps.realloc( sProps.getLength() + 1 );
@@ -324,7 +313,7 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A
}
}
- uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL,
+ uno::Reference< lang::XComponent > xComponent = xDesktop->loadComponentFromURL( aURL,
"_default" ,
frame::FrameSearchFlag::CREATE,
sProps);