xref: /aoo41x/main/vcl/inc/vcl/toolbox.hxx (revision 0d63794c)
1*0d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0d63794cSAndrew Rist  * distributed with this work for additional information
6*0d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
9*0d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0d63794cSAndrew Rist  *
11*0d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0d63794cSAndrew Rist  *
13*0d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0d63794cSAndrew Rist  * software distributed under the License is distributed on an
15*0d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*0d63794cSAndrew Rist  * specific language governing permissions and limitations
18*0d63794cSAndrew Rist  * under the License.
19*0d63794cSAndrew Rist  *
20*0d63794cSAndrew Rist  *************************************************************/
21*0d63794cSAndrew Rist 
22*0d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_TOOLBOX_HXX
25cdf0e10cSrcweir #define _SV_TOOLBOX_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/sv.h>
28cdf0e10cSrcweir #include <vcl/dllapi.h>
29cdf0e10cSrcweir #include <vcl/dockwin.hxx>
30cdf0e10cSrcweir #include <vcl/image.hxx>
31cdf0e10cSrcweir #include <vcl/timer.hxx>
32cdf0e10cSrcweir #include <vcl/virdev.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class UserDrawEvent;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir struct ImplToolItem;
37cdf0e10cSrcweir struct ImplToolSizeArray;
38cdf0e10cSrcweir struct ImplToolSize;
39cdf0e10cSrcweir struct ImplToolBoxPrivateData;
40cdf0e10cSrcweir class  ImplTrackRect;
41cdf0e10cSrcweir class  PopupMenu;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace vcl
44cdf0e10cSrcweir {
45cdf0e10cSrcweir     class IImageListProvider;
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir // -------------------------
49cdf0e10cSrcweir // - ToolBoxCustomizeEvent -
50cdf0e10cSrcweir // -------------------------
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #define TOOLBOX_CUSTOMIZE_RESIZE        ((sal_uInt16)0xFFFE)
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class VCL_DLLPUBLIC ToolBoxCustomizeEvent
55cdf0e10cSrcweir {
56cdf0e10cSrcweir private:
57cdf0e10cSrcweir     ToolBox*    mpTargetBox;
58cdf0e10cSrcweir     void*       mpData;
59cdf0e10cSrcweir     sal_uInt16      mnIdFrom;
60cdf0e10cSrcweir     sal_uInt16      mnPosTo;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir                 ToolBoxCustomizeEvent();
64cdf0e10cSrcweir                 ToolBoxCustomizeEvent( ToolBox* pDropBox,
65cdf0e10cSrcweir                                        sal_uInt16 nId, sal_uInt16 nPos = 0,
66cdf0e10cSrcweir                                        void* pUserData = NULL );
67cdf0e10cSrcweir 
GetTargetBox() const68cdf0e10cSrcweir     ToolBox*    GetTargetBox() const { return mpTargetBox; }
GetTargetPos() const69cdf0e10cSrcweir     sal_uInt16      GetTargetPos() const { return mnPosTo; }
GetSourceId() const70cdf0e10cSrcweir     sal_uInt16      GetSourceId() const { return mnIdFrom; }
GetData() const71cdf0e10cSrcweir     void*       GetData() const { return mpData; }
72cdf0e10cSrcweir     sal_Bool        IsResized() const;
73cdf0e10cSrcweir };
74cdf0e10cSrcweir 
ToolBoxCustomizeEvent()75cdf0e10cSrcweir inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent()
76cdf0e10cSrcweir {
77cdf0e10cSrcweir     mpTargetBox = NULL;
78cdf0e10cSrcweir     mnIdFrom    = 0;
79cdf0e10cSrcweir     mnPosTo     = 0;
80cdf0e10cSrcweir     mpData      = NULL;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
ToolBoxCustomizeEvent(ToolBox * pDropBox,sal_uInt16 nId,sal_uInt16 nPos,void * pUserData)83cdf0e10cSrcweir inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox,
84cdf0e10cSrcweir                                                      sal_uInt16 nId, sal_uInt16 nPos,
85cdf0e10cSrcweir                                                      void* pUserData )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     mpTargetBox = pDropBox;
88cdf0e10cSrcweir     mnIdFrom    = nId;
89cdf0e10cSrcweir     mnPosTo     = nPos;
90cdf0e10cSrcweir     mpData      = pUserData;
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
IsResized() const93cdf0e10cSrcweir inline sal_Bool ToolBoxCustomizeEvent::IsResized() const
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     if ( mnPosTo == TOOLBOX_CUSTOMIZE_RESIZE )
96cdf0e10cSrcweir         return sal_True;
97cdf0e10cSrcweir     else
98cdf0e10cSrcweir         return sal_False;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir // -------------------
102cdf0e10cSrcweir // - ToolBoxItemBits -
103cdf0e10cSrcweir // -------------------
104cdf0e10cSrcweir 
105cdf0e10cSrcweir typedef sal_uInt16 ToolBoxItemBits;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir // --------------------------
108cdf0e10cSrcweir // - Bits fuer ToolBoxItems -
109cdf0e10cSrcweir // --------------------------
110cdf0e10cSrcweir 
111cdf0e10cSrcweir // By changes you must also change: rsc/vclrsc.hxx
112cdf0e10cSrcweir #define TIB_CHECKABLE           ((ToolBoxItemBits)0x0001)
113cdf0e10cSrcweir #define TIB_RADIOCHECK          ((ToolBoxItemBits)0x0002)
114cdf0e10cSrcweir #define TIB_AUTOCHECK           ((ToolBoxItemBits)0x0004)
115cdf0e10cSrcweir #define TIB_LEFT                ((ToolBoxItemBits)0x0008)
116cdf0e10cSrcweir #define TIB_AUTOSIZE            ((ToolBoxItemBits)0x0010)
117cdf0e10cSrcweir #define TIB_DROPDOWN            ((ToolBoxItemBits)0x0020)
118cdf0e10cSrcweir #define TIB_REPEAT              ((ToolBoxItemBits)0x0040)
119cdf0e10cSrcweir #define TIB_DROPDOWNONLY        ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN)    // this button has only drop down functionality
120cdf0e10cSrcweir #define TIB_TEXT_ONLY           ((ToolBoxItemBits)0x0100)
121cdf0e10cSrcweir #define TIB_ICON_ONLY           ((ToolBoxItemBits)0x0200)
122cdf0e10cSrcweir #define TIB_TEXTICON            ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
123cdf0e10cSrcweir 
124cdf0e10cSrcweir // -----------------
125cdf0e10cSrcweir // - ToolBox-Types -
126cdf0e10cSrcweir // -----------------
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #define TOOLBOX_STYLE_OUTBUTTON     ((sal_uInt16)0x0001)
129cdf0e10cSrcweir #define TOOLBOX_STYLE_HANDPOINTER   ((sal_uInt16)0x0002)
130cdf0e10cSrcweir #define TOOLBOX_STYLE_FLAT          ((sal_uInt16)0x0004)
131cdf0e10cSrcweir 
132cdf0e10cSrcweir #define TOOLBOX_APPEND              ((sal_uInt16)0xFFFF)
133cdf0e10cSrcweir #define TOOLBOX_ITEM_NOTFOUND       ((sal_uInt16)0xFFFF)
134cdf0e10cSrcweir 
135cdf0e10cSrcweir // item ids in the custom menu may not exceed this constant
136cdf0e10cSrcweir #define TOOLBOX_MENUITEM_START      ((sal_uInt16)0xE000)
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // defines for the menubutton
139cdf0e10cSrcweir #define TOOLBOX_MENUTYPE_NONE           ((sal_uInt16)0x0000)    // no menu at all, scrolling by spin buttons
140cdf0e10cSrcweir #define TOOLBOX_MENUTYPE_CLIPPEDITEMS   ((sal_uInt16)0x0001)    // menu will contain "more" indicator
141cdf0e10cSrcweir #define TOOLBOX_MENUTYPE_CUSTOMIZE      ((sal_uInt16)0x0002)    // menu will contain "customization" and "more" indicator
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // By changes you must also change: rsc/vclrsc.hxx
144cdf0e10cSrcweir enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT };
145cdf0e10cSrcweir 
146cdf0e10cSrcweir // By changes you must also change: rsc/vclrsc.hxx
147cdf0e10cSrcweir enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON,
148cdf0e10cSrcweir                        TOOLBOXITEM_SPACE, TOOLBOXITEM_SEPARATOR,
149cdf0e10cSrcweir                        TOOLBOXITEM_BREAK };
150cdf0e10cSrcweir 
151cdf0e10cSrcweir // small or large force an exact toolbox size for proper alignemnt
152cdf0e10cSrcweir // dontcare will let the toolbox decide about its size
153cdf0e10cSrcweir enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir // used for internal sizing calculations
156cdf0e10cSrcweir enum FloatingSizeMode { FSMODE_AUTO, FSMODE_FAVOURWIDTH, FSMODE_FAVOURHEIGHT };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir // -----------
159cdf0e10cSrcweir // - ToolBox -
160cdf0e10cSrcweir // -----------
161cdf0e10cSrcweir 
162cdf0e10cSrcweir class VCL_DLLPUBLIC ToolBox : public DockingWindow
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     friend class FloatingWindow;
165cdf0e10cSrcweir     friend class ImplTBDragMgr;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir private:
168cdf0e10cSrcweir     ImplToolBoxPrivateData*		mpData;
169cdf0e10cSrcweir     VirtualDevice*      		mpBtnDev; // TODO: remove unused member
170cdf0e10cSrcweir     ImplToolSizeArray*  mpFloatSizeAry;
171cdf0e10cSrcweir     XubString           maCvtStr;
172cdf0e10cSrcweir     XubString           maNextToolBoxStr;
173cdf0e10cSrcweir     ImageList           maImageList;
174cdf0e10cSrcweir     Timer               maTimer;
175cdf0e10cSrcweir     Rectangle           maUpperRect;
176cdf0e10cSrcweir     Rectangle           maLowerRect;
177cdf0e10cSrcweir     Rectangle           maNextToolRect;
178cdf0e10cSrcweir     Rectangle           maOutDockRect;
179cdf0e10cSrcweir     Rectangle           maInDockRect;
180cdf0e10cSrcweir     Rectangle           maPaintRect;
181cdf0e10cSrcweir     FloatingWindow*     mpFloatWin;
182cdf0e10cSrcweir     sal_uInt16              mnKeyModifier;
183cdf0e10cSrcweir     long                mnDX;
184cdf0e10cSrcweir     long                mnDY;
185cdf0e10cSrcweir     long                mnMaxItemWidth;    // max item width
186cdf0e10cSrcweir     long                mnMaxItemHeight;   // max item height (for standard items)
187cdf0e10cSrcweir     long                mnWinHeight;    // max window height (for window items)
188cdf0e10cSrcweir     long                mnBorderX;      // custom border
189cdf0e10cSrcweir     long                mnBorderY;
190cdf0e10cSrcweir     long                mnLeftBorder;   // inner border
191cdf0e10cSrcweir     long                mnTopBorder;
192cdf0e10cSrcweir     long                mnRightBorder;
193cdf0e10cSrcweir     long                mnBottomBorder;
194cdf0e10cSrcweir     long                mnLastResizeDY;
195cdf0e10cSrcweir     long                mnActivateCount;
196cdf0e10cSrcweir     sal_uInt16              mnLastFocusItemId;
197cdf0e10cSrcweir 	sal_uInt16				mnFocusPos;
198cdf0e10cSrcweir     sal_uInt16              mnOutStyle;
199cdf0e10cSrcweir     sal_uInt16              mnHighItemId;
200cdf0e10cSrcweir     sal_uInt16              mnCurItemId;
201cdf0e10cSrcweir     sal_uInt16              mnDownItemId;
202cdf0e10cSrcweir     sal_uInt16              mnCurPos;
203cdf0e10cSrcweir     sal_uInt16              mnLines;        // total number of toolbox lines
204cdf0e10cSrcweir     sal_uInt16              mnCurLine;      // the currently visible line
205cdf0e10cSrcweir     sal_uInt16              mnCurLines;     // number of lines due to line breaking
206cdf0e10cSrcweir     sal_uInt16              mnVisLines;     // number of visible lines (for scrolling)
207cdf0e10cSrcweir     sal_uInt16              mnFloatLines;   // number of lines during floating mode
208cdf0e10cSrcweir     sal_uInt16              mnDockLines;
209cdf0e10cSrcweir     sal_uInt16              mnConfigItem;
210cdf0e10cSrcweir     sal_uInt16              mnMouseClicks;
211cdf0e10cSrcweir     sal_uInt16              mnMouseModifier;
212cdf0e10cSrcweir     unsigned int        mbDrag:1,
213cdf0e10cSrcweir                         mbSelection:1,
214cdf0e10cSrcweir                         mbCommandDrag:1,
215cdf0e10cSrcweir                         mbUpper:1,
216cdf0e10cSrcweir                         mbLower:1,
217cdf0e10cSrcweir                         mbNextTool:1,
218cdf0e10cSrcweir                         mbIn:1,
219cdf0e10cSrcweir                         mbCalc:1,
220cdf0e10cSrcweir                         mbFormat:1,
221cdf0e10cSrcweir                         mbFullPaint:1,
222cdf0e10cSrcweir                         mbHorz:1,
223cdf0e10cSrcweir                         mbScroll:1,
224cdf0e10cSrcweir                         mbLastFloatMode:1,
225cdf0e10cSrcweir                         mbCustomize:1,
226cdf0e10cSrcweir                         mbCustomizeMode:1,
227cdf0e10cSrcweir                         mbDragging:1,
228cdf0e10cSrcweir                         mbHideStatusText:1,
229cdf0e10cSrcweir                         mbMenuStrings:1,
230cdf0e10cSrcweir                         mbIsShift:1,
231cdf0e10cSrcweir                         mbIsKeyEvent:1,
232cdf0e10cSrcweir                         mbChangingHighlight:1;
233cdf0e10cSrcweir     WindowAlign         meAlign;
234cdf0e10cSrcweir     WindowAlign         meDockAlign;
235cdf0e10cSrcweir     ButtonType          meButtonType;
236cdf0e10cSrcweir     PointerStyle        meLastStyle;
237cdf0e10cSrcweir     WinBits             mnWinStyle;
238cdf0e10cSrcweir     Link                maClickHdl;
239cdf0e10cSrcweir     Link                maDoubleClickHdl;
240cdf0e10cSrcweir     Link                maActivateHdl;
241cdf0e10cSrcweir     Link                maDeactivateHdl;
242cdf0e10cSrcweir     Link                maHighlightHdl;
243cdf0e10cSrcweir     Link                maSelectHdl;
244cdf0e10cSrcweir     Link                maNextToolBoxHdl;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     public:
247cdf0e10cSrcweir     using Window::ImplInit;
248cdf0e10cSrcweir     private:
249cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplInit( Window* pParent, WinBits nStyle );
250cdf0e10cSrcweir //    #if 0 // _SOLAR__PRIVATE
251cdf0e10cSrcweir     using DockingWindow::ImplInitSettings;
252cdf0e10cSrcweir //    #endif
253cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
254cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplLoadRes( const ResId& rResId );
255cdf0e10cSrcweir     SAL_DLLPRIVATE ImplToolItem*   ImplGetItem( sal_uInt16 nId ) const;
256cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplCalcItem();
257cdf0e10cSrcweir     SAL_DLLPRIVATE sal_uInt16          ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool bCalcHorz );
258cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplFormat( sal_Bool bResize = sal_False );
259cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn );
260cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplDrawNext( sal_Bool bIn );
261cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight = sal_False, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
262cdf0e10cSrcweir     using Window::ImplInvalidate;
263cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False );
264cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
265cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplStartCustomizeMode();
266cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplEndCustomizeMode();
267cdf0e10cSrcweir     SAL_DLLPRIVATE const XubString& ImplConvertMenuString( const XubString& rStr );
268cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False );
269cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False );
270cdf0e10cSrcweir 	SAL_DLLPRIVATE void			   ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus = sal_False );
271cdf0e10cSrcweir 	SAL_DLLPRIVATE sal_Bool			   ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False );
272cdf0e10cSrcweir     SAL_DLLPRIVATE sal_uInt16          ImplGetItemLine( ImplToolItem* pCurrentItem );
273cdf0e10cSrcweir     SAL_DLLPRIVATE ImplToolItem*   ImplGetFirstValidItem( sal_uInt16 nLine );
274cdf0e10cSrcweir     SAL_DLLPRIVATE ImplToolItem*   ImplGetLastValidItem( sal_uInt16 nLine );
275cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplOpenItem( KeyCode aKeyCode );
276cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplActivateItem( KeyCode aKeyCode );
277cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplShowFocus();
278cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplHideFocus();
279cdf0e10cSrcweir 	SAL_DLLPRIVATE void			   ImplUpdateInputEnable();
280cdf0e10cSrcweir     SAL_DLLPRIVATE void			   ImplFillLayoutData() const;
281cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplUpdateCustomMenu();
282cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplHasClippedItems();
283cdf0e10cSrcweir     SAL_DLLPRIVATE Point           ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const;
284cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplExecuteCustomMenu();
285cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplIsFloatingMode() const;
286cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplIsInPopupMode() const;
287cdf0e10cSrcweir     SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const;
288cdf0e10cSrcweir     SAL_DLLPRIVATE Size            ImplGetOptimalFloatingSize( FloatingSizeMode eMode );
289cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool            ImplHasExternalMenubutton();
290cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplDrawFloatwinBorder( ImplToolItem* pItem );
291cdf0e10cSrcweir 
292cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(          ImplCallExecuteCustomMenu, void* );
293cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(          ImplUpdateHdl, void* );
294cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(          ImplResetAutoSizeTriesHdl, void* );
295cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(          ImplCustomMenuListener, VclMenuEvent* );
296cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(          ImplDropdownLongClickHdl, ToolBox* );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
299cdf0e10cSrcweir     // Copy assignment is forbidden and not implemented.
300cdf0e10cSrcweir 	SAL_DLLPRIVATE                 ToolBox (const ToolBox &);
301cdf0e10cSrcweir 	SAL_DLLPRIVATE        ToolBox& operator= (const ToolBox &);
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplUpdateImageList(); // called if StateChanged
304cdf0e10cSrcweir public:
305cdf0e10cSrcweir     SAL_DLLPRIVATE void            ImplFloatControl( sal_Bool bStart, FloatingWindow* pWindow = NULL );
306cdf0e10cSrcweir 	SAL_DLLPRIVATE void            ImplDisableFlatButtons();
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     static SAL_DLLPRIVATE int ImplGetDragWidth( ToolBox* pThis );
309cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplUpdateDragArea( ToolBox *pThis );
310cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
311cdf0e10cSrcweir                                                long& rRight, long& rBottom, const ToolBox *pThis );
312cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawGrip( ToolBox* pThis );
313cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapper *pWrapper );
314cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_Bool ImplDrawNativeBackground( ToolBox* pThis, const Region &rRegion );
315cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegion );
316cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, sal_Bool bIsInPopupMode );
317cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect );
318cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplErase( ToolBox* pThis, const Rectangle &rRect, sal_Bool bHighlight = sal_False, sal_Bool bHasOpenPopup = sal_False );
319cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawBorder( ToolBox* pWin );
320cdf0e10cSrcweir     static SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem( const ToolBox* pThis );
321cdf0e10cSrcweir     static SAL_DLLPRIVATE Size ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode = 0 );
322cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplCalcFloatSizes( ToolBox* pThis );
323cdf0e10cSrcweir     static SAL_DLLPRIVATE Size ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines );
324cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize );
325cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplSetMinMaxFloatSize( ToolBox *pThis );
326cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_uInt16 ImplCalcLines( ToolBox* pThis, long nToolSize );
327cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( ToolBox* pThis, const Point& rPos );
328cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode );
329cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( ToolBox* pBox, const Point& rPos );
330cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList );
331cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, sal_Bool bBlack, sal_Bool bColTransform,
332cdf0e10cSrcweir                                                   sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False,
333cdf0e10cSrcweir                                                   long nSize = 6 );
334cdf0e10cSrcweir     static SAL_DLLPRIVATE void SetToolArrowClipregion( ToolBox* pBox, long nX, long nY,
335cdf0e10cSrcweir                                                        sal_Bool bLeft = sal_False, sal_Bool bTop = sal_False,
336cdf0e10cSrcweir                                                        long nSize = 6 );
337cdf0e10cSrcweir     static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight );
338cdf0e10cSrcweir     static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis );
ImplGetToolBoxPrivateData() const339cdf0e10cSrcweir     SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; }
340cdf0e10cSrcweir //#endif
341cdf0e10cSrcweir 
342cdf0e10cSrcweir protected:
SetCurItemId(sal_uInt16 nSet)343cdf0e10cSrcweir     void                SetCurItemId(sal_uInt16 nSet) { mnCurItemId = nSet; }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir public:
346cdf0e10cSrcweir                         ToolBox( Window* pParent, WinBits nStyle = 0 );
347cdf0e10cSrcweir                         ToolBox( Window* pParent, const ResId& rResId );
348cdf0e10cSrcweir                         ~ToolBox();
349cdf0e10cSrcweir 
350cdf0e10cSrcweir     virtual void        Click();
351cdf0e10cSrcweir     virtual void        DoubleClick();
352cdf0e10cSrcweir     virtual void        Activate();
353cdf0e10cSrcweir     virtual void        Deactivate();
354cdf0e10cSrcweir     virtual void        Highlight();
355cdf0e10cSrcweir     virtual void        Select();
356cdf0e10cSrcweir     virtual void        NextToolBox();
357cdf0e10cSrcweir     virtual void        Customize( const ToolBoxCustomizeEvent& rCEvt );
358cdf0e10cSrcweir     virtual void        UserDraw( const UserDrawEvent& rUDEvt );
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
361cdf0e10cSrcweir     virtual void        MouseButtonUp( const MouseEvent& rMEvt );
362cdf0e10cSrcweir     virtual void        MouseMove( const MouseEvent& rMEvt );
363cdf0e10cSrcweir     virtual void        Tracking( const TrackingEvent& rTEvt );
364cdf0e10cSrcweir     virtual void        Paint( const Rectangle& rRect );
365cdf0e10cSrcweir     virtual void        Move();
366cdf0e10cSrcweir     virtual void        Resize();
367cdf0e10cSrcweir     virtual void        RequestHelp( const HelpEvent& rHEvt );
368cdf0e10cSrcweir     virtual long        Notify( NotifyEvent& rNEvt );
369cdf0e10cSrcweir     virtual void        Command( const CommandEvent& rCEvt );
370cdf0e10cSrcweir     virtual void        StateChanged( StateChangedType nType );
371cdf0e10cSrcweir     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 	virtual void        GetFocus();
374cdf0e10cSrcweir 	virtual void        LoseFocus();
375cdf0e10cSrcweir 	virtual void        KeyInput( const KeyEvent& rKEvt );
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     virtual sal_Bool        PrepareToggleFloatingMode();
378cdf0e10cSrcweir     virtual void        ToggleFloatingMode();
379cdf0e10cSrcweir     virtual void        StartDocking();
380cdf0e10cSrcweir     virtual sal_Bool        Docking( const Point& rPos, Rectangle& rRect );
381cdf0e10cSrcweir     virtual void        EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
382cdf0e10cSrcweir     virtual void        Resizing( Size& rSize );
383cdf0e10cSrcweir 
384cdf0e10cSrcweir     void                InsertItem( const ResId& rResId,
385cdf0e10cSrcweir                                     sal_uInt16 nPos = TOOLBOX_APPEND );
386cdf0e10cSrcweir     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
387cdf0e10cSrcweir                                     ToolBoxItemBits nBits = 0,
388cdf0e10cSrcweir                                     sal_uInt16 nPos = TOOLBOX_APPEND );
389cdf0e10cSrcweir     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
390cdf0e10cSrcweir                                     const XubString& rText,
391cdf0e10cSrcweir                                     ToolBoxItemBits nBits = 0,
392cdf0e10cSrcweir                                     sal_uInt16 nPos = TOOLBOX_APPEND );
393cdf0e10cSrcweir     void                InsertItem( sal_uInt16 nItemId, const XubString& rText,
394cdf0e10cSrcweir                                     ToolBoxItemBits nBits = 0,
395cdf0e10cSrcweir                                     sal_uInt16 nPos = TOOLBOX_APPEND );
396cdf0e10cSrcweir     void                InsertWindow( sal_uInt16 nItemId, Window* pWindow,
397cdf0e10cSrcweir                                       ToolBoxItemBits nBits = 0,
398cdf0e10cSrcweir                                       sal_uInt16 nPos = TOOLBOX_APPEND );
399cdf0e10cSrcweir     void                InsertSpace( sal_uInt16 nPos = TOOLBOX_APPEND );
400cdf0e10cSrcweir     void                InsertSeparator( sal_uInt16 nPos = TOOLBOX_APPEND,
401cdf0e10cSrcweir                                          sal_uInt16 nPixSize = 0 );
402cdf0e10cSrcweir     void                InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND );
403cdf0e10cSrcweir     void                RemoveItem( sal_uInt16 nPos );
404cdf0e10cSrcweir     void                MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND );
405cdf0e10cSrcweir     void                CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId,
406cdf0e10cSrcweir                                   sal_uInt16 nNewPos = TOOLBOX_APPEND );
407cdf0e10cSrcweir     void                CopyItems( const ToolBox& rToolBox );
408cdf0e10cSrcweir     void                Clear();
409cdf0e10cSrcweir     void                RecalcItems();
410cdf0e10cSrcweir 
GetImageList() const411cdf0e10cSrcweir     const ImageList&    GetImageList() const { return maImageList; }
412cdf0e10cSrcweir     void				SetImageList( const ImageList& rImageList );
413cdf0e10cSrcweir 
414cdf0e10cSrcweir     void                SetButtonType( ButtonType eNewType = BUTTON_SYMBOL );
GetButtonType() const415cdf0e10cSrcweir     ButtonType          GetButtonType() const { return meButtonType; }
416cdf0e10cSrcweir 
417cdf0e10cSrcweir     // sets a fixed button size (small, large or dontcare (==autosize))
418cdf0e10cSrcweir     void                SetToolboxButtonSize( ToolBoxButtonSize eSize );
419cdf0e10cSrcweir     ToolBoxButtonSize   GetToolboxButtonSize() const;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir     void                SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP );
GetAlign() const422cdf0e10cSrcweir     WindowAlign         GetAlign() const { return meAlign; }
IsHorizontal() const423cdf0e10cSrcweir     sal_Bool                IsHorizontal() const { return mbHorz; }
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     void                SetLineCount( sal_uInt16 nNewLines );
GetLineCount() const426cdf0e10cSrcweir     sal_uInt16              GetLineCount() const { return mnLines; }
GetCurLine() const427cdf0e10cSrcweir     sal_uInt16              GetCurLine() const { return mnCurLine; }
428cdf0e10cSrcweir     void                ShowLine( sal_Bool bNext );
429cdf0e10cSrcweir 
430cdf0e10cSrcweir     // Used to enable/disable scrolling one page at a time for toolbar
431cdf0e10cSrcweir     void                SetPageScroll( sal_Bool b );
432cdf0e10cSrcweir     sal_Bool                GetPageScroll();
433cdf0e10cSrcweir 
434cdf0e10cSrcweir     void                SetNextToolBox( const XubString& rStr );
GetNextToolBox() const435cdf0e10cSrcweir     const XubString&    GetNextToolBox() const { return maNextToolBoxStr; }
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     sal_uInt16              GetItemCount() const;
438cdf0e10cSrcweir     ToolBoxItemType     GetItemType( sal_uInt16 nPos ) const;
439cdf0e10cSrcweir     sal_uInt16              GetItemPos( sal_uInt16 nItemId ) const;
440cdf0e10cSrcweir     sal_uInt16              GetItemPos( const Point& rPos ) const;
441cdf0e10cSrcweir     sal_uInt16              GetItemId( sal_uInt16 nPos ) const;
442cdf0e10cSrcweir     sal_uInt16              GetItemId( const Point& rPos ) const;
443cdf0e10cSrcweir     Rectangle           GetItemRect( sal_uInt16 nItemId ) const;
444cdf0e10cSrcweir     Rectangle           GetItemPosRect( sal_uInt16 nPos ) const;
445cdf0e10cSrcweir     Rectangle           GetItemDropDownRect( sal_uInt16 nItemId ) const;
446cdf0e10cSrcweir     Rectangle           GetItemPosDropDownRect( sal_uInt16 nPos ) const;
447cdf0e10cSrcweir 
448cdf0e10cSrcweir     // retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
449cdf0e10cSrcweir     Point               GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const;
450cdf0e10cSrcweir 
451cdf0e10cSrcweir     Rectangle           GetScrollRect() const;
452cdf0e10cSrcweir     Rectangle           GetMenubuttonRect() const;
GetCurItemId() const453cdf0e10cSrcweir     sal_uInt16              GetCurItemId() const { return mnCurItemId; }
GetDownItemId() const454cdf0e10cSrcweir     sal_uInt16              GetDownItemId() const { return mnDownItemId; }
GetClicks() const455cdf0e10cSrcweir     sal_uInt16              GetClicks() const { return mnMouseClicks; }
GetModifier() const456cdf0e10cSrcweir     sal_uInt16              GetModifier() const { return mnMouseModifier; }
GetKeyModifier() const457cdf0e10cSrcweir 	sal_uInt16				GetKeyModifier() const { return mnKeyModifier; }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir     void                SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits );
460cdf0e10cSrcweir     ToolBoxItemBits     GetItemBits( sal_uInt16 nItemId ) const;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir     void                SetItemData( sal_uInt16 nItemId, void* pNewData );
463cdf0e10cSrcweir     void*               GetItemData( sal_uInt16 nItemId ) const;
464cdf0e10cSrcweir     void                SetItemImage( sal_uInt16 nItemId, const Image& rImage );
465cdf0e10cSrcweir     Image               GetItemImage( sal_uInt16 nItemId ) const;
466cdf0e10cSrcweir     void				SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
467cdf0e10cSrcweir     long				GetItemImageAngle( sal_uInt16 nItemId ) const;
468cdf0e10cSrcweir     void				SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
469cdf0e10cSrcweir     sal_Bool				GetItemImageMirrorMode( sal_uInt16 ) const;
470cdf0e10cSrcweir     void                SetItemHighImage( sal_uInt16 nItemId, const Image& rImage );
471cdf0e10cSrcweir     Image               GetItemHighImage( sal_uInt16 nItemId ) const;
472cdf0e10cSrcweir     void                SetItemText( sal_uInt16 nItemId, const XubString& rText );
473cdf0e10cSrcweir     const XubString&    GetItemText( sal_uInt16 nItemId ) const;
474cdf0e10cSrcweir     void                SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow );
475cdf0e10cSrcweir     Window*             GetItemWindow( sal_uInt16 nItemId ) const;
GetHighlightItemId() const476cdf0e10cSrcweir     sal_uInt16              GetHighlightItemId() const { return mnHighItemId; }
477cdf0e10cSrcweir 
478cdf0e10cSrcweir     void                StartSelection();
479cdf0e10cSrcweir     void                EndSelection();
480cdf0e10cSrcweir 
481cdf0e10cSrcweir     void                SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True );
482cdf0e10cSrcweir     sal_Bool                IsItemDown( sal_uInt16 nItemId ) const;
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     void                SetItemState( sal_uInt16 nItemId, TriState eState );
485cdf0e10cSrcweir     TriState            GetItemState( sal_uInt16 nItemId ) const;
486cdf0e10cSrcweir 
487cdf0e10cSrcweir     void                CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True );
488cdf0e10cSrcweir     sal_Bool                IsItemChecked( sal_uInt16 nItemId ) const;
489cdf0e10cSrcweir 
490cdf0e10cSrcweir     void                EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True );
491cdf0e10cSrcweir     sal_Bool                IsItemEnabled( sal_uInt16 nItemId ) const;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     void                TriggerItem( sal_uInt16 nItemId, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
494cdf0e10cSrcweir     void                ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True );
HideItem(sal_uInt16 nItemId)495cdf0e10cSrcweir     void                HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, sal_False ); }
496cdf0e10cSrcweir     sal_Bool                IsItemVisible( sal_uInt16 nItemId ) const;
497cdf0e10cSrcweir     sal_Bool                IsItemReallyVisible( sal_uInt16 nItemId ) const;
498cdf0e10cSrcweir 
499cdf0e10cSrcweir     void                SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
500cdf0e10cSrcweir     const XubString&    GetItemCommand( sal_uInt16 nItemId ) const;
501cdf0e10cSrcweir 
502cdf0e10cSrcweir     using Window::SetQuickHelpText;
503cdf0e10cSrcweir     void                SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText );
504cdf0e10cSrcweir     using Window::GetQuickHelpText;
505cdf0e10cSrcweir     const XubString&    GetQuickHelpText( sal_uInt16 nItemId ) const;
506cdf0e10cSrcweir 
507cdf0e10cSrcweir     void                SetHelpText( sal_uInt16 nItemId, const XubString& rText );
508cdf0e10cSrcweir     const XubString&    GetHelpText( sal_uInt16 nItemId ) const;
509cdf0e10cSrcweir 
510cdf0e10cSrcweir     void                SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId );
511cdf0e10cSrcweir     rtl::OString        GetHelpId( sal_uInt16 nItemId ) const;
512cdf0e10cSrcweir 
513cdf0e10cSrcweir     //  window size according to current alignment, floating state and number of lines
514cdf0e10cSrcweir     Size                CalcWindowSizePixel() const;
515cdf0e10cSrcweir     //  window size according to current alignment, floating state and a given number of lines
516cdf0e10cSrcweir     Size                CalcWindowSizePixel( sal_uInt16 nCalcLines ) const;
517cdf0e10cSrcweir     //  window size according to current floating state and a given number of lines and a given alignment
518cdf0e10cSrcweir     Size                CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const;
519cdf0e10cSrcweir     // floating window size according to number of lines (uses the number of line breaks)
520cdf0e10cSrcweir     Size                CalcFloatingWindowSizePixel() const;
521cdf0e10cSrcweir     // floating window size with a given number of lines
522cdf0e10cSrcweir     Size                CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const;
523cdf0e10cSrcweir     // automatic window size for popoup mode
524cdf0e10cSrcweir     Size                CalcPopupWindowSizePixel() const;
525cdf0e10cSrcweir 
526cdf0e10cSrcweir     // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
527cdf0e10cSrcweir     Size                CalcMinimumWindowSizePixel() const;
528cdf0e10cSrcweir 
529cdf0e10cSrcweir     void                SetDockingRects( const Rectangle& rOutRect,
530cdf0e10cSrcweir                                          const Rectangle& rInRect );
531cdf0e10cSrcweir     void                SetFloatingLines( sal_uInt16 nFloatLines );
532cdf0e10cSrcweir     sal_uInt16              GetFloatingLines() const;
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     void                SetBorder( long nX, long nY );
GetBorderX() const535cdf0e10cSrcweir     long                GetBorderX() const { return mnBorderX; }
GetBorderY() const536cdf0e10cSrcweir     long                GetBorderY() const { return mnBorderY; }
537cdf0e10cSrcweir 
SetStyle(WinBits nNewStyle)538cdf0e10cSrcweir     void                SetStyle( WinBits nNewStyle ) { mnWinStyle = nNewStyle; }
GetStyle() const539cdf0e10cSrcweir     WinBits             GetStyle() const { return mnWinStyle; }
540cdf0e10cSrcweir 
541cdf0e10cSrcweir     // enable/disable undocking
542cdf0e10cSrcweir     void                Lock( sal_Bool bLock = sal_True );
543cdf0e10cSrcweir 
544cdf0e10cSrcweir     // read configuration to determine locking behaviour
545cdf0e10cSrcweir     static sal_Bool         AlwaysLocked();
546cdf0e10cSrcweir 
EnableMenuStrings(sal_Bool bEnable=sal_True)547cdf0e10cSrcweir     void                EnableMenuStrings( sal_Bool bEnable = sal_True ) { mbMenuStrings = (bEnable != 0); }
IsMenuStringsEnabled() const548cdf0e10cSrcweir     sal_Bool                IsMenuStringsEnabled() const { return mbMenuStrings; }
549cdf0e10cSrcweir 
550cdf0e10cSrcweir     void                SetOutStyle( sal_uInt16 nNewStyle );
GetOutStyle() const551cdf0e10cSrcweir     sal_uInt16              GetOutStyle() const { return mnOutStyle; }
552cdf0e10cSrcweir 
553cdf0e10cSrcweir     void                EnableCustomize( sal_Bool bEnable = sal_True );
IsCustomize()554cdf0e10cSrcweir     sal_Bool                IsCustomize() { return mbCustomize; }
555cdf0e10cSrcweir     void                StartCustomize( const Rectangle& rRect, void* pData = NULL );
556cdf0e10cSrcweir     void                SetCustomizeMode( sal_Bool );
IsInCustomizeMode() const557cdf0e10cSrcweir     sal_Bool                IsInCustomizeMode() const { return mbCustomizeMode; }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     static void         StartCustomizeMode();
560cdf0e10cSrcweir     static void         EndCustomizeMode();
561cdf0e10cSrcweir     static sal_Bool         IsCustomizeMode();
562cdf0e10cSrcweir 
SetHelpText(const XubString & rText)563cdf0e10cSrcweir     void                SetHelpText( const XubString& rText )
564cdf0e10cSrcweir                             { DockingWindow::SetHelpText( rText ); }
GetHelpText() const565cdf0e10cSrcweir     const XubString&    GetHelpText() const
566cdf0e10cSrcweir                             { return DockingWindow::GetHelpText(); }
567cdf0e10cSrcweir 
SetHelpId(const rtl::OString & rId)568cdf0e10cSrcweir     void                SetHelpId( const rtl::OString& rId )
569cdf0e10cSrcweir                             { DockingWindow::SetHelpId( rId ); }
GetHelpId() const570cdf0e10cSrcweir     const rtl::OString& GetHelpId() const
571cdf0e10cSrcweir                             { return DockingWindow::GetHelpId(); }
572cdf0e10cSrcweir 
SetClickHdl(const Link & rLink)573cdf0e10cSrcweir     void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
GetClickHdl() const574cdf0e10cSrcweir     const Link&         GetClickHdl() const { return maClickHdl; }
SetDoubleClickHdl(const Link & rLink)575cdf0e10cSrcweir     void                SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
GetDoubleClickHdl() const576cdf0e10cSrcweir     const Link&         GetDoubleClickHdl() const { return maDoubleClickHdl; }
577cdf0e10cSrcweir     void                SetDropdownClickHdl( const Link& rLink );
578cdf0e10cSrcweir     const Link&         GetDropdownClickHdl() const;
SetActivateHdl(const Link & rLink)579cdf0e10cSrcweir     void                SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; }
GetActivateHdl() const580cdf0e10cSrcweir     const Link&         GetActivateHdl() const { return maActivateHdl; }
SetDeactivateHdl(const Link & rLink)581cdf0e10cSrcweir     void                SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
GetDeactivateHdl() const582cdf0e10cSrcweir     const Link&         GetDeactivateHdl() const { return maDeactivateHdl; }
SetHighlightHdl(const Link & rLink)583cdf0e10cSrcweir     void                SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
GetHighlightHdl() const584cdf0e10cSrcweir     const Link&         GetHighlightHdl() const { return maHighlightHdl; }
SetSelectHdl(const Link & rLink)585cdf0e10cSrcweir     void                SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
GetSelectHdl() const586cdf0e10cSrcweir     const Link&         GetSelectHdl() const { return maSelectHdl; }
SetNextToolBoxHdl(const Link & rLink)587cdf0e10cSrcweir     void                SetNextToolBoxHdl( const Link& rLink ) { maNextToolBoxHdl = rLink; }
GetNextToolBoxHdl() const588cdf0e10cSrcweir     const Link&         GetNextToolBoxHdl() const { return maNextToolBoxHdl; }
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     // support for custom menu (eg for configuration)
591cdf0e10cSrcweir     // note: this menu will also be used to display currently
592cdf0e10cSrcweir     //       clipped toolbox items, so you should only touch
593cdf0e10cSrcweir     //       items that you added by yourself
594cdf0e10cSrcweir     //       the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
595cdf0e10cSrcweir     // to allow for customization of the menu the coresponding handler is called
596cdf0e10cSrcweir     // when the menu button was clicked and before the menu is executed
597cdf0e10cSrcweir     void                SetMenuType( sal_uInt16 aType = TOOLBOX_MENUTYPE_CUSTOMIZE );
598cdf0e10cSrcweir     sal_uInt16              GetMenuType() const;
599cdf0e10cSrcweir     sal_Bool                IsMenuEnabled() const;
600cdf0e10cSrcweir     PopupMenu*          GetMenu() const;
601cdf0e10cSrcweir     void                SetMenuButtonHdl( const Link& rLink );
602cdf0e10cSrcweir     const Link&         GetMenuButtonHdl() const;
603cdf0e10cSrcweir 
604cdf0e10cSrcweir     // open custommenu
605cdf0e10cSrcweir     void                ExecuteCustomMenu();
606cdf0e10cSrcweir 
607cdf0e10cSrcweir     // allow Click Handler to detect special key
IsShift() const608cdf0e10cSrcweir     sal_Bool                IsShift() const { return mbIsShift; }
609cdf0e10cSrcweir     // allow Click Handler to distinguish between mouse and key input
IsKeyEvent() const610cdf0e10cSrcweir     sal_Bool                IsKeyEvent() const { return mbIsKeyEvent; }
611cdf0e10cSrcweir 
612cdf0e10cSrcweir     // allows framework to set/query the planned popupmode
613cdf0e10cSrcweir     sal_Bool                WillUsePopupMode() const;
614cdf0e10cSrcweir     void                WillUsePopupMode( sal_Bool b);
615cdf0e10cSrcweir 
616cdf0e10cSrcweir     // accessibility helpers
617cdf0e10cSrcweir 
618cdf0e10cSrcweir     // gets the displayed text
619cdf0e10cSrcweir     String GetDisplayText() const;
620cdf0e10cSrcweir     // returns the bounding box for the character at index nIndex
621cdf0e10cSrcweir 	// where nIndex is relative to the starting index of the item
622cdf0e10cSrcweir     // with id nItemId (in coordinates of the displaying window)
623cdf0e10cSrcweir     Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const;
624cdf0e10cSrcweir     // -1 is returned if no character is at that point
625cdf0e10cSrcweir     // if an index is found the corresponding item id is filled in (else 0)
626cdf0e10cSrcweir     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
627cdf0e10cSrcweir     // returns the number of portions in the result of GetDisplayText()
628cdf0e10cSrcweir     long GetTextCount() const;
629cdf0e10cSrcweir     // returns the interval [start,end] of text portion nText
630cdf0e10cSrcweir     // returns [-1,-1] for an invalid text number
631cdf0e10cSrcweir     Pair GetTextStartEnd( long nText ) const;
632cdf0e10cSrcweir     // returns the item id for text portion nText or 0 if nText is invalid
633cdf0e10cSrcweir     sal_uInt16 GetDisplayItemId( long nText ) const;
634cdf0e10cSrcweir 
635cdf0e10cSrcweir     const Size&         GetDefaultImageSize() const;
636cdf0e10cSrcweir     void                ChangeHighlight( sal_uInt16 nPos );
637cdf0e10cSrcweir 
638cdf0e10cSrcweir     void SetImageListProvider(vcl::IImageListProvider* _pProvider);
639cdf0e10cSrcweir };
640cdf0e10cSrcweir 
CheckItem(sal_uInt16 nItemId,sal_Bool bCheck)641cdf0e10cSrcweir inline void ToolBox::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck )
642cdf0e10cSrcweir {
643cdf0e10cSrcweir     SetItemState( nItemId, (bCheck) ? STATE_CHECK : STATE_NOCHECK );
644cdf0e10cSrcweir }
645cdf0e10cSrcweir 
IsItemChecked(sal_uInt16 nItemId) const646cdf0e10cSrcweir inline sal_Bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const
647cdf0e10cSrcweir {
648cdf0e10cSrcweir     return (GetItemState( nItemId ) == STATE_CHECK);
649cdf0e10cSrcweir }
650cdf0e10cSrcweir 
CalcWindowSizePixel() const651cdf0e10cSrcweir inline Size ToolBox::CalcWindowSizePixel() const
652cdf0e10cSrcweir {
653cdf0e10cSrcweir     return CalcWindowSizePixel( mnLines );
654cdf0e10cSrcweir }
655cdf0e10cSrcweir 
GetScrollRect() const656cdf0e10cSrcweir inline Rectangle ToolBox::GetScrollRect() const
657cdf0e10cSrcweir {
658cdf0e10cSrcweir     return maUpperRect.GetUnion( maLowerRect );
659cdf0e10cSrcweir }
660cdf0e10cSrcweir 
SetDockingRects(const Rectangle & rOutRect,const Rectangle & rInRect)661cdf0e10cSrcweir inline void ToolBox::SetDockingRects( const Rectangle& rOutRect,
662cdf0e10cSrcweir                                       const Rectangle& rInRect )
663cdf0e10cSrcweir {
664cdf0e10cSrcweir     maOutDockRect = rOutRect;
665cdf0e10cSrcweir     maInDockRect = rInRect;
666cdf0e10cSrcweir }
667cdf0e10cSrcweir 
SetFloatingLines(sal_uInt16 nNewLines)668cdf0e10cSrcweir inline void ToolBox::SetFloatingLines( sal_uInt16 nNewLines )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir     mnFloatLines = nNewLines;
671cdf0e10cSrcweir }
672cdf0e10cSrcweir 
GetFloatingLines() const673cdf0e10cSrcweir inline sal_uInt16 ToolBox::GetFloatingLines() const
674cdf0e10cSrcweir {
675cdf0e10cSrcweir     return mnFloatLines;
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir #endif  // _SV_TOOLBOX_HXX
679