xref: /trunk/main/sw/source/ui/inc/workctrl.hxx (revision 256193c1fa5bb28e88cb9c86285c4f546b4902e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef _WORKCTRL_HXX
23 #define _WORKCTRL_HXX
24 
25 #include <sfx2/tbxctrl.hxx>
26 #include <vcl/toolbox.hxx>
27 #include <svtools/stdctrl.hxx>
28 #ifndef _IMAGEBTN_HXX //autogen
29 #include <vcl/button.hxx>
30 #endif
31 
32 class PopupMenu;
33 class SwView;
34 
35 // doppelter Eintrag! hrc und hxx
36 // diese Ids bestimmen, was die Buttons unter dem Scrollbar tun
37 #define NID_START   20000
38 #define NID_NEXT    20000
39 #define NID_PREV    20001
40 #define NID_TBL     20002
41 #define NID_FRM     20003
42 #define NID_PGE     20004
43 #define NID_DRW     20005
44 #define NID_CTRL    20006
45 #define NID_REG     20007
46 #define NID_BKM     20008
47 #define NID_GRF     20009
48 #define NID_OLE     20010
49 #define NID_OUTL    20011
50 #define NID_SEL     20012
51 #define NID_FTN     20013
52 #define NID_MARK    20014
53 #define NID_POSTIT  20015
54 #define NID_SRCH_REP 20016
55 #define NID_INDEX_ENTRY  20017
56 #define NID_TABLE_FORMULA   20018
57 #define NID_TABLE_FORMULA_ERROR     20019
58 #define NID_COUNT  20
59 
60 
61 //----------------------------------------------------------------------------
62 //
63 //----------------------------------------------------------------------------
64 
65 class SwTbxInsertCtrl : public SfxToolBoxControl
66 {
67     sal_uInt16                  nLastSlotId;
68 
69     using SfxToolBoxControl::Select;
70     virtual void            Select( sal_Bool bMod1 = sal_False );
71 
72 public:
73     SFX_DECL_TOOLBOX_CONTROL();
74 
75     SwTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
76     ~SwTbxInsertCtrl();
77 
78     virtual SfxPopupWindowType  GetPopupWindowType() const;
79     virtual SfxPopupWindow*     CreatePopupWindow();
80     virtual void                StateChanged( sal_uInt16 nSID,
81                                               SfxItemState eState,
82                                               const SfxPoolItem* pState );
83 
84     virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
85 };
86 
87 //----------------------------------------------------------------------------
88 //
89 //----------------------------------------------------------------------------
90 
91 class SwTbxAutoTextCtrl : public SfxToolBoxControl
92 {
93     PopupMenu*              pPopup;
94     SwView*                 pView;
95 
96 
97     void                    DelPopup();
98 public:
99     SFX_DECL_TOOLBOX_CONTROL();
100 
101     SwTbxAutoTextCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
102     ~SwTbxAutoTextCtrl();
103 
104     virtual SfxPopupWindowType  GetPopupWindowType() const;
105     virtual SfxPopupWindow*     CreatePopupWindow();
106     virtual void                StateChanged( sal_uInt16 nSID,
107                                               SfxItemState eState,
108                                               const SfxPoolItem* pState );
109 
110     DECL_LINK(PopupHdl, PopupMenu*);
111 };
112 
113 
114 //----------------------------------------------------------------------------
115 //
116 //----------------------------------------------------------------------------
117 
118 class SwScrollNaviToolBox : public ToolBox
119 {
120     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
121     virtual void    RequestHelp( const HelpEvent& rHEvt );
122 
123     public:
SwScrollNaviToolBox(Window * pParent,WinBits nWinStyle)124         SwScrollNaviToolBox(Window* pParent, WinBits nWinStyle ) :
125             ToolBox(pParent, nWinStyle ) {}
126 };
127 
128 class SwScrollNaviPopup : public SfxPopupWindow
129 {
130     SwScrollNaviToolBox    aToolBox;
131     FixedLine       aSeparator;
132     FixedInfo       aInfoField;
133     ImageList       aIList;
134     ImageList       aIListH;
135 
136     String          sQuickHelp[2 * NID_COUNT];
137 
138     sal_uInt16          nFwdId;
139     sal_uInt16          nBackId;
140 
141     void            ApplyImageList();
142 
143     using Window::GetQuickHelpText;
144 
145 protected:
146         DECL_LINK(SelectHdl, ToolBox*);
147         virtual void        DataChanged( const DataChangedEvent& rDCEvt );
148 
149 public:
150         SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
151         ~SwScrollNaviPopup();
152 
153     static String           GetQuickHelpText(sal_Bool bNext);
154 
155     virtual SfxPopupWindow* Clone() const;
GrabFocus()156     void                GrabFocus(){aToolBox.GrabFocus();}
157 };
158 
159 //----------------------------------------------------------------------------
160 //
161 //----------------------------------------------------------------------------
162 
163 class SwNaviImageButton : public ImageButton
164 {
165         SwScrollNaviPopup*  pPopup;
166         Image               aImage;
167         Image               aImageH;
168         String              sQuickText;
169         SfxPopupWindow*     pPopupWindow;
170         SfxPopupWindow*     pFloatingWindow;
171         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
172 
173     protected:
174         DECL_LINK( PopupModeEndHdl, void * );
175         DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
176 
177         virtual void    Click();
178         virtual void    DataChanged( const DataChangedEvent& rDCEvt );
179         void            SetPopupWindow( SfxPopupWindow* pWindow );
180 
181     public:
182         SwNaviImageButton(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
183 };
184 
185 //----------------------------------------------------------------------------
186 //  Die ImageButtons müssen sich bei Bedarf den HelpText selbst setzen
187 //----------------------------------------------------------------------------
188 
189 class SwHlpImageButton : public ImageButton
190 {
191     sal_Bool        bUp;
192     public:
SwHlpImageButton(Window * pParent,const ResId & rResId,sal_Bool bUpBtn)193         SwHlpImageButton(Window* pParent, const ResId& rResId, sal_Bool bUpBtn) :
194             ImageButton(pParent, rResId), bUp(bUpBtn){}
195 
196     virtual void    RequestHelp( const HelpEvent& rHEvt );
197 
198 };
199 /* -----------------26.11.2002 09:25-----------------
200  *
201  * --------------------------------------------------*/
202 class SwPreviewZoomControl : public SfxToolBoxControl
203 {
204 public:
205     SFX_DECL_TOOLBOX_CONTROL();
206 
207     SwPreviewZoomControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
208     ~SwPreviewZoomControl();
209 
210     virtual void            StateChanged( sal_uInt16 nSID,
211                                               SfxItemState eState,
212                                               const SfxPoolItem* pState );
213 
214     virtual Window*         CreateItemWindow( Window *pParent );
215 };
216 #endif
217 
218 /* vim: set noet sw=4 ts=4: */
219