summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/gen.hxx3
-rw-r--r--sc/source/core/tool/detfunc.cxx4
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
-rw-r--r--svx/source/svdraw/svdopath.cxx3
-rw-r--r--tools/source/generic/gen.cxx9
-rw-r--r--vcl/source/control/scrbar.cxx10
6 files changed, 18 insertions, 13 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index fb4a14f1db7b..7365d60728a4 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -25,6 +25,7 @@
#include <algorithm>
#include <ostream>
#include <config_options.h>
+#include <cassert>
class SvStream;
namespace rtl
@@ -386,6 +387,8 @@ public:
Rectangle( long nLeft, long nTop );
Rectangle( const Point& rLT, const Size& rSize );
+ static Rectangle Justify( const Point& rLT, const Point& rRB );
+
long Left() const { return nLeft; }
long Right() const;
long Top() const { return nTop; }
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index ac1af287d1a5..4923a2f68345 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -509,7 +509,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
*pModel,
OBJ_LINE,
basegfx::B2DPolyPolygon(aTempPoly));
- pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
+ pArrow->NbcSetLogicRect(tools::Rectangle::Justify(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
pArrow->SetLayer( SC_LAYER_INTERN );
@@ -578,7 +578,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
*pModel,
OBJ_LINE,
basegfx::B2DPolyPolygon(aTempPoly));
- pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
+ pArrow->NbcSetLogicRect(tools::Rectangle::Justify(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index a6d74d075077..33eb60a9dd37 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2340,7 +2340,7 @@ void EnhancedCustomShape2d::CreateSubPath(
sal_uInt32 nXor = bClockwise ? 3 : 2;
for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 3 ) < nCoordSize ); i++ )
{
- tools::Rectangle aRect( GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ rSrcPt + 1 ], true, true ) );
+ tools::Rectangle aRect = tools::Rectangle::Justify( GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ rSrcPt + 1 ], true, true ) );
if ( aRect.GetWidth() && aRect.GetHeight() )
{
Point aStart( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + nXor ) ], true, true ) );
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 4ff57d767470..bba20891df41 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -1674,8 +1674,7 @@ void SdrPathObj::ImpForceLineAngle()
aGeo.RecalcTan();
// for SdrTextObj, keep aRect up to date
- maRect = tools::Rectangle(aPoint0, aPoint1);
- maRect.Justify();
+ maRect = tools::Rectangle::Justify(aPoint0, aPoint1);
}
void SdrPathObj::ImpForceKind()
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 7c182818c460..7a275eea3088 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -37,6 +37,15 @@ OString Pair::toString() const
return ss.str().c_str();
}
+tools::Rectangle tools::Rectangle::Justify( const Point& rLT, const Point& rRB )
+{
+ long nLeft = std::min(rLT.X(), rRB.X());
+ long nTop = std::min(rLT.Y(), rRB.Y());
+ long nRight = std::max(rLT.X(), rRB.X());
+ long nBottom = std::max(rLT.Y(), rRB.Y());
+ return Rectangle( nLeft, nTop, nRight, nBottom );
+}
+
void tools::Rectangle::SetSize( const Size& rSize )
{
if ( rSize.Width() < 0 )
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 0cf1c9c5f82c..6d313b0ffe1e 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -269,10 +269,7 @@ void ScrollBar::ImplCalc( bool bUpdate )
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aTrackRegion ) )
maTrackRect = aTrackRegion;
else
- {
- maTrackRect = tools::Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() );
- maTrackRect.Justify();
- }
+ maTrackRect = tools::Rectangle::Justify( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() );
// Check if available space is big enough for thumb ( min thumb size = ScrBar width/height )
mnThumbPixRange = maTrackRect.Right() - maTrackRect.Left();
@@ -309,10 +306,7 @@ void ScrollBar::ImplCalc( bool bUpdate )
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aTrackRegion ) )
maTrackRect = aTrackRegion;
else
- {
- maTrackRect = tools::Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() );
- maTrackRect.Justify();
- }
+ maTrackRect = tools::Rectangle::Justify( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() );
// Check if available space is big enough for thumb
mnThumbPixRange = maTrackRect.Bottom() - maTrackRect.Top();