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