xref: /aoo41x/main/sfx2/source/statbar/stbitem.cxx (revision d119d52d)
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/unohlp.hxx>
58 #endif
59 #include <toolkit/helper/convert.hxx>
60 
61 using namespace ::com::sun::star;
62 
63 //--------------------------------------------------------------------
64 
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 
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 
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 
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
187 uno::Any SAL_CALL SfxStatusBarControl::queryInterface( const uno::Type & rType )
188 throw( uno::RuntimeException)
189 {
190     return svt::StatusbarController::queryInterface( rType );
191 }
192 
193 void SAL_CALL SfxStatusBarControl::acquire() throw()
194 {
195     OWeakObject::acquire();
196 }
197 
198 void SAL_CALL SfxStatusBarControl::release() throw()
199 {
200     OWeakObject::release();
201 }
202 
203 //--------------------------------------------------------------------
204 // XEventListener
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
213 void SAL_CALL SfxStatusBarControl::dispose()
214 throw (uno::RuntimeException)
215 {
216     svt::StatusbarController::dispose();
217 }
218 
219 //--------------------------------------------------------------------
220 // XStatusListener
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 
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 
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 
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 
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 
396 void SAL_CALL SfxStatusBarControl::paint(
397     const uno::Reference< awt::XGraphics >& xGraphics,
398     const awt::Rectangle& rOutputRectangle,
399     ::sal_Int32 nItemId,
400     ::sal_Int32 nStyle )
401 throw ( ::uno::RuntimeException )
402 {
403     ::vos::OGuard aGuard( Application::GetSolarMutex() );
404 
405     OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );;
406     if ( pOutDev )
407     {
408         ::Rectangle aRect = VCLRectangle( rOutputRectangle );
409         UserDrawEvent aUserDrawEvent( pOutDev, aRect, (sal_uInt16)nItemId, (sal_uInt16)nStyle );
410         Paint( aUserDrawEvent );
411     }
412 }
413 
414 //--------------------------------------------------------------------
415 
416 void SAL_CALL SfxStatusBarControl::click()
417 throw ( uno::RuntimeException )
418 {
419     ::vos::OGuard aGuard( Application::GetSolarMutex() );
420     Click();
421 }
422 
423 //--------------------------------------------------------------------
424 
425 void SAL_CALL SfxStatusBarControl::doubleClick()
426 throw ( uno::RuntimeException )
427 {
428     ::vos::OGuard aGuard( Application::GetSolarMutex() );
429     DoubleClick();
430 }
431 
432 //--------------------------------------------------------------------
433 // old sfx2 interface
434 //--------------------------------------------------------------------
435 
436 void SfxStatusBarControl::StateChanged
437 (
438 	sal_uInt16				nSID,
439 	SfxItemState		eState,
440 	const SfxPoolItem* 	pState	/* Zeiger auf ein SfxPoolItem, welches nur
441 								   innerhalb dieses Methodenaufrufs g"ultig
442 								   ist. Es kann ein 0-Pointer, ein Pointer
443 								   auf ein SfxVoidItem oder auf den Typ, f"ur
444 								   den die Subclass von SfxStatusBarControl
445 								   registriert ist vorkommen. */
446 )
447 
448 /*	[Beschreibung]
449 
450 	Die Basisimplementation versteht Items vom Type SfxStringItem, bei
451 	denen der Text in das Status-Zeilen-Feld eingetragen wird und
452 	SfxVoidItem, bei denen das Feld geleert wird. Die Basisimplementierng
453 	sollte in "uberladenen Methoden nicht gerufen werden.
454 */
455 
456 {
457 	DBG_MEMTEST();
458 	DBG_ASSERT( pBar != 0, "setting state to dangling StatusBar" );
459 
460 	const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
461 	if ( eState == SFX_ITEM_AVAILABLE && pStr )
462 		pBar->SetItemText( nSID, pStr->GetValue() );
463 	else
464 	{
465 		DBG_ASSERT( eState != SFX_ITEM_AVAILABLE || pState->ISA(SfxVoidItem),
466 					"wrong SfxPoolItem subclass in SfxStatusBarControl" );
467 		pBar->SetItemText( nSID, String() );
468 	}
469 }
470 
471 //--------------------------------------------------------------------
472 
473 sal_Bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & )
474 
475 /*	[Beschreibung]
476 
477 	Diese virtuelle Methode ist eine Weiterleitung des Events
478 	MouseButtonDown() der StatusBar, falls die Maus-Position innerhalb
479 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
480 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
481 
482 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
483 
484 
485     [Rueckgabewert]
486 
487 	sal_Bool				TRUE
488 						das Event wurde bearbeitet und soll nicht an
489 						die StatusBar weitergeleitet werden
490 
491 						FALSE
492 						das Event wurde nicht bearbeitet und soll an
493 						die StatusBar weitergeleitet werden
494 */
495 
496 {
497 	return sal_False;
498 }
499 
500 //--------------------------------------------------------------------
501 
502 sal_Bool SfxStatusBarControl::MouseMove( const MouseEvent & )
503 
504 /*	[Beschreibung]
505 
506 	Diese virtuelle Methode ist eine Weiterleitung des Events
507 	MouseMove() der StatusBar, falls die Maus-Position innerhalb
508 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
509 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
510 
511 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
512 
513 
514     [Rueckgabewert]
515 
516 	sal_Bool				TRUE
517 						das Event wurde bearbeitet und soll nicht an
518 						die StatusBar weitergeleitet werden
519 
520 						FALSE
521 						das Event wurde nicht bearbeitet und soll an
522 						die StatusBar weitergeleitet werden
523 */
524 
525 {
526 	return sal_False;
527 }
528 
529 //--------------------------------------------------------------------
530 
531 sal_Bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & )
532 
533 /*	[Beschreibung]
534 
535 	Diese virtuelle Methode ist eine Weiterleitung des Events
536 	MouseButtonUp() der StatusBar, falls die Maus-Position innerhalb
537 	des Bereichs des betreffenden Items ist, oder die Maus von diesem
538 	Control mit <SfxStatusBarControl::CaptureMouse()> gecaptured wurde.
539 
540 	Die Defaultimplementierung ist leer und gibt FALSE zur"uck.
541 
542 
543     [Rueckgabewert]
544 
545 	sal_Bool				TRUE
546 						das Event wurde bearbeitet und soll nicht an
547 						die StatusBar weitergeleitet werden
548 
549 						FALSE
550 						das Event wurde nicht bearbeitet und soll an
551 						die StatusBar weitergeleitet werden
552 */
553 
554 {
555 	return sal_False;
556 }
557 
558 //--------------------------------------------------------------------
559 
560 void SfxStatusBarControl::Command( const CommandEvent& )
561 
562 /*	[Beschreibung]
563 
564 	Diese virtuelle Methode wird gerufen, wenn f"ur dieses SfxStatusBarControl
565 	ein CommandEvent f"ur erkannt wurde.
566 
567 	Die Defaultimplementierung ist leer.
568 */
569 
570 {
571 }
572 
573 //--------------------------------------------------------------------
574 
575 void SfxStatusBarControl::Click()
576 
577 /*	[Beschreibung]
578 
579 	Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus
580 	in das zu diesem Control geh"orige Feld der Statuszeile klickt.
581 
582 	Die Defaultimplementierung ist leer.
583 */
584 
585 {
586 }
587 
588 //--------------------------------------------------------------------
589 
590 void SfxStatusBarControl::DoubleClick()
591 
592 /*  [Beschreibung]
593 
594 	Diese virtuelle Methode wird gerufen, wenn der Anwender mit der Maus
595 	in das zu diesem Control geh"orige Feld der Statuszeile doppel-klickt.
596 */
597 
598 {
599     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
600     execute( aArgs );
601 }
602 
603 //--------------------------------------------------------------------
604 
605 void SfxStatusBarControl::Paint
606 (
607 	const UserDrawEvent& /* Referenz auf einen UserDrawEvent */
608 )
609 
610 /*  [Beschreibung]
611 
612 	Diese virtuelle Methode wird gerufen, falls das betreffende Feld
613 	mit SIB_USERDRAW gekennzeichnet ist, um den Inhalt zu zeichnen.
614 	Die Ausgabe mu"s auf dem in durch rUDEvt.GetDevice() erh"altlichen
615 	OutputDevice innerhalb des durch rUDEvt.GetRect() angegebenenen
616 	Rechtecks erfolgen.
617 
618 	Die Defaultimplementierung ist leer.
619 */
620 
621 {
622 }
623 
624 //--------------------------------------------------------------------
625 
626 void SfxStatusBarControl::CaptureMouse()
627 {
628 }
629 
630 //--------------------------------------------------------------------
631 
632 void SfxStatusBarControl::ReleaseMouse()
633 {
634 }
635 
636 //--------------------------------------------------------------------
637 
638 SfxStatusBarControl* SfxStatusBarControl::CreateControl
639 (
640     sal_uInt16     nSlotID,
641     sal_uInt16     nStbId,
642     StatusBar* pBar,
643     SfxModule* pMod
644 )
645 {
646     ::vos::OGuard aGuard( Application::GetSolarMutex() );
647 	SfxApplication *pApp = SFX_APP();
648 
649     SfxSlotPool *pSlotPool;
650 	if ( pMod )
651 		pSlotPool = pMod->GetSlotPool();
652 	else
653         pSlotPool = &SfxSlotPool::GetSlotPool();
654 
655 	TypeId aSlotType = pSlotPool->GetSlotType(nSlotID);
656 	if ( aSlotType )
657 	{
658 		if ( pMod )
659 		{
660 			SfxStbCtrlFactArr_Impl *pFactories = pMod->GetStbCtrlFactories_Impl();
661 			if ( pFactories )
662 			{
663 				SfxStbCtrlFactArr_Impl &rFactories = *pFactories;
664 				for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
665 				if ( rFactories[nFactory]->nTypeId == aSlotType &&
666 					 ( ( rFactories[nFactory]->nSlotId == 0 ) ||
667 					 ( rFactories[nFactory]->nSlotId == nSlotID) ) )
668 					return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
669 			}
670 		}
671 
672 		SfxStbCtrlFactArr_Impl &rFactories = pApp->GetStbCtrlFactories_Impl();
673 		for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
674 		if ( rFactories[nFactory]->nTypeId == aSlotType &&
675 			 ( ( rFactories[nFactory]->nSlotId == 0 ) ||
676 			 ( rFactories[nFactory]->nSlotId == nSlotID) ) )
677 			return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
678 	}
679 
680     return NULL;
681 }
682 
683 //--------------------------------------------------------------------
684 void SfxStatusBarControl::RegisterStatusBarControl(SfxModule* pMod, SfxStbCtrlFactory* pFact)
685 {
686     SFX_APP()->RegisterStatusBarControl_Impl( pMod, pFact );
687 }
688 //--------------------------------------------------------------------
689