/src/libreoffice/include/sfx2/stbitem.hxx
Line | Count | Source |
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 | | #ifndef INCLUDED_SFX2_STBITEM_HXX |
20 | | #define INCLUDED_SFX2_STBITEM_HXX |
21 | | |
22 | | #include <sal/config.h> |
23 | | #include <sfx2/dllapi.h> |
24 | | #include <svtools/statusbarcontroller.hxx> |
25 | | #include <vcl/vclptr.hxx> |
26 | | |
27 | | class SfxModule; |
28 | | class SfxStatusBarControl; |
29 | | class StatusBar; |
30 | | class SfxPoolItem; |
31 | | enum class SfxItemState; |
32 | | |
33 | | rtl::Reference<svt::StatusbarController> SfxStatusBarControllerFactory( |
34 | | const css::uno::Reference< css::frame::XFrame >& rFrame, |
35 | | StatusBar* pStatusBar, |
36 | | unsigned short nID, |
37 | | const OUString& aCommandURL ); |
38 | | typedef rtl::Reference<SfxStatusBarControl> (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); |
39 | | |
40 | | struct SfxStbCtrlFactory |
41 | | { |
42 | | SfxStatusBarControlCtor pCtor; |
43 | | const std::type_info& nTypeId; |
44 | | sal_uInt16 nSlotId; |
45 | | |
46 | | SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor, |
47 | | const std::type_info& nTheTypeId, sal_uInt16 nTheSlotId ): |
48 | 241 | pCtor(pTheCtor), |
49 | 241 | nTypeId(nTheTypeId), |
50 | 241 | nSlotId(nTheSlotId) |
51 | 241 | {} |
52 | | }; |
53 | | |
54 | | |
55 | | class CommandEvent; |
56 | | class MouseEvent; |
57 | | class UserDrawEvent; |
58 | | |
59 | | class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController |
60 | | { |
61 | | sal_uInt16 nSlotId; |
62 | | sal_uInt16 nId; |
63 | | VclPtr<StatusBar> pBar; |
64 | | |
65 | | public: |
66 | | // new controller API |
67 | | // XInterface |
68 | | virtual void SAL_CALL acquire() noexcept override; |
69 | | virtual void SAL_CALL release() noexcept override; |
70 | | |
71 | | // XEventListener |
72 | | using svt::StatusbarController::disposing; |
73 | | |
74 | | // XComponent |
75 | | using svt::StatusbarController::dispose; |
76 | | |
77 | | // XStatusListener |
78 | | virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; |
79 | | |
80 | | // XStatusbarController |
81 | | virtual sal_Bool SAL_CALL mouseButtonDown( const css::awt::MouseEvent& aMouseEvent ) override; |
82 | | virtual sal_Bool SAL_CALL mouseMove( const css::awt::MouseEvent& aMouseEvent ) override; |
83 | | virtual sal_Bool SAL_CALL mouseButtonUp( const css::awt::MouseEvent& aMouseEvent ) override; |
84 | | virtual void SAL_CALL command( const css::awt::Point& aPos, |
85 | | ::sal_Int32 nCommand, |
86 | | sal_Bool bMouseEvent, |
87 | | const css::uno::Any& aData ) override; |
88 | | virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics, |
89 | | const css::awt::Rectangle& rOutputRectangle, |
90 | | ::sal_Int32 nStyle ) override; |
91 | | virtual void SAL_CALL click( const css::awt::Point& aPos ) override; |
92 | | virtual void SAL_CALL doubleClick( const css::awt::Point& aPos ) override; |
93 | | |
94 | | protected: |
95 | | // Old sfx2 interface |
96 | | virtual void StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, |
97 | | const SfxPoolItem* pState ); |
98 | | virtual void Click(); |
99 | | virtual void Command( const CommandEvent& rCEvt ); |
100 | | virtual bool MouseButtonDown( const MouseEvent & ); |
101 | | virtual bool MouseMove( const MouseEvent & ); |
102 | | virtual bool MouseButtonUp( const MouseEvent & ); |
103 | | virtual void Paint( const UserDrawEvent &rUDEvt ); |
104 | | |
105 | | static sal_uInt16 convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons ); |
106 | | |
107 | | public: |
108 | | SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar ); |
109 | | virtual ~SfxStatusBarControl() override; |
110 | | |
111 | 0 | sal_uInt16 GetSlotId() const { return nSlotId; } |
112 | 0 | sal_uInt16 GetId() const { return nId; } |
113 | 0 | StatusBar& GetStatusBar() const { return *pBar; } |
114 | | |
115 | | static rtl::Reference<SfxStatusBarControl> CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule const * ); |
116 | | static void RegisterStatusBarControl(SfxModule*, const SfxStbCtrlFactory&); |
117 | | |
118 | | }; |
119 | | |
120 | | |
121 | | #define SFX_DECL_STATUSBAR_CONTROL() \ |
122 | | static rtl::Reference<SfxStatusBarControl> CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \ |
123 | | static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr) |
124 | | |
125 | | #define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \ |
126 | | rtl::Reference<SfxStatusBarControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \ |
127 | 0 | { return new Class( nSlotId, nId, rStb ); } \Unexecuted instantiation: ScAutoCalculateControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxPosSizeStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxInsertStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxSelectionModeControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: XmlSecStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxModifyControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxZoomSliderControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxZoomStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SvxZoomPageStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: sw::AccessibilityStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SwBookmarkControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SwTemplateControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SwViewLayoutControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SwWordCountStatusBarControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SwZoomControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SdTemplateControl::CreateImpl(unsigned short, unsigned short, StatusBar&) Unexecuted instantiation: SdScaleControl::CreateImpl(unsigned short, unsigned short, StatusBar&) |
128 | | void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ |
129 | 241 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ |
130 | 241 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } ScAutoCalculateControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 11 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 11 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxPosSizeStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 25 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 25 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxInsertStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 20 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 20 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxSelectionModeControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 20 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 20 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
XmlSecStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 26 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 26 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxModifyControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 27 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 27 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxZoomSliderControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 26 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 26 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxZoomStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 17 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 17 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SvxZoomPageStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 5 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 5 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
sw::AccessibilityStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SwBookmarkControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SwTemplateControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SwViewLayoutControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SwWordCountStatusBarControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SwZoomControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 9 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 9 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SdTemplateControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 5 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 5 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
SdScaleControl::RegisterControl(unsigned short, SfxModule*) Line | Count | Source | 129 | 5 | { SfxStatusBarControl::RegisterStatusBarControl( pMod, SfxStbCtrlFactory( \ | 130 | 5 | Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } |
|
131 | | |
132 | | |
133 | | #endif |
134 | | |
135 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |