summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-02 14:43:43 +0200
committerNoel Grandin <noel@peralex.com>2013-01-09 08:08:09 +0200
commit42adbfccad151a29e56ea1ed8eeb323cd4b7dae4 (patch)
tree258e83a20a67af2703036d83cae76a9dd8723030
parent9c634c95e2939b1cdad5ea61e24cce58da3857b9 (diff)
fdo#46808, Adapt embed::HatchWindowFactory UNO service to new style
The service already existed, it just did not have an IDL file. Change-Id: If00396effd92ed72ea942da5eb1fe60b6380c665
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx3
-rw-r--r--embeddedobj/source/general/docholder.cxx32
-rw-r--r--embeddedobj/source/inc/docholder.hxx5
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/embed/HatchWindowFactory.idl38
5 files changed, 57 insertions, 22 deletions
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index 2946d7fc3537..508883d333f0 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -29,6 +29,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/processfactory.hxx>
#include "closepreventer.hxx"
#include "intercept.hxx"
@@ -98,7 +99,7 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa
if ( !m_xFactory.is() )
throw uno::RuntimeException();
- m_pDocHolder = new DocumentHolder( m_xFactory, this );
+ m_pDocHolder = new DocumentHolder( comphelper::getComponentContext(m_xFactory), this );
m_pDocHolder->acquire();
// parse configuration entries
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 47367f7cfa74..76bb6499f471 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -47,7 +47,7 @@
#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
#include <com/sun/star/bridge/ModelDependent.hpp>
#include <com/sun/star/embed/XHatchWindow.hpp>
-#include <com/sun/star/embed/XHatchWindowFactory.hpp>
+#include <com/sun/star/embed/HatchWindowFactory.hpp>
#include <com/sun/star/embed/XInplaceClient.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp>
@@ -150,11 +150,11 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >&
}
//===========================================================================
-DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >& xContext,
OCommonEmbeddedObject* pEmbObj )
: m_pEmbedObj( pEmbObj ),
m_pInterceptor( NULL ),
- m_xFactory( xFactory ),
+ m_xContext( xContext ),
m_bReadOnly( sal_False ),
m_bWaitForClose( sal_False ),
m_bAllowClosing( sal_False ),
@@ -173,7 +173,7 @@ DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory
aArg.Value <<= sal_False;
m_aOutplaceFrameProps[1] <<= aArg;
- uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext );
m_refCount++;
try
{
@@ -247,7 +247,7 @@ void DocumentHolder::CloseFrame()
//---------------------------------------------------------------------------
void DocumentHolder::FreeOffice()
{
- uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( comphelper::getComponentContext(m_xFactory) );
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext );
xDesktop->removeTerminateListener( this );
// the following code is commented out since for now there is still no completely correct way to detect
@@ -410,13 +410,8 @@ sal_Bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >&
if ( xModel.is() )
{
- uno::Reference< embed::XHatchWindowFactory > xHatchFactory(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.HatchWindowFactory" )) ),
- uno::UNO_QUERY );
-
- if ( !xHatchFactory.is() )
- throw uno::RuntimeException();
+ uno::Reference< embed::XHatchWindowFactory > xHatchFactory =
+ embed::HatchWindowFactory::create(m_xContext);
uno::Reference< embed::XHatchWindow > xHatchWindow =
xHatchFactory->createHatchWindowInstance( xParent,
@@ -446,8 +441,7 @@ sal_Bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >&
awt::Rectangle(),//aOwnRectangle,
awt::WindowAttribute::SHOW | awt::VclWindowPeerAttribute::CLIPCHILDREN );
- uno::Reference< awt::XToolkit2 > xToolkit =
- awt::Toolkit::create(comphelper::getComponentContext(m_xFactory));
+ uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create(m_xContext);
uno::Reference< awt::XWindowPeer > xNewWinPeer = xToolkit->createWindow( aOwnWinDescriptor );
uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY );
@@ -456,7 +450,7 @@ sal_Bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >&
// create a frame based on the specified window
uno::Reference< lang::XSingleServiceFactory > xFrameFact(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.TaskCreator" )) ),
+ m_xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.frame.TaskCreator", m_xContext ),
uno::UNO_QUERY_THROW );
uno::Sequence< uno::Any > aArgs( 2 );
@@ -554,14 +548,14 @@ uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl()
if ( !xResult.is() )
{
// no internal document configuration, use the one from the module
- uno::Reference< frame::XModuleManager2 > xModuleMan( frame::ModuleManager::create(comphelper::getComponentContext(m_xFactory)) );
+ uno::Reference< frame::XModuleManager2 > xModuleMan = frame::ModuleManager::create(m_xContext);
::rtl::OUString aModuleIdent =
xModuleMan->identify( uno::Reference< uno::XInterface >( m_xComponent, uno::UNO_QUERY ) );
if ( !aModuleIdent.isEmpty() )
{
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModConfSupplier(
- ui::ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(m_xFactory)) );
+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModConfSupplier =
+ ui::ModuleUIConfigurationManagerSupplier::create(m_xContext);
uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > xModUIConfMan(
xModConfSupplier->getUIConfigurationManager( aModuleIdent ),
uno::UNO_QUERY_THROW );
@@ -836,7 +830,7 @@ uno::Reference< frame::XFrame > DocumentHolder::GetDocFrame()
if ( !m_xFrame.is() )
{
uno::Reference< lang::XSingleServiceFactory > xFrameFact(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.TaskCreator" ) )),
+ m_xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.frame.TaskCreator", m_xContext ),
uno::UNO_QUERY_THROW );
m_xFrame.set(xFrameFact->createInstanceWithArguments( m_aOutplaceFrameProps ), uno::UNO_QUERY_THROW);
diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx
index 7c8f1057f3de..a76faae55597 100644
--- a/embeddedobj/source/inc/docholder.hxx
+++ b/embeddedobj/source/inc/docholder.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/embed/XHatchWindowController.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase6.hxx>
class OCommonEmbeddedObject;
@@ -55,7 +56,7 @@ private:
Interceptor* m_pInterceptor;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xComponent;
@@ -114,7 +115,7 @@ public:
throw ( ::com::sun::star::uno::Exception );
- DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
OCommonEmbeddedObject* pEmbObj );
~DocumentHolder();
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 56e5f4811ba8..a887de2d9381 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -111,6 +111,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing/fr
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/embed,\
DocumentCloser \
FileSystemStorageFactory \
+ HatchWindowFactory \
InstanceLocker \
OLESimpleStorage \
StorageFactory \
diff --git a/offapi/com/sun/star/embed/HatchWindowFactory.idl b/offapi/com/sun/star/embed/HatchWindowFactory.idl
new file mode 100644
index 000000000000..2456ce5892d1
--- /dev/null
+++ b/offapi/com/sun/star/embed/HatchWindowFactory.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_embed_HatchWindowFactory_idl__
+#define __com_sun_star_embed_HatchWindowFactory_idl__
+
+#include <com/sun/star/embed/XHatchWindowFactory.idl>
+
+
+module com { module sun { module star { module embed {
+
+
+/**
+ @since LibreOffice 4.1
+ */
+service HatchWindowFactory : XHatchWindowFactory;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */