[Libreoffice-commits] core.git: 9 commits - framework/inc framework/Library_fwk.mk framework/source framework/util offapi/com offapi/UnoApi_offapi.mk sfx2/source solenv/bin
Matúš Kukan
matus.kukan at collabora.com
Thu Feb 13 11:31:38 CET 2014
framework/Library_fwk.mk | 2
framework/inc/services/desktop.hxx | 53 +-
framework/inc/uifactory/menubarfactory.hxx | 6
framework/source/accelerators/acceleratorconfiguration.cxx | 35 -
framework/source/constant/containerquery.cxx | 32 -
framework/source/inc/constant/containerquery.hxx | 41 --
framework/source/inc/pattern/configuration.hxx | 149 --------
framework/source/jobs/jobexecutor.cxx | 5
framework/source/loadenv/loadenv.cxx | 1
framework/source/register/registerservices.cxx | 42 --
framework/source/services/autorecovery.cxx | 3
framework/source/services/desktop.cxx | 230 ++++++-------
framework/source/services/modulemanager.cxx | 163 ++-------
framework/source/uiconfiguration/uicategorydescription.cxx | 3
framework/source/uielement/uicommanddescription.cxx | 10
framework/source/uifactory/menubarfactory.cxx | 22 -
framework/source/uifactory/statusbarfactory.cxx | 12
framework/source/uifactory/toolbarfactory.cxx | 11
framework/util/fwk.component | 6
offapi/UnoApi_offapi.mk | 1
offapi/com/sun/star/frame/Desktop.idl | 14
offapi/com/sun/star/frame/theDesktop.idl | 47 ++
sfx2/source/notify/globalevents.cxx | 5
solenv/bin/native-code.py | 2
24 files changed, 274 insertions(+), 621 deletions(-)
New commits:
commit c388071c4d1bee70e41f9ff72d50e5966bb8f237
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Thu Feb 13 08:44:10 2014 +0100
remove now empty fwk_component_getFactory
Change-Id: I5f2f5fc9ccc75b145572aa0bb88b00b0d7a5872d
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index e8ad8af..abfc7a9 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -103,7 +103,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/layoutmanager/uielement \
framework/source/loadenv/loadenv \
framework/source/loadenv/targethelper \
- framework/source/register/registerservices \
framework/source/services/ContextChangeEventMultiplexer \
framework/source/services/autorecovery \
framework/source/services/desktop \
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
deleted file mode 100644
index a4a8741..0000000
--- a/framework/source/register/registerservices.cxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- 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 .
- */
-
-
-#include <macros/registration.hxx>
-
-/*=================================================================================================================
- Add new include and new register info to for new services.
-
- Example:
-
- #include <service1.hxx>
- #include <service2.hxx>
-
- COMPONENTGETFACTORY ( IFFACTORIE( Service1 )
- else
- IFFACTORIE( Service2 )
- )
-=================================================================================================================*/
-
-COMPONENTGETFACTORY ( fwk,
- )
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 1b8132c..6541f14 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -18,7 +18,7 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="fwk" xmlns="http://openoffice.org/2010/uno-components">
+ xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.frame.SessionListener"
constructor="com_sun_star_comp_frame_SessionListener_get_implementation">
<service name="com.sun.star.frame.SessionListener"/>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 7454687..4106322 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -24,7 +24,6 @@ core_factory_list = [
("libconfigmgrlo.a", "configmgr_component_getFactory"),
("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
("libfsstoragelo.a", "fsstorage_component_getFactory"),
- ("libfwklo.a", "fwk_component_getFactory"),
("libhyphenlo.a", "hyphen_component_getFactory"),
("liblnglo.a", "lng_component_getFactory"),
("liblnthlo.a", "lnth_component_getFactory"),
commit 2d46ef6da59c6f80bbe00dbb3d207852ad04c7c6
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Thu Jan 16 22:30:54 2014 +0100
fwk: Constructor feature for single-instance framework::Desktop.
Change-Id: Id582e672c0b41a35d25361f7dfe970a767880b2a
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 218a7c9..22a5c6c 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -20,16 +20,11 @@
#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
#define INCLUDED_FRAMEWORK_INC_SERVICES_DESKTOP_HXX
+#include <sal/config.h>
+
#include <classes/framecontainer.hxx>
-#include <threadhelp/threadhelpbase.hxx>
-#include <helper/oframes.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
-
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
@@ -38,7 +33,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XFrames.hpp>
-#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
@@ -53,11 +48,10 @@
#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <unotools/cmdoptions.hxx>
-#include <cppuhelper/propshlp.hxx>
-#include <cppuhelper/implbase6.hxx>
-
#include <comphelper/numberedcollection.hxx>
+#include <cppuhelper/compbase6.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <unotools/cmdoptions.hxx>
namespace framework{
@@ -91,15 +85,10 @@ enum ELoadState
XEventListener
XInteractionHandler
- @base ThreadHelpBase
- TransactionBase
- OBroadcastHelper
- OPropertySetHelper
-
@devstatus ready to use
@threadsafe yes
*//*-*************************************************************************************************************/
-typedef ::cppu::WeakImplHelper6<
+typedef cppu::WeakComponentImplHelper6<
css::lang::XServiceInfo ,
css::frame::XDesktop2 ,
css::frame::XTasksSupplier ,
@@ -107,14 +96,11 @@ typedef ::cppu::WeakImplHelper6<
css::task::XInteractionHandler ,
css::frame::XUntitledNumbers > Desktop_BASE;
-class Desktop : // base classes
- // Order is necessary for right initialization!
- private ThreadHelpBase ,
- private TransactionBase ,
- public ::cppu::OBroadcastHelper ,
- public ::cppu::OPropertySetHelper ,
- // interfaces
- public Desktop_BASE
+class Desktop : private osl::Mutex,
+ private ThreadHelpBase,
+ private TransactionBase,
+ public Desktop_BASE,
+ public cppu::OPropertySetHelper
{
// internal used types, const etcpp.
private:
@@ -130,8 +116,17 @@ class Desktop : // base classes
Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext );
virtual ~Desktop( );
+ void constructorInit();
+
// XServiceInfo
- DECLARE_XSERVICEINFO
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
// XInterface
virtual void SAL_CALL acquire() throw ()
@@ -274,8 +269,7 @@ class Desktop : // base classes
virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException );
// XComponent
- using cppu::OPropertySetHelper::disposing;
- virtual void SAL_CALL dispose ( ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL disposing() throw( css::uno::RuntimeException );
virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException );
virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException );
@@ -407,7 +401,6 @@ class Desktop : // base classes
//-------------------------------------------------------------------------------------------------------------
private:
- static sal_Bool implcp_ctor ( const css::uno::Reference< css::uno::XComponentContext >& xFactory );
static sal_Bool implcp_addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener );
static sal_Bool implcp_removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener );
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index c0d5cf3..a4a8741 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -33,10 +33,8 @@
IFFACTORIE( Service2 )
)
=================================================================================================================*/
-#include <services/desktop.hxx>
COMPONENTGETFACTORY ( fwk,
- IFFACTORY( ::framework::Desktop )
)
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index d3715ed..87fd713 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -17,12 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <loadenv/loadenv.hxx>
+#include <services/desktop.hxx>
+#include <loadenv/loadenv.hxx>
#include <loadenv/targethelper.hxx>
-#include <services/desktop.hxx>
#include <helper/ocomponentaccess.hxx>
+#include <helper/oframes.hxx>
#include <dispatch/dispatchprovider.hxx>
#include <dispatch/interceptionhelper.hxx>
@@ -30,7 +31,6 @@
#include <threadhelp/transactionguard.hxx>
#include <threadhelp/writeguard.hxx>
#include <threadhelp/readguard.hxx>
-#include <services.h>
#include <general.h>
#include <properties.h>
@@ -61,80 +61,77 @@
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/frame/XTerminateListener2.hpp>
-#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/proptypehlp.hxx>
-#include <rtl/ustrbuf.hxx>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <vcl/svapp.hxx>
#include <tools/errinf.hxx>
#include <comphelper/extract.hxx>
-#include <fwkdllapi.h>
-
namespace framework{
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
+OUString SAL_CALL Desktop::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ return OUString("com.sun.star.comp.framework.Desktop");
+}
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( Desktop,
- ::cppu::OWeakObject,
- "com.sun.star.frame.Desktop",
- IMPLEMENTATIONNAME_DESKTOP
- )
-
-DEFINE_INIT_SERVICE ( Desktop,
- {
- /*Attention
- I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
- to create a new instance of this class by our own supported service factory.
- see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information!
- */
-
- //-------------------------------------------------------------------------------------------------------------
- // Initialize a new XFrames-helper-object to handle XIndexAccess and XElementAccess.
- // We hold member as reference ... not as pointer too!
- // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that.
- // But look on dispose() for right order of deinitialization.
- OFrames* pFramesHelper = new OFrames( this, &m_aChildTaskContainer );
- m_xFramesHelper = css::uno::Reference< css::frame::XFrames >( static_cast< ::cppu::OWeakObject* >(pFramesHelper), css::uno::UNO_QUERY );
-
- //-------------------------------------------------------------------------------------------------------------
- // Initialize a new dispatchhelper-object to handle dispatches.
- // We use these helper as slave for our interceptor helper ... not directly!
- // But he is event listener on THIS instance!
- DispatchProvider* pDispatchHelper = new DispatchProvider( m_xContext, this );
- css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( static_cast< ::cppu::OWeakObject* >(pDispatchHelper), css::uno::UNO_QUERY );
-
- //-------------------------------------------------------------------------------------------------------------
- // Initialize a new interception helper object to handle dispatches and implement an interceptor mechanism.
- // Set created dispatch provider as slowest slave of it.
- // Hold interception helper by reference only - not by pointer!
- // So it's easiear to destroy it.
- InterceptionHelper* pInterceptionHelper = new InterceptionHelper( this, xDispatchProvider );
- m_xDispatchHelper = css::uno::Reference< css::frame::XDispatchProvider >( static_cast< ::cppu::OWeakObject* >(pInterceptionHelper), css::uno::UNO_QUERY );
-
- OUStringBuffer sUntitledPrefix (256);
- sUntitledPrefix.append (FWK_RESSTR(STR_UNTITLED_DOCUMENT));
- sUntitledPrefix.appendAscii (" ");
-
- ::comphelper::NumberedCollection* pNumbers = new ::comphelper::NumberedCollection ();
- m_xTitleNumberGenerator = css::uno::Reference< css::frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pNumbers), css::uno::UNO_QUERY_THROW);
- pNumbers->setOwner ( static_cast< ::cppu::OWeakObject* >(this) );
- pNumbers->setUntitledPrefix ( sUntitledPrefix.makeStringAndClear () );
-
- // Safe impossible cases
- // We can't work without this helper!
- SAL_WARN_IF( !m_xFramesHelper.is(), "fwk", "Desktop::Desktop(): Frames helper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!");
- SAL_WARN_IF( !m_xDispatchHelper.is(), "fwk", "Desktop::Desktop(): Dispatch helper is not valid. XDispatch will not work correctly!" );
-
- // Enable object for real working!
- // Otherwise all calls will be rejected ...
- m_aTransactionManager.setWorkingMode( E_WORK );
- }
- )
+sal_Bool SAL_CALL Desktop::supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence<OUString> SAL_CALL Desktop::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< OUString > aSeq(1);
+ aSeq[0] = OUString("com.sun.star.frame.Desktop");
+ return aSeq;
+}
+
+void Desktop::constructorInit()
+{
+ // Initialize a new XFrames-helper-object to handle XIndexAccess and XElementAccess.
+ // We hold member as reference ... not as pointer too!
+ // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that.
+ // But look on dispose() for right order of deinitialization.
+ OFrames* pFramesHelper = new OFrames( this, &m_aChildTaskContainer );
+ m_xFramesHelper = css::uno::Reference< css::frame::XFrames >( static_cast< ::cppu::OWeakObject* >(pFramesHelper), css::uno::UNO_QUERY );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Initialize a new dispatchhelper-object to handle dispatches.
+ // We use these helper as slave for our interceptor helper ... not directly!
+ // But he is event listener on THIS instance!
+ DispatchProvider* pDispatchHelper = new DispatchProvider( m_xContext, this );
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( static_cast< ::cppu::OWeakObject* >(pDispatchHelper), css::uno::UNO_QUERY );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // Initialize a new interception helper object to handle dispatches and implement an interceptor mechanism.
+ // Set created dispatch provider as slowest slave of it.
+ // Hold interception helper by reference only - not by pointer!
+ // So it's easiear to destroy it.
+ InterceptionHelper* pInterceptionHelper = new InterceptionHelper( this, xDispatchProvider );
+ m_xDispatchHelper = css::uno::Reference< css::frame::XDispatchProvider >( static_cast< ::cppu::OWeakObject* >(pInterceptionHelper), css::uno::UNO_QUERY );
+
+ OUStringBuffer sUntitledPrefix (256);
+ sUntitledPrefix.append (FWK_RESSTR(STR_UNTITLED_DOCUMENT));
+ sUntitledPrefix.appendAscii (" ");
+
+ ::comphelper::NumberedCollection* pNumbers = new ::comphelper::NumberedCollection ();
+ m_xTitleNumberGenerator = css::uno::Reference< css::frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pNumbers), css::uno::UNO_QUERY_THROW);
+ pNumbers->setOwner ( static_cast< ::cppu::OWeakObject* >(this) );
+ pNumbers->setUntitledPrefix ( sUntitledPrefix.makeStringAndClear () );
+
+ // Safe impossible cases
+ // We can't work without this helper!
+ SAL_WARN_IF( !m_xFramesHelper.is(), "fwk", "Desktop::Desktop(): Frames helper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!");
+ SAL_WARN_IF( !m_xDispatchHelper.is(), "fwk", "Desktop::Desktop(): Dispatch helper is not valid. XDispatch will not work correctly!" );
+
+ // Enable object for real working!
+ // Otherwise all calls will be rejected ...
+ m_aTransactionManager.setWorkingMode( E_WORK );
+}
/*-************************************************************************************************************//**
@short standard constructor to create instance by factory
@@ -158,14 +155,10 @@ DEFINE_INIT_SERVICE ( Desktop,
@onerror We throw an ASSERT in debug version or do nothing in relaese version.
*//*-*************************************************************************************************************/
Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext )
- // Init baseclasses first
- // Attention: Don't change order of initialization!
- // ThreadHelpBase is a struct with a lock as member. We can't use a lock as direct member!
- // We must guarantee right initialization and a valid value of this to initialize other baseclasses!
: ThreadHelpBase ( &Application::GetSolarMutex() )
, TransactionBase ( )
- , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType > ( m_aLock.getShareableOslMutex() )
- , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
+ , Desktop_BASE ( *static_cast<osl::Mutex *>(this) )
+ , cppu::OPropertySetHelper( cppu::WeakComponentImplHelperBase::rBHelper )
// Init member
, m_bIsTerminated ( sal_False ) // see dispose() for further information!
, m_xContext ( xContext )
@@ -187,9 +180,6 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon
, m_xSfxTerminator ( )
, m_xTitleNumberGenerator ( )
{
- // Safe impossible cases
- // We don't accept all incoming parameter.
- SAL_WARN_IF( implcp_ctor( xContext ), "fwk", "Desktop::Desktop(): Invalid parameter detected!" );
}
/*-************************************************************************************************************//**
@@ -401,22 +391,22 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra
// SYCNHRONIZED ->
WriteGuard aWriteLock( m_aLock );
- if( sImplementationName.equals(IMPLEMENTATIONNAME_SFXTERMINATOR) )
+ if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
{
m_xSfxTerminator = xListener;
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_PIPETERMINATOR) )
+ if( sImplementationName == "com.sun.star.comp.OfficeIPCThreadController" )
{
m_xPipeTerminator = xListener;
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_QUICKLAUNCHER) )
+ if( sImplementationName == "com.sun.star.comp.desktop.QuickstartWrapper" )
{
m_xQuickLauncher = xListener;
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_SWTHREADMANAGER) )
+ if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
{
m_xSWThreadManager = xListener;
return;
@@ -444,25 +434,25 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::
// SYCNHRONIZED ->
WriteGuard aWriteLock( m_aLock );
- if( sImplementationName.equals(IMPLEMENTATIONNAME_SFXTERMINATOR) )
+ if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
{
m_xSfxTerminator.clear();
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_PIPETERMINATOR) )
+ if( sImplementationName == "com.sun.star.comp.OfficeIPCThreadController" )
{
m_xPipeTerminator.clear();
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_QUICKLAUNCHER) )
+ if( sImplementationName == "com.sun.star.comp.desktop.QuickstartWrapper" )
{
m_xQuickLauncher.clear();
return;
}
- if( sImplementationName.equals(IMPLEMENTATIONNAME_SWTHREADMANAGER) )
+ if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
{
m_xSWThreadManager.clear();
return;
@@ -607,13 +597,10 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
SAL_INFO( "fwk.desktop", "framework (as96863) ::Desktop::loadComponentFromURL" );
- ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
SAL_INFO( "fwk.desktop", "PERFORMANCE - Desktop::loadComponentFromURL()" );
- return LoadEnv::loadComponentFromURL(xThis, xContext, sURL, sTargetFrameName, nSearchFlags, lArguments);
+ return LoadEnv::loadComponentFromURL(xThis, m_xContext, sURL, sTargetFrameName, nSearchFlags, lArguments);
}
/*-************************************************************************************************************//**
@@ -1001,13 +988,6 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
// force using of "if() else if() ..."
//-----------------------------------------------------------------------------------------------------
- // get threadsafe some necessary member which are necessary for following functionality
- /* SAFE { */
- ReadGuard aReadLock( m_aLock );
- css::uno::Reference< css::uno::XComponentContext> xContext = m_xContext;
- aReadLock.unlock();
- /* } SAFE */
-
//-----------------------------------------------------------------------------------------------------
// I.I) "_blank"
// create a new task as child of this desktop instance
@@ -1015,7 +995,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
//-----------------------------------------------------------------------------------------------------
if ( sTargetFrameName==SPECIALTARGET_BLANK )
{
- TaskCreator aCreator( xContext );
+ TaskCreator aCreator( m_xContext );
xTarget = aCreator.createTask(sTargetFrameName,sal_False);
}
@@ -1051,13 +1031,6 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
// But note: Such flags are not valid for the desktop - especialy SIBLINGS or PARENT.
//-------------------------------------------------------------------------------------------------
- // get threadsafe some necessary member which are necessary for following functionality
- /* SAFE { */
- aReadLock.lock();
- OUString sOwnName = m_sName;
- aReadLock.unlock();
- /* } SAFE */
-
//-------------------------------------------------------------------------------------------------
// II.I) SELF
// Check for right name. If it's the searched one return ourself - otherwise
@@ -1065,7 +1038,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
//-------------------------------------------------------------------------------------------------
if (
(nSearchFlags & css::frame::FrameSearchFlag::SELF) &&
- (sOwnName == sTargetFrameName )
+ (m_sName == sTargetFrameName)
)
{
xTarget = this;
@@ -1113,7 +1086,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
(nSearchFlags & css::frame::FrameSearchFlag::CREATE)
)
{
- TaskCreator aCreator( xContext );
+ TaskCreator aCreator( m_xContext );
xTarget = aCreator.createTask(sTargetFrameName,sal_False);
}
}
@@ -1121,8 +1094,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS
return xTarget;
}
-//=============================================================================
-void SAL_CALL Desktop::dispose()
+void SAL_CALL Desktop::disposing()
throw( css::uno::RuntimeException )
{
// Safe impossible cases
@@ -1652,7 +1624,8 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropert
{
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
// (Use method "getInfoHelper()".)
- static css::uno::Reference< css::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
+ cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ) );
pInfo = &xInfo;
}
}
@@ -1931,13 +1904,6 @@ void Desktop::impl_sendNotifyTerminationEvent()
return (nNonClosedFrames < 1);
}
-//*****************************************************************************************************************
-// We work with valid servicemanager only.
-sal_Bool Desktop::implcp_ctor( const css::uno::Reference< css::uno::XComponentContext >& xContext )
-{
- return !xContext.is();
-}
-
// We work with valid listener only.
sal_Bool Desktop::implcp_addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener )
{
@@ -1952,4 +1918,34 @@ sal_Bool Desktop::implcp_removeEventListener( const css::uno::Reference< css::la
} // namespace framework
+namespace {
+
+struct Instance {
+ explicit Instance(
+ css::uno::Reference<css::uno::XComponentContext> const & context):
+ instance(static_cast<cppu::OWeakObject *>(new framework::Desktop(context)))
+ {
+ static_cast<framework::Desktop *>(static_cast<cppu::OWeakObject *>
+ (instance.get()))->constructorInit();
+ }
+
+ css::uno::Reference<css::uno::XInterface> instance;
+};
+
+struct Singleton:
+ public rtl::StaticWithArg<
+ Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_Desktop_get_implementation(
+ css::uno::XComponentContext *context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 3503f74..1b8132c 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -36,7 +36,8 @@
constructor="com_sun_star_comp_framework_ControlMenuController_get_implementation">
<service name="com.sun.star.frame.PopupMenuController"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.Desktop">
+ <implementation name="com.sun.star.comp.framework.Desktop"
+ constructor="com_sun_star_comp_framework_Desktop_get_implementation">
<service name="com.sun.star.frame.Desktop"/>
<singleton name="com.sun.star.frame.theDesktop"/>
</implementation>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 3f1a0c1..7454687 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -48,6 +48,7 @@ core_factory_list = [
core_constructor_list = [
# framework/util/fwk.component
"com_sun_star_comp_framework_AutoRecovery_get_implementation",
+ "com_sun_star_comp_framework_Desktop_get_implementation",
"com_sun_star_comp_framework_Frame_get_implementation",
"com_sun_star_comp_framework_JobExecutor_get_implementation",
"com_sun_star_comp_framework_LayoutManager_get_implementation",
commit ce02519c5c7e43fabe7b0c587e3304d48b795d0f
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 20:01:03 2014 +0100
Introduce com.sun.star.frame.theDesktop singleton.
Change-Id: I3d269609119149e289652f6bc106e6bd9061672d
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 9d5fbb1..3503f74 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -38,6 +38,7 @@
</implementation>
<implementation name="com.sun.star.comp.framework.Desktop">
<service name="com.sun.star.frame.Desktop"/>
+ <singleton name="com.sun.star.frame.theDesktop"/>
</implementation>
<implementation name="com.sun.star.comp.framework.DocumentAcceleratorConfiguration"
constructor="com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation">
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 2e1f2d7..3ae45b0 100755
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -201,6 +201,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/frame,\
TaskCreator \
UICommandDescription \
theAutoRecovery \
+ theDesktop \
theGlobalEventBroadcaster \
theUICommandDescription \
))
diff --git a/offapi/com/sun/star/frame/Desktop.idl b/offapi/com/sun/star/frame/Desktop.idl
index c1a1c04..2d6f18d 100644
--- a/offapi/com/sun/star/frame/Desktop.idl
+++ b/offapi/com/sun/star/frame/Desktop.idl
@@ -24,17 +24,13 @@
module com { module sun { module star { module frame {
-/** is the environment for components which can instantiate within frames
-
- <p>
- A desktop environment contains tasks with one or more frames
- in which components can be loaded. The term "task" or naming a frame as a
- "task frame" is not in any way related to any additional implemented
- interfaces, it's just because these frames use task windows.
- </p>
+/**
+ A legacy (single-instance) service-variant of theDesktop singleton.
+
+ @deprecated Use theDesktop singleton instead.
*/
-published service Desktop : XDesktop2;
+published service Desktop : XDesktop2;
}; }; }; };
diff --git a/offapi/com/sun/star/frame/theDesktop.idl b/offapi/com/sun/star/frame/theDesktop.idl
new file mode 100644
index 0000000..12c7d79
--- /dev/null
+++ b/offapi/com/sun/star/frame/theDesktop.idl
@@ -0,0 +1,47 @@
+/* -*- 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_frame_theDesktop_idl__
+#define __com_sun_star_frame_theDesktop_idl__
+
+#include <com/sun/star/frame/XDesktop2.idl>
+
+
+ module com { module sun { module star { module frame {
+
+/** is the environment for components which can instantiate within frames
+
+ <p>
+ A desktop environment contains tasks with one or more frames
+ in which components can be loaded. The term "task" or naming a frame as a
+ "task frame" is not in any way related to any additional implemented
+ interfaces, it's just because these frames use task windows.
+ </p>
+
+ Prior to LibreOffice 4.3, this singleton was only available as a
+ (single-instance) Desktop service.
+
+ @since LibreOffice 4.3
+ */
+published singleton theDesktop : XDesktop2;
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 924a415e68cfeb8eda54db3e19f71eafcd2b9b1e
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 13:30:06 2014 +0100
cosmetics
Change-Id: Ice4f20db3a590568a7ae4ae59fa0c4ff13e59051
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 077a39f..c595f5c 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -429,9 +429,8 @@ com_sun_star_comp_framework_JobExecutor_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- css::uno::XInterface *inst = Singleton::get(context).instance.get();
- inst->acquire();
- return inst;
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index faf8e86..01519ba 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -4562,7 +4562,8 @@ com_sun_star_comp_framework_AutoRecovery_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(static_cast<cppu::OWeakObject *>(Singleton::get(context).instance.get()));
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 43ee09b..58023cb 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -463,7 +463,8 @@ com_sun_star_comp_framework_UICategoryDescription_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(static_cast<cppu::OWeakObject *>(Singleton::get(context).instance.get()));
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index d5931e9..367e8ad 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -549,9 +549,8 @@ com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- css::uno::XInterface *inst = Singleton::get(context).instance.get();
- inst->acquire();
- return inst;
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit eb1799714c7f57cbb8006d33736cd5e088ed6558
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 12:01:00 2014 +0100
cleaning the code a bit
Change-Id: I4cc9c16fb79f669ae70d10a50ace3943075edd46
diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx
index ce9ea19..ba8988d 100644
--- a/framework/inc/uifactory/menubarfactory.hxx
+++ b/framework/inc/uifactory/menubarfactory.hxx
@@ -23,7 +23,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/frame/XModuleManager2.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <toolkit/awt/vclxmenu.hxx>
@@ -67,11 +66,10 @@ typedef ::cppu::WeakImplHelper2<
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
static void CreateUIElement(const OUString& ResourceURL
- , const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args
+ ,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args
,const char* _pExtraMode
- ,const char* _pAsciiName
+ ,const OUString& ResourceType
,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
protected:
diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx
index 3395854..c5ffdfe 100644
--- a/framework/source/uifactory/menubarfactory.cxx
+++ b/framework/source/uifactory/menubarfactory.cxx
@@ -58,21 +58,17 @@ Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement(
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
- // SAFE
- SolarMutexClearableGuard g;
- MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xContext );
- Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY );
- Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
- g.clear();
- CreateUIElement(ResourceURL, Args, "MenuOnly", "private:resource/menubar/", xMenuBar, xModuleManager, m_xContext);
+ Reference< ::com::sun::star::ui::XUIElement > xMenuBar(
+ static_cast<OWeakObject *>(new MenuBarWrapper(m_xContext)), UNO_QUERY);
+ CreateUIElement(ResourceURL, Args, "MenuOnly", "private:resource/menubar/", xMenuBar, m_xContext);
return xMenuBar;
}
+
void MenuBarFactory::CreateUIElement(const OUString& ResourceURL
- , const Sequence< PropertyValue >& Args
+ ,const Sequence< PropertyValue >& Args
,const char* _pExtraMode
- ,const char* _pAsciiName
+ ,const OUString& ResourceType
,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext)
{
Reference< XUIConfigurationManager > xCfgMgr;
@@ -95,7 +91,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL
else if ( _pExtraMode && Args[n].Name.equalsAscii( _pExtraMode ))
Args[n].Value >>= bExtraMode;
}
- if ( aResourceURL.indexOf( OUString::createFromAscii(_pAsciiName)) != 0 )
+ if (!aResourceURL.startsWith(ResourceType))
throw IllegalArgumentException();
// Identify frame and determine document based ui configuration manager/module ui configuration manager
@@ -120,7 +116,9 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL
if ( !bHasSettings )
{
- OUString aModuleIdentifier = _xModuleManager->identify( xFrame );
+ Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager =
+ ModuleManager::create( _rxContext );
+ OUString aModuleIdentifier = xModuleManager->identify( xFrame );
if ( !aModuleIdentifier.isEmpty() )
{
Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx
index ac30f93..adf1673 100644
--- a/framework/source/uifactory/statusbarfactory.cxx
+++ b/framework/source/uifactory/statusbarfactory.cxx
@@ -77,14 +77,10 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement(
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
- // SAFE
- SolarMutexClearableGuard g;
- StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xContext );
- Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
- Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
- g.clear();
- MenuBarFactory::CreateUIElement(ResourceURL, Args, NULL, "private:resource/statusbar/", xMenuBar, xModuleManager, m_xContext );
- return xMenuBar;
+ Reference< ::com::sun::star::ui::XUIElement > xStatusBar(
+ static_cast<OWeakObject *>(new StatusBarWrapper(m_xContext)), UNO_QUERY);
+ MenuBarFactory::CreateUIElement(ResourceURL, Args, NULL, "private:resource/statusbar/", xStatusBar, m_xContext);
+ return xStatusBar;
}
}
diff --git a/framework/source/uifactory/toolbarfactory.cxx b/framework/source/uifactory/toolbarfactory.cxx
index 74f856f..2e104b5 100644
--- a/framework/source/uifactory/toolbarfactory.cxx
+++ b/framework/source/uifactory/toolbarfactory.cxx
@@ -77,13 +77,10 @@ Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement(
const Sequence< PropertyValue >& Args )
throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
{
- SolarMutexClearableGuard g;
- ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xContext );
- Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY );
- Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create(m_xContext);
- g.clear();
- CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xMenuBar, xModuleManager, m_xContext);
- return xMenuBar;
+ Reference< ::com::sun::star::ui::XUIElement > xToolBar(
+ static_cast<OWeakObject *>(new ToolBarWrapper(m_xContext)), UNO_QUERY);
+ CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xToolBar, m_xContext);
+ return xToolBar;
}
}
commit 5691ef0b4f3d1be45f3f208db668d295013cdc9b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 12:00:33 2014 +0100
Move this Singleton class to anonymous namespace.
If you add more Singleton classes into framework namespace,
it builds without any warning but I was not able to see menu text
labels.
Luckily UICommandDescription is involved in this and the problem was not
hidden somewhere else.
Change-Id: Iba0c06c2e31ae509579f31308d9f45f0cb9f654f
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index fc98617..6e31dc6 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -749,11 +749,15 @@ throw (::com::sun::star::uno::RuntimeException)
return sal_True;
}
+} // namespace framework
+
+namespace {
+
struct Instance {
explicit Instance(
css::uno::Reference<css::uno::XComponentContext> const & context):
instance(static_cast<cppu::OWeakObject *>(
- new UICommandDescription(context)))
+ new framework::UICommandDescription(context)))
{
}
@@ -765,7 +769,7 @@ struct Singleton:
Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
{};
-} // namespace framework
+}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_framework_UICommandDescription_get_implementation(
@@ -773,7 +777,7 @@ com_sun_star_comp_framework_UICommandDescription_get_implementation(
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(static_cast<cppu::OWeakObject *>(
- framework::Singleton::get(context).instance.get()));
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9a4056c18f09160264af7a5533852c9deae4b27c
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 09:22:15 2014 +0100
Do not use pattern::configuration::ConfigurationHelper.
Change-Id: I9cf913f085a2c6862e44803485ab63e2b4572eab
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index d76fea6..bbccd55 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -19,7 +19,6 @@
#include <accelerators/acceleratorconfiguration.hxx>
-#include <pattern/configuration.hxx>
#include <accelerators/presethandler.hxx>
#include <xml/saxnamespacefilter.hxx>
@@ -47,24 +46,16 @@
#include <com/sun/star/awt/KeyEvent.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/util/XChangesNotifier.hpp>
#include <comphelper/configurationhelper.hxx>
+#include <officecfg/Setup.hxx>
#include <unotools/configpaths.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <stdio.h>
-
namespace framework
{
const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys";
const char CFG_PROP_COMMAND[] = "Command";
-#ifdef fpc
- #error "Who exports this define? I use it as namespace alias ..."
-#else
- namespace fpc = ::framework::pattern::configuration;
-#endif
-
OUString lcl_getKeyString(salhelper::SingletonRef<framework::KeyMapping>& _rKeyMapping, const css::awt::KeyEvent& aKeyEvent)
{
const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
@@ -588,17 +579,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
//-----------------------------------------------
OUString XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( xContext,
- "/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- OUString sISOLocale;
- xProp->getPropertyValue("ooLocale") >>= sISOLocale;
+ OUString sISOLocale = officecfg::Setup::L10N::ooLocale::get();
if (sISOLocale.isEmpty())
return OUString("en-US");
@@ -1626,17 +1607,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
//-----------------------------------------------
OUString XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( xContext,
- "/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- OUString sISOLocale;
- xProp->getPropertyValue("ooLocale") >>= sISOLocale;
+ OUString sISOLocale = officecfg::Setup::L10N::ooLocale::get();
if (sISOLocale.isEmpty())
return OUString("en-US");
diff --git a/framework/source/inc/pattern/configuration.hxx b/framework/source/inc/pattern/configuration.hxx
deleted file mode 100644
index a893153..0000000
--- a/framework/source/inc/pattern/configuration.hxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- 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 INCLUDED_FRAMEWORK_SOURCE_INC_PATTERN_CONFIGURATION_HXX
-#define INCLUDED_FRAMEWORK_SOURCE_INC_PATTERN_CONFIGURATION_HXX
-
-#include <services.h>
-#include <general.h>
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.hxx>
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <rtl/ustrbuf.hxx>
-
-namespace framework{
- namespace pattern{
- namespace configuration{
-
-//-----------------------------------------------
-class ConfigurationHelper
-{
-
- public:
-
- //---------------------------------------
- /** @short allow opening of a configuration access
- in different working modes.
-
- @descr All enum values must be useable as flags
- mapped into a int32 value!
- */
- enum EOpenMode
- {
- /// open it readonly (default=readwrite!)
- E_READONLY = 1,
- /// disable fallback handling for localized cfg nodes
- E_ALL_LOCALES = 2
- };
-
- //-------------------------------------------
- // interface
- public:
-
- //---------------------------------------
- /**
- @short opens a configuration access.
-
- @descr TODO
-
- @param rxContext
- this method need an uno service manager for internal work.
-
- @param sPackage
- name the configuration file.
- e.g. "/.org.openoffice.Setup"
- Note: It must start with "/" but end without(!) "/"!
-
- @param sRelPath
- describe the relativ path of the requested key inside
- the specified package.
- e.g. "Office/Factories"
- Note: Its not allowed to start or end with a "/"!
- Further you must use encoded path elements if
- e.g. set nodes are involved.
-
- @param nOpenFlags
- force opening of the configuration access in special mode.
- see enum EOpenMode for further information.
- */
- static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
- const OUString& sPackage ,
- const OUString& sRelPath ,
- sal_Int32 nOpenFlags)
- {
- css::uno::Reference< css::uno::XInterface > xCFG;
-
- try
- {
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider =
- css::configuration::theDefaultProvider::get( rxContext );
-
- OUStringBuffer sPath(1024);
- sPath.append(sPackage );
- sPath.append(static_cast<sal_Unicode>('/'));
- sPath.append(sRelPath );
-
- sal_Bool bReadOnly = ((nOpenFlags & ConfigurationHelper::E_READONLY ) == ConfigurationHelper::E_READONLY );
- sal_Bool bAllLocales = ((nOpenFlags & ConfigurationHelper::E_ALL_LOCALES) == ConfigurationHelper::E_ALL_LOCALES);
-
- sal_Int32 c = 1;
- if (bAllLocales)
- c = 2;
-
- css::uno::Sequence< css::uno::Any > lParams(c);
- css::beans::PropertyValue aParam;
-
- aParam.Name = OUString("nodepath");
- aParam.Value <<= sPath.makeStringAndClear();
- lParams[0] <<= aParam;
-
- if (bAllLocales)
- {
- aParam.Name = OUString("*");
- aParam.Value <<= sal_True;
- lParams[1] <<= aParam;
- }
-
- if (bReadOnly)
- xCFG = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS, lParams);
- else
- xCFG = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
- }
- catch(const css::uno::RuntimeException& exRun)
- { throw exRun; }
- catch(const css::uno::Exception&)
- { xCFG.clear(); }
-
- return xCFG;
- }
-};
-
- } // namespace configuration
- } // namespace pattern
-} // namespace framework
-
-#endif // INCLUDED_FRAMEWORK_SOURCE_INC_PATTERN_CONFIGURATION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit dae2b047f9fd84032cb282af3c57ee3d92f9256a
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 08:59:05 2014 +0100
Remove unused ContainerQuery constants.
Change-Id: Ib9f96f79d805c91e80fa5366c71e3e975ebabe90
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index 9a2347d..e8ad8af 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -69,7 +69,6 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/classes/fwktabwindow \
framework/source/classes/menumanager \
framework/source/classes/taskcreator \
- framework/source/constant/containerquery \
framework/source/dispatch/closedispatcher \
framework/source/dispatch/dispatchinformationprovider \
framework/source/dispatch/dispatchprovider \
diff --git a/framework/source/constant/containerquery.cxx b/framework/source/constant/containerquery.cxx
deleted file mode 100644
index c2d6ac9..0000000
--- a/framework/source/constant/containerquery.cxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- 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 .
- */
-
-
-#include <constant/containerquery.hxx>
-
-namespace framework{
- namespace constant{
-
-const sal_Unicode ContainerQuery::SEPARATOR_PARAM = (sal_Unicode)':';
-const sal_Unicode ContainerQuery::SEPARATOR_VALUE = (sal_Unicode)'=';
-
- } // namespace constant
-} // namespace framework
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/inc/constant/containerquery.hxx b/framework/source/inc/constant/containerquery.hxx
deleted file mode 100644
index 889e542..0000000
--- a/framework/source/inc/constant/containerquery.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- 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 INCLUDED_FRAMEWORK_SOURCE_INC_CONSTANT_CONTAINERQUERY_HXX
-#define INCLUDED_FRAMEWORK_SOURCE_INC_CONSTANT_CONTAINERQUERY_HXX
-
-#include <sal/types.h>
-
-namespace framework{
- namespace constant{
-
-struct ContainerQuery
-{
- public:
-
- static const sal_Unicode SEPARATOR_PARAM;
- static const sal_Unicode SEPARATOR_VALUE;
-};
-
- } // namespace constant
-} // namespace framework
-
-#endif // INCLUDED_FRAMEWORK_SOURCE_INC_CONSTANT_CONTAINERQUERY_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 7aa849a..e22d65d 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -22,7 +22,6 @@
#include <loadenv/targethelper.hxx>
#include <framework/framelistanalyzer.hxx>
-#include <constant/containerquery.hxx>
#include <interaction/quietinteraction.hxx>
#include <threadhelp/writeguard.hxx>
#include <threadhelp/readguard.hxx>
commit d8db7f0f4463c68717ed21722a45de035036be4b
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Wed Feb 12 08:50:25 2014 +0100
ModuleManager should be static; and simplify.
This saves some cycles used to open configuration many times.
Change-Id: I12cc7ac87df897a518368094b12d8dcb5be4e3b5
diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx
index d275e0a..4b590be 100644
--- a/framework/source/services/modulemanager.cxx
+++ b/framework/source/services/modulemanager.cxx
@@ -17,13 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <sal/config.h>
-#include <threadhelp/readguard.hxx>
-#include <threadhelp/threadhelpbase.hxx>
-#include <threadhelp/writeguard.hxx>
-
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -40,23 +35,17 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/sequenceasvector.hxx>
#include <comphelper/enumhelper.hxx>
-#include <rtl/ref.hxx>
#include <boost/noncopyable.hpp>
-using namespace framework;
-
namespace {
-static const char CFGPATH_FACTORIES[] = "/org.openoffice.Setup/Office/Factories";
-static const char MODULEPROP_IDENTIFIER[] = "ooSetupFactoryModuleIdentifier";
-
class ModuleManager:
public cppu::WeakImplHelper3<
css::lang::XServiceInfo,
css::frame::XModuleManager2,
css::container::XContainerQuery >,
- private ThreadHelpBase, private boost::noncopyable
+ private boost::noncopyable
{
private:
@@ -73,9 +62,6 @@ private:
*/
css::uno::Reference< css::container::XNameAccess > m_xCFG;
-//___________________________________________
-// interface
-
public:
ModuleManager(const css::uno::Reference< css::uno::XComponentContext >& xContext);
@@ -132,37 +118,10 @@ public:
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties)
throw(css::uno::RuntimeException);
-//___________________________________________
-// helper
private:
//---------------------------------------
- /** @short open the underlying configuration.
-
- @descr This method must be called every time
- a (reaonly!) configuration is needed. Because
- method works together with the member
- m_xCFG, open it on demand and cache it
- afterwards.
-
- Note: A writable configuration access
- must be created explicitly. Otherwise
- we cant make sure that broken write requests
- wont affect our read access !
-
- @return [com.sun.star.container.XNameAccess]
- the configuration object
-
- @throw [com.sun.star.uno.RuntimeException]
- if config could not be opened successfully!
-
- @threadsafe
- */
- css::uno::Reference< css::container::XNameAccess > implts_getConfig()
- throw(css::uno::RuntimeException);
-
- //---------------------------------------
/** @short makes the real identification of the module.
@descr It checks for the optional but preferred interface
@@ -187,15 +146,16 @@ private:
};
ModuleManager::ModuleManager(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : ThreadHelpBase( )
- , m_xContext (xContext)
+ : m_xContext(xContext)
{
+ m_xCFG.set( comphelper::ConfigurationHelper::openConfig(
+ m_xContext, "/org.openoffice.Setup/Office/Factories",
+ comphelper::ConfigurationHelper::E_READONLY),
+ css::uno::UNO_QUERY_THROW );
}
ModuleManager::~ModuleManager()
{
- if (m_xCFG.is())
- m_xCFG.clear();
}
OUString ModuleManager::getImplementationName()
@@ -289,20 +249,14 @@ void SAL_CALL ModuleManager::replaceByName(const OUString& sName ,
2);
}
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
// get access to the element
// Note: Dont use impl_getConfig() method here. Because it creates a readonly access only, further
// it cache it as a member of this module manager instance. If we change some props there ... but dont
// flush changes (because an error occurred) we will read them later. If we use a different config access
// we can close it without a flush ... and our read data wont be affected .-)
css::uno::Reference< css::uno::XInterface > xCfg = ::comphelper::ConfigurationHelper::openConfig(
- xContext,
- OUString(CFGPATH_FACTORIES),
+ m_xContext,
+ "/org.openoffice.Setup/Office/Factories",
::comphelper::ConfigurationHelper::E_STANDARD);
css::uno::Reference< css::container::XNameAccess > xModules (xCfg, css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::container::XNameReplace > xModule ;
@@ -345,9 +299,8 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)
css::uno::RuntimeException )
{
// get access to the element
- css::uno::Reference< css::container::XNameAccess > xCFG = implts_getConfig();
css::uno::Reference< css::container::XNameAccess > xModule;
- xCFG->getByName(sName) >>= xModule;
+ m_xCFG->getByName(sName) >>= xModule;
if (!xModule.is())
{
throw css::uno::RuntimeException(
@@ -357,15 +310,13 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)
// convert it to seq< PropertyValue >
const css::uno::Sequence< OUString > lPropNames = xModule->getElementNames();
- ::comphelper::SequenceAsHashMap lProps ;
- sal_Int32 c = lPropNames.getLength();
- sal_Int32 i = 0;
+ comphelper::SequenceAsHashMap lProps;
- lProps[OUString(MODULEPROP_IDENTIFIER)] <<= sName;
- for (i=0; i<c; ++i)
+ lProps[OUString("ooSetupFactoryModuleIdentifier")] <<= sName;
+ for (sal_Int32 i = 0; i < lPropNames.getLength(); ++i)
{
- const OUString& sPropName = lPropNames[i];
- lProps[sPropName] = xModule->getByName(sPropName);
+ const OUString& sPropName = lPropNames[i];
+ lProps[sPropName] = xModule->getByName(sPropName);
}
return css::uno::makeAny(lProps.getAsConstPropertyValueList());
@@ -374,15 +325,13 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName)
css::uno::Sequence< OUString > SAL_CALL ModuleManager::getElementNames()
throw(css::uno::RuntimeException)
{
- css::uno::Reference< css::container::XNameAccess > xCFG = implts_getConfig();
- return xCFG->getElementNames();
+ return m_xCFG->getElementNames();
}
sal_Bool SAL_CALL ModuleManager::hasByName(const OUString& sName)
throw(css::uno::RuntimeException)
{
- css::uno::Reference< css::container::XNameAccess > xCFG = implts_getConfig();
- return xCFG->hasByName(sName);
+ return m_xCFG->hasByName(sName);
}
css::uno::Type SAL_CALL ModuleManager::getElementType()
@@ -394,8 +343,7 @@ css::uno::Type SAL_CALL ModuleManager::getElementType()
sal_Bool SAL_CALL ModuleManager::hasElements()
throw(css::uno::RuntimeException)
{
- css::uno::Reference< css::container::XNameAccess > xCFG = implts_getConfig();
- return xCFG->hasElements();
+ return m_xCFG->hasElements();
}
css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::createSubSetEnumerationByQuery(const OUString&)
@@ -407,19 +355,15 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::crea
css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties)
throw(css::uno::RuntimeException)
{
- ::comphelper::SequenceAsHashMap lSearchProps (lProperties);
- css::uno::Sequence< OUString > lModules = getElementNames();
- sal_Int32 c = lModules.getLength();
- sal_Int32 i = 0;
- ::comphelper::SequenceAsVector< css::uno::Any > lResult ;
+ ::comphelper::SequenceAsHashMap lSearchProps(lProperties);
+ const css::uno::Sequence< OUString > lModules = getElementNames();
+ ::comphelper::SequenceAsVector< css::uno::Any > lResult;
- for (i=0; i<c; ++i)
+ for (sal_Int32 i = 0; i < lModules.getLength(); ++i)
{
try
{
- const OUString& sModule = lModules[i];
- ::comphelper::SequenceAsHashMap lModuleProps = getByName(sModule);
-
+ ::comphelper::SequenceAsHashMap lModuleProps = getByName(lModules[i]);
if (lModuleProps.match(lSearchProps))
lResult.push_back(css::uno::makeAny(lModuleProps.getAsConstPropertyValueList()));
}
@@ -433,41 +377,6 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::crea
return xEnum;
}
-css::uno::Reference< css::container::XNameAccess > ModuleManager::implts_getConfig()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- if (m_xCFG.is())
- return m_xCFG;
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCfg;
- try
- {
- xCfg = ::comphelper::ConfigurationHelper::openConfig(
- xContext,
- OUString(CFGPATH_FACTORIES),
- ::comphelper::ConfigurationHelper::E_READONLY);
- }
- catch(const css::uno::RuntimeException&)
- {
- throw;
- }
- catch(const css::uno::Exception&)
- {
- xCfg.clear();
- }
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
- m_xCFG = css::uno::Reference< css::container::XNameAccess >(xCfg, css::uno::UNO_QUERY_THROW);
- return m_xCFG;
- // <- SAFE ----------------------------------
-}
-
OUString ModuleManager::implts_identify(const css::uno::Reference< css::uno::XInterface >& xComponent)
{
// Search for an optional (!) interface XModule first.
@@ -484,19 +393,30 @@ OUString ModuleManager::implts_identify(const css::uno::Reference< css::uno::XIn
return OUString();
const css::uno::Sequence< OUString > lKnownModules = getElementNames();
- const OUString* pKnownModules = lKnownModules.getConstArray();
- sal_Int32 c = lKnownModules.getLength();
- sal_Int32 i = 0;
-
- for (i=0; i<c; ++i)
+ for (sal_Int32 i = 0; i < lKnownModules.getLength(); ++i)
{
- if (xInfo->supportsService(pKnownModules[i]))
- return pKnownModules[i];
+ if (xInfo->supportsService(lKnownModules[i]))
+ return lKnownModules[i];
}
return OUString();
}
+struct Instance {
+ explicit Instance(
+ css::uno::Reference<css::uno::XComponentContext> const & context):
+ instance(static_cast<cppu::OWeakObject *>(new ModuleManager(context)))
+ {
+ }
+
+ css::uno::Reference<css::uno::XInterface> instance;
+};
+
+struct Singleton:
+ public rtl::StaticWithArg<
+ Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
+
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
@@ -504,7 +424,8 @@ com_sun_star_comp_framework_ModuleManager_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(new ModuleManager(context));
+ return cppu::acquire(static_cast<cppu::OWeakObject *>(
+ Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list