diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-26 09:50:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-03 10:37:51 +0200 |
commit | 8bc951daf79decbd8a599a409c6d33c5456710e0 (patch) | |
tree | 61d220d83e90a176fbcbe667827eee4b9631a4ca /sw | |
parent | 10eefdfa6c0250c6069e641e404f34e5a91fe993 (diff) |
long->sal_Int32 in tools/gen.hxx
which triggered a lot of changes in sw/
Change-Id: Ia2aa22ea3f76463a85ea077a411246fcfed00bf6
Reviewed-on: https://gerrit.libreoffice.org/48806
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
91 files changed, 543 insertions, 559 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index fdbebe125cec..cd0a3f02397d 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -285,7 +285,7 @@ public: All base lines behind it are moved to a new table/ -node. Is the flag bCalcNewSize set to TRUE, the new SSize for both tables is calculated from the Maximum of the boxes, provided - SSize is set "absolute" (LONG_MAX). + SSize is set "absolute" (RECT_MAX). (Momentarily this is needed only for the RTF-parser.) */ SwTableNode* SplitTable( const SwNodeIndex& rPos, bool bAfter = true, bool bCalcNewSize = false ); diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index c4b1889ae4ae..3c6818c5f807 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -40,7 +40,7 @@ public: inline SwRect( const SwRect &rRect ); inline SwRect( const Point& rLT, const Size& rSize ); inline SwRect( const Point& rLT, const Point& rRB ); - inline SwRect( long X, long Y, long Width, long Height ); + inline SwRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ); //SV-SS e.g. SwRect( pWin->GetClipRect() ); SwRect( const tools::Rectangle &rRect ); @@ -48,25 +48,25 @@ public: //Set-Methods inline void Chg( const Point& rNP, const Size &rNS ); inline void Pos( const Point& rNew ); - inline void Pos( const long nNewX, const long nNewY ); + inline void Pos( const sal_Int32 nNewX, const sal_Int32 nNewY ); inline void SSize( const Size& rNew ); - inline void SSize( const long nHeight, const long nWidth ); - inline void Width( long nNew ); - inline void Height( long nNew ); - inline void Left( const long nLeft ); - inline void Right( const long nRight ); - inline void Top( const long nTop ); - inline void Bottom( const long nBottom ); + inline void SSize( const sal_Int32 nHeight, const sal_Int32 nWidth ); + inline void Width( sal_Int32 nNew ); + inline void Height( sal_Int32 nNew ); + inline void Left( const sal_Int32 nLeft ); + inline void Right( const sal_Int32 nRight ); + inline void Top( const sal_Int32 nTop ); + inline void Bottom( const sal_Int32 nBottom ); //Get-Methods inline const Point &Pos() const; inline const Size &SSize() const; - inline long Width() const; - inline long Height() const; - inline long Left() const; - inline long Right() const; - inline long Top() const; - inline long Bottom() const; + inline sal_Int32 Width() const; + inline sal_Int32 Height() const; + inline sal_Int32 Left() const; + inline sal_Int32 Right() const; + inline sal_Int32 Top() const; + inline sal_Int32 Bottom() const; // In order to be able to access the members of Pos and SSize from the layout side. inline Point &Pos(); @@ -83,7 +83,7 @@ public: SwRect &Intersection_( const SwRect &rRect ); bool IsInside( const Point& rPOINT ) const; - bool IsNear(const Point& rPoint, long nTolerance ) const; + bool IsNear(const Point& rPoint, sal_Int32 nTolerance ) const; bool IsInside( const SwRect& rRect ) const; bool IsOver( const SwRect& rRect ) const; inline bool HasArea() const; @@ -105,30 +105,30 @@ public: friend SvStream& WriteSwRect( SvStream &rStream, const SwRect &rRect ); - void Top_( const long nTop ); - void Bottom_( const long nBottom ); - void Left_( const long nLeft ); - void Right_( const long nRight ); - void Width_( const long nNew ); - void Height_( const long nNew ); - long Top_() const; - long Bottom_() const; - long Left_() const; - long Right_() const; - long Width_() const; - long Height_() const; - void SubTop( const long nSub ); - void AddBottom( const long nAdd ); - void SubLeft( const long nSub ); - void AddRight( const long nAdd ); - void AddWidth( const long nAdd ); - void AddHeight( const long nAdd ); - void SetPosX( const long nNew ); - void SetPosY( const long nNew ); - void SetLeftAndWidth( long nLeft, long nNew ); - void SetTopAndHeight( long nTop, long nNew ); - void SetRightAndWidth( long nRight, long nNew ); - void SetBottomAndHeight( long nBottom, long nNew ); + void Top_( const sal_Int32 nTop ); + void Bottom_( const sal_Int32 nBottom ); + void Left_( const sal_Int32 nLeft ); + void Right_( const sal_Int32 nRight ); + void Width_( const sal_Int32 nNew ); + void Height_( const sal_Int32 nNew ); + sal_Int32 Top_() const; + sal_Int32 Bottom_() const; + sal_Int32 Left_() const; + sal_Int32 Right_() const; + sal_Int32 Width_() const; + sal_Int32 Height_() const; + void SubTop( const sal_Int32 nSub ); + void AddBottom( const sal_Int32 nAdd ); + void SubLeft( const sal_Int32 nSub ); + void AddRight( const sal_Int32 nAdd ); + void AddWidth( const sal_Int32 nAdd ); + void AddHeight( const sal_Int32 nAdd ); + void SetPosX( const sal_Int32 nNew ); + void SetPosY( const sal_Int32 nNew ); + void SetLeftAndWidth( sal_Int32 nLeft, sal_Int32 nNew ); + void SetTopAndHeight( sal_Int32 nTop, sal_Int32 nNew ); + void SetRightAndWidth( sal_Int32 nRight, sal_Int32 nNew ); + void SetBottomAndHeight( sal_Int32 nBottom, sal_Int32 nNew ); void SetUpperLeftCorner( const Point& rNew ); void SetUpperRightCorner( const Point& rNew ); void SetLowerLeftCorner( const Point& rNew ); @@ -138,23 +138,23 @@ public: const Point BottomLeft() const; const Point BottomRight() const; const Size SwappedSize() const; - long GetLeftDistance( long ) const; - long GetBottomDistance( long ) const; - long GetRightDistance( long ) const; - long GetTopDistance( long ) const; - bool OverStepLeft( long ) const; - bool OverStepBottom( long ) const; - bool OverStepTop( long ) const; - bool OverStepRight( long ) const; + sal_Int32 GetLeftDistance( sal_Int32 ) const; + sal_Int32 GetBottomDistance( sal_Int32 ) const; + sal_Int32 GetRightDistance( sal_Int32 ) const; + sal_Int32 GetTopDistance( sal_Int32 ) const; + bool OverStepLeft( sal_Int32 ) const; + bool OverStepBottom( sal_Int32 ) const; + bool OverStepTop( sal_Int32 ) const; + bool OverStepRight( sal_Int32 ) const; }; -typedef void (SwRect:: *SwRectSet)( const long nNew ); -typedef long (SwRect:: *SwRectGet)() const; +typedef void (SwRect:: *SwRectSet)( const sal_Int32 nNew ); +typedef sal_Int32 (SwRect:: *SwRectGet)() const; typedef const Point (SwRect:: *SwRectPoint)() const; typedef const Size (SwRect:: *SwRectSize)() const; -typedef bool (SwRect:: *SwRectMax)( long ) const; -typedef long (SwRect:: *SwRectDist)( long ) const; -typedef void (SwRect:: *SwRectSetTwice)( long, long ); +typedef bool (SwRect:: *SwRectMax)( sal_Int32 ) const; +typedef sal_Int32 (SwRect:: *SwRectDist)( sal_Int32 ) const; +typedef void (SwRect:: *SwRectSetTwice)( sal_Int32, sal_Int32 ); typedef void (SwRect:: *SwRectSetPos)( const Point& ); // Set-Methods @@ -167,7 +167,7 @@ inline void SwRect::Pos( const Point& rNew ) { m_Point = rNew; } -inline void SwRect::Pos( const long nNewX, const long nNewY ) +inline void SwRect::Pos( const sal_Int32 nNewX, const sal_Int32 nNewY ) { m_Point.setX(nNewX); m_Point.setY(nNewY); @@ -176,34 +176,34 @@ inline void SwRect::SSize( const Size& rNew ) { m_Size = rNew; } -inline void SwRect::SSize( const long nNewHeight, const long nNewWidth ) +inline void SwRect::SSize( const sal_Int32 nNewHeight, const sal_Int32 nNewWidth ) { m_Size.setWidth(nNewWidth); m_Size.setHeight(nNewHeight); } -inline void SwRect::Width( long nNew ) +inline void SwRect::Width( sal_Int32 nNew ) { m_Size.setWidth(nNew); } -inline void SwRect::Height( long nNew ) +inline void SwRect::Height( sal_Int32 nNew ) { m_Size.setHeight(nNew); } -inline void SwRect::Left( const long nLeft ) +inline void SwRect::Left( const sal_Int32 nLeft ) { m_Size.AdjustWidth( m_Point.getX() - nLeft ); m_Point.setX(nLeft); } -inline void SwRect::Right( const long nRight ) +inline void SwRect::Right( const sal_Int32 nRight ) { m_Size.setWidth(nRight - m_Point.getX() + 1); } -inline void SwRect::Top( const long nTop ) +inline void SwRect::Top( const sal_Int32 nTop ) { m_Size.AdjustHeight( m_Point.getY() - nTop ); m_Point.setY(nTop); } -inline void SwRect::Bottom( const long nBottom ) +inline void SwRect::Bottom( const sal_Int32 nBottom ) { m_Size.setHeight(nBottom - m_Point.getY() + 1); } @@ -225,27 +225,27 @@ inline Size &SwRect::SSize() { return m_Size; } -inline long SwRect::Width() const +inline sal_Int32 SwRect::Width() const { return m_Size.Width(); } -inline long SwRect::Height() const +inline sal_Int32 SwRect::Height() const { return m_Size.Height(); } -inline long SwRect::Left() const +inline sal_Int32 SwRect::Left() const { return m_Point.X(); } -inline long SwRect::Right() const +inline sal_Int32 SwRect::Right() const { return m_Size.getWidth() ? m_Point.getX() + m_Size.getWidth() - 1 : m_Point.getX(); } -inline long SwRect::Top() const +inline sal_Int32 SwRect::Top() const { return m_Point.Y(); } -inline long SwRect::Bottom() const +inline sal_Int32 SwRect::Bottom() const { return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); } @@ -282,8 +282,8 @@ inline tools::Rectangle SwRect::SVRect() const { SAL_WARN_IF( IsEmpty(), "sw", "SVRect() without Width or Height" ); return tools::Rectangle( m_Point.getX(), m_Point.getY(), - m_Point.getX() + m_Size.getWidth() - 1, //Right() - m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() + m_Point.getX() + (m_Size.getWidth() - 1), //Right() + m_Point.getY() + (m_Size.getHeight() - 1) ); //Bottom() } inline bool SwRect::HasArea() const @@ -323,7 +323,7 @@ inline SwRect::SwRect( const Point& rLT, const Point& rRB ) : m_Size( rRB.X() - rLT.X() + 1, rRB.Y() - rLT.Y() + 1 ) { } -inline SwRect::SwRect( long X, long Y, long W, long H ) : +inline SwRect::SwRect( sal_Int32 X, sal_Int32 Y, sal_Int32 W, sal_Int32 H ) : m_Point( X, Y ), m_Size( W, H ) { diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 613f258fe192..2fde7b6bb55a 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -46,9 +46,9 @@ class CharClass; class CollatorWrapper; class LanguageTag; -typedef long SwTwips; -#define INVALID_TWIPS LONG_MAX -#define TWIPS_MAX (LONG_MAX - 1) +typedef sal_Int32 SwTwips; +#define INVALID_TWIPS RECT_MAX +#define TWIPS_MAX (RECT_MAX - 1) // Converts Millimeters to Twips (1 mm == 56.905479 twips). template <typename T = SwTwips> diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 7f10e4befa90..1ba766356cad 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -397,7 +397,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, "reqif-ole-img.xhtml") Size aLogic(pDevice->PixelToLogic(aPixel, MapMode(MapUnit::Map100thMM))); awt::Size aSize = xShape->getSize(); // This was only 1247, size was not set explicitly. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(aLogic.getWidth()), aSize.Width); + CPPUNIT_ASSERT_EQUAL(aLogic.getWidth(), aSize.Width); // Check mime/media types. CPPUNIT_ASSERT_EQUAL(OUString("image/png"), getProperty<OUString>(xGraphic, "MimeType")); diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 571c96e5d6a2..6f2180da49ea 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -125,11 +125,11 @@ DECLARE_RTFEXPORT_TEST(testN192129, "n192129.rtf") awt::Size aActualSize(xShape->getSize()); if ((aExpectedSize.Width() - aActualSize.Width) / 2 != 0) { - CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width); + CPPUNIT_ASSERT_EQUAL(aExpectedSize.Width(), aActualSize.Width); } if ((aExpectedSize.Height() - aActualSize.Height) / 2 != 0) { - CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height); + CPPUNIT_ASSERT_EQUAL(aExpectedSize.Height(), aActualSize.Height); } } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index ee9b1711f165..e4af20ddc392 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1364,8 +1364,8 @@ DECLARE_RTFIMPORT_TEST(testWatermark, "watermark.rtf") uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); awt::Size aActualSize(xShape->getSize()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width); - CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height); + CPPUNIT_ASSERT_EQUAL(aExpectedSize.Width(), aActualSize.Width); + CPPUNIT_ASSERT_EQUAL(aExpectedSize.Height(), aActualSize.Height); } DECLARE_RTFIMPORT_TEST(testTdf104016, "tdf104016.rtf") diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 394036c6d955..06a7ae836033 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -523,8 +523,8 @@ void SwTiledRenderingTest::testSearchViewArea() { {"SearchItem.SearchString", uno::makeAny(OUString("Heading"))}, {"SearchItem.Backward", uno::makeAny(false)}, - {"SearchItem.SearchStartPointX", uno::makeAny(static_cast<sal_Int32>(aPoint.getX()))}, - {"SearchItem.SearchStartPointY", uno::makeAny(static_cast<sal_Int32>(aPoint.getY()))} + {"SearchItem.SearchStartPointX", uno::makeAny(aPoint.getX())}, + {"SearchItem.SearchStartPointY", uno::makeAny(aPoint.getY())} })); comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); // This was just "Heading", i.e. SwView::SearchAndWrap() did not search from only the top of the second page. diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 628ad727dc47..ef7ee44374e0 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -1382,7 +1382,7 @@ bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj, if( pFEShell && (pFEShell->IsFrameSelected() || pFEShell->IsObjSelected()) ) { - Point aPt( LONG_MIN, LONG_MIN ); + Point aPt( RECT_MIN, RECT_MIN ); pFEShell->SelectObj( aPt ); bCallShowCursor = true; } diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index 8702d8f15733..a8d228288f15 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -116,7 +116,7 @@ bool SwRect::IsInside( const Point& rPoint ) const } // mouse moving of table borders -bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const +bool SwRect::IsNear( const Point& rPoint, sal_Int32 nTolerance ) const { bool bIsNearby = (((Left() - nTolerance) <= rPoint.X()) && ((Top() - nTolerance) <= rPoint.Y()) && @@ -148,28 +148,28 @@ void SwRect::Justify() } // Similar to the inline methods, but we need the function pointers -void SwRect::Width_( const long nNew ) { m_Size.setWidth(nNew); } -void SwRect::Height_( const long nNew ) { m_Size.setHeight(nNew); } -void SwRect::Left_( const long nLeft ){ m_Size.AdjustWidth(m_Point.getX() - nLeft ); m_Point.setX(nLeft); } -void SwRect::Right_( const long nRight ){ m_Size.setWidth(nRight - m_Point.getX()); } -void SwRect::Top_( const long nTop ){ m_Size.AdjustHeight(m_Point.getY() - nTop ); m_Point.setY(nTop); } -void SwRect::Bottom_( const long nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); } - -long SwRect::Width_() const{ return m_Size.getWidth(); } -long SwRect::Height_() const{ return m_Size.getHeight(); } -long SwRect::Left_() const{ return m_Point.getX(); } -long SwRect::Right_() const{ return m_Point.getX() + m_Size.getWidth(); } -long SwRect::Top_() const{ return m_Point.getY(); } -long SwRect::Bottom_() const{ return m_Point.getY() + m_Size.getHeight(); } - -void SwRect::AddWidth( const long nAdd ) { m_Size.AdjustWidth(nAdd ); } -void SwRect::AddHeight( const long nAdd ) { m_Size.AdjustHeight(nAdd ); } -void SwRect::SubLeft( const long nSub ){ m_Size.AdjustWidth(nSub ); m_Point.setX(m_Point.getX() - nSub); } -void SwRect::AddRight( const long nAdd ){ m_Size.AdjustWidth(nAdd ); } -void SwRect::SubTop( const long nSub ){ m_Size.AdjustHeight(nSub ); m_Point.setY(m_Point.getY() - nSub); } -void SwRect::AddBottom( const long nAdd ){ m_Size.AdjustHeight(nAdd ); } -void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); } -void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); } +void SwRect::Width_( const sal_Int32 nNew ) { m_Size.setWidth(nNew); } +void SwRect::Height_( const sal_Int32 nNew ) { m_Size.setHeight(nNew); } +void SwRect::Left_( const sal_Int32 nLeft ){ m_Size.AdjustWidth(m_Point.getX() - nLeft ); m_Point.setX(nLeft); } +void SwRect::Right_( const sal_Int32 nRight ){ m_Size.setWidth(nRight - m_Point.getX()); } +void SwRect::Top_( const sal_Int32 nTop ){ m_Size.AdjustHeight(m_Point.getY() - nTop ); m_Point.setY(nTop); } +void SwRect::Bottom_( const sal_Int32 nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); } + +sal_Int32 SwRect::Width_() const{ return m_Size.getWidth(); } +sal_Int32 SwRect::Height_() const{ return m_Size.getHeight(); } +sal_Int32 SwRect::Left_() const{ return m_Point.getX(); } +sal_Int32 SwRect::Right_() const{ return m_Point.getX() + m_Size.getWidth(); } +sal_Int32 SwRect::Top_() const{ return m_Point.getY(); } +sal_Int32 SwRect::Bottom_() const{ return m_Point.getY() + m_Size.getHeight(); } + +void SwRect::AddWidth( const sal_Int32 nAdd ) { m_Size.AdjustWidth(nAdd ); } +void SwRect::AddHeight( const sal_Int32 nAdd ) { m_Size.AdjustHeight(nAdd ); } +void SwRect::SubLeft( const sal_Int32 nSub ){ m_Size.AdjustWidth(nSub ); m_Point.setX(m_Point.getX() - nSub); } +void SwRect::AddRight( const sal_Int32 nAdd ){ m_Size.AdjustWidth(nAdd ); } +void SwRect::SubTop( const sal_Int32 nSub ){ m_Size.AdjustHeight(nSub ); m_Point.setY(m_Point.getY() - nSub); } +void SwRect::AddBottom( const sal_Int32 nAdd ){ m_Size.AdjustHeight(nAdd ); } +void SwRect::SetPosX( const sal_Int32 nNew ){ m_Point.setX(nNew); } +void SwRect::SetPosY( const sal_Int32 nNew ){ m_Point.setY(nNew); } const Size SwRect::Size_() const { return SSize(); } const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); } @@ -180,36 +180,36 @@ const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.g const Point SwRect::BottomRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); } -long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; } -long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();} -long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; } -long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); } +sal_Int32 SwRect::GetLeftDistance( sal_Int32 nLimit ) const { return m_Point.getX() - nLimit; } +sal_Int32 SwRect::GetBottomDistance( sal_Int32 nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();} +sal_Int32 SwRect::GetTopDistance( sal_Int32 nLimit ) const { return m_Point.getY() - nLimit; } +sal_Int32 SwRect::GetRightDistance( sal_Int32 nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); } -bool SwRect::OverStepLeft( long nLimit ) const +bool SwRect::OverStepLeft( sal_Int32 nLimit ) const { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } -bool SwRect::OverStepBottom( long nLimit ) const +bool SwRect::OverStepBottom( sal_Int32 nLimit ) const { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } -bool SwRect::OverStepTop( long nLimit ) const +bool SwRect::OverStepTop( sal_Int32 nLimit ) const { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } -bool SwRect::OverStepRight( long nLimit ) const +bool SwRect::OverStepRight( sal_Int32 nLimit ) const { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } -void SwRect::SetLeftAndWidth( long nLeft, long nNew ) +void SwRect::SetLeftAndWidth( sal_Int32 nLeft, sal_Int32 nNew ) { m_Point.setX(nLeft); m_Size.setWidth(nNew); } -void SwRect::SetTopAndHeight( long nTop, long nNew ) +void SwRect::SetTopAndHeight( sal_Int32 nTop, sal_Int32 nNew ) { m_Point.setY(nTop); m_Size.setHeight(nNew); } -void SwRect::SetRightAndWidth( long nRight, long nNew ) +void SwRect::SetRightAndWidth( sal_Int32 nRight, sal_Int32 nNew ) { m_Point.setX(nRight - nNew); m_Size.setWidth(nNew); } -void SwRect::SetBottomAndHeight( long nBottom, long nNew ) +void SwRect::SetBottomAndHeight( sal_Int32 nBottom, sal_Int32 nNew ) { m_Point.setY(nBottom - nNew); m_Size.setHeight(nNew); diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx index c17a0a87dc22..e74953eeb5dd 100644 --- a/sw/source/core/bastyp/tabcol.cxx +++ b/sw/source/core/bastyp/tabcol.cxx @@ -71,7 +71,7 @@ void SwTabCols::Insert( long nValue, bool bValue, size_t nPos ) SwTabColsEntry aEntry; aEntry.nPos = nValue; aEntry.nMin = 0; - aEntry.nMax = LONG_MAX; + aEntry.nMax = SAL_MAX_INT32; aEntry.bHidden = bValue; aData.insert( aData.begin() + nPos, aEntry ); diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index fdc029cfb177..da0233037251 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -363,8 +363,8 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrame( } SwTwips nUpperDummy = 0; - long nRightOffset = 0, - nLeftOffset = 0; + sal_Int32 nRightOffset = 0, + nLeftOffset = 0; rTabFrame.CalcFlyOffsets( nUpperDummy, nLeftOffset, nRightOffset ); nWidth -= (nLeftOffset + nRightOffset); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 4aae97a40690..98a85228130b 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -389,8 +389,8 @@ void SwNoTextFrame::GetGrfArea( SwRect &rRect, SwRect* pOrigRect ) const } else { - nLeftCrop = std::max( aOrigSz.Width() - - (rCrop.GetRight() + rCrop.GetLeft()), long(1) ); + nLeftCrop = std::max<sal_Int32>( aOrigSz.Width() - + (rCrop.GetRight() + rCrop.GetLeft()), 1 ); const double nScale = double(aFramePrintArea.Width()) / double(nLeftCrop); nLeftCrop = long(nScale * -rCrop.GetLeft() ); nRightCrop = long(nScale * -rCrop.GetRight() ); @@ -412,7 +412,7 @@ void SwNoTextFrame::GetGrfArea( SwRect &rRect, SwRect* pOrigRect ) const } else { - nTopCrop = std::max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) ); + nTopCrop = std::max<sal_Int32>( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), 1 ); const double nScale = double(aFramePrintArea.Height()) / double(nTopCrop); nTopCrop = long(nScale * -rCrop.GetTop() ); nBottomCrop= long(nScale * -rCrop.GetBottom() ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 5544487788a2..9b6c27d3ea83 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -250,7 +250,7 @@ struct CpyPara CpyPara( SwTableNode* pNd, sal_uInt16 nCopies, CpyTabFrames& rFrameArr ) : pDoc( pNd->GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr), pInsLine(nullptr), pInsBox(nullptr), nOldSize(0), nNewSize(0), - nMinLeft(ULONG_MAX), nMaxRight(0), + nMinLeft(SAL_MAX_UINT32), nMaxRight(0), nCpyCnt(nCopies), nInsPos(0), nLnIdx(0), nBoxIdx(0), nDelBorderFlag(0), bCpyContent( true ) @@ -3500,7 +3500,7 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp else if( ppUndo ) *ppUndo = new SwUndoAttrTable( *aParam.pTableNd, true ); - long nFrameWidth = LONG_MAX; + long nFrameWidth = SAL_MAX_INT32; LockModify(); SwFormatFrameSize aSz( rSz ); SvxLRSpaceItem aLR( rLR ); @@ -3585,7 +3585,7 @@ bool SwTable::SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eTyp // If the Table happens to contain relative values (USHORT_MAX), // we need to convert them to absolute ones now. // Bug 61494 - if( LONG_MAX != nFrameWidth ) + if( SAL_MAX_INT32 != nFrameWidth ) { SwFormatFrameSize aAbsSz( aSz ); aAbsSz.SetWidth( nFrameWidth ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 4fc498d41cb8..422e2c45c780 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2581,9 +2581,9 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) const long nLeftMin = ( aRectFnSet.IsVert() ? pTab->GetPrtLeft() - pPage->getFrameArea().Left() : pTab->GetPrtTop() - pPage->getFrameArea().Top() ); - const long nLeft = aRectFnSet.IsVert() ? LONG_MAX : 0; + const long nLeft = aRectFnSet.IsVert() ? SAL_MAX_INT32 : 0; const long nRight = aRectFnSet.GetHeight(pTab->getFramePrintArea()); - const long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX; + const long nRightMax = aRectFnSet.IsVert() ? nRight : SAL_MAX_INT32; rFill.SetLeftMin( nLeftMin ); rFill.SetLeft( nLeft ); @@ -2611,7 +2611,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) aIter = aBoundaries.find( nUpperBorder ); if ( aIter == aBoundaries.end() ) { - aPair.first = nUpperBorder; aPair.second = LONG_MAX; + aPair.first = nUpperBorder; aPair.second = SAL_MAX_INT32; aBoundaries[ nUpperBorder ] = aPair; } @@ -2619,13 +2619,13 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) aIter = aBoundaries.find( nLowerBorder ); if ( aIter == aBoundaries.end() ) { - aPair.first = nUpperBorder; aPair.second = LONG_MAX; + aPair.first = nUpperBorder; aPair.second = SAL_MAX_INT32; } else { nLowerBorder = (*aIter).first; long nNewLowerBorderUpperBoundary = std::max( (*aIter).second.first, nUpperBorder ); - aPair.first = nNewLowerBorderUpperBoundary; aPair.second = LONG_MAX; + aPair.first = nNewLowerBorderUpperBoundary; aPair.second = SAL_MAX_INT32; } aBoundaries[ nLowerBorder ] = aPair; @@ -2757,7 +2757,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, if ( aRectFnSet.IsVert() ) { nLeftMin = pTab->GetPrtLeft() - pPage->getFrameArea().Left(); - aOld.SetLeft ( LONG_MAX ); + aOld.SetLeft ( SAL_MAX_INT32 ); aOld.SetRightMax( aOld.GetRight() ); } @@ -2765,7 +2765,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, { nLeftMin = pTab->GetPrtTop() - pPage->getFrameArea().Top(); aOld.SetLeft ( 0 ); - aOld.SetRightMax( LONG_MAX ); + aOld.SetRightMax( SAL_MAX_INT32 ); } aOld.SetLeftMin ( nLeftMin ); diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index d5070c99cf6b..f7a4ccfd5a94 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -433,7 +433,7 @@ bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly ) { if( !bTstOnly ) { - long nHeight = 0; + sal_Int32 nHeight = 0; for ( auto pLn : aRowArr ) { @@ -1293,7 +1293,7 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell ) // To compensate for the accuracy of calculation later on in SwTable::SetTabCols // we keep adding up a little. nRet += COLFUZZY; - return static_cast<sal_uInt16>(std::max( long(MINLAY), nRet )); + return static_cast<sal_uInt16>(std::max<sal_Int32>( MINLAY, nRet )); } /* The Line is within the Selection but not outlined by the TabCols. diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index cc96d70a4513..93a58d2a4fb1 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -1045,7 +1045,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const } nMin -= MINFLY; } - aSz.setWidth( std::max( aSz.Width(), nMin ) ); + aSz.setWidth( std::max<sal_Int32>( aSz.Width(), nMin ) ); } SwFrameFormat *pFormat = GetFormat(); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index f6b731ba2be1..9f8f24e5cdf9 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1353,7 +1353,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < // allocated values Point aPt( pFly->getFramePrintArea().Pos() ); aPt += pFly->getFrameArea().Pos(); - if ( rRect.Top() != LONG_MIN && rRect.Pos() != aPt && !bPosProt ) + if ( rRect.Top() != RECT_MIN && rRect.Pos() != aPt && !bPosProt ) { aPt = rRect.Pos(); aPt.setX(aPt.getX() - pFly->getFramePrintArea().Left()); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index c1aa0935a071..842d9250f869 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1465,7 +1465,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool const SdrObject *pBest = nullptr, *pTop = nullptr; - const long nTmp = bNext ? LONG_MAX : 0; + const long nTmp = bNext ? RECT_MAX : 0; Point aBestPos( nTmp, nTmp ); Point aTopPos( nTmp, nTmp ); Point aCurPos; @@ -1629,7 +1629,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool } } // unfortunately nothing found - if( bNext ? (aBestPos.getX() == LONG_MAX) : (aBestPos.getX() == 0) ) + if( bNext ? (aBestPos.getX() == RECT_MAX) : (aBestPos.getX() == 0) ) pBest = pTop; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 4f4f64453f93..d820a4c7e7f2 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -585,9 +585,9 @@ void SwFEShell::GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const const long nLeftMin = ( aRectFnSet.IsVert() ? pTab->GetPrtLeft() - pPage->getFrameArea().Left() : pTab->GetPrtTop() - pPage->getFrameArea().Top() ); - const long nLeft = aRectFnSet.IsVert() ? LONG_MAX : 0; + const long nLeft = aRectFnSet.IsVert() ? SAL_MAX_INT32 : 0; const long nRight = aRectFnSet.GetHeight(pTab->getFramePrintArea()); - const long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX; + const long nRightMax = aRectFnSet.IsVert() ? nRight : SAL_MAX_INT32; if (m_pRowCache->pLastTabFrame != pTab || m_pRowCache->pLastCellFrame != pBox) bDel = true; diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 23553e79ae16..2561528e94b8 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -260,9 +260,9 @@ void GetTableSel( const SwLayoutFrame* pStart, const SwLayoutFrame* pEnd, SwSelUnions aUnions; ::MakeSelUnions( aUnions, pStart, pEnd, eSearchType ); - Point aCurrentTopLeft( LONG_MAX, LONG_MAX ); - Point aCurrentTopRight( 0, LONG_MAX ); - Point aCurrentBottomLeft( LONG_MAX, 0 ); + Point aCurrentTopLeft( RECT_MAX, RECT_MAX ); + Point aCurrentTopRight( 0, RECT_MAX ); + Point aCurrentBottomLeft( RECT_MAX, 0 ); Point aCurrentBottomRight( 0, 0 ); const SwCellFrame* pCurrentTopLeftFrame = nullptr; const SwCellFrame* pCurrentTopRightFrame = nullptr; @@ -573,7 +573,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // they're all adjacent size_t n; sal_uInt16 nCellCnt = 0; - long nYPos = LONG_MAX; + long nYPos = SAL_MAX_INT32; long nXPos = 0; long nHeight = 0; @@ -1809,7 +1809,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, const long nStSz = pStart->GetFormat()->GetFrameSize().GetWidth(); const long nEdSz = pEnd->GetFormat()->GetFrameSize().GetWidth(); - const long nWish = std::max( 1L, pTable->GetFormat()->GetFrameSize().GetWidth() ); + const long nWish = std::max<sal_Int32>( 1, pTable->GetFormat()->GetFrameSize().GetWidth() ); while ( pTable ) { SwRectFnSet aRectFnSet(pTable); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index ee21f12bd6f0..d9c88684d9d0 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -846,20 +846,20 @@ public: bool IsInDtor() const { return mbInDtor; } // No inline cause we need the function pointers - long GetTopMargin() const; - long GetBottomMargin() const; - long GetLeftMargin() const; - long GetRightMargin() const; - void SetTopBottomMargins( long, long ); - void SetLeftRightMargins( long, long ); - void SetRightLeftMargins( long, long ); - long GetPrtLeft() const; - long GetPrtBottom() const; - long GetPrtRight() const; - long GetPrtTop() const; - bool SetMinLeft( long ); - bool SetMaxBottom( long ); - bool SetMaxRight( long ); + sal_Int32 GetTopMargin() const; + sal_Int32 GetBottomMargin() const; + sal_Int32 GetLeftMargin() const; + sal_Int32 GetRightMargin() const; + void SetTopBottomMargins( sal_Int32, sal_Int32 ); + void SetLeftRightMargins( sal_Int32, sal_Int32 ); + void SetRightLeftMargins( sal_Int32, sal_Int32 ); + sal_Int32 GetPrtLeft() const; + sal_Int32 GetPrtBottom() const; + sal_Int32 GetPrtRight() const; + sal_Int32 GetPrtTop() const; + bool SetMinLeft( sal_Int32 ); + bool SetMaxBottom( sal_Int32 ); + bool SetMaxRight( sal_Int32 ); void MakeBelowPos( const SwFrame*, const SwFrame*, bool ); void MakeLeftPos( const SwFrame*, const SwFrame*, bool ); void MakeRightPos( const SwFrame*, const SwFrame*, bool ); @@ -1224,11 +1224,11 @@ public: } }; -typedef long (SwFrame:: *SwFrameGet)() const; -typedef bool (SwFrame:: *SwFrameMax)( long ); +typedef sal_Int32 (SwFrame:: *SwFrameGet)() const; +typedef bool (SwFrame:: *SwFrameMax)( sal_Int32 ); typedef void (SwFrame:: *SwFrameMakePos)( const SwFrame*, const SwFrame*, bool ); -typedef long (*SwOperator)( long, long ); -typedef void (SwFrame:: *SwFrameSet)( long, long ); +typedef sal_Int32 (*SwOperator)( sal_Int32, sal_Int32 ); +typedef void (SwFrame:: *SwFrameSet)( sal_Int32, sal_Int32 ); struct SwRectFnCollection { @@ -1316,58 +1316,58 @@ public: || (rRect1.*m_fnRect->fnGetLeft)() != (rRect2.*m_fnRect->fnGetLeft)()); } - long GetTop (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetTop) (); } - long GetBottom(const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetBottom)(); } - long GetLeft (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetLeft) (); } - long GetRight (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetRight) (); } - long GetWidth (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetWidth) (); } - long GetHeight(const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetHeight)(); } + sal_Int32 GetTop (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetTop) (); } + sal_Int32 GetBottom(const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetBottom)(); } + sal_Int32 GetLeft (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetLeft) (); } + sal_Int32 GetRight (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetRight) (); } + sal_Int32 GetWidth (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetWidth) (); } + sal_Int32 GetHeight(const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetHeight)(); } Point GetPos (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetPos) (); } Size GetSize (const SwRect& rRect) const { return (rRect.*m_fnRect->fnGetSize) (); } - void SetTop (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetTop) (nNew); } - void SetBottom(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetBottom)(nNew); } - void SetLeft (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetLeft) (nNew); } - void SetRight (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetRight) (nNew); } - void SetWidth (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetWidth) (nNew); } - void SetHeight(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetHeight)(nNew); } - - void SubTop (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSubTop) (nNew); } - void AddBottom(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnAddBottom)(nNew); } - void SubLeft (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSubLeft) (nNew); } - void AddRight (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnAddRight) (nNew); } - void AddWidth (SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnAddWidth) (nNew); } - void AddHeight(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnAddHeight)(nNew); } - - void SetPosX(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetPosX)(nNew); } - void SetPosY(SwRect& rRect, long nNew) const { (rRect.*m_fnRect->fnSetPosY)(nNew); } - - long GetTopMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetTopMargin) (); } - long GetBottomMargin(const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetBottomMargin)(); } - long GetLeftMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetLeftMargin) (); } - long GetRightMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetRightMargin) (); } - void SetXMargins(SwFrame& rFrame, long nLeft, long nRight) const { (rFrame.*m_fnRect->fnSetXMargins)(nLeft, nRight); } - void SetYMargins(SwFrame& rFrame, long nTop, long nBottom) const { (rFrame.*m_fnRect->fnSetYMargins)(nTop, nBottom); } - long GetPrtTop (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtTop) (); } - long GetPrtBottom (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtBottom) (); } - long GetPrtLeft (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtLeft) (); } - long GetPrtRight (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtRight) (); } - long TopDist (const SwRect& rRect, long nPos) const { return (rRect.*m_fnRect->fnTopDist) (nPos); } - long BottomDist(const SwRect& rRect, long nPos) const { return (rRect.*m_fnRect->fnBottomDist) (nPos); } - long LeftDist (const SwRect& rRect, long nPos) const { return (rRect.*m_fnRect->fnLeftDist) (nPos); } - long RightDist (const SwRect& rRect, long nPos) const { return (rRect.*m_fnRect->fnRightDist) (nPos); } - void SetLimit (SwFrame& rFrame, long nNew) const { (rFrame.*m_fnRect->fnSetLimit) (nNew); } - bool OverStep (const SwRect& rRect, long nPos) const { return (rRect.*m_fnRect->fnOverStep) (nPos); } + void SetTop (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetTop) (nNew); } + void SetBottom(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetBottom)(nNew); } + void SetLeft (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetLeft) (nNew); } + void SetRight (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetRight) (nNew); } + void SetWidth (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetWidth) (nNew); } + void SetHeight(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetHeight)(nNew); } + + void SubTop (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSubTop) (nNew); } + void AddBottom(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnAddBottom)(nNew); } + void SubLeft (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSubLeft) (nNew); } + void AddRight (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnAddRight) (nNew); } + void AddWidth (SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnAddWidth) (nNew); } + void AddHeight(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnAddHeight)(nNew); } + + void SetPosX(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetPosX)(nNew); } + void SetPosY(SwRect& rRect, sal_Int32 nNew) const { (rRect.*m_fnRect->fnSetPosY)(nNew); } + + sal_Int32 GetTopMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetTopMargin) (); } + sal_Int32 GetBottomMargin(const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetBottomMargin)(); } + sal_Int32 GetLeftMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetLeftMargin) (); } + sal_Int32 GetRightMargin (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetRightMargin) (); } + void SetXMargins(SwFrame& rFrame, sal_Int32 nLeft, sal_Int32 nRight) const { (rFrame.*m_fnRect->fnSetXMargins)(nLeft, nRight); } + void SetYMargins(SwFrame& rFrame, sal_Int32 nTop, sal_Int32 nBottom) const { (rFrame.*m_fnRect->fnSetYMargins)(nTop, nBottom); } + sal_Int32 GetPrtTop (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtTop) (); } + sal_Int32 GetPrtBottom (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtBottom) (); } + sal_Int32 GetPrtLeft (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtLeft) (); } + sal_Int32 GetPrtRight (const SwFrame& rFrame) const { return (rFrame.*m_fnRect->fnGetPrtRight) (); } + sal_Int32 TopDist (const SwRect& rRect, sal_Int32 nPos) const { return (rRect.*m_fnRect->fnTopDist) (nPos); } + sal_Int32 BottomDist(const SwRect& rRect, sal_Int32 nPos) const { return (rRect.*m_fnRect->fnBottomDist) (nPos); } + sal_Int32 LeftDist (const SwRect& rRect, sal_Int32 nPos) const { return (rRect.*m_fnRect->fnLeftDist) (nPos); } + sal_Int32 RightDist (const SwRect& rRect, sal_Int32 nPos) const { return (rRect.*m_fnRect->fnRightDist) (nPos); } + void SetLimit (SwFrame& rFrame, sal_Int32 nNew) const { (rFrame.*m_fnRect->fnSetLimit) (nNew); } + bool OverStep (const SwRect& rRect, sal_Int32 nPos) const { return (rRect.*m_fnRect->fnOverStep) (nPos); } void SetPos(SwRect& rRect, const Point& rNew) const { (rRect.*m_fnRect->fnSetPos)(rNew); } void MakePos(SwFrame& rFrame, const SwFrame* pUp, const SwFrame* pPrv, bool bNotify) const { (rFrame.*m_fnRect->fnMakePos)(pUp, pPrv, bNotify); } - long XDiff(long n1, long n2) const { return (m_fnRect->fnXDiff) (n1, n2); } - long YDiff(long n1, long n2) const { return (m_fnRect->fnYDiff) (n1, n2); } - long XInc (long n1, long n2) const { return (m_fnRect->fnXInc) (n1, n2); } - long YInc (long n1, long n2) const { return (m_fnRect->fnYInc) (n1, n2); } + sal_Int32 XDiff(sal_Int32 n1, sal_Int32 n2) const { return (m_fnRect->fnXDiff) (n1, n2); } + sal_Int32 YDiff(sal_Int32 n1, sal_Int32 n2) const { return (m_fnRect->fnYDiff) (n1, n2); } + sal_Int32 XInc (sal_Int32 n1, sal_Int32 n2) const { return (m_fnRect->fnXInc) (n1, n2); } + sal_Int32 YInc (sal_Int32 n1, sal_Int32 n2) const { return (m_fnRect->fnYInc) (n1, n2); } - void SetLeftAndWidth(SwRect& rRect, long nLeft, long nWidth) const { (rRect.*m_fnRect->fnSetLeftAndWidth)(nLeft, nWidth); } - void SetTopAndHeight(SwRect& rRect, long nTop, long nHeight) const { (rRect.*m_fnRect->fnSetTopAndHeight)(nTop, nHeight); } + void SetLeftAndWidth(SwRect& rRect, sal_Int32 nLeft, sal_Int32 nWidth) const { (rRect.*m_fnRect->fnSetLeftAndWidth)(nLeft, nWidth); } + void SetTopAndHeight(SwRect& rRect, sal_Int32 nTop, sal_Int32 nHeight) const { (rRect.*m_fnRect->fnSetTopAndHeight)(nTop, nHeight); } private: bool m_bVert; diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index c0ecd3463b02..98fdfaf85588 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -47,7 +47,7 @@ class SwFrameFormats; class SwRegionRects; #define FAR_AWAY (SAL_MAX_INT32 - 20000) // initial position of a Fly -#define BROWSE_HEIGHT (56700L * 10L) // 10 Meters +#define BROWSE_HEIGHT (56700 * 10) // 10 Meters #define GRFNUM_NO 0 #define GRFNUM_YES 1 #define GRFNUM_REPLACE 2 @@ -125,7 +125,7 @@ extern bool bDontCreateObjects; extern bool bSetCompletePaintOnInvalidate; // for table settings via keyboard -long CalcRowRstHeight( SwLayoutFrame *pRow ); +SwTwips CalcRowRstHeight( SwLayoutFrame *pRow ); long CalcHeightWithFlys( const SwFrame *pFrame ); SwPageFrame *InsertNewPage( SwPageDesc &rDesc, SwFrame *pUpper, diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx index 288055e9e30a..dfa8452a135c 100644 --- a/sw/source/core/inc/tabfrm.hxx +++ b/sw/source/core/inc/tabfrm.hxx @@ -201,8 +201,8 @@ public: bool CalcFlyOffsets( SwTwips& rUpper, - long& rLeftOffset, - long& rRightOffset ) const; + sal_Int32& rLeftOffset, + sal_Int32& rRightOffset ) const; SwTwips CalcHeightOfFirstContentLine() const; diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 87142b7f0e6f..c9a275d989d5 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -157,7 +157,7 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) ( pNewUpper->IsColBodyFrame() && !pNewUpper->GetUpper()->GetPrev() && !pNewUpper->GetUpper()->GetNext() ) ) ) ) - nSpace += pNewUpper->Grow( LONG_MAX, true ); + nSpace += pNewUpper->Grow( SAL_MAX_INT32, true ); if ( nMoveAnyway < 3 ) { @@ -644,15 +644,15 @@ void SwFrame::MakePos() } // #i28701# - new type <SwSortedObjs> -static void lcl_CheckObjects(SwSortedObjs& rSortedObjs, const SwFrame* pFrame, long& rBot) +static void lcl_CheckObjects(SwSortedObjs& rSortedObjs, const SwFrame* pFrame, sal_Int32& rBot) { // And then there can be paragraph anchored frames that sit below their paragraph. - long nMax = 0; + sal_Int32 nMax = 0; for (SwAnchoredObject* pObj : rSortedObjs) { // #i28701# - consider changed type of <SwSortedObjs> // entries. - long nTmp = 0; + sal_Int32 nTmp = 0; if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr ) { SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj); @@ -679,11 +679,11 @@ size_t SwPageFrame::GetContentHeight(const long nTop, const long nBottom) const "SwPageFrame::GetContentHeight(): No support for columns."); // In pages without columns, the content defines the size. - long nBot = getFrameArea().Top() + nTop; + sal_Int32 nBot = getFrameArea().Top() + nTop; const SwFrame *pFrame = Lower(); while (pFrame) { - long nTmp = 0; + sal_Int32 nTmp = 0; const SwFrame *pCnt = static_cast<const SwLayoutFrame*>(pFrame)->ContainsAny(); while (pCnt && (pCnt->GetUpper() == pFrame || static_cast<const SwLayoutFrame*>(pFrame)->IsAnLower(pCnt))) @@ -812,7 +812,7 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) else { // In pages without columns, the content defines the size. - long nBot = GetContentHeight(nTop, nBottom); + sal_Int32 nBot = GetContentHeight(nTop, nBottom); // #i35143# - If second page frame // exists, the first page doesn't have to fulfill the @@ -823,7 +823,7 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) } // #i35143# - Assure, that the page // doesn't exceed the defined browse height. - aFrm.Height( std::min( nBot, BROWSE_HEIGHT ) ); + aFrm.Height( std::min<sal_Int32>( nBot, BROWSE_HEIGHT ) ); } } @@ -1053,7 +1053,7 @@ void SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) // Do not protrude the edge of the visible area. The page may be // wider, because there may be objects with excess width // (RootFrame::ImplCalcBrowseWidth()) - long nMinWidth = 0; + sal_Int32 nMinWidth = 0; for (size_t i = 0; GetDrawObjs() && i < GetDrawObjs()->size(); ++i) { @@ -1070,14 +1070,14 @@ void SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) if ( RndStdIds::FLY_AS_CHAR == rFormat.GetAnchor().GetAnchorId() ) { - nMinWidth = std::max( nMinWidth, + nMinWidth = std::max<sal_Int32>( nMinWidth, bFly ? rFormat.GetFrameSize().GetWidth() : pObj->GetObjRect().Width() ); } } const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() ); - long nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() ); + sal_Int32 nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() ); nWidth -= aRectFnSet.GetLeft(getFramePrintArea()); nWidth -= rAttrs.CalcRightLine(); nWidth = std::max( nMinWidth, nWidth ); @@ -1091,7 +1091,7 @@ void SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) // The PrtArea should already be at least MINLAY wide, matching the // minimal values of the UI SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); - aRectFnSet.SetWidth( aPrt, std::min( long(MINLAY), aRectFnSet.GetWidth(getFrameArea()) ) ); + aRectFnSet.SetWidth( aPrt, std::min<sal_Int32>( MINLAY, aRectFnSet.GetWidth(getFrameArea()) ) ); SwTwips nTmp = aRectFnSet.GetWidth(getFrameArea()) - aRectFnSet.GetWidth(aPrt); if( aRectFnSet.GetLeft(aPrt) > nTmp ) diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index efb776eaaef4..7ab121525bae 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -39,7 +39,7 @@ SwColumnFrame::SwColumnFrame( SwFrameFormat *pFormat, SwFrame* pSib ): mnFrameType = SwFrameType::Column; SwBodyFrame* pColBody = new SwBodyFrame( pFormat->GetDoc()->GetDfltFrameFormat(), pSib ); pColBody->InsertBehind( this, nullptr ); // ColumnFrames now with BodyFrame - SetMaxFootnoteHeight( LONG_MAX ); + SetMaxFootnoteHeight( SAL_MAX_INT32 ); } void SwColumnFrame::DestroyImpl() @@ -132,7 +132,7 @@ static bool lcl_AddColumns( SwLayoutFrame *pCont, sal_uInt16 nCount ) bool bRet; SwTwips nMax = pCont->IsPageBodyFrame() ? - pCont->FindPageFrame()->GetMaxFootnoteHeight() : LONG_MAX; + pCont->FindPageFrame()->GetMaxFootnoteHeight() : SAL_MAX_INT32; if ( pNeighbourCol ) { bRet = false; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 75a064fa6e55..8427c9920a66 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1427,7 +1427,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, // former consideration if ( pOwn->IsTextFrame() ) { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nAdd = std::max<sal_Int32>( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); } nUpper += nAdd; } @@ -1453,7 +1453,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max<sal_Int32>( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); } } nUpper += nAdd; @@ -1469,7 +1469,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, { // former consideration if ( pOwn->IsTextFrame() ) - nUpper = std::max( nUpper, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nUpper = std::max<sal_Int32>( nUpper, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); if ( nPrevLineSpacing != 0 ) { nUpper = std::max( nUpper, nPrevLineSpacing ); @@ -1499,7 +1499,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max<sal_Int32>( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); } } nUpper += nAdd; diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index cfdcec89b779..fb3a33f105c4 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1054,7 +1054,7 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos ) SwFrameFormat *pFormat = GetFormat(); const bool bVert = GetAnchorFrame()->IsVertical(); const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y(); - SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY; + SwTwips nTmpY = nNewY == SAL_MAX_INT32 ? 0 : nNewY; if( bVert ) nTmpY = -nTmpY; SfxItemSet aSet( pFormat->GetDoc()->GetAttrPool(), @@ -1079,7 +1079,7 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos ) { if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() ) { - if( LONG_MAX != nNewY ) + if( SAL_MAX_INT32 != nNewY ) { aVert.SetVertOrient( text::VertOrientation::NONE ); sal_Int32 nOfs = @@ -1113,7 +1113,7 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos ) if ( !IsFlyInContentFrame() ) { const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X(); - SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX; + SwTwips nTmpX = nNewX == SAL_MAX_INT32 ? 0 : nNewX; SwFormatHoriOrient aHori( pFormat->GetHoriOrient() ); // #i34948# - handle also at-page and at-fly anchored // Writer fly frames @@ -1134,7 +1134,7 @@ void SwFlyFrame::ChgRelPos( const Point &rNewPos ) aHori.SetHoriOrient( text::HoriOrientation::NONE ); if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() ) { - if( LONG_MAX != nNewX ) + if( SAL_MAX_INT32 != nNewX ) { if( !pAutoFrame ) { @@ -1762,8 +1762,8 @@ SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) if ( Lower() && !IsColLocked() && !HasFixSize() ) { SwTwips nSize = aRectFnSet.GetHeight(getFrameArea()); - if( nSize > 0 && nDist > ( LONG_MAX - nSize ) ) - nDist = LONG_MAX - nSize; + if( nSize > 0 && nDist > ( SAL_MAX_INT32 - nSize ) ) + nDist = SAL_MAX_INT32 - nSize; if ( nDist <= 0 ) return 0; @@ -2335,7 +2335,7 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize &rSz ) const const SwFrame *pRel = IsFlyLayFrame() ? GetAnchorFrame() : GetAnchorFrame()->GetUpper(); if( pRel ) // LAYER_IMPL { - long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX; + sal_Int32 nRelWidth = SAL_MAX_INT32, nRelHeight = SAL_MAX_INT32; const SwViewShell *pSh = getRootFrame()->GetCurrShell(); if ( ( pRel->IsBodyFrame() || pRel->IsPageFrame() ) && pSh && pSh->GetViewOptions()->getBrowseMode() && diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 71cdcc029235..2b11e5cab57d 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -599,7 +599,7 @@ static const SwFrame * lcl_CalcDownDist( SwDistance &rRet, { // <rPt> point is above environment of given content frame // correct for vertical layout? - rRet.nMain = LONG_MAX; + rRet.nMain = SAL_MAX_INT32; } else if( rPt.X() < pUp->getFrameArea().Left() && rPt.Y() <= ( bVert ? pUp->getFrameArea().Top() : pUp->getFrameArea().Bottom() ) ) @@ -625,7 +625,7 @@ static const SwFrame * lcl_CalcDownDist( SwDistance &rRet, return pCnt; } else - rRet.nMain = LONG_MAX; + rRet.nMain = SAL_MAX_INT32; } else { @@ -844,7 +844,7 @@ static const SwFrame * lcl_CalcDownDist( SwDistance &rRet, return pLay; } else - rRet.nMain = LONG_MAX; + rRet.nMain = SAL_MAX_INT32; } } return nullptr; @@ -876,10 +876,10 @@ static sal_uInt64 lcl_FindCntDiff( const Point &rPt, const SwLayoutFrame *pLay, { //Calculate the distance between those two points. //'delta' X^2 + 'delta' Y^2 = 'distance'^2 - sal_uInt64 dX = std::max( pCnt->getFrameArea().Left(), rPt.X() ) - - std::min( pCnt->getFrameArea().Left(), rPt.X() ), - dY = std::max( pCnt->getFrameArea().Top(), rPt.Y() ) - - std::min( pCnt->getFrameArea().Top(), rPt.Y() ); + sal_uInt64 dX = std::max<sal_Int32>( pCnt->getFrameArea().Left(), rPt.X() ) - + std::min<sal_Int32>( pCnt->getFrameArea().Left(), rPt.X() ), + dY = std::max<sal_Int32>( pCnt->getFrameArea().Top(), rPt.Y() ) - + std::min<sal_Int32>( pCnt->getFrameArea().Top(), rPt.Y() ); // square of the difference will do fine here const sal_uInt64 nDiff = (dX * dX) + (dY * dY); if ( pCnt->getFrameArea().Top() <= rPt.Y() ) @@ -1098,8 +1098,8 @@ const SwContentFrame *FindAnchor( const SwFrame *pOldAnch, const Point &rNew, } } if ( !pUpFrame ) - nUp.nMain = LONG_MAX; - if ( nUp.nMain >= 0 && LONG_MAX != nUp.nMain ) + nUp.nMain = SAL_MAX_INT32; + if ( nUp.nMain >= 0 && SAL_MAX_INT32 != nUp.nMain ) { bNegAllowed = false; if ( nUpLst.nMain < 0 ) //don't take the wrong one, if the value @@ -1114,7 +1114,7 @@ const SwContentFrame *FindAnchor( const SwFrame *pOldAnch, const Point &rNew, const SwContentFrame *pDownFrame = pCnt; SwDistance nDownLst; if ( nDown.nMain < 0 ) - nDown.nMain = LONG_MAX; + nDown.nMain = SAL_MAX_INT32; do { pDownLst = pDownFrame; nDownLst = nDown; @@ -1126,31 +1126,31 @@ const SwContentFrame *FindAnchor( const SwFrame *pOldAnch, const Point &rNew, { ::lcl_CalcDownDist( nDown, aNew, pDownFrame ); if ( nDown.nMain < 0 ) - nDown.nMain = LONG_MAX; + nDown.nMain = SAL_MAX_INT32; //It makes sense to search further, if the distance grows inside //a table. if ( pDownLst->IsInTab() && pDownFrame->IsInTab() ) { - while ( pDownFrame && ( ( nDown.nMain != LONG_MAX && pDownFrame->IsInTab()) || bBody != pDownFrame->IsInDocBody() ) ) + while ( pDownFrame && ( ( nDown.nMain != SAL_MAX_INT32 && pDownFrame->IsInTab()) || bBody != pDownFrame->IsInDocBody() ) ) { pDownFrame = pDownFrame->GetNextContentFrame(); if ( pDownFrame ) ::lcl_CalcDownDist( nDown, aNew, pDownFrame ); if ( nDown.nMain < 0 ) - nDown.nMain = LONG_MAX; + nDown.nMain = SAL_MAX_INT32; } } } if ( !pDownFrame ) - nDown.nMain = LONG_MAX; + nDown.nMain = SAL_MAX_INT32; } while ( pDownFrame && nDown <= nDownLst && - nDown.nMain != LONG_MAX && nDownLst.nMain != LONG_MAX ); + nDown.nMain != SAL_MAX_INT32 && nDownLst.nMain != SAL_MAX_INT32 ); //If we couldn't find one in both directions, we'll search the Content whose //left upper corner is the nearest to the point. Such a situation may //happen, if the point doesn't lay in the text flow but in any margin. - if ( nDownLst.nMain == LONG_MAX && nUpLst.nMain == LONG_MAX ) + if ( nDownLst.nMain == SAL_MAX_INT32 && nUpLst.nMain == SAL_MAX_INT32 ) { // If an OLE objects, which is contained in a fly frame // is resized in inplace mode and the new Position is outside the @@ -1274,7 +1274,7 @@ void SwFlyAtContentFrame::SetAbsPos( const Point &rNew ) nX = pCnt->getFrameArea().Left() - pOriginal->getFrameArea().Left(); } - if ( nY == LONG_MAX ) + if ( nY == SAL_MAX_INT32 ) { // #i70582# const SwTwips nTopForObjPos = lcl_GetTopForObjPos(pCnt, bVert, bVertL2R); @@ -1343,9 +1343,9 @@ void SwFlyAtContentFrame::SetAbsPos( const Point &rNew ) } ResetLastCharRectHeight(); if( text::RelOrientation::CHAR == pFormat->GetVertOrient().GetRelationOrient() ) - nY = LONG_MAX; + nY = SAL_MAX_INT32; if( text::RelOrientation::CHAR == pFormat->GetHoriOrient().GetRelationOrient() ) - nX = LONG_MAX; + nX = SAL_MAX_INT32; } else { diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 2a20c9c70e9d..b1c67634618b 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -485,10 +485,10 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz ) ::CalcClipRect( pObj, aTmpStretch, false ); aClip.Intersection_( aTmpStretch ); - const long nBot = getFrameArea().Top() + getFrameArea().Height(); - const long nRig = getFrameArea().Left() + getFrameArea().Width(); - const long nClipBot = aClip.Top() + aClip.Height(); - const long nClipRig = aClip.Left() + aClip.Width(); + const sal_Int32 nBot = getFrameArea().Top() + getFrameArea().Height(); + const sal_Int32 nRig = getFrameArea().Left() + getFrameArea().Width(); + const sal_Int32 nClipBot = aClip.Top() + aClip.Height(); + const sal_Int32 nClipRig = aClip.Left() + aClip.Width(); const bool bBot = nBot > nClipBot; const bool bRig = nRig > nClipRig; @@ -660,7 +660,7 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz ) { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); aFrm.Height( aFrameRect.Height() ); - aFrm.Width ( std::max( long(MINLAY), aFrameRect.Width() ) ); + aFrm.Width ( std::max<sal_Int32>( MINLAY, aFrameRect.Width() ) ); } if ( Lower() && Lower()->IsColumnFrame() ) diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 0df9ee9c5900..ab4bd72e3b04 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3160,7 +3160,7 @@ SwTwips CalcRowRstHeight( SwLayoutFrame *pRow ) { return 0; } - SwTwips nRstHeight = LONG_MAX; + SwTwips nRstHeight = RECT_MAX; while (pLow && pLow->IsLayoutFrame()) { nRstHeight = std::min(nRstHeight, ::lcl_CalcCellRstHeight(static_cast<SwLayoutFrame*>(pLow))); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index e8eddce278c1..5a0a5a942665 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -216,7 +216,7 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const bGrow = false; } if( bGrow ) - Grow( LONG_MAX ); + Grow( SAL_MAX_INT32 ); else { // VarSize is determined based on the content plus the borders @@ -261,7 +261,7 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea()); if( nPrtHeight < 0 ) { - const SwTwips nTmpDiff = std::max( aRectFnSet.GetTop(getFramePrintArea()), -nPrtHeight ); + const SwTwips nTmpDiff = std::max<sal_Int32>( aRectFnSet.GetTop(getFramePrintArea()), -nPrtHeight ); SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aRectFnSet.SubTop( aPrt, nTmpDiff ); } @@ -275,14 +275,14 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) { // No check if FixSize since FootnoteContainer are variable up to their max. height. - // If the max. height is LONG_MAX, take as much space as needed. + // If the max. height is SAL_MAX_INT32, take as much space as needed. // If the page is a special footnote page, take also as much as possible. assert(GetUpper() && GetUpper()->IsFootnoteBossFrame()); SwRectFnSet aRectFnSet(this); if( aRectFnSet.GetHeight(getFrameArea()) > 0 && - nDist > ( LONG_MAX - aRectFnSet.GetHeight(getFrameArea()) ) ) - nDist = LONG_MAX - aRectFnSet.GetHeight(getFrameArea()); + nDist > ( SAL_MAX_INT32 - aRectFnSet.GetHeight(getFrameArea()) ) ) + nDist = SAL_MAX_INT32 - aRectFnSet.GetHeight(getFrameArea()); SwFootnoteBossFrame *pBoss = static_cast<SwFootnoteBossFrame*>(GetUpper()); if( IsInSct() ) @@ -303,9 +303,9 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) SwPageFrame *pPage = pBoss->FindPageFrame(); if ( bBrowseMode || !pPage->IsFootnotePage() ) { - if ( pBoss->GetMaxFootnoteHeight() != LONG_MAX ) + if ( pBoss->GetMaxFootnoteHeight() != SAL_MAX_INT32 ) { - nDist = std::min( nDist, pBoss->GetMaxFootnoteHeight() + nDist = std::min<sal_Int32>( nDist, pBoss->GetMaxFootnoteHeight() - aRectFnSet.GetHeight(getFrameArea()) ); if ( nDist <= 0 ) return 0; @@ -2414,13 +2414,13 @@ void SwFootnoteBossFrame::SetFootnoteDeadLine( const SwTwips nDeadLine ) const SwViewShell *pSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr; if( pSh && pSh->GetViewOptions()->getBrowseMode() ) - m_nMaxFootnoteHeight += pBody->Grow( LONG_MAX, true ); + m_nMaxFootnoteHeight += pBody->Grow( SAL_MAX_INT32, true ); if ( IsInSct() ) - m_nMaxFootnoteHeight += FindSctFrame()->Grow( LONG_MAX, true ); + m_nMaxFootnoteHeight += FindSctFrame()->Grow( SAL_MAX_INT32, true ); if ( m_nMaxFootnoteHeight < 0 ) m_nMaxFootnoteHeight = 0; - if ( nMax != LONG_MAX && m_nMaxFootnoteHeight > nMax ) + if ( nMax != SAL_MAX_INT32 && m_nMaxFootnoteHeight > nMax ) m_nMaxFootnoteHeight = nMax; } diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index c2d2a46718c6..b3443ed68450 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -237,7 +237,7 @@ void SwHeadFootFrame::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs) ColLock(); - SwTwips nMaxHeight = LONG_MAX; + SwTwips nMaxHeight = SAL_MAX_INT32; SwTwips nRemaining, nOldHeight; // #i64301# // use the position of the footer printing area to control invalidation @@ -428,7 +428,7 @@ void SwHeadFootFrame::Format(vcl::RenderContext* pRenderContext, const SwBorderA { lcl_LayoutFrameEnsureMinHeight(*this); - long nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); + SwTwips nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); if ( !isFramePrintAreaValid() ) FormatPrt(nUL, pAttrs); diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 1bab86af7333..efe1a065c2e4 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -49,13 +49,13 @@ bool SwRootFrame::s_isNoVirDev = false; SwCache *SwFrame::mpCache = nullptr; -long FirstMinusSecond( long nFirst, long nSecond ) +sal_Int32 FirstMinusSecond( sal_Int32 nFirst, sal_Int32 nSecond ) { return nFirst - nSecond; } -long SecondMinusFirst( long nFirst, long nSecond ) +sal_Int32 SecondMinusFirst( sal_Int32 nFirst, sal_Int32 nSecond ) { return nSecond - nFirst; } -long SwIncrement( long nA, long nAdd ) +sal_Int32 SwIncrement( sal_Int32 nA, sal_Int32 nAdd ) { return nA + nAdd; } -long SwDecrement( long nA, long nSub ) +sal_Int32 SwDecrement( sal_Int32 nA, sal_Int32 nSub ) { return nA - nSub; } static SwRectFnCollection aHorizontal = { @@ -107,7 +107,7 @@ static SwRectFnCollection aHorizontal = { /*.fnXDiff =*/&FirstMinusSecond, /*.fnYDiff =*/&FirstMinusSecond, /*.fnXInc =*/&SwIncrement, - /*.fnYInc =*/&o3tl::saturating_add<long>, + /*.fnYInc =*/&o3tl::saturating_add<sal_Int32>, /*.fnSetLeftAndWidth =*/&SwRect::SetLeftAndWidth, /*.fnSetTopAndHeight =*/&SwRect::SetTopAndHeight diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 238f44cc1afb..d787389b1934 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -184,7 +184,7 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg else m_bHasGrid = false; SetMaxFootnoteHeight( pPgDsc->GetFootnoteInfo().GetHeight() ? - pPgDsc->GetFootnoteInfo().GetHeight() : LONG_MAX ); + pPgDsc->GetFootnoteInfo().GetHeight() : SAL_MAX_INT32 ); mnFrameType = SwFrameType::Page; m_bInvalidLayout = m_bInvalidContent = m_bInvalidSpelling = m_bInvalidSmartTags = m_bInvalidAutoCmplWrds = m_bInvalidWordCount = true; m_bInvalidFlyLayout = m_bInvalidFlyContent = m_bInvalidFlyInCnt = m_bFootnotePage = m_bEndNotePage = false; @@ -551,7 +551,7 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) static_cast<SwRootFrame*>(GetUpper())->SetSuperfluous(); SetMaxFootnoteHeight(m_pDesc->GetFootnoteInfo().GetHeight()); if(!GetMaxFootnoteHeight()) - SetMaxFootnoteHeight(LONG_MAX); + SetMaxFootnoteHeight(SAL_MAX_INT32); SetColMaxFootnoteHeight(); // here, the page might be destroyed: static_cast<SwRootFrame*>(GetUpper())->RemoveFootnotes(nullptr, false, true); @@ -648,8 +648,8 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this); - aFrm.Height( std::max( rSz.GetHeight(), long(MINLAY) ) ); - aFrm.Width ( std::max( rSz.GetWidth(), long(MINLAY) ) ); + aFrm.Height( std::max<sal_Int32>( rSz.GetHeight(), MINLAY ) ); + aFrm.Width ( std::max<sal_Int32>( rSz.GetWidth(), MINLAY ) ); } if ( GetUpper() ) @@ -1018,7 +1018,7 @@ void SwFrame::CheckPageDescs( SwPageFrame *pStart, bool bNotifyFields, SwPageFra // For the update of page numbering fields, nDocPos provides // the page position from where invalidation should start. - SwTwips nDocPos = LONG_MAX; + SwTwips nDocPos = SAL_MAX_INT32; SwRootFrame *pRoot = static_cast<SwRootFrame*>(pStart->GetUpper()); SwDoc* pDoc = pStart->GetFormat()->GetDoc(); @@ -1052,7 +1052,7 @@ void SwFrame::CheckPageDescs( SwPageFrame *pStart, bool bNotifyFields, SwPageFra pImp->CheckWaitCursor(); // invalidate the field, starting from here - if ( nDocPos == LONG_MAX ) + if ( nDocPos == SAL_MAX_INT32 ) nDocPos = pPrevPage ? pPrevPage->getFrameArea().Top() : pPage->getFrameArea().Top(); // Cases: @@ -1422,7 +1422,7 @@ void SwRootFrame::RemoveSuperfluous() mbCheckSuperfluous = false; SwPageFrame *pPage = GetLastPage(); - long nDocPos = LONG_MAX; + long nDocPos = SAL_MAX_INT32; // Check the corresponding last page if it is empty and stop loop at the last non-empty page. do @@ -1488,7 +1488,7 @@ void SwRootFrame::RemoveSuperfluous() } while ( pPage ); SwViewShell *pSh = getRootFrame()->GetCurrShell(); - if ( nDocPos != LONG_MAX && + if ( nDocPos != SAL_MAX_INT32 && (!pSh || !pSh->Imp()->IsUpdateExpFields()) ) { SwDocPosUpdate aMsgHint( nDocPos ); @@ -2291,7 +2291,7 @@ void SwRootFrame::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* p const bool bLastColumn = pPageToAdjust->GetNext() == pEndOfRow; const bool bLastRow = !pEndOfRow; - nMinPageLeft = std::min( nMinPageLeft, aNewPagePos.getX() ); + nMinPageLeft = std::min<sal_Int32>( nMinPageLeft, aNewPagePos.getX() ); nMaxPageRight = std::max( nMaxPageRight, aNewPagePos.getX() + nCurrentPageWidth); // border of nGapBetweenPages around the current page: diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f8baf5e1903e..1e1cb34a0a54 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5322,7 +5322,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co { nY -= nGrid; SwTwips nPosY = std::max( aInter.Left(), nY ); - SwTwips nHeight = std::min(nRight, aTmp.Pos().X())-nPosY; + SwTwips nHeight = std::min<sal_Int32>(nRight, aTmp.Pos().X())-nPosY; if( nHeight > 0 ) { if( bCell ) @@ -5355,7 +5355,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co if( bBorder ) { SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nW = std::min<sal_Int32>(nRight, aTmp.Pos().X()) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -5413,7 +5413,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co if( bBorder ) { SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nW = std::min<sal_Int32>(nRight, aTmp.Pos().X()) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -5452,7 +5452,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co if( bGrid ) { nY += nGrid; - SwTwips nPosY = std::max( aInter.Top(), aTmp.Pos().getY() ); + SwTwips nPosY = std::max<sal_Int32>( aInter.Top(), aTmp.Pos().getY() ); SwTwips nHeight = std::min(nBottom, nY ) - nPosY; if( nHeight ) { @@ -5485,7 +5485,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY += nRuby; if( bBorder ) { - SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().getY()); + SwTwips nPos = std::max<sal_Int32>(aInter.Top(),aTmp.Pos().getY()); SwTwips nH = std::min( nBottom, nY ) - nPos; SwRect aVert( Point( aGrid.Left(), nPos ), Size( 1, nH ) ); @@ -5542,7 +5542,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY += nRuby; if( bBorder ) { - SwTwips nPos = std::max(aInter.Top(),aTmp.Pos().Y()); + SwTwips nPos = std::max<sal_Int32>(aInter.Top(),aTmp.Pos().Y()); SwTwips nH = std::min( nBottom, nY ) - nPos; SwRect aVert( Point( aGrid.Left(), nPos ), Size( 1, nH ) ); @@ -6432,8 +6432,8 @@ static void lcl_RefreshLine( const SwLayoutFrame *pLay, const bool bHori = rP1.Y() == rP2.Y(); // use pointers to member function in order to unify flow - typedef long (Point:: *pmfPtGet)() const; - typedef void (Point:: *pmfPtSet)(long); + typedef sal_Int32 (Point:: *pmfPtGet)() const; + typedef void (Point:: *pmfPtSet)(sal_Int32); const pmfPtGet pDirPtX = &Point::X; const pmfPtGet pDirPtY = &Point::Y; const pmfPtGet pDirPt = bHori ? pDirPtX : pDirPtY; diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 8f68adf082c7..d338431054bf 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -782,7 +782,7 @@ void SwSectionFrame::MakeAll(vcl::RenderContext* pRenderContext) bCanContainSplitSection = CanContainSplitSection(GetUpper()); if( pSh && (pSh->GetViewOptions()->getBrowseMode() || bCanContainSplitSection) && - ( Grow( LONG_MAX, true ) > 0 ) ) + ( Grow( SAL_MAX_INT32, true ) > 0 ) ) { while( GetFollow() ) { @@ -2103,7 +2103,7 @@ bool SwSectionFrame::Growable() const aRectFnSet.GetBottom(getFrameArea()) ) > 0 ) return true; - return ( GetUpper() && const_cast<SwFrame*>(static_cast<SwFrame const *>(GetUpper()))->Grow( LONG_MAX, true ) ); + return ( GetUpper() && const_cast<SwFrame*>(static_cast<SwFrame const *>(GetUpper()))->Grow( SAL_MAX_INT32, true ) ); } SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst ) @@ -2112,8 +2112,8 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst ) { SwRectFnSet aRectFnSet(this); long nFrameHeight = aRectFnSet.GetHeight(getFrameArea()); - if( nFrameHeight > 0 && nDist > (LONG_MAX - nFrameHeight) ) - nDist = LONG_MAX - nFrameHeight; + if( nFrameHeight > 0 && nDist > (SAL_MAX_INT32 - nFrameHeight) ) + nDist = SAL_MAX_INT32 - nFrameHeight; if ( nDist <= 0 ) return 0; @@ -2140,7 +2140,7 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst ) SwTwips nSpace = nGrow; if( !bInCalcContent && nGrow < nDist && GetUpper() ) nGrow = o3tl::saturating_add( - nGrow, GetUpper()->Grow( LONG_MAX, true )); + nGrow, GetUpper()->Grow( SAL_MAX_INT32, true )); if( nGrow > nDist ) nGrow = nDist; diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 8fceca4e8bd9..5242c953c828 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -33,24 +33,24 @@ #include <hints.hxx> // No inline cause we need the function pointers -long SwFrame::GetTopMargin() const +sal_Int32 SwFrame::GetTopMargin() const { return getFramePrintArea().Top(); } -long SwFrame::GetBottomMargin() const +sal_Int32 SwFrame::GetBottomMargin() const { return getFrameArea().Height() -getFramePrintArea().Height() -getFramePrintArea().Top(); } -long SwFrame::GetLeftMargin() const +sal_Int32 SwFrame::GetLeftMargin() const { return getFramePrintArea().Left(); } -long SwFrame::GetRightMargin() const +sal_Int32 SwFrame::GetRightMargin() const { return getFrameArea().Width() - getFramePrintArea().Width() - getFramePrintArea().Left(); } -long SwFrame::GetPrtLeft() const +sal_Int32 SwFrame::GetPrtLeft() const { return getFrameArea().Left() + getFramePrintArea().Left(); } -long SwFrame::GetPrtBottom() const +sal_Int32 SwFrame::GetPrtBottom() const { return getFrameArea().Top() + getFramePrintArea().Height() + getFramePrintArea().Top(); } -long SwFrame::GetPrtRight() const +sal_Int32 SwFrame::GetPrtRight() const { return getFrameArea().Left() + getFramePrintArea().Width() + getFramePrintArea().Left(); } -long SwFrame::GetPrtTop() const +sal_Int32 SwFrame::GetPrtTop() const { return getFrameArea().Top() + getFramePrintArea().Top(); } -bool SwFrame::SetMinLeft( long nDeadline ) +bool SwFrame::SetMinLeft( sal_Int32 nDeadline ) { SwTwips nDiff = nDeadline - getFrameArea().Left(); if( nDiff > 0 ) @@ -66,7 +66,7 @@ bool SwFrame::SetMinLeft( long nDeadline ) return false; } -bool SwFrame::SetMaxBottom( long nDeadline ) +bool SwFrame::SetMaxBottom( sal_Int32 nDeadline ) { SwTwips nDiff = getFrameArea().Top() + getFrameArea().Height() - nDeadline; if( nDiff > 0 ) @@ -82,7 +82,7 @@ bool SwFrame::SetMaxBottom( long nDeadline ) return false; } -bool SwFrame::SetMaxRight( long nDeadline ) +bool SwFrame::SetMaxRight( sal_Int32 nDeadline ) { SwTwips nDiff = getFrameArea().Left() + getFrameArea().Width() - nDeadline; if( nDiff > 0 ) @@ -162,21 +162,21 @@ void SwFrame::MakeRightPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotif } } -void SwFrame::SetTopBottomMargins( long nTop, long nBot ) +void SwFrame::SetTopBottomMargins( sal_Int32 nTop, sal_Int32 nBot ) { SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aPrt.Top( nTop ); aPrt.Height( getFrameArea().Height() - nTop - nBot ); } -void SwFrame::SetLeftRightMargins( long nLeft, long nRight) +void SwFrame::SetLeftRightMargins( sal_Int32 nLeft, sal_Int32 nRight) { SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aPrt.Left( nLeft ); aPrt.Width( getFrameArea().Width() - nLeft - nRight ); } -void SwFrame::SetRightLeftMargins( long nRight, long nLeft) +void SwFrame::SetRightLeftMargins( sal_Int32 nRight, sal_Int32 nLeft) { SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aPrt.Left( nLeft ); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 67ee9cc37a18..39e730d73e2d 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -515,7 +515,7 @@ static void lcl_PreprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine, // Check if we can move pTmpLastLineRow to the follow table, // or if we have to split the line: bool bTableLayoutTooComplex = false; - long nMinHeight = 0; + sal_Int32 nMinHeight = 0; // We have to take into account: // 1. The fixed height of the row @@ -611,7 +611,7 @@ static void lcl_PostprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine lcl_MoveRowContent( *pFollowRow, *pRowFrame ); pFollowRow->Cut(); SwFrame::DestroyFrame(pFollowRow); - ::SwInvalidateAll( pCurrMasterCell, LONG_MAX ); + ::SwInvalidateAll( pCurrMasterCell, SAL_MAX_INT32 ); } } @@ -655,7 +655,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, rTab.SetConsiderObjsForMinCellHeight( true ); // invalidate last line - ::SwInvalidateAll( &rLastLine, LONG_MAX ); + ::SwInvalidateAll( &rLastLine, SAL_MAX_INT32 ); // Shrink the table to account for the shrunk last row, as well as lower rows // that had been moved to follow table in SwTabFrame::Split. @@ -681,7 +681,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, rLastLine.SetInSplit(); // Do the recalculation - lcl_RecalcRow( &rLastLine, LONG_MAX ); + lcl_RecalcRow( &rLastLine, SAL_MAX_INT32 ); // #115759# - force a format of the last line in order to // get the correct height. rLastLine.InvalidateSize(); @@ -754,14 +754,14 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, { // Everything looks fine. Splitting seems to be successful. We invalidate // rFollowLine to force a new formatting. - ::SwInvalidateAll( &rFollowLine, LONG_MAX ); + ::SwInvalidateAll( &rFollowLine, SAL_MAX_INT32 ); } else { // Splitting the table row gave us an unexpected result. // Everything has to be prepared for a second try to split // the table, this time without splitting the row. - ::SwInvalidateAll( &rLastLine, LONG_MAX ); + ::SwInvalidateAll( &rLastLine, SAL_MAX_INT32 ); } rTab.SetRebuildLastLine( false ); @@ -972,7 +972,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK Lower()->InvalidatePos_(); // #i43913# - correction // call method <lcl_InnerCalcLayout> with first lower. - lcl_InnerCalcLayout( Lower(), LONG_MAX, true ); + lcl_InnerCalcLayout( Lower(), SAL_MAX_INT32, true ); } //In order to be able to compare the positions of the cells with CutPos, @@ -1337,8 +1337,8 @@ bool SwTabFrame::Join() void SwInvalidatePositions( SwFrame *pFrame, long nBottom ) { - // LONG_MAX == nBottom means we have to calculate all - bool bAll = LONG_MAX == nBottom; + // SAL_MAX_INT32 == nBottom means we have to calculate all + bool bAll = SAL_MAX_INT32 == nBottom; SwRectFnSet aRectFnSet(pFrame); do { pFrame->InvalidatePos_(); @@ -1362,8 +1362,8 @@ void SwInvalidatePositions( SwFrame *pFrame, long nBottom ) void SwInvalidateAll( SwFrame *pFrame, long nBottom ) { - // LONG_MAX == nBottom means we have to calculate all - bool bAll = LONG_MAX == nBottom; + // SAL_MAX_INT32 == nBottom means we have to calculate all + bool bAll = SAL_MAX_INT32 == nBottom; SwRectFnSet aRectFnSet(pFrame); do { @@ -1426,8 +1426,8 @@ bool SwContentFrame::CalcLowers( SwLayoutFrame* pLay, const SwLayoutFrame* pDont return true; vcl::RenderContext* pRenderContext = pLay->getRootFrame()->GetCurrShell()->GetOut(); - // LONG_MAX == nBottom means we have to calculate all - bool bAll = LONG_MAX == nBottom; + // SAL_MAX_INT32 == nBottom means we have to calculate all + bool bAll = SAL_MAX_INT32 == nBottom; bool bRet = false; SwContentFrame *pCnt = pLay->ContainsContent(); SwRectFnSet aRectFnSet(pLay); @@ -1516,8 +1516,8 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame, bool _bOnlyRowsAndCells ) { vcl::RenderContext* pRenderContext = pFrame->getRootFrame()->GetCurrShell() ? pFrame->getRootFrame()->GetCurrShell()->GetOut() : nullptr; - // LONG_MAX == nBottom means we have to calculate all - bool bAll = LONG_MAX == nBottom; + // SAL_MAX_INT32 == nBottom means we have to calculate all + bool bAll = SAL_MAX_INT32 == nBottom; bool bRet = false; const SwFrame* pOldUp = pFrame->GetUpper(); SwRectFnSet aRectFnSet(pFrame); @@ -1673,8 +1673,8 @@ static void lcl_RecalcTable( SwTabFrame& rTab, pFirstRow = static_cast<SwLayoutFrame*>(rTab.Lower()); rNotify.SetLowersComplete( true ); } - ::SwInvalidatePositions( pFirstRow, LONG_MAX ); - lcl_RecalcRow( static_cast<SwRowFrame*>(pFirstRow), LONG_MAX ); + ::SwInvalidatePositions( pFirstRow, SAL_MAX_INT32 ); + lcl_RecalcRow( static_cast<SwRowFrame*>(pFirstRow), SAL_MAX_INT32 ); } } @@ -2124,7 +2124,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) SwFrame *pTmp = GetUpper(); SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*pTmp); if ( bBrowseMode ) - nDeadLine += pTmp->Grow( LONG_MAX, true ); + nDeadLine += pTmp->Grow( SAL_MAX_INT32, true ); bool bFits = aRectFnSet.BottomDist(getFrameArea(), nDeadLine) > 0; if (!bFits && aRectFnSet.GetHeight(GetFollow()->getFrameArea()) == 0) // The follow should move backwards, so allow the case @@ -2141,9 +2141,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // invalidate and rebuild last row if ( pLastLine ) { - ::SwInvalidateAll( pLastLine, LONG_MAX ); + ::SwInvalidateAll( pLastLine, SAL_MAX_INT32 ); SetRebuildLastLine( true ); - lcl_RecalcRow( static_cast<SwRowFrame*>(pLastLine), LONG_MAX ); + lcl_RecalcRow( static_cast<SwRowFrame*>(pLastLine), SAL_MAX_INT32 ); SetRebuildLastLine( false ); } @@ -2266,7 +2266,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } else if (m_bONECalcLowers) { - lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX ); + lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), SAL_MAX_INT32 ); m_bONECalcLowers = false; } } @@ -2289,7 +2289,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } else if (m_bONECalcLowers) { - lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX ); + lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), SAL_MAX_INT32 ); m_bONECalcLowers = false; } @@ -2351,7 +2351,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper()); if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE) nDeadLine = aRectFnSet.YInc( nDeadLine, - GetUpper()->Grow( LONG_MAX, true ) ); + GetUpper()->Grow( SAL_MAX_INT32, true ) ); { SetInRecalcLowerRow( true ); @@ -2459,7 +2459,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // to nDeadLine may not be enough. if ( bSplitError && bTryToSplit ) // no restart if we did not try to split: i72847, i79426 { - lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX ); + lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), SAL_MAX_INT32 ); setFrameAreaPositionValid(false); bTryToSplit = false; continue; @@ -2641,8 +2641,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) /// Calculate the offsets arising because of FlyFrames bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, - long& rLeftOffset, - long& rRightOffset ) const + sal_Int32& rLeftOffset, + sal_Int32& rRightOffset ) const { bool bInvalidatePrtArea = false; const SwPageFrame *pPage = FindPageFrame(); @@ -2747,7 +2747,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, css::text::WrapTextMode_PARALLEL == rSur.GetSurround())&& text::HoriOrientation::LEFT == rHori.GetHoriOrient() ) { - const long nWidth = aRectFnSet.XDiff( + const sal_Int32 nWidth = aRectFnSet.XDiff( aRectFnSet.GetRight(aFlyRect), aRectFnSet.GetLeft(pFly->GetAnchorFrame()->getFrameArea()) ); rLeftOffset = std::max( rLeftOffset, nWidth ); @@ -2757,7 +2757,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, css::text::WrapTextMode_PARALLEL == rSur.GetSurround())&& text::HoriOrientation::RIGHT == rHori.GetHoriOrient() ) { - const long nWidth = aRectFnSet.XDiff( + const sal_Int32 nWidth = aRectFnSet.XDiff( aRectFnSet.GetRight(pFly->GetAnchorFrame()->getFrameArea()), aRectFnSet.GetLeft(aFlyRect) ); rRightOffset = std::max( rRightOffset, nWidth ); @@ -2781,7 +2781,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA SwRectFnSet aRectFnSet(this); if ( !isFrameAreaSizeValid() ) { - long nDiff = aRectFnSet.GetWidth(GetUpper()->getFramePrintArea()) - + sal_Int32 nDiff = aRectFnSet.GetWidth(GetUpper()->getFramePrintArea()) - aRectFnSet.GetWidth(getFrameArea()); if( nDiff ) { @@ -2800,14 +2800,14 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA //1. There are borders with SurroundNone, dodge them completely //2. There are borders which only float on the right or the left side and // are right or left aligned, those set the minimum for the borders. - long nTmpRight = -1000000, + sal_Int32 nTmpRight = -1000000, nLeftOffset = 0; if( CalcFlyOffsets( nUpper, nLeftOffset, nTmpRight ) ) { setFramePrintAreaValid(false); } - long nRightOffset = std::max( 0L, nTmpRight ); + sal_Int32 nRightOffset = std::max<sal_Int32>( 0, nTmpRight ); SwTwips nLower = pAttrs->CalcBottomLine(); // #i29550# @@ -2874,7 +2874,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA nRightSpacing = nRightLine + ( ( (nWishRight+nLeftOffset) < 0 ) ? (nWishRight+nLeftOffset) : - std::max( 0L, nWishRight ) ); + std::max<sal_Int32>( 0, nWishRight ) ); } } break; @@ -2905,7 +2905,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA nLeftSpacing = nLeftLine + ( ( (nWishLeft+nRightOffset) < 0 ) ? (nWishLeft+nRightOffset) : - std::max( 0L, nWishLeft ) ); + std::max<sal_Int32>( 0, nWishLeft ) ); } } break; @@ -3006,7 +3006,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA //Don't overlap the edge of the visible area. //The page width can be bigger because objects with //"over-size" are possible (RootFrame::ImplCalcBrowseWidth()) - long nWidth = pSh->GetBrowseWidth(); + sal_Int32 nWidth = pSh->GetBrowseWidth(); nWidth -= getFramePrintArea().Left(); nWidth -= pAttrs->CalcRightLine(); @@ -3047,8 +3047,8 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { SwRectFnSet aRectFnSet(this); SwTwips nHeight = aRectFnSet.GetHeight(getFrameArea()); - if( nHeight > 0 && nDist > ( LONG_MAX - nHeight ) ) - nDist = LONG_MAX - nHeight; + if( nHeight > 0 && nDist > ( SAL_MAX_INT32 - nHeight ) ) + nDist = SAL_MAX_INT32 - nHeight; if ( bTst && !IsRestrictTableGrowth() ) return nDist; @@ -3069,7 +3069,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( nReal < nDist ) { - long nTmp = GetUpper()->Grow( nDist - std::max<long>(nReal, 0), bTst, bInfo ); + sal_Int32 nTmp = GetUpper()->Grow( nDist - std::max<long>(nReal, 0), bTst, bInfo ); if ( IsRestrictTableGrowth() ) { @@ -3435,7 +3435,7 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool &rReformat const SwViewShell *pSh = getRootFrame()->GetCurrShell(); if( pSh && pSh->GetViewOptions()->getBrowseMode() ) - nSpace += pNewUpper->Grow( LONG_MAX, true ); + nSpace += pNewUpper->Grow( SAL_MAX_INT32, true ); } } else if (!m_bLockBackMove) @@ -3749,7 +3749,7 @@ void SwRowFrame::MakeAll(vcl::RenderContext* pRenderContext) long CalcHeightWithFlys( const SwFrame *pFrame ) { SwRectFnSet aRectFnSet(pFrame); - long nHeight = 0; + sal_Int32 nHeight = 0; const SwFrame* pTmp = pFrame->IsSctFrame() ? static_cast<const SwSectionFrame*>(pFrame)->ContainsContent() : pFrame; while( pTmp ) @@ -4504,8 +4504,8 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) const SwFormatFrameSize &rSz = pMod->GetFrameSize(); SwTwips nMinHeight = 0; if (rSz.GetHeightSizeType() == ATT_MIN_SIZE) - nMinHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*this), - 0L); + nMinHeight = std::max<sal_Int32>(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*this), + 0); // Only necessary to calculate minimal row height if height // of pRow is at least nMinHeight. Otherwise nMinHeight is the @@ -5380,7 +5380,7 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine ) // In this case we have to return the maximum of the heights // of the first lines in rSourceLine. bool bIsInFollowFlowLine = rSourceLine.IsInFollowFlowRow(); - SwTwips nHeight = bIsInFollowFlowLine ? LONG_MAX : 0; + SwTwips nHeight = bIsInFollowFlowLine ? SAL_MAX_INT32 : 0; while ( pCurrSourceCell ) { @@ -5507,7 +5507,7 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine ) pCurrSourceCell = static_cast<const SwCellFrame*>(pCurrSourceCell->GetNext()); } - return ( LONG_MAX == nHeight ) ? 0 : nHeight; + return ( SAL_MAX_INT32 == nHeight ) ? 0 : nHeight; } /// Function to calculate height of first text row @@ -5618,8 +5618,8 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const SwTwips nMinRowHeight = 0; if (rSz.GetHeightSizeType() == ATT_MIN_SIZE) { - nMinRowHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*pFirstRow), - 0L); + nMinRowHeight = std::max<sal_Int32>(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*pFirstRow), + 0); } nTmpHeight += std::max( nHeightOfFirstContentLine, nMinRowHeight ); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index f322cc9d9cc6..b191afc0c709 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -178,10 +178,10 @@ bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint, // check, if we have to adjust the point if ( !getFrameArea().IsInside( aPoint ) ) { - aPoint.setX( std::max( aPoint.X(), getFrameArea().Left() ) ); - aPoint.setX( std::min( aPoint.X(), getFrameArea().Right() ) ); - aPoint.setY( std::max( aPoint.Y(), getFrameArea().Top() ) ); - aPoint.setY( std::min( aPoint.Y(), getFrameArea().Bottom() ) ); + aPoint.setX( std::max<sal_Int32>( aPoint.X(), getFrameArea().Left() ) ); + aPoint.setX( std::min<sal_Int32>( aPoint.X(), getFrameArea().Right() ) ); + aPoint.setY( std::max<sal_Int32>( aPoint.Y(), getFrameArea().Top() ) ); + aPoint.setY( std::min<sal_Int32>( aPoint.Y(), getFrameArea().Bottom() ) ); } bool bTextRet = false; diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 1107da6c4e94..a6e0a538055f 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1436,8 +1436,8 @@ SwTwips SwFrame::Grow( SwTwips nDist, bool bTst, bool bInfo ) SwRectFnSet aRectFnSet(this); SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea()); - if( nPrtHeight > 0 && nDist > (LONG_MAX - nPrtHeight) ) - nDist = LONG_MAX - nPrtHeight; + if( nPrtHeight > 0 && nDist > (SAL_MAX_INT32 - nPrtHeight) ) + nDist = SAL_MAX_INT32 - nPrtHeight; if ( IsFlyFrame() ) return static_cast<SwFlyFrame*>(this)->Grow_( nDist, bTst ); @@ -1554,7 +1554,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) { SwViewShell *pViewShell = getRootFrame()->GetCurrShell(); SwLayoutFrame *pUp = GetUpper(); - long nChg; + sal_Int32 nChg; const long nUpPrtBottom = pUp->getFrameArea().Height() - pUp->getFramePrintArea().Height() - pUp->getFramePrintArea().Top(); SwRect aInva( pUp->getFrameArea() ); @@ -1580,7 +1580,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) { { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pBody); - aFrm.Height(std::max( 0L, aFrm.Height() - nChg )); + aFrm.Height(std::max<sal_Int32>( 0, aFrm.Height() - nChg )); } pBody->InvalidatePrt_(); @@ -2029,8 +2029,8 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea()); if( nFrameHeight > 0 && - nDist > (LONG_MAX - nFrameHeight ) ) - nDist = LONG_MAX - nFrameHeight; + nDist > (SAL_MAX_INT32 - nFrameHeight ) ) + nDist = SAL_MAX_INT32 - nFrameHeight; const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); @@ -2161,7 +2161,7 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) if( nRstHeight < 0 ) { SwTwips nNextHeight = 0; - if( GetUpper()->IsSctFrame() && nDist > LONG_MAX/2 ) + if( GetUpper()->IsSctFrame() && nDist > SAL_MAX_INT32/2 ) { SwFrame *pNxt = GetNext(); while( pNxt ) @@ -2552,8 +2552,8 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) const SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea()); const SwTwips nFramePos = getFrameArea().Pos().X(); - if ( nFrameHeight > 0 && nDist > (LONG_MAX - nFrameHeight) ) - nDist = LONG_MAX - nFrameHeight; + if ( nFrameHeight > 0 && nDist > (SAL_MAX_INT32 - nFrameHeight) ) + nDist = SAL_MAX_INT32 - nFrameHeight; SwTwips nMin = 0; if ( GetUpper() && !IsCellFrame() ) @@ -2747,7 +2747,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) { if( !Lower()->IsNeighbourFrame() ) { const SwFrame *pFrame = Lower(); - const long nTmp = aRectFnSet.GetHeight(getFramePrintArea()); + const sal_Int32 nTmp = aRectFnSet.GetHeight(getFramePrintArea()); while( pFrame && nMin < nTmp ) { nMin += aRectFnSet.GetHeight(pFrame->getFrameArea()); pFrame = pFrame->GetNext(); @@ -3507,7 +3507,7 @@ long SwLayoutFrame::CalcRel( const SwFormatFrameSize &rSz ) const if ( nPercent ) { const SwFrame *pRel = GetUpper(); - long nRel = LONG_MAX; + sal_Int32 nRel = SAL_MAX_INT32; const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); if( pRel->IsPageBodyFrame() && pSh && bBrowseMode && pSh->VisArea().Width() ) @@ -3612,7 +3612,7 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, // nMinimum starts with the passed minimum height and is then remembered // as the maximum height on which column content still juts out of a // column. - // nMaximum starts with LONG_MAX and is then remembered as the minimum + // nMaximum starts with SAL_MAX_INT32 and is then remembered as the minimum // width on which the content fitted. // In column based sections nMaximum starts at the maximum value which // the surrounding defines, this can certainly be a value on which @@ -3643,7 +3643,7 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, { nMaximum = aRectFnSet.GetHeight(getFrameArea()) - nBorder + aRectFnSet.BottomDist(getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper())); - nMaximum += GetUpper()->Grow( LONG_MAX, true ); + nMaximum += GetUpper()->Grow( SAL_MAX_INT32, true ); if( nMaximum < nMinimum ) { if( nMaximum < 0 ) @@ -3687,7 +3687,7 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, } } else - nMaximum = LONG_MAX; + nMaximum = SAL_MAX_INT32; // #i3317# - reset temporarily consideration // of wrapping style influence @@ -3746,7 +3746,7 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, // OD 28.03.2003 #108446# - initialize local variable SwTwips nDiff = 0; SwTwips nMaxFree = 0; - SwTwips nAllFree = LONG_MAX; + SwTwips nAllFree = SAL_MAX_INT32; // set bFoundLower if there is at least one non-empty column bool bFoundLower = false; while( pCol ) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 2d2dd975ed65..50ba4487b4b8 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -530,11 +530,11 @@ struct SwFillData nLineWidth( 0 ), bFirstLine( true ), bInner( false ), bColumn( false ), bEmpty( true ){} SwFillMode Mode() const { return pCMS->m_pFill->eMode; } - long X() const { return rPoint.X(); } - long Y() const { return rPoint.Y(); } - long Left() const { return aFrame.Left(); } - long Right() const { return aFrame.Right(); } - long Bottom() const { return aFrame.Bottom(); } + sal_Int32 X() const { return rPoint.X(); } + sal_Int32 Y() const { return rPoint.Y(); } + sal_Int32 Left() const { return aFrame.Left(); } + sal_Int32 Right() const { return aFrame.Right(); } + sal_Int32 Bottom() const { return aFrame.Bottom(); } SwFillCursorPos &Fill() const { return *pCMS->m_pFill; } void SetTab( sal_uInt16 nNew ) { pCMS->m_pFill->nTabCnt = nNew; } void SetSpace( sal_uInt16 nNew ) { pCMS->m_pFill->nSpaceCnt = nNew; } @@ -1403,7 +1403,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const nFirst = nFirst - nDist; else nFirst = 0; - nDist = std::max( nDist, GetLineSpace() ); + nDist = std::max<sal_Int32>( nDist, GetLineSpace() ); nDist += nLineHeight; nDiff -= nFirst; diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index b6203899aee0..84f13c4ce4d0 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -231,11 +231,11 @@ bool SwTextFrame::CalcFollow( const sal_Int32 nTextOfst ) } // The footnote area must not get larger - SwSaveFootnoteHeight aSave( FindFootnoteBossFrame( true ), LONG_MAX ); + SwSaveFootnoteHeight aSave( FindFootnoteBossFrame( true ), SAL_MAX_INT32 ); pMyFollow->CalcFootnoteFlag(); if ( !pMyFollow->GetNext() && !pMyFollow->HasFootnote() ) - nOldBottom = aRectFnSet.IsVert() ? 0 : LONG_MAX; + nOldBottom = aRectFnSet.IsVert() ? 0 : SAL_MAX_INT32; while( true ) { diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index e90ad9126a13..4abf0cb7a153 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -183,7 +183,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p // 5. paragraph border // Note: These values have already been used during calculation // of the printing area of the paragraph. - const int nLMWithNum = pNode->GetLeftMarginWithNum( true ); + const sal_Int32 nLMWithNum = pNode->GetLeftMarginWithNum( true ); if ( m_pFrame->IsRightToLeft() ) { // this calculation is identical this the calculation for L2R layout - see below @@ -219,7 +219,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p else { nLeft = m_pFrame->getFrameArea().Left() + - std::max( long( rSpace.GetTextLeft() + nLMWithNum ), + std::max<sal_Int32>( rSpace.GetTextLeft() + nLMWithNum, m_pFrame->getFramePrintArea().Left() ); } } @@ -243,7 +243,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p else { short nFLOfst = 0; - long nFirstLineOfs = 0; + sal_Int32 nFirstLineOfs = 0; if( !pNode->GetFirstLineOfsWithNum( nFLOfst ) && rSpace.IsAutoFirst() ) { @@ -312,7 +312,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p else { nFirst = m_pFrame->getFrameArea().Left() + - std::max( rSpace.GetTextLeft() + nLMWithNum+ nFirstLineOfs, + std::max<sal_Int32>( rSpace.GetTextLeft() + nLMWithNum+ nFirstLineOfs, m_pFrame->getFramePrintArea().Left() ); } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 7fc2ae4005df..bc3e03924115 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1969,7 +1969,7 @@ void SwTextFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "SwTextFormatter::CalcUnclipped with unswapped frame" ); - long nFlyAsc, nFlyDesc; + sal_Int32 nFlyAsc, nFlyDesc; m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc ); rTop = Y() + GetCurr()->GetAscent(); rBottom = rTop + nFlyDesc; @@ -1996,7 +1996,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, aTmpInf.SetIdx( nStartIdx ); aTmpInf.SetPos( aStart ); - long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + sal_Int32 nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc ); const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight(); @@ -2115,7 +2115,7 @@ void SwTextFormatter::AlignFlyInCntBase( long nBaseLine ) const nFlags |= AsCharFlags::Reverse; } - long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + sal_Int32 nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; while( pPos ) { @@ -2456,7 +2456,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, // aBase.X() = Offset in the line after the current position // aBase.Y() = LineIter.Y() + Ascent of the current position - long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + sal_Int32 nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; // i#11859 - use new method <SwLineLayout::MaxAscentDescent(..)> // to change line spacing behaviour at paragraph - Compatibility to MS Word //SwLinePortion *pPos = pCurr->GetFirstPortion(); @@ -2705,7 +2705,7 @@ namespace { rThis.GetCharRect( &aRect, nReformat ); txtFormatInfo.SetMulti( bOldMulti ); - return nFormatRepaint ? std::min( aRect.Left(), nFormatRepaint ) : + return nFormatRepaint ? std::min<sal_Int32>( aRect.Left(), nFormatRepaint ) : aRect.Left(); } else diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index d15a398ffa43..7e352a3d7cde 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -950,8 +950,8 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList() pAnchoredObj->GetFrameFormat().GetVertOrient(); if( text::VertOrientation::BOTTOM != rTmpFormat.GetVertOrient() ) nMinBottom = ( aRectFnSet.IsVert() && nMinBottom ) ? - std::min( nMinBottom, aBound.Left() ) : - std::max( nMinBottom, aRectFnSet.GetBottom(aBound) ); + std::min<sal_Int32>( nMinBottom, aBound.Left() ) : + std::max<sal_Int32>( nMinBottom, aRectFnSet.GetBottom(aBound) ); } bOn = true; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index c1e953725fc8..51dd1dc41561 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1900,7 +1900,7 @@ SwTestFormat::SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPre, SwTwip { SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*pFrame); - aRectFnSet.SetHeight( aPrt, std::max( 0L , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) ); + aRectFnSet.SetHeight( aPrt, std::max<sal_Int32>( 0 , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) ); aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(pFrame->getFrameArea()) - ( rAttrs.CalcLeft( pFrame ) + rAttrs.CalcRight( pFrame ) ) ); } @@ -2002,7 +2002,7 @@ bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst ) // force a MoveFwd if( IsWidow() || ( aRectFnSet.IsVert() ? ( 0 == getFrameArea().Left() ) : - ( LONG_MAX - 20000 < getFrameArea().Bottom() ) ) ) + ( SAL_MAX_INT32 - 20000 < getFrameArea().Bottom() ) ) ) { SetWidow(false); if ( GetFollow() ) @@ -2011,7 +2011,7 @@ bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst ) // whether there's a Follow with a real height at all. // Else (e.g. for newly created SctFrames) we ignore the IsWidow() and // still check if we can find enough room - if( ( ( ! aRectFnSet.IsVert() && LONG_MAX - 20000 >= getFrameArea().Bottom() ) || + if( ( ( ! aRectFnSet.IsVert() && SAL_MAX_INT32 - 20000 >= getFrameArea().Bottom() ) || ( aRectFnSet.IsVert() && 0 < getFrameArea().Left() ) ) && ( GetFollow()->IsVertical() ? !GetFollow()->getFrameArea().Width() : diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index e44642494175..a204caf9bd82 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -221,7 +221,7 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* pFrame, SwTwips nLower ) // the deadline should consider their lower borders. const SwFrame* pStartFrame = pFrame->GetUpper()->GetLower(); OSL_ENSURE( pStartFrame, "Upper has no lower" ); - SwTwips nFlyLower = aRectFnSet.IsVert() ? LONG_MAX : 0; + SwTwips nFlyLower = aRectFnSet.IsVert() ? SAL_MAX_INT32 : 0; while ( pStartFrame != pFrame ) { OSL_ENSURE( pStartFrame, "Frame chain is broken" ); @@ -342,10 +342,10 @@ SwTwips SwTextFrame::GetFootnoteFrameHeight_() const if ( !pRef->IsInFootnoteConnect() ) { SwSaveFootnoteHeight aSave( const_cast<SwFootnoteBossFrame*>(pBoss), nHeight ); - nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( LONG_MAX, true ); + nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( SAL_MAX_INT32, true ); } else - nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( LONG_MAX, true ); + nHeight = const_cast<SwFootnoteContFrame*>(static_cast<const SwFootnoteContFrame*>(pCont))->Grow( SAL_MAX_INT32, true ); nHeight += nTmp; if( nHeight < 0 ) diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index 6ffc9324853e..c8906a8f425a 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -153,7 +153,7 @@ bool SwTextFrameBreak::IsInside( SwTextMargin const &rLine ) const // The LineHeight exceeds the current Frame height. // Call a test Grow to detect if the Frame could // grow the requested area. - nHeight += m_pFrame->GrowTst( LONG_MAX ); + nHeight += m_pFrame->GrowTst( SAL_MAX_INT32 ); // The Grow() returns the height by which the Upper of the TextFrame // would let the TextFrame grow. diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 484f52405dd3..e76d52b834ab 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -378,10 +378,10 @@ void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) const { // output the Frame xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", getFrameArea().Left() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", getFrameArea().Top() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", getFrameArea().Width() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", getFrameArea().Height() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%" SAL_PRIdINT32, getFrameArea().Left() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%" SAL_PRIdINT32, getFrameArea().Top() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%" SAL_PRIdINT32, getFrameArea().Width() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%" SAL_PRIdINT32, getFrameArea().Height() ); xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFixSize"), BAD_CAST(OString::boolean(HasFixSize()).getStr())); xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidPos"), BAD_CAST(OString::boolean(isFrameAreaPositionValid()).getStr())); xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidSize"), BAD_CAST(OString::boolean(isFrameAreaSizeValid()).getStr())); @@ -390,10 +390,10 @@ void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) const // output the Prt xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", getFramePrintArea().Left() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", getFramePrintArea().Top() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", getFramePrintArea().Width() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", getFramePrintArea().Height() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%" SAL_PRIdINT32, getFramePrintArea().Left() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%" SAL_PRIdINT32, getFramePrintArea().Top() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%" SAL_PRIdINT32, getFramePrintArea().Width() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%" SAL_PRIdINT32, getFramePrintArea().Height() ); xmlTextWriterEndElement( writer ); } @@ -457,10 +457,10 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this ); xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", GetObjBoundRect().Left() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", GetObjBoundRect().Top() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", GetObjBoundRect().Width() ); - xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", GetObjBoundRect().Height() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%" SAL_PRIdINT32, GetObjBoundRect().Left() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%" SAL_PRIdINT32, GetObjBoundRect().Top() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%" SAL_PRIdINT32, GetObjBoundRect().Width() ); + xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%" SAL_PRIdINT32, GetObjBoundRect().Height() ); xmlTextWriterEndElement( writer ); if (const SdrObject* pObject = GetDrawObj()) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index dcbdf4a79d76..eb16c5c28a8f 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -2551,8 +2551,8 @@ uno::Sequence<beans::PropertyState> SwXStyle::getPropertyStates(const uno::Seque const SvxSizeItem& rSize = rSet.Get(SID_ATTR_PAGE_SIZE); sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f; - if((LONG_MAX == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId)) || - (LONG_MAX == rSize.GetSize().Height() && MID_SIZE_HEIGHT == nMemberId)) + if((SAL_MAX_INT32 == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId)) || + (SAL_MAX_INT32 == rSize.GetSize().Height() && MID_SIZE_HEIGHT == nMemberId)) { pStates[i] = beans::PropertyState_DEFAULT_VALUE; } diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index f7fdcc0efae4..d4702d186b60 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -514,13 +514,13 @@ void SwPagePreviewLayout::CalcDocPreviewPaintRect() Size aSize; if ( mbDoesLayoutColsFitIntoWindow ) - aSize.setWidth( std::min( mnPreviewLayoutWidth, + aSize.setWidth( std::min<sal_Int32>( mnPreviewLayoutWidth, maPreviewDocRect.GetWidth() - aTopLeftPos.X() ) ); else aSize.setWidth( std::min( maPreviewDocRect.GetWidth() - aTopLeftPos.X(), maWinSize.Width() - maAdditionalPaintOffset.X() ) ); if ( mbDoesLayoutRowsFitIntoWindow ) - aSize.setHeight( std::min( mnPreviewLayoutHeight, + aSize.setHeight( std::min<sal_Int32>( mnPreviewLayoutHeight, maPreviewDocRect.GetHeight() - aTopLeftPos.Y() ) ); else aSize.setHeight( std::min( maPreviewDocRect.GetHeight() - aTopLeftPos.Y(), @@ -774,7 +774,7 @@ Point SwPagePreviewLayout::GetPreviewStartPosForNewScale( // check, if new y-position is outside document preview if ( aNewPaintStartPos.Y() > maPreviewDocRect.Bottom() ) aNewPaintStartPos.setY( - std::max( 0L, maPreviewDocRect.Bottom() - mnPreviewLayoutHeight ) ); + std::max<sal_Int32>( 0, maPreviewDocRect.Bottom() - mnPreviewLayoutHeight ) ); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 7c536e86117f..5fa122a19c04 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -348,9 +348,9 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) aTmp1 = GetOut()->LogicToPixel( aTmp1 ); tools::Rectangle aTmp2( GetOut()->PixelToLogic( aTmp1 ) ); if ( aTmp2.Left() > aRect.Left() ) - aTmp1.SetLeft( std::max( 0L, aTmp1.Left() - 1 ) ); + aTmp1.SetLeft( std::max<sal_Int32>( 0, aTmp1.Left() - 1 ) ); if ( aTmp2.Top() > aRect.Top() ) - aTmp1.SetTop( std::max( 0L, aTmp1.Top() - 1 ) ); + aTmp1.SetTop( std::max<sal_Int32>( 0, aTmp1.Top() - 1 ) ); aTmp1.AdjustRight(1 ); aTmp1.AdjustBottom(1 ); aTmp1 = GetOut()->PixelToLogic( aTmp1 ); @@ -1224,7 +1224,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const tools::Rectangle // #i98766# - disable smooth scrolling for Mac const sal_uLong nBitCnt = mpOut->GetBitCount(); - long lMult = 1, lMax = LONG_MAX; + long lMult = 1, lMax = SAL_MAX_INT32; if ( nBitCnt == 16 ) { lMax = 7000; @@ -1271,14 +1271,14 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const tools::Rectangle aRect.Height( aSize.Height() ); if ( pRect ) { - aRect.Pos().setX( std::max(aRect.Left(),pRect->Left()-aPixSz.Width()) ); - aRect.Right( std::min(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width())); + aRect.Pos().setX( std::max<sal_Int32>(aRect.Left(),pRect->Left()-aPixSz.Width()) ); + aRect.Right( std::min<sal_Int32>(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width())); } else aRect.SSize().AdjustWidth(2*aPixSz.Width() ); aRect.Pos().setY( lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height() : aRect.Top() - aSize.Height() + aPixSz.Height() ); - aRect.Pos().setX( std::max( 0L, aRect.Left()-aPixSz.Width() ) ); + aRect.Pos().setX( std::max<sal_Int32>( 0, aRect.Left()-aPixSz.Width() ) ); aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos())); aRect.SSize()= GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize())); maVisArea = aRect; @@ -2230,7 +2230,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) if( bBrowseModeChanged || bHideWhitespaceModeChanged ) { // #i44963# Good occasion to check if page sizes in - // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import) + // page descriptions are still set to (SAL_MAX_INT32, SAL_MAX_INT32) (html import) mxDoc->CheckDefaultPageFormat(); InvalidateLayout( true ); } diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 4c74acecdd09..a9c589963b7c 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -93,7 +93,7 @@ void SwViewShell::Init( const SwViewOption *pNewOpt ) InitPrt( pPDFOut ); // i#44963 Good occasion to check if page sizes in - // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import) + // page descriptions are still set to (SAL_MAX_INT32, SAL_MAX_INT32) (html import) if ( !bBrowseMode ) { mxDoc->CheckDefaultPageFormat(); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 3e98da244e51..b95215fb50ee 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -825,8 +825,8 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa //const SwPageDesc& rPgDsc = *pOutDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD ); const SwFormatFrameSize& rSz = rPgDsc.GetMaster().GetFrameSize(); // Clipboard-Document is always created w/o printer; thus the - // default PageDesc is always aug LONG_MAX !! Set then to DIN A4 - if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() ) + // default PageDesc is always aug SAL_MAX_INT32 !! Set then to DIN A4 + if( SAL_MAX_INT32 == rSz.GetHeight() || SAL_MAX_INT32 == rSz.GetWidth() ) { SwPageDesc aNew( rPgDsc ); SwFormatFrameSize aNewSz( rSz ); diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index b3125aff5e75..e5d538ccfddd 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -412,7 +412,7 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, long nVal, long nLongVal = 0; bool bOutLongVal = true; - if( nVal > LONG_MAX / nMul ) + if( nVal > SAL_MAX_INT32 / nMul ) { sal_Int64 nBigVal( nVal ); nBigVal *= nMul; @@ -420,7 +420,7 @@ static void AddUnitPropertyValue(OStringBuffer &rOut, long nVal, nBigVal += 5; nBigVal /= 10; - if( nBigVal <= LONG_MAX ) + if( nBigVal <= SAL_MAX_INT32 ) { // a long is sufficient nLongVal = static_cast<long>(nBigVal); diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx index efebccefa116..f1473961a1e3 100644 --- a/sw/source/filter/html/htmldrawwriter.cxx +++ b/sw/source/filter/html/htmldrawwriter.cxx @@ -244,13 +244,13 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt, if( aPixelSz.Width() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width). - append("=\"").append(static_cast<sal_Int32>(aPixelSz.Width())).append("\""); + append("=\"").append(aPixelSz.Width()).append("\""); } if( aPixelSz.Height() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height). - append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\""); + append("=\"").append(aPixelSz.Height()).append("\""); } } diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 3d349bc1ddb0..545efee3062c 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -635,13 +635,13 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, if( aPixelSpc.Width() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace). - append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Width())).append("\""); + append("=\"").append(aPixelSpc.Width()).append("\""); } if( aPixelSpc.Height() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace). - append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Height())).append("\""); + append("=\"").append(aPixelSpc.Height()).append("\""); } } @@ -714,7 +714,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, if( nPrcWidth ) sOut.append(static_cast<sal_Int32>(nPrcWidth)).append('%'); else - sOut.append(static_cast<sal_Int32>(aPixelSz.Width())); + sOut.append(aPixelSz.Width()); sOut.append("\""); } @@ -726,7 +726,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, if( nPrcHeight ) sOut.append(static_cast<sal_Int32>(nPrcHeight)).append('%'); else - sOut.append(static_cast<sal_Int32>(aPixelSz.Height())); + sOut.append(aPixelSz.Height()); sOut.append("\""); } } @@ -902,12 +902,12 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma if (aPixelSpc.Width()) { - aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_hspace, static_cast<sal_Int32>(aPixelSpc.Width())); + aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_hspace, aPixelSpc.Width()); } if (aPixelSpc.Height()) { - aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_vspace, static_cast<sal_Int32>(aPixelSpc.Height())); + aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_vspace, aPixelSpc.Height()); } } @@ -979,7 +979,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma if (nPrcWidth) sWidth = OString::number(static_cast<sal_Int32>(nPrcWidth)) + "%"; else - sWidth = OString::number(static_cast<sal_Int32>(aPixelSz.Width())); + sWidth = OString::number(aPixelSz.Width()); aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_width, sWidth); } @@ -990,7 +990,7 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma if (nPrcHeight) sHeight = OString::number(static_cast<sal_Int32>(nPrcHeight)) + "%"; else - sHeight = OString::number(static_cast<sal_Int32>(aPixelSz.Height())); + sHeight = OString::number(aPixelSz.Height()); aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_height, sHeight); } } diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index cb49ab3ebd3a..e6752e0c2dd9 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -789,7 +789,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( aSz.Height() ) { sOptions += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" + - OString::number(static_cast<sal_Int32>(aSz.Height())) + "\""; + OString::number(aSz.Height()) + "\""; } auto aTmp2 = xPropSet->getPropertyValue( "MultiSelection" ); @@ -827,12 +827,12 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( aSz.Height() ) { sOptions += " " OOO_STRING_SVTOOLS_HTML_O_rows "=\"" + - OString::number(static_cast<sal_Int32>(aSz.Height())) + "\""; + OString::number(aSz.Height()) + "\""; } if( aSz.Width() ) { sOptions += " " OOO_STRING_SVTOOLS_HTML_O_cols "=\"" + - OString::number(static_cast<sal_Int32>(aSz.Width())) + "\""; + OString::number(aSz.Width()) + "\""; } aTmp = xPropSet->getPropertyValue( "HScroll" ); @@ -866,7 +866,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( aSz.Width() ) { sOptions += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" + - OString::number(static_cast<sal_Int32>(aSz.Width())) + "\""; + OString::number(aSz.Width()) + "\""; } aTmp = xPropSet->getPropertyValue( "MaxTextLen" ); @@ -903,7 +903,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( aSz.Width() ) { sOptions += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" + - OString::number(static_cast<sal_Int32>(aSz.Width())) + "\""; + OString::number(aSz.Width()) + "\""; } // VALUE vim form: don't export because of security reasons @@ -996,13 +996,13 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( aPixelSz.Width() ) { sOut += " " OOO_STRING_SVTOOLS_HTML_O_width "=\"" + - OString::number(static_cast<sal_Int32>(aPixelSz.Width())) + "\""; + OString::number(aPixelSz.Width()) + "\""; } if( aPixelSz.Height() ) { sOut += " " OOO_STRING_SVTOOLS_HTML_O_height "=\"" + - OString::number(static_cast<sal_Int32>(aPixelSz.Height())) + "\""; + OString::number(aPixelSz.Height()) + "\""; } } diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 296b68a3b901..7fe37f6e70f5 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1021,10 +1021,10 @@ void SwHTMLParser::InsertFloatingFrame() uno::makeAny( bHasBorder ) ); xSet->setPropertyValue("FrameMarginWidth", - uno::makeAny( sal_Int32( aMargin.Width() ) ) ); + uno::makeAny( aMargin.Width() ) ); xSet->setPropertyValue("FrameMarginHeight", - uno::makeAny( sal_Int32( aMargin.Height() ) ) ); + uno::makeAny( aMargin.Height() ) ); } } } diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 60a913e1ac7a..1af4cdf178e8 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -368,7 +368,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } else { - sOut.append(static_cast<sal_Int32>(aPixelSz.Width())); + sOut.append(aPixelSz.Width()); } sOut.append("\""); } @@ -376,7 +376,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, if( nHeight ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height) - .append("=\"").append(static_cast<sal_Int32>(aPixelSz.Height())).append("\""); + .append("=\"").append(aPixelSz.Height()).append("\""); } const SfxItemSet& rItemSet = pBox->GetFrameFormat()->GetAttrSet(); @@ -671,13 +671,13 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( aPixelSpc.Width() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace). - append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Width())).append("\""); + append("=\"").append(aPixelSpc.Width()).append("\""); } if( aPixelSpc.Height() ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace). - append("=\"").append(static_cast<sal_Int32>(aPixelSpc.Height())).append("\""); + append("=\"").append(aPixelSpc.Height()).append("\""); } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 63c6c8c53ea5..7be5f2ecc89f 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5030,7 +5030,7 @@ sal_uInt16 SwHTMLParser::ToTwips( sal_uInt16 nPixel ) { long nTwips = Application::GetDefaultDevice()->PixelToLogic( Size( nPixel, nPixel ), MapMode( MapUnit::MapTwip ) ).Width(); - return static_cast<sal_uInt16>(std::min(nTwips, SwTwips(SAL_MAX_UINT16))); + return static_cast<sal_uInt16>(std::min<sal_uInt16>(nTwips, SwTwips(SAL_MAX_UINT16))); } else return nPixel; diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index e1a8503d657d..97a4ee144c72 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -167,7 +167,7 @@ public: void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr ); - virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId, bool bTstEnde=true, long nHand = LONG_MAX, bool consumedByField=false); + virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId, bool bTstEnde=true, long nHand = SAL_MAX_INT32, bool consumedByField=false); void StealAttr(const SwNodeIndex& rNode); void MarkAllAttrsOld(); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index a5bd0bc8f571..feca015b656b 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -601,29 +601,15 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons // the 'Size' type uses 'long' for width and height, so on // platforms where 'long' is 32 bits they can obviously never be // larger than the max signed 32-bit integer. -#if SAL_TYPES_SIZEOFLONG > 4 - if (rSize.Width() > MAX_INTEGER_VALUE) - cx = MAX_INTEGER_VALUE; + if (0 > rSize.Width()) + cx = 0; else -#endif - { - if (0 > rSize.Width()) - cx = 0; - else - cx = rSize.Width(); - } + cx = rSize.Width(); -#if SAL_TYPES_SIZEOFLONG > 4 - if (rSize.Height() > MAX_INTEGER_VALUE) - cy = MAX_INTEGER_VALUE; + if (0 > rSize.Height()) + cy = 0; else -#endif - { - if (0 > rSize.Height()) - cy = 0; - else - cy = rSize.Height(); - } + cy = rSize.Height(); OString aWidth(OString::number(TwipsToEMU(cx))); //we explicitly check the converted EMU value for the range as mentioned in above comment. diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index ff0257873bc4..0508d2b8ec99 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3798,14 +3798,14 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r aRet.append(rCr.GetBottom()); aRet.append(OOO_STRING_SVTOOLS_RTF_PICW); - aRet.append(static_cast<sal_Int32>(rMapped.Width())); + aRet.append(rMapped.Width()); aRet.append(OOO_STRING_SVTOOLS_RTF_PICH); - aRet.append(static_cast<sal_Int32>(rMapped.Height())); + aRet.append(rMapped.Height()); aRet.append(OOO_STRING_SVTOOLS_RTF_PICWGOAL); - aRet.append(static_cast<sal_Int32>(rOrig.Width())); + aRet.append(rOrig.Width()); aRet.append(OOO_STRING_SVTOOLS_RTF_PICHGOAL); - aRet.append(static_cast<sal_Int32>(rOrig.Height())); + aRet.append(rOrig.Height()); aRet.append(pBLIPType); if (bIsWMF) diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index f6dcdf3cecf8..f37e7e8ce415 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -802,8 +802,8 @@ void RtfExport::ExportDocument_Impl() const SwFormatFrameSize& rSz = rFormatPage.GetFrameSize(); // Clipboard document is always created without a printer, then - // the size will be always LONG_MAX! Solution then is to use A4 - if (LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth()) + // the size will be always SAL_MAX_INT32! Solution then is to use A4 + if (SAL_MAX_INT32 == rSz.GetHeight() || SAL_MAX_INT32 == rSz.GetWidth()) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PAPERH); Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4); diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index ab63e083da44..b19bb1402d74 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -530,10 +530,8 @@ void RtfSdrExport::impl_writeGraphic() // Add it to the properties. RtfStringBuffer aBuf; aBuf->append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP); - aBuf->append(OOO_STRING_SVTOOLS_RTF_PICW).append(sal_Int32(aMapped.Width())); - aBuf->append(OOO_STRING_SVTOOLS_RTF_PICH) - .append(sal_Int32(aMapped.Height())) - .append(SAL_NEWLINE_STRING); + aBuf->append(OOO_STRING_SVTOOLS_RTF_PICW).append(aMapped.Width()); + aBuf->append(OOO_STRING_SVTOOLS_RTF_PICH).append(aMapped.Height()).append(SAL_NEWLINE_STRING); aBuf->append(msfilter::rtfutil::WriteHex(pGraphicAry, nSize)); aBuf->append('}'); m_aShapeProps.insert(std::pair<OString, OString>("pib", aBuf.makeStringAndClear())); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 75f74fa61b7d..7406f153a67f 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -565,7 +565,7 @@ sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, return bRet; } -bool RTLDrawingsHack(long &rLeft, +bool RTLDrawingsHack(sal_Int32 &rLeft, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize) { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 1cbbeebf27f6..8bcc97c768ed 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -5028,7 +5028,7 @@ static void ParaTabStopDelAdd( WW8Export& rWrt, else { pTO = nullptr; - nOP = LONG_MAX; + nOP = SAL_MAX_INT32; } const SvxTabStop* pTN; @@ -5046,10 +5046,10 @@ static void ParaTabStopDelAdd( WW8Export& rWrt, else { pTN = nullptr; - nNP = LONG_MAX; + nNP = SAL_MAX_INT32; } - if( nOP == LONG_MAX && nNP == LONG_MAX ) + if( nOP == SAL_MAX_INT32 && nNP == SAL_MAX_INT32 ) break; // everything done if( nOP < nNP ) // next tab is old diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index a7153844ec71..273ee9b48f65 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -383,7 +383,7 @@ public: void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr); - virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId, bool bTstEnde=true, long nHand=LONG_MAX, bool consumedByField=false) override; + virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId, bool bTstEnde=true, long nHand=SAL_MAX_INT32, bool consumedByField=false) override; void SetToggleAttr(sal_uInt8 nId, bool bOn) { diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 64312c378894..a71630fbf03e 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4427,7 +4427,7 @@ eBookStatus WW8PLCFx_Book::GetStatus() const long WW8PLCFx_Book::GetHandle() const { if( !pBook[0] || !pBook[1] ) - return LONG_MAX; + return SAL_MAX_INT32; if( nIsEnd ) return pBook[1]->GetIdx(); @@ -4436,7 +4436,7 @@ long WW8PLCFx_Book::GetHandle() const if (const void* p = pBook[0]->GetData(pBook[0]->GetIdx())) return SVBT16ToShort( *static_cast<SVBT16 const *>(p) ); else - return LONG_MAX; + return SAL_MAX_INT32; } } @@ -4634,7 +4634,7 @@ void WW8PLCFx_AtnBook::advance() long WW8PLCFx_AtnBook::getHandle() const { if (!m_pBook[0] || !m_pBook[1]) - return LONG_MAX; + return SAL_MAX_INT32; if (m_bIsEnd) return m_pBook[1]->GetIdx(); @@ -4643,7 +4643,7 @@ long WW8PLCFx_AtnBook::getHandle() const if (const void* p = m_pBook[0]->GetData(m_pBook[0]->GetIdx())) return SVBT16ToShort(*static_cast<const SVBT16*>(p)); else - return LONG_MAX; + return SAL_MAX_INT32; } } @@ -4766,7 +4766,7 @@ void WW8PLCFx_FactoidBook::advance() long WW8PLCFx_FactoidBook::getHandle() const { if (!m_pBook[0] || !m_pBook[1]) - return LONG_MAX; + return SAL_MAX_INT32; if (m_bIsEnd) return m_pBook[1]->GetIdx(); @@ -4775,7 +4775,7 @@ long WW8PLCFx_FactoidBook::getHandle() const if (const void* p = m_pBook[0]->GetData(m_pBook[0]->GetIdx())) return SVBT16ToShort(*static_cast<const SVBT16*>(p)); else - return LONG_MAX; + return SAL_MAX_INT32; } } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index c9216ed1cbe6..ecd0ccfeb022 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_WW8SCAN_HXX #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8SCAN_HXX -#ifndef LONG_MAX +#ifndef SAL_MAX_INT32 #include <limits.h> #endif #include <algorithm> diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 7ca7c63922cc..29b8486d8f9f 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -134,10 +134,10 @@ static void lcl_addOutplaceProperties( *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(sal_Int32(0)) ); pStates++; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any(static_cast<sal_Int32>(aSize.Width())) ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any(aSize.Width()) ); pStates++; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any(static_cast<sal_Int32>(aSize.Height())) ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any(aSize.Height()) ); } } diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index cf4f328c47b3..a951e0b41887 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -871,10 +871,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra makeAny( true ) ); xSet->setPropertyValue("FrameMarginWidth", - makeAny( sal_Int32( aMargin.Width() ) ) ); + makeAny( aMargin.Width() ) ); xSet->setPropertyValue("FrameMarginHeight", - makeAny( sal_Int32( aMargin.Height() ) ) ); + makeAny( aMargin.Height() ) ); } SwFrameFormat *const pFrameFormat = diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 1bc236dccaa6..c0fb5669a089 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -592,8 +592,8 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableToFromHdl, Button*, pButton, void ) if( !aField.isEmpty() ) { OUString aStr( m_pEdDbText->GetText() ); - sal_Int32 nPos = static_cast<sal_Int32>(m_pEdDbText->GetSelection().Min()); - const sal_Int32 nSel = static_cast<sal_Int32>(m_pEdDbText->GetSelection().Max()) - nPos; + sal_Int32 nPos = m_pEdDbText->GetSelection().Min(); + const sal_Int32 nSel = m_pEdDbText->GetSelection().Max() - nPos; if( nSel ) // first delete the existing selection aStr = aStr.replaceAt( nPos, nSel, "" ); diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 3f8daf71e599..32bb037eae04 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -439,7 +439,7 @@ void SwLabPage::DisplayFormat() SetMetric(*aField.get(), aMetric); aField->SetDecimalDigits(2); aField->SetMin (0); - aField->SetMax (LONG_MAX); + aField->SetMax (SAL_MAX_INT32); SwLabRec* pRec = GetSelectedEntryPos(); aItem.m_aLstType = pRec->m_aType; diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index fe827cf1f560..06f5c4e4fa15 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -70,8 +70,8 @@ SwFieldDokPage::SwFieldDokPage(vcl::Window* pParent, const SfxItemSet *const pCo m_pNumFormatLB->SetDoubleClickHdl(LINK(this, SwFieldDokPage, NumFormatHdl)); m_pLevelED->SetMax(MAXLEVEL); - m_pDateOffsetED->SetMin(LONG_MIN); - m_pDateOffsetED->SetMax(LONG_MAX); + m_pDateOffsetED->SetMin(SAL_MIN_INT32); + m_pDateOffsetED->SetMax(SAL_MAX_INT32); //enable 'active' language selection m_pNumFormatLB->SetShowLanguageControl(true); } diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 269f54d4a17c..7f8a428ef4dc 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1361,12 +1361,12 @@ void SwFramePage::InitPos(RndStdIds eId, if (!bEnable) { m_pAtHorzPosED->SetValue( 0, FUNIT_TWIP ); - if (nX != LONG_MAX && m_bHtmlMode) + if (nX != SAL_MAX_INT32 && m_bHtmlMode) m_pAtHorzPosED->SetModifyFlag(); } else { - if (nX != LONG_MAX) + if (nX != SAL_MAX_INT32) m_pAtHorzPosED->SetValue( m_pAtHorzPosED->Normalize(nX), FUNIT_TWIP ); } m_pAtHorzPosFT->Enable( bEnable ); @@ -1376,19 +1376,19 @@ void SwFramePage::InitPos(RndStdIds eId, if ( !bEnable ) { m_pAtVertPosED->SetValue( 0, FUNIT_TWIP ); - if(nY != LONG_MAX && m_bHtmlMode) + if(nY != SAL_MAX_INT32 && m_bHtmlMode) m_pAtVertPosED->SetModifyFlag(); } else { if ( eId == RndStdIds::FLY_AS_CHAR ) { - if ( nY == LONG_MAX ) + if ( nY == SAL_MAX_INT32 ) nY = 0; else nY *= -1; } - if ( nY != LONG_MAX ) + if ( nY != SAL_MAX_INT32 ) m_pAtVertPosED->SetValue( m_pAtVertPosED->Normalize(nY), FUNIT_TWIP ); } m_pAtVertPosFT->Enable( bEnable && m_bAllowVertPositioning ); @@ -1766,7 +1766,7 @@ DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * _pSet) IMPL_LINK_NOARG(SwFramePage, MirrorHdl, Button*, void) { RndStdIds eId = GetAnchor(); - InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX); + InitPos( eId, -1, 0, -1, 0, SAL_MAX_INT32, SAL_MAX_INT32); } IMPL_LINK( SwFramePage, RelSizeClickHdl, Button *, p, void ) @@ -1891,10 +1891,10 @@ void SwFramePage::RangeModifyHdl() if (aVal.bAutoHeight && (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog")) { - SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max(nHeight, 1L), nMaxHeight); + SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max<sal_Int32>(nHeight, 1), nMaxHeight); m_aWidthED.SetMax(m_aWidthED.NormalizePercent(nTmp), FUNIT_TWIP); - nTmp = std::min(nHeight * nMaxWidth / std::max(nWidth, 1L), nMaxWidth); + nTmp = std::min(nHeight * nMaxWidth / std::max<sal_Int32>(nWidth, 1), nMaxWidth); m_aHeightED.SetMax(m_aWidthED.NormalizePercent(nTmp), FUNIT_TWIP); } else @@ -1936,7 +1936,7 @@ IMPL_LINK_NOARG(SwFramePage, AnchorTypeHdl, Button*, void) RndStdIds eId = GetAnchor(); - InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX); + InitPos( eId, -1, 0, -1, 0, SAL_MAX_INT32, SAL_MAX_INT32); RangeModifyHdl(); if(m_bHtmlMode) @@ -2272,7 +2272,7 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset) RndStdIds eAnchorId = GetAnchor(); if ( m_bNew && !m_bFormat ) - InitPos(eAnchorId, -1, 0, -1, 0, LONG_MAX, LONG_MAX); + InitPos(eAnchorId, -1, 0, -1, 0, SAL_MAX_INT32, SAL_MAX_INT32); else { const SwFormatHoriOrient& rHori = rSet.Get(RES_HORI_ORIENT); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index e3fd606cc073..e3aef8c719e9 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3977,7 +3977,7 @@ Size SwEntryBrowseBox::GetOptimalSize() const long nWidth(std::accumulate(aWidths.begin(), aWidths.end(), 0)); - aSize.setWidth( std::max(aSize.Width(), nWidth) ); + aSize.setWidth( std::max<sal_Int32>(aSize.Width(), nWidth) ); return aSize; } diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 0b7daa49b5d7..f9d6f9a3f88a 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -134,7 +134,7 @@ static void lcl_LeaveDrawText(SwWrtShell& rSh) if(rSh.GetDrawView()) { rSh.GetDrawView()->SdrEndTextEdit( true ); - Point aPt(LONG_MIN, LONG_MIN); + Point aPt(SAL_MIN_INT32, SAL_MIN_INT32); // go out of the frame rSh.SelectObj(aPt, SW_LEAVE_FRAME); rSh.EnterStdMode(); @@ -701,7 +701,7 @@ bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellM else { rView.LeaveDrawCreate(); - Point aPt(LONG_MIN, LONG_MIN); + Point aPt(SAL_MIN_INT32, SAL_MIN_INT32); // go out of the frame rShell.SelectObj(aPt, SW_LEAVE_FRAME); SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index a629f2cc5742..10ebf51b4991 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -368,8 +368,8 @@ void SwPageBreakWin::UpdatePosition( const Point* pEvtPt ) // Place the button on the left or right? ::tools::Rectangle aVisArea = GetEditWin()->LogicToPixel( GetEditWin()->GetView().GetVisArea() ); - long nLineLeft = std::max( nPgLeft, aVisArea.Left() ); - long nLineRight = std::min( nPgRight, aVisArea.Right() ); + long nLineLeft = std::max<sal_Int32>( nPgLeft, aVisArea.Left() ); + long nLineRight = std::min<sal_Int32>( nPgRight, aVisArea.Right() ); long nBtnLeft = nLineLeft; if ( m_pMousePt ) diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 5f0f0bfbd21f..d16cf9d3808b 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1066,10 +1066,10 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb ) pToCharContentPos, bFollowTextFlow, false, &aRefPoint ); } - long nLeft = std::min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() ); - long nRight = std::min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() ); - long nUp = std::min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() ); - long nDown = std::min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() ); + long nLeft = std::min<sal_Int32>( aTmp.Left() - aBoundRect.Left(), aSnap.Width() ); + long nRight = std::min<sal_Int32>( aBoundRect.Right() - aTmp.Right(), aSnap.Width() ); + long nUp = std::min<sal_Int32>( aTmp.Top() - aBoundRect.Top(), aSnap.Height() ); + long nDown = std::min<sal_Int32>( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() ); switch ( nDir ) { diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx index 1debb81ca787..1813fe7e2115 100644 --- a/sw/source/uibase/frmdlg/frmmgr.cxx +++ b/sw/source/uibase/frmdlg/frmmgr.cxx @@ -516,24 +516,24 @@ void SwFlyFrameAttrMgr::DelAttr( sal_uInt16 nId ) void SwFlyFrameAttrMgr::SetLRSpace( long nLeft, long nRight ) { - OSL_ENSURE( LONG_MAX != nLeft && LONG_MAX != nRight, "Which border to set?" ); + OSL_ENSURE( SAL_MAX_INT32 != nLeft && SAL_MAX_INT32 != nRight, "Which border to set?" ); SvxLRSpaceItem aTmp( m_aSet.Get( RES_LR_SPACE ) ); - if( LONG_MAX != nLeft ) + if( SAL_MAX_INT32 != nLeft ) aTmp.SetLeft( sal_uInt16(nLeft) ); - if( LONG_MAX != nRight ) + if( SAL_MAX_INT32 != nRight ) aTmp.SetRight( sal_uInt16(nRight) ); m_aSet.Put( aTmp ); } void SwFlyFrameAttrMgr::SetULSpace( long nTop, long nBottom ) { - OSL_ENSURE(LONG_MAX != nTop && LONG_MAX != nBottom, "Which border to set?" ); + OSL_ENSURE(SAL_MAX_INT32 != nTop && SAL_MAX_INT32 != nBottom, "Which border to set?" ); SvxULSpaceItem aTmp( m_aSet.Get( RES_UL_SPACE ) ); - if( LONG_MAX != nTop ) + if( SAL_MAX_INT32 != nTop ) aTmp.SetUpper( sal_uInt16(nTop) ); - if( LONG_MAX != nBottom ) + if( SAL_MAX_INT32 != nBottom ) aTmp.SetLower( sal_uInt16(nBottom) ); m_aSet.Put( aTmp ); } @@ -591,7 +591,7 @@ void SwFlyFrameAttrMgr::SetRotation(sal_uInt16 nOld, sal_uInt16 nNew, const Size void SwFlyFrameAttrMgr::SetSize( const Size& rSize ) { SwFormatFrameSize aSize( GetFrameSize() ); - aSize.SetSize(Size(std::max(rSize.Width(), long(MINFLY)), std::max(rSize.Height(), long(MINFLY)))); + aSize.SetSize(Size(std::max<sal_Int32>(rSize.Width(), MINFLY), std::max<sal_Int32>(rSize.Height(), MINFLY))); m_aSet.Put( aSize ); } diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 6d1c67493655..d7df870ce44a 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -778,7 +778,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) { SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); SvTreeListEntry* pEntry = bSelect ? m_pTable->FirstSelected() : m_pTable->First(); - sal_uLong nPos = LONG_MAX; + sal_uLong nPos = SAL_MAX_INT32; typedef std::vector<SvTreeListEntry*> ListBoxEntries_t; ListBoxEntries_t aRedlines; @@ -793,7 +793,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) { if( !m_pTable->GetParent( pEntry ) ) { - if( bSelect && LONG_MAX == nPos ) + if( bSelect && SAL_MAX_INT32 == nPos ) nPos = m_pTable->GetModel()->GetAbsPos( pEntry ); RedlinData *pData = static_cast<RedlinData *>(pEntry->GetUserData()); @@ -854,7 +854,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) m_bInhibitActivate = false; Activate(); - if( ULONG_MAX != nPos && m_pTable->GetEntryCount() ) + if( SAL_MAX_UINT32 != nPos && m_pTable->GetEntryCount() ) { if( nPos >= m_pTable->GetEntryCount() ) nPos = m_pTable->GetEntryCount() - 1; diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx index bb5fd3b9a5e9..f3d69e8b99a7 100644 --- a/sw/source/uibase/ribbar/drawbase.cxx +++ b/sw/source/uibase/ribbar/drawbase.cxx @@ -189,7 +189,7 @@ bool SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt) { bool bUnlockView = !m_pSh->IsViewLocked(); m_pSh->LockView( true ); //lock visible section - m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // deselect all + m_pSh->SelectObj(Point(SAL_MAX_INT32, SAL_MAX_INT32)); // deselect all if( bUnlockView ) m_pSh->LockView( false ); } @@ -375,7 +375,7 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) if (aPnt == m_aStartPos) { if (!m_pSh->IsObjSelectable(aPnt)) - m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); + m_pSh->SelectObj(Point(SAL_MAX_INT32, SAL_MAX_INT32)); else if (!bReturn) { if (!rMEvt.IsShift()) diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index c2747c86243e..ce4fa5dd2767 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -294,10 +294,10 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) if ( pMarginItem ) { xSet->setPropertyValue("FrameMarginWidth", - uno::makeAny( sal_Int32( aMargin.Width() ) ) ); + uno::makeAny( aMargin.Width() ) ); xSet->setPropertyValue("FrameMarginHeight", - uno::makeAny( sal_Int32( aMargin.Height() ) ) ); + uno::makeAny( aMargin.Height() ) ); } } catch (const uno::Exception&) diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index 52b49a483e7d..7e3c94d3769e 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -151,7 +151,7 @@ void SwTableFUNC::SetColWidth(sal_uInt16 nNum, SwTwips nNewWidth ) aCols[ GetRightSeparator(nNum-1) ] -= nDiff; } else - aCols.SetRight( std::min( nNewWidth, aCols.GetRightMax()) ); + aCols.SetRight( std::min<sal_Int32>( nNewWidth, aCols.GetRightMax()) ); pSh->StartAllAction(); pSh->SetTabCols( aCols, bCurrentOnly ); diff --git a/sw/source/uibase/uiview/swcli.cxx b/sw/source/uibase/uiview/swcli.cxx index 4d896b52792b..bc9905f82a4f 100644 --- a/sw/source/uibase/uiview/swcli.cxx +++ b/sw/source/uibase/uiview/swcli.cxx @@ -146,7 +146,7 @@ void SwOleClient::ViewChanged() aVisSize.setWidth( long(aVisSize.Width() * GetScaleWidth()) ); aVisSize.setHeight( long(aVisSize.Height() * GetScaleHeight()) ); - SwRect aRect( Point( LONG_MIN, LONG_MIN ), aVisSize ); + SwRect aRect( Point( SAL_MIN_INT32, SAL_MIN_INT32 ), aVisSize ); rSh.LockView( true ); // Prevent scrolling in the EndAction rSh.StartAllAction(); rSh.RequestObjectResize( aRect, GetObject() ); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index eb010a49f94d..99df87c3e8ba 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1250,8 +1250,8 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions(); sal_Int64 nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top(); - sal_Int64 nRight = LONG_MIN; - sal_Int64 nBottom = LONG_MIN; + sal_Int64 nRight = SAL_MIN_INT32; + sal_Int64 nBottom = SAL_MIN_INT32; sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType()); sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom()); bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index c48970cb8e86..26fdb197f3cf 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -816,7 +816,7 @@ void SwView::Execute(SfxRequest &rReq) if(pSdrView) { LeaveDrawCreate(); - Point aPt(LONG_MIN, LONG_MIN); + Point aPt(SAL_MIN_INT32, SAL_MIN_INT32); //go out of the frame m_pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME); SfxBindings& rBind = GetViewFrame()->GetBindings(); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index dba6610de692..c3f672e34561 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -354,12 +354,12 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, if(nDesHeight > nCurHeight) // the height is not sufficient, then nYScroll is no longer of interest { pPt->setY( rRect.Top() ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max<sal_Int32>( lMin, pPt->Y() ) ); } else if ( rRect.Top() < m_aVisArea.Top() ) // Upward shift { pPt->setY( rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll) ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max<sal_Int32>( lMin, pPt->Y() ) ); } else if( rRect.Bottom() > m_aVisArea.Bottom() ) // Downward shift { @@ -379,9 +379,9 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, else if ( rRect.Left() < m_aVisArea.Left() ) // Shift left { pPt->setX( rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll) ); - pPt->setX( std::max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() ) ); - pPt->setX( std::min( rRect.Left() - nScrollX, pPt->X() ) ); - pPt->setX( std::max( 0L, pPt->X() ) ); + pPt->setX( std::max<sal_Int32>( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() ) ); + pPt->setX( std::min<sal_Int32>( rRect.Left() - nScrollX, pPt->X() ) ); + pPt->setX( std::max<sal_Int32>( 0, pPt->X() ) ); } } @@ -462,7 +462,7 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt if( m_bTopCursor ) { const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0; - aPt.setY( std::min( std::max( nBorder, rRect.Top() ), + aPt.setY( std::min<sal_Int32>( std::max<sal_Int32>( nBorder, rRect.Top() ), m_aDocSz.Height() + nBorder - m_aVisArea.GetHeight() ) ); } @@ -479,7 +479,7 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt if( m_bTopCursor ) { const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0; - aPt.setY( std::min( std::max( nBorder, rRect.Top() ), + aPt.setY( std::min<sal_Int32>( std::max<sal_Int32>( nBorder, rRect.Top() ), m_aDocSz.Height() + nBorder - m_aVisArea.GetHeight() ) ); } @@ -502,7 +502,7 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt - m_aVisArea.Left() - m_aVisArea.Right() ) / 2 ); aPnt.setX( SetHScrollMax( aPnt.X() ) ); const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0; - aPnt.setX( std::max( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() ) ); + aPnt.setX( std::max<sal_Int32>( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() ) ); } m_aVisArea = aOldVisArea; if( pCareWn ) @@ -570,7 +570,7 @@ long SwView::PageUp() Point aPos(m_aVisArea.TopLeft()); aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) ); - aPos.setY( std::max(0L, aPos.Y()) ); + aPos.setY( std::max<sal_Int32>(0, aPos.Y()) ); SetVisArea( aPos ); return 1; } diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index bad0b82dfefb..9b4368737caf 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -326,7 +326,7 @@ long SwWrtShell::SetCursorKillSel(const Point *pPt, bool bTextOnly ) void SwWrtShell::UnSelectFrame() { // Remove Frame selection with guaranteed invalid position - Point aPt(LONG_MIN, LONG_MIN); + Point aPt(SAL_MIN_INT32, SAL_MIN_INT32); SelectObj(aPt); SwTransferable::ClearSelection( *this ); } |