xref: /AOO41X/main/framework/source/fwe/classes/rootactiontriggercontainer.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_framework.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <classes/rootactiontriggercontainer.hxx>
32*cdf0e10cSrcweir #include <classes/actiontriggercontainer.hxx>
33*cdf0e10cSrcweir #include <classes/actiontriggerpropertyset.hxx>
34*cdf0e10cSrcweir #include <classes/actiontriggerseparatorpropertyset.hxx>
35*cdf0e10cSrcweir #include <framework/actiontriggerhelper.hxx>
36*cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx>
37*cdf0e10cSrcweir #include <osl/mutex.hxx>
38*cdf0e10cSrcweir #include <vcl/svapp.hxx>
39*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir using namespace cppu;
43*cdf0e10cSrcweir using namespace com::sun::star::uno;
44*cdf0e10cSrcweir using namespace com::sun::star::lang;
45*cdf0e10cSrcweir using namespace com::sun::star::container;
46*cdf0e10cSrcweir using namespace com::sun::star::beans;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace framework
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir static Sequence< sal_Int8 > impl_getStaticIdentifier()
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir     static sal_uInt8 pGUID[16] = { 0x17, 0x0F, 0xA2, 0xC9, 0xCA, 0x50, 0x4A, 0xD3, 0xA6, 0x3B, 0x39, 0x99, 0xC5, 0x96, 0x43, 0x27 };
55*cdf0e10cSrcweir     static ::com::sun::star::uno::Sequence< sal_Int8 > seqID((sal_Int8*)pGUID,16) ;
56*cdf0e10cSrcweir     return seqID ;
57*cdf0e10cSrcweir }
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir RootActionTriggerContainer::RootActionTriggerContainer( const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier, const Reference< XMultiServiceFactory >& rServiceManager ) :
61*cdf0e10cSrcweir 	PropertySetContainer( rServiceManager )
62*cdf0e10cSrcweir 	,	m_bContainerCreated( sal_False )
63*cdf0e10cSrcweir 	,	m_bContainerChanged( sal_False )
64*cdf0e10cSrcweir 	,	m_bInContainerCreation( sal_False )
65*cdf0e10cSrcweir     ,   m_pMenu( pMenu )
66*cdf0e10cSrcweir     ,   m_pMenuIdentifier( pMenuIdentifier )
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir RootActionTriggerContainer::~RootActionTriggerContainer()
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir }
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir Sequence< sal_Int8 > RootActionTriggerContainer::GetUnoTunnelId() const
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir 	return impl_getStaticIdentifier();
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir const Menu* RootActionTriggerContainer::GetMenu()
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	if ( !m_bContainerChanged )
82*cdf0e10cSrcweir 		return m_pMenu;
83*cdf0e10cSrcweir 	else
84*cdf0e10cSrcweir 	{
85*cdf0e10cSrcweir 		ResetableGuard aGuard( m_aLock );
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 		Menu* pNewMenu = new PopupMenu;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 		ActionTriggerHelper::CreateMenuFromActionTriggerContainer( pNewMenu, this );
90*cdf0e10cSrcweir 		m_pMenu = pNewMenu;
91*cdf0e10cSrcweir 		m_bContainerChanged = sal_False;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 		return m_pMenu;
94*cdf0e10cSrcweir 	}
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir // XInterface
99*cdf0e10cSrcweir Any SAL_CALL RootActionTriggerContainer::queryInterface( const Type& aType )
100*cdf0e10cSrcweir throw ( RuntimeException )
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir 	Any a = ::cppu::queryInterface(
103*cdf0e10cSrcweir 				aType ,
104*cdf0e10cSrcweir 				SAL_STATIC_CAST( XMultiServiceFactory*	, this ),
105*cdf0e10cSrcweir 				SAL_STATIC_CAST( XServiceInfo*			, this ),
106*cdf0e10cSrcweir 				SAL_STATIC_CAST( XUnoTunnel*			, this ),
107*cdf0e10cSrcweir                 SAL_STATIC_CAST( XTypeProvider*         , this ),
108*cdf0e10cSrcweir                 SAL_STATIC_CAST( XNamed*                , this ));
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	if( a.hasValue() )
111*cdf0e10cSrcweir 	{
112*cdf0e10cSrcweir 		return a;
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	return PropertySetContainer::queryInterface( aType );
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir void SAL_CALL RootActionTriggerContainer::acquire() throw ()
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir 	PropertySetContainer::acquire();
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir void SAL_CALL RootActionTriggerContainer::release() throw ()
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	PropertySetContainer::release();
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir // XMultiServiceFactory
129*cdf0e10cSrcweir Reference< XInterface > SAL_CALL RootActionTriggerContainer::createInstance( const ::rtl::OUString& aServiceSpecifier )
130*cdf0e10cSrcweir throw ( Exception,  RuntimeException )
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir 	if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGER ))
133*cdf0e10cSrcweir 		return (OWeakObject *)( new ActionTriggerPropertySet( m_xServiceManager ));
134*cdf0e10cSrcweir 	else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERCONTAINER ))
135*cdf0e10cSrcweir 		return (OWeakObject *)( new ActionTriggerContainer( m_xServiceManager ));
136*cdf0e10cSrcweir 	else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERSEPARATOR ))
137*cdf0e10cSrcweir 		return (OWeakObject *)( new ActionTriggerSeparatorPropertySet( m_xServiceManager ));
138*cdf0e10cSrcweir 	else
139*cdf0e10cSrcweir 		throw com::sun::star::uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown service specifier!" )), (OWeakObject *)this );
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir Reference< XInterface > SAL_CALL RootActionTriggerContainer::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /*Arguments*/ )
143*cdf0e10cSrcweir throw ( Exception, RuntimeException )
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	return createInstance( ServiceSpecifier );
146*cdf0e10cSrcweir }
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL RootActionTriggerContainer::getAvailableServiceNames()
149*cdf0e10cSrcweir throw ( RuntimeException )
150*cdf0e10cSrcweir {
151*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSeq( 3 );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGER ));
154*cdf0e10cSrcweir 	aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGERCONTAINER ));
155*cdf0e10cSrcweir 	aSeq[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGERSEPARATOR ));
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	return aSeq;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir // XIndexContainer
162*cdf0e10cSrcweir void SAL_CALL RootActionTriggerContainer::insertByIndex( sal_Int32 Index, const Any& Element )
163*cdf0e10cSrcweir throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir 	ResetableGuard aGuard( m_aLock );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	if ( !m_bContainerCreated )
168*cdf0e10cSrcweir 		FillContainer();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	if ( !m_bInContainerCreation )
171*cdf0e10cSrcweir 		m_bContainerChanged = sal_True;
172*cdf0e10cSrcweir 	PropertySetContainer::insertByIndex( Index, Element );
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir void SAL_CALL RootActionTriggerContainer::removeByIndex( sal_Int32 Index )
176*cdf0e10cSrcweir throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
177*cdf0e10cSrcweir {
178*cdf0e10cSrcweir 	ResetableGuard aGuard( m_aLock );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	if ( !m_bContainerCreated )
181*cdf0e10cSrcweir 		FillContainer();
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 	if ( !m_bInContainerCreation )
184*cdf0e10cSrcweir 		m_bContainerChanged = sal_True;
185*cdf0e10cSrcweir 	PropertySetContainer::removeByIndex( Index );
186*cdf0e10cSrcweir }
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir // XIndexReplace
190*cdf0e10cSrcweir void SAL_CALL RootActionTriggerContainer::replaceByIndex( sal_Int32 Index, const Any& Element )
191*cdf0e10cSrcweir throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
192*cdf0e10cSrcweir {
193*cdf0e10cSrcweir 	ResetableGuard aGuard( m_aLock );
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	if ( !m_bContainerCreated )
196*cdf0e10cSrcweir 		FillContainer();
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 	if ( !m_bInContainerCreation )
199*cdf0e10cSrcweir 		m_bContainerChanged = sal_True;
200*cdf0e10cSrcweir 	PropertySetContainer::replaceByIndex( Index, Element );
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir // XIndexAccess
205*cdf0e10cSrcweir sal_Int32 SAL_CALL RootActionTriggerContainer::getCount()
206*cdf0e10cSrcweir throw ( RuntimeException )
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir 	ResetableGuard aGuard( m_aLock );
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	if ( !m_bContainerCreated )
211*cdf0e10cSrcweir 	{
212*cdf0e10cSrcweir 		if ( m_pMenu )
213*cdf0e10cSrcweir 		{
214*cdf0e10cSrcweir 			vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
215*cdf0e10cSrcweir 			return m_pMenu->GetItemCount();
216*cdf0e10cSrcweir 		}
217*cdf0e10cSrcweir 		else
218*cdf0e10cSrcweir 			return 0;
219*cdf0e10cSrcweir 	}
220*cdf0e10cSrcweir 	else
221*cdf0e10cSrcweir 	{
222*cdf0e10cSrcweir 		return PropertySetContainer::getCount();
223*cdf0e10cSrcweir 	}
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir Any SAL_CALL RootActionTriggerContainer::getByIndex( sal_Int32 Index )
227*cdf0e10cSrcweir throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
228*cdf0e10cSrcweir {
229*cdf0e10cSrcweir 	ResetableGuard aGuard( m_aLock );
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 	if ( !m_bContainerCreated )
232*cdf0e10cSrcweir 		FillContainer();
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 	return PropertySetContainer::getByIndex( Index );
235*cdf0e10cSrcweir }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir // XElementAccess
239*cdf0e10cSrcweir Type SAL_CALL RootActionTriggerContainer::getElementType()
240*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException)
241*cdf0e10cSrcweir {
242*cdf0e10cSrcweir 	return ::getCppuType(( Reference< XPropertySet >*)0);
243*cdf0e10cSrcweir }
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir sal_Bool SAL_CALL RootActionTriggerContainer::hasElements()
246*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir 	if ( m_pMenu )
249*cdf0e10cSrcweir 	{
250*cdf0e10cSrcweir 		vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
251*cdf0e10cSrcweir 		return ( m_pMenu->GetItemCount() > 0 );
252*cdf0e10cSrcweir 	}
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 	return sal_False;
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir // XServiceInfo
259*cdf0e10cSrcweir ::rtl::OUString SAL_CALL RootActionTriggerContainer::getImplementationName()
260*cdf0e10cSrcweir throw ( RuntimeException )
261*cdf0e10cSrcweir {
262*cdf0e10cSrcweir 	return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_ROOTACTIONTRIGGERCONTAINER ));
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir sal_Bool SAL_CALL RootActionTriggerContainer::supportsService( const ::rtl::OUString& ServiceName )
266*cdf0e10cSrcweir throw ( RuntimeException )
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir 	if ( ServiceName.equalsAscii( SERVICENAME_ACTIONTRIGGERCONTAINER ))
269*cdf0e10cSrcweir 		return sal_True;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	return sal_False;
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL RootActionTriggerContainer::getSupportedServiceNames()
275*cdf0e10cSrcweir throw ( RuntimeException )
276*cdf0e10cSrcweir {
277*cdf0e10cSrcweir     Sequence< ::rtl::OUString > seqServiceNames( 1 );
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	seqServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGERCONTAINER ));
280*cdf0e10cSrcweir 	return seqServiceNames;
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir // XUnoTunnel
284*cdf0e10cSrcweir sal_Int64 SAL_CALL RootActionTriggerContainer::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw ( RuntimeException )
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir     if ( aIdentifier == impl_getStaticIdentifier() )
287*cdf0e10cSrcweir         return reinterpret_cast< sal_Int64 >( this );
288*cdf0e10cSrcweir     else
289*cdf0e10cSrcweir         return 0;
290*cdf0e10cSrcweir }
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir // XTypeProvider
293*cdf0e10cSrcweir Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes() throw ( RuntimeException )
294*cdf0e10cSrcweir {
295*cdf0e10cSrcweir 	// Optimize this method !
296*cdf0e10cSrcweir 	// We initialize a static variable only one time. And we don't must use a mutex at every call!
297*cdf0e10cSrcweir 	// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
298*cdf0e10cSrcweir 	static ::cppu::OTypeCollection* pTypeCollection = NULL ;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 	if ( pTypeCollection == NULL )
301*cdf0e10cSrcweir 	{
302*cdf0e10cSrcweir 		// Ready for multithreading; get global mutex for first call of this method only! see before
303*cdf0e10cSrcweir 		osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 		// Control these pointer again ... it can be, that another instance will be faster then these!
306*cdf0e10cSrcweir 		if ( pTypeCollection == NULL )
307*cdf0e10cSrcweir 		{
308*cdf0e10cSrcweir 			// Create a static typecollection ...
309*cdf0e10cSrcweir 			static ::cppu::OTypeCollection aTypeCollection(
310*cdf0e10cSrcweir 						::getCppuType(( const Reference< XMultiServiceFactory	>*)NULL ) ,
311*cdf0e10cSrcweir 						::getCppuType(( const Reference< XIndexContainer		>*)NULL ) ,
312*cdf0e10cSrcweir 						::getCppuType(( const Reference< XIndexAccess			>*)NULL ) ,
313*cdf0e10cSrcweir 						::getCppuType(( const Reference< XIndexReplace			>*)NULL ) ,
314*cdf0e10cSrcweir 						::getCppuType(( const Reference< XServiceInfo			>*)NULL ) ,
315*cdf0e10cSrcweir 						::getCppuType(( const Reference< XTypeProvider			>*)NULL ) ,
316*cdf0e10cSrcweir                         ::getCppuType(( const Reference< XUnoTunnel             >*)NULL ) ,
317*cdf0e10cSrcweir                         ::getCppuType(( const Reference< XNamed                 >*)NULL )) ;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir 			// ... and set his address to static pointer!
320*cdf0e10cSrcweir 			pTypeCollection = &aTypeCollection ;
321*cdf0e10cSrcweir 		}
322*cdf0e10cSrcweir 	}
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 	return pTypeCollection->getTypes() ;
325*cdf0e10cSrcweir }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL RootActionTriggerContainer::getImplementationId() throw ( RuntimeException )
328*cdf0e10cSrcweir {
329*cdf0e10cSrcweir 	// Create one Id for all instances of this class.
330*cdf0e10cSrcweir 	// Use ethernet address to do this! (sal_True)
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 	// Optimize this method
333*cdf0e10cSrcweir 	// We initialize a static variable only one time. And we don't must use a mutex at every call!
334*cdf0e10cSrcweir 	// For the first call; pID is NULL - for the second call pID is different from NULL!
335*cdf0e10cSrcweir 	static ::cppu::OImplementationId* pID = NULL ;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 	if ( pID == NULL )
338*cdf0e10cSrcweir 	{
339*cdf0e10cSrcweir 		// Ready for multithreading; get global mutex for first call of this method only! see before
340*cdf0e10cSrcweir 		osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 		// Control these pointer again ... it can be, that another instance will be faster then these!
343*cdf0e10cSrcweir 		if ( pID == NULL )
344*cdf0e10cSrcweir 		{
345*cdf0e10cSrcweir 			// Create a new static ID ...
346*cdf0e10cSrcweir 			static ::cppu::OImplementationId aID( sal_False ) ;
347*cdf0e10cSrcweir 			// ... and set his address to static pointer!
348*cdf0e10cSrcweir 			pID = &aID ;
349*cdf0e10cSrcweir 		}
350*cdf0e10cSrcweir 	}
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	return pID->getImplementationId() ;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir // private implementation helper
356*cdf0e10cSrcweir void RootActionTriggerContainer::FillContainer()
357*cdf0e10cSrcweir {
358*cdf0e10cSrcweir 	m_bContainerCreated = sal_True;
359*cdf0e10cSrcweir 	m_bInContainerCreation = sal_True;
360*cdf0e10cSrcweir     Reference<XIndexContainer> xXIndexContainer( (OWeakObject *)this, UNO_QUERY );
361*cdf0e10cSrcweir 	ActionTriggerHelper::FillActionTriggerContainerFromMenu(
362*cdf0e10cSrcweir 		xXIndexContainer,
363*cdf0e10cSrcweir 		m_pMenu );
364*cdf0e10cSrcweir 	m_bInContainerCreation = sal_False;
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir ::rtl::OUString RootActionTriggerContainer::getName() throw ( RuntimeException )
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir     ::rtl::OUString sRet;
369*cdf0e10cSrcweir     if( m_pMenuIdentifier )
370*cdf0e10cSrcweir         sRet = *m_pMenuIdentifier;
371*cdf0e10cSrcweir     return sRet;
372*cdf0e10cSrcweir }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir void RootActionTriggerContainer::setName( const ::rtl::OUString& ) throw ( RuntimeException)
375*cdf0e10cSrcweir {
376*cdf0e10cSrcweir     throw RuntimeException();
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380