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