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