xref: /trunk/main/sfx2/source/statbar/stbitem.cxx (revision b63233d8)
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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sfx2.hxx"
26 #include <svl/stritem.hxx>
27 #ifndef GCC
28 #endif
29 #include <com/sun/star/util/URL.hpp>
30 #include <com/sun/star/util/XURLTransformer.hpp>
31 #include <com/sun/star/frame/XController.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <com/sun/star/frame/status/ItemStatus.hpp>
34 #include <com/sun/star/frame/status/ItemState.hpp>
35 #include <com/sun/star/awt/MouseButton.hpp>
36 
37 #include <vcl/status.hxx>
38 
39 #include <sfx2/app.hxx>
40 #include "sfx2/stbitem.hxx"
41 #include "sfxtypes.hxx"
42 #include <sfx2/msg.hxx>
43 #include "arrdecl.hxx"
44 #include <sfx2/bindings.hxx>
45 #include <sfx2/msgpool.hxx>
46 #include <sfx2/module.hxx>
47 #include <sfx2/dispatch.hxx>
48 #include <sfx2/unoctitm.hxx>
49 #include <sfx2/objsh.hxx>
50 #include <sfx2/sfx.hrc>
51 
52 #include <comphelper/processfactory.hxx>
53 #include <svl/eitem.hxx>
54 #include <svl/stritem.hxx>
55 #include <svl/intitem.hxx>
56 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
57 #include <toolkit/helper/vclunohelper.hxx>
58 #endif
59 #include <toolkit/helper/convert.hxx>
60 
61 using namespace ::com::sun::star;
62 
63 //--------------------------------------------------------------------
64 
convertAwtToVCLMouseButtons(sal_Int16 nAwtMouseButtons)65 sal_uInt16 SfxStatusBarControl::convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons )
66 {
67     sal_uInt16 nVCLMouseButtons( 0 );
68 
69     if ( nAwtMouseButtons & awt::MouseButton::LEFT )
70         nVCLMouseButtons |= MOUSE_LEFT;
71     if ( nAwtMouseButtons & awt::MouseButton::RIGHT )
72         nVCLMouseButtons |= MOUSE_RIGHT;
73     if ( nAwtMouseButtons & awt::MouseButton::MIDDLE )
74         nVCLMouseButtons |= MOUSE_MIDDLE;
75 
76     return nVCLMouseButtons;
77 }
78 
79 //--------------------------------------------------------------------
80 
SfxStatusBarControllerFactory(const uno::Reference<frame::XFrame> & rFrame,StatusBar * pStatusBar,unsigned short nID,const::rtl::OUString & aCommandURL)81 svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory(
82     const uno::Reference< frame::XFrame >& rFrame,
83     StatusBar* pStatusBar,
84     unsigned short nID,
85     const ::rtl::OUString& aCommandURL )
86 {
87     ::vos::OGuard aGuard( Application::GetSolarMutex() );
88 
89     util::URL aTargetURL;
90     aTargetURL.Complete = aCommandURL;
91     uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
92         rtl::OUString::createFromAscii( "com.sun.star.util.URLTransformer" )), uno::UNO_QUERY );
93     xTrans->parseStrict( aTargetURL );
94 
95     SfxObjectShell* pObjShell = NULL;
96     uno::Reference < frame::XController > xController;
97     uno::Reference < frame::XModel > xModel;
98     if ( rFrame.is() )
99     {
100         xController = rFrame->getController();
101         if ( xController.is() )
102             xModel = xController->getModel();
103     }
104 
105     if ( xModel.is() )
106     {
107         // Get tunnel from model to retrieve the SfxObjectShell pointer from it
108         ::com::sun::star::uno::Reference < ::com::sun::star::lang::XUnoTunnel > xObj( xModel, uno::UNO_QUERY );
109 		::com::sun::star::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence();
110         if ( xObj.is() )
111         {
112 		    sal_Int64 nHandle = xObj->getSomething( aSeq );
113 		    if ( nHandle )
114                         pObjShell = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle ));
115         }
116     }
117 
118     SfxModule*     pModule   = pObjShell ? pObjShell->GetModule() : NULL;
119     SfxSlotPool*   pSlotPool = 0;
120 
121     if ( pModule )
122         pSlotPool = pModule->GetSlotPool();
123     else
124         pSlotPool = &(SfxSlotPool::GetSlotPool( NULL ));
125 
126     const SfxSlot* pSlot = pSlotPool->GetUnoSlot( aTargetURL.Path );
127     if ( pSlot )
128     {
129         sal_uInt16 nSlotId = pSlot->GetSlotId();
130         if ( nSlotId > 0 )
131         {
132             rtl::OString aCmd(".uno:");
133             aCmd += pSlot->GetUnoName();
134             pStatusBar->SetHelpId( nSlotId, aCmd );
135             return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule );
136         }
137     }
138 
139     return NULL;
140 }
141 
142 //--------------------------------------------------------------------
143 
SfxStatusBarControl(sal_uInt16 nSlotID,sal_uInt16 nCtrlID,StatusBar & rBar)144 SfxStatusBarControl::SfxStatusBarControl
145 (
146 	sal_uInt16		nSlotID,			/* Slot-Id, mit der diese Instanz
147 									   verbunden wird. Wurde bei der
148 									   Registrierung eine Slot-Id != 0
149 									   angegeben, ist dies immer die dort
150 									   angegebene. */
151     sal_uInt16      nCtrlID,            /* ID of this controller in the status bar */
152 
153 	StatusBar&	rBar				/* Referenz auf die StatusBar, f"ur die
154 									   dieses Control erzeugt wurde. */
155 )
156 
157 /*	[Beschreibung]
158 
159 	Konstruktor der Klasse SfxStatusBarControl. Die Subclasses werden
160 	bei Bedarf per Factory vom SFx erzeugt.
161 
162 	Instanzen dieser Basisklasse werden f"ur alle StatusBar-Felder
163 	erzeugt, f"ur die keine speziellen registriert wurden.
164 */
165 
166 :   svt::StatusbarController(),
167     nSlotId( nSlotID ),
168     nId( nCtrlID ),
169     pBar( &rBar )
170 {
171 }
172 
173 //--------------------------------------------------------------------
174 
~SfxStatusBarControl()175 SfxStatusBarControl::~SfxStatusBarControl()
176 
177 /*	[Beschreibung]
178 
179 	Destruktor der Klasse SfxStatusBarControl. Die Instanzen dieser
180 	Klasse und deren Subklassen werden vom SFx zerst"ort.
181 */
182 
183 {}
184 
185 //--------------------------------------------------------------------
186 // XInterface
queryInterface(const uno::Type & rType)187 uno::Any SAL_CALL SfxStatusBarControl::queryInterface( const uno::Type & rType )
188 throw( uno::RuntimeException)
189 {
190     return svt::StatusbarController::queryInterface( rType );
191 }
192 
acquire()193 void SAL_CALL SfxStatusBarControl::acquire() throw()
194 {
195     OWeakObject::acquire();
196 }
197 
release()198 void SAL_CALL SfxStatusBarControl::release() throw()
199 {
200     OWeakObject::release();
201 }
202 
203 //--------------------------------------------------------------------
204 // XEventListener
disposing(const lang::EventObject & aEvent)205 void SAL_CALL SfxStatusBarControl::disposing( const lang::EventObject& aEvent )
206 throw( uno::RuntimeException )
207 {
208     svt::StatusbarController::disposing( aEvent );
209 }
210 
211 //--------------------------------------------------------------------
212 // XComponent
dispose()213 void SAL_CALL SfxStatusBarControl::dispose()
214 throw (uno::RuntimeException)
215 {
216     svt::StatusbarController::dispose();
217 }
218 
219 //--------------------------------------------------------------------
220 // XStatusListener
statusChanged(const frame::FeatureStateEvent & rEvent)221 void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent& rEvent )
222 throw ( ::com::sun::star::uno::RuntimeException )
223 {
224     SfxViewFrame* pViewFrame = NULL;
225     uno::Reference < frame::XController > xController;
226 
227     ::vos::OGuard aGuard( Application::GetSolarMutex() );
228     if ( m_xFrame.is() )
229         xController = m_xFrame->getController();
230 
231     uno::Reference < frame::XDispatchProvider > xProvider( xController, uno::UNO_QUERY );
232     if ( xProvider.is() )
233     {
234         uno::Reference < frame::XDispatch > xDisp = xProvider->queryDispatch( rEvent.FeatureURL, ::rtl::OUString(), 0 );
235         if ( xDisp.is() )
236         {
237             uno::Reference< lang::XUnoTunnel > xTunnel( xDisp, uno::UNO_QUERY );
238             SfxOfficeDispatch* pDisp = NULL;
239             if ( xTunnel.is() )
240             {
241                 sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
242                 pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation ));
243             }
244 
245             if ( pDisp )
246                 pViewFrame = pDisp->GetDispatcher_Impl()->GetFrame();
247         }
248     }
249 
250     sal_uInt16 nSlotID = 0;
251     SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame );
252     const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path );
253     if ( pSlot )
254         nSlotID = pSlot->GetSlotId();
255 
256     if ( nSlotID > 0 )
257     {
258         if ( rEvent.Requery )
259             svt::StatusbarController::statusChanged( rEvent );
260 	    else
261 	    {
262             SfxItemState eState = SFX_ITEM_DISABLED;
263 		    SfxPoolItem* pItem = NULL;
264 		    if ( rEvent.IsEnabled )
265 		    {
266 			    eState = SFX_ITEM_AVAILABLE;
267 			    uno::Type pType = rEvent.State.getValueType();
268 
269                 if ( pType == ::getVoidCppuType() )
270                 {
271                     pItem = new SfxVoidItem( nSlotID );
272                     eState = SFX_ITEM_UNKNOWN;
273                 }
274                 else if ( pType == ::getBooleanCppuType() )
275 			    {
276 				    sal_Bool bTemp = 0;
277 				    rEvent.State >>= bTemp ;
278 				    pItem = new SfxBoolItem( nSlotID, bTemp );
279 			    }
280 			    else if ( pType == ::getCppuType((const sal_uInt16*)0) )
281 			    {
282 				    sal_uInt16 nTemp = 0;
283 				    rEvent.State >>= nTemp ;
284 				    pItem = new SfxUInt16Item( nSlotID, nTemp );
285 			    }
286 			    else if ( pType == ::getCppuType((const sal_uInt32*)0) )
287 			    {
288 				    sal_uInt32 nTemp = 0;
289 				    rEvent.State >>= nTemp ;
290 				    pItem = new SfxUInt32Item( nSlotID, nTemp );
291 			    }
292 			    else if ( pType == ::getCppuType((const ::rtl::OUString*)0) )
293 			    {
294 				    ::rtl::OUString sTemp ;
295 				    rEvent.State >>= sTemp ;
296 				    pItem = new SfxStringItem( nSlotID, sTemp );
297 			    }
298                 else if ( pType == ::getCppuType((const ::com::sun::star::frame::status::ItemStatus*)0) )
299                 {
300                     frame::status::ItemStatus aItemStatus;
301                     rEvent.State >>= aItemStatus;
302                     eState = aItemStatus.State;
303                     pItem = new SfxVoidItem( nSlotID );
304                 }
305 			    else
306                 {
307                     if ( pSlot )
308                         pItem = pSlot->GetType()->CreateItem();
309                     if ( pItem )
310                     {
311                         pItem->SetWhich( nSlotID );
312                         pItem->PutValue( rEvent.State );
313                     }
314                     else
315                         pItem = new SfxVoidItem( nSlotID );
316                 }
317 		    }
318 
319             StateChanged( nSlotID, eState, pItem );
320             delete pItem;
321 	    }
322     }
323 }
324 
325 //--------------------------------------------------------------------
326 // XStatusbarController
327 
mouseButtonDown(const awt::MouseEvent & rMouseEvent)328 ::sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonDown(
329     const awt::MouseEvent& rMouseEvent )
330 throw ( uno::RuntimeException )
331 {
332     ::vos::OGuard aGuard( Application::GetSolarMutex() );
333     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
334 
335     ::MouseEvent aMouseEvent( aPos,
336                               (sal_uInt16)rMouseEvent.ClickCount,
337                               0,
338                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
339                               0 );
340 
341     return MouseButtonDown( aMouseEvent );
342 }
343 
344 //--------------------------------------------------------------------
345 
mouseMove(const awt::MouseEvent & rMouseEvent)346 ::sal_Bool SAL_CALL SfxStatusBarControl::mouseMove(
347     const awt::MouseEvent& rMouseEvent )
348 throw (uno::RuntimeException)
349 {
350     ::vos::OGuard aGuard( Application::GetSolarMutex() );
351     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
352 
353     ::MouseEvent aMouseEvent( aPos,
354                               (sal_uInt16)rMouseEvent.ClickCount,
355                               0,
356                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
357                               0 );
358     return MouseMove( aMouseEvent );
359 }
360 
361 //--------------------------------------------------------------------
362 
mouseButtonUp(const::awt::MouseEvent & rMouseEvent)363 ::sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonUp(
364     const ::awt::MouseEvent& rMouseEvent )
365 throw ( uno::RuntimeException )
366 {
367     ::vos::OGuard aGuard( Application::GetSolarMutex() );
368     ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
369 
370     ::MouseEvent aMouseEvent( aPos,
371                               (sal_uInt16)rMouseEvent.ClickCount,
372                               0,
373                               convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
374                               0 );
375     return MouseButtonUp( aMouseEvent );
376 }
377 
378 //--------------------------------------------------------------------
379 
command(const awt::Point & rPos,::sal_Int32 nCommand,::sal_Bool,const::com::sun::star::uno::Any &)380 void SAL_CALL SfxStatusBarControl::command(
381     const awt::Point& rPos,
382     ::sal_Int32 nCommand,
383     ::sal_Bool /*bMouseEvent*/,
384     const ::com::sun::star::uno::Any& /*aData*/ )
385 throw (::com::sun::star::uno::RuntimeException)
386 {
387     ::vos::OGuard aGuard( Application::GetSolarMutex() );
388     ::Point aPos( rPos.X, rPos.Y );
389     CommandEvent aCmdEvent( aPos, (sal_uInt16)nCommand, sal_True, NULL );
390 
391     Command( aCmdEvent );
392 }
393 
394 //--------------------------------------------------------------------
395 
paint(const uno::Reference<awt::XGraphics> & xGraphics,const awt::Rectangle & rOutputRectangle,::sal_Int32 nStyle)396 void SAL_CALL SfxStatusBarControl::paint(
397     const uno::Reference< awt::XGraphics >& xGraphics,
398     const awt::Rectangle& rOutputRectangle,
399     ::sal_Int32 nStyle )
400 throw ( ::uno::RuntimeException )
401 {
402     ::vos::OGuard aGuard( Application::GetSolarMutex() );
403 
404     OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );;
405     if ( pOutDev )
406     {
407         ::Rectangle aRect = VCLRectangle( rOutputRectangle );
408         UserDrawEvent aUserDrawEvent( pOutDev, aRect, pBar->GetCurItemId(), (sal_uInt16)nStyle );
409         Paint( aUserDrawEvent );
410     }
411 }
412 
413 //--------------------------------------------------------------------
414 
click(const awt::Point &)415 void SAL_CALL SfxStatusBarControl::click( const awt::Point& )
416 throw ( uno::RuntimeException )
417 {
418     ::vos::OGuard aGuard( Application::GetSolarMutex() );
419     Click();
420 }
421 
422 //--------------------------------------------------------------------
423 
doubleClick(const awt::Point &)424 void SAL_CALL SfxStatusBarControl::doubleClick( const awt::Point& )
425 throw ( uno::RuntimeException )
426 {
427     ::vos::OGuard aGuard( Application::GetSolarMutex() );
428     DoubleClick();
429 }
430 
431 //--------------------------------------------------------------------
432 // old sfx2 interface
433 //--------------------------------------------------------------------
434 
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)435 void SfxStatusBarControl::StateChanged
436 (
437 	sal_uInt16				nSID,
438 	SfxItemState		eState,
439 	const SfxPoolItem* 	pState	/* Zeiger auf ein SfxPoolItem, welches nur
440 								   innerhalb dieses Methodenaufrufs g"ultig
441 								   ist. Es kann ein 0-Pointer, ein Pointer
442 								   auf ein SfxVoidItem oder auf den Typ, f"ur
443 								   den die Subclass von SfxStatusBarControl
444 								   registriert ist vorkommen. */
445 )
446 
447 /*	[Beschreibung]
448 
449 	Die Basisimplementation versteht Items vom Type SfxStringItem, bei
450 	denen der Text in das Status-Zeilen-Feld eingetragen wird und
451 	SfxVoidItem, bei denen das Feld geleert wird. Die Basisimplementierng
452 	sollte in "uberladenen Methoden nicht gerufen werden.
453 */
454 
455 {
456 	DBG_MEMTEST();
457 	DBG_ASSERT( pBar != 0, "setting state to dangling StatusBar" );
458 
459 	const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
460 	if ( eState == SFX_ITEM_AVAILABLE && pStr )
461 		pBar->SetItemText( nSID, pStr->GetValue() );
462 	else
463 	{
464 		DBG_ASSERT( eState != SFX_ITEM_AVAILABLE || pState->ISA(SfxVoidItem),
465 					"wrong SfxPoolItem subclass in SfxStatusBarControl" );
466 		pBar->SetItemText( nSID, String() );
467 	}
468 }
469 
470 //--------------------------------------------------------------------
471 
MouseButtonDown(const MouseEvent &)472 sal_Bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & )
473 
474 /*	[Beschreibung]
475 
476 	Diese virtuelle Methode ist eine Weiterleitung des Events
477 	MouseButtonDown() der StatusBar, falls die Maus-Position innerhalb
478 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
479 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
480 
481 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
482 
483 
484     [Rueckgabewert]
485 
486 	sal_Bool				TRUE
487 						das Event wurde bearbeitet und soll nicht an
488 						die StatusBar weitergeleitet werden
489 
490 						FALSE
491 						das Event wurde nicht bearbeitet und soll an
492 						die StatusBar weitergeleitet werden
493 */
494 
495 {
496 	return sal_False;
497 }
498 
499 //--------------------------------------------------------------------
500 
MouseMove(const MouseEvent &)501 sal_Bool SfxStatusBarControl::MouseMove( const MouseEvent & )
502 
503 /*	[Beschreibung]
504 
505 	Diese virtuelle Methode ist eine Weiterleitung des Events
506 	MouseMove() der StatusBar, falls die Maus-Position innerhalb
507 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
508 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
509 
510 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
511 
512 
513     [Rueckgabewert]
514 
515 	sal_Bool				TRUE
516 						das Event wurde bearbeitet und soll nicht an
517 						die StatusBar weitergeleitet werden
518 
519 						FALSE
520 						das Event wurde nicht bearbeitet und soll an
521 						die StatusBar weitergeleitet werden
522 */
523 
524 {
525 	return sal_False;
526 }
527 
528 //--------------------------------------------------------------------
529 
MouseButtonUp(const MouseEvent &)530 sal_Bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & )
531 
532 /*	[Beschreibung]
533 
534 	Diese virtuelle Methode ist eine Weiterleitung des Events
535 	MouseButtonUp() der StatusBar, falls die Maus-Position innerhalb
536 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
537 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
538 
539 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
540 
541 
542     [Rueckgabewert]
543 
544 	sal_Bool				TRUE
545 						das Event wurde bearbeitet und soll nicht an
546 						die StatusBar weitergeleitet werden
547 
548 						FALSE
549 						das Event wurde nicht bearbeitet und soll an
550 						die StatusBar weitergeleitet werden
551 */
552 
553 {
554 	return sal_False;
555 }
556 
557 //--------------------------------------------------------------------
558 
Command(const CommandEvent &)559 void SfxStatusBarControl::Command( const CommandEvent& )
560 
561 /*	[Beschreibung]
562 
563 	Diese virtuelle Methode wird gerufen, wenn f"ur dieses SfxStatusBarControl
564 	ein CommandEvent f"ur erkannt wurde.
565 
566 	Die Defaultimplementierung ist leer.
567 */
568 
569 {
570 }
571 
572 //--------------------------------------------------------------------
573 
Click()574 void SfxStatusBarControl::Click()
575 
576 /*	[Beschreibung]
577 
578 	Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus
579 	in das zu diesem Control geh"orige Feld der Statuszeile klickt.
580 
581 	Die Defaultimplementierung ist leer.
582 */
583 
584 {
585 }
586 
587 //--------------------------------------------------------------------
588 
DoubleClick()589 void SfxStatusBarControl::DoubleClick()
590 
591 /*  [Beschreibung]
592 
593 	Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus
594 	in das zu diesem Control geh"orige Feld der Statuszeile doppel-klickt.
595 */
596 
597 {
598     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
599     execute( aArgs );
600 }
601 
602 //--------------------------------------------------------------------
603 
Paint(const UserDrawEvent &)604 void SfxStatusBarControl::Paint
605 (
606 	const UserDrawEvent& /* Referenz auf einen UserDrawEvent */
607 )
608 
609 /*  [Beschreibung]
610 
611 	Diese virtuelle Methode wird gerufen, falls das betreffende Feld
612 	mit SIB_USERDRAW gekennzeichnet ist, um den Inhalt zu zeichnen.
613 	Die Ausgabe mu"s auf dem in durch rUDEvt.GetDevice() erh"altlichen
614 	OutputDevice innerhalb des durch rUDEvt.GetRect() angegebenenen
615 	Rechtecks erfolgen.
616 
617 	Die Defaultimplementierung ist leer.
618 */
619 
620 {
621 }
622 
623 //--------------------------------------------------------------------
624 
CaptureMouse()625 void SfxStatusBarControl::CaptureMouse()
626 {
627 }
628 
629 //--------------------------------------------------------------------
630 
ReleaseMouse()631 void SfxStatusBarControl::ReleaseMouse()
632 {
633 }
634 
635 //--------------------------------------------------------------------
636 
CreateControl(sal_uInt16 nSlotID,sal_uInt16 nStbId,StatusBar * pBar,SfxModule * pMod)637 SfxStatusBarControl* SfxStatusBarControl::CreateControl
638 (
639     sal_uInt16     nSlotID,
640     sal_uInt16     nStbId,
641     StatusBar* pBar,
642     SfxModule* pMod
643 )
644 {
645     ::vos::OGuard aGuard( Application::GetSolarMutex() );
646 	SfxApplication *pApp = SFX_APP();
647 
648     SfxSlotPool *pSlotPool;
649 	if ( pMod )
650 		pSlotPool = pMod->GetSlotPool();
651 	else
652         pSlotPool = &SfxSlotPool::GetSlotPool();
653 
654 	TypeId aSlotType = pSlotPool->GetSlotType(nSlotID);
655 	if ( aSlotType )
656 	{
657 		if ( pMod )
658 		{
659 			SfxStbCtrlFactArr_Impl *pFactories = pMod->GetStbCtrlFactories_Impl();
660 			if ( pFactories )
661 			{
662 				SfxStbCtrlFactArr_Impl &rFactories = *pFactories;
663 				for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
664 				if ( rFactories[nFactory]->nTypeId == aSlotType &&
665 					 ( ( rFactories[nFactory]->nSlotId == 0 ) ||
666 					 ( rFactories[nFactory]->nSlotId == nSlotID) ) )
667 					return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
668 			}
669 		}
670 
671 		SfxStbCtrlFactArr_Impl &rFactories = pApp->GetStbCtrlFactories_Impl();
672 		for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
673 		if ( rFactories[nFactory]->nTypeId == aSlotType &&
674 			 ( ( rFactories[nFactory]->nSlotId == 0 ) ||
675 			 ( rFactories[nFactory]->nSlotId == nSlotID) ) )
676 			return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
677 	}
678 
679     return NULL;
680 }
681 
682 //--------------------------------------------------------------------
RegisterStatusBarControl(SfxModule * pMod,SfxStbCtrlFactory * pFact)683 void SfxStatusBarControl::RegisterStatusBarControl(SfxModule* pMod, SfxStbCtrlFactory* pFact)
684 {
685     SFX_APP()->RegisterStatusBarControl_Impl( pMod, pFact );
686 }
687 //--------------------------------------------------------------------
688