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