summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/gen.hxx3
-rw-r--r--starmath/source/mathmlimport.cxx4
-rw-r--r--tools/source/generic/gen.cxx12
3 files changed, 17 insertions, 2 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 53f7fb716e3c..90486536c401 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -472,6 +472,9 @@ public:
* Sanitizing variants for handling data from the outside
*/
void SaturatingSetSize(const Size& rSize);
+ void SaturatingSetX(long x);
+ void SaturatingSetY(long y);
+
private:
long nLeft;
long nTop;
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index ed207aaa0f0b..59b42570a2d0 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -3067,12 +3067,12 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
if (pValue->Name == "ViewAreaTop" )
{
pValue->Value >>= nTmp;
- aRect.setY( nTmp );
+ aRect.SaturatingSetY(nTmp);
}
else if (pValue->Name == "ViewAreaLeft" )
{
pValue->Value >>= nTmp;
- aRect.setX( nTmp );
+ aRect.SaturatingSetX(nTmp);
}
else if (pValue->Name == "ViewAreaWidth" )
{
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 5fe6eeeaa3d6..ea855f98e9f0 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -85,6 +85,18 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize)
nBottom = RECT_EMPTY;
}
+void tools::Rectangle::SaturatingSetX(long x)
+{
+ nRight = o3tl::saturating_add(nRight, x - nLeft);
+ nLeft = x;
+}
+
+void tools::Rectangle::SaturatingSetY(long y)
+{
+ nBottom = o3tl::saturating_add(nBottom, y - nTop);
+ nTop = y;
+}
+
tools::Rectangle& tools::Rectangle::Union( const tools::Rectangle& rRect )
{
if ( rRect.IsEmpty() )