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