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