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 :
20 : #ifndef _SV_WINDOW_HXX
21 : #define _SV_WINDOW_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/outdev.hxx>
26 : #include <tools/resid.hxx>
27 : #include <vcl/pointr.hxx>
28 : #include <tools/wintypes.hxx>
29 : #include <vcl/apptypes.hxx>
30 : #include <vcl/inputctx.hxx>
31 : #include <vcl/vclevent.hxx>
32 : // Only for compatibility - because many people outside haven't included event.hxx
33 : #include <vcl/event.hxx>
34 : #include <vcl/region.hxx>
35 : #include <vcl/salnativewidgets.hxx>
36 : #include <rtl/ustring.hxx>
37 : #include <cppuhelper/weakref.hxx>
38 : #include <com/sun/star/uno/Reference.hxx>
39 : #include <boost/shared_ptr.hpp>
40 :
41 : class VirtualDevice;
42 : struct ImplDelData;
43 : struct ImplWinData;
44 : struct ImplOverlapData;
45 : struct ImplFrameData;
46 : struct ImplCalcToTopData;
47 : struct SystemEnvData;
48 : struct SystemParentData;
49 : class ImplBorderWindow;
50 : class VirtualDevice;
51 : class Timer;
52 : class Cursor;
53 : class DockingManager;
54 : class ScrollBar;
55 : class Bitmap;
56 : class Image;
57 : class MouseEvent;
58 : class KeyEvent;
59 : class CommandEvent;
60 : class TrackingEvent;
61 : class HelpEvent;
62 : class DataChangedEvent;
63 : class NotifyEvent;
64 : class SystemWindow;
65 : class SalFrame;
66 : class SalObject;
67 : class MenuFloatingWindow;
68 : class UNOWindowData;
69 : // Nur fuer ExecuteDrag:
70 : struct IDataObject;
71 : class VCLXWindow;
72 : struct ImplAccessibleInfos;
73 :
74 : namespace com {
75 : namespace sun {
76 : namespace star {
77 : namespace accessibility {
78 : class XAccessible;
79 : }}}}
80 :
81 : namespace com {
82 : namespace sun {
83 : namespace star {
84 : namespace beans {
85 : struct PropertyValue;
86 : }}}}
87 :
88 : namespace com {
89 : namespace sun {
90 : namespace star {
91 : namespace rendering {
92 : class XCanvas;
93 : class XSpriteCanvas;
94 : }}}}
95 :
96 : namespace com {
97 : namespace sun {
98 : namespace star {
99 : namespace awt {
100 : class XWindowPeer;
101 : class XWindow;
102 : }
103 : namespace uno {
104 : class Any;
105 : class XInterface;
106 : }
107 : namespace datatransfer {
108 : namespace clipboard {
109 : class XClipboard;
110 : }
111 :
112 : namespace dnd {
113 : class XDragGestureRecognizer;
114 : class XDragSource;
115 : class XDropTarget;
116 : } } } } }
117 :
118 : namespace vcl {
119 : struct ControlLayoutData;
120 : }
121 :
122 : namespace svt { class PopupWindowControllerImpl; }
123 :
124 : // ---------------
125 : // - WindowTypes -
126 : // ---------------
127 :
128 : // Type fuer GetWindow()
129 : #define WINDOW_PARENT ((sal_uInt16)0)
130 : #define WINDOW_FIRSTCHILD ((sal_uInt16)1)
131 : #define WINDOW_LASTCHILD ((sal_uInt16)2)
132 : #define WINDOW_PREV ((sal_uInt16)3)
133 : #define WINDOW_NEXT ((sal_uInt16)4)
134 : #define WINDOW_FIRSTOVERLAP ((sal_uInt16)5)
135 : #define WINDOW_LASTOVERLAP ((sal_uInt16)6)
136 : #define WINDOW_OVERLAP ((sal_uInt16)7)
137 : #define WINDOW_PARENTOVERLAP ((sal_uInt16)8)
138 : #define WINDOW_CLIENT ((sal_uInt16)9)
139 : #define WINDOW_REALPARENT ((sal_uInt16)10)
140 : #define WINDOW_FRAME ((sal_uInt16)11)
141 : #define WINDOW_BORDER ((sal_uInt16)12)
142 : #define WINDOW_FIRSTTOPWINDOWCHILD ((sal_uInt16)13)
143 : #define WINDOW_LASTTOPWINDOWCHILD ((sal_uInt16)14)
144 : #define WINDOW_PREVTOPWINDOWSIBLING ((sal_uInt16)15)
145 : #define WINDOW_NEXTTOPWINDOWSIBLING ((sal_uInt16)16)
146 :
147 : // Flags for setPosSizePixel()
148 : #define WINDOW_POSSIZE_X ((sal_uInt16)0x0001)
149 : #define WINDOW_POSSIZE_Y ((sal_uInt16)0x0002)
150 : #define WINDOW_POSSIZE_WIDTH ((sal_uInt16)0x0004)
151 : #define WINDOW_POSSIZE_HEIGHT ((sal_uInt16)0x0008)
152 : #define WINDOW_POSSIZE_POS (WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y)
153 : #define WINDOW_POSSIZE_SIZE (WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT)
154 : #define WINDOW_POSSIZE_POSSIZE (WINDOW_POSSIZE_POS | WINDOW_POSSIZE_SIZE)
155 : #define WINDOW_POSSIZE_ALL (WINDOW_POSSIZE_POSSIZE)
156 : #define WINDOW_POSSIZE_DROPDOWN ((sal_uInt16)0x0010)
157 :
158 : // Flags for Show()
159 : #define SHOW_NOPARENTUPDATE ((sal_uInt16)0x0001)
160 : #define SHOW_NOFOCUSCHANGE ((sal_uInt16)0x0002)
161 : #define SHOW_NOACTIVATE ((sal_uInt16)0x0004)
162 : #define SHOW_FOREGROUNDTASK ((sal_uInt16)0x0008)
163 :
164 : // Flags for SetZOrder()
165 : #define WINDOW_ZORDER_BEFOR ((sal_uInt16)0x0001)
166 : #define WINDOW_ZORDER_BEHIND ((sal_uInt16)0x0002)
167 : #define WINDOW_ZORDER_FIRST ((sal_uInt16)0x0004)
168 : #define WINDOW_ZORDER_LAST ((sal_uInt16)0x0008)
169 :
170 : // Activate-Flags
171 : #define ACTIVATE_MODE_GRABFOCUS ((sal_uInt16)0x0001)
172 :
173 : // ToTop-Flags
174 : #define TOTOP_RESTOREWHENMIN ((sal_uInt16)0x0001)
175 : #define TOTOP_FOREGROUNDTASK ((sal_uInt16)0x0002)
176 : #define TOTOP_NOGRABFOCUS ((sal_uInt16)0x0004)
177 : #define TOTOP_GRABFOCUSONLY ((sal_uInt16)0x0008)
178 :
179 : // Flags for Invalidate
180 : #define INVALIDATE_CHILDREN ((sal_uInt16)0x0001)
181 : #define INVALIDATE_NOCHILDREN ((sal_uInt16)0x0002)
182 : #define INVALIDATE_NOERASE ((sal_uInt16)0x0004)
183 : #define INVALIDATE_UPDATE ((sal_uInt16)0x0008)
184 : #define INVALIDATE_TRANSPARENT ((sal_uInt16)0x0010)
185 : #define INVALIDATE_NOTRANSPARENT ((sal_uInt16)0x0020)
186 : #define INVALIDATE_NOCLIPCHILDREN ((sal_uInt16)0x4000)
187 : // Temporaer fuer Kompatibilitaet
188 : #define INVALIDATE_BACKGROUND INVALIDATE_TRANSPARENT
189 :
190 : // Flags for Validate
191 : #define VALIDATE_CHILDREN ((sal_uInt16)0x0001)
192 : #define VALIDATE_NOCHILDREN ((sal_uInt16)0x0002)
193 :
194 : // Flags for Scroll
195 : #define SCROLL_CLIP ((sal_uInt16)0x0001)
196 : #define SCROLL_CHILDREN ((sal_uInt16)0x0002)
197 : #define SCROLL_NOCHILDREN ((sal_uInt16)0x0004)
198 : #define SCROLL_NOERASE ((sal_uInt16)0x0008)
199 : #define SCROLL_NOINVALIDATE ((sal_uInt16)0x0010)
200 : #define SCROLL_NOWINDOWINVALIDATE ((sal_uInt16)0x0020)
201 : #define SCROLL_USECLIPREGION ((sal_uInt16)0x0040)
202 : #define SCROLL_UPDATE ((sal_uInt16)0x0080)
203 :
204 : // Flags for ParentClipMode
205 : #define PARENTCLIPMODE_CLIP ((sal_uInt16)0x0001)
206 : #define PARENTCLIPMODE_NOCLIP ((sal_uInt16)0x0002)
207 :
208 : // Flags for Invert()
209 : #define INVERT_HIGHLIGHT ((sal_uInt16)0x0001)
210 : #define INVERT_50 ((sal_uInt16)0x0002)
211 :
212 : // Flags for ShowTracking()
213 : #define SHOWTRACK_SMALL ((sal_uInt16)0x0001)
214 : #define SHOWTRACK_BIG ((sal_uInt16)0x0002)
215 : #define SHOWTRACK_SPLIT ((sal_uInt16)0x0003)
216 : #define SHOWTRACK_OBJECT ((sal_uInt16)0x0004)
217 : #define SHOWTRACK_WINDOW ((sal_uInt16)0x1000)
218 : #define SHOWTRACK_CLIP ((sal_uInt16)0x2000)
219 : #define SHOWTRACK_STYLE ((sal_uInt16)0x000F)
220 :
221 : // Flags for StartTracking()
222 : #define STARTTRACK_KEYINPUT ((sal_uInt16)0x0001)
223 : #define STARTTRACK_KEYMOD ((sal_uInt16)0x0002)
224 : #define STARTTRACK_NOKEYCANCEL ((sal_uInt16)0x0004)
225 : #define STARTTRACK_SCROLLREPEAT ((sal_uInt16)0x0008)
226 : #define STARTTRACK_BUTTONREPEAT ((sal_uInt16)0x0010)
227 : #define STARTTRACK_MOUSEBUTTONDOWN ((sal_uInt16)0x0020)
228 : #define STARTTRACK_FOCUSCANCEL ((sal_uInt16)0x0040)
229 :
230 : // Flags for StartAutoScroll()
231 : #define AUTOSCROLL_VERT ((sal_uInt16)0x0001)
232 : #define AUTOSCROLL_HORZ ((sal_uInt16)0x0002)
233 :
234 : // Flags for StateChanged()
235 : typedef sal_uInt16 StateChangedType;
236 : #define STATE_CHANGE_INITSHOW ((StateChangedType)1)
237 : #define STATE_CHANGE_VISIBLE ((StateChangedType)2)
238 : #define STATE_CHANGE_UPDATEMODE ((StateChangedType)3)
239 : #define STATE_CHANGE_ENABLE ((StateChangedType)4)
240 : #define STATE_CHANGE_TEXT ((StateChangedType)5)
241 : #define STATE_CHANGE_IMAGE ((StateChangedType)6)
242 : #define STATE_CHANGE_DATA ((StateChangedType)7)
243 : #define STATE_CHANGE_STATE ((StateChangedType)8)
244 : #define STATE_CHANGE_STYLE ((StateChangedType)9)
245 : #define STATE_CHANGE_ZOOM ((StateChangedType)10)
246 : #define STATE_CHANGE_BORDER ((StateChangedType)11)
247 : #define STATE_CHANGE_TRANSPARENT ((StateChangedType)12)
248 : #define STATE_CHANGE_CONTROLFONT ((StateChangedType)13)
249 : #define STATE_CHANGE_CONTROLFOREGROUND ((StateChangedType)14)
250 : #define STATE_CHANGE_CONTROLBACKGROUND ((StateChangedType)15)
251 : #define STATE_CHANGE_READONLY ((StateChangedType)16)
252 : #define STATE_CHANGE_EXTENDEDSTYLE ((StateChangedType)17)
253 : #define STATE_CHANGE_MIRRORING ((StateChangedType)18)
254 : #define STATE_CHANGE_CONTROL_FOCUS ((StateChangedType)20)
255 : #define STATE_CHANGE_USER ((StateChangedType)10000)
256 :
257 : // GetFocusFlags
258 : #define GETFOCUS_TAB ((sal_uInt16)0x0001)
259 : #define GETFOCUS_CURSOR ((sal_uInt16)0x0002)
260 : #define GETFOCUS_MNEMONIC ((sal_uInt16)0x0004)
261 : #define GETFOCUS_FORWARD ((sal_uInt16)0x0010)
262 : #define GETFOCUS_BACKWARD ((sal_uInt16)0x0020)
263 : #define GETFOCUS_AROUND ((sal_uInt16)0x0040)
264 : #define GETFOCUS_UNIQUEMNEMONIC ((sal_uInt16)0x0100)
265 : #define GETFOCUS_INIT ((sal_uInt16)0x0200)
266 : #define GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0400)
267 :
268 : // Draw-Flags fuer Draw()
269 : #define WINDOW_DRAW_MONO ((sal_uLong)0x00000001)
270 : #define WINDOW_DRAW_NOBORDER ((sal_uLong)0x00000002)
271 : #define WINDOW_DRAW_NOCONTROLS ((sal_uLong)0x00000004)
272 : #define WINDOW_DRAW_NODISABLE ((sal_uLong)0x00000008)
273 : #define WINDOW_DRAW_NOMNEMONIC ((sal_uLong)0x00000010)
274 : #define WINDOW_DRAW_NOSELECTION ((sal_uLong)0x00000020)
275 : #define WINDOW_DRAW_NOFOCUS ((sal_uLong)0x00000040)
276 : #define WINDOW_DRAW_NOBACKGROUND ((sal_uLong)0x00000080)
277 : #define WINDOW_DRAW_ROLLOVER ((sal_uLong)0x00000100)
278 :
279 : // Border-Styles fuer SetBorder()
280 : #define WINDOW_BORDER_NORMAL ((sal_uInt16)0x0001)
281 : #define WINDOW_BORDER_MONO ((sal_uInt16)0x0002)
282 : #define WINDOW_BORDER_MENU ((sal_uInt16)0x0010)
283 : #define WINDOW_BORDER_NWF ((sal_uInt16)0x0020)
284 : #define WINDOW_BORDER_NOBORDER ((sal_uInt16)0x1000)
285 : #define WINDOW_BORDER_REMOVEBORDER ((sal_uInt16)0x2000)
286 :
287 : // DialogControl-Flags
288 : #define WINDOW_DLGCTRL_RETURN ((sal_uInt16)0x0001)
289 : #define WINDOW_DLGCTRL_WANTFOCUS ((sal_uInt16)0x0002)
290 : #define WINDOW_DLGCTRL_MOD1TAB ((sal_uInt16)0x0004)
291 : #define WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0008)
292 :
293 : // GetWindowClipRegionPixel-Flags
294 : #define WINDOW_GETCLIPREGION_NULL ((sal_uInt16)0x0001)
295 : #define WINDOW_GETCLIPREGION_NOCHILDREN ((sal_uInt16)0x0002)
296 :
297 : // EndExtTextInput-Flags
298 : #define EXTTEXTINPUT_END_COMPLETE ((sal_uInt16)0x0001)
299 : #define EXTTEXTINPUT_END_CANCEL ((sal_uInt16)0x0002)
300 :
301 : #define IMPL_MINSIZE_BUTTON_WIDTH 70
302 : #define IMPL_MINSIZE_BUTTON_HEIGHT 22
303 : #define IMPL_EXTRA_BUTTON_WIDTH 18
304 : #define IMPL_EXTRA_BUTTON_HEIGHT 10
305 : #define IMPL_SEP_BUTTON_X 5
306 : #define IMPL_SEP_BUTTON_Y 5
307 : #define IMPL_MINSIZE_MSGBOX_WIDTH 150
308 : #define IMPL_MINSIZE_MSGBOX_HEIGHT 80
309 : #define IMPL_DIALOG_OFFSET 5
310 : #define IMPL_DIALOG_BAR_OFFSET 3
311 : #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
312 : #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
313 : #define IMPL_SEP_MSGBOX_IMAGE 8
314 :
315 : #define DLGWINDOW_PREV 0
316 : #define DLGWINDOW_NEXT 1
317 : #define DLGWINDOW_FIRST 2
318 :
319 : enum WindowSizeType
320 : {
321 : WINDOWSIZE_MINIMUM,
322 : WINDOWSIZE_PREFERRED,
323 : WINDOWSIZE_MAXIMUM
324 : };
325 :
326 : // ----------
327 : // - Window -
328 : // ----------
329 :
330 : #ifdef DBG_UTIL
331 : const char* ImplDbgCheckWindow( const void* pObj );
332 : #endif
333 :
334 : class Dialog;
335 : class WindowImpl;
336 : class VclBuilder;
337 :
338 1424 : struct WindowResHeader
339 : {
340 : sal_uLong nObjMask;
341 : rtl::OString aHelpId;
342 : sal_uLong nRSStyle;
343 : };
344 :
345 : class VCL_DLLPUBLIC Window : public OutputDevice
346 : {
347 : friend class Cursor;
348 : friend class OutputDevice;
349 : friend class Application;
350 : friend class SystemWindow;
351 : friend class WorkWindow;
352 : friend class Dialog;
353 : friend class MessBox;
354 : friend class DockingWindow;
355 : friend class FloatingWindow;
356 : friend class GroupBox;
357 : friend class PushButton;
358 : friend class RadioButton;
359 : friend class SystemChildWindow;
360 : friend class ImplBorderWindow;
361 : friend class VclBuilder;
362 :
363 : // TODO: improve missing functionality
364 : // only required because of SetFloatingMode()
365 : friend class ImplDockingWindowWrapper;
366 : friend class ImplPopupFloatWin;
367 : friend class MenuFloatingWindow;
368 :
369 : friend class svt::PopupWindowControllerImpl;
370 :
371 : private:
372 : // NOTE: to remove many dependencies of other modules
373 : // to this central file, all members are now hidden
374 : // in the WindowImpl class and all inline functions
375 : // were removed
376 : //
377 : // Please do *not* add new members or inline functions to class Window,
378 : // but use class WindowImpl instead
379 : //
380 : WindowImpl* mpWindowImpl;
381 :
382 : SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType );
383 :
384 : #ifdef DBG_UTIL
385 : friend const char* ImplDbgCheckWindow( const void* pObj );
386 : #endif
387 : friend Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos );
388 : public:
389 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
390 : SAL_DLLPRIVATE WinBits ImplInitRes( const ResId& rResId );
391 : SAL_DLLPRIVATE WindowResHeader ImplLoadResHeader( const ResId& rResId );
392 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
393 : SAL_DLLPRIVATE void ImplSetFrameParent( const Window* pParent );
394 : SAL_DLLPRIVATE void ImplInsertWindow( Window* pParent );
395 : SAL_DLLPRIVATE void ImplRemoveWindow( sal_Bool bRemoveFrameData );
396 : SAL_DLLPRIVATE Window* ImplGetWindow();
397 : SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
398 : SalFrame* ImplGetFrame() const;
399 : SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const;
400 : SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
401 : SAL_DLLPRIVATE void ImplCallFocusChangeActivate( Window* pNewOverlapWindow, Window* pOldOverlapWindow );
402 : SAL_DLLPRIVATE Window* ImplFindWindow( const Point& rFramePos );
403 : SAL_DLLPRIVATE sal_uInt16 ImplHitTest( const Point& rFramePos );
404 : SAL_DLLPRIVATE Window* ImplGetParent() const;
405 : SAL_DLLPRIVATE Window* ImplGetClientWindow() const;
406 : SAL_DLLPRIVATE Window* ImplGetBorderWindow() const;
407 : SAL_DLLPRIVATE Window* ImplGetFirstOverlapWindow();
408 : SAL_DLLPRIVATE const Window* ImplGetFirstOverlapWindow() const;
409 : SAL_DLLPRIVATE Window* ImplGetFrameWindow() const;
410 : SAL_DLLPRIVATE sal_Bool ImplIsRealParentPath( const Window* pWindow ) const;
411 : SAL_DLLPRIVATE sal_Bool ImplIsChild( const Window* pWindow, sal_Bool bSystemWindow = sal_False ) const;
412 : SAL_DLLPRIVATE sal_Bool ImplIsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow = sal_False ) const;
413 : SAL_DLLPRIVATE sal_Bool ImplIsDockingWindow() const;
414 : SAL_DLLPRIVATE sal_Bool ImplIsFloatingWindow() const;
415 : SAL_DLLPRIVATE sal_Bool ImplIsSplitter() const;
416 : SAL_DLLPRIVATE sal_Bool ImplIsPushButton() const;
417 : SAL_DLLPRIVATE sal_Bool ImplIsOverlapWindow() const;
418 : SAL_DLLPRIVATE void ImplSetMouseTransparent( sal_Bool bTransparent );
419 : SAL_DLLPRIVATE int ImplTestMousePointerSet();
420 : SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
421 : SAL_DLLPRIVATE void ImplResetReallyVisible();
422 : SAL_DLLPRIVATE void ImplSetReallyVisible();
423 : SAL_DLLPRIVATE void ImplCallInitShow();
424 : SAL_DLLPRIVATE void ImplAddDel( ImplDelData* pDel );
425 : SAL_DLLPRIVATE void ImplRemoveDel( ImplDelData* pDel );
426 : SAL_DLLPRIVATE void ImplInitResolutionSettings();
427 : SAL_DLLPRIVATE void ImplPointToLogic( Font& rFont ) const;
428 : SAL_DLLPRIVATE void ImplLogicToPoint( Font& rFont ) const;
429 : SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos );
430 : SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos );
431 : SAL_DLLPRIVATE sal_Bool ImplSysObjClip( const Region* pOldRegion );
432 : SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
433 : SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
434 : SAL_DLLPRIVATE void ImplUpdateSysObjClip();
435 : SAL_DLLPRIVATE sal_Bool ImplSetClipFlagChildren( sal_Bool bSysObjOnlySmaller = sal_False );
436 : SAL_DLLPRIVATE sal_Bool ImplSetClipFlagOverlapWindows( sal_Bool bSysObjOnlySmaller = sal_False );
437 : SAL_DLLPRIVATE sal_Bool ImplSetClipFlag( sal_Bool bSysObjOnlySmaller = sal_False );
438 : SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( Region& rRegion );
439 : SAL_DLLPRIVATE void ImplIntersectWindowRegion( Region& rRegion );
440 : SAL_DLLPRIVATE void ImplExcludeWindowRegion( Region& rRegion );
441 : SAL_DLLPRIVATE void ImplExcludeOverlapWindows( Region& rRegion );
442 : SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( Region& rRegion );
443 : SAL_DLLPRIVATE void ImplClipBoundaries( Region& rRegion, sal_Bool bThis, sal_Bool bOverlaps );
444 : SAL_DLLPRIVATE sal_Bool ImplClipChildren( Region& rRegion );
445 : SAL_DLLPRIVATE void ImplClipAllChildren( Region& rRegion );
446 : SAL_DLLPRIVATE void ImplClipSiblings( Region& rRegion );
447 : SAL_DLLPRIVATE void ImplInitWinClipRegion();
448 : SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
449 : SAL_DLLPRIVATE Region* ImplGetWinChildClipRegion();
450 : SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion );
451 : SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion );
452 : SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion );
453 : SAL_DLLPRIVATE void ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion,
454 : sal_Bool bChildren, sal_Bool bParent, sal_Bool bSiblings );
455 : SAL_DLLPRIVATE void ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags );
456 : SAL_DLLPRIVATE void ImplCallOverlapPaint();
457 : SAL_DLLPRIVATE void ImplPostPaint();
458 : SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags );
459 : SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const Region& rRegion );
460 : SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( Region& rRegion );
461 : SAL_DLLPRIVATE void ImplInvalidate( const Region* rRegion, sal_uInt16 nFlags );
462 : SAL_DLLPRIVATE void ImplValidateFrameRegion( const Region* rRegion, sal_uInt16 nFlags );
463 : SAL_DLLPRIVATE void ImplValidate( const Region* rRegion, sal_uInt16 nFlags );
464 : SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const Rectangle& rRect, long nHorzScroll, long nVertScroll, sal_Bool bChildren );
465 : SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const Rectangle& rRect, long nHorzScroll, long nVertScroll, sal_Bool bChildren );
466 : SAL_DLLPRIVATE void ImplScroll( const Rectangle& rRect, long nHorzScroll, long nVertScroll, sal_uInt16 nFlags );
467 : SAL_DLLPRIVATE void ImplUpdateAll( sal_Bool bOverlapWindows = sal_True );
468 : SAL_DLLPRIVATE void ImplUpdateWindowPtr( Window* pWindow );
469 : SAL_DLLPRIVATE void ImplUpdateWindowPtr();
470 : SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame );
471 : SAL_DLLPRIVATE sal_Bool ImplUpdatePos();
472 : SAL_DLLPRIVATE void ImplUpdateSysObjPos();
473 21404 : SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl; }
474 :
475 : /** check whether a font is suitable for UI
476 :
477 : The font to be tested will be checked whether it could display a
478 : localized test string. If this is not the case, then the font
479 : is deemed unsuitable as UI font.
480 :
481 : @param rFont
482 : the font to be tested
483 :
484 : @returns
485 : <TRUE/> if the font can be used as UI font
486 : <FALSE/> if the font is unsuitable as UI font
487 : */
488 : SAL_DLLPRIVATE bool ImplCheckUIFont( const Font& rFont );
489 : SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl = sal_True );
490 : SAL_DLLPRIVATE void ImplAlignChildren();
491 : SAL_DLLPRIVATE void ImplPosSizeWindow( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags );
492 : SAL_DLLPRIVATE void ImplToBottomChild();
493 : SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
494 : SAL_DLLPRIVATE void ImplToTop( sal_uInt16 nFlags );
495 : SAL_DLLPRIVATE void ImplStartToTop( sal_uInt16 nFlags );
496 : SAL_DLLPRIVATE void ImplFocusToTop( sal_uInt16 nFlags, sal_Bool bReallyVisible );
497 : SAL_DLLPRIVATE void ImplShowAllOverlaps();
498 : SAL_DLLPRIVATE void ImplHideAllOverlaps();
499 : SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
500 : SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, sal_Bool bModChanged = sal_False );
501 : SAL_DLLPRIVATE void ImplGenerateMouseMove();
502 : SAL_DLLPRIVATE void ImplGrabFocus( sal_uInt16 nFlags );
503 : SAL_DLLPRIVATE void ImplInvertFocus( const Rectangle& rRect );
504 : SAL_DLLPRIVATE void ImplControlFocus( sal_uInt16 nFlags = 0 );
505 : SAL_DLLPRIVATE Window* ImplGetDlgWindow( sal_uInt16 n, sal_uInt16 nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = NULL );
506 : SAL_DLLPRIVATE sal_Bool ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput );
507 : SAL_DLLPRIVATE sal_Bool ImplHasDlgCtrl();
508 : SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
509 : SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( Window* pWindow, sal_Bool bGetFocus );
510 : SAL_DLLPRIVATE Window* ImplFindDlgCtrlWindow( Window* pWindow );
511 : SAL_DLLPRIVATE long ImplLogicUnitToPixelX( long nX, MapUnit eUnit );
512 : SAL_DLLPRIVATE long ImplLogicUnitToPixelY( long nY, MapUnit eUnit );
513 : SAL_DLLPRIVATE sal_Bool ImplIsWindowInFront( const Window* pTestWindow ) const;
514 : SAL_DLLPRIVATE void ImplSaveOverlapBackground();
515 : SAL_DLLPRIVATE sal_Bool ImplRestoreOverlapBackground( Region& rInvRegion );
516 : SAL_DLLPRIVATE void ImplDeleteOverlapBackground();
517 : SAL_DLLPRIVATE void ImplInvalidateAllOverlapBackgrounds();
518 : SAL_DLLPRIVATE static void ImplNewInputContext();
519 : SAL_DLLPRIVATE void ImplCallActivateListeners(Window*);
520 : SAL_DLLPRIVATE void ImplCallDeactivateListeners(Window*);
521 : DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl, void* );
522 : DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void* );
523 : DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl, Timer* );
524 : DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void* );
525 : DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* );
526 : DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl, void* );
527 :
528 : SAL_DLLPRIVATE static void ImplCalcSymbolRect( Rectangle& rRect );
529 : SAL_DLLPRIVATE void ImplHandleScroll( ScrollBar* pHScrl, long nX, ScrollBar* pVScrl, long nY );
530 : SAL_DLLPRIVATE sal_Bool ImplIsAccessibleCandidate() const;
531 : SAL_DLLPRIVATE sal_Bool ImplIsAccessibleNativeFrame() const;
532 : SAL_DLLPRIVATE sal_uInt16 ImplGetAccessibleCandidateChildWindowCount( sal_uInt16 nFirstWindowType ) const;
533 : SAL_DLLPRIVATE Window* ImplGetAccessibleCandidateChild( sal_uInt16 nChild, sal_uInt16& rChildCount, sal_uInt16 nFirstWindowType, sal_Bool bTopLevel = sal_True ) const;
534 : SAL_DLLPRIVATE sal_Bool ImplRegisterAccessibleNativeFrame();
535 : SAL_DLLPRIVATE void ImplRevokeAccessibleNativeFrame();
536 : SAL_DLLPRIVATE void ImplCallResize();
537 : SAL_DLLPRIVATE void ImplCallMove();
538 : SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const;
539 : SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
540 : SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX();
541 : SAL_DLLPRIVATE void ImplIncModalCount();
542 : SAL_DLLPRIVATE void ImplDecModalCount();
543 :
544 : // retrieves the list of owner draw decorated windows for this window hiearchy
545 : SAL_DLLPRIVATE ::std::vector<Window *>& ImplGetOwnerDrawList();
546 : SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow();
547 :
548 : SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, sal_Bool bClientOnly ) const;
549 : SAL_DLLPRIVATE void ImplNotifyIconifiedState( sal_Bool bIconified );
550 : SAL_DLLPRIVATE bool ImplStopDnd();
551 : SAL_DLLPRIVATE void ImplStartDnd();
552 :
553 : SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow );
554 : SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos );
555 :
556 : SAL_DLLPRIVATE void ImplIsInTaskPaneList( sal_Bool mbIsInTaskList );
557 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >
558 : ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const;
559 :
560 : private:
561 : // Default construction is forbidden and not implemented.
562 : SAL_DLLPRIVATE Window();
563 :
564 : // Copy assignment is forbidden and not implemented.
565 : SAL_DLLPRIVATE Window (const Window &);
566 : SAL_DLLPRIVATE Window & operator= (const Window &);
567 :
568 : protected:
569 : // Single argument ctors shall be explicit.
570 : explicit Window( WindowType nType );
571 :
572 : void SetCompoundControl( sal_Bool bCompound );
573 :
574 : void ImplCallEventListeners( sal_uLong nEvent, void* pData = NULL );
575 : void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
576 : void FireVclEvent( VclSimpleEvent* pEvent );
577 :
578 : sal_Int32 get_height_request() const;
579 : sal_Int32 get_width_request() const;
580 :
581 : // FIXME: this is a hack to workaround missing layout functionality
582 : SAL_DLLPRIVATE void ImplAdjustNWFSizes();
583 : public:
584 : // Single argument ctors shall be explicit.
585 : explicit Window( Window* pParent, WinBits nStyle = 0 );
586 :
587 : Window( Window* pParent, const ResId& rResId );
588 : virtual ~Window();
589 :
590 : virtual void MouseMove( const MouseEvent& rMEvt );
591 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
592 : virtual void MouseButtonUp( const MouseEvent& rMEvt );
593 : virtual void KeyInput( const KeyEvent& rKEvt );
594 : virtual void KeyUp( const KeyEvent& rKEvt );
595 : virtual void PrePaint();
596 : virtual void Paint( const Rectangle& rRect );
597 :
598 : virtual void PostPaint();
599 : virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
600 : virtual void Move();
601 : virtual void Resize();
602 : virtual void Activate();
603 : virtual void Deactivate();
604 : virtual void GetFocus();
605 : virtual void LoseFocus();
606 : virtual void RequestHelp( const HelpEvent& rHEvt );
607 : virtual void Command( const CommandEvent& rCEvt );
608 : virtual void Tracking( const TrackingEvent& rTEvt );
609 : virtual void UserEvent( sal_uLong nEvent, void* pEventData );
610 : virtual void StateChanged( StateChangedType nStateChange );
611 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
612 : virtual long PreNotify( NotifyEvent& rNEvt );
613 : virtual long Notify( NotifyEvent& rNEvt );
614 : virtual Window* GetPreferredKeyInputWindow();
615 :
616 : /*virtual*/ void AddEventListener( const Link& rEventListener );
617 : /*virtual*/ void RemoveEventListener( const Link& rEventListener );
618 : /*virtual*/ void AddChildEventListener( const Link& rEventListener );
619 : /*virtual*/ void RemoveChildEventListener( const Link& rEventListener );
620 :
621 : sal_uLong PostUserEvent( const Link& rLink, void* pCaller = NULL );
622 : sal_Bool PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData = NULL );
623 : sal_Bool PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller = NULL );
624 : void RemoveUserEvent( sal_uLong nUserEvent );
625 :
626 : void IncrementLockCount();
627 : void DecrementLockCount();
628 : sal_Bool IsLocked( sal_Bool bChildren = sal_False ) const;
629 :
630 : // returns the input language used for the last key stroke
631 : // may be LANGUAGE_DONTKNOW if not supported by the OS
632 : LanguageType GetInputLanguage() const;
633 :
634 : void SetStyle( WinBits nStyle );
635 : WinBits GetStyle() const;
636 : WinBits GetPrevStyle() const;
637 : void SetExtendedStyle( WinBits nExtendedStyle );
638 : WinBits GetExtendedStyle() const;
639 : void SetType( WindowType nType );
640 : WindowType GetType() const;
641 : sal_Bool IsSystemWindow() const;
642 : sal_Bool IsDialog() const;
643 : sal_Bool IsMenuFloatingWindow() const;
644 : sal_Bool IsToolbarFloatingWindow() const;
645 : sal_Bool IsTopWindow() const;
646 : SystemWindow* GetSystemWindow() const;
647 :
648 : void EnableAllResize( sal_Bool bEnable = sal_True );
649 :
650 : void SetBorderStyle( sal_uInt16 nBorderStyle );
651 : sal_uInt16 GetBorderStyle() const;
652 : void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
653 : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
654 : Size CalcWindowSize( const Size& rOutSz ) const;
655 : Size CalcOutputSize( const Size& rWinSz ) const;
656 : long CalcTitleWidth() const;
657 :
658 : void EnableClipSiblings( sal_Bool bClipSiblings = sal_True );
659 :
660 : void EnableChildTransparentMode( sal_Bool bEnable = sal_True );
661 : sal_Bool IsChildTransparentModeEnabled() const;
662 :
663 : void SetMouseTransparent( sal_Bool bTransparent );
664 : sal_Bool IsMouseTransparent() const;
665 : void SetPaintTransparent( sal_Bool bTransparent );
666 : sal_Bool IsPaintTransparent() const;
667 : void SetDialogControlStart( sal_Bool bStart );
668 : sal_Bool IsDialogControlStart() const;
669 : void SetDialogControlFlags( sal_uInt16 nFlags );
670 : sal_uInt16 GetDialogControlFlags() const;
671 :
672 0 : struct PointerState
673 : {
674 : sal_uLong mnState; // the button state
675 : Point maPos; // mouse position in output coordinates
676 : };
677 : PointerState GetPointerState();
678 : sal_Bool IsMouseOver();
679 :
680 : sal_uLong GetCurrentModButtons();
681 :
682 : void SetInputContext( const InputContext& rInputContext );
683 : const InputContext& GetInputContext() const;
684 : void EndExtTextInput( sal_uInt16 nFlags );
685 : void SetCursorRect( const Rectangle* pRect = NULL, long nExtTextInputWidth = 0 );
686 : const Rectangle* GetCursorRect() const;
687 : long GetCursorExtTextInputWidth() const;
688 :
689 : using OutputDevice::SetSettings;
690 : virtual void SetSettings( const AllSettings& rSettings );
691 : virtual void SetSettings( const AllSettings& rSettings, sal_Bool bChild );
692 : void UpdateSettings( const AllSettings& rSettings, sal_Bool bChild = sal_False );
693 : void NotifyAllChildren( DataChangedEvent& rDCEvt );
694 :
695 : void SetPointFont( const Font& rFont );
696 : Font GetPointFont() const;
697 : void SetZoomedPointFont( const Font& rFont );
698 : long GetDrawPixel( OutputDevice* pDev, long nPixels ) const;
699 : Font GetDrawPixelFont( OutputDevice* pDev ) const;
700 :
701 : void SetControlFont();
702 : void SetControlFont( const Font& rFont );
703 : Font GetControlFont() const;
704 : sal_Bool IsControlFont() const;
705 : void SetControlForeground();
706 : void SetControlForeground( const Color& rColor );
707 : Color GetControlForeground() const;
708 : sal_Bool IsControlForeground() const;
709 : void SetControlBackground();
710 : void SetControlBackground( const Color& rColor );
711 : Color GetControlBackground() const;
712 : sal_Bool IsControlBackground() const;
713 :
714 : void SetParentClipMode( sal_uInt16 nMode = 0 );
715 : sal_uInt16 GetParentClipMode() const;
716 :
717 : void SetWindowRegionPixel();
718 : void SetWindowRegionPixel( const Region& rRegion );
719 : const Region& GetWindowRegionPixel() const;
720 : sal_Bool IsWindowRegionPixel() const;
721 : Region GetWindowClipRegionPixel( sal_uInt16 nFlags = 0 ) const;
722 : Region GetPaintRegion() const;
723 : sal_Bool IsInPaint() const;
724 : // while IsInPaint returns true ExpandPaintClipRegion adds the
725 : // submitted region to the paint clip region so you can
726 : // paint additional parts of your window if necessary
727 : void ExpandPaintClipRegion( const Region& rRegion );
728 :
729 : void SetParent( Window* pNewParent );
730 : Window* GetParent() const;
731 : // return the dialog we are contained in or NULL if un-contained
732 : Dialog* GetParentDialog() const;
733 :
734 : void Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = 0 );
735 4375 : void Hide( sal_uInt16 nFlags = 0 ) { Show( sal_False, nFlags ); }
736 : sal_Bool IsVisible() const;
737 : sal_Bool IsReallyVisible() const;
738 : sal_Bool IsReallyShown() const;
739 : sal_Bool IsInInitShow() const;
740 :
741 : void Enable( bool bEnable = true, bool bChild = true );
742 58 : void Disable( bool bChild = true ) { Enable( false, bChild ); }
743 : sal_Bool IsEnabled() const;
744 :
745 : void EnableInput( sal_Bool bEnable = sal_True, sal_Bool bChild = sal_True );
746 : void EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin,
747 : const Window* pExcludeWindow = NULL );
748 : sal_Bool IsInputEnabled() const;
749 :
750 : /** Override <code>EnableInput</code>. This can be necessary due to other people
751 : using EnableInput for whole window hierarchies.
752 :
753 :
754 : <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
755 : mutually exclusive; the last setter wins.
756 : @param bAlways
757 : sets always enabled flag
758 :
759 : @param bChild
760 : if true children are recursively set to AlwaysEnableInput
761 : */
762 : void AlwaysEnableInput( sal_Bool bAlways, sal_Bool bChild = sal_True );
763 : /** returns the current AlwaysEnableInput state
764 : @return
765 : true if window is in AlwaysEnableInput state
766 : */
767 : sal_Bool IsAlwaysEnableInput() const;
768 : /** Override <code>EnableInput</code>, counterpart to AlwaysEnableInput.
769 : Windows with AlwaysDisableInput will not get key events even if enabled
770 : and input enabled.This can be necessary due to other people using EnableInput
771 : for whole window hierarchies.
772 :
773 : <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
774 : mutually exclusive; the last setter wins.
775 :
776 : @param bAlways
777 : sets always disable flag
778 :
779 : @param bChild
780 : if true children are recursively set to AlwaysDisableInput
781 : */
782 : void AlwaysDisableInput( sal_Bool bAlways, sal_Bool bChild = sal_True );
783 :
784 : /** usually event handlers (see AddEventListener and AddChildEventListener)
785 : are not called on disabled, modal or input disabled windows. There are however rare cases
786 : in which one wants a Window or rather one of its Control subclasses to
787 : not evaluate events but still react to those events externally. In these
788 : rare cases call SetCallHandlersOnInputDisabled( true ) to have your handler
789 : called anyway.
790 :
791 : Currently only mouse events get this special treatment.
792 :
793 : Use this sparingly, chances are if you want to use it you're wroking around
794 : the real problem.
795 :
796 : @param bCall
797 : Enable/Disable calling event handlers for this disabled, modal or input disabled window.
798 : This call is implicity done recursively for possible child windows.
799 : */
800 : void SetCallHandlersOnInputDisabled( bool bCall );
801 : /** get state of SetCallHandlersOnInputDisabled
802 :
803 : @returns whether handlers are called regardless of input enabled state
804 : */
805 : bool IsCallHandlersOnInputDisabled() const;
806 : /** A window is in modal mode if one of its children or subchildren
807 : is a running modal window (a modal dialog)
808 :
809 : @returns sal_True if a child or subchild is a running modal window
810 : */
811 : sal_Bool IsInModalMode() const;
812 :
813 : /**
814 : * Necessary for calc ref input handling from modal dialogs
815 : */
816 : bool IsInModalNonRefMode() const;
817 :
818 : void SetActivateMode( sal_uInt16 nMode );
819 : sal_uInt16 GetActivateMode() const;
820 :
821 : void ToTop( sal_uInt16 nFlags = 0 );
822 : void SetZOrder( Window* pRefWindow, sal_uInt16 nFlags );
823 : void EnableAlwaysOnTop( sal_Bool bEnable = sal_True );
824 : sal_Bool IsAlwaysOnTopEnabled() const;
825 :
826 : virtual void setPosSizePixel( long nX, long nY,
827 : long nWidth, long nHeight,
828 : sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
829 : virtual void SetPosPixel( const Point& rNewPos );
830 : virtual Point GetPosPixel() const;
831 : virtual void SetSizePixel( const Size& rNewSize );
832 : virtual Size GetSizePixel() const;
833 : virtual void SetPosSizePixel( const Point& rNewPos,
834 : const Size& rNewSize );
835 : virtual void SetOutputSizePixel( const Size& rNewSize );
836 : sal_Bool IsDefaultPos() const;
837 : sal_Bool IsDefaultSize() const;
838 :
839 : // those conversion routines might deliver different results during UI mirroring
840 : Point OutputToScreenPixel( const Point& rPos ) const;
841 : Point ScreenToOutputPixel( const Point& rPos ) const;
842 : // the normalized screen methods work independent from UI mirroring
843 : Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
844 : Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
845 : Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
846 : Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
847 : Rectangle GetDesktopRectPixel() const;
848 : // window extents including border and decoratrion
849 : Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
850 : // window extents of the client window, coordinates to be used in SetPosPixel
851 : Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const;
852 :
853 : virtual sal_Bool IsScrollable() const;
854 : virtual void Scroll( long nHorzScroll, long nVertScroll,
855 : sal_uInt16 nFlags = 0 );
856 : virtual void Scroll( long nHorzScroll, long nVertScroll,
857 : const Rectangle& rRect, sal_uInt16 nFlags = 0 );
858 : virtual void Invalidate( sal_uInt16 nFlags = 0 );
859 : virtual void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
860 : virtual void Invalidate( const Region& rRegion, sal_uInt16 nFlags = 0 );
861 : void Validate( sal_uInt16 nFlags = 0 );
862 : sal_Bool HasPaintEvent() const;
863 : void Update();
864 : void Flush();
865 : void Sync();
866 :
867 : // toggles new docking support, enabled via toolkit
868 : void EnableDocking( sal_Bool bEnable = sal_True );
869 : // retrieves the single dockingmanager instance
870 : static DockingManager* GetDockingManager();
871 :
872 : void EnablePaint( sal_Bool bEnable );
873 : sal_Bool IsPaintEnabled() const;
874 : void SetUpdateMode( sal_Bool bUpdate );
875 : sal_Bool IsUpdateMode() const;
876 : void SetParentUpdateMode( sal_Bool bUpdate );
877 :
878 : void GrabFocus();
879 : sal_Bool HasFocus() const;
880 : sal_Bool HasChildPathFocus( sal_Bool bSystemWindow = sal_False ) const;
881 : sal_Bool IsActive() const;
882 : sal_Bool HasActiveChildFrame();
883 : sal_uInt16 GetGetFocusFlags() const;
884 : void GrabFocusToDocument();
885 :
886 : /**
887 : * Set this when you need to act as if the window has focus even if it
888 : * doesn't. This is necessary for implementing tab stops inside floating
889 : * windows, but floating windows don't get focus from the system.
890 : */
891 : void SetFakeFocus( bool bFocus );
892 :
893 : sal_Bool IsCompoundControl() const;
894 :
895 : static sal_uIntPtr SaveFocus();
896 : static sal_Bool EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore = sal_True );
897 :
898 : void CaptureMouse();
899 : void ReleaseMouse();
900 : sal_Bool IsMouseCaptured() const;
901 :
902 : void SetPointer( const Pointer& rPointer );
903 : const Pointer& GetPointer() const;
904 : void EnableChildPointerOverwrite( sal_Bool bOverwrite = sal_True );
905 : void SetPointerPosPixel( const Point& rPos );
906 : Point GetPointerPosPixel();
907 : Point GetLastPointerPosPixel();
908 : void ShowPointer( sal_Bool bVisible );
909 : void EnterWait();
910 : void LeaveWait();
911 : sal_Bool IsWait() const;
912 :
913 : void SetCursor( Cursor* pCursor );
914 : Cursor* GetCursor() const;
915 :
916 : void SetZoom( const Fraction& rZoom );
917 : const Fraction& GetZoom() const;
918 : sal_Bool IsZoom() const;
919 : long CalcZoom( long n ) const;
920 :
921 : virtual void SetText( const XubString& rStr );
922 : virtual String GetText() const;
923 : // return the actual text displayed
924 : // this may have e.g. accellerators removed or portions
925 : // replaced by ellipsis
926 : virtual String GetDisplayText() const;
927 : // gets the visible background color. for transparent windows
928 : // this may be the parent's background color; for controls
929 : // this may be a child's background color (e.g. ListBox)
930 : virtual const Wallpaper& GetDisplayBackground() const;
931 :
932 : void SetHelpText( const XubString& rHelpText );
933 : const XubString& GetHelpText() const;
934 :
935 : void SetQuickHelpText( const XubString& rHelpText );
936 : const XubString& GetQuickHelpText() const;
937 :
938 : void SetHelpId( const rtl::OString& );
939 : const rtl::OString& GetHelpId() const;
940 :
941 : void SetUniqueId( const rtl::OString& );
942 : const rtl::OString& GetUniqueId() const;
943 :
944 : Window* FindWindow( const Point& rPos ) const;
945 :
946 : sal_uInt16 GetChildCount() const;
947 : Window* GetChild( sal_uInt16 nChild ) const;
948 : Window* GetWindow( sal_uInt16 nType ) const;
949 : sal_Bool IsChild( const Window* pWindow, sal_Bool bSystemWindow = sal_False ) const;
950 : sal_Bool IsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow = sal_False ) const;
951 :
952 : void SetData( void* pNewData );
953 : void* GetData() const;
954 :
955 : void ShowFocus( const Rectangle& rRect );
956 : void HideFocus();
957 :
958 : void Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
959 : void Invert( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
960 :
961 : // transparent background for selected or checked items in toolboxes etc.
962 : void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly );
963 : // the same, but fills a passed Color with a text color complementing the selection background
964 : void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly, Color* pSelectionTextColor );
965 : // support rounded edges in the selection rect
966 : void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor );
967 :
968 : void ShowTracking( const Rectangle& rRect,
969 : sal_uInt16 nFlags = SHOWTRACK_SMALL );
970 : void HideTracking();
971 : void InvertTracking( const Rectangle& rRect,
972 : sal_uInt16 nFlags = SHOWTRACK_SMALL );
973 : void InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
974 :
975 : void StartTracking( sal_uInt16 nFlags = 0 );
976 : void EndTracking( sal_uInt16 nFlags = 0 );
977 : sal_Bool IsTracking() const;
978 :
979 : void StartAutoScroll( sal_uInt16 nFlags );
980 : void EndAutoScroll();
981 :
982 : sal_Bool HandleScrollCommand( const CommandEvent& rCmd,
983 : ScrollBar* pHScrl = NULL,
984 : ScrollBar* pVScrl = NULL );
985 :
986 : void SaveBackground( const Point& rPos, const Size& rSize,
987 : const Point& rDestOff, VirtualDevice& rSaveDevice );
988 :
989 : const SystemEnvData* GetSystemData() const;
990 : ::com::sun::star::uno::Any GetSystemDataAny() const;
991 :
992 : // API to set/query the component interfaces
993 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( sal_Bool bCreate = sal_True );
994 : virtual void SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace );
995 :
996 : // Accessibility
997 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True );
998 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
999 : void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > );
1000 :
1001 : Window* GetAccessibleParentWindow() const;
1002 : sal_uInt16 GetAccessibleChildWindowCount();
1003 : Window* GetAccessibleChildWindow( sal_uInt16 n );
1004 :
1005 : void SetAccessibleRole( sal_uInt16 nRole );
1006 : sal_uInt16 GetAccessibleRole() const;
1007 :
1008 : void SetAccessibleName( const String& rName );
1009 : String GetAccessibleName() const;
1010 :
1011 : void SetAccessibleDescription( const String& rDescr );
1012 : String GetAccessibleDescription() const;
1013 :
1014 : void SetAccessibleRelationLabeledBy( Window* pLabeledBy );
1015 : Window* GetAccessibleRelationLabeledBy() const;
1016 :
1017 : Window* GetAccessibleRelationLabelFor() const;
1018 :
1019 : void SetAccessibleRelationMemberOf( Window* pMemberOf );
1020 :
1021 : // to avoid sending accessibility events in cases like closing dialogs
1022 : // by default checks complete parent path
1023 : sal_Bool IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath = sal_True );
1024 : void SetAccessibilityEventsSuppressed(sal_Bool bSuppressed);
1025 :
1026 : /// request XCanvas render interface for this window
1027 : ::com::sun::star::uno::Reference<
1028 : ::com::sun::star::rendering::XCanvas > GetCanvas() const;
1029 : /// request XSpriteCanvas render interface for this window
1030 : ::com::sun::star::uno::Reference<
1031 : ::com::sun::star::rendering::XSpriteCanvas > GetSpriteCanvas() const;
1032 :
1033 : /* records all DrawText operations within the passed rectangle;
1034 : * a synchronous paint is sent to achieve this
1035 : */
1036 : void RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect );
1037 :
1038 : // set and retrieve for Toolkit
1039 : VCLXWindow* GetWindowPeer() const;
1040 : void SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow );
1041 :
1042 : // remember if it was generated by Toolkit
1043 : sal_Bool IsCreatedWithToolkit() const;
1044 : void SetCreatedWithToolkit( sal_Bool b );
1045 :
1046 : // Deprecated - can use SetAccessibleRelationLabelFor/By nowadys
1047 : virtual Window* GetParentLabelFor( const Window* pLabel ) const;
1048 : virtual Window* GetParentLabeledBy( const Window* pLabeled ) const;
1049 : KeyEvent GetActivationKey() const;
1050 :
1051 : // Drag and Drop interfaces
1052 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > GetDropTarget();
1053 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > GetDragSource();
1054 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1055 :
1056 : // Clipboard/Selection interfaces
1057 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard();
1058 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetPrimarySelection();
1059 :
1060 : /*
1061 : * Advisory Sizing - what is a good size for this widget
1062 : *
1063 : * Retrieves the preferred size of a widget ignoring
1064 : * "width-request" and "height-request" properties.
1065 : *
1066 : * Implement this in sub-classes to tell layout
1067 : * the preferred widget size.
1068 : */
1069 : virtual Size GetOptimalSize(WindowSizeType eType) const;
1070 :
1071 : /*
1072 : * Widgets call this to inform their owner container that the widget wants
1073 : * to renegotiate its size. Should be called when a widget has a new size
1074 : * request. e.g. a FixedText Control gets a new label.
1075 : *
1076 : * akin to gtk_widget_queue_resize
1077 : */
1078 : void queue_resize();
1079 :
1080 : /*
1081 : * Sets the "width-request" property
1082 : *
1083 : * Override for width request of the widget, or -1 if natural request
1084 : * should be used.
1085 : *
1086 : * @see get_preferred_size, set_width_request
1087 : */
1088 : void set_height_request(sal_Int32 nHeightRequest);
1089 :
1090 : /*
1091 : * Sets the "height-request" property
1092 : *
1093 : * Override for height request of the widget, or -1 if natural request
1094 : * should be used.
1095 : *
1096 : * @see get_preferred_size, set_height_request
1097 : */
1098 : void set_width_request(sal_Int32 nWidthRequest);
1099 :
1100 : /*
1101 : * Retrieves the preferred size of a widget taking
1102 : * into account the "width-request" and "height-request" properties.
1103 : *
1104 : * Overrides the result of GetOptimalSize to honor the
1105 : * width-request and height-request properties.
1106 : *
1107 : * @see GetOptimalSize
1108 : *
1109 : * akin to gtk_widget_get_preferred_size
1110 : */
1111 : Size get_preferred_size() const;
1112 :
1113 : /*
1114 : * How to horizontally align this widget
1115 : */
1116 : VclAlign get_halign() const;
1117 : void set_halign(VclAlign eAlign);
1118 :
1119 : /*
1120 : * How to vertically align this widget
1121 : */
1122 : VclAlign get_valign() const;
1123 : void set_valign(VclAlign eAlign);
1124 :
1125 : /*
1126 : * Whether the widget would like to use any available extra horizontal
1127 : * space.
1128 : */
1129 : bool get_hexpand() const;
1130 : void set_hexpand(bool bExpand);
1131 :
1132 : /*
1133 : * Whether the widget would like to use any available extra vertical
1134 : * space.
1135 : */
1136 : bool get_vexpand() const;
1137 : void set_vexpand(bool bExpand);
1138 :
1139 : /*
1140 : * Whether the widget would like to use any available extra space.
1141 : */
1142 : bool get_expand() const;
1143 : void set_expand(bool bExpand);
1144 :
1145 : /*
1146 : * Whether the widget should receive extra space when the parent grows
1147 : */
1148 : bool get_fill() const;
1149 : void set_fill(bool bFill);
1150 :
1151 : void set_border_width(sal_Int32 nBorderWidth);
1152 : sal_Int32 get_border_width() const;
1153 :
1154 : void set_margin_left(sal_Int32 nWidth);
1155 : sal_Int32 get_margin_left() const;
1156 :
1157 : void set_margin_right(sal_Int32 nWidth);
1158 : sal_Int32 get_margin_right() const;
1159 :
1160 : void set_margin_top(sal_Int32 nWidth);
1161 : sal_Int32 get_margin_top() const;
1162 :
1163 : void set_margin_bottom(sal_Int32 nWidth);
1164 : sal_Int32 get_margin_bottom() const;
1165 :
1166 : /*
1167 : * How the widget is packed with reference to the start or end of the parent
1168 : */
1169 : VclPackType get_pack_type() const;
1170 : void set_pack_type(VclPackType ePackType);
1171 :
1172 : /*
1173 : * The extra space to put between the widget and its neighbors
1174 : */
1175 : sal_Int32 get_padding() const;
1176 : void set_padding(sal_Int32 nPadding);
1177 :
1178 : /*
1179 : * The number of columns that the widget spans
1180 : */
1181 : sal_Int32 get_grid_width() const;
1182 : void set_grid_width(sal_Int32 nCols);
1183 :
1184 : /*
1185 : * The column number to attach the left side of the widget to
1186 : */
1187 : sal_Int32 get_grid_left_attach() const;
1188 : void set_grid_left_attach(sal_Int32 nAttach);
1189 :
1190 : /*
1191 : * The number of row that the widget spans
1192 : */
1193 : sal_Int32 get_grid_height() const;
1194 : void set_grid_height(sal_Int32 nRows);
1195 :
1196 : /*
1197 : * The row number to attach the top side of the widget to
1198 : */
1199 : sal_Int32 get_grid_top_attach() const;
1200 : void set_grid_top_attach(sal_Int32 nAttach);
1201 :
1202 : /*
1203 : * If true this child appears in a secondary layout group of children
1204 : * e.g. help buttons in a buttonbox
1205 : */
1206 : bool get_secondary() const;
1207 : void set_secondary(bool bSecondary);
1208 :
1209 : /*
1210 : * Sets a widget property
1211 : *
1212 : * @return false if property is unknown
1213 : */
1214 : virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
1215 :
1216 : /*
1217 : * Sets a font attribute
1218 : *
1219 : * @return false if attribute is unknown
1220 : */
1221 : bool set_font_attribute(const rtl::OString &rKey, const rtl::OString &rValue);
1222 :
1223 : /*
1224 : * Move this widget to be the nNewPosition'd child of its parent
1225 : */
1226 : void reorderWithinParent(sal_uInt16 nNewPosition);
1227 :
1228 : //-------------------------------------
1229 : // Native Widget Rendering functions
1230 : //-------------------------------------
1231 :
1232 : // form controls must never use native widgets, this can be toggled here
1233 : void EnableNativeWidget( sal_Bool bEnable = sal_True );
1234 : sal_Bool IsNativeWidgetEnabled() const;
1235 :
1236 : // a helper method for a Control's Draw method
1237 : void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize );
1238 :
1239 : /* mark Window for deletion in top of event queue
1240 : */
1241 : void doLazyDelete();
1242 :
1243 : //-------------------------------------
1244 : // Keyboard access functions
1245 : //-------------------------------------
1246 :
1247 : /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1248 : Scroll Lock. Use the following mask to retrieve the state of each
1249 : indicator:
1250 :
1251 : INDICATOR_CAPS_LOCK
1252 : INDICATOR_NUM_LOCK
1253 : INDICATOR_SCROLL_LOCK
1254 : */
1255 : sal_uInt16 GetIndicatorState() const;
1256 :
1257 : void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1258 :
1259 : virtual rtl::OUString GetSurroundingText() const;
1260 : virtual Selection GetSurroundingTextSelection() const;
1261 : };
1262 :
1263 :
1264 : #endif // _SV_WINDOW_HXX
1265 :
1266 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|