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