/src/libreoffice/sw/source/uibase/inc/workctrl.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_SW_SOURCE_UIBASE_INC_WORKCTRL_HXX |
20 | | #define INCLUDED_SW_SOURCE_UIBASE_INC_WORKCTRL_HXX |
21 | | |
22 | | #include <sfx2/tbxctrl.hxx> |
23 | | #include <vcl/toolbox.hxx> |
24 | | #include <vcl/InterimItemWindow.hxx> |
25 | | #include <com/sun/star/lang/XServiceInfo.hpp> |
26 | | |
27 | | class Menu; |
28 | | |
29 | | using namespace ::com::sun::star; |
30 | | |
31 | | // double entry! hrc and hxx |
32 | | // these Ids say what the buttons below the scrollbar are doing |
33 | 0 | #define NID_START 20000 |
34 | 0 | #define NID_TBL 20000 |
35 | 0 | #define NID_FRM 20001 |
36 | 0 | #define NID_PGE 20002 |
37 | 0 | #define NID_DRW 20003 |
38 | 0 | #define NID_CTRL 20004 |
39 | 0 | #define NID_REG 20005 |
40 | 0 | #define NID_BKM 20006 |
41 | 0 | #define NID_GRF 20007 |
42 | 0 | #define NID_OLE 20008 |
43 | 0 | #define NID_OUTL 20009 |
44 | 0 | #define NID_SEL 20010 |
45 | 0 | #define NID_FTN 20011 |
46 | 0 | #define NID_MARK 20012 |
47 | 0 | #define NID_POSTIT 20013 |
48 | 0 | #define NID_SRCH_REP 20014 |
49 | 0 | #define NID_INDEX_ENTRY 20015 |
50 | 0 | #define NID_TABLE_FORMULA 20016 |
51 | 0 | #define NID_TABLE_FORMULA_ERROR 20017 |
52 | 0 | #define NID_RECENCY 20018 |
53 | 0 | #define NID_FIELD 20019 |
54 | 0 | #define NID_FIELD_BYTYPE 20020 |
55 | 0 | #define NID_COUNT 21 |
56 | | |
57 | | class SwTbxAutoTextCtrl final : public SfxToolBoxControl |
58 | | { |
59 | | public: |
60 | | SFX_DECL_TOOLBOX_CONTROL(); |
61 | | |
62 | | SwTbxAutoTextCtrl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); |
63 | | virtual ~SwTbxAutoTextCtrl() override; |
64 | | |
65 | | virtual void CreatePopupWindow() override; |
66 | | virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, |
67 | | SfxItemState eState, |
68 | | const SfxPoolItem* pState ) override; |
69 | | |
70 | | DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, bool); |
71 | | }; |
72 | | |
73 | | class SwPreviewZoomControl final : public SfxToolBoxControl |
74 | | { |
75 | | public: |
76 | | SFX_DECL_TOOLBOX_CONTROL(); |
77 | | |
78 | | SwPreviewZoomControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); |
79 | | virtual ~SwPreviewZoomControl() override; |
80 | | |
81 | | virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, |
82 | | SfxItemState eState, |
83 | | const SfxPoolItem* pState ) override; |
84 | | |
85 | | virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override; |
86 | | }; |
87 | | |
88 | | class SwJumpToSpecificPageControl final : public SfxToolBoxControl |
89 | | { |
90 | | public: |
91 | | SFX_DECL_TOOLBOX_CONTROL(); |
92 | | |
93 | | SwJumpToSpecificPageControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx ); |
94 | | virtual ~SwJumpToSpecificPageControl() override; |
95 | | |
96 | | virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override; |
97 | | }; |
98 | | |
99 | | class NavElementBox_Base |
100 | | { |
101 | | public: |
102 | | NavElementBox_Base(std::unique_ptr<weld::ComboBox> xComboBox, |
103 | | uno::Reference<frame::XFrame> xFrame); |
104 | | |
105 | 0 | virtual ~NavElementBox_Base() {} |
106 | | |
107 | 0 | void set_sensitive(bool bSensitive) {m_xComboBox->set_sensitive(bSensitive);} |
108 | | |
109 | 0 | weld::ComboBox* GetComboBox() {return m_xComboBox.get();} |
110 | | |
111 | | void UpdateBox(); |
112 | | |
113 | | |
114 | | protected: |
115 | | std::unique_ptr<weld::ComboBox> m_xComboBox; |
116 | | uno::Reference< frame::XFrame > m_xFrame; |
117 | | |
118 | | virtual bool DoKeyInput(const KeyEvent& /*rKEvt*/); |
119 | | |
120 | | DECL_STATIC_LINK(NavElementBox_Base, SelectHdl, weld::ComboBox&, void); |
121 | | DECL_LINK(KeyInputHdl, const KeyEvent&, bool); |
122 | | |
123 | | void ReleaseFocus_Impl(); |
124 | | }; |
125 | | |
126 | | class NavElementBox_Impl final : public InterimItemWindow, public NavElementBox_Base |
127 | | { |
128 | | public: |
129 | | NavElementBox_Impl(vcl::Window* pParent, |
130 | | const uno::Reference<frame::XFrame>& xFrame); |
131 | | |
132 | | virtual void dispose() override |
133 | 0 | { |
134 | 0 | m_xComboBox.reset(); |
135 | 0 | InterimItemWindow::dispose(); |
136 | 0 | } |
137 | | |
138 | | virtual void GetFocus() override |
139 | 0 | { |
140 | 0 | if (m_xComboBox) |
141 | 0 | m_xComboBox->grab_focus(); |
142 | 0 | InterimItemWindow::GetFocus(); |
143 | 0 | } |
144 | | |
145 | | virtual bool DoKeyInput(const KeyEvent& rKEvt) override; |
146 | | |
147 | | virtual ~NavElementBox_Impl() override |
148 | 0 | { |
149 | 0 | disposeOnce(); |
150 | 0 | } |
151 | | }; |
152 | | |
153 | | typedef cppu::ImplInheritanceHelper< ::svt::ToolboxController, lang::XServiceInfo> NavElementToolBoxControl_Base; |
154 | | class NavElementToolBoxControl final : public NavElementToolBoxControl_Base |
155 | | { |
156 | | public: |
157 | | explicit NavElementToolBoxControl( |
158 | | const css::uno::Reference< css::uno::XComponentContext >& rServiceManager ); |
159 | | |
160 | | // XServiceInfo |
161 | | virtual OUString SAL_CALL getImplementationName() override; |
162 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
163 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
164 | | |
165 | | // XComponent |
166 | | virtual void SAL_CALL dispose() override; |
167 | | |
168 | | // XStatusListener |
169 | | virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; |
170 | | |
171 | | // XToolbarController |
172 | | virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override; |
173 | | virtual void SAL_CALL click() override; |
174 | | virtual void SAL_CALL doubleClick() override; |
175 | | virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override; |
176 | | virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override; |
177 | | |
178 | 0 | weld::ComboBox* GetComboBox() {return m_pBox->GetComboBox();} |
179 | | |
180 | | private: |
181 | | VclPtr<NavElementBox_Impl> m_xVclBox; |
182 | | std::unique_ptr<NavElementBox_Base> m_xWeldBox; |
183 | | NavElementBox_Base* m_pBox; |
184 | | }; |
185 | | |
186 | | #endif |
187 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |