diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-14 12:58:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 10:57:09 +0200 |
commit | bb121c864cc3c101ef733a4088c7ba3e36eced14 (patch) | |
tree | 2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /embedserv/source | |
parent | 6d818ed651aaafcfb12ebc21449d35947d2e85a9 (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 'embedserv/source')
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 8ddfb66703ff..acd4d57ec440 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XStatusListener.hpp> @@ -91,13 +91,8 @@ DocumentHolder::DocumentHolder( m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ), m_bLink( sal_False ) { - static const ::rtl::OUString aServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); } @@ -390,13 +385,8 @@ HRESULT DocumentHolder::InPlaceActivate( // load the model into the frame LoadDocInFrame( sal_True ); - static const ::rtl::OUString aDesktopServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XFramesSupplier > xDesktop( - m_xFactory->createInstance( aDesktopServiceName ), - uno::UNO_QUERY ); - if(xDesktop.is()) - xDesktop->getFrames()->append(m_xFrame); + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->getFrames()->append(m_xFrame); // determine the menuhandle to get menutitems. if(m_xLayoutManager.is()) { @@ -645,15 +635,9 @@ BOOL DocumentHolder::Undo(void) void DocumentHolder::FreeOffice() { - const ::rtl::OUString aServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if ( xDesktop.is() ) - { - xDesktop->removeTerminateListener( - (frame::XTerminateListener*)this ); - } + uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); + xDesktop->removeTerminateListener( + (frame::XTerminateListener*)this ); } void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete ) @@ -812,15 +796,9 @@ uno::Reference< frame::XFrame > DocumentHolder::DocumentFrame() { if(! m_xFrame.is() ) { - rtl::OUString aDesktopSrvNm( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); - - uno::Reference<frame::XDesktop> xDesktop( - m_xFactory->createInstance(aDesktopSrvNm), - uno::UNO_QUERY); + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(comphelper::getComponentContext(m_xFactory)); - uno::Reference<frame::XFrame> xFrame( - xDesktop,uno::UNO_QUERY); + uno::Reference<frame::XFrame> xFrame(xDesktop,uno::UNO_QUERY); // the frame will be registered on desktop here, later when the document // is loaded into the frame in ::show() method the terminate listener will be removed |