summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx8
-rw-r--r--sw/source/core/doc/docnum.cxx3
-rw-r--r--sw/source/core/docnode/ndtbl.cxx7
-rw-r--r--sw/source/core/table/swnewtable.cxx3
-rw-r--r--sw/source/core/txtnode/fntcache.cxx6
-rw-r--r--sw/source/ui/docvw/SidebarWin.cxx6
-rw-r--r--sw/source/ui/sidebar/PageMarginControl.cxx36
-rw-r--r--sw/source/ui/sidebar/PagePropertyPanel.cxx36
8 files changed, 62 insertions, 43 deletions
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 );