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