diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-02-01 16:46:05 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-02-01 17:38:59 +0100 |
commit | 150befe0fe9533f39df55b0d95ad25caaddf1830 (patch) | |
tree | c4f6492529a65b055fccc0f944f92c03959e9243 | |
parent | b3c3e116ff0eb9b550b73d3901395c042e31d192 (diff) |
const is such a useless concept anyway </sarcasm>
-rw-r--r-- | vcl/inc/salgdi.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/salnativewidgets.hxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/outdevnative.cxx | 54 | ||||
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 35 |
4 files changed, 81 insertions, 20 deletions
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 7736832c1735..d29247bb229d 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -351,7 +351,7 @@ public: sal_Bool mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack = false ) const; void mirror( Rectangle& rRect, const OutputDevice*, bool bBack = false ) const; void mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack = false ) const; - void mirror( ControlType,const ImplControlValue&,const OutputDevice*,bool bBack = false) const; + void mirror( ImplControlValue&, const OutputDevice*, bool bBack = false ) const; basegfx::B2DPoint mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *pOutDev, bool bBack = false ) const; basegfx::B2DPolygon mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index af392854ee1d..6c7cba11ebb6 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -297,6 +297,8 @@ class VCL_DLLPUBLIC ImplControlValue virtual ~ImplControlValue(); + virtual ImplControlValue* clone() const; + ControlType getType() const { return mType; } inline ButtonValue getTristateVal( void ) const { return mTristate; } @@ -334,6 +336,7 @@ class VCL_DLLPUBLIC ScrollbarValue : public ImplControlValue mnThumbState = 0; mnPage1State = 0; mnPage2State = 0; }; virtual ~ScrollbarValue(); + virtual ScrollbarValue* clone() const; }; class VCL_DLLPUBLIC SliderValue : public ImplControlValue @@ -350,6 +353,7 @@ class VCL_DLLPUBLIC SliderValue : public ImplControlValue , mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( 0 ) {} virtual ~SliderValue(); + virtual SliderValue* clone() const; }; /* TabitemValue: @@ -375,6 +379,7 @@ class VCL_DLLPUBLIC TabitemValue : public ImplControlValue mnAlignment = 0; }; virtual ~TabitemValue(); + virtual TabitemValue* clone() const; sal_Bool isLeftAligned() const { return (mnAlignment & TABITEM_LEFTALIGNED) != 0; } sal_Bool isRightAligned() const { return (mnAlignment & TABITEM_RIGHTALIGNED) != 0; } @@ -406,6 +411,7 @@ class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue mnUpperState = mnLowerState = 0; }; virtual ~SpinbuttonValue(); + virtual SpinbuttonValue* clone() const; }; /* Toolbarvalue: @@ -418,6 +424,7 @@ public: ToolbarValue() : ImplControlValue( CTRL_TOOLBAR, BUTTONVALUE_DONTKNOW, 0 ) { mbIsTopDockingArea = sal_False; } virtual ~ToolbarValue(); + virtual ToolbarValue* clone() const; Rectangle maGripRect; sal_Bool mbIsTopDockingArea; // indicates that this is the top aligned dockingarea // adjacent to the menubar @@ -433,6 +440,7 @@ public: MenubarValue() : ImplControlValue( CTRL_MENUBAR, BUTTONVALUE_DONTKNOW, 0 ) { maTopDockingAreaHeight=0; } virtual ~MenubarValue(); + virtual MenubarValue* clone() const; int maTopDockingAreaHeight; }; @@ -451,6 +459,7 @@ public: , maItemRect( i_rItemRect ) {} virtual ~MenupopupValue(); + virtual MenupopupValue* clone() const; Rectangle maItemRect; }; @@ -465,6 +474,7 @@ public: : ImplControlValue( CTRL_PUSHBUTTON, BUTTONVALUE_DONTKNOW, 0 ) , mbBevelButton( false ), mbSingleLine( true ) {} virtual ~PushButtonValue(); + virtual PushButtonValue* clone() const; bool mbBevelButton:1; bool mbSingleLine:1; diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx index 50c2ac0540c6..f37417ebeca2 100644 --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -63,38 +63,92 @@ ImplControlValue::~ImplControlValue() { } +ImplControlValue* ImplControlValue::clone() const +{ + assert( typeid( const ImplControlValue ) == typeid( *this )); + return new ImplControlValue( *this ); +} + ScrollbarValue::~ScrollbarValue() { } +ScrollbarValue* ScrollbarValue::clone() const +{ + assert( typeid( const ScrollbarValue ) == typeid( *this )); + return new ScrollbarValue( *this ); +} + SliderValue::~SliderValue() { } +SliderValue* SliderValue::clone() const +{ + assert( typeid( const SliderValue ) == typeid( *this )); + return new SliderValue( *this ); +} + TabitemValue::~TabitemValue() { } +TabitemValue* TabitemValue::clone() const +{ + assert( typeid( const TabitemValue ) == typeid( *this )); + return new TabitemValue( *this ); +} + SpinbuttonValue::~SpinbuttonValue() { } +SpinbuttonValue* SpinbuttonValue::clone() const +{ + assert( typeid( const SpinbuttonValue ) == typeid( *this )); + return new SpinbuttonValue( *this ); +} + ToolbarValue::~ToolbarValue() { } +ToolbarValue* ToolbarValue::clone() const +{ + assert( typeid( const ToolbarValue ) == typeid( *this )); + return new ToolbarValue( *this ); +} + MenubarValue::~MenubarValue() { } +MenubarValue* MenubarValue::clone() const +{ + assert( typeid( const MenubarValue ) == typeid( *this )); + return new MenubarValue( *this ); +} + MenupopupValue::~MenupopupValue() { } +MenupopupValue* MenupopupValue::clone() const +{ + assert( typeid( const MenupopupValue ) == typeid( *this )); + return new MenupopupValue( *this ); +} + PushButtonValue::~PushButtonValue() { } +PushButtonValue* PushButtonValue::clone() const +{ + assert( typeid( const PushButtonValue ) == typeid( *this )); + return new PushButtonValue( *this ); +} + // ----------------------------------------------------------------------- // These functions are mainly passthrough functions that allow access to // the SalFrame behind a Window object for native widget rendering purposes. diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 1e0d25683848..e38838087fea 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -51,6 +51,7 @@ #include <svdata.hxx> #include <outdata.hxx> +#include <boost/scoped_ptr.hpp> #include "basegfx/polygon/b2dpolygon.hxx" @@ -691,19 +692,19 @@ sal_Bool SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); } -void SalGraphics::mirror( ControlType , const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const +void SalGraphics::mirror( ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const { switch( rVal.getType() ) { case CTRL_SLIDER: { - SliderValue* pSlVal = static_cast<SliderValue*>(const_cast<ImplControlValue*>(&rVal)); + SliderValue* pSlVal = static_cast<SliderValue*>(&rVal); mirror(pSlVal->maThumbRect,pOutDev,bBack); } break; case CTRL_SCROLLBAR: { - ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(const_cast<ImplControlValue*>(&rVal)); + ScrollbarValue* pScVal = static_cast<ScrollbarValue*>(&rVal); mirror(pScVal->maThumbRect,pOutDev,bBack); mirror(pScVal->maButton1Rect,pOutDev,bBack); mirror(pScVal->maButton2Rect,pOutDev,bBack); @@ -712,14 +713,14 @@ void SalGraphics::mirror( ControlType , const ImplControlValue& rVal, const Outp case CTRL_SPINBOX: case CTRL_SPINBUTTONS: { - SpinbuttonValue* pSpVal = static_cast<SpinbuttonValue*>(const_cast<ImplControlValue*>(&rVal)); + SpinbuttonValue* pSpVal = static_cast<SpinbuttonValue*>(&rVal); mirror(pSpVal->maUpperRect,pOutDev,bBack); mirror(pSpVal->maLowerRect,pOutDev,bBack); } break; case CTRL_TOOLBAR: { - ToolbarValue* pTVal = static_cast<ToolbarValue*>(const_cast<ImplControlValue*>(&rVal)); + ToolbarValue* pTVal = static_cast<ToolbarValue*>(&rVal); mirror(pTVal->maGripRect,pOutDev,bBack); } break; @@ -734,9 +735,9 @@ sal_Bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, c { Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); - mirror( nType, aValue, pOutDev ); - sal_Bool bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); - mirror( nType, aValue, pOutDev, true ); + boost::scoped_ptr< ImplControlValue > mirrorValue( aValue.clone()); + mirror( *mirrorValue, pOutDev ); + sal_Bool bRet = drawNativeControl( nType, nPart, rgn, nState, *mirrorValue, aCaption ); return bRet; } else @@ -751,9 +752,9 @@ sal_Bool SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPar { Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); - mirror( nType, aValue, pOutDev ); - sal_Bool bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); - mirror( nType, aValue, pOutDev, true ); + boost::scoped_ptr< ImplControlValue > mirrorValue( aValue.clone()); + mirror( *mirrorValue, pOutDev ); + sal_Bool bRet = drawNativeControlText( nType, nPart, rgn, nState, *mirrorValue, aCaption ); return bRet; } else @@ -768,20 +769,16 @@ sal_Bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPa { Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); - mirror( nType, aValue, pOutDev ); - if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, + boost::scoped_ptr< ImplControlValue > mirrorValue( aValue.clone()); + mirror( *mirrorValue, pOutDev ); + if( getNativeControlRegion( nType, nPart, rgn, nState, *mirrorValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ) ) { mirror( rNativeBoundingRegion, pOutDev, true ); mirror( rNativeContentRegion, pOutDev, true ); - mirror( nType, aValue, pOutDev, true ); return sal_True; } - else - { - mirror( nType, aValue, pOutDev, true ); - return sal_False; - } + return sal_False; } else return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption, |