diff options
Diffstat (limited to 'sw')
37 files changed, 117 insertions, 115 deletions
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index a9c5a79c023f..c0153ef93d3f 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -152,11 +152,11 @@ public: }; typedef void (SwRect::*SwRectSet)( const tools::Long nNew ); -typedef long (SwRect::*SwRectGet)() const; +typedef tools::Long (SwRect::*SwRectGet)() const; typedef Point (SwRect::*SwRectPoint)() const; typedef Size (SwRect::*SwRectSize)() const; typedef bool (SwRect::*SwRectMax)( tools::Long ) const; -typedef long (SwRect::*SwRectDist)( tools::Long ) const; +typedef tools::Long (SwRect::*SwRectDist)( tools::Long ) const; typedef void (SwRect::*SwRectSetTwice)( tools::Long, tools::Long ); typedef void (SwRect::*SwRectSetPos)( const Point& ); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index cabd1ff97401..ac2b3c41d6bd 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -226,7 +226,7 @@ private: { CompareData &m_rData1, &m_rData2; const MovedData &m_rMoved1, &m_rMoved2; - std::unique_ptr<long[]> m_pMemory; + std::unique_ptr<tools::Long[]> m_pMemory; tools::Long *m_pFDiag, *m_pBDiag; void Compare( sal_uLong nStt1, sal_uLong nEnd1, sal_uLong nStt2, sal_uLong nEnd2 ); @@ -788,7 +788,7 @@ Compare::CompareSequence::CompareSequence( : m_rData1( rD1 ), m_rData2( rD2 ), m_rMoved1( rMD1 ), m_rMoved2( rMD2 ) { sal_uLong nSize = rMD1.GetCount() + rMD2.GetCount() + 3; - m_pMemory.reset( new long[ nSize * 2 ] ); + m_pMemory.reset( new tools::Long[ nSize * 2 ] ); m_pFDiag = m_pMemory.get() + ( rMD2.GetCount() + 1 ); m_pBDiag = m_pMemory.get() + ( nSize + rMD2.GetCount() + 1 ); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 7d8c50238ae1..e8517ba547eb 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -665,7 +665,7 @@ void SwNoTextFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBord if( nChgHght > 0) Grow( nChgHght ); else if( nChgHght < 0) - Shrink( std::min(getFramePrintArea().Height(), -nChgHght) ); + Shrink( std::min(getFramePrintArea().Height(), tools::Long(-nChgHght)) ); } bool SwNoTextFrame::GetCharRect( SwRect &rRect, const SwPosition& rPos, diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 2bacf8976553..84ebb7dd8821 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1312,7 +1312,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( tools::Long(MINLAY), nRet )); + return static_cast<sal_uInt16>(std::max( SwTwips(MINLAY), nRet )); } /* The Line is within the Selection but not outlined by the TabCols. diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index aca6663389bd..11129ec7c225 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1834,7 +1834,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, const tools::Long nStSz = pStart->GetFormat()->GetFrameSize().GetWidth(); const tools::Long nEdSz = pEnd->GetFormat()->GetFrameSize().GetWidth(); - const tools::Long nWish = std::max( 1L, pTable->GetFormat()->GetFrameSize().GetWidth() ); + const tools::Long nWish = std::max( tools::Long(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 2a053eacd94f..90930daeabee 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1261,10 +1261,10 @@ public: SwFrameDeleteGuard& operator=(const SwFrameDeleteGuard&) =delete; }; -typedef long (SwFrame::*SwFrameGet)() const; +typedef tools::Long (SwFrame::*SwFrameGet)() const; typedef bool (SwFrame::*SwFrameMax)( tools::Long ); typedef void (SwFrame::*SwFrameMakePos)( const SwFrame*, const SwFrame*, bool ); -typedef long (*SwOperator)( tools::Long, tools::Long ); +typedef tools::Long (*SwOperator)( tools::Long, tools::Long ); typedef void (SwFrame::*SwFrameSet)( tools::Long, tools::Long ); struct SwRectFnCollection diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index cdbc4dbbd420..59e2c25769c7 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -50,7 +50,7 @@ namespace sw { struct Extent; } namespace basegfx::utils { class B2DClipState; } #define FAR_AWAY (SAL_MAX_INT32 - 20000) // initial position of a Fly -#define BROWSE_HEIGHT (56700L * 10L) // 10 Meters +constexpr tools::Long BROWSE_HEIGHT = 56700 * 10; // 10 Meters #define GRFNUM_NO 0 #define GRFNUM_YES 1 #define GRFNUM_REPLACE 2 diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 4fb8b578451f..eb2ef8016a22 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -575,8 +575,8 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const const SvxULSpaceItem& rUL = rFormat.GetULSpace(); const SvxLRSpaceItem& rLR = rFormat.GetLRSpace(); { - maObjRectWithSpaces.Top ( std::max( maObjRectWithSpaces.Top() - tools::Long(rUL.GetUpper()), 0L )); - maObjRectWithSpaces.Left( std::max( maObjRectWithSpaces.Left()- rLR.GetLeft(), 0L )); + maObjRectWithSpaces.Top ( std::max( maObjRectWithSpaces.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) )); + maObjRectWithSpaces.Left( std::max( maObjRectWithSpaces.Left()- rLR.GetLeft(), tools::Long(0) )); maObjRectWithSpaces.AddHeight(rUL.GetLower() ); maObjRectWithSpaces.AddWidth(rLR.GetRight() ); } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index ae100af25d46..7b91a1bc74cc 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1465,7 +1465,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, // former consideration if ( pOwn->IsTextFrame() ) { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nAdd = std::max( nAdd, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace()) ); } nUpper += nAdd; } @@ -1491,7 +1491,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max( nAdd, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true )) ); } } nUpper += nAdd; @@ -1509,7 +1509,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, { // former consideration if ( pOwn->IsTextFrame() ) - nUpper = std::max( nUpper, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nUpper = std::max( nUpper, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace()) ); if ( nPrevLineSpacing != 0 ) { nUpper = std::max( nUpper, nPrevLineSpacing ); @@ -1539,7 +1539,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max( nAdd, SwTwips(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 49f522c42d41..9987d682dbfc 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -826,10 +826,10 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, SwRect aNew( GetObjRectWithSpaces() ); SwRect aOld( getFrameArea() ); const SvxULSpaceItem &rUL = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetULSpace(); - aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), 0L ) ); + aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) ); aOld.AddHeight(rUL.GetLower() ); const SvxLRSpaceItem &rLR = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetLRSpace(); - aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), 0L ) ); + aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) ); aOld.AddWidth(rLR.GetRight() ); aNew.Union( aOld ); NotifyBackground( FindPageFrame(), aNew, PrepareHint::Clear ); @@ -928,13 +928,13 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( RES_UL_SPACE == nWhich ) { const SvxULSpaceItem &rUL = *static_cast<const SvxULSpaceItem*>(pNew); - aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), 0L ) ); + aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) ); aOld.AddHeight(rUL.GetLower() ); } else { const SvxLRSpaceItem &rLR = *static_cast<const SvxLRSpaceItem*>(pNew); - aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), 0L ) ); + aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) ); aOld.AddWidth(rLR.GetRight() ); } } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 7f60bb165ad5..95029bbf90e9 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3561,7 +3561,7 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrame *pCell ) nLow += static_cast<SwTextFrame*>(pLow)->GetParHeight()-pLow->getFramePrintArea().Height(); else if( pLow->IsSctFrame() && static_cast<SwSectionFrame*>(pLow)->IsUndersized() ) nLow += static_cast<SwSectionFrame*>(pLow)->Undersize(); - nFlyAdd = std::max( 0L, nFlyAdd - nLow ); + nFlyAdd = std::max( tools::Long(0), nFlyAdd - nLow ); nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) ); nHeight += nLow; pLow = pLow->GetNext(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 414615267676..51e97fb1c25c 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -305,7 +305,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( SwTwips(aRectFnSet.GetTop(getFramePrintArea())), -nPrtHeight ); SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aRectFnSet.SubTop( aPrt, nTmpDiff ); } @@ -348,8 +348,8 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) { if ( pBoss->GetMaxFootnoteHeight() != LONG_MAX ) { - nDist = std::min( nDist, pBoss->GetMaxFootnoteHeight() - - aRectFnSet.GetHeight(getFrameArea()) ); + nDist = std::min( nDist, + SwTwips(pBoss->GetMaxFootnoteHeight() - aRectFnSet.GetHeight(getFrameArea())) ); if ( nDist <= 0 ) return 0; } diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 922aab7dcd55..ec97ae693029 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -426,7 +426,7 @@ void SwHeadFootFrame::Format(vcl::RenderContext* pRenderContext, const SwBorderA { lcl_LayoutFrameEnsureMinHeight(*this); - tools::Long nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); + SwTwips nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); if ( !isFramePrintAreaValid() ) FormatPrt(nUL, pAttrs); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index c322a0d7b496..73914fda045d 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2303,8 +2303,8 @@ 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() ); - nMaxPageRight = std::max( nMaxPageRight, aNewPagePos.getX() + nCurrentPageWidth); + nMinPageLeft = std::min( nMinPageLeft, SwTwips(aNewPagePos.getX()) ); + nMaxPageRight = std::max( nMaxPageRight, SwTwips(aNewPagePos.getX() + nCurrentPageWidth)); // border of nGapBetweenPages around the current page: SwRect aPageRectWithBorders( aNewPagePos.getX() - nGapBetweenPages, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index b06341cb9ecb..12536c52a054 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -864,7 +864,7 @@ static void lcl_DrawDashedRect( OutputDevice * pOut, SwLineRect const & rLRect ) // Discriminate vertically stretched rect from horizontally stretched // and restrict minimum nHalfLWidth to 1 - tools::Long nHalfLWidth = std::max( static_cast<tools::Long>(std::min( rLRect.Width( ), rLRect.Height( ) ) / 2), 1L ); + tools::Long nHalfLWidth = std::max( std::min( rLRect.Width( ), rLRect.Height( ) ) / 2, tools::Long(1) ); if ( rLRect.Height( ) > rLRect.Width( ) ) { @@ -1237,7 +1237,7 @@ static tools::Long lcl_AlignWidth( const tools::Long nWidth, SwPaintProperties c const tools::Long nW = nWidth % properties.nSPixelSzW; if ( !nW || nW > properties.nSHalfPixelSzW ) - return std::max(1L, nWidth - properties.nSHalfPixelSzW); + return std::max(tools::Long(1), nWidth - properties.nSHalfPixelSzW); } return nWidth; } @@ -1249,7 +1249,7 @@ static tools::Long lcl_AlignHeight( const tools::Long nHeight, SwPaintProperties const tools::Long nH = nHeight % properties.nSPixelSzH; if ( !nH || nH > properties.nSHalfPixelSzH ) - return std::max(1L, nHeight - properties.nSHalfPixelSzH); + return std::max(tools::Long(1), nHeight - properties.nSHalfPixelSzH); } return nHeight; } @@ -5396,8 +5396,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co if( bGrid ) { nY -= nGrid; - SwTwips nPosY = std::max( aInter.Left(), nY ); - SwTwips nHeight = std::min(nRight, aTmp.Pos().X())-nPosY; + SwTwips nPosY = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nHeight = std::min(nRight, SwTwips(aTmp.Pos().X()))-nPosY; if( nHeight > 0 ) { if( bCell ) @@ -5429,8 +5429,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY -= nRuby; if( bBorder ) { - SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nPos = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nW = std::min(nRight, SwTwips(aTmp.Pos().X())) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -5455,7 +5455,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co { nY -= nGrid; SwTwips nHeight = aTmp.Pos().X() - - std::max(aInter.Left(), nY ); + - std::max(SwTwips(aInter.Left()), nY ); if( nHeight > 0 ) { if( bCell ) @@ -5487,8 +5487,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY -= nRuby; if( bBorder ) { - SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nPos = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nW = std::min(nRight, SwTwips(aTmp.Pos().X())) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -6507,7 +6507,7 @@ 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 tools::Long (Point::*pmfPtGet)() const; typedef void (Point::*pmfPtSet)(tools::Long); const pmfPtGet pDirPtX = &Point::X; const pmfPtGet pDirPtY = &Point::Y; diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index adf3e5478176..44e31aac0993 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -552,7 +552,7 @@ static void lcl_PreprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine, SwBorderAttrAccess aAccess( SwFrame::GetCache(), pCell ); const SwBorderAttrs &rAttrs = *aAccess.Get(); - nMinHeight = std::max( nMinHeight, lcl_CalcTopAndBottomMargin( *static_cast<SwLayoutFrame*>(pCell), rAttrs ) ); + nMinHeight = std::max( nMinHeight, tools::Long(lcl_CalcTopAndBottomMargin( *static_cast<SwLayoutFrame*>(pCell), rAttrs )) ); pCell = pCell->GetNext(); } } @@ -2911,7 +2911,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA setFramePrintAreaValid(false); } - tools::Long nRightOffset = std::max( 0L, nTmpRight ); + tools::Long nRightOffset = std::max( tools::Long(0), nTmpRight ); SwTwips nLower = pAttrs->CalcBottomLine(); // #i29550# @@ -2966,7 +2966,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // surrounding fly frames on the right // -> right indent is maximum of given right offset // and wished right offset. - nRightSpacing = nRightLine + std::max( nRightOffset, nWishRight ); + nRightSpacing = nRightLine + std::max( SwTwips(nRightOffset), nWishRight ); } else { @@ -2997,7 +2997,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // surrounding fly frames on the left // -> right indent is maximum of given left offset // and wished left offset. - nLeftSpacing = nLeftLine + std::max( nLeftOffset, nWishLeft ); + nLeftSpacing = nLeftLine + std::max( SwTwips(nLeftOffset), nWishLeft ); } else { @@ -3019,11 +3019,11 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA const SwTwips nCenterSpacing = ( nMax - nWishedTableWidth ) / 2; nLeftSpacing = nLeftLine + ( (nLeftOffset > 0) ? - std::max( nCenterSpacing, nLeftOffset ) : + std::max( nCenterSpacing, SwTwips(nLeftOffset) ) : nCenterSpacing ); nRightSpacing = nRightLine + ( (nRightOffset > 0) ? - std::max( nCenterSpacing, nRightOffset ) : + std::max( nCenterSpacing, SwTwips(nRightOffset) ) : nCenterSpacing ); } break; @@ -3046,7 +3046,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of left spacing and left offset. // OD 10.03.2003 #i9040# - consider left line attribute. - nLeftSpacing = std::max( nLeftSpacing, ( nLeftOffset + nLeftLine ) ); + nLeftSpacing = std::max( nLeftSpacing, SwTwips( nLeftOffset + nLeftLine ) ); } // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)> nRightSpacing = pAttrs->CalcRight( this ); @@ -3056,7 +3056,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of right spacing and right offset. // OD 10.03.2003 #i9040# - consider right line attribute. - nRightSpacing = std::max( nRightSpacing, ( nRightOffset + nRightLine ) ); + nRightSpacing = std::max( nRightSpacing, SwTwips( nRightOffset + nRightLine ) ); } } break; @@ -3072,14 +3072,14 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of right spacing and right offset. // OD 10.03.2003 #i9040# - consider left line attribute. - nLeftSpacing = std::max( nLeftSpacing, ( pAttrs->CalcLeftLine() + nLeftOffset ) ); + nLeftSpacing = std::max( nLeftSpacing, SwTwips( pAttrs->CalcLeftLine() + nLeftOffset ) ); } // OD 10.03.2003 #i9040# - consider right and left line attribute. const SwTwips nWishRight = nMax - (nLeftSpacing-pAttrs->CalcLeftLine()) - nWishedTableWidth; nRightSpacing = nRightLine + ( (nRightOffset > 0) ? - std::max( nWishRight, nRightOffset ) : + std::max( nWishRight, SwTwips(nRightOffset) ) : nWishRight ); } break; @@ -3176,7 +3176,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( IsRestrictTableGrowth() ) { - nTmp = std::min( nDist, nReal + nTmp ); + nTmp = std::min( tools::Long(nDist), nReal + nTmp ); nDist = nTmp < 0 ? 0 : nTmp; } } @@ -3966,7 +3966,7 @@ tools::Long CalcHeightWithFlys( const SwFrame *pFrame ) aRectFnSet.GetBottom(pAnchoredObj->GetObjRect()), aRectFnSet.GetBottom(pFrame->getFrameArea()) ); - nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop2 ); + nHeight = std::max( nHeight, tools::Long(nDistOfFlyBottomToAnchorTop2 )); } } } @@ -4038,7 +4038,7 @@ static SwTwips lcl_CalcMinCellHeight( const SwLayoutFrame *_pCell, // #i26945# if ( _bConsiderObjs ) { - nFlyAdd = std::max( 0L, nFlyAdd - nLowHeight ); + nFlyAdd = std::max( tools::Long(0), nFlyAdd - nLowHeight ); nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) ); } } @@ -4636,7 +4636,7 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SwTwips nMinHeight = 0; if (rSz.GetHeightSizeType() == SwFrameSize::Minimum) nMinHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*this), - 0L); + tools::Long(0)); // Only necessary to calculate minimal row height if height // of pRow is at least nMinHeight. Otherwise nMinHeight is the @@ -5777,7 +5777,7 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const if (rSz.GetHeightSizeType() == SwFrameSize::Minimum) { nMinRowHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*pFirstRow), - 0L); + tools::Long(0)); } nTmpHeight += std::max( nHeightOfFirstContentLine, nMinRowHeight ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 416c44378c60..3d9c9e6056fb 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1607,7 +1607,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) if ( nDiff > 0 ) { nChg = BROWSE_HEIGHT - pUp->getFrameArea().Height(); - nChg = std::min( nDiff, nChg ); + nChg = std::min( nDiff, SwTwips(nChg) ); if ( !IsBodyFrame() ) { @@ -1621,7 +1621,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) { { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pBody); - aFrm.Height(std::max( 0L, aFrm.Height() - nChg )); + aFrm.Height(std::max( tools::Long(0), aFrm.Height() - nChg )); } pBody->InvalidatePrt_(); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 48ba68d3a81f..303a529e3484 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -382,12 +382,12 @@ bool SwTextFrame::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const if ( aRectFnSet.IsVert() ) { if ( aRectFnSet.IsVertL2R() ) - nMaxY = std::min( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::min( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); else - nMaxY = std::max( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::max( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); } else - nMaxY = std::min( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::min( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); if ( pFrame->IsEmpty() || ! aRectFnSet.GetHeight(pFrame->getFramePrintArea()) ) { Point aPnt1 = pFrame->getFrameArea().Pos() + pFrame->getFramePrintArea().Pos(); @@ -1407,7 +1407,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const nFirst = nFirst - nDist; else nFirst = 0; - nDist = std::max( nDist, GetLineSpace() ); + nDist = std::max( nDist, SwTwips(GetLineSpace()) ); nDist += nLineHeight; nDiff -= nFirst; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index fb064af7d3c9..aa4ba00b8d8d 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2069,7 +2069,7 @@ void SwTextFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "SwTextFormatter::CalcUnclipped with unswapped frame" ); - tools::Long nFlyAsc, nFlyDesc; + SwTwips nFlyAsc, nFlyDesc; m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc ); rTop = Y() + GetCurr()->GetAscent(); rBottom = rTop + nFlyDesc; @@ -2096,7 +2096,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, aTmpInf.SetIdx( nStartIdx ); aTmpInf.SetPos( aStart ); - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc ); const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight(); @@ -2215,7 +2215,7 @@ void SwTextFormatter::AlignFlyInCntBase( tools::Long nBaseLine ) const nFlags |= AsCharFlags::Reverse; } - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; while( pPos ) { @@ -2577,7 +2577,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 - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips 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(); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 866eaf929979..61fd156e191c 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -143,7 +143,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, SwLinePortion *pPor = bEndPor ? m_pCurr->GetFirstPortion() : CalcPaintOfst( rPaint ); // Optimization! - SwTwips nMaxRight = std::min( rPaint.Right(), Right() ); + SwTwips nMaxRight = std::min<SwTwips>( rPaint.Right(), Right() ); const SwTwips nTmpLeft = GetInfo().X(); //compatibility setting: allow tabstop text to exceed right margin if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN)) diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 46851c08d7ad..a5fb1f6b6731 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -983,7 +983,7 @@ SwTwips SwTextFly::CalcMinBottom() const { const SwRect& aBound( pAnchoredObj->GetObjRectWithSpaces() ); if( aBound.Top() < nEndOfFrame ) - nRet = std::max( nRet, aBound.Bottom() ); + nRet = std::max( nRet, SwTwips(aBound.Bottom()) ); } } } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 3b954b6f857d..d1a5f9054462 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -3152,7 +3152,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( tools::Long(0) , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) ); aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(pFrame->getFrameArea()) - ( rAttrs.CalcLeft( pFrame ) + rAttrs.CalcRight( pFrame ) ) ); } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 8f1aca1a64b4..b544ba56a48b 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1008,7 +1008,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc); // kerning array - gives the absolute position of end of each character - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); if ( m_pPrinter ) m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(), @@ -1115,7 +1115,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); if ( m_pPrinter ) m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(), @@ -1257,7 +1257,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Simple kerning is handled by DrawStretchText if( rInf.GetSpace() || rInf.GetKanaComp() ) { - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); @@ -1465,12 +1465,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) bool bBullet = rInf.GetBullet(); if( m_bSymbol ) bBullet = false; - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); CreateScrFont( *rInf.GetShell(), rInf.GetOut() ); tools::Long nScrPos; // get screen array - std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pScrArray(new tools::Long[sal_Int32(rInf.GetLen())]); SwTextGlyphsKey aGlyphsKey{ &rInf.GetOut(), rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()) }; SalLayoutGlyphs* pGlyphs = lcl_CreateLayout(aGlyphsKey, m_aTextGlyphs[aGlyphsKey]); rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(), @@ -1982,7 +1982,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) aTextSize.setWidth( m_pPrinter->GetTextWidth( rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn))); aTextSize.setHeight( m_pPrinter->GetTextHeight() ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(nLn)]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(nLn)]); CreateScrFont( *rInf.GetShell(), rInf.GetOut() ); if( !GetScrFont()->IsSameInstance( rInf.GetOut().GetFont() ) ) rInf.GetOut().SetFont( *m_pScrFont ); @@ -2001,7 +2001,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) nScrPos = pKernArray[ sal_Int32(nLn) - 1 ]; else { - std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pScrArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); nScrPos = pScrArray[ 0 ]; @@ -2050,7 +2050,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) rInf.GetOut().SetFont( *m_pPrtFont ); if( bCompress ) { - std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] ); + std::unique_ptr<tools::Long[]> pKernArray( new tools::Long[sal_Int32(nLn)] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn)); rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray.get(), @@ -2090,7 +2090,7 @@ TextFrameIndex SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf) if( 0 != nSperren ) nKern -= nSperren; - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); // be sure to have the correct layout mode at the printer if ( m_pPrinter ) @@ -2407,7 +2407,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe const SwDoc* pDoc = rInf.GetShell()->GetDoc(); const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); @@ -2438,7 +2438,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe { const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())] ); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); tools::Long nCurrPos = pKernArray[sal_Int32(nTextBreak)] + nGridWidthAdd; @@ -2554,7 +2554,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe nLn = TextFrameIndex(1); else if (nLn > nTextBreak2 + nTextBreak2) nLn = nTextBreak2 + nTextBreak2; - std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] ); + std::unique_ptr<tools::Long[]> pKernArray( new tools::Long[sal_Int32(nLn)] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn)); if( rInf.GetScriptInfo()->Compress( pKernArray.get(), rInf.GetIdx(), nLn, diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 02f0e988172e..57fda67e4e2c 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -504,13 +504,13 @@ void SwPagePreviewLayout::CalcDocPreviewPaintRect() Size aSize; if ( mbDoesLayoutColsFitIntoWindow ) - aSize.setWidth( std::min( mnPreviewLayoutWidth, + aSize.setWidth( std::min( tools::Long(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( tools::Long(mnPreviewLayoutHeight), maPreviewDocRect.GetHeight() - aTopLeftPos.Y() ) ); else aSize.setHeight( std::min( maPreviewDocRect.GetHeight() - aTopLeftPos.Y(), @@ -764,7 +764,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( tools::Long(0), maPreviewDocRect.Bottom() - mnPreviewLayoutHeight ) ); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 95129e6b90dc..049ef9742cc1 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -351,9 +351,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( tools::Long(0), aTmp1.Left() - 1 ) ); if ( aTmp2.Top() > aRect.Top() ) - aTmp1.SetTop( std::max( 0L, aTmp1.Top() - 1 ) ); + aTmp1.SetTop( std::max<tools::Long>( 0, aTmp1.Top() - 1 ) ); aTmp1.AdjustRight(1 ); aTmp1.AdjustBottom(1 ); aTmp1 = GetOut()->PixelToLogic( aTmp1 ); @@ -1169,7 +1169,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) const tools::Rectangle &rBound = pObj->GetObjRect().SVRect(); if (rBound.Left() != FAR_AWAY) { // OD 03.03.2003 #107927# - use correct datatype - const SwTwips nL = std::max( 0L, rBound.Left() - nOfst ); + const SwTwips nL = std::max( SwTwips(0), SwTwips(rBound.Left() - nOfst) ); if ( nL < nMinLeft ) nMinLeft = nL; if( rBound.Right() + nOfst > nMaxRight ) @@ -1302,7 +1302,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to aRect.AddWidth(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( tools::Long(0), aRect.Left()-aPixSz.Width() ) ); aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos())); aRect.SSize( GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize())) ); maVisArea = aRect; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c74b2d99edb7..59770d71785b 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5030,7 +5030,7 @@ sal_uInt16 SwHTMLParser::ToTwips( sal_uInt16 nPixel ) { if( nPixel && Application::GetDefaultDevice() ) { - tools::Long nTwips = Application::GetDefaultDevice()->PixelToLogic( + SwTwips nTwips = Application::GetDefaultDevice()->PixelToLogic( Size( nPixel, nPixel ), MapMode( MapUnit::MapTwip ) ).Width(); return static_cast<sal_uInt16>(std::min(nTwips, SwTwips(SAL_MAX_UINT16))); } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 41ca25235c48..8d68eb5da6f7 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -716,9 +716,11 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons * 2147483647( MAX_INTEGER_VALUE ). * Therefore changing the following accordingly so that LO sync's up with MSO. **/ - sal_uInt64 cx = TwipsToEMU(std::clamp(rSize.Width(), 0L, tools::Long(SAL_MAX_INT32))); + sal_uInt64 cx + = TwipsToEMU(std::clamp(rSize.Width(), tools::Long(0), tools::Long(SAL_MAX_INT32))); OString aWidth(OString::number(std::min(cx, sal_uInt64(SAL_MAX_INT32)))); - sal_uInt64 cy = TwipsToEMU(std::clamp(rSize.Height(), 0L, tools::Long(SAL_MAX_INT32))); + sal_uInt64 cy + = TwipsToEMU(std::clamp(rSize.Height(), tools::Long(0), tools::Long(SAL_MAX_INT32))); OString aHeight(OString::number(std::min(cy, sal_uInt64(SAL_MAX_INT32)))); m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_extent, XML_cx, aWidth, XML_cy, aHeight); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fdfec6fde53a..ac7d6aed62ea 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -553,7 +553,7 @@ sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, return bRet; } -static bool RTLDrawingsHack(tools::Long &rLeft, +static bool RTLDrawingsHack(SwTwips &rLeft, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize) { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 82f93536e959..adbfaf20bae3 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -5263,7 +5263,7 @@ bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap) tools::Long SwWW8ImplReader::ImportExtSprm(WW8PLCFManResult* pRes) { // array for reading of the extended ( self-defined ) SPRMs - typedef long (SwWW8ImplReader::*FNReadRecordExt)(WW8PLCFManResult*); + typedef tools::Long (SwWW8ImplReader::*FNReadRecordExt)(WW8PLCFManResult*); static const FNReadRecordExt aWwSprmTab[] = { diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 730d275901d7..1992f8ad6dd5 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -176,8 +176,8 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan : ROUND(m_aItem.m_lVDist / 10.0)); // Scale factor - const float fx = float(lOutWPix23) / std::max(1L, lDispW); - const float fy = float(lOutHPix23) / std::max(1L, lDispH); + const float fx = float(lOutWPix23) / std::max(tools::Long(1), lDispW); + const float fy = float(lOutHPix23) / std::max(tools::Long(1), lDispH); const float f = std::min(fx, fy); // zero point @@ -383,8 +383,8 @@ void SwLabFormatPage::ChangeMinMax() m_xHDistField->set_min(nMinSize, FieldUnit::CM); m_xVDistField->set_min(nMinSize, FieldUnit::CM); - m_xHDistField->set_max(tools::Long(100) * ((lMax - lLeft ) / std::max(1L, static_cast<tools::Long>(nCols))), FieldUnit::TWIP); - m_xVDistField->set_max(tools::Long(100) * ((lMax - lUpper) / std::max(1L, static_cast<tools::Long>(nRows))), FieldUnit::TWIP); + m_xHDistField->set_max(100 * ((lMax - lLeft ) / std::max(1, nCols)), FieldUnit::TWIP); + m_xVDistField->set_max(100 * ((lMax - lUpper) / std::max(1, nRows)), FieldUnit::TWIP); m_xWidthField->set_min(nMinSize, FieldUnit::CM); m_xHeightField->set_min(nMinSize, FieldUnit::CM); @@ -395,8 +395,8 @@ void SwLabFormatPage::ChangeMinMax() m_xLeftField->set_max(tools::Long(100) * (lMax - nCols * lHDist), FieldUnit::TWIP); m_xUpperField->set_max(tools::Long(100) * (lMax - nRows * lVDist), FieldUnit::TWIP); - m_xColsField->set_range(1, (lMax - lLeft ) / std::max(1L, lHDist)); - m_xRowsField->set_range(1, (lMax - lUpper) / std::max(1L, lVDist)); + m_xColsField->set_range(1, (lMax - lLeft ) / std::max(tools::Long(1), lHDist)); + m_xRowsField->set_range(1, (lMax - lUpper) / std::max(tools::Long(1), lVDist)); m_xPWidthField->set_range(tools::Long(100) * lMinPWidth, tools::Long(100) * lMax, FieldUnit::TWIP); m_xPHeightField->set_range(tools::Long(100) * lMinPHeight, tools::Long(100) * lMax, FieldUnit::TWIP); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index ac63432eb60c..4adf7cb34447 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -721,8 +721,8 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, weld::MetricSpinButton&, void ) } //set maximum values - m_xCLNrEdt->set_max(std::max(1L, - std::min(tools::Long(nMaxCols), tools::Long( m_xColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); + m_xCLNrEdt->set_max(std::max(tools::Long(1), + std::min(tools::Long(nMaxCols), tools::Long(m_xColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); //prompt example window if(!m_bLockUpdate) @@ -795,8 +795,8 @@ void SwColumnPage::Init() // set maximum number of columns // values below 1 are not allowed - m_xCLNrEdt->set_max(std::max(1L, - std::min(tools::Long(nMaxCols), tools::Long( m_xColMgr->GetActualSize() / g_nMinWidth) ))); + m_xCLNrEdt->set_max(std::max(tools::Long(1), + std::min(tools::Long(nMaxCols), tools::Long(m_xColMgr->GetActualSize() / g_nMinWidth) ))); } bool SwColumnPage::isLineNotNone() const diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index a5ba5cb27c9c..3e4129b96743 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -339,13 +339,13 @@ void SwModule::InsertEnv( SfxRequest& rReq ) switch (rItem.m_eAlign) { case ENV_HOR_LEFT: break; - case ENV_HOR_CNTR: lLeft += std::max(0L, tools::Long(aPaperSize.Width() - nPageW)) / 2; + case ENV_HOR_CNTR: lLeft += std::max(tools::Long(0), aPaperSize.Width() - nPageW) / 2; break; - case ENV_HOR_RGHT: lLeft += std::max(0L, tools::Long(aPaperSize.Width() - nPageW)); + case ENV_HOR_RGHT: lLeft += std::max(tools::Long(0), aPaperSize.Width() - nPageW); break; - case ENV_VER_LEFT: lUpper += std::max(0L, tools::Long(aPaperSize.Width() - nPageH)); + case ENV_VER_LEFT: lUpper += std::max(tools::Long(0), aPaperSize.Width() - nPageH); break; - case ENV_VER_CNTR: lUpper += std::max(0L, tools::Long(aPaperSize.Width() - nPageH)) / 2; + case ENV_VER_CNTR: lUpper += std::max(tools::Long(0), aPaperSize.Width() - nPageH) / 2; break; case ENV_VER_RGHT: break; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 50e0694471ca..2049e6f60288 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -683,7 +683,7 @@ void SwEditWin::JustifyAreaTimer() #ifdef UNX const tools::Long coMinLen = 100; #else - const long coMinLen = 50; + const tools::Long coMinLen = 50; #endif tools::Long const nTimeout = 800, nDiff = std::max( diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index e0d8c517cda6..e2e1f28e2e7c 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -102,7 +102,7 @@ private: using SwEditShell::AutoCorrect; using SwCursorShell::GotoMark; - typedef long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); + typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); typedef void (SwWrtShell::*SELECTFUNC2)(const Point *, bool bProp ); SELECTFUNC2 m_fnDrag = &SwWrtShell::BeginDrag; diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index ecf9b6deafc6..7fc050f83803 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -145,7 +145,7 @@ void SwTableFUNC::SetColWidth(sal_uInt16 nNum, SwTwips nNewWidth ) aCols[ GetRightSeparator(nNum-1) ] -= nDiff; } else - aCols.SetRight( std::min( nNewWidth, aCols.GetRightMax()) ); + aCols.SetRight( std::min( nNewWidth, SwTwips(aCols.GetRightMax()) ) ); pSh->StartAllAction(); pSh->SetTabCols( aCols, bCurrentOnly ); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 679e08fc8025..fdfff47b13f3 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -131,14 +131,14 @@ tools::Long SwView::SetHScrollMax( tools::Long lMax ) // At negative values the document is completely visible. // In this case, no scrolling. - return std::max( std::min( lMax, lSize ), 0L ); + return std::max( std::min( lMax, lSize ), tools::Long(0) ); } tools::Long SwView::SetVScrollMax( tools::Long lMax ) { const tools::Long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2; tools::Long lSize = GetDocSz().Height() + lBorder - m_aVisArea.GetHeight(); - return std::max( std::min( lMax, lSize), 0L ); // see horizontal + return std::max( std::min( lMax, lSize), tools::Long(0) ); // see horizontal } Point SwView::AlignToPixel(const Point &rPt) const @@ -346,12 +346,12 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, if(nDesHeight > nCurHeight) // the height is not sufficient, then nYScroll is no longer of interest { pPt->setY( rRect.Top() ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) ); } else if ( rRect.Top() < m_aVisArea.Top() ) // Upward shift { pPt->setY( rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll) ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) ); } else if( rRect.Bottom() > m_aVisArea.Bottom() ) // Downward shift { @@ -373,7 +373,7 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, pPt->setX( rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll) ); pPt->setX( std::max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() ) ); pPt->setX( std::min( rRect.Left() - nScrollX, pPt->X() ) ); - pPt->setX( std::max( 0L, pPt->X() ) ); + pPt->setX( std::max( tools::Long(0), pPt->X() ) ); } } @@ -570,7 +570,7 @@ bool SwView::PageUp() Point aPos(m_aVisArea.TopLeft()); aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) ); - aPos.setY( std::max(0L, aPos.Y()) ); + aPos.setY( std::max(tools::Long(0), aPos.Y()) ); SetVisArea( aPos ); return true; } diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 7924d5b04ca7..d4f34c04d7cb 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -2111,8 +2111,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) { nEnd = aTabCols.GetRight() - rEntry.nPos; SvxColumnDescription aColDesc( nStart, nEnd, - std::max(0L, aTabCols.GetRight() - rEntry.nMax), - std::max(0L, aTabCols.GetRight() - rEntry.nMin), + std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMax), + std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMin), !aTabCols.IsHidden(i) ); aColItem.Append(aColDesc); } |