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