LibreOffice Module sw (master)  1
workctrl.hxx
Go to the documentation of this file.
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>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 
27 class PopupMenu;
28 class SwView;
29 
30 using namespace ::com::sun::star;
31 
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
57 
59 {
60 public:
62 
63  SwTbxAutoTextCtrl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
64  virtual ~SwTbxAutoTextCtrl() override;
65 
66  virtual void CreatePopupWindow() override;
67  virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID,
68  SfxItemState eState,
69  const SfxPoolItem* pState ) override;
70 
71  DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, bool);
72 };
73 
75 {
76 public:
78 
79  SwPreviewZoomControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
80  virtual ~SwPreviewZoomControl() override;
81 
82  virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID,
83  SfxItemState eState,
84  const SfxPoolItem* pState ) override;
85 
86  virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
87 };
88 
90 {
91 public:
93 
94  SwJumpToSpecificPageControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
95  virtual ~SwJumpToSpecificPageControl() override;
96 
97  virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
98 };
99 
101 
103 {
104 public:
105  NavElementBox_Base(std::unique_ptr<weld::ComboBox> xComboBox,
106  const uno::Reference<frame::XFrame>& xFrame);
107 
108  virtual ~NavElementBox_Base() {}
109 
110  void set_sensitive(bool bSensitive) {m_xComboBox->set_sensitive(bSensitive);}
111 
113 
114  void UpdateBox();
115 
116 
117 protected:
118  std::unique_ptr<weld::ComboBox> m_xComboBox;
119  uno::Reference< frame::XFrame > m_xFrame;
121 
122  virtual bool DoKeyInput(const KeyEvent& /*rKEvt*/);
123 
125  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
126 
127  void ReleaseFocus_Impl();
128 };
129 
131 {
132 public:
134  const uno::Reference<frame::XFrame>& xFrame);
135 
136  virtual void dispose() override
137  {
138  m_xComboBox.reset();
140  }
141 
142  virtual void GetFocus() override
143  {
144  if (m_xComboBox)
145  m_xComboBox->grab_focus();
147  }
148 
149  virtual bool DoKeyInput(const KeyEvent& rKEvt) override;
150 
151  virtual ~NavElementBox_Impl() override
152  {
153  disposeOnce();
154  }
155 };
156 
157 class NavElementToolBoxControl : public svt::ToolboxController, public lang::XServiceInfo
158 {
159 public:
160  explicit NavElementToolBoxControl(
161  const css::uno::Reference< css::uno::XComponentContext >& rServiceManager );
162 
163  // XInterface
164  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
165  virtual void SAL_CALL acquire() noexcept override;
166  virtual void SAL_CALL release() noexcept override;
167 
168  // XServiceInfo
169  virtual OUString SAL_CALL getImplementationName() override;
170  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
171  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
172 
173  // XComponent
174  virtual void SAL_CALL dispose() override;
175 
176  // XStatusListener
177  virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
178 
179  // XToolbarController
180  virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
181  virtual void SAL_CALL click() override;
182  virtual void SAL_CALL doubleClick() override;
183  virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override;
184  virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override;
185 
187 
188 private:
190  std::unique_ptr<NavElementBox_Base> m_xWeldBox;
192 };
193 
194 #endif
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void set_sensitive(bool bSensitive)
Definition: workctrl.hxx:110
virtual void SAL_CALL dispose() override
Definition: workctrl.cxx:714
DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu *, bool)
DECL_STATIC_LINK(NavElementBox_Base, SelectHdl, weld::ComboBox &, void)
virtual ~SwTbxAutoTextCtrl() override
Definition: workctrl.cxx:73
virtual bool DoKeyInput(const KeyEvent &)
Definition: workctrl.cxx:654
Reference< XFrame > xFrame
virtual bool DoKeyInput(const KeyEvent &rKEvt) override
Definition: workctrl.cxx:659
virtual void SAL_CALL click() override
Definition: workctrl.cxx:755
sal_Int16 nId
virtual void SAL_CALL doubleClick() override
Definition: workctrl.cxx:759
uno::Reference< frame::XFrame > m_xFrame
Definition: workctrl.hxx:119
SwJumpToSpecificPageControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
Definition: workctrl.cxx:569
virtual void SAL_CALL release() noexcept override
Definition: workctrl.cxx:692
weld::ComboBox * GetComboBox()
Definition: workctrl.hxx:186
NavElementToolBoxControl(const css::uno::Reference< css::uno::XComponentContext > &rServiceManager)
Definition: workctrl.cxx:669
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: workctrl.cxx:124
virtual ~SwJumpToSpecificPageControl() override
Definition: workctrl.cxx:576
virtual void CreatePopupWindow() override
Definition: workctrl.cxx:77
virtual ~NavElementBox_Impl() override
Definition: workctrl.hxx:151
NavElementBox_Base * m_pBox
Definition: workctrl.hxx:191
virtual void GetFocus() override
virtual void SAL_CALL execute(sal_Int16 KeyModifier) override
Definition: workctrl.cxx:751
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
Definition: workctrl.cxx:725
virtual void dispose() override
Definition: workctrl.hxx:136
virtual ~NavElementBox_Base()
Definition: workctrl.hxx:108
virtual void GetFocus() override
Definition: workctrl.hxx:142
std::unique_ptr< NavElementBox_Base > m_xWeldBox
Definition: workctrl.hxx:190
SwPreviewZoomControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
Definition: workctrl.cxx:479
virtual ~SwPreviewZoomControl() override
Definition: workctrl.cxx:487
NavElementBox_Impl(vcl::Window *pParent, const uno::Reference< frame::XFrame > &xFrame)
Definition: workctrl.cxx:604
unsigned char sal_Bool
virtual void SAL_CALL acquire() noexcept override
Definition: workctrl.cxx:687
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
NavElementBox_Base(std::unique_ptr< weld::ComboBox > xComboBox, const uno::Reference< frame::XFrame > &xFrame)
Definition: workctrl.cxx:585
SwTbxAutoTextCtrl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
Definition: workctrl.cxx:64
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
Definition: workctrl.cxx:579
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: workctrl.cxx:698
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: workctrl.cxx:678
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: workctrl.cxx:491
SfxItemState
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override
Definition: workctrl.cxx:763
virtual void dispose() override
weld::ComboBox * GetComboBox()
Definition: workctrl.hxx:112
void ReleaseFocus_Impl()
Definition: workctrl.cxx:612
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: workctrl.cxx:708
VclPtr< NavElementBox_Impl > m_xVclBox
Definition: workctrl.hxx:189
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow(const css::uno::Reference< css::awt::XWindow > &Parent) override
Definition: workctrl.cxx:768
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
Definition: workctrl.cxx:507
virtual OUString SAL_CALL getImplementationName() override
Definition: workctrl.cxx:703
Definition: view.hxx:144
std::unique_ptr< weld::ComboBox > m_xComboBox
Definition: workctrl.hxx:118