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