Branch data Line data Source code
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 <svl/stritem.hxx>
21 : : #include <com/sun/star/util/URL.hpp>
22 : : #include <com/sun/star/util/URLTransformer.hpp>
23 : : #include <com/sun/star/util/XURLTransformer.hpp>
24 : : #include <com/sun/star/frame/XController.hpp>
25 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
26 : : #include <com/sun/star/frame/status/ItemStatus.hpp>
27 : : #include <com/sun/star/frame/status/ItemState.hpp>
28 : : #include <com/sun/star/awt/MouseButton.hpp>
29 : :
30 : : #include <vcl/status.hxx>
31 : :
32 : : #include <sfx2/app.hxx>
33 : : #include "sfx2/stbitem.hxx"
34 : : #include "sfxtypes.hxx"
35 : : #include <sfx2/msg.hxx>
36 : : #include "arrdecl.hxx"
37 : : #include <sfx2/bindings.hxx>
38 : : #include <sfx2/msgpool.hxx>
39 : : #include <sfx2/module.hxx>
40 : : #include <sfx2/dispatch.hxx>
41 : : #include <sfx2/unoctitm.hxx>
42 : : #include <sfx2/objsh.hxx>
43 : : #include <sfx2/sfx.hrc>
44 : :
45 : : #include <comphelper/processfactory.hxx>
46 : : #include <svl/eitem.hxx>
47 : : #include <svl/intitem.hxx>
48 : : #include <toolkit/unohlp.hxx>
49 : : #include <toolkit/helper/convert.hxx>
50 : :
51 : : using namespace ::com::sun::star;
52 : :
53 : : //--------------------------------------------------------------------
54 : :
55 : 0 : sal_uInt16 SfxStatusBarControl::convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons )
56 : : {
57 : 0 : sal_uInt16 nVCLMouseButtons( 0 );
58 : :
59 [ # # ]: 0 : if ( nAwtMouseButtons & awt::MouseButton::LEFT )
60 : 0 : nVCLMouseButtons |= MOUSE_LEFT;
61 [ # # ]: 0 : if ( nAwtMouseButtons & awt::MouseButton::RIGHT )
62 : 0 : nVCLMouseButtons |= MOUSE_RIGHT;
63 [ # # ]: 0 : if ( nAwtMouseButtons & awt::MouseButton::MIDDLE )
64 : 0 : nVCLMouseButtons |= MOUSE_MIDDLE;
65 : :
66 : 0 : return nVCLMouseButtons;
67 : : }
68 : :
69 : : //--------------------------------------------------------------------
70 : :
71 : 11575 : svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory(
72 : : const uno::Reference< frame::XFrame >& rFrame,
73 : : StatusBar* pStatusBar,
74 : : unsigned short nID,
75 : : const ::rtl::OUString& aCommandURL )
76 : : {
77 [ + - ]: 11575 : SolarMutexGuard aGuard;
78 : :
79 : 11575 : util::URL aTargetURL;
80 : 11575 : aTargetURL.Complete = aCommandURL;
81 [ + - ][ + - ]: 11575 : uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
82 [ + - ][ + - ]: 11575 : xTrans->parseStrict( aTargetURL );
83 : :
84 : 11575 : SfxObjectShell* pObjShell = NULL;
85 : 11575 : uno::Reference < frame::XController > xController;
86 : 11575 : uno::Reference < frame::XModel > xModel;
87 [ + - ]: 11575 : if ( rFrame.is() )
88 : : {
89 [ + - ][ + - ]: 11575 : xController = rFrame->getController();
[ + - ]
90 [ + - ]: 11575 : if ( xController.is() )
91 [ + - ][ + - ]: 11575 : xModel = xController->getModel();
[ + - ]
92 : : }
93 : :
94 [ + - ]: 11575 : if ( xModel.is() )
95 : : {
96 : : // Get tunnel from model to retrieve the SfxObjectShell pointer from it
97 [ + - ]: 11575 : ::com::sun::star::uno::Reference < ::com::sun::star::lang::XUnoTunnel > xObj( xModel, uno::UNO_QUERY );
98 [ + - ][ + - ]: 11575 : ::com::sun::star::uno::Sequence < sal_Int8 > aSeq = SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence();
[ + - ]
99 [ + - ]: 11575 : if ( xObj.is() )
100 : : {
101 [ + - ][ + - ]: 11575 : sal_Int64 nHandle = xObj->getSomething( aSeq );
102 [ + + ]: 11575 : if ( nHandle )
103 : 11507 : pObjShell = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle ));
104 [ + - ]: 11575 : }
105 : : }
106 : :
107 [ + + ][ + - ]: 11575 : SfxModule* pModule = pObjShell ? pObjShell->GetModule() : NULL;
108 : 11575 : SfxSlotPool* pSlotPool = 0;
109 : :
110 [ + + ]: 11575 : if ( pModule )
111 [ + - ]: 11507 : pSlotPool = pModule->GetSlotPool();
112 : : else
113 [ + - ]: 68 : pSlotPool = &(SfxSlotPool::GetSlotPool( NULL ));
114 : :
115 [ + - ][ + - ]: 11575 : const SfxSlot* pSlot = pSlotPool->GetUnoSlot( aTargetURL.Path );
[ + - ]
116 [ + + ]: 11575 : if ( pSlot )
117 : : {
118 : 11541 : sal_uInt16 nSlotId = pSlot->GetSlotId();
119 [ + - ]: 11541 : if ( nSlotId > 0 )
120 : : {
121 : 11541 : rtl::OString aCmd(".uno:");
122 : 11541 : aCmd += pSlot->GetUnoName();
123 [ + - ]: 11541 : pStatusBar->SetHelpId( nSlotId, aCmd );
124 [ + - ]: 11541 : return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule );
125 : : }
126 : : }
127 : :
128 [ + - ]: 11575 : return NULL;
129 : : }
130 : :
131 : : //--------------------------------------------------------------------
132 : :
133 : 10023 : SfxStatusBarControl::SfxStatusBarControl
134 : : (
135 : : sal_uInt16 nSlotID, /* Slot-Id which is connected to this
136 : : instance. If a Slot-Id is set to != 0 at
137 : : registration it will always be set there.
138 : : */
139 : :
140 : :
141 : : sal_uInt16 nCtrlID, /* ID of this controller in the status bar */
142 : :
143 : : StatusBar& rBar /* Reference to the StatusBar,for which
144 : : this Control was created. */
145 : : )
146 : :
147 : :
148 : : /* [Description]
149 : :
150 : : Constructor of the SfxStatusBarControl Class. The Subclasses are
151 : : created at the Factory if necessary.
152 : :
153 : : Instances of this base class are created for all StatusBar-fields
154 : : for which no specific ones have been registered.
155 : : */
156 : :
157 : : : svt::StatusbarController(),
158 : : nSlotId( nSlotID ),
159 : : nId( nCtrlID ),
160 : 10023 : pBar( &rBar )
161 : : {
162 : 10023 : }
163 : :
164 : : //--------------------------------------------------------------------
165 : :
166 : 10023 : SfxStatusBarControl::~SfxStatusBarControl()
167 : :
168 : : /* [Description]
169 : :
170 : : Destructor of the SfxStatusBarControl Class. The Class and its Subclasses
171 : : are destroyed by SFx.
172 : : */
173 : :
174 [ - + ]: 10023 : {}
175 : :
176 : : //--------------------------------------------------------------------
177 : : // XInterface
178 : 86250 : uno::Any SAL_CALL SfxStatusBarControl::queryInterface( const uno::Type & rType )
179 : : throw( uno::RuntimeException)
180 : : {
181 : 86250 : return svt::StatusbarController::queryInterface( rType );
182 : : }
183 : :
184 : 256814 : void SAL_CALL SfxStatusBarControl::acquire() throw()
185 : : {
186 : 256814 : OWeakObject::acquire();
187 : 256814 : }
188 : :
189 : 256814 : void SAL_CALL SfxStatusBarControl::release() throw()
190 : : {
191 : 256814 : OWeakObject::release();
192 : 256814 : }
193 : :
194 : : //--------------------------------------------------------------------
195 : : // XEventListener
196 : 0 : void SAL_CALL SfxStatusBarControl::disposing( const lang::EventObject& aEvent )
197 : : throw( uno::RuntimeException )
198 : : {
199 : 0 : svt::StatusbarController::disposing( aEvent );
200 : 0 : }
201 : :
202 : : //--------------------------------------------------------------------
203 : : // XComponent
204 : 10023 : void SAL_CALL SfxStatusBarControl::dispose()
205 : : throw (uno::RuntimeException)
206 : : {
207 : 10023 : svt::StatusbarController::dispose();
208 : 10023 : }
209 : :
210 : : //--------------------------------------------------------------------
211 : : // XStatusListener
212 : 19689 : void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent& rEvent )
213 : : throw ( ::com::sun::star::uno::RuntimeException )
214 : : {
215 : 19689 : SfxViewFrame* pViewFrame = NULL;
216 : 19689 : uno::Reference < frame::XController > xController;
217 : :
218 [ + - ]: 19689 : SolarMutexGuard aGuard;
219 [ + - ]: 19689 : if ( m_xFrame.is() )
220 [ + - ][ + - ]: 19689 : xController = m_xFrame->getController();
[ + - ]
221 : :
222 [ + - ]: 19689 : uno::Reference < frame::XDispatchProvider > xProvider( xController, uno::UNO_QUERY );
223 [ + - ]: 19689 : if ( xProvider.is() )
224 : : {
225 [ + - ][ + - ]: 19689 : uno::Reference < frame::XDispatch > xDisp = xProvider->queryDispatch( rEvent.FeatureURL, ::rtl::OUString(), 0 );
226 [ + - ]: 19689 : if ( xDisp.is() )
227 : : {
228 [ + - ]: 19689 : uno::Reference< lang::XUnoTunnel > xTunnel( xDisp, uno::UNO_QUERY );
229 : 19689 : SfxOfficeDispatch* pDisp = NULL;
230 [ + - ]: 19689 : if ( xTunnel.is() )
231 : : {
232 [ + - ][ + - ]: 19689 : sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
[ + - ]
233 : 19689 : pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation ));
234 : : }
235 : :
236 [ + - ]: 19689 : if ( pDisp )
237 [ + - ][ + - ]: 19689 : pViewFrame = pDisp->GetDispatcher_Impl()->GetFrame();
238 : 19689 : }
239 : : }
240 : :
241 : 19689 : sal_uInt16 nSlotID = 0;
242 [ + - ]: 19689 : SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( pViewFrame );
243 [ + - ][ + - ]: 19689 : const SfxSlot* pSlot = rPool.GetUnoSlot( rEvent.FeatureURL.Path );
[ + - ]
244 [ + - ]: 19689 : if ( pSlot )
245 : 19689 : nSlotID = pSlot->GetSlotId();
246 : :
247 [ + - ]: 19689 : if ( nSlotID > 0 )
248 : : {
249 [ - + ]: 19689 : if ( rEvent.Requery )
250 [ # # ]: 0 : svt::StatusbarController::statusChanged( rEvent );
251 : : else
252 : : {
253 : 19689 : SfxItemState eState = SFX_ITEM_DISABLED;
254 : 19689 : SfxPoolItem* pItem = NULL;
255 [ + + ]: 19689 : if ( rEvent.IsEnabled )
256 : : {
257 : 19065 : eState = SFX_ITEM_AVAILABLE;
258 : 19065 : uno::Type pType = rEvent.State.getValueType();
259 : :
260 [ + + ][ + - ]: 19065 : if ( pType == ::getVoidCppuType() )
261 : : {
262 [ + - ][ + - ]: 4244 : pItem = new SfxVoidItem( nSlotID );
263 : 4244 : eState = SFX_ITEM_UNKNOWN;
264 : : }
265 [ + - ][ + + ]: 14821 : else if ( pType == ::getBooleanCppuType() )
266 : : {
267 : 3155 : sal_Bool bTemp = 0;
268 : 3155 : rEvent.State >>= bTemp ;
269 [ + - ][ + - ]: 3155 : pItem = new SfxBoolItem( nSlotID, bTemp );
270 : : }
271 [ + - ][ - + ]: 11666 : else if ( pType == ::getCppuType((const sal_uInt16*)0) )
272 : : {
273 : 0 : sal_uInt16 nTemp = 0;
274 : 0 : rEvent.State >>= nTemp ;
275 [ # # ][ # # ]: 0 : pItem = new SfxUInt16Item( nSlotID, nTemp );
276 : : }
277 [ + - ][ - + ]: 11666 : else if ( pType == ::getCppuType((const sal_uInt32*)0) )
278 : : {
279 : 0 : sal_uInt32 nTemp = 0;
280 : 0 : rEvent.State >>= nTemp ;
281 [ # # ][ # # ]: 0 : pItem = new SfxUInt32Item( nSlotID, nTemp );
282 : : }
283 [ + - ][ + + ]: 11666 : else if ( pType == ::getCppuType((const ::rtl::OUString*)0) )
284 : : {
285 : 2967 : ::rtl::OUString sTemp ;
286 : 2967 : rEvent.State >>= sTemp ;
287 [ + - ][ + - ]: 2967 : pItem = new SfxStringItem( nSlotID, sTemp );
[ + - ][ + - ]
288 : : }
289 [ + - ][ - + ]: 8699 : else if ( pType == ::getCppuType((const ::com::sun::star::frame::status::ItemStatus*)0) )
290 : : {
291 : 0 : frame::status::ItemStatus aItemStatus;
292 [ # # ]: 0 : rEvent.State >>= aItemStatus;
293 : 0 : eState = aItemStatus.State;
294 [ # # ][ # # ]: 0 : pItem = new SfxVoidItem( nSlotID );
295 : : }
296 : : else
297 : : {
298 [ + - ]: 8699 : if ( pSlot )
299 [ + - ]: 8699 : pItem = pSlot->GetType()->CreateItem();
300 [ + - ]: 8699 : if ( pItem )
301 : : {
302 : 8699 : pItem->SetWhich( nSlotID );
303 [ + - ]: 8699 : pItem->PutValue( rEvent.State );
304 : : }
305 : : else
306 [ # # ][ # # ]: 0 : pItem = new SfxVoidItem( nSlotID );
307 : 19065 : }
308 : : }
309 : :
310 [ + - ]: 19689 : StateChanged( nSlotID, eState, pItem );
311 [ + + ][ + - ]: 19689 : delete pItem;
312 : : }
313 [ + - ]: 19689 : }
314 : 19689 : }
315 : :
316 : : //--------------------------------------------------------------------
317 : : // XStatusbarController
318 : :
319 : 0 : ::sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonDown(
320 : : const awt::MouseEvent& rMouseEvent )
321 : : throw ( uno::RuntimeException )
322 : : {
323 [ # # ]: 0 : SolarMutexGuard aGuard;
324 : 0 : ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
325 : :
326 : : ::MouseEvent aMouseEvent( aPos,
327 : : (sal_uInt16)rMouseEvent.ClickCount,
328 : : 0,
329 [ # # ]: 0 : convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
330 [ # # ]: 0 : 0 );
331 : :
332 [ # # ][ # # ]: 0 : return MouseButtonDown( aMouseEvent );
333 : : }
334 : :
335 : : //--------------------------------------------------------------------
336 : :
337 : 0 : ::sal_Bool SAL_CALL SfxStatusBarControl::mouseMove(
338 : : const awt::MouseEvent& rMouseEvent )
339 : : throw (uno::RuntimeException)
340 : : {
341 [ # # ]: 0 : SolarMutexGuard aGuard;
342 : 0 : ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
343 : :
344 : : ::MouseEvent aMouseEvent( aPos,
345 : : (sal_uInt16)rMouseEvent.ClickCount,
346 : : 0,
347 [ # # ]: 0 : convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
348 [ # # ]: 0 : 0 );
349 [ # # ][ # # ]: 0 : return MouseMove( aMouseEvent );
350 : : }
351 : :
352 : : //--------------------------------------------------------------------
353 : :
354 : 0 : ::sal_Bool SAL_CALL SfxStatusBarControl::mouseButtonUp(
355 : : const ::awt::MouseEvent& rMouseEvent )
356 : : throw ( uno::RuntimeException )
357 : : {
358 [ # # ]: 0 : SolarMutexGuard aGuard;
359 : 0 : ::Point aPos( rMouseEvent.X, rMouseEvent.Y );
360 : :
361 : : ::MouseEvent aMouseEvent( aPos,
362 : : (sal_uInt16)rMouseEvent.ClickCount,
363 : : 0,
364 [ # # ]: 0 : convertAwtToVCLMouseButtons( rMouseEvent.Buttons ),
365 [ # # ]: 0 : 0 );
366 [ # # ][ # # ]: 0 : return MouseButtonUp( aMouseEvent );
367 : : }
368 : :
369 : : //--------------------------------------------------------------------
370 : :
371 : 0 : void SAL_CALL SfxStatusBarControl::command(
372 : : const awt::Point& rPos,
373 : : ::sal_Int32 nCommand,
374 : : ::sal_Bool /*bMouseEvent*/,
375 : : const ::com::sun::star::uno::Any& /*aData*/ )
376 : : throw (::com::sun::star::uno::RuntimeException)
377 : : {
378 [ # # ]: 0 : SolarMutexGuard aGuard;
379 : 0 : ::Point aPos( rPos.X, rPos.Y );
380 [ # # ]: 0 : CommandEvent aCmdEvent( aPos, (sal_uInt16)nCommand, sal_True, NULL );
381 : :
382 [ # # ][ # # ]: 0 : Command( aCmdEvent );
383 : 0 : }
384 : :
385 : : //--------------------------------------------------------------------
386 : :
387 : 16089 : void SAL_CALL SfxStatusBarControl::paint(
388 : : const uno::Reference< awt::XGraphics >& xGraphics,
389 : : const awt::Rectangle& rOutputRectangle,
390 : : ::sal_Int32 nItemId,
391 : : ::sal_Int32 nStyle )
392 : : throw ( ::uno::RuntimeException )
393 : : {
394 [ + - ]: 16089 : SolarMutexGuard aGuard;
395 : :
396 [ + - ]: 16089 : OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );
397 [ + - ]: 16089 : if ( pOutDev )
398 : : {
399 [ + - ]: 16089 : ::Rectangle aRect = VCLRectangle( rOutputRectangle );
400 [ + - ]: 16089 : UserDrawEvent aUserDrawEvent( pOutDev, aRect, (sal_uInt16)nItemId, (sal_uInt16)nStyle );
401 [ + - ]: 16089 : Paint( aUserDrawEvent );
402 [ + - ]: 16089 : }
403 : 16089 : }
404 : :
405 : : //--------------------------------------------------------------------
406 : :
407 : 0 : void SAL_CALL SfxStatusBarControl::click()
408 : : throw ( uno::RuntimeException )
409 : : {
410 [ # # ]: 0 : SolarMutexGuard aGuard;
411 [ # # ][ # # ]: 0 : Click();
412 : 0 : }
413 : :
414 : : //--------------------------------------------------------------------
415 : :
416 : 0 : void SAL_CALL SfxStatusBarControl::doubleClick()
417 : : throw ( uno::RuntimeException )
418 : : {
419 [ # # ]: 0 : SolarMutexGuard aGuard;
420 [ # # ][ # # ]: 0 : DoubleClick();
421 : 0 : }
422 : :
423 : : //--------------------------------------------------------------------
424 : : // old sfx2 interface
425 : : //--------------------------------------------------------------------
426 : :
427 : 0 : void SfxStatusBarControl::StateChanged
428 : : (
429 : : sal_uInt16 nSID,
430 : : SfxItemState eState,
431 : : const SfxPoolItem* pState /* Pointer to SfxPoolItem, is only valid
432 : : withih this Method call. This can be a
433 : : Null-Pointer, a Pointer to SfxVoidItem
434 : : or of this Type found registered by the
435 : : Subclass of SfxStatusBarControl.
436 : : */
437 : : )
438 : :
439 : : /* [Description]
440 : :
441 : : The base implementation includes items of type SfxStringItem
442 : : where the text is entered in the status row field and
443 : : SfxVoidItem, where the field is emptied. The base implementation
444 : : should not be called in overloaded methods.
445 : : */
446 : :
447 : : {
448 : : DBG_ASSERT( pBar != 0, "setting state to dangling StatusBar" );
449 : :
450 [ # # ][ # # ]: 0 : const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
451 [ # # ][ # # ]: 0 : if ( eState == SFX_ITEM_AVAILABLE && pStr )
452 : 0 : pBar->SetItemText( nSID, pStr->GetValue() );
453 : : else
454 : : {
455 : : DBG_ASSERT( eState != SFX_ITEM_AVAILABLE || pState->ISA(SfxVoidItem),
456 : : "wrong SfxPoolItem subclass in SfxStatusBarControl" );
457 [ # # ]: 0 : pBar->SetItemText( nSID, String() );
458 : : }
459 : 0 : }
460 : :
461 : : //--------------------------------------------------------------------
462 : :
463 : 0 : sal_Bool SfxStatusBarControl::MouseButtonDown( const MouseEvent & )
464 : :
465 : : /* [Description]
466 : :
467 : : This virtual method forwards the Event MouseButtonDown() of the
468 : : StatusBar if the mouse position is within the range of the items,
469 : : or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
470 : :
471 : : The default implementation is empty and returns FALSE.
472 : :
473 : : [Return value]
474 : :
475 : : sal_Bool TRUE
476 : : The event has been processed and is not intended to
477 : : be forwarded to StatusBar
478 : :
479 : : FALSE
480 : : The event was not processed and is to be
481 : : be forwarded to StatusBar
482 : : */
483 : :
484 : : {
485 : 0 : return sal_False;
486 : : }
487 : :
488 : : //--------------------------------------------------------------------
489 : :
490 : 0 : sal_Bool SfxStatusBarControl::MouseMove( const MouseEvent & )
491 : :
492 : : /* [Description]
493 : :
494 : : This virtual method forwards the Event MouseMove() of the
495 : : StatusBar if the mouse position is within the range of the items,
496 : : or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
497 : :
498 : : The default implementation is empty and returns FALSE.
499 : :
500 : : [Return value]
501 : :
502 : : sal_Bool TRUE
503 : : The event has been processed and is not intended to
504 : : be forwarded to StatusBar
505 : :
506 : : FALSE
507 : : The event was not processed and is to be
508 : : be forwarded to StatusBar
509 : : */
510 : :
511 : : {
512 : 0 : return sal_False;
513 : : }
514 : :
515 : : //--------------------------------------------------------------------
516 : :
517 : 0 : sal_Bool SfxStatusBarControl::MouseButtonUp( const MouseEvent & )
518 : :
519 : : /* [Description]
520 : :
521 : : This virtual method forwards the Event MouseButtonUp() of the
522 : : StatusBar if the mouse position is within the range of the items,
523 : : or if the mouse was captured by <SfxStatusBarControl::CaptureMouse()>
524 : :
525 : : The default implementation is empty and returns FALSE.
526 : :
527 : : [Return value]
528 : :
529 : : sal_Bool TRUE
530 : : The event has been processed and is not intended to
531 : : be forwarded to StatusBar
532 : :
533 : : FALSE
534 : : The event was not processed and is to be
535 : : be forwarded to StatusBar
536 : : */
537 : :
538 : : {
539 : 0 : return sal_False;
540 : : }
541 : :
542 : : //--------------------------------------------------------------------
543 : :
544 : 0 : void SfxStatusBarControl::Command( const CommandEvent& )
545 : :
546 : : /* [Description]
547 : :
548 : : This virtual method is called when a CommandEvent is recived by
549 : : SfxStatusBarControl.
550 : :
551 : : The default implementation is empty.
552 : : */
553 : :
554 : : {
555 : 0 : }
556 : :
557 : : //--------------------------------------------------------------------
558 : :
559 : 0 : void SfxStatusBarControl::Click()
560 : :
561 : : /* [Description]
562 : :
563 : : This virtual method is called when the user clicks on the
564 : : field in the status row that belongs to this control.
565 : :
566 : : The default implementation is empty.
567 : : */
568 : :
569 : : {
570 : 0 : }
571 : :
572 : : //--------------------------------------------------------------------
573 : :
574 : 0 : void SfxStatusBarControl::DoubleClick()
575 : :
576 : : /* [Description]
577 : :
578 : : This virtual method is called when the user double-clicks on the
579 : : field in the status row that belongs to this control.
580 : : */
581 : :
582 : : {
583 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
584 [ # # ][ # # ]: 0 : execute( aArgs );
585 : 0 : }
586 : :
587 : : //--------------------------------------------------------------------
588 : :
589 : 0 : void SfxStatusBarControl::Paint
590 : : (
591 : : const UserDrawEvent& /* Reference to an UserDrawEvent */
592 : : )
593 : :
594 : : /* [Description]
595 : :
596 : : This virtual method is called to paint the contents if the field
597 : : at hand is marked with SIB_USERDRAW. The output must be obtained
598 : : within the Rectangle of rUDEvt.GetRect() by the OutputDevice
599 : : given by rUDEvt.GetDevice().
600 : :
601 : : The default implementation is empty.
602 : : */
603 : :
604 : : {
605 : 0 : }
606 : :
607 : : //--------------------------------------------------------------------
608 : :
609 : 0 : void SfxStatusBarControl::CaptureMouse()
610 : : {
611 : 0 : }
612 : :
613 : : //--------------------------------------------------------------------
614 : :
615 : 0 : void SfxStatusBarControl::ReleaseMouse()
616 : : {
617 : 0 : }
618 : :
619 : : //--------------------------------------------------------------------
620 : :
621 : 11541 : SfxStatusBarControl* SfxStatusBarControl::CreateControl
622 : : (
623 : : sal_uInt16 nSlotID,
624 : : sal_uInt16 nStbId,
625 : : StatusBar* pBar,
626 : : SfxModule* pMod
627 : : )
628 : : {
629 [ + - ]: 11541 : SolarMutexGuard aGuard;
630 [ + - ]: 11541 : SfxApplication *pApp = SFX_APP();
631 : :
632 : : SfxSlotPool *pSlotPool;
633 [ + + ]: 11541 : if ( pMod )
634 [ + - ]: 11507 : pSlotPool = pMod->GetSlotPool();
635 : : else
636 [ + - ]: 34 : pSlotPool = &SfxSlotPool::GetSlotPool();
637 : :
638 [ + - ]: 11541 : TypeId aSlotType = pSlotPool->GetSlotType(nSlotID);
639 [ + - ]: 11541 : if ( aSlotType )
640 : : {
641 [ + + ]: 11541 : if ( pMod )
642 : : {
643 [ + - ]: 11507 : SfxStbCtrlFactArr_Impl *pFactories = pMod->GetStbCtrlFactories_Impl();
644 [ + - ]: 11507 : if ( pFactories )
645 : : {
646 : 11507 : SfxStbCtrlFactArr_Impl &rFactories = *pFactories;
647 [ + + ]: 69342 : for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory )
648 [ + + + + : 96160 : if ( rFactories[nFactory]->nTypeId == aSlotType &&
+ + ][ + + ]
649 : 14533 : ( ( rFactories[nFactory]->nSlotId == 0 ) ||
650 : 13769 : ( rFactories[nFactory]->nSlotId == nSlotID) ) )
651 [ + - ]: 10023 : return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
652 : : }
653 : : }
654 : :
655 [ + - ]: 1518 : SfxStbCtrlFactArr_Impl &rFactories = pApp->GetStbCtrlFactories_Impl();
656 [ - + ]: 1518 : for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory )
657 [ # # # # : 0 : if ( rFactories[nFactory]->nTypeId == aSlotType &&
# # ][ # # ]
658 : 0 : ( ( rFactories[nFactory]->nSlotId == 0 ) ||
659 : 0 : ( rFactories[nFactory]->nSlotId == nSlotID) ) )
660 [ # # ]: 0 : return rFactories[nFactory]->pCtor( nSlotID, nStbId, *pBar );
661 : : }
662 : :
663 [ + - ]: 11541 : return NULL;
664 : : }
665 : :
666 : : //--------------------------------------------------------------------
667 : 1350 : void SfxStatusBarControl::RegisterStatusBarControl(SfxModule* pMod, SfxStbCtrlFactory* pFact)
668 : : {
669 : 1350 : SFX_APP()->RegisterStatusBarControl_Impl( pMod, pFact );
670 : 1350 : }
671 : : //--------------------------------------------------------------------
672 : :
673 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|