Line data Source code
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 <svtools/stdctrl.hxx>
25 : #include <vcl/button.hxx>
26 :
27 : class PopupMenu;
28 : class SwView;
29 :
30 : // double entry! hrc and hxx
31 : // these Ids say what the buttons below the scrollbar are doing
32 : #define NID_START 20000
33 : #define NID_NEXT 20000
34 : #define NID_PREV 20001
35 : #define NID_TBL 20002
36 : #define NID_FRM 20003
37 : #define NID_PGE 20004
38 : #define NID_DRW 20005
39 : #define NID_CTRL 20006
40 : #define NID_REG 20007
41 : #define NID_BKM 20008
42 : #define NID_GRF 20009
43 : #define NID_OLE 20010
44 : #define NID_OUTL 20011
45 : #define NID_SEL 20012
46 : #define NID_FTN 20013
47 : #define NID_MARK 20014
48 : #define NID_POSTIT 20015
49 : #define NID_SRCH_REP 20016
50 : #define NID_INDEX_ENTRY 20017
51 : #define NID_TABLE_FORMULA 20018
52 : #define NID_TABLE_FORMULA_ERROR 20019
53 : #define NID_COUNT 20
54 :
55 : class SwTbxInsertCtrl : public SfxToolBoxControl
56 : {
57 : sal_uInt16 nLastSlotId;
58 :
59 : virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
60 :
61 : public:
62 : SFX_DECL_TOOLBOX_CONTROL();
63 :
64 : SwTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
65 : virtual ~SwTbxInsertCtrl();
66 :
67 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
68 : virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
69 : virtual void StateChanged( sal_uInt16 nSID,
70 : SfxItemState eState,
71 : const SfxPoolItem* pState ) SAL_OVERRIDE;
72 :
73 : virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 : };
75 :
76 : class SwTbxAutoTextCtrl : public SfxToolBoxControl
77 : {
78 : PopupMenu* pPopup;
79 :
80 : void DelPopup();
81 : public:
82 : SFX_DECL_TOOLBOX_CONTROL();
83 :
84 : SwTbxAutoTextCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
85 : virtual ~SwTbxAutoTextCtrl();
86 :
87 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
88 : virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
89 : virtual void StateChanged( sal_uInt16 nSID,
90 : SfxItemState eState,
91 : const SfxPoolItem* pState ) SAL_OVERRIDE;
92 :
93 : DECL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*);
94 : };
95 :
96 : class SwTbxFieldCtrl : public SfxToolBoxControl
97 : {
98 : public:
99 : SFX_DECL_TOOLBOX_CONTROL();
100 :
101 : SwTbxFieldCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
102 : virtual ~SwTbxFieldCtrl();
103 :
104 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
105 : virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
106 : virtual void StateChanged( sal_uInt16 nSID,
107 : SfxItemState eState,
108 : const SfxPoolItem* pState ) SAL_OVERRIDE;
109 :
110 : DECL_LINK(PopupHdl, PopupMenu*);
111 : };
112 :
113 : class SwScrollNaviPopup;
114 :
115 : class SwScrollNaviToolBox : public ToolBox
116 : {
117 : VclPtr<SwScrollNaviPopup> m_pNaviPopup;
118 :
119 : virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
120 : virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
121 :
122 : public:
123 0 : SwScrollNaviToolBox(vcl::Window* pParent, SwScrollNaviPopup* pNaviPopup, WinBits nWinStyle)
124 : : ToolBox(pParent, nWinStyle)
125 0 : , m_pNaviPopup(pNaviPopup)
126 : {
127 0 : }
128 : virtual ~SwScrollNaviToolBox();
129 : virtual void dispose() SAL_OVERRIDE;
130 : };
131 :
132 : class SwScrollNaviPopup : public SfxPopupWindow
133 : {
134 : VclPtr<SwScrollNaviToolBox> m_pToolBox;
135 : VclPtr<FixedText> m_pInfoField;
136 : ImageList aIList;
137 :
138 : OUString sQuickHelp[2 * NID_COUNT];
139 :
140 : void ApplyImageList();
141 :
142 : using Window::GetQuickHelpText;
143 :
144 : protected:
145 : DECL_LINK_TYPED(SelectHdl, ToolBox*, void);
146 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
147 :
148 : public:
149 : SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window *pParent );
150 : virtual ~SwScrollNaviPopup();
151 : virtual void dispose() SAL_OVERRIDE;
152 :
153 : static OUString GetQuickHelpText(bool bNext);
154 :
155 : virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE;
156 0 : void GrabFocus() { m_pToolBox->GrabFocus(); }
157 : };
158 :
159 : // ImageButtons have to set the HelpText themselves if needed
160 :
161 0 : class SwHlpImageButton : public ImageButton
162 : {
163 : bool bUp;
164 : public:
165 : SwHlpImageButton(vcl::Window* pParent, const ResId& rResId, bool bUpBtn) :
166 : ImageButton(pParent, rResId), bUp(bUpBtn){}
167 :
168 : virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
169 :
170 : };
171 :
172 : class SwPreviewZoomControl : public SfxToolBoxControl
173 : {
174 : public:
175 : SFX_DECL_TOOLBOX_CONTROL();
176 :
177 : SwPreviewZoomControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
178 : virtual ~SwPreviewZoomControl();
179 :
180 : virtual void StateChanged( sal_uInt16 nSID,
181 : SfxItemState eState,
182 : const SfxPoolItem* pState ) SAL_OVERRIDE;
183 :
184 : virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
185 : };
186 : #endif
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|