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 #ifndef __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX
32*cdf0e10cSrcweir #include "uielement/complextoolbarcontroller.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
36*cdf0e10cSrcweir //	my own includes
37*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #ifndef __FRAMEWORK_TOOLBAR_HXX_
40*cdf0e10cSrcweir #include "uielement/toolbar.hxx"
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
44*cdf0e10cSrcweir //	interface includes
45*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
46*cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/frame/status/ItemStatus.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/frame/status/ItemState.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/frame/status/Visibility.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/frame/XControlNotificationListener.hpp>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
56*cdf0e10cSrcweir //	other includes
57*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
58*cdf0e10cSrcweir #include <svtools/toolboxcontroller.hxx>
59*cdf0e10cSrcweir #include <vos/mutex.hxx>
60*cdf0e10cSrcweir #include <vcl/svapp.hxx>
61*cdf0e10cSrcweir #ifndef _VCL_MNEMONIC_HXX_
62*cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
63*cdf0e10cSrcweir #endif
64*cdf0e10cSrcweir #include <tools/urlobj.hxx>
65*cdf0e10cSrcweir #include <dispatch/uieventloghelper.hxx>
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir using namespace ::com::sun::star;
68*cdf0e10cSrcweir using namespace ::com::sun::star::awt;
69*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
70*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
71*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
72*cdf0e10cSrcweir using namespace ::com::sun::star::frame;
73*cdf0e10cSrcweir using namespace ::com::sun::star::frame::status;
74*cdf0e10cSrcweir using namespace ::com::sun::star::util;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir namespace framework
77*cdf0e10cSrcweir {
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir // ------------------------------------------------------------------
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir ComplexToolbarController::ComplexToolbarController(
82*cdf0e10cSrcweir     const Reference< XMultiServiceFactory >& rServiceManager,
83*cdf0e10cSrcweir     const Reference< XFrame >&               rFrame,
84*cdf0e10cSrcweir     ToolBox*                                 pToolbar,
85*cdf0e10cSrcweir     sal_uInt16                                   nID,
86*cdf0e10cSrcweir     const ::rtl::OUString&                          aCommand ) :
87*cdf0e10cSrcweir     svt::ToolboxController( rServiceManager, rFrame, aCommand )
88*cdf0e10cSrcweir     ,   m_pToolbar( pToolbar )
89*cdf0e10cSrcweir     ,   m_nID( nID )
90*cdf0e10cSrcweir     ,   m_bMadeInvisible( sal_False )
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir     m_xURLTransformer.set( m_xServiceManager->createInstance(
93*cdf0e10cSrcweir                                                         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))),
94*cdf0e10cSrcweir                                                       UNO_QUERY_THROW );
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir // ------------------------------------------------------------------
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir ComplexToolbarController::~ComplexToolbarController()
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir // ------------------------------------------------------------------
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir void SAL_CALL ComplexToolbarController::dispose()
106*cdf0e10cSrcweir throw ( RuntimeException )
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     m_pToolbar->SetItemWindow( m_nID, 0 );
111*cdf0e10cSrcweir     svt::ToolboxController::dispose();
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     m_xURLTransformer.clear();
114*cdf0e10cSrcweir     m_pToolbar = 0;
115*cdf0e10cSrcweir     m_nID = 0;
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir // ------------------------------------------------------------------
119*cdf0e10cSrcweir Sequence<PropertyValue> ComplexToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     Sequence<PropertyValue> aArgs( 1 );
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // Add key modifier to argument list
124*cdf0e10cSrcweir     aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
125*cdf0e10cSrcweir     aArgs[0].Value <<= KeyModifier;
126*cdf0e10cSrcweir     return aArgs;
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir // -----------------------------------------------------------------------------
129*cdf0e10cSrcweir void SAL_CALL ComplexToolbarController::execute( sal_Int16 KeyModifier )
130*cdf0e10cSrcweir throw ( RuntimeException )
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir     Reference< XDispatch >       xDispatch;
133*cdf0e10cSrcweir     Reference< XURLTransformer > xURLTransformer;
134*cdf0e10cSrcweir     ::rtl::OUString                     aCommandURL;
135*cdf0e10cSrcweir     ::com::sun::star::util::URL  aTargetURL;
136*cdf0e10cSrcweir     Sequence<PropertyValue> aArgs;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     {
139*cdf0e10cSrcweir         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir         if ( m_bDisposed )
142*cdf0e10cSrcweir             throw DisposedException();
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir         if ( m_bInitialized &&
145*cdf0e10cSrcweir              m_xFrame.is() &&
146*cdf0e10cSrcweir              m_xServiceManager.is() &&
147*cdf0e10cSrcweir              m_aCommandURL.getLength() )
148*cdf0e10cSrcweir         {
149*cdf0e10cSrcweir             xURLTransformer = m_xURLTransformer;
150*cdf0e10cSrcweir             xDispatch = getDispatchFromCommand( m_aCommandURL );
151*cdf0e10cSrcweir             aCommandURL = m_aCommandURL;
152*cdf0e10cSrcweir             aTargetURL = getInitializedURL();
153*cdf0e10cSrcweir             aArgs = getExecuteArgs(KeyModifier);
154*cdf0e10cSrcweir         }
155*cdf0e10cSrcweir     }
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 )
158*cdf0e10cSrcweir     {
159*cdf0e10cSrcweir         // Execute dispatch asynchronously
160*cdf0e10cSrcweir         ExecuteInfo* pExecuteInfo = new ExecuteInfo;
161*cdf0e10cSrcweir         pExecuteInfo->xDispatch     = xDispatch;
162*cdf0e10cSrcweir         pExecuteInfo->aTargetURL    = aTargetURL;
163*cdf0e10cSrcweir         pExecuteInfo->aArgs         = aArgs;
164*cdf0e10cSrcweir         if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
165*cdf0e10cSrcweir             UiEventLogHelper(::rtl::OUString::createFromAscii("ComplexToolbarController")).log(
166*cdf0e10cSrcweir                 m_xServiceManager,
167*cdf0e10cSrcweir                 m_xFrame,
168*cdf0e10cSrcweir                 aTargetURL,
169*cdf0e10cSrcweir                 aArgs);
170*cdf0e10cSrcweir         Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController , ExecuteHdl_Impl), pExecuteInfo );
171*cdf0e10cSrcweir     }
172*cdf0e10cSrcweir }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir // ------------------------------------------------------------------
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir void ComplexToolbarController::statusChanged( const FeatureStateEvent& Event )
177*cdf0e10cSrcweir throw ( RuntimeException )
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     if ( m_bDisposed )
182*cdf0e10cSrcweir         return;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     if ( m_pToolbar )
185*cdf0e10cSrcweir     {
186*cdf0e10cSrcweir         m_pToolbar->EnableItem( m_nID, Event.IsEnabled );
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir         sal_uInt16 nItemBits = m_pToolbar->GetItemBits( m_nID );
189*cdf0e10cSrcweir         nItemBits &= ~TIB_CHECKABLE;
190*cdf0e10cSrcweir 	    TriState eTri = STATE_NOCHECK;
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir         sal_Bool        bValue = sal_Bool();
193*cdf0e10cSrcweir         rtl::OUString   aStrValue;
194*cdf0e10cSrcweir         ItemStatus      aItemState;
195*cdf0e10cSrcweir         Visibility      aItemVisibility;
196*cdf0e10cSrcweir         ControlCommand  aControlCommand;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir         if ( Event.State >>= bValue )
199*cdf0e10cSrcweir         {
200*cdf0e10cSrcweir             // Boolean, treat it as checked/unchecked
201*cdf0e10cSrcweir             if ( m_bMadeInvisible )
202*cdf0e10cSrcweir                 m_pToolbar->ShowItem( m_nID, sal_True );
203*cdf0e10cSrcweir             m_pToolbar->CheckItem( m_nID, bValue );
204*cdf0e10cSrcweir             if ( bValue )
205*cdf0e10cSrcweir                 eTri = STATE_CHECK;
206*cdf0e10cSrcweir 		    nItemBits |= TIB_CHECKABLE;
207*cdf0e10cSrcweir         }
208*cdf0e10cSrcweir         else if ( Event.State >>= aStrValue )
209*cdf0e10cSrcweir         {
210*cdf0e10cSrcweir             ::rtl::OUString aText( MnemonicGenerator::EraseAllMnemonicChars( aStrValue ) );
211*cdf0e10cSrcweir             m_pToolbar->SetItemText( m_nID, aText );
212*cdf0e10cSrcweir             m_pToolbar->SetQuickHelpText( m_nID, aText );
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir             if ( m_bMadeInvisible )
215*cdf0e10cSrcweir                 m_pToolbar->ShowItem( m_nID, sal_True );
216*cdf0e10cSrcweir         }
217*cdf0e10cSrcweir         else if ( Event.State >>= aItemState )
218*cdf0e10cSrcweir         {
219*cdf0e10cSrcweir 			eTri = STATE_DONTKNOW;
220*cdf0e10cSrcweir             nItemBits |= TIB_CHECKABLE;
221*cdf0e10cSrcweir             if ( m_bMadeInvisible )
222*cdf0e10cSrcweir                 m_pToolbar->ShowItem( m_nID, sal_True );
223*cdf0e10cSrcweir         }
224*cdf0e10cSrcweir         else if ( Event.State >>= aItemVisibility )
225*cdf0e10cSrcweir         {
226*cdf0e10cSrcweir             m_pToolbar->ShowItem( m_nID, aItemVisibility.bVisible );
227*cdf0e10cSrcweir             m_bMadeInvisible = !aItemVisibility.bVisible;
228*cdf0e10cSrcweir         }
229*cdf0e10cSrcweir         else if ( Event.State >>= aControlCommand )
230*cdf0e10cSrcweir         {
231*cdf0e10cSrcweir             executeControlCommand( aControlCommand );
232*cdf0e10cSrcweir             if ( m_bMadeInvisible )
233*cdf0e10cSrcweir                 m_pToolbar->ShowItem( m_nID, sal_True );
234*cdf0e10cSrcweir         }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir         else if ( m_bMadeInvisible )
237*cdf0e10cSrcweir             m_pToolbar->ShowItem( m_nID, sal_True );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir         m_pToolbar->SetItemState( m_nID, eTri );
240*cdf0e10cSrcweir 	    m_pToolbar->SetItemBits( m_nID, nItemBits );
241*cdf0e10cSrcweir     }
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir // ------------------------------------------------------------------
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir    const sal_uInt32 nRef = Application::ReleaseSolarMutex();
249*cdf0e10cSrcweir    try
250*cdf0e10cSrcweir    {
251*cdf0e10cSrcweir        // Asynchronous execution as this can lead to our own destruction!
252*cdf0e10cSrcweir        // Framework can recycle our current frame and the layout manager disposes all user interface
253*cdf0e10cSrcweir        // elements if a component gets detached from its frame!
254*cdf0e10cSrcweir        pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs );
255*cdf0e10cSrcweir    }
256*cdf0e10cSrcweir    catch ( Exception& )
257*cdf0e10cSrcweir    {
258*cdf0e10cSrcweir    }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir    Application::AcquireSolarMutex( nRef );
261*cdf0e10cSrcweir    delete pExecuteInfo;
262*cdf0e10cSrcweir    return 0;
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir // ------------------------------------------------------------------
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, Notify_Impl, NotifyInfo*, pNotifyInfo )
268*cdf0e10cSrcweir {
269*cdf0e10cSrcweir    const sal_uInt32 nRef = Application::ReleaseSolarMutex();
270*cdf0e10cSrcweir    try
271*cdf0e10cSrcweir    {
272*cdf0e10cSrcweir        // Asynchronous execution: As this can lead to our own destruction!
273*cdf0e10cSrcweir        // Framework can recycle our current frame and the layout manager disposes all user interface
274*cdf0e10cSrcweir        // elements if a component gets detached from its frame!
275*cdf0e10cSrcweir        frame::ControlEvent aEvent;
276*cdf0e10cSrcweir        aEvent.aURL  = pNotifyInfo->aSourceURL;
277*cdf0e10cSrcweir        aEvent.Event = pNotifyInfo->aEventName;
278*cdf0e10cSrcweir        aEvent.aInformation = pNotifyInfo->aInfoSeq;
279*cdf0e10cSrcweir        pNotifyInfo->xNotifyListener->controlEvent( aEvent );
280*cdf0e10cSrcweir    }
281*cdf0e10cSrcweir    catch ( Exception& )
282*cdf0e10cSrcweir    {
283*cdf0e10cSrcweir    }
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir    Application::AcquireSolarMutex( nRef );
286*cdf0e10cSrcweir    delete pNotifyInfo;
287*cdf0e10cSrcweir    return 0;
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir // ------------------------------------------------------------------
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir void ComplexToolbarController::addNotifyInfo(
293*cdf0e10cSrcweir     const rtl::OUString&                      aEventName,
294*cdf0e10cSrcweir     const uno::Reference< frame::XDispatch >& xDispatch,
295*cdf0e10cSrcweir     const uno::Sequence< beans::NamedValue >& rInfo )
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir     uno::Reference< frame::XControlNotificationListener > xControlNotify( xDispatch, uno::UNO_QUERY );
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     if ( xControlNotify.is() )
300*cdf0e10cSrcweir     {
301*cdf0e10cSrcweir         // Execute notification asynchronously
302*cdf0e10cSrcweir         NotifyInfo* pNotifyInfo = new NotifyInfo;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         pNotifyInfo->aEventName      = aEventName;
305*cdf0e10cSrcweir         pNotifyInfo->xNotifyListener = xControlNotify;
306*cdf0e10cSrcweir         pNotifyInfo->aSourceURL      = getInitializedURL();
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir         // Add frame as source to the information sequence
309*cdf0e10cSrcweir         sal_Int32 nCount = rInfo.getLength();
310*cdf0e10cSrcweir         uno::Sequence< beans::NamedValue > aInfoSeq( rInfo );
311*cdf0e10cSrcweir         aInfoSeq.realloc( nCount+1 );
312*cdf0e10cSrcweir         aInfoSeq[nCount].Name  = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Source" ));
313*cdf0e10cSrcweir         aInfoSeq[nCount].Value = uno::makeAny( getFrameInterface() );
314*cdf0e10cSrcweir         pNotifyInfo->aInfoSeq  = aInfoSeq;
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         Application::PostUserEvent( STATIC_LINK(0, ComplexToolbarController, Notify_Impl), pNotifyInfo );
317*cdf0e10cSrcweir     }
318*cdf0e10cSrcweir }
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir // --------------------------------------------------------
321*cdf0e10cSrcweir sal_Int32 ComplexToolbarController::getFontSizePixel( const Window* pWindow )
322*cdf0e10cSrcweir {
323*cdf0e10cSrcweir 	const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
324*cdf0e10cSrcweir     const Font&          rFont     = rSettings.GetAppFont();
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir     // Calculate height of the application font used by window
327*cdf0e10cSrcweir     sal_Int32 nHeight = sal_Int32( rFont.GetHeight() );
328*cdf0e10cSrcweir     ::Size aPixelSize = pWindow->LogicToPixel( ::Size( 0, nHeight ), MAP_APPFONT );
329*cdf0e10cSrcweir     return aPixelSize.Height();
330*cdf0e10cSrcweir }
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir // --------------------------------------------------------
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir uno::Reference< frame::XDispatch > ComplexToolbarController::getDispatchFromCommand( const rtl::OUString& aCommand ) const
335*cdf0e10cSrcweir {
336*cdf0e10cSrcweir     uno::Reference< frame::XDispatch > xDispatch;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     if ( m_bInitialized && m_xFrame.is() && m_xServiceManager.is() && aCommand.getLength() )
339*cdf0e10cSrcweir     {
340*cdf0e10cSrcweir         URLToDispatchMap::const_iterator pIter = m_aListenerMap.find( aCommand );
341*cdf0e10cSrcweir         if ( pIter != m_aListenerMap.end() )
342*cdf0e10cSrcweir             xDispatch = pIter->second;
343*cdf0e10cSrcweir     }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir     return xDispatch;
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir // --------------------------------------------------------
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir const ::com::sun::star::util::URL& ComplexToolbarController::getInitializedURL()
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir     if ( m_aURL.Complete.getLength() == 0 )
353*cdf0e10cSrcweir     {
354*cdf0e10cSrcweir         m_aURL.Complete = m_aCommandURL;
355*cdf0e10cSrcweir         m_xURLTransformer->parseStrict( m_aURL );
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir     return m_aURL;
358*cdf0e10cSrcweir }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir void ComplexToolbarController::notifyFocusGet()
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir     // send focus get notification
363*cdf0e10cSrcweir     uno::Sequence< beans::NamedValue > aInfo;
364*cdf0e10cSrcweir     addNotifyInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FocusSet" )),
365*cdf0e10cSrcweir                     getDispatchFromCommand( m_aCommandURL ),
366*cdf0e10cSrcweir                     aInfo );
367*cdf0e10cSrcweir }
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir void ComplexToolbarController::notifyFocusLost()
370*cdf0e10cSrcweir {
371*cdf0e10cSrcweir     // send focus lost notification
372*cdf0e10cSrcweir     uno::Sequence< beans::NamedValue > aInfo;
373*cdf0e10cSrcweir     addNotifyInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FocusLost" )),
374*cdf0e10cSrcweir                     getDispatchFromCommand( m_aCommandURL ),
375*cdf0e10cSrcweir                     aInfo );
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir void ComplexToolbarController::notifyTextChanged( const ::rtl::OUString& aText )
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir     // send text changed notification
381*cdf0e10cSrcweir     uno::Sequence< beans::NamedValue > aInfo( 1 );
382*cdf0e10cSrcweir     aInfo[0].Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ));
383*cdf0e10cSrcweir     aInfo[0].Value <<= aText;
384*cdf0e10cSrcweir     addNotifyInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextChanged" )),
385*cdf0e10cSrcweir                    getDispatchFromCommand( m_aCommandURL ),
386*cdf0e10cSrcweir                    aInfo );
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir } // namespace
390*cdf0e10cSrcweir 
391