summaryrefslogtreecommitdiff
path: root/sc/source
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 /sc/source
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 'sc/source')
-rw-r--r--sc/source/filter/excel/xlroot.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/vba/testvba/testvba.cxx4
-rw-r--r--sc/source/ui/vba/vbahelper.cxx6
-rw-r--r--sc/source/ui/vba/vbawindows.cxx8
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx9
6 files changed, 12 insertions, 26 deletions
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index b8c9796a4682..dbc470346115 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -20,6 +20,7 @@
#include "xlroot.hxx"
#include <rtl/strbuf.hxx>
#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
@@ -141,8 +142,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
// screen pixel size
try
{
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW );
- Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
+ Reference< frame::XDesktop2 > xFramesSupp = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
Reference< XFrame > xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW );
Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW );
DeviceInfo aDeviceInfo = xDevice->getInfo();
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 7dba3539522b..df3f2ade6650 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -18,6 +18,7 @@
*/
#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
using namespace ::com::sun::star;
@@ -2254,11 +2255,7 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument()
try
{
SC_MOD()->SetInSharedDocLoading( true );
- uno::Reference< lang::XMultiServiceFactory > xFactory(
- ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XComponentLoader > xLoader(
- xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
uno::Sequence < beans::PropertyValue > aArgs( 1 );
aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" ));
aArgs[0].Value <<= sal_True;
diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx
index 8d68d0ddbd23..433dea872408 100644
--- a/sc/source/ui/vba/testvba/testvba.cxx
+++ b/sc/source/ui/vba/testvba/testvba.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -293,8 +294,7 @@ int main( int argv, char** argc )
Reference<XMultiComponentFactory> xFactory = xCC->getServiceManager();
OSL_TRACE("got servicemanager");
std::cout << "got servicemanager" << std::endl;
- Reference<XInterface> desktop = xFactory->createInstanceWithContext(
- ascii("com.sun.star.frame.Desktop"), xCC);
+ Reference<XDesktop2> desktop = Desktop::create(xCC);
OSL_TRACE("got desktop");
std::cout << "got desktop" << std::endl;
Reference<frame::XComponentLoader> xLoader(desktop, UNO_QUERY_THROW);
diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx
index f8ae29e0ad91..96c1aeb44df0 100644
--- a/sc/source/ui/vba/vbahelper.cxx
+++ b/sc/source/ui/vba/vbahelper.cxx
@@ -21,7 +21,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -270,9 +270,7 @@ getCurrentDocument() throw (uno::RuntimeException)
{
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
- uno::Reference<lang::XMultiComponentFactory > xSMgr(
- xCtx->getServiceManager() );
- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(xCtx);
xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
if ( !xModel.is() )
{
diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx
index b78d8eb1eff3..56ddccf9e9c0 100644
--- a/sc/source/ui/vba/vbawindows.cxx
+++ b/sc/source/ui/vba/vbawindows.cxx
@@ -21,7 +21,7 @@
#include <boost/unordered_map.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <cppuhelper/implbase3.hxx>
#include "vbawindow.hxx"
@@ -66,11 +66,7 @@ public:
WindowComponentEnumImpl( 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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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() )
{
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index fac9a46dcf95..3fdc2c8bab22 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -47,7 +47,7 @@
#include <com/sun/star/sheet/XNamedRanges.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/table/XTableChartsSupplier.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -160,13 +160,8 @@ openNewDoc(rtl::OUString aSheetName )
{
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
- xContext->getServiceManager() );
- uno::Reference <frame::XComponentLoader > xComponentLoader(
- xServiceManager->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ),
- xContext ), uno::UNO_QUERY_THROW );
+ uno::Reference <frame::XDesktop2 > xComponentLoader = frame::Desktop::create(xContext);
uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/scalc" ) ),