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_dbaccess.hxx"
30*cdf0e10cSrcweir #ifndef DBACCESS_TOOLBOXCONTROLLER_HXX
31*cdf0e10cSrcweir #include "toolboxcontroller.hxx"
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_IMAGETYPE_HPP_
34*cdf0e10cSrcweir #include <com/sun/star/ui/ImageType.hpp>
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
37*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
40*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #ifndef _SV_MENU_HXX
43*cdf0e10cSrcweir #include <vcl/menu.hxx>
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGER_HPP_
46*cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfigurationManager.hpp>
47*cdf0e10cSrcweir #endif
48*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGERSUPPLIER_HPP_
49*cdf0e10cSrcweir #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_XIMAGEMANAGER_HPP_
52*cdf0e10cSrcweir #include <com/sun/star/ui/XImageManager.hpp>
53*cdf0e10cSrcweir #endif
54*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_IMAGETYPE_HPP_
55*cdf0e10cSrcweir #include <com/sun/star/ui/ImageType.hpp>
56*cdf0e10cSrcweir #endif
57*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HPP_
58*cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp>
59*cdf0e10cSrcweir #endif
60*cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX //autogen
61*cdf0e10cSrcweir #include <vcl/svapp.hxx>
62*cdf0e10cSrcweir #endif
63*cdf0e10cSrcweir #ifndef _SV_TOOLBOX_HXX
64*cdf0e10cSrcweir #include <vcl/toolbox.hxx>
65*cdf0e10cSrcweir #endif
66*cdf0e10cSrcweir #ifndef _DBU_RESOURCE_HRC_
67*cdf0e10cSrcweir #include "dbu_resource.hrc"
68*cdf0e10cSrcweir #endif
69*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_MISCOPT_HXX
70*cdf0e10cSrcweir #include <svtools/miscopt.hxx>
71*cdf0e10cSrcweir #endif
72*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
73*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
74*cdf0e10cSrcweir #endif
75*cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H
76*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
77*cdf0e10cSrcweir #endif
78*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_MENUOPTIONS_HXX
79*cdf0e10cSrcweir #include <svtools/menuoptions.hxx>
80*cdf0e10cSrcweir #endif
81*cdf0e10cSrcweir #ifndef _VOS_MUTEX_HXX_
82*cdf0e10cSrcweir #include <vos/mutex.hxx>
83*cdf0e10cSrcweir #endif
84*cdf0e10cSrcweir #ifndef _DBU_REGHELPER_HXX_
85*cdf0e10cSrcweir #include "dbu_reghelper.hxx"
86*cdf0e10cSrcweir #endif
87*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
88*cdf0e10cSrcweir #include "UITools.hxx"
89*cdf0e10cSrcweir #endif
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_OToolboxController()
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir 	static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OToolboxController> aAutoRegistration;
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir namespace dbaui
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir 	using namespace svt;
99*cdf0e10cSrcweir 	using namespace ::com::sun::star::graphic;
100*cdf0e10cSrcweir 	using namespace com::sun::star::uno;
101*cdf0e10cSrcweir 	using namespace com::sun::star::beans;
102*cdf0e10cSrcweir 	using namespace com::sun::star::lang;
103*cdf0e10cSrcweir 	using namespace ::com::sun::star::frame;
104*cdf0e10cSrcweir 	using namespace ::com::sun::star::util;
105*cdf0e10cSrcweir 	using namespace ::com::sun::star::ui;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     namespace
108*cdf0e10cSrcweir     {
109*cdf0e10cSrcweir         void lcl_copy(Menu* _pMenu,sal_uInt16 _nMenuId,sal_uInt16 _nMenuPos,ToolBox* _pToolBox,sal_uInt16 _nToolId,const ::rtl::OUString& _sCommand)
110*cdf0e10cSrcweir         {
111*cdf0e10cSrcweir             if ( _pMenu->GetItemType(_nMenuPos) != MENUITEM_STRING )
112*cdf0e10cSrcweir                 _pToolBox->SetItemImage(_nToolId, _pMenu->GetItemImage(_nMenuId));
113*cdf0e10cSrcweir             _pToolBox->SetItemCommand( _nToolId, _sCommand);
114*cdf0e10cSrcweir             _pToolBox->SetHelpId(_nToolId, _pMenu->GetHelpId(_nMenuId));
115*cdf0e10cSrcweir             _pToolBox->SetHelpText(_nToolId, _pMenu->GetHelpText(_nMenuId));
116*cdf0e10cSrcweir             _pToolBox->SetQuickHelpText(_nToolId, _pMenu->GetTipHelpText(_nMenuId));
117*cdf0e10cSrcweir             _pToolBox->SetItemText(_nToolId, _pMenu->GetItemText(_nMenuId));
118*cdf0e10cSrcweir         }
119*cdf0e10cSrcweir     }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	OToolboxController::OToolboxController(const Reference< XMultiServiceFactory >& _rxORB)
122*cdf0e10cSrcweir 		: m_nToolBoxId(1)
123*cdf0e10cSrcweir 	{
124*cdf0e10cSrcweir 		osl_incrementInterlockedCount(&m_refCount);
125*cdf0e10cSrcweir 		m_xServiceManager = _rxORB;
126*cdf0e10cSrcweir 		osl_decrementInterlockedCount(&m_refCount);
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
130*cdf0e10cSrcweir 	IMPLEMENT_SERVICE_INFO1_STATIC(OToolboxController,"com.sun.star.sdb.ApplicationToolboxController","com.sun.star.frame.ToolboxController")
131*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
132*cdf0e10cSrcweir 	// XInterface
133*cdf0e10cSrcweir 	Any SAL_CALL OToolboxController::queryInterface( const Type& _rType ) throw (RuntimeException)
134*cdf0e10cSrcweir 	{
135*cdf0e10cSrcweir 		Any aReturn = ToolboxController::queryInterface(_rType);
136*cdf0e10cSrcweir 		if (!aReturn.hasValue())
137*cdf0e10cSrcweir 			aReturn = TToolboxController_BASE::queryInterface(_rType);
138*cdf0e10cSrcweir 		return aReturn;
139*cdf0e10cSrcweir 	}
140*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
141*cdf0e10cSrcweir 	void SAL_CALL OToolboxController::acquire() throw ()
142*cdf0e10cSrcweir 	{
143*cdf0e10cSrcweir 		ToolboxController::acquire();
144*cdf0e10cSrcweir 	}
145*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
146*cdf0e10cSrcweir 	void SAL_CALL OToolboxController::release() throw ()
147*cdf0e10cSrcweir 	{
148*cdf0e10cSrcweir 		ToolboxController::release();
149*cdf0e10cSrcweir 	}
150*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
151*cdf0e10cSrcweir 	void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
152*cdf0e10cSrcweir 	{
153*cdf0e10cSrcweir 		ToolboxController::initialize(_rArguments);
154*cdf0e10cSrcweir 		vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
155*cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 		if ( m_aCommandURL.equalsAscii(".uno:DBNewForm") )
158*cdf0e10cSrcweir 		{
159*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewForm"))           ,sal_True));
160*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewView"))           ,sal_True));
161*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewViewSQL"))        ,sal_True));
162*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewQuery"))          ,sal_True));
163*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewQuerySql"))       ,sal_True));
164*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewReport"))			,sal_True));
165*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewReportAutoPilot")),sal_True));
166*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBNewTable"))          ,sal_True));
167*cdf0e10cSrcweir 		}
168*cdf0e10cSrcweir 		else
169*cdf0e10cSrcweir 		{
170*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Refresh"))         ,sal_True));
171*cdf0e10cSrcweir 			m_aStates.insert(TCommandState::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:DBRebuildData"))   ,sal_True));
172*cdf0e10cSrcweir 		}
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 		TCommandState::iterator aIter = m_aStates.begin();
175*cdf0e10cSrcweir         TCommandState::iterator aEnd = m_aStates.end();
176*cdf0e10cSrcweir 		for (; aIter != aEnd; ++aIter)
177*cdf0e10cSrcweir 			addStatusListener(aIter->first);
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 		ToolBox*    pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
180*cdf0e10cSrcweir 		if ( pToolBox )
181*cdf0e10cSrcweir 		{
182*cdf0e10cSrcweir 			sal_uInt16 nCount = pToolBox->GetItemCount();
183*cdf0e10cSrcweir 			for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
184*cdf0e10cSrcweir 			{
185*cdf0e10cSrcweir 				sal_uInt16 nItemId = pToolBox->GetItemId(nPos);
186*cdf0e10cSrcweir 				if ( pToolBox->GetItemCommand(nItemId) == String(m_aCommandURL) )
187*cdf0e10cSrcweir 				{
188*cdf0e10cSrcweir 					m_nToolBoxId = nItemId;
189*cdf0e10cSrcweir 					break;
190*cdf0e10cSrcweir 				}
191*cdf0e10cSrcweir 			}
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir             // check if paste special is allowed, when not don't add DROPDOWN
194*cdf0e10cSrcweir 			pToolBox->SetItemBits(m_nToolBoxId,pToolBox->GetItemBits(m_nToolBoxId) | TIB_DROPDOWN);
195*cdf0e10cSrcweir 		}
196*cdf0e10cSrcweir 	}
197*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
198*cdf0e10cSrcweir 	void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException )
199*cdf0e10cSrcweir 	{
200*cdf0e10cSrcweir         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
201*cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
202*cdf0e10cSrcweir 		TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
203*cdf0e10cSrcweir 		if ( aFind != m_aStates.end() )
204*cdf0e10cSrcweir         {
205*cdf0e10cSrcweir 			aFind->second = Event.IsEnabled;
206*cdf0e10cSrcweir             if ( m_aCommandURL == aFind->first && !Event.IsEnabled )
207*cdf0e10cSrcweir             {
208*cdf0e10cSrcweir                 ::std::auto_ptr<PopupMenu> pMenu = getMenu();
209*cdf0e10cSrcweir                 sal_uInt16 nCount = pMenu->GetItemCount();
210*cdf0e10cSrcweir                 for (sal_uInt16 i = 0; i < nCount; ++i)
211*cdf0e10cSrcweir                 {
212*cdf0e10cSrcweir                     sal_uInt16 nItemId = pMenu->GetItemId(i);
213*cdf0e10cSrcweir                     aFind = m_aStates.find(pMenu->GetItemCommand(nItemId));
214*cdf0e10cSrcweir                     if ( aFind != m_aStates.end() && aFind->second )
215*cdf0e10cSrcweir                     {
216*cdf0e10cSrcweir                         m_aCommandURL = aFind->first;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir                         ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
219*cdf0e10cSrcweir                         lcl_copy(pMenu.get(),nItemId,i,pToolBox,m_nToolBoxId, m_aCommandURL);
220*cdf0e10cSrcweir                         break;
221*cdf0e10cSrcweir                     }
222*cdf0e10cSrcweir                 }
223*cdf0e10cSrcweir             }
224*cdf0e10cSrcweir         }
225*cdf0e10cSrcweir 	}
226*cdf0e10cSrcweir     // -----------------------------------------------------------------------------
227*cdf0e10cSrcweir     ::std::auto_ptr<PopupMenu> OToolboxController::getMenu()
228*cdf0e10cSrcweir     {
229*cdf0e10cSrcweir         ::std::auto_ptr<PopupMenu> pMenu;
230*cdf0e10cSrcweir 		if ( m_aStates.size() > 2 )
231*cdf0e10cSrcweir 		{
232*cdf0e10cSrcweir 			pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_APP_NEW ) ) );
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 			sal_Bool bHighContrast = isHighContrast();
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 			try
237*cdf0e10cSrcweir 			{
238*cdf0e10cSrcweir 				Reference<XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(getServiceManager()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"))),UNO_QUERY);
239*cdf0e10cSrcweir 				Reference<XUIConfigurationManager> xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument")));
240*cdf0e10cSrcweir 				Reference<XImageManager> xImageMgr(xUIConfigMgr->getImageManager(),UNO_QUERY);
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 				short nImageType = hasBigImages() ? ImageType::SIZE_LARGE : ImageType::SIZE_DEFAULT;
244*cdf0e10cSrcweir 				if ( bHighContrast )
245*cdf0e10cSrcweir 					nImageType |= ImageType::COLOR_HIGHCONTRAST;
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 				Sequence< ::rtl::OUString> aSeq(1);
248*cdf0e10cSrcweir 				sal_uInt16 nCount = pMenu->GetItemCount();
249*cdf0e10cSrcweir 				for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
250*cdf0e10cSrcweir 				{
251*cdf0e10cSrcweir                     if ( pMenu->GetItemType( nPos ) == MENUITEM_SEPARATOR )
252*cdf0e10cSrcweir                         continue;
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 					sal_uInt16 nItemId = pMenu->GetItemId(nPos);
255*cdf0e10cSrcweir 					aSeq[0] = pMenu->GetItemCommand(nItemId);
256*cdf0e10cSrcweir 					Sequence< Reference<XGraphic> > aImages = xImageMgr->getImages(nImageType,aSeq);
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 					Image aImage(aImages[0]);
259*cdf0e10cSrcweir 					pMenu->SetItemImage(nItemId,aImage);
260*cdf0e10cSrcweir 					TCommandState::iterator aFind = m_aStates.find( aSeq[0] );
261*cdf0e10cSrcweir 					if ( aFind != m_aStates.end() )
262*cdf0e10cSrcweir 					{
263*cdf0e10cSrcweir 						pMenu->EnableItem(nItemId,aFind->second);
264*cdf0e10cSrcweir 					}
265*cdf0e10cSrcweir 				}
266*cdf0e10cSrcweir 			}
267*cdf0e10cSrcweir 			catch(const Exception&)
268*cdf0e10cSrcweir 			{
269*cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
270*cdf0e10cSrcweir 			}
271*cdf0e10cSrcweir 		}
272*cdf0e10cSrcweir 		else
273*cdf0e10cSrcweir 		{
274*cdf0e10cSrcweir 			pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_REFRESH_DATA ) ) );
275*cdf0e10cSrcweir 		}
276*cdf0e10cSrcweir         return pMenu;
277*cdf0e10cSrcweir     }
278*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
279*cdf0e10cSrcweir 	Reference< ::com::sun::star::awt::XWindow > SAL_CALL OToolboxController::createPopupWindow() throw (RuntimeException)
280*cdf0e10cSrcweir 	{
281*cdf0e10cSrcweir 		// execute the menu
282*cdf0e10cSrcweir 		vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
283*cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 		ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()));
286*cdf0e10cSrcweir         ::std::auto_ptr<PopupMenu> pMenu = getMenu();
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 		sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),POPUPMENU_EXECUTE_DOWN);
289*cdf0e10cSrcweir 		// "cleanup" the toolbox state
290*cdf0e10cSrcweir 		Point aPoint = pToolBox->GetItemRect( m_nToolBoxId ).TopLeft();
291*cdf0e10cSrcweir 		MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
292*cdf0e10cSrcweir 		pToolBox->MouseMove( aLeave );
293*cdf0e10cSrcweir 		pToolBox->SetItemDown( m_nToolBoxId, sal_False);
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		if ( nSelected )
296*cdf0e10cSrcweir 		{
297*cdf0e10cSrcweir             m_aCommandURL = pMenu->GetItemCommand(nSelected);
298*cdf0e10cSrcweir             lcl_copy(pMenu.get(),nSelected,pMenu->GetItemPos(nSelected),pToolBox,m_nToolBoxId, m_aCommandURL);
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 			Reference<XDispatch> xDispatch = m_aListenerMap.find(m_aCommandURL)->second;
301*cdf0e10cSrcweir 			if ( xDispatch.is() )
302*cdf0e10cSrcweir 			{
303*cdf0e10cSrcweir 				URL aUrl;
304*cdf0e10cSrcweir 				Sequence < PropertyValue > aArgs;
305*cdf0e10cSrcweir 				aUrl.Complete = m_aCommandURL;
306*cdf0e10cSrcweir 				OSL_ENSURE(aUrl.Complete.getLength(),"Command is empty!");
307*cdf0e10cSrcweir 				if ( getURLTransformer().is() )
308*cdf0e10cSrcweir 					getURLTransformer()->parseStrict(aUrl);
309*cdf0e10cSrcweir 				xDispatch->dispatch(aUrl,aArgs);
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 			}
312*cdf0e10cSrcweir 		}
313*cdf0e10cSrcweir 		return Reference< ::com::sun::star::awt::XWindow >();
314*cdf0e10cSrcweir 	}
315*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
316*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
317*cdf0e10cSrcweir //..........................................................................
318*cdf0e10cSrcweir } // dbaui
319*cdf0e10cSrcweir //..........................................................................
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 
322