Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SV_WINDOW_H
21 : #define _SV_WINDOW_H
22 :
23 : #include <vector>
24 : #include <tools/solar.h>
25 : #include <vcl/outdev.hxx>
26 : #include <vcl/timer.hxx>
27 : #ifndef _SV_INPUTCTX_HXX
28 : #include <vcl/inputctx.hxx>
29 : #endif
30 : #ifndef _SV_POINTR_HXX
31 : #include <vcl/pointr.hxx>
32 : #endif
33 : #include <tools/wintypes.hxx>
34 : #include <vcl/vclevent.hxx>
35 : #include <com/sun/star/uno/Reference.hxx>
36 : #include <cppuhelper/weakref.hxx>
37 :
38 : #include <vcl/salnativewidgets.hxx>
39 :
40 : #include <list>
41 :
42 : struct SalPaintEvent;
43 : struct ImplDelData;
44 : struct ImplAccessibleInfos;
45 :
46 : class Window;
47 : class VirtualDevice;
48 : class Cursor;
49 : class ImplDevFontList;
50 : class ImplFontCache;
51 : class VCLXWindow;
52 : class SalFrame;
53 : class SalObject;
54 :
55 :
56 : namespace com {
57 : namespace sun {
58 : namespace star {
59 : namespace accessibility {
60 : class XAccessible;
61 : }}}}
62 :
63 : namespace com {
64 : namespace sun {
65 : namespace star {
66 : namespace rendering {
67 : class XCanvas;
68 : }}}}
69 :
70 : namespace com {
71 : namespace sun {
72 : namespace star {
73 : namespace awt {
74 : class XWindowPeer;
75 : class XWindow;
76 : }
77 : namespace uno {
78 : class Any;
79 : class XInterface;
80 : }
81 : namespace datatransfer {
82 : namespace clipboard {
83 : class XClipboard;
84 : }
85 :
86 : namespace dnd {
87 : class XDropTargetListener;
88 : class XDragGestureRecognizer;
89 : class XDragSource;
90 : class XDropTarget;
91 : } } } } }
92 :
93 : namespace vcl {
94 : struct ControlLayoutData;
95 : }
96 :
97 :
98 : // --------------
99 : // - Prototypes -
100 : // --------------
101 :
102 : long ImplWindowFrameProc( Window* pInst, SalFrame* pFrame, sal_uInt16 nEvent, const void* pEvent );
103 :
104 : // -----------
105 : // - HitTest -
106 : // -----------
107 :
108 : #define WINDOW_HITTEST_INSIDE ((sal_uInt16)0x0001)
109 : #define WINDOW_HITTEST_TRANSPARENT ((sal_uInt16)0x0002)
110 :
111 : // ---------------
112 : // - ImplWinData -
113 : // ---------------
114 :
115 10591 : struct ImplWinData
116 : {
117 : UniString* mpExtOldText;
118 : sal_uInt16* mpExtOldAttrAry;
119 : Rectangle* mpCursorRect;
120 : long mnCursorExtWidth;
121 : Rectangle* mpFocusRect;
122 : Rectangle* mpTrackRect;
123 : sal_uInt16 mnTrackFlags;
124 : sal_uInt16 mnIsTopWindow;
125 : sal_Bool mbMouseOver; // tracks mouse over for native widget paint effect
126 : sal_Bool mbEnableNativeWidget; // toggle native widget rendering
127 : ::std::list< Window* >
128 : maTopWindowChildren;
129 : };
130 :
131 : // -------------------
132 : // - ImplOverlapData -
133 : // -------------------
134 :
135 : struct ImplOverlapData
136 : {
137 : VirtualDevice* mpSaveBackDev; // Gesicherte Hintergrund-Bitmap
138 : Region* mpSaveBackRgn; // Gesicherte Region, was invalidiert werden muss
139 : Window* mpNextBackWin; // Naechstes Fenster mit Hintergrund-Sicherung
140 : sal_uIntPtr mnSaveBackSize; // Groesse Bitmap fuer Hintergrund-Sicherung
141 : sal_Bool mbSaveBack; // sal_True: Background sichern
142 : sal_uInt8 mnTopLevel; // Level for Overlap-Window
143 : };
144 :
145 : // -----------------
146 : // - ImplFrameData -
147 : // -----------------
148 :
149 334 : struct ImplFrameData
150 : {
151 : Timer maPaintTimer; // paint timer
152 : Timer maResizeTimer; // resize timer
153 : InputContext maOldInputContext; // Last set Input Context
154 : Window* mpNextFrame; // next frame window
155 : Window* mpFirstOverlap; // first overlap window
156 : Window* mpFocusWin; // focus window (is also set, when frame doesn't have the focous)
157 : Window* mpMouseMoveWin; // last window, where MouseMove() called
158 : Window* mpMouseDownWin; // last window, where MouseButtonDown() called
159 : Window* mpFirstBackWin; // Erstes Overlap-Window mit Hintergrund-Sicherung
160 : ::std::vector<Window *> maOwnerDrawList; // List of system windows with owner draw decoration
161 : ImplDevFontList* mpFontList; // Font-List for this frame
162 : ImplFontCache* mpFontCache; // Font-Cache for this frame
163 : sal_Int32 mnDPIX; // Original Screen Resolution
164 : sal_Int32 mnDPIY; // Original Screen Resolution
165 : ImplMapRes maMapUnitRes; // for LogicUnitToPixel
166 : sal_uIntPtr mnAllSaveBackSize; // Groesse aller Bitmaps fuer Hintergrund-Sicherung
167 : sal_uIntPtr mnFocusId; // FocusId for PostUserLink
168 : sal_uIntPtr mnMouseMoveId; // MoveId for PostUserLink
169 : long mnLastMouseX; // last x mouse position
170 : long mnLastMouseY; // last y mouse position
171 : long mnBeforeLastMouseX; // last but one x mouse position
172 : long mnBeforeLastMouseY; // last but one y mouse position
173 : long mnFirstMouseX; // first x mouse position by mousebuttondown
174 : long mnFirstMouseY; // first y mouse position by mousebuttondown
175 : long mnLastMouseWinX; // last x mouse position, rel. to pMouseMoveWin
176 : long mnLastMouseWinY; // last y mouse position, rel. to pMouseMoveWin
177 : sal_uInt16 mnModalMode; // frame based modal count (app based makes no sense anymore)
178 : sal_uIntPtr mnMouseDownTime; // mouse button down time for double click
179 : sal_uInt16 mnClickCount; // mouse click count
180 : sal_uInt16 mnFirstMouseCode; // mouse code by mousebuttondown
181 : sal_uInt16 mnMouseCode; // mouse code
182 : sal_uInt16 mnMouseMode; // mouse mode
183 : MapUnit meMapUnit; // last MapUnit for LogicUnitToPixel
184 : sal_Bool mbHasFocus; // focus
185 : sal_Bool mbInMouseMove; // is MouseMove on stack
186 : sal_Bool mbMouseIn; // is Mouse inside the frame
187 : sal_Bool mbStartDragCalled; // is command startdrag called
188 : sal_Bool mbNeedSysWindow; // set, when FrameSize <= IMPL_MIN_NEEDSYSWIN
189 : sal_Bool mbMinimized; // set, when FrameSize <= 0
190 : sal_Bool mbStartFocusState; // FocusState, beim abschicken des Events
191 : sal_Bool mbInSysObjFocusHdl; // Innerhalb vom GetFocus-Handler eines SysChildren
192 : sal_Bool mbInSysObjToTopHdl; // Innerhalb vom ToTop-Handler eines SysChildren
193 : sal_Bool mbSysObjFocus; // Hat ein SysChild den Focus
194 :
195 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > mxDragSource;
196 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > mxDropTarget;
197 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
198 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
199 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection;
200 :
201 : sal_Bool mbInternalDragGestureRecognizer;
202 : };
203 :
204 : // -----------------------
205 : // - ImplAccessibleInfos -
206 : // -----------------------
207 :
208 : struct ImplAccessibleInfos
209 : {
210 : sal_uInt16 nAccessibleRole;
211 : String* pAccessibleName;
212 : String* pAccessibleDescription;
213 : Window* pLabeledByWindow;
214 : Window* pLabelForWindow;
215 : Window* pMemberOfWindow;
216 :
217 : ImplAccessibleInfos();
218 : ~ImplAccessibleInfos();
219 : };
220 :
221 :
222 : // ---------------
223 : // - WindowImpl -
224 : // ---------------
225 :
226 : enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1, AlwaysInputDisabled =2 };
227 :
228 : class WindowImpl
229 : {
230 : public:
231 : WindowImpl();
232 : ~WindowImpl();
233 :
234 : ImplWinData* mpWinData;
235 : ImplOverlapData* mpOverlapData;
236 : ImplFrameData* mpFrameData;
237 : SalFrame* mpFrame;
238 : SalObject* mpSysObj;
239 : Window* mpFrameWindow;
240 : Window* mpOverlapWindow;
241 : Window* mpBorderWindow;
242 : Window* mpClientWindow;
243 : Window* mpParent;
244 : Window* mpRealParent;
245 : Window* mpFirstChild;
246 : Window* mpLastChild;
247 : Window* mpFirstOverlap;
248 : Window* mpLastOverlap;
249 : Window* mpPrev;
250 : Window* mpNext;
251 : Window* mpNextOverlap;
252 : Window* mpLastFocusWindow;
253 : Window* mpDlgCtrlDownWindow;
254 : VclEventListeners maEventListeners;
255 : VclEventListeners maChildEventListeners;
256 :
257 : // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
258 : ::com::sun::star::uno::WeakReference< ::com::sun::star::rendering::XCanvas > mxCanvas;
259 :
260 : ImplDelData* mpFirstDel;
261 : void* mpUserData;
262 : Cursor* mpCursor;
263 : Pointer maPointer;
264 : Fraction maZoom;
265 : XubString maText;
266 : Font* mpControlFont;
267 : Color maControlForeground;
268 : Color maControlBackground;
269 : sal_Int32 mnLeftBorder;
270 : sal_Int32 mnTopBorder;
271 : sal_Int32 mnRightBorder;
272 : sal_Int32 mnBottomBorder;
273 : sal_Int32 mnWidthRequest;
274 : sal_Int32 mnHeightRequest;
275 : long mnX;
276 : long mnY;
277 : long mnAbsScreenX;
278 : Point maPos;
279 : rtl::OString maHelpId;
280 : rtl::OString maUniqId;
281 : XubString maHelpText;
282 : XubString maQuickHelpText;
283 : InputContext maInputContext;
284 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
285 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
286 : ImplAccessibleInfos* mpAccessibleInfos;
287 : VCLXWindow* mpVCLXWindow;
288 : Region maWinRegion; // region to 'shape' the VCL window (frame coordinates)
289 : Region maWinClipRegion; // the (clipping) region that finally corresponds to the VCL window (frame coordinates)
290 : Region maInvalidateRegion; // region that has to be redrawn (frame coordinates)
291 : Region* mpChildClipRegion; // child clip region if CLIPCHILDREN is set (frame coordinates)
292 : Region* mpPaintRegion; // only set during Paint() method call (window coordinates)
293 : WinBits mnStyle;
294 : WinBits mnPrevStyle;
295 : WinBits mnExtendedStyle;
296 : WinBits mnPrevExtendedStyle;
297 : WindowType mnType;
298 : ControlPart mnNativeBackground;
299 : sal_uInt16 mnWaitCount;
300 : sal_uInt16 mnPaintFlags;
301 : sal_uInt16 mnGetFocusFlags;
302 : sal_uInt16 mnParentClipMode;
303 : sal_uInt16 mnActivateMode;
304 : sal_uInt16 mnDlgCtrlFlags;
305 : sal_uInt16 mnLockCount;
306 : AlwaysInputMode meAlwaysInputMode;
307 : VclAlign meHalign;
308 : VclAlign meValign;
309 : VclPackType mePackType;
310 : sal_Int32 mnPadding;
311 : sal_Int32 mnGridHeight;
312 : sal_Int32 mnGridLeftAttach;
313 : sal_Int32 mnGridTopAttach;
314 : sal_Int32 mnGridWidth;
315 : sal_Int32 mnBorderWidth;
316 : sal_Int32 mnMarginLeft;
317 : sal_Int32 mnMarginRight;
318 : sal_Int32 mnMarginTop;
319 : sal_Int32 mnMarginBottom;
320 : sal_uInt8 mbFrame:1,
321 : mbBorderWin:1,
322 : mbOverlapWin:1,
323 : mbSysWin:1,
324 : mbDialog:1,
325 : mbDockWin:1,
326 : mbFloatWin:1,
327 : mbPushButton:1,
328 : mbVisible:1,
329 : mbDisabled:1,
330 : mbInputDisabled:1,
331 : mbDropDisabled:1,
332 : mbNoUpdate:1,
333 : mbNoParentUpdate:1,
334 : mbActive:1,
335 : mbParentActive:1,
336 : mbReallyVisible:1,
337 : mbReallyShown:1,
338 : mbInInitShow:1,
339 : mbChildNotify:1,
340 : mbChildPtrOverwrite:1,
341 : mbNoPtrVisible:1,
342 : mbPaintFrame:1,
343 : mbInPaint:1,
344 : mbMouseMove:1,
345 : mbMouseButtonDown:1,
346 : mbMouseButtonUp:1,
347 : mbKeyInput:1,
348 : mbKeyUp:1,
349 : mbCommand:1,
350 : mbDefPos:1,
351 : mbDefSize:1,
352 : mbCallMove:1,
353 : mbCallResize:1,
354 : mbWaitSystemResize:1,
355 : mbInitWinClipRegion:1,
356 : mbInitChildRegion:1,
357 : mbWinRegion:1,
358 : mbClipChildren:1,
359 : mbClipSiblings:1,
360 : mbChildTransparent:1,
361 : mbPaintTransparent:1,
362 : mbMouseTransparent:1,
363 : mbDlgCtrlStart:1,
364 : mbFocusVisible:1,
365 : mbTrackVisible:1,
366 : mbUseNativeFocus:1,
367 : mbNativeFocusVisible:1,
368 : mbInShowFocus:1,
369 : mbInHideFocus:1,
370 : mbControlForeground:1,
371 : mbControlBackground:1,
372 : mbAlwaysOnTop:1,
373 : mbCompoundControl:1,
374 : mbCompoundControlHasFocus:1,
375 : mbPaintDisabled:1,
376 : mbAllResize:1,
377 : mbInDtor:1,
378 : mbExtTextInput:1,
379 : mbInFocusHdl:1,
380 : mbOverlapVisible:1,
381 : mbCreatedWithToolkit:1,
382 : mbToolBox:1,
383 : mbSplitter:1,
384 : mbSuppressAccessibilityEvents:1,
385 : mbMenuFloatingWindow:1,
386 : mbDrawSelectionBackground:1,
387 : mbIsInTaskPaneList:1,
388 : mbToolbarFloatingWindow:1,
389 : mbCallHandlersDuringInputDisabled:1,
390 : mbDisableAccessibleLabelForRelation:1,
391 : mbDisableAccessibleLabeledByRelation:1,
392 : mbHelpTextDynamic:1,
393 : mbFakeFocusSet:1,
394 : mbHexpand:1,
395 : mbVexpand:1,
396 : mbExpand:1,
397 : mbFill:1,
398 : mbSecondary:1;
399 :
400 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
401 : };
402 :
403 : // -----------------
404 : // - Hilfsmethoden -
405 : // -----------------
406 :
407 : long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouseLeave,
408 : long nX, long nY, sal_uIntPtr nMsgTime,
409 : sal_uInt16 nCode, sal_uInt16 nMode );
410 : void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
411 :
412 : #endif // _SV_WINDOW_H
413 :
414 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|