summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-11 09:34:11 +0200
committerNoel Grandin <noel@peralex.com>2012-12-13 05:20:58 +0200
commitbb8900baaaaa489442a5bd805bb42d43cd6fc152 (patch)
treea58b61b399f971d2c52340e1db1a4c0d4ca2d2fe
parentc1e42d60c572d23c61a703cd66495eab1cea4e05 (diff)
fdo#46808, Create new-style ui::WindowContentFactoryManager service
The service already existed, it just did not have an IDL file. Change-Id: Ie059e8d81fdfb4c3a5eca274a2406f806ee77b5c
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/source/uifactory/windowcontentfactorymanager.cxx2
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/ui/WindowContentFactoryManager.idl39
-rw-r--r--sfx2/source/dialog/dockwin.cxx131
5 files changed, 102 insertions, 72 deletions
diff --git a/framework/inc/services.h b/framework/inc/services.h
index fcae2a074a7b..e606390c8664 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -81,7 +81,6 @@ namespace framework{
#define SERVICENAME_STRINGABBREVIATION DECLARE_ASCII("com.sun.star.util.UriAbbreviation" )
#define SERVICENAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.ui.ImageManager" )
#define SERVICENAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow" )
-#define SERVICENAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager" )
#define SERVICENAME_DISPLAYACCESS DECLARE_ASCII("com.sun.star.awt.DisplayAccess" )
#define SERVICENAME_PANELFACTORY DECLARE_ASCII("com.sun.star.ui.PanelFactory" )
#define SERVICENAME_MODELWINSERVICE DECLARE_ASCII("com.sun.star.ui.ModelWinService" )
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index f9e27ebc1d9f..496e74e2b643 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -56,7 +56,7 @@ namespace framework
//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( WindowContentFactoryManager ,
::cppu::OWeakObject ,
- SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
+ DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager"),
IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
)
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 9c1aa3f6e66b..b2bcb4a7bbb3 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -305,6 +305,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
GlobalAcceleratorConfiguration \
ModuleUIConfigurationManagerSupplier \
WindowContentFactory \
+ WindowContentFactoryManager \
WindowStateConfiguration \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\
diff --git a/offapi/com/sun/star/ui/WindowContentFactoryManager.idl b/offapi/com/sun/star/ui/WindowContentFactoryManager.idl
new file mode 100644
index 000000000000..95ea4ce47e36
--- /dev/null
+++ b/offapi/com/sun/star/ui/WindowContentFactoryManager.idl
@@ -0,0 +1,39 @@
+/* -*- 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_ui_WindowContentFactoryManager_idl__
+#define __com_sun_star_ui_WindowContentFactoryManager_idl__
+
+#include <com/sun/star/lang/XSingleComponentFactory.idl>
+
+
+module com { module sun { module star { module ui {
+
+
+/**
+ This interface could be imcomplete since I derived it from it's sole place of use.
+
+ @since LibreOffice 4.1
+*/
+service WindowContentFactoryManager : com::sun::star::lang::XSingleComponentFactory;
+
+
+}; }; }; };
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 8932896412a1..c8cb078ee409 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/WindowContentFactoryManager.hpp>
#define MAX_TOGGLEAREA_WIDTH 20
#define MAX_TOGGLEAREA_HEIGHT 20
@@ -128,7 +129,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
SfxChildWinInfo* pInfo )
: SfxChildWindow( pParentWnd , nId )
{
- uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
const rtl::OUString aDockWindowResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" ));
SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
@@ -136,86 +137,76 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
pWindow = pTitleDockWindow;
eChildAlignment = SFX_ALIGN_NOALIGNMENT;
- // Use factory manager to retrieve XWindow factory. That can be used to instanciate
+ // Use factory manager to retrieve XWindow factory. That can be used to instantiate
// the real window factory.
- uno::Reference< lang::XSingleComponentFactory > xFactoryMgr(
- xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.ui.WindowContentFactoryManager"))),
- uno::UNO_QUERY );
-
- if (xFactoryMgr.is())
+ uno::Reference< lang::XSingleComponentFactory > xFactoryMgr = ui::WindowContentFactoryManager::create(xContext);
+
+ SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
+ uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
+ uno::Sequence< uno::Any > aArgs(2);
+ beans::PropertyValue aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
+ aPropValue.Value = uno::makeAny( xFrame );
+ aArgs[0] <<= aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
+
+ // create a resource URL from the nId provided by the sfx2
+ ::rtl::OUString aResourceURL( aDockWindowResourceURL );
+ aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
+ aPropValue.Value = uno::makeAny( aResourceURL );
+ aArgs[1] <<= aPropValue;
+
+ uno::Reference< awt::XWindow > xWindow;
+ try
{
- SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
- uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
- uno::Sequence< uno::Any > aArgs(2);
- beans::PropertyValue aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value = uno::makeAny( xFrame );
- aArgs[0] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
-
- // create a resource URL from the nId provided by the sfx2
- ::rtl::OUString aResourceURL( aDockWindowResourceURL );
- aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
- aPropValue.Value = uno::makeAny( aResourceURL );
- aArgs[1] <<= aPropValue;
-
- uno::Reference< awt::XWindow > xWindow;
- try
- {
- uno::Reference< uno::XComponentContext > xContext(
- comphelper::getComponentContext( xServiceManager ) );
-
- xWindow = uno::Reference< awt::XWindow>(
- xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
- uno::UNO_QUERY );
-
- static uno::WeakReference< frame::XModuleManager2 > m_xModuleManager;
-
- uno::Reference< frame::XModuleManager2 > xModuleManager( m_xModuleManager );
- if ( !xModuleManager.is() )
- {
- xModuleManager = frame::ModuleManager::create(comphelper::getComponentContext(xServiceManager));
- m_xModuleManager = xModuleManager;
- }
-
- static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
+ xWindow = uno::Reference< awt::XWindow>(
+ xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
+ uno::UNO_QUERY );
- uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
- if ( !xWindowStateConfiguration.is() )
- {
- xWindowStateConfiguration = ui::WindowStateConfiguration::create( comphelper::getComponentContext(xServiceManager) );
- m_xWindowStateConfiguration = xWindowStateConfiguration;
- }
+ static uno::WeakReference< frame::XModuleManager2 > m_xModuleManager;
- ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
-
- uno::Reference< container::XNameAccess > xModuleWindowState(
- xWindowStateConfiguration->getByName( sModuleIdentifier ),
- uno::UNO_QUERY );
- if ( xModuleWindowState.is() )
- {
- WindowState aDockWinState;
- if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
- pTitleDockWindow->SetText( aDockWinState.sTitle );
- }
- }
- catch ( beans::UnknownPropertyException& )
+ uno::Reference< frame::XModuleManager2 > xModuleManager( m_xModuleManager );
+ if ( !xModuleManager.is() )
{
+ xModuleManager = frame::ModuleManager::create(xContext);
+ m_xModuleManager = xModuleManager;
}
- catch ( uno::RuntimeException& )
+
+ static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
+
+ uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
+ if ( !xWindowStateConfiguration.is() )
{
+ xWindowStateConfiguration = ui::WindowStateConfiguration::create( xContext );
+ m_xWindowStateConfiguration = xWindowStateConfiguration;
}
- catch ( uno::Exception& )
+
+ ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
+
+ uno::Reference< container::XNameAccess > xModuleWindowState(
+ xWindowStateConfiguration->getByName( sModuleIdentifier ),
+ uno::UNO_QUERY );
+ if ( xModuleWindowState.is() )
{
+ WindowState aDockWinState;
+ if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
+ pTitleDockWindow->SetText( aDockWinState.sTitle );
}
-
- Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
- if ( pContentWindow )
- pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
- pTitleDockWindow->SetWrappedWindow(pContentWindow);
}
+ catch ( beans::UnknownPropertyException& )
+ {
+ }
+ catch ( uno::RuntimeException& )
+ {
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
+ if ( pContentWindow )
+ pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ pTitleDockWindow->SetWrappedWindow(pContentWindow);
pWindow->SetOutputSizePixel( Size( 270, 240 ) );