popupmenucontrollerbase.cxx (5900e8ec) popupmenucontrollerbase.cxx (d026be40)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 24 unchanged lines hidden (view full) ---

33//_________________________________________________________________________________________________________________
34// interface includes
35//_________________________________________________________________________________________________________________
36#include <com/sun/star/awt/XDevice.hpp>
37#include <com/sun/star/beans/PropertyValue.hpp>
38#include <com/sun/star/awt/MenuItemStyle.hpp>
39#include <com/sun/star/frame/XDispatchProvider.hpp>
40#include <com/sun/star/lang/DisposedException.hpp>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 24 unchanged lines hidden (view full) ---

33//_________________________________________________________________________________________________________________
34// interface includes
35//_________________________________________________________________________________________________________________
36#include <com/sun/star/awt/XDevice.hpp>
37#include <com/sun/star/beans/PropertyValue.hpp>
38#include <com/sun/star/awt/MenuItemStyle.hpp>
39#include <com/sun/star/frame/XDispatchProvider.hpp>
40#include <com/sun/star/lang/DisposedException.hpp>
41#include <com/sun/star/awt/XMenuExtended.hpp>
42
43//_________________________________________________________________________________________________________________
44// includes of other projects
45//_________________________________________________________________________________________________________________
46
47#ifndef _VCL_MENU_HXX_
48#include <vcl/menu.hxx>
49#endif

--- 48 unchanged lines hidden (view full) ---

98{
99 if (rBHelper.bDisposed || rBHelper.bInDispose)
100 throw com::sun::star::lang::DisposedException();
101}
102
103// protected function
104void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu )
105{
41
42//_________________________________________________________________________________________________________________
43// includes of other projects
44//_________________________________________________________________________________________________________________
45
46#ifndef _VCL_MENU_HXX_
47#include <vcl/menu.hxx>
48#endif

--- 48 unchanged lines hidden (view full) ---

97{
98 if (rBHelper.bDisposed || rBHelper.bInDispose)
99 throw com::sun::star::lang::DisposedException();
100}
101
102// protected function
103void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu )
104{
106 VCLXPopupMenu* pPopupMenu = 0;
107 if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 )
108 {
105 if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 )
106 {
109 pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
110 if ( pPopupMenu )
111 {
112 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
113
114 PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
115 pVCLPopupMenu->Clear();
116 }
107 rPopupMenu->clear();
117 }
118}
119
120void SAL_CALL PopupMenuControllerBase::disposing()
121{
122 // Reset our members and set disposed flag
123 osl::MutexGuard aLock( m_aMutex );
124 m_xFrame.clear();

--- 21 unchanged lines hidden (view full) ---

146{
147 osl::MutexGuard aLock( m_aMutex );
148 m_xFrame.clear();
149 m_xDispatch.clear();
150 m_xPopupMenu.clear();
151}
152
153// XMenuListener
108 }
109}
110
111void SAL_CALL PopupMenuControllerBase::disposing()
112{
113 // Reset our members and set disposed flag
114 osl::MutexGuard aLock( m_aMutex );
115 m_xFrame.clear();

--- 21 unchanged lines hidden (view full) ---

137{
138 osl::MutexGuard aLock( m_aMutex );
139 m_xFrame.clear();
140 m_xDispatch.clear();
141 m_xPopupMenu.clear();
142}
143
144// XMenuListener
154void SAL_CALL PopupMenuControllerBase::highlight( const awt::MenuEvent& ) throw (RuntimeException)
145void SAL_CALL PopupMenuControllerBase::itemHighlighted( const awt::MenuEvent& ) throw (RuntimeException)
155{
156}
157
158void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const URL& aURL)
159{
160 Sequence<PropertyValue> aArgs;
161 OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch");
162 if ( _xDispatch.is() )
163 _xDispatch->dispatch( aURL, aArgs );
164}
165
146{
147}
148
149void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const URL& aURL)
150{
151 Sequence<PropertyValue> aArgs;
152 OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch");
153 if ( _xDispatch.is() )
154 _xDispatch->dispatch( aURL, aArgs );
155}
156
166void SAL_CALL PopupMenuControllerBase::select( const awt::MenuEvent& rEvent ) throw (RuntimeException)
157void SAL_CALL PopupMenuControllerBase::itemSelected( const awt::MenuEvent& rEvent ) throw (RuntimeException)
167{
168 throwIfDisposed();
169
170 osl::MutexGuard aLock( m_aMutex );
171
158{
159 throwIfDisposed();
160
161 osl::MutexGuard aLock( m_aMutex );
162
172 Reference< awt::XMenuExtended > xExtMenu( m_xPopupMenu, UNO_QUERY );
173 if( xExtMenu.is() )
163 if( m_xPopupMenu.is() )
174 {
175 Sequence<PropertyValue> aArgs;
164 {
165 Sequence<PropertyValue> aArgs;
176 dispatchCommand( xExtMenu->getCommand( rEvent.MenuId ), aArgs );
166 dispatchCommand( m_xPopupMenu->getCommand( rEvent.MenuId ), aArgs );
177 }
178}
179
180void PopupMenuControllerBase::dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
181{
182 osl::MutexGuard aLock( m_aMutex );
183
184 throwIfDisposed();

--- 18 unchanged lines hidden (view full) ---

203
204IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo*, pDispatchInfo )
205{
206 pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
207 delete pDispatchInfo;
208 return 0;
209}
210
167 }
168}
169
170void PopupMenuControllerBase::dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
171{
172 osl::MutexGuard aLock( m_aMutex );
173
174 throwIfDisposed();

--- 18 unchanged lines hidden (view full) ---

193
194IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo*, pDispatchInfo )
195{
196 pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
197 delete pDispatchInfo;
198 return 0;
199}
200
211void SAL_CALL PopupMenuControllerBase::activate( const awt::MenuEvent& ) throw (RuntimeException)
201void SAL_CALL PopupMenuControllerBase::itemActivated( const awt::MenuEvent& ) throw (RuntimeException)
212{
213}
214
202{
203}
204
215void SAL_CALL PopupMenuControllerBase::deactivate( const awt::MenuEvent& ) throw (RuntimeException)
205void SAL_CALL PopupMenuControllerBase::itemDeactivated( const awt::MenuEvent& ) throw (RuntimeException)
216{
217}
218
219void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
220{
221 osl::ClearableMutexGuard aLock( m_aMutex );
222 throwIfDisposed();
223 aLock.clear();

--- 193 unchanged lines hidden ---
206{
207}
208
209void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException )
210{
211 osl::ClearableMutexGuard aLock( m_aMutex );
212 throwIfDisposed();
213 aLock.clear();

--- 193 unchanged lines hidden ---