diff options
Diffstat (limited to 'sw/source/core')
46 files changed, 350 insertions, 350 deletions
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(); |