xref: /trunk/main/sw/source/ui/inc/workctrl.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _WORKCTRL_HXX
28 #define _WORKCTRL_HXX
29 
30 #include <sfx2/tbxctrl.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <svtools/stdctrl.hxx>
33 #ifndef _IMAGEBTN_HXX //autogen
34 #include <vcl/button.hxx>
35 #endif
36 
37 class PopupMenu;
38 class SwView;
39 
40 // doppelter Eintrag! hrc und hxx
41 // diese Ids bestimmen, was die Buttons unter dem Scrollbar tun
42 #define NID_START   20000
43 #define NID_NEXT    20000
44 #define NID_PREV    20001
45 #define NID_TBL     20002
46 #define NID_FRM     20003
47 #define NID_PGE     20004
48 #define NID_DRW     20005
49 #define NID_CTRL    20006
50 #define NID_REG     20007
51 #define NID_BKM     20008
52 #define NID_GRF     20009
53 #define NID_OLE     20010
54 #define NID_OUTL    20011
55 #define NID_SEL     20012
56 #define NID_FTN     20013
57 #define NID_MARK    20014
58 #define NID_POSTIT  20015
59 #define NID_SRCH_REP 20016
60 #define NID_INDEX_ENTRY  20017
61 #define NID_TABLE_FORMULA   20018
62 #define NID_TABLE_FORMULA_ERROR     20019
63 #define NID_COUNT  20
64 
65 
66 
67 //----------------------------------------------------------------------------
68 //
69 //----------------------------------------------------------------------------
70 
71 class SwTbxInsertCtrl : public SfxToolBoxControl
72 {
73     sal_uInt16                  nLastSlotId;
74 
75     using SfxToolBoxControl::Select;
76     virtual void            Select( sal_Bool bMod1 = sal_False );
77 
78 public:
79     SFX_DECL_TOOLBOX_CONTROL();
80 
81     SwTbxInsertCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
82     ~SwTbxInsertCtrl();
83 
84     virtual SfxPopupWindowType  GetPopupWindowType() const;
85     virtual SfxPopupWindow*     CreatePopupWindow();
86     virtual void                StateChanged( sal_uInt16 nSID,
87                                               SfxItemState eState,
88                                               const SfxPoolItem* pState );
89 
90     virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
91 };
92 
93 //----------------------------------------------------------------------------
94 //
95 //----------------------------------------------------------------------------
96 
97 class SwTbxAutoTextCtrl : public SfxToolBoxControl
98 {
99     PopupMenu*              pPopup;
100     SwView*                 pView;
101 
102 
103     void                    DelPopup();
104 public:
105     SFX_DECL_TOOLBOX_CONTROL();
106 
107     SwTbxAutoTextCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
108     ~SwTbxAutoTextCtrl();
109 
110     virtual SfxPopupWindowType  GetPopupWindowType() const;
111     virtual SfxPopupWindow*     CreatePopupWindow();
112     virtual void                StateChanged( sal_uInt16 nSID,
113                                               SfxItemState eState,
114                                               const SfxPoolItem* pState );
115 
116     DECL_LINK(PopupHdl, PopupMenu*);
117 };
118 
119 
120 //----------------------------------------------------------------------------
121 //
122 //----------------------------------------------------------------------------
123 
124 class SwScrollNaviToolBox : public ToolBox
125 {
126     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
127     virtual void    RequestHelp( const HelpEvent& rHEvt );
128 
129     public:
130         SwScrollNaviToolBox(Window* pParent, WinBits nWinStyle ) :
131             ToolBox(pParent, nWinStyle ) {}
132 };
133 
134 class SwScrollNaviPopup : public SfxPopupWindow
135 {
136     SwScrollNaviToolBox    aToolBox;
137     FixedLine       aSeparator;
138     FixedInfo       aInfoField;
139     ImageList       aIList;
140     ImageList       aIListH;
141 
142     String          sQuickHelp[2 * NID_COUNT];
143 
144     sal_uInt16          nFwdId;
145     sal_uInt16          nBackId;
146 
147     void            ApplyImageList();
148 
149     using Window::GetQuickHelpText;
150 
151 protected:
152         DECL_LINK(SelectHdl, ToolBox*);
153         virtual void        DataChanged( const DataChangedEvent& rDCEvt );
154 
155 public:
156         SwScrollNaviPopup( sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
157         ~SwScrollNaviPopup();
158 
159     static String           GetQuickHelpText(sal_Bool bNext);
160 
161     virtual SfxPopupWindow* Clone() const;
162     void                GrabFocus(){aToolBox.GrabFocus();}
163 };
164 
165 //----------------------------------------------------------------------------
166 //
167 //----------------------------------------------------------------------------
168 
169 class SwNaviImageButton : public ImageButton
170 {
171         SwScrollNaviPopup*  pPopup;
172         Image               aImage;
173         Image               aImageH;
174         String              sQuickText;
175         SfxPopupWindow*     pPopupWindow;
176         SfxPopupWindow*     pFloatingWindow;
177         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
178 
179     protected:
180         DECL_LINK( PopupModeEndHdl, void * );
181         DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
182 
183         virtual void    Click();
184         virtual void    DataChanged( const DataChangedEvent& rDCEvt );
185         void            SetPopupWindow( SfxPopupWindow* pWindow );
186 
187     public:
188         SwNaviImageButton(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
189 };
190 
191 //----------------------------------------------------------------------------
192 //  Die ImageButtons muessen sich bei Bedarf den HelpText selbst setzen
193 //----------------------------------------------------------------------------
194 
195 class SwHlpImageButton : public ImageButton
196 {
197     sal_Bool        bUp;
198     public:
199         SwHlpImageButton(Window* pParent, const ResId& rResId, sal_Bool bUpBtn) :
200             ImageButton(pParent, rResId), bUp(bUpBtn){}
201 
202     virtual void    RequestHelp( const HelpEvent& rHEvt );
203 
204 };
205 /* -----------------26.11.2002 09:25-----------------
206  *
207  * --------------------------------------------------*/
208 class SwPreviewZoomControl : public SfxToolBoxControl
209 {
210 public:
211     SFX_DECL_TOOLBOX_CONTROL();
212 
213     SwPreviewZoomControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
214     ~SwPreviewZoomControl();
215 
216     virtual void            StateChanged( sal_uInt16 nSID,
217                                               SfxItemState eState,
218                                               const SfxPoolItem* pState );
219 
220     virtual Window*         CreateItemWindow( Window *pParent );
221 };
222 #endif
223 
224 
225 
226