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_INC_WINDOW_H
21 : #define INCLUDED_VCL_INC_WINDOW_H
22 :
23 : #include <sal/config.h>
24 :
25 : #include <com/sun/star/uno/Reference.hxx>
26 : #include <cppuhelper/weakref.hxx>
27 : #include <list>
28 : #include <tools/wintypes.hxx>
29 : #include <tools/fract.hxx>
30 : #include <vcl/cursor.hxx>
31 : #include <vcl/inputctx.hxx>
32 : #include <vcl/outdev.hxx>
33 : #include <vcl/pointr.hxx>
34 : #include <vcl/salnativewidgets.hxx>
35 : #include <vcl/timer.hxx>
36 : #include <vcl/idle.hxx>
37 : #include <vcl/vclevent.hxx>
38 : #include <vcl/vclptr.hxx>
39 : #include <vcl/rendersettings.hxx>
40 : #include <vector>
41 :
42 : struct SalPaintEvent;
43 : struct ImplDelData;
44 : struct ImplAccessibleInfos;
45 :
46 : namespace vcl {
47 : class Window;
48 : struct ControlLayoutData;
49 : }
50 :
51 : class FixedText;
52 : class VclSizeGroup;
53 : class VirtualDevice;
54 : class PhysicalFontCollection;
55 : class ImplFontCache;
56 : class VCLXWindow;
57 : class SalFrame;
58 : class SalObject;
59 : enum class MouseEventModifiers;
60 : enum class MouseNotifyEvent;
61 : enum class ActivateModeFlags;
62 : enum class DialogControlFlags;
63 : enum class GetFocusFlags;
64 : enum class ParentClipMode;
65 :
66 : namespace com { namespace sun { namespace star {
67 :
68 : namespace accessibility {
69 : class XAccessible;
70 : }
71 :
72 : namespace rendering {
73 : class XCanvas;
74 : }
75 :
76 : namespace awt {
77 : class XWindowPeer;
78 : class XWindow;
79 : }
80 : namespace uno {
81 : class Any;
82 : class XInterface;
83 : }
84 : namespace datatransfer { namespace clipboard {
85 : class XClipboard;
86 : }
87 :
88 : namespace dnd {
89 : class XDropTargetListener;
90 : class XDragGestureRecognizer;
91 : class XDragSource;
92 : class XDropTarget;
93 : }}}}}
94 :
95 : bool ImplWindowFrameProc( vcl::Window* pInst, SalFrame* pFrame, sal_uInt16 nEvent, const void* pEvent );
96 :
97 : #define WINDOW_HITTEST_INSIDE ((sal_uInt16)0x0001)
98 : #define WINDOW_HITTEST_TRANSPARENT ((sal_uInt16)0x0002)
99 :
100 534605 : struct ImplWinData
101 : {
102 : OUString* mpExtOldText;
103 : sal_uInt16* mpExtOldAttrAry;
104 : Rectangle* mpCursorRect;
105 : long mnCursorExtWidth;
106 : bool mbVertical;
107 : Rectangle* mpCompositionCharRects;
108 : long mnCompositionCharRects;
109 : Rectangle* mpFocusRect;
110 : Rectangle* mpTrackRect;
111 : sal_uInt16 mnTrackFlags;
112 : sal_uInt16 mnIsTopWindow;
113 : bool mbMouseOver; //< tracks mouse over for native widget paint effect
114 : bool mbEnableNativeWidget; //< toggle native widget rendering
115 : ::std::list< VclPtr<vcl::Window> >
116 : maTopWindowChildren;
117 : };
118 :
119 13863 : struct ImplOverlapData
120 : {
121 : VclPtr<VirtualDevice> mpSaveBackDev; //< saved background bitmap
122 : vcl::Region* mpSaveBackRgn; //< saved region, which must be invalidated
123 : VclPtr<vcl::Window> mpNextBackWin; //< next window with saved background
124 : sal_uIntPtr mnSaveBackSize; //< bitmap size of saved background
125 : bool mbSaveBack; //< true: save background
126 : sal_uInt8 mnTopLevel; //< Level for Overlap-Window
127 : };
128 :
129 13863 : struct ImplFrameData
130 : {
131 : Idle maPaintIdle; //< paint idle handler
132 : Idle maResizeIdle; //< resize timer
133 : InputContext maOldInputContext; //< last set Input Context
134 : VclPtr<vcl::Window> mpNextFrame; //< next frame window
135 : VclPtr<vcl::Window> mpFirstOverlap; //< first overlap vcl::Window
136 : VclPtr<vcl::Window> mpFocusWin; //< focus window (is also set, when frame doesn't have the focous)
137 : VclPtr<vcl::Window> mpMouseMoveWin; //< last window, where MouseMove() called
138 : VclPtr<vcl::Window> mpMouseDownWin; //< last window, where MouseButtonDown() called
139 : VclPtr<vcl::Window> mpFirstBackWin; //< first overlap-window with saved background
140 : ::std::vector<VclPtr<vcl::Window> > maOwnerDrawList; //< List of system windows with owner draw decoration
141 : PhysicalFontCollection* mpFontCollection; //< Font-List for this frame
142 : ImplFontCache* mpFontCache; //< Font-Cache for this frame
143 : sal_Int32 mnDPIX; //< Original Screen Resolution
144 : sal_Int32 mnDPIY; //< Original Screen Resolution
145 : ImplMapRes maMapUnitRes; //< for LogicUnitToPixel
146 : sal_uIntPtr mnAllSaveBackSize; //< size of all bitmaps of saved backgrounds
147 : ImplSVEvent * mnFocusId; //< FocusId for PostUserLink
148 : ImplSVEvent * mnMouseMoveId; //< MoveId for PostUserLink
149 : long mnLastMouseX; //< last x mouse position
150 : long mnLastMouseY; //< last y mouse position
151 : long mnBeforeLastMouseX; //< last but one x mouse position
152 : long mnBeforeLastMouseY; //< last but one y mouse position
153 : long mnFirstMouseX; //< first x mouse position by mousebuttondown
154 : long mnFirstMouseY; //< first y mouse position by mousebuttondown
155 : long mnLastMouseWinX; //< last x mouse position, rel. to pMouseMoveWin
156 : long mnLastMouseWinY; //< last y mouse position, rel. to pMouseMoveWin
157 : sal_uInt16 mnModalMode; //< frame based modal count (app based makes no sense anymore)
158 : sal_uInt64 mnMouseDownTime; //< mouse button down time for double click
159 : sal_uInt16 mnClickCount; //< mouse click count
160 : sal_uInt16 mnFirstMouseCode; //< mouse code by mousebuttondown
161 : sal_uInt16 mnMouseCode; //< mouse code
162 : MouseEventModifiers mnMouseMode; //< mouse mode
163 : MapUnit meMapUnit; //< last MapUnit for LogicUnitToPixel
164 : bool mbHasFocus; //< focus
165 : bool mbInMouseMove; //< is MouseMove on stack
166 : bool mbMouseIn; //> is Mouse inside the frame
167 : bool mbStartDragCalled; //< is command startdrag called
168 : bool mbNeedSysWindow; //< set, when FrameSize <= IMPL_MIN_NEEDSYSWIN
169 : bool mbMinimized; //< set, when FrameSize <= 0
170 : bool mbStartFocusState; //< FocusState, when sending the event
171 : bool mbInSysObjFocusHdl; //< within a SysChildren's GetFocus handler
172 : bool mbInSysObjToTopHdl; //< within a SysChildren's ToTop handler
173 : bool mbSysObjFocus; //< does a SysChild have focus
174 :
175 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > mxDragSource;
176 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > mxDropTarget;
177 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
178 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
179 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection;
180 :
181 : bool mbInternalDragGestureRecognizer;
182 : };
183 :
184 : struct ImplAccessibleInfos
185 : {
186 : sal_uInt16 nAccessibleRole;
187 : OUString* pAccessibleName;
188 : OUString* pAccessibleDescription;
189 : VclPtr<vcl::Window> pLabeledByWindow;
190 : VclPtr<vcl::Window> pLabelForWindow;
191 : VclPtr<vcl::Window> pMemberOfWindow;
192 :
193 : ImplAccessibleInfos();
194 : ~ImplAccessibleInfos();
195 : };
196 :
197 : enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1, AlwaysInputDisabled =2 };
198 :
199 : class WindowImpl
200 : {
201 : private:
202 : WindowImpl(const WindowImpl&) SAL_DELETED_FUNCTION;
203 : WindowImpl& operator=(const WindowImpl&) SAL_DELETED_FUNCTION;
204 : public:
205 : WindowImpl( WindowType );
206 : ~WindowImpl();
207 :
208 : ImplWinData* mpWinData;
209 : ImplOverlapData* mpOverlapData;
210 : ImplFrameData* mpFrameData;
211 : SalFrame* mpFrame;
212 : SalObject* mpSysObj;
213 : VclPtr<vcl::Window> mpFrameWindow;
214 : VclPtr<vcl::Window> mpOverlapWindow;
215 : VclPtr<vcl::Window> mpBorderWindow;
216 : VclPtr<vcl::Window> mpClientWindow;
217 : VclPtr<vcl::Window> mpParent;
218 : VclPtr<vcl::Window> mpRealParent;
219 : VclPtr<vcl::Window> mpFirstChild;
220 : VclPtr<vcl::Window> mpLastChild;
221 : VclPtr<vcl::Window> mpFirstOverlap;
222 : VclPtr<vcl::Window> mpLastOverlap;
223 : VclPtr<vcl::Window> mpPrev;
224 : VclPtr<vcl::Window> mpNext;
225 : VclPtr<vcl::Window> mpNextOverlap;
226 : VclPtr<vcl::Window> mpLastFocusWindow;
227 : VclPtr<vcl::Window> mpDlgCtrlDownWindow;
228 : VclEventListeners maEventListeners;
229 : VclEventListeners maChildEventListeners;
230 :
231 : // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
232 : ::com::sun::star::uno::WeakReference< ::com::sun::star::rendering::XCanvas > mxCanvas;
233 :
234 : ImplDelData* mpFirstDel;
235 : void* mpUserData;
236 : vcl::Cursor* mpCursor;
237 : Pointer maPointer;
238 : Fraction maZoom;
239 : OUString maText;
240 : vcl::Font* mpControlFont;
241 : Color maControlForeground;
242 : Color maControlBackground;
243 : sal_Int32 mnLeftBorder;
244 : sal_Int32 mnTopBorder;
245 : sal_Int32 mnRightBorder;
246 : sal_Int32 mnBottomBorder;
247 : sal_Int32 mnWidthRequest;
248 : sal_Int32 mnHeightRequest;
249 : sal_Int32 mnOptimalWidthCache;
250 : sal_Int32 mnOptimalHeightCache;
251 : long mnX;
252 : long mnY;
253 : long mnAbsScreenX;
254 : Point maPos;
255 : OString maHelpId;
256 : OString maUniqId;
257 : OUString maHelpText;
258 : OUString maQuickHelpText;
259 : InputContext maInputContext;
260 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
261 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
262 : std::shared_ptr< VclSizeGroup > m_xSizeGroup;
263 : std::vector< VclPtr<FixedText> > m_aMnemonicLabels;
264 : ImplAccessibleInfos* mpAccessibleInfos;
265 : VCLXWindow* mpVCLXWindow;
266 : vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates)
267 : vcl::Region maWinClipRegion; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates)
268 : vcl::Region maInvalidateRegion; //< region that has to be redrawn (frame coordinates)
269 : vcl::Region* mpChildClipRegion; //< child clip region if CLIPCHILDREN is set (frame coordinates)
270 : vcl::Region* mpPaintRegion; //< only set during Paint() method call (window coordinates)
271 : WinBits mnStyle;
272 : WinBits mnPrevStyle;
273 : WinBits mnExtendedStyle;
274 : WinBits mnPrevExtendedStyle;
275 : WindowType mnType;
276 : ControlPart mnNativeBackground;
277 : sal_uInt16 mnWaitCount;
278 : sal_uInt16 mnPaintFlags;
279 : GetFocusFlags mnGetFocusFlags;
280 : ParentClipMode mnParentClipMode;
281 : ActivateModeFlags mnActivateMode;
282 : DialogControlFlags mnDlgCtrlFlags;
283 : sal_uInt16 mnLockCount;
284 : AlwaysInputMode meAlwaysInputMode;
285 : VclAlign meHalign;
286 : VclAlign meValign;
287 : VclPackType mePackType;
288 : sal_Int32 mnPadding;
289 : sal_Int32 mnGridHeight;
290 : sal_Int32 mnGridLeftAttach;
291 : sal_Int32 mnGridTopAttach;
292 : sal_Int32 mnGridWidth;
293 : sal_Int32 mnBorderWidth;
294 : sal_Int32 mnMarginLeft;
295 : sal_Int32 mnMarginRight;
296 : sal_Int32 mnMarginTop;
297 : sal_Int32 mnMarginBottom;
298 : bool mbFrame:1,
299 : mbBorderWin:1,
300 : mbOverlapWin:1,
301 : mbSysWin:1,
302 : mbDialog:1,
303 : mbDockWin:1,
304 : mbFloatWin:1,
305 : mbPushButton:1,
306 : mbVisible:1,
307 : mbDisabled:1,
308 : mbInputDisabled:1,
309 : mbDropDisabled:1,
310 : mbNoUpdate:1,
311 : mbNoParentUpdate:1,
312 : mbActive:1,
313 : mbParentActive:1,
314 : mbReallyVisible:1,
315 : mbReallyShown:1,
316 : mbInInitShow:1,
317 : mbChildNotify:1,
318 : mbChildPtrOverwrite:1,
319 : mbNoPtrVisible:1,
320 : mbPaintFrame:1,
321 : mbInPaint:1,
322 : mbMouseMove:1,
323 : mbMouseButtonDown:1,
324 : mbMouseButtonUp:1,
325 : mbKeyInput:1,
326 : mbKeyUp:1,
327 : mbCommand:1,
328 : mbDefPos:1,
329 : mbDefSize:1,
330 : mbCallMove:1,
331 : mbCallResize:1,
332 : mbWaitSystemResize:1,
333 : mbInitWinClipRegion:1,
334 : mbInitChildRegion:1,
335 : mbWinRegion:1,
336 : mbClipChildren:1,
337 : mbClipSiblings:1,
338 : mbChildTransparent:1,
339 : mbPaintTransparent:1,
340 : mbMouseTransparent:1,
341 : mbDlgCtrlStart:1,
342 : mbFocusVisible:1,
343 : mbTrackVisible:1,
344 : mbUseNativeFocus:1,
345 : mbNativeFocusVisible:1,
346 : mbInShowFocus:1,
347 : mbInHideFocus:1,
348 : mbControlForeground:1,
349 : mbControlBackground:1,
350 : mbAlwaysOnTop:1,
351 : mbCompoundControl:1,
352 : mbCompoundControlHasFocus:1,
353 : mbPaintDisabled:1,
354 : mbAllResize:1,
355 : mbInDispose:1,
356 : mbExtTextInput:1,
357 : mbInFocusHdl:1,
358 : mbOverlapVisible:1,
359 : mbCreatedWithToolkit:1,
360 : mbToolBox:1,
361 : mbSplitter:1,
362 : mbSuppressAccessibilityEvents:1,
363 : mbMenuFloatingWindow:1,
364 : mbDrawSelectionBackground:1,
365 : mbIsInTaskPaneList:1,
366 : mbToolbarFloatingWindow:1,
367 : mbCallHandlersDuringInputDisabled:1,
368 : mbHelpTextDynamic:1,
369 : mbFakeFocusSet:1,
370 : mbHexpand:1,
371 : mbVexpand:1,
372 : mbExpand:1,
373 : mbFill:1,
374 : mbSecondary:1,
375 : mbNonHomogeneous:1,
376 : mbDoubleBuffering:1;
377 :
378 : vcl::RenderSettings maRenderSettings;
379 :
380 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
381 : };
382 :
383 : // helper methods
384 :
385 : bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave,
386 : long nX, long nY, sal_uInt64 nMsgTime,
387 : sal_uInt16 nCode, MouseEventModifiers nMode );
388 : void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
389 :
390 : #endif // INCLUDED_VCL_INC_WINDOW_H
391 :
392 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|