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