diff options
25 files changed, 140 insertions, 79 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 7d7d38a2d97e..b12261eb560d 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -46,7 +46,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> - +#include <cstdlib> #include <limits> #include <boost/bind.hpp> #include <boost/scoped_ptr.hpp> @@ -392,8 +392,8 @@ namespace pcr void HyperlinkInput::impl_checkEndClick( const ::MouseEvent rMEvt ) { const MouseSettings& rMouseSettings( GetSettings().GetMouseSettings() ); - if ( ( abs( rMEvt.GetPosPixel().X() - m_aMouseButtonDownPos.X() ) < rMouseSettings.GetStartDragWidth() ) - && ( abs( rMEvt.GetPosPixel().Y() - m_aMouseButtonDownPos.Y() ) < rMouseSettings.GetStartDragHeight() ) + if ( ( std::abs( rMEvt.GetPosPixel().X() - m_aMouseButtonDownPos.X() ) < rMouseSettings.GetStartDragWidth() ) + && ( std::abs( rMEvt.GetPosPixel().Y() - m_aMouseButtonDownPos.Y() ) < rMouseSettings.GetStartDragHeight() ) ) Application::PostUserEvent( m_aClickHandler ); } diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx index b62c0f042cd1..c63728a42aa5 100644 --- a/reportdesign/source/ui/inc/ViewsWindow.hxx +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -65,9 +65,9 @@ namespace rptui case POS_DOWN: return lhs.Bottom() >= rhs.Bottom(); case POS_CENTER_HORIZONTAL: - return abs(m_aRefPoint.X() - lhs.Center().X()) < abs(m_aRefPoint.X() - rhs.Center().X()); + return std::abs(m_aRefPoint.X() - lhs.Center().X()) < std::abs(m_aRefPoint.X() - rhs.Center().X()); case POS_CENTER_VERTICAL: - return abs(lhs.Center().Y() - m_aRefPoint.Y()) < abs(rhs.Center().Y() - m_aRefPoint.Y()); + return std::abs(lhs.Center().Y() - m_aRefPoint.Y()) < std::abs(rhs.Center().Y() - m_aRefPoint.Y()); } return false; } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 161726bd4f34..9ca6852ab092 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -47,6 +47,7 @@ #include <svx/svdundo.hxx> #include <toolkit/helper/convert.hxx> #include <algorithm> +#include <cstdlib> #include <numeric> #include <o3tl/compat_functional.hxx> @@ -1096,8 +1097,8 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi aNewObjPos.Y() += nSectionHeight; } - const sal_Int32 nDeltaX = abs(aLeftTop.X() - aAbsolutePnt.X()); - const sal_Int32 nDeltaY = abs(aLeftTop.Y() - aAbsolutePnt.Y()); + const sal_Int32 nDeltaX = std::abs(aLeftTop.X() - aAbsolutePnt.X()); + const sal_Int32 nDeltaY = std::abs(aLeftTop.Y() - aAbsolutePnt.Y()); m_aDragDelta.X() = nDeltaX; m_aDragDelta.Y() = nDeltaY; diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 0d08c9f6e817..174520a5a697 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include "scitems.hxx" #include <comphelper/string.hxx> #include <editeng/eeitem.hxx> @@ -1072,7 +1076,7 @@ void ScPreviewShell::DoScroll( sal_uInt16 nMode ) aCurPos.Y() -= nVPage; break; case SID_CURSORPAGEDOWN: - if( (abs(nVPage+nThumbPos-nRangeMax)<10) || nMaxVertPos<0 ) + if( (std::abs(nVPage+nThumbPos-nRangeMax)<10) || nMaxVertPos<0 ) { long nPage = pPreview->GetPageNo(); long nTotal = pPreview->GetTotalPages(); diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 304c2b298b39..d36590a56200 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <osl/endian.h> #include <eppt.hxx> #include "text.hxx" @@ -1245,7 +1249,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u nDefaultTabSizeSrc = nTabStop; } const sal_uInt32 nDefaultTabSize = MapSize( awt::Size( nDefaultTabSizeSrc, 1 ) ).Width; - sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize; + sal_uInt32 nDefaultTabs = std::abs( maRect.GetWidth() ) / nDefaultTabSize; if ( nTabs ) nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize ); if ( (sal_Int32)nDefaultTabs < 0 ) diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 746e940a361c..647e2516c3e5 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include "controller/SlsSelectionFunction.hxx" #include "SlideSorter.hxx" @@ -1361,8 +1365,8 @@ bool NormalModeHandler::ProcessMotionEvent ( { const sal_Int32 nDistance (maButtonDownLocation ? ::std::max ( - abs(maButtonDownLocation->X() - rDescriptor.maMousePosition.X()), - abs(maButtonDownLocation->Y() - rDescriptor.maMousePosition.Y())) + std::abs(maButtonDownLocation->X() - rDescriptor.maMousePosition.X()), + std::abs(maButtonDownLocation->Y() - rDescriptor.maMousePosition.Y())) : 0); if (nDistance > 3) StartDrag( diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx index 48b0898aad67..c6a4f1e5df28 100644 --- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> #include "controller/SlsVisibleAreaManager.hxx" #include "controller/SlideSorterController.hxx" @@ -270,14 +273,14 @@ VisibleAreaScroller::VisibleAreaScroller ( // When the distance to scroll is larger than a threshold then first // jump to within this distance of the final value and start the // animation from there. - if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance) + if (std::abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance) { if (aStart.X() < aEnd.X()) maStart.X() = aEnd.X()-gnMaxScrollDistance; else maStart.X() = aEnd.X()+gnMaxScrollDistance; } - if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance) + if (std::abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance) { if (aStart.Y() < aEnd.Y()) maStart.Y() = aEnd.Y()-gnMaxScrollDistance; diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index dac2f9866ece..d6312cbc0874 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -22,6 +22,7 @@ #include <vcl/help.hxx> #include <vcl/settings.hxx> +#include <cstdlib> #include <stack> #include <svtools/treelistbox.hxx> @@ -3141,8 +3142,8 @@ IMPL_LINK_NOARG(SvImpLBox, EditTimerCall) if ( bIsMouseTriggered ) { Point aCurrentMousePos = pView->GetPointerPosPixel(); - if ( ( abs( aCurrentMousePos.X() - aEditClickPos.X() ) > 5 ) - || ( abs( aCurrentMousePos.Y() - aEditClickPos.Y() ) > 5 ) + if ( ( std::abs( aCurrentMousePos.X() - aEditClickPos.X() ) > 5 ) + || ( std::abs( aCurrentMousePos.Y() - aEditClickPos.Y() ) > 5 ) ) { return 0L; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index c1f4324dc668..89bfb608599b 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <salhelper/timer.hxx> #include <svtools/grfmgr.hxx> #include <tools/debug.hxx> @@ -494,8 +498,8 @@ static void checkMetadataBitmap( const BitmapEx& rBmpEx, } if( rDestSize != rRefSize ) { if( rBmpEx.GetSizePixel().Width() > 100 && rBmpEx.GetSizePixel().Height() > 100 - && abs( rDestSize.Width() - rRefSize.Width()) < 5 - && abs( rDestSize.Height() - rRefSize.Height()) < 5 ) + && std::abs( rDestSize.Width() - rRefSize.Width()) < 5 + && std::abs( rDestSize.Height() - rRefSize.Height()) < 5 ) ; // ok, assume it's close enough else { // fall back to mtf rendering diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index e439ca7b8760..f1048e10a8ae 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <vcl/bmpacc.hxx> #include <tools/poly.hxx> #include <vcl/outdev.hxx> @@ -1007,8 +1011,8 @@ static BitmapEx checkMetadataBitmap( const BitmapEx& rBmpEx, // caused by this small difference). This will allow caching of the resulting // (scaled) pixmap, which can make a noticeable performance difference. if( rBmpEx.GetSizePixel().Width() > 100 && rBmpEx.GetSizePixel().Height() > 100 - && abs( rDestSize.Width() - rRefSize.Width()) < 5 - && abs( rDestSize.Height() - rRefSize.Height()) < 5 ) + && std::abs( rDestSize.Width() - rRefSize.Width()) < 5 + && std::abs( rDestSize.Height() - rRefSize.Height()) < 5 ) ; // ok, assume it's close enough else { // fall back to mtf rendering diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 4565a1eafe61..31372d00ee9f 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -39,6 +39,7 @@ #include <vcl/image.hxx> #include <tools/diagnose_ex.h> +#include <cstdlib> #include <functional> #include <numeric> @@ -2338,7 +2339,7 @@ namespace svt { namespace table Rectangle aDataArea( Point( 0, m_nColHeaderHeightPixel ), m_pDataWindow->GetOutputSizePixel() ); if ( m_pDataWindow->GetBackground().IsScrollable() - && abs( nPixelDelta ) < aDataArea.GetHeight() + && std::abs( nPixelDelta ) < aDataArea.GetHeight() ) { m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE | SCROLL_CHILDREN); @@ -2418,7 +2419,7 @@ namespace svt { namespace table // scroll the window content (if supported and possible), or invalidate the complete window if ( m_pDataWindow->GetBackground().IsScrollable() - && abs( nPixelDelta ) < aDataArea.GetWidth() + && std::abs( nPixelDelta ) < aDataArea.GetWidth() ) { m_pDataWindow->Scroll( nPixelDelta, 0, aDataArea, SCROLL_CLIP | SCROLL_UPDATE ); diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index e30155e34573..a6a4f7224ef1 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <svx/framelink.hxx> #include <math.h> @@ -765,9 +769,9 @@ void lclDrawHorLine( LinePoints aTPoints( rLPos + lclToMapUnit( rLRes.mnOffs1, nTOffs ), rRPos + lclToMapUnit( rRRes.mnOffs1, nTOffs ) ); LinePoints aBPoints( rLPos + lclToMapUnit( rLRes.mnOffs2, nBOffs ), rRPos + lclToMapUnit( rRRes.mnOffs2, nBOffs ) ); - sal_uInt32 nWidth = lclToMapUnit( abs( nTOffs ) ) + lclToMapUnit( abs( nBOffs ) ); + sal_uInt32 nWidth = lclToMapUnit( std::abs( nTOffs ) ) + lclToMapUnit( std::abs( nBOffs ) ); if ( ( nTOffs >= 0 && nBOffs >= 0 ) || ( nTOffs <= 0 && nBOffs <= 0 ) ) - nWidth = abs( lclToMapUnit( nTOffs ) - lclToMapUnit( nBOffs ) ) + 1; + nWidth = std::abs( lclToMapUnit( nTOffs ) - lclToMapUnit( nBOffs ) ) + 1; Point rLMid = ( aTPoints.maBeg + aBPoints.maBeg ) / 2; Point rRMid = ( aTPoints.maEnd + aBPoints.maEnd ) / 2; @@ -835,9 +839,9 @@ void lclDrawVerLine( LinePoints aLPoints( rTPos + lclToMapUnit( nLOffs, rTRes.mnOffs1 ), rBPos + lclToMapUnit( nLOffs, rBRes.mnOffs1 ) ); LinePoints aRPoints( rTPos + lclToMapUnit( nROffs, rTRes.mnOffs2 ), rBPos + lclToMapUnit( nROffs, rBRes.mnOffs2 ) ); - sal_uInt32 nWidth = lclToMapUnit( abs( nLOffs ) ) + lclToMapUnit( abs( nROffs ) ); + sal_uInt32 nWidth = lclToMapUnit( std::abs( nLOffs ) ) + lclToMapUnit( std::abs( nROffs ) ); if ( ( nLOffs >= 0 && nROffs >= 0 ) || ( nLOffs <= 0 && nROffs <= 0 ) ) - nWidth = abs( lclToMapUnit( nLOffs ) - lclToMapUnit( nROffs ) ) + 1; + nWidth = std::abs( lclToMapUnit( nLOffs ) - lclToMapUnit( nROffs ) ) + 1; Point rTMid = ( aLPoints.maBeg + aRPoints.maBeg ) / 2; Point rBMid = ( aLPoints.maEnd + aRPoints.maEnd ) / 2; @@ -1023,9 +1027,9 @@ void lclDrawDiagLine( Point aSMid( ( aLPoints.maBeg + aL2Points.maBeg ) / 2 ); Point aEMid( ( aLPoints.maEnd + aL2Points.maEnd ) / 2 ); - sal_uInt32 nWidth = lclToMapUnit( abs( nDiagOffs1 ) ) + lclToMapUnit( abs( nDiagOffs2 ) ); + sal_uInt32 nWidth = lclToMapUnit( std::abs( nDiagOffs1 ) ) + lclToMapUnit( std::abs( nDiagOffs2 ) ); if ( ( nDiagOffs1 <= 0 && nDiagOffs2 <= 0 ) || ( nDiagOffs1 >=0 && nDiagOffs2 >=0 ) ) - nWidth = lclToMapUnit( abs( nDiagOffs1 - nDiagOffs2 ) ); + nWidth = lclToMapUnit( std::abs( nDiagOffs1 - nDiagOffs2 ) ); svtools::DrawLine( rDev, aSMid, aEMid, nWidth, nDashing ); rDev.Pop(); // clipping region diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index cf2351250f75..82ff2bcd7522 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -56,6 +56,7 @@ #include <comphelper/property.hxx> #include <algorithm> +#include <cstdlib> #include <map> using namespace ::svxform; @@ -2302,7 +2303,7 @@ sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute) DBG_ASSERT( !m_pSeekCursor->isAfterLast() && !m_pSeekCursor->isBeforeFirst(), "DbGridControl::SeekCursor: how did the seek cursor get to this position?!" ); nSteps = nRow - (m_pSeekCursor->getRow() - 1); - bAbsolute = bAbsolute || (abs(nSteps) > 100); + bAbsolute = bAbsolute || (std::abs(nSteps) > 100); } if ( bAbsolute ) diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 8dc0ef5d85fd..e9ef92837d4a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -517,22 +517,22 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx") if( aStyleCommandName.equals( "margin-left" ) ) { float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat(); - CPPUNIT_ASSERT_EQUAL(0, abs(97.6 - fValue)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(97.6, fValue, 0.1); } else if( aStyleCommandName.equals( "margin-top" ) ) { float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat(); - CPPUNIT_ASSERT_EQUAL(0, abs(165 - fValue)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(165.0, fValue, 0.2); } else if( aStyleCommandName.equals( "width" ) ) { float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat(); - CPPUNIT_ASSERT_EQUAL(0, abs(283.4 - fValue)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(283.4, fValue, 0.1); } else if( aStyleCommandName.equals( "height" ) ) { float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat(); - CPPUNIT_ASSERT_EQUAL(0, abs(141.7 - fValue)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(141.7, fValue, 0.1); } } while( nextTokenPos != -1 ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 79aa45d61e47..05ec96d4aebb 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -52,6 +52,7 @@ #include <switerator.hxx> #include <comphelper/string.hxx> +#include <cstdlib> #include <map> namespace { @@ -1758,7 +1759,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) else { // Impossible to move to negative index - if( sal_uLong(abs( nOffset )) > nStIdx) + if( sal_uLong(std::abs( nOffset )) > nStIdx) return false; nInEndIdx = nStIdx - 1; diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 4a7f4e552ebf..4cd0278c30ed 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -79,6 +79,7 @@ #include <unochart.hxx> #include <node.hxx> #include <ndtxt.hxx> +#include <cstdlib> #include <map> #include <algorithm> #include <rootfrm.hxx> @@ -2516,7 +2517,7 @@ struct FuzzyCompare bool FuzzyCompare::operator() ( long s1, long s2 ) const { - return ( s1 < s2 && abs( s1 - s2 ) > ROWFUZZY ); + return ( s1 < s2 && std::abs( s1 - s2 ) > ROWFUZZY ); } static bool lcl_IsFrmInColumn( const SwCellFrm& rFrm, SwSelBoxes& rBoxes ) @@ -2801,7 +2802,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur const long nNewRowHeight = nNewRowEnd - nNewRowStart; const long nDiff = nNewRowHeight - nOldRowHeight; - if ( abs( nDiff ) >= ROWFUZZY ) + if ( std::abs( nDiff ) >= ROWFUZZY ) { // For the old table model pTxtFrm and pLine will be set for every box. // For the new table model pTxtFrm will be set if the box is not covered, @@ -2819,7 +2820,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur { const long nLowerBorder = (pFrm->Frm().*fnRect->fnGetBottom)(); const sal_uLong nTabTop = (pTab->*fnRect->fnGetPrtTop)(); - if ( abs( (*fnRect->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) + if ( std::abs( (*fnRect->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) { if ( !bCurColOnly || pFrm == pBoxFrm ) { diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index ff26c7b2aa65..26a445aa8aba 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -29,6 +29,7 @@ #include <fmtfsize.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <cstdlib> #include <vector> #include <set> #include <list> @@ -2141,7 +2142,7 @@ void SwTable::CheckConsistency() const SAL_WARN_IF( nWidth != nLineWidth, "sw.core", "Different Line Widths: first: " << nLineWidth << " current [" << nCurrLine << "]: " << nWidth); - SAL_WARN_IF( abs(nWidth - nTabSize) > 1 /* how tolerant? */, "sw.core", + SAL_WARN_IF( std::abs(nWidth - nTabSize) > 1 /* how tolerant? */, "sw.core", "Line width differs from table width: " << nTabSize << " current [" << nCurrLine << "]: " << nWidth); SAL_WARN_IF( nWidth < 0 || nWidth > USHRT_MAX, "sw.core", diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 78362c372566..3bcbb0886c78 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <i18nlangtag/mslangid.hxx> #include <vcl/outdev.hxx> #include <vcl/print.hxx> @@ -348,7 +352,7 @@ sal_uInt16 SwFntObj::GetFontHeight( const SwViewShell* pSh, const OutputDevice& long nTmpPrtHeight = (sal_uInt16)aOutMet.GetAscent() + aOutMet.GetDescent(); (void) nTmpPrtHeight; // #i106098#: do not compare with == here due to rounding error - OSL_ENSURE( abs(nTmpPrtHeight - nPrtHeight) < 3, + OSL_ENSURE( std::abs(nTmpPrtHeight - nPrtHeight) < 3, "GetTextHeight != Ascent + Descent" ); #endif diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx index f05fd724c485..503549e159a1 100644 --- a/sw/source/ui/docvw/SidebarWin.cxx +++ b/sw/source/ui/docvw/SidebarWin.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <SidebarWin.hxx> #include <SidebarWinAcc.hxx> #include <PostItMgr.hxx> @@ -462,7 +466,7 @@ void SwSidebarWin::SetPosAndSize() DoResize(); } - if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) ) + if (GetPosPixel().X() != mPosSize.TopLeft().X() || (std::abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) ) { bChange = true; SetPosPixel(mPosSize.TopLeft()); diff --git a/sw/source/ui/sidebar/PageMarginControl.cxx b/sw/source/ui/sidebar/PageMarginControl.cxx index 717a18554f9c..dd3d031c8dff 100644 --- a/sw/source/ui/sidebar/PageMarginControl.cxx +++ b/sw/source/ui/sidebar/PageMarginControl.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include "PageMarginControl.hxx" #include "PagePropertyPanel.hxx" #include "PagePropertyPanel.hrc" @@ -259,34 +263,34 @@ void PageMarginControl::SelectValueSetItem() { const long cTolerance = 5; - if( abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + if( std::abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance && !mbMirrored ) { mpMarginValueSet->SelectItem(1); } - else if( abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + else if( std::abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && !mbMirrored ) { mpMarginValueSet->SelectItem(2); } - else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && - abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && - abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + else if( std::abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + std::abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + std::abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && !mbMirrored ) { mpMarginValueSet->SelectItem(3); } - else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance && - abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + else if( std::abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance && + std::abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && mbMirrored ) { mpMarginValueSet->SelectItem(4); diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx index 156a1cb03429..a5d02386cb52 100644 --- a/sw/source/ui/sidebar/PagePropertyPanel.cxx +++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include "PagePropertyPanel.hxx" #include "PagePropertyPanel.hrc" @@ -566,31 +570,31 @@ void PagePropertyPanel::ChangeMarginImage() const long cTolerance = 5; const sal_uInt16 nIdMargin = mpToolBoxMargin->GetItemId(UNO_MARGIN); - if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance && - abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance && + if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance && + std::abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance && mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgNarrow_L : mImgNarrow ); - else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance && - abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance && + else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance && + std::abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance && mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgNormal_L : mImgNormal ); - else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance && - abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance && - abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance && + std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance && + std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgWide_L : mImgWide ); - else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance && - abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && - abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance && + std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + std::abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR ) mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgMirrored_L : mImgMirrored ); diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx index e7bb64467c10..9988ea8001ee 100644 --- a/vcl/generic/print/common_gfx.cxx +++ b/vcl/generic/print/common_gfx.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> #include "psputil.hxx" #include "glyphset.hxx" @@ -194,8 +197,8 @@ PrinterGfx::JoinVerticalClipRectangles( std::list< Rectangle >::iterator& it, ) { if( aLastRect.GetHeight() > 1 || - abs( aLastRect.Left() - nextit->Left() ) > 2 || - abs( aLastRect.Right() - nextit->Right() ) > 2 + std::abs( aLastRect.Left() - nextit->Left() ) > 2 || + std::abs( aLastRect.Right() - nextit->Right() ) > 2 ) { leftside.push_back( Point( aLastRect.Left(), aLastRect.Bottom()+1 ) ); diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 6274cfc8883e..4d6063f744b4 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <tools/debug.hxx> #include <vcl/svapp.hxx> @@ -714,7 +718,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) pWin->ImplGetWindow()->IsTopWindow() && pWin->mpWindowImpl->mbReallyVisible ) { SalFrameGeometry g = pWin->mpWindowImpl->mpFrame->GetGeometry(); - if( abs(g.nX-aState.mnX) < 2 && abs(g.nY-aState.mnY) < 5 ) + if( std::abs(g.nX-aState.mnX) < 2 && std::abs(g.nY-aState.mnY) < 5 ) { long displacement = g.nTopDecoration ? g.nTopDecoration : 20; if( (unsigned long) (aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > (unsigned long) aDesktop.Right() || diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index f74950946f9a..77c0e3d1b9cb 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -45,6 +45,7 @@ #include <svsys.h> #endif +#include <cstdlib> #include <string.h> #include <vector> #include <math.h> @@ -2206,11 +2207,11 @@ Size ToolBox::ImplGetOptimalFloatingSize() return aSize2; // set the size with the smallest delta as the current size - long dx1 = abs( mnDX - aSize1.Width() ); - long dy1 = abs( mnDY - aSize1.Height() ); + long dx1 = std::abs( mnDX - aSize1.Width() ); + long dy1 = std::abs( mnDY - aSize1.Height() ); - long dx2 = abs( mnDX - aSize2.Width() ); - long dy2 = abs( mnDY - aSize2.Height() ); + long dx2 = std::abs( mnDX - aSize2.Width() ); + long dy2 = std::abs( mnDY - aSize2.Height() ); if( dx1*dy1 < dx2*dy2 ) aCurrentSize = aSize1; diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 4072e835cad6..0e5a3ce8ce39 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> #include "unx/saldisp.hxx" #include "unx/saldata.hxx" @@ -1246,7 +1249,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor > it = m_aSelections.find( selection ); if( it != m_aSelections.end() && it->second->m_aTypes.getLength() && - abs( it->second->m_nLastTimestamp - time( NULL ) ) < 2 + std::abs( it->second->m_nLastTimestamp - time( NULL ) ) < 2 ) { rTypes = it->second->m_aTypes; |