xref: /AOO41X/main/framework/source/uielement/menubarwrapper.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 //_________________________________________________________________________________________________________________
32*cdf0e10cSrcweir //	my own includes
33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
34*cdf0e10cSrcweir #include <uielement/menubarwrapper.hxx>
35*cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx>
36*cdf0e10cSrcweir #include <framework/actiontriggerhelper.hxx>
37*cdf0e10cSrcweir #include <services.h>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
40*cdf0e10cSrcweir //	interface includes
41*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/awt/XSystemDependentMenuPeer.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/awt/XMenuBar.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/ui/UIElementType.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52*cdf0e10cSrcweir //	other includes
53*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
54*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
55*cdf0e10cSrcweir #include <tools/solar.h>
56*cdf0e10cSrcweir #include <vcl/svapp.hxx>
57*cdf0e10cSrcweir #include <rtl/logfile.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir using namespace com::sun::star;
60*cdf0e10cSrcweir using namespace com::sun::star::uno;
61*cdf0e10cSrcweir using namespace com::sun::star::beans;
62*cdf0e10cSrcweir using namespace com::sun::star::frame;
63*cdf0e10cSrcweir using namespace com::sun::star::lang;
64*cdf0e10cSrcweir using namespace com::sun::star::container;
65*cdf0e10cSrcweir using namespace com::sun::star::awt;
66*cdf0e10cSrcweir using namespace com::sun::star::util;
67*cdf0e10cSrcweir using namespace ::com::sun::star::ui;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir namespace framework
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir //*****************************************************************************************************************
73*cdf0e10cSrcweir //	XInterface, XTypeProvider
74*cdf0e10cSrcweir //*****************************************************************************************************************
75*cdf0e10cSrcweir DEFINE_XINTERFACE_11    (   MenuBarWrapper                                                    ,
76*cdf0e10cSrcweir                             UIConfigElementWrapperBase                                        ,
77*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider          ),
78*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIElement               ),
79*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementSettings       ),
80*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet     ),
81*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet      ),
82*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet          ),
83*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::lang::XInitialization        ),
84*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::lang::XComponent             ),
85*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::util::XUpdatable             ),
86*cdf0e10cSrcweir                             DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationListener ),
87*cdf0e10cSrcweir                             DERIVED_INTERFACE( ::com::sun::star::container::XNameAccess, ::com::sun::star::container::XElementAccess )
88*cdf0e10cSrcweir 						)
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir DEFINE_XTYPEPROVIDER_11 (   MenuBarWrapper                                  ,
91*cdf0e10cSrcweir                             ::com::sun::star::lang::XTypeProvider           ,
92*cdf0e10cSrcweir                             ::com::sun::star::ui::XUIElement                ,
93*cdf0e10cSrcweir                             ::com::sun::star::ui::XUIElementSettings        ,
94*cdf0e10cSrcweir                             ::com::sun::star::beans::XMultiPropertySet      ,
95*cdf0e10cSrcweir                             ::com::sun::star::beans::XFastPropertySet       ,
96*cdf0e10cSrcweir                             ::com::sun::star::beans::XPropertySet           ,
97*cdf0e10cSrcweir                             ::com::sun::star::lang::XInitialization         ,
98*cdf0e10cSrcweir                             ::com::sun::star::lang::XComponent              ,
99*cdf0e10cSrcweir                             ::com::sun::star::util::XUpdatable              ,
100*cdf0e10cSrcweir                             ::com::sun::star::ui::XUIConfigurationListener  ,
101*cdf0e10cSrcweir                             ::com::sun::star::container::XNameAccess
102*cdf0e10cSrcweir 						)
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir // #110897#
105*cdf0e10cSrcweir MenuBarWrapper::MenuBarWrapper(
106*cdf0e10cSrcweir 	const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager
107*cdf0e10cSrcweir 	)
108*cdf0e10cSrcweir :    UIConfigElementWrapperBase( UIElementType::MENUBAR,xServiceManager ),
109*cdf0e10cSrcweir      m_bRefreshPopupControllerCache( sal_True )
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir MenuBarWrapper::~MenuBarWrapper()
114*cdf0e10cSrcweir {
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir void SAL_CALL MenuBarWrapper::dispose() throw (::com::sun::star::uno::RuntimeException)
118*cdf0e10cSrcweir {
119*cdf0e10cSrcweir     Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     com::sun::star::lang::EventObject aEvent( xThis );
122*cdf0e10cSrcweir     m_aListenerContainer.disposeAndClear( aEvent );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     m_xMenuBarManager->dispose();
127*cdf0e10cSrcweir     m_xMenuBarManager.clear();
128*cdf0e10cSrcweir     m_xConfigSource.clear();
129*cdf0e10cSrcweir     m_xConfigData.clear();
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     m_xMenuBar.clear();
132*cdf0e10cSrcweir     m_bDisposed = sal_True;
133*cdf0e10cSrcweir }
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir // XInitialization
136*cdf0e10cSrcweir void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::MenuBarWrapper::initialize" );
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     if ( m_bDisposed )
143*cdf0e10cSrcweir         throw DisposedException();
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     if ( !m_bInitialized )
146*cdf0e10cSrcweir     {
147*cdf0e10cSrcweir         rtl::OUString aModuleIdentifier;
148*cdf0e10cSrcweir         UIConfigElementWrapperBase::initialize( aArguments );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir         Reference< XFrame > xFrame( m_xWeakFrame );
151*cdf0e10cSrcweir         if ( xFrame.is() && m_xConfigSource.is() )
152*cdf0e10cSrcweir         {
153*cdf0e10cSrcweir             // Create VCL menubar which will be filled with settings data
154*cdf0e10cSrcweir             MenuBar*        pVCLMenuBar = 0;
155*cdf0e10cSrcweir             VCLXMenuBar*    pAwtMenuBar = 0;
156*cdf0e10cSrcweir             {
157*cdf0e10cSrcweir                 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
158*cdf0e10cSrcweir                 pVCLMenuBar = new MenuBar();
159*cdf0e10cSrcweir             }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir             Reference< XModuleManager > xModuleManager;
162*cdf0e10cSrcweir             xModuleManager = Reference< XModuleManager >(
163*cdf0e10cSrcweir                 m_xServiceFactory->createInstance(
164*cdf0e10cSrcweir                     SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir             try
167*cdf0e10cSrcweir             {
168*cdf0e10cSrcweir                 aModuleIdentifier = xModuleManager->identify( xFrame );
169*cdf0e10cSrcweir             }
170*cdf0e10cSrcweir             catch( Exception& )
171*cdf0e10cSrcweir             {
172*cdf0e10cSrcweir             }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir             Reference< XURLTransformer > xTrans;
175*cdf0e10cSrcweir             try
176*cdf0e10cSrcweir             {
177*cdf0e10cSrcweir                 xTrans.set( m_xServiceFactory->createInstance(
178*cdf0e10cSrcweir                                                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
179*cdf0e10cSrcweir                                                     "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
180*cdf0e10cSrcweir                 m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False );
181*cdf0e10cSrcweir                 if ( m_xConfigData.is() )
182*cdf0e10cSrcweir                 {
183*cdf0e10cSrcweir                     // Fill menubar with container contents
184*cdf0e10cSrcweir                     sal_uInt16 nId = 1;
185*cdf0e10cSrcweir                     MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans );
186*cdf0e10cSrcweir                 }
187*cdf0e10cSrcweir             }
188*cdf0e10cSrcweir             catch ( NoSuchElementException& )
189*cdf0e10cSrcweir             {
190*cdf0e10cSrcweir             }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir             sal_Bool bMenuOnly( sal_False );
193*cdf0e10cSrcweir             for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
194*cdf0e10cSrcweir             {
195*cdf0e10cSrcweir                 PropertyValue aPropValue;
196*cdf0e10cSrcweir                 if ( aArguments[n] >>= aPropValue )
197*cdf0e10cSrcweir                 {
198*cdf0e10cSrcweir                     if ( aPropValue.Name.equalsAscii( "MenuOnly" ))
199*cdf0e10cSrcweir                         aPropValue.Value >>= bMenuOnly;
200*cdf0e10cSrcweir                 }
201*cdf0e10cSrcweir             }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir             if ( !bMenuOnly )
204*cdf0e10cSrcweir             {
205*cdf0e10cSrcweir                 // Initialize menubar manager with our vcl menu bar. There are some situations where we only want to get the menu without any
206*cdf0e10cSrcweir                 // interaction which is done by the menu bar manager. This must be requested by a special property called "MenuOnly". Be careful
207*cdf0e10cSrcweir                 // a menu bar created with this property is not fully supported. It must be attached to a real menu bar manager to have full
208*cdf0e10cSrcweir                 // support. This feature is currently used for "Inplace editing"!
209*cdf0e10cSrcweir                 Reference< XDispatchProvider > xDispatchProvider;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir                 // #110897#
212*cdf0e10cSrcweir                 MenuBarManager* pMenuBarManager = new MenuBarManager( m_xServiceFactory,
213*cdf0e10cSrcweir                                                                       xFrame,
214*cdf0e10cSrcweir                                                                       xTrans,
215*cdf0e10cSrcweir                                                                       xDispatchProvider,
216*cdf0e10cSrcweir                                                                       aModuleIdentifier,
217*cdf0e10cSrcweir                                                                       pVCLMenuBar,
218*cdf0e10cSrcweir                                                                       sal_False,
219*cdf0e10cSrcweir                                                                       sal_True );
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 				m_xMenuBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
222*cdf0e10cSrcweir             }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir             // Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange.
225*cdf0e10cSrcweir             // Don't use this toolkit menu bar or one of its functions. It is only used as a data container!
226*cdf0e10cSrcweir             pAwtMenuBar = new VCLXMenuBar( pVCLMenuBar );
227*cdf0e10cSrcweir             m_xMenuBar = Reference< XMenuBar >( static_cast< OWeakObject *>( pAwtMenuBar ), UNO_QUERY );
228*cdf0e10cSrcweir         }
229*cdf0e10cSrcweir     }
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir // XUIElementSettings
233*cdf0e10cSrcweir void SAL_CALL MenuBarWrapper::updateSettings() throw ( RuntimeException )
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir     if ( m_bDisposed )
238*cdf0e10cSrcweir         throw DisposedException();
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     if ( m_xMenuBarManager.is() )
241*cdf0e10cSrcweir     {
242*cdf0e10cSrcweir         if ( m_xConfigSource.is() && m_bPersistent )
243*cdf0e10cSrcweir         {
244*cdf0e10cSrcweir             try
245*cdf0e10cSrcweir             {
246*cdf0e10cSrcweir                 MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir                 m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False );
249*cdf0e10cSrcweir                 if ( m_xConfigData.is() )
250*cdf0e10cSrcweir                     pMenuBarManager->SetItemContainer( m_xConfigData );
251*cdf0e10cSrcweir             }
252*cdf0e10cSrcweir             catch ( NoSuchElementException& )
253*cdf0e10cSrcweir             {
254*cdf0e10cSrcweir             }
255*cdf0e10cSrcweir         }
256*cdf0e10cSrcweir         else if ( !m_bPersistent )
257*cdf0e10cSrcweir         {
258*cdf0e10cSrcweir             // Transient menubar: do nothing
259*cdf0e10cSrcweir         }
260*cdf0e10cSrcweir     }
261*cdf0e10cSrcweir }
262*cdf0e10cSrcweir void MenuBarWrapper::impl_fillNewData()
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir     // Transient menubar => Fill menubar with new data
265*cdf0e10cSrcweir     MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir     if ( pMenuBarManager )
268*cdf0e10cSrcweir         pMenuBarManager->SetItemContainer( m_xConfigData );
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir void MenuBarWrapper::fillPopupControllerCache()
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir     if ( m_bRefreshPopupControllerCache )
275*cdf0e10cSrcweir     {
276*cdf0e10cSrcweir         MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
277*cdf0e10cSrcweir         if ( pMenuBarManager )
278*cdf0e10cSrcweir             pMenuBarManager->GetPopupController( m_aPopupControllerCache );
279*cdf0e10cSrcweir         if ( !m_aPopupControllerCache.empty() )
280*cdf0e10cSrcweir             m_bRefreshPopupControllerCache = sal_False;
281*cdf0e10cSrcweir     }
282*cdf0e10cSrcweir }
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir // XElementAccess
285*cdf0e10cSrcweir Type SAL_CALL MenuBarWrapper::getElementType()
286*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
287*cdf0e10cSrcweir {
288*cdf0e10cSrcweir     return ::getCppuType(( Reference< XDispatchProvider >*)0);
289*cdf0e10cSrcweir }
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir ::sal_Bool SAL_CALL MenuBarWrapper::hasElements()
292*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     if ( m_bDisposed )
297*cdf0e10cSrcweir         throw DisposedException();
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     fillPopupControllerCache();
300*cdf0e10cSrcweir     return ( !m_aPopupControllerCache.empty() );
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir // XNameAccess
304*cdf0e10cSrcweir Any SAL_CALL MenuBarWrapper::getByName(
305*cdf0e10cSrcweir     const ::rtl::OUString& aName )
306*cdf0e10cSrcweir throw ( container::NoSuchElementException,
307*cdf0e10cSrcweir         lang::WrappedTargetException,
308*cdf0e10cSrcweir         uno::RuntimeException)
309*cdf0e10cSrcweir {
310*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     if ( m_bDisposed )
313*cdf0e10cSrcweir         throw DisposedException();
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     fillPopupControllerCache();
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.find( aName );
318*cdf0e10cSrcweir     if ( pIter != m_aPopupControllerCache.end() )
319*cdf0e10cSrcweir     {
320*cdf0e10cSrcweir         uno::Reference< frame::XDispatchProvider > xDispatchProvider;
321*cdf0e10cSrcweir         xDispatchProvider = pIter->second.m_xDispatchProvider;
322*cdf0e10cSrcweir         return uno::makeAny( xDispatchProvider );
323*cdf0e10cSrcweir     }
324*cdf0e10cSrcweir     else
325*cdf0e10cSrcweir         throw container::NoSuchElementException();
326*cdf0e10cSrcweir }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL MenuBarWrapper::getElementNames()
329*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
330*cdf0e10cSrcweir {
331*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     if ( m_bDisposed )
334*cdf0e10cSrcweir         throw DisposedException();
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir     fillPopupControllerCache();
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     Sequence< rtl::OUString > aSeq( m_aPopupControllerCache.size() );
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir     sal_Int32 i( 0 );
341*cdf0e10cSrcweir     PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.begin();
342*cdf0e10cSrcweir     while ( pIter != m_aPopupControllerCache.end() )
343*cdf0e10cSrcweir     {
344*cdf0e10cSrcweir         aSeq[i++] = pIter->first;
345*cdf0e10cSrcweir         ++pIter;
346*cdf0e10cSrcweir     }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     return aSeq;
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir ::sal_Bool SAL_CALL MenuBarWrapper::hasByName(
352*cdf0e10cSrcweir     const ::rtl::OUString& aName )
353*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
354*cdf0e10cSrcweir {
355*cdf0e10cSrcweir     ResetableGuard aLock( m_aLock );
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     if ( m_bDisposed )
358*cdf0e10cSrcweir         throw DisposedException();
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir     fillPopupControllerCache();
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir     PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.find( aName );
363*cdf0e10cSrcweir     if ( pIter != m_aPopupControllerCache.end() )
364*cdf0e10cSrcweir         return sal_True;
365*cdf0e10cSrcweir     else
366*cdf0e10cSrcweir         return sal_False;
367*cdf0e10cSrcweir }
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir // XUIElement
370*cdf0e10cSrcweir Reference< XInterface > SAL_CALL MenuBarWrapper::getRealInterface() throw ( RuntimeException )
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     if ( m_bDisposed )
373*cdf0e10cSrcweir         throw DisposedException();
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir     return Reference< XInterface >( m_xMenuBarManager, UNO_QUERY );
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir } // namespace framework
379*cdf0e10cSrcweir 
380