diff options
46 files changed, 789 insertions, 711 deletions
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 7111a29a6a8a..484584828b9f 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1067,14 +1067,14 @@ void SvImpLBox::DrawNet() //so that SvImpLBox::DrawNet() doesn't draw anything too if(pView->IsNativeControlSupported( CTRL_LISTNET, PART_ENTIRE_CONTROL)) { ImplControlValue aControlValue; - Point aTemp(0,0); // temporary needed for g++ 3.3.5 - Region aCtrlRegion( Rectangle(aTemp, Size( 0, 0 )) ); + Point aTemp(0,0); // temporary needed for g++ 3.3.5 + Rectangle aCtrlRegion( aTemp, Size( 0, 0 ) ); ControlState nState = CTRL_STATE_ENABLED; - if( pView->DrawNativeControl( CTRL_LISTNET, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, rtl::OUString() ) ) - { - return; - } + if( pView->DrawNativeControl( CTRL_LISTNET, PART_ENTIRE_CONTROL, + aCtrlRegion, nState, aControlValue, rtl::OUString() ) ) + { + return; + } } diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 82321b53259e..edb0a65cb39f 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -425,7 +425,7 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */, if ( nIndex != SV_BMP_STATICIMAGE && pWin && pWin->IsNativeControlSupported( (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX, PART_ENTIRE_CONTROL) ) { ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle(rPos, Size(pData->Width(), pData->Height())) ); + Rectangle aCtrlRegion( rPos, Size(pData->Width(), pData->Height()) ); ControlState nState = 0; //states CTRL_STATE_DEFAULT, CTRL_STATE_PRESSED and CTRL_STATE_ROLLOVER are not implemented @@ -440,7 +440,7 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */, aControlValue.setTristateVal( BUTTONVALUE_MIXED ); bNativeOK = pWin->DrawNativeControl( (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + aCtrlRegion, nState, aControlValue, rtl::OUString() ); } if( !bNativeOK) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index bf6e41f93f36..b11a3f12ddf3 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -1814,7 +1814,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags, if ( IsNativeControlSupported( CTRL_LISTNODE, PART_ENTIRE_CONTROL) ) { ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle(aPos, pImg->GetSizePixel() ) ); + Rectangle aCtrlRegion( aPos, pImg->GetSizePixel() ); ControlState nState = 0; if ( IsEnabled() ) nState |= CTRL_STATE_ENABLED; diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index fa393da3d5a8..f0bd192fc02c 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -920,7 +920,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ) ); Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, - Region( aCtrlRect ), + aCtrlRect, CTRL_STATE_ENABLED, ImplControlValue(), OUString() ); @@ -928,7 +928,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { bDrawItemRect = false; if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, - Region( aItemRect ), + aItemRect, CTRL_STATE_SELECTED | ( pEntry->mbEnabled? CTRL_STATE_ENABLED: 0 ), ImplControlValue(), OUString() ) ) @@ -1312,13 +1312,12 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; - Region aCtrlRegion( i_rRect ); ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED; aControlValue.setTristateVal( BUTTONVALUE_ON ); bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, - aCtrlRegion, nState, aControlValue, + i_rRect, nState, aControlValue, rtl::OUString() ); } @@ -1335,10 +1334,10 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo rMaxWidth = rCheckHeight = rRadioHeight = 0; ImplControlValue aVal; - Region aNativeBounds; - Region aNativeContent; + Rectangle aNativeBounds; + Rectangle aNativeContent; Point tmp( 0, 0 ); - Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) { if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), @@ -1351,8 +1350,8 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo aNativeContent ) ) { - rCheckHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = aNativeContent.GetBoundRect().GetWidth(); + rCheckHeight = aNativeBounds.GetHeight(); + rMaxWidth = aNativeContent.GetWidth(); } } if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) @@ -1367,8 +1366,8 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo aNativeContent ) ) { - rRadioHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth()); + rRadioHeight = aNativeBounds.GetHeight(); + rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); } } return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; @@ -1492,7 +1491,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); - DrawNativeControl( CTRL_MENU_POPUP, nPart, Region( aCheckRect ), nState, ImplControlValue(), OUString() ); + DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, ImplControlValue(), OUString() ); } else if ( pEntry->mbChecked ) // by default do nothing for unchecked items { diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 38aee00c8f55..23067d3ee5d0 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -296,19 +296,18 @@ namespace svt const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) ); TabitemValue tiValue; - ImplControlValue aControlValue( (void*)(&tiValue) ); - Region aBoundingRegion, aContentRegion; + Rectangle aBoundingRegion, aContentRegion; bool bNativeOK = getTargetDevice().GetNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentArea, nState, - aControlValue, ::rtl::OUString(), + tiValue, ::rtl::OUString(), aBoundingRegion, aContentRegion ); (void)bNativeOK; OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - return aBoundingRegion.GetBoundRect(); + return aBoundingRegion; } //------------------------------------------------------------------------------------------------------------------ @@ -322,9 +321,8 @@ namespace svt if ( i_nItemFlags & ITEM_POSITION_LAST ) tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; - ImplControlValue aControlValue( (void *)(&tiValue) ); - bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, aControlValue, rtl::OUString() ); + bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, tiValue, rtl::OUString() ); (void)bNativeOK; OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx index 7198d0e8f98c..9c9ef1dc4b5a 100644 --- a/tools/source/string/strucvt.cxx +++ b/tools/source/string/strucvt.cxx @@ -201,6 +201,8 @@ UniString::UniString( const ResId& rResId ) Append( UniString::CreateFromInt32( rResId.GetId() ) ); AppendAscii( " not found>" ); #endif + if( pResMgr ) + pResMgr->PopContext(); } diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index a1d287337bea..e8ae78d0aed2 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -1199,8 +1199,15 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam // try to find an exact match // because the list is sorted this will also find fontnames of the form searchfontname* std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() ); - if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL ) - return &(*it); + if( it != lang->second.aSubstAttributes.end()) + { + const FontNameAttr& rFoundAttr = *it; + // a search for "abcblack" may match with an entry for "abc" + // the reverse is not a good idea (e.g. #i112731# alba->albani) + if( rFoundAttr.Name.Len() <= aSearchFont.Len() ) + if( aSearchFont.CompareTo( rFoundAttr.Name, rFoundAttr.Name.Len() ) == COMPARE_EQUAL ) + return &rFoundAttr; + } } // gradually become more unspecific if( aLocale.Variant.getLength() ) diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 1948018806e1..8867d1d26078 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -229,17 +229,17 @@ public: CGPoint* makeCGptArray(ULONG nPoints, const SalPoint* pPtAry); // native widget rendering methods that require mirroring - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); // get device resolution virtual void GetResolution( long& rDPIX, long& rDPIY ); diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index d5c09137e9cb..6e206977b5c4 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -379,13 +379,13 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n * aPos was or was not inside the native widget specified by the * nType/nPart combination. */ -BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, +BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& rPos, BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { Rectangle aRect; - bool bValid = AquaGetScrollRect( /* TODO: m_nScreen */ nPart, rControlRegion.GetBoundRect(), aRect ); + bool bValid = AquaGetScrollRect( /* TODO: m_nScreen */ nPart, rControlRegion, aRect ); rIsInside = bValid ? aRect.IsInside( rPos ) : FALSE; if( GetSalData()->mbIsScrollbarDoubleMax ) { @@ -472,7 +472,7 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState ) */ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ) @@ -484,7 +484,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, CGContextSaveGState( mrContext ); - Rectangle buttonRect = rControlRegion.GetBoundRect(); + Rectangle buttonRect = rControlRegion; HIRect rc = ImplGetHIRectFromRectangle(buttonRect); /** Scrollbar parts code equivalent ** @@ -621,7 +621,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, // no animation aPushInfo.animation.time.start = 0; aPushInfo.animation.time.current = 0; - PushButtonValue* pPBVal = (PushButtonValue*)aValue.getOptionalVal(); + PushButtonValue* pPBVal = aValue.getType() == CTRL_PUSHBUTTON ? (PushButtonValue*)&aValue : NULL; int nPaintHeight = static_cast<int>(rc.size.height); if( pPBVal && pPBVal->mbBevelButton ) @@ -790,7 +790,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, case CTRL_SLIDER: { - SliderValue* pSLVal = (SliderValue*)aValue.getOptionalVal(); + SliderValue* pSLVal = (SliderValue*)&aValue; HIThemeTrackDrawInfo aTrackDraw; aTrackDraw.kind = kThemeSliderMedium; @@ -820,7 +820,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, case CTRL_SCROLLBAR: { - ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal()); + ScrollbarValue* pScrollbarVal = (ScrollbarValue *)&aValue; if( nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_DRAW_BACKGROUND_HORZ ) @@ -962,7 +962,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, //first, last or middle tab aTabItemDrawInfo.position=kHIThemeTabPositionMiddle; - TabitemValue* pTabValue = (TabitemValue *) aValue.getOptionalVal(); + TabitemValue* pTabValue = (TabitemValue *) &aValue; unsigned int nAlignment = pTabValue->mnAlignment; //TABITEM_LEFTALIGNED (and TABITEM_RIGHTALIGNED) for the leftmost (or rightmost) tab //when there are several lines of tabs because there is only one first tab and one @@ -1089,7 +1089,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, if(nState & CTRL_STATE_FOCUSED) HIThemeDrawFocusRect(&rc, true, mrContext, kHIThemeOrientationNormal); //buttons: - SpinbuttonValue* pSpinButtonVal = (SpinbuttonValue *)(aValue.getOptionalVal()); + SpinbuttonValue* pSpinButtonVal = (SpinbuttonValue *)&aValue; ControlState nUpperState = CTRL_STATE_ENABLED;//state of the upper button ControlState nLowerState = CTRL_STATE_ENABLED;//and of the lower button if(pSpinButtonVal) {//pSpinButtonVal is sometimes null @@ -1228,7 +1228,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, +BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ) { @@ -1249,14 +1249,14 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar * aValue: An optional value (tristate/numerical/string) * aCaption: A caption or title string (like button text etc) */ -BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, +BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { BOOL toReturn = FALSE; - Rectangle aCtrlBoundRect( rControlRegion.GetBoundRect() ); + Rectangle aCtrlBoundRect( rControlRegion ); short x = aCtrlBoundRect.Left(); short y = aCtrlBoundRect.Top(); short w, h; @@ -1271,14 +1271,14 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa { w = 19; // taken from HIG h = aCtrlBoundRect.GetHeight(); - rNativeBoundingRegion = rNativeContentRegion = Region( Rectangle( Point( x, y ), Size( w, h ) ) ); + rNativeBoundingRegion = rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); toReturn = true; } else if( nPart == PART_THUMB_VERT ) { w = aCtrlBoundRect.GetWidth(); h = 18; // taken from HIG - rNativeBoundingRegion = rNativeContentRegion = Region( Rectangle( Point( x, y ), Size( w, h ) ) ); + rNativeBoundingRegion = rNativeContentRegion = Rectangle( Point( x, y ), Size( w, h ) ); toReturn = true; } } diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 8f4b94bf7b18..fa185c32dcda 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -66,6 +66,8 @@ public: SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); SAL_DLLPRIVATE SymbolAlign ImplGetSymbolAlign() const; SAL_DLLPRIVATE void ImplSetSmallSymbol( BOOL bSmall = TRUE ); + SAL_DLLPRIVATE const Rectangle& ImplGetSymbolRect() const; + SAL_DLLPRIVATE void ImplSetSymbolRect(const Rectangle&); protected: Button( WindowType nType ); diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 9b748f2b5937..f787df3692ce 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -1191,14 +1191,14 @@ public: // Query the native control to determine if it was acted upon BOOL HitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); // Request rendering of a particular control and/or part BOOL DrawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption ); @@ -1206,7 +1206,7 @@ public: // Request rendering of a caption string for a control BOOL DrawNativeControlText( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption ); @@ -1214,12 +1214,12 @@ public: // Query the native control's actual drawing region (including adornment) BOOL GetNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ); }; diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 08c489f7d466..f75817071304 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -158,17 +158,17 @@ protected: virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ) = 0; // native widget rendering methods that require mirroring - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); /** Render bitmap with alpha channel @@ -440,7 +440,7 @@ public: // Query the native control to determine if it was acted upon BOOL HitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ); @@ -448,7 +448,7 @@ public: // Request rendering of a particular control and/or part BOOL DrawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, @@ -457,7 +457,7 @@ public: // Request rendering of a caption string for a control BOOL DrawNativeControlText( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, @@ -466,12 +466,12 @@ public: // Query the native control's actual drawing region (including adornment) BOOL GetNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion, + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ); static void AddDevFontSubstitute( OutputDevice* pOutDev, diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index 8e98791d9f78..19c34cbc5e34 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -41,6 +41,9 @@ typedef sal_uInt32 ControlType; +// for use in general purpose ImplControlValue +#define CTRL_GENERIC 0 + // Normal PushButton/Command Button #define CTRL_PUSHBUTTON 1 @@ -260,13 +263,50 @@ enum ButtonValue { BUTTONVALUE_MIXED }; -#ifdef __cplusplus +/* ImplControlValue: + * + * Generic value container for all control parts. + */ + +class VCL_DLLPUBLIC ImplControlValue +{ + friend class SalFrame; + + private: + ControlType mType; + ButtonValue mTristate; // Tristate value: on, off, mixed + long mNumber; // numeric value + protected: + ImplControlValue( ControlType i_eType, ButtonValue i_eTriState, long i_nNumber ) + : mType( i_eType ) + , mTristate( i_eTriState ) + , mNumber( i_nNumber ) + {} + + public: + explicit ImplControlValue( ButtonValue nTristate ) + : mType( CTRL_GENERIC ), mTristate(nTristate), mNumber(0) {} + explicit ImplControlValue( long nNumeric ) + : mType( CTRL_GENERIC ), mTristate(BUTTONVALUE_DONTKNOW), mNumber( nNumeric) {} + inline ImplControlValue() + : mType( CTRL_GENERIC ), mTristate(BUTTONVALUE_DONTKNOW), mNumber(0) {} + + virtual ~ImplControlValue(); + + ControlType getType() const { return mType; } + + inline ButtonValue getTristateVal( void ) const { return mTristate; } + inline void setTristateVal( ButtonValue nTristate ) { mTristate = nTristate; } + + inline long getNumericVal( void ) const { return mNumber; } + inline void setNumericVal( long nNumeric ) { mNumber = nNumeric; } +}; /* ScrollbarValue: * * Value container for scrollbars. */ -class VCL_DLLPUBLIC ScrollbarValue + class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue { public: long mnMin; @@ -283,15 +323,16 @@ class VCL_DLLPUBLIC ScrollbarValue ControlState mnPage2State; inline ScrollbarValue() - { - mnMin = 0; mnMax = 0; mnCur = 0; mnVisibleSize = 0; - mnButton1State = 0; mnButton2State = 0; - mnThumbState = 0; mnPage1State = 0; mnPage2State = 0; - }; - inline ~ScrollbarValue() {}; + : ImplControlValue( CTRL_SCROLLBAR, BUTTONVALUE_DONTKNOW, 0 ) + { + mnMin = 0; mnMax = 0; mnCur = 0; mnVisibleSize = 0; + mnButton1State = 0; mnButton2State = 0; + mnThumbState = 0; mnPage1State = 0; mnPage2State = 0; + }; + virtual ~ScrollbarValue(); }; -class VCL_DLLPUBLIC SliderValue +class VCL_DLLPUBLIC SliderValue : public ImplControlValue { public: long mnMin; @@ -300,9 +341,11 @@ class VCL_DLLPUBLIC SliderValue Rectangle maThumbRect; ControlState mnThumbState; - SliderValue() : mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( 0 ) + SliderValue() + : ImplControlValue( CTRL_SLIDER, BUTTONVALUE_DONTKNOW, 0 ) + , mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( 0 ) {} - ~SliderValue() {} + virtual ~SliderValue(); }; /* TabitemValue: @@ -317,23 +360,24 @@ class VCL_DLLPUBLIC SliderValue #define TABITEM_FIRST_IN_GROUP 0x004 // the tabitem is the first in group of tabitems #define TABITEM_LAST_IN_GROUP 0x008 // the tabitem is the last in group of tabitems -class VCL_DLLPUBLIC TabitemValue +class VCL_DLLPUBLIC TabitemValue : public ImplControlValue { public: unsigned int mnAlignment; inline TabitemValue() - { - mnAlignment = 0; - }; - inline ~TabitemValue() {}; - - BOOL isLeftAligned() { return (mnAlignment & TABITEM_LEFTALIGNED) != 0; } - BOOL isRightAligned() { return (mnAlignment & TABITEM_RIGHTALIGNED) != 0; } - BOOL isBothAligned() { return isLeftAligned() && isRightAligned(); } - BOOL isNotAligned() { return (mnAlignment & (TABITEM_LEFTALIGNED | TABITEM_RIGHTALIGNED)) == 0; } - BOOL isFirst() { return (mnAlignment & TABITEM_FIRST_IN_GROUP) != 0; } - BOOL isLast() { return (mnAlignment & TABITEM_LAST_IN_GROUP) != 0; } + : ImplControlValue( CTRL_TAB_ITEM, BUTTONVALUE_DONTKNOW, 0 ) + { + mnAlignment = 0; + }; + virtual ~TabitemValue(); + + BOOL isLeftAligned() const { return (mnAlignment & TABITEM_LEFTALIGNED) != 0; } + BOOL isRightAligned() const { return (mnAlignment & TABITEM_RIGHTALIGNED) != 0; } + BOOL isBothAligned() const { return isLeftAligned() && isRightAligned(); } + BOOL isNotAligned() const { return (mnAlignment & (TABITEM_LEFTALIGNED | TABITEM_RIGHTALIGNED)) == 0; } + BOOL isFirst() const { return (mnAlignment & TABITEM_FIRST_IN_GROUP) != 0; } + BOOL isLast() const { return (mnAlignment & TABITEM_LAST_IN_GROUP) != 0; } }; /* SpinbuttonValue: @@ -342,7 +386,7 @@ class VCL_DLLPUBLIC TabitemValue * Note: the other parameters of DrawNativeControl will have no meaning * all parameters for spinbuttons are carried here */ -class VCL_DLLPUBLIC SpinbuttonValue +class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue { public: Rectangle maUpperRect; @@ -353,20 +397,23 @@ class VCL_DLLPUBLIC SpinbuttonValue int mnLowerPart; inline SpinbuttonValue() - { - mnUpperState = mnLowerState = 0; - }; - inline ~SpinbuttonValue() {}; + : ImplControlValue( CTRL_SPINBUTTONS, BUTTONVALUE_DONTKNOW, 0 ) + { + mnUpperState = mnLowerState = 0; + }; + virtual ~SpinbuttonValue(); }; /* Toolbarvalue: * * Value container for toolbars detailing the grip position */ -class ToolbarValue +class ToolbarValue : public ImplControlValue { public: - ToolbarValue() { mbIsTopDockingArea = FALSE; } + ToolbarValue() : ImplControlValue( CTRL_TOOLBAR, BUTTONVALUE_DONTKNOW, 0 ) + { mbIsTopDockingArea = FALSE; } + virtual ~ToolbarValue(); Rectangle maGripRect; BOOL mbIsTopDockingArea; // indicates that this is the top aligned dockingarea // adjacent to the menubar @@ -376,10 +423,12 @@ public: * * Value container for menubars specifying height of adjacent docking area */ -class MenubarValue +class MenubarValue : public ImplControlValue { public: - MenubarValue() { maTopDockingAreaHeight=0; } + MenubarValue() : ImplControlValue( CTRL_MENUBAR, BUTTONVALUE_DONTKNOW, 0 ) + { maTopDockingAreaHeight=0; } + virtual ~MenubarValue(); int maTopDockingAreaHeight; }; @@ -387,61 +436,18 @@ public: * * Value container for pushbuttons specifying additional drawing hints */ -class PushButtonValue +class PushButtonValue : public ImplControlValue { public: -PushButtonValue() : mbBevelButton( false ), mbSingleLine( true ) {} + PushButtonValue() + : ImplControlValue( CTRL_PUSHBUTTON, BUTTONVALUE_DONTKNOW, 0 ) + , mbBevelButton( false ), mbSingleLine( true ) {} + virtual ~PushButtonValue(); + bool mbBevelButton:1; bool mbSingleLine:1; }; -/* ImplControlValue: - * - * Generic value container for all control parts. - */ - -class ImplControlValue -{ - friend class SalFrame; - - private: - ButtonValue mTristate; // Tristate value: on, off, mixed - rtl::OUString mString; // string value - long mNumber; // numeric value - void * mOptionalVal; // optional control-specific value - - public: - inline ImplControlValue( ButtonValue nTristate, rtl::OUString sString, long nNumeric, void * aOptVal ) \ - { mTristate = nTristate; mString = sString; mNumber = nNumeric; mOptionalVal = aOptVal; }; - inline ImplControlValue( ButtonValue nTristate, rtl::OUString sString, long nNumeric ) \ - { mTristate = nTristate; mString = sString; mNumber = nNumeric; mOptionalVal = NULL; }; - explicit ImplControlValue( ButtonValue nTristate ) - : mTristate(nTristate), mNumber(0), mOptionalVal(NULL) {} - explicit ImplControlValue( rtl::OUString& rString ) - : mTristate(BUTTONVALUE_DONTKNOW), mString(rString), mNumber(0), mOptionalVal(NULL) {} - explicit ImplControlValue( long nNumeric ) - : mTristate(BUTTONVALUE_DONTKNOW), mNumber( nNumeric), mOptionalVal(NULL) {} - explicit ImplControlValue( void* aOptVal ) - : mTristate(BUTTONVALUE_DONTKNOW), mNumber(0), mOptionalVal(aOptVal) {} - inline ImplControlValue() - : mTristate(BUTTONVALUE_DONTKNOW), mNumber(0), mOptionalVal(NULL) {} - - inline ~ImplControlValue() { mOptionalVal = NULL; }; - - inline ButtonValue getTristateVal( void ) const { return mTristate; } - inline void setTristateVal( ButtonValue nTristate ) { mTristate = nTristate; } - - inline const rtl::OUString& getStringVal( void ) const { return mString; } - inline void setStringVal( rtl::OUString sString ) { mString = sString; } - - inline long getNumericVal( void ) const { return mNumber; } - inline void setNumericVal( long nNumeric ) { mNumber = nNumeric; } - - inline void * getOptionalVal( void ) const { return mOptionalVal; } - inline void setOptionalVal( void * aOptVal ) { mOptionalVal = aOptVal; } -}; - -#endif /* __cplusplus */ #endif diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index ac1da931ba06..1f9efa7b6e65 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -444,7 +444,7 @@ void HelpTextWindow::Paint( const Rectangle& ) if ( IsNativeControlSupported( CTRL_TOOLTIP, PART_ENTIRE_CONTROL ) ) { // #i46472# workaround gcc3.3 temporary problem - Region aCtrlRegion = Region( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( Point( 0, 0 ), GetOutputSizePixel() ); ImplControlValue aControlValue; bNativeOK = DrawNativeControl( CTRL_TOOLTIP, PART_ENTIRE_CONTROL, aCtrlRegion, 0, aControlValue, rtl::OUString() ); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index d66389eee62d..d4f29e224e7b 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -83,6 +83,7 @@ class ImplCommonButtonData { public: Rectangle maFocusRect; + Rectangle maSymbolRect; USHORT mnButtonState; BOOL mbSmallSymbol; @@ -334,6 +335,18 @@ const Rectangle& Button::GetFocusRect() const // ----------------------------------------------------------------------- +const Rectangle& Button::ImplGetSymbolRect() const +{ + return mpButtonData->maSymbolRect; +} + +void Button::ImplSetSymbolRect( const Rectangle& i_rRect ) +{ + mpButtonData->maSymbolRect = i_rRect; +} + +// ----------------------------------------------------------------------- + USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags ) { @@ -1176,6 +1189,9 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags Size aSize = rRect.GetSize(); Point aPos = rRect.TopLeft(); + ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; + if( nImageSep < 1 ) + nImageSep = 1; if ( mnDDStyle == PUSHBUTTON_DROPDOWN_MENUBUTTON ) { if ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) ) @@ -1186,8 +1202,8 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags aInRect.Left() = aInRect.Right() - nSymbolSize; aSize.Width() -= ( 5 + nSymbolSize ); - ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, - 1, nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); + ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, + nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); } else ImplCalcSymbolRect( aInRect ); @@ -1195,15 +1211,19 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags if( ! bLayout ) { DecorationView aDecoView( pDev ); + long nDistance = (aInRect.GetHeight() > 10) ? 2 : 1; + long nX = aInRect.Left() - 2*nDistance;; + Point aStartPt( nX, aInRect.Top()+nDistance ); + Point aEndPt( nX, aInRect.Bottom()-nDistance ); + aDecoView.DrawSeparator( aStartPt, aEndPt ); aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle ); + aInRect.Left() -= 2*nDistance; + ImplSetSymbolRect( aInRect ); } } else { Rectangle aSymbolRect; - ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; - if( nImageSep < 1 ) - nImageSep = 1; // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary // in the next major this should be replaced by "true" ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, @@ -1213,6 +1233,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags { DecorationView aDecoView( pDev ); aDecoView.DrawSymbol( aSymbolRect, meSymbol, aColor, nStyle ); + ImplSetSymbolRect( aSymbolRect ); } if ( mnDDStyle == PUSHBUTTON_DROPDOWN_TOOLBOX && !bLayout ) @@ -1314,7 +1335,6 @@ void PushButton::ImplDrawPushButton( bool bLayout ) // for CTRL_LISTBOX/PART_BUTTON_DOWN and CTRL_COMBOBOX/PART_BUTTON_DOWN ImplControlValue aControlValue; - Region aCtrlRegion( aInRect ); ControlState nState = 0; if ( mbPressed ) nState |= CTRL_STATE_PRESSED; @@ -1326,7 +1346,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if ( IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() ) ) nState |= CTRL_STATE_ROLLOVER; - bNativeOK = DrawNativeControl( aCtrlType, PART_BUTTON_DOWN, aCtrlRegion, nState, + bNativeOK = DrawNativeControl( aCtrlType, PART_BUTTON_DOWN, aInRect, nState, aControlValue, rtl::OUString() ); } } @@ -1338,10 +1358,8 @@ void PushButton::ImplDrawPushButton( bool bLayout ) bool bRollOver = (IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() )); if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) { - PushButtonValue aPBVal; - ImplControlValue aControlValue; - aControlValue.setOptionalVal( &aPBVal ); - Region aCtrlRegion( aInRect ); + PushButtonValue aControlValue; + Rectangle aCtrlRegion( aInRect ); ControlState nState = 0; if ( mbPressed || IsChecked() ) nState |= CTRL_STATE_PRESSED; @@ -1354,7 +1372,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) nState |= CTRL_STATE_ROLLOVER; if( GetStyle() & WB_BEVELBUTTON ) - aPBVal.mbBevelButton = true; + aControlValue.mbBevelButton = true; // draw frame into invisible window to have aInRect modified correctly // but do not shift the inner rect for pressed buttons (ie remove BUTTON_DRAW_PRESSED) @@ -1373,7 +1391,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aFontSize( Application::GetSettings().GetStyleSettings().GetPushButtonFont().GetSize() ); aFontSize = LogicToPixel( aFontSize, MapMode( MAP_POINT ) ); Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); - aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); + aControlValue.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) ) { @@ -1434,22 +1452,19 @@ void PushButton::ImplSetDefButton( BOOL bSet ) if ( (IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) { - Region aBoundingRgn, aContentRgn; + Rectangle aBound, aCont; Rectangle aCtrlRect( 0, 0, 80, 20 ); // use a constant size to avoid accumulating // will not work if the theme has dynamic adornment sizes ImplControlValue aControlValue; - Region aCtrlRegion( aCtrlRect ); + Rectangle aCtrlRegion( aCtrlRect ); ControlState nState = CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED; // get native size of a 'default' button // and adjust the VCL button if more space for adornment is required if( GetNativeControlRegion( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString(), - aBoundingRgn, aContentRgn ) ) + aBound, aCont ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - Rectangle aBound(aBoundingRgn.GetBoundRect()); - dLeft = aCont.Left() - aBound.Left(); dTop = aCont.Top() - aBound.Top(); dRight = aBound.Right() - aCont.Right(); @@ -2004,6 +2019,8 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const aSize = Size( 16, 12 ); else aSize = Size( 26, 24 ); + if( mnDDStyle == PUSHBUTTON_DROPDOWN_MENUBUTTON ) + aSize.Width() += 4; } else if ( IsImage() && ! (ImplGetButtonState() & BUTTON_DRAW_NOIMAGE) ) aSize = GetModeImage().GetSizePixel(); @@ -2334,9 +2351,8 @@ void RadioButton::ImplDrawRadioButtonState() // no native drawing for image radio buttons if ( !maImage && (bNativeOK=IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) { - ImplControlValue aControlValue( mbChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 ); + ImplControlValue aControlValue( mbChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); Rectangle aCtrlRect( maStateRect.TopLeft(), maStateRect.GetSize() ); - Region aCtrlRegion( aCtrlRect ); ControlState nState = 0; if ( ImplGetButtonState() & BUTTON_DRAW_PRESSED ) nState |= CTRL_STATE_PRESSED; @@ -2347,7 +2363,7 @@ void RadioButton::ImplDrawRadioButtonState() if ( IsMouseOver() && maMouseRect.IsInside( GetPointerPosPixel() ) ) nState |= CTRL_STATE_ROLLOVER; - bNativeOK = DrawNativeControl( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, + bNativeOK = DrawNativeControl( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL, aCtrlRect, nState, aControlValue,rtl::OUString() ); } @@ -3198,17 +3214,16 @@ Size RadioButton::ImplGetRadioImageSize() const { ImplControlValue aControlValue; // #i45896# workaround gcc3.3 temporary problem - Region aCtrlRegion = Region( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + Rectangle aCtrlRegion( Point( 0, 0 ), GetSizePixel() ); ControlState nState = CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED; - Region aBoundingRgn, aContentRgn; + Rectangle aBoundingRgn, aContentRgn; // get native size of a radio button if( pThis->GetNativeControlRegion( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - aSize = aCont.GetSize(); + aSize = aContentRgn.GetSize(); bDefaultSize = false; } } @@ -3323,16 +3338,15 @@ void RadioButton::ImplSetMinimumNWFSize() ImplControlValue aControlValue; Size aCurSize( GetSizePixel() ); - Region aCtrlRegion = Region( Rectangle( Point( 0, 0 ), aCurSize ) ); - Region aBoundingRgn, aContentRgn; + Rectangle aCtrlRegion( Point( 0, 0 ), aCurSize ); + Rectangle aBoundingRgn, aContentRgn; // get native size of a radiobutton if( GetNativeControlRegion( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - Size aSize = aCont.GetSize(); + Size aSize = aContentRgn.GetSize(); if( aSize.Height() > aCurSize.Height() ) { @@ -3509,8 +3523,8 @@ void CheckBox::ImplDrawCheckBoxState() if ( (bNativeOK=IsNativeControlSupported(CTRL_CHECKBOX, PART_ENTIRE_CONTROL)) == TRUE ) { - ImplControlValue aControlValue( meState == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 ); - Region aCtrlRegion( maStateRect ); + ImplControlValue aControlValue( meState == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); + Rectangle aCtrlRegion( maStateRect ); ControlState nState = 0; if ( HasFocus() ) nState |= CTRL_STATE_FOCUSED; @@ -4144,17 +4158,16 @@ Size CheckBox::ImplGetCheckImageSize() const { ImplControlValue aControlValue; // #i45896# workaround gcc3.3 temporary problem - Region aCtrlRegion = Region( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + Rectangle aCtrlRegion( Point( 0, 0 ), GetSizePixel() ); ControlState nState = CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED; - Region aBoundingRgn, aContentRgn; + Rectangle aBoundingRgn, aContentRgn; // get native size of a check box if( pThis->GetNativeControlRegion( CTRL_CHECKBOX, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - aSize = aCont.GetSize(); + aSize = aContentRgn.GetSize(); bDefaultSize = false; } } @@ -4234,16 +4247,15 @@ void CheckBox::ImplSetMinimumNWFSize() ImplControlValue aControlValue; Size aCurSize( GetSizePixel() ); - Region aCtrlRegion = Region( Rectangle( Point( 0, 0 ), aCurSize ) ); - Region aBoundingRgn, aContentRgn; + Rectangle aCtrlRegion( Point( 0, 0 ), aCurSize ); + Rectangle aBoundingRgn, aContentRgn; // get native size of a radiobutton if( GetNativeControlRegion( CTRL_CHECKBOX, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - Size aSize = aCont.GetSize(); + Size aSize = aContentRgn.GetSize(); if( aSize.Height() > aCurSize.Height() ) { @@ -4444,8 +4456,8 @@ void DisclosureButton::ImplDrawCheckBoxState() Rectangle aStateRect( GetStateRect() ); - ImplControlValue aControlValue( GetState() == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 ); - Region aCtrlRegion( aStateRect ); + ImplControlValue aControlValue( GetState() == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); + Rectangle aCtrlRegion( aStateRect ); ControlState nState = 0; if ( HasFocus() ) nState |= CTRL_STATE_FOCUSED; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f5c04b7c3cfa..8efa3404a44a 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -139,8 +139,8 @@ void ComboBox::ImplCalcEditHeight() if ( !IsDropDownBox() ) mnDDHeight += 4; - Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 10, 10 ) ) ); - Region aBoundRegion, aContentRegion; + Rectangle aCtrlRegion( Point( 0, 0 ), Size( 10, 10 ) ); + Rectangle aBoundRegion, aContentRegion; ImplControlValue aControlValue; ControlType aType = IsDropDownBox() ? CTRL_COMBOBOX : CTRL_EDITBOX; if( GetNativeControlRegion( aType, PART_ENTIRE_CONTROL, @@ -149,7 +149,7 @@ void ComboBox::ImplCalcEditHeight() aControlValue, rtl::OUString(), aBoundRegion, aContentRegion ) ) { - const long nNCHeight = aBoundRegion.GetBoundRect().GetHeight(); + const long nNCHeight = aBoundRegion.GetHeight(); if( mnDDHeight < nNCHeight ) mnDDHeight = sal::static_int_cast<USHORT>( nNCHeight ); } @@ -629,10 +629,10 @@ void ComboBox::Resize() Window *pBorder = GetWindow( WINDOW_BORDER ); ImplControlValue aControlValue; Point aPoint; - Region aContent, aBound; + Rectangle aContent, aBound; // use the full extent of the control - Region aArea( Rectangle(aPoint, pBorder->GetOutputSizePixel()) ); + Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() ); if ( GetNativeControlRegion(CTRL_COMBOBOX, PART_BUTTON_DOWN, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) @@ -641,7 +641,7 @@ void ComboBox::Resize() aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aPoint ) ); aContent.Move(-aPoint.X(), -aPoint.Y()); - mpBtn->SetPosSizePixel( aContent.GetBoundRect().Left(), nTop, aContent.GetBoundRect().getWidth(), (nBottom-nTop) ); + mpBtn->SetPosSizePixel( aContent.Left(), nTop, aContent.getWidth(), (nBottom-nTop) ); // adjust the size of the edit field if ( GetNativeControlRegion(CTRL_COMBOBOX, PART_SUB_EDIT, @@ -651,13 +651,12 @@ void ComboBox::Resize() aContent.Move(-aPoint.X(), -aPoint.Y()); // use the themes drop down size - Rectangle aContentRect = aContent.GetBoundRect(); - mpSubEdit->SetPosSizePixel( aContentRect.TopLeft(), aContentRect.GetSize() ); + mpSubEdit->SetPosSizePixel( aContent.TopLeft(), aContent.GetSize() ); } else { // use the themes drop down size for the button - aOutSz.Width() -= aContent.GetBoundRect().getWidth(); + aOutSz.Width() -= aContent.getWidth(); mpSubEdit->SetSizePixel( aOutSz ); } } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 0a29a627b8e3..c0e7b352642c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2842,7 +2842,7 @@ Size Edit::CalcMinimumSize() const Size aMinSize ( CalcSize( 3 ) ); if( aSize.Width() < aMinSize.Width() ) aSize.Width() = aMinSize.Width(); - // add some space between text entry an border + // add some space between text entry and border aSize.Height() += 4; aSize = CalcWindowSize( aSize ); @@ -2850,14 +2850,13 @@ Size Edit::CalcMinimumSize() const // ask NWF what if it has an opinion, too ImplControlValue aControlValue; Rectangle aRect( Point( 0, 0 ), aSize ); - Region aContent, aBound; + Rectangle aContent, aBound; if( const_cast<Edit*>(this)->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { - Rectangle aBoundRect( aContent.GetBoundRect() ); - if( aBoundRect.GetHeight() > aSize.Height() ) - aSize.Height() = aBoundRect.GetHeight(); + if( aBound.GetHeight() > aSize.Height() ) + aSize.Height() = aBound.GetHeight(); } return aSize; } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index ebccfdc1e6bb..02c8d2b5fcb3 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2819,7 +2819,7 @@ void ImplWin::ImplDraw( bool bLayout ) sal_Int32 nLeft, nTop, nRight, nBottom; pWin->GetBorder( nLeft, nTop, nRight, nBottom ); Point aPoint( -nLeft, -nTop ); - Region aCtrlRegion( Rectangle( aPoint - GetPosPixel(), pWin->GetSizePixel() ) ); + Rectangle aCtrlRegion( aPoint - GetPosPixel(), pWin->GetSizePixel() ); BOOL bMouseOver = FALSE; if( GetParent() ) @@ -2838,8 +2838,7 @@ void ImplWin::ImplDraw( bool bLayout ) if( ! (nParentStyle & WB_BORDER) || (nParentStyle & WB_NOBORDER) ) { Rectangle aParentRect( Point( 0, 0 ), pWin->GetSizePixel() ); - Region aParentReg( aParentRect ); - pWin->DrawNativeControl( CTRL_LISTBOX, PART_ENTIRE_CONTROL, aParentReg, + pWin->DrawNativeControl( CTRL_LISTBOX, PART_ENTIRE_CONTROL, aParentRect, nState, aControlValue, rtl::OUString() ); } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 6c7df5b106bf..eb8c20d1d803 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -129,14 +129,14 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle ) IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) ) { ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 20, mnDDHeight ) ) ); - Region aBoundingRgn( aCtrlRegion ); - Region aContentRgn( aCtrlRegion ); + Rectangle aCtrlRegion( Point( 0, 0 ), Size( 20, mnDDHeight ) ); + Rectangle aBoundingRgn( aCtrlRegion ); + Rectangle aContentRgn( aCtrlRegion ); if( GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - sal_Int32 nHeight = aBoundingRgn.GetBoundRect().GetHeight(); + sal_Int32 nHeight = aBoundingRgn.GetHeight(); if( nHeight > mnDDHeight ) mnDDHeight = static_cast<USHORT>(nHeight); } @@ -652,10 +652,10 @@ void ListBox::Resize() Window *pBorder = GetWindow( WINDOW_BORDER ); ImplControlValue aControlValue; Point aPoint; - Region aContent, aBound; + Rectangle aContent, aBound; // use the full extent of the control - Region aArea( Rectangle(aPoint, pBorder->GetOutputSizePixel()) ); + Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() ); if ( GetNativeControlRegion( CTRL_LISTBOX, PART_BUTTON_DOWN, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) @@ -665,8 +665,8 @@ void ListBox::Resize() aContent.Move( -aPoint.X(), -aPoint.Y() ); // use the themes drop down size for the button - aOutSz.Width() = aContent.GetBoundRect().Left(); - mpBtn->SetPosSizePixel( aContent.GetBoundRect().Left(), nTop, aContent.GetBoundRect().Right(), (nBottom-nTop) ); + aOutSz.Width() = aContent.Left(); + mpBtn->SetPosSizePixel( aContent.Left(), nTop, aContent.Right(), (nBottom-nTop) ); // adjust the size of the edit field if ( GetNativeControlRegion( CTRL_LISTBOX, PART_SUB_EDIT, @@ -676,7 +676,6 @@ void ListBox::Resize() aContent.Move( -aPoint.X(), -aPoint.Y() ); // use the themes drop down size - Rectangle aContentRect = aContent.GetBoundRect(); if( ! (GetStyle() & WB_BORDER) && ImplGetSVData()->maNWFData.mbNoFocusRects ) { // no border but focus ring behavior -> we have a problem; the @@ -684,11 +683,11 @@ void ListBox::Resize() // let's do the best we can and center vertically, so it doesn't look // completely wrong. Size aSz( GetOutputSizePixel() ); - long nDiff = aContentRect.Top() - (aSz.Height() - aContentRect.GetHeight())/2; - aContentRect.Top() -= nDiff; - aContentRect.Bottom() -= nDiff; + long nDiff = aContent.Top() - (aSz.Height() - aContent.GetHeight())/2; + aContent.Top() -= nDiff; + aContent.Bottom() -= nDiff; } - mpImplWin->SetPosSizePixel( aContentRect.TopLeft(), aContentRect.GetSize() ); + mpImplWin->SetPosSizePixel( aContent.TopLeft(), aContent.GetSize() ); } else mpImplWin->SetSizePixel( aOutSz ); @@ -1327,15 +1326,14 @@ Size ListBox::CalcMinimumSize() const // see how large the edit area inside is to estimate what is needed for the dropdown ImplControlValue aControlValue; Point aPoint; - Region aContent, aBound; + Rectangle aContent, aBound; Size aTestSize( 100, 20 ); - Region aArea( Rectangle( aPoint, aTestSize ) ); + Rectangle aArea( aPoint, aTestSize ); if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_SUB_EDIT, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { // use the themes drop down size - Rectangle aContentRect = aContent.GetBoundRect(); - aSz.Width() += aTestSize.Width() - aContentRect.GetWidth(); + aSz.Width() += aTestSize.Width() - aContent.GetWidth(); } else aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize(); @@ -1347,13 +1345,12 @@ Size ListBox::CalcMinimumSize() const { ImplControlValue aControlValue; Rectangle aRect( Point( 0, 0 ), aSz ); - Region aContent, aBound; + Rectangle aContent, aBound; if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { - Rectangle aBoundRect( aBound.GetBoundRect() ); - if( aBoundRect.GetHeight() > aSz.Height() ) - aSz.Height() = aBoundRect.GetHeight(); + if( aBound.GetHeight() > aSz.Height() ) + aSz.Height() = aBound.GetHeight(); } } diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx index 94f61818ac92..1c83779da1a9 100644 --- a/vcl/source/control/menubtn.cxx +++ b/vcl/source/control/menubtn.cxx @@ -169,20 +169,27 @@ IMPL_LINK( MenuButton, ImplMenuTimeoutHdl, Timer*, EMPTYARG ) void MenuButton::MouseButtonDown( const MouseEvent& rMEvt ) { + bool bExecute = true; if ( mnMenuMode & MENUBUTTON_MENUMODE_TIMED ) { - if ( !mpMenuTimer ) + // if the separated dropdown symbol is hit, + // execute the popup immediately + if( ! ImplGetSymbolRect().IsInside( rMEvt.GetPosPixel() ) ) { - mpMenuTimer = new Timer; - mpMenuTimer->SetTimeoutHdl( LINK( this, MenuButton, ImplMenuTimeoutHdl ) ); - } + if ( !mpMenuTimer ) + { + mpMenuTimer = new Timer; + mpMenuTimer->SetTimeoutHdl( LINK( this, MenuButton, ImplMenuTimeoutHdl ) ); + } - mpMenuTimer->SetTimeout( GetSettings().GetMouseSettings().GetActionDelay() ); - mpMenuTimer->Start(); + mpMenuTimer->SetTimeout( GetSettings().GetMouseSettings().GetActionDelay() ); + mpMenuTimer->Start(); - PushButton::MouseButtonDown( rMEvt ); + PushButton::MouseButtonDown( rMEvt ); + bExecute = false; + } } - else + if( bExecute ) { if ( PushButton::ImplHitTestPushButton( this, rMEvt.GetPosPixel() ) ) { diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 54a1e0a97eab..9c82bb096dec 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -342,8 +342,8 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) Rectangle& maTrackRect = mpData->maTrackRect; // TODO: remove when maTrackRect is no longer in mpData if ( mbCalcSize ) { - const Region aControlRegion( Rectangle( (const Point&)Point(0,0), aSize ) ); - Region aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion; + const Rectangle aControlRegion( Point(0,0), aSize ); + Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion; if ( GetStyle() & WB_HORZ ) { @@ -352,8 +352,8 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) GetNativeControlRegion( CTRL_SCROLLBAR, PART_BUTTON_RIGHT, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aBtn2Region ) ) { - maBtn1Rect = aBtn1Region.GetBoundRect(); - maBtn2Rect = aBtn2Region.GetBoundRect(); + maBtn1Rect = aBtn1Region; + maBtn2Rect = aBtn2Region; } else { @@ -366,7 +366,7 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) if ( GetNativeControlRegion( CTRL_SCROLLBAR, PART_TRACK_HORZ_AREA, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aTrackRegion ) ) - maTrackRect = aTrackRegion.GetBoundRect(); + maTrackRect = aTrackRegion; else maTrackRect = Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() ); @@ -393,8 +393,8 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) GetNativeControlRegion( CTRL_SCROLLBAR, PART_BUTTON_DOWN, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aBtn2Region ) ) { - maBtn1Rect = aBtn1Region.GetBoundRect(); - maBtn2Rect = aBtn2Region.GetBoundRect(); + maBtn1Rect = aBtn1Region; + maBtn2Rect = aBtn2Region; } else { @@ -407,7 +407,7 @@ void ScrollBar::ImplCalc( BOOL bUpdate ) if ( GetNativeControlRegion( CTRL_SCROLLBAR, PART_TRACK_VERT_AREA, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aTrackRegion ) ) - maTrackRect = aTrackRegion.GetBoundRect(); + maTrackRect = aTrackRegion; else maTrackRect = Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() ); @@ -524,7 +524,7 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) { - ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); + ScrollbarValue scrValue; BOOL bNativeOK = IsNativeControlSupported(CTRL_SCROLLBAR, PART_ENTIRE_CONTROL); if( bNativeOK ) @@ -535,7 +535,6 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) if( IsNativeControlSupported(CTRL_SCROLLBAR, bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT) ) { ControlState nState = ( IsEnabled() ? CTRL_STATE_ENABLED : 0 ) | ( HasFocus() ? CTRL_STATE_FOCUSED : 0 ); - ScrollbarValue scrValue; scrValue.mnMin = mnMinRange; scrValue.mnMax = mnMaxRange; @@ -570,20 +569,14 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) } } - aControlValue.setOptionalVal( (void *)(&scrValue) ); - -#if 1 - Region aCtrlRegion; + Rectangle aCtrlRegion; aCtrlRegion.Union( maBtn1Rect ); aCtrlRegion.Union( maBtn2Rect ); aCtrlRegion.Union( maPage1Rect ); aCtrlRegion.Union( maPage2Rect ); aCtrlRegion.Union( maThumbRect ); -#else - const Region aCtrlRegion( Rectangle( Point(0,0), GetOutputSizePixel() ) ); -#endif bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, (bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT), - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + aCtrlRegion, nState, scrValue, rtl::OUString() ); } else { @@ -591,8 +584,8 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) { sal_uInt32 part1 = bHorz ? PART_TRACK_HORZ_LEFT : PART_TRACK_VERT_UPPER; sal_uInt32 part2 = bHorz ? PART_TRACK_HORZ_RIGHT : PART_TRACK_VERT_LOWER; - Region aCtrlRegion1( maPage1Rect ); - Region aCtrlRegion2( maPage2Rect ); + Rectangle aCtrlRegion1( maPage1Rect ); + Rectangle aCtrlRegion2( maPage2Rect ); ControlState nState1 = (IsEnabled() ? CTRL_STATE_ENABLED : 0) | (HasFocus() ? CTRL_STATE_FOCUSED : 0); ControlState nState2 = nState1; @@ -613,18 +606,18 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) if ( nDrawFlags & SCRBAR_DRAW_PAGE1 ) bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, part1, aCtrlRegion1, nState1, - aControlValue, rtl::OUString() ); + scrValue, rtl::OUString() ); if ( nDrawFlags & SCRBAR_DRAW_PAGE2 ) bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, part2, aCtrlRegion2, nState2, - aControlValue, rtl::OUString() ); + scrValue, rtl::OUString() ); } if ( (nDrawFlags & SCRBAR_DRAW_BTN1) || (nDrawFlags & SCRBAR_DRAW_BTN2) ) { sal_uInt32 part1 = bHorz ? PART_BUTTON_LEFT : PART_BUTTON_UP; sal_uInt32 part2 = bHorz ? PART_BUTTON_RIGHT : PART_BUTTON_DOWN; - Region aCtrlRegion1( maBtn1Rect ); - Region aCtrlRegion2( maBtn2Rect ); + Rectangle aCtrlRegion1( maBtn1Rect ); + Rectangle aCtrlRegion2( maBtn2Rect ); ControlState nState1 = HasFocus() ? CTRL_STATE_FOCUSED : 0; ControlState nState2 = nState1; @@ -655,16 +648,16 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) if ( nDrawFlags & SCRBAR_DRAW_BTN1 ) bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, part1, aCtrlRegion1, nState1, - aControlValue, rtl::OUString() ); + scrValue, rtl::OUString() ); if ( nDrawFlags & SCRBAR_DRAW_BTN2 ) bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, part2, aCtrlRegion2, nState2, - aControlValue, rtl::OUString() ); + scrValue, rtl::OUString() ); } if ( (nDrawFlags & SCRBAR_DRAW_THUMB) && !maThumbRect.IsEmpty() ) { ControlState nState = IsEnabled() ? CTRL_STATE_ENABLED : 0; - Region aCtrlRegion( maThumbRect ); + Rectangle aCtrlRegion( maThumbRect ); if ( mnStateFlags & SCRBAR_STATE_THUMB_DOWN ) nState |= CTRL_STATE_PRESSED; @@ -683,7 +676,7 @@ BOOL ScrollBar::ImplDrawNative( USHORT nDrawFlags ) } bNativeOK = DrawNativeControl( CTRL_SCROLLBAR, (bHorz ? PART_THUMB_HORZ : PART_THUMB_VERT), - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + aCtrlRegion, nState, scrValue, rtl::OUString() ); } } } @@ -920,7 +913,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) BOOL bIsInside = FALSE; Point aPoint( 0, 0 ); - Region aControlRegion( Rectangle( aPoint, GetOutputSizePixel() ) ); + Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); switch ( meScrollType ) { @@ -953,7 +946,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) case SCROLL_PAGEUP: // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_LEFT: PART_TRACK_VERT_UPPER, - Region( maPage1Rect ), rMousePos, bIsInside )? + maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) { @@ -967,7 +960,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction ) case SCROLL_PAGEDOWN: // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_RIGHT: PART_TRACK_VERT_LOWER, - Region( maPage2Rect ), rMousePos, bIsInside )? + maPage2Rect, rMousePos, bIsInside )? bIsInside: maPage2Rect.IsInside( rMousePos ) ) { @@ -1030,7 +1023,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) BOOL bDragToMouse = FALSE; Point aPoint( 0, 0 ); - Region aControlRegion( Rectangle( aPoint, GetOutputSizePixel() ) ); + Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); if ( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_BUTTON_LEFT: PART_BUTTON_UP, aControlRegion, rMousePos, bIsInside )? @@ -1063,7 +1056,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) else { bool bThumbHit = HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_THUMB_HORZ : PART_THUMB_VERT, - Region( maThumbRect ), rMousePos, bIsInside ) + maThumbRect, rMousePos, bIsInside ) ? bIsInside : maThumbRect.IsInside( rMousePos ); bool bDragHandling = rMEvt.IsMiddle() || bThumbHit || ImplGetSVData()->maNWFData.mbScrollbarJumpPage; if( bDragHandling ) @@ -1112,7 +1105,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) // HitTestNativeControl, see remark at top of file if ( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_LEFT : PART_TRACK_VERT_UPPER, - Region( maPage1Rect ), rMousePos, bIsInside )? + maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) { @@ -1387,7 +1380,7 @@ Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) BOOL bIsInside = FALSE; Point aPoint( 0, 0 ); - Region aControlRegion( Rectangle( aPoint, GetOutputSizePixel() ) ); + Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_BUTTON_LEFT: PART_BUTTON_UP, aControlRegion, rPt, bIsInside )? @@ -1401,19 +1394,19 @@ Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) return &maBtn2Rect; // HitTestNativeControl, see remark at top of file else if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal ? PART_TRACK_HORZ_LEFT : PART_TRACK_VERT_UPPER, - Region( maPage1Rect ), rPt, bIsInside)? + maPage1Rect, rPt, bIsInside)? bIsInside: maPage1Rect.IsInside( rPt ) ) return &maPage1Rect; // HitTestNativeControl, see remark at top of file else if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal ? PART_TRACK_HORZ_RIGHT : PART_TRACK_VERT_LOWER, - Region( maPage2Rect ), rPt, bIsInside)? + maPage2Rect, rPt, bIsInside)? bIsInside: maPage2Rect.IsInside( rPt ) ) return &maPage2Rect; // HitTestNativeControl, see remark at top of file else if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal ? PART_THUMB_HORZ : PART_THUMB_VERT, - Region( maThumbRect ), rPt, bIsInside)? + maThumbRect, rPt, bIsInside)? bIsInside: maThumbRect.IsInside( rPt ) ) return &maThumbRect; diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 2390a8e3e9a6..daf733a57a33 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -195,15 +195,14 @@ void Slider::ImplUpdateRects( BOOL bUpdate ) else maChannel2Rect.SetEmpty(); - const Region aControlRegion( Rectangle( Point(0,0), Size( SLIDER_THUMB_SIZE, 10 ) ) ); - Region aThumbBounds, aThumbContent; + const Rectangle aControlRegion( Rectangle( Point(0,0), Size( SLIDER_THUMB_SIZE, 10 ) ) ); + Rectangle aThumbBounds, aThumbContent; if ( GetNativeControlRegion( CTRL_SLIDER, PART_THUMB_HORZ, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aThumbBounds, aThumbContent ) ) { - Rectangle aRect( aThumbBounds.GetBoundRect() ); - maThumbRect.Left() = mnThumbPixPos - aRect.GetWidth()/2; - maThumbRect.Right() = maThumbRect.Left() + aRect.GetWidth() - 1; + maThumbRect.Left() = mnThumbPixPos - aThumbBounds.GetWidth()/2; + maThumbRect.Right() = maThumbRect.Left() + aThumbBounds.GetWidth() - 1; bInvalidateAll = true; } } @@ -230,15 +229,14 @@ void Slider::ImplUpdateRects( BOOL bUpdate ) else maChannel2Rect.SetEmpty(); - const Region aControlRegion( Rectangle( Point(0,0), Size( 10, SLIDER_THUMB_SIZE ) ) ); - Region aThumbBounds, aThumbContent; + const Rectangle aControlRegion( Rectangle( Point(0,0), Size( 10, SLIDER_THUMB_SIZE ) ) ); + Rectangle aThumbBounds, aThumbContent; if ( GetNativeControlRegion( CTRL_SLIDER, PART_THUMB_VERT, aControlRegion, 0, ImplControlValue(), rtl::OUString(), aThumbBounds, aThumbContent ) ) { - Rectangle aRect( aThumbBounds.GetBoundRect() ); - maThumbRect.Top() = mnThumbPixPos - aRect.GetHeight()/2; - maThumbRect.Bottom() = maThumbRect.Top() + aRect.GetHeight() - 1; + maThumbRect.Top() = mnThumbPixPos - aThumbBounds.GetHeight()/2; + maThumbRect.Bottom() = maThumbRect.Top() + aThumbBounds.GetHeight() - 1; bInvalidateAll = true; } } @@ -388,7 +386,6 @@ void Slider::ImplDraw( USHORT nDrawFlags ) ImplCalc( FALSE ); ControlPart nPart = (GetStyle() & WB_HORZ) ? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA; - ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); ControlState nState = ( IsEnabled() ? CTRL_STATE_ENABLED : 0 ) | ( HasFocus() ? CTRL_STATE_FOCUSED : 0 ); SliderValue sldValue; @@ -402,11 +399,10 @@ void Slider::ImplDraw( USHORT nDrawFlags ) if( maThumbRect.IsInside( GetPointerPosPixel() ) ) sldValue.mnThumbState |= CTRL_STATE_ROLLOVER; } - aControlValue.setOptionalVal( (void *)(&sldValue) ); - const Region aCtrlRegion( Rectangle( Point(0,0), GetOutputSizePixel() ) ); + const Rectangle aCtrlRegion( Point(0,0), GetOutputSizePixel() ); bool bNativeOK = DrawNativeControl( CTRL_SLIDER, nPart, - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + aCtrlRegion, nState, sldValue, rtl::OUString() ); if( bNativeOK ) return; diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index d18a412e31cc..754270e9012f 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -88,15 +88,12 @@ BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonVa // there is just no useful native support for spinfields with dropdown !(pWin->GetStyle() & WB_DROPDOWN) ) { - ImplControlValue aControlValue; - aControlValue.setOptionalVal( (void*) &rSpinbuttonValue ); - if( pWin->IsNativeControlSupported(CTRL_SPINBOX, rSpinbuttonValue.mnUpperPart) && pWin->IsNativeControlSupported(CTRL_SPINBOX, rSpinbuttonValue.mnLowerPart) ) { // only paint the embedded spin buttons, all buttons are painted at once - bNativeOK = pWin->DrawNativeControl( CTRL_SPINBOX, PART_ALL_BUTTONS, Region(), CTRL_STATE_ENABLED, - aControlValue, rtl::OUString() ); + bNativeOK = pWin->DrawNativeControl( CTRL_SPINBOX, PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED, + rSpinbuttonValue, rtl::OUString() ); } else { @@ -115,17 +112,17 @@ BOOL ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue& rSpinbuttonVa Point aPt; Size aSize( pBorder->GetOutputSizePixel() ); // the size of the border window, i.e., the whole control - Region aBound, aContent; - Region aNatRgn( Rectangle( aPt, aSize ) ); + Rectangle aBound, aContent; + Rectangle aNatRgn( aPt, aSize ); if( pBorder->GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL, - aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound, aContent) ) { - aSize = aContent.GetBoundRect().GetSize(); + aSize = aContent.GetSize(); } - Region aRgn( Rectangle( aPt, aSize ) ); + Rectangle aRgn( aPt, aSize ); bNativeOK = pBorder->DrawNativeControl( CTRL_SPINBOX, PART_ENTIRE_CONTROL, aRgn, CTRL_STATE_ENABLED, - aControlValue, rtl::OUString() ); + rSpinbuttonValue, rtl::OUString() ); pBorder->SetClipRegion( oldRgn ); } @@ -139,12 +136,9 @@ BOOL ImplDrawNativeSpinbuttons( Window *pWin, const SpinbuttonValue& rSpinbutton if( pWin->IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL) ) { - ImplControlValue aControlValue; - aControlValue.setOptionalVal( (void*) &rSpinbuttonValue ); - // only paint the standalone spin buttons, all buttons are painted at once - bNativeOK = pWin->DrawNativeControl( CTRL_SPINBUTTONS, PART_ALL_BUTTONS, Region(), CTRL_STATE_ENABLED, - aControlValue, rtl::OUString() ); + bNativeOK = pWin->DrawNativeControl( CTRL_SPINBUTTONS, PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED, + rSpinbuttonValue, rtl::OUString() ); } return bNativeOK; } @@ -705,7 +699,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec nBottom1--; BOOL bNativeRegionOK = FALSE; - Region aContentUp, aContentDown; + Rectangle aContentUp, aContentDown; if ( (pDev->GetOutDevType() == OUTDEV_WINDOW) && // there is just no useful native support for spinfields with dropdown @@ -717,11 +711,11 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec // get the system's spin button size ImplControlValue aControlValue; - Region aBound; + Rectangle aBound; Point aPoint; // use the full extent of the control - Region aArea( Rectangle( aPoint, pBorder->GetOutputSizePixel() ) ); + Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() ); bNativeRegionOK = pWin->GetNativeControlRegion(CTRL_SPINBOX, PART_BUTTON_UP, @@ -740,8 +734,8 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec if( bNativeRegionOK ) { - rSpinUpArea = aContentUp.GetBoundRect(); - rSpinDownArea = aContentDown.GetBoundRect(); + rSpinUpArea = aContentUp; + rSpinDownArea = aContentDown; } else { @@ -774,11 +768,11 @@ void SpinField::Resize() ImplControlValue aControlValue; Point aPoint; - Region aContent, aBound; + Rectangle aContent, aBound; // use the full extent of the control Window *pBorder = GetWindow( WINDOW_BORDER ); - Region aArea( Rectangle(aPoint, pBorder->GetOutputSizePixel()) ); + Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() ); // adjust position and size of the edit field if ( GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT, @@ -789,10 +783,9 @@ void SpinField::Resize() aContent.Move(-aPoint.X(), -aPoint.Y()); // use the themes drop down size - Rectangle aContentRect = aContent.GetBoundRect(); - mpEdit->SetPosPixel( aContentRect.TopLeft() ); + mpEdit->SetPosPixel( aContent.TopLeft() ); bSubEditPositioned = true; - aSize = aContentRect.GetSize(); + aSize = aContent.GetSize(); } else { diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 95f84626b582..c892b32534ec 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -411,15 +411,14 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) 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 ); + Rectangle aCtrlRegion( Point( 0, 0 ), aSize ); + Rectangle aBoundingRgn, aContentRgn; + const ImplControlValue aControlValue; if(GetNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - return aCont.GetSize(); + return aContentRgn.GetSize(); } // For systems without synthetic bold support @@ -938,8 +937,7 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( !bLayout && (bNativeOK = IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)) == TRUE ) { - ImplControlValue aControlValue; - Region aCtrlRegion( pItem->maRect ); + Rectangle aCtrlRegion( pItem->maRect ); ControlState nState = 0; if( pItem->mnId == mnCurPageId ) @@ -974,10 +972,9 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP; if ( bLastInGroup ) tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; - aControlValue.setOptionalVal( (void *)(&tiValue) ); bNativeOK = DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, nState, - aControlValue, rtl::OUString() ); + tiValue, rtl::OUString() ); } if( ! bLayout && !bNativeOK ) @@ -1236,7 +1233,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) BOOL bNativeOK = FALSE; if( ! bLayout && (bNativeOK = IsNativeControlSupported( CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) == TRUE ) { - const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); + const ImplControlValue aControlValue; ControlState nState = CTRL_STATE_ENABLED; int part = PART_ENTIRE_CONTROL; @@ -1250,10 +1247,8 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) if( !rRect.IsEmpty() ) aClipRgn.Intersect( rRect ); - Region aCtrlRegion( aRect ); - Rectangle aClipRect( aClipRgn.GetBoundRect() ); - if( !aClipRgn.IsEmpty() ) //&& aClipRect.getHeight() && aClipRect.getWidth() ) - bNativeOK = DrawNativeControl( CTRL_TAB_PANE, part, aCtrlRegion, nState, + if( !aClipRgn.IsEmpty() ) + bNativeOK = DrawNativeControl( CTRL_TAB_PANE, part, aRect, nState, aControlValue, rtl::OUString() ); } else diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index f069828f25f9..55d09d266019 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -50,6 +50,7 @@ CDEFS+=-DENABLE_GRAPHITE EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/outdev.obj \ $(SLO)$/outdev3.obj \ + $(SLO)$/outdevnative.obj \ $(SLO)$/gfxlink.obj \ $(SLO)$/print.obj \ $(SLO)$/print2.obj \ @@ -106,7 +107,6 @@ 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/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 949d3df5275f..bf1cc2728bf1 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1889,10 +1889,11 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, nTestMatch -= 1000000; // test font name substrings - if( (rSearchFamilyName.Len() && pData->maMatchFamilyName.Len()) + // TODO: calculate name matching score using e.g. Levenstein distance + if( (rSearchFamilyName.Len() >= 4) && (pData->maMatchFamilyName.Len() >= 4) && ((rSearchFamilyName.Search( pData->maMatchFamilyName ) != STRING_NOTFOUND) || (pData->maMatchFamilyName.Search( rSearchFamilyName ) != STRING_NOTFOUND)) ) - nTestMatch += 100000*2; + nTestMatch += 5000; // test SERIF attribute if( nSearchType & IMPL_FONT_ATTR_SERIF ) diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 47b150ddc4c5..2ef8682d10ac 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -1135,7 +1135,7 @@ void OutputDevice::Erase() { ImplControlValue aControlValue; Point aGcc3WorkaroundTemporary; - Region aCtrlRegion( Rectangle( aGcc3WorkaroundTemporary, GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( aGcc3WorkaroundTemporary, GetOutputSizePixel() ); ControlState nState = 0; if( pWindow->IsEnabled() ) nState |= CTRL_STATE_ENABLED; diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index fed41ec4de85..521f4d7ea62d 100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -59,6 +59,38 @@ static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice ) } } +ImplControlValue::~ImplControlValue() +{ +} + +ScrollbarValue::~ScrollbarValue() +{ +} + +SliderValue::~SliderValue() +{ +} + +TabitemValue::~TabitemValue() +{ +} + +SpinbuttonValue::~SpinbuttonValue() +{ +} + +ToolbarValue::~ToolbarValue() +{ +} + +MenubarValue::~MenubarValue() +{ +} + +PushButtonValue::~PushButtonValue() +{ +} + // ----------------------------------------------------------------------- // These functions are mainly passthrough functions that allow access to // the SalFrame behind a Window object for native widget rendering purposes. @@ -83,7 +115,7 @@ BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPar BOOL OutputDevice::HitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ) { @@ -95,7 +127,7 @@ BOOL OutputDevice::HitTestNativeControl( ControlType nType, return FALSE; Point aWinOffs( mnOutOffX, mnOutOffY ); - Region screenRegion( rControlRegion ); + Rectangle screenRegion( rControlRegion ); screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ), @@ -104,47 +136,117 @@ BOOL OutputDevice::HitTestNativeControl( ControlType nType, // ----------------------------------------------------------------------- -static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) +static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const ImplControlValue& rVal, OutputDevice& rDev ) { - if( aValue.getOptionalVal() ) + boost::shared_ptr< ImplControlValue > aResult; + switch( rVal.getType() ) { - switch( nType ) + case CTRL_SLIDER: { - 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() ); - } + const SliderValue* pSlVal = static_cast<const SliderValue*>(&rVal); + SliderValue* pNew = new SliderValue( *pSlVal ); + aResult.reset( pNew ); + pNew->maThumbRect = rDev.ImplLogicToDevicePixel( pSlVal->maThumbRect ); + } + break; + case CTRL_SCROLLBAR: + { + const ScrollbarValue* pScVal = static_cast<const ScrollbarValue*>(&rVal); + ScrollbarValue* pNew = new ScrollbarValue( *pScVal ); + aResult.reset( pNew ); + pNew->maThumbRect = rDev.ImplLogicToDevicePixel( pScVal->maThumbRect ); + pNew->maButton1Rect = rDev.ImplLogicToDevicePixel( pScVal->maButton1Rect ); + pNew->maButton2Rect = rDev.ImplLogicToDevicePixel( pScVal->maButton2Rect ); + } + break; + case CTRL_SPINBUTTONS: + { + const SpinbuttonValue* pSpVal = static_cast<const SpinbuttonValue*>(&rVal); + SpinbuttonValue* pNew = new SpinbuttonValue( *pSpVal ); + aResult.reset( pNew ); + pNew->maUpperRect = rDev.ImplLogicToDevicePixel( pSpVal->maUpperRect ); + pNew->maLowerRect = rDev.ImplLogicToDevicePixel( pSpVal->maLowerRect ); + } + break; + case CTRL_TOOLBAR: + { + const ToolbarValue* pTVal = static_cast<const ToolbarValue*>(&rVal); + ToolbarValue* pNew = new ToolbarValue( *pTVal ); + aResult.reset( pNew ); + pNew->maGripRect = rDev.ImplLogicToDevicePixel( pTVal->maGripRect ); + } + break; + case CTRL_TAB_ITEM: + { + const TabitemValue* pTIVal = static_cast<const TabitemValue*>(&rVal); + TabitemValue* pNew = new TabitemValue( *pTIVal ); + aResult.reset( pNew ); + } + break; + case CTRL_MENUBAR: + { + const MenubarValue* pMVal = static_cast<const MenubarValue*>(&rVal); + MenubarValue* pNew = new MenubarValue( *pMVal ); + aResult.reset( pNew ); + } + break; + case CTRL_PUSHBUTTON: + { + const PushButtonValue* pBVal = static_cast<const PushButtonValue*>(&rVal); + PushButtonValue* pNew = new PushButtonValue( *pBVal ); + aResult.reset( pNew ); + } + break; + case CTRL_GENERIC: + aResult.reset( new ImplControlValue( rVal ) ); break; + default: + OSL_ENSURE( 0, "unknown ImplControlValue type !" ); + break; + } + return aResult; +} + +#if 0 +static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) +{ + switch( aValue.getType() ) + { + case CTRL_SLIDER: + { + SliderValue* pSlVal = static_cast<SliderValue*>(const_cast<ImplControlValue*>(&aValue)); + pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_SCROLLBAR: + { + ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(const_cast<ImplControlValue*>(&aValue)); + 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 = static_cast<SpinbuttonValue*>(const_cast<ImplControlValue*>(&aValue)); + pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); + pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_TOOLBAR: + { + ToolbarValue* pTVal = static_cast<ToolbarValue*>(const_cast<ImplControlValue*>(&aValue)); + pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); } + break; } } +#endif BOOL OutputDevice::DrawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption ) @@ -183,22 +285,15 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, // 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 ); + boost::shared_ptr< ImplControlValue > aScreenCtrlValue( lcl_transformControlValue( aValue, *this ) ); + Rectangle screenRegion( ImplLogicToDevicePixel( rControlRegion ) ); 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 ); + BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); return bRet; } @@ -208,7 +303,7 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, BOOL OutputDevice::DrawNativeControlText(ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption ) @@ -233,15 +328,10 @@ BOOL OutputDevice::DrawNativeControlText(ControlType nType, // 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 ); + boost::shared_ptr< ImplControlValue > aScreenCtrlValue( lcl_transformControlValue( aValue, *this ) ); + Rectangle screenRegion( ImplLogicToDevicePixel( rControlRegion ) ); - // transform back ImplControlValue members - lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this ); return bRet; } @@ -251,12 +341,12 @@ BOOL OutputDevice::DrawNativeControlText(ControlType nType, BOOL OutputDevice::GetNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, ::rtl::OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ) { if( !lcl_enableNativeWidget( *this ) ) return FALSE; @@ -267,22 +357,18 @@ BOOL OutputDevice::GetNativeControlRegion( ControlType nType, // 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 ); + boost::shared_ptr< ImplControlValue > aScreenCtrlValue( lcl_transformControlValue( aValue, *this ) ); + Rectangle screenRegion( ImplLogicToDevicePixel( rControlRegion ) ); - BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, + BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, rNativeBoundingRegion, rNativeContentRegion, this ); if( bRet ) { // transform back native regions - rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + rNativeBoundingRegion = ImplDevicePixelToLogic( rNativeBoundingRegion ); + rNativeContentRegion = ImplDevicePixelToLogic( rNativeContentRegion ); } - // 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 7a6808a0e392..97e11c5a6aa4 100644..100755 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -669,13 +669,13 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } -BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, +BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Point pt( aPos ); - Region rgn( rControlRegion ); + Rectangle rgn( rControlRegion ); mirror( pt.X(), pOutDev ); mirror( rgn, pOutDev ); return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside ); @@ -684,51 +684,48 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); } -void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const +void SalGraphics::mirror( ControlType , const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const { - if( rVal.getOptionalVal() ) + switch( rVal.getType() ) { - switch( nType ) + case CTRL_SLIDER: { - case CTRL_SLIDER: - { - SliderValue* pSlVal = reinterpret_cast<SliderValue*>(rVal.getOptionalVal()); - mirror(pSlVal->maThumbRect,pOutDev,bBack); - } - break; - case CTRL_SCROLLBAR: - { - ScrollbarValue* pScVal = reinterpret_cast<ScrollbarValue*>(rVal.getOptionalVal()); - mirror(pScVal->maThumbRect,pOutDev,bBack); - mirror(pScVal->maButton1Rect,pOutDev,bBack); - mirror(pScVal->maButton2Rect,pOutDev,bBack); - } - break; - case CTRL_SPINBOX: - case CTRL_SPINBUTTONS: - { - SpinbuttonValue* pSpVal = reinterpret_cast<SpinbuttonValue*>(rVal.getOptionalVal()); - mirror(pSpVal->maUpperRect,pOutDev,bBack); - mirror(pSpVal->maLowerRect,pOutDev,bBack); - } - break; - case CTRL_TOOLBAR: - { - ToolbarValue* pTVal = reinterpret_cast<ToolbarValue*>(rVal.getOptionalVal()); - mirror(pTVal->maGripRect,pOutDev,bBack); - } - break; + SliderValue* pSlVal = static_cast<SliderValue*>(const_cast<ImplControlValue*>(&rVal)); + mirror(pSlVal->maThumbRect,pOutDev,bBack); + } + break; + case CTRL_SCROLLBAR: + { + ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(const_cast<ImplControlValue*>(&rVal)); + mirror(pScVal->maThumbRect,pOutDev,bBack); + mirror(pScVal->maButton1Rect,pOutDev,bBack); + mirror(pScVal->maButton2Rect,pOutDev,bBack); + } + break; + case CTRL_SPINBOX: + case CTRL_SPINBUTTONS: + { + SpinbuttonValue* pSpVal = static_cast<SpinbuttonValue*>(const_cast<ImplControlValue*>(&rVal)); + mirror(pSpVal->maUpperRect,pOutDev,bBack); + mirror(pSpVal->maLowerRect,pOutDev,bBack); + } + break; + case CTRL_TOOLBAR: + { + ToolbarValue* pTVal = static_cast<ToolbarValue*>(const_cast<ImplControlValue*>(&rVal)); + mirror(pTVal->maGripRect,pOutDev,bBack); } + break; } } -BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, +BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - Region rgn( rControlRegion ); + Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); @@ -739,13 +736,13 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); } -BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, +BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - Region rgn( rControlRegion ); + Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); @@ -756,13 +753,13 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); } -BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, +BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { - Region rgn( rControlRegion ); + Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index 7faf12d062fe..8aa0e47f1a35 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -58,7 +58,7 @@ BOOL SalGraphics::IsNativeControlSupported( ControlType, ControlPart ) */ BOOL SalGraphics::hitTestNativeControl( ControlType, ControlPart, - const Region&, + const Rectangle&, const Point&, BOOL& ) { @@ -77,7 +77,7 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, */ BOOL SalGraphics::drawNativeControl( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) @@ -98,7 +98,7 @@ BOOL SalGraphics::drawNativeControl( ControlType, */ BOOL SalGraphics::drawNativeControlText( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) @@ -122,12 +122,12 @@ BOOL SalGraphics::drawNativeControlText( ControlType, */ BOOL SalGraphics::getNativeControlRegion( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString&, - Region &, - Region & ) + Rectangle &, + Rectangle & ) { return( FALSE ); } diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 8eedf76043da..b221d1f7d928 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1151,15 +1151,13 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei if( mbNWFBorder ) { ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( mnWidth < 10 ? 10 : mnWidth, mnHeight < 10 ? 10 : mnHeight ) ) ); - Region aBoundingRgn( aCtrlRegion ); - Region aContentRgn( aCtrlRegion ); + Rectangle aCtrlRegion( (const Point&)Point(), Size( mnWidth < 10 ? 10 : mnWidth, mnHeight < 10 ? 10 : mnHeight ) ); + Rectangle aBounds( aCtrlRegion ); + Rectangle aContent( aCtrlRegion ); if( pWin->GetNativeControlRegion( aCtrlType, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), - aBoundingRgn, aContentRgn ) ) + aBounds, aContent ) ) { - Rectangle aBounds( aBoundingRgn.GetBoundRect() ); - Rectangle aContent( aContentRgn.GetBoundRect() ); mnLeftBorder = aContent.Left() - aBounds.Left(); mnRightBorder = aBounds.Right() - aContent.Right(); mnTopBorder = aContent.Top() - aBounds.Top(); @@ -1346,13 +1344,14 @@ void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags, OutputDevice*, co nState |= CTRL_STATE_ROLLOVER; Point aPoint; - Region aCtrlRegion( Rectangle( aPoint, Size( mnWidth, mnHeight ) ) ); + Rectangle aCtrlRegion( aPoint, Size( mnWidth, mnHeight ) ); - Region aBoundingRgn( Rectangle( aPoint, Size( mnWidth, mnHeight ) ) ); - Region aContentRgn=aCtrlRegion; + Rectangle aBoundingRgn( aPoint, Size( mnWidth, mnHeight ) ); + Rectangle aContentRgn( aCtrlRegion ); if(pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, - nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn )) { - aCtrlRegion=aContentRgn; + nState, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn )) + { + aCtrlRegion=aContentRgn; } bNativeOK = pWin->DrawNativeControl( aCtrlType, aCtrlPart, aCtrlRegion, nState, diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index a32790cfb0d4..e5c3dc525cec 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -877,12 +877,12 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, if( pWin->GetType() == WINDOW_BORDERWINDOW ) nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER; ImplControlValue aControlValue( nValueStyle ); - Region aBound, aContent; - Region aNatRgn( rRect ); + Rectangle aBound, aContent; + Rectangle aNatRgn( rRect ); if(pWin && pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER, aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { - rRect = aContent.GetBoundRect(); + rRect = aContent; } else if ( nStyle & FRAME_DRAW_MONO ) ImplDrawDPILineRect( pDev, rRect, NULL, bRound ); @@ -922,15 +922,15 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect, if( pWin->GetType() == WINDOW_BORDERWINDOW ) nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER; ImplControlValue aControlValue( nValueStyle ); - Region aBound, aContent; - Region aNatRgn( rRect ); + Rectangle aBound, aContent; + Rectangle aNatRgn( rRect ); if( pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER, aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { if( pWin->DrawNativeControl( CTRL_FRAME, PART_BORDER, aContent, CTRL_STATE_ENABLED, aControlValue, rtl::OUString()) ) { - rRect = aContent.GetBoundRect(); + rRect = aContent; return; } } diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx index 95e6c6113c45..9ea407e52ee3 100644 --- a/vcl/source/window/dockingarea.cxx +++ b/vcl/source/window/dockingarea.cxx @@ -152,23 +152,21 @@ void DockingAreaWindow::Paint( const Rectangle& ) EnableNativeWidget( TRUE ); // only required because the toolkit curently switches this flag off if( IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) { - ImplControlValue aControlValue; - ToolbarValue aToolbarValue; + ToolbarValue aControlValue; if( GetAlign() == WINDOWALIGN_TOP && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG ) { // give NWF a hint that this dockingarea is adjacent to the menubar // useful for special gradient effects that should cover both windows - aToolbarValue.mbIsTopDockingArea = TRUE; + aControlValue.mbIsTopDockingArea = TRUE; } - aControlValue.setOptionalVal( (void *)(&aToolbarValue) ); ControlState nState = CTRL_STATE_ENABLED; if( !ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB ) { // draw a single toolbar background covering the whole docking area Point tmp; - Region aCtrlRegion( Rectangle( tmp, GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( tmp, GetOutputSizePixel() ); DrawNativeControl( CTRL_TOOLBAR, IsHorizontal() ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT, aCtrlRegion, nState, aControlValue, rtl::OUString() ); @@ -231,7 +229,7 @@ void DockingAreaWindow::Paint( const Rectangle& ) aTBRect.Bottom() = aOutSz.Height() - 1; } DrawNativeControl( CTRL_TOOLBAR, IsHorizontal() ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT, - Region( aTBRect), nState, aControlValue, rtl::OUString() ); + aTBRect, nState, aControlValue, rtl::OUString() ); } } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 1723d26ce399..81676eba3be4 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2268,10 +2268,10 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon if( ! bIsMenuBar ) { ImplControlValue aVal; - Region aNativeBounds; - Region aNativeContent; + Rectangle aNativeBounds; + Rectangle aNativeContent; Point tmp( 0, 0 ); - Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + Rectangle aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) { if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), @@ -2284,8 +2284,8 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon aNativeContent ) ) { - rCheckHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = aNativeContent.GetBoundRect().GetWidth(); + rCheckHeight = aNativeBounds.GetHeight(); + rMaxWidth = aNativeContent.GetWidth(); } } if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) @@ -2300,8 +2300,8 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon aNativeContent ) ) { - rRadioHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth()); + rRadioHeight = aNativeBounds.GetHeight(); + rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); } } } @@ -2516,10 +2516,10 @@ Size Menu::ImplCalcSize( Window* pWin ) if( pWindow->IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) { ImplControlValue aVal; - Region aNativeBounds; - Region aNativeContent; + Rectangle aNativeBounds; + Rectangle aNativeContent; Point tmp( 0, 0 ); - Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); if( pWindow->GetNativeControlRegion( ControlType(CTRL_MENUBAR), ControlPart(PART_ENTIRE_CONTROL), aCtrlRegion, @@ -2530,7 +2530,7 @@ Size Menu::ImplCalcSize( Window* pWin ) aNativeContent ) ) { - int nNativeHeight = aNativeBounds.GetBoundRect().GetHeight(); + int nNativeHeight = aNativeBounds.GetHeight(); if( nNativeHeight > aSz.Height() ) aSz.Height() = nNativeHeight; } @@ -2555,7 +2555,7 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; - Region aCtrlRegion( i_rRect ); + Rectangle aCtrlRegion( i_rRect ); ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED; aControlValue.setTristateVal( BUTTONVALUE_ON ); @@ -2689,7 +2689,7 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, - Region( aCheckRect ), + aCheckRect, nState, ImplControlValue(), OUString() ); @@ -4679,7 +4679,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) ) ); Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, - Region( aCtrlRect ), + aCtrlRect, CTRL_STATE_ENABLED, ImplControlValue(), OUString() ); @@ -4688,7 +4688,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) { bDrawItemRect = false; if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, - Region( aItemRect ), + aItemRect, CTRL_STATE_SELECTED | ( pData->bEnabled? CTRL_STATE_ENABLED: 0 ), ImplControlValue(), OUString() ) ) @@ -5026,7 +5026,7 @@ void MenuFloatingWindow::Paint( const Rectangle& ) Size aPxSize( GetOutputSizePixel() ); aPxSize.Width() -= nX; DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, - Region( Rectangle( Point( nX, 0 ), aPxSize ) ), + Rectangle( Point( nX, 0 ), aPxSize ), CTRL_STATE_ENABLED, ImplControlValue(), OUString() ); @@ -5540,23 +5540,21 @@ void MenuBarWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL ) ) { // draw background (transparency) - ImplControlValue aControlValue; - MenubarValue aMenubarValue; - aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - aControlValue.setOptionalVal( (void *)(&aMenubarValue) ); + MenubarValue aControlValue; + aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); Point tmp(0,0); - Region aBgRegion( Rectangle( tmp, GetOutputSizePixel() ) ); + Rectangle aBgRegion( tmp, GetOutputSizePixel() ); DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aBgRegion, CTRL_STATE_ENABLED, aControlValue, OUString() ); - ImplAddNWFSeparator( this, aMenubarValue ); + ImplAddNWFSeparator( this, aControlValue ); // draw selected item DrawNativeControl( CTRL_MENUBAR, PART_MENU_ITEM, - Region( aRect ), + aRect, CTRL_STATE_ENABLED | CTRL_STATE_SELECTED, aControlValue, OUString() ); @@ -5572,18 +5570,15 @@ void MenuBarWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) { if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) ) { - ImplControlValue aControlValue; MenubarValue aMenubarValue; aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - aControlValue.setOptionalVal( (void *)(&aMenubarValue) ); // use full window size to get proper gradient // but clip accordingly Point aPt; Rectangle aCtrlRect( aPt, GetOutputSizePixel() ); - Region aCtrlRegion( aCtrlRect ); - DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString() ); + DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRect, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); ImplAddNWFSeparator( this, aMenubarValue ); } else @@ -5814,14 +5809,12 @@ void MenuBarWindow::Paint( const Rectangle& ) if( IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) ) { Point aPt; - Region aCtrlRegion( Rectangle( aPt, GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( aPt, GetOutputSizePixel() ); - ImplControlValue aControlValue; MenubarValue aMenubarValue; aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this ); - aControlValue.setOptionalVal( (void *)(&aMenubarValue) ); - DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString() ); + DrawNativeControl( CTRL_MENUBAR, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aMenubarValue, rtl::OUString() ); ImplAddNWFSeparator( this, aMenubarValue ); } SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 35077b1cff0e..52f54db0e50e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -2514,13 +2514,13 @@ void PrintProgressDialog::implCalcProgressRect() if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) { ImplControlValue aValue; - Region aControlRegion( Rectangle( Point(), Size( 100, mnProgressHeight ) ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Point(), Size( 100, mnProgressHeight ) ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) { - mnProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + mnProgressHeight = aNativeControlRegion.GetHeight(); } mbNativeProgress = true; } diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index c139ae1ffb30..385dd241c770 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -544,7 +544,7 @@ void DrawProgress( Window* pWindow, const Point& rPos, long nPerc = (nPercent2 > 10000) ? 10000 : nPercent2; ImplControlValue aValue( nFullWidth * (long)nPerc / 10000 ); Rectangle aDrawRect( rPos, Size( nFullWidth, nPrgsHeight ) ); - Region aControlRegion( aDrawRect ); + Rectangle aControlRegion( aDrawRect ); if( bNeedErase ) { Window* pEraseWindow = pWindow; @@ -711,13 +711,13 @@ void StatusBar::ImplCalcProgressRect() if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) { ImplControlValue aValue; - Region aControlRegion( Rectangle( (const Point&)Point(), maPrgsFrameRect.GetSize() ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Rectangle( (const Point&)Point(), maPrgsFrameRect.GetSize() ) ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) { - long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + long nProgressHeight = aNativeControlRegion.GetHeight(); if( nProgressHeight > maPrgsFrameRect.GetHeight() ) { long nDelta = nProgressHeight - maPrgsFrameRect.GetHeight(); @@ -1723,13 +1723,13 @@ Size StatusBar::CalcWindowSizePixel() const if( pThis->IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) { ImplControlValue aValue; - Region aControlRegion( Rectangle( (const Point&)Point(), Size( nCalcWidth, nMinHeight ) ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( (const Point&)Point(), Size( nCalcWidth, nMinHeight ) ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( pThis->GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) { - nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + nProgressHeight = aNativeControlRegion.GetHeight(); } } @@ -1737,14 +1737,13 @@ Size StatusBar::CalcWindowSizePixel() const pThis->IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) ) { ImplControlValue aControlValue( FRAME_DRAW_NODRAW ); - Region aBound, aContent; - Region aNatRgn( Rectangle( Point( 0, 0 ), Size( 150, 50 ) ) ); + Rectangle aBound, aContent; + Rectangle aNatRgn( Point( 0, 0 ), Size( 150, 50 ) ); if( pThis->GetNativeControlRegion(CTRL_FRAME, PART_BORDER, aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { mpImplData->mnItemBorderWidth = - ( aBound.GetBoundRect().GetHeight() - - aContent.GetBoundRect().GetHeight() ) / 2; + ( aBound.GetHeight() - aContent.GetHeight() ) / 2; } } diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 7bfd115af8f9..0589d57009f4 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -149,7 +149,7 @@ void TabPage::Paint( const Rectangle& ) // draw native tabpage only inside tabcontrols, standalone tabpages look ugly (due to bad dialog design) if( IsNativeControlSupported(CTRL_TAB_BODY, PART_ENTIRE_CONTROL) && GetParent() && (GetParent()->GetType() == WINDOW_TABCONTROL) ) { - const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); + const ImplControlValue aControlValue; ControlState nState = CTRL_STATE_ENABLED; int part = PART_ENTIRE_CONTROL; @@ -160,7 +160,7 @@ void TabPage::Paint( const Rectangle& ) Point aPoint; // pass the whole window region to NWF as the tab body might be a gradient or bitmap // that has to be scaled properly, clipping makes sure that we do not paint too much - Region aCtrlRegion( Rectangle( aPoint, GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( aPoint, GetOutputSizePixel() ); DrawNativeControl( CTRL_TAB_BODY, part, aCtrlRegion, nState, aControlValue, rtl::OUString() ); } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 9ad0b8734437..cde91a8dcd97 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -215,13 +215,13 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis ) ImplControlValue aControlValue; Point aPoint; - Region aContent, aBound; - Region aArea( Rectangle(aPoint, pThis->GetOutputSizePixel()) ); + Rectangle aContent, aBound; + Rectangle aArea( aPoint, pThis->GetOutputSizePixel() ); if ( pThis->GetNativeControlRegion(CTRL_TOOLBAR, pThis->mbHorz ? PART_THUMB_VERT : PART_THUMB_HORZ, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { - width = pThis->mbHorz ? aContent.GetBoundRect().GetWidth() : aContent.GetBoundRect().GetHeight(); + width = pThis->mbHorz ? aContent.GetWidth() : aContent.GetHeight(); } } return width; @@ -338,16 +338,14 @@ void ToolBox::ImplDrawGrip( ToolBox* pThis ) BOOL bNativeOk = FALSE; if( pThis->IsNativeControlSupported( CTRL_TOOLBAR, pThis->mbHorz ? PART_THUMB_HORZ : PART_THUMB_VERT ) ) { - ImplControlValue aControlValue; ToolbarValue aToolbarValue; aToolbarValue.maGripRect = pWrapper->GetDragArea(); - aControlValue.setOptionalVal( (void *)(&aToolbarValue) ); Point aPt; - Region aCtrlRegion( Rectangle( aPt, pThis->GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( aPt, pThis->GetOutputSizePixel() ); ControlState nState = CTRL_STATE_ENABLED; bNativeOk = pThis->DrawNativeControl( CTRL_TOOLBAR, pThis->mbHorz ? PART_THUMB_VERT : PART_THUMB_HORZ, - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + aCtrlRegion, nState, aToolbarValue, rtl::OUString() ); } if( bNativeOk ) @@ -557,7 +555,7 @@ BOOL ToolBox::ImplDrawNativeBackground( ToolBox* pThis, const Region & ) { // use NWF Point aPt; - Region aCtrlRegion( Rectangle( aPt, pThis->GetOutputSizePixel() ) ); + Rectangle aCtrlRegion( aPt, pThis->GetOutputSizePixel() ); ControlState nState = CTRL_STATE_ENABLED; return pThis->DrawNativeControl( CTRL_TOOLBAR, pThis->mbHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT, @@ -1918,9 +1916,9 @@ BOOL ToolBox::ImplCalcItem() // determine minimum size necessary in NWF { Rectangle aRect( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); - Region aReg = aRect; + Rectangle aReg( aRect ); ImplControlValue aVal; - Region aNativeBounds, aNativeContent; + Rectangle aNativeBounds, aNativeContent; if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, @@ -1929,7 +1927,7 @@ BOOL ToolBox::ImplCalcItem() aVal, OUString(), aNativeBounds, aNativeContent ) ) { - aRect = aNativeBounds.GetBoundRect(); + aRect = aNativeBounds; if( aRect.GetWidth() > nMinWidth ) nMinWidth = aRect.GetWidth(); if( aRect.GetHeight() > nMinHeight ) @@ -1954,7 +1952,7 @@ BOOL ToolBox::ImplCalcItem() aVal, OUString(), aNativeBounds, aNativeContent ) ) { - aRect = aNativeBounds.GetBoundRect(); + aRect = aNativeBounds; if( aRect.GetHeight() > mnWinHeight ) mnWinHeight = aRect.GetHeight(); } @@ -1966,7 +1964,7 @@ BOOL ToolBox::ImplCalcItem() aVal, OUString(), aNativeBounds, aNativeContent ) ) { - aRect = aNativeBounds.GetBoundRect(); + aRect = aNativeBounds; if( aRect.GetHeight() > mnWinHeight ) mnWinHeight = aRect.GetHeight(); } @@ -1978,7 +1976,7 @@ BOOL ToolBox::ImplCalcItem() aVal, OUString(), aNativeBounds, aNativeContent ) ) { - aRect = aNativeBounds.GetBoundRect(); + aRect = aNativeBounds; if( aRect.GetHeight() > mnWinHeight ) mnWinHeight = aRect.GetHeight(); } @@ -3418,7 +3416,6 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highl if( !bIsWindow && pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; - Region aCtrlRegion( rRect ); ControlState nState = 0; if ( highlight == 1 ) nState |= CTRL_STATE_PRESSED; @@ -3429,7 +3426,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highl bNativeOk = pThis->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, - aCtrlRegion, nState, aControlValue, rtl::OUString() ); + rRect, nState, aControlValue, rtl::OUString() ); } if( !bNativeOk ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ebeb5c94d68a..35641ab8d6f9 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -243,18 +243,17 @@ void Window::ImplInitAppFontData( Window* pWindow ) // of control sizes, if yes, make app font scalings larger // so dialog positioning is not completely off ImplControlValue aControlValue; - Region aCtrlRegion( (const Rectangle&)Rectangle( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) ) ); - Region aBoundingRgn( aCtrlRegion ); - Region aContentRgn( aCtrlRegion ); + Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) ); + Rectangle aBoundingRgn( aCtrlRegion ); + Rectangle aContentRgn( aCtrlRegion ); if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion, CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aContentRect( aContentRgn.GetBoundRect() ); // comment: the magical +6 is for the extra border in bordered // (which is the standard) edit fields - if( aContentRect.GetHeight() - nTextHeight > (nTextHeight+4)/4 ) - pSVData->maGDIData.mnAppFontY = (aContentRect.GetHeight()-4) * 10; + if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 ) + pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10; } } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index cdc72485ae6c..9d3ce6b137cd 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -617,7 +617,7 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP */ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ) { @@ -654,8 +654,8 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, else if ( nPart == PART_BUTTON_RIGHT ) nCounterPart = PART_BUTTON_LEFT; - aBackward = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion.GetBoundRect() ); - aForward = NWGetScrollButtonRect( m_nScreen, nCounterPart, rControlRegion.GetBoundRect() ); + aBackward = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion ); + aForward = NWGetScrollButtonRect( m_nScreen, nCounterPart, rControlRegion ); if ( has_backward && has_forward2 ) { @@ -727,7 +727,7 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, */ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ) @@ -753,7 +753,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, GtkSalGraphics::bThemeChanged = FALSE; } - Rectangle aCtrlRect = rControlRegion.GetBoundRect(); + Rectangle aCtrlRect( rControlRegion ); Region aClipRegion( m_aClipRegion ); if( aClipRegion.IsNull() ) aClipRegion = aCtrlRect; @@ -897,7 +897,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ) @@ -908,7 +908,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, bool bOldNeedPixmapPaint = bNeedPixmapPaint; bNeedPixmapPaint = true; - Rectangle aCtrlRect = rControlRegion.GetBoundRect(); + Rectangle aCtrlRect = rControlRegion; BOOL returnVal = FALSE; SelectFont(); @@ -956,7 +956,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, */ BOOL GtkSalGraphics::drawNativeControlText( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) @@ -980,20 +980,20 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, */ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ) { BOOL returnVal = FALSE; if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) - && (rControlRegion.GetBoundRect().GetWidth() > 16) - && (rControlRegion.GetBoundRect().GetHeight() > 16) ) + && (rControlRegion.GetWidth() > 16) + && (rControlRegion.GetHeight() > 16) ) { - rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), + rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rControlRegion; @@ -1001,7 +1001,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, } if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { - rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, + rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; @@ -1010,7 +1010,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if ( (nType==CTRL_SPINBOX) && ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { - rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, + rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; @@ -1018,7 +1018,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, } if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { - rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, + rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; @@ -1032,14 +1032,14 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (nPart==PART_BUTTON) )) { - rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rCaption ); + rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; } if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ) ) { - rNativeBoundingRegion = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion.GetBoundRect() ); + rNativeBoundingRegion = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1049,10 +1049,10 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, NWEnsureGTKMenubar( m_nScreen ); GtkRequisition aReq; gtk_widget_size_request( gWidgetData[m_nScreen].gMenubarWidget, &aReq ); - Rectangle aMenuBarRect = rControlRegion.GetBoundRect(); + Rectangle aMenuBarRect = rControlRegion; aMenuBarRect = Rectangle( aMenuBarRect.TopLeft(), Size( aMenuBarRect.GetWidth(), aReq.height+1 ) ); - rNativeBoundingRegion = Region( aMenuBarRect ); + rNativeBoundingRegion = aMenuBarRect; rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; } @@ -1071,9 +1071,9 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (char *)NULL ); rNativeBoundingRegion = rControlRegion; Rectangle aIndicatorRect( Point( 0, - (rControlRegion.GetBoundRect().GetHeight()-indicator_size)/2), + (rControlRegion.GetHeight()-indicator_size)/2), Size( indicator_size, indicator_size ) ); - rNativeContentRegion = Region( aIndicatorRect ); + rNativeContentRegion = aIndicatorRect; returnVal = TRUE; } } @@ -1090,9 +1090,9 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, indicator_size += 2*indicator_spacing; // guess overpaint of theme rNativeBoundingRegion = rControlRegion; Rectangle aIndicatorRect( Point( 0, - (rControlRegion.GetBoundRect().GetHeight()-indicator_size)/2), + (rControlRegion.GetHeight()-indicator_size)/2), Size( indicator_size, indicator_size ) ); - rNativeContentRegion = Region( aIndicatorRect ); + rNativeContentRegion = aIndicatorRect; returnVal = TRUE; } if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL ) @@ -1101,10 +1101,10 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, GtkWidget* widget = gWidgetData[m_nScreen].gEditBoxWidget; GtkRequisition aReq; gtk_widget_size_request( widget, &aReq ); - Rectangle aEditRect = rControlRegion.GetBoundRect(); + Rectangle aEditRect = rControlRegion; aEditRect = Rectangle( aEditRect.TopLeft(), Size( aEditRect.GetWidth(), aReq.height+1 ) ); - rNativeBoundingRegion = Region( aEditRect ); + rNativeBoundingRegion = aEditRect; rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; } @@ -1118,7 +1118,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, "slider-width", &slider_width, "slider-length", &slider_length, (char *)NULL); - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( rControlRegion ); if( nPart == PART_THUMB_HORZ ) { aRect.Right() = aRect.Left() + slider_length - 1; @@ -1129,7 +1129,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, aRect.Bottom() = aRect.Top() + slider_length - 1; aRect.Right() = aRect.Left() + slider_width - 1; } - rNativeBoundingRegion = rNativeContentRegion = Region( aRect ); + rNativeBoundingRegion = rNativeContentRegion = aRect; returnVal = TRUE; } @@ -1432,7 +1432,8 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, const ImplControlValue& aValue, const OUString& ) { - ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal()); + OSL_ASSERT( aValue.getType() == CTRL_SCROLLBAR ); + const ScrollbarValue* pScrollbarVal = static_cast<const ScrollbarValue *>(&aValue); GdkPixmap* pixmap = NULL; Rectangle pixmapRect, scrollbarRect; GtkStateType stateType; @@ -1979,7 +1980,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, Rectangle pixmapRect; GtkStateType stateType; GtkShadowType shadowType; - SpinbuttonValue * pSpinVal = (SpinbuttonValue *)(aValue.getOptionalVal()); + const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&aValue) : NULL; Rectangle upBtnRect; ControlPart upBtnPart = PART_BUTTON_UP; ControlState upBtnState = CTRL_STATE_ENABLED; @@ -2290,10 +2291,11 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const ImplControlValue& aValue, const OUString& ) { + OSL_ASSERT( aValue.getType() == CTRL_TAB_ITEM ); GdkPixmap * pixmap; Rectangle pixmapRect; Rectangle tabRect; - TabitemValue * pTabitemValue = (TabitemValue *)(aValue.getOptionalVal()); + const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue); GtkStateType stateType; GtkShadowType shadowType; if( ! gWidgetData[ m_nScreen ].gCacheTabItems ) @@ -2571,9 +2573,9 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(gWidgetData[m_nScreen].gHandleBoxWidget), shadowType ); // evaluate grip rect - ToolbarValue* pVal = (ToolbarValue*)aValue.getOptionalVal(); - if( pVal ) + if( aValue.getType() == CTRL_TOOLBAR ) { + const ToolbarValue* pVal = static_cast<const ToolbarValue*>(&aValue); g_x = pVal->maGripRect.Left(); g_y = pVal->maGripRect.Top(); g_w = pVal->maGripRect.GetWidth(); @@ -3044,20 +3046,19 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( ControlState nState, const ImplControlValue& rValue, const OUString& ) { + OSL_ASSERT( rValue.getType() == CTRL_SLIDER ); NWEnsureGTKSlider( m_nScreen ); gint w, h; w = rControlRectangle.GetWidth(); h = rControlRectangle.GetHeight(); - SliderValue* pVal = (SliderValue*)rValue.getOptionalVal(); + const SliderValue* pVal = static_cast<const SliderValue*>(&rValue); GdkPixmap* pixmap = NWGetPixmapFromScreen( rControlRectangle ); if( ! pixmap ) return FALSE; - (void)pVal; - GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); GtkWidget* pWidget = (nPart == PART_TRACK_HORZ_AREA) ? GTK_WIDGET(gWidgetData[m_nScreen].gHScale) diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 065b5435eeb0..7544a566d8ae 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -63,17 +63,17 @@ public: // native widget methods virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); //helper methods for frame's UpdateSettings void updateSettings( AllSettings& rSettings ); @@ -179,7 +179,7 @@ protected: ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion, + BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); }; diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 3adc9f5c679a..29d79f88ffb3 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -255,19 +255,19 @@ class WidgetPainter @return valid push button. */ - QPushButton *pushButton( const Region& rControlRegion, BOOL bDefault ); + QPushButton *pushButton( const Rectangle& rControlRegion, BOOL bDefault ); /** 'Get' method for radio button. @see pushButton() */ - QRadioButton *radioButton( const Region& rControlRegion ); + QRadioButton *radioButton( const Rectangle& rControlRegion ); /** 'Get' method for check box. @see pushButton() */ - QCheckBox *checkBox( const Region& rControlRegion ); + QCheckBox *checkBox( const Rectangle& rControlRegion ); /** 'Get' method for combo box. @@ -276,74 +276,74 @@ class WidgetPainter @see pushButton(), m_pEditableComboBox */ - QComboBox *comboBox( const Region& rControlRegion, BOOL bEditable ); + QComboBox *comboBox( const Rectangle& rControlRegion, BOOL bEditable ); /** 'Get' method for line edit box. @see pushButton() */ - QLineEdit *lineEdit( const Region& rControlRegion ); + QLineEdit *lineEdit( const Rectangle& rControlRegion ); /** 'Get' method for spin box. @see pushButton() */ - QSpinWidget *spinWidget( const Region& rControlRegion ); + QSpinWidget *spinWidget( const Rectangle& rControlRegion ); /** 'Get' method for tab bar. @see pushButton() */ - QTabBar *tabBar( const Region& rControlRegion ); + QTabBar *tabBar( const Rectangle& rControlRegion ); /** 'Get' method for tab widget. @see pushButton() */ - QTabWidget *tabWidget( const Region& rControlRegion ); + QTabWidget *tabWidget( const Rectangle& rControlRegion ); /** 'Get' method for list view. @see pushButton() */ - QListView *listView( const Region& rControlRegion ); + QListView *listView( const Rectangle& rControlRegion ); /** 'Get' method for scroll bar. @see pushButton() */ - QScrollBar *scrollBar( const Region& rControlRegion, + QScrollBar *scrollBar( const Rectangle& rControlRegion, BOOL bHorizontal, const ImplControlValue& aValue ); /** 'Get' method for tool bar. @see pushButton() */ - QToolBar *toolBar( const Region& rControlRegion, BOOL bHorizontal ); + QToolBar *toolBar( const Rectangle& rControlRegion, BOOL bHorizontal ); /** 'Get' method for tool button. @see pushButton() */ - QToolButton *toolButton( const Region& rControlRegion ); + QToolButton *toolButton( const Rectangle& rControlRegion ); /** 'Get' method for menu bar. @see pushButton() */ - QMenuBar *menuBar( const Region& rControlRegion ); + QMenuBar *menuBar( const Rectangle& rControlRegion ); /** 'Get' method for popup menu. @see pushButton() */ - QPopupMenu *popupMenu( const Region& rControlRegion ); + QPopupMenu *popupMenu( const Rectangle& rControlRegion ); /** 'Get' method for progress bar @see pushButton() */ - QProgressBar *progressBar( const Region& rControlRegion ); + QProgressBar *progressBar( const Rectangle& rControlRegion ); // TODO other widgets @@ -363,7 +363,7 @@ class WidgetPainter QStyle::SFlags vclStateValue2SFlags( ControlState nState, const ImplControlValue& aValue ); public: - /** Convert VCL Region to QRect. + /** Convert VCL Rectangle to QRect. @param rControlRegion The region to convert. @@ -371,7 +371,7 @@ class WidgetPainter @return The bounding box of the region. */ - static QRect region2QRect( const Region& rControlRegion ); + static QRect region2QRect( const Rectangle& rControlRegion ); }; WidgetPainter::WidgetPainter( void ) @@ -525,7 +525,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, } else if ( strcmp( "QSpinWidget", pClassName ) == 0 ) { - SpinbuttonValue *pValue = static_cast<SpinbuttonValue *> ( aValue.getOptionalVal() ); + const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue *> ( &aValue ); // Is any of the buttons pressed? QStyle::SCFlags eActive = QStyle::SC_None; @@ -576,7 +576,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, } else if ( strcmp( "QTabBar", pClassName ) == 0 ) { - TabitemValue *pValue = static_cast<TabitemValue *> ( aValue.getOptionalVal() ); + const TabitemValue *pValue = static_cast<const TabitemValue *> ( &aValue ); QTab *pTab = NULL; if ( pValue ) @@ -614,7 +614,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, } else if ( strcmp( "QScrollBar", pClassName ) == 0 ) { - ScrollbarValue *pValue = static_cast<ScrollbarValue *> ( aValue.getOptionalVal() ); + const ScrollbarValue *pValue = static_cast<const ScrollbarValue *> ( &aValue ); QStyle::SCFlags eActive = QStyle::SC_None; if ( pValue ) @@ -695,7 +695,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, if ( nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT ) { - ToolbarValue *pValue = static_cast< ToolbarValue * >( aValue.getOptionalVal() ); + const ToolbarValue *pValue = static_cast< const ToolbarValue * >( &aValue ); QRect qThumbRect = region2QRect( pValue->maGripRect ); qThumbRect.moveBy( -qWidgetPos.x(), -qWidgetPos.y() ); @@ -795,7 +795,7 @@ BOOL WidgetPainter::drawStyledWidget( QWidget *pWidget, return TRUE; } -QPushButton *WidgetPainter::pushButton( const Region& rControlRegion, +QPushButton *WidgetPainter::pushButton( const Rectangle& rControlRegion, BOOL bDefault ) { if ( !m_pPushButton ) @@ -832,7 +832,7 @@ QPushButton *WidgetPainter::pushButton( const Region& rControlRegion, return m_pPushButton; } -QRadioButton *WidgetPainter::radioButton( const Region& rControlRegion ) +QRadioButton *WidgetPainter::radioButton( const Rectangle& rControlRegion ) { if ( !m_pRadioButton ) m_pRadioButton = new QRadioButton( NULL, "radio_button" ); @@ -861,7 +861,7 @@ QRadioButton *WidgetPainter::radioButton( const Region& rControlRegion ) return m_pRadioButton; } -QCheckBox *WidgetPainter::checkBox( const Region& rControlRegion ) +QCheckBox *WidgetPainter::checkBox( const Rectangle& rControlRegion ) { if ( !m_pCheckBox ) m_pCheckBox = new QCheckBox( NULL, "check_box" ); @@ -890,7 +890,7 @@ QCheckBox *WidgetPainter::checkBox( const Region& rControlRegion ) return m_pCheckBox; } -QComboBox *WidgetPainter::comboBox( const Region& rControlRegion, +QComboBox *WidgetPainter::comboBox( const Rectangle& rControlRegion, BOOL bEditable ) { QComboBox *pComboBox = NULL; @@ -915,7 +915,7 @@ QComboBox *WidgetPainter::comboBox( const Region& rControlRegion, return pComboBox; } -QLineEdit *WidgetPainter::lineEdit( const Region& rControlRegion ) +QLineEdit *WidgetPainter::lineEdit( const Rectangle& rControlRegion ) { if ( !m_pLineEdit ) m_pLineEdit = new QLineEdit( NULL, "line_edit" ); @@ -928,7 +928,7 @@ QLineEdit *WidgetPainter::lineEdit( const Region& rControlRegion ) return m_pLineEdit; } -QSpinWidget *WidgetPainter::spinWidget( const Region& rControlRegion ) +QSpinWidget *WidgetPainter::spinWidget( const Rectangle& rControlRegion ) { if ( !m_pSpinWidget ) { @@ -947,7 +947,7 @@ QSpinWidget *WidgetPainter::spinWidget( const Region& rControlRegion ) return m_pSpinWidget; } -QTabBar *WidgetPainter::tabBar( const Region& rControlRegion ) +QTabBar *WidgetPainter::tabBar( const Rectangle& rControlRegion ) { if ( !m_pTabBar ) { @@ -976,7 +976,7 @@ QTabBar *WidgetPainter::tabBar( const Region& rControlRegion ) return m_pTabBar; } -QTabWidget *WidgetPainter::tabWidget( const Region& rControlRegion ) +QTabWidget *WidgetPainter::tabWidget( const Rectangle& rControlRegion ) { if ( !m_pTabWidget ) m_pTabWidget = new QTabWidget( NULL, "tab_widget" ); @@ -990,7 +990,7 @@ QTabWidget *WidgetPainter::tabWidget( const Region& rControlRegion ) return m_pTabWidget; } -QListView *WidgetPainter::listView( const Region& rControlRegion ) +QListView *WidgetPainter::listView( const Rectangle& rControlRegion ) { if ( !m_pListView ) m_pListView = new QListView( NULL, "list_view" ); @@ -1003,7 +1003,7 @@ QListView *WidgetPainter::listView( const Region& rControlRegion ) return m_pListView; } -QScrollBar *WidgetPainter::scrollBar( const Region& rControlRegion, +QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion, BOOL bHorizontal, const ImplControlValue& aValue ) { if ( !m_pScrollBar ) @@ -1019,7 +1019,7 @@ QScrollBar *WidgetPainter::scrollBar( const Region& rControlRegion, m_pScrollBar->resize( qRect.size() ); m_pScrollBar->setOrientation( bHorizontal? Qt::Horizontal: Qt::Vertical ); - ScrollbarValue *pValue = static_cast<ScrollbarValue *> ( aValue.getOptionalVal() ); + const ScrollbarValue *pValue = static_cast<const ScrollbarValue *> ( &aValue ); if ( pValue ) { m_pScrollBar->setMinValue( pValue->mnMin ); @@ -1031,7 +1031,7 @@ QScrollBar *WidgetPainter::scrollBar( const Region& rControlRegion, return m_pScrollBar; } -QToolBar *WidgetPainter::toolBar( const Region& rControlRegion, BOOL bHorizontal ) +QToolBar *WidgetPainter::toolBar( const Rectangle& rControlRegion, BOOL bHorizontal ) { if ( !m_pMainWindow ) m_pMainWindow = new QMainWindow( NULL, "main_window" ); @@ -1064,7 +1064,7 @@ QToolBar *WidgetPainter::toolBar( const Region& rControlRegion, BOOL bHorizontal return pToolBar; } -QToolButton *WidgetPainter::toolButton( const Region& rControlRegion) +QToolButton *WidgetPainter::toolButton( const Rectangle& rControlRegion) { if ( !m_pToolButton ) m_pToolButton = new QToolButton( NULL, "tool_button" ); @@ -1077,7 +1077,7 @@ QToolButton *WidgetPainter::toolButton( const Region& rControlRegion) return m_pToolButton; } -QMenuBar *WidgetPainter::menuBar( const Region& rControlRegion) +QMenuBar *WidgetPainter::menuBar( const Rectangle& rControlRegion) { if ( !m_pMenuBar ) { @@ -1098,7 +1098,7 @@ QMenuBar *WidgetPainter::menuBar( const Region& rControlRegion) return m_pMenuBar; } -QPopupMenu *WidgetPainter::popupMenu( const Region& rControlRegion) +QPopupMenu *WidgetPainter::popupMenu( const Rectangle& rControlRegion) { if ( !m_pPopupMenu ) { @@ -1119,7 +1119,7 @@ QPopupMenu *WidgetPainter::popupMenu( const Region& rControlRegion) return m_pPopupMenu; } -QProgressBar *WidgetPainter::progressBar( const Region& rControlRegion ) +QProgressBar *WidgetPainter::progressBar( const Rectangle& rControlRegion ) { if ( !m_pProgressBar ) m_pProgressBar = new QProgressBar( NULL, "progress_bar" ); @@ -1155,12 +1155,10 @@ QStyle::SFlags WidgetPainter::vclStateValue2SFlags( ControlState nState, return nStyle; } -QRect WidgetPainter::region2QRect( const Region& rControlRegion ) +QRect WidgetPainter::region2QRect( const Rectangle& rControlRegion ) { - Rectangle aRect = rControlRegion.GetBoundRect(); - - return QRect( QPoint( aRect.Left(), aRect.Top() ), - QPoint( aRect.Right(), aRect.Bottom() ) ); + return QRect( QPoint( rControlRegion.Left(), rControlRegion.Top() ), + QPoint( rControlRegion.Right(), rControlRegion.Bottom() ) ); } /** Instance of WidgetPainter. @@ -1176,21 +1174,21 @@ class KDESalGraphics : public X11SalGraphics virtual ~KDESalGraphics() {} virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, const Point& aPos, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, ControlState nState, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, - const Region& rControlRegion, ControlState nState, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, ControlState nState, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); }; /** What widgets can be drawn the native way. @@ -1241,13 +1239,13 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP nType/nPart combination. */ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, const Point& rPos, + const Rectangle& rControlRegion, const Point& rPos, BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { // make position relative to rControlRegion - Point aPos = rPos - rControlRegion.GetBoundRect().TopLeft(); + Point aPos = rPos - rControlRegion.TopLeft(); rIsInside = FALSE; BOOL bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ); @@ -1348,7 +1346,7 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, ControlState nState, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& ) { @@ -1490,7 +1488,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, - const Region&, ControlState, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) { @@ -1515,10 +1513,10 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, A caption or title string (like button text etc.) */ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, ControlState nState, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue&, const OUString&, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) { BOOL bReturn = FALSE; QRect qBoundingRect = WidgetPainter::region2QRect( rControlRegion ); @@ -1697,12 +1695,12 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar // Bounding region Point aBPoint( qBoundingRect.x(), qBoundingRect.y() ); Size aBSize( qBoundingRect.width(), qBoundingRect.height() ); - rNativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) ); + rNativeBoundingRegion = Rectangle( aBPoint, aBSize ); // Region of the content Point aPoint( qRect.x(), qRect.y() ); Size aSize( qRect.width(), qRect.height() ); - rNativeContentRegion = Region( Rectangle( aPoint, aSize ) ); + rNativeContentRegion = Rectangle( aPoint, aSize ); } return bReturn; diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index fdc9a8bbcee1..2c04af384c51 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -80,15 +80,13 @@ QStyle::State vclStateValue2StateFlag( ControlState nControlState, } /** - Convert VCL Region to QRect. - @param rControlRegion The region to convert. - @return The bounding box of the region. + Convert VCL Rectangle to QRect. + @param rControlRegion The Rectangle to convert. + @return The matching QRect */ -QRect region2QRect( const Region& rControlRegion ) +QRect region2QRect( const Rectangle& rControlRegion ) { - Rectangle aRect = rControlRegion.GetBoundRect(); - - return QRect(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight()); + return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight()); } KDESalGraphics::KDESalGraphics() : @@ -157,7 +155,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par } BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, - const Region&, const Point&, + const Rectangle&, const Point&, BOOL& ) { return FALSE; @@ -235,7 +233,7 @@ namespace } BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, - const Region& rControlRegion, ControlState nControlState, + const Rectangle& rControlRegion, ControlState nControlState, const ImplControlValue& value, const OUString& ) { @@ -252,7 +250,8 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, type = CTRL_SPINBUTTONS; if( type == CTRL_SPINBUTTONS ) { - SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal()); + OSL_ASSERT( value.getType() != CTRL_SPINBUTTONS ); + const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue *>(&value); Rectangle aButtonRect( pSpinVal->maUpperRect); aButtonRect.Union( pSpinVal->maLowerRect );; widgetRect = QRect( aButtonRect.Left(), aButtonRect.Top(), @@ -425,7 +424,8 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ)) { QStyleOptionSlider option; - ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() ); + OSL_ASSERT( value.getType() == CTRL_SCROLLBAR ); + const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&value); //if the scroll bar is active (aka not degenrate...allow for hover events if (sbVal->mnVisibleSize < sbVal->mnMax) @@ -461,9 +461,9 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, QStyleOptionSpinBox option; // determine active control - SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal()); - if( pSpinVal ) + if( value.getType() == CTRL_SPINBUTTONS ) { + const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue *>(&value); if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) ) option.activeSubControls |= QStyle::SC_SpinBoxUp; if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) ) @@ -536,7 +536,8 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA)) { - SliderValue* slVal = static_cast<SliderValue *> ( value.getOptionalVal() ); + OSL_ASSERT( value.getType() == CTRL_SLIDER ); + const SliderValue* slVal = static_cast<const SliderValue *>(&value); QStyleOptionSlider option; option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); @@ -589,10 +590,10 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, - const Region& controlRegion, ControlState controlState, + const Rectangle& controlRegion, ControlState controlState, const ImplControlValue& val, const OUString&, - Region &nativeBoundingRegion, Region &nativeContentRegion ) + Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion ) { bool retVal = false; @@ -892,12 +893,12 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, // Bounding region Point aBPoint( boundingRect.x(), boundingRect.y() ); Size aBSize( boundingRect.width(), boundingRect.height() ); - nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) ); + nativeBoundingRegion = Rectangle( aBPoint, aBSize ); // Region of the content Point aPoint( contentRect.x(), contentRect.y() ); Size aSize( contentRect.width(), contentRect.height() ); - nativeContentRegion = Region( Rectangle( aPoint, aSize ) ); + nativeContentRegion = Rectangle( aPoint, aSize ); } return retVal; diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx index 5661d743e0cd..0bce1700f1fc 100644 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ b/vcl/unx/kde4/KDESalGraphics.hxx @@ -58,12 +58,12 @@ class KDESalGraphics : public X11SalGraphics type/part combination. */ virtual BOOL hitTestNativeControl( ControlType type, ControlPart part, - const Region& rControlRegion, const Point& aPos, + const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); /** Draw the requested control described by part/nControlState. @param rControlRegion - The bounding region of the complete control in VCL frame coordinates. + The bounding Rectangle of the complete control in VCL frame coordinates. @param aValue An optional value (tristate/numerical/string). @@ -72,7 +72,7 @@ class KDESalGraphics : public X11SalGraphics A caption or title string (like button text etc.) */ virtual BOOL drawNativeControl( ControlType type, ControlPart part, - const Region& rControlRegion, ControlState nControlState, + const Rectangle& rControlRegion, ControlState nControlState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); @@ -85,7 +85,7 @@ class KDESalGraphics : public X11SalGraphics @param aCaption A caption or title string (like button text etc.) */ virtual BOOL drawNativeControlText( ControlType, ControlPart, - const Region&, ControlState, + const Rectangle&, ControlState, const ImplControlValue&, const rtl::OUString& ) { return false; } /** Check if the bounding regions match. @@ -106,8 +106,8 @@ class KDESalGraphics : public X11SalGraphics A caption or title string (like button text etc.) */ virtual BOOL getNativeControlRegion( ControlType type, ControlPart part, - const Region& rControlRegion, ControlState nControlState, + const Rectangle& rControlRegion, ControlState nControlState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); };
\ No newline at end of file diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index b1bfcbee96f4..442b8bee1f15 100644..100755 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -227,17 +227,17 @@ protected: virtual BOOL drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize ); // native widget rendering methods that require mirroring - virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, BOOL& rIsInside ); - virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, + virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); - virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, + virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption, - Region &rNativeBoundingRegion, Region &rNativeContentRegion ); + Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ); virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index b91716572298..8197fb37cd6d 100644..100755 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -317,7 +317,7 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP */ BOOL WinSalGraphics::hitTestNativeControl( ControlType, ControlPart, - const Region&, + const Rectangle&, const Point&, BOOL& ) { @@ -553,9 +553,9 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } if( nType == CTRL_SPINBUTTONS && nPart == PART_ALL_BUTTONS ) { - SpinbuttonValue *pValue = (SpinbuttonValue*) aValue.getOptionalVal(); - if( pValue ) + if( aValue.getType() == CTRL_SPINBUTTONS ) { + const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); BOOL bOk = FALSE; RECT rect; @@ -578,9 +578,9 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, //rc.bottom--; if( nPart == PART_ALL_BUTTONS ) { - SpinbuttonValue *pValue = (SpinbuttonValue*) aValue.getOptionalVal(); - if( pValue ) + if( aValue.getType() == CTRL_SPINBUTTONS ) { + const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue*>(&aValue); BOOL bOk = FALSE; RECT rect; @@ -787,20 +787,19 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, iPart = TABP_TABITEMLEFTEDGE; rc.bottom--; - TabitemValue *pValue = (TabitemValue*) aValue.getOptionalVal(); - if( pValue ) + OSL_ASSERT( aValue.getType() == CTRL_TAB_ITEM ); + + const TabitemValue *pValue = static_cast<const TabitemValue*>(&aValue); + if( pValue->isBothAligned() ) { - if( pValue->isBothAligned() ) - { - iPart = TABP_TABITEMLEFTEDGE; - rc.right--; - } - else if( pValue->isLeftAligned() ) - iPart = TABP_TABITEMLEFTEDGE; - else if( pValue->isRightAligned() ) - iPart = TABP_TABITEMRIGHTEDGE; - else iPart = TABP_TABITEM; + iPart = TABP_TABITEMLEFTEDGE; + rc.right--; } + else if( pValue->isLeftAligned() ) + iPart = TABP_TABITEMLEFTEDGE; + else if( pValue->isRightAligned() ) + iPart = TABP_TABITEMRIGHTEDGE; + else iPart = TABP_TABITEM; if( !(nState & CTRL_STATE_ENABLED) ) iState = TILES_DISABLED; @@ -856,9 +855,12 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } else if( nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT ) { - ToolbarValue *pValue = (ToolbarValue*) aValue.getOptionalVal(); - if( pValue && pValue->mbIsTopDockingArea ) - rc.top = 0; // extend potential gradient to cover menu bar as well + if( aValue.getType() == CTRL_TOOLBAR ) + { + const ToolbarValue *pValue = static_cast<const ToolbarValue*>(&aValue); + if( pValue->mbIsTopDockingArea ) + rc.top = 0; // extend potential gradient to cover menu bar as well + } return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } } @@ -868,9 +870,11 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nPart != PART_ENTIRE_CONTROL ) return FALSE; - MenubarValue *pValue = (MenubarValue*) aValue.getOptionalVal(); - if( pValue ) + if( aValue.getType() == CTRL_MENUBAR ) + { + const MenubarValue *pValue = static_cast<const MenubarValue*>(&aValue); rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well + } return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } @@ -918,7 +922,8 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ImplDrawTheme( hTheme, hDC, iPart, iState, aTRect, aCaption ); RECT aThumbRect; - SliderValue* pVal = (SliderValue*)aValue.getOptionalVal(); + OSL_ASSERT( aValue.getType() == CTRL_SLIDER ); + const SliderValue* pVal = static_cast<const SliderValue*>(&aValue); aThumbRect.left = pVal->maThumbRect.Left(); aThumbRect.top = pVal->maThumbRect.Top(); aThumbRect.right = pVal->maThumbRect.Right(); @@ -963,7 +968,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, */ BOOL WinSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& aCaption ) @@ -1043,7 +1048,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( !hTheme ) return false; - Rectangle buttonRect = rControlRegion.GetBoundRect(); + Rectangle buttonRect = rControlRegion; RECT rc; rc.left = buttonRect.Left(); rc.right = buttonRect.Right()+1; @@ -1080,7 +1085,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, */ BOOL WinSalGraphics::drawNativeControlText( ControlType, ControlPart, - const Region&, + const Rectangle&, ControlState, const ImplControlValue&, const OUString& ) @@ -1104,12 +1109,12 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, */ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, - const Region& rControlRegion, + const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& rControlValue, const OUString&, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) + Rectangle &rNativeBoundingRegion, + Rectangle &rNativeContentRegion ) { BOOL bRet = FALSE; @@ -1146,7 +1151,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { Rectangle aRect( ImplGetThemeRect( hTheme, hDC, TP_SPLITBUTTONDROPDOWN, - TS_HOT, rControlRegion.GetBoundRect() ) ); + TS_HOT, rControlRegion ) ); rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; if( !rNativeContentRegion.IsEmpty() ) @@ -1160,7 +1165,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { Rectangle aRect( ImplGetThemeRect( hTheme, hDC, PP_BAR, - 0, rControlRegion.GetBoundRect() ) ); + 0, rControlRegion ) ); rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; if( !rNativeContentRegion.IsEmpty() ) @@ -1172,7 +1177,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, HTHEME hTheme = getThemeHandle( mhWnd, L"Combobox"); if( hTheme ) { - Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, CP_DROPDOWNBUTTON, CBXS_NORMAL, aBoxRect ) ); if( aRect.GetHeight() > aBoxRect.GetHeight() ) @@ -1192,7 +1197,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if( hTheme ) { // get borderr size - Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER, EBWBS_HOT, aBoxRect ) ); // ad app font height @@ -1231,7 +1236,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if( nPart == PART_THUMB_HORZ ) { long nW = aThumbRect.GetWidth(); - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( rControlRegion ); aRect.Right() = aRect.Left() + nW - 1; rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; @@ -1239,7 +1244,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, else { long nH = aThumbRect.GetHeight(); - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( rControlRegion ); aRect.Bottom() = aRect.Top() + nH - 1; rNativeContentRegion = aRect; rNativeBoundingRegion = rNativeContentRegion; @@ -1250,30 +1255,30 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) ) { - Rectangle aControlRect( rControlRegion.GetBoundRect() ); + Rectangle aControlRect( rControlRegion ); rNativeContentRegion = aControlRect; --aControlRect.Bottom(); - TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() ); - if ( pValue ) + if( rControlValue.getType() == CTRL_TAB_ITEM ) { + const TabitemValue *pValue = static_cast<const TabitemValue*>(&rControlValue); if ( pValue->isBothAligned() ) --aControlRect.Right(); - } - if ( nState & CTRL_STATE_SELECTED ) - { - aControlRect.Left() -= 2; - if ( pValue && !pValue->isBothAligned() ) + if ( nState & CTRL_STATE_SELECTED ) { - if ( pValue->isLeftAligned() || pValue->isNotAligned() ) - aControlRect.Right() += 2; - if ( pValue->isRightAligned() ) - aControlRect.Right() += 1; + aControlRect.Left() -= 2; + if ( pValue && !pValue->isBothAligned() ) + { + if ( pValue->isLeftAligned() || pValue->isNotAligned() ) + aControlRect.Right() += 2; + if ( pValue->isRightAligned() ) + aControlRect.Right() += 1; + } + aControlRect.Top() -= 2; + aControlRect.Bottom() += 2; } - aControlRect.Top() -= 2; - aControlRect.Bottom() += 2; } rNativeBoundingRegion = aControlRect; bRet = TRUE; |