1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX2_STBITEM_HXX
20 #define INCLUDED_SFX2_STBITEM_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <svl/poolitem.hxx>
25 #include <svtools/statusbarcontroller.hxx>
27 //------------------------------------------------------------------
31 class SfxStatusBarControl
;
34 svt::StatusbarController
* SAL_CALL
SfxStatusBarControllerFactory(
35 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
,
36 StatusBar
* pStatusBar
,
38 const OUString
& aCommandURL
);
39 typedef SfxStatusBarControl
* (*SfxStatusBarControlCtor
)( sal_uInt16 nSlotId
, sal_uInt16 nId
, StatusBar
&rStb
);
41 struct SfxStbCtrlFactory
43 SfxStatusBarControlCtor pCtor
;
47 SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor
,
48 TypeId nTheTypeId
, sal_uInt16 nTheSlotId
):
55 //------------------------------------------------------------------
61 class SFX2_DLLPUBLIC SfxStatusBarControl
: public svt::StatusbarController
70 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
71 virtual void SAL_CALL
acquire() throw();
72 virtual void SAL_CALL
release() throw();
75 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& aEvent
) throw( ::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
statusChanged( const ::com::sun::star::frame::FeatureStateEvent
& Event
)
82 throw ( ::com::sun::star::uno::RuntimeException
);
84 // XStatusbarController
85 virtual ::sal_Bool SAL_CALL
mouseButtonDown( const ::com::sun::star::awt::MouseEvent
& aMouseEvent
) throw (::com::sun::star::uno::RuntimeException
);
86 virtual ::sal_Bool SAL_CALL
mouseMove( const ::com::sun::star::awt::MouseEvent
& aMouseEvent
) throw (::com::sun::star::uno::RuntimeException
);
87 virtual ::sal_Bool SAL_CALL
mouseButtonUp( const ::com::sun::star::awt::MouseEvent
& aMouseEvent
) throw (::com::sun::star::uno::RuntimeException
);
88 virtual void SAL_CALL
command( const ::com::sun::star::awt::Point
& aPos
,
90 ::sal_Bool bMouseEvent
,
91 const ::com::sun::star::uno::Any
& aData
) throw (::com::sun::star::uno::RuntimeException
);
92 virtual void SAL_CALL
paint( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
,
93 const ::com::sun::star::awt::Rectangle
& rOutputRectangle
,
94 ::sal_Int32 nStyle
) throw (::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
click( const ::com::sun::star::awt::Point
& aPos
) throw (::com::sun::star::uno::RuntimeException
);
96 virtual void SAL_CALL
doubleClick( const ::com::sun::star::awt::Point
& aPos
) throw (::com::sun::star::uno::RuntimeException
);
99 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
100 const SfxPoolItem
* pState
);
101 virtual void Click();
102 virtual void DoubleClick();
103 virtual void Command( const CommandEvent
& rCEvt
);
104 virtual sal_Bool
MouseButtonDown( const MouseEvent
& );
105 virtual sal_Bool
MouseMove( const MouseEvent
& );
106 virtual sal_Bool
MouseButtonUp( const MouseEvent
& );
107 virtual void Paint( const UserDrawEvent
&rUDEvt
);
109 static sal_uInt16
convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons
);
112 SfxStatusBarControl( sal_uInt16 nSlotID
, sal_uInt16 nId
, StatusBar
& rBar
);
113 virtual ~SfxStatusBarControl();
115 sal_uInt16
GetSlotId() const { return nSlotId
; }
116 sal_uInt16
GetId() const { return nId
; }
117 StatusBar
& GetStatusBar() const { return *pBar
; }
121 static SfxStatusBarControl
* CreateControl( sal_uInt16 nSlotID
, sal_uInt16 nId
, StatusBar
*pBar
, SfxModule
* );
122 static void RegisterStatusBarControl(SfxModule
*, SfxStbCtrlFactory
*);
126 //------------------------------------------------------------------
128 #define SFX_DECL_STATUSBAR_CONTROL() \
129 static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
130 static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
132 #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
133 SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
134 { return new Class( nSlotId, nId, rStb ); } \
135 void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
136 { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \
137 Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */