diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/image.cxx | 22 | ||||
-rw-r--r-- | vcl/source/gdi/makefile.mk | 1 | ||||
-rw-r--r-- | vcl/source/gdi/outdevnative.cxx | 290 | ||||
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 24 | ||||
-rw-r--r-- | vcl/source/gdi/salnativewidgets-none.cxx | 7 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 51 | ||||
-rw-r--r-- | vcl/source/window/window3.cxx | 259 |
8 files changed, 353 insertions, 306 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 741267044829..b97afd720785 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -408,6 +408,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) if( aImageSize.Height() > aSize.Height() ) aSize.Height() = aImageSize.Height(); + aSize.Width() += TAB_TABOFFSET_X*2; + aSize.Height() += TAB_TABOFFSET_Y*2; + Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) ); Region aBoundingRgn, aContentRgn; const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); @@ -419,8 +422,6 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) return aCont.GetSize(); } - aSize.Width() += TAB_TABOFFSET_X*2; - aSize.Height() += TAB_TABOFFSET_Y*2; // For systems without synthetic bold support if ( mbExtraSpace ) aSize.Width() += TAB_EXTRASPACE_X; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index e3f63a03d081..e79308b2664e 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -50,6 +50,10 @@ #include <vcl/image.h> #include <vcl/image.hxx> +#if OSL_DEBUG_LEVEL > 0 +#include <rtl/strbuf.hxx> +#endif + DBG_NAME( Image ) DBG_NAME( ImageList ) @@ -543,11 +547,19 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) rtl::OUString aFileName = rPrefix; aFileName += maName; -#ifdef DBG_UTIL - bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); - DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image"); -#else - aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + bool bSuccess = +#endif + aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + if ( !bSuccess ) + { + ::rtl::OStringBuffer aMessage; + aMessage.append( "ImageAryData::Load: failed to load image '" ); + aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); + } #endif } diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 75f2b3fffc64..f069828f25f9 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -106,6 +106,7 @@ SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ + $(SLO)$/outdevnative.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx new file mode 100644 index 000000000000..fed41ec4de85 --- /dev/null +++ b/vcl/source/gdi/outdevnative.cxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/outdev.hxx" +#include "vcl/window.hxx" +#include "vcl/salgdi.hxx" +#include "vcl/salnativewidgets.hxx" +#include "vcl/pdfextoutdevdata.hxx" + +// ----------------------------------------------------------------------- + +static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice ) +{ + const OutDevType eType( i_rDevice.GetOutDevType() ); + switch ( eType ) + { + + case OUTDEV_WINDOW: + return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled(); + + case OUTDEV_VIRDEV: + { + const ::vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() ); + const ::vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const ::vcl::PDFExtOutDevData* >( pOutDevData ) ); + if ( pPDFData != NULL ) + return false; + return true; + } + + default: + return false; + } +} + +// ----------------------------------------------------------------------- +// These functions are mainly passthrough functions that allow access to +// the SalFrame behind a Window object for native widget rendering purposes. +// ----------------------------------------------------------------------- + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + return( mpGraphics->IsNativeControlSupported(nType, nPart) ); +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + BOOL& rIsInside ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ), + rIsInside, this ) ); +} + +// ----------------------------------------------------------------------- + +static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) +{ + if( aValue.getOptionalVal() ) + { + switch( nType ) + { + case CTRL_SLIDER: + { + SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal()); + pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_SCROLLBAR: + { + ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal()); + pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() ); + pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_SPINBOX: + case CTRL_SPINBUTTONS: + { + SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal()); + pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); + pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_TOOLBAR: + { + ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal()); + pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + } + } +} + +BOOL OutputDevice::DrawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + /* + if( !IsInPaint() && IsPaintTransparent() ) + { + // only required if called directly (ie, we're not in Paint() ): + // force redraw (Paint()) for transparent controls + // to trigger a repaint of the background + Region aClipRgn( GetClipRegion() ); + if( !rControlRegion.IsEmpty() ) + aClipRgn.Intersect( rControlRegion ); + Invalidate( aClipRgn, INVALIDATE_UPDATE ); + return TRUE; + } + */ + + // make sure the current clip region is initialized correctly + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return TRUE; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + // do so for ImplControlValue members, also + lcl_moveControlValue( nType, aValue, aWinOffs ); + + Region aTestRegion( GetActiveClipRegion() ); + aTestRegion.Intersect( rControlRegion ); + if( aTestRegion == rControlRegion ) + nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed + + BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::DrawNativeControlText(ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + // make sure the current clip region is initialized correctly + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return false; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return true; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, + aCaption, rNativeBoundingRegion, + rNativeContentRegion, this ); + if( bRet ) + { + // transform back native regions + rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + } + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 55d6f7bdd892..84e45979d679 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -669,7 +669,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* } BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) + const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -677,10 +677,10 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co Region rgn( rControlRegion ); mirror( pt.X(), pOutDev ); mirror( rgn, pOutDev ); - return hitTestNativeControl( nType, nPart, rgn, pt, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside ); } else - return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); } void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const @@ -722,7 +722,7 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const } BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -730,33 +730,33 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) + const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, + const ImplControlValue& aValue, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -764,7 +764,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption, + if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ) ) { mirror( rNativeBoundingRegion, pOutDev, true ); @@ -779,7 +779,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, } } else - return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption, + return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ); } diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 8b87f142ba25..7faf12d062fe 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -60,7 +60,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) { return( FALSE ); @@ -74,7 +73,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControl( ControlType, @@ -82,7 +80,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -97,7 +94,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControlText( ControlType, @@ -105,7 +101,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -123,7 +118,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::getNativeControlRegion( ControlType, @@ -131,7 +125,6 @@ BOOL SalGraphics::getNativeControlRegion( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString&, Region &, Region & ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8906edaa5046..aadef164282b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -98,6 +98,7 @@ #include "vcl/lazydelete.hxx" #include <set> +#include <typeinfo> using namespace rtl; using namespace ::com::sun::star::uno; @@ -1322,7 +1323,6 @@ ImplWinData* Window::ImplGetWinData() const mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow()) mpWindowImpl->mpWinData->mbMouseOver = FALSE; mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; mpWindowImpl->mpWinData->mpSmartHelpId = NULL; mpWindowImpl->mpWinData->mpSmartUniqueId = NULL; } @@ -4328,6 +4328,27 @@ Window::Window( Window* pParent, const ResId& rResId ) } // ----------------------------------------------------------------------- +#if OSL_DEBUG_LEVEL > 0 +namespace +{ + void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow ) + { + // skip border windows, they don't carry information which helps diagnosing the problem + const Window* pWindow( &i_rWindow ); + while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) ) + pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD ); + if ( !pWindow ) + pWindow = &i_rWindow; + + io_rErrorString += char(13); + io_rErrorString += typeid( *pWindow ).name(); + io_rErrorString += " (window text: '"; + io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 ); + io_rErrorString += "')"; + } +} +#endif +// ----------------------------------------------------------------------- Window::~Window() { @@ -4460,9 +4481,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; } @@ -4483,9 +4502,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; } @@ -4507,10 +4524,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstChild; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! @@ -4524,10 +4539,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstOverlap; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! @@ -4722,10 +4735,6 @@ Window::~Window() delete mpWindowImpl->mpWinData->mpFocusRect; if ( mpWindowImpl->mpWinData->mpTrackRect ) delete mpWindowImpl->mpWinData->mpTrackRect; - // Native widget support - delete mpWindowImpl->mpWinData->mpSalControlHandle; - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; - if ( mpWindowImpl->mpWinData->mpSmartHelpId ) delete mpWindowImpl->mpWinData->mpSmartHelpId; if ( mpWindowImpl->mpWinData->mpSmartUniqueId ) @@ -7444,13 +7453,13 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR // ----------------------------------------------------------------------- -Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const { // with decoration return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE ); } -Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const { // without decoration return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE ); @@ -7458,12 +7467,12 @@ Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) // ----------------------------------------------------------------------- -Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) +Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const { SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); // make sure we use the extent of our border window, // otherwise we miss a few pixels - Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; + const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) ); aPos.X() += g.nX; diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index aecbc9c3ef0c..65019ba2a4af 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -28,269 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#define _SV_WINDOW_CXX - -#include "svsys.h" -#include "vcl/window.h" #include "vcl/window.hxx" #include "vcl/waitobj.hxx" -#include "vcl/salgdi.hxx" -#include "vcl/salnativewidgets.hxx" -#include "vcl/salctrlhandle.hxx" -#include "rtl/ustring.hxx" #include "vcl/button.hxx" -using namespace rtl; - -// ----------------------------------------------------------------------- -// These functions are mainly passthrough functions that allow access to -// the SalFrame behind a Window object for native widget rendering purposes. -// ----------------------------------------------------------------------- - -void Window::ImplInitSalControlHandle() -{ - // create SalControlHandle on demand - // not needed for ordinary windows - // TODO: move creation to SalGraphics - //if( !ImplGetWinData()->mpSalControlHandle ) - // ImplGetWinData()->mpSalControlHandle = new SalControlHandle; -} - -// ----------------------------------------------------------------------- - -BOOL Window::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - return( mpGraphics->IsNativeControlSupported(nType, nPart) ); -} - - -// ----------------------------------------------------------------------- - -BOOL Window::HitTestNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - const Point& aPos, - BOOL& rIsInside ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, OutputToScreenPixel( aPos ), *ImplGetWinData()->mpSalControlHandle, rIsInside, this ) ); -} - -// ----------------------------------------------------------------------- - -void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) const -{ - if( aValue.getOptionalVal() ) - { - switch( nType ) - { - case CTRL_SLIDER: - { - SliderValue* pSlVal = reinterpret_cast<SliderValue*>(aValue.getOptionalVal()); - pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SCROLLBAR: - { - ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(aValue.getOptionalVal()); - pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SPINBOX: - case CTRL_SPINBUTTONS: - { - SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(aValue.getOptionalVal()); - pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); - pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_TOOLBAR: - { - ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(aValue.getOptionalVal()); - pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - } - } -} - -BOOL Window::DrawNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - /* - if( !IsInPaint() && IsPaintTransparent() ) - { - // only required if called directly (ie, we're not in Paint() ): - // force redraw (Paint()) for transparent controls - // to trigger a repaint of the background - Region aClipRgn( GetClipRegion() ); - if( !rControlRegion.IsEmpty() ) - aClipRgn.Intersect( rControlRegion ); - Invalidate( aClipRgn, INVALIDATE_UPDATE ); - return TRUE; - } - */ - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return TRUE; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - // do so for ImplControlValue members, also - ImplMoveControlValue( nType, aValue, aWinOffs ); - - Region aTestRegion( GetActiveClipRegion() ); - aTestRegion.Intersect( rControlRegion ); - if( aTestRegion == rControlRegion ) - nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed - - BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::DrawNativeControlText(ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return false; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return true; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::GetNativeControlRegion( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, - *ImplGetWinData()->mpSalControlHandle, aCaption, rNativeBoundingRegion, - rNativeContentRegion, this ); - if( bRet ) - { - // transform back native regions - rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - } - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - // ----------------------------------------------------------------------- WaitObject::~WaitObject() |