Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / stbitem.hxx
blob4531d0a23b818087dbf08f42d934420f2fbe0972
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include <vcl/status.hxx>
29 class SfxModule;
30 class SfxStatusBarControl;
32 svt::StatusbarController* SfxStatusBarControllerFactory(
33 const css::uno::Reference< css::frame::XFrame >& rFrame,
34 StatusBar* pStatusBar,
35 unsigned short nID,
36 const OUString& aCommandURL );
37 typedef SfxStatusBarControl* (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb );
39 struct SfxStbCtrlFactory
41 SfxStatusBarControlCtor const pCtor;
42 const std::type_info& nTypeId;
43 sal_uInt16 const nSlotId;
45 SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor,
46 const std::type_info& nTheTypeId, sal_uInt16 nTheSlotId ):
47 pCtor(pTheCtor),
48 nTypeId(nTheTypeId),
49 nSlotId(nTheSlotId)
54 class CommandEvent;
55 class MouseEvent;
56 class UserDrawEvent;
58 class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController
60 sal_uInt16 const nSlotId;
61 sal_uInt16 const nId;
62 VclPtr<StatusBar> pBar;
64 protected:
65 // new controller API
66 // XInterface
67 virtual void SAL_CALL acquire() throw() override;
68 virtual void SAL_CALL release() throw() override;
70 // XEventListener
71 using svt::StatusbarController::disposing;
73 // XComponent
74 using svt::StatusbarController::dispose;
76 // XStatusListener
77 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
79 // XStatusbarController
80 virtual sal_Bool SAL_CALL mouseButtonDown( const css::awt::MouseEvent& aMouseEvent ) override;
81 virtual sal_Bool SAL_CALL mouseMove( const css::awt::MouseEvent& aMouseEvent ) override;
82 virtual sal_Bool SAL_CALL mouseButtonUp( const css::awt::MouseEvent& aMouseEvent ) override;
83 virtual void SAL_CALL command( const css::awt::Point& aPos,
84 ::sal_Int32 nCommand,
85 sal_Bool bMouseEvent,
86 const css::uno::Any& aData ) override;
87 virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics,
88 const css::awt::Rectangle& rOutputRectangle,
89 ::sal_Int32 nStyle ) override;
90 virtual void SAL_CALL click( const css::awt::Point& aPos ) override;
91 virtual void SAL_CALL doubleClick( const css::awt::Point& aPos ) override;
93 // Old sfx2 interface
94 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
95 const SfxPoolItem* pState );
96 virtual void Click();
97 virtual void Command( const CommandEvent& rCEvt );
98 virtual bool MouseButtonDown( const MouseEvent & );
99 virtual bool MouseMove( const MouseEvent & );
100 virtual bool MouseButtonUp( const MouseEvent & );
101 virtual void Paint( const UserDrawEvent &rUDEvt );
103 static sal_uInt16 convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
105 public:
106 SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar );
107 virtual ~SfxStatusBarControl() override;
109 sal_uInt16 GetSlotId() const { return nSlotId; }
110 sal_uInt16 GetId() const { return nId; }
111 StatusBar& GetStatusBar() const { return *pBar; }
113 static SfxStatusBarControl* CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule const * );
114 static void RegisterStatusBarControl(SfxModule*, const SfxStbCtrlFactory&);
119 #define SFX_DECL_STATUSBAR_CONTROL() \
120 static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
121 static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr)
123 #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
124 SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
125 { return new Class( nSlotId, nId, rStb ); } \
126 void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
127 { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \
128 Class::CreateImpl, typeid(nItemClass), nSlotId ) ); }
131 #endif
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */