1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <uielement/statusbarmanager.hxx>
21 #include <uielement/genericstatusbarcontroller.hxx>
22 
23 #include <framework/sfxhelperfunctions.hxx>
24 #include <framework/addonsoptions.hxx>
25 #include <uielement/statusbarmerger.hxx>
26 #include <uielement/statusbaritem.hxx>
27 #include <com/sun/star/frame/XLayoutManager.hpp>
28 #include <com/sun/star/frame/theStatusbarControllerFactory.hpp>
29 #include <com/sun/star/ui/ItemStyle.hpp>
30 #include <com/sun/star/ui/ItemType.hpp>
31 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/awt/Command.hpp>
35 #include <com/sun/star/ui/XStatusbarItem.hpp>
36 #include <comphelper/processfactory.hxx>
37 #include <comphelper/propertyvalue.hxx>
38 #include <comphelper/sequence.hxx>
39 #include <toolkit/helper/vclunohelper.hxx>
40 #include <svtools/statusbarcontroller.hxx>
41 #include <tools/debug.hxx>
42 
43 #include <utility>
44 #include <vcl/commandevent.hxx>
45 #include <vcl/event.hxx>
46 #include <vcl/status.hxx>
47 #include <vcl/svapp.hxx>
48 #include <vcl/settings.hxx>
49 #include <vcl/commandinfoprovider.hxx>
50 
51 #include <cassert>
52 
53 using namespace ::com::sun::star;
54 
55 namespace framework
56 {
57 
58 namespace
59 {
60 
61 template< class MAP >
62 struct lcl_UpdateController
63 {
operator ()framework::__anon1e68ddfe0111::lcl_UpdateController64     void operator()( typename MAP::value_type &rElement ) const
65     {
66         try
67         {
68             if ( rElement.second.is() )
69                 rElement.second->update();
70         }
71         catch ( uno::Exception& )
72         {
73         }
74     }
75 };
76 
77 template< class MAP >
78 struct lcl_RemoveController
79 {
operator ()framework::__anon1e68ddfe0111::lcl_RemoveController80     void operator()( typename MAP::value_type &rElement ) const
81     {
82         try
83         {
84             if ( rElement.second.is() )
85                 rElement.second->dispose();
86         }
87         catch ( uno::Exception& )
88         {
89         }
90     }
91 };
92 
impl_convertItemStyleToItemBits(sal_Int16 nStyle)93 StatusBarItemBits impl_convertItemStyleToItemBits( sal_Int16 nStyle )
94 {
95     StatusBarItemBits nItemBits( StatusBarItemBits::NONE );
96 
97     if (( nStyle & css::ui::ItemStyle::ALIGN_RIGHT ) == css::ui::ItemStyle::ALIGN_RIGHT )
98         nItemBits |= StatusBarItemBits::Right;
99     else if ( nStyle & css::ui::ItemStyle::ALIGN_LEFT )
100         nItemBits |= StatusBarItemBits::Left;
101     else
102         nItemBits |= StatusBarItemBits::Center;
103 
104     if (( nStyle & css::ui::ItemStyle::DRAW_FLAT ) == css::ui::ItemStyle::DRAW_FLAT )
105         nItemBits |= StatusBarItemBits::Flat;
106     else if ( nStyle & css::ui::ItemStyle::DRAW_OUT3D )
107         nItemBits |= StatusBarItemBits::Out;
108     else
109         nItemBits |= StatusBarItemBits::In;
110 
111     if (( nStyle & css::ui::ItemStyle::AUTO_SIZE ) == css::ui::ItemStyle::AUTO_SIZE )
112         nItemBits |= StatusBarItemBits::AutoSize;
113     if ( nStyle & css::ui::ItemStyle::OWNER_DRAW )
114         nItemBits |= StatusBarItemBits::UserDraw;
115 
116     if ( nStyle & css::ui::ItemStyle::MANDATORY )
117         nItemBits |= StatusBarItemBits::Mandatory;
118 
119     return nItemBits;
120 }
121 
122 }
123 
StatusBarManager(uno::Reference<uno::XComponentContext> xContext,uno::Reference<frame::XFrame> rFrame,StatusBar * pStatusBar)124 StatusBarManager::StatusBarManager(
125     uno::Reference< uno::XComponentContext > xContext,
126     uno::Reference< frame::XFrame >  rFrame,
127     StatusBar* pStatusBar ) :
128     m_bDisposed( false ),
129     m_bFrameActionRegistered( false ),
130     m_bUpdateControllers( false ),
131     m_pStatusBar( pStatusBar ),
132     m_xFrame(std::move( rFrame )),
133     m_xContext(std::move( xContext ))
134 {
135 
136     m_xStatusbarControllerFactory = frame::theStatusbarControllerFactory::get(
137         ::comphelper::getProcessComponentContext());
138 
139     m_pStatusBar->AdjustItemWidthsForHiDPI();
140     m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) );
141     m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) );
142 }
143 
~StatusBarManager()144 StatusBarManager::~StatusBarManager()
145 {
146 }
147 
GetStatusBar() const148 StatusBar* StatusBarManager::GetStatusBar() const
149 {
150     SolarMutexGuard g;
151     return m_pStatusBar;
152 }
153 
frameAction(const frame::FrameActionEvent & Action)154 void StatusBarManager::frameAction( const frame::FrameActionEvent& Action )
155 {
156     SolarMutexGuard g;
157     if ( Action.Action == frame::FrameAction_CONTEXT_CHANGED )
158         UpdateControllers();
159 }
160 
disposing(const lang::EventObject & Source)161 void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source )
162 {
163     SolarMutexGuard g;
164 
165     if ( m_bDisposed )
166         return;
167 
168     RemoveControllers();
169 
170     if ( Source.Source == uno::Reference< uno::XInterface >( m_xFrame, uno::UNO_QUERY ))
171         m_xFrame.clear();
172 
173     m_xContext.clear();
174 }
175 
176 // XComponent
dispose()177 void SAL_CALL StatusBarManager::dispose()
178 {
179     uno::Reference< lang::XComponent > xThis(this );
180 
181     {
182         lang::EventObject aEvent( xThis );
183         std::unique_lock aGuard(m_mutex);
184         m_aListenerContainer.disposeAndClear( aGuard, aEvent );
185     }
186     {
187         SolarMutexGuard g;
188         if ( m_bDisposed )
189             return;
190 
191         RemoveControllers();
192 
193         // destroy the item data
194         for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ )
195         {
196             AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>(
197                 m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) );
198             delete pUserData;
199         }
200 
201         m_pStatusBar.disposeAndClear();
202 
203         if ( m_bFrameActionRegistered && m_xFrame.is() )
204         {
205             try
206             {
207                 m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >(this) );
208             }
209             catch ( const uno::Exception& )
210             {
211             }
212         }
213 
214         m_xFrame.clear();
215         m_xContext.clear();
216 
217         m_bDisposed = true;
218     }
219 }
220 
addEventListener(const uno::Reference<lang::XEventListener> & xListener)221 void SAL_CALL StatusBarManager::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
222 {
223     SolarMutexGuard g;
224 
225     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
226     if ( m_bDisposed )
227         throw lang::DisposedException();
228 
229     std::unique_lock aGuard(m_mutex);
230     m_aListenerContainer.addInterface( aGuard, xListener );
231 }
232 
removeEventListener(const uno::Reference<lang::XEventListener> & xListener)233 void SAL_CALL StatusBarManager::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
234 {
235     std::unique_lock aGuard(m_mutex);
236     m_aListenerContainer.removeInterface( aGuard, xListener );
237 }
238 
239 // XUIConfigurationListener
elementInserted(const css::ui::ConfigurationEvent &)240 void SAL_CALL StatusBarManager::elementInserted( const css::ui::ConfigurationEvent& )
241 {
242     SolarMutexGuard g;
243 
244     if ( m_bDisposed )
245         return;
246 }
247 
elementRemoved(const css::ui::ConfigurationEvent &)248 void SAL_CALL StatusBarManager::elementRemoved( const css::ui::ConfigurationEvent& )
249 {
250     SolarMutexGuard g;
251 
252     if ( m_bDisposed )
253         return;
254 }
255 
elementReplaced(const css::ui::ConfigurationEvent &)256 void SAL_CALL StatusBarManager::elementReplaced( const css::ui::ConfigurationEvent& )
257 {
258     SolarMutexGuard g;
259 
260     if ( m_bDisposed )
261         return;
262 }
263 
UpdateControllers()264 void StatusBarManager::UpdateControllers()
265 {
266     if ( !m_bUpdateControllers )
267     {
268         m_bUpdateControllers = true;
269         std::for_each( m_aControllerMap.begin(),
270                        m_aControllerMap.end(),
271                        lcl_UpdateController< StatusBarControllerMap >() );
272     }
273     m_bUpdateControllers = false;
274 }
275 
RemoveControllers()276 void StatusBarManager::RemoveControllers()
277 {
278     DBG_TESTSOLARMUTEX();
279     assert(!m_bDisposed);
280 
281     std::for_each( m_aControllerMap.begin(),
282                    m_aControllerMap.end(),
283                    lcl_RemoveController< StatusBarControllerMap >() );
284     m_aControllerMap.clear();
285 }
286 
CreateControllers()287 void StatusBarManager::CreateControllers()
288 {
289     uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar );
290 
291     for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ )
292     {
293         sal_uInt16 nId = m_pStatusBar->GetItemId( i );
294         if ( nId == 0 )
295             continue;
296 
297         OUString aCommandURL( m_pStatusBar->GetItemCommand( nId ));
298         bool bInit( true );
299         uno::Reference< frame::XStatusbarController > xController;
300         AddonStatusbarItemData *pItemData = static_cast< AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) );
301         uno::Reference< ui::XStatusbarItem > xStatusbarItem = new StatusbarItem( m_pStatusBar, nId, aCommandURL );
302 
303         std::vector< uno::Any > aPropVector
304         {
305             uno::Any(comphelper::makePropertyValue(u"CommandURL"_ustr, aCommandURL)),
306             uno::Any(comphelper::makePropertyValue(u"ModuleIdentifier"_ustr, u""_ustr)),
307             uno::Any(comphelper::makePropertyValue(u"Frame"_ustr, m_xFrame)),
308 
309             // TODO remove this
310             uno::Any(comphelper::makePropertyValue(u"ServiceManager"_ustr, uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW))),
311 
312             uno::Any(comphelper::makePropertyValue(u"ParentWindow"_ustr, xStatusbarWindow)),
313             uno::Any(comphelper::makePropertyValue(u"Identifier"_ustr, nId)),
314             uno::Any(comphelper::makePropertyValue(u"StatusbarItem"_ustr, xStatusbarItem))
315         };
316 
317         uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) );
318 
319         // 1) UNO Statusbar controllers, registered in Controllers.xcu
320         if ( m_xStatusbarControllerFactory.is() &&
321              m_xStatusbarControllerFactory->hasController( aCommandURL, u""_ustr ))
322         {
323             xController.set(m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
324                                 aCommandURL, aArgs, m_xContext ),
325                             uno::UNO_QUERY );
326             bInit = false; // Initialization is done through the factory service
327         }
328 
329         if ( !xController.is() )
330         {
331             // 2) Old SFX2 Statusbar controllers
332             xController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL );
333             if ( !xController )
334             {
335                 // 3) Is Add-on? Generic statusbar controller
336                 if ( pItemData )
337                 {
338                     xController = new GenericStatusbarController( m_xContext,
339                                                                   m_xFrame,
340                                                                   xStatusbarItem,
341                                                                   pItemData );
342                 }
343                 else
344                 {
345                     // 4) Default Statusbar controller
346                     xController = new svt::StatusbarController( m_xContext, m_xFrame, aCommandURL, nId );
347                 }
348             }
349         }
350 
351         m_aControllerMap[nId] = xController;
352         if ( bInit )
353         {
354             xController->initialize( aArgs );
355         }
356     }
357 
358     // add frame action listeners
359     if ( !m_bFrameActionRegistered && m_xFrame.is() )
360     {
361         m_bFrameActionRegistered = true;
362         m_xFrame->addFrameActionListener( uno::Reference< frame::XFrameActionListener >(this) );
363     }
364 }
365 
FillStatusBar(const uno::Reference<container::XIndexAccess> & rItemContainer)366 void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAccess >& rItemContainer )
367 {
368     SolarMutexGuard g;
369 
370     if ( m_bDisposed || !m_pStatusBar )
371         return;
372 
373     sal_uInt16         nId( 1 );
374 
375     RemoveControllers();
376 
377     // reset and fill command map
378     m_pStatusBar->Clear();
379     m_aControllerMap.clear();// TODO already done in RemoveControllers
380 
381     for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
382     {
383         uno::Sequence< beans::PropertyValue >   aProps;
384         OUString                                aCommandURL;
385         sal_Int16                               nOffset( 0 );
386         sal_Int16                               nStyle( 0 );
387         sal_Int16                               nWidth( 0 );
388         sal_uInt16                              nType( css::ui::ItemType::DEFAULT );
389 
390         try
391         {
392             if ( rItemContainer->getByIndex( n ) >>= aProps )
393             {
394                 for (beans::PropertyValue const& prop : aProps)
395                 {
396                     if ( prop.Name == "CommandURL" )
397                     {
398                         prop.Value >>= aCommandURL;
399                     }
400                     else if ( prop.Name == "Style" )
401                     {
402                         prop.Value >>= nStyle;
403                     }
404                     else if ( prop.Name == "Type" )
405                     {
406                         prop.Value >>= nType;
407                     }
408                     else if ( prop.Name == "Width" )
409                     {
410                         prop.Value >>= nWidth;
411                     }
412                     else if ( prop.Name == "Offset" )
413                     {
414                         prop.Value >>= nOffset;
415                     }
416                 }
417 
418                 if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
419                 {
420                     auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, u""_ustr);
421                     OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
422                     StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
423 
424                     m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
425                     m_pStatusBar->SetItemCommand( nId, aCommandURL );
426                     m_pStatusBar->SetAccessibleName( nId, aString );
427                     ++nId;
428                 }
429             }
430         }
431         catch ( const css::lang::IndexOutOfBoundsException& )
432         {
433             break;
434         }
435     }
436 
437     // Statusbar Merging
438     constexpr sal_uInt16 STATUSBAR_ITEM_STARTID = 1000;
439     MergeStatusbarInstructionContainer aMergeInstructions = AddonsOptions().GetMergeStatusbarInstructions();
440     if ( !aMergeInstructions.empty() )
441     {
442         const sal_uInt32 nCount = aMergeInstructions.size();
443         sal_uInt16 nItemId( STATUSBAR_ITEM_STARTID );
444 
445         for ( sal_uInt32 i = 0; i < nCount; i++ )
446         {
447             MergeStatusbarInstruction &rInstruction = aMergeInstructions[i];
448             if ( !StatusbarMerger::IsCorrectContext( rInstruction.aMergeContext ) )
449                 continue;
450 
451             AddonStatusbarItemContainer aItems;
452             StatusbarMerger::ConvertSeqSeqToVector( rInstruction.aMergeStatusbarItems, aItems );
453 
454             sal_uInt16 nRefPos = StatusbarMerger::FindReferencePos( m_pStatusBar, rInstruction.aMergePoint );
455             if ( nRefPos != STATUSBAR_ITEM_NOTFOUND )
456             {
457                 StatusbarMerger::ProcessMergeOperation( m_pStatusBar,
458                                                         nRefPos,
459                                                         nItemId,
460                                                         rInstruction.aMergeCommand,
461                                                         rInstruction.aMergeCommandParameter,
462                                                         aItems );
463             }
464             else
465             {
466                 StatusbarMerger::ProcessMergeFallback( m_pStatusBar,
467                                                        nItemId,
468                                                        rInstruction.aMergeCommand,
469                                                        rInstruction.aMergeCommandParameter,
470                                                        aItems );
471             }
472         }
473     }
474 
475     // Create controllers
476     CreateControllers();
477 
478     // Notify controllers that they are now correctly initialized and can start listening
479     UpdateControllers();
480 }
481 
DataChanged(const DataChangedEvent & rDCEvt)482 void StatusBarManager::DataChanged( const DataChangedEvent& rDCEvt )
483 {
484     SolarMutexClearableGuard aGuard;
485 
486     if ((( rDCEvt.GetType() == DataChangedEventType::SETTINGS         ) ||
487          ( rDCEvt.GetType() == DataChangedEventType::FONTS            ) ||
488          ( rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION ) ||
489          ( rDCEvt.GetType() == DataChangedEventType::DISPLAY          ))  &&
490          ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE               ))
491     {
492         css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
493         css::uno::Reference< css::beans::XPropertySet > xPropSet( m_xFrame, css::uno::UNO_QUERY );
494         if ( xPropSet.is() )
495             xPropSet->getPropertyValue(u"LayoutManager"_ustr) >>= xLayoutManager;
496         if ( xLayoutManager.is() )
497         {
498             aGuard.clear();
499             xLayoutManager->doLayout();
500         }
501     }
502 }
503 
UserDraw(const UserDrawEvent & rUDEvt)504 void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
505 {
506     SolarMutexClearableGuard aGuard;
507 
508     if ( m_bDisposed )
509         return;
510 
511     sal_uInt16 nId( rUDEvt.GetItemId() );
512     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
513     if (( nId <= 0 ) || ( it == m_aControllerMap.end() ))
514         return;
515 
516     uno::Reference< frame::XStatusbarController > xController( it->second );
517     if (xController.is() && rUDEvt.GetRenderContext())
518     {
519         uno::Reference< awt::XGraphics > xGraphics = rUDEvt.GetRenderContext()->CreateUnoGraphics();
520 
521         awt::Rectangle aRect( rUDEvt.GetRect().Left(),
522                               rUDEvt.GetRect().Top(),
523                               rUDEvt.GetRect().GetWidth(),
524                               rUDEvt.GetRect().GetHeight() );
525         aGuard.clear();
526         xController->paint(xGraphics, aRect, 0);
527     }
528 }
529 
Command(const CommandEvent & rEvt)530 void StatusBarManager::Command( const CommandEvent& rEvt )
531 {
532     SolarMutexGuard g;
533 
534     if ( m_bDisposed )
535         return;
536 
537     if ( rEvt.GetCommand() != CommandEventId::ContextMenu )
538         return;
539 
540     sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() );
541     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
542     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
543     {
544         uno::Reference< frame::XStatusbarController > xController( it->second );
545         if ( xController.is() )
546         {
547             awt::Point aPos;
548             aPos.X = rEvt.GetMousePosPixel().X();
549             aPos.Y = rEvt.GetMousePosPixel().Y();
550             xController->command( aPos, awt::Command::CONTEXTMENU, true, uno::Any() );
551         }
552     }
553 }
554 
MouseMove(const MouseEvent & rMEvt)555 void StatusBarManager::MouseMove( const MouseEvent& rMEvt )
556 {
557     MouseButton(rMEvt,&frame::XStatusbarController::mouseMove);
558 }
559 
MouseButton(const MouseEvent & rMEvt,sal_Bool (SAL_CALL frame::XStatusbarController::* _pMethod)(const css::awt::MouseEvent &))560 void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL frame::XStatusbarController::*_pMethod )(const css::awt::MouseEvent&))
561 {
562     SolarMutexGuard g;
563 
564     if ( m_bDisposed )
565         return;
566 
567     sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
568     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
569     if (( nId <= 0 ) || ( it == m_aControllerMap.end() ))
570         return;
571 
572     uno::Reference< frame::XStatusbarController > xController( it->second );
573     if ( xController.is() )
574     {
575         css::awt::MouseEvent aMouseEvent;
576         aMouseEvent.Buttons = rMEvt.GetButtons();
577         aMouseEvent.X = rMEvt.GetPosPixel().X();
578         aMouseEvent.Y = rMEvt.GetPosPixel().Y();
579         aMouseEvent.ClickCount = rMEvt.GetClicks();
580         (xController.get()->*_pMethod)( aMouseEvent);
581     }
582 }
583 
MouseButtonDown(const MouseEvent & rMEvt)584 void StatusBarManager::MouseButtonDown( const MouseEvent& rMEvt )
585 {
586     MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonDown);
587 }
588 
MouseButtonUp(const MouseEvent & rMEvt)589 void StatusBarManager::MouseButtonUp( const MouseEvent& rMEvt )
590 {
591     MouseButton(rMEvt,&frame::XStatusbarController::mouseButtonUp);
592 }
593 
IMPL_LINK_NOARG(StatusBarManager,Click,StatusBar *,void)594 IMPL_LINK_NOARG(StatusBarManager, Click, StatusBar*, void)
595 {
596     SolarMutexGuard g;
597 
598     if ( m_bDisposed )
599         return;
600 
601     sal_uInt16 nId = m_pStatusBar->GetCurItemId();
602     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
603     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
604     {
605         uno::Reference< frame::XStatusbarController > xController( it->second );
606         if ( xController.is() )
607         {
608             const Point aVCLPos = m_pStatusBar->GetPointerPosPixel();
609             const awt::Point aAWTPoint( aVCLPos.X(), aVCLPos.Y() );
610             xController->click( aAWTPoint );
611         }
612     }
613 }
614 
IMPL_LINK_NOARG(StatusBarManager,DoubleClick,StatusBar *,void)615 IMPL_LINK_NOARG(StatusBarManager, DoubleClick, StatusBar*, void)
616 {
617     SolarMutexGuard g;
618 
619     if ( m_bDisposed )
620         return;
621 
622     sal_uInt16 nId = m_pStatusBar->GetCurItemId();
623     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
624     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
625     {
626         uno::Reference< frame::XStatusbarController > xController( it->second );
627         if ( xController.is() )
628         {
629             const Point aVCLPos = m_pStatusBar->GetPointerPosPixel();
630             const awt::Point aAWTPoint( aVCLPos.X(), aVCLPos.Y() );
631             xController->doubleClick( aAWTPoint );
632         }
633     }
634 }
635 
636 }
637 
638 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
639