[Libreoffice-commits] .: 3 commits - vcl/inc vcl/source vcl/unx
Lubos Lunak
llunak at kemper.freedesktop.org
Wed Feb 1 08:39:08 PST 2012
vcl/inc/salgdi.hxx | 2 -
vcl/inc/vcl/salnativewidgets.hxx | 18 ++++++++++---
vcl/source/gdi/outdevnative.cxx | 54 +++++++++++++++++++++++++++++++++++++++
vcl/source/gdi/salgdilayout.cxx | 35 +++++++++++--------------
vcl/unx/kde4/KDESalGraphics.cxx | 1
5 files changed, 86 insertions(+), 24 deletions(-)
New commits:
commit c161e3652853e7478f79df22e83412ada50f3c6a
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Feb 1 17:36:16 2012 +0100
add a check before a cast
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index c552d91..0be12fb 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -369,6 +369,7 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
// paints the whole menu item, so translate position (and it'll be clipped);
// it is also necessary to fill the background transparently first, as this
// is painted after menuitem highlight, otherwise there would be a grey area
+ assert( value.getType() == CTRL_MENU_POPUP );
const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value);
QRect menuItemRect( region2QRect( menuVal->maItemRect ));
QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(),
commit 47f16670f05186413d6f5b436d36c0e52059c74a
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Feb 1 16:52:43 2012 +0100
VCL_DLLPUBLIC was missing for some *Value types
diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx
index 6c7cba1..872fa35 100644
--- a/vcl/inc/vcl/salnativewidgets.hxx
+++ b/vcl/inc/vcl/salnativewidgets.hxx
@@ -418,7 +418,7 @@ class VCL_DLLPUBLIC SpinbuttonValue : public ImplControlValue
*
* Value container for toolbars detailing the grip position
*/
-class ToolbarValue : public ImplControlValue
+class VCL_DLLPUBLIC ToolbarValue : public ImplControlValue
{
public:
ToolbarValue() : ImplControlValue( CTRL_TOOLBAR, BUTTONVALUE_DONTKNOW, 0 )
@@ -434,7 +434,7 @@ public:
*
* Value container for menubars specifying height of adjacent docking area
*/
-class MenubarValue : public ImplControlValue
+class VCL_DLLPUBLIC MenubarValue : public ImplControlValue
{
public:
MenubarValue() : ImplControlValue( CTRL_MENUBAR, BUTTONVALUE_DONTKNOW, 0 )
@@ -449,7 +449,7 @@ public:
* Value container for menu items; specifies the rectangle for the whole item which
* may be useful when drawing parts with a smaller rectangle.
*/
-class MenupopupValue : public ImplControlValue
+class VCL_DLLPUBLIC MenupopupValue : public ImplControlValue
{
public:
MenupopupValue() : ImplControlValue( CTRL_MENU_POPUP, BUTTONVALUE_DONTKNOW, 0 )
@@ -467,7 +467,7 @@ public:
*
* Value container for pushbuttons specifying additional drawing hints
*/
-class PushButtonValue : public ImplControlValue
+class VCL_DLLPUBLIC PushButtonValue : public ImplControlValue
{
public:
PushButtonValue()
commit 150befe0fe9533f39df55b0d95ad25caaddf1830
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Feb 1 16:46:05 2012 +0100
const is such a useless concept anyway </sarcasm>
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 7736832..d29247b 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 af39285..6c7cba1 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 50c2ac0..f37417e 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 1e0d256..e388380 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,
More information about the Libreoffice-commits
mailing list