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