19f62ea84SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 39f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 49f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file 59f62ea84SAndrew Rist * distributed with this work for additional information 69f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file 79f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the 89f62ea84SAndrew Rist * "License"); you may not use this file except in compliance 99f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 119f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 139f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing, 149f62ea84SAndrew Rist * software distributed under the License is distributed on an 159f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169f62ea84SAndrew Rist * KIND, either express or implied. See the License for the 179f62ea84SAndrew Rist * specific language governing permissions and limitations 189f62ea84SAndrew Rist * under the License. 19cdf0e10cSrcweir * 209f62ea84SAndrew Rist *************************************************************/ 219f62ea84SAndrew Rist 229f62ea84SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_vcl.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "tools/time.hxx" 28cdf0e10cSrcweir #include "tools/debug.hxx" 29cdf0e10cSrcweir #include "tools/rc.h" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "unotools/fontcfg.hxx" 32cdf0e10cSrcweir #include "unotools/confignode.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include "vcl/unohelp.hxx" 35cdf0e10cSrcweir #include "vcl/salgtype.hxx" 36cdf0e10cSrcweir #include "vcl/event.hxx" 37cdf0e10cSrcweir #include "vcl/help.hxx" 38cdf0e10cSrcweir #include "vcl/cursor.hxx" 39cdf0e10cSrcweir #include "vcl/svapp.hxx" 40cdf0e10cSrcweir #include "vcl/window.hxx" 41cdf0e10cSrcweir #include "vcl/syswin.hxx" 42cdf0e10cSrcweir #include "vcl/syschild.hxx" 43cdf0e10cSrcweir #include "vcl/dockwin.hxx" 44cdf0e10cSrcweir #include "vcl/menu.hxx" 45cdf0e10cSrcweir #include "vcl/wrkwin.hxx" 46cdf0e10cSrcweir #include "vcl/wall.hxx" 47cdf0e10cSrcweir #include "vcl/gradient.hxx" 48cdf0e10cSrcweir #include "vcl/salctype.hxx" 49cdf0e10cSrcweir #include "vcl/button.hxx" 50cdf0e10cSrcweir #include "vcl/taskpanelist.hxx" 51cdf0e10cSrcweir #include "vcl/dialog.hxx" 52cdf0e10cSrcweir #include "vcl/unowrap.hxx" 53cdf0e10cSrcweir #include "vcl/gdimtf.hxx" 54cdf0e10cSrcweir #include "vcl/pdfextoutdevdata.hxx" 55cdf0e10cSrcweir #include "vcl/lazydelete.hxx" 56cdf0e10cSrcweir 57cdf0e10cSrcweir // declare system types in sysdata.hxx 58cdf0e10cSrcweir #include "svsys.h" 59cdf0e10cSrcweir #include "vcl/sysdata.hxx" 60cdf0e10cSrcweir 61cdf0e10cSrcweir #include "salframe.hxx" 62cdf0e10cSrcweir #include "salobj.hxx" 63cdf0e10cSrcweir #include "salinst.hxx" 64cdf0e10cSrcweir #include "salgdi.hxx" 65cdf0e10cSrcweir #include "svdata.hxx" 66cdf0e10cSrcweir #include "dbggui.hxx" 67cdf0e10cSrcweir #include "outfont.hxx" 68cdf0e10cSrcweir #include "window.h" 69cdf0e10cSrcweir #include "toolbox.h" 70cdf0e10cSrcweir #include "outdev.h" 71cdf0e10cSrcweir #include "brdwin.hxx" 72cdf0e10cSrcweir #include "helpwin.hxx" 73cdf0e10cSrcweir #include "sallayout.hxx" 74cdf0e10cSrcweir #include "dndlcon.hxx" 75cdf0e10cSrcweir #include "dndevdis.hxx" 76cdf0e10cSrcweir 77cdf0e10cSrcweir #include "com/sun/star/awt/XWindowPeer.hpp" 78cdf0e10cSrcweir #include "com/sun/star/rendering/XCanvas.hpp" 79cdf0e10cSrcweir #include "com/sun/star/rendering/XSpriteCanvas.hpp" 80cdf0e10cSrcweir #include "com/sun/star/awt/XWindow.hpp" 81cdf0e10cSrcweir #include "comphelper/processfactory.hxx" 82cdf0e10cSrcweir #include "com/sun/star/datatransfer/dnd/XDragSource.hpp" 83cdf0e10cSrcweir #include "com/sun/star/datatransfer/dnd/XDropTarget.hpp" 84cdf0e10cSrcweir #include "com/sun/star/datatransfer/clipboard/XClipboard.hpp" 85cdf0e10cSrcweir #include "com/sun/star/awt/XTopWindow.hpp" 86cdf0e10cSrcweir #include "com/sun/star/awt/XDisplayConnection.hpp" 87cdf0e10cSrcweir #include "com/sun/star/lang/XInitialization.hpp" 88cdf0e10cSrcweir #include "com/sun/star/lang/XComponent.hpp" 89cdf0e10cSrcweir #include "com/sun/star/lang/XServiceName.hpp" 90cdf0e10cSrcweir #include "com/sun/star/accessibility/XAccessible.hpp" 91cdf0e10cSrcweir #include "com/sun/star/accessibility/AccessibleRole.hpp" 92cdf0e10cSrcweir 93cdf0e10cSrcweir #include <set> 94cdf0e10cSrcweir #include <typeinfo> 95cdf0e10cSrcweir 96cdf0e10cSrcweir using namespace rtl; 97cdf0e10cSrcweir using namespace ::com::sun::star::uno; 98cdf0e10cSrcweir using namespace ::com::sun::star::lang; 99cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::clipboard; 100cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::dnd; 101cdf0e10cSrcweir using namespace ::com::sun::star; 102cdf0e10cSrcweir using namespace com::sun; 103cdf0e10cSrcweir 104cdf0e10cSrcweir using ::com::sun::star::awt::XTopWindow; 105cdf0e10cSrcweir 106cdf0e10cSrcweir // ======================================================================= 107cdf0e10cSrcweir 108cdf0e10cSrcweir DBG_NAME( Window ) 109cdf0e10cSrcweir 110cdf0e10cSrcweir // ======================================================================= 111cdf0e10cSrcweir 112cdf0e10cSrcweir #define IMPL_PAINT_PAINT ((sal_uInt16)0x0001) 113cdf0e10cSrcweir #define IMPL_PAINT_PAINTALL ((sal_uInt16)0x0002) 114cdf0e10cSrcweir #define IMPL_PAINT_PAINTALLCHILDS ((sal_uInt16)0x0004) 115cdf0e10cSrcweir #define IMPL_PAINT_PAINTCHILDS ((sal_uInt16)0x0008) 116cdf0e10cSrcweir #define IMPL_PAINT_ERASE ((sal_uInt16)0x0010) 117cdf0e10cSrcweir #define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020) 118cdf0e10cSrcweir 119cdf0e10cSrcweir // ----------------------------------------------------------------------- 120cdf0e10cSrcweir 121cdf0e10cSrcweir typedef Window* PWINDOW; 122cdf0e10cSrcweir 123cdf0e10cSrcweir // ----------------------------------------------------------------------- 124cdf0e10cSrcweir 125cdf0e10cSrcweir struct ImplCalcToTopData 126cdf0e10cSrcweir { 127cdf0e10cSrcweir ImplCalcToTopData* mpNext; 128cdf0e10cSrcweir Window* mpWindow; 129cdf0e10cSrcweir Region* mpInvalidateRegion; 130cdf0e10cSrcweir }; 131cdf0e10cSrcweir 132cdf0e10cSrcweir ImplAccessibleInfos::ImplAccessibleInfos() 133cdf0e10cSrcweir { 134cdf0e10cSrcweir nAccessibleRole = 0xFFFF; 135cdf0e10cSrcweir pAccessibleName = NULL; 136cdf0e10cSrcweir pAccessibleDescription = NULL; 137cdf0e10cSrcweir pLabeledByWindow = NULL; 138cdf0e10cSrcweir pLabelForWindow = NULL; 139cdf0e10cSrcweir pMemberOfWindow = NULL; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir ImplAccessibleInfos::~ImplAccessibleInfos() 143cdf0e10cSrcweir { 144cdf0e10cSrcweir delete pAccessibleName; 145cdf0e10cSrcweir delete pAccessibleDescription; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir // ----------------------------------------------------------------------- 149cdf0e10cSrcweir 150cf06609aSHerbert Dürr WindowImpl::WindowImpl( WindowType nType ) 151cdf0e10cSrcweir { 152cf06609aSHerbert Dürr maZoom = Fraction( 1, 1 ); 153e6f63103SArmin Le Grand maWinRegion = Region(true); 154e6f63103SArmin Le Grand maWinClipRegion = Region(true); 155cf06609aSHerbert Dürr mpWinData = NULL; // Extra Window Data, that we dont need for all windows 156cf06609aSHerbert Dürr mpOverlapData = NULL; // Overlap Data 157cf06609aSHerbert Dürr mpFrameData = NULL; // Frame Data 158cf06609aSHerbert Dürr mpFrame = NULL; // Pointer to frame window 159cf06609aSHerbert Dürr mpSysObj = NULL; 160cf06609aSHerbert Dürr mpFrameWindow = NULL; // window to top level parent (same as frame window) 161cf06609aSHerbert Dürr mpOverlapWindow = NULL; // first overlap parent 162cf06609aSHerbert Dürr mpBorderWindow = NULL; // Border-Window 163cf06609aSHerbert Dürr mpClientWindow = NULL; // Client-Window of a FrameWindow 164cf06609aSHerbert Dürr mpParent = NULL; // parent (inkl. BorderWindow) 165cf06609aSHerbert Dürr mpRealParent = NULL; // real parent (exkl. BorderWindow) 166cf06609aSHerbert Dürr mpFirstChild = NULL; // first child window 167cf06609aSHerbert Dürr mpLastChild = NULL; // last child window 168cf06609aSHerbert Dürr mpFirstOverlap = NULL; // first overlap window (only set in overlap windows) 169cf06609aSHerbert Dürr mpLastOverlap = NULL; // last overlap window (only set in overlap windows) 170cf06609aSHerbert Dürr mpPrev = NULL; // prev window 171cf06609aSHerbert Dürr mpNext = NULL; // next window 172cf06609aSHerbert Dürr mpNextOverlap = NULL; // next overlap window of frame 173cf06609aSHerbert Dürr mpLastFocusWindow = NULL; // window for focus restore 174cf06609aSHerbert Dürr mpDlgCtrlDownWindow = NULL; // window for dialog control 175cf06609aSHerbert Dürr mpFirstDel = NULL; // Dtor notification list 176cf06609aSHerbert Dürr mpUserData = NULL; // user data 177cf06609aSHerbert Dürr mpExtImpl = NULL; // extended implementation data 178cf06609aSHerbert Dürr mpCursor = NULL; // cursor 179cf06609aSHerbert Dürr mpControlFont = NULL; // font propertie 180cf06609aSHerbert Dürr mpVCLXWindow = NULL; 181cf06609aSHerbert Dürr mpAccessibleInfos = NULL; 182cf06609aSHerbert Dürr maControlForeground = Color( COL_TRANSPARENT ); // foreground color not set 183cf06609aSHerbert Dürr maControlBackground = Color( COL_TRANSPARENT ); // background color not set 184cf06609aSHerbert Dürr mnLeftBorder = 0; // left border 185cf06609aSHerbert Dürr mnTopBorder = 0; // top border 186cf06609aSHerbert Dürr mnRightBorder = 0; // right border 187cf06609aSHerbert Dürr mnBottomBorder = 0; // bottom border 188cf06609aSHerbert Dürr mnX = 0; // X-Position to Parent 189cf06609aSHerbert Dürr mnY = 0; // Y-Position to Parent 190cf06609aSHerbert Dürr mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning 191cf06609aSHerbert Dürr mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren 192cf06609aSHerbert Dürr mpPaintRegion = NULL; // Paint-ClipRegion 193cf06609aSHerbert Dürr mnStyle = 0; // style (init in ImplInitWindow) 194cf06609aSHerbert Dürr mnPrevStyle = 0; // prevstyle (set in SetStyle) 195cf06609aSHerbert Dürr mnExtendedStyle = 0; // extended style (init in ImplInitWindow) 196cf06609aSHerbert Dürr mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle) 197cf06609aSHerbert Dürr mnType = nType; // window type 198cf06609aSHerbert Dürr mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf 199cf06609aSHerbert Dürr mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer) 200cf06609aSHerbert Dürr mnPaintFlags = 0; // Flags for ImplCallPaint 201cf06609aSHerbert Dürr mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode 202cf06609aSHerbert Dürr mnActivateMode = 0; // Wird bei System/Overlap-Windows umgesetzt 203cf06609aSHerbert Dürr mnDlgCtrlFlags = 0; // DialogControl-Flags 204cf06609aSHerbert Dürr mnLockCount = 0; // LockCount 205cf06609aSHerbert Dürr meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called 206cf06609aSHerbert Dürr mbFrame = sal_False; // sal_True: Window is a frame window 207cf06609aSHerbert Dürr mbBorderWin = sal_False; // sal_True: Window is a border window 208cf06609aSHerbert Dürr mbOverlapWin = sal_False; // sal_True: Window is a overlap window 209cf06609aSHerbert Dürr mbSysWin = sal_False; // sal_True: SystemWindow is the base class 210cf06609aSHerbert Dürr mbDialog = sal_False; // sal_True: Dialog is the base class 211cf06609aSHerbert Dürr mbDockWin = sal_False; // sal_True: DockingWindow is the base class 212cf06609aSHerbert Dürr mbFloatWin = sal_False; // sal_True: FloatingWindow is the base class 213cf06609aSHerbert Dürr mbPushButton = sal_False; // sal_True: PushButton is the base class 214cf06609aSHerbert Dürr mbToolBox = sal_False; // sal_True: ToolBox is the base class 215cf06609aSHerbert Dürr mbMenuFloatingWindow= sal_False; // sal_True: MenuFloatingWindow is the base class 216cf06609aSHerbert Dürr mbToolbarFloatingWindow= sal_False; // sal_True: ImplPopupFloatWin is the base class, used for subtoolbars 217cf06609aSHerbert Dürr mbSplitter = sal_False; // sal_True: Splitter is the base class 218cf06609aSHerbert Dürr mbVisible = sal_False; // sal_True: Show( sal_True ) called 219cf06609aSHerbert Dürr mbOverlapVisible = sal_False; // sal_True: Hide called for visible window from ImplHideAllOverlapWindow() 220cf06609aSHerbert Dürr mbDisabled = sal_False; // sal_True: Enable( sal_False ) called 221cf06609aSHerbert Dürr mbInputDisabled = sal_False; // sal_True: EnableInput( sal_False ) called 222cf06609aSHerbert Dürr mbDropDisabled = sal_False; // sal_True: Drop is enabled 223cf06609aSHerbert Dürr mbNoUpdate = sal_False; // sal_True: SetUpdateMode( sal_False ) called 224cf06609aSHerbert Dürr mbNoParentUpdate = sal_False; // sal_True: SetParentUpdateMode( sal_False ) called 225cf06609aSHerbert Dürr mbActive = sal_False; // sal_True: Window Active 226cf06609aSHerbert Dürr mbParentActive = sal_False; // sal_True: OverlapActive from Parent 227cf06609aSHerbert Dürr mbReallyVisible = sal_False; // sal_True: this and all parents to an overlaped window are visible 228cf06609aSHerbert Dürr mbReallyShown = sal_False; // sal_True: this and all parents to an overlaped window are shown 229cf06609aSHerbert Dürr mbInInitShow = sal_False; // sal_True: we are in InitShow 230cf06609aSHerbert Dürr mbChildNotify = sal_False; // sal_True: ChildNotify 231cf06609aSHerbert Dürr mbChildPtrOverwrite = sal_False; // sal_True: PointerStyle overwrites Child-Pointer 232cf06609aSHerbert Dürr mbNoPtrVisible = sal_False; // sal_True: ShowPointer( sal_False ) called 233cf06609aSHerbert Dürr mbMouseMove = sal_False; // sal_True: BaseMouseMove called 234cf06609aSHerbert Dürr mbPaintFrame = sal_False; // sal_True: Paint is visible, but not painted 235cf06609aSHerbert Dürr mbInPaint = sal_False; // sal_True: Inside PaintHdl 236cf06609aSHerbert Dürr mbMouseButtonDown = sal_False; // sal_True: BaseMouseButtonDown called 237cf06609aSHerbert Dürr mbMouseButtonUp = sal_False; // sal_True: BaseMouseButtonUp called 238cf06609aSHerbert Dürr mbKeyInput = sal_False; // sal_True: BaseKeyInput called 239cf06609aSHerbert Dürr mbKeyUp = sal_False; // sal_True: BaseKeyUp called 240cf06609aSHerbert Dürr mbCommand = sal_False; // sal_True: BaseCommand called 241cf06609aSHerbert Dürr mbDefPos = sal_True; // sal_True: Position is not Set 242cf06609aSHerbert Dürr mbDefSize = sal_True; // sal_True: Size is not Set 243cf06609aSHerbert Dürr mbCallMove = sal_True; // sal_True: Move must be called by Show 244cf06609aSHerbert Dürr mbCallResize = sal_True; // sal_True: Resize must be called by Show 245cf06609aSHerbert Dürr mbWaitSystemResize = sal_True; // sal_True: Wait for System-Resize 246cf06609aSHerbert Dürr mbInitWinClipRegion = sal_True; // sal_True: Calc Window Clip Region 247cf06609aSHerbert Dürr mbInitChildRegion = sal_False; // sal_True: InitChildClipRegion 248cf06609aSHerbert Dürr mbWinRegion = sal_False; // sal_True: Window Region 249cf06609aSHerbert Dürr mbClipChildren = sal_False; // sal_True: request that child-windows get clipped 250cf06609aSHerbert Dürr mbClipSiblings = sal_False; // sal_True: request that sibling child-windows get clipped 251cf06609aSHerbert Dürr mbChildTransparent = sal_False; // sal_True: allow child-windows to enable transparency (incl. Parent-CLIPCHILDREN) 252cf06609aSHerbert Dürr mbPaintTransparent = sal_False; // sal_True: Paints muessen auf Parent ausgeloest werden 253cf06609aSHerbert Dürr mbMouseTransparent = sal_False; // sal_True: Window is transparent for Mouse 254cf06609aSHerbert Dürr mbDlgCtrlStart = sal_False; // sal_True: Ab hier eigenes Dialog-Control 255cf06609aSHerbert Dürr mbFocusVisible = sal_False; // sal_True: Focus Visible 256cf06609aSHerbert Dürr mbUseNativeFocus = sal_False; 257cf06609aSHerbert Dürr mbNativeFocusVisible= sal_False; // sal_True: native Focus Visible 258cf06609aSHerbert Dürr mbInShowFocus = sal_False; // prevent recursion 259cf06609aSHerbert Dürr mbInHideFocus = sal_False; // prevent recursion 260cf06609aSHerbert Dürr mbTrackVisible = sal_False; // sal_True: Tracking Visible 261cf06609aSHerbert Dürr mbControlForeground = sal_False; // sal_True: Foreground-Property set 262cf06609aSHerbert Dürr mbControlBackground = sal_False; // sal_True: Background-Property set 263cf06609aSHerbert Dürr mbAlwaysOnTop = sal_False; // sal_True: window is always on top 264cf06609aSHerbert Dürr mbCompoundControl = sal_False; // sal_True: Zusammengesetztes Control => Listener... 265cf06609aSHerbert Dürr mbCompoundControlHasFocus = sal_False; // sal_True: Zusammengesetztes Control hat irgendwo den Focus 266cf06609aSHerbert Dürr mbPaintDisabled = sal_False; // sal_True: to disable paint events 267cf06609aSHerbert Dürr mbAllResize = sal_False; // sal_True: to enable sending of ResizeEvents with both height=0 and width=0 268cf06609aSHerbert Dürr mbInDtor = sal_False; // sal_True: is set when the window is being destructed 269cf06609aSHerbert Dürr mbExtTextInput = sal_False; // sal_True: ExtTextInput-Mode is active 270cf06609aSHerbert Dürr mbInFocusHdl = sal_False; // sal_True: is set when inside a GetFocus-Handler context 271cf06609aSHerbert Dürr mbCreatedWithToolkit = sal_False; 272cf06609aSHerbert Dürr mbSuppressAccessibilityEvents = sal_False; // sal_True: do not send any accessibility events 273cf06609aSHerbert Dürr mbDrawSelectionBackground = sal_False; // sal_True: draws transparent window background to indicate (toolbox) selection 274cf06609aSHerbert Dürr mbIsInTaskPaneList = sal_False; // sal_True: window was added to the taskpanelist in the topmost system window 275cf06609aSHerbert Dürr mnNativeBackground = 0; // initialize later, depends on type 276cf06609aSHerbert Dürr mbCallHandlersDuringInputDisabled = sal_False; // sal_True: call event handlers even if input is disabled 277cf06609aSHerbert Dürr mbDisableAccessibleLabelForRelation = sal_False; // sal_True: do not set LabelFor relation on accessible objects 278cf06609aSHerbert Dürr mbDisableAccessibleLabeledByRelation = sal_False; // sal_True: do not set LabeledBy relation on accessible objects 279cf06609aSHerbert Dürr mbHelpTextDynamic = sal_False; // sal_True: append help id in HELP_DEBUG case 28095a18594SAndre Fischer mbFakeFocusSet = sal_False; // sal_True: pretend as if the window 28195a18594SAndre Fischer // has focus. 28295a18594SAndre Fischer mbIsThemingEnabled = sal_True; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir WindowImpl::~WindowImpl() 286cdf0e10cSrcweir { 287cf06609aSHerbert Dürr delete mpChildClipRegion; 288cf06609aSHerbert Dürr delete mpAccessibleInfos; 289cf06609aSHerbert Dürr delete mpControlFont; 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir 293cdf0e10cSrcweir // ----------------------------------------------------------------------- 294cdf0e10cSrcweir 295cdf0e10cSrcweir // helper method to allow inline constructor even for pWindow!=NULL case 296cdf0e10cSrcweir void ImplDelData::AttachToWindow( const Window* pWindow ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir if( pWindow ) 299cdf0e10cSrcweir const_cast<Window*>(pWindow)->ImplAddDel( this ); 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir // ----------------------------------------------------------------------- 303cdf0e10cSrcweir 304cdf0e10cSrcweir // define dtor for ImplDelData 305cdf0e10cSrcweir ImplDelData::~ImplDelData() 306cdf0e10cSrcweir { 307cdf0e10cSrcweir // #112873# auto remove of ImplDelData 308cdf0e10cSrcweir // due to this code actively calling ImplRemoveDel() is not mandatory anymore 309cdf0e10cSrcweir if( !mbDel && mpWindow ) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir // the window still exists but we were not removed 312cdf0e10cSrcweir const_cast<Window*>(mpWindow)->ImplRemoveDel( this ); 313cdf0e10cSrcweir mpWindow = NULL; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir } 316cdf0e10cSrcweir 317cdf0e10cSrcweir // ----------------------------------------------------------------------- 318cdf0e10cSrcweir 319cdf0e10cSrcweir #ifdef DBG_UTIL 320cdf0e10cSrcweir const char* ImplDbgCheckWindow( const void* pObj ) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir DBG_TESTSOLARMUTEX(); 323cdf0e10cSrcweir 324cdf0e10cSrcweir const Window* pWindow = (Window*)pObj; 325cdf0e10cSrcweir 326cdf0e10cSrcweir if ( (pWindow->GetType() < WINDOW_FIRST) || (pWindow->GetType() > WINDOW_LAST) ) 327cdf0e10cSrcweir return "Window data overwrite"; 328cdf0e10cSrcweir 329cdf0e10cSrcweir // Fenster-Verkettung ueberpruefen 330cdf0e10cSrcweir Window* pChild = pWindow->mpWindowImpl->mpFirstChild; 331cdf0e10cSrcweir while ( pChild ) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir if ( pChild->mpWindowImpl->mpParent != pWindow ) 334cdf0e10cSrcweir return "Child-Window-Parent wrong"; 335cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir return NULL; 339cdf0e10cSrcweir } 340cdf0e10cSrcweir #endif 341cdf0e10cSrcweir 342cdf0e10cSrcweir // ======================================================================= 343cdf0e10cSrcweir 344cdf0e10cSrcweir void Window::ImplInitAppFontData( Window* pWindow ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 347cdf0e10cSrcweir long nTextHeight = pWindow->GetTextHeight(); 348cdf0e10cSrcweir long nTextWidth = pWindow->GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "aemnnxEM" ) ) ); 349cdf0e10cSrcweir long nSymHeight = nTextHeight*4; 350cdf0e10cSrcweir // Falls Font zu schmal ist, machen wir die Basis breiter, 351cdf0e10cSrcweir // damit die Dialoge symetrisch aussehen und nicht zu schmal 352cdf0e10cSrcweir // werden. Wenn der Dialog die gleiche breite hat, geben wir 353cdf0e10cSrcweir // noch etwas Spielraum dazu, da etwas mehr Platz besser ist. 354cdf0e10cSrcweir if ( nSymHeight > nTextWidth ) 355cdf0e10cSrcweir nTextWidth = nSymHeight; 356cdf0e10cSrcweir else if ( nSymHeight+5 > nTextWidth ) 357cdf0e10cSrcweir nTextWidth = nSymHeight+5; 358cdf0e10cSrcweir pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8; 359cdf0e10cSrcweir pSVData->maGDIData.mnAppFontY = nTextHeight * 10; 360cdf0e10cSrcweir 361cdf0e10cSrcweir // FIXME: this is currently only on aqua, check with other 362cdf0e10cSrcweir // platforms 363cdf0e10cSrcweir if( pSVData->maNWFData.mbNoFocusRects ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir // try to find out wether there is a large correction 366cdf0e10cSrcweir // of control sizes, if yes, make app font scalings larger 367cdf0e10cSrcweir // so dialog positioning is not completely off 368cdf0e10cSrcweir ImplControlValue aControlValue; 369cdf0e10cSrcweir Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) ); 370cdf0e10cSrcweir Rectangle aBoundingRgn( aCtrlRegion ); 371cdf0e10cSrcweir Rectangle aContentRgn( aCtrlRegion ); 372cdf0e10cSrcweir if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion, 373cdf0e10cSrcweir CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), 374cdf0e10cSrcweir aBoundingRgn, aContentRgn ) ) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir // comment: the magical +6 is for the extra border in bordered 377cdf0e10cSrcweir // (which is the standard) edit fields 378cdf0e10cSrcweir if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 ) 379cdf0e10cSrcweir pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir 384cdf0e10cSrcweir pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX; 385cdf0e10cSrcweir if ( pSVData->maAppData.mnDialogScaleX ) 386cdf0e10cSrcweir pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir // ----------------------------------------------------------------------- 390cdf0e10cSrcweir 391cdf0e10cSrcweir bool Window::ImplCheckUIFont( const Font& rFont ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) 394cdf0e10cSrcweir return true; 395cdf0e10cSrcweir 396cdf0e10cSrcweir // create a text string using the localized text of important buttons 397cdf0e10cSrcweir String aTestText; 398cdf0e10cSrcweir static const StandardButtonType aTestButtons[] = 399cdf0e10cSrcweir { 400cdf0e10cSrcweir BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT, 401cdf0e10cSrcweir BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE, 402cdf0e10cSrcweir BUTTON_RETRY, BUTTON_HELP 403cdf0e10cSrcweir }; 404cdf0e10cSrcweir 405cdf0e10cSrcweir const int nTestButtonCount = sizeof(aTestButtons)/sizeof(*aTestButtons); 406cdf0e10cSrcweir for( int n = 0; n < nTestButtonCount; ++n ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir String aButtonStr = Button::GetStandardText( aTestButtons[n] ); 409cdf0e10cSrcweir // #i115432# ignore mnemonic+accelerator part of each string 410cdf0e10cSrcweir // TODO: use a string filtering method when it becomes available 411cdf0e10cSrcweir const int nLen = aButtonStr.Len(); 412cdf0e10cSrcweir bool bInside = false; 413cdf0e10cSrcweir for( int i = 0; i < nLen; ++i ) { 414cdf0e10cSrcweir const sal_Unicode c = aButtonStr.GetChar( i ); 415cdf0e10cSrcweir if( (c == '(')) 416cdf0e10cSrcweir bInside = true; 417cdf0e10cSrcweir if( (c == ')')) 418cdf0e10cSrcweir bInside = false; 419cdf0e10cSrcweir if( (c == '~') 420cdf0e10cSrcweir || (c == '(') || (c == ')') 421cdf0e10cSrcweir || ((c >= 'A') && (c <= 'Z') && bInside) ) 422cdf0e10cSrcweir aButtonStr.SetChar( i, ' ' ); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir // append sanitized button text to test string 425cdf0e10cSrcweir aTestText.Append( aButtonStr ); 426cdf0e10cSrcweir } 427cdf0e10cSrcweir 428cdf0e10cSrcweir const int nFirstChar = HasGlyphs( rFont, aTestText ); 429cdf0e10cSrcweir const bool bUIFontOk = (nFirstChar >= aTestText.Len()); 430cdf0e10cSrcweir return bUIFontOk; 431cdf0e10cSrcweir } 432cdf0e10cSrcweir 433cdf0e10cSrcweir // ----------------------------------------------------------------------- 434cdf0e10cSrcweir 435cdf0e10cSrcweir void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir // reset high contrast to false, so the system can either update it 438cdf0e10cSrcweir // or AutoDetectSystemHC can kick in (see below) 439cdf0e10cSrcweir StyleSettings aTmpSt( rSettings.GetStyleSettings() ); 440cdf0e10cSrcweir aTmpSt.SetHighContrastMode( sal_False ); 441cdf0e10cSrcweir rSettings.SetStyleSettings( aTmpSt ); 442cdf0e10cSrcweir ImplGetFrame()->UpdateSettings( rSettings ); 443cdf0e10cSrcweir // reset default border width for layouters 444cdf0e10cSrcweir ImplGetSVData()->maAppData.mnDefaultLayoutBorder = -1; 445cdf0e10cSrcweir 446cdf0e10cSrcweir // Verify availability of the configured UI font, otherwise choose "Andale Sans UI" 447cdf0e10cSrcweir String aUserInterfaceFont; 448cdf0e10cSrcweir bool bUseSystemFont = rSettings.GetStyleSettings().GetUseSystemUIFonts(); 449cdf0e10cSrcweir 450cdf0e10cSrcweir // check whether system UI font can display a typical UI text 451cdf0e10cSrcweir if( bUseSystemFont ) 452cdf0e10cSrcweir bUseSystemFont = ImplCheckUIFont( rSettings.GetStyleSettings().GetAppFont() ); 453cdf0e10cSrcweir 454cdf0e10cSrcweir if ( !bUseSystemFont ) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir ImplInitFontList(); 457cdf0e10cSrcweir String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); 458cdf0e10cSrcweir xub_StrLen nIndex = 0; 459cdf0e10cSrcweir while( nIndex != STRING_NOTFOUND ) 460cdf0e10cSrcweir { 461cdf0e10cSrcweir String aName( aConfigFont.GetToken( 0, ';', nIndex ) ); 462cdf0e10cSrcweir if ( aName.Len() && mpWindowImpl->mpFrameData->mpFontList->FindFontFamily( aName ) ) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir aUserInterfaceFont = aConfigFont; 465cdf0e10cSrcweir break; 466cdf0e10cSrcweir } 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir if ( ! aUserInterfaceFont.Len() ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir String aFallbackFont (RTL_CONSTASCII_USTRINGPARAM( "Andale Sans UI" )); 472cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFontList->FindFontFamily( aFallbackFont ) ) 473cdf0e10cSrcweir aUserInterfaceFont = aFallbackFont; 474cdf0e10cSrcweir } 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir if ( !bUseSystemFont && aUserInterfaceFont.Len() ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir StyleSettings aStyleSettings = rSettings.GetStyleSettings(); 480cdf0e10cSrcweir Font aFont = aStyleSettings.GetAppFont(); 481cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 482cdf0e10cSrcweir aStyleSettings.SetAppFont( aFont ); 483cdf0e10cSrcweir aFont = aStyleSettings.GetHelpFont(); 484cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 485cdf0e10cSrcweir aStyleSettings.SetHelpFont( aFont ); 486cdf0e10cSrcweir aFont = aStyleSettings.GetTitleFont(); 487cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 488cdf0e10cSrcweir aStyleSettings.SetTitleFont( aFont ); 489cdf0e10cSrcweir aFont = aStyleSettings.GetFloatTitleFont(); 490cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 491cdf0e10cSrcweir aStyleSettings.SetFloatTitleFont( aFont ); 492cdf0e10cSrcweir aFont = aStyleSettings.GetMenuFont(); 493cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 494cdf0e10cSrcweir aStyleSettings.SetMenuFont( aFont ); 495cdf0e10cSrcweir aFont = aStyleSettings.GetToolFont(); 496cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 497cdf0e10cSrcweir aStyleSettings.SetToolFont( aFont ); 498cdf0e10cSrcweir aFont = aStyleSettings.GetLabelFont(); 499cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 500cdf0e10cSrcweir aStyleSettings.SetLabelFont( aFont ); 501cdf0e10cSrcweir aFont = aStyleSettings.GetInfoFont(); 502cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 503cdf0e10cSrcweir aStyleSettings.SetInfoFont( aFont ); 504cdf0e10cSrcweir aFont = aStyleSettings.GetRadioCheckFont(); 505cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 506cdf0e10cSrcweir aStyleSettings.SetRadioCheckFont( aFont ); 507cdf0e10cSrcweir aFont = aStyleSettings.GetPushButtonFont(); 508cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 509cdf0e10cSrcweir aStyleSettings.SetPushButtonFont( aFont ); 510cdf0e10cSrcweir aFont = aStyleSettings.GetFieldFont(); 511cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 512cdf0e10cSrcweir aStyleSettings.SetFieldFont( aFont ); 513cdf0e10cSrcweir aFont = aStyleSettings.GetIconFont(); 514cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 515cdf0e10cSrcweir aStyleSettings.SetIconFont( aFont ); 516cdf0e10cSrcweir aFont = aStyleSettings.GetGroupFont(); 517cdf0e10cSrcweir aFont.SetName( aUserInterfaceFont ); 518cdf0e10cSrcweir aStyleSettings.SetGroupFont( aFont ); 519cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir StyleSettings aStyleSettings = rSettings.GetStyleSettings(); 523cdf0e10cSrcweir // #97047: Force all fonts except Menu and Help to a fixed height 524cdf0e10cSrcweir // to avoid UI scaling due to large fonts 525cdf0e10cSrcweir // - but allow bigger fonts on bigger screens (i16682, i21238) 526cdf0e10cSrcweir // dialogs were designed to fit 800x600 with an 8pt font, so scale accordingly 527cdf0e10cSrcweir int maxFontheight = 9; // #107886#: 9 is default for some asian systems, so always allow if requested 528cdf0e10cSrcweir if( GetDesktopRectPixel().getHeight() > 600 ) 529cdf0e10cSrcweir maxFontheight = (int) ((( 8.0 * (double) GetDesktopRectPixel().getHeight()) / 600.0) + 1.5); 530cdf0e10cSrcweir 531cdf0e10cSrcweir Font aFont = aStyleSettings.GetMenuFont(); 532cdf0e10cSrcweir int defFontheight = aFont.GetHeight(); 533cdf0e10cSrcweir if( defFontheight > maxFontheight ) 534cdf0e10cSrcweir defFontheight = maxFontheight; 535cdf0e10cSrcweir 536cdf0e10cSrcweir // if the UI is korean, chinese or another locale 537cdf0e10cSrcweir // where the system font size is kown to be often too small to 538cdf0e10cSrcweir // generate readable fonts enforce a minimum font size of 9 points 539cdf0e10cSrcweir bool bBrokenLangFontHeight = false; 540cdf0e10cSrcweir static const LanguageType eBrokenSystemFontSizeLanguages[] = 541cdf0e10cSrcweir { LANGUAGE_KOREAN, LANGUAGE_KOREAN_JOHAB, 542cdf0e10cSrcweir LANGUAGE_CHINESE_HONGKONG, LANGUAGE_CHINESE_MACAU, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_SINGAPORE, LANGUAGE_CHINESE_TRADITIONAL 543cdf0e10cSrcweir }; 544cdf0e10cSrcweir static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet( 545cdf0e10cSrcweir eBrokenSystemFontSizeLanguages, 546cdf0e10cSrcweir eBrokenSystemFontSizeLanguages + 547cdf0e10cSrcweir (sizeof(eBrokenSystemFontSizeLanguages)/sizeof(eBrokenSystemFontSizeLanguages[0])) 548cdf0e10cSrcweir ); 549cdf0e10cSrcweir LanguageType aLang = Application::GetSettings().GetUILanguage(); 550cdf0e10cSrcweir if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir defFontheight = Max(9, defFontheight); 553cdf0e10cSrcweir bBrokenLangFontHeight = true; 554cdf0e10cSrcweir } 555cdf0e10cSrcweir 556cdf0e10cSrcweir // i22098, toolfont will be scaled differently to avoid bloated rulers and status bars for big fonts 557cdf0e10cSrcweir int toolfontheight = defFontheight; 558cdf0e10cSrcweir if( toolfontheight > 9 ) 559cdf0e10cSrcweir toolfontheight = (defFontheight+8) / 2; 560cdf0e10cSrcweir 561cdf0e10cSrcweir aFont = aStyleSettings.GetAppFont(); 562cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 563cdf0e10cSrcweir aStyleSettings.SetAppFont( aFont ); 564cdf0e10cSrcweir aFont = aStyleSettings.GetTitleFont(); 565cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 566cdf0e10cSrcweir aStyleSettings.SetTitleFont( aFont ); 567cdf0e10cSrcweir aFont = aStyleSettings.GetFloatTitleFont(); 568cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 569cdf0e10cSrcweir aStyleSettings.SetFloatTitleFont( aFont ); 570cdf0e10cSrcweir // keep menu and help font size from system unless in broken locale size 571cdf0e10cSrcweir if( bBrokenLangFontHeight ) 572cdf0e10cSrcweir { 573cdf0e10cSrcweir aFont = aStyleSettings.GetMenuFont(); 574cdf0e10cSrcweir if( aFont.GetHeight() < defFontheight ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 577cdf0e10cSrcweir aStyleSettings.SetMenuFont( aFont ); 578cdf0e10cSrcweir } 579cdf0e10cSrcweir aFont = aStyleSettings.GetHelpFont(); 580cdf0e10cSrcweir if( aFont.GetHeight() < defFontheight ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 583cdf0e10cSrcweir aStyleSettings.SetHelpFont( aFont ); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir // use different height for toolfont 588cdf0e10cSrcweir aFont = aStyleSettings.GetToolFont(); 589cdf0e10cSrcweir aFont.SetHeight( toolfontheight ); 590cdf0e10cSrcweir aStyleSettings.SetToolFont( aFont ); 591cdf0e10cSrcweir 592cdf0e10cSrcweir aFont = aStyleSettings.GetLabelFont(); 593cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 594cdf0e10cSrcweir aStyleSettings.SetLabelFont( aFont ); 595cdf0e10cSrcweir aFont = aStyleSettings.GetInfoFont(); 596cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 597cdf0e10cSrcweir aStyleSettings.SetInfoFont( aFont ); 598cdf0e10cSrcweir aFont = aStyleSettings.GetRadioCheckFont(); 599cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 600cdf0e10cSrcweir aStyleSettings.SetRadioCheckFont( aFont ); 601cdf0e10cSrcweir aFont = aStyleSettings.GetPushButtonFont(); 602cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 603cdf0e10cSrcweir aStyleSettings.SetPushButtonFont( aFont ); 604cdf0e10cSrcweir aFont = aStyleSettings.GetFieldFont(); 605cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 606cdf0e10cSrcweir aStyleSettings.SetFieldFont( aFont ); 607cdf0e10cSrcweir aFont = aStyleSettings.GetIconFont(); 608cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 609cdf0e10cSrcweir aStyleSettings.SetIconFont( aFont ); 610cdf0e10cSrcweir aFont = aStyleSettings.GetGroupFont(); 611cdf0e10cSrcweir aFont.SetHeight( defFontheight ); 612cdf0e10cSrcweir aStyleSettings.SetGroupFont( aFont ); 613cdf0e10cSrcweir 614cdf0e10cSrcweir // set workspace gradient to black in dark themes 615cdf0e10cSrcweir if( aStyleSettings.GetWindowColor().IsDark() ) 616cdf0e10cSrcweir aStyleSettings.SetWorkspaceGradient( Wallpaper( Color( COL_BLACK ) ) ); 617cdf0e10cSrcweir else 618cdf0e10cSrcweir { 619cdf0e10cSrcweir Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR ); 620cdf0e10cSrcweir aStyleSettings.SetWorkspaceGradient( Wallpaper( aGrad ) ); 621cdf0e10cSrcweir } 622cdf0e10cSrcweir 623cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 624cdf0e10cSrcweir 625cdf0e10cSrcweir 626cdf0e10cSrcweir // auto detect HC mode; if the system already set it to "yes" 627cdf0e10cSrcweir // (see above) then accept that 628cdf0e10cSrcweir if( !rSettings.GetStyleSettings().GetHighContrastMode() ) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir sal_Bool bTmp = sal_False, bAutoHCMode = sal_True; 631cdf0e10cSrcweir utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory( 632cdf0e10cSrcweir vcl::unohelper::GetMultiServiceFactory(), 633*464d271fSMatthias Seidel OUString::createFromAscii( "org.openoffice.Office.Common/Accessibility" ) ); // note: case sensitive ! 634cdf0e10cSrcweir if ( aNode.isValid() ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "AutoDetectSystemHC" ) ); 637cdf0e10cSrcweir if( aValue >>= bTmp ) 638cdf0e10cSrcweir bAutoHCMode = bTmp; 639cdf0e10cSrcweir } 640cdf0e10cSrcweir if( bAutoHCMode ) 641cdf0e10cSrcweir { 642cdf0e10cSrcweir if( rSettings.GetStyleSettings().GetFaceColor().IsDark() 643cdf0e10cSrcweir || rSettings.GetStyleSettings().GetWindowColor().IsDark() ) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir aStyleSettings = rSettings.GetStyleSettings(); 646cdf0e10cSrcweir aStyleSettings.SetHighContrastMode( sal_True ); 647cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir static const char* pEnvHC = getenv( "SAL_FORCE_HC" ); 653cdf0e10cSrcweir if( pEnvHC && *pEnvHC ) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir aStyleSettings.SetHighContrastMode( sal_True ); 656cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir #ifdef DBG_UTIL 660cdf0e10cSrcweir // Evt. AppFont auf Fett schalten, damit man feststellen kann, 661cdf0e10cSrcweir // ob fuer die Texte auf anderen Systemen genuegend Platz 662cdf0e10cSrcweir // vorhanden ist 663cdf0e10cSrcweir if ( DbgIsBoldAppFont() ) 664cdf0e10cSrcweir { 665cdf0e10cSrcweir aStyleSettings = rSettings.GetStyleSettings(); 666cdf0e10cSrcweir aFont = aStyleSettings.GetAppFont(); 667cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 668cdf0e10cSrcweir aStyleSettings.SetAppFont( aFont ); 669cdf0e10cSrcweir aFont = aStyleSettings.GetGroupFont(); 670cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 671cdf0e10cSrcweir aStyleSettings.SetGroupFont( aFont ); 672cdf0e10cSrcweir aFont = aStyleSettings.GetLabelFont(); 673cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 674cdf0e10cSrcweir aStyleSettings.SetLabelFont( aFont ); 675cdf0e10cSrcweir aFont = aStyleSettings.GetRadioCheckFont(); 676cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 677cdf0e10cSrcweir aStyleSettings.SetRadioCheckFont( aFont ); 678cdf0e10cSrcweir aFont = aStyleSettings.GetPushButtonFont(); 679cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 680cdf0e10cSrcweir aStyleSettings.SetPushButtonFont( aFont ); 681cdf0e10cSrcweir aFont = aStyleSettings.GetFieldFont(); 682cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 683cdf0e10cSrcweir aStyleSettings.SetFieldFont( aFont ); 684cdf0e10cSrcweir aFont = aStyleSettings.GetIconFont(); 685cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 686cdf0e10cSrcweir aStyleSettings.SetIconFont( aFont ); 687cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 688cdf0e10cSrcweir } 689cdf0e10cSrcweir #endif 690cdf0e10cSrcweir 691cdf0e10cSrcweir if ( bCallHdl ) 692cdf0e10cSrcweir GetpApp()->SystemSettingsChanging( rSettings, this ); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir // ----------------------------------------------------------------------- 696cdf0e10cSrcweir 697cdf0e10cSrcweir MouseEvent ImplTranslateMouseEvent( const MouseEvent& rE, Window* pSource, Window* pDest ) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() ); 700cdf0e10cSrcweir aPos = pDest->ScreenToOutputPixel( aPos ); 701cdf0e10cSrcweir return MouseEvent( aPos, rE.GetClicks(), rE.GetMode(), rE.GetButtons(), rE.GetModifier() ); 702cdf0e10cSrcweir } 703cdf0e10cSrcweir 704cdf0e10cSrcweir // ----------------------------------------------------------------------- 705cdf0e10cSrcweir 706cdf0e10cSrcweir CommandEvent ImplTranslateCommandEvent( const CommandEvent& rCEvt, Window* pSource, Window* pDest ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir if ( !rCEvt.IsMouseEvent() ) 709cdf0e10cSrcweir return rCEvt; 710cdf0e10cSrcweir 711cdf0e10cSrcweir Point aPos = pSource->OutputToScreenPixel( rCEvt.GetMousePosPixel() ); 712cdf0e10cSrcweir aPos = pDest->ScreenToOutputPixel( aPos ); 713cdf0e10cSrcweir return CommandEvent( aPos, rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir // ======================================================================= 717cdf0e10cSrcweir 718cdf0e10cSrcweir void Window::ImplInitWindowData( WindowType nType ) 719cdf0e10cSrcweir { 720cf06609aSHerbert Dürr mpWindowImpl = new WindowImpl( nType ); 721cdf0e10cSrcweir 722cdf0e10cSrcweir meOutDevType = OUTDEV_WINDOW; 723cdf0e10cSrcweir 724cdf0e10cSrcweir mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // sal_True: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active 725cdf0e10cSrcweir } 726cdf0e10cSrcweir 727cdf0e10cSrcweir // ----------------------------------------------------------------------- 728cdf0e10cSrcweir 729cdf0e10cSrcweir void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& /*aSystemWorkWindowToken*/ ) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir ImplInit( pParent, nStyle, NULL ); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir 734cdf0e10cSrcweir // ----------------------------------------------------------------------- 735cdf0e10cSrcweir 736cdf0e10cSrcweir void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" ); 739cdf0e10cSrcweir 740cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 741cdf0e10cSrcweir Window* pRealParent = pParent; 742cdf0e10cSrcweir 743cdf0e10cSrcweir // 3D-Look vererben 744cdf0e10cSrcweir if ( !mpWindowImpl->mbOverlapWin && pParent && (pParent->GetStyle() & WB_3DLOOK) ) 745cdf0e10cSrcweir nStyle |= WB_3DLOOK; 746cdf0e10cSrcweir 747cdf0e10cSrcweir // create border window if necessary 748cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow 749cdf0e10cSrcweir && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) ) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir sal_uInt16 nBorderTypeStyle = 0; 752cdf0e10cSrcweir if( (nStyle & WB_SYSTEMCHILDWINDOW) ) 753cdf0e10cSrcweir { 754cdf0e10cSrcweir // handle WB_SYSTEMCHILDWINDOW 755cdf0e10cSrcweir // these should be analogous to a top level frame; meaning they 756cdf0e10cSrcweir // should have a border window with style BORDERWINDOW_STYLE_FRAME 757cdf0e10cSrcweir // which controls their size 758cdf0e10cSrcweir nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; 759cdf0e10cSrcweir nStyle |= WB_BORDER; 760cdf0e10cSrcweir } 76195a18594SAndre Fischer ImplBorderWindow* pBorderWin = 76295a18594SAndre Fischer mpWindowImpl->mbIsThemingEnabled 76395a18594SAndre Fischer ? CreateBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ) 76495a18594SAndre Fischer : new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); 765cdf0e10cSrcweir ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this; 766cdf0e10cSrcweir pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); 767cdf0e10cSrcweir mpWindowImpl->mpBorderWindow = pBorderWin; 768cdf0e10cSrcweir pParent = mpWindowImpl->mpBorderWindow; 769cdf0e10cSrcweir } 770cdf0e10cSrcweir else if( !mpWindowImpl->mbFrame && ! pParent ) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir mpWindowImpl->mbOverlapWin = sal_True; 773cdf0e10cSrcweir mpWindowImpl->mbFrame = sal_True; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir // insert window in list 777cdf0e10cSrcweir ImplInsertWindow( pParent ); 778cdf0e10cSrcweir mpWindowImpl->mnStyle = nStyle; 779cdf0e10cSrcweir 780cdf0e10cSrcweir // Overlap-Window-Daten 781cdf0e10cSrcweir if ( mpWindowImpl->mbOverlapWin ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir mpWindowImpl->mpOverlapData = new ImplOverlapData; 784cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL; 785cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL; 786cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mpNextBackWin = NULL; 787cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mnSaveBackSize = 0; 788cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mbSaveBack = sal_False; 789cdf0e10cSrcweir mpWindowImpl->mpOverlapData->mnTopLevel = 1; 790cdf0e10cSrcweir } 791cdf0e10cSrcweir 792cdf0e10cSrcweir if( pParent && ! mpWindowImpl->mbFrame ) 793cdf0e10cSrcweir mbEnableRTL = pParent->mbEnableRTL; 794cdf0e10cSrcweir 795cdf0e10cSrcweir // test for frame creation 796cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 797cdf0e10cSrcweir { 798cdf0e10cSrcweir // create frame 799cdf0e10cSrcweir sal_uLong nFrameStyle = 0; 800cdf0e10cSrcweir 801cdf0e10cSrcweir if ( nStyle & WB_MOVEABLE ) 802cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE; 803cdf0e10cSrcweir if ( nStyle & WB_SIZEABLE ) 804cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_SIZEABLE; 805cdf0e10cSrcweir if ( nStyle & WB_CLOSEABLE ) 806cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_CLOSEABLE; 807cdf0e10cSrcweir if ( nStyle & WB_APP ) 808cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_DEFAULT; 809cdf0e10cSrcweir // check for undecorated floating window 810cdf0e10cSrcweir if( // 1. floating windows that are not moveable/sizeable (only closeable allowed) 811cdf0e10cSrcweir ( !(nFrameStyle & ~SAL_FRAME_STYLE_CLOSEABLE) && 812cdf0e10cSrcweir ( mpWindowImpl->mbFloatWin || ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow) || (nStyle & WB_SYSTEMFLOATWIN) ) ) || 813cdf0e10cSrcweir // 2. borderwindows of floaters with ownerdraw decoration 814cdf0e10cSrcweir ( ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow && (nStyle & WB_OWNERDRAWDECORATION) ) ) ) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir nFrameStyle = SAL_FRAME_STYLE_FLOAT; 817cdf0e10cSrcweir if( nStyle & WB_OWNERDRAWDECORATION ) 818cdf0e10cSrcweir nFrameStyle |= (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_NOSHADOW); 819cdf0e10cSrcweir if( nStyle & WB_NEEDSFOCUS ) 820cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_FLOAT_FOCUSABLE; 821cdf0e10cSrcweir } 822cdf0e10cSrcweir else if( mpWindowImpl->mbFloatWin ) 823cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_TOOLWINDOW; 824cdf0e10cSrcweir 825cdf0e10cSrcweir if( nStyle & WB_INTROWIN ) 826cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_INTRO; 827cdf0e10cSrcweir if( nStyle & WB_TOOLTIPWIN ) 828cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_TOOLTIP; 829cdf0e10cSrcweir 830cdf0e10cSrcweir if( nStyle & WB_NOSHADOW ) 831cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_NOSHADOW; 832cdf0e10cSrcweir 833cdf0e10cSrcweir if( nStyle & WB_SYSTEMCHILDWINDOW ) 834cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_SYSTEMCHILD; 835cdf0e10cSrcweir 836cdf0e10cSrcweir switch (mpWindowImpl->mnType) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir case WINDOW_DIALOG: 839cdf0e10cSrcweir case WINDOW_TABDIALOG: 840cdf0e10cSrcweir case WINDOW_MODALDIALOG: 841cdf0e10cSrcweir case WINDOW_MODELESSDIALOG: 842cdf0e10cSrcweir case WINDOW_MESSBOX: 843cdf0e10cSrcweir case WINDOW_INFOBOX: 844cdf0e10cSrcweir case WINDOW_WARNINGBOX: 845cdf0e10cSrcweir case WINDOW_ERRORBOX: 846cdf0e10cSrcweir case WINDOW_QUERYBOX: 847cdf0e10cSrcweir nFrameStyle |= SAL_FRAME_STYLE_DIALOG; 848cdf0e10cSrcweir default: 849cdf0e10cSrcweir break; 850cdf0e10cSrcweir } 851cdf0e10cSrcweir 852cdf0e10cSrcweir SalFrame* pParentFrame = NULL; 853cdf0e10cSrcweir if ( pParent ) 854cdf0e10cSrcweir pParentFrame = pParent->mpWindowImpl->mpFrame; 855cdf0e10cSrcweir SalFrame* pFrame; 856cdf0e10cSrcweir if ( pSystemParentData ) 857cdf0e10cSrcweir pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SAL_FRAME_STYLE_PLUG ); 858cdf0e10cSrcweir else 859cdf0e10cSrcweir pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle ); 860cdf0e10cSrcweir if ( !pFrame ) 861cdf0e10cSrcweir { 862cdf0e10cSrcweir // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario) 863cdf0e10cSrcweir throw ::com::sun::star::uno::RuntimeException( 864cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not create system window!" ) ), 865cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); 866cdf0e10cSrcweir //GetpApp()->Exception( EXC_SYSOBJNOTCREATED ); 867cdf0e10cSrcweir } 868cdf0e10cSrcweir 869cdf0e10cSrcweir pFrame->SetCallback( this, ImplWindowFrameProc ); 870cdf0e10cSrcweir 871cdf0e10cSrcweir // set window frame data 872cdf0e10cSrcweir mpWindowImpl->mpFrameData = new ImplFrameData; 873cdf0e10cSrcweir mpWindowImpl->mpFrame = pFrame; 874cdf0e10cSrcweir mpWindowImpl->mpFrameWindow = this; 875cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = this; 876cdf0e10cSrcweir 877cdf0e10cSrcweir // set frame data 878cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame; 879cdf0e10cSrcweir pSVData->maWinData.mpFirstFrame = this; 880cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFirstOverlap = NULL; 881cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = NULL; 882cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL; 883cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseDownWin = NULL; 884cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFirstBackWin = NULL; 885cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFontList = pSVData->maGDIData.mpScreenFontList; 886cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache; 887cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnAllSaveBackSize = 0; 888cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnFocusId = 0; 889cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnMouseMoveId = 0; 890cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnLastMouseX = -1; 891cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnLastMouseY = -1; 892cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnBeforeLastMouseX = -1; 893cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnBeforeLastMouseY = -1; 894cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnFirstMouseX = -1; 895cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnFirstMouseY = -1; 896cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnLastMouseWinX = -1; 897cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnLastMouseWinY = -1; 898cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnModalMode = 0; 899cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnMouseDownTime = 0; 900cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnClickCount = 0; 901cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnFirstMouseCode = 0; 902cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnMouseCode = 0; 903cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnMouseMode = 0; 904cdf0e10cSrcweir mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL; 905cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbHasFocus = sal_False; 906cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbInMouseMove = sal_False; 907cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbMouseIn = sal_False; 908cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbStartDragCalled = sal_False; 909cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbNeedSysWindow = sal_False; 910cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbMinimized = sal_False; 911cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbStartFocusState = sal_False; 912cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = sal_False; 913cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = sal_False; 914cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbSysObjFocus = sal_False; 915cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.SetTimeout( 30 ); 916cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) ); 917cdf0e10cSrcweir mpWindowImpl->mpFrameData->maResizeTimer.SetTimeout( 50 ); 918cdf0e10cSrcweir mpWindowImpl->mpFrameData->maResizeTimer.SetTimeoutHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) ); 919cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_False; 920cdf0e10cSrcweir 921cdf0e10cSrcweir if ( pRealParent && IsTopWindow() ) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir ImplWinData* pParentWinData = pRealParent->ImplGetWinData(); 924cdf0e10cSrcweir pParentWinData->maTopWindowChildren.push_back( this ); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir } 927cdf0e10cSrcweir 928cdf0e10cSrcweir // init data 929cdf0e10cSrcweir mpWindowImpl->mpRealParent = pRealParent; 930cdf0e10cSrcweir 931cdf0e10cSrcweir // #99318: make sure fontcache and list is available before call to SetSettings 932cdf0e10cSrcweir mpFontList = mpWindowImpl->mpFrameData->mpFontList; 933cdf0e10cSrcweir mpFontCache = mpWindowImpl->mpFrameData->mpFontCache; 934cdf0e10cSrcweir 935cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 936cdf0e10cSrcweir { 937cdf0e10cSrcweir if ( pParent ) 938cdf0e10cSrcweir { 939cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX; 940cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY; 941cdf0e10cSrcweir } 942cdf0e10cSrcweir else 943cdf0e10cSrcweir { 944cdf0e10cSrcweir if ( ImplGetGraphics() ) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir } 949cdf0e10cSrcweir 950cdf0e10cSrcweir // add ownerdraw decorated frame windows to list in the top-most frame window 951cdf0e10cSrcweir // so they can be hidden on lose focus 952cdf0e10cSrcweir if( nStyle & WB_OWNERDRAWDECORATION ) 953cdf0e10cSrcweir ImplGetOwnerDrawList().push_back( this ); 954cdf0e10cSrcweir 955cdf0e10cSrcweir // delay settings initialization until first "real" frame 956cdf0e10cSrcweir // this relies on the IntroWindow not needing any system settings 957cdf0e10cSrcweir if ( !pSVData->maAppData.mbSettingsInit && 958cdf0e10cSrcweir ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) 959cdf0e10cSrcweir ) 960cdf0e10cSrcweir { 961cdf0e10cSrcweir // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings 962cdf0e10cSrcweir ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); 963cdf0e10cSrcweir OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); 964cdf0e10cSrcweir pSVData->maAppData.mbSettingsInit = sal_True; 965cdf0e10cSrcweir } 966cdf0e10cSrcweir 967cdf0e10cSrcweir // If we create a Window with default size, query this 968cdf0e10cSrcweir // size directly, because we want resize all Controls to 969cdf0e10cSrcweir // the correct size before we display the window 970cdf0e10cSrcweir if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) ) 971cdf0e10cSrcweir mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight ); 972cdf0e10cSrcweir } 973cdf0e10cSrcweir else 974cdf0e10cSrcweir { 975cdf0e10cSrcweir if ( pParent ) 976cdf0e10cSrcweir { 977cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 978cdf0e10cSrcweir { 979cdf0e10cSrcweir mpWindowImpl->mbDisabled = pParent->mpWindowImpl->mbDisabled; 980cdf0e10cSrcweir mpWindowImpl->mbInputDisabled = pParent->mpWindowImpl->mbInputDisabled; 981cdf0e10cSrcweir mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode; 982cdf0e10cSrcweir } 983cdf0e10cSrcweir 984cdf0e10cSrcweir OutputDevice::SetSettings( pParent->GetSettings() ); 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir } 988cdf0e10cSrcweir 989cdf0e10cSrcweir const StyleSettings& rStyleSettings = maSettings.GetStyleSettings(); 990cdf0e10cSrcweir sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom(); 991cdf0e10cSrcweir mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100; 992cdf0e10cSrcweir mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100; 993cdf0e10cSrcweir maFont = rStyleSettings.GetAppFont(); 994cdf0e10cSrcweir ImplPointToLogic( maFont ); 995cdf0e10cSrcweir 996cdf0e10cSrcweir if ( nStyle & WB_3DLOOK ) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir SetTextColor( rStyleSettings.GetButtonTextColor() ); 999cdf0e10cSrcweir SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) ); 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir else 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir SetTextColor( rStyleSettings.GetWindowTextColor() ); 1004cdf0e10cSrcweir SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir ImplUpdatePos(); 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir // calculate app font res (except for the Intro Window or the default window) 1010cdf0e10cSrcweir if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) ) 1011cdf0e10cSrcweir ImplInitAppFontData( this ); 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() ) 1014cdf0e10cSrcweir GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this ); 1015cdf0e10cSrcweir } 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir // ----------------------------------------------------------------------- 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir void Window::ImplSetFrameParent( const Window* pParent ) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir Window* pFrameWindow = ImplGetSVData()->maWinData.mpFirstFrame; 1022cdf0e10cSrcweir while( pFrameWindow ) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir // search all frames that are children of this window 1025cdf0e10cSrcweir // and reparent them 1026cdf0e10cSrcweir if( ImplIsRealParentPath( pFrameWindow ) ) 1027cdf0e10cSrcweir { 1028cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->mpFrame != pFrameWindow->mpWindowImpl->mpFrame, "SetFrameParent to own" ); 1029cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->mpFrame, "no frame" ); 1030cdf0e10cSrcweir SalFrame* pParentFrame = pParent ? pParent->mpWindowImpl->mpFrame : NULL; 1031cdf0e10cSrcweir pFrameWindow->mpWindowImpl->mpFrame->SetParent( pParentFrame ); 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir pFrameWindow = pFrameWindow->mpWindowImpl->mpFrameData->mpNextFrame; 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir // ----------------------------------------------------------------------- 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir void Window::ImplInsertWindow( Window* pParent ) 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir mpWindowImpl->mpParent = pParent; 1042cdf0e10cSrcweir mpWindowImpl->mpRealParent = pParent; 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir if ( pParent && !mpWindowImpl->mbFrame ) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir // search frame window and set window frame data 1047cdf0e10cSrcweir Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow; 1048cdf0e10cSrcweir mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData; 1049cdf0e10cSrcweir mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame; 1050cdf0e10cSrcweir mpWindowImpl->mpFrameWindow = pFrameParent; 1051cdf0e10cSrcweir mpWindowImpl->mbFrame = sal_False; 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir // search overlap window and insert window in list 1054cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 1055cdf0e10cSrcweir { 1056cdf0e10cSrcweir Window* pFirstOverlapParent = pParent; 1057cdf0e10cSrcweir while ( !pFirstOverlapParent->ImplIsOverlapWindow() ) 1058cdf0e10cSrcweir pFirstOverlapParent = pFirstOverlapParent->ImplGetParent(); 1059cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = pFirstOverlapParent; 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir mpWindowImpl->mpNextOverlap = mpWindowImpl->mpFrameData->mpFirstOverlap; 1062cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFirstOverlap = this; 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir // Overlap-Windows sind per default die obersten 1065cdf0e10cSrcweir mpWindowImpl->mpNext = pFirstOverlapParent->mpWindowImpl->mpFirstOverlap; 1066cdf0e10cSrcweir pFirstOverlapParent->mpWindowImpl->mpFirstOverlap = this; 1067cdf0e10cSrcweir if ( !pFirstOverlapParent->mpWindowImpl->mpLastOverlap ) 1068cdf0e10cSrcweir pFirstOverlapParent->mpWindowImpl->mpLastOverlap = this; 1069cdf0e10cSrcweir else 1070cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this; 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir else 1073cdf0e10cSrcweir { 1074cdf0e10cSrcweir if ( pParent->ImplIsOverlapWindow() ) 1075cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = pParent; 1076cdf0e10cSrcweir else 1077cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = pParent->mpWindowImpl->mpOverlapWindow; 1078cdf0e10cSrcweir mpWindowImpl->mpPrev = pParent->mpWindowImpl->mpLastChild; 1079cdf0e10cSrcweir pParent->mpWindowImpl->mpLastChild = this; 1080cdf0e10cSrcweir if ( !pParent->mpWindowImpl->mpFirstChild ) 1081cdf0e10cSrcweir pParent->mpWindowImpl->mpFirstChild = this; 1082cdf0e10cSrcweir else 1083cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this; 1084cdf0e10cSrcweir } 1085cdf0e10cSrcweir } 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir // ----------------------------------------------------------------------- 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir void Window::ImplRemoveWindow( sal_Bool bRemoveFrameData ) 1091cdf0e10cSrcweir { 1092cdf0e10cSrcweir // Fenster aus den Listen austragen 1093cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame ) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstOverlap == this ) 1098cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFirstOverlap = mpWindowImpl->mpNextOverlap; 1099cdf0e10cSrcweir else 1100cdf0e10cSrcweir { 1101cdf0e10cSrcweir Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap; 1102cdf0e10cSrcweir while ( pTempWin->mpWindowImpl->mpNextOverlap != this ) 1103cdf0e10cSrcweir pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; 1104cdf0e10cSrcweir pTempWin->mpWindowImpl->mpNextOverlap = mpWindowImpl->mpNextOverlap; 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 1108cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 1109cdf0e10cSrcweir else 1110cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext; 1111cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 1112cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 1113cdf0e10cSrcweir else 1114cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; 1115cdf0e10cSrcweir } 1116cdf0e10cSrcweir else 1117cdf0e10cSrcweir { 1118cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 1119cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 1120cdf0e10cSrcweir else 1121cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext; 1122cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 1123cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 1124cdf0e10cSrcweir else 1125cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev; 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir mpWindowImpl->mpPrev = NULL; 1129cdf0e10cSrcweir mpWindowImpl->mpNext = NULL; 1130cdf0e10cSrcweir } 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir if ( bRemoveFrameData ) 1133cdf0e10cSrcweir { 1134cdf0e10cSrcweir // Graphic freigeben 1135cdf0e10cSrcweir ImplReleaseGraphics(); 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir } 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir // ----------------------------------------------------------------------- 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir void Window::ImplCallResize() 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir mpWindowImpl->mbCallResize = sal_False; 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir if( GetBackground().IsGradient() ) 1146cdf0e10cSrcweir Invalidate(); 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir Resize(); 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir // #88419# Most classes don't call the base class in Resize() and Move(), 1151cdf0e10cSrcweir // => Call ImpleResize/Move instead of Resize/Move directly... 1152cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE ); 1153cdf0e10cSrcweir 1154cdf0e10cSrcweir ImplExtResize(); 1155cdf0e10cSrcweir } 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir // ----------------------------------------------------------------------- 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir void Window::ImplCallMove() 1160cdf0e10cSrcweir { 1161cdf0e10cSrcweir mpWindowImpl->mbCallMove = sal_False; 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir if( mpWindowImpl->mbFrame ) 1164cdf0e10cSrcweir { 1165cdf0e10cSrcweir // update frame position 1166cdf0e10cSrcweir SalFrame *pParentFrame = NULL; 1167cdf0e10cSrcweir Window *pParent = ImplGetParent(); 1168cdf0e10cSrcweir while( pParent ) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir if( pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame ) 1171cdf0e10cSrcweir { 1172cdf0e10cSrcweir pParentFrame = pParent->mpWindowImpl->mpFrame; 1173cdf0e10cSrcweir break; 1174cdf0e10cSrcweir } 1175cdf0e10cSrcweir pParent = pParent->GetParent(); 1176cdf0e10cSrcweir } 1177cdf0e10cSrcweir 1178cdf0e10cSrcweir SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); 1179cdf0e10cSrcweir mpWindowImpl->maPos = Point( g.nX, g.nY ); 1180cdf0e10cSrcweir if( pParentFrame ) 1181cdf0e10cSrcweir { 1182cdf0e10cSrcweir g = pParentFrame->GetGeometry(); 1183cdf0e10cSrcweir mpWindowImpl->maPos -= Point( g.nX, g.nY ); 1184cdf0e10cSrcweir } 1185cdf0e10cSrcweir // the client window and and all its subclients have the same position as the borderframe 1186cdf0e10cSrcweir // this is important for floating toolbars where the borderwindow is a floating window 1187cdf0e10cSrcweir // which has another borderwindow (ie the system floating window) 1188cdf0e10cSrcweir Window *pClientWin = mpWindowImpl->mpClientWindow; 1189cdf0e10cSrcweir while( pClientWin ) 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir pClientWin->mpWindowImpl->maPos = mpWindowImpl->maPos; 1192cdf0e10cSrcweir pClientWin = pClientWin->mpWindowImpl->mpClientWindow; 1193cdf0e10cSrcweir } 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir Move(); 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOVE ); 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir 1201cdf0e10cSrcweir // ----------------------------------------------------------------------- 1202cdf0e10cSrcweir 1203cdf0e10cSrcweir static rtl::OString ImplAutoHelpID( ResMgr* pResMgr ) 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir rtl::OString aRet; 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir if( pResMgr && Application::IsAutoHelpIdEnabled() ) 1208cdf0e10cSrcweir aRet = pResMgr->GetAutoHelpId(); 1209cdf0e10cSrcweir 1210cdf0e10cSrcweir return aRet; 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir // ----------------------------------------------------------------------- 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir WinBits Window::ImplInitRes( const ResId& rResId ) 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir GetRes( rResId ); 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir char* pRes = (char*)GetClassRes(); 1220cdf0e10cSrcweir pRes += 8; 1221cdf0e10cSrcweir sal_uInt32 nStyle = (sal_uInt32)GetLongRes( (void*)pRes ); 1222cdf0e10cSrcweir rResId.SetWinBits( nStyle ); 1223cdf0e10cSrcweir return nStyle; 1224cdf0e10cSrcweir } 1225cdf0e10cSrcweir 1226cdf0e10cSrcweir // ----------------------------------------------------------------------- 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir void Window::ImplLoadRes( const ResId& rResId ) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir sal_uLong nObjMask = ReadLongRes(); 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir // we need to calculate auto helpids before the resource gets closed 1233cdf0e10cSrcweir // if the resource only contains flags, it will be closed before we try to read a help id 1234cdf0e10cSrcweir // so we always create an auto help id that might be overwritten later 1235cdf0e10cSrcweir // HelpId 1236cdf0e10cSrcweir rtl::OString aHelpId = ImplAutoHelpID( rResId.GetResMgr() ); 1237cdf0e10cSrcweir 1238cdf0e10cSrcweir // ResourceStyle 1239cdf0e10cSrcweir sal_uLong nRSStyle = ReadLongRes(); 1240cdf0e10cSrcweir // WinBits 1241cdf0e10cSrcweir ReadLongRes(); 1242cdf0e10cSrcweir 1243cdf0e10cSrcweir if( nObjMask & WINDOW_HELPID ) 1244cdf0e10cSrcweir aHelpId = ReadByteStringRes(); 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir SetHelpId( aHelpId ); 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir sal_Bool bPos = sal_False; 1249cdf0e10cSrcweir sal_Bool bSize = sal_False; 1250cdf0e10cSrcweir Point aPos; 1251cdf0e10cSrcweir Size aSize; 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir if ( nObjMask & (WINDOW_XYMAPMODE | WINDOW_X | WINDOW_Y) ) 1254cdf0e10cSrcweir { 1255cdf0e10cSrcweir // Groessenangabe aus der Resource verwenden 1256cdf0e10cSrcweir MapUnit ePosMap = MAP_PIXEL; 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir bPos = sal_True; 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir if ( nObjMask & WINDOW_XYMAPMODE ) 1261cdf0e10cSrcweir ePosMap = (MapUnit)ReadLongRes(); 1262cdf0e10cSrcweir if ( nObjMask & WINDOW_X ) 1263cdf0e10cSrcweir aPos.X() = ImplLogicUnitToPixelX( ReadLongRes(), ePosMap ); 1264cdf0e10cSrcweir if ( nObjMask & WINDOW_Y ) 1265cdf0e10cSrcweir aPos.Y() = ImplLogicUnitToPixelY( ReadLongRes(), ePosMap ); 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir 1268cdf0e10cSrcweir if ( nObjMask & (WINDOW_WHMAPMODE | WINDOW_WIDTH | WINDOW_HEIGHT) ) 1269cdf0e10cSrcweir { 1270cdf0e10cSrcweir // Groessenangabe aus der Resource verwenden 1271cdf0e10cSrcweir MapUnit eSizeMap = MAP_PIXEL; 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir bSize = sal_True; 1274cdf0e10cSrcweir 1275cdf0e10cSrcweir if ( nObjMask & WINDOW_WHMAPMODE ) 1276cdf0e10cSrcweir eSizeMap = (MapUnit)ReadLongRes(); 1277cdf0e10cSrcweir if ( nObjMask & WINDOW_WIDTH ) 1278cdf0e10cSrcweir aSize.Width() = ImplLogicUnitToPixelX( ReadLongRes(), eSizeMap ); 1279cdf0e10cSrcweir if ( nObjMask & WINDOW_HEIGHT ) 1280cdf0e10cSrcweir aSize.Height() = ImplLogicUnitToPixelY( ReadLongRes(), eSizeMap ); 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir 1283cdf0e10cSrcweir // Wegen Optimierung so schlimm aussehend 1284cdf0e10cSrcweir if ( nRSStyle & RSWND_CLIENTSIZE ) 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir if ( bPos ) 1287cdf0e10cSrcweir SetPosPixel( aPos ); 1288cdf0e10cSrcweir if ( bSize ) 1289cdf0e10cSrcweir SetOutputSizePixel( aSize ); 1290cdf0e10cSrcweir } 1291cdf0e10cSrcweir else if ( bPos && bSize ) 1292cdf0e10cSrcweir SetPosSizePixel( aPos, aSize ); 1293cdf0e10cSrcweir else if ( bPos ) 1294cdf0e10cSrcweir SetPosPixel( aPos ); 1295cdf0e10cSrcweir else if ( bSize ) 1296cdf0e10cSrcweir SetSizePixel( aSize ); 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir if ( nRSStyle & RSWND_DISABLED ) 1299cdf0e10cSrcweir Enable( sal_False ); 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir if ( nObjMask & WINDOW_TEXT ) 1302cdf0e10cSrcweir SetText( ReadStringRes() ); 1303cdf0e10cSrcweir if ( nObjMask & WINDOW_HELPTEXT ) 1304cdf0e10cSrcweir { 1305cdf0e10cSrcweir SetHelpText( ReadStringRes() ); 1306cdf0e10cSrcweir mpWindowImpl->mbHelpTextDynamic = sal_True; 1307cdf0e10cSrcweir } 1308cdf0e10cSrcweir if ( nObjMask & WINDOW_QUICKTEXT ) 1309cdf0e10cSrcweir SetQuickHelpText( ReadStringRes() ); 1310cdf0e10cSrcweir if ( nObjMask & WINDOW_EXTRALONG ) 1311cdf0e10cSrcweir SetData( (void*)ReadLongRes() ); 1312cdf0e10cSrcweir if ( nObjMask & WINDOW_UNIQUEID ) 1313cdf0e10cSrcweir SetUniqueId( ReadByteStringRes() ); 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir if ( nObjMask & WINDOW_BORDER_STYLE ) 1316cdf0e10cSrcweir { 1317cdf0e10cSrcweir sal_uInt16 nBorderStyle = (sal_uInt16)ReadLongRes(); 1318cdf0e10cSrcweir SetBorderStyle( nBorderStyle ); 1319cdf0e10cSrcweir } 1320cdf0e10cSrcweir } 1321cdf0e10cSrcweir 1322cdf0e10cSrcweir // ----------------------------------------------------------------------- 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir ImplWinData* Window::ImplGetWinData() const 1325cdf0e10cSrcweir { 1326cdf0e10cSrcweir if ( !mpWindowImpl->mpWinData ) 1327cdf0e10cSrcweir { 1328cdf0e10cSrcweir static const char* pNoNWF = getenv( "SAL_NO_NWF" ); 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir ((Window*)this)->mpWindowImpl->mpWinData = new ImplWinData; 1331cdf0e10cSrcweir mpWindowImpl->mpWinData->mpExtOldText = NULL; 1332cdf0e10cSrcweir mpWindowImpl->mpWinData->mpExtOldAttrAry = NULL; 1333cdf0e10cSrcweir mpWindowImpl->mpWinData->mpCursorRect = 0; 1334cdf0e10cSrcweir mpWindowImpl->mpWinData->mnCursorExtWidth = 0; 1335cdf0e10cSrcweir mpWindowImpl->mpWinData->mpFocusRect = NULL; 1336cdf0e10cSrcweir mpWindowImpl->mpWinData->mpTrackRect = NULL; 1337cdf0e10cSrcweir mpWindowImpl->mpWinData->mnTrackFlags = 0; 1338cdf0e10cSrcweir mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow()) 1339cdf0e10cSrcweir mpWindowImpl->mpWinData->mbMouseOver = sal_False; 1340cdf0e10cSrcweir mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? sal_False : sal_True; // sal_True: try to draw this control with native theme API 1341cdf0e10cSrcweir } 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir return mpWindowImpl->mpWinData; 1344cdf0e10cSrcweir } 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir // ----------------------------------------------------------------------- 1347cdf0e10cSrcweir 1348cdf0e10cSrcweir SalGraphics* Window::ImplGetFrameGraphics() const 1349cdf0e10cSrcweir { 1350cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow->mpGraphics ) 1351cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->mbInitClipRegion = sal_True; 1352cdf0e10cSrcweir else 1353cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->ImplGetGraphics(); 1354cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion(); 1355cdf0e10cSrcweir return mpWindowImpl->mpFrameWindow->mpGraphics; 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir // ----------------------------------------------------------------------- 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir Window* Window::ImplFindWindow( const Point& rFramePos ) 1361cdf0e10cSrcweir { 1362cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir Window* pTempWindow; 1365cdf0e10cSrcweir Window* pFindWindow; 1366cdf0e10cSrcweir 1367cdf0e10cSrcweir // Zuerst alle ueberlappenden Fenster ueberpruefen 1368cdf0e10cSrcweir pTempWindow = mpWindowImpl->mpFirstOverlap; 1369cdf0e10cSrcweir while ( pTempWindow ) 1370cdf0e10cSrcweir { 1371cdf0e10cSrcweir pFindWindow = pTempWindow->ImplFindWindow( rFramePos ); 1372cdf0e10cSrcweir if ( pFindWindow ) 1373cdf0e10cSrcweir return pFindWindow; 1374cdf0e10cSrcweir pTempWindow = pTempWindow->mpWindowImpl->mpNext; 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir // dann testen wir unser Fenster 1378cdf0e10cSrcweir if ( !mpWindowImpl->mbVisible ) 1379cdf0e10cSrcweir return NULL; 1380cdf0e10cSrcweir 1381cdf0e10cSrcweir sal_uInt16 nHitTest = ImplHitTest( rFramePos ); 1382cdf0e10cSrcweir if ( nHitTest & WINDOW_HITTEST_INSIDE ) 1383cdf0e10cSrcweir { 1384cdf0e10cSrcweir // und danach gehen wir noch alle Child-Fenster durch 1385cdf0e10cSrcweir pTempWindow = mpWindowImpl->mpFirstChild; 1386cdf0e10cSrcweir while ( pTempWindow ) 1387cdf0e10cSrcweir { 1388cdf0e10cSrcweir pFindWindow = pTempWindow->ImplFindWindow( rFramePos ); 1389cdf0e10cSrcweir if ( pFindWindow ) 1390cdf0e10cSrcweir return pFindWindow; 1391cdf0e10cSrcweir pTempWindow = pTempWindow->mpWindowImpl->mpNext; 1392cdf0e10cSrcweir } 1393cdf0e10cSrcweir 1394cdf0e10cSrcweir if ( nHitTest & WINDOW_HITTEST_TRANSPARENT ) 1395cdf0e10cSrcweir return NULL; 1396cdf0e10cSrcweir else 1397cdf0e10cSrcweir return this; 1398cdf0e10cSrcweir } 1399cdf0e10cSrcweir 1400cdf0e10cSrcweir return NULL; 1401cdf0e10cSrcweir } 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir // ----------------------------------------------------------------------- 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir sal_uInt16 Window::ImplHitTest( const Point& rFramePos ) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir Point aFramePos( rFramePos ); 1408cdf0e10cSrcweir if( ImplIsAntiparallel() ) 1409cdf0e10cSrcweir { 1410cdf0e10cSrcweir // - RTL - re-mirror frame pos at this window 1411cdf0e10cSrcweir ImplReMirror( aFramePos ); 1412cdf0e10cSrcweir } 1413cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 1414cdf0e10cSrcweir if ( !aRect.IsInside( aFramePos ) ) 1415cdf0e10cSrcweir return 0; 1416cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 1417cdf0e10cSrcweir { 1418cdf0e10cSrcweir Point aTempPos = aFramePos; 1419cdf0e10cSrcweir aTempPos.X() -= mnOutOffX; 1420cdf0e10cSrcweir aTempPos.Y() -= mnOutOffY; 1421cdf0e10cSrcweir if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) ) 1422cdf0e10cSrcweir return 0; 1423cdf0e10cSrcweir } 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir sal_uInt16 nHitTest = WINDOW_HITTEST_INSIDE; 1426cdf0e10cSrcweir if ( mpWindowImpl->mbMouseTransparent ) 1427cdf0e10cSrcweir nHitTest |= WINDOW_HITTEST_TRANSPARENT; 1428cdf0e10cSrcweir return nHitTest; 1429cdf0e10cSrcweir } 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir // ----------------------------------------------------------------------- 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir sal_Bool Window::ImplIsRealParentPath( const Window* pWindow ) const 1434cdf0e10cSrcweir { 1435cdf0e10cSrcweir pWindow = pWindow->GetParent(); 1436cdf0e10cSrcweir while ( pWindow ) 1437cdf0e10cSrcweir { 1438cdf0e10cSrcweir if ( pWindow == this ) 1439cdf0e10cSrcweir return sal_True; 1440cdf0e10cSrcweir pWindow = pWindow->GetParent(); 1441cdf0e10cSrcweir } 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir return sal_False; 1444cdf0e10cSrcweir } 1445cdf0e10cSrcweir 1446cdf0e10cSrcweir // ----------------------------------------------------------------------- 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir sal_Bool Window::ImplIsChild( const Window* pWindow, sal_Bool bSystemWindow ) const 1449cdf0e10cSrcweir { 1450cdf0e10cSrcweir do 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() ) 1453cdf0e10cSrcweir break; 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 1456cdf0e10cSrcweir 1457cdf0e10cSrcweir if ( pWindow == this ) 1458cdf0e10cSrcweir return sal_True; 1459cdf0e10cSrcweir } 1460cdf0e10cSrcweir while ( pWindow ); 1461cdf0e10cSrcweir 1462cdf0e10cSrcweir return sal_False; 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir // ----------------------------------------------------------------------- 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir sal_Bool Window::ImplIsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir if ( this == pWindow ) 1470cdf0e10cSrcweir return sal_True; 1471cdf0e10cSrcweir return ImplIsChild( pWindow, bSystemWindow ); 1472cdf0e10cSrcweir } 1473cdf0e10cSrcweir 1474cdf0e10cSrcweir // ----------------------------------------------------------------------- 1475cdf0e10cSrcweir 1476cdf0e10cSrcweir Window* Window::ImplGetSameParent( const Window* pWindow ) const 1477cdf0e10cSrcweir { 1478cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow != pWindow->mpWindowImpl->mpFrameWindow ) 1479cdf0e10cSrcweir return NULL; 1480cdf0e10cSrcweir else 1481cdf0e10cSrcweir { 1482cdf0e10cSrcweir if ( pWindow->ImplIsChild( this ) ) 1483cdf0e10cSrcweir return (Window*)pWindow; 1484cdf0e10cSrcweir else 1485cdf0e10cSrcweir { 1486cdf0e10cSrcweir Window* pTestWindow = (Window*)this; 1487cdf0e10cSrcweir while ( (pTestWindow == pWindow) || pTestWindow->ImplIsChild( pWindow ) ) 1488cdf0e10cSrcweir pTestWindow = pTestWindow->ImplGetParent(); 1489cdf0e10cSrcweir return pTestWindow; 1490cdf0e10cSrcweir } 1491cdf0e10cSrcweir } 1492cdf0e10cSrcweir } 1493cdf0e10cSrcweir 1494cdf0e10cSrcweir // ----------------------------------------------------------------------- 1495cdf0e10cSrcweir 1496cdf0e10cSrcweir int Window::ImplTestMousePointerSet() 1497cdf0e10cSrcweir { 1498cdf0e10cSrcweir // Wenn Mouse gecaptured ist, dann soll MousePointer umgeschaltet werden 1499cdf0e10cSrcweir if ( IsMouseCaptured() ) 1500cdf0e10cSrcweir return sal_True; 1501cdf0e10cSrcweir 1502cdf0e10cSrcweir // Wenn sich Mouse ueber dem Fenster befindet, dann soll MousePointer 1503cdf0e10cSrcweir // umgeschaltet werden 1504cdf0e10cSrcweir Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() ); 1505cdf0e10cSrcweir if ( aClientRect.IsInside( GetPointerPosPixel() ) ) 1506cdf0e10cSrcweir return sal_True; 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir return sal_False; 1509cdf0e10cSrcweir } 1510cdf0e10cSrcweir 1511cdf0e10cSrcweir // ----------------------------------------------------------------------- 1512cdf0e10cSrcweir 1513cdf0e10cSrcweir PointerStyle Window::ImplGetMousePointer() const 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir PointerStyle ePointerStyle; 1516cdf0e10cSrcweir sal_Bool bWait = sal_False; 1517cdf0e10cSrcweir 1518cdf0e10cSrcweir if ( IsEnabled() && IsInputEnabled() && ! IsInModalMode() ) 1519cdf0e10cSrcweir ePointerStyle = GetPointer().GetStyle(); 1520cdf0e10cSrcweir else 1521cdf0e10cSrcweir ePointerStyle = POINTER_ARROW; 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir const Window* pWindow = this; 1524cdf0e10cSrcweir do 1525cdf0e10cSrcweir { 1526cdf0e10cSrcweir // Wenn Pointer nicht sichtbar, dann wird suche abgebrochen, da 1527cdf0e10cSrcweir // dieser Status nicht ueberschrieben werden darf 1528cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbNoPtrVisible ) 1529cdf0e10cSrcweir return POINTER_NULL; 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir if ( !bWait ) 1532cdf0e10cSrcweir { 1533cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mnWaitCount ) 1534cdf0e10cSrcweir { 1535cdf0e10cSrcweir ePointerStyle = POINTER_WAIT; 1536cdf0e10cSrcweir bWait = sal_True; 1537cdf0e10cSrcweir } 1538cdf0e10cSrcweir else 1539cdf0e10cSrcweir { 1540cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbChildPtrOverwrite ) 1541cdf0e10cSrcweir ePointerStyle = pWindow->GetPointer().GetStyle(); 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir } 1544cdf0e10cSrcweir 1545cdf0e10cSrcweir if ( pWindow->ImplIsOverlapWindow() ) 1546cdf0e10cSrcweir break; 1547cdf0e10cSrcweir 1548cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 1549cdf0e10cSrcweir } 1550cdf0e10cSrcweir while ( pWindow ); 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir return ePointerStyle; 1553cdf0e10cSrcweir } 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir // ----------------------------------------------------------------------- 1556cdf0e10cSrcweir 1557cdf0e10cSrcweir void Window::ImplResetReallyVisible() 1558cdf0e10cSrcweir { 1559cdf0e10cSrcweir sal_Bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible; 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir mbDevOutput = sal_False; 1562cdf0e10cSrcweir mpWindowImpl->mbReallyVisible = sal_False; 1563cdf0e10cSrcweir mpWindowImpl->mbReallyShown = sal_False; 1564cdf0e10cSrcweir 1565cdf0e10cSrcweir // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge. 1566cdf0e10cSrcweir // For this, the data member of the event must not be NULL. 1567cdf0e10cSrcweir // Previously, we did this in Window::Show, but there some events got lost in certain situations. 1568cdf0e10cSrcweir // #104887# - 2004-08-10 - fs@openoffice.org 1569cdf0e10cSrcweir if( bBecameReallyInvisible && ImplIsAccessibleCandidate() ) 1570cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_HIDE, this ); 1571cdf0e10cSrcweir // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_HIDE. Normally, we should 1572cdf0e10cSrcweir // introduce another event which explicitly triggers the Accessibility implementations. 1573cdf0e10cSrcweir 1574cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 1575cdf0e10cSrcweir while ( pWindow ) 1576cdf0e10cSrcweir { 1577cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 1578cdf0e10cSrcweir pWindow->ImplResetReallyVisible(); 1579cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1580cdf0e10cSrcweir } 1581cdf0e10cSrcweir 1582cdf0e10cSrcweir pWindow = mpWindowImpl->mpFirstChild; 1583cdf0e10cSrcweir while ( pWindow ) 1584cdf0e10cSrcweir { 1585cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 1586cdf0e10cSrcweir pWindow->ImplResetReallyVisible(); 1587cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1588cdf0e10cSrcweir } 1589cdf0e10cSrcweir } 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir // ----------------------------------------------------------------------- 1592cdf0e10cSrcweir 1593cdf0e10cSrcweir void Window::ImplSetReallyVisible() 1594cdf0e10cSrcweir { 1595cdf0e10cSrcweir // #i43594# it is possible that INITSHOW was never send, because the visibility state changed between 1596cdf0e10cSrcweir // ImplCallInitShow() and ImplSetReallyVisible() when called from Show() 1597cdf0e10cSrcweir // mbReallyShown is a useful indicator 1598cdf0e10cSrcweir if( !mpWindowImpl->mbReallyShown ) 1599cdf0e10cSrcweir ImplCallInitShow(); 1600cdf0e10cSrcweir 1601cdf0e10cSrcweir sal_Bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible; 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir mbDevOutput = sal_True; 1604cdf0e10cSrcweir mpWindowImpl->mbReallyVisible = sal_True; 1605cdf0e10cSrcweir mpWindowImpl->mbReallyShown = sal_True; 1606cdf0e10cSrcweir 1607cdf0e10cSrcweir // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge. 1608cdf0e10cSrcweir // For this, the data member of the event must not be NULL. 1609cdf0e10cSrcweir // Previously, we did this in Window::Show, but there some events got lost in certain situations. Now 1610cdf0e10cSrcweir // we're doing it when the visibility really changes 1611cdf0e10cSrcweir // #104887# - 2004-08-10 - fs@openoffice.org 1612cdf0e10cSrcweir if( bBecameReallyVisible && ImplIsAccessibleCandidate() ) 1613cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_SHOW, this ); 1614cdf0e10cSrcweir // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_SHOW. Normally, we should 1615cdf0e10cSrcweir // introduce another event which explicitly triggers the Accessibility implementations. 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 1618cdf0e10cSrcweir while ( pWindow ) 1619cdf0e10cSrcweir { 1620cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbVisible ) 1621cdf0e10cSrcweir pWindow->ImplSetReallyVisible(); 1622cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1623cdf0e10cSrcweir } 1624cdf0e10cSrcweir 1625cdf0e10cSrcweir pWindow = mpWindowImpl->mpFirstChild; 1626cdf0e10cSrcweir while ( pWindow ) 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbVisible ) 1629cdf0e10cSrcweir pWindow->ImplSetReallyVisible(); 1630cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1631cdf0e10cSrcweir } 1632cdf0e10cSrcweir } 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir // ----------------------------------------------------------------------- 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir void Window::ImplCallInitShow() 1637cdf0e10cSrcweir { 1638cdf0e10cSrcweir mpWindowImpl->mbReallyShown = sal_True; 1639cdf0e10cSrcweir mpWindowImpl->mbInInitShow = sal_True; 1640cdf0e10cSrcweir StateChanged( STATE_CHANGE_INITSHOW ); 1641cdf0e10cSrcweir mpWindowImpl->mbInInitShow = sal_False; 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 1644cdf0e10cSrcweir while ( pWindow ) 1645cdf0e10cSrcweir { 1646cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbVisible ) 1647cdf0e10cSrcweir pWindow->ImplCallInitShow(); 1648cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1649cdf0e10cSrcweir } 1650cdf0e10cSrcweir 1651cdf0e10cSrcweir pWindow = mpWindowImpl->mpFirstChild; 1652cdf0e10cSrcweir while ( pWindow ) 1653cdf0e10cSrcweir { 1654cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbVisible ) 1655cdf0e10cSrcweir pWindow->ImplCallInitShow(); 1656cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir } 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir // ----------------------------------------------------------------------- 1661cdf0e10cSrcweir 166286e1cf34SPedro Giffuni void Window::ImplAddDel( ImplDelData* pDel ) // TODO: make "const" when incompatibility ok 1663cdf0e10cSrcweir { 1664cdf0e10cSrcweir DBG_ASSERT( !pDel->mpWindow, "Window::ImplAddDel(): cannot add ImplDelData twice !" ); 1665cdf0e10cSrcweir if( !pDel->mpWindow ) 1666cdf0e10cSrcweir { 1667cdf0e10cSrcweir pDel->mpWindow = this; // #112873# store ref to this window, so pDel can remove itself 1668cdf0e10cSrcweir pDel->mpNext = mpWindowImpl->mpFirstDel; 1669cdf0e10cSrcweir mpWindowImpl->mpFirstDel = pDel; 1670cdf0e10cSrcweir } 1671cdf0e10cSrcweir } 1672cdf0e10cSrcweir 1673cdf0e10cSrcweir // ----------------------------------------------------------------------- 1674cdf0e10cSrcweir 167586e1cf34SPedro Giffuni void Window::ImplRemoveDel( ImplDelData* pDel ) // TODO: make "const" when incompatibility ok 1676cdf0e10cSrcweir { 1677cdf0e10cSrcweir pDel->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore 1678cdf0e10cSrcweir if ( mpWindowImpl->mpFirstDel == pDel ) 1679cdf0e10cSrcweir mpWindowImpl->mpFirstDel = pDel->mpNext; 1680cdf0e10cSrcweir else 1681cdf0e10cSrcweir { 1682cdf0e10cSrcweir ImplDelData* pData = mpWindowImpl->mpFirstDel; 1683cdf0e10cSrcweir while ( pData->mpNext != pDel ) 1684cdf0e10cSrcweir pData = pData->mpNext; 1685cdf0e10cSrcweir pData->mpNext = pDel->mpNext; 1686cdf0e10cSrcweir } 1687cdf0e10cSrcweir } 1688cdf0e10cSrcweir 1689cdf0e10cSrcweir // ----------------------------------------------------------------------- 1690cdf0e10cSrcweir 1691cdf0e10cSrcweir void Window::ImplInitResolutionSettings() 1692cdf0e10cSrcweir { 1693cdf0e10cSrcweir // AppFont-Aufloesung und DPI-Aufloesung neu berechnen 1694cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 1695cdf0e10cSrcweir { 1696cdf0e10cSrcweir const StyleSettings& rStyleSettings = maSettings.GetStyleSettings(); 1697cdf0e10cSrcweir sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom(); 1698cdf0e10cSrcweir mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100; 1699cdf0e10cSrcweir mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100; 1700cdf0e10cSrcweir SetPointFont( rStyleSettings.GetAppFont() ); 1701cdf0e10cSrcweir } 1702cdf0e10cSrcweir else if ( mpWindowImpl->mpParent ) 1703cdf0e10cSrcweir { 1704cdf0e10cSrcweir mnDPIX = mpWindowImpl->mpParent->mnDPIX; 1705cdf0e10cSrcweir mnDPIY = mpWindowImpl->mpParent->mnDPIY; 1706cdf0e10cSrcweir } 1707cdf0e10cSrcweir 1708cdf0e10cSrcweir // Vorberechnete Werte fuer logische Einheiten updaten und auch 1709cdf0e10cSrcweir // die entsprechenden Tools dazu 1710cdf0e10cSrcweir if ( IsMapMode() ) 1711cdf0e10cSrcweir { 1712cdf0e10cSrcweir MapMode aMapMode = GetMapMode(); 1713cdf0e10cSrcweir SetMapMode(); 1714cdf0e10cSrcweir SetMapMode( aMapMode ); 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir } 1717cdf0e10cSrcweir 1718cdf0e10cSrcweir // ----------------------------------------------------------------------- 1719cdf0e10cSrcweir 1720cdf0e10cSrcweir void Window::ImplPointToLogic( Font& rFont ) const 1721cdf0e10cSrcweir { 1722cdf0e10cSrcweir Size aSize = rFont.GetSize(); 1723cdf0e10cSrcweir sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir if ( aSize.Width() ) 1726cdf0e10cSrcweir { 1727cdf0e10cSrcweir aSize.Width() *= mpWindowImpl->mpFrameData->mnDPIX; 1728cdf0e10cSrcweir aSize.Width() += 72/2; 1729cdf0e10cSrcweir aSize.Width() /= 72; 1730cdf0e10cSrcweir aSize.Width() *= nScreenFontZoom; 1731cdf0e10cSrcweir aSize.Width() /= 100; 1732cdf0e10cSrcweir } 1733cdf0e10cSrcweir aSize.Height() *= mpWindowImpl->mpFrameData->mnDPIY; 1734cdf0e10cSrcweir aSize.Height() += 72/2; 1735cdf0e10cSrcweir aSize.Height() /= 72; 1736cdf0e10cSrcweir aSize.Height() *= nScreenFontZoom; 1737cdf0e10cSrcweir aSize.Height() /= 100; 1738cdf0e10cSrcweir 1739cdf0e10cSrcweir if ( IsMapModeEnabled() ) 1740cdf0e10cSrcweir aSize = PixelToLogic( aSize ); 1741cdf0e10cSrcweir 1742cdf0e10cSrcweir rFont.SetSize( aSize ); 1743cdf0e10cSrcweir } 1744cdf0e10cSrcweir 1745cdf0e10cSrcweir // ----------------------------------------------------------------------- 1746cdf0e10cSrcweir 1747cdf0e10cSrcweir void Window::ImplLogicToPoint( Font& rFont ) const 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir Size aSize = rFont.GetSize(); 1750cdf0e10cSrcweir sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom(); 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir if ( IsMapModeEnabled() ) 1753cdf0e10cSrcweir aSize = LogicToPixel( aSize ); 1754cdf0e10cSrcweir 1755cdf0e10cSrcweir if ( aSize.Width() ) 1756cdf0e10cSrcweir { 1757cdf0e10cSrcweir aSize.Width() *= 100; 1758cdf0e10cSrcweir aSize.Width() /= nScreenFontZoom; 1759cdf0e10cSrcweir aSize.Width() *= 72; 1760cdf0e10cSrcweir aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX/2; 1761cdf0e10cSrcweir aSize.Width() /= mpWindowImpl->mpFrameData->mnDPIX; 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir aSize.Height() *= 100; 1764cdf0e10cSrcweir aSize.Height() /= nScreenFontZoom; 1765cdf0e10cSrcweir aSize.Height() *= 72; 1766cdf0e10cSrcweir aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY/2; 1767cdf0e10cSrcweir aSize.Height() /= mpWindowImpl->mpFrameData->mnDPIY; 1768cdf0e10cSrcweir 1769cdf0e10cSrcweir rFont.SetSize( aSize ); 1770cdf0e10cSrcweir } 1771cdf0e10cSrcweir 1772cdf0e10cSrcweir // ----------------------------------------------------------------------- 1773cdf0e10cSrcweir 1774cdf0e10cSrcweir sal_Bool Window::ImplSysObjClip( const Region* pOldRegion ) 1775cdf0e10cSrcweir { 1776cdf0e10cSrcweir sal_Bool bUpdate = sal_True; 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir sal_Bool bVisibleState = mpWindowImpl->mbReallyVisible; 1781cdf0e10cSrcweir 1782cdf0e10cSrcweir if ( bVisibleState ) 1783cdf0e10cSrcweir { 1784cdf0e10cSrcweir Region* pWinChildClipRegion = ImplGetWinChildClipRegion(); 1785cdf0e10cSrcweir 1786cdf0e10cSrcweir if ( !pWinChildClipRegion->IsEmpty() ) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir if ( pOldRegion ) 1789cdf0e10cSrcweir { 1790cdf0e10cSrcweir Region aNewRegion = *pWinChildClipRegion; 1791cdf0e10cSrcweir pWinChildClipRegion->Intersect( *pOldRegion ); 1792cdf0e10cSrcweir bUpdate = aNewRegion == *pWinChildClipRegion; 1793cdf0e10cSrcweir } 1794cdf0e10cSrcweir 1795cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 1796cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 1797cdf0e10cSrcweir 1798cdf0e10cSrcweir Region aRegion = *pWinChildClipRegion; 1799cdf0e10cSrcweir Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 1800cdf0e10cSrcweir Region aWinRectRegion( aWinRect ); 1801cdf0e10cSrcweir sal_uInt16 nClipFlags = mpWindowImpl->mpSysObj->GetClipRegionType(); 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir if ( aRegion == aWinRectRegion ) 1804cdf0e10cSrcweir mpWindowImpl->mpSysObj->ResetClipRegion(); 1805cdf0e10cSrcweir else 1806cdf0e10cSrcweir { 1807cdf0e10cSrcweir if ( nClipFlags & SAL_OBJECT_CLIP_EXCLUDERECTS ) 1808cdf0e10cSrcweir { 1809cdf0e10cSrcweir aWinRectRegion.Exclude( aRegion ); 1810cdf0e10cSrcweir aRegion = aWinRectRegion; 1811cdf0e10cSrcweir } 1812cdf0e10cSrcweir if ( !(nClipFlags & SAL_OBJECT_CLIP_ABSOLUTE) ) 1813cdf0e10cSrcweir aRegion.Move( -mnOutOffX, -mnOutOffY ); 1814cdf0e10cSrcweir 1815cdf0e10cSrcweir // ClipRegion setzen/updaten 1816e6f63103SArmin Le Grand RectangleVector aRectangles; 1817e6f63103SArmin Le Grand aRegion.GetRegionRectangles(aRectangles); 1818e6f63103SArmin Le Grand mpWindowImpl->mpSysObj->BeginSetClipRegion(aRectangles.size()); 1819cdf0e10cSrcweir 1820e6f63103SArmin Le Grand for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++) 1821cdf0e10cSrcweir { 1822e6f63103SArmin Le Grand mpWindowImpl->mpSysObj->UnionClipRegion( 1823e6f63103SArmin Le Grand aRectIter->Left(), 1824e6f63103SArmin Le Grand aRectIter->Top(), 1825e6f63103SArmin Le Grand aRectIter->GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does 1826e6f63103SArmin Le Grand aRectIter->GetHeight()); // same for height 1827cdf0e10cSrcweir } 1828e6f63103SArmin Le Grand 1829cdf0e10cSrcweir mpWindowImpl->mpSysObj->EndSetClipRegion(); 1830e6f63103SArmin Le Grand 1831e6f63103SArmin Le Grand //long nX; 1832e6f63103SArmin Le Grand //long nY; 1833e6f63103SArmin Le Grand //long nWidth; 1834e6f63103SArmin Le Grand //long nHeight; 1835e6f63103SArmin Le Grand //sal_uLong nRectCount; 1836e6f63103SArmin Le Grand //ImplRegionInfo aInfo; 1837e6f63103SArmin Le Grand //sal_Bool bRegionRect; 1838e6f63103SArmin Le Grand // 1839e6f63103SArmin Le Grand //nRectCount = aRegion.GetRectCount(); 1840e6f63103SArmin Le Grand //mpWindowImpl->mpSysObj->BeginSetClipRegion( nRectCount ); 1841e6f63103SArmin Le Grand //bRegionRect = aRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); 1842e6f63103SArmin Le Grand //while ( bRegionRect ) 1843e6f63103SArmin Le Grand //{ 1844e6f63103SArmin Le Grand // mpWindowImpl->mpSysObj->UnionClipRegion( nX, nY, nWidth, nHeight ); 1845e6f63103SArmin Le Grand // bRegionRect = aRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); 1846e6f63103SArmin Le Grand //} 1847e6f63103SArmin Le Grand //mpWindowImpl->mpSysObj->EndSetClipRegion(); 1848cdf0e10cSrcweir } 1849cdf0e10cSrcweir } 1850cdf0e10cSrcweir else 1851cdf0e10cSrcweir bVisibleState = sal_False; 1852cdf0e10cSrcweir } 1853cdf0e10cSrcweir 1854cdf0e10cSrcweir // Visible-Status updaten 1855cdf0e10cSrcweir mpWindowImpl->mpSysObj->Show( bVisibleState ); 1856cdf0e10cSrcweir } 1857cdf0e10cSrcweir 1858cdf0e10cSrcweir return bUpdate; 1859cdf0e10cSrcweir } 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir // ----------------------------------------------------------------------- 1862cdf0e10cSrcweir 1863cdf0e10cSrcweir void Window::ImplUpdateSysObjChildsClip() 1864cdf0e10cSrcweir { 1865cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj && mpWindowImpl->mbInitWinClipRegion ) 1866cdf0e10cSrcweir ImplSysObjClip( NULL ); 1867cdf0e10cSrcweir 1868cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 1869cdf0e10cSrcweir while ( pWindow ) 1870cdf0e10cSrcweir { 1871cdf0e10cSrcweir pWindow->ImplUpdateSysObjChildsClip(); 1872cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1873cdf0e10cSrcweir } 1874cdf0e10cSrcweir } 1875cdf0e10cSrcweir 1876cdf0e10cSrcweir // ----------------------------------------------------------------------- 1877cdf0e10cSrcweir 1878cdf0e10cSrcweir void Window::ImplUpdateSysObjOverlapsClip() 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir ImplUpdateSysObjChildsClip(); 1881cdf0e10cSrcweir 1882cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 1883cdf0e10cSrcweir while ( pWindow ) 1884cdf0e10cSrcweir { 1885cdf0e10cSrcweir pWindow->ImplUpdateSysObjOverlapsClip(); 1886cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1887cdf0e10cSrcweir } 1888cdf0e10cSrcweir } 1889cdf0e10cSrcweir 1890cdf0e10cSrcweir // ----------------------------------------------------------------------- 1891cdf0e10cSrcweir 1892cdf0e10cSrcweir void Window::ImplUpdateSysObjClip() 1893cdf0e10cSrcweir { 1894cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 1895cdf0e10cSrcweir { 1896cdf0e10cSrcweir ImplUpdateSysObjChildsClip(); 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir // Schwestern muessen ihre ClipRegion auch neu berechnen 1899cdf0e10cSrcweir if ( mpWindowImpl->mbClipSiblings ) 1900cdf0e10cSrcweir { 1901cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpNext; 1902cdf0e10cSrcweir while ( pWindow ) 1903cdf0e10cSrcweir { 1904cdf0e10cSrcweir pWindow->ImplUpdateSysObjChildsClip(); 1905cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1906cdf0e10cSrcweir } 1907cdf0e10cSrcweir } 1908cdf0e10cSrcweir } 1909cdf0e10cSrcweir else 1910cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->ImplUpdateSysObjOverlapsClip(); 1911cdf0e10cSrcweir } 1912cdf0e10cSrcweir 1913cdf0e10cSrcweir // ----------------------------------------------------------------------- 1914cdf0e10cSrcweir 1915cdf0e10cSrcweir sal_Bool Window::ImplSetClipFlagChilds( sal_Bool bSysObjOnlySmaller ) 1916cdf0e10cSrcweir { 1917cdf0e10cSrcweir sal_Bool bUpdate = sal_True; 1918cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 1919cdf0e10cSrcweir { 1920cdf0e10cSrcweir Region* pOldRegion = NULL; 1921cdf0e10cSrcweir if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion ) 1922cdf0e10cSrcweir pOldRegion = new Region( mpWindowImpl->maWinClipRegion ); 1923cdf0e10cSrcweir 1924cdf0e10cSrcweir mbInitClipRegion = sal_True; 1925cdf0e10cSrcweir mpWindowImpl->mbInitWinClipRegion = sal_True; 1926cdf0e10cSrcweir 1927cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 1928cdf0e10cSrcweir while ( pWindow ) 1929cdf0e10cSrcweir { 1930cdf0e10cSrcweir if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) 1931cdf0e10cSrcweir bUpdate = sal_False; 1932cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1933cdf0e10cSrcweir } 1934cdf0e10cSrcweir 1935cdf0e10cSrcweir if ( !ImplSysObjClip( pOldRegion ) ) 1936cdf0e10cSrcweir { 1937cdf0e10cSrcweir mbInitClipRegion = sal_True; 1938cdf0e10cSrcweir mpWindowImpl->mbInitWinClipRegion = sal_True; 1939cdf0e10cSrcweir bUpdate = sal_False; 1940cdf0e10cSrcweir } 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir if ( pOldRegion ) 1943cdf0e10cSrcweir delete pOldRegion; 1944cdf0e10cSrcweir } 1945cdf0e10cSrcweir else 1946cdf0e10cSrcweir { 1947cdf0e10cSrcweir mbInitClipRegion = sal_True; 1948cdf0e10cSrcweir mpWindowImpl->mbInitWinClipRegion = sal_True; 1949cdf0e10cSrcweir 1950cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 1951cdf0e10cSrcweir while ( pWindow ) 1952cdf0e10cSrcweir { 1953cdf0e10cSrcweir if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) 1954cdf0e10cSrcweir bUpdate = sal_False; 1955cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1956cdf0e10cSrcweir } 1957cdf0e10cSrcweir } 1958cdf0e10cSrcweir return bUpdate; 1959cdf0e10cSrcweir } 1960cdf0e10cSrcweir 1961cdf0e10cSrcweir // ----------------------------------------------------------------------- 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir sal_Bool Window::ImplSetClipFlagOverlapWindows( sal_Bool bSysObjOnlySmaller ) 1964cdf0e10cSrcweir { 1965cdf0e10cSrcweir sal_Bool bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); 1966cdf0e10cSrcweir 1967cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 1968cdf0e10cSrcweir while ( pWindow ) 1969cdf0e10cSrcweir { 1970cdf0e10cSrcweir if ( !pWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller ) ) 1971cdf0e10cSrcweir bUpdate = sal_False; 1972cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 1973cdf0e10cSrcweir } 1974cdf0e10cSrcweir 1975cdf0e10cSrcweir return bUpdate; 1976cdf0e10cSrcweir } 1977cdf0e10cSrcweir 1978cdf0e10cSrcweir // ----------------------------------------------------------------------- 1979cdf0e10cSrcweir 1980cdf0e10cSrcweir sal_Bool Window::ImplSetClipFlag( sal_Bool bSysObjOnlySmaller ) 1981cdf0e10cSrcweir { 1982cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 1983cdf0e10cSrcweir { 1984cdf0e10cSrcweir sal_Bool bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller ); 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir Window* pParent = ImplGetParent(); 1987cdf0e10cSrcweir if ( pParent && 1988cdf0e10cSrcweir ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP)) ) 1989cdf0e10cSrcweir { 1990cdf0e10cSrcweir pParent->mbInitClipRegion = sal_True; 1991cdf0e10cSrcweir pParent->mpWindowImpl->mbInitChildRegion = sal_True; 1992cdf0e10cSrcweir } 1993cdf0e10cSrcweir 1994cdf0e10cSrcweir // Schwestern muessen ihre ClipRegion auch neu berechnen 1995cdf0e10cSrcweir if ( mpWindowImpl->mbClipSiblings ) 1996cdf0e10cSrcweir { 1997cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpNext; 1998cdf0e10cSrcweir while ( pWindow ) 1999cdf0e10cSrcweir { 2000cdf0e10cSrcweir if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) ) 2001cdf0e10cSrcweir bUpdate = sal_False; 2002cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2003cdf0e10cSrcweir } 2004cdf0e10cSrcweir } 2005cdf0e10cSrcweir 2006cdf0e10cSrcweir return bUpdate; 2007cdf0e10cSrcweir } 2008cdf0e10cSrcweir else 2009cdf0e10cSrcweir return mpWindowImpl->mpFrameWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller ); 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir 2012cdf0e10cSrcweir // ----------------------------------------------------------------------- 2013cdf0e10cSrcweir 2014cdf0e10cSrcweir void Window::ImplIntersectWindowClipRegion( Region& rRegion ) 2015cdf0e10cSrcweir { 2016cdf0e10cSrcweir if ( mpWindowImpl->mbInitWinClipRegion ) 2017cdf0e10cSrcweir ImplInitWinClipRegion(); 2018cdf0e10cSrcweir 2019cdf0e10cSrcweir rRegion.Intersect( mpWindowImpl->maWinClipRegion ); 2020cdf0e10cSrcweir } 2021cdf0e10cSrcweir 2022cdf0e10cSrcweir // ----------------------------------------------------------------------- 2023cdf0e10cSrcweir 2024cdf0e10cSrcweir void Window::ImplIntersectWindowRegion( Region& rRegion ) 2025cdf0e10cSrcweir { 2026cdf0e10cSrcweir rRegion.Intersect( Rectangle( Point( mnOutOffX, mnOutOffY ), 2027cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 2028cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 2029cdf0e10cSrcweir rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 2030cdf0e10cSrcweir } 2031cdf0e10cSrcweir 2032cdf0e10cSrcweir // ----------------------------------------------------------------------- 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir void Window::ImplExcludeWindowRegion( Region& rRegion ) 2035cdf0e10cSrcweir { 2036cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 2037cdf0e10cSrcweir { 2038cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 2039cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, 2040cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 2041cdf0e10cSrcweir aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 2042cdf0e10cSrcweir rRegion.Exclude( aRegion ); 2043cdf0e10cSrcweir } 2044cdf0e10cSrcweir else 2045cdf0e10cSrcweir { 2046cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 2047cdf0e10cSrcweir rRegion.Exclude( Rectangle( aPoint, 2048cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 2049cdf0e10cSrcweir } 2050cdf0e10cSrcweir } 2051cdf0e10cSrcweir 2052cdf0e10cSrcweir // ----------------------------------------------------------------------- 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir void Window::ImplExcludeOverlapWindows( Region& rRegion ) 2055cdf0e10cSrcweir { 2056cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 2057cdf0e10cSrcweir while ( pWindow ) 2058cdf0e10cSrcweir { 2059cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2060cdf0e10cSrcweir { 2061cdf0e10cSrcweir pWindow->ImplExcludeWindowRegion( rRegion ); 2062cdf0e10cSrcweir pWindow->ImplExcludeOverlapWindows( rRegion ); 2063cdf0e10cSrcweir } 2064cdf0e10cSrcweir 2065cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2066cdf0e10cSrcweir } 2067cdf0e10cSrcweir } 2068cdf0e10cSrcweir 2069cdf0e10cSrcweir // ----------------------------------------------------------------------- 2070cdf0e10cSrcweir 2071cdf0e10cSrcweir void Window::ImplExcludeOverlapWindows2( Region& rRegion ) 2072cdf0e10cSrcweir { 2073cdf0e10cSrcweir if ( mpWindowImpl->mbReallyVisible ) 2074cdf0e10cSrcweir ImplExcludeWindowRegion( rRegion ); 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir ImplExcludeOverlapWindows( rRegion ); 2077cdf0e10cSrcweir } 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir // ----------------------------------------------------------------------- 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir void Window::ImplClipBoundaries( Region& rRegion, sal_Bool bThis, sal_Bool bOverlaps ) 2082cdf0e10cSrcweir { 2083cdf0e10cSrcweir if ( bThis ) 2084cdf0e10cSrcweir ImplIntersectWindowClipRegion( rRegion ); 2085cdf0e10cSrcweir else if ( ImplIsOverlapWindow() ) 2086cdf0e10cSrcweir { 2087cdf0e10cSrcweir // Evt. noch am Frame clippen 2088cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame ) 2089cdf0e10cSrcweir rRegion.Intersect( Rectangle( Point( 0, 0 ), Size( mpWindowImpl->mpFrameWindow->mnOutWidth, mpWindowImpl->mpFrameWindow->mnOutHeight ) ) ); 2090cdf0e10cSrcweir 2091cdf0e10cSrcweir if ( bOverlaps && !rRegion.IsEmpty() ) 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir // Clip Overlap Siblings 2094cdf0e10cSrcweir Window* pStartOverlapWindow = this; 2095cdf0e10cSrcweir while ( !pStartOverlapWindow->mpWindowImpl->mbFrame ) 2096cdf0e10cSrcweir { 2097cdf0e10cSrcweir Window* pOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; 2098cdf0e10cSrcweir while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) ) 2099cdf0e10cSrcweir { 2100cdf0e10cSrcweir pOverlapWindow->ImplExcludeOverlapWindows2( rRegion ); 2101cdf0e10cSrcweir pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 2102cdf0e10cSrcweir } 2103cdf0e10cSrcweir pStartOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow; 2104cdf0e10cSrcweir } 2105cdf0e10cSrcweir 2106cdf0e10cSrcweir // Clip Child Overlap Windows 2107cdf0e10cSrcweir ImplExcludeOverlapWindows( rRegion ); 2108cdf0e10cSrcweir } 2109cdf0e10cSrcweir } 2110cdf0e10cSrcweir else 2111cdf0e10cSrcweir ImplGetParent()->ImplIntersectWindowClipRegion( rRegion ); 2112cdf0e10cSrcweir } 2113cdf0e10cSrcweir 2114cdf0e10cSrcweir // ----------------------------------------------------------------------- 2115cdf0e10cSrcweir 2116cdf0e10cSrcweir sal_Bool Window::ImplClipChilds( Region& rRegion ) 2117cdf0e10cSrcweir { 2118cdf0e10cSrcweir sal_Bool bOtherClip = sal_False; 2119cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 2120cdf0e10cSrcweir while ( pWindow ) 2121cdf0e10cSrcweir { 2122cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2123cdf0e10cSrcweir { 2124cdf0e10cSrcweir // ParentClipMode-Flags auswerten 2125cdf0e10cSrcweir sal_uInt16 nClipMode = pWindow->GetParentClipMode(); 2126cdf0e10cSrcweir if ( !(nClipMode & PARENTCLIPMODE_NOCLIP) && 2127cdf0e10cSrcweir ((nClipMode & PARENTCLIPMODE_CLIP) || (GetStyle() & WB_CLIPCHILDREN)) ) 2128cdf0e10cSrcweir pWindow->ImplExcludeWindowRegion( rRegion ); 2129cdf0e10cSrcweir else 2130cdf0e10cSrcweir bOtherClip = sal_True; 2131cdf0e10cSrcweir } 2132cdf0e10cSrcweir 2133cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2134cdf0e10cSrcweir } 2135cdf0e10cSrcweir 2136cdf0e10cSrcweir return bOtherClip; 2137cdf0e10cSrcweir } 2138cdf0e10cSrcweir 2139cdf0e10cSrcweir // ----------------------------------------------------------------------- 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir void Window::ImplClipAllChilds( Region& rRegion ) 2142cdf0e10cSrcweir { 2143cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 2144cdf0e10cSrcweir while ( pWindow ) 2145cdf0e10cSrcweir { 2146cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2147cdf0e10cSrcweir pWindow->ImplExcludeWindowRegion( rRegion ); 2148cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2149cdf0e10cSrcweir } 2150cdf0e10cSrcweir } 2151cdf0e10cSrcweir 2152cdf0e10cSrcweir // ----------------------------------------------------------------------- 2153cdf0e10cSrcweir 2154cdf0e10cSrcweir void Window::ImplClipSiblings( Region& rRegion ) 2155cdf0e10cSrcweir { 2156cdf0e10cSrcweir Window* pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild; 2157cdf0e10cSrcweir while ( pWindow ) 2158cdf0e10cSrcweir { 2159cdf0e10cSrcweir if ( pWindow == this ) 2160cdf0e10cSrcweir break; 2161cdf0e10cSrcweir 2162cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2163cdf0e10cSrcweir pWindow->ImplExcludeWindowRegion( rRegion ); 2164cdf0e10cSrcweir 2165cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2166cdf0e10cSrcweir } 2167cdf0e10cSrcweir } 2168cdf0e10cSrcweir 2169cdf0e10cSrcweir // ----------------------------------------------------------------------- 2170cdf0e10cSrcweir 2171cdf0e10cSrcweir void Window::ImplInitWinClipRegion() 2172cdf0e10cSrcweir { 2173cdf0e10cSrcweir // Build Window Region 2174cdf0e10cSrcweir mpWindowImpl->maWinClipRegion = Rectangle( Point( mnOutOffX, mnOutOffY ), 2175cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ); 2176cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 2177cdf0e10cSrcweir mpWindowImpl->maWinClipRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 2178cdf0e10cSrcweir 2179cdf0e10cSrcweir // ClipSiblings 2180cdf0e10cSrcweir if ( mpWindowImpl->mbClipSiblings && !ImplIsOverlapWindow() ) 2181cdf0e10cSrcweir ImplClipSiblings( mpWindowImpl->maWinClipRegion ); 2182cdf0e10cSrcweir 2183cdf0e10cSrcweir // Clip Parent Boundaries 2184cdf0e10cSrcweir ImplClipBoundaries( mpWindowImpl->maWinClipRegion, sal_False, sal_True ); 2185cdf0e10cSrcweir 2186cdf0e10cSrcweir // Clip Children 2187cdf0e10cSrcweir if ( (GetStyle() & WB_CLIPCHILDREN) || mpWindowImpl->mbClipChildren ) 2188cdf0e10cSrcweir mpWindowImpl->mbInitChildRegion = sal_True; 2189cdf0e10cSrcweir 2190cdf0e10cSrcweir mpWindowImpl->mbInitWinClipRegion = sal_False; 2191cdf0e10cSrcweir } 2192cdf0e10cSrcweir 2193cdf0e10cSrcweir // ----------------------------------------------------------------------- 2194cdf0e10cSrcweir 2195cdf0e10cSrcweir void Window::ImplInitWinChildClipRegion() 2196cdf0e10cSrcweir { 2197cdf0e10cSrcweir if ( !mpWindowImpl->mpFirstChild ) 2198cdf0e10cSrcweir { 2199cdf0e10cSrcweir if ( mpWindowImpl->mpChildClipRegion ) 2200cdf0e10cSrcweir { 2201cdf0e10cSrcweir delete mpWindowImpl->mpChildClipRegion; 2202cdf0e10cSrcweir mpWindowImpl->mpChildClipRegion = NULL; 2203cdf0e10cSrcweir } 2204cdf0e10cSrcweir } 2205cdf0e10cSrcweir else 2206cdf0e10cSrcweir { 2207cdf0e10cSrcweir if ( !mpWindowImpl->mpChildClipRegion ) 2208cdf0e10cSrcweir mpWindowImpl->mpChildClipRegion = new Region( mpWindowImpl->maWinClipRegion ); 2209cdf0e10cSrcweir else 2210cdf0e10cSrcweir *mpWindowImpl->mpChildClipRegion = mpWindowImpl->maWinClipRegion; 2211cdf0e10cSrcweir 2212cdf0e10cSrcweir ImplClipChilds( *mpWindowImpl->mpChildClipRegion ); 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir 2215cdf0e10cSrcweir mpWindowImpl->mbInitChildRegion = sal_False; 2216cdf0e10cSrcweir } 2217cdf0e10cSrcweir 2218cdf0e10cSrcweir // ----------------------------------------------------------------------- 2219cdf0e10cSrcweir 2220cdf0e10cSrcweir Region* Window::ImplGetWinChildClipRegion() 2221cdf0e10cSrcweir { 2222cdf0e10cSrcweir if ( mpWindowImpl->mbInitWinClipRegion ) 2223cdf0e10cSrcweir ImplInitWinClipRegion(); 2224cdf0e10cSrcweir if ( mpWindowImpl->mbInitChildRegion ) 2225cdf0e10cSrcweir ImplInitWinChildClipRegion(); 2226cdf0e10cSrcweir if ( mpWindowImpl->mpChildClipRegion ) 2227cdf0e10cSrcweir return mpWindowImpl->mpChildClipRegion; 2228cdf0e10cSrcweir else 2229cdf0e10cSrcweir return &mpWindowImpl->maWinClipRegion; 2230cdf0e10cSrcweir } 2231cdf0e10cSrcweir 2232cdf0e10cSrcweir // ----------------------------------------------------------------------- 2233cdf0e10cSrcweir 2234cdf0e10cSrcweir void Window::ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion ) 2235cdf0e10cSrcweir { 2236cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstOverlap; 2237cdf0e10cSrcweir while ( pWindow ) 2238cdf0e10cSrcweir { 2239cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2240cdf0e10cSrcweir { 2241cdf0e10cSrcweir Region aTempRegion( rInterRegion ); 2242cdf0e10cSrcweir pWindow->ImplIntersectWindowRegion( aTempRegion ); 2243cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2244cdf0e10cSrcweir pWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion ); 2245cdf0e10cSrcweir } 2246cdf0e10cSrcweir 2247cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2248cdf0e10cSrcweir } 2249cdf0e10cSrcweir } 2250cdf0e10cSrcweir 2251cdf0e10cSrcweir // ----------------------------------------------------------------------- 2252cdf0e10cSrcweir 2253cdf0e10cSrcweir void Window::ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion ) 2254cdf0e10cSrcweir { 2255cdf0e10cSrcweir if ( mpWindowImpl->mbReallyVisible ) 2256cdf0e10cSrcweir { 2257cdf0e10cSrcweir Region aTempRegion( rInterRegion ); 2258cdf0e10cSrcweir ImplIntersectWindowRegion( aTempRegion ); 2259cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2260cdf0e10cSrcweir } 2261cdf0e10cSrcweir 2262cdf0e10cSrcweir ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion ); 2263cdf0e10cSrcweir } 2264cdf0e10cSrcweir 2265cdf0e10cSrcweir // ----------------------------------------------------------------------- 2266cdf0e10cSrcweir 2267cdf0e10cSrcweir void Window::ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion ) 2268cdf0e10cSrcweir { 2269cdf0e10cSrcweir // Clip Overlap Siblings 2270cdf0e10cSrcweir Window* pStartOverlapWindow; 2271cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 2272cdf0e10cSrcweir pStartOverlapWindow = mpWindowImpl->mpOverlapWindow; 2273cdf0e10cSrcweir else 2274cdf0e10cSrcweir pStartOverlapWindow = this; 2275cdf0e10cSrcweir while ( !pStartOverlapWindow->mpWindowImpl->mbFrame ) 2276cdf0e10cSrcweir { 2277cdf0e10cSrcweir Window* pOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; 2278cdf0e10cSrcweir while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) ) 2279cdf0e10cSrcweir { 2280cdf0e10cSrcweir pOverlapWindow->ImplIntersectAndUnionOverlapWindows2( rInterRegion, rRegion ); 2281cdf0e10cSrcweir pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 2282cdf0e10cSrcweir } 2283cdf0e10cSrcweir pStartOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow; 2284cdf0e10cSrcweir } 2285cdf0e10cSrcweir 2286cdf0e10cSrcweir // Clip Child Overlap Windows 2287cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 2288cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion ); 2289cdf0e10cSrcweir else 2290cdf0e10cSrcweir ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion ); 2291cdf0e10cSrcweir } 2292cdf0e10cSrcweir 2293cdf0e10cSrcweir // ----------------------------------------------------------------------- 2294cdf0e10cSrcweir 2295cdf0e10cSrcweir void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion, 2296cdf0e10cSrcweir sal_Bool bChilds, sal_Bool bParent, sal_Bool bSiblings ) 2297cdf0e10cSrcweir { 2298cdf0e10cSrcweir Region aRegion( rSourceRect ); 2299cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 2300cdf0e10cSrcweir rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 2301cdf0e10cSrcweir Region aTempRegion; 2302cdf0e10cSrcweir Window* pWindow; 2303cdf0e10cSrcweir 2304cdf0e10cSrcweir ImplCalcOverlapRegionOverlaps( aRegion, rRegion ); 2305cdf0e10cSrcweir 2306cdf0e10cSrcweir // Parent-Boundaries 2307cdf0e10cSrcweir if ( bParent ) 2308cdf0e10cSrcweir { 2309cdf0e10cSrcweir pWindow = this; 2310cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 2311cdf0e10cSrcweir { 2312cdf0e10cSrcweir pWindow = ImplGetParent(); 2313cdf0e10cSrcweir do 2314cdf0e10cSrcweir { 2315cdf0e10cSrcweir aTempRegion = aRegion; 2316cdf0e10cSrcweir pWindow->ImplExcludeWindowRegion( aTempRegion ); 2317cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2318cdf0e10cSrcweir if ( pWindow->ImplIsOverlapWindow() ) 2319cdf0e10cSrcweir break; 2320cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 2321cdf0e10cSrcweir } 2322cdf0e10cSrcweir while ( pWindow ); 2323cdf0e10cSrcweir } 2324cdf0e10cSrcweir if ( !pWindow->mpWindowImpl->mbFrame ) 2325cdf0e10cSrcweir { 2326cdf0e10cSrcweir aTempRegion = aRegion; 2327cdf0e10cSrcweir aTempRegion.Exclude( Rectangle( Point( 0, 0 ), Size( mpWindowImpl->mpFrameWindow->mnOutWidth, mpWindowImpl->mpFrameWindow->mnOutHeight ) ) ); 2328cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2329cdf0e10cSrcweir } 2330cdf0e10cSrcweir } 2331cdf0e10cSrcweir 2332cdf0e10cSrcweir // Siblings 2333cdf0e10cSrcweir if ( bSiblings && !ImplIsOverlapWindow() ) 2334cdf0e10cSrcweir { 2335cdf0e10cSrcweir pWindow = mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild; 2336cdf0e10cSrcweir do 2337cdf0e10cSrcweir { 2338cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible && (pWindow != this) ) 2339cdf0e10cSrcweir { 2340cdf0e10cSrcweir aTempRegion = aRegion; 2341cdf0e10cSrcweir pWindow->ImplIntersectWindowRegion( aTempRegion ); 2342cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2343cdf0e10cSrcweir } 2344cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2345cdf0e10cSrcweir } 2346cdf0e10cSrcweir while ( pWindow ); 2347cdf0e10cSrcweir } 2348cdf0e10cSrcweir 2349cdf0e10cSrcweir // Childs 2350cdf0e10cSrcweir if ( bChilds ) 2351cdf0e10cSrcweir { 2352cdf0e10cSrcweir pWindow = mpWindowImpl->mpFirstChild; 2353cdf0e10cSrcweir while ( pWindow ) 2354cdf0e10cSrcweir { 2355cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbReallyVisible ) 2356cdf0e10cSrcweir { 2357cdf0e10cSrcweir aTempRegion = aRegion; 2358cdf0e10cSrcweir pWindow->ImplIntersectWindowRegion( aTempRegion ); 2359cdf0e10cSrcweir rRegion.Union( aTempRegion ); 2360cdf0e10cSrcweir } 2361cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2362cdf0e10cSrcweir } 2363cdf0e10cSrcweir } 2364cdf0e10cSrcweir } 2365cdf0e10cSrcweir 2366cdf0e10cSrcweir // ----------------------------------------------------------------------- 2367cdf0e10cSrcweir 2368cdf0e10cSrcweir void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags ) 2369cdf0e10cSrcweir { 2370e6f63103SArmin Le Grand Exception aException; 2371e6f63103SArmin Le Grand bool bExceptionCaught(false); 2372e6f63103SArmin Le Grand 2373cdf0e10cSrcweir // call PrePaint. PrePaint may add to the invalidate region as well as 2374cdf0e10cSrcweir // other parameters used below. 2375cdf0e10cSrcweir PrePaint(); 2376cdf0e10cSrcweir 2377cdf0e10cSrcweir mpWindowImpl->mbPaintFrame = sal_False; 2378cdf0e10cSrcweir 2379cdf0e10cSrcweir if ( nPaintFlags & IMPL_PAINT_PAINTALLCHILDS ) 2380cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALLCHILDS | (nPaintFlags & IMPL_PAINT_PAINTALL); 2381cdf0e10cSrcweir if ( nPaintFlags & IMPL_PAINT_PAINTCHILDS ) 2382cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTCHILDS; 2383cdf0e10cSrcweir if ( nPaintFlags & IMPL_PAINT_ERASE ) 2384cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_ERASE; 2385cdf0e10cSrcweir if ( nPaintFlags & IMPL_PAINT_CHECKRTL ) 2386cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL; 2387cdf0e10cSrcweir if ( !mpWindowImpl->mpFirstChild ) 2388cdf0e10cSrcweir mpWindowImpl->mnPaintFlags &= ~IMPL_PAINT_PAINTALLCHILDS; 2389cdf0e10cSrcweir 2390cdf0e10cSrcweir if ( mpWindowImpl->mbPaintDisabled ) 2391cdf0e10cSrcweir { 2392cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2393cdf0e10cSrcweir Invalidate( INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN ); 2394cdf0e10cSrcweir else if ( pRegion ) 2395cdf0e10cSrcweir Invalidate( *pRegion, INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN ); 2396cdf0e10cSrcweir return; 2397cdf0e10cSrcweir } 2398cdf0e10cSrcweir 2399cdf0e10cSrcweir nPaintFlags = mpWindowImpl->mnPaintFlags & ~(IMPL_PAINT_PAINT); 2400cdf0e10cSrcweir 2401cdf0e10cSrcweir Region* pChildRegion = NULL; 2402cdf0e10cSrcweir Rectangle aSelectionRect; 2403cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT ) 2404cdf0e10cSrcweir { 2405cdf0e10cSrcweir Region* pWinChildClipRegion = ImplGetWinChildClipRegion(); 2406cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2407cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion = *pWinChildClipRegion; 2408cdf0e10cSrcweir else 2409cdf0e10cSrcweir { 2410cdf0e10cSrcweir if ( pRegion ) 2411cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Union( *pRegion ); 2412cdf0e10cSrcweir 2413cdf0e10cSrcweir if( mpWindowImpl->mpWinData && mpWindowImpl->mbTrackVisible ) 2414cdf0e10cSrcweir /* #98602# need to repaint all children within the 2415cdf0e10cSrcweir * tracking rectangle, so the following invert 2416cdf0e10cSrcweir * operation takes places without traces of the previous 2417cdf0e10cSrcweir * one. 2418cdf0e10cSrcweir */ 2419cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Union( *mpWindowImpl->mpWinData->mpTrackRect ); 2420cdf0e10cSrcweir 2421cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS ) 2422cdf0e10cSrcweir pChildRegion = new Region( mpWindowImpl->maInvalidateRegion ); 2423cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Intersect( *pWinChildClipRegion ); 2424cdf0e10cSrcweir } 2425cdf0e10cSrcweir mpWindowImpl->mnPaintFlags = 0; 2426cdf0e10cSrcweir if ( !mpWindowImpl->maInvalidateRegion.IsEmpty() ) 2427cdf0e10cSrcweir { 2428cdf0e10cSrcweir bool bRestoreCursor = false; 2429cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 2430cdf0e10cSrcweir bRestoreCursor = mpWindowImpl->mpCursor->ImplHide( false ); 2431cdf0e10cSrcweir 2432cdf0e10cSrcweir mbInitClipRegion = sal_True; 2433cdf0e10cSrcweir mpWindowImpl->mbInPaint = sal_True; 2434cdf0e10cSrcweir 2435cdf0e10cSrcweir // Paint-Region zuruecksetzen 2436cdf0e10cSrcweir Region aPaintRegion( mpWindowImpl->maInvalidateRegion ); 2437cdf0e10cSrcweir Rectangle aPaintRect = aPaintRegion.GetBoundRect(); 2438cdf0e10cSrcweir 2439cdf0e10cSrcweir // - RTL - re-mirror paint rect and region at this window 2440cdf0e10cSrcweir if( ImplIsAntiparallel() ) 2441cdf0e10cSrcweir { 2442cdf0e10cSrcweir ImplReMirror( aPaintRect ); 2443cdf0e10cSrcweir ImplReMirror( aPaintRegion ); 2444cdf0e10cSrcweir } 2445cdf0e10cSrcweir aPaintRect = ImplDevicePixelToLogic( aPaintRect); 2446cdf0e10cSrcweir mpWindowImpl->mpPaintRegion = &aPaintRegion; 2447cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.SetEmpty(); 2448cdf0e10cSrcweir 2449cdf0e10cSrcweir if ( (nPaintFlags & IMPL_PAINT_ERASE) && IsBackground() ) 2450cdf0e10cSrcweir { 2451cdf0e10cSrcweir if ( IsClipRegion() ) 2452cdf0e10cSrcweir { 2453cdf0e10cSrcweir Region aOldRegion = GetClipRegion(); 2454cdf0e10cSrcweir SetClipRegion(); 2455cdf0e10cSrcweir Erase(); 2456cdf0e10cSrcweir SetClipRegion( aOldRegion ); 2457cdf0e10cSrcweir } 2458cdf0e10cSrcweir else 2459cdf0e10cSrcweir Erase(); 2460cdf0e10cSrcweir } 2461cdf0e10cSrcweir 2462cdf0e10cSrcweir // #98943# trigger drawing of toolbox selection after all childern are painted 2463cdf0e10cSrcweir if( mpWindowImpl->mbDrawSelectionBackground ) 2464cdf0e10cSrcweir aSelectionRect = aPaintRect; 2465cdf0e10cSrcweir 2466e6f63103SArmin Le Grand // Paint can throw exceptions; to not have a situation where 2467e6f63103SArmin Le Grand // mpWindowImpl->mbInPaint keeps to be on true (and other 2468e6f63103SArmin Le Grand // settings, too) better catch here to avoid to go completely out of 2469e6f63103SArmin Le Grand // this method without executing the after-paint stuff 2470e6f63103SArmin Le Grand try 2471e6f63103SArmin Le Grand { 2472cdf0e10cSrcweir Paint( aPaintRect ); 2473e6f63103SArmin Le Grand } 2474e6f63103SArmin Le Grand catch(Exception& rException) 2475e6f63103SArmin Le Grand { 2476e6f63103SArmin Le Grand aException = rException; 2477e6f63103SArmin Le Grand bExceptionCaught = true; 2478e6f63103SArmin Le Grand } 2479cdf0e10cSrcweir 2480cdf0e10cSrcweir if ( mpWindowImpl->mpWinData ) 2481cdf0e10cSrcweir { 2482cdf0e10cSrcweir if ( mpWindowImpl->mbFocusVisible ) 2483cdf0e10cSrcweir ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) ); 2484cdf0e10cSrcweir } 2485cdf0e10cSrcweir mpWindowImpl->mbInPaint = sal_False; 2486cdf0e10cSrcweir mbInitClipRegion = sal_True; 2487cdf0e10cSrcweir mpWindowImpl->mpPaintRegion = NULL; 2488cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 2489cdf0e10cSrcweir mpWindowImpl->mpCursor->ImplShow( false, bRestoreCursor ); 2490cdf0e10cSrcweir } 2491cdf0e10cSrcweir } 2492cdf0e10cSrcweir else 2493cdf0e10cSrcweir mpWindowImpl->mnPaintFlags = 0; 2494cdf0e10cSrcweir 2495cdf0e10cSrcweir if ( nPaintFlags & (IMPL_PAINT_PAINTALLCHILDS | IMPL_PAINT_PAINTCHILDS) ) 2496cdf0e10cSrcweir { 2497cdf0e10cSrcweir // die Childfenster ausgeben 2498cdf0e10cSrcweir Window* pTempWindow = mpWindowImpl->mpFirstChild; 2499cdf0e10cSrcweir while ( pTempWindow ) 2500cdf0e10cSrcweir { 2501cdf0e10cSrcweir if ( pTempWindow->mpWindowImpl->mbVisible ) 2502cdf0e10cSrcweir pTempWindow->ImplCallPaint( pChildRegion, nPaintFlags ); 2503cdf0e10cSrcweir pTempWindow = pTempWindow->mpWindowImpl->mpNext; 2504cdf0e10cSrcweir } 2505cdf0e10cSrcweir } 2506cdf0e10cSrcweir 2507cdf0e10cSrcweir if ( mpWindowImpl->mpWinData && mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) ) 2508cdf0e10cSrcweir /* #98602# need to invert the tracking rect AFTER 2509cdf0e10cSrcweir * the children have painted 2510cdf0e10cSrcweir */ 2511cdf0e10cSrcweir InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags ); 2512cdf0e10cSrcweir 2513cdf0e10cSrcweir // #98943# draw toolbox selection 2514cdf0e10cSrcweir if( !aSelectionRect.IsEmpty() ) 2515cdf0e10cSrcweir DrawSelectionBackground( aSelectionRect, 3, sal_False, sal_True, sal_False ); 2516cdf0e10cSrcweir 2517cdf0e10cSrcweir if ( pChildRegion ) 2518cdf0e10cSrcweir delete pChildRegion; 2519e6f63103SArmin Le Grand 2520e6f63103SArmin Le Grand if(bExceptionCaught) 2521e6f63103SArmin Le Grand { 2522e6f63103SArmin Le Grand throw(aException); 2523e6f63103SArmin Le Grand } 2524cdf0e10cSrcweir } 2525cdf0e10cSrcweir 2526cdf0e10cSrcweir // ----------------------------------------------------------------------- 2527cdf0e10cSrcweir 2528cdf0e10cSrcweir void Window::ImplCallOverlapPaint() 2529cdf0e10cSrcweir { 2530cdf0e10cSrcweir // Zuerst geben wir die ueberlappenden Fenster aus 2531cdf0e10cSrcweir Window* pTempWindow = mpWindowImpl->mpFirstOverlap; 2532cdf0e10cSrcweir while ( pTempWindow ) 2533cdf0e10cSrcweir { 2534cdf0e10cSrcweir if ( pTempWindow->mpWindowImpl->mbReallyVisible ) 2535cdf0e10cSrcweir pTempWindow->ImplCallOverlapPaint(); 2536cdf0e10cSrcweir pTempWindow = pTempWindow->mpWindowImpl->mpNext; 2537cdf0e10cSrcweir } 2538cdf0e10cSrcweir 2539cdf0e10cSrcweir // und dann erst uns selber 2540cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) ) 2541cdf0e10cSrcweir { 2542cdf0e10cSrcweir // - RTL - notify ImplCallPaint to check for re-mirroring (CHECKRTL) 2543cdf0e10cSrcweir // because we were called from the Sal layer 2544cdf0e10cSrcweir ImplCallPaint( NULL, mpWindowImpl->mnPaintFlags /*| IMPL_PAINT_CHECKRTL */); 2545cdf0e10cSrcweir } 2546cdf0e10cSrcweir } 2547cdf0e10cSrcweir 2548cdf0e10cSrcweir // ----------------------------------------------------------------------- 2549cdf0e10cSrcweir 2550cdf0e10cSrcweir void Window::ImplPostPaint() 2551cdf0e10cSrcweir { 2552cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->maPaintTimer.IsActive() ) 2553cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.Start(); 2554cdf0e10cSrcweir } 2555cdf0e10cSrcweir 2556cdf0e10cSrcweir // ----------------------------------------------------------------------- 2557cdf0e10cSrcweir 2558cdf0e10cSrcweir IMPL_LINK( Window, ImplHandlePaintHdl, void*, EMPTYARG ) 2559cdf0e10cSrcweir { 2560cdf0e10cSrcweir // save paint events until resizing is done 2561cdf0e10cSrcweir if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeTimer.IsActive() ) 2562cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.Start(); 2563cdf0e10cSrcweir else if ( mpWindowImpl->mbReallyVisible ) 2564cdf0e10cSrcweir ImplCallOverlapPaint(); 2565cdf0e10cSrcweir return 0; 2566cdf0e10cSrcweir } 2567cdf0e10cSrcweir 2568cdf0e10cSrcweir // ----------------------------------------------------------------------- 2569cdf0e10cSrcweir 2570cdf0e10cSrcweir IMPL_LINK( Window, ImplHandleResizeTimerHdl, void*, EMPTYARG ) 2571cdf0e10cSrcweir { 2572cdf0e10cSrcweir if( mpWindowImpl->mbReallyVisible ) 2573cdf0e10cSrcweir { 2574cdf0e10cSrcweir ImplCallResize(); 2575cdf0e10cSrcweir if( mpWindowImpl->mpFrameData->maPaintTimer.IsActive() ) 2576cdf0e10cSrcweir { 2577cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.Stop(); 2578cdf0e10cSrcweir mpWindowImpl->mpFrameData->maPaintTimer.GetTimeoutHdl().Call( NULL ); 2579cdf0e10cSrcweir } 2580cdf0e10cSrcweir } 2581cdf0e10cSrcweir 2582cdf0e10cSrcweir return 0; 2583cdf0e10cSrcweir } 2584cdf0e10cSrcweir 2585cdf0e10cSrcweir // ----------------------------------------------------------------------- 2586cdf0e10cSrcweir 2587cdf0e10cSrcweir void Window::ImplInvalidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags ) 2588cdf0e10cSrcweir { 2589cdf0e10cSrcweir // PAINTCHILDS bei allen Parent-Fenster bis zum ersten OverlapWindow 2590cdf0e10cSrcweir // setzen 2591cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 2592cdf0e10cSrcweir { 2593cdf0e10cSrcweir Window* pTempWindow = this; 2594cdf0e10cSrcweir sal_uInt16 nTranspPaint = IsPaintTransparent() ? IMPL_PAINT_PAINT : 0; 2595cdf0e10cSrcweir do 2596cdf0e10cSrcweir { 2597cdf0e10cSrcweir pTempWindow = pTempWindow->ImplGetParent(); 2598cdf0e10cSrcweir if ( pTempWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTCHILDS ) 2599cdf0e10cSrcweir break; 2600cdf0e10cSrcweir pTempWindow->mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTCHILDS | nTranspPaint; 2601cdf0e10cSrcweir if( ! pTempWindow->IsPaintTransparent() ) 2602cdf0e10cSrcweir nTranspPaint = 0; 2603cdf0e10cSrcweir } 2604cdf0e10cSrcweir while ( !pTempWindow->ImplIsOverlapWindow() ); 2605cdf0e10cSrcweir } 2606cdf0e10cSrcweir 2607cdf0e10cSrcweir // Paint-Flags setzen 2608cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT; 2609cdf0e10cSrcweir if ( nFlags & INVALIDATE_CHILDREN ) 2610cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTALLCHILDS; 2611cdf0e10cSrcweir if ( !(nFlags & INVALIDATE_NOERASE) ) 2612cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_ERASE; 2613cdf0e10cSrcweir if ( !pRegion ) 2614cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTALL; 2615cdf0e10cSrcweir 2616cdf0e10cSrcweir // Wenn nicht alles neu ausgegeben werden muss, dann die Region 2617cdf0e10cSrcweir // dazupacken 2618cdf0e10cSrcweir if ( !(mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL) ) 2619cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Union( *pRegion ); 2620cdf0e10cSrcweir 2621cdf0e10cSrcweir // Handle transparent windows correctly: invalidate must be done on the first opaque parent 2622cdf0e10cSrcweir if( ((IsPaintTransparent() && !(nFlags & INVALIDATE_NOTRANSPARENT)) || (nFlags & INVALIDATE_TRANSPARENT) ) 2623cdf0e10cSrcweir && ImplGetParent() ) 2624cdf0e10cSrcweir { 2625cdf0e10cSrcweir Window *pParent = ImplGetParent(); 2626cdf0e10cSrcweir while( pParent && pParent->IsPaintTransparent() ) 2627cdf0e10cSrcweir pParent = pParent->ImplGetParent(); 2628cdf0e10cSrcweir if( pParent ) 2629cdf0e10cSrcweir { 2630cdf0e10cSrcweir Region *pChildRegion; 2631cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2632cdf0e10cSrcweir // invalidate the whole child window region in the parent 2633cdf0e10cSrcweir pChildRegion = ImplGetWinChildClipRegion(); 2634cdf0e10cSrcweir else 2635cdf0e10cSrcweir // invalidate the same region in the parent that has to be repainted in the child 2636cdf0e10cSrcweir pChildRegion = &mpWindowImpl->maInvalidateRegion; 2637cdf0e10cSrcweir 2638cdf0e10cSrcweir nFlags |= INVALIDATE_CHILDREN; // paint should also be done on all children 2639cdf0e10cSrcweir nFlags &= ~INVALIDATE_NOERASE; // parent should paint and erase to create proper background 2640cdf0e10cSrcweir pParent->ImplInvalidateFrameRegion( pChildRegion, nFlags ); 2641cdf0e10cSrcweir } 2642cdf0e10cSrcweir } 2643cdf0e10cSrcweir ImplPostPaint(); 2644cdf0e10cSrcweir } 2645cdf0e10cSrcweir 2646cdf0e10cSrcweir // ----------------------------------------------------------------------- 2647cdf0e10cSrcweir 2648cdf0e10cSrcweir void Window::ImplInvalidateOverlapFrameRegion( const Region& rRegion ) 2649cdf0e10cSrcweir { 2650cdf0e10cSrcweir Region aRegion = rRegion; 2651cdf0e10cSrcweir 2652cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_True, sal_True ); 2653cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 2654cdf0e10cSrcweir ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN ); 2655cdf0e10cSrcweir 2656cdf0e10cSrcweir // Dann invalidieren wir die ueberlappenden Fenster 2657cdf0e10cSrcweir Window* pTempWindow = mpWindowImpl->mpFirstOverlap; 2658cdf0e10cSrcweir while ( pTempWindow ) 2659cdf0e10cSrcweir { 2660cdf0e10cSrcweir if ( pTempWindow->IsVisible() ) 2661cdf0e10cSrcweir pTempWindow->ImplInvalidateOverlapFrameRegion( rRegion ); 2662cdf0e10cSrcweir 2663cdf0e10cSrcweir pTempWindow = pTempWindow->mpWindowImpl->mpNext; 2664cdf0e10cSrcweir } 2665cdf0e10cSrcweir } 2666cdf0e10cSrcweir 2667cdf0e10cSrcweir // ----------------------------------------------------------------------- 2668cdf0e10cSrcweir 2669cdf0e10cSrcweir void Window::ImplInvalidateParentFrameRegion( Region& rRegion ) 2670cdf0e10cSrcweir { 2671cdf0e10cSrcweir if ( mpWindowImpl->mbOverlapWin ) 2672cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion ); 2673cdf0e10cSrcweir else 2674cdf0e10cSrcweir { 2675cdf0e10cSrcweir if( ImplGetParent() ) 2676cdf0e10cSrcweir ImplGetParent()->ImplInvalidateFrameRegion( &rRegion, INVALIDATE_CHILDREN ); 2677cdf0e10cSrcweir } 2678cdf0e10cSrcweir } 2679cdf0e10cSrcweir 2680cdf0e10cSrcweir // ----------------------------------------------------------------------- 2681cdf0e10cSrcweir 2682cdf0e10cSrcweir void Window::ImplInvalidate( const Region* pRegion, sal_uInt16 nFlags ) 2683cdf0e10cSrcweir { 2684cdf0e10cSrcweir 2685cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 2686cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 2687cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 2688cdf0e10cSrcweir 2689cdf0e10cSrcweir // Feststellen, was neu ausgegeben werden muss 2690cdf0e10cSrcweir sal_Bool bInvalidateAll = !pRegion; 2691cdf0e10cSrcweir 2692cdf0e10cSrcweir // Transparent-Invalidate beruecksichtigen 2693cdf0e10cSrcweir Window* pOpaqueWindow = this; 2694cdf0e10cSrcweir if ( (mpWindowImpl->mbPaintTransparent && !(nFlags & INVALIDATE_NOTRANSPARENT)) || (nFlags & INVALIDATE_TRANSPARENT) ) 2695cdf0e10cSrcweir { 2696cdf0e10cSrcweir Window* pTempWindow = pOpaqueWindow->ImplGetParent(); 2697cdf0e10cSrcweir while ( pTempWindow ) 2698cdf0e10cSrcweir { 2699cdf0e10cSrcweir if ( !pTempWindow->IsPaintTransparent() ) 2700cdf0e10cSrcweir { 2701cdf0e10cSrcweir pOpaqueWindow = pTempWindow; 2702cdf0e10cSrcweir nFlags |= INVALIDATE_CHILDREN; 2703cdf0e10cSrcweir bInvalidateAll = sal_False; 2704cdf0e10cSrcweir break; 2705cdf0e10cSrcweir } 2706cdf0e10cSrcweir 2707cdf0e10cSrcweir if ( pTempWindow->ImplIsOverlapWindow() ) 2708cdf0e10cSrcweir break; 2709cdf0e10cSrcweir 2710cdf0e10cSrcweir pTempWindow = pTempWindow->ImplGetParent(); 2711cdf0e10cSrcweir } 2712cdf0e10cSrcweir } 2713cdf0e10cSrcweir 2714cdf0e10cSrcweir // Region zusammenbauen 2715cdf0e10cSrcweir sal_uInt16 nOrgFlags = nFlags; 2716cdf0e10cSrcweir if ( !(nFlags & (INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN)) ) 2717cdf0e10cSrcweir { 2718cdf0e10cSrcweir if ( GetStyle() & WB_CLIPCHILDREN ) 2719cdf0e10cSrcweir nFlags |= INVALIDATE_NOCHILDREN; 2720cdf0e10cSrcweir else 2721cdf0e10cSrcweir nFlags |= INVALIDATE_CHILDREN; 2722cdf0e10cSrcweir } 2723cdf0e10cSrcweir if ( (nFlags & INVALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild ) 2724cdf0e10cSrcweir bInvalidateAll = sal_False; 2725cdf0e10cSrcweir if ( bInvalidateAll ) 2726cdf0e10cSrcweir ImplInvalidateFrameRegion( NULL, nFlags ); 2727cdf0e10cSrcweir else 2728cdf0e10cSrcweir { 2729cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 2730cdf0e10cSrcweir Region aRegion( aRect ); 2731cdf0e10cSrcweir if ( pRegion ) 2732cdf0e10cSrcweir { 2733cdf0e10cSrcweir // --- RTL --- remirror region before intersecting it 2734cdf0e10cSrcweir if ( ImplIsAntiparallel() ) 2735cdf0e10cSrcweir { 2736cdf0e10cSrcweir Region aRgn( *pRegion ); 2737cdf0e10cSrcweir ImplReMirror( aRgn ); 2738cdf0e10cSrcweir aRegion.Intersect( aRgn ); 2739cdf0e10cSrcweir } 2740cdf0e10cSrcweir else 2741cdf0e10cSrcweir aRegion.Intersect( *pRegion ); 2742cdf0e10cSrcweir } 2743cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_True, sal_True ); 2744cdf0e10cSrcweir if ( nFlags & INVALIDATE_NOCHILDREN ) 2745cdf0e10cSrcweir { 2746cdf0e10cSrcweir nFlags &= ~INVALIDATE_CHILDREN; 2747cdf0e10cSrcweir if ( !(nFlags & INVALIDATE_NOCLIPCHILDREN) ) 2748cdf0e10cSrcweir { 2749cdf0e10cSrcweir if ( nOrgFlags & INVALIDATE_NOCHILDREN ) 2750cdf0e10cSrcweir ImplClipAllChilds( aRegion ); 2751cdf0e10cSrcweir else 2752cdf0e10cSrcweir { 2753cdf0e10cSrcweir if ( ImplClipChilds( aRegion ) ) 2754cdf0e10cSrcweir nFlags |= INVALIDATE_CHILDREN; 2755cdf0e10cSrcweir } 2756cdf0e10cSrcweir } 2757cdf0e10cSrcweir } 2758cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 2759cdf0e10cSrcweir ImplInvalidateFrameRegion( &aRegion, nFlags ); // transparency is handled here, pOpaqueWindow not required 2760cdf0e10cSrcweir } 2761cdf0e10cSrcweir 2762cdf0e10cSrcweir if ( nFlags & INVALIDATE_UPDATE ) 2763cdf0e10cSrcweir pOpaqueWindow->Update(); // start painting at the opaque parent 2764cdf0e10cSrcweir } 2765cdf0e10cSrcweir 2766cdf0e10cSrcweir // ----------------------------------------------------------------------- 2767cdf0e10cSrcweir 2768cdf0e10cSrcweir void Window::ImplMoveInvalidateRegion( const Rectangle& rRect, 2769cdf0e10cSrcweir long nHorzScroll, long nVertScroll, 2770cdf0e10cSrcweir sal_Bool bChilds ) 2771cdf0e10cSrcweir { 2772cdf0e10cSrcweir if ( (mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALL)) == IMPL_PAINT_PAINT ) 2773cdf0e10cSrcweir { 2774cdf0e10cSrcweir Region aTempRegion = mpWindowImpl->maInvalidateRegion; 2775cdf0e10cSrcweir aTempRegion.Intersect( rRect ); 2776cdf0e10cSrcweir aTempRegion.Move( nHorzScroll, nVertScroll ); 2777cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Union( aTempRegion ); 2778cdf0e10cSrcweir } 2779cdf0e10cSrcweir 2780cdf0e10cSrcweir if ( bChilds && (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTCHILDS) ) 2781cdf0e10cSrcweir { 2782cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 2783cdf0e10cSrcweir while ( pWindow ) 2784cdf0e10cSrcweir { 2785cdf0e10cSrcweir pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, sal_True ); 2786cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 2787cdf0e10cSrcweir } 2788cdf0e10cSrcweir } 2789cdf0e10cSrcweir } 2790cdf0e10cSrcweir 2791cdf0e10cSrcweir // ----------------------------------------------------------------------- 2792cdf0e10cSrcweir 2793cdf0e10cSrcweir void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect, 2794cdf0e10cSrcweir long nHorzScroll, long nVertScroll, 2795cdf0e10cSrcweir sal_Bool bChilds ) 2796cdf0e10cSrcweir { 2797cdf0e10cSrcweir // Paint-Region auch verschieben, wenn noch Paints anstehen 2798cdf0e10cSrcweir ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChilds ); 2799cdf0e10cSrcweir // Paint-Region muss bei uns verschoben gesetzt werden, die durch 2800cdf0e10cSrcweir // die Parents gezeichnet werden 2801cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 2802cdf0e10cSrcweir { 2803cdf0e10cSrcweir Region aPaintAllRegion; 2804cdf0e10cSrcweir Window* pPaintAllWindow = this; 2805cdf0e10cSrcweir do 2806cdf0e10cSrcweir { 2807cdf0e10cSrcweir pPaintAllWindow = pPaintAllWindow->ImplGetParent(); 2808cdf0e10cSrcweir if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS ) 2809cdf0e10cSrcweir { 2810cdf0e10cSrcweir if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2811cdf0e10cSrcweir { 2812cdf0e10cSrcweir aPaintAllRegion.SetEmpty(); 2813cdf0e10cSrcweir break; 2814cdf0e10cSrcweir } 2815cdf0e10cSrcweir else 2816cdf0e10cSrcweir aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion ); 2817cdf0e10cSrcweir } 2818cdf0e10cSrcweir } 2819cdf0e10cSrcweir while ( !pPaintAllWindow->ImplIsOverlapWindow() ); 2820cdf0e10cSrcweir if ( !aPaintAllRegion.IsEmpty() ) 2821cdf0e10cSrcweir { 2822cdf0e10cSrcweir aPaintAllRegion.Move( nHorzScroll, nVertScroll ); 2823cdf0e10cSrcweir sal_uInt16 nPaintFlags = 0; 2824cdf0e10cSrcweir if ( bChilds ) 2825cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= INVALIDATE_CHILDREN; 2826cdf0e10cSrcweir ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags ); 2827cdf0e10cSrcweir } 2828cdf0e10cSrcweir } 2829cdf0e10cSrcweir } 2830cdf0e10cSrcweir 2831cdf0e10cSrcweir // ----------------------------------------------------------------------- 2832cdf0e10cSrcweir 2833cdf0e10cSrcweir void Window::ImplValidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags ) 2834cdf0e10cSrcweir { 2835cdf0e10cSrcweir if ( !pRegion ) 2836cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.SetEmpty(); 2837cdf0e10cSrcweir else 2838cdf0e10cSrcweir { 2839cdf0e10cSrcweir // Wenn alle Childfenster neu ausgegeben werden muessen, 2840cdf0e10cSrcweir // dann invalidieren wir diese vorher 2841cdf0e10cSrcweir if ( (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS) && mpWindowImpl->mpFirstChild ) 2842cdf0e10cSrcweir { 2843cdf0e10cSrcweir Region aChildRegion = mpWindowImpl->maInvalidateRegion; 2844cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2845cdf0e10cSrcweir { 2846cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 2847cdf0e10cSrcweir aChildRegion = aRect; 2848cdf0e10cSrcweir } 2849cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 2850cdf0e10cSrcweir while ( pChild ) 2851cdf0e10cSrcweir { 2852cdf0e10cSrcweir pChild->Invalidate( aChildRegion, INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT ); 2853cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 2854cdf0e10cSrcweir } 2855cdf0e10cSrcweir } 2856cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL ) 2857cdf0e10cSrcweir { 2858cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 2859cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion = aRect; 2860cdf0e10cSrcweir } 2861cdf0e10cSrcweir mpWindowImpl->maInvalidateRegion.Exclude( *pRegion ); 2862cdf0e10cSrcweir } 2863cdf0e10cSrcweir mpWindowImpl->mnPaintFlags &= ~IMPL_PAINT_PAINTALL; 2864cdf0e10cSrcweir 2865cdf0e10cSrcweir if ( nFlags & VALIDATE_CHILDREN ) 2866cdf0e10cSrcweir { 2867cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 2868cdf0e10cSrcweir while ( pChild ) 2869cdf0e10cSrcweir { 2870cdf0e10cSrcweir pChild->ImplValidateFrameRegion( pRegion, nFlags ); 2871cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 2872cdf0e10cSrcweir } 2873cdf0e10cSrcweir } 2874cdf0e10cSrcweir } 2875cdf0e10cSrcweir 2876cdf0e10cSrcweir // ----------------------------------------------------------------------- 2877cdf0e10cSrcweir 2878cdf0e10cSrcweir void Window::ImplValidate( const Region* pRegion, sal_uInt16 nFlags ) 2879cdf0e10cSrcweir { 2880cdf0e10cSrcweir // Region zusammenbauen 2881cdf0e10cSrcweir sal_Bool bValidateAll = !pRegion; 2882cdf0e10cSrcweir sal_uInt16 nOrgFlags = nFlags; 2883cdf0e10cSrcweir if ( !(nFlags & (VALIDATE_CHILDREN | VALIDATE_NOCHILDREN)) ) 2884cdf0e10cSrcweir { 2885cdf0e10cSrcweir if ( GetStyle() & WB_CLIPCHILDREN ) 2886cdf0e10cSrcweir nFlags |= VALIDATE_NOCHILDREN; 2887cdf0e10cSrcweir else 2888cdf0e10cSrcweir nFlags |= VALIDATE_CHILDREN; 2889cdf0e10cSrcweir } 2890cdf0e10cSrcweir if ( (nFlags & VALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild ) 2891cdf0e10cSrcweir bValidateAll = sal_False; 2892cdf0e10cSrcweir if ( bValidateAll ) 2893cdf0e10cSrcweir ImplValidateFrameRegion( NULL, nFlags ); 2894cdf0e10cSrcweir else 2895cdf0e10cSrcweir { 2896cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 2897cdf0e10cSrcweir Region aRegion( aRect ); 2898cdf0e10cSrcweir if ( pRegion ) 2899cdf0e10cSrcweir aRegion.Intersect( *pRegion ); 2900cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_True, sal_True ); 2901cdf0e10cSrcweir if ( nFlags & VALIDATE_NOCHILDREN ) 2902cdf0e10cSrcweir { 2903cdf0e10cSrcweir nFlags &= ~VALIDATE_CHILDREN; 2904cdf0e10cSrcweir if ( nOrgFlags & VALIDATE_NOCHILDREN ) 2905cdf0e10cSrcweir ImplClipAllChilds( aRegion ); 2906cdf0e10cSrcweir else 2907cdf0e10cSrcweir { 2908cdf0e10cSrcweir if ( ImplClipChilds( aRegion ) ) 2909cdf0e10cSrcweir nFlags |= VALIDATE_CHILDREN; 2910cdf0e10cSrcweir } 2911cdf0e10cSrcweir } 2912cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 2913cdf0e10cSrcweir ImplValidateFrameRegion( &aRegion, nFlags ); 2914cdf0e10cSrcweir } 2915cdf0e10cSrcweir } 2916cdf0e10cSrcweir 2917cdf0e10cSrcweir // ----------------------------------------------------------------------- 2918cdf0e10cSrcweir 2919cdf0e10cSrcweir void Window::ImplScroll( const Rectangle& rRect, 2920cdf0e10cSrcweir long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) 2921cdf0e10cSrcweir { 2922cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() ) 2923cdf0e10cSrcweir return; 2924cdf0e10cSrcweir 2925cdf0e10cSrcweir nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll ); 2926cdf0e10cSrcweir nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll ); 2927cdf0e10cSrcweir 2928cdf0e10cSrcweir if ( !nHorzScroll && !nVertScroll ) 2929cdf0e10cSrcweir return; 2930cdf0e10cSrcweir 2931cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 2932cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 2933cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 2934cdf0e10cSrcweir 2935cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 2936cdf0e10cSrcweir mpWindowImpl->mpCursor->ImplHide( false ); 2937cdf0e10cSrcweir 2938cdf0e10cSrcweir sal_uInt16 nOrgFlags = nFlags; 2939cdf0e10cSrcweir if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) ) 2940cdf0e10cSrcweir { 2941cdf0e10cSrcweir if ( GetStyle() & WB_CLIPCHILDREN ) 2942cdf0e10cSrcweir nFlags |= SCROLL_NOCHILDREN; 2943cdf0e10cSrcweir else 2944cdf0e10cSrcweir nFlags |= SCROLL_CHILDREN; 2945cdf0e10cSrcweir } 2946cdf0e10cSrcweir 2947cdf0e10cSrcweir Region aInvalidateRegion; 2948cdf0e10cSrcweir sal_Bool bScrollChilds = (nFlags & SCROLL_CHILDREN) != 0; 2949cdf0e10cSrcweir sal_Bool bErase = (nFlags & SCROLL_NOERASE) == 0; 2950cdf0e10cSrcweir 2951cdf0e10cSrcweir if ( !mpWindowImpl->mpFirstChild ) 2952cdf0e10cSrcweir bScrollChilds = sal_False; 2953cdf0e10cSrcweir 2954cdf0e10cSrcweir // --- RTL --- check if this window requires special action 2955cdf0e10cSrcweir sal_Bool bReMirror = ( ImplIsAntiparallel() ); 2956cdf0e10cSrcweir 2957cdf0e10cSrcweir Rectangle aRectMirror( rRect ); 2958cdf0e10cSrcweir if( bReMirror ) 2959cdf0e10cSrcweir { 2960cdf0e10cSrcweir // --- RTL --- make sure the invalidate region of this window is 2961cdf0e10cSrcweir // computed in the same coordinate space as the one from the overlap windows 2962cdf0e10cSrcweir ImplReMirror( aRectMirror ); 2963cdf0e10cSrcweir } 2964cdf0e10cSrcweir 2965cdf0e10cSrcweir // Paint-Bereiche anpassen 2966cdf0e10cSrcweir ImplMoveAllInvalidateRegions( aRectMirror, nHorzScroll, nVertScroll, bScrollChilds ); 2967cdf0e10cSrcweir 2968cdf0e10cSrcweir if ( !(nFlags & SCROLL_NOINVALIDATE) ) 2969cdf0e10cSrcweir { 2970cdf0e10cSrcweir ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChilds, sal_True, sal_False ); 2971cdf0e10cSrcweir 2972cdf0e10cSrcweir // --- RTL --- 2973cdf0e10cSrcweir // if the scrolling on the device is performed in the opposite direction 2974cdf0e10cSrcweir // then move the overlaps in that direction to compute the invalidate region 2975cdf0e10cSrcweir // on the correct side, i.e., revert nHorzScroll 2976cdf0e10cSrcweir 2977cdf0e10cSrcweir if ( !aInvalidateRegion.IsEmpty() ) 2978cdf0e10cSrcweir { 2979cdf0e10cSrcweir aInvalidateRegion.Move( bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll ); 2980cdf0e10cSrcweir bErase = sal_True; 2981cdf0e10cSrcweir } 2982cdf0e10cSrcweir if ( !(nFlags & SCROLL_NOWINDOWINVALIDATE) ) 2983cdf0e10cSrcweir { 2984cdf0e10cSrcweir Rectangle aDestRect( aRectMirror ); 2985cdf0e10cSrcweir aDestRect.Move( bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll ); 2986cdf0e10cSrcweir Region aWinInvalidateRegion( aRectMirror ); 2987cdf0e10cSrcweir aWinInvalidateRegion.Exclude( aDestRect ); 2988cdf0e10cSrcweir 2989cdf0e10cSrcweir aInvalidateRegion.Union( aWinInvalidateRegion ); 2990cdf0e10cSrcweir } 2991cdf0e10cSrcweir } 2992cdf0e10cSrcweir 2993cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 2994cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); 2995cdf0e10cSrcweir if ( nFlags & SCROLL_CLIP ) 2996cdf0e10cSrcweir aRegion.Intersect( rRect ); 2997cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 2998cdf0e10cSrcweir aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 2999cdf0e10cSrcweir 3000cdf0e10cSrcweir aRegion.Exclude( aInvalidateRegion ); 3001cdf0e10cSrcweir 3002cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_False, sal_True ); 3003cdf0e10cSrcweir if ( !bScrollChilds ) 3004cdf0e10cSrcweir { 3005cdf0e10cSrcweir if ( nOrgFlags & SCROLL_NOCHILDREN ) 3006cdf0e10cSrcweir ImplClipAllChilds( aRegion ); 3007cdf0e10cSrcweir else 3008cdf0e10cSrcweir ImplClipChilds( aRegion ); 3009cdf0e10cSrcweir } 3010cdf0e10cSrcweir if ( mbClipRegion && (nFlags & SCROLL_USECLIPREGION) ) 3011cdf0e10cSrcweir aRegion.Intersect( maRegion ); 3012cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 3013cdf0e10cSrcweir { 3014cdf0e10cSrcweir if ( mpWindowImpl->mpWinData ) 3015cdf0e10cSrcweir { 3016cdf0e10cSrcweir if ( mpWindowImpl->mbFocusVisible ) 3017cdf0e10cSrcweir ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) ); 3018cdf0e10cSrcweir if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) ) 3019cdf0e10cSrcweir InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags ); 3020cdf0e10cSrcweir } 3021cdf0e10cSrcweir 3022cdf0e10cSrcweir SalGraphics* pGraphics = ImplGetFrameGraphics(); 3023cdf0e10cSrcweir if ( pGraphics ) 3024cdf0e10cSrcweir { 3025cdf0e10cSrcweir if( bReMirror ) 3026cdf0e10cSrcweir { 3027cdf0e10cSrcweir // --- RTL --- frame coordinates require re-mirroring 3028cdf0e10cSrcweir ImplReMirror( aRegion ); 3029cdf0e10cSrcweir } 3030cdf0e10cSrcweir 3031cdf0e10cSrcweir ImplSelectClipRegion( aRegion, pGraphics ); 3032cdf0e10cSrcweir pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll, 3033cdf0e10cSrcweir rRect.Left(), rRect.Top(), 3034cdf0e10cSrcweir rRect.GetWidth(), rRect.GetHeight(), 3035cdf0e10cSrcweir SAL_COPYAREA_WINDOWINVALIDATE, this ); 3036cdf0e10cSrcweir } 3037cdf0e10cSrcweir 3038cdf0e10cSrcweir if ( mpWindowImpl->mpWinData ) 3039cdf0e10cSrcweir { 3040cdf0e10cSrcweir if ( mpWindowImpl->mbFocusVisible ) 3041cdf0e10cSrcweir ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) ); 3042cdf0e10cSrcweir if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) ) 3043cdf0e10cSrcweir InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags ); 3044cdf0e10cSrcweir } 3045cdf0e10cSrcweir } 3046cdf0e10cSrcweir 3047cdf0e10cSrcweir if ( !aInvalidateRegion.IsEmpty() ) 3048cdf0e10cSrcweir { 3049cdf0e10cSrcweir // --- RTL --- the invalidate region for this windows is already computed in frame coordinates 3050cdf0e10cSrcweir // so it has to be re-mirrored before calling the Paint-handler 3051cdf0e10cSrcweir mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL; 3052cdf0e10cSrcweir 3053cdf0e10cSrcweir sal_uInt16 nPaintFlags = INVALIDATE_CHILDREN; 3054cdf0e10cSrcweir if ( !bErase ) 3055cdf0e10cSrcweir nPaintFlags |= INVALIDATE_NOERASE; 3056cdf0e10cSrcweir if ( !bScrollChilds ) 3057cdf0e10cSrcweir { 3058cdf0e10cSrcweir if ( nOrgFlags & SCROLL_NOCHILDREN ) 3059cdf0e10cSrcweir ImplClipAllChilds( aInvalidateRegion ); 3060cdf0e10cSrcweir else 3061cdf0e10cSrcweir ImplClipChilds( aInvalidateRegion ); 3062cdf0e10cSrcweir } 3063cdf0e10cSrcweir ImplInvalidateFrameRegion( &aInvalidateRegion, nPaintFlags ); 3064cdf0e10cSrcweir } 3065cdf0e10cSrcweir 3066cdf0e10cSrcweir if ( bScrollChilds ) 3067cdf0e10cSrcweir { 3068cdf0e10cSrcweir Window* pWindow = mpWindowImpl->mpFirstChild; 3069cdf0e10cSrcweir while ( pWindow ) 3070cdf0e10cSrcweir { 3071cdf0e10cSrcweir Point aPos = pWindow->GetPosPixel(); 3072cdf0e10cSrcweir aPos += Point( nHorzScroll, nVertScroll ); 3073cdf0e10cSrcweir pWindow->SetPosPixel( aPos ); 3074cdf0e10cSrcweir 3075cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 3076cdf0e10cSrcweir } 3077cdf0e10cSrcweir } 3078cdf0e10cSrcweir 3079cdf0e10cSrcweir if ( nFlags & SCROLL_UPDATE ) 3080cdf0e10cSrcweir Update(); 3081cdf0e10cSrcweir 3082cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 3083cdf0e10cSrcweir mpWindowImpl->mpCursor->ImplShow( false ); 3084cdf0e10cSrcweir } 3085cdf0e10cSrcweir 3086cdf0e10cSrcweir // ----------------------------------------------------------------------- 3087cdf0e10cSrcweir 3088cdf0e10cSrcweir void Window::ImplUpdateAll( sal_Bool bOverlapWindows ) 3089cdf0e10cSrcweir { 3090cdf0e10cSrcweir if ( !mpWindowImpl->mbReallyVisible ) 3091cdf0e10cSrcweir return; 3092cdf0e10cSrcweir 3093cdf0e10cSrcweir sal_Bool bFlush = sal_False; 3094cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) 3095cdf0e10cSrcweir { 3096cdf0e10cSrcweir Point aPoint( 0, 0 ); 3097cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); 3098cdf0e10cSrcweir ImplInvalidateOverlapFrameRegion( aRegion ); 3099cdf0e10cSrcweir if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) 3100cdf0e10cSrcweir bFlush = sal_True; 3101cdf0e10cSrcweir } 3102cdf0e10cSrcweir 3103cdf0e10cSrcweir // Ein Update wirkt immer auf das OverlapWindow, damit bei spaeteren 3104cdf0e10cSrcweir // Paints nicht zuviel gemalt wird, wenn dort ALLCHILDREN usw. gesetzt 3105cdf0e10cSrcweir // ist 3106cdf0e10cSrcweir Window* pWindow = ImplGetFirstOverlapWindow(); 3107cdf0e10cSrcweir if ( bOverlapWindows ) 3108cdf0e10cSrcweir pWindow->ImplCallOverlapPaint(); 3109cdf0e10cSrcweir else 3110cdf0e10cSrcweir { 3111cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) ) 3112cdf0e10cSrcweir pWindow->ImplCallPaint( NULL, pWindow->mpWindowImpl->mnPaintFlags ); 3113cdf0e10cSrcweir } 3114cdf0e10cSrcweir 3115cdf0e10cSrcweir if ( bFlush ) 3116cdf0e10cSrcweir Flush(); 3117cdf0e10cSrcweir } 3118cdf0e10cSrcweir 3119cdf0e10cSrcweir // ----------------------------------------------------------------------- 3120cdf0e10cSrcweir 3121cdf0e10cSrcweir void Window::ImplUpdateWindowPtr( Window* pWindow ) 3122cdf0e10cSrcweir { 3123cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow != pWindow->mpWindowImpl->mpFrameWindow ) 3124cdf0e10cSrcweir { 3125cdf0e10cSrcweir // Graphic freigeben 3126cdf0e10cSrcweir ImplReleaseGraphics(); 3127cdf0e10cSrcweir } 3128cdf0e10cSrcweir 3129cdf0e10cSrcweir mpWindowImpl->mpFrameData = pWindow->mpWindowImpl->mpFrameData; 3130cdf0e10cSrcweir mpWindowImpl->mpFrame = pWindow->mpWindowImpl->mpFrame; 3131cdf0e10cSrcweir mpWindowImpl->mpFrameWindow = pWindow->mpWindowImpl->mpFrameWindow; 3132cdf0e10cSrcweir if ( pWindow->ImplIsOverlapWindow() ) 3133cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = pWindow; 3134cdf0e10cSrcweir else 3135cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow = pWindow->mpWindowImpl->mpOverlapWindow; 3136cdf0e10cSrcweir 3137cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 3138cdf0e10cSrcweir while ( pChild ) 3139cdf0e10cSrcweir { 3140cdf0e10cSrcweir pChild->ImplUpdateWindowPtr( pWindow ); 3141cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 3142cdf0e10cSrcweir } 3143cdf0e10cSrcweir } 3144cdf0e10cSrcweir 3145cdf0e10cSrcweir // ----------------------------------------------------------------------- 3146cdf0e10cSrcweir 3147cdf0e10cSrcweir void Window::ImplUpdateWindowPtr() 3148cdf0e10cSrcweir { 3149cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 3150cdf0e10cSrcweir while ( pChild ) 3151cdf0e10cSrcweir { 3152cdf0e10cSrcweir pChild->ImplUpdateWindowPtr( this ); 3153cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 3154cdf0e10cSrcweir } 3155cdf0e10cSrcweir } 3156cdf0e10cSrcweir 3157cdf0e10cSrcweir // ----------------------------------------------------------------------- 3158cdf0e10cSrcweir 3159cdf0e10cSrcweir void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame ) 3160cdf0e10cSrcweir { 3161cdf0e10cSrcweir sal_Bool bVisible = IsVisible(); 3162cdf0e10cSrcweir Show( sal_False ); 3163cdf0e10cSrcweir ImplRemoveWindow( bNewFrame ); 3164cdf0e10cSrcweir Window* pRealParent = mpWindowImpl->mpRealParent; 3165cdf0e10cSrcweir ImplInsertWindow( ImplGetParent() ); 3166cdf0e10cSrcweir mpWindowImpl->mpRealParent = pRealParent; 3167cdf0e10cSrcweir ImplUpdateWindowPtr(); 3168cdf0e10cSrcweir if ( ImplUpdatePos() ) 3169cdf0e10cSrcweir ImplUpdateSysObjPos(); 3170cdf0e10cSrcweir 3171cdf0e10cSrcweir if ( bNewFrame ) 3172cdf0e10cSrcweir { 3173cdf0e10cSrcweir Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap; 3174cdf0e10cSrcweir while ( pOverlapWindow ) 3175cdf0e10cSrcweir { 3176cdf0e10cSrcweir Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 3177cdf0e10cSrcweir pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame ); 3178cdf0e10cSrcweir pOverlapWindow = pNextOverlapWindow; 3179cdf0e10cSrcweir } 3180cdf0e10cSrcweir } 3181cdf0e10cSrcweir 3182cdf0e10cSrcweir if ( bVisible ) 3183cdf0e10cSrcweir Show( sal_True ); 3184cdf0e10cSrcweir } 3185cdf0e10cSrcweir 3186cdf0e10cSrcweir // ----------------------------------------------------------------------- 3187cdf0e10cSrcweir 3188cdf0e10cSrcweir sal_Bool Window::ImplUpdatePos() 3189cdf0e10cSrcweir { 3190cdf0e10cSrcweir sal_Bool bSysChild = sal_False; 3191cdf0e10cSrcweir 3192cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 3193cdf0e10cSrcweir { 3194cdf0e10cSrcweir mnOutOffX = mpWindowImpl->mnX; 3195cdf0e10cSrcweir mnOutOffY = mpWindowImpl->mnY; 3196cdf0e10cSrcweir } 3197cdf0e10cSrcweir else 3198cdf0e10cSrcweir { 3199cdf0e10cSrcweir Window* pParent = ImplGetParent(); 3200cdf0e10cSrcweir 3201cdf0e10cSrcweir mnOutOffX = mpWindowImpl->mnX + pParent->mnOutOffX; 3202cdf0e10cSrcweir mnOutOffY = mpWindowImpl->mnY + pParent->mnOutOffY; 3203cdf0e10cSrcweir } 3204cdf0e10cSrcweir 3205cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 3206cdf0e10cSrcweir while ( pChild ) 3207cdf0e10cSrcweir { 3208cdf0e10cSrcweir if ( pChild->ImplUpdatePos() ) 3209cdf0e10cSrcweir bSysChild = sal_True; 3210cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 3211cdf0e10cSrcweir } 3212cdf0e10cSrcweir 3213cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 3214cdf0e10cSrcweir bSysChild = sal_True; 3215cdf0e10cSrcweir 3216cdf0e10cSrcweir return bSysChild; 3217cdf0e10cSrcweir } 3218cdf0e10cSrcweir 3219cdf0e10cSrcweir // ----------------------------------------------------------------------- 3220cdf0e10cSrcweir 3221cdf0e10cSrcweir void Window::ImplUpdateSysObjPos() 3222cdf0e10cSrcweir { 3223cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 3224cdf0e10cSrcweir mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); 3225cdf0e10cSrcweir 3226cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 3227cdf0e10cSrcweir while ( pChild ) 3228cdf0e10cSrcweir { 3229cdf0e10cSrcweir pChild->ImplUpdateSysObjPos(); 3230cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 3231cdf0e10cSrcweir } 3232cdf0e10cSrcweir } 3233cdf0e10cSrcweir // ----------------------------------------------------------------------- 3234cdf0e10cSrcweir 3235cdf0e10cSrcweir void Window::ImplPosSizeWindow( long nX, long nY, 3236cdf0e10cSrcweir long nWidth, long nHeight, sal_uInt16 nFlags ) 3237cdf0e10cSrcweir { 3238cdf0e10cSrcweir sal_Bool bNewPos = sal_False; 3239cdf0e10cSrcweir sal_Bool bNewSize = sal_False; 3240cdf0e10cSrcweir sal_Bool bNewWidth = sal_False; 3241cdf0e10cSrcweir sal_Bool bCopyBits = sal_False; 3242cdf0e10cSrcweir long nOldOutOffX = mnOutOffX; 3243cdf0e10cSrcweir long nOldOutOffY = mnOutOffY; 3244cdf0e10cSrcweir long nOldOutWidth = mnOutWidth; 3245cdf0e10cSrcweir long nOldOutHeight = mnOutHeight; 3246cdf0e10cSrcweir Region* pOverlapRegion = NULL; 3247cdf0e10cSrcweir Region* pOldRegion = NULL; 3248cdf0e10cSrcweir 3249cdf0e10cSrcweir if ( IsReallyVisible() ) 3250cdf0e10cSrcweir { 3251cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 3252cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 3253cdf0e10cSrcweir 3254cdf0e10cSrcweir Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ), 3255cdf0e10cSrcweir Size( nOldOutWidth, nOldOutHeight ) ); 3256cdf0e10cSrcweir pOldRegion = new Region( aOldWinRect ); 3257cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 3258cdf0e10cSrcweir pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 3259cdf0e10cSrcweir 3260cdf0e10cSrcweir if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent && 3261cdf0e10cSrcweir !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() && 3262cdf0e10cSrcweir !HasPaintEvent() ) 3263cdf0e10cSrcweir bCopyBits = sal_True; 3264cdf0e10cSrcweir } 3265cdf0e10cSrcweir 3266cdf0e10cSrcweir sal_Bool bnXRecycled = sal_False; // avoid duplicate mirroring in RTL case 3267cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_WIDTH ) 3268cdf0e10cSrcweir { 3269cdf0e10cSrcweir if(!( nFlags & WINDOW_POSSIZE_X )) 3270cdf0e10cSrcweir { 3271cdf0e10cSrcweir nX = mpWindowImpl->mnX; 3272cdf0e10cSrcweir nFlags |= WINDOW_POSSIZE_X; 3273cdf0e10cSrcweir bnXRecycled = sal_True; // we're using a mnX which was already mirrored in RTL case 3274cdf0e10cSrcweir } 3275cdf0e10cSrcweir 3276cdf0e10cSrcweir if ( nWidth < 0 ) 3277cdf0e10cSrcweir nWidth = 0; 3278cdf0e10cSrcweir if ( nWidth != mnOutWidth ) 3279cdf0e10cSrcweir { 3280cdf0e10cSrcweir mnOutWidth = nWidth; 3281cdf0e10cSrcweir bNewSize = sal_True; 3282cdf0e10cSrcweir bCopyBits = sal_False; 3283cdf0e10cSrcweir bNewWidth = sal_True; 3284cdf0e10cSrcweir } 3285cdf0e10cSrcweir } 3286cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_HEIGHT ) 3287cdf0e10cSrcweir { 3288cdf0e10cSrcweir if ( nHeight < 0 ) 3289cdf0e10cSrcweir nHeight = 0; 3290cdf0e10cSrcweir if ( nHeight != mnOutHeight ) 3291cdf0e10cSrcweir { 3292cdf0e10cSrcweir mnOutHeight = nHeight; 3293cdf0e10cSrcweir bNewSize = sal_True; 3294cdf0e10cSrcweir bCopyBits = sal_False; 3295cdf0e10cSrcweir } 3296cdf0e10cSrcweir } 3297cdf0e10cSrcweir 3298cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_X ) 3299cdf0e10cSrcweir { 3300cdf0e10cSrcweir long nOrgX = nX; 3301cdf0e10cSrcweir // --- RTL --- (compare the screen coordinates) 3302cdf0e10cSrcweir Point aPtDev( Point( nX+mnOutOffX, 0 ) ); 3303cdf0e10cSrcweir if( ImplHasMirroredGraphics() ) 3304cdf0e10cSrcweir { 3305cdf0e10cSrcweir mpGraphics->mirror( aPtDev.X(), this ); 3306cdf0e10cSrcweir 3307cdf0e10cSrcweir // #106948# always mirror our pos if our parent is not mirroring, even 3308cdf0e10cSrcweir // if we are also not mirroring 3309cdf0e10cSrcweir // --- RTL --- check if parent is in different coordinates 3310cdf0e10cSrcweir if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) 3311cdf0e10cSrcweir { 3312cdf0e10cSrcweir // --- RTL --- (re-mirror at parent window) 3313cdf0e10cSrcweir nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; 3314cdf0e10cSrcweir } 3315cdf0e10cSrcweir /* #i99166# An LTR window in RTL UI that gets sized only would be 3316cdf0e10cSrcweir expected to not moved its upper left point 3317cdf0e10cSrcweir */ 3318cdf0e10cSrcweir if( bnXRecycled ) 3319cdf0e10cSrcweir { 3320cdf0e10cSrcweir if( ImplIsAntiparallel() ) 3321cdf0e10cSrcweir { 3322cdf0e10cSrcweir aPtDev.X() = mpWindowImpl->mnAbsScreenX; 3323cdf0e10cSrcweir nOrgX = mpWindowImpl->maPos.X(); 3324cdf0e10cSrcweir } 3325cdf0e10cSrcweir } 3326cdf0e10cSrcweir } 3327cdf0e10cSrcweir else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) 3328cdf0e10cSrcweir { 3329cdf0e10cSrcweir // mirrored window in LTR UI 3330cdf0e10cSrcweir { 3331cdf0e10cSrcweir // --- RTL --- (re-mirror at parent window) 3332cdf0e10cSrcweir nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; 3333cdf0e10cSrcweir } 3334cdf0e10cSrcweir } 3335cdf0e10cSrcweir 3336cdf0e10cSrcweir // check maPos as well, as it could have been changed for client windows (ImplCallMove()) 3337cdf0e10cSrcweir if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() ) 3338cdf0e10cSrcweir { 3339cdf0e10cSrcweir if ( bCopyBits && !pOverlapRegion ) 3340cdf0e10cSrcweir { 3341cdf0e10cSrcweir pOverlapRegion = new Region(); 3342cdf0e10cSrcweir ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ), 3343cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ), 3344cdf0e10cSrcweir *pOverlapRegion, sal_False, sal_True, sal_True ); 3345cdf0e10cSrcweir } 3346cdf0e10cSrcweir mpWindowImpl->mnX = nX; 3347cdf0e10cSrcweir mpWindowImpl->maPos.X() = nOrgX; 3348cdf0e10cSrcweir mpWindowImpl->mnAbsScreenX = aPtDev.X(); // --- RTL --- (store real screen pos) 3349cdf0e10cSrcweir bNewPos = sal_True; 3350cdf0e10cSrcweir } 3351cdf0e10cSrcweir } 3352cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_Y ) 3353cdf0e10cSrcweir { 3354cdf0e10cSrcweir // check maPos as well, as it could have been changed for client windows (ImplCallMove()) 3355cdf0e10cSrcweir if ( nY != mpWindowImpl->mnY || nY != mpWindowImpl->maPos.Y() ) 3356cdf0e10cSrcweir { 3357cdf0e10cSrcweir if ( bCopyBits && !pOverlapRegion ) 3358cdf0e10cSrcweir { 3359cdf0e10cSrcweir pOverlapRegion = new Region(); 3360cdf0e10cSrcweir ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ), 3361cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ), 3362cdf0e10cSrcweir *pOverlapRegion, sal_False, sal_True, sal_True ); 3363cdf0e10cSrcweir } 3364cdf0e10cSrcweir mpWindowImpl->mnY = nY; 3365cdf0e10cSrcweir mpWindowImpl->maPos.Y() = nY; 3366cdf0e10cSrcweir bNewPos = sal_True; 3367cdf0e10cSrcweir } 3368cdf0e10cSrcweir } 3369cdf0e10cSrcweir 3370cdf0e10cSrcweir /* if ( nFlags & (WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y) ) 3371cdf0e10cSrcweir { 3372cdf0e10cSrcweir POINT aPt; 3373cdf0e10cSrcweir aPt.x = mpWindowImpl->maPos.X(); 3374cdf0e10cSrcweir aPt.y = mpWindowImpl->maPos.Y(); 3375cdf0e10cSrcweir ClientToScreen( mpWindowImpl->mpFrame->maFrameData.mhWnd , &aPt ); 3376cdf0e10cSrcweir mpWindowImpl->maPos.X() = aPt.x; 3377cdf0e10cSrcweir mpWindowImpl->maPos.Y() = aPt.y; 3378cdf0e10cSrcweir } 3379cdf0e10cSrcweir */ 3380cdf0e10cSrcweir if ( bNewPos || bNewSize ) 3381cdf0e10cSrcweir { 3382cdf0e10cSrcweir sal_Bool bUpdateSysObjPos = sal_False; 3383cdf0e10cSrcweir if ( bNewPos ) 3384cdf0e10cSrcweir bUpdateSysObjPos = ImplUpdatePos(); 3385cdf0e10cSrcweir 3386cdf0e10cSrcweir // the borderwindow always specifies the position for its client window 3387cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 3388cdf0e10cSrcweir mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos; 3389cdf0e10cSrcweir 3390cdf0e10cSrcweir if ( mpWindowImpl->mpClientWindow ) 3391cdf0e10cSrcweir { 3392cdf0e10cSrcweir mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder, 3393cdf0e10cSrcweir mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder, 3394cdf0e10cSrcweir mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder, 3395cdf0e10cSrcweir mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder, 3396cdf0e10cSrcweir WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y | 3397cdf0e10cSrcweir WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT ); 3398cdf0e10cSrcweir // Wenn wir ein ClientWindow haben, dann hat dieses fuer die 3399cdf0e10cSrcweir // Applikation auch die Position des FloatingWindows 3400cdf0e10cSrcweir mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos; 3401cdf0e10cSrcweir if ( bNewPos ) 3402cdf0e10cSrcweir { 3403cdf0e10cSrcweir if ( mpWindowImpl->mpClientWindow->IsVisible() ) 3404cdf0e10cSrcweir { 3405cdf0e10cSrcweir mpWindowImpl->mpClientWindow->ImplCallMove(); 3406cdf0e10cSrcweir } 3407cdf0e10cSrcweir else 3408cdf0e10cSrcweir { 3409cdf0e10cSrcweir mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = sal_True; 3410cdf0e10cSrcweir } 3411cdf0e10cSrcweir } 3412cdf0e10cSrcweir } 3413cdf0e10cSrcweir // else 3414cdf0e10cSrcweir // { 3415cdf0e10cSrcweir // if ( mpWindowImpl->mpBorderWindow ) 3416cdf0e10cSrcweir // mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos; 3417cdf0e10cSrcweir // } 3418cdf0e10cSrcweir 3419cdf0e10cSrcweir // Move()/Resize() werden erst bei Show() gerufen, damit min. eins vor 3420cdf0e10cSrcweir // einem Show() kommt 3421cdf0e10cSrcweir if ( IsVisible() ) 3422cdf0e10cSrcweir { 3423cdf0e10cSrcweir if ( bNewPos ) 3424cdf0e10cSrcweir { 3425cdf0e10cSrcweir ImplCallMove(); 3426cdf0e10cSrcweir } 3427cdf0e10cSrcweir if ( bNewSize ) 3428cdf0e10cSrcweir { 3429cdf0e10cSrcweir ImplCallResize(); 3430cdf0e10cSrcweir } 3431cdf0e10cSrcweir } 3432cdf0e10cSrcweir else 3433cdf0e10cSrcweir { 3434cdf0e10cSrcweir if ( bNewPos ) 3435cdf0e10cSrcweir mpWindowImpl->mbCallMove = sal_True; 3436cdf0e10cSrcweir if ( bNewSize ) 3437cdf0e10cSrcweir mpWindowImpl->mbCallResize = sal_True; 3438cdf0e10cSrcweir } 3439cdf0e10cSrcweir 3440cdf0e10cSrcweir sal_Bool bUpdateSysObjClip = sal_False; 3441cdf0e10cSrcweir if ( IsReallyVisible() ) 3442cdf0e10cSrcweir { 3443cdf0e10cSrcweir if ( bNewPos || bNewSize ) 3444cdf0e10cSrcweir { 3445cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 3446cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev ) 3447cdf0e10cSrcweir ImplDeleteOverlapBackground(); 3448cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 3449cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 3450cdf0e10cSrcweir // Clip-Flag neu setzen 3451cdf0e10cSrcweir bUpdateSysObjClip = !ImplSetClipFlag( sal_True ); 3452cdf0e10cSrcweir } 3453cdf0e10cSrcweir 3454cdf0e10cSrcweir // Fensterinhalt invalidieren ? 3455cdf0e10cSrcweir if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) ) 3456cdf0e10cSrcweir { 3457cdf0e10cSrcweir if ( bNewPos ) 3458cdf0e10cSrcweir { 3459cdf0e10cSrcweir sal_Bool bInvalidate = sal_False; 3460cdf0e10cSrcweir sal_Bool bParentPaint = sal_True; 3461cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 3462cdf0e10cSrcweir bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled(); 3463cdf0e10cSrcweir if ( bCopyBits && bParentPaint && !HasPaintEvent() ) 3464cdf0e10cSrcweir { 3465cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 3466cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, 3467cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 3468cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 3469cdf0e10cSrcweir aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 3470cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_False, sal_True ); 3471cdf0e10cSrcweir if ( !pOverlapRegion->IsEmpty() ) 3472cdf0e10cSrcweir { 3473cdf0e10cSrcweir pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY ); 3474cdf0e10cSrcweir aRegion.Exclude( *pOverlapRegion ); 3475cdf0e10cSrcweir } 3476cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 3477cdf0e10cSrcweir { 3478cdf0e10cSrcweir // Paint-Bereiche anpassen 3479cdf0e10cSrcweir ImplMoveAllInvalidateRegions( Rectangle( Point( nOldOutOffX, nOldOutOffY ), 3480cdf0e10cSrcweir Size( nOldOutWidth, nOldOutHeight ) ), 3481cdf0e10cSrcweir mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY, 3482cdf0e10cSrcweir sal_True ); 3483cdf0e10cSrcweir SalGraphics* pGraphics = ImplGetFrameGraphics(); 3484cdf0e10cSrcweir if ( pGraphics ) 3485cdf0e10cSrcweir { 3486cdf0e10cSrcweir const bool bSelectClipRegion = ImplSelectClipRegion( aRegion, pGraphics ); 3487cdf0e10cSrcweir if ( bSelectClipRegion ) 3488cdf0e10cSrcweir { 3489cdf0e10cSrcweir pGraphics->CopyArea( mnOutOffX, mnOutOffY, 3490cdf0e10cSrcweir nOldOutOffX, nOldOutOffY, 3491cdf0e10cSrcweir nOldOutWidth, nOldOutHeight, 3492cdf0e10cSrcweir SAL_COPYAREA_WINDOWINVALIDATE, this ); 3493cdf0e10cSrcweir } 3494cdf0e10cSrcweir else 3495cdf0e10cSrcweir bInvalidate = sal_True; 3496cdf0e10cSrcweir } 3497cdf0e10cSrcweir else 3498cdf0e10cSrcweir bInvalidate = sal_True; 3499cdf0e10cSrcweir if ( !bInvalidate ) 3500cdf0e10cSrcweir { 3501cdf0e10cSrcweir if ( !pOverlapRegion->IsEmpty() ) 3502cdf0e10cSrcweir ImplInvalidateFrameRegion( pOverlapRegion, INVALIDATE_CHILDREN ); 3503cdf0e10cSrcweir } 3504cdf0e10cSrcweir } 3505cdf0e10cSrcweir else 3506cdf0e10cSrcweir bInvalidate = sal_True; 3507cdf0e10cSrcweir } 3508cdf0e10cSrcweir else 3509cdf0e10cSrcweir bInvalidate = sal_True; 3510cdf0e10cSrcweir if ( bInvalidate ) 3511cdf0e10cSrcweir ImplInvalidateFrameRegion( NULL, INVALIDATE_CHILDREN ); 3512cdf0e10cSrcweir } 3513cdf0e10cSrcweir else 3514cdf0e10cSrcweir { 3515cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 3516cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, 3517cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 3518cdf0e10cSrcweir aRegion.Exclude( *pOldRegion ); 3519cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 3520cdf0e10cSrcweir aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); 3521cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_False, sal_True ); 3522cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 3523cdf0e10cSrcweir ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN ); 3524cdf0e10cSrcweir } 3525cdf0e10cSrcweir } 3526cdf0e10cSrcweir 3527cdf0e10cSrcweir // Parent oder Overlaps invalidieren 3528cdf0e10cSrcweir if ( bNewPos || 3529cdf0e10cSrcweir (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) ) 3530cdf0e10cSrcweir { 3531cdf0e10cSrcweir Region aRegion( *pOldRegion ); 3532cdf0e10cSrcweir if ( !mpWindowImpl->mbPaintTransparent ) 3533cdf0e10cSrcweir ImplExcludeWindowRegion( aRegion ); 3534cdf0e10cSrcweir ImplClipBoundaries( aRegion, sal_False, sal_True ); 3535cdf0e10cSrcweir if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow ) 3536cdf0e10cSrcweir ImplInvalidateParentFrameRegion( aRegion ); 3537cdf0e10cSrcweir } 3538cdf0e10cSrcweir } 3539cdf0e10cSrcweir 3540cdf0e10cSrcweir // System-Objekte anpassen 3541cdf0e10cSrcweir if ( bUpdateSysObjClip ) 3542cdf0e10cSrcweir ImplUpdateSysObjClip(); 3543cdf0e10cSrcweir if ( bUpdateSysObjPos ) 3544cdf0e10cSrcweir ImplUpdateSysObjPos(); 3545cdf0e10cSrcweir if ( bNewSize && mpWindowImpl->mpSysObj ) 3546cdf0e10cSrcweir mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); 3547cdf0e10cSrcweir } 3548cdf0e10cSrcweir 3549cdf0e10cSrcweir if ( pOverlapRegion ) 3550cdf0e10cSrcweir delete pOverlapRegion; 3551cdf0e10cSrcweir if ( pOldRegion ) 3552cdf0e10cSrcweir delete pOldRegion; 3553cdf0e10cSrcweir } 3554cdf0e10cSrcweir 3555cdf0e10cSrcweir // ----------------------------------------------------------------------- 3556cdf0e10cSrcweir 3557cdf0e10cSrcweir void Window::ImplToBottomChild() 3558cdf0e10cSrcweir { 3559cdf0e10cSrcweir if ( !ImplIsOverlapWindow() && !mpWindowImpl->mbReallyVisible && (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild != this) ) 3560cdf0e10cSrcweir { 3561cdf0e10cSrcweir // Fenster an das Ende der Liste setzen 3562cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 3563cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 3564cdf0e10cSrcweir else 3565cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext; 3566cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 3567cdf0e10cSrcweir mpWindowImpl->mpPrev = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild; 3568cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this; 3569cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this; 3570cdf0e10cSrcweir mpWindowImpl->mpNext = NULL; 3571cdf0e10cSrcweir } 3572cdf0e10cSrcweir } 3573cdf0e10cSrcweir 3574cdf0e10cSrcweir // ----------------------------------------------------------------------- 3575cdf0e10cSrcweir 3576cdf0e10cSrcweir void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData ) 3577cdf0e10cSrcweir { 3578cdf0e10cSrcweir DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcToTop(): Is not a OverlapWindow" ); 3579cdf0e10cSrcweir 3580cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame ) 3581cdf0e10cSrcweir { 3582cdf0e10cSrcweir if ( IsReallyVisible() ) 3583cdf0e10cSrcweir { 3584cdf0e10cSrcweir // Region berechnen, wo das Fenster mit anderen Fenstern ueberlappt 3585cdf0e10cSrcweir Point aPoint( mnOutOffX, mnOutOffY ); 3586cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, 3587cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ) ); 3588cdf0e10cSrcweir Region aInvalidateRegion; 3589cdf0e10cSrcweir ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion ); 3590cdf0e10cSrcweir 3591cdf0e10cSrcweir if ( !aInvalidateRegion.IsEmpty() ) 3592cdf0e10cSrcweir { 3593cdf0e10cSrcweir ImplCalcToTopData* pData = new ImplCalcToTopData; 3594cdf0e10cSrcweir pPrevData->mpNext = pData; 3595cdf0e10cSrcweir pData->mpNext = NULL; 3596cdf0e10cSrcweir pData->mpWindow = this; 3597cdf0e10cSrcweir pData->mpInvalidateRegion = new Region( aInvalidateRegion ); 3598cdf0e10cSrcweir } 3599cdf0e10cSrcweir } 3600cdf0e10cSrcweir } 3601cdf0e10cSrcweir } 3602cdf0e10cSrcweir 3603cdf0e10cSrcweir // ----------------------------------------------------------------------- 3604cdf0e10cSrcweir 3605cdf0e10cSrcweir void Window::ImplCalcChildOverlapToTop( ImplCalcToTopData* pPrevData ) 3606cdf0e10cSrcweir { 3607cdf0e10cSrcweir DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcChildOverlapToTop(): Is not a OverlapWindow" ); 3608cdf0e10cSrcweir 3609cdf0e10cSrcweir ImplCalcToTop( pPrevData ); 3610cdf0e10cSrcweir if ( pPrevData->mpNext ) 3611cdf0e10cSrcweir pPrevData = pPrevData->mpNext; 3612cdf0e10cSrcweir 3613cdf0e10cSrcweir Window* pOverlap = mpWindowImpl->mpFirstOverlap; 3614cdf0e10cSrcweir while ( pOverlap ) 3615cdf0e10cSrcweir { 3616cdf0e10cSrcweir pOverlap->ImplCalcToTop( pPrevData ); 3617cdf0e10cSrcweir if ( pPrevData->mpNext ) 3618cdf0e10cSrcweir pPrevData = pPrevData->mpNext; 3619cdf0e10cSrcweir pOverlap = pOverlap->mpWindowImpl->mpNext; 3620cdf0e10cSrcweir } 3621cdf0e10cSrcweir } 3622cdf0e10cSrcweir 3623cdf0e10cSrcweir // ----------------------------------------------------------------------- 3624cdf0e10cSrcweir 3625cdf0e10cSrcweir void Window::ImplToTop( sal_uInt16 nFlags ) 3626cdf0e10cSrcweir { 3627cdf0e10cSrcweir DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplToTop(): Is not a OverlapWindow" ); 3628cdf0e10cSrcweir 3629cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 3630cdf0e10cSrcweir { 3631cdf0e10cSrcweir // Wenn in das externe Fenster geklickt wird, ist dieses 3632cdf0e10cSrcweir // dafuer zustaendig dafuer zu sorgen, das unser Frame 3633cdf0e10cSrcweir // nach vorne kommt 3634cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbHasFocus && 3635cdf0e10cSrcweir !mpWindowImpl->mpFrameData->mbSysObjFocus && 3636cdf0e10cSrcweir !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl && 3637cdf0e10cSrcweir !mpWindowImpl->mpFrameData->mbInSysObjToTopHdl ) 3638cdf0e10cSrcweir { 3639cdf0e10cSrcweir // do not bring floating windows on the client to top 3640cdf0e10cSrcweir if( !ImplGetClientWindow() || !(ImplGetClientWindow()->GetStyle() & WB_SYSTEMFLOATWIN) ) 3641cdf0e10cSrcweir { 3642cdf0e10cSrcweir sal_uInt16 nSysFlags = 0; 3643cdf0e10cSrcweir if ( nFlags & TOTOP_RESTOREWHENMIN ) 3644cdf0e10cSrcweir nSysFlags |= SAL_FRAME_TOTOP_RESTOREWHENMIN; 3645cdf0e10cSrcweir if ( nFlags & TOTOP_FOREGROUNDTASK ) 3646cdf0e10cSrcweir nSysFlags |= SAL_FRAME_TOTOP_FOREGROUNDTASK; 3647cdf0e10cSrcweir if ( nFlags & TOTOP_GRABFOCUSONLY ) 3648cdf0e10cSrcweir nSysFlags |= SAL_FRAME_TOTOP_GRABFOCUS_ONLY; 3649cdf0e10cSrcweir mpWindowImpl->mpFrame->ToTop( nSysFlags ); 3650cdf0e10cSrcweir } 3651cdf0e10cSrcweir } 3652cdf0e10cSrcweir } 3653cdf0e10cSrcweir else 3654cdf0e10cSrcweir { 3655cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap != this ) 3656cdf0e10cSrcweir { 3657cdf0e10cSrcweir // Fenster aus der Liste entfernen 3658cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 3659cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 3660cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 3661cdf0e10cSrcweir else 3662cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; 3663cdf0e10cSrcweir 3664cdf0e10cSrcweir // AlwaysOnTop beruecksichtigen 3665cdf0e10cSrcweir sal_Bool bOnTop = IsAlwaysOnTopEnabled(); 3666cdf0e10cSrcweir Window* pNextWin = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; 3667cdf0e10cSrcweir if ( !bOnTop ) 3668cdf0e10cSrcweir { 3669cdf0e10cSrcweir while ( pNextWin ) 3670cdf0e10cSrcweir { 3671cdf0e10cSrcweir if ( !pNextWin->IsAlwaysOnTopEnabled() ) 3672cdf0e10cSrcweir break; 3673cdf0e10cSrcweir pNextWin = pNextWin->mpWindowImpl->mpNext; 3674cdf0e10cSrcweir } 3675cdf0e10cSrcweir } 3676cdf0e10cSrcweir 3677cdf0e10cSrcweir // TopLevel abpruefen 3678cdf0e10cSrcweir sal_uInt8 nTopLevel = mpWindowImpl->mpOverlapData->mnTopLevel; 3679cdf0e10cSrcweir while ( pNextWin ) 3680cdf0e10cSrcweir { 3681cdf0e10cSrcweir if ( (bOnTop != pNextWin->IsAlwaysOnTopEnabled()) || 3682cdf0e10cSrcweir (nTopLevel <= pNextWin->mpWindowImpl->mpOverlapData->mnTopLevel) ) 3683cdf0e10cSrcweir break; 3684cdf0e10cSrcweir pNextWin = pNextWin->mpWindowImpl->mpNext; 3685cdf0e10cSrcweir } 3686cdf0e10cSrcweir 3687cdf0e10cSrcweir // Fenster in die Liste wieder eintragen 3688cdf0e10cSrcweir mpWindowImpl->mpNext = pNextWin; 3689cdf0e10cSrcweir if ( pNextWin ) 3690cdf0e10cSrcweir { 3691cdf0e10cSrcweir mpWindowImpl->mpPrev = pNextWin->mpWindowImpl->mpPrev; 3692cdf0e10cSrcweir pNextWin->mpWindowImpl->mpPrev = this; 3693cdf0e10cSrcweir } 3694cdf0e10cSrcweir else 3695cdf0e10cSrcweir { 3696cdf0e10cSrcweir mpWindowImpl->mpPrev = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap; 3697cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = this; 3698cdf0e10cSrcweir } 3699cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 3700cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this; 3701cdf0e10cSrcweir else 3702cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = this; 3703cdf0e10cSrcweir 3704cdf0e10cSrcweir // ClipRegion muss von diesem Fenster und allen weiteren 3705cdf0e10cSrcweir // ueberlappenden Fenstern neu berechnet werden. 3706cdf0e10cSrcweir if ( IsReallyVisible() ) 3707cdf0e10cSrcweir { 3708cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 3709cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 3710cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 3711cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->ImplSetClipFlagOverlapWindows(); 3712cdf0e10cSrcweir } 3713cdf0e10cSrcweir } 3714cdf0e10cSrcweir } 3715cdf0e10cSrcweir } 3716cdf0e10cSrcweir 3717cdf0e10cSrcweir // ----------------------------------------------------------------------- 3718cdf0e10cSrcweir 3719cdf0e10cSrcweir void Window::ImplStartToTop( sal_uInt16 nFlags ) 3720cdf0e10cSrcweir { 3721cdf0e10cSrcweir ImplCalcToTopData aStartData; 3722cdf0e10cSrcweir ImplCalcToTopData* pCurData; 3723cdf0e10cSrcweir ImplCalcToTopData* pNextData; 3724cdf0e10cSrcweir Window* pOverlapWindow; 3725cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 3726cdf0e10cSrcweir pOverlapWindow = this; 3727cdf0e10cSrcweir else 3728cdf0e10cSrcweir pOverlapWindow = mpWindowImpl->mpOverlapWindow; 3729cdf0e10cSrcweir 3730cdf0e10cSrcweir // Zuerst die Paint-Bereiche berechnen 3731cdf0e10cSrcweir Window* pTempOverlapWindow = pOverlapWindow; 3732cdf0e10cSrcweir aStartData.mpNext = NULL; 3733cdf0e10cSrcweir pCurData = &aStartData; 3734cdf0e10cSrcweir do 3735cdf0e10cSrcweir { 3736cdf0e10cSrcweir pTempOverlapWindow->ImplCalcToTop( pCurData ); 3737cdf0e10cSrcweir if ( pCurData->mpNext ) 3738cdf0e10cSrcweir pCurData = pCurData->mpNext; 3739cdf0e10cSrcweir pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpOverlapWindow; 3740cdf0e10cSrcweir } 3741cdf0e10cSrcweir while ( !pTempOverlapWindow->mpWindowImpl->mbFrame ); 3742cdf0e10cSrcweir // Dann die Paint-Bereiche der ChildOverlap-Windows berechnen 3743cdf0e10cSrcweir pTempOverlapWindow = mpWindowImpl->mpFirstOverlap; 3744cdf0e10cSrcweir while ( pTempOverlapWindow ) 3745cdf0e10cSrcweir { 3746cdf0e10cSrcweir pTempOverlapWindow->ImplCalcToTop( pCurData ); 3747cdf0e10cSrcweir if ( pCurData->mpNext ) 3748cdf0e10cSrcweir pCurData = pCurData->mpNext; 3749cdf0e10cSrcweir pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpNext; 3750cdf0e10cSrcweir } 3751cdf0e10cSrcweir 3752cdf0e10cSrcweir // Dann die Fenster-Verkettung aendern 3753cdf0e10cSrcweir pTempOverlapWindow = pOverlapWindow; 3754cdf0e10cSrcweir do 3755cdf0e10cSrcweir { 3756cdf0e10cSrcweir pTempOverlapWindow->ImplToTop( nFlags ); 3757cdf0e10cSrcweir pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpOverlapWindow; 3758cdf0e10cSrcweir } 3759cdf0e10cSrcweir while ( !pTempOverlapWindow->mpWindowImpl->mbFrame ); 3760cdf0e10cSrcweir // Und zum Schluss invalidieren wir die ungueltigen Bereiche 3761cdf0e10cSrcweir pCurData = aStartData.mpNext; 3762cdf0e10cSrcweir while ( pCurData ) 3763cdf0e10cSrcweir { 3764cdf0e10cSrcweir pCurData->mpWindow->ImplInvalidateFrameRegion( pCurData->mpInvalidateRegion, INVALIDATE_CHILDREN ); 3765cdf0e10cSrcweir pNextData = pCurData->mpNext; 3766cdf0e10cSrcweir delete pCurData->mpInvalidateRegion; 3767cdf0e10cSrcweir delete pCurData; 3768cdf0e10cSrcweir pCurData = pNextData; 3769cdf0e10cSrcweir } 3770cdf0e10cSrcweir } 3771cdf0e10cSrcweir 3772cdf0e10cSrcweir // ----------------------------------------------------------------------- 3773cdf0e10cSrcweir 3774cdf0e10cSrcweir void Window::ImplFocusToTop( sal_uInt16 nFlags, sal_Bool bReallyVisible ) 3775cdf0e10cSrcweir { 3776cdf0e10cSrcweir // Soll Focus auch geholt werden? 3777cdf0e10cSrcweir if ( !(nFlags & TOTOP_NOGRABFOCUS) ) 3778cdf0e10cSrcweir { 3779cdf0e10cSrcweir // Erstes Fenster mit GrabFocus-Activate bekommt den Focus 3780cdf0e10cSrcweir Window* pFocusWindow = this; 3781cdf0e10cSrcweir while ( !pFocusWindow->ImplIsOverlapWindow() ) 3782cdf0e10cSrcweir { 3783cdf0e10cSrcweir // Nur wenn Fenster kein Border-Fenster hat, da wir 3784cdf0e10cSrcweir // immer das dazugehoerende BorderFenster finden wollen 3785cdf0e10cSrcweir if ( !pFocusWindow->mpWindowImpl->mpBorderWindow ) 3786cdf0e10cSrcweir { 3787cdf0e10cSrcweir if ( pFocusWindow->mpWindowImpl->mnActivateMode & ACTIVATE_MODE_GRABFOCUS ) 3788cdf0e10cSrcweir break; 3789cdf0e10cSrcweir } 3790cdf0e10cSrcweir pFocusWindow = pFocusWindow->ImplGetParent(); 3791cdf0e10cSrcweir } 3792cdf0e10cSrcweir if ( (pFocusWindow->mpWindowImpl->mnActivateMode & ACTIVATE_MODE_GRABFOCUS) && 3793cdf0e10cSrcweir !pFocusWindow->HasChildPathFocus( sal_True ) ) 3794cdf0e10cSrcweir pFocusWindow->GrabFocus(); 3795cdf0e10cSrcweir } 3796cdf0e10cSrcweir 3797cdf0e10cSrcweir if ( bReallyVisible ) 3798cdf0e10cSrcweir ImplGenerateMouseMove(); 3799cdf0e10cSrcweir } 3800cdf0e10cSrcweir 3801cdf0e10cSrcweir // ----------------------------------------------------------------------- 3802cdf0e10cSrcweir 3803cdf0e10cSrcweir void Window::ImplShowAllOverlaps() 3804cdf0e10cSrcweir { 3805cdf0e10cSrcweir Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap; 3806cdf0e10cSrcweir while ( pOverlapWindow ) 3807cdf0e10cSrcweir { 3808cdf0e10cSrcweir if ( pOverlapWindow->mpWindowImpl->mbOverlapVisible ) 3809cdf0e10cSrcweir { 3810cdf0e10cSrcweir pOverlapWindow->Show( sal_True, SHOW_NOACTIVATE ); 3811cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_False; 3812cdf0e10cSrcweir } 3813cdf0e10cSrcweir 3814cdf0e10cSrcweir pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 3815cdf0e10cSrcweir } 3816cdf0e10cSrcweir } 3817cdf0e10cSrcweir 3818cdf0e10cSrcweir // ----------------------------------------------------------------------- 3819cdf0e10cSrcweir 3820cdf0e10cSrcweir void Window::ImplHideAllOverlaps() 3821cdf0e10cSrcweir { 3822cdf0e10cSrcweir Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap; 3823cdf0e10cSrcweir while ( pOverlapWindow ) 3824cdf0e10cSrcweir { 3825cdf0e10cSrcweir if ( pOverlapWindow->IsVisible() ) 3826cdf0e10cSrcweir { 3827cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_True; 3828cdf0e10cSrcweir pOverlapWindow->Show( sal_False ); 3829cdf0e10cSrcweir } 3830cdf0e10cSrcweir 3831cdf0e10cSrcweir pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 3832cdf0e10cSrcweir } 3833cdf0e10cSrcweir } 3834cdf0e10cSrcweir 3835cdf0e10cSrcweir // ----------------------------------------------------------------------- 3836cdf0e10cSrcweir 3837cdf0e10cSrcweir void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, sal_Bool bModChanged ) 3838cdf0e10cSrcweir { 3839cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mbMouseIn && mpWindowImpl->mpFrameWindow->mpWindowImpl->mbReallyVisible ) 3840cdf0e10cSrcweir { 3841cdf0e10cSrcweir sal_uLong nTime = Time::GetSystemTicks(); 3842cdf0e10cSrcweir long nX = mpWindowImpl->mpFrameData->mnLastMouseX; 3843cdf0e10cSrcweir long nY = mpWindowImpl->mpFrameData->mnLastMouseY; 3844cdf0e10cSrcweir sal_uInt16 nCode = nMouseCode; 3845cdf0e10cSrcweir sal_uInt16 nMode = mpWindowImpl->mpFrameData->mnMouseMode; 3846cdf0e10cSrcweir sal_Bool bLeave; 3847cdf0e10cSrcweir // Auf MouseLeave testen 3848cdf0e10cSrcweir if ( ((nX < 0) || (nY < 0) || 3849cdf0e10cSrcweir (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || 3850cdf0e10cSrcweir (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && 3851cdf0e10cSrcweir !ImplGetSVData()->maWinData.mpCaptureWin ) 3852cdf0e10cSrcweir bLeave = sal_True; 3853cdf0e10cSrcweir else 3854cdf0e10cSrcweir bLeave = sal_False; 3855cdf0e10cSrcweir nMode |= MOUSE_SYNTHETIC; 3856cdf0e10cSrcweir if ( bModChanged ) 3857cdf0e10cSrcweir nMode |= MOUSE_MODIFIERCHANGED; 3858cdf0e10cSrcweir ImplHandleMouseEvent( mpWindowImpl->mpFrameWindow, EVENT_MOUSEMOVE, bLeave, nX, nY, nTime, nCode, nMode ); 3859cdf0e10cSrcweir } 3860cdf0e10cSrcweir } 3861cdf0e10cSrcweir 3862cdf0e10cSrcweir // ----------------------------------------------------------------------- 3863cdf0e10cSrcweir 3864cdf0e10cSrcweir void Window::ImplGenerateMouseMove() 3865cdf0e10cSrcweir { 3866cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mnMouseMoveId ) 3867cdf0e10cSrcweir Application::PostUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId, LINK( mpWindowImpl->mpFrameWindow, Window, ImplGenerateMouseMoveHdl ) ); 3868cdf0e10cSrcweir } 3869cdf0e10cSrcweir 3870cdf0e10cSrcweir // ----------------------------------------------------------------------- 3871cdf0e10cSrcweir 3872cdf0e10cSrcweir IMPL_LINK( Window, ImplGenerateMouseMoveHdl, void*, EMPTYARG ) 3873cdf0e10cSrcweir { 3874cdf0e10cSrcweir mpWindowImpl->mpFrameData->mnMouseMoveId = 0; 3875cdf0e10cSrcweir Window* pCaptureWin = ImplGetSVData()->maWinData.mpCaptureWin; 3876cdf0e10cSrcweir if( ! pCaptureWin || 3877cdf0e10cSrcweir (pCaptureWin->mpWindowImpl && pCaptureWin->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame) 3878cdf0e10cSrcweir ) 3879cdf0e10cSrcweir { 3880cdf0e10cSrcweir ImplCallMouseMove( mpWindowImpl->mpFrameData->mnMouseCode ); 3881cdf0e10cSrcweir } 3882cdf0e10cSrcweir return 0; 3883cdf0e10cSrcweir } 3884cdf0e10cSrcweir 3885cdf0e10cSrcweir // ----------------------------------------------------------------------- 3886cdf0e10cSrcweir 3887cdf0e10cSrcweir void Window::ImplInvertFocus( const Rectangle& rRect ) 3888cdf0e10cSrcweir { 3889cdf0e10cSrcweir InvertTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); 3890cdf0e10cSrcweir } 3891cdf0e10cSrcweir 3892cdf0e10cSrcweir // ----------------------------------------------------------------------- 3893cdf0e10cSrcweir 3894cdf0e10cSrcweir void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow, 3895cdf0e10cSrcweir Window* pOldOverlapWindow ) 3896cdf0e10cSrcweir { 3897cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 3898cdf0e10cSrcweir Window* pNewRealWindow; 3899cdf0e10cSrcweir Window* pOldRealWindow; 3900cdf0e10cSrcweir Window* pLastRealWindow; 3901cdf0e10cSrcweir sal_Bool bCallActivate = sal_True; 3902cdf0e10cSrcweir sal_Bool bCallDeactivate = sal_True; 3903cdf0e10cSrcweir 3904cdf0e10cSrcweir pOldRealWindow = pOldOverlapWindow->ImplGetWindow(); 3905cdf0e10cSrcweir pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); 3906cdf0e10cSrcweir if ( (pOldRealWindow->GetType() != WINDOW_FLOATINGWINDOW) || 3907cdf0e10cSrcweir pOldRealWindow->GetActivateMode() ) 3908cdf0e10cSrcweir { 3909cdf0e10cSrcweir if ( (pNewRealWindow->GetType() == WINDOW_FLOATINGWINDOW) && 3910cdf0e10cSrcweir !pNewRealWindow->GetActivateMode() ) 3911cdf0e10cSrcweir { 3912cdf0e10cSrcweir pSVData->maWinData.mpLastDeacWin = pOldOverlapWindow; 3913cdf0e10cSrcweir bCallDeactivate = sal_False; 3914cdf0e10cSrcweir } 3915cdf0e10cSrcweir } 3916cdf0e10cSrcweir else if ( (pNewRealWindow->GetType() != WINDOW_FLOATINGWINDOW) || 3917cdf0e10cSrcweir pNewRealWindow->GetActivateMode() ) 3918cdf0e10cSrcweir { 3919cdf0e10cSrcweir if ( pSVData->maWinData.mpLastDeacWin ) 3920cdf0e10cSrcweir { 3921cdf0e10cSrcweir if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow ) 3922cdf0e10cSrcweir bCallActivate = sal_False; 3923cdf0e10cSrcweir else 3924cdf0e10cSrcweir { 3925cdf0e10cSrcweir pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow(); 3926cdf0e10cSrcweir pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = sal_False; 3927cdf0e10cSrcweir pSVData->maWinData.mpLastDeacWin->Deactivate(); 3928cdf0e10cSrcweir if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin ) 3929cdf0e10cSrcweir { 3930cdf0e10cSrcweir pLastRealWindow->mpWindowImpl->mbActive = sal_True; 3931cdf0e10cSrcweir pLastRealWindow->Activate(); 3932cdf0e10cSrcweir } 3933cdf0e10cSrcweir } 3934cdf0e10cSrcweir pSVData->maWinData.mpLastDeacWin = NULL; 3935cdf0e10cSrcweir } 3936cdf0e10cSrcweir } 3937cdf0e10cSrcweir 3938cdf0e10cSrcweir if ( bCallDeactivate ) 3939cdf0e10cSrcweir { 3940cdf0e10cSrcweir if( pOldOverlapWindow->mpWindowImpl->mbActive ) 3941cdf0e10cSrcweir { 3942cdf0e10cSrcweir pOldOverlapWindow->mpWindowImpl->mbActive = sal_False; 3943cdf0e10cSrcweir pOldOverlapWindow->Deactivate(); 3944cdf0e10cSrcweir } 3945cdf0e10cSrcweir if ( pOldRealWindow != pOldOverlapWindow ) 3946cdf0e10cSrcweir { 3947cdf0e10cSrcweir if( pOldRealWindow->mpWindowImpl->mbActive ) 3948cdf0e10cSrcweir { 3949cdf0e10cSrcweir pOldRealWindow->mpWindowImpl->mbActive = sal_False; 3950cdf0e10cSrcweir pOldRealWindow->Deactivate(); 3951cdf0e10cSrcweir } 3952cdf0e10cSrcweir } 3953cdf0e10cSrcweir } 3954cdf0e10cSrcweir if ( bCallActivate && ! pNewOverlapWindow->mpWindowImpl->mbActive ) 3955cdf0e10cSrcweir { 3956cdf0e10cSrcweir if( ! pNewOverlapWindow->mpWindowImpl->mbActive ) 3957cdf0e10cSrcweir { 3958cdf0e10cSrcweir pNewOverlapWindow->mpWindowImpl->mbActive = sal_True; 3959cdf0e10cSrcweir pNewOverlapWindow->Activate(); 3960cdf0e10cSrcweir } 3961cdf0e10cSrcweir if ( pNewRealWindow != pNewOverlapWindow ) 3962cdf0e10cSrcweir { 3963cdf0e10cSrcweir if( ! pNewRealWindow->mpWindowImpl->mbActive ) 3964cdf0e10cSrcweir { 3965cdf0e10cSrcweir pNewRealWindow->mpWindowImpl->mbActive = sal_True; 3966cdf0e10cSrcweir pNewRealWindow->Activate(); 3967cdf0e10cSrcweir } 3968cdf0e10cSrcweir } 3969cdf0e10cSrcweir } 3970cdf0e10cSrcweir } 3971cdf0e10cSrcweir 3972cdf0e10cSrcweir static bool IsWindowFocused(const WindowImpl& rWinImpl) 3973cdf0e10cSrcweir { 3974cdf0e10cSrcweir if (rWinImpl.mpSysObj) 3975cdf0e10cSrcweir return true; 3976cdf0e10cSrcweir 3977cdf0e10cSrcweir if (rWinImpl.mpFrameData->mbHasFocus) 3978cdf0e10cSrcweir return true; 3979cdf0e10cSrcweir 3980cdf0e10cSrcweir if (rWinImpl.mbFakeFocusSet) 3981cdf0e10cSrcweir return true; 3982cdf0e10cSrcweir 3983cdf0e10cSrcweir return false; 3984cdf0e10cSrcweir } 3985cdf0e10cSrcweir 3986cdf0e10cSrcweir // ----------------------------------------------------------------------- 3987cdf0e10cSrcweir void Window::ImplGrabFocus( sal_uInt16 nFlags ) 3988cdf0e10cSrcweir { 3989cdf0e10cSrcweir // #143570# no focus for destructing windows 3990cdf0e10cSrcweir if( mpWindowImpl->mbInDtor ) 3991cdf0e10cSrcweir return; 3992cdf0e10cSrcweir 3993cdf0e10cSrcweir // some event listeners do really bad stuff 3994cdf0e10cSrcweir // => prepare for the worst 3995cdf0e10cSrcweir ImplDelData aDogTag( this ); 3996cdf0e10cSrcweir 3997cdf0e10cSrcweir // Currently the client window should always get the focus 3998cdf0e10cSrcweir // Should the border window at some point be focusable 3999cdf0e10cSrcweir // we need to change all GrabFocus() instances in VCL, 4000cdf0e10cSrcweir // e.g. in ToTop() 4001cdf0e10cSrcweir 4002cdf0e10cSrcweir if ( mpWindowImpl->mpClientWindow ) 4003cdf0e10cSrcweir { 4004cdf0e10cSrcweir // For a lack of design we need a little hack here to 4005cdf0e10cSrcweir // ensure that dialogs on close pass the focus back to 4006cdf0e10cSrcweir // the correct window 4007cdf0e10cSrcweir if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) && 4008cdf0e10cSrcweir !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) && 4009cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->IsEnabled() && 4010cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->IsInputEnabled() && 4011cdf0e10cSrcweir ! mpWindowImpl->mpLastFocusWindow->IsInModalMode() 4012cdf0e10cSrcweir ) 4013cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->GrabFocus(); 4014cdf0e10cSrcweir else 4015cdf0e10cSrcweir mpWindowImpl->mpClientWindow->GrabFocus(); 4016cdf0e10cSrcweir return; 4017cdf0e10cSrcweir } 4018cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame ) 4019cdf0e10cSrcweir { 4020cdf0e10cSrcweir // For a lack of design we need a little hack here to 4021cdf0e10cSrcweir // ensure that dialogs on close pass the focus back to 4022cdf0e10cSrcweir // the correct window 4023cdf0e10cSrcweir if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) && 4024cdf0e10cSrcweir !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) && 4025cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->IsEnabled() && 4026cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->IsInputEnabled() && 4027cdf0e10cSrcweir ! mpWindowImpl->mpLastFocusWindow->IsInModalMode() 4028cdf0e10cSrcweir ) 4029cdf0e10cSrcweir { 4030cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->GrabFocus(); 4031cdf0e10cSrcweir return; 4032cdf0e10cSrcweir } 4033cdf0e10cSrcweir } 4034cdf0e10cSrcweir 4035cdf0e10cSrcweir // If the Window is disabled, then we don't change the focus 4036cdf0e10cSrcweir if ( !IsEnabled() || !IsInputEnabled() || IsInModalMode() ) 4037cdf0e10cSrcweir return; 4038cdf0e10cSrcweir 4039cdf0e10cSrcweir // we only need to set the focus if it is not already set 4040cdf0e10cSrcweir // note: if some other frame is waiting for an asynchrounous focus event 4041cdf0e10cSrcweir // we also have to post an asynchronous focus event for this frame 4042cdf0e10cSrcweir // which is done using ToTop 4043cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 4044cdf0e10cSrcweir 4045cdf0e10cSrcweir sal_Bool bAsyncFocusWaiting = sal_False; 4046cdf0e10cSrcweir Window *pFrame = pSVData->maWinData.mpFirstFrame; 4047cdf0e10cSrcweir while( pFrame ) 4048cdf0e10cSrcweir { 4049cdf0e10cSrcweir if( pFrame != mpWindowImpl->mpFrameWindow && pFrame->mpWindowImpl->mpFrameData->mnFocusId ) 4050cdf0e10cSrcweir { 4051cdf0e10cSrcweir bAsyncFocusWaiting = sal_True; 4052cdf0e10cSrcweir break; 4053cdf0e10cSrcweir } 4054cdf0e10cSrcweir pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame; 4055cdf0e10cSrcweir } 4056cdf0e10cSrcweir 4057cdf0e10cSrcweir bool bHasFocus = IsWindowFocused(*mpWindowImpl); 4058cdf0e10cSrcweir 4059cdf0e10cSrcweir sal_Bool bMustNotGrabFocus = sal_False; 4060cdf0e10cSrcweir // #100242#, check parent hierarchy if some floater prohibits grab focus 4061cdf0e10cSrcweir 4062cdf0e10cSrcweir Window *pParent = this; 4063cdf0e10cSrcweir while( pParent ) 4064cdf0e10cSrcweir { 4065cdf0e10cSrcweir // #102158#, ignore grabfocus only if the floating parent grabs keyboard focus by itself (GrabsFocus()) 4066cdf0e10cSrcweir // otherwise we cannot set the focus in a floating toolbox 4067cdf0e10cSrcweir if( ( (pParent->mpWindowImpl->mbFloatWin && ((FloatingWindow*)pParent)->GrabsFocus()) || ( pParent->GetStyle() & WB_SYSTEMFLOATWIN ) ) && !( pParent->GetStyle() & WB_MOVEABLE ) ) 4068cdf0e10cSrcweir { 4069cdf0e10cSrcweir bMustNotGrabFocus = sal_True; 4070cdf0e10cSrcweir break; 4071cdf0e10cSrcweir } 4072cdf0e10cSrcweir pParent = pParent->mpWindowImpl->mpParent; 4073cdf0e10cSrcweir } 4074cdf0e10cSrcweir 4075cdf0e10cSrcweir 4076cdf0e10cSrcweir if ( ( pSVData->maWinData.mpFocusWin != this && ! mpWindowImpl->mbInDtor ) || ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) ) 4077cdf0e10cSrcweir { 4078cdf0e10cSrcweir // EndExtTextInput if it is not the same window 4079cdf0e10cSrcweir if ( pSVData->maWinData.mpExtTextInputWin && 4080cdf0e10cSrcweir (pSVData->maWinData.mpExtTextInputWin != this) ) 4081cdf0e10cSrcweir pSVData->maWinData.mpExtTextInputWin->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE ); 4082cdf0e10cSrcweir 4083cdf0e10cSrcweir // Dieses Fenster als letztes FocusWindow merken 4084cdf0e10cSrcweir Window* pOverlapWindow = ImplGetFirstOverlapWindow(); 4085cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mpLastFocusWindow = this; 4086cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = this; 4087cdf0e10cSrcweir 4088cdf0e10cSrcweir if( !bHasFocus ) 4089cdf0e10cSrcweir { 4090cdf0e10cSrcweir // menue windows never get the system focus 4091cdf0e10cSrcweir // the application will keep the focus 4092cdf0e10cSrcweir if( bMustNotGrabFocus ) 4093cdf0e10cSrcweir return; 4094cdf0e10cSrcweir else 4095cdf0e10cSrcweir { 4096cdf0e10cSrcweir // Hier setzen wir schon den Focus um, da ToTop() den Focus 4097cdf0e10cSrcweir // nicht auf ein anderes Fenster setzen darf 4098cdf0e10cSrcweir //DBG_WARNING( "Window::GrabFocus() - Frame doesn't have the focus" ); 4099cdf0e10cSrcweir mpWindowImpl->mpFrame->ToTop( SAL_FRAME_TOTOP_GRABFOCUS | SAL_FRAME_TOTOP_GRABFOCUS_ONLY ); 4100cdf0e10cSrcweir return; 4101cdf0e10cSrcweir } 4102cdf0e10cSrcweir } 4103cdf0e10cSrcweir 4104cdf0e10cSrcweir Window* pOldFocusWindow = pSVData->maWinData.mpFocusWin; 4105cdf0e10cSrcweir ImplDelData aOldFocusDel( pOldFocusWindow ); 4106cdf0e10cSrcweir 4107cdf0e10cSrcweir pSVData->maWinData.mpFocusWin = this; 4108cdf0e10cSrcweir 4109cdf0e10cSrcweir if ( pOldFocusWindow ) 4110cdf0e10cSrcweir { 4111cdf0e10cSrcweir // Cursor hiden 4112cdf0e10cSrcweir if ( pOldFocusWindow->mpWindowImpl->mpCursor ) 4113cdf0e10cSrcweir pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide( true ); 4114cdf0e10cSrcweir } 4115cdf0e10cSrcweir 4116cdf0e10cSrcweir // !!!!! Wegen altem SV-Office Activate/Deavtivate Handling 4117cdf0e10cSrcweir // !!!!! erstmal so wie frueher 4118cdf0e10cSrcweir if ( pOldFocusWindow ) 4119cdf0e10cSrcweir { 4120cdf0e10cSrcweir // Focus merken 4121cdf0e10cSrcweir Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow(); 4122cdf0e10cSrcweir Window* pNewOverlapWindow = ImplGetFirstOverlapWindow(); 4123cdf0e10cSrcweir if ( pOldOverlapWindow != pNewOverlapWindow ) 4124cdf0e10cSrcweir ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow ); 4125cdf0e10cSrcweir } 4126cdf0e10cSrcweir else 4127cdf0e10cSrcweir { 4128cdf0e10cSrcweir Window* pNewOverlapWindow = ImplGetFirstOverlapWindow(); 4129cdf0e10cSrcweir Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); 4130cdf0e10cSrcweir pNewOverlapWindow->mpWindowImpl->mbActive = sal_True; 4131cdf0e10cSrcweir pNewOverlapWindow->Activate(); 4132cdf0e10cSrcweir if ( pNewRealWindow != pNewOverlapWindow ) 4133cdf0e10cSrcweir { 4134cdf0e10cSrcweir pNewRealWindow->mpWindowImpl->mbActive = sal_True; 4135cdf0e10cSrcweir pNewRealWindow->Activate(); 4136cdf0e10cSrcweir } 4137cdf0e10cSrcweir } 4138cdf0e10cSrcweir /* 4139cdf0e10cSrcweir // call Deactivate and Activate 4140cdf0e10cSrcweir Window* pDeactivateParent; 4141cdf0e10cSrcweir Window* pActivateParent; 4142cdf0e10cSrcweir Window* pParent; 4143cdf0e10cSrcweir Window* pLastParent; 4144cdf0e10cSrcweir pDeactivateParent = pOldFocusWindow; 4145cdf0e10cSrcweir while ( pDeactivateParent ) 4146cdf0e10cSrcweir { 4147cdf0e10cSrcweir pParent = pDeactivateParent; 4148cdf0e10cSrcweir if ( pParent->ImplIsChild( this ) ) 4149cdf0e10cSrcweir break; 4150cdf0e10cSrcweir 4151cdf0e10cSrcweir if ( pDeactivateParent->ImplIsOverlapWindow() ) 4152cdf0e10cSrcweir { 4153cdf0e10cSrcweir if ( !pDeactivateParent->mpWindowImpl->mbParentActive ) 4154cdf0e10cSrcweir break; 4155cdf0e10cSrcweir } 4156cdf0e10cSrcweir 4157cdf0e10cSrcweir pDeactivateParent = pDeactivateParent->ImplGetParent(); 4158cdf0e10cSrcweir } 4159cdf0e10cSrcweir if ( pOldFocusWindow ) 4160cdf0e10cSrcweir { 4161cdf0e10cSrcweir pActivateParent = this; 4162cdf0e10cSrcweir while ( pActivateParent ) 4163cdf0e10cSrcweir { 4164cdf0e10cSrcweir pParent = pActivateParent; 4165cdf0e10cSrcweir if ( pParent->ImplIsChild( pOldFocusWindow ) ) 4166cdf0e10cSrcweir break; 4167cdf0e10cSrcweir 4168cdf0e10cSrcweir if ( pActivateParent->ImplIsOverlapWindow() ) 4169cdf0e10cSrcweir { 4170cdf0e10cSrcweir if ( !pActivateParent->mpWindowImpl->mbParentActive ) 4171cdf0e10cSrcweir break; 4172cdf0e10cSrcweir } 4173cdf0e10cSrcweir 4174cdf0e10cSrcweir pActivateParent = pActivateParent->ImplGetParent(); 4175cdf0e10cSrcweir } 4176cdf0e10cSrcweir } 4177cdf0e10cSrcweir else 4178cdf0e10cSrcweir { 4179cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 4180cdf0e10cSrcweir pActivateParent = this; 4181cdf0e10cSrcweir else 4182cdf0e10cSrcweir pActivateParent = mpWindowImpl->mpOverlapWindow; 4183cdf0e10cSrcweir while ( pActivateParent ) 4184cdf0e10cSrcweir { 4185cdf0e10cSrcweir if ( pActivateParent->ImplIsOverlapWindow() ) 4186cdf0e10cSrcweir { 4187cdf0e10cSrcweir if ( !pActivateParent->mpWindowImpl->mbParentActive ) 4188cdf0e10cSrcweir break; 4189cdf0e10cSrcweir } 4190cdf0e10cSrcweir 4191cdf0e10cSrcweir pActivateParent = pActivateParent->ImplGetParent(); 4192cdf0e10cSrcweir } 4193cdf0e10cSrcweir } 4194cdf0e10cSrcweir if ( pDeactivateParent ) 4195cdf0e10cSrcweir { 4196cdf0e10cSrcweir do 4197cdf0e10cSrcweir { 4198cdf0e10cSrcweir pLastParent = pOldFocusWindow; 4199cdf0e10cSrcweir if ( pLastParent != pDeactivateParent ) 4200cdf0e10cSrcweir { 4201cdf0e10cSrcweir pParent = pLastParent->ImplGetParent(); 4202cdf0e10cSrcweir while ( pParent ) 4203cdf0e10cSrcweir { 4204cdf0e10cSrcweir if ( pParent == pDeactivateParent ) 4205cdf0e10cSrcweir break; 4206cdf0e10cSrcweir pLastParent = pParent; 4207cdf0e10cSrcweir pParent = pParent->ImplGetParent(); 4208cdf0e10cSrcweir } 4209cdf0e10cSrcweir } 4210cdf0e10cSrcweir else 4211cdf0e10cSrcweir pParent = pLastParent; 4212cdf0e10cSrcweir 4213cdf0e10cSrcweir pParent->mpWindowImpl->mbActive = sal_False; 4214cdf0e10cSrcweir pParent->Deactivate(); 4215cdf0e10cSrcweir pDeactivateParent = pLastParent; 4216cdf0e10cSrcweir } 4217cdf0e10cSrcweir while ( pDeactivateParent != pOldFocusWindow ); 4218cdf0e10cSrcweir } 4219cdf0e10cSrcweir do 4220cdf0e10cSrcweir { 4221cdf0e10cSrcweir pLastParent = this; 4222cdf0e10cSrcweir if ( pLastParent != pActivateParent ) 4223cdf0e10cSrcweir { 4224cdf0e10cSrcweir pParent = pLastParent->ImplGetParent(); 4225cdf0e10cSrcweir while ( pParent ) 4226cdf0e10cSrcweir { 4227cdf0e10cSrcweir if ( pParent == pActivateParent ) 4228cdf0e10cSrcweir break; 4229cdf0e10cSrcweir pLastParent = pParent; 4230cdf0e10cSrcweir pParent = pParent->ImplGetParent(); 4231cdf0e10cSrcweir } 4232cdf0e10cSrcweir } 4233cdf0e10cSrcweir else 4234cdf0e10cSrcweir pParent = pLastParent; 4235cdf0e10cSrcweir 4236cdf0e10cSrcweir pParent->mpWindowImpl->mbActive = sal_True; 4237cdf0e10cSrcweir pParent->Activate(); 4238cdf0e10cSrcweir pActivateParent = pLastParent; 4239cdf0e10cSrcweir } 4240cdf0e10cSrcweir while ( pActivateParent != this ); 4241cdf0e10cSrcweir */ 4242cdf0e10cSrcweir // call Get- and LoseFocus 4243cdf0e10cSrcweir if ( pOldFocusWindow && ! aOldFocusDel.IsDelete() ) 4244cdf0e10cSrcweir { 4245cdf0e10cSrcweir if ( pOldFocusWindow->IsTracking() && 4246cdf0e10cSrcweir (pSVData->maWinData.mnTrackFlags & STARTTRACK_FOCUSCANCEL) ) 4247cdf0e10cSrcweir pOldFocusWindow->EndTracking( ENDTRACK_CANCEL | ENDTRACK_FOCUS ); 4248cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_LOSEFOCUS, pOldFocusWindow ); 4249cdf0e10cSrcweir if ( !ImplCallPreNotify( aNEvt ) ) 4250cdf0e10cSrcweir pOldFocusWindow->LoseFocus(); 4251cdf0e10cSrcweir pOldFocusWindow->ImplCallDeactivateListeners( this ); 4252cdf0e10cSrcweir } 4253cdf0e10cSrcweir 4254cdf0e10cSrcweir if ( pSVData->maWinData.mpFocusWin == this ) 4255cdf0e10cSrcweir { 4256cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 4257cdf0e10cSrcweir { 4258cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = this; 4259cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl ) 4260cdf0e10cSrcweir mpWindowImpl->mpSysObj->GrabFocus(); 4261cdf0e10cSrcweir } 4262cdf0e10cSrcweir 4263cdf0e10cSrcweir if ( pSVData->maWinData.mpFocusWin == this ) 4264cdf0e10cSrcweir { 4265cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 4266cdf0e10cSrcweir mpWindowImpl->mpCursor->ImplShow(); 4267cdf0e10cSrcweir mpWindowImpl->mbInFocusHdl = sal_True; 4268cdf0e10cSrcweir mpWindowImpl->mnGetFocusFlags = nFlags; 4269cdf0e10cSrcweir // if we're changing focus due to closing a popup floating window 4270cdf0e10cSrcweir // notify the new focus window so it can restore the inner focus 4271cdf0e10cSrcweir // eg, toolboxes can select their recent active item 4272cdf0e10cSrcweir if( pOldFocusWindow && 4273cdf0e10cSrcweir ! aOldFocusDel.IsDelete() && 4274cdf0e10cSrcweir ( pOldFocusWindow->GetDialogControlFlags() & WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ) ) 4275cdf0e10cSrcweir mpWindowImpl->mnGetFocusFlags |= GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL; 4276cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_GETFOCUS, this ); 4277cdf0e10cSrcweir if ( !ImplCallPreNotify( aNEvt ) && !aDogTag.IsDelete() ) 4278cdf0e10cSrcweir GetFocus(); 4279cdf0e10cSrcweir if( !aDogTag.IsDelete() ) 4280cdf0e10cSrcweir ImplCallActivateListeners( (pOldFocusWindow && ! aOldFocusDel.IsDelete()) ? pOldFocusWindow : NULL ); 4281cdf0e10cSrcweir if( !aDogTag.IsDelete() ) 4282cdf0e10cSrcweir { 4283cdf0e10cSrcweir mpWindowImpl->mnGetFocusFlags = 0; 4284cdf0e10cSrcweir mpWindowImpl->mbInFocusHdl = sal_False; 4285cdf0e10cSrcweir } 4286cdf0e10cSrcweir } 4287cdf0e10cSrcweir } 4288cdf0e10cSrcweir 4289cdf0e10cSrcweir GetpApp()->FocusChanged(); 4290cdf0e10cSrcweir ImplNewInputContext(); 4291cdf0e10cSrcweir } 4292cdf0e10cSrcweir } 4293cdf0e10cSrcweir 4294cdf0e10cSrcweir // ----------------------------------------------------------------------- 4295cdf0e10cSrcweir 4296cdf0e10cSrcweir void Window::ImplNewInputContext() 4297cdf0e10cSrcweir { 4298cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 4299cdf0e10cSrcweir Window* pFocusWin = pSVData->maWinData.mpFocusWin; 4300cdf0e10cSrcweir if ( !pFocusWin ) 4301cdf0e10cSrcweir return; 4302cdf0e10cSrcweir 4303cdf0e10cSrcweir // Is InputContext changed? 4304cdf0e10cSrcweir const InputContext& rInputContext = pFocusWin->GetInputContext(); 4305cdf0e10cSrcweir if ( rInputContext == pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext ) 4306cdf0e10cSrcweir return; 4307cdf0e10cSrcweir 4308cdf0e10cSrcweir pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext = rInputContext; 4309cdf0e10cSrcweir 4310cdf0e10cSrcweir SalInputContext aNewContext; 4311cdf0e10cSrcweir const Font& rFont = rInputContext.GetFont(); 4312cdf0e10cSrcweir const XubString& rFontName = rFont.GetName(); 4313cdf0e10cSrcweir ImplFontEntry* pFontEntry = NULL; 4314cdf0e10cSrcweir aNewContext.mpFont = NULL; 4315cdf0e10cSrcweir if ( rFontName.Len() ) 4316cdf0e10cSrcweir { 4317cdf0e10cSrcweir Size aSize = pFocusWin->ImplLogicToDevicePixel( rFont.GetSize() ); 4318cdf0e10cSrcweir if ( !aSize.Height() ) 4319cdf0e10cSrcweir { 4320cdf0e10cSrcweir // Nur dann Defaultgroesse setzen, wenn Fonthoehe auch in logischen 4321cdf0e10cSrcweir // Koordinaaten 0 ist 4322cdf0e10cSrcweir if ( rFont.GetSize().Height() ) 4323cdf0e10cSrcweir aSize.Height() = 1; 4324cdf0e10cSrcweir else 4325cdf0e10cSrcweir aSize.Height() = (12*pFocusWin->mnDPIY)/72; 4326cdf0e10cSrcweir } 4327cdf0e10cSrcweir // TODO: No display device uses ImplDirectFontSubstitution thingy, right? => remove it 4328cdf0e10cSrcweir ImplDirectFontSubstitution* pFontSubst = NULL; 4329cdf0e10cSrcweir //if( pFocusWin->mpOutDevData ) 4330cdf0e10cSrcweir // pFontSubst = &pFocusWin->mpOutDevData->maDevFontSubst; 4331cdf0e10cSrcweir pFontEntry = pFocusWin->mpFontCache->GetFontEntry( pFocusWin->mpFontList, 4332cdf0e10cSrcweir rFont, aSize, static_cast<float>(aSize.Height()), pFontSubst ); 4333cdf0e10cSrcweir if ( pFontEntry ) 4334cdf0e10cSrcweir aNewContext.mpFont = &pFontEntry->maFontSelData; 4335cdf0e10cSrcweir } 4336cdf0e10cSrcweir aNewContext.meLanguage = rFont.GetLanguage(); 4337cdf0e10cSrcweir aNewContext.mnOptions = rInputContext.GetOptions(); 4338cdf0e10cSrcweir pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext ); 4339cdf0e10cSrcweir 4340cdf0e10cSrcweir if ( pFontEntry ) 4341cdf0e10cSrcweir pFocusWin->mpFontCache->Release( pFontEntry ); 4342cdf0e10cSrcweir } 4343cdf0e10cSrcweir 4344cdf0e10cSrcweir // ----------------------------------------------------------------------- 4345cdf0e10cSrcweir 4346cdf0e10cSrcweir Window::Window( WindowType nType ) 4347cdf0e10cSrcweir { 4348cdf0e10cSrcweir DBG_CTOR( Window, ImplDbgCheckWindow ); 4349cdf0e10cSrcweir 4350cdf0e10cSrcweir ImplInitWindowData( nType ); 4351cdf0e10cSrcweir } 4352cdf0e10cSrcweir 4353cdf0e10cSrcweir // ----------------------------------------------------------------------- 4354cdf0e10cSrcweir 4355cdf0e10cSrcweir Window::Window( Window* pParent, WinBits nStyle ) 4356cdf0e10cSrcweir { 4357cdf0e10cSrcweir DBG_CTOR( Window, ImplDbgCheckWindow ); 4358cdf0e10cSrcweir 4359cdf0e10cSrcweir ImplInitWindowData( WINDOW_WINDOW ); 4360cdf0e10cSrcweir ImplInit( pParent, nStyle, NULL ); 4361cdf0e10cSrcweir } 4362cdf0e10cSrcweir 4363cdf0e10cSrcweir // ----------------------------------------------------------------------- 4364cdf0e10cSrcweir 4365cdf0e10cSrcweir Window::Window( Window* pParent, const ResId& rResId ) 4366cdf0e10cSrcweir { 4367cdf0e10cSrcweir DBG_CTOR( Window, ImplDbgCheckWindow ); 4368cdf0e10cSrcweir 4369cdf0e10cSrcweir ImplInitWindowData( WINDOW_WINDOW ); 4370cdf0e10cSrcweir rResId.SetRT( RSC_WINDOW ); 4371cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 4372cdf0e10cSrcweir ImplInit( pParent, nStyle, NULL ); 4373cdf0e10cSrcweir ImplLoadRes( rResId ); 4374cdf0e10cSrcweir 4375cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 4376cdf0e10cSrcweir Show(); 4377cdf0e10cSrcweir } 4378cdf0e10cSrcweir 4379cdf0e10cSrcweir // ----------------------------------------------------------------------- 4380cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 4381cdf0e10cSrcweir namespace 4382cdf0e10cSrcweir { 4383cdf0e10cSrcweir void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow ) 4384cdf0e10cSrcweir { 4385cdf0e10cSrcweir // skip border windows, they don't carry information which helps diagnosing the problem 4386cdf0e10cSrcweir const Window* pWindow( &i_rWindow ); 4387cdf0e10cSrcweir while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) ) 4388cdf0e10cSrcweir pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD ); 4389cdf0e10cSrcweir if ( !pWindow ) 4390cdf0e10cSrcweir pWindow = &i_rWindow; 4391cdf0e10cSrcweir 4392cdf0e10cSrcweir io_rErrorString += char(13); 4393cdf0e10cSrcweir io_rErrorString += typeid( *pWindow ).name(); 4394cdf0e10cSrcweir io_rErrorString += " (window text: '"; 4395cdf0e10cSrcweir io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 ); 4396cdf0e10cSrcweir io_rErrorString += "')"; 4397cdf0e10cSrcweir } 4398cdf0e10cSrcweir } 4399cdf0e10cSrcweir #endif 4400cdf0e10cSrcweir // ----------------------------------------------------------------------- 4401cdf0e10cSrcweir 4402cdf0e10cSrcweir Window::~Window() 4403cdf0e10cSrcweir { 4404cdf0e10cSrcweir ImplFreeExtWindowImpl(); 4405cdf0e10cSrcweir 4406cdf0e10cSrcweir vcl::LazyDeletor<Window>::Undelete( this ); 4407cdf0e10cSrcweir 4408cdf0e10cSrcweir DBG_DTOR( Window, ImplDbgCheckWindow ); 4409cdf0e10cSrcweir DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" ); 4410cdf0e10cSrcweir 4411cdf0e10cSrcweir 4412cdf0e10cSrcweir // remove Key and Mouse events issued by Application::PostKey/MouseEvent 4413cdf0e10cSrcweir Application::RemoveMouseAndKeyEvents( this ); 4414cdf0e10cSrcweir 4415cdf0e10cSrcweir // Dispose of the canvas implementation (which, currently, has an 4416cdf0e10cSrcweir // own wrapper window as a child to this one. 4417cdf0e10cSrcweir uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); 4418cdf0e10cSrcweir if( xCanvas.is() ) 4419cdf0e10cSrcweir { 4420cdf0e10cSrcweir uno::Reference < lang::XComponent > xCanvasComponent( xCanvas, 4421cdf0e10cSrcweir uno::UNO_QUERY ); 4422cdf0e10cSrcweir if( xCanvasComponent.is() ) 4423cdf0e10cSrcweir xCanvasComponent->dispose(); 4424cdf0e10cSrcweir } 4425cdf0e10cSrcweir 4426cdf0e10cSrcweir mpWindowImpl->mbInDtor = sal_True; 4427cdf0e10cSrcweir 4428cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_OBJECT_DYING ); 4429cdf0e10cSrcweir 4430cdf0e10cSrcweir // do not send child events for frames that were registered as native frames 4431cdf0e10cSrcweir if( !ImplIsAccessibleNativeFrame() && mpWindowImpl->mbReallyVisible ) 4432cdf0e10cSrcweir if ( ImplIsAccessibleCandidate() && GetAccessibleParentWindow() ) 4433cdf0e10cSrcweir GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDDESTROYED, this ); 4434cdf0e10cSrcweir 4435cdf0e10cSrcweir // remove associated data structures from dockingmanager 4436cdf0e10cSrcweir ImplGetDockingManager()->RemoveWindow( this ); 4437cdf0e10cSrcweir 4438cdf0e10cSrcweir 4439cdf0e10cSrcweir // remove ownerdraw decorated windows from list in the top-most frame window 4440cdf0e10cSrcweir if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) 4441cdf0e10cSrcweir { 4442cdf0e10cSrcweir ::std::vector< Window* >& rList = ImplGetOwnerDrawList(); 4443cdf0e10cSrcweir ::std::vector< Window* >::iterator p; 4444cdf0e10cSrcweir p = ::std::find( rList.begin(), rList.end(), this ); 4445cdf0e10cSrcweir if( p != rList.end() ) 4446cdf0e10cSrcweir rList.erase( p ); 4447cdf0e10cSrcweir } 4448cdf0e10cSrcweir 4449cdf0e10cSrcweir // shutdown drag and drop 4450cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::lang::XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, ::com::sun::star::uno::UNO_QUERY ); 4451cdf0e10cSrcweir 4452cdf0e10cSrcweir if( xDnDComponent.is() ) 4453cdf0e10cSrcweir xDnDComponent->dispose(); 4454cdf0e10cSrcweir 4455cdf0e10cSrcweir if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData ) 4456cdf0e10cSrcweir { 4457cdf0e10cSrcweir try 4458cdf0e10cSrcweir { 4459cdf0e10cSrcweir // deregister drop target listener 4460cdf0e10cSrcweir if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() ) 4461cdf0e10cSrcweir { 4462cdf0e10cSrcweir uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = 4463cdf0e10cSrcweir uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); 4464cdf0e10cSrcweir if( xDragGestureRecognizer.is() ) 4465cdf0e10cSrcweir { 4466cdf0e10cSrcweir xDragGestureRecognizer->removeDragGestureListener( 4467cdf0e10cSrcweir uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); 4468cdf0e10cSrcweir } 4469cdf0e10cSrcweir 4470cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); 4471cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTargetListener.clear(); 4472cdf0e10cSrcweir } 4473cdf0e10cSrcweir 4474cdf0e10cSrcweir // shutdown drag and drop for this frame window 4475cdf0e10cSrcweir uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY ); 4476cdf0e10cSrcweir 4477cdf0e10cSrcweir // DNDEventDispatcher does not hold a reference of the DropTarget, 4478cdf0e10cSrcweir // so it's ok if it does not support XComponent 4479cdf0e10cSrcweir if( xComponent.is() ) 4480cdf0e10cSrcweir xComponent->dispose(); 4481cdf0e10cSrcweir } 4482cdf0e10cSrcweir 4483adad3ae8SHerbert Dürr catch ( Exception&) 4484cdf0e10cSrcweir { 4485cdf0e10cSrcweir // can be safely ignored here. 4486cdf0e10cSrcweir } 4487cdf0e10cSrcweir } 4488cdf0e10cSrcweir 4489cdf0e10cSrcweir UnoWrapperBase* pWrapper = Application::GetUnoWrapper( sal_False ); 4490cdf0e10cSrcweir if ( pWrapper ) 4491cdf0e10cSrcweir pWrapper->WindowDestroyed( this ); 4492cdf0e10cSrcweir 4493cdf0e10cSrcweir // MT: Must be called after WindowDestroyed! 4494cdf0e10cSrcweir // Otherwise, if the accessible is a VCLXWindow, it will try to destroy this window again! 4495cdf0e10cSrcweir // But accessibility implementations from applications need this dispose. 4496cdf0e10cSrcweir if ( mpWindowImpl->mxAccessible.is() ) 4497cdf0e10cSrcweir { 4498cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xC( mpWindowImpl->mxAccessible, ::com::sun::star::uno::UNO_QUERY ); 4499cdf0e10cSrcweir if ( xC.is() ) 4500cdf0e10cSrcweir xC->dispose(); 4501cdf0e10cSrcweir } 4502cdf0e10cSrcweir 4503cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 4504cdf0e10cSrcweir 4505cdf0e10cSrcweir if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) ) 4506cdf0e10cSrcweir ImplDestroyHelpWindow( true ); 4507cdf0e10cSrcweir 4508cdf0e10cSrcweir DBG_ASSERT( pSVData->maWinData.mpTrackWin != this, 4509cdf0e10cSrcweir "Window::~Window(): Window is in TrackingMode" ); 4510cdf0e10cSrcweir DBG_ASSERT( pSVData->maWinData.mpCaptureWin != this, 4511cdf0e10cSrcweir "Window::~Window(): Window has the mouse captured" ); 4512cdf0e10cSrcweir // #103442# DefModalDialogParent is now determined on-the-fly, so this pointer is unimportant now 4513cdf0e10cSrcweir //DBG_ASSERT( pSVData->maWinData.mpDefDialogParent != this, 4514cdf0e10cSrcweir // "Window::~Window(): Window is DefModalDialogParent" ); 4515cdf0e10cSrcweir 4516cdf0e10cSrcweir // Wegen alter kompatibilitaet 4517cdf0e10cSrcweir if ( pSVData->maWinData.mpTrackWin == this ) 4518cdf0e10cSrcweir EndTracking(); 4519cdf0e10cSrcweir if ( pSVData->maWinData.mpCaptureWin == this ) 4520cdf0e10cSrcweir ReleaseMouse(); 4521cdf0e10cSrcweir if ( pSVData->maWinData.mpDefDialogParent == this ) 4522cdf0e10cSrcweir pSVData->maWinData.mpDefDialogParent = NULL; 4523cdf0e10cSrcweir 4524cdf0e10cSrcweir #ifdef DBG_UTIL 4525cdf0e10cSrcweir if ( sal_True ) // always perform these tests in non-pro versions 4526cdf0e10cSrcweir { 4527cdf0e10cSrcweir ByteString aErrorStr; 4528cdf0e10cSrcweir sal_Bool bError = sal_False; 4529cdf0e10cSrcweir Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap; 4530cdf0e10cSrcweir while ( pTempWin ) 4531cdf0e10cSrcweir { 4532cdf0e10cSrcweir if ( ImplIsRealParentPath( pTempWin ) ) 4533cdf0e10cSrcweir { 4534cdf0e10cSrcweir bError = sal_True; 4535cdf0e10cSrcweir lcl_appendWindowInfo( aErrorStr, *pTempWin ); 4536cdf0e10cSrcweir } 4537cdf0e10cSrcweir pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; 4538cdf0e10cSrcweir } 4539cdf0e10cSrcweir if ( bError ) 4540cdf0e10cSrcweir { 4541cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4542cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4543cdf0e10cSrcweir aTempStr += ") with living SystemWindow(s) destroyed: "; 4544cdf0e10cSrcweir aTempStr += aErrorStr; 4545cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4546cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4547cdf0e10cSrcweir } 4548cdf0e10cSrcweir 4549cdf0e10cSrcweir bError = sal_False; 4550cdf0e10cSrcweir pTempWin = pSVData->maWinData.mpFirstFrame; 4551cdf0e10cSrcweir while ( pTempWin ) 4552cdf0e10cSrcweir { 4553cdf0e10cSrcweir if ( ImplIsRealParentPath( pTempWin ) ) 4554cdf0e10cSrcweir { 4555cdf0e10cSrcweir bError = sal_True; 4556cdf0e10cSrcweir lcl_appendWindowInfo( aErrorStr, *pTempWin ); 4557cdf0e10cSrcweir } 4558cdf0e10cSrcweir pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; 4559cdf0e10cSrcweir } 4560cdf0e10cSrcweir if ( bError ) 4561cdf0e10cSrcweir { 4562cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4563cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4564cdf0e10cSrcweir aTempStr += ") with living SystemWindow(s) destroyed: "; 4565cdf0e10cSrcweir aTempStr += aErrorStr; 4566cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4567cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4568cdf0e10cSrcweir } 4569cdf0e10cSrcweir 4570cdf0e10cSrcweir if ( mpWindowImpl->mpFirstChild ) 4571cdf0e10cSrcweir { 4572cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4573cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4574cdf0e10cSrcweir aTempStr += ") with living Child(s) destroyed: "; 4575cdf0e10cSrcweir pTempWin = mpWindowImpl->mpFirstChild; 4576cdf0e10cSrcweir while ( pTempWin ) 4577cdf0e10cSrcweir { 4578cdf0e10cSrcweir lcl_appendWindowInfo( aTempStr, *pTempWin ); 4579cdf0e10cSrcweir pTempWin = pTempWin->mpWindowImpl->mpNext; 4580cdf0e10cSrcweir } 4581cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4582cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4583cdf0e10cSrcweir } 4584cdf0e10cSrcweir 4585cdf0e10cSrcweir if ( mpWindowImpl->mpFirstOverlap ) 4586cdf0e10cSrcweir { 4587cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4588cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4589cdf0e10cSrcweir aTempStr += ") with living SystemWindow(s) destroyed: "; 4590cdf0e10cSrcweir pTempWin = mpWindowImpl->mpFirstOverlap; 4591cdf0e10cSrcweir while ( pTempWin ) 4592cdf0e10cSrcweir { 4593cdf0e10cSrcweir lcl_appendWindowInfo( aTempStr, *pTempWin ); 4594cdf0e10cSrcweir pTempWin = pTempWin->mpWindowImpl->mpNext; 4595cdf0e10cSrcweir } 4596cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4597cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4598cdf0e10cSrcweir } 4599cdf0e10cSrcweir 4600cdf0e10cSrcweir Window* pMyParent = this; 4601cdf0e10cSrcweir SystemWindow* pMySysWin = NULL; 4602cdf0e10cSrcweir 4603cdf0e10cSrcweir while ( pMyParent ) 4604cdf0e10cSrcweir { 4605cdf0e10cSrcweir if ( pMyParent->IsSystemWindow() ) 4606cdf0e10cSrcweir pMySysWin = (SystemWindow*)pMyParent; 4607cdf0e10cSrcweir pMyParent = pMyParent->GetParent(); 4608cdf0e10cSrcweir } 4609cdf0e10cSrcweir if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) ) 4610cdf0e10cSrcweir { 4611cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4612cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4613cdf0e10cSrcweir aTempStr += ") still in TaskPanelList!"; 4614cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4615cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4616cdf0e10cSrcweir } 4617cdf0e10cSrcweir } 4618cdf0e10cSrcweir #endif 4619cdf0e10cSrcweir 4620cdf0e10cSrcweir if( mpWindowImpl->mbIsInTaskPaneList ) 4621cdf0e10cSrcweir { 4622cdf0e10cSrcweir Window* pMyParent = this; 4623cdf0e10cSrcweir SystemWindow* pMySysWin = NULL; 4624cdf0e10cSrcweir 4625cdf0e10cSrcweir while ( pMyParent ) 4626cdf0e10cSrcweir { 4627cdf0e10cSrcweir if ( pMyParent->IsSystemWindow() ) 4628cdf0e10cSrcweir pMySysWin = (SystemWindow*)pMyParent; 4629cdf0e10cSrcweir pMyParent = pMyParent->GetParent(); 4630cdf0e10cSrcweir } 4631cdf0e10cSrcweir if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) ) 4632cdf0e10cSrcweir { 4633cdf0e10cSrcweir pMySysWin->GetTaskPaneList()->RemoveWindow( this ); 4634cdf0e10cSrcweir } 4635cdf0e10cSrcweir else 4636cdf0e10cSrcweir { 4637cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4638cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4639cdf0e10cSrcweir aTempStr += ") not found in TaskPanelList!"; 4640cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4641cdf0e10cSrcweir } 4642cdf0e10cSrcweir } 4643cdf0e10cSrcweir 4644cdf0e10cSrcweir // Fenster hiden, um das entsprechende Paint-Handling auszuloesen 4645cdf0e10cSrcweir Hide(); 4646cdf0e10cSrcweir 4647cdf0e10cSrcweir // Mitteilen, das Fenster zerstoert wird 4648cdf0e10cSrcweir { 4649cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_DESTROY, this ); 4650cdf0e10cSrcweir Notify( aNEvt ); 4651cdf0e10cSrcweir } 4652cdf0e10cSrcweir 4653cdf0e10cSrcweir // EndExtTextInputMode 4654cdf0e10cSrcweir if ( pSVData->maWinData.mpExtTextInputWin == this ) 4655cdf0e10cSrcweir { 4656cdf0e10cSrcweir EndExtTextInput( EXTTEXTINPUT_END_COMPLETE ); 4657cdf0e10cSrcweir if ( pSVData->maWinData.mpExtTextInputWin == this ) 4658cdf0e10cSrcweir pSVData->maWinData.mpExtTextInputWin = NULL; 4659cdf0e10cSrcweir } 4660cdf0e10cSrcweir 4661cdf0e10cSrcweir // check if the focus window is our child 4662cdf0e10cSrcweir sal_Bool bHasFocussedChild = sal_False; 4663cdf0e10cSrcweir if( pSVData->maWinData.mpFocusWin && ImplIsRealParentPath( pSVData->maWinData.mpFocusWin ) ) 4664cdf0e10cSrcweir { 4665cdf0e10cSrcweir // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below 4666cdf0e10cSrcweir bHasFocussedChild = sal_True; 4667cdf0e10cSrcweir #ifdef DBG_UTIL 4668cdf0e10cSrcweir ByteString aTempStr( "Window (" ); 4669cdf0e10cSrcweir aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); 4670cdf0e10cSrcweir aTempStr += ") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !"; 4671cdf0e10cSrcweir DBG_ERROR( aTempStr.GetBuffer() ); 4672cdf0e10cSrcweir GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! 4673cdf0e10cSrcweir #endif 4674cdf0e10cSrcweir } 4675cdf0e10cSrcweir 4676cdf0e10cSrcweir // Wenn wir den Focus haben, dann den Focus auf ein anderes Fenster setzen 4677cdf0e10cSrcweir Window* pOverlapWindow = ImplGetFirstOverlapWindow(); 4678cdf0e10cSrcweir if ( pSVData->maWinData.mpFocusWin == this 4679cdf0e10cSrcweir || bHasFocussedChild ) // #122232#, see above, try some cleanup 4680cdf0e10cSrcweir { 4681cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 4682cdf0e10cSrcweir { 4683cdf0e10cSrcweir pSVData->maWinData.mpFocusWin = NULL; 4684cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL; 4685cdf0e10cSrcweir GetpApp()->FocusChanged(); 4686cdf0e10cSrcweir } 4687cdf0e10cSrcweir else 4688cdf0e10cSrcweir { 4689cdf0e10cSrcweir Window* pParent = GetParent(); 4690cdf0e10cSrcweir Window* pBorderWindow = mpWindowImpl->mpBorderWindow; 4691cdf0e10cSrcweir // Bei ueberlappenden Fenstern wird der Focus auf den 4692cdf0e10cSrcweir // Parent vom naechsten FrameWindow gesetzt 4693cdf0e10cSrcweir if ( pBorderWindow ) 4694cdf0e10cSrcweir { 4695cdf0e10cSrcweir if ( pBorderWindow->ImplIsOverlapWindow() ) 4696cdf0e10cSrcweir pParent = pBorderWindow->mpWindowImpl->mpOverlapWindow; 4697cdf0e10cSrcweir } 4698cdf0e10cSrcweir else if ( ImplIsOverlapWindow() ) 4699cdf0e10cSrcweir pParent = mpWindowImpl->mpOverlapWindow; 4700cdf0e10cSrcweir 4701cdf0e10cSrcweir if ( pParent && pParent->IsEnabled() && pParent->IsInputEnabled() && ! pParent->IsInModalMode() ) 4702cdf0e10cSrcweir pParent->GrabFocus(); 4703cdf0e10cSrcweir else 4704cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->GrabFocus(); 4705cdf0e10cSrcweir 4706cdf0e10cSrcweir // If the focus was set back to 'this' set it to nothing 4707cdf0e10cSrcweir if ( pSVData->maWinData.mpFocusWin == this ) 4708cdf0e10cSrcweir { 4709cdf0e10cSrcweir pSVData->maWinData.mpFocusWin = NULL; 4710cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL; 4711cdf0e10cSrcweir GetpApp()->FocusChanged(); 4712cdf0e10cSrcweir } 4713cdf0e10cSrcweir } 4714cdf0e10cSrcweir } 4715cdf0e10cSrcweir 4716cdf0e10cSrcweir 4717cdf0e10cSrcweir if ( pOverlapWindow->mpWindowImpl->mpLastFocusWindow == this ) 4718cdf0e10cSrcweir pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL; 4719cdf0e10cSrcweir 4720cdf0e10cSrcweir // reset hint for DefModalDialogParent 4721cdf0e10cSrcweir if( pSVData->maWinData.mpActiveApplicationFrame == this ) 4722cdf0e10cSrcweir pSVData->maWinData.mpActiveApplicationFrame = NULL; 4723cdf0e10cSrcweir 4724cdf0e10cSrcweir // gemerkte Fenster zuruecksetzen 4725cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFocusWin == this ) 4726cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = NULL; 4727cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpMouseMoveWin == this ) 4728cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL; 4729cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpMouseDownWin == this ) 4730cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseDownWin = NULL; 4731cdf0e10cSrcweir 4732cdf0e10cSrcweir // Deactivate-Window zuruecksetzen 4733cdf0e10cSrcweir if ( pSVData->maWinData.mpLastDeacWin == this ) 4734cdf0e10cSrcweir pSVData->maWinData.mpLastDeacWin = NULL; 4735cdf0e10cSrcweir 4736cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 4737cdf0e10cSrcweir { 4738cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mnFocusId ) 4739cdf0e10cSrcweir Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId ); 4740cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mnMouseMoveId ) 4741cdf0e10cSrcweir Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId ); 4742cdf0e10cSrcweir } 4743cdf0e10cSrcweir 4744cf06609aSHerbert Dürr // release SalGraphics 4745cdf0e10cSrcweir ImplReleaseGraphics(); 4746cdf0e10cSrcweir 4747cf06609aSHerbert Dürr // notify ImplDelData subscribers of this window about the window deletion 4748cdf0e10cSrcweir ImplDelData* pDelData = mpWindowImpl->mpFirstDel; 4749cdf0e10cSrcweir while ( pDelData ) 4750cdf0e10cSrcweir { 4751cdf0e10cSrcweir pDelData->mbDel = sal_True; 4752cdf0e10cSrcweir pDelData->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore 4753cdf0e10cSrcweir pDelData = pDelData->mpNext; 4754cdf0e10cSrcweir } 4755cdf0e10cSrcweir 4756cf06609aSHerbert Dürr // remove window from the lists 4757cdf0e10cSrcweir ImplRemoveWindow( sal_True ); 4758cdf0e10cSrcweir 4759cdf0e10cSrcweir // de-register as "top window child" at our parent, if necessary 4760cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 4761cdf0e10cSrcweir { 4762cdf0e10cSrcweir sal_Bool bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 ); 4763cdf0e10cSrcweir if ( mpWindowImpl->mpRealParent && bIsTopWindow ) 4764cdf0e10cSrcweir { 4765cdf0e10cSrcweir ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData(); 4766cdf0e10cSrcweir 4767cdf0e10cSrcweir ::std::list< Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(), 4768cdf0e10cSrcweir pParentWinData->maTopWindowChildren.end(), this ); 4769cdf0e10cSrcweir DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" ); 4770cdf0e10cSrcweir if ( myPos != pParentWinData->maTopWindowChildren.end() ) 4771cdf0e10cSrcweir pParentWinData->maTopWindowChildren.erase( myPos ); 4772cdf0e10cSrcweir } 4773cdf0e10cSrcweir } 4774cdf0e10cSrcweir 4775cf06609aSHerbert Dürr // cleanup Extra Window Data, TODO: add and use ImplWinData destructor 4776cdf0e10cSrcweir if ( mpWindowImpl->mpWinData ) 4777cdf0e10cSrcweir { 4778cdf0e10cSrcweir if ( mpWindowImpl->mpWinData->mpExtOldText ) 4779cdf0e10cSrcweir delete mpWindowImpl->mpWinData->mpExtOldText; 4780cdf0e10cSrcweir if ( mpWindowImpl->mpWinData->mpExtOldAttrAry ) 4781cdf0e10cSrcweir delete mpWindowImpl->mpWinData->mpExtOldAttrAry; 4782cdf0e10cSrcweir if ( mpWindowImpl->mpWinData->mpCursorRect ) 4783cdf0e10cSrcweir delete mpWindowImpl->mpWinData->mpCursorRect; 4784cdf0e10cSrcweir if ( mpWindowImpl->mpWinData->mpFocusRect ) 4785cdf0e10cSrcweir delete mpWindowImpl->mpWinData->mpFocusRect; 4786cdf0e10cSrcweir if ( mpWindowImpl->mpWinData->mpTrackRect ) 4787cdf0e10cSrcweir delete mpWindowImpl->mpWinData->mpTrackRect; 4788cdf0e10cSrcweir 4789cdf0e10cSrcweir delete mpWindowImpl->mpWinData; 4790cdf0e10cSrcweir } 4791cdf0e10cSrcweir 4792cf06609aSHerbert Dürr // cleanup overlap related window data 4793cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapData ) 4794cdf0e10cSrcweir delete mpWindowImpl->mpOverlapData; 4795cdf0e10cSrcweir 4796cf06609aSHerbert Dürr // remove BorderWindow or Frame window data 4797cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 4798cdf0e10cSrcweir delete mpWindowImpl->mpBorderWindow; 4799cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame ) 4800cdf0e10cSrcweir { 4801cdf0e10cSrcweir if ( pSVData->maWinData.mpFirstFrame == this ) 4802cdf0e10cSrcweir pSVData->maWinData.mpFirstFrame = mpWindowImpl->mpFrameData->mpNextFrame; 4803cdf0e10cSrcweir else 4804cdf0e10cSrcweir { 4805cdf0e10cSrcweir Window* pSysWin = pSVData->maWinData.mpFirstFrame; 4806cdf0e10cSrcweir while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this ) 4807cdf0e10cSrcweir pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame; 4808cdf0e10cSrcweir pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame; 4809cdf0e10cSrcweir } 4810cdf0e10cSrcweir mpWindowImpl->mpFrame->SetCallback( NULL, NULL ); 4811cdf0e10cSrcweir pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame ); 4812cdf0e10cSrcweir delete mpWindowImpl->mpFrameData; 4813cdf0e10cSrcweir } 4814cdf0e10cSrcweir 4815cdf0e10cSrcweir // should be the last statements 4816cdf0e10cSrcweir delete mpWindowImpl; mpWindowImpl = NULL; 4817cdf0e10cSrcweir } 4818cdf0e10cSrcweir 4819cdf0e10cSrcweir // ----------------------------------------------------------------------- 4820cdf0e10cSrcweir void Window::doLazyDelete() 4821cdf0e10cSrcweir { 4822cdf0e10cSrcweir SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(this); 4823cdf0e10cSrcweir DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this); 4824cdf0e10cSrcweir if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) ) 4825cdf0e10cSrcweir { 4826cdf0e10cSrcweir Show( sal_False ); 4827cdf0e10cSrcweir SetParent( ImplGetDefaultWindow() ); 4828cdf0e10cSrcweir } 4829cdf0e10cSrcweir vcl::LazyDeletor<Window>::Delete( this ); 4830cdf0e10cSrcweir } 4831cdf0e10cSrcweir 4832cdf0e10cSrcweir // ----------------------------------------------------------------------- 4833cdf0e10cSrcweir void Window::InterceptChildWindowKeyDown( sal_Bool bIntercept ) 4834cdf0e10cSrcweir { 4835cdf0e10cSrcweir if( mpWindowImpl->mpSysObj ) 4836cdf0e10cSrcweir mpWindowImpl->mpSysObj->InterceptChildWindowKeyDown( bIntercept ); 4837cdf0e10cSrcweir } 4838cdf0e10cSrcweir 4839cdf0e10cSrcweir // ----------------------------------------------------------------------- 4840cdf0e10cSrcweir 4841cdf0e10cSrcweir void Window::MouseMove( const MouseEvent& rMEvt ) 4842cdf0e10cSrcweir { 4843cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4844cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4845cdf0e10cSrcweir } 4846cdf0e10cSrcweir 4847cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_MOUSEMOVE, this, &rMEvt ); 4848cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 4849cdf0e10cSrcweir mpWindowImpl->mbMouseMove = sal_True; 4850cdf0e10cSrcweir } 4851cdf0e10cSrcweir 4852cdf0e10cSrcweir // ----------------------------------------------------------------------- 4853cdf0e10cSrcweir 4854cdf0e10cSrcweir void Window::MouseButtonDown( const MouseEvent& rMEvt ) 4855cdf0e10cSrcweir { 4856cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4857cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4858cdf0e10cSrcweir } 4859cdf0e10cSrcweir 4860cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_MOUSEBUTTONDOWN, this, &rMEvt ); 4861cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 4862cdf0e10cSrcweir mpWindowImpl->mbMouseButtonDown = sal_True; 4863cdf0e10cSrcweir } 4864cdf0e10cSrcweir 4865cdf0e10cSrcweir // ----------------------------------------------------------------------- 4866cdf0e10cSrcweir 4867cdf0e10cSrcweir void Window::MouseButtonUp( const MouseEvent& rMEvt ) 4868cdf0e10cSrcweir { 4869cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4870cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4871cdf0e10cSrcweir } 4872cdf0e10cSrcweir 4873cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_MOUSEBUTTONUP, this, &rMEvt ); 4874cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 4875cdf0e10cSrcweir mpWindowImpl->mbMouseButtonUp = sal_True; 4876cdf0e10cSrcweir } 4877cdf0e10cSrcweir 4878cdf0e10cSrcweir // ----------------------------------------------------------------------- 4879cdf0e10cSrcweir 4880cdf0e10cSrcweir void Window::KeyInput( const KeyEvent& rKEvt ) 4881cdf0e10cSrcweir { 4882cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4883cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4884cdf0e10cSrcweir } 4885cdf0e10cSrcweir 4886cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_KEYINPUT, this, &rKEvt ); 4887cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 4888cdf0e10cSrcweir mpWindowImpl->mbKeyInput = sal_True; 4889cdf0e10cSrcweir } 4890cdf0e10cSrcweir 4891cdf0e10cSrcweir // ----------------------------------------------------------------------- 4892cdf0e10cSrcweir 4893cdf0e10cSrcweir void Window::KeyUp( const KeyEvent& rKEvt ) 4894cdf0e10cSrcweir { 4895cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4896cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4897cdf0e10cSrcweir } 4898cdf0e10cSrcweir 4899cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_KEYUP, this, &rKEvt ); 4900cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 4901cdf0e10cSrcweir mpWindowImpl->mbKeyUp = sal_True; 4902cdf0e10cSrcweir } 4903cdf0e10cSrcweir 4904cdf0e10cSrcweir // ----------------------------------------------------------------------- 4905cdf0e10cSrcweir 4906cdf0e10cSrcweir void Window::PrePaint() 4907cdf0e10cSrcweir { 4908cdf0e10cSrcweir } 4909cdf0e10cSrcweir 4910cdf0e10cSrcweir // ----------------------------------------------------------------------- 4911cdf0e10cSrcweir 4912cdf0e10cSrcweir void Window::Paint( const Rectangle& rRect ) 4913cdf0e10cSrcweir { 4914cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4915cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4916cdf0e10cSrcweir } 4917cdf0e10cSrcweir 4918cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_PAINT, (void*)&rRect ); 4919cdf0e10cSrcweir } 4920cdf0e10cSrcweir 4921cdf0e10cSrcweir // ----------------------------------------------------------------------- 4922cdf0e10cSrcweir 4923cdf0e10cSrcweir void Window::PostPaint() 4924cdf0e10cSrcweir { 4925cdf0e10cSrcweir } 4926cdf0e10cSrcweir 4927cdf0e10cSrcweir // ----------------------------------------------------------------------- 4928cdf0e10cSrcweir 4929cdf0e10cSrcweir void Window::Draw( OutputDevice*, const Point&, const Size&, sal_uLong ) 4930cdf0e10cSrcweir { 4931cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4932cdf0e10cSrcweir } 4933cdf0e10cSrcweir 4934cdf0e10cSrcweir // ----------------------------------------------------------------------- 4935cdf0e10cSrcweir 4936cdf0e10cSrcweir void Window::Move() 4937cdf0e10cSrcweir { 4938cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4939cdf0e10cSrcweir } 4940cdf0e10cSrcweir 4941cdf0e10cSrcweir // ----------------------------------------------------------------------- 4942cdf0e10cSrcweir 4943cdf0e10cSrcweir void Window::Resize() 4944cdf0e10cSrcweir { 4945cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4946cdf0e10cSrcweir } 4947cdf0e10cSrcweir 4948cdf0e10cSrcweir // ----------------------------------------------------------------------- 4949cdf0e10cSrcweir 4950cdf0e10cSrcweir void Window::Activate() 4951cdf0e10cSrcweir { 4952cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4953cdf0e10cSrcweir } 4954cdf0e10cSrcweir 4955cdf0e10cSrcweir // ----------------------------------------------------------------------- 4956cdf0e10cSrcweir 4957cdf0e10cSrcweir void Window::Deactivate() 4958cdf0e10cSrcweir { 4959cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4960cdf0e10cSrcweir } 4961cdf0e10cSrcweir 4962cdf0e10cSrcweir // ----------------------------------------------------------------------- 4963cdf0e10cSrcweir 4964cdf0e10cSrcweir void Window::GetFocus() 4965cdf0e10cSrcweir { 4966cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4967cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4968cdf0e10cSrcweir } 4969cdf0e10cSrcweir 4970cdf0e10cSrcweir if ( HasFocus() && mpWindowImpl->mpLastFocusWindow && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) ) 4971cdf0e10cSrcweir { 4972cdf0e10cSrcweir ImplDelData aDogtag( this ); 4973cdf0e10cSrcweir mpWindowImpl->mpLastFocusWindow->GrabFocus(); 4974cdf0e10cSrcweir if( aDogtag.IsDelete() ) 4975cdf0e10cSrcweir return; 4976cdf0e10cSrcweir } 4977cdf0e10cSrcweir 4978cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_GETFOCUS, this ); 4979cdf0e10cSrcweir Notify( aNEvt ); 4980cdf0e10cSrcweir } 4981cdf0e10cSrcweir 4982cdf0e10cSrcweir // ----------------------------------------------------------------------- 4983cdf0e10cSrcweir 4984cdf0e10cSrcweir void Window::LoseFocus() 4985cdf0e10cSrcweir { 4986cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4987cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 4988cdf0e10cSrcweir } 4989cdf0e10cSrcweir 4990cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_LOSEFOCUS, this ); 4991cdf0e10cSrcweir Notify( aNEvt ); 4992cdf0e10cSrcweir } 4993cdf0e10cSrcweir 4994cdf0e10cSrcweir // ----------------------------------------------------------------------- 4995cdf0e10cSrcweir 4996cdf0e10cSrcweir void Window::RequestHelp( const HelpEvent& rHEvt ) 4997cdf0e10cSrcweir { 4998cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 4999cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5000cdf0e10cSrcweir } 5001cdf0e10cSrcweir 5002cdf0e10cSrcweir // Wenn Balloon-Help angefordert wird, dann den Balloon mit dem 5003cdf0e10cSrcweir // gesetzten Hilfetext anzeigen 5004cdf0e10cSrcweir if ( rHEvt.GetMode() & HELPMODE_BALLOON ) 5005cdf0e10cSrcweir { 5006cdf0e10cSrcweir const XubString* pStr = &(GetHelpText()); 5007cdf0e10cSrcweir if ( !pStr->Len() ) 5008cdf0e10cSrcweir pStr = &(GetQuickHelpText()); 5009cdf0e10cSrcweir if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() ) 5010cdf0e10cSrcweir ImplGetParent()->RequestHelp( rHEvt ); 5011cdf0e10cSrcweir else 5012cdf0e10cSrcweir Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), *pStr ); 5013cdf0e10cSrcweir } 5014cdf0e10cSrcweir else if ( rHEvt.GetMode() & HELPMODE_QUICK ) 5015cdf0e10cSrcweir { 5016cdf0e10cSrcweir const XubString* pStr = &(GetQuickHelpText()); 5017cdf0e10cSrcweir if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() ) 5018cdf0e10cSrcweir ImplGetParent()->RequestHelp( rHEvt ); 5019cdf0e10cSrcweir else 5020cdf0e10cSrcweir { 5021cdf0e10cSrcweir Point aPos = GetPosPixel(); 5022cdf0e10cSrcweir if ( ImplGetParent() && !ImplIsOverlapWindow() ) 5023cdf0e10cSrcweir aPos = ImplGetParent()->OutputToScreenPixel( aPos ); 5024cdf0e10cSrcweir Rectangle aRect( aPos, GetSizePixel() ); 5025cdf0e10cSrcweir String aHelpText; 5026cdf0e10cSrcweir if ( pStr->Len() ) 5027cdf0e10cSrcweir aHelpText = GetHelpText(); 5028cdf0e10cSrcweir Help::ShowQuickHelp( this, aRect, *pStr, aHelpText, QUICKHELP_CTRLTEXT ); 5029cdf0e10cSrcweir } 5030cdf0e10cSrcweir } 5031cdf0e10cSrcweir else 5032cdf0e10cSrcweir { 5033cdf0e10cSrcweir String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); 5034cdf0e10cSrcweir if ( aStrHelpId.Len() == 0 && ImplGetParent() ) 5035cdf0e10cSrcweir ImplGetParent()->RequestHelp( rHEvt ); 5036cdf0e10cSrcweir else 5037cdf0e10cSrcweir { 5038cdf0e10cSrcweir Help* pHelp = Application::GetHelp(); 5039cdf0e10cSrcweir if ( pHelp ) 5040cdf0e10cSrcweir { 5041cdf0e10cSrcweir if( aStrHelpId.Len() > 0 ) 5042cdf0e10cSrcweir pHelp->Start( aStrHelpId, this ); 5043cdf0e10cSrcweir else 5044cdf0e10cSrcweir pHelp->Start( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OOO_HELP_INDEX ) ), this ); 5045cdf0e10cSrcweir } 5046cdf0e10cSrcweir } 5047cdf0e10cSrcweir } 5048cdf0e10cSrcweir } 5049cdf0e10cSrcweir 5050cdf0e10cSrcweir // ----------------------------------------------------------------------- 5051cdf0e10cSrcweir 5052cdf0e10cSrcweir void Window::Command( const CommandEvent& rCEvt ) 5053cdf0e10cSrcweir { 5054cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 5055cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5056cdf0e10cSrcweir } 5057cdf0e10cSrcweir 5058cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_COMMAND, (void*)&rCEvt ); 5059cdf0e10cSrcweir 5060cdf0e10cSrcweir NotifyEvent aNEvt( EVENT_COMMAND, this, &rCEvt ); 5061cdf0e10cSrcweir if ( !Notify( aNEvt ) ) 5062cdf0e10cSrcweir mpWindowImpl->mbCommand = sal_True; 5063cdf0e10cSrcweir } 5064cdf0e10cSrcweir 5065cdf0e10cSrcweir // ----------------------------------------------------------------------- 5066cdf0e10cSrcweir 5067cdf0e10cSrcweir void Window::Tracking( const TrackingEvent& rTEvt ) 5068cdf0e10cSrcweir { 5069cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5070cdf0e10cSrcweir 5071cdf0e10cSrcweir ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); 5072cdf0e10cSrcweir if( pWrapper ) 5073cdf0e10cSrcweir pWrapper->Tracking( rTEvt ); 5074cdf0e10cSrcweir } 5075cdf0e10cSrcweir 5076cdf0e10cSrcweir // ----------------------------------------------------------------------- 5077cdf0e10cSrcweir 5078cdf0e10cSrcweir void Window::UserEvent( sal_uLong, void* ) 5079cdf0e10cSrcweir { 5080cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5081cdf0e10cSrcweir } 5082cdf0e10cSrcweir 5083cdf0e10cSrcweir // ----------------------------------------------------------------------- 5084cdf0e10cSrcweir 5085cdf0e10cSrcweir void Window::StateChanged( StateChangedType ) 5086cdf0e10cSrcweir { 5087cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5088cdf0e10cSrcweir } 5089cdf0e10cSrcweir 5090cdf0e10cSrcweir // ----------------------------------------------------------------------- 5091cdf0e10cSrcweir 5092cdf0e10cSrcweir void Window::DataChanged( const DataChangedEvent& ) 5093cdf0e10cSrcweir { 5094cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5095cdf0e10cSrcweir } 5096cdf0e10cSrcweir 5097cdf0e10cSrcweir // ----------------------------------------------------------------------- 5098cdf0e10cSrcweir 5099cdf0e10cSrcweir void Window::ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt ) 5100cdf0e10cSrcweir { 5101cdf0e10cSrcweir if( rNEvt.GetType() == EVENT_COMMAND ) 5102cdf0e10cSrcweir { 5103cdf0e10cSrcweir const CommandEvent* pCEvt = rNEvt.GetCommandEvent(); 5104cdf0e10cSrcweir if ( pCEvt->GetCommand() != COMMAND_CONTEXTMENU ) 5105cdf0e10cSrcweir // non context menu events are not to be notified up the chain 5106cdf0e10cSrcweir // so we return immediately 5107cdf0e10cSrcweir return; 5108cdf0e10cSrcweir 5109cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5110cdf0e10cSrcweir { 5111cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5112cdf0e10cSrcweir // not interested in: The event listeners are already called in ::Command, 5113cdf0e10cSrcweir // and calling them here a second time doesn't make sense 5114cdf0e10cSrcweir ; 5115cdf0e10cSrcweir else 5116cdf0e10cSrcweir { 5117cdf0e10cSrcweir CommandEvent aCommandEvent = ImplTranslateCommandEvent( *pCEvt, rNEvt.GetWindow(), this ); 5118cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_COMMAND, &aCommandEvent ); 5119cdf0e10cSrcweir } 5120cdf0e10cSrcweir } 5121cdf0e10cSrcweir } 5122cdf0e10cSrcweir 512386e1cf34SPedro Giffuni // #82968# notify event listeners for mouse and key events separately and 5124cdf0e10cSrcweir // not in PreNotify ( as for focus listeners ) 5125cdf0e10cSrcweir // this allows for procesing those events internally first and pass it to 5126cdf0e10cSrcweir // the toolkit later 5127cdf0e10cSrcweir 5128cdf0e10cSrcweir ImplDelData aDelData; 5129cdf0e10cSrcweir ImplAddDel( &aDelData ); 5130cdf0e10cSrcweir 5131cdf0e10cSrcweir if( rNEvt.GetType() == EVENT_MOUSEMOVE ) 5132cdf0e10cSrcweir { 5133cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5134cdf0e10cSrcweir { 5135cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5136cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() ); 5137cdf0e10cSrcweir else 5138cdf0e10cSrcweir { 5139cdf0e10cSrcweir MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ); 5140cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &aMouseEvent ); 5141cdf0e10cSrcweir } 5142cdf0e10cSrcweir } 5143cdf0e10cSrcweir } 5144cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP ) 5145cdf0e10cSrcweir { 5146cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5147cdf0e10cSrcweir { 5148cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5149cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() ); 5150cdf0e10cSrcweir else 5151cdf0e10cSrcweir { 5152cdf0e10cSrcweir MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ); 5153cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &aMouseEvent ); 5154cdf0e10cSrcweir } 5155cdf0e10cSrcweir } 5156cdf0e10cSrcweir } 5157cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) 5158cdf0e10cSrcweir { 5159cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5160cdf0e10cSrcweir { 5161cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5162cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() ); 5163cdf0e10cSrcweir else 5164cdf0e10cSrcweir { 5165cdf0e10cSrcweir MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ); 5166cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &aMouseEvent ); 5167cdf0e10cSrcweir } 5168cdf0e10cSrcweir } 5169cdf0e10cSrcweir } 5170cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_KEYINPUT ) 5171cdf0e10cSrcweir { 5172cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5173cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() ); 5174cdf0e10cSrcweir } 5175cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_KEYUP ) 5176cdf0e10cSrcweir { 5177cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5178cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() ); 5179cdf0e10cSrcweir } 5180cdf0e10cSrcweir 5181cdf0e10cSrcweir if ( aDelData.IsDelete() ) 5182cdf0e10cSrcweir return; 5183cdf0e10cSrcweir ImplRemoveDel( &aDelData ); 5184cdf0e10cSrcweir 5185cdf0e10cSrcweir // #106721# check if we're part of a compound control and notify 5186cdf0e10cSrcweir Window *pParent = ImplGetParent(); 5187cdf0e10cSrcweir while( pParent ) 5188cdf0e10cSrcweir { 5189cdf0e10cSrcweir if( pParent->IsCompoundControl() ) 5190cdf0e10cSrcweir { 5191cdf0e10cSrcweir pParent->ImplNotifyKeyMouseCommandEventListeners( rNEvt ); 5192cdf0e10cSrcweir break; 5193cdf0e10cSrcweir } 5194cdf0e10cSrcweir pParent = pParent->ImplGetParent(); 5195cdf0e10cSrcweir } 5196cdf0e10cSrcweir } 5197cdf0e10cSrcweir 5198cdf0e10cSrcweir // ----------------------------------------------------------------------- 5199cdf0e10cSrcweir 5200cdf0e10cSrcweir long Window::PreNotify( NotifyEvent& rNEvt ) 5201cdf0e10cSrcweir { 5202cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 5203cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5204cdf0e10cSrcweir } 5205cdf0e10cSrcweir 5206cdf0e10cSrcweir long bDone = sal_False; 5207cdf0e10cSrcweir if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() ) 5208cdf0e10cSrcweir bDone = mpWindowImpl->mpParent->PreNotify( rNEvt ); 5209cdf0e10cSrcweir 5210cdf0e10cSrcweir if ( !bDone ) 5211cdf0e10cSrcweir { 5212cdf0e10cSrcweir if( rNEvt.GetType() == EVENT_GETFOCUS ) 5213cdf0e10cSrcweir { 5214cdf0e10cSrcweir sal_Bool bCompoundFocusChanged = sal_False; 5215cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl && !mpWindowImpl->mbCompoundControlHasFocus && HasChildPathFocus() ) 5216cdf0e10cSrcweir { 5217cdf0e10cSrcweir mpWindowImpl->mbCompoundControlHasFocus = sal_True; 5218cdf0e10cSrcweir bCompoundFocusChanged = sal_True; 5219cdf0e10cSrcweir } 5220cdf0e10cSrcweir 5221cdf0e10cSrcweir if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) 5222cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS ); 5223cdf0e10cSrcweir } 5224cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) 5225cdf0e10cSrcweir { 5226cdf0e10cSrcweir sal_Bool bCompoundFocusChanged = sal_False; 5227cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl && mpWindowImpl->mbCompoundControlHasFocus && !HasChildPathFocus() ) 5228cdf0e10cSrcweir { 5229cdf0e10cSrcweir mpWindowImpl->mbCompoundControlHasFocus = sal_False ; 5230cdf0e10cSrcweir bCompoundFocusChanged = sal_True; 5231cdf0e10cSrcweir } 5232cdf0e10cSrcweir 5233cdf0e10cSrcweir if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) 5234cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS ); 5235cdf0e10cSrcweir } 5236cdf0e10cSrcweir 5237cdf0e10cSrcweir // #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )! 5238cdf0e10cSrcweir // see also ImplHandleMouseEvent(), ImplHandleKey() 5239cdf0e10cSrcweir 5240cdf0e10cSrcweir /* 5241cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_MOUSEMOVE ) 5242cdf0e10cSrcweir { 5243cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5244cdf0e10cSrcweir { 5245cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5246cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() ); 5247cdf0e10cSrcweir else 5248cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); 5249cdf0e10cSrcweir } 5250cdf0e10cSrcweir } 5251cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP ) 5252cdf0e10cSrcweir { 5253cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5254cdf0e10cSrcweir { 5255cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5256cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() ); 5257cdf0e10cSrcweir else 5258cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); 5259cdf0e10cSrcweir } 5260cdf0e10cSrcweir } 5261cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) 5262cdf0e10cSrcweir { 5263cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5264cdf0e10cSrcweir { 5265cdf0e10cSrcweir if ( rNEvt.GetWindow() == this ) 5266cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() ); 5267cdf0e10cSrcweir else 5268cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) ); 5269cdf0e10cSrcweir } 5270cdf0e10cSrcweir } 5271cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_KEYINPUT ) 5272cdf0e10cSrcweir { 5273cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5274cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() ); 5275cdf0e10cSrcweir } 5276cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_KEYUP ) 5277cdf0e10cSrcweir { 5278cdf0e10cSrcweir if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) ) 5279cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() ); 5280cdf0e10cSrcweir } 5281cdf0e10cSrcweir */ 5282cdf0e10cSrcweir } 5283cdf0e10cSrcweir 5284cdf0e10cSrcweir return bDone; 5285cdf0e10cSrcweir } 5286cdf0e10cSrcweir 5287cdf0e10cSrcweir // ----------------------------------------------------------------------- 5288cdf0e10cSrcweir 5289cdf0e10cSrcweir long Window::Notify( NotifyEvent& rNEvt ) 5290cdf0e10cSrcweir { 5291cdf0e10cSrcweir { // Klammerung, da in diesem Handler das Window zerstoert werden darf 5292cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5293cdf0e10cSrcweir } 5294cdf0e10cSrcweir 5295cdf0e10cSrcweir long nRet = sal_False; 5296cdf0e10cSrcweir 5297cdf0e10cSrcweir // check for docking window 5298cdf0e10cSrcweir // but do nothing if window is docked and locked 5299cdf0e10cSrcweir ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); 5300cdf0e10cSrcweir if( pWrapper && !( !pWrapper->IsFloatingMode() && pWrapper->IsLocked() ) ) 5301cdf0e10cSrcweir { 5302cdf0e10cSrcweir if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) 5303cdf0e10cSrcweir { 5304cdf0e10cSrcweir const MouseEvent* pMEvt = rNEvt.GetMouseEvent(); 5305cdf0e10cSrcweir sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); 5306cdf0e10cSrcweir if ( pMEvt->IsLeft() ) 5307cdf0e10cSrcweir { 5308cdf0e10cSrcweir if ( pMEvt->IsMod1() && (pMEvt->GetClicks() == 2) ) 5309cdf0e10cSrcweir { 5310cdf0e10cSrcweir // ctrl double click toggles floating mode 5311cdf0e10cSrcweir pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() ); 5312cdf0e10cSrcweir return sal_True; 5313cdf0e10cSrcweir } 5314cdf0e10cSrcweir else if ( pMEvt->GetClicks() == 1 && bHit) 5315cdf0e10cSrcweir { 5316cdf0e10cSrcweir // allow start docking during mouse move 5317cdf0e10cSrcweir pWrapper->ImplEnableStartDocking(); 5318cdf0e10cSrcweir return sal_True; 5319cdf0e10cSrcweir } 5320cdf0e10cSrcweir } 5321cdf0e10cSrcweir } 5322cdf0e10cSrcweir else if ( rNEvt.GetType() == EVENT_MOUSEMOVE ) 5323cdf0e10cSrcweir { 5324cdf0e10cSrcweir const MouseEvent* pMEvt = rNEvt.GetMouseEvent(); 5325cdf0e10cSrcweir sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() ); 5326cdf0e10cSrcweir if ( pMEvt->IsLeft() ) 5327cdf0e10cSrcweir { 5328cdf0e10cSrcweir // check if a single click initiated this sequence ( ImplStartDockingEnabled() ) 5329cdf0e10cSrcweir // check if window is docked and 5330cdf0e10cSrcweir if( pWrapper->ImplStartDockingEnabled() && !pWrapper->IsFloatingMode() && 5331cdf0e10cSrcweir !pWrapper->IsDocking() && bHit ) 5332cdf0e10cSrcweir { 5333cdf0e10cSrcweir Point aPos = pMEvt->GetPosPixel(); 5334cdf0e10cSrcweir Window* pWindow = rNEvt.GetWindow(); 5335cdf0e10cSrcweir if ( pWindow != this ) 5336cdf0e10cSrcweir { 5337cdf0e10cSrcweir aPos = pWindow->OutputToScreenPixel( aPos ); 5338cdf0e10cSrcweir aPos = ScreenToOutputPixel( aPos ); 5339cdf0e10cSrcweir } 5340cdf0e10cSrcweir pWrapper->ImplStartDocking( aPos ); 5341cdf0e10cSrcweir } 5342cdf0e10cSrcweir return sal_True; 5343cdf0e10cSrcweir } 5344cdf0e10cSrcweir } 5345cdf0e10cSrcweir else if( rNEvt.GetType() == EVENT_KEYINPUT ) 5346cdf0e10cSrcweir { 5347cdf0e10cSrcweir const KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode(); 5348cdf0e10cSrcweir if( rKey.GetCode() == KEY_F10 && rKey.GetModifier() && 5349cdf0e10cSrcweir rKey.IsShift() && rKey.IsMod1() ) 5350cdf0e10cSrcweir { 5351cdf0e10cSrcweir pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() ); 5352cdf0e10cSrcweir /* At this point the floating toolbar frame does not have the 5353cdf0e10cSrcweir * input focus since these frames don't get the focus per default 5354cdf0e10cSrcweir * To enable keyboard handling of this toolbar set the input focus 5355cdf0e10cSrcweir * to the frame. This needs to be done with ToTop since GrabFocus 5356cdf0e10cSrcweir * would not notice any change since "this" already has the focus. 5357cdf0e10cSrcweir */ 5358cdf0e10cSrcweir if( pWrapper->IsFloatingMode() ) 5359cdf0e10cSrcweir ToTop( TOTOP_GRABFOCUSONLY ); 5360cdf0e10cSrcweir return sal_True; 5361cdf0e10cSrcweir } 5362cdf0e10cSrcweir } 5363cdf0e10cSrcweir } 5364cdf0e10cSrcweir 5365cdf0e10cSrcweir // Dialog-Steuerung 5366cdf0e10cSrcweir if ( (GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL ) 5367cdf0e10cSrcweir { 5368cdf0e10cSrcweir // Wenn Parent auch DialogSteuerung aktiviert hat, uebernimmt dieser die Steuerung 5369cdf0e10cSrcweir if ( (rNEvt.GetType() == EVENT_KEYINPUT) || (rNEvt.GetType() == EVENT_KEYUP) ) 5370cdf0e10cSrcweir { 5371cdf0e10cSrcweir if ( ImplIsOverlapWindow() || 5372cdf0e10cSrcweir ((ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) ) 5373cdf0e10cSrcweir { 5374cdf0e10cSrcweir nRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == EVENT_KEYINPUT ); 5375cdf0e10cSrcweir } 5376cdf0e10cSrcweir } 5377cdf0e10cSrcweir else if ( (rNEvt.GetType() == EVENT_GETFOCUS) || (rNEvt.GetType() == EVENT_LOSEFOCUS) ) 5378cdf0e10cSrcweir { 5379cdf0e10cSrcweir ImplDlgCtrlFocusChanged( rNEvt.GetWindow(), rNEvt.GetType() == EVENT_GETFOCUS ); 5380cdf0e10cSrcweir if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == EVENT_GETFOCUS) && 5381cdf0e10cSrcweir !(GetStyle() & WB_TABSTOP) && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) ) 5382cdf0e10cSrcweir { 5383cdf0e10cSrcweir sal_uInt16 n = 0; 5384cdf0e10cSrcweir Window* pFirstChild = ImplGetDlgWindow( n, DLGWINDOW_FIRST ); 5385cdf0e10cSrcweir if ( pFirstChild ) 5386cdf0e10cSrcweir pFirstChild->ImplControlFocus(); 5387cdf0e10cSrcweir } 5388cdf0e10cSrcweir } 5389cdf0e10cSrcweir } 5390cdf0e10cSrcweir 5391cdf0e10cSrcweir if ( !nRet ) 5392cdf0e10cSrcweir { 5393cdf0e10cSrcweir if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() ) 5394cdf0e10cSrcweir nRet = mpWindowImpl->mpParent->Notify( rNEvt ); 5395cdf0e10cSrcweir } 5396cdf0e10cSrcweir 5397cdf0e10cSrcweir return nRet; 5398cdf0e10cSrcweir } 5399cdf0e10cSrcweir 54009959513dSSteve Yin void Window::NotifyVCLEvent( sal_uLong nEvent ,void* pData /*= NULL*/) 5401ad3a95a3SSteve Yin { 5402ad3a95a3SSteve Yin ImplCallEventListeners( nEvent ,pData); 5403ad3a95a3SSteve Yin } 5404ad3a95a3SSteve Yin ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > Window::GetAccFlowToSequence() 5405ad3a95a3SSteve Yin { 5406ad3a95a3SSteve Yin return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >(); 5407ad3a95a3SSteve Yin } 5408cdf0e10cSrcweir // ----------------------------------------------------------------------- 5409cdf0e10cSrcweir 5410cdf0e10cSrcweir void Window::ImplCallEventListeners( sal_uLong nEvent, void* pData ) 5411cdf0e10cSrcweir { 5412cdf0e10cSrcweir // The implementation was moved to CallEventListeners(), 5413cdf0e10cSrcweir // because derived classes in svtools must be able to 5414cdf0e10cSrcweir // call the event listeners and ImplCallEventListeners() 5415cdf0e10cSrcweir // is not exported. 5416cdf0e10cSrcweir // TODO: replace ImplCallEventListeners() by CallEventListeners() in vcl 5417cdf0e10cSrcweir 5418cdf0e10cSrcweir CallEventListeners( nEvent, pData ); 5419cdf0e10cSrcweir } 5420cdf0e10cSrcweir 5421cdf0e10cSrcweir // ----------------------------------------------------------------------- 5422cdf0e10cSrcweir 5423cdf0e10cSrcweir void Window::CallEventListeners( sal_uLong nEvent, void* pData ) 5424cdf0e10cSrcweir { 5425cdf0e10cSrcweir VclWindowEvent aEvent( this, nEvent, pData ); 5426cdf0e10cSrcweir 5427cdf0e10cSrcweir ImplDelData aDelData; 5428cdf0e10cSrcweir ImplAddDel( &aDelData ); 5429cdf0e10cSrcweir 5430cdf0e10cSrcweir ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent ); 5431cdf0e10cSrcweir 5432cdf0e10cSrcweir if ( aDelData.IsDelete() ) 5433cdf0e10cSrcweir return; 5434cdf0e10cSrcweir 5435cdf0e10cSrcweir if ( !mpWindowImpl->maEventListeners.empty() ) 5436cdf0e10cSrcweir mpWindowImpl->maEventListeners.Call( &aEvent ); 5437cdf0e10cSrcweir 5438cdf0e10cSrcweir if ( aDelData.IsDelete() ) 5439cdf0e10cSrcweir return; 5440cdf0e10cSrcweir 5441cdf0e10cSrcweir ImplRemoveDel( &aDelData ); 5442cdf0e10cSrcweir 5443cdf0e10cSrcweir Window* pWindow = this; 5444cdf0e10cSrcweir while ( pWindow ) 5445cdf0e10cSrcweir { 5446cdf0e10cSrcweir pWindow->ImplAddDel( &aDelData ); 5447cdf0e10cSrcweir 5448cdf0e10cSrcweir if ( !pWindow->mpWindowImpl->maChildEventListeners.empty() ) 5449cdf0e10cSrcweir pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent ); 5450cdf0e10cSrcweir 5451cdf0e10cSrcweir if ( aDelData.IsDelete() ) 5452cdf0e10cSrcweir return; 5453cdf0e10cSrcweir 5454cdf0e10cSrcweir pWindow->ImplRemoveDel( &aDelData ); 5455cdf0e10cSrcweir 5456cdf0e10cSrcweir pWindow = pWindow->GetParent(); 5457cdf0e10cSrcweir } 5458cdf0e10cSrcweir } 5459cdf0e10cSrcweir 5460cdf0e10cSrcweir void Window::FireVclEvent( VclSimpleEvent* pEvent ) 5461cdf0e10cSrcweir { 5462cdf0e10cSrcweir ImplGetSVData()->mpApp->ImplCallEventListeners(pEvent); 5463cdf0e10cSrcweir } 5464cdf0e10cSrcweir 5465cdf0e10cSrcweir // ----------------------------------------------------------------------- 5466cdf0e10cSrcweir 5467cdf0e10cSrcweir void Window::AddEventListener( const Link& rEventListener ) 5468cdf0e10cSrcweir { 5469cdf0e10cSrcweir mpWindowImpl->maEventListeners.push_back( rEventListener ); 5470cdf0e10cSrcweir } 5471cdf0e10cSrcweir 5472cdf0e10cSrcweir // ----------------------------------------------------------------------- 5473cdf0e10cSrcweir 5474cdf0e10cSrcweir void Window::RemoveEventListener( const Link& rEventListener ) 5475cdf0e10cSrcweir { 5476cdf0e10cSrcweir mpWindowImpl->maEventListeners.remove( rEventListener ); 5477cdf0e10cSrcweir } 5478cdf0e10cSrcweir 5479cdf0e10cSrcweir // ----------------------------------------------------------------------- 5480cdf0e10cSrcweir 5481cdf0e10cSrcweir void Window::AddChildEventListener( const Link& rEventListener ) 5482cdf0e10cSrcweir { 5483cdf0e10cSrcweir mpWindowImpl->maChildEventListeners.push_back( rEventListener ); 5484cdf0e10cSrcweir } 5485cdf0e10cSrcweir 5486cdf0e10cSrcweir // ----------------------------------------------------------------------- 5487cdf0e10cSrcweir 5488cdf0e10cSrcweir void Window::RemoveChildEventListener( const Link& rEventListener ) 5489cdf0e10cSrcweir { 5490cdf0e10cSrcweir mpWindowImpl->maChildEventListeners.remove( rEventListener ); 5491cdf0e10cSrcweir } 5492cdf0e10cSrcweir 5493cdf0e10cSrcweir // ----------------------------------------------------------------------- 5494cdf0e10cSrcweir 5495cdf0e10cSrcweir sal_uLong Window::PostUserEvent( sal_uLong nEvent, void* pEventData ) 5496cdf0e10cSrcweir { 5497cdf0e10cSrcweir sal_uLong nEventId; 5498cdf0e10cSrcweir PostUserEvent( nEventId, nEvent, pEventData ); 5499cdf0e10cSrcweir return nEventId; 5500cdf0e10cSrcweir } 5501cdf0e10cSrcweir 5502cdf0e10cSrcweir // ----------------------------------------------------------------------- 5503cdf0e10cSrcweir 5504cdf0e10cSrcweir sal_uLong Window::PostUserEvent( const Link& rLink, void* pCaller ) 5505cdf0e10cSrcweir { 5506cdf0e10cSrcweir sal_uLong nEventId; 5507cdf0e10cSrcweir PostUserEvent( nEventId, rLink, pCaller ); 5508cdf0e10cSrcweir return nEventId; 5509cdf0e10cSrcweir } 5510cdf0e10cSrcweir 5511cdf0e10cSrcweir // ----------------------------------------------------------------------- 5512cdf0e10cSrcweir 5513cdf0e10cSrcweir sal_Bool Window::PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData ) 5514cdf0e10cSrcweir { 5515cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5516cdf0e10cSrcweir 5517cdf0e10cSrcweir ImplSVEvent* pSVEvent = new ImplSVEvent; 5518cdf0e10cSrcweir pSVEvent->mnEvent = nEvent; 5519cdf0e10cSrcweir pSVEvent->mpData = pEventData; 5520cdf0e10cSrcweir pSVEvent->mpLink = NULL; 5521cdf0e10cSrcweir pSVEvent->mpWindow = this; 5522cdf0e10cSrcweir pSVEvent->mbCall = sal_True; 5523cdf0e10cSrcweir ImplAddDel( &(pSVEvent->maDelData) ); 5524cdf0e10cSrcweir rEventId = (sal_uLong)pSVEvent; 5525cdf0e10cSrcweir if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) ) 5526cdf0e10cSrcweir return sal_True; 5527cdf0e10cSrcweir else 5528cdf0e10cSrcweir { 5529cdf0e10cSrcweir rEventId = 0; 5530cdf0e10cSrcweir ImplRemoveDel( &(pSVEvent->maDelData) ); 5531cdf0e10cSrcweir delete pSVEvent; 5532cdf0e10cSrcweir return sal_False; 5533cdf0e10cSrcweir } 5534cdf0e10cSrcweir } 5535cdf0e10cSrcweir 5536cdf0e10cSrcweir // ----------------------------------------------------------------------- 5537cdf0e10cSrcweir 5538cdf0e10cSrcweir sal_Bool Window::PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller ) 5539cdf0e10cSrcweir { 5540cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5541cdf0e10cSrcweir 5542cdf0e10cSrcweir ImplSVEvent* pSVEvent = new ImplSVEvent; 5543cdf0e10cSrcweir pSVEvent->mnEvent = 0; 5544cdf0e10cSrcweir pSVEvent->mpData = pCaller; 5545cdf0e10cSrcweir pSVEvent->mpLink = new Link( rLink ); 5546cdf0e10cSrcweir pSVEvent->mpWindow = this; 5547cdf0e10cSrcweir pSVEvent->mbCall = sal_True; 5548cdf0e10cSrcweir ImplAddDel( &(pSVEvent->maDelData) ); 5549cdf0e10cSrcweir rEventId = (sal_uLong)pSVEvent; 5550cdf0e10cSrcweir if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) ) 5551cdf0e10cSrcweir return sal_True; 5552cdf0e10cSrcweir else 5553cdf0e10cSrcweir { 5554cdf0e10cSrcweir rEventId = 0; 5555cdf0e10cSrcweir ImplRemoveDel( &(pSVEvent->maDelData) ); 5556cdf0e10cSrcweir delete pSVEvent; 5557cdf0e10cSrcweir return sal_False; 5558cdf0e10cSrcweir } 5559cdf0e10cSrcweir } 5560cdf0e10cSrcweir 5561cdf0e10cSrcweir // ----------------------------------------------------------------------- 5562cdf0e10cSrcweir 5563cdf0e10cSrcweir void Window::RemoveUserEvent( sal_uLong nUserEvent ) 5564cdf0e10cSrcweir { 5565cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5566cdf0e10cSrcweir 5567cdf0e10cSrcweir ImplSVEvent* pSVEvent = (ImplSVEvent*)nUserEvent; 5568cdf0e10cSrcweir 5569cdf0e10cSrcweir DBG_ASSERT( pSVEvent->mpWindow == this, 5570cdf0e10cSrcweir "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" ); 5571cdf0e10cSrcweir DBG_ASSERT( pSVEvent->mbCall, 5572cdf0e10cSrcweir "Window::RemoveUserEvent(): Event is already removed" ); 5573cdf0e10cSrcweir 5574cdf0e10cSrcweir if ( pSVEvent->mpWindow ) 5575cdf0e10cSrcweir { 5576cdf0e10cSrcweir pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) ); 5577cdf0e10cSrcweir pSVEvent->mpWindow = NULL; 5578cdf0e10cSrcweir } 5579cdf0e10cSrcweir 5580cdf0e10cSrcweir pSVEvent->mbCall = sal_False; 5581cdf0e10cSrcweir } 5582cdf0e10cSrcweir 5583cdf0e10cSrcweir // ----------------------------------------------------------------------- 5584cdf0e10cSrcweir 5585cdf0e10cSrcweir IMPL_LINK( Window, ImplAsyncStateChangedHdl, void*, pState ) 5586cdf0e10cSrcweir { 5587cdf0e10cSrcweir StateChanged( (StateChangedType)(sal_uLong)pState ); 5588cdf0e10cSrcweir return 0; 5589cdf0e10cSrcweir } 5590cdf0e10cSrcweir 5591cdf0e10cSrcweir // ----------------------------------------------------------------------- 5592cdf0e10cSrcweir 5593cdf0e10cSrcweir void Window::PostStateChanged( StateChangedType nState ) 5594cdf0e10cSrcweir { 5595cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5596cdf0e10cSrcweir 5597cdf0e10cSrcweir PostUserEvent( LINK( this, Window, ImplAsyncStateChangedHdl ), (void*)(sal_uLong)nState ); 5598cdf0e10cSrcweir } 5599cdf0e10cSrcweir 5600cdf0e10cSrcweir // ----------------------------------------------------------------------- 5601cdf0e10cSrcweir 5602cdf0e10cSrcweir sal_Bool Window::IsLocked( sal_Bool bChilds ) const 5603cdf0e10cSrcweir { 5604cdf0e10cSrcweir if ( mpWindowImpl->mnLockCount != 0 ) 5605cdf0e10cSrcweir return sal_True; 5606cdf0e10cSrcweir 5607cdf0e10cSrcweir if ( bChilds || mpWindowImpl->mbChildNotify ) 5608cdf0e10cSrcweir { 5609cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 5610cdf0e10cSrcweir while ( pChild ) 5611cdf0e10cSrcweir { 5612cdf0e10cSrcweir if ( pChild->IsLocked( sal_True ) ) 5613cdf0e10cSrcweir return sal_True; 5614cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 5615cdf0e10cSrcweir } 5616cdf0e10cSrcweir } 5617cdf0e10cSrcweir 5618cdf0e10cSrcweir return sal_False; 5619cdf0e10cSrcweir } 5620cdf0e10cSrcweir 5621cdf0e10cSrcweir // ----------------------------------------------------------------------- 5622cdf0e10cSrcweir 5623cdf0e10cSrcweir void Window::SetStyle( WinBits nStyle ) 5624cdf0e10cSrcweir { 5625cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5626cdf0e10cSrcweir 5627cdf0e10cSrcweir if ( mpWindowImpl->mnStyle != nStyle ) 5628cdf0e10cSrcweir { 5629cdf0e10cSrcweir mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle; 5630cdf0e10cSrcweir mpWindowImpl->mnStyle = nStyle; 5631cdf0e10cSrcweir StateChanged( STATE_CHANGE_STYLE ); 5632cdf0e10cSrcweir } 5633cdf0e10cSrcweir } 5634cdf0e10cSrcweir 5635cdf0e10cSrcweir // ----------------------------------------------------------------------- 5636cdf0e10cSrcweir 5637cdf0e10cSrcweir void Window::SetExtendedStyle( WinBits nExtendedStyle ) 5638cdf0e10cSrcweir { 5639cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5640cdf0e10cSrcweir 5641cdf0e10cSrcweir if ( mpWindowImpl->mnExtendedStyle != nExtendedStyle ) 5642cdf0e10cSrcweir { 5643cdf0e10cSrcweir Window* pWindow = ImplGetBorderWindow(); 5644cdf0e10cSrcweir if( ! pWindow ) 5645cdf0e10cSrcweir pWindow = this; 5646cdf0e10cSrcweir if( pWindow->mpWindowImpl->mbFrame ) 5647cdf0e10cSrcweir { 5648cdf0e10cSrcweir SalExtStyle nExt = 0; 5649cdf0e10cSrcweir if( (nExtendedStyle & WB_EXT_DOCUMENT) ) 5650cdf0e10cSrcweir nExt |= SAL_FRAME_EXT_STYLE_DOCUMENT; 5651cdf0e10cSrcweir if( (nExtendedStyle & WB_EXT_DOCMODIFIED) ) 5652cdf0e10cSrcweir nExt |= SAL_FRAME_EXT_STYLE_DOCMODIFIED; 5653cdf0e10cSrcweir 5654cdf0e10cSrcweir pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt ); 5655cdf0e10cSrcweir } 5656cdf0e10cSrcweir mpWindowImpl->mnPrevExtendedStyle = mpWindowImpl->mnExtendedStyle; 5657cdf0e10cSrcweir mpWindowImpl->mnExtendedStyle = nExtendedStyle; 5658cdf0e10cSrcweir StateChanged( STATE_CHANGE_EXTENDEDSTYLE ); 5659cdf0e10cSrcweir } 5660cdf0e10cSrcweir } 5661cdf0e10cSrcweir 5662cdf0e10cSrcweir // ----------------------------------------------------------------------- 5663cdf0e10cSrcweir 5664cdf0e10cSrcweir SystemWindow* Window::GetSystemWindow() const 5665cdf0e10cSrcweir { 5666cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5667cdf0e10cSrcweir 5668cdf0e10cSrcweir const Window* pWin = this; 5669cdf0e10cSrcweir while ( pWin && !pWin->IsSystemWindow() ) 5670cdf0e10cSrcweir pWin = pWin->GetParent(); 5671cdf0e10cSrcweir return (SystemWindow*)pWin; 5672cdf0e10cSrcweir } 5673cdf0e10cSrcweir 5674cdf0e10cSrcweir // ----------------------------------------------------------------------- 5675cdf0e10cSrcweir 5676cdf0e10cSrcweir void Window::SetBorderStyle( sal_uInt16 nBorderStyle ) 5677cdf0e10cSrcweir { 5678cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5679cdf0e10cSrcweir 5680cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5681cdf0e10cSrcweir { 5682cdf0e10cSrcweir if( nBorderStyle == WINDOW_BORDER_REMOVEBORDER && 5683cdf0e10cSrcweir ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && 5684cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent 5685cdf0e10cSrcweir ) 5686cdf0e10cSrcweir { 5687cdf0e10cSrcweir // this is a little awkward: some controls (e.g. svtools ProgressBar) 5688cdf0e10cSrcweir // cannot avoid getting constructed with WB_BORDER but want to disable 5689cdf0e10cSrcweir // borders in case of NWF drawing. So they need a method to remove their border window 5690cdf0e10cSrcweir Window* pBorderWin = mpWindowImpl->mpBorderWindow; 5691cdf0e10cSrcweir // remove us as border window's client 5692cdf0e10cSrcweir pBorderWin->mpWindowImpl->mpClientWindow = NULL; 5693cdf0e10cSrcweir mpWindowImpl->mpBorderWindow = NULL; 5694cdf0e10cSrcweir mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent; 5695cdf0e10cSrcweir // reparent us above the border window 5696cdf0e10cSrcweir SetParent( pBorderWin->mpWindowImpl->mpParent ); 5697cdf0e10cSrcweir // set us to the position and size of our previous border 5698cdf0e10cSrcweir Point aBorderPos( pBorderWin->GetPosPixel() ); 5699cdf0e10cSrcweir Size aBorderSize( pBorderWin->GetSizePixel() ); 5700cdf0e10cSrcweir SetPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() ); 5701cdf0e10cSrcweir // release border window 5702cdf0e10cSrcweir delete pBorderWin; 5703cdf0e10cSrcweir 5704cdf0e10cSrcweir // set new style bits 5705cdf0e10cSrcweir SetStyle( GetStyle() & (~WB_BORDER) ); 5706cdf0e10cSrcweir } 5707cdf0e10cSrcweir else 5708cdf0e10cSrcweir { 5709cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW ) 5710cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetBorderStyle( nBorderStyle ); 5711cdf0e10cSrcweir else 5712cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle ); 5713cdf0e10cSrcweir } 5714cdf0e10cSrcweir } 5715cdf0e10cSrcweir } 5716cdf0e10cSrcweir 5717cdf0e10cSrcweir // ----------------------------------------------------------------------- 5718cdf0e10cSrcweir 5719cdf0e10cSrcweir sal_uInt16 Window::GetBorderStyle() const 5720cdf0e10cSrcweir { 5721cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5722cdf0e10cSrcweir 5723cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5724cdf0e10cSrcweir { 5725cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW ) 5726cdf0e10cSrcweir return ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->GetBorderStyle(); 5727cdf0e10cSrcweir else 5728cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->GetBorderStyle(); 5729cdf0e10cSrcweir } 5730cdf0e10cSrcweir 5731cdf0e10cSrcweir return 0; 5732cdf0e10cSrcweir } 5733cdf0e10cSrcweir 5734cdf0e10cSrcweir // ----------------------------------------------------------------------- 5735cdf0e10cSrcweir 5736cdf0e10cSrcweir long Window::CalcTitleWidth() const 5737cdf0e10cSrcweir { 5738cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5739cdf0e10cSrcweir 5740cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5741cdf0e10cSrcweir { 5742cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW ) 5743cdf0e10cSrcweir return ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->CalcTitleWidth(); 5744cdf0e10cSrcweir else 5745cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->CalcTitleWidth(); 5746cdf0e10cSrcweir } 5747cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame && (mpWindowImpl->mnStyle & WB_MOVEABLE) ) 5748cdf0e10cSrcweir { 5749cdf0e10cSrcweir // Fuer Frame-Fenster raten wir die Breite, da wir den Border fuer 5750cdf0e10cSrcweir // externe Dialoge nicht kennen 5751cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 5752cdf0e10cSrcweir Font aFont = GetFont(); 5753cdf0e10cSrcweir ((Window*)this)->SetPointFont( rStyleSettings.GetTitleFont() ); 5754cdf0e10cSrcweir long nTitleWidth = GetTextWidth( GetText() ); 5755cdf0e10cSrcweir ((Window*)this)->SetFont( aFont ); 5756cdf0e10cSrcweir nTitleWidth += rStyleSettings.GetTitleHeight() * 3; 5757cdf0e10cSrcweir nTitleWidth += rStyleSettings.GetBorderSize() * 2; 5758cdf0e10cSrcweir nTitleWidth += 10; 5759cdf0e10cSrcweir return nTitleWidth; 5760cdf0e10cSrcweir } 5761cdf0e10cSrcweir 5762cdf0e10cSrcweir return 0; 5763cdf0e10cSrcweir } 5764cdf0e10cSrcweir 5765cdf0e10cSrcweir // ----------------------------------------------------------------------- 5766cdf0e10cSrcweir 5767cdf0e10cSrcweir void Window::EnableClipSiblings( sal_Bool bClipSiblings ) 5768cdf0e10cSrcweir { 5769cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5770cdf0e10cSrcweir 5771cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5772cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->EnableClipSiblings( bClipSiblings ); 5773cdf0e10cSrcweir 5774cdf0e10cSrcweir mpWindowImpl->mbClipSiblings = bClipSiblings; 5775cdf0e10cSrcweir } 5776cdf0e10cSrcweir 5777cdf0e10cSrcweir // ----------------------------------------------------------------------- 5778cdf0e10cSrcweir 5779cdf0e10cSrcweir void Window::SetMouseTransparent( sal_Bool bTransparent ) 5780cdf0e10cSrcweir { 5781cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5782cdf0e10cSrcweir 5783cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5784cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetMouseTransparent( bTransparent ); 5785cdf0e10cSrcweir 5786cdf0e10cSrcweir if( mpWindowImpl->mpSysObj ) 5787cdf0e10cSrcweir mpWindowImpl->mpSysObj->SetMouseTransparent( bTransparent ); 5788cdf0e10cSrcweir 5789cdf0e10cSrcweir mpWindowImpl->mbMouseTransparent = bTransparent; 5790cdf0e10cSrcweir } 5791cdf0e10cSrcweir 5792cdf0e10cSrcweir // ----------------------------------------------------------------------- 5793cdf0e10cSrcweir 5794cdf0e10cSrcweir void Window::SetPaintTransparent( sal_Bool bTransparent ) 5795cdf0e10cSrcweir { 5796cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5797cdf0e10cSrcweir 5798cdf0e10cSrcweir // transparency is not useful for frames as the background would have to be provided by a different frame 5799cdf0e10cSrcweir if( bTransparent && mpWindowImpl->mbFrame ) 5800cdf0e10cSrcweir return; 5801cdf0e10cSrcweir 5802cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5803cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetPaintTransparent( bTransparent ); 5804cdf0e10cSrcweir 5805cdf0e10cSrcweir mpWindowImpl->mbPaintTransparent = bTransparent; 5806cdf0e10cSrcweir } 5807cdf0e10cSrcweir 5808cdf0e10cSrcweir // ----------------------------------------------------------------------- 5809cdf0e10cSrcweir 5810cdf0e10cSrcweir void Window::SetInputContext( const InputContext& rInputContext ) 5811cdf0e10cSrcweir { 5812cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5813cdf0e10cSrcweir 5814cdf0e10cSrcweir mpWindowImpl->maInputContext = rInputContext; 5815cdf0e10cSrcweir if ( !mpWindowImpl->mbInFocusHdl && HasFocus() ) 5816cdf0e10cSrcweir ImplNewInputContext(); 5817cdf0e10cSrcweir } 5818cdf0e10cSrcweir 5819cdf0e10cSrcweir // ----------------------------------------------------------------------- 5820cdf0e10cSrcweir 5821cdf0e10cSrcweir void Window::EndExtTextInput( sal_uInt16 nFlags ) 5822cdf0e10cSrcweir { 5823cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5824cdf0e10cSrcweir 5825cdf0e10cSrcweir if ( mpWindowImpl->mbExtTextInput ) 5826cdf0e10cSrcweir ImplGetFrame()->EndExtTextInput( nFlags ); 5827cdf0e10cSrcweir } 5828cdf0e10cSrcweir 5829cdf0e10cSrcweir // ----------------------------------------------------------------------- 5830cdf0e10cSrcweir 5831cdf0e10cSrcweir void Window::SetCursorRect( const Rectangle* pRect, long nExtTextInputWidth ) 5832cdf0e10cSrcweir { 5833cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5834cdf0e10cSrcweir 5835cdf0e10cSrcweir ImplWinData* pWinData = ImplGetWinData(); 5836cdf0e10cSrcweir if ( pWinData->mpCursorRect ) 5837cdf0e10cSrcweir { 5838cdf0e10cSrcweir if ( pRect ) 5839cdf0e10cSrcweir *pWinData->mpCursorRect = *pRect; 5840cdf0e10cSrcweir else 5841cdf0e10cSrcweir { 5842cdf0e10cSrcweir delete pWinData->mpCursorRect; 5843cdf0e10cSrcweir pWinData->mpCursorRect = NULL; 5844cdf0e10cSrcweir } 5845cdf0e10cSrcweir } 5846cdf0e10cSrcweir else 5847cdf0e10cSrcweir { 5848cdf0e10cSrcweir if ( pRect ) 5849cdf0e10cSrcweir pWinData->mpCursorRect = new Rectangle( *pRect ); 5850cdf0e10cSrcweir } 5851cdf0e10cSrcweir 5852cdf0e10cSrcweir pWinData->mnCursorExtWidth = nExtTextInputWidth; 5853cdf0e10cSrcweir 5854cdf0e10cSrcweir } 5855cdf0e10cSrcweir 5856cdf0e10cSrcweir // ----------------------------------------------------------------------- 5857cdf0e10cSrcweir 5858cdf0e10cSrcweir const Rectangle* Window::GetCursorRect() const 5859cdf0e10cSrcweir { 5860cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5861cdf0e10cSrcweir 5862cdf0e10cSrcweir ImplWinData* pWinData = ImplGetWinData(); 5863cdf0e10cSrcweir return pWinData->mpCursorRect; 5864cdf0e10cSrcweir } 5865cdf0e10cSrcweir 5866cdf0e10cSrcweir // ----------------------------------------------------------------------- 5867cdf0e10cSrcweir 5868cdf0e10cSrcweir long Window::GetCursorExtTextInputWidth() const 5869cdf0e10cSrcweir { 5870cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5871cdf0e10cSrcweir 5872cdf0e10cSrcweir ImplWinData* pWinData = ImplGetWinData(); 5873cdf0e10cSrcweir return pWinData->mnCursorExtWidth; 5874cdf0e10cSrcweir } 5875cdf0e10cSrcweir 5876cdf0e10cSrcweir // ----------------------------------------------------------------------- 5877cdf0e10cSrcweir void Window::SetSettings( const AllSettings& rSettings ) 5878cdf0e10cSrcweir { 5879cdf0e10cSrcweir SetSettings( rSettings, sal_False ); 5880cdf0e10cSrcweir } 5881cdf0e10cSrcweir 5882cdf0e10cSrcweir void Window::SetSettings( const AllSettings& rSettings, sal_Bool bChild ) 5883cdf0e10cSrcweir { 5884cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5885cdf0e10cSrcweir 5886cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5887cdf0e10cSrcweir { 5888cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetSettings( rSettings, sal_False ); 5889cdf0e10cSrcweir if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && 5890cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) 5891cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, sal_True ); 5892cdf0e10cSrcweir } 5893cdf0e10cSrcweir 5894cdf0e10cSrcweir AllSettings aOldSettings = maSettings; 5895cdf0e10cSrcweir OutputDevice::SetSettings( rSettings ); 5896cdf0e10cSrcweir sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); 5897cdf0e10cSrcweir 5898cdf0e10cSrcweir // AppFont-Aufloesung und DPI-Aufloesung neu berechnen 5899cdf0e10cSrcweir ImplInitResolutionSettings(); 5900cdf0e10cSrcweir 5901cdf0e10cSrcweir if ( nChangeFlags ) 5902cdf0e10cSrcweir { 5903cdf0e10cSrcweir DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags ); 5904cdf0e10cSrcweir DataChanged( aDCEvt ); 5905cdf0e10cSrcweir } 5906cdf0e10cSrcweir 5907cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 5908cdf0e10cSrcweir { 5909cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 5910cdf0e10cSrcweir while ( pChild ) 5911cdf0e10cSrcweir { 5912cdf0e10cSrcweir pChild->SetSettings( rSettings, bChild ); 5913cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 5914cdf0e10cSrcweir } 5915cdf0e10cSrcweir } 5916cdf0e10cSrcweir } 5917cdf0e10cSrcweir 5918cdf0e10cSrcweir // ----------------------------------------------------------------------- 5919cdf0e10cSrcweir 5920cdf0e10cSrcweir void Window::UpdateSettings( const AllSettings& rSettings, sal_Bool bChild ) 5921cdf0e10cSrcweir { 5922cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5923cdf0e10cSrcweir 5924cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 5925cdf0e10cSrcweir { 5926cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->UpdateSettings( rSettings, sal_False ); 5927cdf0e10cSrcweir if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && 5928cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) 5929cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, sal_True ); 5930cdf0e10cSrcweir } 5931cdf0e10cSrcweir 5932cdf0e10cSrcweir AllSettings aOldSettings = maSettings; 5933cdf0e10cSrcweir sal_uLong nChangeFlags = maSettings.Update( maSettings.GetWindowUpdate(), rSettings ); 5934cdf0e10cSrcweir nChangeFlags |= SETTINGS_IN_UPDATE_SETTINGS; // Set this flag so the receiver of the data changed 5935cdf0e10cSrcweir // event can distinguish between the changing of global 5936cdf0e10cSrcweir // setting and a local change ( with SetSettings ) 5937cdf0e10cSrcweir 5938cdf0e10cSrcweir // AppFont-Aufloesung und DPI-Aufloesung neu berechnen 5939cdf0e10cSrcweir ImplInitResolutionSettings(); 5940cdf0e10cSrcweir 5941cdf0e10cSrcweir /* #i73785# 5942cdf0e10cSrcweir * do not overwrite a WheelBehavior with false 5943cdf0e10cSrcweir * this looks kind of a hack, but WheelBehavior 5944cdf0e10cSrcweir * is always a local change, not a system property, 5945cdf0e10cSrcweir * so we can spare all our users the hassle of reacting on 5946cdf0e10cSrcweir * this in their respective DataChanged. 5947cdf0e10cSrcweir */ 5948cdf0e10cSrcweir MouseSettings aSet( maSettings.GetMouseSettings() ); 5949cdf0e10cSrcweir aSet.SetWheelBehavior( aOldSettings.GetMouseSettings().GetWheelBehavior() ); 5950cdf0e10cSrcweir maSettings.SetMouseSettings( aSet ); 5951cdf0e10cSrcweir 5952cdf0e10cSrcweir if( (nChangeFlags & SETTINGS_STYLE) && IsBackground() ) 5953cdf0e10cSrcweir { 5954cdf0e10cSrcweir Wallpaper aWallpaper = GetBackground(); 5955cdf0e10cSrcweir if( !aWallpaper.IsBitmap() && !aWallpaper.IsGradient() ) 5956cdf0e10cSrcweir { 5957cdf0e10cSrcweir if ( mpWindowImpl->mnStyle & WB_3DLOOK ) 5958cdf0e10cSrcweir SetBackground( Wallpaper( rSettings.GetStyleSettings().GetFaceColor() ) ); 5959cdf0e10cSrcweir else 5960cdf0e10cSrcweir SetBackground( Wallpaper( rSettings.GetStyleSettings().GetWindowColor() ) ); 5961cdf0e10cSrcweir } 5962cdf0e10cSrcweir } 5963cdf0e10cSrcweir 5964cdf0e10cSrcweir if ( nChangeFlags ) 5965cdf0e10cSrcweir { 5966cdf0e10cSrcweir DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags ); 5967cdf0e10cSrcweir DataChanged( aDCEvt ); 5968cdf0e10cSrcweir // notify data change handler 5969cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_DATACHANGED, &aDCEvt); 5970cdf0e10cSrcweir } 5971cdf0e10cSrcweir 5972cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 5973cdf0e10cSrcweir { 5974cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 5975cdf0e10cSrcweir while ( pChild ) 5976cdf0e10cSrcweir { 5977cdf0e10cSrcweir pChild->UpdateSettings( rSettings, bChild ); 5978cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 5979cdf0e10cSrcweir } 5980cdf0e10cSrcweir } 5981cdf0e10cSrcweir } 5982cdf0e10cSrcweir 5983cdf0e10cSrcweir // ----------------------------------------------------------------------- 5984cdf0e10cSrcweir 5985cdf0e10cSrcweir void Window::NotifyAllChilds( DataChangedEvent& rDCEvt ) 5986cdf0e10cSrcweir { 5987cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 5988cdf0e10cSrcweir 5989cdf0e10cSrcweir DataChanged( rDCEvt ); 5990cdf0e10cSrcweir 5991cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 5992cdf0e10cSrcweir while ( pChild ) 5993cdf0e10cSrcweir { 5994cdf0e10cSrcweir pChild->NotifyAllChilds( rDCEvt ); 5995cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 5996cdf0e10cSrcweir } 5997cdf0e10cSrcweir } 5998cdf0e10cSrcweir 5999cdf0e10cSrcweir // ----------------------------------------------------------------------- 6000cdf0e10cSrcweir 6001cdf0e10cSrcweir void Window::SetPointFont( const Font& rFont ) 6002cdf0e10cSrcweir { 6003cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6004cdf0e10cSrcweir 6005cdf0e10cSrcweir Font aFont = rFont; 6006cdf0e10cSrcweir ImplPointToLogic( aFont ); 6007cdf0e10cSrcweir SetFont( aFont ); 6008cdf0e10cSrcweir } 6009cdf0e10cSrcweir 6010cdf0e10cSrcweir // ----------------------------------------------------------------------- 6011cdf0e10cSrcweir 6012cdf0e10cSrcweir Font Window::GetPointFont() const 6013cdf0e10cSrcweir { 6014cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6015cdf0e10cSrcweir 6016cdf0e10cSrcweir Font aFont = GetFont(); 6017cdf0e10cSrcweir ImplLogicToPoint( aFont ); 6018cdf0e10cSrcweir return aFont; 6019cdf0e10cSrcweir } 6020cdf0e10cSrcweir 6021cdf0e10cSrcweir // ----------------------------------------------------------------------- 6022cdf0e10cSrcweir 6023cdf0e10cSrcweir // TODO: remove in next incompatible build 6024cdf0e10cSrcweir void Window::GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const 6025cdf0e10cSrcweir { 6026cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6027cdf0e10cSrcweir 6028cdf0e10cSrcweir nDPIX = mpWindowImpl->mpFrameData->mnDPIX; 6029cdf0e10cSrcweir nDPIY = mpWindowImpl->mpFrameData->mnDPIY; 6030cdf0e10cSrcweir } 6031cdf0e10cSrcweir 6032cdf0e10cSrcweir // ----------------------------------------------------------------------- 6033cdf0e10cSrcweir 6034cdf0e10cSrcweir void Window::SetParentClipMode( sal_uInt16 nMode ) 6035cdf0e10cSrcweir { 6036cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6037cdf0e10cSrcweir 6038cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6039cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetParentClipMode( nMode ); 6040cdf0e10cSrcweir else 6041cdf0e10cSrcweir { 6042cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 6043cdf0e10cSrcweir { 6044cdf0e10cSrcweir mpWindowImpl->mnParentClipMode = nMode; 6045cdf0e10cSrcweir if ( nMode & PARENTCLIPMODE_CLIP ) 6046cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mbClipChildren = sal_True; 6047cdf0e10cSrcweir } 6048cdf0e10cSrcweir } 6049cdf0e10cSrcweir } 6050cdf0e10cSrcweir 6051cdf0e10cSrcweir // ----------------------------------------------------------------------- 6052cdf0e10cSrcweir 6053cdf0e10cSrcweir sal_uInt16 Window::GetParentClipMode() const 6054cdf0e10cSrcweir { 6055cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6056cdf0e10cSrcweir 6057cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6058cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->GetParentClipMode(); 6059cdf0e10cSrcweir else 6060cdf0e10cSrcweir return mpWindowImpl->mnParentClipMode; 6061cdf0e10cSrcweir } 6062cdf0e10cSrcweir 6063cdf0e10cSrcweir // ----------------------------------------------------------------------- 6064cdf0e10cSrcweir 6065cdf0e10cSrcweir void Window::SetWindowRegionPixel() 6066cdf0e10cSrcweir { 6067cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6068cdf0e10cSrcweir 6069cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6070cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetWindowRegionPixel(); 6071cdf0e10cSrcweir else if( mpWindowImpl->mbFrame ) 6072cdf0e10cSrcweir { 6073e6f63103SArmin Le Grand mpWindowImpl->maWinRegion = Region(true); 6074cdf0e10cSrcweir mpWindowImpl->mbWinRegion = sal_False; 6075cdf0e10cSrcweir mpWindowImpl->mpFrame->ResetClipRegion(); 6076cdf0e10cSrcweir } 6077cdf0e10cSrcweir else 6078cdf0e10cSrcweir { 6079cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 6080cdf0e10cSrcweir { 6081e6f63103SArmin Le Grand mpWindowImpl->maWinRegion = Region(true); 6082cdf0e10cSrcweir mpWindowImpl->mbWinRegion = sal_False; 6083cdf0e10cSrcweir ImplSetClipFlag(); 6084cdf0e10cSrcweir 6085cdf0e10cSrcweir if ( IsReallyVisible() ) 6086cdf0e10cSrcweir { 6087cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 6088cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev ) 6089cdf0e10cSrcweir ImplDeleteOverlapBackground(); 6090cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 6091cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 6092cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 6093cdf0e10cSrcweir Region aRegion( aRect ); 6094cdf0e10cSrcweir ImplInvalidateParentFrameRegion( aRegion ); 6095cdf0e10cSrcweir } 6096cdf0e10cSrcweir } 6097cdf0e10cSrcweir } 6098cdf0e10cSrcweir } 6099cdf0e10cSrcweir 6100cdf0e10cSrcweir // ----------------------------------------------------------------------- 6101cdf0e10cSrcweir 6102cdf0e10cSrcweir void Window::SetWindowRegionPixel( const Region& rRegion ) 6103cdf0e10cSrcweir { 6104cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6105cdf0e10cSrcweir 6106cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6107cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetWindowRegionPixel( rRegion ); 6108cdf0e10cSrcweir else if( mpWindowImpl->mbFrame ) 6109cdf0e10cSrcweir { 6110e6f63103SArmin Le Grand if( !rRegion.IsNull() ) 6111cdf0e10cSrcweir { 6112cdf0e10cSrcweir mpWindowImpl->maWinRegion = rRegion; 6113cdf0e10cSrcweir mpWindowImpl->mbWinRegion = ! rRegion.IsEmpty(); 6114e6f63103SArmin Le Grand 6115cdf0e10cSrcweir if( mpWindowImpl->mbWinRegion ) 6116cdf0e10cSrcweir { 6117cdf0e10cSrcweir // ClipRegion setzen/updaten 6118e6f63103SArmin Le Grand RectangleVector aRectangles; 6119e6f63103SArmin Le Grand mpWindowImpl->maWinRegion.GetRegionRectangles(aRectangles); 6120e6f63103SArmin Le Grand mpWindowImpl->mpFrame->BeginSetClipRegion(aRectangles.size()); 6121cdf0e10cSrcweir 6122e6f63103SArmin Le Grand for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++) 6123cdf0e10cSrcweir { 6124e6f63103SArmin Le Grand mpWindowImpl->mpFrame->UnionClipRegion( 6125e6f63103SArmin Le Grand aRectIter->Left(), 6126e6f63103SArmin Le Grand aRectIter->Top(), 6127e6f63103SArmin Le Grand aRectIter->GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does 6128e6f63103SArmin Le Grand aRectIter->GetHeight()); // same for height 6129cdf0e10cSrcweir } 6130e6f63103SArmin Le Grand 6131cdf0e10cSrcweir mpWindowImpl->mpFrame->EndSetClipRegion(); 6132e6f63103SArmin Le Grand 6133e6f63103SArmin Le Grand //long nX; 6134e6f63103SArmin Le Grand //long nY; 6135e6f63103SArmin Le Grand //long nWidth; 6136e6f63103SArmin Le Grand //long nHeight; 6137e6f63103SArmin Le Grand //sal_uLong nRectCount; 6138e6f63103SArmin Le Grand //ImplRegionInfo aInfo; 6139e6f63103SArmin Le Grand //sal_Bool bRegionRect; 6140e6f63103SArmin Le Grand // 6141e6f63103SArmin Le Grand //nRectCount = mpWindowImpl->maWinRegion.GetRectCount(); 6142e6f63103SArmin Le Grand //mpWindowImpl->mpFrame->BeginSetClipRegion( nRectCount ); 6143e6f63103SArmin Le Grand //bRegionRect = mpWindowImpl->maWinRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight ); 6144e6f63103SArmin Le Grand //while ( bRegionRect ) 6145e6f63103SArmin Le Grand //{ 6146e6f63103SArmin Le Grand // mpWindowImpl->mpFrame->UnionClipRegion( nX, nY, nWidth, nHeight ); 6147e6f63103SArmin Le Grand // bRegionRect = mpWindowImpl->maWinRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight ); 6148e6f63103SArmin Le Grand //} 6149e6f63103SArmin Le Grand //mpWindowImpl->mpFrame->EndSetClipRegion(); 6150cdf0e10cSrcweir } 6151cdf0e10cSrcweir else 6152cdf0e10cSrcweir SetWindowRegionPixel(); 6153cdf0e10cSrcweir } 6154cdf0e10cSrcweir else 6155cdf0e10cSrcweir SetWindowRegionPixel(); 6156cdf0e10cSrcweir } 6157cdf0e10cSrcweir else 6158cdf0e10cSrcweir { 6159cdf0e10cSrcweir sal_Bool bInvalidate = sal_False; 6160cdf0e10cSrcweir 6161e6f63103SArmin Le Grand if ( rRegion.IsNull() ) 6162cdf0e10cSrcweir { 6163cdf0e10cSrcweir if ( mpWindowImpl->mbWinRegion ) 6164cdf0e10cSrcweir { 6165e6f63103SArmin Le Grand mpWindowImpl->maWinRegion = Region(true); 6166cdf0e10cSrcweir mpWindowImpl->mbWinRegion = sal_False; 6167cdf0e10cSrcweir ImplSetClipFlag(); 6168cdf0e10cSrcweir bInvalidate = sal_True; 6169cdf0e10cSrcweir } 6170cdf0e10cSrcweir } 6171cdf0e10cSrcweir else 6172cdf0e10cSrcweir { 6173cdf0e10cSrcweir mpWindowImpl->maWinRegion = rRegion; 6174cdf0e10cSrcweir mpWindowImpl->mbWinRegion = sal_True; 6175cdf0e10cSrcweir ImplSetClipFlag(); 6176cdf0e10cSrcweir bInvalidate = sal_True; 6177cdf0e10cSrcweir } 6178cdf0e10cSrcweir 6179cdf0e10cSrcweir if ( IsReallyVisible() ) 6180cdf0e10cSrcweir { 6181cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 6182cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev ) 6183cdf0e10cSrcweir ImplDeleteOverlapBackground(); 6184cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 6185cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 6186cdf0e10cSrcweir Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 6187cdf0e10cSrcweir Region aRegion( aRect ); 6188cdf0e10cSrcweir ImplInvalidateParentFrameRegion( aRegion ); 6189cdf0e10cSrcweir } 6190cdf0e10cSrcweir } 6191cdf0e10cSrcweir } 6192cdf0e10cSrcweir 6193cdf0e10cSrcweir // ----------------------------------------------------------------------- 6194cdf0e10cSrcweir 6195cdf0e10cSrcweir const Region& Window::GetWindowRegionPixel() const 6196cdf0e10cSrcweir { 6197cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6198cdf0e10cSrcweir 6199cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6200cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->GetWindowRegionPixel(); 6201cdf0e10cSrcweir else 6202cdf0e10cSrcweir return mpWindowImpl->maWinRegion; 6203cdf0e10cSrcweir } 6204cdf0e10cSrcweir 6205cdf0e10cSrcweir // ----------------------------------------------------------------------- 6206cdf0e10cSrcweir 6207cdf0e10cSrcweir sal_Bool Window::IsWindowRegionPixel() const 6208cdf0e10cSrcweir { 6209cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6210cdf0e10cSrcweir 6211cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6212cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->IsWindowRegionPixel(); 6213cdf0e10cSrcweir else 6214cdf0e10cSrcweir return mpWindowImpl->mbWinRegion; 6215cdf0e10cSrcweir } 6216cdf0e10cSrcweir 6217cdf0e10cSrcweir // ----------------------------------------------------------------------- 6218cdf0e10cSrcweir 6219cdf0e10cSrcweir Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const 6220cdf0e10cSrcweir { 6221cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6222cdf0e10cSrcweir 6223cdf0e10cSrcweir Region aWinClipRegion; 6224cdf0e10cSrcweir 6225cdf0e10cSrcweir if ( nFlags & WINDOW_GETCLIPREGION_NOCHILDREN ) 6226cdf0e10cSrcweir { 6227cdf0e10cSrcweir if ( mpWindowImpl->mbInitWinClipRegion ) 6228cdf0e10cSrcweir ((Window*)this)->ImplInitWinClipRegion(); 6229cdf0e10cSrcweir aWinClipRegion = mpWindowImpl->maWinClipRegion; 6230cdf0e10cSrcweir } 6231cdf0e10cSrcweir else 6232cdf0e10cSrcweir { 6233cdf0e10cSrcweir Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion(); 6234cdf0e10cSrcweir aWinClipRegion = *pWinChildClipRegion; 6235cdf0e10cSrcweir // --- RTL --- remirror clip region before passing it to somebody 6236cdf0e10cSrcweir if( ImplIsAntiparallel() ) 6237cdf0e10cSrcweir ImplReMirror( aWinClipRegion ); 6238cdf0e10cSrcweir } 6239cdf0e10cSrcweir 6240cdf0e10cSrcweir if ( nFlags & WINDOW_GETCLIPREGION_NULL ) 6241cdf0e10cSrcweir { 6242cdf0e10cSrcweir Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 6243cdf0e10cSrcweir Region aWinRegion( aWinRect ); 6244cdf0e10cSrcweir 6245cdf0e10cSrcweir if ( aWinRegion == aWinClipRegion ) 6246cdf0e10cSrcweir aWinClipRegion.SetNull(); 6247cdf0e10cSrcweir } 6248cdf0e10cSrcweir 6249cdf0e10cSrcweir aWinClipRegion.Move( -mnOutOffX, -mnOutOffY ); 6250cdf0e10cSrcweir 6251cdf0e10cSrcweir return aWinClipRegion; 6252cdf0e10cSrcweir } 6253cdf0e10cSrcweir 6254cdf0e10cSrcweir // ----------------------------------------------------------------------- 6255cdf0e10cSrcweir 6256cdf0e10cSrcweir Region Window::GetPaintRegion() const 6257cdf0e10cSrcweir { 6258cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6259cdf0e10cSrcweir 6260cdf0e10cSrcweir if ( mpWindowImpl->mpPaintRegion ) 6261cdf0e10cSrcweir { 6262cdf0e10cSrcweir Region aRegion = *mpWindowImpl->mpPaintRegion; 6263cdf0e10cSrcweir aRegion.Move( -mnOutOffX, -mnOutOffY ); 6264cdf0e10cSrcweir return PixelToLogic( aRegion ); 6265cdf0e10cSrcweir } 6266cdf0e10cSrcweir else 6267cdf0e10cSrcweir { 6268e6f63103SArmin Le Grand Region aPaintRegion(true); 6269cdf0e10cSrcweir return aPaintRegion; 6270cdf0e10cSrcweir } 6271cdf0e10cSrcweir } 6272cdf0e10cSrcweir 6273cdf0e10cSrcweir // ----------------------------------------------------------------------- 6274cdf0e10cSrcweir 6275cdf0e10cSrcweir void Window::ExpandPaintClipRegion( const Region& rRegion ) 6276cdf0e10cSrcweir { 6277cdf0e10cSrcweir if( mpWindowImpl->mpPaintRegion ) 6278cdf0e10cSrcweir { 6279cdf0e10cSrcweir Region aPixRegion = LogicToPixel( rRegion ); 6280cdf0e10cSrcweir Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion ); 6281cdf0e10cSrcweir 6282cdf0e10cSrcweir Region aWinChildRegion = *ImplGetWinChildClipRegion(); 6283cdf0e10cSrcweir // --- RTL -- only this region is in frame coordinates, so re-mirror it 6284cdf0e10cSrcweir if( ImplIsAntiparallel() ) 6285cdf0e10cSrcweir ImplReMirror( aWinChildRegion ); 6286cdf0e10cSrcweir aDevPixRegion.Intersect( aWinChildRegion ); 6287cdf0e10cSrcweir if( ! aDevPixRegion.IsEmpty() ) 6288cdf0e10cSrcweir { 6289cdf0e10cSrcweir mpWindowImpl->mpPaintRegion->Union( aDevPixRegion ); 6290cdf0e10cSrcweir mbInitClipRegion = sal_True; 6291cdf0e10cSrcweir } 6292cdf0e10cSrcweir } 6293cdf0e10cSrcweir } 6294cdf0e10cSrcweir 6295cdf0e10cSrcweir // ----------------------------------------------------------------------- 6296cdf0e10cSrcweir 6297cdf0e10cSrcweir static SystemWindow *ImplGetLastSystemWindow( Window *pWin ) 6298cdf0e10cSrcweir { 6299cdf0e10cSrcweir // get the most top-level system window, the one that contains the taskpanelist 6300cdf0e10cSrcweir SystemWindow *pSysWin = NULL; 6301cdf0e10cSrcweir if( !pWin ) 6302cdf0e10cSrcweir return pSysWin; 6303cdf0e10cSrcweir Window *pMyParent = pWin; 6304cdf0e10cSrcweir while ( pMyParent ) 6305cdf0e10cSrcweir { 6306cdf0e10cSrcweir if ( pMyParent->IsSystemWindow() ) 6307cdf0e10cSrcweir pSysWin = (SystemWindow*)pMyParent; 6308cdf0e10cSrcweir pMyParent = pMyParent->GetParent(); 6309cdf0e10cSrcweir } 6310cdf0e10cSrcweir return pSysWin; 6311cdf0e10cSrcweir } 6312cdf0e10cSrcweir 6313cdf0e10cSrcweir void Window::SetParent( Window* pNewParent ) 6314cdf0e10cSrcweir { 6315cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6316cdf0e10cSrcweir DBG_ASSERT( pNewParent, "Window::SetParent(): pParent == NULL" ); 6317cdf0e10cSrcweir DBG_ASSERT( pNewParent != this, "someone tried to reparent a window to itself" ); 6318cdf0e10cSrcweir 6319cdf0e10cSrcweir if( pNewParent == this ) 6320cdf0e10cSrcweir return; 6321cdf0e10cSrcweir 6322cdf0e10cSrcweir // check if the taskpanelist would change and move the window pointer accordingly 6323cdf0e10cSrcweir SystemWindow *pSysWin = ImplGetLastSystemWindow(this); 6324cdf0e10cSrcweir SystemWindow *pNewSysWin = NULL; 6325cdf0e10cSrcweir sal_Bool bChangeTaskPaneList = sal_False; 6326cdf0e10cSrcweir if( pSysWin && pSysWin->ImplIsInTaskPaneList( this ) ) 6327cdf0e10cSrcweir { 6328cdf0e10cSrcweir pNewSysWin = ImplGetLastSystemWindow( pNewParent ); 6329cdf0e10cSrcweir if( pNewSysWin && pNewSysWin != pSysWin ) 6330cdf0e10cSrcweir { 6331cdf0e10cSrcweir bChangeTaskPaneList = sal_True; 6332cdf0e10cSrcweir pSysWin->GetTaskPaneList()->RemoveWindow( this ); 6333cdf0e10cSrcweir } 6334cdf0e10cSrcweir } 6335cdf0e10cSrcweir // remove ownerdraw decorated windows from list in the top-most frame window 6336cdf0e10cSrcweir if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) 6337cdf0e10cSrcweir { 6338cdf0e10cSrcweir ::std::vector< Window* >& rList = ImplGetOwnerDrawList(); 6339cdf0e10cSrcweir ::std::vector< Window* >::iterator p; 6340cdf0e10cSrcweir p = ::std::find( rList.begin(), rList.end(), this ); 6341cdf0e10cSrcweir if( p != rList.end() ) 6342cdf0e10cSrcweir rList.erase( p ); 6343cdf0e10cSrcweir } 6344cdf0e10cSrcweir 6345cdf0e10cSrcweir ImplSetFrameParent( pNewParent ); 6346cdf0e10cSrcweir 6347cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6348cdf0e10cSrcweir { 6349cdf0e10cSrcweir mpWindowImpl->mpRealParent = pNewParent; 6350cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetParent( pNewParent ); 6351cdf0e10cSrcweir return; 6352cdf0e10cSrcweir } 6353cdf0e10cSrcweir 6354cdf0e10cSrcweir if ( mpWindowImpl->mpParent == pNewParent ) 6355cdf0e10cSrcweir return; 6356cdf0e10cSrcweir 6357cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 6358cdf0e10cSrcweir mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame ); 6359cdf0e10cSrcweir 6360cdf0e10cSrcweir sal_Bool bVisible = IsVisible(); 6361cdf0e10cSrcweir Show( sal_False, SHOW_NOFOCUSCHANGE ); 6362cdf0e10cSrcweir 6363cdf0e10cSrcweir // Testen, ob sich das Overlap-Window aendert 6364cdf0e10cSrcweir Window* pOldOverlapWindow; 6365cdf0e10cSrcweir Window* pNewOverlapWindow = NULL; 6366cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 6367cdf0e10cSrcweir pOldOverlapWindow = NULL; 6368cdf0e10cSrcweir else 6369cdf0e10cSrcweir { 6370cdf0e10cSrcweir pNewOverlapWindow = pNewParent->ImplGetFirstOverlapWindow(); 6371cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapWindow != pNewOverlapWindow ) 6372cdf0e10cSrcweir pOldOverlapWindow = mpWindowImpl->mpOverlapWindow; 6373cdf0e10cSrcweir else 6374cdf0e10cSrcweir pOldOverlapWindow = NULL; 6375cdf0e10cSrcweir } 6376cdf0e10cSrcweir 6377cdf0e10cSrcweir // Fenster in der Hirachie umsetzen 6378cdf0e10cSrcweir sal_Bool bFocusOverlapWin = HasChildPathFocus( sal_True ); 6379cdf0e10cSrcweir sal_Bool bFocusWin = HasChildPathFocus(); 6380cdf0e10cSrcweir sal_Bool bNewFrame = pNewParent->mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow; 6381cdf0e10cSrcweir if ( bNewFrame ) 6382cdf0e10cSrcweir { 6383cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFocusWin ) 6384cdf0e10cSrcweir { 6385cdf0e10cSrcweir if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpFocusWin ) ) 6386cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = NULL; 6387cdf0e10cSrcweir } 6388cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpMouseMoveWin ) 6389cdf0e10cSrcweir { 6390cdf0e10cSrcweir if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpMouseMoveWin ) ) 6391cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL; 6392cdf0e10cSrcweir } 6393cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpMouseDownWin ) 6394cdf0e10cSrcweir { 6395cdf0e10cSrcweir if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpMouseDownWin ) ) 6396cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpMouseDownWin = NULL; 6397cdf0e10cSrcweir } 6398cdf0e10cSrcweir } 6399cdf0e10cSrcweir ImplRemoveWindow( bNewFrame ); 6400cdf0e10cSrcweir ImplInsertWindow( pNewParent ); 6401cdf0e10cSrcweir if ( mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP ) 6402cdf0e10cSrcweir pNewParent->mpWindowImpl->mbClipChildren = sal_True; 6403cdf0e10cSrcweir ImplUpdateWindowPtr(); 6404cdf0e10cSrcweir if ( ImplUpdatePos() ) 6405cdf0e10cSrcweir ImplUpdateSysObjPos(); 6406cdf0e10cSrcweir 6407cdf0e10cSrcweir // Wenn sich das Overlap-Window geaendert hat, dann muss getestet werden, 6408cdf0e10cSrcweir // ob auch OverlapWindow die das Child-Fenster als Parent gehabt haben 6409cdf0e10cSrcweir // in der Window-Hirachie umgesetzt werden muessen 6410cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 6411cdf0e10cSrcweir { 6412cdf0e10cSrcweir if ( bNewFrame ) 6413cdf0e10cSrcweir { 6414cdf0e10cSrcweir Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap; 6415cdf0e10cSrcweir while ( pOverlapWindow ) 6416cdf0e10cSrcweir { 6417cdf0e10cSrcweir Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 6418cdf0e10cSrcweir pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame ); 6419cdf0e10cSrcweir pOverlapWindow = pNextOverlapWindow; 6420cdf0e10cSrcweir } 6421cdf0e10cSrcweir } 6422cdf0e10cSrcweir } 6423cdf0e10cSrcweir else if ( pOldOverlapWindow ) 6424cdf0e10cSrcweir { 6425cdf0e10cSrcweir // Focus-Save zuruecksetzen 6426cdf0e10cSrcweir if ( bFocusWin || 6427cdf0e10cSrcweir (pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow && 6428cdf0e10cSrcweir IsWindowOrChild( pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow )) ) 6429cdf0e10cSrcweir pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL; 6430cdf0e10cSrcweir 6431cdf0e10cSrcweir Window* pOverlapWindow = pOldOverlapWindow->mpWindowImpl->mpFirstOverlap; 6432cdf0e10cSrcweir while ( pOverlapWindow ) 6433cdf0e10cSrcweir { 6434cdf0e10cSrcweir Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext; 6435cdf0e10cSrcweir if ( ImplIsRealParentPath( pOverlapWindow->ImplGetWindow() ) ) 6436cdf0e10cSrcweir pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame ); 6437cdf0e10cSrcweir pOverlapWindow = pNextOverlapWindow; 6438cdf0e10cSrcweir } 6439cdf0e10cSrcweir 6440cdf0e10cSrcweir // Activate-Status beim naechsten Overlap-Window updaten 6441cdf0e10cSrcweir if ( HasChildPathFocus( sal_True ) ) 6442cdf0e10cSrcweir ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow ); 6443cdf0e10cSrcweir } 6444cdf0e10cSrcweir 6445cdf0e10cSrcweir // Activate-Status mit umsetzen 6446cdf0e10cSrcweir if ( bNewFrame ) 6447cdf0e10cSrcweir { 6448cdf0e10cSrcweir if ( (GetType() == WINDOW_BORDERWINDOW) && 6449cdf0e10cSrcweir (ImplGetWindow()->GetType() == WINDOW_FLOATINGWINDOW) ) 6450cdf0e10cSrcweir ((ImplBorderWindow*)this)->SetDisplayActive( mpWindowImpl->mpFrameData->mbHasFocus ); 6451cdf0e10cSrcweir } 6452cdf0e10cSrcweir 6453cdf0e10cSrcweir // Focus evtl. auf den neuen Frame umsetzen, wenn FocusWindow mit 6454cdf0e10cSrcweir // SetParent() umgesetzt wird 6455cdf0e10cSrcweir if ( bFocusOverlapWin ) 6456cdf0e10cSrcweir { 6457cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin = Application::GetFocusWindow(); 6458cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbHasFocus ) 6459cdf0e10cSrcweir { 6460cdf0e10cSrcweir mpWindowImpl->mpFrame->ToTop( 0 ); 6461cdf0e10cSrcweir } 6462cdf0e10cSrcweir } 6463cdf0e10cSrcweir 6464cdf0e10cSrcweir // Assure DragSource and DropTarget members are created 6465cdf0e10cSrcweir if ( bNewFrame ) 6466cdf0e10cSrcweir { 6467cdf0e10cSrcweir GetDropTarget(); 6468cdf0e10cSrcweir } 6469cdf0e10cSrcweir 6470cdf0e10cSrcweir if( bChangeTaskPaneList ) 6471cdf0e10cSrcweir pNewSysWin->GetTaskPaneList()->AddWindow( this ); 6472cdf0e10cSrcweir 6473cdf0e10cSrcweir if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) 6474cdf0e10cSrcweir ImplGetOwnerDrawList().push_back( this ); 6475cdf0e10cSrcweir 6476cdf0e10cSrcweir if ( bVisible ) 6477cdf0e10cSrcweir Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); 6478cdf0e10cSrcweir } 6479cdf0e10cSrcweir 6480cdf0e10cSrcweir // ----------------------------------------------------------------------- 6481cdf0e10cSrcweir 6482cdf0e10cSrcweir void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags ) 6483cdf0e10cSrcweir { 6484cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6485cdf0e10cSrcweir 6486cdf0e10cSrcweir if ( mpWindowImpl->mbVisible == bVisible ) 6487cdf0e10cSrcweir return; 6488cdf0e10cSrcweir 6489cdf0e10cSrcweir ImplDelData aDogTag( this ); 6490cdf0e10cSrcweir 6491cdf0e10cSrcweir sal_Bool bRealVisibilityChanged = sal_False; 6492cdf0e10cSrcweir mpWindowImpl->mbVisible = (bVisible != 0); 6493cdf0e10cSrcweir 6494cdf0e10cSrcweir if ( !bVisible ) 6495cdf0e10cSrcweir { 6496cdf0e10cSrcweir ImplHideAllOverlaps(); 6497cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6498cdf0e10cSrcweir return; 6499cdf0e10cSrcweir 6500cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6501cdf0e10cSrcweir { 6502cdf0e10cSrcweir sal_Bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate; 6503cdf0e10cSrcweir if ( mpWindowImpl->mbNoParentUpdate ) 6504cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = sal_True; 6505cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->Show( sal_False, nFlags ); 6506cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate; 6507cdf0e10cSrcweir } 6508cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame ) 6509cdf0e10cSrcweir { 6510cdf0e10cSrcweir mpWindowImpl->mbSuppressAccessibilityEvents = sal_True; 6511cdf0e10cSrcweir mpWindowImpl->mpFrame->Show( sal_False, sal_False ); 6512cdf0e10cSrcweir } 6513cdf0e10cSrcweir 6514cdf0e10cSrcweir StateChanged( STATE_CHANGE_VISIBLE ); 6515cdf0e10cSrcweir 6516cdf0e10cSrcweir if ( mpWindowImpl->mbReallyVisible ) 6517cdf0e10cSrcweir { 6518e6f63103SArmin Le Grand Region aInvRegion; 6519cdf0e10cSrcweir sal_Bool bSaveBack = sal_False; 6520cdf0e10cSrcweir 6521cdf0e10cSrcweir if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame ) 6522cdf0e10cSrcweir { 6523cdf0e10cSrcweir if ( ImplRestoreOverlapBackground( aInvRegion ) ) 6524cdf0e10cSrcweir bSaveBack = sal_True; 6525cdf0e10cSrcweir } 6526cdf0e10cSrcweir 6527cdf0e10cSrcweir if ( !bSaveBack ) 6528cdf0e10cSrcweir { 6529cdf0e10cSrcweir if ( mpWindowImpl->mbInitWinClipRegion ) 6530cdf0e10cSrcweir ImplInitWinClipRegion(); 6531cdf0e10cSrcweir aInvRegion = mpWindowImpl->maWinClipRegion; 6532cdf0e10cSrcweir } 6533cdf0e10cSrcweir 6534cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6535cdf0e10cSrcweir return; 6536cdf0e10cSrcweir 6537cdf0e10cSrcweir bRealVisibilityChanged = mpWindowImpl->mbReallyVisible; 6538cdf0e10cSrcweir ImplResetReallyVisible(); 6539cdf0e10cSrcweir ImplSetClipFlag(); 6540cdf0e10cSrcweir 6541cdf0e10cSrcweir if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame ) 6542cdf0e10cSrcweir { 6543cdf0e10cSrcweir // Focus umsetzen 6544cdf0e10cSrcweir if ( !(nFlags & SHOW_NOFOCUSCHANGE) && HasChildPathFocus() ) 6545cdf0e10cSrcweir { 6546cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapWindow->IsEnabled() && 6547cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->IsInputEnabled() && 6548cdf0e10cSrcweir ! mpWindowImpl->mpOverlapWindow->IsInModalMode() 6549cdf0e10cSrcweir ) 6550cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->GrabFocus(); 6551cdf0e10cSrcweir } 6552cdf0e10cSrcweir } 6553cdf0e10cSrcweir 6554cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame ) 6555cdf0e10cSrcweir { 6556cdf0e10cSrcweir if( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mbEnableNativeWidget ) 6557cdf0e10cSrcweir { 6558cdf0e10cSrcweir /* 6559cdf0e10cSrcweir * #i48371# native theming: some themes draw outside the control 6560cdf0e10cSrcweir * area we tell them to (bad thing, but we cannot do much about it ). 6561cdf0e10cSrcweir * On hiding these controls they get invalidated with their window rectangle 6562cdf0e10cSrcweir * which leads to the parts outside the control area being left and not 6563cdf0e10cSrcweir * invalidated. Workaround: invalidate an area on the parent, too 6564cdf0e10cSrcweir */ 6565cdf0e10cSrcweir const int workaround_border = 5; 6566cdf0e10cSrcweir Rectangle aBounds( aInvRegion.GetBoundRect() ); 6567cdf0e10cSrcweir aBounds.Left() -= workaround_border; 6568cdf0e10cSrcweir aBounds.Top() -= workaround_border; 6569cdf0e10cSrcweir aBounds.Right() += workaround_border; 6570cdf0e10cSrcweir aBounds.Bottom() += workaround_border; 6571cdf0e10cSrcweir aInvRegion = aBounds; 6572cdf0e10cSrcweir } 6573cdf0e10cSrcweir if ( !mpWindowImpl->mbNoParentUpdate && !(nFlags & SHOW_NOPARENTUPDATE) ) 6574cdf0e10cSrcweir { 6575cdf0e10cSrcweir if ( !aInvRegion.IsEmpty() ) 6576cdf0e10cSrcweir ImplInvalidateParentFrameRegion( aInvRegion ); 6577cdf0e10cSrcweir } 6578cdf0e10cSrcweir ImplGenerateMouseMove(); 6579cdf0e10cSrcweir } 6580cdf0e10cSrcweir } 6581cdf0e10cSrcweir } 6582cdf0e10cSrcweir else 6583cdf0e10cSrcweir { 6584cdf0e10cSrcweir // inherit native widget flag for form controls 6585cdf0e10cSrcweir // required here, because frames never show up in the child hierarchy - which should be fixed.... 6586cdf0e10cSrcweir // eg, the drop down of a combobox which is a system floating window 6587cdf0e10cSrcweir if( mpWindowImpl->mbFrame && GetParent() && GetParent()->IsCompoundControl() && 6588cdf0e10cSrcweir GetParent()->IsNativeWidgetEnabled() != IsNativeWidgetEnabled() ) 6589cdf0e10cSrcweir EnableNativeWidget( GetParent()->IsNativeWidgetEnabled() ); 6590cdf0e10cSrcweir 6591cdf0e10cSrcweir if ( mpWindowImpl->mbCallMove ) 6592cdf0e10cSrcweir { 6593cdf0e10cSrcweir ImplCallMove(); 6594cdf0e10cSrcweir } 6595cdf0e10cSrcweir if ( mpWindowImpl->mbCallResize ) 6596cdf0e10cSrcweir { 6597cdf0e10cSrcweir ImplCallResize(); 6598cdf0e10cSrcweir } 6599cdf0e10cSrcweir 6600cdf0e10cSrcweir StateChanged( STATE_CHANGE_VISIBLE ); 6601cdf0e10cSrcweir 6602cdf0e10cSrcweir Window* pTestParent; 6603cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 6604cdf0e10cSrcweir pTestParent = mpWindowImpl->mpOverlapWindow; 6605cdf0e10cSrcweir else 6606cdf0e10cSrcweir pTestParent = ImplGetParent(); 6607cdf0e10cSrcweir if ( mpWindowImpl->mbFrame || pTestParent->mpWindowImpl->mbReallyVisible ) 6608cdf0e10cSrcweir { 6609cdf0e10cSrcweir // Wenn ein Window gerade sichtbar wird, schicken wir allen 6610cdf0e10cSrcweir // Child-Fenstern ein StateChanged, damit diese sich 6611cdf0e10cSrcweir // initialisieren koennen 6612cdf0e10cSrcweir ImplCallInitShow(); 6613cdf0e10cSrcweir 6614cdf0e10cSrcweir // Wenn es ein SystemWindow ist, dann kommt es auch automatisch 6615cdf0e10cSrcweir // nach vorne, wenn es gewuenscht ist 6616cdf0e10cSrcweir if ( ImplIsOverlapWindow() && !(nFlags & SHOW_NOACTIVATE) ) 6617cdf0e10cSrcweir { 6618cdf0e10cSrcweir ImplStartToTop(( nFlags & SHOW_FOREGROUNDTASK ) ? TOTOP_FOREGROUNDTASK : 0 ); 6619cdf0e10cSrcweir ImplFocusToTop( 0, sal_False ); 6620cdf0e10cSrcweir } 6621cdf0e10cSrcweir 6622cdf0e10cSrcweir // Hintergrund sichern 6623cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mbSaveBack ) 6624cdf0e10cSrcweir ImplSaveOverlapBackground(); 6625cdf0e10cSrcweir // adjust mpWindowImpl->mbReallyVisible 6626cdf0e10cSrcweir bRealVisibilityChanged = !mpWindowImpl->mbReallyVisible; 6627cdf0e10cSrcweir ImplSetReallyVisible(); 6628cdf0e10cSrcweir 6629cdf0e10cSrcweir // Dafuer sorgen, das Clip-Rechtecke neu berechnet werden 6630cdf0e10cSrcweir ImplSetClipFlag(); 6631cdf0e10cSrcweir 6632cdf0e10cSrcweir if ( !mpWindowImpl->mbFrame ) 6633cdf0e10cSrcweir { 6634cdf0e10cSrcweir sal_uInt16 nInvalidateFlags = INVALIDATE_CHILDREN; 6635cdf0e10cSrcweir if( ! IsPaintTransparent() ) 6636cdf0e10cSrcweir nInvalidateFlags |= INVALIDATE_NOTRANSPARENT; 6637cdf0e10cSrcweir ImplInvalidate( NULL, nInvalidateFlags ); 6638cdf0e10cSrcweir ImplGenerateMouseMove(); 6639cdf0e10cSrcweir } 6640cdf0e10cSrcweir } 6641cdf0e10cSrcweir 6642cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6643cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->Show( sal_True, nFlags ); 6644cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame ) 6645cdf0e10cSrcweir { 6646cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 6647cdf0e10cSrcweir // #106431#, hide SplashScreen 6648cdf0e10cSrcweir if( pSVData->mpIntroWindow && !ImplIsWindowOrChild( pSVData->mpIntroWindow ) ) 6649cdf0e10cSrcweir pSVData->mpIntroWindow->Hide(); 6650cdf0e10cSrcweir 6651cdf0e10cSrcweir //DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated"); 6652cdf0e10cSrcweir mpWindowImpl->mbSuppressAccessibilityEvents = sal_False; 6653cdf0e10cSrcweir 6654cdf0e10cSrcweir mpWindowImpl->mbPaintFrame = sal_True; 6655cdf0e10cSrcweir sal_Bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? sal_True : sal_False; 6656cdf0e10cSrcweir mpWindowImpl->mpFrame->Show( sal_True, bNoActivate ); 6657cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6658cdf0e10cSrcweir return; 6659cdf0e10cSrcweir 6660cdf0e10cSrcweir // Query the correct size of the window, if we are waiting for 6661cdf0e10cSrcweir // a system resize 6662cdf0e10cSrcweir if ( mpWindowImpl->mbWaitSystemResize ) 6663cdf0e10cSrcweir { 6664cdf0e10cSrcweir long nOutWidth; 6665cdf0e10cSrcweir long nOutHeight; 6666cdf0e10cSrcweir mpWindowImpl->mpFrame->GetClientSize( nOutWidth, nOutHeight ); 6667cdf0e10cSrcweir ImplHandleResize( this, nOutWidth, nOutHeight ); 6668cdf0e10cSrcweir } 6669cdf0e10cSrcweir } 6670cdf0e10cSrcweir 6671cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6672cdf0e10cSrcweir return; 6673cdf0e10cSrcweir 6674cdf0e10cSrcweir #ifdef DBG_UTIL 6675cdf0e10cSrcweir if ( IsDialog() || (GetType() == WINDOW_TABPAGE) || (GetType() == WINDOW_DOCKINGWINDOW) ) 6676cdf0e10cSrcweir { 6677cdf0e10cSrcweir DBG_DIALOGTEST( this ); 6678cdf0e10cSrcweir } 6679cdf0e10cSrcweir #endif 6680cdf0e10cSrcweir 6681cdf0e10cSrcweir ImplShowAllOverlaps(); 6682cdf0e10cSrcweir } 6683cdf0e10cSrcweir 6684cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6685cdf0e10cSrcweir return; 6686cdf0e10cSrcweir // invalidate all saved backgrounds 6687cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 6688cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 6689cdf0e10cSrcweir 6690cdf0e10cSrcweir // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge 6691cdf0e10cSrcweir // However, the access bridge only uses this event if the data member is not NULL (it's kind of a hack that 6692cdf0e10cSrcweir // we re-use the SHOW/HIDE events this way, with this particular semantics). 6693cdf0e10cSrcweir // Since #104887#, the notifications for the access bridge are done in Impl(Set|Reset)ReallyVisible. Here, we 6694cdf0e10cSrcweir // now only notify with a NULL data pointer, for all other clients except the access bridge. 6695cdf0e10cSrcweir if ( !bRealVisibilityChanged ) 6696cdf0e10cSrcweir ImplCallEventListeners( mpWindowImpl->mbVisible ? VCLEVENT_WINDOW_SHOW : VCLEVENT_WINDOW_HIDE, NULL ); 6697cdf0e10cSrcweir if( aDogTag.IsDelete() ) 6698cdf0e10cSrcweir return; 6699cdf0e10cSrcweir 6700cdf0e10cSrcweir // #107575#, if a floating windows is shown that grabs the focus, we have to notify the toolkit about it 6701cdf0e10cSrcweir // ImplGrabFocus() is not called in this case 6702cdf0e10cSrcweir // Because this might lead to problems the task will be shifted to 6.y 6703cdf0e10cSrcweir // Note: top-level context menues are registered at the access bridge after being shown, 6704cdf0e10cSrcweir // so this will probably not help here.... 6705cdf0e10cSrcweir /* 6706cdf0e10cSrcweir if( mpWindowImpl->mbFloatWin && ((FloatingWindow*) this )->GrabsFocus() ) 6707cdf0e10cSrcweir { 6708cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 6709cdf0e10cSrcweir if( !mpWindowImpl->mbVisible ) 6710cdf0e10cSrcweir { 6711cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS ); 6712cdf0e10cSrcweir if( pSVData->maWinData.mpFocusWin ) 6713cdf0e10cSrcweir pSVData->maWinData.mpFocusWin->ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS ); 6714cdf0e10cSrcweir } 6715cdf0e10cSrcweir else 6716cdf0e10cSrcweir { 6717cdf0e10cSrcweir if( pSVData->maWinData.mpFocusWin ) 6718cdf0e10cSrcweir pSVData->maWinData.mpFocusWin->ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS ); 6719cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS ); 6720cdf0e10cSrcweir } 6721cdf0e10cSrcweir } 6722cdf0e10cSrcweir */ 6723cdf0e10cSrcweir } 6724cdf0e10cSrcweir 6725cdf0e10cSrcweir // ----------------------------------------------------------------------- 6726cdf0e10cSrcweir 6727cdf0e10cSrcweir Size Window::GetSizePixel() const 6728cdf0e10cSrcweir { 6729cdf0e10cSrcweir // #i43257# trigger pending resize handler to assure correct window sizes 6730cdf0e10cSrcweir if( mpWindowImpl->mpFrameData->maResizeTimer.IsActive() ) 6731cdf0e10cSrcweir { 6732cdf0e10cSrcweir ImplDelData aDogtag( this ); 6733cdf0e10cSrcweir mpWindowImpl->mpFrameData->maResizeTimer.Stop(); 6734cdf0e10cSrcweir mpWindowImpl->mpFrameData->maResizeTimer.GetTimeoutHdl().Call( NULL ); 6735cdf0e10cSrcweir if( aDogtag.IsDelete() ) 6736cdf0e10cSrcweir return Size(0,0); 6737cdf0e10cSrcweir } 6738cdf0e10cSrcweir 6739cdf0e10cSrcweir return Size( mnOutWidth+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder, 6740cdf0e10cSrcweir mnOutHeight+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ); 6741cdf0e10cSrcweir } 6742cdf0e10cSrcweir 6743cdf0e10cSrcweir void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 6744cdf0e10cSrcweir sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const 6745cdf0e10cSrcweir { 6746cdf0e10cSrcweir rLeftBorder = mpWindowImpl->mnLeftBorder; 6747cdf0e10cSrcweir rTopBorder = mpWindowImpl->mnTopBorder; 6748cdf0e10cSrcweir rRightBorder = mpWindowImpl->mnRightBorder; 6749cdf0e10cSrcweir rBottomBorder = mpWindowImpl->mnBottomBorder; 6750cdf0e10cSrcweir } 6751cdf0e10cSrcweir 6752cdf0e10cSrcweir 6753cdf0e10cSrcweir // ----------------------------------------------------------------------- 6754cdf0e10cSrcweir 6755cdf0e10cSrcweir void Window::Enable( bool bEnable, bool bChild ) 6756cdf0e10cSrcweir { 6757cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6758cdf0e10cSrcweir 6759cdf0e10cSrcweir if ( !bEnable ) 6760cdf0e10cSrcweir { 6761cdf0e10cSrcweir // Wenn ein Fenster disablte wird, wird automatisch der Tracking-Modus 6762cdf0e10cSrcweir // beendet oder der Capture geklaut 6763cdf0e10cSrcweir if ( IsTracking() ) 6764cdf0e10cSrcweir EndTracking( ENDTRACK_CANCEL ); 6765cdf0e10cSrcweir if ( IsMouseCaptured() ) 6766cdf0e10cSrcweir ReleaseMouse(); 6767cdf0e10cSrcweir // Wenn Fenster den Focus hat und in der Dialog-Steuerung enthalten, 6768cdf0e10cSrcweir // wird versucht, den Focus auf das naechste Control weiterzuschalten 6769cdf0e10cSrcweir // mpWindowImpl->mbDisabled darf erst nach Aufruf von ImplDlgCtrlNextWindow() gesetzt 6770cdf0e10cSrcweir // werden. Ansonsten muss ImplDlgCtrlNextWindow() umgestellt werden 6771cdf0e10cSrcweir if ( HasFocus() ) 6772cdf0e10cSrcweir ImplDlgCtrlNextWindow(); 6773cdf0e10cSrcweir } 6774cdf0e10cSrcweir 6775cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6776cdf0e10cSrcweir { 6777cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->Enable( bEnable, sal_False ); 6778cdf0e10cSrcweir if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && 6779cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) 6780cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, sal_True ); 6781cdf0e10cSrcweir } 6782cdf0e10cSrcweir 6783cdf0e10cSrcweir // #i56102# restore app focus win in case the 6784cdf0e10cSrcweir // window was disabled when the frame focus changed 6785cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 6786cdf0e10cSrcweir if( bEnable && 6787cdf0e10cSrcweir pSVData->maWinData.mpFocusWin == NULL && 6788cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbHasFocus && 6789cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin == this ) 6790cdf0e10cSrcweir pSVData->maWinData.mpFocusWin = this; 6791cdf0e10cSrcweir 6792cdf0e10cSrcweir if ( mpWindowImpl->mbDisabled != !bEnable ) 6793cdf0e10cSrcweir { 6794cdf0e10cSrcweir mpWindowImpl->mbDisabled = !bEnable; 6795cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 6796cdf0e10cSrcweir mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled ); 6797cdf0e10cSrcweir // if ( mpWindowImpl->mbFrame ) 6798cdf0e10cSrcweir // mpWindowImpl->mpFrame->Enable( bEnable && !mpWindowImpl->mbInputDisabled ); 6799cdf0e10cSrcweir StateChanged( STATE_CHANGE_ENABLE ); 6800cdf0e10cSrcweir 6801cdf0e10cSrcweir ImplCallEventListeners( bEnable ? VCLEVENT_WINDOW_ENABLED : VCLEVENT_WINDOW_DISABLED ); 6802cdf0e10cSrcweir } 6803cdf0e10cSrcweir 6804cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 6805cdf0e10cSrcweir { 6806cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 6807cdf0e10cSrcweir while ( pChild ) 6808cdf0e10cSrcweir { 6809cdf0e10cSrcweir pChild->Enable( bEnable, bChild ); 6810cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 6811cdf0e10cSrcweir } 6812cdf0e10cSrcweir } 6813cdf0e10cSrcweir 6814cdf0e10cSrcweir if ( IsReallyVisible() ) 6815cdf0e10cSrcweir ImplGenerateMouseMove(); 6816cdf0e10cSrcweir } 6817cdf0e10cSrcweir 6818cdf0e10cSrcweir // ----------------------------------------------------------------------- 6819cdf0e10cSrcweir 6820cdf0e10cSrcweir void Window::SetCallHandlersOnInputDisabled( bool bCall ) 6821cdf0e10cSrcweir { 6822cdf0e10cSrcweir mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? sal_True : sal_False; 6823cdf0e10cSrcweir 6824cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 6825cdf0e10cSrcweir while ( pChild ) 6826cdf0e10cSrcweir { 6827cdf0e10cSrcweir pChild->SetCallHandlersOnInputDisabled( bCall ); 6828cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 6829cdf0e10cSrcweir } 6830cdf0e10cSrcweir } 6831cdf0e10cSrcweir 6832cdf0e10cSrcweir // ----------------------------------------------------------------------- 6833cdf0e10cSrcweir 6834cdf0e10cSrcweir bool Window::IsCallHandlersOnInputDisabled() const 6835cdf0e10cSrcweir { 6836cdf0e10cSrcweir return mpWindowImpl->mbCallHandlersDuringInputDisabled ? true : false; 6837cdf0e10cSrcweir } 6838cdf0e10cSrcweir 6839cdf0e10cSrcweir // ----------------------------------------------------------------------- 6840cdf0e10cSrcweir 6841cdf0e10cSrcweir void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild ) 6842cdf0e10cSrcweir { 6843cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6844cdf0e10cSrcweir 6845cdf0e10cSrcweir sal_Bool bNotify = (bEnable != mpWindowImpl->mbInputDisabled); 6846cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6847cdf0e10cSrcweir { 6848cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->EnableInput( bEnable, sal_False ); 6849cdf0e10cSrcweir if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) && 6850cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow ) 6851cdf0e10cSrcweir ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, sal_True ); 6852cdf0e10cSrcweir } 6853cdf0e10cSrcweir 6854cdf0e10cSrcweir if ( (! bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) || 6855cdf0e10cSrcweir ( bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled) ) 6856cdf0e10cSrcweir { 6857cdf0e10cSrcweir // Wenn ein Fenster disablte wird, wird automatisch der 6858cdf0e10cSrcweir // Tracking-Modus beendet oder der Capture geklaut 6859cdf0e10cSrcweir if ( !bEnable ) 6860cdf0e10cSrcweir { 6861cdf0e10cSrcweir if ( IsTracking() ) 6862cdf0e10cSrcweir EndTracking( ENDTRACK_CANCEL ); 6863cdf0e10cSrcweir if ( IsMouseCaptured() ) 6864cdf0e10cSrcweir ReleaseMouse(); 6865cdf0e10cSrcweir } 6866cdf0e10cSrcweir 6867cdf0e10cSrcweir if ( mpWindowImpl->mbInputDisabled != !bEnable ) 6868cdf0e10cSrcweir { 6869cdf0e10cSrcweir mpWindowImpl->mbInputDisabled = !bEnable; 6870cdf0e10cSrcweir if ( mpWindowImpl->mpSysObj ) 6871cdf0e10cSrcweir mpWindowImpl->mpSysObj->Enable( !mpWindowImpl->mbDisabled && bEnable ); 6872cdf0e10cSrcweir // if ( mpWindowImpl->mbFrame ) 6873cdf0e10cSrcweir // mpWindowImpl->mpFrame->Enable( !mpWindowImpl->mbDisabled && bEnable ); 6874cdf0e10cSrcweir } 6875cdf0e10cSrcweir } 6876cdf0e10cSrcweir 6877cdf0e10cSrcweir // #i56102# restore app focus win in case the 6878cdf0e10cSrcweir // window was disabled when the frame focus changed 6879cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 6880cdf0e10cSrcweir if( bEnable && 6881cdf0e10cSrcweir pSVData->maWinData.mpFocusWin == NULL && 6882cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbHasFocus && 6883cdf0e10cSrcweir mpWindowImpl->mpFrameData->mpFocusWin == this ) 6884cdf0e10cSrcweir pSVData->maWinData.mpFocusWin = this; 6885cdf0e10cSrcweir 6886cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 6887cdf0e10cSrcweir { 6888cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 6889cdf0e10cSrcweir while ( pChild ) 6890cdf0e10cSrcweir { 6891cdf0e10cSrcweir pChild->EnableInput( bEnable, bChild ); 6892cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 6893cdf0e10cSrcweir } 6894cdf0e10cSrcweir } 6895cdf0e10cSrcweir 6896cdf0e10cSrcweir if ( IsReallyVisible() ) 6897cdf0e10cSrcweir ImplGenerateMouseMove(); 6898cdf0e10cSrcweir 6899cdf0e10cSrcweir // #104827# notify parent 6900cdf0e10cSrcweir if ( bNotify ) 6901cdf0e10cSrcweir { 6902cdf0e10cSrcweir NotifyEvent aNEvt( bEnable ? EVENT_INPUTENABLE : EVENT_INPUTDISABLE, this ); 6903cdf0e10cSrcweir Notify( aNEvt ); 6904cdf0e10cSrcweir } 6905cdf0e10cSrcweir } 6906cdf0e10cSrcweir 6907cdf0e10cSrcweir // ----------------------------------------------------------------------- 6908cdf0e10cSrcweir 6909cdf0e10cSrcweir void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin, 6910cdf0e10cSrcweir const Window* pExcludeWindow ) 6911cdf0e10cSrcweir { 6912cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6913cdf0e10cSrcweir 6914cdf0e10cSrcweir EnableInput( bEnable, bChild ); 6915cdf0e10cSrcweir if ( bSysWin ) 6916cdf0e10cSrcweir { 6917cdf0e10cSrcweir // pExculeWindow is the first Overlap-Frame --> if this 6918cdf0e10cSrcweir // shouldn't be the case, than this must be changed in dialog.cxx 6919cdf0e10cSrcweir if( pExcludeWindow ) 6920cdf0e10cSrcweir pExcludeWindow = pExcludeWindow->ImplGetFirstOverlapWindow(); 6921cdf0e10cSrcweir Window* pSysWin = mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mpFirstOverlap; 6922cdf0e10cSrcweir while ( pSysWin ) 6923cdf0e10cSrcweir { 6924cdf0e10cSrcweir // Is Window in the path from this window 6925cdf0e10cSrcweir if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, sal_True ) ) 6926cdf0e10cSrcweir { 6927cdf0e10cSrcweir // Is Window not in the exclude window path or not the 6928cdf0e10cSrcweir // exclude window, than change the status 6929cdf0e10cSrcweir if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, sal_True ) ) 6930cdf0e10cSrcweir pSysWin->EnableInput( bEnable, bChild ); 6931cdf0e10cSrcweir } 6932cdf0e10cSrcweir pSysWin = pSysWin->mpWindowImpl->mpNextOverlap; 6933cdf0e10cSrcweir } 6934cdf0e10cSrcweir 6935cdf0e10cSrcweir // enable/disable floating system windows as well 6936cdf0e10cSrcweir Window* pFrameWin = ImplGetSVData()->maWinData.mpFirstFrame; 6937cdf0e10cSrcweir while ( pFrameWin ) 6938cdf0e10cSrcweir { 6939cdf0e10cSrcweir if( pFrameWin->ImplIsFloatingWindow() ) 6940cdf0e10cSrcweir { 6941cdf0e10cSrcweir // Is Window in the path from this window 6942cdf0e10cSrcweir if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, sal_True ) ) 6943cdf0e10cSrcweir { 6944cdf0e10cSrcweir // Is Window not in the exclude window path or not the 6945cdf0e10cSrcweir // exclude window, than change the status 6946cdf0e10cSrcweir if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, sal_True ) ) 6947cdf0e10cSrcweir pFrameWin->EnableInput( bEnable, bChild ); 6948cdf0e10cSrcweir } 6949cdf0e10cSrcweir } 6950cdf0e10cSrcweir pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame; 6951cdf0e10cSrcweir } 6952cdf0e10cSrcweir 6953cdf0e10cSrcweir // the same for ownerdraw floating windows 6954cdf0e10cSrcweir if( mpWindowImpl->mbFrame ) 6955cdf0e10cSrcweir { 6956cdf0e10cSrcweir ::std::vector< Window* >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList; 6957cdf0e10cSrcweir ::std::vector< Window* >::iterator p = rList.begin(); 6958cdf0e10cSrcweir while( p != rList.end() ) 6959cdf0e10cSrcweir { 6960cdf0e10cSrcweir // Is Window in the path from this window 6961cdf0e10cSrcweir if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( (*p), sal_True ) ) 6962cdf0e10cSrcweir { 6963cdf0e10cSrcweir // Is Window not in the exclude window path or not the 6964cdf0e10cSrcweir // exclude window, than change the status 6965cdf0e10cSrcweir if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), sal_True ) ) 6966cdf0e10cSrcweir (*p)->EnableInput( bEnable, bChild ); 6967cdf0e10cSrcweir } 6968cdf0e10cSrcweir p++; 6969cdf0e10cSrcweir } 6970cdf0e10cSrcweir } 6971cdf0e10cSrcweir } 6972cdf0e10cSrcweir } 6973cdf0e10cSrcweir 6974cdf0e10cSrcweir // ----------------------------------------------------------------------- 6975cdf0e10cSrcweir 6976cdf0e10cSrcweir void Window::AlwaysEnableInput( sal_Bool bAlways, sal_Bool bChild ) 6977cdf0e10cSrcweir { 6978cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 6979cdf0e10cSrcweir 6980cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 6981cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, sal_False ); 6982cdf0e10cSrcweir 6983cdf0e10cSrcweir if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled ) 6984cdf0e10cSrcweir { 6985cdf0e10cSrcweir mpWindowImpl->meAlwaysInputMode = AlwaysInputEnabled; 6986cdf0e10cSrcweir 6987cdf0e10cSrcweir if ( bAlways ) 6988cdf0e10cSrcweir EnableInput( sal_True, sal_False ); 6989cdf0e10cSrcweir } 6990cdf0e10cSrcweir else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled ) 6991cdf0e10cSrcweir { 6992cdf0e10cSrcweir mpWindowImpl->meAlwaysInputMode = AlwaysInputNone; 6993cdf0e10cSrcweir } 6994cdf0e10cSrcweir 6995cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 6996cdf0e10cSrcweir { 6997cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 6998cdf0e10cSrcweir while ( pChild ) 6999cdf0e10cSrcweir { 7000cdf0e10cSrcweir pChild->AlwaysEnableInput( bAlways, bChild ); 7001cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 7002cdf0e10cSrcweir } 7003cdf0e10cSrcweir } 7004cdf0e10cSrcweir } 7005cdf0e10cSrcweir 7006cdf0e10cSrcweir // ----------------------------------------------------------------------- 7007cdf0e10cSrcweir 7008cdf0e10cSrcweir void Window::AlwaysDisableInput( sal_Bool bAlways, sal_Bool bChild ) 7009cdf0e10cSrcweir { 7010cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7011cdf0e10cSrcweir 7012cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 7013cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->AlwaysDisableInput( bAlways, sal_False ); 7014cdf0e10cSrcweir 7015cdf0e10cSrcweir if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled ) 7016cdf0e10cSrcweir { 7017cdf0e10cSrcweir mpWindowImpl->meAlwaysInputMode = AlwaysInputDisabled; 7018cdf0e10cSrcweir 7019cdf0e10cSrcweir if ( bAlways ) 7020cdf0e10cSrcweir EnableInput( sal_False, sal_False ); 7021cdf0e10cSrcweir } 7022cdf0e10cSrcweir else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled ) 7023cdf0e10cSrcweir { 7024cdf0e10cSrcweir mpWindowImpl->meAlwaysInputMode = AlwaysInputNone; 7025cdf0e10cSrcweir } 7026cdf0e10cSrcweir 7027cdf0e10cSrcweir if ( bChild || mpWindowImpl->mbChildNotify ) 7028cdf0e10cSrcweir { 7029cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 7030cdf0e10cSrcweir while ( pChild ) 7031cdf0e10cSrcweir { 7032cdf0e10cSrcweir pChild->AlwaysDisableInput( bAlways, bChild ); 7033cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 7034cdf0e10cSrcweir } 7035cdf0e10cSrcweir } 7036cdf0e10cSrcweir } 7037cdf0e10cSrcweir 7038cdf0e10cSrcweir // ----------------------------------------------------------------------- 7039cdf0e10cSrcweir 7040cdf0e10cSrcweir void Window::SetActivateMode( sal_uInt16 nMode ) 7041cdf0e10cSrcweir { 7042cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7043cdf0e10cSrcweir 7044cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 7045cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetActivateMode( nMode ); 7046cdf0e10cSrcweir 7047cdf0e10cSrcweir if ( mpWindowImpl->mnActivateMode != nMode ) 7048cdf0e10cSrcweir { 7049cdf0e10cSrcweir mpWindowImpl->mnActivateMode = nMode; 7050cdf0e10cSrcweir 7051cdf0e10cSrcweir // Evtl. ein Decativate/Activate ausloesen 7052cdf0e10cSrcweir if ( mpWindowImpl->mnActivateMode ) 7053cdf0e10cSrcweir { 7054cdf0e10cSrcweir if ( (mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW)) && 7055cdf0e10cSrcweir !HasChildPathFocus( sal_True ) ) 7056cdf0e10cSrcweir { 7057cdf0e10cSrcweir mpWindowImpl->mbActive = sal_False; 7058cdf0e10cSrcweir Deactivate(); 7059cdf0e10cSrcweir } 7060cdf0e10cSrcweir } 7061cdf0e10cSrcweir else 7062cdf0e10cSrcweir { 7063cdf0e10cSrcweir if ( !mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW) ) 7064cdf0e10cSrcweir { 7065cdf0e10cSrcweir mpWindowImpl->mbActive = sal_True; 7066cdf0e10cSrcweir Activate(); 7067cdf0e10cSrcweir } 7068cdf0e10cSrcweir } 7069cdf0e10cSrcweir } 7070cdf0e10cSrcweir } 7071cdf0e10cSrcweir 7072cdf0e10cSrcweir // ----------------------------------------------------------------------- 7073cdf0e10cSrcweir 7074cdf0e10cSrcweir void Window::ToTop( sal_uInt16 nFlags ) 7075cdf0e10cSrcweir { 7076cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7077cdf0e10cSrcweir 7078cdf0e10cSrcweir ImplStartToTop( nFlags ); 7079cdf0e10cSrcweir ImplFocusToTop( nFlags, IsReallyVisible() ); 7080cdf0e10cSrcweir } 7081cdf0e10cSrcweir 7082cdf0e10cSrcweir // ----------------------------------------------------------------------- 7083cdf0e10cSrcweir 7084cdf0e10cSrcweir void Window::SetZOrder( Window* pRefWindow, sal_uInt16 nFlags ) 7085cdf0e10cSrcweir { 7086cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7087cdf0e10cSrcweir 7088cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 7089cdf0e10cSrcweir { 7090cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetZOrder( pRefWindow, nFlags ); 7091cdf0e10cSrcweir return; 7092cdf0e10cSrcweir } 7093cdf0e10cSrcweir 7094cdf0e10cSrcweir if ( nFlags & WINDOW_ZORDER_FIRST ) 7095cdf0e10cSrcweir { 7096cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 7097cdf0e10cSrcweir pRefWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; 7098cdf0e10cSrcweir else 7099cdf0e10cSrcweir pRefWindow = mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild; 7100cdf0e10cSrcweir nFlags |= WINDOW_ZORDER_BEFOR; 7101cdf0e10cSrcweir } 7102cdf0e10cSrcweir else if ( nFlags & WINDOW_ZORDER_LAST ) 7103cdf0e10cSrcweir { 7104cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 7105cdf0e10cSrcweir pRefWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap; 7106cdf0e10cSrcweir else 7107cdf0e10cSrcweir pRefWindow = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild; 7108cdf0e10cSrcweir nFlags |= WINDOW_ZORDER_BEHIND; 7109cdf0e10cSrcweir } 7110cdf0e10cSrcweir 7111cdf0e10cSrcweir while ( pRefWindow->mpWindowImpl->mpBorderWindow ) 7112cdf0e10cSrcweir pRefWindow = pRefWindow->mpWindowImpl->mpBorderWindow; 7113cdf0e10cSrcweir if ( (pRefWindow == this) || mpWindowImpl->mbFrame ) 7114cdf0e10cSrcweir return; 7115cdf0e10cSrcweir 7116cdf0e10cSrcweir DBG_ASSERT( pRefWindow->mpWindowImpl->mpParent == mpWindowImpl->mpParent, "Window::SetZOrder() - pRefWindow has other parent" ); 7117cdf0e10cSrcweir if ( nFlags & WINDOW_ZORDER_BEFOR ) 7118cdf0e10cSrcweir { 7119cdf0e10cSrcweir if ( pRefWindow->mpWindowImpl->mpPrev == this ) 7120cdf0e10cSrcweir return; 7121cdf0e10cSrcweir 7122cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 7123cdf0e10cSrcweir { 7124cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 7125cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 7126cdf0e10cSrcweir else 7127cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext; 7128cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 7129cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 7130cdf0e10cSrcweir else 7131cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; 7132cdf0e10cSrcweir if ( !pRefWindow->mpWindowImpl->mpPrev ) 7133cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = this; 7134cdf0e10cSrcweir } 7135cdf0e10cSrcweir else 7136cdf0e10cSrcweir { 7137cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 7138cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 7139cdf0e10cSrcweir else 7140cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext; 7141cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 7142cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 7143cdf0e10cSrcweir else 7144cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev; 7145cdf0e10cSrcweir if ( !pRefWindow->mpWindowImpl->mpPrev ) 7146cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = this; 7147cdf0e10cSrcweir } 7148cdf0e10cSrcweir 7149cdf0e10cSrcweir mpWindowImpl->mpPrev = pRefWindow->mpWindowImpl->mpPrev; 7150cdf0e10cSrcweir mpWindowImpl->mpNext = pRefWindow; 7151cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 7152cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this; 7153cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this; 7154cdf0e10cSrcweir } 7155cdf0e10cSrcweir else if ( nFlags & WINDOW_ZORDER_BEHIND ) 7156cdf0e10cSrcweir { 7157cdf0e10cSrcweir if ( pRefWindow->mpWindowImpl->mpNext == this ) 7158cdf0e10cSrcweir return; 7159cdf0e10cSrcweir 7160cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 7161cdf0e10cSrcweir { 7162cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 7163cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 7164cdf0e10cSrcweir else 7165cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext; 7166cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 7167cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 7168cdf0e10cSrcweir else 7169cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; 7170cdf0e10cSrcweir if ( !pRefWindow->mpWindowImpl->mpNext ) 7171cdf0e10cSrcweir mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = this; 7172cdf0e10cSrcweir } 7173cdf0e10cSrcweir else 7174cdf0e10cSrcweir { 7175cdf0e10cSrcweir if ( mpWindowImpl->mpPrev ) 7176cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; 7177cdf0e10cSrcweir else 7178cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext; 7179cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 7180cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; 7181cdf0e10cSrcweir else 7182cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev; 7183cdf0e10cSrcweir if ( !pRefWindow->mpWindowImpl->mpNext ) 7184cdf0e10cSrcweir mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this; 7185cdf0e10cSrcweir } 7186cdf0e10cSrcweir 7187cdf0e10cSrcweir mpWindowImpl->mpPrev = pRefWindow; 7188cdf0e10cSrcweir mpWindowImpl->mpNext = pRefWindow->mpWindowImpl->mpNext; 7189cdf0e10cSrcweir if ( mpWindowImpl->mpNext ) 7190cdf0e10cSrcweir mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this; 7191cdf0e10cSrcweir mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this; 7192cdf0e10cSrcweir } 7193cdf0e10cSrcweir 7194cdf0e10cSrcweir if ( IsReallyVisible() ) 7195cdf0e10cSrcweir { 7196cdf0e10cSrcweir // Hintergrund-Sicherung zuruecksetzen 7197cdf0e10cSrcweir if ( mpWindowImpl->mpFrameData->mpFirstBackWin ) 7198cdf0e10cSrcweir ImplInvalidateAllOverlapBackgrounds(); 7199cdf0e10cSrcweir 7200cdf0e10cSrcweir if ( mpWindowImpl->mbInitWinClipRegion || !mpWindowImpl->maWinClipRegion.IsEmpty() ) 7201cdf0e10cSrcweir { 7202cdf0e10cSrcweir sal_Bool bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion; 7203cdf0e10cSrcweir ImplSetClipFlag(); 7204cdf0e10cSrcweir 7205cdf0e10cSrcweir // Wenn ClipRegion noch nicht initalisiert wurde, dann 7206cdf0e10cSrcweir // gehen wir davon aus, das das Fenster noch nicht 7207cdf0e10cSrcweir // ausgegeben wurde und loesen somit auch keine 7208cdf0e10cSrcweir // Invalidates aus. Dies ist eine Optimierung fuer 7209cdf0e10cSrcweir // HTML-Dokumenten mit vielen Controls. Wenn es mal 7210cdf0e10cSrcweir // Probleme mit dieser Abfrage gibt, sollte man ein 7211cdf0e10cSrcweir // Flag einfuehren, ob das Fenster nach Show schon 7212cdf0e10cSrcweir // einmal ausgegeben wurde. 7213cdf0e10cSrcweir if ( !bInitWinClipRegion ) 7214cdf0e10cSrcweir { 7215cdf0e10cSrcweir // Alle nebeneinanderliegen Fenster invalidieren 7216cdf0e10cSrcweir // Noch nicht komplett implementiert !!! 7217cdf0e10cSrcweir Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 7218cdf0e10cSrcweir Window* pWindow = NULL; 7219cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 7220cdf0e10cSrcweir { 7221cdf0e10cSrcweir if ( mpWindowImpl->mpOverlapWindow ) 7222cdf0e10cSrcweir pWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap; 7223cdf0e10cSrcweir } 7224cdf0e10cSrcweir else 7225cdf0e10cSrcweir pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild; 7226cdf0e10cSrcweir // Alle Fenster, die vor uns liegen und von uns verdeckt wurden, 7227cdf0e10cSrcweir // invalidieren 7228cdf0e10cSrcweir while ( pWindow ) 7229cdf0e10cSrcweir { 7230cdf0e10cSrcweir if ( pWindow == this ) 7231cdf0e10cSrcweir break; 7232cdf0e10cSrcweir Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ), 7233cdf0e10cSrcweir Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) ); 7234cdf0e10cSrcweir if ( aWinRect.IsOver( aCompRect ) ) 7235cdf0e10cSrcweir pWindow->Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT ); 7236cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 7237cdf0e10cSrcweir } 7238cdf0e10cSrcweir // Wenn uns ein Fenster welches im Hinterund liegt verdeckt hat, 7239cdf0e10cSrcweir // dann muessen wir uns neu ausgeben 7240cdf0e10cSrcweir while ( pWindow ) 7241cdf0e10cSrcweir { 7242cdf0e10cSrcweir if ( pWindow != this ) 7243cdf0e10cSrcweir { 7244cdf0e10cSrcweir Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ), 7245cdf0e10cSrcweir Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) ); 7246cdf0e10cSrcweir if ( aWinRect.IsOver( aCompRect ) ) 7247cdf0e10cSrcweir { 7248cdf0e10cSrcweir Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT ); 7249cdf0e10cSrcweir break; 7250cdf0e10cSrcweir } 7251cdf0e10cSrcweir } 7252cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpNext; 7253cdf0e10cSrcweir } 7254cdf0e10cSrcweir } 7255cdf0e10cSrcweir } 7256cdf0e10cSrcweir } 7257cdf0e10cSrcweir } 7258cdf0e10cSrcweir 7259cdf0e10cSrcweir // ----------------------------------------------------------------------- 7260cdf0e10cSrcweir 7261cdf0e10cSrcweir void Window::EnableAlwaysOnTop( sal_Bool bEnable ) 7262cdf0e10cSrcweir { 7263cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7264cdf0e10cSrcweir 7265cdf0e10cSrcweir mpWindowImpl->mbAlwaysOnTop = bEnable; 7266cdf0e10cSrcweir 7267cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 7268cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->EnableAlwaysOnTop( bEnable ); 7269cdf0e10cSrcweir else if ( bEnable && IsReallyVisible() ) 7270cdf0e10cSrcweir ToTop(); 7271cdf0e10cSrcweir 7272cdf0e10cSrcweir if ( mpWindowImpl->mbFrame ) 7273cdf0e10cSrcweir mpWindowImpl->mpFrame->SetAlwaysOnTop( bEnable ); 7274cdf0e10cSrcweir } 7275cdf0e10cSrcweir 7276cdf0e10cSrcweir // ----------------------------------------------------------------------- 7277cdf0e10cSrcweir 7278cdf0e10cSrcweir void Window::SetPosSizePixel( long nX, long nY, 7279cdf0e10cSrcweir long nWidth, long nHeight, sal_uInt16 nFlags ) 7280cdf0e10cSrcweir { 7281cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7282cdf0e10cSrcweir 7283cdf0e10cSrcweir sal_Bool bHasValidSize = !mpWindowImpl->mbDefSize; 7284cdf0e10cSrcweir 7285cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_POS ) 7286cdf0e10cSrcweir mpWindowImpl->mbDefPos = sal_False; 7287cdf0e10cSrcweir if ( nFlags & WINDOW_POSSIZE_SIZE ) 7288cdf0e10cSrcweir mpWindowImpl->mbDefSize = sal_False; 7289cdf0e10cSrcweir 7290cdf0e10cSrcweir // Oberstes BorderWindow ist das Window, welches positioniert werden soll 7291cdf0e10cSrcweir Window* pWindow = this; 7292cdf0e10cSrcweir while ( pWindow->mpWindowImpl->mpBorderWindow ) 7293cdf0e10cSrcweir pWindow = pWindow->mpWindowImpl->mpBorderWindow; 7294cdf0e10cSrcweir 7295cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mbFrame ) 7296cdf0e10cSrcweir { 7297cdf0e10cSrcweir // Note: if we're positioning a frame, the coordinates are interpreted 7298cdf0e10cSrcweir // as being the top-left corner of the window's client area and NOT 7299cdf0e10cSrcweir // as the position of the border ! (due to limitations of several UNIX window managers) 7300cdf0e10cSrcweir long nOldWidth = pWindow->mnOutWidth; 7301cdf0e10cSrcweir 7302cdf0e10cSrcweir if ( !(nFlags & WINDOW_POSSIZE_WIDTH) ) 7303cdf0e10cSrcweir nWidth = pWindow->mnOutWidth; 7304cdf0e10cSrcweir if ( !(nFlags & WINDOW_POSSIZE_HEIGHT) ) 7305cdf0e10cSrcweir nHeight = pWindow->mnOutHeight; 7306cdf0e10cSrcweir 7307cdf0e10cSrcweir 7308cdf0e10cSrcweir sal_uInt16 nSysFlags=0; 7309cdf0e10cSrcweir if( nFlags & WINDOW_POSSIZE_WIDTH ) 7310cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_WIDTH; 7311cdf0e10cSrcweir if( nFlags & WINDOW_POSSIZE_HEIGHT ) 7312cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_HEIGHT; 7313cdf0e10cSrcweir if( nFlags & WINDOW_POSSIZE_X ) 7314cdf0e10cSrcweir { 7315cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_X; 7316cdf0e10cSrcweir if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) 7317cdf0e10cSrcweir { 7318cdf0e10cSrcweir Window* pParent = pWindow->GetParent(); 7319cdf0e10cSrcweir nX += pParent->mnOutOffX; 7320cdf0e10cSrcweir } 7321cdf0e10cSrcweir if( GetParent() && GetParent()->ImplIsAntiparallel() ) 7322cdf0e10cSrcweir { 7323cdf0e10cSrcweir // --- RTL --- (re-mirror at parent window) 7324cdf0e10cSrcweir Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); 7325cdf0e10cSrcweir GetParent()->ImplReMirror( aRect ); 7326cdf0e10cSrcweir nX = aRect.nLeft; 7327cdf0e10cSrcweir } 7328cdf0e10cSrcweir } 7329cdf0e10cSrcweir if( !(nFlags & WINDOW_POSSIZE_X) && bHasValidSize && pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth ) 7330cdf0e10cSrcweir { 7331cdf0e10cSrcweir // --- RTL --- make sure the old right aligned position is not changed 7332cdf0e10cSrcweir // system windows will always grow to the right 7333cdf0e10cSrcweir if( pWindow->GetParent() && pWindow->GetParent()->ImplHasMirroredGraphics() ) 7334cdf0e10cSrcweir { 7335cdf0e10cSrcweir long myWidth = nOldWidth; 7336cdf0e10cSrcweir if( !myWidth ) 7337cdf0e10cSrcweir myWidth = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth; 7338cdf0e10cSrcweir if( !myWidth ) 7339cdf0e10cSrcweir myWidth = nWidth; 7340cdf0e10cSrcweir nFlags |= WINDOW_POSSIZE_X; 7341cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_X; 7342cdf0e10cSrcweir nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - 7343cdf0e10cSrcweir mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration; 7344cdf0e10cSrcweir nX = pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration + 7345cdf0e10cSrcweir pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX; 7346cdf0e10cSrcweir if(!(nFlags & WINDOW_POSSIZE_Y)) 7347cdf0e10cSrcweir { 7348cdf0e10cSrcweir nFlags |= WINDOW_POSSIZE_Y; 7349cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_Y; 7350cdf0e10cSrcweir nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - 7351cdf0e10cSrcweir mpWindowImpl->mpFrame->GetUnmirroredGeometry().nTopDecoration; 7352cdf0e10cSrcweir } 7353cdf0e10cSrcweir } 7354cdf0e10cSrcweir } 7355cdf0e10cSrcweir if( nFlags & WINDOW_POSSIZE_Y ) 7356cdf0e10cSrcweir { 7357cdf0e10cSrcweir nSysFlags |= SAL_FRAME_POSSIZE_Y; 7358cdf0e10cSrcweir if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) 7359cdf0e10cSrcweir { 7360cdf0e10cSrcweir Window* pParent = pWindow->GetParent(); 7361cdf0e10cSrcweir nY += pParent->mnOutOffY; 7362cdf0e10cSrcweir } 7363cdf0e10cSrcweir } 7364cdf0e10cSrcweir 7365cdf0e10cSrcweir if( nSysFlags & (SAL_FRAME_POSSIZE_WIDTH|SAL_FRAME_POSSIZE_HEIGHT) ) 7366cdf0e10cSrcweir { 7367cdf0e10cSrcweir // check for min/max client size and adjust size accordingly 7368cdf0e10cSrcweir // otherwise it may happen that the resize event is ignored, i.e. the old size remains 7369cdf0e10cSrcweir // unchanged but ImplHandleResize() is called with the wrong size 7370cdf0e10cSrcweir SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow ); 7371cdf0e10cSrcweir if( pSystemWindow ) 7372cdf0e10cSrcweir { 7373cdf0e10cSrcweir Size aMinSize = pSystemWindow->GetMinOutputSizePixel(); 7374cdf0e10cSrcweir Size aMaxSize = pSystemWindow->GetMaxOutputSizePixel(); 7375cdf0e10cSrcweir if( nWidth < aMinSize.Width() ) 7376cdf0e10cSrcweir nWidth = aMinSize.Width(); 7377cdf0e10cSrcweir if( nHeight < aMinSize.Height() ) 7378cdf0e10cSrcweir nHeight = aMinSize.Height(); 7379cdf0e10cSrcweir 7380cdf0e10cSrcweir if( nWidth > aMaxSize.Width() ) 7381cdf0e10cSrcweir nWidth = aMaxSize.Width(); 7382cdf0e10cSrcweir if( nHeight > aMaxSize.Height() ) 7383cdf0e10cSrcweir nHeight = aMaxSize.Height(); 7384cdf0e10cSrcweir } 7385cdf0e10cSrcweir } 7386cdf0e10cSrcweir 7387cdf0e10cSrcweir pWindow->mpWindowImpl->mpFrame->SetPosSize( nX, nY, nWidth, nHeight, nSysFlags ); 7388cdf0e10cSrcweir 7389cdf0e10cSrcweir // Resize should be called directly. If we havn't 7390cdf0e10cSrcweir // set the correct size, we get a second resize from 739186e1cf34SPedro Giffuni // the system with the correct size. This can happen 7392cdf0e10cSrcweir // if the size is to small or to large. 7393cdf0e10cSrcweir ImplHandleResize( pWindow, nWidth, nHeight ); 7394cdf0e10cSrcweir } 7395cdf0e10cSrcweir else 7396cdf0e10cSrcweir { 7397cdf0e10cSrcweir pWindow->ImplPosSizeWindow( nX, nY, nWidth, nHeight, nFlags ); 7398cdf0e10cSrcweir if ( IsReallyVisible() ) 7399cdf0e10cSrcweir ImplGenerateMouseMove(); 7400cdf0e10cSrcweir } 7401cdf0e10cSrcweir } 7402cdf0e10cSrcweir 7403cdf0e10cSrcweir // ----------------------------------------------------------------------- 7404cdf0e10cSrcweir 7405cdf0e10cSrcweir Point Window::GetPosPixel() const 7406cdf0e10cSrcweir { 7407cdf0e10cSrcweir return mpWindowImpl->maPos; 7408cdf0e10cSrcweir } 7409cdf0e10cSrcweir 7410cdf0e10cSrcweir // ----------------------------------------------------------------------- 7411cdf0e10cSrcweir 7412cdf0e10cSrcweir Rectangle Window::GetDesktopRectPixel() const 7413cdf0e10cSrcweir { 7414cdf0e10cSrcweir Rectangle rRect; 7415cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrame->GetWorkArea( rRect ); 7416cdf0e10cSrcweir return rRect; 7417cdf0e10cSrcweir } 7418cdf0e10cSrcweir 7419cdf0e10cSrcweir // ----------------------------------------------------------------------- 7420cdf0e10cSrcweir 7421cdf0e10cSrcweir Point Window::OutputToScreenPixel( const Point& rPos ) const 7422cdf0e10cSrcweir { 7423cdf0e10cSrcweir // relative to top level parent 7424cdf0e10cSrcweir return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY ); 7425cdf0e10cSrcweir } 7426cdf0e10cSrcweir 7427cdf0e10cSrcweir // ----------------------------------------------------------------------- 7428cdf0e10cSrcweir 7429cdf0e10cSrcweir Point Window::ScreenToOutputPixel( const Point& rPos ) const 7430cdf0e10cSrcweir { 7431cdf0e10cSrcweir // relative to top level parent 7432cdf0e10cSrcweir return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY ); 7433cdf0e10cSrcweir } 7434cdf0e10cSrcweir 7435cdf0e10cSrcweir // ----------------------------------------------------------------------- 7436cdf0e10cSrcweir 7437cdf0e10cSrcweir long Window::ImplGetUnmirroredOutOffX() 7438cdf0e10cSrcweir { 7439cdf0e10cSrcweir // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow 7440cdf0e10cSrcweir long offx = mnOutOffX; 7441cdf0e10cSrcweir if( ImplHasMirroredGraphics() ) 7442cdf0e10cSrcweir { 7443cdf0e10cSrcweir if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) 7444cdf0e10cSrcweir { 7445cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 7446cdf0e10cSrcweir offx -= mpWindowImpl->mpParent->mnOutOffX; 7447cdf0e10cSrcweir 7448cdf0e10cSrcweir offx = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - offx; 7449cdf0e10cSrcweir 7450cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 7451cdf0e10cSrcweir offx += mpWindowImpl->mpParent->mnOutOffX; 7452cdf0e10cSrcweir 7453cdf0e10cSrcweir } 7454cdf0e10cSrcweir } 7455cdf0e10cSrcweir return offx; 7456cdf0e10cSrcweir } 7457cdf0e10cSrcweir 7458cdf0e10cSrcweir // normalized screen pixel are independent of mirroring 7459cdf0e10cSrcweir Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const 7460cdf0e10cSrcweir { 7461cdf0e10cSrcweir // relative to top level parent 7462cdf0e10cSrcweir long offx = ((Window*) this)->ImplGetUnmirroredOutOffX(); 7463cdf0e10cSrcweir return Point( rPos.X()+offx, rPos.Y()+mnOutOffY ); 7464cdf0e10cSrcweir } 7465cdf0e10cSrcweir 7466cdf0e10cSrcweir Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const 7467cdf0e10cSrcweir { 7468cdf0e10cSrcweir // relative to top level parent 7469cdf0e10cSrcweir long offx = ((Window*) this)->ImplGetUnmirroredOutOffX(); 7470cdf0e10cSrcweir return Point( rPos.X()-offx, rPos.Y()-mnOutOffY ); 7471cdf0e10cSrcweir } 7472cdf0e10cSrcweir 7473cdf0e10cSrcweir // ----------------------------------------------------------------------- 7474cdf0e10cSrcweir 7475cdf0e10cSrcweir Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const 7476cdf0e10cSrcweir { 7477cdf0e10cSrcweir // relative to the screen 7478cdf0e10cSrcweir Point p = OutputToScreenPixel( rPos ); 7479cdf0e10cSrcweir SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); 7480cdf0e10cSrcweir p.X() += g.nX; 7481cdf0e10cSrcweir p.Y() += g.nY; 7482cdf0e10cSrcweir return p; 7483cdf0e10cSrcweir } 7484cdf0e10cSrcweir 7485cdf0e10cSrcweir // ----------------------------------------------------------------------- 7486cdf0e10cSrcweir 7487cdf0e10cSrcweir Point Window::AbsoluteScreenToOutputPixel( const Point& rPos ) const 7488cdf0e10cSrcweir { 7489cdf0e10cSrcweir // relative to the screen 7490cdf0e10cSrcweir Point p = ScreenToOutputPixel( rPos ); 7491cdf0e10cSrcweir SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); 7492cdf0e10cSrcweir p.X() -= g.nX; 7493cdf0e10cSrcweir p.Y() -= g.nY; 7494cdf0e10cSrcweir return p; 7495cdf0e10cSrcweir } 7496cdf0e10cSrcweir 7497cdf0e10cSrcweir // ----------------------------------------------------------------------- 7498cdf0e10cSrcweir 7499cdf0e10cSrcweir Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rRect ) const 7500cdf0e10cSrcweir { 7501cdf0e10cSrcweir // this method creates unmirrored screen coordinates to be compared with the desktop 7502cdf0e10cSrcweir // and is used for positioning of RTL popup windows correctly on the screen 7503cdf0e10cSrcweir SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry(); 7504cdf0e10cSrcweir 7505cdf0e10cSrcweir Point p1 = OutputToScreenPixel( rRect.TopRight() ); 7506cdf0e10cSrcweir p1.X() = g.nX+g.nWidth-p1.X(); 7507cdf0e10cSrcweir p1.Y() += g.nY; 7508cdf0e10cSrcweir 7509cdf0e10cSrcweir Point p2 = OutputToScreenPixel( rRect.BottomLeft() ); 7510cdf0e10cSrcweir p2.X() = g.nX+g.nWidth-p2.X(); 7511cdf0e10cSrcweir p2.Y() += g.nY; 7512cdf0e10cSrcweir 7513cdf0e10cSrcweir return Rectangle( p1, p2 ); 7514cdf0e10cSrcweir } 7515cdf0e10cSrcweir 7516cdf0e10cSrcweir 7517cdf0e10cSrcweir // ----------------------------------------------------------------------- 7518cdf0e10cSrcweir 7519cdf0e10cSrcweir Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const 7520cdf0e10cSrcweir { 7521cdf0e10cSrcweir // with decoration 7522cdf0e10cSrcweir return ImplGetWindowExtentsRelative( pRelativeWindow, sal_False ); 7523cdf0e10cSrcweir } 7524cdf0e10cSrcweir 7525cdf0e10cSrcweir Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const 7526cdf0e10cSrcweir { 7527cdf0e10cSrcweir // without decoration 7528cdf0e10cSrcweir return ImplGetWindowExtentsRelative( pRelativeWindow, sal_True ); 7529cdf0e10cSrcweir } 7530cdf0e10cSrcweir 7531cdf0e10cSrcweir // ----------------------------------------------------------------------- 7532cdf0e10cSrcweir 7533cdf0e10cSrcweir Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, sal_Bool bClientOnly ) const 7534cdf0e10cSrcweir { 7535cdf0e10cSrcweir SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); 7536cdf0e10cSrcweir // make sure we use the extent of our border window, 7537cdf0e10cSrcweir // otherwise we miss a few pixels 7538cdf0e10cSrcweir const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; 7539cdf0e10cSrcweir 7540cdf0e10cSrcweir Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) ); 7541cdf0e10cSrcweir aPos.X() += g.nX; 7542cdf0e10cSrcweir aPos.Y() += g.nY; 7543cdf0e10cSrcweir Size aSize ( pWin->GetSizePixel() ); 7544cdf0e10cSrcweir // #104088# do not add decoration to the workwindow to be compatible to java accessibility api 7545cdf0e10cSrcweir if( !bClientOnly && (mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WINDOW_WORKWINDOW)) ) 7546cdf0e10cSrcweir { 7547cdf0e10cSrcweir aPos.X() -= g.nLeftDecoration; 7548cdf0e10cSrcweir aPos.Y() -= g.nTopDecoration; 7549cdf0e10cSrcweir aSize.Width() += g.nLeftDecoration + g.nRightDecoration; 7550cdf0e10cSrcweir aSize.Height() += g.nTopDecoration + g.nBottomDecoration; 7551cdf0e10cSrcweir } 7552cdf0e10cSrcweir if( pRelativeWindow ) 7553cdf0e10cSrcweir { 7554cdf0e10cSrcweir // #106399# express coordinates relative to borderwindow 7555cdf0e10cSrcweir Window *pRelWin = (!bClientOnly && pRelativeWindow->mpWindowImpl->mpBorderWindow) ? pRelativeWindow->mpWindowImpl->mpBorderWindow : pRelativeWindow; 7556cdf0e10cSrcweir aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos ); 7557cdf0e10cSrcweir } 7558cdf0e10cSrcweir return Rectangle( aPos, aSize ); 7559cdf0e10cSrcweir } 7560cdf0e10cSrcweir 7561cdf0e10cSrcweir // ----------------------------------------------------------------------- 7562cdf0e10cSrcweir 7563cdf0e10cSrcweir void Window::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags ) 7564cdf0e10cSrcweir { 7565cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7566cdf0e10cSrcweir 7567cdf0e10cSrcweir ImplScroll( Rectangle( Point( mnOutOffX, mnOutOffY ), 7568cdf0e10cSrcweir Size( mnOutWidth, mnOutHeight ) ), 7569cdf0e10cSrcweir nHorzScroll, nVertScroll, nFlags & ~SCROLL_CLIP ); 7570cdf0e10cSrcweir } 7571cdf0e10cSrcweir 7572cdf0e10cSrcweir // ----------------------------------------------------------------------- 7573cdf0e10cSrcweir 7574cdf0e10cSrcweir void Window::Scroll( long nHorzScroll, long nVertScroll, 7575cdf0e10cSrcweir const Rectangle& rRect, sal_uInt16 nFlags ) 7576cdf0e10cSrcweir { 7577cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7578cdf0e10cSrcweir 7579cdf0e10cSrcweir Rectangle aRect = ImplLogicToDevicePixel( rRect ); 7580cdf0e10cSrcweir aRect.Intersection( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) ); 7581cdf0e10cSrcweir if ( !aRect.IsEmpty() ) 7582cdf0e10cSrcweir ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags ); 7583cdf0e10cSrcweir } 7584cdf0e10cSrcweir 7585cdf0e10cSrcweir // ----------------------------------------------------------------------- 7586cdf0e10cSrcweir 7587cdf0e10cSrcweir void Window::Invalidate( sal_uInt16 nFlags ) 7588cdf0e10cSrcweir { 7589cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7590cdf0e10cSrcweir 7591cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7592cdf0e10cSrcweir return; 7593cdf0e10cSrcweir 7594cdf0e10cSrcweir ImplInvalidate( NULL, nFlags ); 7595cdf0e10cSrcweir } 7596cdf0e10cSrcweir 7597cdf0e10cSrcweir // ----------------------------------------------------------------------- 7598cdf0e10cSrcweir 7599cdf0e10cSrcweir void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) 7600cdf0e10cSrcweir { 7601cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7602cdf0e10cSrcweir 7603cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7604cdf0e10cSrcweir return; 7605cdf0e10cSrcweir 7606cdf0e10cSrcweir Rectangle aRect = ImplLogicToDevicePixel( rRect ); 7607cdf0e10cSrcweir if ( !aRect.IsEmpty() ) 7608cdf0e10cSrcweir { 7609cdf0e10cSrcweir Region aRegion( aRect ); 7610cdf0e10cSrcweir ImplInvalidate( &aRegion, nFlags ); 7611cdf0e10cSrcweir } 7612cdf0e10cSrcweir } 7613cdf0e10cSrcweir 7614cdf0e10cSrcweir // ----------------------------------------------------------------------- 7615cdf0e10cSrcweir 7616cdf0e10cSrcweir void Window::Invalidate( const Region& rRegion, sal_uInt16 nFlags ) 7617cdf0e10cSrcweir { 7618cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7619cdf0e10cSrcweir 7620cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7621cdf0e10cSrcweir return; 7622cdf0e10cSrcweir 7623cdf0e10cSrcweir if ( rRegion.IsNull() ) 7624cdf0e10cSrcweir ImplInvalidate( NULL, nFlags ); 7625cdf0e10cSrcweir else 7626cdf0e10cSrcweir { 7627cdf0e10cSrcweir Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); 7628cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 7629cdf0e10cSrcweir ImplInvalidate( &aRegion, nFlags ); 7630cdf0e10cSrcweir } 7631cdf0e10cSrcweir } 7632cdf0e10cSrcweir 7633cdf0e10cSrcweir // ----------------------------------------------------------------------- 7634cdf0e10cSrcweir 7635cdf0e10cSrcweir void Window::Validate( sal_uInt16 nFlags ) 7636cdf0e10cSrcweir { 7637cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7638cdf0e10cSrcweir 7639cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7640cdf0e10cSrcweir return; 7641cdf0e10cSrcweir 7642cdf0e10cSrcweir ImplValidate( NULL, nFlags ); 7643cdf0e10cSrcweir } 7644cdf0e10cSrcweir 7645cdf0e10cSrcweir // ----------------------------------------------------------------------- 7646cdf0e10cSrcweir 7647cdf0e10cSrcweir void Window::Validate( const Rectangle& rRect, sal_uInt16 nFlags ) 7648cdf0e10cSrcweir { 7649cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7650cdf0e10cSrcweir 7651cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7652cdf0e10cSrcweir return; 7653cdf0e10cSrcweir 7654cdf0e10cSrcweir Rectangle aRect = ImplLogicToDevicePixel( rRect ); 7655cdf0e10cSrcweir if ( !aRect.IsEmpty() ) 7656cdf0e10cSrcweir { 7657cdf0e10cSrcweir Region aRegion( aRect ); 7658cdf0e10cSrcweir ImplValidate( &aRegion, nFlags ); 7659cdf0e10cSrcweir } 7660cdf0e10cSrcweir } 7661cdf0e10cSrcweir 7662cdf0e10cSrcweir // ----------------------------------------------------------------------- 7663cdf0e10cSrcweir 7664cdf0e10cSrcweir void Window::Validate( const Region& rRegion, sal_uInt16 nFlags ) 7665cdf0e10cSrcweir { 7666cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7667cdf0e10cSrcweir 7668cdf0e10cSrcweir if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight ) 7669cdf0e10cSrcweir return; 7670cdf0e10cSrcweir 7671cdf0e10cSrcweir if ( rRegion.IsNull() ) 7672cdf0e10cSrcweir ImplValidate( NULL, nFlags ); 7673cdf0e10cSrcweir else 7674cdf0e10cSrcweir { 7675cdf0e10cSrcweir Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); 7676cdf0e10cSrcweir if ( !aRegion.IsEmpty() ) 7677cdf0e10cSrcweir ImplValidate( &aRegion, nFlags ); 7678cdf0e10cSrcweir } 7679cdf0e10cSrcweir } 7680cdf0e10cSrcweir 7681cdf0e10cSrcweir // ----------------------------------------------------------------------- 7682cdf0e10cSrcweir 7683cdf0e10cSrcweir sal_Bool Window::HasPaintEvent() const 7684cdf0e10cSrcweir { 7685cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7686cdf0e10cSrcweir 7687cdf0e10cSrcweir if ( !mpWindowImpl->mbReallyVisible ) 7688cdf0e10cSrcweir return sal_False; 7689cdf0e10cSrcweir 7690cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) 7691cdf0e10cSrcweir return sal_True; 7692cdf0e10cSrcweir 7693cdf0e10cSrcweir if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT ) 7694cdf0e10cSrcweir return sal_True; 7695cdf0e10cSrcweir 7696cdf0e10cSrcweir if ( !ImplIsOverlapWindow() ) 7697cdf0e10cSrcweir { 7698cdf0e10cSrcweir const Window* pTempWindow = this; 7699cdf0e10cSrcweir do 7700cdf0e10cSrcweir { 7701cdf0e10cSrcweir pTempWindow = pTempWindow->ImplGetParent(); 7702cdf0e10cSrcweir if ( pTempWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINTCHILDS | IMPL_PAINT_PAINTALLCHILDS) ) 7703cdf0e10cSrcweir return sal_True; 7704cdf0e10cSrcweir } 7705cdf0e10cSrcweir while ( !pTempWindow->ImplIsOverlapWindow() ); 7706cdf0e10cSrcweir } 7707cdf0e10cSrcweir 7708cdf0e10cSrcweir return sal_False; 7709cdf0e10cSrcweir } 7710cdf0e10cSrcweir 7711cdf0e10cSrcweir // ----------------------------------------------------------------------- 7712cdf0e10cSrcweir 7713cdf0e10cSrcweir void Window::Update() 7714cdf0e10cSrcweir { 7715cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7716cdf0e10cSrcweir 7717cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 7718cdf0e10cSrcweir { 7719cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->Update(); 7720cdf0e10cSrcweir return; 7721cdf0e10cSrcweir } 7722cdf0e10cSrcweir 7723cdf0e10cSrcweir if ( !mpWindowImpl->mbReallyVisible ) 7724cdf0e10cSrcweir return; 7725cdf0e10cSrcweir 7726cdf0e10cSrcweir sal_Bool bFlush = sal_False; 7727cdf0e10cSrcweir if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame ) 7728cdf0e10cSrcweir { 7729cdf0e10cSrcweir Point aPoint( 0, 0 ); 7730cdf0e10cSrcweir Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) ); 7731cdf0e10cSrcweir ImplInvalidateOverlapFrameRegion( aRegion ); 7732cdf0e10cSrcweir if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) 7733cdf0e10cSrcweir bFlush = sal_True; 7734cdf0e10cSrcweir } 7735cdf0e10cSrcweir 7736cdf0e10cSrcweir // Zuerst muessen wir alle Fenster ueberspringen, die Paint-Transparent 7737cdf0e10cSrcweir // sind 7738cdf0e10cSrcweir Window* pUpdateWindow = this; 7739cdf0e10cSrcweir Window* pWindow = pUpdateWindow; 7740cdf0e10cSrcweir while ( !pWindow->ImplIsOverlapWindow() ) 7741cdf0e10cSrcweir { 7742cdf0e10cSrcweir if ( !pWindow->mpWindowImpl->mbPaintTransparent ) 7743cdf0e10cSrcweir { 7744cdf0e10cSrcweir pUpdateWindow = pWindow; 7745cdf0e10cSrcweir break; 7746cdf0e10cSrcweir } 7747cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 7748cdf0e10cSrcweir } 7749cdf0e10cSrcweir // Ein Update wirkt immer auf das Window, wo PAINTALLCHILDS gesetzt 7750cdf0e10cSrcweir // ist, damit nicht zuviel gemalt wird 7751cdf0e10cSrcweir pWindow = pUpdateWindow; 7752cdf0e10cSrcweir do 7753cdf0e10cSrcweir { 7754cdf0e10cSrcweir if ( pWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS ) 7755cdf0e10cSrcweir pUpdateWindow = pWindow; 7756cdf0e10cSrcweir if ( pWindow->ImplIsOverlapWindow() ) 7757cdf0e10cSrcweir break; 7758cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 7759cdf0e10cSrcweir } 7760cdf0e10cSrcweir while ( pWindow ); 7761cdf0e10cSrcweir 7762cdf0e10cSrcweir // Wenn es etwas zu malen gibt, dann ein Paint ausloesen 7763cdf0e10cSrcweir if ( pUpdateWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) ) 7764cdf0e10cSrcweir { 7765cdf0e10cSrcweir // und fuer alle ueber uns stehende System-Fenster auch ein Update 7766cdf0e10cSrcweir // ausloesen, damit nicht die ganze Zeit luecken stehen bleiben 7767cdf0e10cSrcweir Window* pUpdateOverlapWindow = ImplGetFirstOverlapWindow()->mpWindowImpl->mpFirstOverlap; 7768cdf0e10cSrcweir while ( pUpdateOverlapWindow ) 7769cdf0e10cSrcweir { 7770cdf0e10cSrcweir pUpdateOverlapWindow->Update(); 7771cdf0e10cSrcweir pUpdateOverlapWindow = pUpdateOverlapWindow->mpWindowImpl->mpNext; 7772cdf0e10cSrcweir } 7773cdf0e10cSrcweir 7774cdf0e10cSrcweir pUpdateWindow->ImplCallPaint( NULL, pUpdateWindow->mpWindowImpl->mnPaintFlags ); 7775cdf0e10cSrcweir } 7776cdf0e10cSrcweir 7777cdf0e10cSrcweir if ( bFlush ) 7778cdf0e10cSrcweir Flush(); 7779cdf0e10cSrcweir } 7780cdf0e10cSrcweir 7781cdf0e10cSrcweir // ----------------------------------------------------------------------- 7782cdf0e10cSrcweir 7783cdf0e10cSrcweir void Window::Flush() 7784cdf0e10cSrcweir { 7785cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7786cdf0e10cSrcweir 7787cdf0e10cSrcweir const Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ); 7788cdf0e10cSrcweir mpWindowImpl->mpFrame->Flush( aWinRect ); 7789cdf0e10cSrcweir } 7790cdf0e10cSrcweir 7791cdf0e10cSrcweir // ----------------------------------------------------------------------- 7792cdf0e10cSrcweir 7793cdf0e10cSrcweir void Window::Sync() 7794cdf0e10cSrcweir { 7795cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7796cdf0e10cSrcweir 7797cdf0e10cSrcweir mpWindowImpl->mpFrame->Sync(); 7798cdf0e10cSrcweir } 7799cdf0e10cSrcweir 7800cdf0e10cSrcweir // ----------------------------------------------------------------------- 7801cdf0e10cSrcweir 7802cdf0e10cSrcweir void Window::SetUpdateMode( sal_Bool bUpdate ) 7803cdf0e10cSrcweir { 7804cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7805cdf0e10cSrcweir 7806cdf0e10cSrcweir mpWindowImpl->mbNoUpdate = !bUpdate; 7807cdf0e10cSrcweir StateChanged( STATE_CHANGE_UPDATEMODE ); 7808cdf0e10cSrcweir } 7809cdf0e10cSrcweir 7810cdf0e10cSrcweir // ----------------------------------------------------------------------- 7811cdf0e10cSrcweir 7812cdf0e10cSrcweir void Window::GrabFocus() 7813cdf0e10cSrcweir { 7814cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7815cdf0e10cSrcweir 7816cdf0e10cSrcweir ImplGrabFocus( 0 ); 7817cdf0e10cSrcweir } 7818cdf0e10cSrcweir 7819cdf0e10cSrcweir // ----------------------------------------------------------------------- 7820cdf0e10cSrcweir 7821cdf0e10cSrcweir sal_Bool Window::HasFocus() const 7822cdf0e10cSrcweir { 7823cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7824cdf0e10cSrcweir 7825cdf0e10cSrcweir // #107575# the first floating window always has the keyboard focus, see also winproc.cxx: ImplGetKeyInputWindow() 7826cdf0e10cSrcweir // task was shifted to 6.y, so its commented out 7827cdf0e10cSrcweir /* 7828cdf0e10cSrcweir Window* pFocusWin = ImplGetSVData()->maWinData.mpFirstFloat; 7829cdf0e10cSrcweir if( pFocusWin && pFocusWin->mpWindowImpl->mbFloatWin && ((FloatingWindow *)pFocusWin)->GrabsFocus() ) 7830cdf0e10cSrcweir pFocusWin = pFocusWin->GetPreferredKeyInputWindow(); 7831cdf0e10cSrcweir else 7832cdf0e10cSrcweir pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; 7833cdf0e10cSrcweir 7834cdf0e10cSrcweir return (this == pFocusWin); 7835cdf0e10cSrcweir */ 7836cdf0e10cSrcweir 7837cdf0e10cSrcweir return (this == ImplGetSVData()->maWinData.mpFocusWin); 7838cdf0e10cSrcweir } 7839cdf0e10cSrcweir 7840cdf0e10cSrcweir // ----------------------------------------------------------------------- 7841cdf0e10cSrcweir 7842cdf0e10cSrcweir void Window::GrabFocusToDocument() 7843cdf0e10cSrcweir { 7844cdf0e10cSrcweir Window *pWin = this; 7845cdf0e10cSrcweir while( pWin ) 7846cdf0e10cSrcweir { 7847cdf0e10cSrcweir if( !pWin->GetParent() ) 7848cdf0e10cSrcweir { 7849cdf0e10cSrcweir pWin->ImplGetFrameWindow()->GetWindow( WINDOW_CLIENT )->GrabFocus(); 7850cdf0e10cSrcweir return; 7851cdf0e10cSrcweir } 7852cdf0e10cSrcweir pWin = pWin->GetParent(); 7853cdf0e10cSrcweir } 7854cdf0e10cSrcweir } 7855cdf0e10cSrcweir 7856cdf0e10cSrcweir void Window::SetFakeFocus( bool bFocus ) 7857cdf0e10cSrcweir { 7858cdf0e10cSrcweir ImplGetWindowImpl()->mbFakeFocusSet = bFocus; 7859cdf0e10cSrcweir } 7860cdf0e10cSrcweir 7861cdf0e10cSrcweir // ----------------------------------------------------------------------- 7862cdf0e10cSrcweir 7863cdf0e10cSrcweir sal_Bool Window::HasChildPathFocus( sal_Bool bSystemWindow ) const 7864cdf0e10cSrcweir { 7865cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7866cdf0e10cSrcweir 7867cdf0e10cSrcweir // #107575#, the first floating window always has the keyboard focus, see also winproc.cxx: ImplGetKeyInputWindow() 7868cdf0e10cSrcweir // task was shifted to 6.y, so its commented out 7869cdf0e10cSrcweir /* 7870cdf0e10cSrcweir Window* pFocusWin = ImplGetSVData()->maWinData.mpFirstFloat; 7871cdf0e10cSrcweir if( pFocusWin && pFocusWin->mpWindowImpl->mbFloatWin && ((FloatingWindow *)pFocusWin)->GrabsFocus() ) 7872cdf0e10cSrcweir pFocusWin = pFocusWin->GetPreferredKeyInputWindow(); 7873cdf0e10cSrcweir else 7874cdf0e10cSrcweir pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; 7875cdf0e10cSrcweir */ 7876cdf0e10cSrcweir Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; 7877cdf0e10cSrcweir if ( pFocusWin ) 7878cdf0e10cSrcweir return ImplIsWindowOrChild( pFocusWin, bSystemWindow ); 7879cdf0e10cSrcweir return sal_False; 7880cdf0e10cSrcweir } 7881cdf0e10cSrcweir 7882cdf0e10cSrcweir // ----------------------------------------------------------------------- 7883cdf0e10cSrcweir 7884cdf0e10cSrcweir void Window::CaptureMouse() 7885cdf0e10cSrcweir { 7886cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7887cdf0e10cSrcweir 7888cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 7889cdf0e10cSrcweir 7890cdf0e10cSrcweir // Tracking evt. beenden 7891cdf0e10cSrcweir if ( pSVData->maWinData.mpTrackWin != this ) 7892cdf0e10cSrcweir { 7893cdf0e10cSrcweir if ( pSVData->maWinData.mpTrackWin ) 7894cdf0e10cSrcweir pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL ); 7895cdf0e10cSrcweir } 7896cdf0e10cSrcweir 7897cdf0e10cSrcweir if ( pSVData->maWinData.mpCaptureWin != this ) 7898cdf0e10cSrcweir { 7899cdf0e10cSrcweir pSVData->maWinData.mpCaptureWin = this; 7900cdf0e10cSrcweir mpWindowImpl->mpFrame->CaptureMouse( sal_True ); 7901cdf0e10cSrcweir } 7902cdf0e10cSrcweir } 7903cdf0e10cSrcweir 7904cdf0e10cSrcweir // ----------------------------------------------------------------------- 7905cdf0e10cSrcweir 7906cdf0e10cSrcweir void Window::ReleaseMouse() 7907cdf0e10cSrcweir { 7908cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7909cdf0e10cSrcweir 7910cdf0e10cSrcweir ImplSVData* pSVData = ImplGetSVData(); 7911cdf0e10cSrcweir 7912cdf0e10cSrcweir DBG_ASSERTWARNING( pSVData->maWinData.mpCaptureWin == this, 7913cdf0e10cSrcweir "Window::ReleaseMouse(): window doesn't have the mouse capture" ); 7914cdf0e10cSrcweir 7915cdf0e10cSrcweir if ( pSVData->maWinData.mpCaptureWin == this ) 7916cdf0e10cSrcweir { 7917cdf0e10cSrcweir pSVData->maWinData.mpCaptureWin = NULL; 7918cdf0e10cSrcweir mpWindowImpl->mpFrame->CaptureMouse( sal_False ); 7919cdf0e10cSrcweir ImplGenerateMouseMove(); 7920cdf0e10cSrcweir } 7921cdf0e10cSrcweir } 7922cdf0e10cSrcweir 7923cdf0e10cSrcweir // ----------------------------------------------------------------------- 7924cdf0e10cSrcweir 7925cdf0e10cSrcweir sal_Bool Window::IsMouseCaptured() const 7926cdf0e10cSrcweir { 7927cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7928cdf0e10cSrcweir 7929cdf0e10cSrcweir return (this == ImplGetSVData()->maWinData.mpCaptureWin); 7930cdf0e10cSrcweir } 7931cdf0e10cSrcweir 7932cdf0e10cSrcweir // ----------------------------------------------------------------------- 7933cdf0e10cSrcweir 7934cdf0e10cSrcweir void Window::SetPointer( const Pointer& rPointer ) 7935cdf0e10cSrcweir { 7936cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7937cdf0e10cSrcweir 7938cdf0e10cSrcweir if ( mpWindowImpl->maPointer == rPointer ) 7939cdf0e10cSrcweir return; 7940cdf0e10cSrcweir 7941cdf0e10cSrcweir mpWindowImpl->maPointer = rPointer; 7942cdf0e10cSrcweir 7943cdf0e10cSrcweir // Pointer evt. direkt umsetzen 7944cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) 7945cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); 7946cdf0e10cSrcweir } 7947cdf0e10cSrcweir 7948cdf0e10cSrcweir // ----------------------------------------------------------------------- 7949cdf0e10cSrcweir 7950cdf0e10cSrcweir void Window::EnableChildPointerOverwrite( sal_Bool bOverwrite ) 7951cdf0e10cSrcweir { 7952cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7953cdf0e10cSrcweir 7954cdf0e10cSrcweir if ( mpWindowImpl->mbChildPtrOverwrite == bOverwrite ) 7955cdf0e10cSrcweir return; 7956cdf0e10cSrcweir 7957cdf0e10cSrcweir mpWindowImpl->mbChildPtrOverwrite = bOverwrite; 7958cdf0e10cSrcweir 7959cdf0e10cSrcweir // Pointer evt. direkt umsetzen 7960cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) 7961cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); 7962cdf0e10cSrcweir } 7963cdf0e10cSrcweir 7964cdf0e10cSrcweir // ----------------------------------------------------------------------- 7965cdf0e10cSrcweir 7966cdf0e10cSrcweir void Window::SetPointerPosPixel( const Point& rPos ) 7967cdf0e10cSrcweir { 7968cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7969cdf0e10cSrcweir 7970cdf0e10cSrcweir Point aPos = ImplOutputToFrame( rPos ); 7971cdf0e10cSrcweir if( ImplHasMirroredGraphics() ) 7972cdf0e10cSrcweir { 7973cdf0e10cSrcweir if( !IsRTLEnabled() ) 7974cdf0e10cSrcweir { 7975cdf0e10cSrcweir // --- RTL --- (re-mirror mouse pos at this window) 7976cdf0e10cSrcweir ImplReMirror( aPos ); 7977cdf0e10cSrcweir } 7978cdf0e10cSrcweir // mirroring is required here, SetPointerPos bypasses SalGraphics 7979cdf0e10cSrcweir mpGraphics->mirror( aPos.X(), this ); 7980cdf0e10cSrcweir } 7981cdf0e10cSrcweir else if( ImplIsAntiparallel() ) 7982cdf0e10cSrcweir { 7983cdf0e10cSrcweir ImplReMirror( aPos ); 7984cdf0e10cSrcweir } 7985cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() ); 7986cdf0e10cSrcweir } 7987cdf0e10cSrcweir 7988cdf0e10cSrcweir // ----------------------------------------------------------------------- 7989cdf0e10cSrcweir 7990cdf0e10cSrcweir Point Window::GetPointerPosPixel() 7991cdf0e10cSrcweir { 7992cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 7993cdf0e10cSrcweir 7994cdf0e10cSrcweir Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); 7995cdf0e10cSrcweir if( ImplIsAntiparallel() ) 7996cdf0e10cSrcweir { 7997cdf0e10cSrcweir // --- RTL --- (re-mirror mouse pos at this window) 7998cdf0e10cSrcweir ImplReMirror( aPos ); 7999cdf0e10cSrcweir } 8000cdf0e10cSrcweir return ImplFrameToOutput( aPos ); 8001cdf0e10cSrcweir } 8002cdf0e10cSrcweir 8003cdf0e10cSrcweir // ----------------------------------------------------------------------- 8004cdf0e10cSrcweir 8005cdf0e10cSrcweir Point Window::GetLastPointerPosPixel() 8006cdf0e10cSrcweir { 8007cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8008cdf0e10cSrcweir 8009cdf0e10cSrcweir Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); 8010cdf0e10cSrcweir if( ImplIsAntiparallel() ) 8011cdf0e10cSrcweir { 8012cdf0e10cSrcweir // --- RTL --- (re-mirror mouse pos at this window) 8013cdf0e10cSrcweir ImplReMirror( aPos ); 8014cdf0e10cSrcweir } 8015cdf0e10cSrcweir return ImplFrameToOutput( aPos ); 8016cdf0e10cSrcweir } 8017cdf0e10cSrcweir 8018cdf0e10cSrcweir // ----------------------------------------------------------------------- 8019cdf0e10cSrcweir 8020cdf0e10cSrcweir void Window::ShowPointer( sal_Bool bVisible ) 8021cdf0e10cSrcweir { 8022cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8023cdf0e10cSrcweir 8024cdf0e10cSrcweir if ( mpWindowImpl->mbNoPtrVisible != !bVisible ) 8025cdf0e10cSrcweir { 8026cdf0e10cSrcweir mpWindowImpl->mbNoPtrVisible = !bVisible; 8027cdf0e10cSrcweir 8028cdf0e10cSrcweir // Pointer evt. direkt umsetzen 8029cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) 8030cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); 8031cdf0e10cSrcweir } 8032cdf0e10cSrcweir } 8033cdf0e10cSrcweir 8034cdf0e10cSrcweir // ----------------------------------------------------------------------- 8035cdf0e10cSrcweir 8036cdf0e10cSrcweir Window::PointerState Window::GetPointerState() 8037cdf0e10cSrcweir { 8038cdf0e10cSrcweir PointerState aState; 8039cdf0e10cSrcweir aState.mnState = 0; 8040cdf0e10cSrcweir 8041cdf0e10cSrcweir if (mpWindowImpl->mpFrame) 8042cdf0e10cSrcweir { 8043cdf0e10cSrcweir SalFrame::SalPointerState aSalPointerState; 8044cdf0e10cSrcweir 8045cdf0e10cSrcweir aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); 8046cdf0e10cSrcweir if( ImplIsAntiparallel() ) 8047cdf0e10cSrcweir { 8048cdf0e10cSrcweir // --- RTL --- (re-mirror mouse pos at this window) 8049cdf0e10cSrcweir ImplReMirror( aSalPointerState.maPos ); 8050cdf0e10cSrcweir } 8051cdf0e10cSrcweir aState.maPos = ImplFrameToOutput( aSalPointerState.maPos ); 8052cdf0e10cSrcweir aState.mnState = aSalPointerState.mnState; 8053cdf0e10cSrcweir } 8054cdf0e10cSrcweir return aState; 8055cdf0e10cSrcweir } 8056cdf0e10cSrcweir 8057cdf0e10cSrcweir // ----------------------------------------------------------------------- 8058cdf0e10cSrcweir 8059cdf0e10cSrcweir sal_Bool Window::IsMouseOver() 8060cdf0e10cSrcweir { 8061cdf0e10cSrcweir return ImplGetWinData()->mbMouseOver; 8062cdf0e10cSrcweir } 8063cdf0e10cSrcweir 8064cdf0e10cSrcweir // ----------------------------------------------------------------------- 8065cdf0e10cSrcweir 8066cdf0e10cSrcweir void Window::EnterWait() 8067cdf0e10cSrcweir { 8068cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8069cdf0e10cSrcweir 8070cdf0e10cSrcweir mpWindowImpl->mnWaitCount++; 8071cdf0e10cSrcweir 8072cdf0e10cSrcweir if ( mpWindowImpl->mnWaitCount == 1 ) 8073cdf0e10cSrcweir { 8074cdf0e10cSrcweir // Pointer evt. direkt umsetzen 8075cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) 8076cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); 8077cdf0e10cSrcweir } 8078cdf0e10cSrcweir } 8079cdf0e10cSrcweir 8080cdf0e10cSrcweir // ----------------------------------------------------------------------- 8081cdf0e10cSrcweir 8082cdf0e10cSrcweir void Window::LeaveWait() 8083cdf0e10cSrcweir { 8084cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8085cdf0e10cSrcweir 8086cdf0e10cSrcweir if ( mpWindowImpl->mnWaitCount ) 8087cdf0e10cSrcweir { 8088cdf0e10cSrcweir mpWindowImpl->mnWaitCount--; 8089cdf0e10cSrcweir 8090cdf0e10cSrcweir if ( !mpWindowImpl->mnWaitCount ) 8091cdf0e10cSrcweir { 8092cdf0e10cSrcweir // Pointer evt. direkt umsetzen 8093cdf0e10cSrcweir if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) 8094cdf0e10cSrcweir mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); 8095cdf0e10cSrcweir } 8096cdf0e10cSrcweir } 8097cdf0e10cSrcweir } 8098cdf0e10cSrcweir 8099cdf0e10cSrcweir // ----------------------------------------------------------------------- 8100cdf0e10cSrcweir 8101cdf0e10cSrcweir void Window::SetCursor( Cursor* pCursor ) 8102cdf0e10cSrcweir { 8103cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8104cdf0e10cSrcweir 8105cdf0e10cSrcweir if ( mpWindowImpl->mpCursor != pCursor ) 8106cdf0e10cSrcweir { 8107cdf0e10cSrcweir if ( mpWindowImpl->mpCursor ) 8108cdf0e10cSrcweir mpWindowImpl->mpCursor->ImplHide( true ); 8109cdf0e10cSrcweir mpWindowImpl->mpCursor = pCursor; 8110cdf0e10cSrcweir if ( pCursor ) 8111cdf0e10cSrcweir pCursor->ImplShow(); 8112cdf0e10cSrcweir } 8113cdf0e10cSrcweir } 8114cdf0e10cSrcweir 8115cdf0e10cSrcweir // ----------------------------------------------------------------------- 8116cdf0e10cSrcweir 8117cdf0e10cSrcweir void Window::SetText( const XubString& rStr ) 8118cdf0e10cSrcweir { 8119cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8120cdf0e10cSrcweir 8121cdf0e10cSrcweir String oldTitle( mpWindowImpl->maText ); 8122cdf0e10cSrcweir mpWindowImpl->maText = rStr; 8123cdf0e10cSrcweir 8124cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 8125cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->SetText( rStr ); 8126cdf0e10cSrcweir else if ( mpWindowImpl->mbFrame ) 8127cdf0e10cSrcweir mpWindowImpl->mpFrame->SetTitle( rStr ); 8128cdf0e10cSrcweir 8129cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle ); 8130cdf0e10cSrcweir 8131cdf0e10cSrcweir // #107247# needed for accessibility 8132cdf0e10cSrcweir // The VCLEVENT_WINDOW_FRAMETITLECHANGED is (mis)used to notify accessible name changes. 8133cdf0e10cSrcweir // Therefore a window, which is labeled by this window, must also notify an accessible 8134cdf0e10cSrcweir // name change. 8135cdf0e10cSrcweir if ( IsReallyVisible() ) 8136cdf0e10cSrcweir { 8137cdf0e10cSrcweir Window* pWindow = GetAccessibleRelationLabelFor(); 8138cdf0e10cSrcweir if ( pWindow && pWindow != this ) 8139cdf0e10cSrcweir pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle ); 8140cdf0e10cSrcweir } 8141cdf0e10cSrcweir 8142cdf0e10cSrcweir StateChanged( STATE_CHANGE_TEXT ); 8143cdf0e10cSrcweir } 8144cdf0e10cSrcweir 8145cdf0e10cSrcweir // ----------------------------------------------------------------------- 8146cdf0e10cSrcweir 8147cdf0e10cSrcweir String Window::GetText() const 8148cdf0e10cSrcweir { 8149cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8150cdf0e10cSrcweir 8151cdf0e10cSrcweir return mpWindowImpl->maText; 8152cdf0e10cSrcweir } 8153cdf0e10cSrcweir 8154cdf0e10cSrcweir // ----------------------------------------------------------------------- 8155cdf0e10cSrcweir 8156cdf0e10cSrcweir String Window::GetDisplayText() const 8157cdf0e10cSrcweir { 8158cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8159cdf0e10cSrcweir 8160cdf0e10cSrcweir return GetText(); 8161cdf0e10cSrcweir } 8162cdf0e10cSrcweir 8163cdf0e10cSrcweir // ----------------------------------------------------------------------- 8164cdf0e10cSrcweir 8165cdf0e10cSrcweir const Wallpaper& Window::GetDisplayBackground() const 8166cdf0e10cSrcweir { 8167cdf0e10cSrcweir // FIXME: fix issue 52349, need to fix this really in 8168cdf0e10cSrcweir // all NWF enabled controls 8169cdf0e10cSrcweir const ToolBox* pTB = dynamic_cast<const ToolBox*>(this); 8170cdf0e10cSrcweir if( pTB ) 8171cdf0e10cSrcweir { 8172cdf0e10cSrcweir if( IsNativeWidgetEnabled() ) 8173cdf0e10cSrcweir return pTB->ImplGetToolBoxPrivateData()->maDisplayBackground; 8174cdf0e10cSrcweir } 8175cdf0e10cSrcweir 8176cdf0e10cSrcweir if( !IsBackground() ) 8177cdf0e10cSrcweir { 8178cdf0e10cSrcweir if( mpWindowImpl->mpParent ) 8179cdf0e10cSrcweir return mpWindowImpl->mpParent->GetDisplayBackground(); 8180cdf0e10cSrcweir } 8181cdf0e10cSrcweir 8182cdf0e10cSrcweir const Wallpaper& rBack = GetBackground(); 8183cdf0e10cSrcweir if( ! rBack.IsBitmap() && 8184cdf0e10cSrcweir ! rBack.IsGradient() && 8185cdf0e10cSrcweir rBack.GetColor().GetColor() == COL_TRANSPARENT && 8186cdf0e10cSrcweir mpWindowImpl->mpParent ) 8187cdf0e10cSrcweir return mpWindowImpl->mpParent->GetDisplayBackground(); 8188cdf0e10cSrcweir return rBack; 8189cdf0e10cSrcweir } 8190cdf0e10cSrcweir 8191cdf0e10cSrcweir // ----------------------------------------------------------------------- 8192cdf0e10cSrcweir 8193cdf0e10cSrcweir const XubString& Window::GetHelpText() const 8194cdf0e10cSrcweir { 8195cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8196cdf0e10cSrcweir 8197cdf0e10cSrcweir String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); 8198cdf0e10cSrcweir bool bStrHelpId = (aStrHelpId.Len() > 0); 8199cdf0e10cSrcweir 8200cdf0e10cSrcweir if ( !mpWindowImpl->maHelpText.Len() && bStrHelpId ) 8201cdf0e10cSrcweir { 8202cdf0e10cSrcweir if ( !IsDialog() && (mpWindowImpl->mnType != WINDOW_TABPAGE) && (mpWindowImpl->mnType != WINDOW_FLOATINGWINDOW) ) 8203cdf0e10cSrcweir { 8204cdf0e10cSrcweir Help* pHelp = Application::GetHelp(); 8205cdf0e10cSrcweir if ( pHelp ) 8206cdf0e10cSrcweir { 8207cdf0e10cSrcweir ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this ); 8208cdf0e10cSrcweir mpWindowImpl->mbHelpTextDynamic = sal_False; 8209cdf0e10cSrcweir } 8210cdf0e10cSrcweir } 8211cdf0e10cSrcweir } 8212cdf0e10cSrcweir else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId ) 8213cdf0e10cSrcweir { 8214cdf0e10cSrcweir static const char* pEnv = getenv( "HELP_DEBUG" ); 8215cdf0e10cSrcweir if( pEnv && *pEnv ) 8216cdf0e10cSrcweir { 8217cdf0e10cSrcweir rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() ); 8218cdf0e10cSrcweir aTxt.append( mpWindowImpl->maHelpText ); 8219cdf0e10cSrcweir aTxt.appendAscii( "\n------------------\n" ); 8220cdf0e10cSrcweir aTxt.append( rtl::OUString( aStrHelpId ) ); 8221cdf0e10cSrcweir mpWindowImpl->maHelpText = aTxt.makeStringAndClear(); 8222cdf0e10cSrcweir } 8223cdf0e10cSrcweir mpWindowImpl->mbHelpTextDynamic = sal_False; 8224cdf0e10cSrcweir } 8225cdf0e10cSrcweir 8226cdf0e10cSrcweir return mpWindowImpl->maHelpText; 8227cdf0e10cSrcweir } 8228cdf0e10cSrcweir 8229cdf0e10cSrcweir // ----------------------------------------------------------------------- 8230cdf0e10cSrcweir 8231cdf0e10cSrcweir Window* Window::FindWindow( const Point& rPos ) const 8232cdf0e10cSrcweir { 8233cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8234cdf0e10cSrcweir 8235cdf0e10cSrcweir Point aPos = OutputToScreenPixel( rPos ); 8236cdf0e10cSrcweir return ((Window*)this)->ImplFindWindow( aPos ); 8237cdf0e10cSrcweir } 8238cdf0e10cSrcweir 8239cdf0e10cSrcweir // ----------------------------------------------------------------------- 8240cdf0e10cSrcweir 8241cdf0e10cSrcweir sal_uInt16 Window::GetChildCount() const 8242cdf0e10cSrcweir { 8243cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8244cdf0e10cSrcweir 8245cdf0e10cSrcweir sal_uInt16 nChildCount = 0; 8246cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 8247cdf0e10cSrcweir while ( pChild ) 8248cdf0e10cSrcweir { 8249cdf0e10cSrcweir nChildCount++; 8250cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 8251cdf0e10cSrcweir } 8252cdf0e10cSrcweir 8253cdf0e10cSrcweir return nChildCount; 8254cdf0e10cSrcweir } 8255cdf0e10cSrcweir 8256cdf0e10cSrcweir // ----------------------------------------------------------------------- 8257cdf0e10cSrcweir 8258cdf0e10cSrcweir Window* Window::GetChild( sal_uInt16 nChild ) const 8259cdf0e10cSrcweir { 8260cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8261cdf0e10cSrcweir 8262cdf0e10cSrcweir sal_uInt16 nChildCount = 0; 8263cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 8264cdf0e10cSrcweir while ( pChild ) 8265cdf0e10cSrcweir { 8266cdf0e10cSrcweir if ( nChild == nChildCount ) 8267cdf0e10cSrcweir return pChild; 8268cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 8269cdf0e10cSrcweir nChildCount++; 8270cdf0e10cSrcweir } 8271cdf0e10cSrcweir 8272cdf0e10cSrcweir return NULL; 8273cdf0e10cSrcweir } 8274cdf0e10cSrcweir 8275cdf0e10cSrcweir // ----------------------------------------------------------------------- 8276cdf0e10cSrcweir 8277cdf0e10cSrcweir Window* Window::GetWindow( sal_uInt16 nType ) const 8278cdf0e10cSrcweir { 8279cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8280cdf0e10cSrcweir 8281cdf0e10cSrcweir switch ( nType ) 8282cdf0e10cSrcweir { 8283cdf0e10cSrcweir case WINDOW_PARENT: 8284cdf0e10cSrcweir return mpWindowImpl->mpRealParent; 8285cdf0e10cSrcweir 8286cdf0e10cSrcweir case WINDOW_FIRSTCHILD: 8287cdf0e10cSrcweir return mpWindowImpl->mpFirstChild; 8288cdf0e10cSrcweir 8289cdf0e10cSrcweir case WINDOW_LASTCHILD: 8290cdf0e10cSrcweir return mpWindowImpl->mpLastChild; 8291cdf0e10cSrcweir 8292cdf0e10cSrcweir case WINDOW_PREV: 8293cdf0e10cSrcweir return mpWindowImpl->mpPrev; 8294cdf0e10cSrcweir 8295cdf0e10cSrcweir case WINDOW_NEXT: 8296cdf0e10cSrcweir return mpWindowImpl->mpNext; 8297cdf0e10cSrcweir 8298cdf0e10cSrcweir case WINDOW_FIRSTOVERLAP: 8299cdf0e10cSrcweir return mpWindowImpl->mpFirstOverlap; 8300cdf0e10cSrcweir 8301cdf0e10cSrcweir case WINDOW_LASTOVERLAP: 8302cdf0e10cSrcweir return mpWindowImpl->mpLastOverlap; 8303cdf0e10cSrcweir 8304cdf0e10cSrcweir case WINDOW_OVERLAP: 8305cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 8306cdf0e10cSrcweir return (Window*)this; 8307cdf0e10cSrcweir else 8308cdf0e10cSrcweir return mpWindowImpl->mpOverlapWindow; 8309cdf0e10cSrcweir 8310cdf0e10cSrcweir case WINDOW_PARENTOVERLAP: 8311cdf0e10cSrcweir if ( ImplIsOverlapWindow() ) 8312cdf0e10cSrcweir return mpWindowImpl->mpOverlapWindow; 8313cdf0e10cSrcweir else 8314cdf0e10cSrcweir return mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpOverlapWindow; 8315cdf0e10cSrcweir 8316cdf0e10cSrcweir case WINDOW_CLIENT: 8317cdf0e10cSrcweir return ((Window*)this)->ImplGetWindow(); 8318cdf0e10cSrcweir 8319cdf0e10cSrcweir case WINDOW_REALPARENT: 8320cdf0e10cSrcweir return ImplGetParent(); 8321cdf0e10cSrcweir 8322cdf0e10cSrcweir case WINDOW_FRAME: 8323cdf0e10cSrcweir return mpWindowImpl->mpFrameWindow; 8324cdf0e10cSrcweir 8325cdf0e10cSrcweir case WINDOW_BORDER: 8326cdf0e10cSrcweir if ( mpWindowImpl->mpBorderWindow ) 8327cdf0e10cSrcweir return mpWindowImpl->mpBorderWindow->GetWindow( WINDOW_BORDER ); 8328cdf0e10cSrcweir return (Window*)this; 8329cdf0e10cSrcweir 8330cdf0e10cSrcweir case WINDOW_FIRSTTOPWINDOWCHILD: 8331cdf0e10cSrcweir return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.begin(); 8332cdf0e10cSrcweir 8333cdf0e10cSrcweir case WINDOW_LASTTOPWINDOWCHILD: 8334cdf0e10cSrcweir return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.rbegin(); 8335cdf0e10cSrcweir 8336cdf0e10cSrcweir case WINDOW_PREVTOPWINDOWSIBLING: 8337cdf0e10cSrcweir { 8338cdf0e10cSrcweir if ( !mpWindowImpl->mpRealParent ) 8339cdf0e10cSrcweir return NULL; 8340cdf0e10cSrcweir const ::std::list< Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren ); 8341cdf0e10cSrcweir ::std::list< Window* >::const_iterator myPos = 8342cdf0e10cSrcweir ::std::find( rTopWindows.begin(), rTopWindows.end(), this ); 8343cdf0e10cSrcweir if ( myPos == rTopWindows.end() ) 8344cdf0e10cSrcweir return NULL; 8345cdf0e10cSrcweir if ( myPos == rTopWindows.begin() ) 8346cdf0e10cSrcweir return NULL; 8347cdf0e10cSrcweir return *--myPos; 8348cdf0e10cSrcweir } 8349cdf0e10cSrcweir 8350cdf0e10cSrcweir case WINDOW_NEXTTOPWINDOWSIBLING: 8351cdf0e10cSrcweir { 8352cdf0e10cSrcweir if ( !mpWindowImpl->mpRealParent ) 8353cdf0e10cSrcweir return NULL; 8354cdf0e10cSrcweir const ::std::list< Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren ); 8355cdf0e10cSrcweir ::std::list< Window* >::const_iterator myPos = 8356cdf0e10cSrcweir ::std::find( rTopWindows.begin(), rTopWindows.end(), this ); 8357cdf0e10cSrcweir if ( ( myPos == rTopWindows.end() ) || ( ++myPos == rTopWindows.end() ) ) 8358cdf0e10cSrcweir return NULL; 8359cdf0e10cSrcweir return *myPos; 8360cdf0e10cSrcweir } 8361cdf0e10cSrcweir 8362cdf0e10cSrcweir } 8363cdf0e10cSrcweir 8364cdf0e10cSrcweir return NULL; 8365cdf0e10cSrcweir } 8366cdf0e10cSrcweir 8367cdf0e10cSrcweir // ----------------------------------------------------------------------- 8368cdf0e10cSrcweir 8369cdf0e10cSrcweir sal_Bool Window::IsChild( const Window* pWindow, sal_Bool bSystemWindow ) const 8370cdf0e10cSrcweir { 8371cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8372cdf0e10cSrcweir DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow ); 8373cdf0e10cSrcweir 8374cdf0e10cSrcweir do 8375cdf0e10cSrcweir { 8376cdf0e10cSrcweir if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() ) 8377cdf0e10cSrcweir break; 8378cdf0e10cSrcweir 8379cdf0e10cSrcweir pWindow = pWindow->ImplGetParent(); 8380cdf0e10cSrcweir 8381cdf0e10cSrcweir if ( pWindow == this ) 8382cdf0e10cSrcweir return sal_True; 8383cdf0e10cSrcweir } 8384cdf0e10cSrcweir while ( pWindow ); 8385cdf0e10cSrcweir 8386cdf0e10cSrcweir return sal_False; 8387cdf0e10cSrcweir } 8388cdf0e10cSrcweir 8389cdf0e10cSrcweir // ----------------------------------------------------------------------- 8390cdf0e10cSrcweir 8391cdf0e10cSrcweir sal_Bool Window::IsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const 8392cdf0e10cSrcweir { 8393cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8394cdf0e10cSrcweir DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow ); 8395cdf0e10cSrcweir 8396cdf0e10cSrcweir if ( this == pWindow ) 8397cdf0e10cSrcweir return sal_True; 8398cdf0e10cSrcweir return ImplIsChild( pWindow, bSystemWindow ); 8399cdf0e10cSrcweir } 8400cdf0e10cSrcweir 8401cdf0e10cSrcweir // ----------------------------------------------------------------------- 8402cdf0e10cSrcweir 8403cdf0e10cSrcweir const SystemEnvData* Window::GetSystemData() const 8404cdf0e10cSrcweir { 8405cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8406cdf0e10cSrcweir 8407cdf0e10cSrcweir return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : NULL; 8408cdf0e10cSrcweir } 8409cdf0e10cSrcweir 8410cdf0e10cSrcweir ::com::sun::star::uno::Any Window::GetSystemDataAny() const 8411cdf0e10cSrcweir { 8412cdf0e10cSrcweir ::com::sun::star::uno::Any aRet; 8413cdf0e10cSrcweir const SystemEnvData* pSysData = GetSystemData(); 8414cdf0e10cSrcweir if( pSysData ) 8415cdf0e10cSrcweir { 8416cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize ); 8417cdf0e10cSrcweir aRet <<= aSeq; 8418cdf0e10cSrcweir } 8419cdf0e10cSrcweir return aRet; 8420cdf0e10cSrcweir } 8421cdf0e10cSrcweir 8422cdf0e10cSrcweir // ----------------------------------------------------------------------- 8423cdf0e10cSrcweir 8424cdf0e10cSrcweir void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow ) 8425cdf0e10cSrcweir { 8426cdf0e10cSrcweir // be safe against re-entrance: first clear the old ref, then assign the new one 8427cdf0e10cSrcweir // #133706# / 2006-03-30 / frank.schoenheit@sun.com 8428cdf0e10cSrcweir mpWindowImpl->mxWindowPeer.clear(); 8429cdf0e10cSrcweir mpWindowImpl->mxWindowPeer = xPeer; 8430cdf0e10cSrcweir 8431cdf0e10cSrcweir mpWindowImpl->mpVCLXWindow = pVCLXWindow; 8432cdf0e10cSrcweir } 8433cdf0e10cSrcweir 8434cdf0e10cSrcweir // ----------------------------------------------------------------------- 8435cdf0e10cSrcweir 8436cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( sal_Bool bCreate ) 8437cdf0e10cSrcweir { 8438cdf0e10cSrcweir if ( !mpWindowImpl->mxWindowPeer.is() && bCreate ) 8439cdf0e10cSrcweir { 8440cdf0e10cSrcweir UnoWrapperBase* pWrapper = Application::GetUnoWrapper(); 8441cdf0e10cSrcweir if ( pWrapper ) 8442cdf0e10cSrcweir mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this, sal_True ); 8443cdf0e10cSrcweir } 8444cdf0e10cSrcweir return mpWindowImpl->mxWindowPeer; 8445cdf0e10cSrcweir } 8446cdf0e10cSrcweir 8447cdf0e10cSrcweir // ----------------------------------------------------------------------- 8448cdf0e10cSrcweir 8449cdf0e10cSrcweir void Window::SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace ) 8450cdf0e10cSrcweir { 8451cdf0e10cSrcweir UnoWrapperBase* pWrapper = Application::GetUnoWrapper(); 8452cdf0e10cSrcweir DBG_ASSERT( pWrapper, "SetComponentInterface: No Wrapper!" ); 8453cdf0e10cSrcweir if ( pWrapper ) 8454cdf0e10cSrcweir pWrapper->SetWindowInterface( this, xIFace ); 8455cdf0e10cSrcweir } 8456cdf0e10cSrcweir 8457cdf0e10cSrcweir // ----------------------------------------------------------------------- 8458cdf0e10cSrcweir 8459cdf0e10cSrcweir void Window::ImplCallDeactivateListeners( Window *pNew ) 8460cdf0e10cSrcweir { 8461cdf0e10cSrcweir // no deactivation if the the newly activated window is my child 8462cdf0e10cSrcweir if ( !pNew || !ImplIsChild( pNew ) ) 8463cdf0e10cSrcweir { 8464cdf0e10cSrcweir ImplDelData aDogtag( this ); 8465cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_DEACTIVATE ); 8466cdf0e10cSrcweir if( aDogtag.IsDelete() ) 8467cdf0e10cSrcweir return; 8468cdf0e10cSrcweir 8469cdf0e10cSrcweir // #100759#, avoid walking the wrong frame's hierarchy 8470cdf0e10cSrcweir // eg, undocked docking windows (ImplDockFloatWin) 8471cdf0e10cSrcweir if ( ImplGetParent() && mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow ) 8472cdf0e10cSrcweir ImplGetParent()->ImplCallDeactivateListeners( pNew ); 8473cdf0e10cSrcweir } 8474cdf0e10cSrcweir } 8475cdf0e10cSrcweir 8476cdf0e10cSrcweir // ----------------------------------------------------------------------- 8477cdf0e10cSrcweir 8478cdf0e10cSrcweir void Window::ImplCallActivateListeners( Window *pOld ) 8479cdf0e10cSrcweir { 8480cdf0e10cSrcweir // no activation if the the old active window is my child 8481cdf0e10cSrcweir if ( !pOld || !ImplIsChild( pOld ) ) 8482cdf0e10cSrcweir { 8483cdf0e10cSrcweir ImplDelData aDogtag( this ); 8484cdf0e10cSrcweir ImplCallEventListeners( VCLEVENT_WINDOW_ACTIVATE, pOld ); 8485cdf0e10cSrcweir if( aDogtag.IsDelete() ) 8486cdf0e10cSrcweir return; 8487cdf0e10cSrcweir 8488cdf0e10cSrcweir // #106298# revoke the change for 105369, because this change 8489cdf0e10cSrcweir // disabled the activate event for the parent, 8490cdf0e10cSrcweir // if the parent is a compound control 8491cdf0e10cSrcweir //if( !GetParent() || !GetParent()->IsCompoundControl() ) 8492cdf0e10cSrcweir //{ 8493cdf0e10cSrcweir // #100759#, avoid walking the wrong frame's hierarchy 8494cdf0e10cSrcweir // eg, undocked docking windows (ImplDockFloatWin) 8495cdf0e10cSrcweir // #104714#, revert the changes for 100759 because it has a side effect when pOld is a dialog 8496cdf0e10cSrcweir // additionally the gallery is not dockable anymore, so 100759 canot occur 8497cdf0e10cSrcweir if ( ImplGetParent() ) /* && mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow ) */ 8498cdf0e10cSrcweir ImplGetParent()->ImplCallActivateListeners( pOld ); 8499cdf0e10cSrcweir else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 ) 8500cdf0e10cSrcweir { 8501cdf0e10cSrcweir // top level frame reached: store hint for DefModalDialogParent 8502cdf0e10cSrcweir ImplGetSVData()->maWinData.mpActiveApplicationFrame = mpWindowImpl->mpFrameWindow; 8503cdf0e10cSrcweir } 8504cdf0e10cSrcweir //} 8505cdf0e10cSrcweir } 8506cdf0e10cSrcweir } 8507cdf0e10cSrcweir 8508cdf0e10cSrcweir // ----------------------------------------------------------------------- 8509cdf0e10cSrcweir 8510cdf0e10cSrcweir bool Window::ImplStopDnd() 8511cdf0e10cSrcweir { 8512cdf0e10cSrcweir bool bRet = false; 8513cdf0e10cSrcweir if( mpWindowImpl->mpFrameData && mpWindowImpl->mpFrameData->mxDropTargetListener.is() ) 8514cdf0e10cSrcweir { 8515cdf0e10cSrcweir bRet = true; 8516cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget.clear(); 8517cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDragSource.clear(); 8518cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTargetListener.clear(); 8519cdf0e10cSrcweir } 8520cdf0e10cSrcweir 8521cdf0e10cSrcweir return bRet; 8522cdf0e10cSrcweir } 8523cdf0e10cSrcweir 8524cdf0e10cSrcweir // ----------------------------------------------------------------------- 8525cdf0e10cSrcweir 8526cdf0e10cSrcweir void Window::ImplStartDnd() 8527cdf0e10cSrcweir { 8528cdf0e10cSrcweir GetDropTarget(); 8529cdf0e10cSrcweir } 8530cdf0e10cSrcweir 8531cdf0e10cSrcweir // ----------------------------------------------------------------------- 8532cdf0e10cSrcweir 8533cdf0e10cSrcweir uno::Reference< XDropTarget > Window::GetDropTarget() 8534cdf0e10cSrcweir { 8535cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8536cdf0e10cSrcweir 8537cdf0e10cSrcweir if( ! mpWindowImpl->mxDNDListenerContainer.is() ) 8538cdf0e10cSrcweir { 8539cdf0e10cSrcweir sal_Int8 nDefaultActions = 0; 8540cdf0e10cSrcweir 8541cdf0e10cSrcweir if( mpWindowImpl->mpFrameData ) 8542cdf0e10cSrcweir { 8543cdf0e10cSrcweir if( ! mpWindowImpl->mpFrameData->mxDropTarget.is() ) 8544cdf0e10cSrcweir { 8545cdf0e10cSrcweir // initialization is done in GetDragSource 8546cdf0e10cSrcweir uno::Reference< XDragSource > xDragSource = GetDragSource(); 8547cdf0e10cSrcweir } 8548cdf0e10cSrcweir 8549cdf0e10cSrcweir if( mpWindowImpl->mpFrameData->mxDropTarget.is() ) 8550cdf0e10cSrcweir { 8551cdf0e10cSrcweir nDefaultActions = mpWindowImpl->mpFrameData->mxDropTarget->getDefaultActions(); 8552cdf0e10cSrcweir 8553cdf0e10cSrcweir if( ! mpWindowImpl->mpFrameData->mxDropTargetListener.is() ) 8554cdf0e10cSrcweir { 8555cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTargetListener = new DNDEventDispatcher( mpWindowImpl->mpFrameWindow ); 8556cdf0e10cSrcweir 8557cdf0e10cSrcweir try 8558cdf0e10cSrcweir { 8559cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget->addDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener ); 8560cdf0e10cSrcweir 8561cdf0e10cSrcweir // register also as drag gesture listener if directly supported by drag source 8562cdf0e10cSrcweir uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer = 8563cdf0e10cSrcweir uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY); 8564cdf0e10cSrcweir 8565cdf0e10cSrcweir if( xDragGestureRecognizer.is() ) 8566cdf0e10cSrcweir { 8567cdf0e10cSrcweir xDragGestureRecognizer->addDragGestureListener( 8568cdf0e10cSrcweir uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY)); 8569cdf0e10cSrcweir } 8570cdf0e10cSrcweir else 8571cdf0e10cSrcweir mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True; 8572cdf0e10cSrcweir 8573cdf0e10cSrcweir } 8574cdf0e10cSrcweir 8575adad3ae8SHerbert Dürr catch( RuntimeException&) 8576cdf0e10cSrcweir { 8577cdf0e10cSrcweir // release all instances 8578cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget.clear(); 8579cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDragSource.clear(); 8580cdf0e10cSrcweir } 8581cdf0e10cSrcweir } 8582cdf0e10cSrcweir } 8583cdf0e10cSrcweir 8584cdf0e10cSrcweir } 8585cdf0e10cSrcweir 8586cdf0e10cSrcweir mpWindowImpl->mxDNDListenerContainer = static_cast < XDropTarget * > ( new DNDListenerContainer( nDefaultActions ) ); 8587cdf0e10cSrcweir } 8588cdf0e10cSrcweir 8589cdf0e10cSrcweir // this object is located in the same process, so there will be no runtime exception 8590cdf0e10cSrcweir return uno::Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY ); 8591cdf0e10cSrcweir } 8592cdf0e10cSrcweir 8593cdf0e10cSrcweir // ----------------------------------------------------------------------- 8594cdf0e10cSrcweir 8595cdf0e10cSrcweir uno::Reference< XDragSource > Window::GetDragSource() 8596cdf0e10cSrcweir { 8597cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8598cdf0e10cSrcweir 8599cdf0e10cSrcweir if( mpWindowImpl->mpFrameData ) 8600cdf0e10cSrcweir { 8601cdf0e10cSrcweir if( ! mpWindowImpl->mpFrameData->mxDragSource.is() ) 8602cdf0e10cSrcweir { 8603cdf0e10cSrcweir try 8604cdf0e10cSrcweir { 8605cdf0e10cSrcweir uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); 8606cdf0e10cSrcweir if ( xFactory.is() ) 8607cdf0e10cSrcweir { 8608cdf0e10cSrcweir const SystemEnvData * pEnvData = GetSystemData(); 8609cdf0e10cSrcweir 8610cdf0e10cSrcweir if( pEnvData ) 8611cdf0e10cSrcweir { 8612cdf0e10cSrcweir Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 ); 8613cdf0e10cSrcweir OUString aDragSourceSN, aDropTargetSN; 8614cc13e73eSYuri Dario #if defined WNT || defined OS2 8615cdf0e10cSrcweir aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" ); 8616cdf0e10cSrcweir aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" ); 8617cdf0e10cSrcweir aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); 8618cdf0e10cSrcweir aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd ); 8619cdf0e10cSrcweir #elif defined QUARTZ 8620cdf0e10cSrcweir /* FIXME: Mac OS X specific dnd interface does not exist! * 8621cdf0e10cSrcweir * Using Windows based dnd as a temporary solution */ 8622cdf0e10cSrcweir aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" ); 8623cdf0e10cSrcweir aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" ); 8624bde8a4bdSHerbert Dürr aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->mpNSView) ) ); 8625bde8a4bdSHerbert Dürr aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->mpNSView) ) ); 8626cdf0e10cSrcweir #elif defined UNX 8627cdf0e10cSrcweir aDropTargetAL.realloc( 3 ); 8628cdf0e10cSrcweir aDragSourceAL.realloc( 3 ); 8629cdf0e10cSrcweir aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DragSource" ); 8630cdf0e10cSrcweir aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DropTarget" ); 8631cdf0e10cSrcweir 8632cdf0e10cSrcweir aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); 8633cdf0e10cSrcweir aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() ); 8634cdf0e10cSrcweir aDropTargetAL[ 0 ] = makeAny( Application::GetDisplayConnection() ); 8635cdf0e10cSrcweir aDropTargetAL[ 1 ] = makeAny( (sal_Size)(pEnvData->aShellWindow) ); 8636cdf0e10cSrcweir aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() ); 8637cdf0e10cSrcweir #endif 8638cdf0e10cSrcweir if( aDragSourceSN.getLength() ) 8639cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY ); 8640cdf0e10cSrcweir 8641cdf0e10cSrcweir if( aDropTargetSN.getLength() ) 8642cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY ); 8643cdf0e10cSrcweir } 8644cdf0e10cSrcweir } 8645cdf0e10cSrcweir } 8646cdf0e10cSrcweir 8647cdf0e10cSrcweir // createInstance can throw any exception 8648adad3ae8SHerbert Dürr catch( Exception&) 8649cdf0e10cSrcweir { 8650cdf0e10cSrcweir // release all instances 8651cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDropTarget.clear(); 8652cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxDragSource.clear(); 8653cdf0e10cSrcweir } 8654cdf0e10cSrcweir } 8655cdf0e10cSrcweir 8656cdf0e10cSrcweir return mpWindowImpl->mpFrameData->mxDragSource; 8657cdf0e10cSrcweir } 8658cdf0e10cSrcweir 8659cdf0e10cSrcweir return uno::Reference< XDragSource > (); 8660cdf0e10cSrcweir } 8661cdf0e10cSrcweir 8662cdf0e10cSrcweir // ----------------------------------------------------------------------- 8663cdf0e10cSrcweir 8664cdf0e10cSrcweir void Window::GetDragSourceDropTarget(uno::Reference< XDragSource >& xDragSource, uno::Reference< XDropTarget > &xDropTarget ) 8665cdf0e10cSrcweir // only for RVP transmission 8666cdf0e10cSrcweir { 8667cdf0e10cSrcweir if( mpWindowImpl->mpFrameData ) 8668cdf0e10cSrcweir { 8669cdf0e10cSrcweir // initialization is done in GetDragSource 8670cdf0e10cSrcweir xDragSource = GetDragSource(); 8671cdf0e10cSrcweir xDropTarget = mpWindowImpl->mpFrameData->mxDropTarget; 8672cdf0e10cSrcweir } 8673cdf0e10cSrcweir else 8674cdf0e10cSrcweir { 8675cdf0e10cSrcweir xDragSource.clear(); 8676cdf0e10cSrcweir xDropTarget.clear(); 8677cdf0e10cSrcweir } 8678cdf0e10cSrcweir } 8679cdf0e10cSrcweir 8680cdf0e10cSrcweir // ----------------------------------------------------------------------- 8681cdf0e10cSrcweir 8682cdf0e10cSrcweir uno::Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer() 8683cdf0e10cSrcweir { 8684cdf0e10cSrcweir return uno::Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY ); 8685cdf0e10cSrcweir } 8686cdf0e10cSrcweir 8687cdf0e10cSrcweir // ----------------------------------------------------------------------- 8688cdf0e10cSrcweir 8689cdf0e10cSrcweir uno::Reference< XClipboard > Window::GetClipboard() 8690cdf0e10cSrcweir { 8691cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8692cdf0e10cSrcweir 8693cdf0e10cSrcweir if( mpWindowImpl->mpFrameData ) 8694cdf0e10cSrcweir { 8695cdf0e10cSrcweir if( ! mpWindowImpl->mpFrameData->mxClipboard.is() ) 8696cdf0e10cSrcweir { 8697cdf0e10cSrcweir try 8698cdf0e10cSrcweir { 8699cdf0e10cSrcweir uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); 8700cdf0e10cSrcweir 8701cdf0e10cSrcweir if( xFactory.is() ) 8702cdf0e10cSrcweir { 8703cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY ); 8704cdf0e10cSrcweir 8705cdf0e10cSrcweir if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) 8706cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); 8707cdf0e10cSrcweir 8708cdf0e10cSrcweir #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized 8709cdf0e10cSrcweir if( mpWindowImpl->mpFrameData->mxClipboard.is() ) 8710cdf0e10cSrcweir { 8711cdf0e10cSrcweir uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY ); 8712cdf0e10cSrcweir 8713cdf0e10cSrcweir if( xInit.is() ) 8714cdf0e10cSrcweir { 8715cdf0e10cSrcweir Sequence< Any > aArgumentList( 3 ); 8716cdf0e10cSrcweir aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); 8717cdf0e10cSrcweir aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "CLIPBOARD" ) ); 8718cdf0e10cSrcweir aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); 8719cdf0e10cSrcweir 8720cdf0e10cSrcweir xInit->initialize( aArgumentList ); 8721cdf0e10cSrcweir } 8722cdf0e10cSrcweir } 8723cdf0e10cSrcweir #endif 8724cdf0e10cSrcweir } 8725cdf0e10cSrcweir } 8726cdf0e10cSrcweir 8727cdf0e10cSrcweir // createInstance can throw any exception 8728adad3ae8SHerbert Dürr catch( Exception&) 8729cdf0e10cSrcweir { 8730cdf0e10cSrcweir // release all instances 8731cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxClipboard.clear(); 8732cdf0e10cSrcweir } 8733cdf0e10cSrcweir } 8734cdf0e10cSrcweir 8735cdf0e10cSrcweir return mpWindowImpl->mpFrameData->mxClipboard; 8736cdf0e10cSrcweir } 8737cdf0e10cSrcweir 8738cdf0e10cSrcweir return static_cast < XClipboard * > (0); 8739cdf0e10cSrcweir } 8740cdf0e10cSrcweir 8741cdf0e10cSrcweir // ----------------------------------------------------------------------- 8742cdf0e10cSrcweir 8743cdf0e10cSrcweir uno::Reference< XClipboard > Window::GetPrimarySelection() 8744cdf0e10cSrcweir { 8745cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8746cdf0e10cSrcweir 8747cdf0e10cSrcweir if( mpWindowImpl->mpFrameData ) 8748cdf0e10cSrcweir { 8749cdf0e10cSrcweir if( ! mpWindowImpl->mpFrameData->mxSelection.is() ) 8750cdf0e10cSrcweir { 8751cdf0e10cSrcweir try 8752cdf0e10cSrcweir { 8753cdf0e10cSrcweir uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() ); 8754cdf0e10cSrcweir 8755cdf0e10cSrcweir if( xFactory.is() ) 8756cdf0e10cSrcweir { 8757cdf0e10cSrcweir #if defined(UNX) && !defined(QUARTZ) 8758cdf0e10cSrcweir Sequence< Any > aArgumentList( 3 ); 8759cdf0e10cSrcweir aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() ); 8760cdf0e10cSrcweir aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) ); 8761cdf0e10cSrcweir aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() ); 8762cdf0e10cSrcweir 8763cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments( 8764cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ), aArgumentList ), UNO_QUERY ); 8765cdf0e10cSrcweir # else 8766cdf0e10cSrcweir static uno::Reference< XClipboard > s_xSelection; 8767cdf0e10cSrcweir 8768cdf0e10cSrcweir if ( !s_xSelection.is() ) 8769cdf0e10cSrcweir s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY ); 8770cdf0e10cSrcweir 8771cdf0e10cSrcweir if ( !s_xSelection.is() ) 8772cdf0e10cSrcweir s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY ); 8773cdf0e10cSrcweir 8774cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxSelection = s_xSelection; 8775cdf0e10cSrcweir # endif 8776cdf0e10cSrcweir } 8777cdf0e10cSrcweir } 8778cdf0e10cSrcweir 8779cdf0e10cSrcweir // createInstance can throw any exception 8780adad3ae8SHerbert Dürr catch( Exception&) 8781cdf0e10cSrcweir { 8782cdf0e10cSrcweir // release all instances 8783cdf0e10cSrcweir mpWindowImpl->mpFrameData->mxSelection.clear(); 8784cdf0e10cSrcweir } 8785cdf0e10cSrcweir } 8786cdf0e10cSrcweir 8787cdf0e10cSrcweir return mpWindowImpl->mpFrameData->mxSelection; 8788cdf0e10cSrcweir } 8789cdf0e10cSrcweir 8790cdf0e10cSrcweir return static_cast < XClipboard * > (0); 8791cdf0e10cSrcweir } 8792cdf0e10cSrcweir 8793cdf0e10cSrcweir // ----------------------------------------------------------------------- 8794cdf0e10cSrcweir // Accessibility 8795cdf0e10cSrcweir // ----------------------------------------------------------------------- 8796cdf0e10cSrcweir 8797cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::GetAccessible( sal_Bool bCreate ) 8798cdf0e10cSrcweir { 8799cdf0e10cSrcweir // do not optimize hierarchy for the top level border win (ie, when there is no parent) 8800cdf0e10cSrcweir /* // do not optimize accessible hierarchy at all to better reflect real VCL hierarchy 8801cdf0e10cSrcweir if ( GetParent() && ( GetType() == WINDOW_BORDERWINDOW ) && ( GetChildCount() == 1 ) ) 8802cdf0e10cSrcweir //if( !ImplIsAccessibleCandidate() ) 8803cdf0e10cSrcweir { 8804cdf0e10cSrcweir Window* pChild = GetAccessibleChildWindow( 0 ); 8805cdf0e10cSrcweir if ( pChild ) 8806cdf0e10cSrcweir return pChild->GetAccessible(); 8807cdf0e10cSrcweir } 8808cdf0e10cSrcweir */ 8809cdf0e10cSrcweir if ( !mpWindowImpl->mxAccessible.is() && bCreate ) 8810cdf0e10cSrcweir mpWindowImpl->mxAccessible = CreateAccessible(); 8811cdf0e10cSrcweir 8812cdf0e10cSrcweir return mpWindowImpl->mxAccessible; 8813cdf0e10cSrcweir } 8814cdf0e10cSrcweir 8815cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::CreateAccessible() 8816cdf0e10cSrcweir { 8817cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc( GetComponentInterface( sal_True ), ::com::sun::star::uno::UNO_QUERY ); 8818cdf0e10cSrcweir return xAcc; 8819cdf0e10cSrcweir } 8820cdf0e10cSrcweir 8821cdf0e10cSrcweir void Window::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > x ) 8822cdf0e10cSrcweir { 8823cdf0e10cSrcweir mpWindowImpl->mxAccessible = x; 8824cdf0e10cSrcweir } 8825cdf0e10cSrcweir 8826cdf0e10cSrcweir // skip all border windows that are no top level frames 8827cdf0e10cSrcweir sal_Bool Window::ImplIsAccessibleCandidate() const 8828cdf0e10cSrcweir { 8829cdf0e10cSrcweir if( !mpWindowImpl->mbBorderWin ) 8830cdf0e10cSrcweir return sal_True; 8831cdf0e10cSrcweir else 8832cdf0e10cSrcweir // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menues!) are closeable 8833cdf0e10cSrcweir if( mpWindowImpl->mbFrame && mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) 8834cdf0e10cSrcweir return sal_True; 8835cdf0e10cSrcweir else 8836cdf0e10cSrcweir return sal_False; 8837cdf0e10cSrcweir } 8838cdf0e10cSrcweir 8839cdf0e10cSrcweir sal_Bool Window::ImplIsAccessibleNativeFrame() const 8840cdf0e10cSrcweir { 8841cdf0e10cSrcweir if( mpWindowImpl->mbFrame ) 8842cdf0e10cSrcweir // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menues!) are closeable 8843cdf0e10cSrcweir if( (mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE)) ) 8844cdf0e10cSrcweir return sal_True; 8845cdf0e10cSrcweir else 8846cdf0e10cSrcweir return sal_False; 8847cdf0e10cSrcweir else 8848cdf0e10cSrcweir return sal_False; 8849cdf0e10cSrcweir } 8850cdf0e10cSrcweir 8851cdf0e10cSrcweir sal_uInt16 Window::ImplGetAccessibleCandidateChildWindowCount( sal_uInt16 nFirstWindowType ) const 8852cdf0e10cSrcweir { 8853cdf0e10cSrcweir sal_uInt16 nChildren = 0; 8854cdf0e10cSrcweir Window* pChild = GetWindow( nFirstWindowType ); 8855cdf0e10cSrcweir while ( pChild ) 8856cdf0e10cSrcweir { 8857cdf0e10cSrcweir if( pChild->ImplIsAccessibleCandidate() ) 8858cdf0e10cSrcweir nChildren++; 8859cdf0e10cSrcweir else 8860cdf0e10cSrcweir nChildren = sal::static_int_cast<sal_uInt16>(nChildren + pChild->ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD )); 8861cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 8862cdf0e10cSrcweir } 8863cdf0e10cSrcweir return nChildren; 8864cdf0e10cSrcweir } 8865cdf0e10cSrcweir 8866cdf0e10cSrcweir Window* Window::ImplGetAccessibleCandidateChild( sal_uInt16 nChild, sal_uInt16& rChildCount, sal_uInt16 nFirstWindowType, sal_Bool bTopLevel ) const 8867cdf0e10cSrcweir { 8868cdf0e10cSrcweir DBG_CHKTHIS( Window, ImplDbgCheckWindow ); 8869cdf0e10cSrcweir 8870cdf0e10cSrcweir if( bTopLevel ) 8871cdf0e10cSrcweir rChildCount = 0; 8872cdf0e10cSrcweir 8873cdf0e10cSrcweir Window* pChild = GetWindow( nFirstWindowType ); 8874cdf0e10cSrcweir while ( pChild ) 8875cdf0e10cSrcweir { 8876cdf0e10cSrcweir Window *pTmpChild = pChild; 8877cdf0e10cSrcweir 8878cdf0e10cSrcweir if( !pChild->ImplIsAccessibleCandidate() ) 8879cdf0e10cSrcweir pTmpChild = pChild->ImplGetAccessibleCandidateChild( nChild, rChildCount, WINDOW_FIRSTCHILD, sal_False ); 8880cdf0e10cSrcweir 8881cdf0e10cSrcweir if ( nChild == rChildCount ) 8882cdf0e10cSrcweir return pTmpChild; 8883cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 8884cdf0e10cSrcweir rChildCount++; 8885cdf0e10cSrcweir } 8886cdf0e10cSrcweir 8887cdf0e10cSrcweir return NULL; 8888cdf0e10cSrcweir } 8889cdf0e10cSrcweir 8890cdf0e10cSrcweir /* 8891cdf0e10cSrcweir Window* Window::GetAccessibleParentWindow() const 8892cdf0e10cSrcweir { 8893cdf0e10cSrcweir Window* pParent = GetParent(); 8894cdf0e10cSrcweir while ( pParent ) 8895cdf0e10cSrcweir if( pParent->ImplIsAccessibleCandidate() ) 8896cdf0e10cSrcweir break; 8897cdf0e10cSrcweir else 8898cdf0e10cSrcweir pParent = pParent->GetParent(); 8899cdf0e10cSrcweir return pParent; 8900cdf0e10cSrcweir } 8901cdf0e10cSrcweir */ 8902cdf0e10cSrcweir 8903cdf0e10cSrcweir Window* Window::GetAccessibleParentWindow() const 8904cdf0e10cSrcweir { 8905cdf0e10cSrcweir if ( ImplIsAccessibleNativeFrame() ) 8906cdf0e10cSrcweir return NULL; 8907cdf0e10cSrcweir 8908cdf0e10cSrcweir Window* pParent = mpWindowImpl->mpParent; 8909cdf0e10cSrcweir if( GetType() == WINDOW_MENUBARWINDOW ) 8910cdf0e10cSrcweir { 8911cdf0e10cSrcweir // report the menubar as a child of THE workwindow 8912cdf0e10cSrcweir Window *pWorkWin = GetParent()->mpWindowImpl->mpFirstChild; 8913cdf0e10cSrcweir while( pWorkWin && (pWorkWin == this) ) 8914cdf0e10cSrcweir pWorkWin = pWorkWin->mpWindowImpl->mpNext; 8915cdf0e10cSrcweir pParent = pWorkWin; 8916cdf0e10cSrcweir } 8917cdf0e10cSrcweir // If this a floating window which has a native boarder window, this one should be reported as 8918cdf0e10cSrcweir // accessible parent 8919cdf0e10cSrcweir else if( GetType() == WINDOW_FLOATINGWINDOW && 8920cdf0e10cSrcweir mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) 8921cdf0e10cSrcweir { 8922cdf0e10cSrcweir pParent = mpWindowImpl->mpBorderWindow; 8923cdf0e10cSrcweir } 8924cdf0e10cSrcweir else if( pParent && !pParent->ImplIsAccessibleCandidate() ) 8925cdf0e10cSrcweir { 8926cdf0e10cSrcweir pParent = pParent->mpWindowImpl->mpParent; 8927cdf0e10cSrcweir } 8928cdf0e10cSrcweir return pParent; 8929cdf0e10cSrcweir } 8930cdf0e10cSrcweir 8931cdf0e10cSrcweir /* 8932cdf0e10cSrcweir sal_uInt16 Window::GetAccessibleChildWindowCount() 8933cdf0e10cSrcweir { 8934cdf0e10cSrcweir sal_uInt16 nChildren = ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD ); 8935cdf0e10cSrcweir 8936cdf0e10cSrcweir // Search also for SystemWindows. 8937cdf0e10cSrcweir Window* pOverlap = GetWindow( WINDOW_OVERLAP ); 8938cdf0e10cSrcweir nChildren += pOverlap->ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTOVERLAP ); 8939cdf0e10cSrcweir 8940cdf0e10cSrcweir return nChildren; 8941cdf0e10cSrcweir } 8942cdf0e10cSrcweir */ 8943cdf0e10cSrcweir 8944cdf0e10cSrcweir sal_uInt16 Window::GetAccessibleChildWindowCount() 8945cdf0e10cSrcweir { 8946cdf0e10cSrcweir sal_uInt16 nChildren = 0; 8947cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 8948cdf0e10cSrcweir while( pChild ) 8949cdf0e10cSrcweir { 8950cdf0e10cSrcweir if( pChild->IsVisible() ) 8951cdf0e10cSrcweir nChildren++; 8952cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 8953cdf0e10cSrcweir } 8954cdf0e10cSrcweir 8955cdf0e10cSrcweir // #107176# ignore overlapwindows 8956cdf0e10cSrcweir // this only affects non-system floating windows 8957cdf0e10cSrcweir // which are either not accessible (like the HelpAgent) or should be changed to system windows anyway 8958cdf0e10cSrcweir /* 8959cdf0e10cSrcweir if( ImplIsOverlapWindow() ) 8960cdf0e10cSrcweir { 8961cdf0e10cSrcweir Window* pOverlap = GetWindow( WINDOW_FIRSTOVERLAP ); 8962cdf0e10cSrcweir while ( pOverlap ) 8963cdf0e10cSrcweir { 8964cdf0e10cSrcweir if( pOverlap->IsVisible() ) 8965cdf0e10cSrcweir nChildren++; 8966cdf0e10cSrcweir pOverlap = pOverlap->GetWindow( WINDOW_NEXT ); 8967cdf0e10cSrcweir } 8968cdf0e10cSrcweir } 8969cdf0e10cSrcweir */ 8970cdf0e10cSrcweir 8971cdf0e10cSrcweir // report the menubarwindow as a child of THE workwindow 8972cdf0e10cSrcweir if( GetType() == WINDOW_BORDERWINDOW ) 8973cdf0e10cSrcweir { 8974cdf0e10cSrcweir if( ((ImplBorderWindow *) this)->mpMenuBarWindow && 8975cdf0e10cSrcweir ((ImplBorderWindow *) this)->mpMenuBarWindow->IsVisible() 8976cdf0e10cSrcweir ) 8977cdf0e10cSrcweir --nChildren; 8978cdf0e10cSrcweir } 8979cdf0e10cSrcweir else if( GetType() == WINDOW_WORKWINDOW ) 8980cdf0e10cSrcweir { 8981cdf0e10cSrcweir if( ((WorkWindow *) this)->GetMenuBar() && 8982cdf0e10cSrcweir ((WorkWindow *) this)->GetMenuBar()->GetWindow() && 8983cdf0e10cSrcweir ((WorkWindow *) this)->GetMenuBar()->GetWindow()->IsVisible() 8984cdf0e10cSrcweir ) 8985cdf0e10cSrcweir ++nChildren; 8986cdf0e10cSrcweir } 8987cdf0e10cSrcweir 8988cdf0e10cSrcweir return nChildren; 8989cdf0e10cSrcweir } 8990cdf0e10cSrcweir 8991cdf0e10cSrcweir /* 8992cdf0e10cSrcweir Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) 8993cdf0e10cSrcweir { 8994cdf0e10cSrcweir sal_uInt16 nChildCount; // will be set in ImplGetAccessibleCandidateChild(...) 8995cdf0e10cSrcweir Window* pChild = ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTCHILD, sal_True ); 8996cdf0e10cSrcweir if ( !pChild && ( n >= nChildCount ) ) 8997cdf0e10cSrcweir { 8998cdf0e10cSrcweir Window* pOverlap = GetWindow( WINDOW_OVERLAP ); 8999cdf0e10cSrcweir pChild = pOverlap->ImplGetAccessibleCandidateChild( n, nChildCount, WINDOW_FIRSTOVERLAP, sal_False ); 9000cdf0e10cSrcweir } 9001cdf0e10cSrcweir 9002cdf0e10cSrcweir return pChild; 9003cdf0e10cSrcweir } 9004cdf0e10cSrcweir */ 9005cdf0e10cSrcweir 9006cdf0e10cSrcweir Window* Window::GetAccessibleChildWindow( sal_uInt16 n ) 9007cdf0e10cSrcweir { 9008cdf0e10cSrcweir // report the menubarwindow as a the first child of THE workwindow 9009cdf0e10cSrcweir if( GetType() == WINDOW_WORKWINDOW && ((WorkWindow *) this)->GetMenuBar() ) 9010cdf0e10cSrcweir { 9011cdf0e10cSrcweir if( n == 0 ) 9012cdf0e10cSrcweir { 9013cdf0e10cSrcweir MenuBar *pMenuBar = ((WorkWindow *) this)->GetMenuBar(); 9014cdf0e10cSrcweir if( pMenuBar->GetWindow() && pMenuBar->GetWindow()->IsVisible() ) 9015cdf0e10cSrcweir return pMenuBar->GetWindow(); 9016cdf0e10cSrcweir } 9017cdf0e10cSrcweir else 9018cdf0e10cSrcweir --n; 9019cdf0e10cSrcweir } 9020cdf0e10cSrcweir 9021cdf0e10cSrcweir // transform n to child number including invisible children 9022cdf0e10cSrcweir sal_uInt16 nChildren = n; 9023cdf0e10cSrcweir Window* pChild = mpWindowImpl->mpFirstChild; 9024cdf0e10cSrcweir while( pChild ) 9025cdf0e10cSrcweir { 9026cdf0e10cSrcweir if( pChild->IsVisible() ) 9027cdf0e10cSrcweir { 9028cdf0e10cSrcweir if( ! nChildren ) 9029cdf0e10cSrcweir break; 9030cdf0e10cSrcweir nChildren--; 9031cdf0e10cSrcweir } 9032cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 9033cdf0e10cSrcweir } 9034cdf0e10cSrcweir 9035cdf0e10cSrcweir if( GetType() == WINDOW_BORDERWINDOW && pChild && pChild->GetType() == WINDOW_MENUBARWINDOW ) 9036cdf0e10cSrcweir { 9037cdf0e10cSrcweir do pChild = pChild->mpWindowImpl->mpNext; while( pChild && ! pChild->IsVisible() ); 9038cdf0e10cSrcweir DBG_ASSERT( pChild, "GetAccessibleChildWindow(): wrong index in border window"); 9039cdf0e10cSrcweir } 9040cdf0e10cSrcweir if ( !pChild ) 9041cdf0e10cSrcweir { 9042cdf0e10cSrcweir // #107176# ignore overlapwindows 9043cdf0e10cSrcweir /* 9044cdf0e10cSrcweir if( ImplIsOverlapWindow() ) 9045cdf0e10cSrcweir { 9046cdf0e10cSrcweir Window* pOverlap = GetWindow( WINDOW_FIRSTOVERLAP ); 9047cdf0e10cSrcweir while ( !pChild && pOverlap ) 9048cdf0e10cSrcweir { 9049cdf0e10cSrcweir if ( !nChildren && pOverlap->IsVisible() ) 9050cdf0e10cSrcweir { 9051cdf0e10cSrcweir pChild = pOverlap; 9052cdf0e10cSrcweir break; 9053cdf0e10cSrcweir } 9054cdf0e10cSrcweir pOverlap = pOverlap->GetWindow( WINDOW_NEXT ); 9055cdf0e10cSrcweir if( pOverlap && pOverlap->IsVisible() ) 9056cdf0e10cSrcweir nChildren--; 9057cdf0e10cSrcweir } 9058cdf0e10cSrcweir } 9059cdf0e10cSrcweir */ 9060cdf0e10cSrcweir 9061cdf0e10cSrcweir } 9062cdf0e10cSrcweir if ( pChild && ( pChild->GetType() == WINDOW_BORDERWINDOW ) && ( pChild->GetChildCount() == 1 ) ) 9063cdf0e10cSrcweir { 9064cdf0e10cSrcweir pChild = pChild->GetChild( 0 ); 9065cdf0e10cSrcweir } 9066cdf0e10cSrcweir return pChild; 9067cdf0e10cSrcweir } 9068cdf0e10cSrcweir 9069cdf0e10cSrcweir 9070cdf0e10cSrcweir void Window::SetAccessibleRole( sal_uInt16 nRole ) 9071cdf0e10cSrcweir { 9072cdf0e10cSrcweir if ( !mpWindowImpl->mpAccessibleInfos ) 9073cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9074cdf0e10cSrcweir 9075cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->mpAccessibleInfos->nAccessibleRole == 0xFFFF, "AccessibleRole already set!" ); 9076cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole; 9077cdf0e10cSrcweir } 9078cdf0e10cSrcweir 9079cdf0e10cSrcweir sal_uInt16 Window::GetAccessibleRole() const 9080cdf0e10cSrcweir { 9081cdf0e10cSrcweir using namespace ::com::sun::star; 9082cdf0e10cSrcweir 9083cdf0e10cSrcweir sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF; 9084cdf0e10cSrcweir if ( nRole == 0xFFFF ) 9085cdf0e10cSrcweir { 9086cdf0e10cSrcweir switch ( GetType() ) 9087cdf0e10cSrcweir { 9088cdf0e10cSrcweir case WINDOW_MESSBOX: // MT: Would be nice to have special roles! 9089cdf0e10cSrcweir case WINDOW_INFOBOX: 9090cdf0e10cSrcweir case WINDOW_WARNINGBOX: 9091cdf0e10cSrcweir case WINDOW_ERRORBOX: 9092cdf0e10cSrcweir case WINDOW_QUERYBOX: nRole = accessibility::AccessibleRole::ALERT; break; 9093cdf0e10cSrcweir 9094cdf0e10cSrcweir case WINDOW_MODELESSDIALOG: 9095cdf0e10cSrcweir case WINDOW_MODALDIALOG: 9096cdf0e10cSrcweir case WINDOW_SYSTEMDIALOG: 9097cdf0e10cSrcweir case WINDOW_PRINTERSETUPDIALOG: 9098cdf0e10cSrcweir case WINDOW_PRINTDIALOG: 9099cdf0e10cSrcweir case WINDOW_TABDIALOG: 9100cdf0e10cSrcweir case WINDOW_BUTTONDIALOG: 9101cdf0e10cSrcweir case WINDOW_DIALOG: nRole = accessibility::AccessibleRole::DIALOG; break; 9102cdf0e10cSrcweir 9103cdf0e10cSrcweir case WINDOW_PUSHBUTTON: 9104cdf0e10cSrcweir case WINDOW_OKBUTTON: 9105cdf0e10cSrcweir case WINDOW_CANCELBUTTON: 9106cdf0e10cSrcweir case WINDOW_HELPBUTTON: 9107cdf0e10cSrcweir case WINDOW_IMAGEBUTTON: 9108ad3a95a3SSteve Yin //case WINDOW_MENUBUTTON: 9109cdf0e10cSrcweir case WINDOW_MOREBUTTON: 9110cdf0e10cSrcweir case WINDOW_SPINBUTTON: 9111cdf0e10cSrcweir case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break; 9112ad3a95a3SSteve Yin case WINDOW_MENUBUTTON: nRole = accessibility::AccessibleRole::BUTTON_MENU; break; 9113cdf0e10cSrcweir 9114cdf0e10cSrcweir case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break; 9115cdf0e10cSrcweir case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break; 9116cdf0e10cSrcweir case WINDOW_COLORDIALOG: nRole = accessibility::AccessibleRole::COLOR_CHOOSER; break; 9117cdf0e10cSrcweir case WINDOW_FONTDIALOG: nRole = accessibility::AccessibleRole::FONT_CHOOSER; break; 9118cdf0e10cSrcweir 9119cdf0e10cSrcweir case WINDOW_IMAGERADIOBUTTON: 9120cdf0e10cSrcweir case WINDOW_RADIOBUTTON: nRole = accessibility::AccessibleRole::RADIO_BUTTON; break; 9121cdf0e10cSrcweir case WINDOW_TRISTATEBOX: 9122cdf0e10cSrcweir case WINDOW_CHECKBOX: nRole = accessibility::AccessibleRole::CHECK_BOX; break; 9123cdf0e10cSrcweir 9124cdf0e10cSrcweir case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break; 9125cdf0e10cSrcweir 9126cdf0e10cSrcweir case WINDOW_PATTERNFIELD: 9127ad3a95a3SSteve Yin // Need to set the role of those window control to spinbox 9128ad3a95a3SSteve Yin /* 9129cdf0e10cSrcweir case WINDOW_NUMERICFIELD: 9130cdf0e10cSrcweir case WINDOW_METRICFIELD: 9131cdf0e10cSrcweir case WINDOW_CURRENCYFIELD: 9132cdf0e10cSrcweir case WINDOW_LONGCURRENCYFIELD: 9133ad3a95a3SSteve Yin */ 9134cdf0e10cSrcweir case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break; 9135cdf0e10cSrcweir 9136cdf0e10cSrcweir case WINDOW_PATTERNBOX: 9137cdf0e10cSrcweir case WINDOW_NUMERICBOX: 9138cdf0e10cSrcweir case WINDOW_METRICBOX: 9139cdf0e10cSrcweir case WINDOW_CURRENCYBOX: 9140cdf0e10cSrcweir case WINDOW_LONGCURRENCYBOX: 9141cdf0e10cSrcweir case WINDOW_COMBOBOX: nRole = accessibility::AccessibleRole::COMBO_BOX; break; 9142cdf0e10cSrcweir 9143cdf0e10cSrcweir case WINDOW_LISTBOX: 9144cdf0e10cSrcweir case WINDOW_MULTILISTBOX: nRole = accessibility::AccessibleRole::LIST; break; 9145cdf0e10cSrcweir 9146cdf0e10cSrcweir case WINDOW_TREELISTBOX: nRole = accessibility::AccessibleRole::TREE; break; 9147cdf0e10cSrcweir 9148cdf0e10cSrcweir case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break; 9149cdf0e10cSrcweir case WINDOW_FIXEDBORDER: 9150ad3a95a3SSteve Yin nRole = accessibility::AccessibleRole::SEPARATOR; break; 9151ad3a95a3SSteve Yin case WINDOW_FIXEDLINE: 9152ad3a95a3SSteve Yin { if( GetText().Len() > 0 ) 9153ad3a95a3SSteve Yin nRole = accessibility::AccessibleRole::LABEL; 9154ad3a95a3SSteve Yin else 9155ad3a95a3SSteve Yin nRole = accessibility::AccessibleRole::SEPARATOR; 9156ad3a95a3SSteve Yin break; 9157ad3a95a3SSteve Yin } 9158ad3a95a3SSteve Yin //case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break; 9159cdf0e10cSrcweir case WINDOW_FIXEDBITMAP: 9160cdf0e10cSrcweir case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break; 9161cdf0e10cSrcweir case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break; 9162cdf0e10cSrcweir case WINDOW_SCROLLBAR: nRole = accessibility::AccessibleRole::SCROLL_BAR; break; 9163cdf0e10cSrcweir 9164cdf0e10cSrcweir case WINDOW_SLIDER: 9165cdf0e10cSrcweir case WINDOW_SPLITTER: 9166cdf0e10cSrcweir case WINDOW_SPLITWINDOW: nRole = accessibility::AccessibleRole::SPLIT_PANE; break; 9167cdf0e10cSrcweir 9168cdf0e10cSrcweir case WINDOW_DATEBOX: 9169cdf0e10cSrcweir case WINDOW_TIMEBOX: 9170cdf0e10cSrcweir case WINDOW_DATEFIELD: 9171cdf0e10cSrcweir case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break; 9172cdf0e10cSrcweir 9173ad3a95a3SSteve Yin // Need to set the role of those window control to spinbox 9174ad3a95a3SSteve Yin case WINDOW_NUMERICFIELD: 9175ad3a95a3SSteve Yin case WINDOW_METRICFIELD: 9176ad3a95a3SSteve Yin case WINDOW_CURRENCYFIELD: 9177ad3a95a3SSteve Yin case WINDOW_LONGCURRENCYFIELD: 9178cdf0e10cSrcweir case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break; 9179cdf0e10cSrcweir 9180cdf0e10cSrcweir case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break; 9181cdf0e10cSrcweir case WINDOW_STATUSBAR: nRole = accessibility::AccessibleRole::STATUS_BAR; break; 9182cdf0e10cSrcweir 9183cdf0e10cSrcweir case WINDOW_TABPAGE: nRole = accessibility::AccessibleRole::PANEL; break; 9184cdf0e10cSrcweir case WINDOW_TABCONTROL: nRole = accessibility::AccessibleRole::PAGE_TAB_LIST; break; 9185cdf0e10cSrcweir 9186cdf0e10cSrcweir case WINDOW_DOCKINGWINDOW: 9187cdf0e10cSrcweir case WINDOW_SYSWINDOW: nRole = (mpWindowImpl->mbFrame) ? accessibility::AccessibleRole::FRAME : 9188cdf0e10cSrcweir accessibility::AccessibleRole::PANEL; break; 9189cdf0e10cSrcweir 9190cdf0e10cSrcweir case WINDOW_FLOATINGWINDOW: nRole = ( mpWindowImpl->mbFrame || 9191cdf0e10cSrcweir (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) || 9192cdf0e10cSrcweir (GetStyle() & WB_OWNERDRAWDECORATION) ) ? accessibility::AccessibleRole::FRAME : 9193cdf0e10cSrcweir accessibility::AccessibleRole::WINDOW; break; 9194cdf0e10cSrcweir 9195cdf0e10cSrcweir case WINDOW_WORKWINDOW: nRole = accessibility::AccessibleRole::ROOT_PANE; break; 9196cdf0e10cSrcweir 9197cdf0e10cSrcweir 9198cdf0e10cSrcweir case WINDOW_SCROLLBARBOX: nRole = accessibility::AccessibleRole::FILLER; break; 9199cdf0e10cSrcweir 9200cdf0e10cSrcweir case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break; 9201cdf0e10cSrcweir 9202cdf0e10cSrcweir case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break; 9203cdf0e10cSrcweir case WINDOW_WINDOW: 9204cdf0e10cSrcweir case WINDOW_CONTROL: 9205cdf0e10cSrcweir case WINDOW_BORDERWINDOW: 9206cdf0e10cSrcweir case WINDOW_SYSTEMCHILDWINDOW: 9207cdf0e10cSrcweir default: 9208cdf0e10cSrcweir if (ImplIsAccessibleNativeFrame() ) 9209cdf0e10cSrcweir nRole = accessibility::AccessibleRole::FRAME; 9210cdf0e10cSrcweir else if( IsScrollable() ) 9211cdf0e10cSrcweir nRole = accessibility::AccessibleRole::SCROLL_PANE; 9212cdf0e10cSrcweir else if( ((Window*)this)->ImplGetWindow()->IsMenuFloatingWindow() ) 9213cdf0e10cSrcweir nRole = accessibility::AccessibleRole::WINDOW; // #106002#, contextmenues are windows (i.e. toplevel) 9214cdf0e10cSrcweir else 9215cdf0e10cSrcweir // #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead 9216cdf0e10cSrcweir // a WINDOW is interpreted as a top-level window, which is typically not the case 9217cdf0e10cSrcweir //nRole = accessibility::AccessibleRole::WINDOW; 9218cdf0e10cSrcweir nRole = accessibility::AccessibleRole::PANEL; 9219cdf0e10cSrcweir } 9220cdf0e10cSrcweir } 9221cdf0e10cSrcweir return nRole; 9222cdf0e10cSrcweir } 9223cdf0e10cSrcweir 9224cdf0e10cSrcweir void Window::SetAccessibleName( const String& rName ) 9225cdf0e10cSrcweir { 9226cdf0e10cSrcweir if ( !mpWindowImpl->mpAccessibleInfos ) 9227cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9228cdf0e10cSrcweir 9229ad3a95a3SSteve Yin String oldName = GetAccessibleName(); 9230cdf0e10cSrcweir delete mpWindowImpl->mpAccessibleInfos->pAccessibleName; 9231cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName ); 9232ad3a95a3SSteve Yin ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldName ); 9233cdf0e10cSrcweir } 9234cdf0e10cSrcweir 9235cdf0e10cSrcweir String Window::GetAccessibleName() const 9236cdf0e10cSrcweir { 9237cdf0e10cSrcweir String aAccessibleName; 9238cdf0e10cSrcweir if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleName ) 9239cdf0e10cSrcweir { 9240cdf0e10cSrcweir aAccessibleName = *mpWindowImpl->mpAccessibleInfos->pAccessibleName; 9241cdf0e10cSrcweir } 9242cdf0e10cSrcweir else 9243cdf0e10cSrcweir { 9244cdf0e10cSrcweir switch ( GetType() ) 9245cdf0e10cSrcweir { 9246cdf0e10cSrcweir // case WINDOW_IMAGERADIOBUTTON: 9247cdf0e10cSrcweir // case WINDOW_RADIOBUTTON: 9248cdf0e10cSrcweir // case WINDOW_TRISTATEBOX: 9249cdf0e10cSrcweir // case WINDOW_CHECKBOX: 9250cdf0e10cSrcweir 9251cdf0e10cSrcweir case WINDOW_MULTILINEEDIT: 9252cdf0e10cSrcweir case WINDOW_PATTERNFIELD: 9253cdf0e10cSrcweir case WINDOW_NUMERICFIELD: 9254cdf0e10cSrcweir case WINDOW_METRICFIELD: 9255cdf0e10cSrcweir case WINDOW_CURRENCYFIELD: 9256cdf0e10cSrcweir case WINDOW_LONGCURRENCYFIELD: 9257cdf0e10cSrcweir case WINDOW_EDIT: 9258cdf0e10cSrcweir 9259cdf0e10cSrcweir case WINDOW_DATEBOX: 9260cdf0e10cSrcweir case WINDOW_TIMEBOX: 9261cdf0e10cSrcweir case WINDOW_CURRENCYBOX: 9262cdf0e10cSrcweir case WINDOW_LONGCURRENCYBOX: 9263cdf0e10cSrcweir case WINDOW_DATEFIELD: 9264cdf0e10cSrcweir case WINDOW_TIMEFIELD: 9265cdf0e10cSrcweir case WINDOW_SPINFIELD: 9266cdf0e10cSrcweir 9267cdf0e10cSrcweir case WINDOW_COMBOBOX: 9268cdf0e10cSrcweir case WINDOW_LISTBOX: 9269cdf0e10cSrcweir case WINDOW_MULTILISTBOX: 9270cdf0e10cSrcweir case WINDOW_TREELISTBOX: 9271cdf0e10cSrcweir case WINDOW_METRICBOX: 9272cdf0e10cSrcweir { 9273cdf0e10cSrcweir Window *pLabel = GetAccessibleRelationLabeledBy(); 9274cdf0e10cSrcweir if ( pLabel && pLabel != this ) 9275cdf0e10cSrcweir aAccessibleName = pLabel->GetText(); 9276cdf0e10cSrcweir } 9277ad3a95a3SSteve Yin if ( !aAccessibleName.Len() ) 9278ad3a95a3SSteve Yin { 9279ad3a95a3SSteve Yin aAccessibleName = GetQuickHelpText(); 9280ad3a95a3SSteve Yin } 9281cdf0e10cSrcweir break; 9282cdf0e10cSrcweir 9283cdf0e10cSrcweir case WINDOW_IMAGEBUTTON: 9284cdf0e10cSrcweir case WINDOW_PUSHBUTTON: 9285cdf0e10cSrcweir aAccessibleName = GetText(); 9286cdf0e10cSrcweir if ( !aAccessibleName.Len() ) 9287cdf0e10cSrcweir { 9288cdf0e10cSrcweir aAccessibleName = GetQuickHelpText(); 9289cdf0e10cSrcweir if ( !aAccessibleName.Len() ) 9290cdf0e10cSrcweir aAccessibleName = GetHelpText(); 9291cdf0e10cSrcweir } 9292cdf0e10cSrcweir break; 9293cdf0e10cSrcweir 9294ad3a95a3SSteve Yin case WINDOW_TOOLBOX: 9295ad3a95a3SSteve Yin aAccessibleName = GetText(); 9296ad3a95a3SSteve Yin if( aAccessibleName.Len() == 0 ) 9297ad3a95a3SSteve Yin aAccessibleName =XubString( RTL_CONSTASCII_USTRINGPARAM( "Tool Bar" ) ); 9298ad3a95a3SSteve Yin break; 9299ad3a95a3SSteve Yin case WINDOW_MOREBUTTON: 9300ad3a95a3SSteve Yin aAccessibleName = mpWindowImpl->maText; 9301ad3a95a3SSteve Yin break; 9302cdf0e10cSrcweir default: 9303cdf0e10cSrcweir aAccessibleName = GetText(); 9304cdf0e10cSrcweir break; 9305cdf0e10cSrcweir } 9306cdf0e10cSrcweir 9307cdf0e10cSrcweir aAccessibleName = GetNonMnemonicString( aAccessibleName ); 9308cdf0e10cSrcweir } 9309cdf0e10cSrcweir 9310cdf0e10cSrcweir return aAccessibleName; 9311cdf0e10cSrcweir } 9312cdf0e10cSrcweir 9313cdf0e10cSrcweir void Window::SetAccessibleDescription( const String& rDescription ) 9314cdf0e10cSrcweir { 9315cdf0e10cSrcweir if ( ! mpWindowImpl->mpAccessibleInfos ) 9316cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9317cdf0e10cSrcweir 9318cdf0e10cSrcweir DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "AccessibleDescription already set!" ); 9319cdf0e10cSrcweir delete mpWindowImpl->mpAccessibleInfos->pAccessibleDescription; 9320cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->pAccessibleDescription = new String( rDescription ); 9321cdf0e10cSrcweir } 9322cdf0e10cSrcweir 9323cdf0e10cSrcweir String Window::GetAccessibleDescription() const 9324cdf0e10cSrcweir { 9325cdf0e10cSrcweir String aAccessibleDescription; 9326cdf0e10cSrcweir if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleDescription ) 9327cdf0e10cSrcweir { 9328cdf0e10cSrcweir aAccessibleDescription = *mpWindowImpl->mpAccessibleInfos->pAccessibleDescription; 9329cdf0e10cSrcweir } 9330cdf0e10cSrcweir else 9331cdf0e10cSrcweir { 9332cdf0e10cSrcweir // Special code for help text windows. ZT asks the border window for the 9333cdf0e10cSrcweir // description so we have to forward this request to our inner window. 9334cdf0e10cSrcweir const Window* pWin = ((Window *)this)->ImplGetWindow(); 9335cdf0e10cSrcweir if ( pWin->GetType() == WINDOW_HELPTEXTWINDOW ) 9336cdf0e10cSrcweir aAccessibleDescription = pWin->GetHelpText(); 9337cdf0e10cSrcweir else 9338cdf0e10cSrcweir aAccessibleDescription = GetHelpText(); 9339cdf0e10cSrcweir } 9340cdf0e10cSrcweir 9341cdf0e10cSrcweir return aAccessibleDescription; 9342cdf0e10cSrcweir } 9343cdf0e10cSrcweir 9344cdf0e10cSrcweir void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy ) 9345cdf0e10cSrcweir { 9346cdf0e10cSrcweir if ( !mpWindowImpl->mpAccessibleInfos ) 9347cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9348cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy; 9349cdf0e10cSrcweir } 9350cdf0e10cSrcweir 9351cdf0e10cSrcweir void Window::SetAccessibleRelationLabelFor( Window* pLabelFor ) 9352cdf0e10cSrcweir { 9353cdf0e10cSrcweir if ( !mpWindowImpl->mpAccessibleInfos ) 9354cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9355cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->pLabelForWindow = pLabelFor; 9356cdf0e10cSrcweir } 9357cdf0e10cSrcweir 9358cdf0e10cSrcweir void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin ) 9359cdf0e10cSrcweir { 9360cdf0e10cSrcweir if ( !mpWindowImpl->mpAccessibleInfos ) 9361cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos; 9362cdf0e10cSrcweir mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin; 9363cdf0e10cSrcweir } 9364cdf0e10cSrcweir 9365cdf0e10cSrcweir sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath ) 9366cdf0e10cSrcweir { 9367cdf0e10cSrcweir if( !bTraverseParentPath ) 9368cdf0e10cSrcweir return mpWindowImpl->mbSuppressAccessibilityEvents; 9369cdf0e10cSrcweir else 9370cdf0e10cSrcweir { 9371cdf0e10cSrcweir Window *pParent = this; 9372cdf0e10cSrcweir while ( pParent && pParent->mpWindowImpl) 9373cdf0e10cSrcweir { 9374cdf0e10cSrcweir if( pParent->mpWindowImpl->mbSuppressAccessibilityEvents ) 9375cdf0e10cSrcweir return sal_True; 9376cdf0e10cSrcweir else 9377cdf0e10cSrcweir pParent = pParent->mpWindowImpl->mpParent; // do not use GetParent() to find borderwindows that are frames 9378cdf0e10cSrcweir } 9379cdf0e10cSrcweir return sal_False; 9380cdf0e10cSrcweir } 9381cdf0e10cSrcweir } 9382cdf0e10cSrcweir 9383cdf0e10cSrcweir void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed) 9384cdf0e10cSrcweir { 9385cdf0e10cSrcweir mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed; 9386cdf0e10cSrcweir } 9387cdf0e10cSrcweir 9388cdf0e10cSrcweir void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect ) 9389cdf0e10cSrcweir { 9390cdf0e10cSrcweir if( ! mpOutDevData ) 9391cdf0e10cSrcweir ImplInitOutDevData(); 9392cdf0e10cSrcweir mpOutDevData->mpRecordLayout = pLayout; 9393cdf0e10cSrcweir mpOutDevData->maRecordRect = rRect; 9394cdf0e10cSrcweir Paint( rRect ); 9395cdf0e10cSrcweir mpOutDevData->mpRecordLayout = NULL; 9396cdf0e10cSrcweir } 9397cdf0e10cSrcweir 9398cdf0e10cSrcweir // ----------------------------------------------------------------------- 9399cdf0e10cSrcweir // ----------------------------------------------------------------------- 9400cdf0e10cSrcweir 9401cdf0e10cSrcweir 9402cdf0e10cSrcweir // returns background color used in this control 9403cdf0e10cSrcweir // false: could not determine color 9404cdf0e10cSrcweir sal_Bool Window::ImplGetCurrentBackgroundColor( Color& rCol ) 9405cdf0e10cSrcweir { 9406cdf0e10cSrcweir sal_Bool bRet = sal_True; 9407cdf0e10cSrcweir 9408cdf0e10cSrcweir switch ( GetType() ) 9409cdf0e10cSrcweir { 9410cdf0e10cSrcweir // peform special handling here 9411cdf0e10cSrcweir case WINDOW_PUSHBUTTON: 9412cdf0e10cSrcweir case WINDOW_OKBUTTON: 9413cdf0e10cSrcweir case WINDOW_CANCELBUTTON: 9414cdf0e10cSrcweir // etc. 9415cdf0e10cSrcweir default: 9416cdf0e10cSrcweir if( IsControlBackground() ) 9417cdf0e10cSrcweir rCol = GetControlBackground(); 9418cdf0e10cSrcweir else if( IsBackground() ) 9419cdf0e10cSrcweir { 9420cdf0e10cSrcweir Wallpaper aWall = GetBackground(); 9421cdf0e10cSrcweir if( !aWall.IsGradient() && !aWall.IsBitmap() ) 9422cdf0e10cSrcweir rCol = aWall.GetColor(); 9423cdf0e10cSrcweir else 9424cdf0e10cSrcweir bRet = sal_False; 9425cdf0e10cSrcweir } 9426cdf0e10cSrcweir else 9427cdf0e10cSrcweir rCol = GetSettings().GetStyleSettings().GetFaceColor(); 9428cdf0e10cSrcweir break; 9429cdf0e10cSrcweir } 9430cdf0e10cSrcweir return bRet; 9431cdf0e10cSrcweir } 9432cdf0e10cSrcweir 9433cdf0e10cSrcweir void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly ) 9434cdf0e10cSrcweir { 9435cdf0e10cSrcweir DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, NULL, NULL ); 9436cdf0e10cSrcweir } 9437cdf0e10cSrcweir 9438cdf0e10cSrcweir void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly, Color* pSelectionTextColor ) 9439cdf0e10cSrcweir { 9440cdf0e10cSrcweir DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, pSelectionTextColor, NULL ); 9441cdf0e10cSrcweir } 9442cdf0e10cSrcweir 9443cdf0e10cSrcweir void Window::DrawSelectionBackground( const Rectangle& rRect, 9444cdf0e10cSrcweir sal_uInt16 highlight, 9445cdf0e10cSrcweir sal_Bool bChecked, 9446cdf0e10cSrcweir sal_Bool bDrawBorder, 9447cdf0e10cSrcweir sal_Bool bDrawExtBorderOnly, 9448cdf0e10cSrcweir long nCornerRadius, 9449cdf0e10cSrcweir Color* pSelectionTextColor, 9450cdf0e10cSrcweir Color* pPaintColor 9451cdf0e10cSrcweir ) 9452cdf0e10cSrcweir { 9453cdf0e10cSrcweir if( rRect.IsEmpty() ) 9454cdf0e10cSrcweir return; 9455cdf0e10cSrcweir 9456cdf0e10cSrcweir bool bRoundEdges = nCornerRadius > 0; 9457cdf0e10cSrcweir 9458cdf0e10cSrcweir const StyleSettings& rStyles = GetSettings().GetStyleSettings(); 9459cdf0e10cSrcweir 9460cdf0e10cSrcweir 9461cdf0e10cSrcweir // colors used for item highlighting 9462cdf0e10cSrcweir Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() ); 9463cdf0e10cSrcweir Color aSelectionFillCol( aSelectionBorderCol ); 9464cdf0e10cSrcweir 9465cdf0e10cSrcweir sal_Bool bDark = rStyles.GetFaceColor().IsDark(); 9466cdf0e10cSrcweir sal_Bool bBright = ( rStyles.GetFaceColor() == Color( COL_WHITE ) ); 9467cdf0e10cSrcweir 9468cdf0e10cSrcweir int c1 = aSelectionBorderCol.GetLuminance(); 9469cdf0e10cSrcweir int c2 = GetDisplayBackground().GetColor().GetLuminance(); 9470cdf0e10cSrcweir 9471cdf0e10cSrcweir if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) ) 9472cdf0e10cSrcweir { 9473cdf0e10cSrcweir // constrast too low 9474cdf0e10cSrcweir sal_uInt16 h,s,b; 9475cdf0e10cSrcweir aSelectionFillCol.RGBtoHSB( h, s, b ); 9476cdf0e10cSrcweir if( b > 50 ) b -= 40; 9477cdf0e10cSrcweir else b += 40; 9478cdf0e10cSrcweir aSelectionFillCol.SetColor( Color::HSBtoRGB( h, s, b ) ); 9479cdf0e10cSrcweir aSelectionBorderCol = aSelectionFillCol; 9480cdf0e10cSrcweir } 9481cdf0e10cSrcweir 9482cdf0e10cSrcweir if( bRoundEdges ) 9483cdf0e10cSrcweir { 9484cdf0e10cSrcweir if( aSelectionBorderCol.IsDark() ) 9485cdf0e10cSrcweir aSelectionBorderCol.IncreaseLuminance( 128 ); 9486cdf0e10cSrcweir else 9487cdf0e10cSrcweir aSelectionBorderCol.DecreaseLuminance( 128 ); 9488cdf0e10cSrcweir } 9489cdf0e10cSrcweir 9490cdf0e10cSrcweir Rectangle aRect( rRect ); 9491cdf0e10cSrcweir if( bDrawExtBorderOnly ) 9492cdf0e10cSrcweir { 9493cdf0e10cSrcweir aRect.nLeft -= 1; 9494cdf0e10cSrcweir aRect.nTop -= 1; 9495cdf0e10cSrcweir aRect.nRight += 1; 9496cdf0e10cSrcweir aRect.nBottom += 1; 9497cdf0e10cSrcweir } 9498cdf0e10cSrcweir Color oldFillCol = GetFillColor(); 9499cdf0e10cSrcweir Color oldLineCol = GetLineColor(); 9500cdf0e10cSrcweir 9501cdf0e10cSrcweir if( bDrawBorder ) 9502cdf0e10cSrcweir SetLineColor( bDark ? Color(COL_WHITE) : ( bBright ? Color(COL_BLACK) : aSelectionBorderCol ) ); 9503cdf0e10cSrcweir else 9504cdf0e10cSrcweir SetLineColor(); 9505cdf0e10cSrcweir 9506cdf0e10cSrcweir sal_uInt16 nPercent = 0; 9507cdf0e10cSrcweir if( !highlight ) 9508cdf0e10cSrcweir { 9509cdf0e10cSrcweir if( bDark ) 9510cdf0e10cSrcweir aSelectionFillCol = COL_BLACK; 9511cdf0e10cSrcweir else 9512cdf0e10cSrcweir nPercent = 80; // just checked (light) 9513cdf0e10cSrcweir } 9514cdf0e10cSrcweir else 9515cdf0e10cSrcweir { 9516cdf0e10cSrcweir if( bChecked && highlight == 2 ) 9517cdf0e10cSrcweir { 9518cdf0e10cSrcweir if( bDark ) 9519cdf0e10cSrcweir aSelectionFillCol = COL_LIGHTGRAY; 9520cdf0e10cSrcweir else if ( bBright ) 9521cdf0e10cSrcweir { 9522cdf0e10cSrcweir aSelectionFillCol = COL_BLACK; 9523cdf0e10cSrcweir SetLineColor( COL_BLACK ); 9524cdf0e10cSrcweir nPercent = 0; 9525cdf0e10cSrcweir } 9526cdf0e10cSrcweir else 9527cdf0e10cSrcweir nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark ) 9528cdf0e10cSrcweir } 9529cdf0e10cSrcweir else if( bChecked || highlight == 1 ) 9530cdf0e10cSrcweir { 9531cdf0e10cSrcweir if( bDark ) 9532cdf0e10cSrcweir aSelectionFillCol = COL_GRAY; 9533cdf0e10cSrcweir else if ( bBright ) 9534cdf0e10cSrcweir { 9535cdf0e10cSrcweir aSelectionFillCol = COL_BLACK; 9536cdf0e10cSrcweir SetLineColor( COL_BLACK ); 9537cdf0e10cSrcweir nPercent = 0; 9538cdf0e10cSrcweir } 9539cdf0e10cSrcweir else 9540cdf0e10cSrcweir nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark ) 9541cdf0e10cSrcweir } 9542cdf0e10cSrcweir else 9543cdf0e10cSrcweir { 9544cdf0e10cSrcweir if( bDark ) 9545cdf0e10cSrcweir aSelectionFillCol = COL_LIGHTGRAY; 9546cdf0e10cSrcweir else if ( bBright ) 9547cdf0e10cSrcweir { 9548cdf0e10cSrcweir aSelectionFillCol = COL_BLACK; 9549cdf0e10cSrcweir SetLineColor( COL_BLACK ); 9550cdf0e10cSrcweir if( highlight == 3 ) 9551cdf0e10cSrcweir nPercent = 80; 9552cdf0e10cSrcweir else 9553cdf0e10cSrcweir nPercent = 0; 9554cdf0e10cSrcweir } 9555cdf0e10cSrcweir else 9556cdf0e10cSrcweir nPercent = 70; // selected ( dark ) 9557cdf0e10cSrcweir } 9558cdf0e10cSrcweir } 9559cdf0e10cSrcweir 9560cdf0e10cSrcweir if( bDark && bDrawExtBorderOnly ) 9561cdf0e10cSrcweir { 9562cdf0e10cSrcweir SetFillColor(); 9563cdf0e10cSrcweir if( pSelectionTextColor ) 9564cdf0e10cSrcweir *pSelectionTextColor = rStyles.GetHighlightTextColor(); 9565cdf0e10cSrcweir } 9566cdf0e10cSrcweir else 9567cdf0e10cSrcweir { 9568cdf0e10cSrcweir SetFillColor( aSelectionFillCol ); 9569cdf0e10cSrcweir if( pSelectionTextColor ) 9570cdf0e10cSrcweir { 9571cdf0e10cSrcweir Color aTextColor = IsControlBackground() ? GetControlForeground() : rStyles.GetButtonTextColor(); 9572cdf0e10cSrcweir Color aHLTextColor = rStyles.GetHighlightTextColor(); 9573cdf0e10cSrcweir int nTextDiff = abs(aSelectionFillCol.GetLuminance() - aTextColor.GetLuminance()); 9574cdf0e10cSrcweir int nHLDiff = abs(aSelectionFillCol.GetLuminance() - aHLTextColor.GetLuminance()); 9575cdf0e10cSrcweir *pSelectionTextColor = (nHLDiff >= nTextDiff) ? aHLTextColor : aTextColor; 9576cdf0e10cSrcweir } 9577cdf0e10cSrcweir } 9578cdf0e10cSrcweir 9579cdf0e10cSrcweir 9580cdf0e10cSrcweir if( bDark ) 9581cdf0e10cSrcweir { 9582cdf0e10cSrcweir DrawRect( aRect ); 9583cdf0e10cSrcweir } 9584cdf0e10cSrcweir else 9585cdf0e10cSrcweir { 9586cdf0e10cSrcweir if( bRoundEdges ) 9587cdf0e10cSrcweir { 9588cdf0e10cSrcweir Polygon aPoly( aRect, nCornerRadius, nCornerRadius ); 9589cdf0e10cSrcweir PolyPolygon aPolyPoly( aPoly ); 9590cdf0e10cSrcweir DrawTransparent( aPolyPoly, nPercent ); 9591cdf0e10cSrcweir } 9592cdf0e10cSrcweir else 9593cdf0e10cSrcweir { 9594cdf0e10cSrcweir Polygon aPoly( aRect ); 9595cdf0e10cSrcweir PolyPolygon aPolyPoly( aPoly ); 9596cdf0e10cSrcweir DrawTransparent( aPolyPoly, nPercent ); 9597cdf0e10cSrcweir } 9598cdf0e10cSrcweir } 9599cdf0e10cSrcweir 9600cdf0e10cSrcweir SetFillColor( oldFillCol ); 9601cdf0e10cSrcweir SetLineColor( oldLineCol ); 9602cdf0e10cSrcweir } 9603cdf0e10cSrcweir 9604cdf0e10cSrcweir /* 9605cdf0e10cSrcweir void Window::DbgAssertNoEventListeners() 9606cdf0e10cSrcweir { 9607cdf0e10cSrcweir VclWindowEvent aEvent( this, 0, NULL ); 9608cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->maEventListeners.empty(), "Eventlistener: Who is still listening???" ) 9609cdf0e10cSrcweir if ( !mpWindowImpl->maEventListeners.empty() ) 9610cdf0e10cSrcweir mpWindowImpl->maEventListeners.Call( &aEvent ); 9611cdf0e10cSrcweir 9612cdf0e10cSrcweir DBG_ASSERT( mpWindowImpl->maChildEventListeners.empty(), "ChildEventlistener: Who is still listening???" ) 9613cdf0e10cSrcweir if ( !mpWindowImpl->maChildEventListeners.empty() ) 9614cdf0e10cSrcweir mpWindowImpl->maChildEventListeners.Call( &aEvent ); 9615cdf0e10cSrcweir } 9616cdf0e10cSrcweir */ 9617cdf0e10cSrcweir 9618cdf0e10cSrcweir // controls should return the window that gets the 9619cdf0e10cSrcweir // focus by default, so keyevents can be sent to that window directly 9620cdf0e10cSrcweir Window* Window::GetPreferredKeyInputWindow() 9621cdf0e10cSrcweir { 9622cdf0e10cSrcweir return this; 9623cdf0e10cSrcweir } 9624cdf0e10cSrcweir 9625cdf0e10cSrcweir 9626cdf0e10cSrcweir sal_Bool Window::IsScrollable() const 9627cdf0e10cSrcweir { 9628cdf0e10cSrcweir // check for scrollbars 9629cdf0e10cSrcweir Window *pChild = mpWindowImpl->mpFirstChild; 9630cdf0e10cSrcweir while( pChild ) 9631cdf0e10cSrcweir { 9632cdf0e10cSrcweir if( pChild->GetType() == WINDOW_SCROLLBAR ) 9633cdf0e10cSrcweir return true; 9634cdf0e10cSrcweir else 9635cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 9636cdf0e10cSrcweir } 9637cdf0e10cSrcweir return false; 9638cdf0e10cSrcweir } 9639cdf0e10cSrcweir 9640cdf0e10cSrcweir sal_Bool Window::IsTopWindow() const 9641cdf0e10cSrcweir { 9642cdf0e10cSrcweir if ( mpWindowImpl->mbInDtor ) 9643cdf0e10cSrcweir return sal_False; 9644cdf0e10cSrcweir 9645cdf0e10cSrcweir // topwindows must be frames or they must have a borderwindow which is a frame 9646cdf0e10cSrcweir if( !mpWindowImpl->mbFrame && (!mpWindowImpl->mpBorderWindow || (mpWindowImpl->mpBorderWindow && !mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) ) 9647cdf0e10cSrcweir return sal_False; 9648cdf0e10cSrcweir 9649cdf0e10cSrcweir ImplGetWinData(); 9650cdf0e10cSrcweir if( mpWindowImpl->mpWinData->mnIsTopWindow == (sal_uInt16)~0) // still uninitialized 9651cdf0e10cSrcweir { 9652cdf0e10cSrcweir // #113722#, cache result of expensive queryInterface call 9653cdf0e10cSrcweir Window *pThisWin = (Window*)this; 9654cdf0e10cSrcweir uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); 9655cdf0e10cSrcweir pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0; 9656cdf0e10cSrcweir } 9657cdf0e10cSrcweir return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? sal_True : sal_False; 9658cdf0e10cSrcweir } 9659cdf0e10cSrcweir 9660cdf0e10cSrcweir void Window::ImplMirrorFramePos( Point &pt ) const 9661cdf0e10cSrcweir { 9662cdf0e10cSrcweir pt.X() = mpWindowImpl->mpFrame->maGeometry.nWidth-1-pt.X(); 9663cdf0e10cSrcweir } 9664cdf0e10cSrcweir 9665cdf0e10cSrcweir // frame based modal counter (dialogs are not modal to the whole application anymore) 9666cdf0e10cSrcweir sal_Bool Window::IsInModalMode() const 9667cdf0e10cSrcweir { 9668cdf0e10cSrcweir return (mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mnModalMode != 0); 9669cdf0e10cSrcweir } 9670cdf0e10cSrcweir void Window::ImplIncModalCount() 9671cdf0e10cSrcweir { 9672cdf0e10cSrcweir Window* pFrameWindow = mpWindowImpl->mpFrameWindow; 9673cdf0e10cSrcweir Window* pParent = pFrameWindow; 9674cdf0e10cSrcweir while( pFrameWindow ) 9675cdf0e10cSrcweir { 9676cdf0e10cSrcweir pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode++; 9677cdf0e10cSrcweir while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow ) 9678cdf0e10cSrcweir { 9679cdf0e10cSrcweir pParent = pParent->GetParent(); 9680cdf0e10cSrcweir } 9681cdf0e10cSrcweir pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL; 9682cdf0e10cSrcweir } 9683cdf0e10cSrcweir } 9684cdf0e10cSrcweir void Window::ImplDecModalCount() 9685cdf0e10cSrcweir { 9686cdf0e10cSrcweir Window* pFrameWindow = mpWindowImpl->mpFrameWindow; 9687cdf0e10cSrcweir Window* pParent = pFrameWindow; 9688cdf0e10cSrcweir while( pFrameWindow ) 9689cdf0e10cSrcweir { 9690cdf0e10cSrcweir pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode--; 9691cdf0e10cSrcweir while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow ) 9692cdf0e10cSrcweir { 9693cdf0e10cSrcweir pParent = pParent->GetParent(); 9694cdf0e10cSrcweir } 9695cdf0e10cSrcweir pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL; 9696cdf0e10cSrcweir } 9697cdf0e10cSrcweir } 9698cdf0e10cSrcweir sal_Bool Window::ImplIsInTaskPaneList() 9699cdf0e10cSrcweir { 9700cdf0e10cSrcweir return mpWindowImpl->mbIsInTaskPaneList; 9701cdf0e10cSrcweir } 9702cdf0e10cSrcweir void Window::ImplIsInTaskPaneList( sal_Bool mbIsInTaskList ) 9703cdf0e10cSrcweir { 9704cdf0e10cSrcweir mpWindowImpl->mbIsInTaskPaneList = mbIsInTaskList; 9705cdf0e10cSrcweir } 9706cdf0e10cSrcweir 9707cdf0e10cSrcweir void Window::ImplNotifyIconifiedState( sal_Bool bIconified ) 9708cdf0e10cSrcweir { 9709cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE ); 9710cdf0e10cSrcweir // #109206# notify client window as well to have toolkit topwindow listeners notified 9711cdf0e10cSrcweir if( mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow && mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow ) 9712cdf0e10cSrcweir mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE ); 9713cdf0e10cSrcweir } 9714cdf0e10cSrcweir 9715cdf0e10cSrcweir sal_Bool Window::HasActiveChildFrame() 9716cdf0e10cSrcweir { 9717cdf0e10cSrcweir sal_Bool bRet = sal_False; 9718cdf0e10cSrcweir Window *pFrameWin = ImplGetSVData()->maWinData.mpFirstFrame; 9719cdf0e10cSrcweir while( pFrameWin ) 9720cdf0e10cSrcweir { 9721cdf0e10cSrcweir if( pFrameWin != mpWindowImpl->mpFrameWindow ) 9722cdf0e10cSrcweir { 9723cdf0e10cSrcweir sal_Bool bDecorated = sal_False; 9724cdf0e10cSrcweir Window *pChildFrame = pFrameWin->ImplGetWindow(); 9725cdf0e10cSrcweir // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP which can 9726cdf0e10cSrcweir // be removed for ToolBoxes to influence the keyboard accessibility 9727cdf0e10cSrcweir // thus WB_MOVEABLE is no indicator for decoration anymore 9728cdf0e10cSrcweir // but FloatingWindows carry this information in their TitleType... 9729cdf0e10cSrcweir // TODO: avoid duplicate WinBits !!! 9730cdf0e10cSrcweir if( pChildFrame && pChildFrame->ImplIsFloatingWindow() ) 9731cdf0e10cSrcweir bDecorated = ((FloatingWindow*) pChildFrame)->GetTitleType() != FLOATWIN_TITLE_NONE; 9732cdf0e10cSrcweir if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) ) 9733cdf0e10cSrcweir if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() ) 9734cdf0e10cSrcweir { 9735cdf0e10cSrcweir if( ImplIsChild( pChildFrame, sal_True ) ) 9736cdf0e10cSrcweir { 9737cdf0e10cSrcweir bRet = sal_True; 9738cdf0e10cSrcweir break; 9739cdf0e10cSrcweir } 9740cdf0e10cSrcweir } 9741cdf0e10cSrcweir } 9742cdf0e10cSrcweir pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame; 9743cdf0e10cSrcweir } 9744cdf0e10cSrcweir return bRet; 9745cdf0e10cSrcweir } 9746cdf0e10cSrcweir 9747cdf0e10cSrcweir LanguageType Window::GetInputLanguage() const 9748cdf0e10cSrcweir { 9749cdf0e10cSrcweir return mpWindowImpl->mpFrame->GetInputLanguage(); 9750cdf0e10cSrcweir } 9751cdf0e10cSrcweir 9752cdf0e10cSrcweir void Window::EnableNativeWidget( sal_Bool bEnable ) 9753cdf0e10cSrcweir { 9754cdf0e10cSrcweir static const char* pNoNWF = getenv( "SAL_NO_NWF" ); 9755cdf0e10cSrcweir if( pNoNWF && *pNoNWF ) 9756cdf0e10cSrcweir bEnable = sal_False; 9757cdf0e10cSrcweir 9758cdf0e10cSrcweir if( bEnable != ImplGetWinData()->mbEnableNativeWidget ) 9759cdf0e10cSrcweir { 9760cdf0e10cSrcweir ImplGetWinData()->mbEnableNativeWidget = bEnable; 9761cdf0e10cSrcweir 9762cdf0e10cSrcweir // send datachanged event to allow for internal changes required for NWF 9763cdf0e10cSrcweir // like clipmode, transparency, etc. 9764cdf0e10cSrcweir DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &maSettings, SETTINGS_STYLE ); 9765cdf0e10cSrcweir DataChanged( aDCEvt ); 9766cdf0e10cSrcweir 9767cdf0e10cSrcweir // sometimes the borderwindow is queried, so keep it in sync 9768cdf0e10cSrcweir if( mpWindowImpl->mpBorderWindow ) 9769cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->ImplGetWinData()->mbEnableNativeWidget = bEnable; 9770cdf0e10cSrcweir } 9771cdf0e10cSrcweir 9772cdf0e10cSrcweir // push down, useful for compound controls 9773cdf0e10cSrcweir Window *pChild = mpWindowImpl->mpFirstChild; 9774cdf0e10cSrcweir while( pChild ) 9775cdf0e10cSrcweir { 9776cdf0e10cSrcweir pChild->EnableNativeWidget( bEnable ); 9777cdf0e10cSrcweir pChild = pChild->mpWindowImpl->mpNext; 9778cdf0e10cSrcweir } 9779cdf0e10cSrcweir } 9780cdf0e10cSrcweir 9781cdf0e10cSrcweir sal_Bool Window::IsNativeWidgetEnabled() const 9782cdf0e10cSrcweir { 9783cdf0e10cSrcweir return ImplGetWinData()->mbEnableNativeWidget; 9784cdf0e10cSrcweir } 9785cdf0e10cSrcweir 9786cdf0e10cSrcweir #ifdef WNT // see #140456# 9787cdf0e10cSrcweir #include <win/salframe.h> 9788cdf0e10cSrcweir #endif 9789cdf0e10cSrcweir 9790cdf0e10cSrcweir uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize, 9791cdf0e10cSrcweir bool bFullscreen, 9792cdf0e10cSrcweir bool bSpriteCanvas ) const 9793cdf0e10cSrcweir { 9794cdf0e10cSrcweir // try to retrieve hard reference from weak member 9795cdf0e10cSrcweir uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas ); 9796cdf0e10cSrcweir 9797cdf0e10cSrcweir // canvas still valid? Then we're done. 9798cdf0e10cSrcweir if( xCanvas.is() ) 9799cdf0e10cSrcweir return xCanvas; 9800cdf0e10cSrcweir 9801cdf0e10cSrcweir Sequence< Any > aArg(6); 9802cdf0e10cSrcweir 9803cdf0e10cSrcweir // Feed any with operating system's window handle 9804cdf0e10cSrcweir // ============================================== 9805cdf0e10cSrcweir 9806cdf0e10cSrcweir // common: first any is VCL pointer to window (for VCL canvas) 9807cdf0e10cSrcweir aArg[ 0 ] = makeAny( reinterpret_cast<sal_Int64>(this) ); 9808cdf0e10cSrcweir 9809cdf0e10cSrcweir // TODO(Q1): Make GetSystemData method virtual 9810cdf0e10cSrcweir 9811cdf0e10cSrcweir // check whether we're a SysChild: have to fetch system data 9812cdf0e10cSrcweir // directly from SystemChildWindow, because the GetSystemData 9813cdf0e10cSrcweir // method is unfortunately not virtual 9814cdf0e10cSrcweir const SystemChildWindow* pSysChild = dynamic_cast< const SystemChildWindow* >( this ); 9815cdf0e10cSrcweir if( pSysChild ) 9816cdf0e10cSrcweir { 9817cdf0e10cSrcweir aArg[ 1 ] = pSysChild->GetSystemDataAny(); 9818cdf0e10cSrcweir aArg[ 5 ] = pSysChild->GetSystemGfxDataAny(); 9819cdf0e10cSrcweir } 9820cdf0e10cSrcweir else 9821cdf0e10cSrcweir { 9822cdf0e10cSrcweir aArg[ 1 ] = GetSystemDataAny(); 9823cdf0e10cSrcweir aArg[ 5 ] = GetSystemGfxDataAny(); 9824cdf0e10cSrcweir } 9825cdf0e10cSrcweir 9826cdf0e10cSrcweir if( bFullscreen ) 9827cdf0e10cSrcweir aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( 0, 0, 9828cdf0e10cSrcweir rFullscreenSize.Width(), 9829cdf0e10cSrcweir rFullscreenSize.Height() ) ); 9830cdf0e10cSrcweir else 9831cdf0e10cSrcweir aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) ); 9832cdf0e10cSrcweir 9833cdf0e10cSrcweir aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? sal_True : sal_False ); 9834cdf0e10cSrcweir aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >( 9835cdf0e10cSrcweir const_cast<Window*>(this)->GetComponentInterface(), 9836cdf0e10cSrcweir uno::UNO_QUERY )); 9837cdf0e10cSrcweir 9838cdf0e10cSrcweir uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory(); 9839cdf0e10cSrcweir 9840cdf0e10cSrcweir // Create canvas instance with window handle 9841cdf0e10cSrcweir // ========================================= 9842cdf0e10cSrcweir if ( xFactory.is() ) 9843cdf0e10cSrcweir { 9844cdf0e10cSrcweir static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory( 9845cdf0e10cSrcweir uno::Reference<lang::XMultiServiceFactory>( 9846cdf0e10cSrcweir xFactory->createInstance( 9847cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 9848cdf0e10cSrcweir "com.sun.star.rendering.CanvasFactory") ) ), 9849cdf0e10cSrcweir UNO_QUERY )); 9850cdf0e10cSrcweir uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get()); 9851cdf0e10cSrcweir 9852cdf0e10cSrcweir if(xCanvasFactory.is()) 9853cdf0e10cSrcweir { 9854cdf0e10cSrcweir #ifdef WNT 9855cdf0e10cSrcweir // see #140456# - if we're running on a multiscreen setup, 9856cdf0e10cSrcweir // request special, multi-screen safe sprite canvas 9857cdf0e10cSrcweir // implementation (not DX5 canvas, as it cannot cope with 9858cdf0e10cSrcweir // surfaces spanning multiple displays). Note: canvas 9859cdf0e10cSrcweir // (without sprite) stays the same) 9860cdf0e10cSrcweir const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; 9861cdf0e10cSrcweir if( (nDisplay >= Application::GetScreenCount()) ) 9862cdf0e10cSrcweir { 9863cdf0e10cSrcweir xCanvas.set( xCanvasFactory->createInstanceWithArguments( 9864cdf0e10cSrcweir bSpriteCanvas ? 9865cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 9866cdf0e10cSrcweir "com.sun.star.rendering.SpriteCanvas.MultiScreen" )) : 9867cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 9868cdf0e10cSrcweir "com.sun.star.rendering.Canvas.MultiScreen" )), 9869cdf0e10cSrcweir aArg ), 9870cdf0e10cSrcweir UNO_QUERY ); 9871cdf0e10cSrcweir 9872cdf0e10cSrcweir } 9873cdf0e10cSrcweir else 9874cdf0e10cSrcweir { 9875cdf0e10cSrcweir #endif 9876cdf0e10cSrcweir xCanvas.set( xCanvasFactory->createInstanceWithArguments( 9877cdf0e10cSrcweir bSpriteCanvas ? 9878cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 9879cdf0e10cSrcweir "com.sun.star.rendering.SpriteCanvas" )) : 9880cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 9881cdf0e10cSrcweir "com.sun.star.rendering.Canvas" )), 9882cdf0e10cSrcweir aArg ), 9883cdf0e10cSrcweir UNO_QUERY ); 9884cdf0e10cSrcweir 9885cdf0e10cSrcweir #ifdef WNT 9886cdf0e10cSrcweir } 9887cdf0e10cSrcweir #endif 9888cdf0e10cSrcweir 9889cdf0e10cSrcweir mpWindowImpl->mxCanvas = xCanvas; 9890cdf0e10cSrcweir } 9891cdf0e10cSrcweir } 9892cdf0e10cSrcweir 9893cdf0e10cSrcweir // no factory??? Empty reference, then. 9894cdf0e10cSrcweir return xCanvas; 9895cdf0e10cSrcweir } 9896cdf0e10cSrcweir 9897cdf0e10cSrcweir uno::Reference< rendering::XCanvas > Window::GetCanvas() const 9898cdf0e10cSrcweir { 9899cdf0e10cSrcweir return ImplGetCanvas( Size(), false, false ); 9900cdf0e10cSrcweir } 9901cdf0e10cSrcweir 9902cdf0e10cSrcweir uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const 9903cdf0e10cSrcweir { 9904cdf0e10cSrcweir uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( 9905cdf0e10cSrcweir ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY ); 9906cdf0e10cSrcweir return xSpriteCanvas; 9907cdf0e10cSrcweir } 9908cdf0e10cSrcweir 9909cdf0e10cSrcweir uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpriteCanvas( const Size& rFullscreenSize ) const 9910cdf0e10cSrcweir { 9911cdf0e10cSrcweir uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( 9912cdf0e10cSrcweir ImplGetCanvas( rFullscreenSize, true, true ), uno::UNO_QUERY ); 9913cdf0e10cSrcweir return xSpriteCanvas; 9914cdf0e10cSrcweir } 9915cdf0e10cSrcweir 9916cdf0e10cSrcweir void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) 9917cdf0e10cSrcweir { 9918cdf0e10cSrcweir sal_Bool bRVisible = mpWindowImpl->mbReallyVisible; 9919cdf0e10cSrcweir mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; 9920cdf0e10cSrcweir sal_Bool bDevOutput = mbDevOutput; 9921cdf0e10cSrcweir mbDevOutput = sal_True; 9922cdf0e10cSrcweir 9923cdf0e10cSrcweir long nOldDPIX = ImplGetDPIX(); 9924cdf0e10cSrcweir long nOldDPIY = ImplGetDPIY(); 9925cdf0e10cSrcweir mnDPIX = i_pTargetOutDev->ImplGetDPIX(); 9926cdf0e10cSrcweir mnDPIY = i_pTargetOutDev->ImplGetDPIY(); 9927cdf0e10cSrcweir sal_Bool bOutput = IsOutputEnabled(); 9928cdf0e10cSrcweir EnableOutput(); 9929cdf0e10cSrcweir 9930cdf0e10cSrcweir DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); 9931cdf0e10cSrcweir if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) 9932cdf0e10cSrcweir return; 9933cdf0e10cSrcweir 9934cdf0e10cSrcweir // preserve graphicsstate 9935cdf0e10cSrcweir Push(); 9936cdf0e10cSrcweir Region aClipRegion( GetClipRegion() ); 9937cdf0e10cSrcweir SetClipRegion(); 9938cdf0e10cSrcweir 9939cdf0e10cSrcweir GDIMetaFile* pOldMtf = GetConnectMetaFile(); 9940cdf0e10cSrcweir GDIMetaFile aMtf; 9941cdf0e10cSrcweir SetConnectMetaFile( &aMtf ); 9942cdf0e10cSrcweir 9943cdf0e10cSrcweir // put a push action to metafile 9944cdf0e10cSrcweir Push(); 9945cdf0e10cSrcweir // copy graphics state to metafile 9946cdf0e10cSrcweir Font aCopyFont = GetFont(); 9947cdf0e10cSrcweir if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY ) 9948cdf0e10cSrcweir { 9949cdf0e10cSrcweir aCopyFont.SetHeight( aCopyFont.GetHeight() * mnDPIY / nOldDPIY ); 9950cdf0e10cSrcweir aCopyFont.SetWidth( aCopyFont.GetWidth() * mnDPIX / nOldDPIX ); 9951cdf0e10cSrcweir } 9952cdf0e10cSrcweir SetFont( aCopyFont ); 9953cdf0e10cSrcweir SetTextColor( GetTextColor() ); 9954cdf0e10cSrcweir if( IsLineColor() ) 9955cdf0e10cSrcweir SetLineColor( GetLineColor() ); 9956cdf0e10cSrcweir else 9957cdf0e10cSrcweir SetLineColor(); 9958cdf0e10cSrcweir if( IsFillColor() ) 9959cdf0e10cSrcweir SetFillColor( GetFillColor() ); 9960cdf0e10cSrcweir else 9961cdf0e10cSrcweir SetFillColor(); 9962cdf0e10cSrcweir if( IsTextLineColor() ) 9963cdf0e10cSrcweir SetTextLineColor( GetTextLineColor() ); 9964cdf0e10cSrcweir else 9965cdf0e10cSrcweir SetTextLineColor(); 9966cdf0e10cSrcweir if( IsOverlineColor() ) 9967cdf0e10cSrcweir SetOverlineColor( GetOverlineColor() ); 9968cdf0e10cSrcweir else 9969cdf0e10cSrcweir SetOverlineColor(); 9970cdf0e10cSrcweir if( IsTextFillColor() ) 9971cdf0e10cSrcweir SetTextFillColor( GetTextFillColor() ); 9972cdf0e10cSrcweir else 9973cdf0e10cSrcweir SetTextFillColor(); 9974cdf0e10cSrcweir SetTextAlign( GetTextAlign() ); 9975cdf0e10cSrcweir SetRasterOp( GetRasterOp() ); 9976cdf0e10cSrcweir if( IsRefPoint() ) 9977cdf0e10cSrcweir SetRefPoint( GetRefPoint() ); 9978cdf0e10cSrcweir else 9979cdf0e10cSrcweir SetRefPoint(); 9980cdf0e10cSrcweir SetLayoutMode( GetLayoutMode() ); 9981cdf0e10cSrcweir SetDigitLanguage( GetDigitLanguage() ); 9982cdf0e10cSrcweir Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() ); 9983cdf0e10cSrcweir aClipRegion.Intersect( aPaintRect ); 9984cdf0e10cSrcweir SetClipRegion( aClipRegion ); 9985cdf0e10cSrcweir 9986cdf0e10cSrcweir // do the actual paint 9987cdf0e10cSrcweir 9988cdf0e10cSrcweir // background 9989cdf0e10cSrcweir if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & PARENTCLIPMODE_NOCLIP ) ) 9990cdf0e10cSrcweir Erase(); 9991cdf0e10cSrcweir // foreground 9992cdf0e10cSrcweir Paint( aPaintRect ); 9993cdf0e10cSrcweir // put a pop action to metafile 9994cdf0e10cSrcweir Pop(); 9995cdf0e10cSrcweir 9996cdf0e10cSrcweir SetConnectMetaFile( pOldMtf ); 9997cdf0e10cSrcweir EnableOutput( bOutput ); 9998cdf0e10cSrcweir mpWindowImpl->mbReallyVisible = bRVisible; 9999cdf0e10cSrcweir 10000cdf0e10cSrcweir // paint metafile to VDev 10001cdf0e10cSrcweir VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 ); 10002cdf0e10cSrcweir pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); 10003cdf0e10cSrcweir pMaskedDevice->EnableRTL( IsRTLEnabled() ); 10004cdf0e10cSrcweir aMtf.WindStart(); 10005cdf0e10cSrcweir aMtf.Play( pMaskedDevice ); 10006cdf0e10cSrcweir BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) ); 10007cdf0e10cSrcweir i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx ); 10008cdf0e10cSrcweir // get rid of virtual device now so they don't pile up during recursive calls 10009cdf0e10cSrcweir delete pMaskedDevice, pMaskedDevice = NULL; 10010cdf0e10cSrcweir 10011cdf0e10cSrcweir 10012cdf0e10cSrcweir for( Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext ) 10013cdf0e10cSrcweir { 10014cdf0e10cSrcweir if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) 10015cdf0e10cSrcweir { 10016cdf0e10cSrcweir long nDeltaX = pChild->mnOutOffX - mnOutOffX; 10017cdf0e10cSrcweir if( ImplHasMirroredGraphics() ) 10018cdf0e10cSrcweir nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; 10019cdf0e10cSrcweir long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); 10020cdf0e10cSrcweir Point aPos( i_rPos ); 10021cdf0e10cSrcweir Point aDelta( nDeltaX, nDeltaY ); 10022cdf0e10cSrcweir aPos += aDelta; 10023cdf0e10cSrcweir pChild->ImplPaintToDevice( i_pTargetOutDev, aPos ); 10024cdf0e10cSrcweir } 10025cdf0e10cSrcweir } 10026cdf0e10cSrcweir 10027cdf0e10cSrcweir // restore graphics state 10028cdf0e10cSrcweir Pop(); 10029cdf0e10cSrcweir 10030cdf0e10cSrcweir EnableOutput( bOutput ); 10031cdf0e10cSrcweir mpWindowImpl->mbReallyVisible = bRVisible; 10032cdf0e10cSrcweir mbDevOutput = bDevOutput; 10033cdf0e10cSrcweir mnDPIX = nOldDPIX; 10034cdf0e10cSrcweir mnDPIY = nOldDPIY; 10035cdf0e10cSrcweir } 10036cdf0e10cSrcweir 10037cdf0e10cSrcweir void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ ) 10038cdf0e10cSrcweir { 10039cdf0e10cSrcweir // FIXME: scaling: currently this is for pixel copying only 10040cdf0e10cSrcweir 10041cdf0e10cSrcweir DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); 10042cdf0e10cSrcweir DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); 10043cdf0e10cSrcweir 10044cdf0e10cSrcweir 10045cdf0e10cSrcweir Point aPos = pDev->LogicToPixel( rPos ); 10046cdf0e10cSrcweir 10047cdf0e10cSrcweir Window* pRealParent = NULL; 10048cdf0e10cSrcweir if( ! mpWindowImpl->mbVisible ) 10049cdf0e10cSrcweir { 10050cdf0e10cSrcweir Window* pTempParent = ImplGetDefaultWindow(); 10051cdf0e10cSrcweir if( pTempParent ) 10052cdf0e10cSrcweir pTempParent->EnableChildTransparentMode(); 10053cdf0e10cSrcweir pRealParent = GetParent(); 10054cdf0e10cSrcweir SetParent( pTempParent ); 10055cdf0e10cSrcweir // trigger correct visibility flags for children 10056cdf0e10cSrcweir Show(); 10057cdf0e10cSrcweir Hide(); 10058cdf0e10cSrcweir } 10059cdf0e10cSrcweir 10060cdf0e10cSrcweir sal_Bool bVisible = mpWindowImpl->mbVisible; 10061cdf0e10cSrcweir mpWindowImpl->mbVisible = sal_True; 10062cdf0e10cSrcweir 10063cdf0e10cSrcweir if( mpWindowImpl->mpBorderWindow ) 10064cdf0e10cSrcweir mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos ); 10065cdf0e10cSrcweir else 10066cdf0e10cSrcweir ImplPaintToDevice( pDev, rPos ); 10067cdf0e10cSrcweir 10068cdf0e10cSrcweir mpWindowImpl->mbVisible = bVisible; 10069cdf0e10cSrcweir 10070cdf0e10cSrcweir if( pRealParent ) 10071cdf0e10cSrcweir SetParent( pRealParent ); 10072cdf0e10cSrcweir } 10073cdf0e10cSrcweir 10074cdf0e10cSrcweir XubString Window::GetSurroundingText() const 10075cdf0e10cSrcweir { 10076cdf0e10cSrcweir return XubString::EmptyString(); 10077cdf0e10cSrcweir } 10078cdf0e10cSrcweir 10079cdf0e10cSrcweir Selection Window::GetSurroundingTextSelection() const 10080cdf0e10cSrcweir { 10081cdf0e10cSrcweir return Selection( 0, 0 ); 10082cdf0e10cSrcweir } 10083cdf0e10cSrcweir 10084