1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
39 #define NID_CTRL 20004
44 #define NID_OUTL 20009
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
58 class SwTbxAutoTextCtrl final
: public SfxToolBoxControl
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
,
69 const SfxPoolItem
* pState
) override
;
71 DECL_STATIC_LINK(SwTbxAutoTextCtrl
, PopupHdl
, Menu
*, bool);
74 class SwPreviewZoomControl final
: public SfxToolBoxControl
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
,
84 const SfxPoolItem
* pState
) override
;
86 virtual VclPtr
<InterimItemWindow
> CreateItemWindow( vcl::Window
*pParent
) override
;
89 class SwJumpToSpecificPageControl final
: public SfxToolBoxControl
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
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();}
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
132 NavElementBox_Impl(vcl::Window
* pParent
,
133 const uno::Reference
<frame::XFrame
>& xFrame
);
135 virtual void dispose() override
138 InterimItemWindow::dispose();
141 virtual void GetFocus() override
144 m_xComboBox
->grab_focus();
145 InterimItemWindow::GetFocus();
148 virtual bool DoKeyInput(const KeyEvent
& rKEvt
) override
;
150 virtual ~NavElementBox_Impl() override
156 typedef cppu::ImplInheritanceHelper
< ::svt::ToolboxController
, lang::XServiceInfo
> NavElementToolBoxControl_Base
;
157 class NavElementToolBoxControl final
: public NavElementToolBoxControl_Base
160 explicit NavElementToolBoxControl(
161 const css::uno::Reference
< css::uno::XComponentContext
>& rServiceManager
);
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
;
169 virtual void SAL_CALL
dispose() override
;
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();}
184 VclPtr
<NavElementBox_Impl
> m_xVclBox
;
185 std::unique_ptr
<NavElementBox_Base
> m_xWeldBox
;
186 NavElementBox_Base
* m_pBox
;
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */