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