editeng/inc/editdoc.hxx                               |   28 +-
 editeng/qa/items/borderline_test.cxx                  |   46 ++--
 editeng/source/accessibility/AccessibleStringWrap.cxx |    2 
 editeng/source/editeng/editdoc.cxx                    |   12 -
 editeng/source/editeng/editeng.cxx                    |   26 +-
 editeng/source/editeng/editobj2.hxx                   |    2 
 editeng/source/editeng/editundo.cxx                   |    8 
 editeng/source/editeng/editview.cxx                   |   12 -
 editeng/source/editeng/eehtml.cxx                     |    2 
 editeng/source/editeng/eertfpar.cxx                   |    8 
 editeng/source/editeng/impedit.cxx                    |   60 ++---
 editeng/source/editeng/impedit.hxx                    |   46 ++--
 editeng/source/editeng/impedit2.cxx                   |   78 +++----
 editeng/source/editeng/impedit3.cxx                   |  198 +++++++++---------
 editeng/source/editeng/impedit4.cxx                   |    6 
 editeng/source/items/borderline.cxx                   |   14 -
 editeng/source/items/frmitems.cxx                     |   64 ++---
 editeng/source/items/itemtype.cxx                     |    4 
 editeng/source/items/numitem.cxx                      |   10 
 editeng/source/items/paperinf.cxx                     |    2 
 editeng/source/items/svxfont.cxx                      |   28 +-
 editeng/source/items/textitem.cxx                     |   16 -
 editeng/source/misc/txtrange.cxx                      |   74 +++---
 editeng/source/outliner/outleeng.cxx                  |    6 
 editeng/source/outliner/outleeng.hxx                  |    6 
 editeng/source/outliner/outliner.cxx                  |   14 -
 editeng/source/outliner/outlvw.cxx                    |    6 
 editeng/source/rtf/rtfitem.cxx                        |    2 
 editeng/source/uno/unofored.cxx                       |    4 
 editeng/source/uno/unoforou.cxx                       |    4 
 include/editeng/borderline.hxx                        |   15 -
 include/editeng/boxitem.hxx                           |    4 
 include/editeng/bulletitem.hxx                        |    6 
 include/editeng/editeng.hxx                           |   12 -
 include/editeng/editview.hxx                          |    4 
 include/editeng/fhgtitem.hxx                          |    2 
 include/editeng/itemtype.hxx                          |    4 
 include/editeng/kernitem.hxx                          |    2 
 include/editeng/lineitem.hxx                          |    2 
 include/editeng/lrspitem.hxx                          |   36 +--
 include/editeng/numitem.hxx                           |   18 -
 include/editeng/outliner.hxx                          |   16 -
 include/editeng/paperinf.hxx                          |    4 
 include/editeng/shaditem.hxx                          |    2 
 include/editeng/sizeitem.hxx                          |   10 
 include/editeng/svxfont.hxx                           |    7 
 include/editeng/ulspitem.hxx                          |    2 
 47 files changed, 468 insertions(+), 466 deletions(-)

New commits:
commit f886d9cacba197cb92a75317fe7d24280dff6436
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Mon Oct 19 15:13:24 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Oct 20 10:08:05 2020 +0200

    use tools::Long in editeng
    
    Change-Id: Ib7014c353489461ad9489d9f3fefd59a32f8f877
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104524
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index f4ef714999e9..4b4f610772a5 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -350,10 +350,10 @@ namespace o3tl {
 
 struct ExtraPortionInfo
 {
-    long    nOrgWidth;
-    long    nWidthFullCompression;
+    tools::Long    nOrgWidth;
+    tools::Long    nWidthFullCompression;
 
-    long    nPortionOffsetX;
+    tools::Long    nPortionOffsetX;
 
     sal_uInt16  nMaxCompression100thPercent;
 
@@ -368,7 +368,7 @@ struct ExtraPortionInfo
             ExtraPortionInfo();
             ~ExtraPortionInfo();
 
-    void    SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen );
+    void    SaveOrgDXArray( const tools::Long* pDXArray, sal_Int32 nLen );
 };
 
 
@@ -461,8 +461,8 @@ public:
 
 private:
     CharPosArrayType aPositions;
-    long            nTxtWidth;
-    long            nStartPosX;
+    tools::Long            nTxtWidth;
+    tools::Long            nStartPosX;
     sal_Int32          nStart;     // could be replaced by nStartPortion
     sal_Int32          nEnd;       // could be replaced by nEndPortion
     sal_Int32          nStartPortion;
@@ -504,8 +504,8 @@ public:
     sal_uInt16      GetHeight() const               { return nHeight; }
     sal_uInt16      GetTxtHeight() const            { return nTxtHeight; }
 
-    void            SetTextWidth( long n )          { nTxtWidth = n; }
-    long            GetTextWidth() const            { return nTxtWidth; }
+    void            SetTextWidth( tools::Long n )          { nTxtWidth = n; }
+    tools::Long            GetTextWidth() const            { return nTxtWidth; 
}
 
     void            SetMaxAscent( sal_uInt16 n )        { nMaxAscent = n; }
     sal_uInt16      GetMaxAscent() const            { return nMaxAscent; }
@@ -515,8 +515,8 @@ public:
 
     sal_Int32       GetLen() const                  { return nEnd - nStart; }
 
-    long            GetStartPosX() const            { return nStartPosX; }
-    void            SetStartPosX( long start );
+    tools::Long            GetStartPosX() const            { return 
nStartPosX; }
+    void            SetStartPosX( tools::Long start );
     Size            CalcTextSize( ParaPortion& rParaPortion );
 
     bool            IsInvalid() const               { return bInvalid; }
@@ -566,7 +566,7 @@ private:
     EditLineList        aLineList;
     TextPortionList     aTextPortionList;
     ContentNode*        pNode;
-    long                nHeight;
+    tools::Long                nHeight;
 
     ScriptTypePosInfos      aScriptInfos;
     WritingDirectionInfos   aWritingDirectionInfos;
@@ -610,7 +610,7 @@ public:
 
     bool                IsEmpty() { return GetTextPortions().Count() == 1 && 
GetTextPortions()[0].GetLen() == 0; }
 
-    long                GetHeight() const           { return ( bVisible ? 
nHeight : 0 ); }
+    tools::Long                GetHeight() const           { return ( bVisible 
? nHeight : 0 ); }
     sal_Int32           GetFirstLineOffset() const  { return ( bVisible ? 
nFirstLineOffset : 0 ); }
     void                ResetHeight()   { nHeight = 0; nFirstLineOffset = 0; }
 
@@ -638,8 +638,8 @@ public:
                     ~ParaPortionList();
 
     void            Reset();
-    long GetYOffset(const ParaPortion* pPPortion) const;
-    sal_Int32 FindParagraph(long nYOffset) const;
+    tools::Long GetYOffset(const ParaPortion* pPPortion) const;
+    sal_Int32 FindParagraph(tools::Long nYOffset) const;
 
     const ParaPortion* SafeGetObject(sal_Int32 nPos) const;
     ParaPortion* SafeGetObject(sal_Int32 nPos);
diff --git a/editeng/qa/items/borderline_test.cxx 
b/editeng/qa/items/borderline_test.cxx
index a44c2927d4cb..0499c7087984 100644
--- a/editeng/qa/items/borderline_test.cxx
+++ b/editeng/qa/items/borderline_test.cxx
@@ -16,15 +16,15 @@
 
 using namespace ::com::sun::star::table::BorderLineStyle;
 
-#define TEST_WIDTH long( 40 )
+#define TEST_WIDTH tools::Long( 40 )
 
-#define THINTHICKSG_IN_WIDTH long( 15 )
-#define THINTHICKSG_OUT_WIDTH long( 40 )
-#define THINTHICKSG_DIST_WIDTH long( 15 )
+#define THINTHICKSG_IN_WIDTH tools::Long( 15 )
+#define THINTHICKSG_OUT_WIDTH tools::Long( 40 )
+#define THINTHICKSG_DIST_WIDTH tools::Long( 15 )
 
-#define THINTHICKLG_IN_WIDTH long( 15 )
-#define THINTHICKLG_OUT_WIDTH long( 30 )
-#define THINTHICKLG_DIST_WIDTH long( 40 )
+#define THINTHICKLG_IN_WIDTH tools::Long( 15 )
+#define THINTHICKLG_OUT_WIDTH tools::Long( 30 )
+#define THINTHICKLG_DIST_WIDTH tools::Long( 40 )
 
 using namespace editeng;
 
@@ -77,9 +77,9 @@ void BorderLineTest::testGuessWidthDouble()
     SvxBorderLine line;
     line.GuessLinesWidths( SvxBorderLineStyle::DOUBLE, TEST_WIDTH, TEST_WIDTH, 
TEST_WIDTH );
     CPPUNIT_ASSERT_EQUAL( SvxBorderLineStyle::DOUBLE, 
line.GetBorderLineStyle() );
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetOutWidth()) );
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetInWidth()) );
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, static_cast<long>(line.GetDistance()) );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, 
static_cast<tools::Long>(line.GetOutWidth()) );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, 
static_cast<tools::Long>(line.GetInWidth()) );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH, 
static_cast<tools::Long>(line.GetDistance()) );
     CPPUNIT_ASSERT_EQUAL( 3*TEST_WIDTH, line.GetWidth() );
 }
 
@@ -89,10 +89,10 @@ void BorderLineTest::testGuessWidthNoMatch()
     line.GuessLinesWidths( SvxBorderLineStyle::DOUBLE,
             TEST_WIDTH + 1, TEST_WIDTH + 2, TEST_WIDTH + 3 );
     CPPUNIT_ASSERT_EQUAL( SvxBorderLineStyle::DOUBLE, 
line.GetBorderLineStyle() );
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+1, static_cast<long>(line.GetOutWidth()) 
);
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+2, static_cast<long>(line.GetInWidth()) );
-    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+3, static_cast<long>(line.GetDistance()));
-    CPPUNIT_ASSERT_EQUAL( long( (3 * TEST_WIDTH) + 6 ), line.GetWidth() );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+1, 
static_cast<tools::Long>(line.GetOutWidth()) );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+2, 
static_cast<tools::Long>(line.GetInWidth()) );
+    CPPUNIT_ASSERT_EQUAL( TEST_WIDTH+3, 
static_cast<tools::Long>(line.GetDistance()));
+    CPPUNIT_ASSERT_EQUAL( tools::Long( (3 * TEST_WIDTH) + 6 ), line.GetWidth() 
);
 }
 
 void BorderLineTest::testGuessWidthThinthickSmallgap()
@@ -104,11 +104,11 @@ void BorderLineTest::testGuessWidthThinthickSmallgap()
             THINTHICKSG_DIST_WIDTH );
     CPPUNIT_ASSERT_EQUAL( SvxBorderLineStyle::THINTHICK_SMALLGAP, 
line.GetBorderLineStyle() );
     CPPUNIT_ASSERT_EQUAL( THINTHICKSG_OUT_WIDTH,
-            static_cast<long>(line.GetOutWidth()) );
+            static_cast<tools::Long>(line.GetOutWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKSG_IN_WIDTH,
-            static_cast<long>(line.GetInWidth()) );
+            static_cast<tools::Long>(line.GetInWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKSG_DIST_WIDTH,
-            static_cast<long>(line.GetDistance()) );
+            static_cast<tools::Long>(line.GetDistance()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKSG_OUT_WIDTH + THINTHICKSG_IN_WIDTH
             + THINTHICKSG_DIST_WIDTH, line.GetWidth() );
 }
@@ -122,11 +122,11 @@ void BorderLineTest::testGuessWidthThinthickLargegap()
             THINTHICKLG_DIST_WIDTH );
     CPPUNIT_ASSERT_EQUAL( SvxBorderLineStyle::THINTHICK_LARGEGAP, 
line.GetBorderLineStyle() );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH,
-            static_cast<long>(line.GetOutWidth()) );
+            static_cast<tools::Long>(line.GetOutWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_IN_WIDTH,
-            static_cast<long>(line.GetInWidth()) );
+            static_cast<tools::Long>(line.GetInWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_DIST_WIDTH,
-            static_cast<long>(line.GetDistance()) );
+            static_cast<tools::Long>(line.GetDistance()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH + THINTHICKLG_IN_WIDTH
             + THINTHICKLG_DIST_WIDTH, line.GetWidth() );
 }
@@ -140,11 +140,11 @@ void BorderLineTest::testGuessWidthNostyleDouble()
             THINTHICKLG_DIST_WIDTH );
     CPPUNIT_ASSERT_EQUAL( SvxBorderLineStyle::THINTHICK_LARGEGAP, 
line.GetBorderLineStyle() );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH,
-            static_cast<long>(line.GetOutWidth()) );
+            static_cast<tools::Long>(line.GetOutWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_IN_WIDTH,
-            static_cast<long>(line.GetInWidth()) );
+            static_cast<tools::Long>(line.GetInWidth()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_DIST_WIDTH,
-            static_cast<long>(line.GetDistance()) );
+            static_cast<tools::Long>(line.GetDistance()) );
     CPPUNIT_ASSERT_EQUAL( THINTHICKLG_OUT_WIDTH + THINTHICKLG_IN_WIDTH
             + THINTHICKLG_DIST_WIDTH, line.GetWidth() );
 }
diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx 
b/editeng/source/accessibility/AccessibleStringWrap.cxx
index ccc4546e04df..a2439705a7fd 100644
--- a/editeng/source/accessibility/AccessibleStringWrap.cxx
+++ b/editeng/source/accessibility/AccessibleStringWrap.cxx
@@ -54,7 +54,7 @@ void AccessibleStringWrap::GetCharacterBounds( sal_Int32 
nIndex, tools::Rectangl
     }
     else
     {
-        long aXArray[2];
+        tools::Long aXArray[2];
         mrDev.GetCaretPositions( maText, aXArray, nIndex, 1 );
         rRect.SetLeft( 0 );
         rRect.SetTop( 0 );
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 75b9ef827cb3..454fc460849a 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -493,7 +493,7 @@ ExtraPortionInfo::~ExtraPortionInfo()
 {
 }
 
-void ExtraPortionInfo::SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen )
+void ExtraPortionInfo::SaveOrgDXArray( const tools::Long* pDXArray, sal_Int32 
nLen )
 {
     if (pDXArray)
     {
@@ -752,9 +752,9 @@ void ParaPortionList::Reset()
     maPortions.clear();
 }
 
-long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
+tools::Long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const
 {
-    long nHeight = 0;
+    tools::Long nHeight = 0;
     for (const auto & rPortion : maPortions)
     {
         const ParaPortion* pTmpPortion = rPortion.get();
@@ -766,9 +766,9 @@ long ParaPortionList::GetYOffset(const ParaPortion* 
pPPortion) const
     return nHeight;
 }
 
-sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const
+sal_Int32 ParaPortionList::FindParagraph(tools::Long nYOffset) const
 {
-    long nY = 0;
+    tools::Long nY = 0;
     for (size_t i = 0, n = maPortions.size(); i < n; ++i)
     {
         nY += maPortions[i]->GetHeight(); // should also be correct even in 
bVisible!
@@ -999,7 +999,7 @@ void EditLine::SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH )
     nTxtHeight = ( nTxtH ? nTxtH : nH );
 }
 
-void EditLine::SetStartPosX( long start )
+void EditLine::SetStartPosX( tools::Long start )
 {
     if (start > 0)
         nStartPosX = start;
diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 03836af7b511..071f78947b2f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -261,8 +261,8 @@ void EditEngine::Draw( OutputDevice* pOutDev, const 
tools::Rectangle& rOutRect,
     {
         // Clip only if necessary...
         if ( rStartDocPos.X() || rStartDocPos.Y() ||
-             ( rOutRect.GetHeight() < static_cast<long>(GetTextHeight()) ) ||
-             ( rOutRect.GetWidth() < static_cast<long>(CalcTextWidth()) ) )
+             ( rOutRect.GetHeight() < 
static_cast<tools::Long>(GetTextHeight()) ) ||
+             ( rOutRect.GetWidth() < static_cast<tools::Long>(CalcTextWidth()) 
) )
         {
             // Some printer drivers cause problems if characters graze the
             // ClipRegion, therefore rather add a pixel more ...
@@ -846,7 +846,7 @@ EditSelection EditEngine::SelectWord(
     return pImpEditEngine->SelectWord(rCurSelection, nWordType);
 }
 
-long EditEngine::GetXPos(
+tools::Long EditEngine::GetXPos(
         const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 
nIndex, bool bPreferPortionStart) const
 {
     return pImpEditEngine->GetXPos(pParaPortion, pLine, nIndex, 
bPreferPortionStart);
@@ -1030,10 +1030,10 @@ bool EditEngine::PostKeyEvent( const KeyEvent& 
rKeyEvent, EditView* pEditView, v
                     sal_Int32 nParas = GetParagraphCount();
                     Point aPos;
                     Point aViewStart( pEditView->GetOutputArea().TopLeft() );
-                    long n20 = 40 * pImpEditEngine->nOnePixelInRef;
+                    tools::Long n20 = 40 * pImpEditEngine->nOnePixelInRef;
                     for ( sal_Int32 n = 0; n < nParas; n++ )
                     {
-                        long nH = GetTextHeight( n );
+                        tools::Long nH = GetTextHeight( n );
                         Point P1( aViewStart.X() + n20 + n20*(n%2), 
aViewStart.Y() + aPos.Y() );
                         Point P2( P1 );
                         P2.AdjustX(n20 );
@@ -1887,7 +1887,7 @@ void EditEngine::SetControlWord( EEControlBits nWord )
     }
     else
     {
-        long nY = 0;
+        tools::Long nY = 0;
         sal_Int32 nNodes = pImpEditEngine->GetEditDoc().Count();
         for ( sal_Int32 n = 0; n < nNodes; n++ )
         {
@@ -1915,10 +1915,10 @@ EEControlBits EditEngine::GetControlWord() const
     return pImpEditEngine->aStatus.GetControlWord();
 }
 
-long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph )
+tools::Long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph )
 {
 
-    long nX = 0;
+    tools::Long nX = 0;
     const ParaPortion* pPPortion = 
pImpEditEngine->GetParaPortions().SafeGetObject( nParagraph );
     if ( pPPortion )
     {
@@ -2007,7 +2007,7 @@ bool EditEngine::IsTextPos( const Point& rPaperPos, 
sal_uInt16 nBorder )
     // take unrotated positions for calculation here
     Point aDocPos = GetDocPos( rPaperPos );
 
-    if ( ( aDocPos.Y() > 0  ) && ( aDocPos.Y() < 
static_cast<long>(pImpEditEngine->GetTextHeight()) ) )
+    if ( ( aDocPos.Y() > 0  ) && ( aDocPos.Y() < 
static_cast<tools::Long>(pImpEditEngine->GetTextHeight()) ) )
     {
         EditPaM aPaM = pImpEditEngine->GetPaM( aDocPos, false );
         if ( aPaM.GetNode() )
@@ -2377,7 +2377,7 @@ void EditEngine::CompleteOnlineSpelling()
     }
 }
 
-sal_Int32 EditEngine::FindParagraph( long nDocPosY )
+sal_Int32 EditEngine::FindParagraph( tools::Long nDocPosY )
 {
     return pImpEditEngine->GetParaPortions().FindParagraph( nDocPosY );
 }
@@ -2447,14 +2447,14 @@ css::uno::Reference< css::datatransfer::XTransferable >
 // ======================    Virtual Methods    ========================
 
 void EditEngine::DrawingText( const Point&, const OUString&, sal_Int32, 
sal_Int32,
-                              const long*, const SvxFont&, sal_Int32 
/*nPara*/, sal_uInt8 /*nRightToLeft*/,
+                              const tools::Long*, const SvxFont&, sal_Int32 
/*nPara*/, sal_uInt8 /*nRightToLeft*/,
                               const EEngineData::WrongSpellVector*, const 
SvxFieldData*, bool, bool,
                               const css::lang::Locale*, const Color&, const 
Color&)
 
 {
 }
 
-void EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/,
+void EditEngine::DrawingTab( const Point& /*rStartPos*/, tools::Long 
/*nWidth*/,
                              const OUString& /*rChar*/, const SvxFont& 
/*rFont*/,
                              sal_Int32 /*nPara*/, sal_uInt8 /*nRightToLeft*/, 
bool /*bEndOfLine*/,
                              bool /*bEndOfParagraph*/, const Color& 
/*rOverlineColor*/,
@@ -2462,7 +2462,7 @@ void EditEngine::DrawingTab( const Point& /*rStartPos*/, 
long /*nWidth*/,
 {
 }
 
-void EditEngine::PaintingFirstLine( sal_Int32, const Point&, long, const 
Point&, short, OutputDevice* )
+void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, 
const Point&, short, OutputDevice* )
 {
 }
 
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 41bbc5404e50..605571be46cf 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -82,7 +82,7 @@ inline bool XEditAttribute::operator==( const XEditAttribute& 
rCompare ) const
 
 struct XParaPortion
 {
-    long                nHeight;
+    tools::Long                nHeight;
     sal_uInt16          nFirstLineOffset;
 
     EditLineList        aLines;
diff --git a/editeng/source/editeng/editundo.cxx 
b/editeng/source/editeng/editundo.cxx
index 5ab476c98698..714dd1b682ed 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -415,15 +415,15 @@ void EditUndoMoveParagraphs::Undo()
 {
     DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" 
);
     Range aTmpRange( nParagraphs );
-    long nTmpDest = aTmpRange.Min();
+    tools::Long nTmpDest = aTmpRange.Min();
 
-    long nDiff = nDest - aTmpRange.Min();
+    tools::Long nDiff = nDest - aTmpRange.Min();
     aTmpRange.Min() += nDiff;
     aTmpRange.Max() += nDiff;
 
-    if ( nParagraphs.Min() < static_cast<long>(nDest) )
+    if ( nParagraphs.Min() < static_cast<tools::Long>(nDest) )
     {
-        long nLen = aTmpRange.Len();
+        tools::Long nLen = aTmpRange.Len();
         aTmpRange.Min() -= nLen;
         aTmpRange.Max() -= nLen;
     }
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index 6b897a3bdb5c..f13a67870902 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -196,7 +196,7 @@ tools::Rectangle EditView::GetInvalidateRect() const
     else
     {
         tools::Rectangle aRect( pImpEditView->aOutArea );
-        long nMore = pImpEditView->GetWindow()->PixelToLogic( Size( 
pImpEditView->GetInvalidateMore(), 0 ) ).Width();
+        tools::Long nMore = pImpEditView->GetWindow()->PixelToLogic( Size( 
pImpEditView->GetInvalidateMore(), 0 ) ).Width();
         aRect.AdjustLeft( -nMore );
         aRect.AdjustRight(nMore );
         aRect.AdjustTop( -nMore );
@@ -527,7 +527,7 @@ void EditView::HideCursor(bool bDeactivate)
     }
 }
 
-Pair EditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
+Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck 
nRangeCheck )
 {
     return pImpEditView->Scroll( ndX, ndY, nRangeCheck );
 }
@@ -670,12 +670,12 @@ void EditView::MoveParagraphs( Range aParagraphs, 
sal_Int32 nNewPos )
     pImpEditView->pEditEngine->pImpEditEngine->UndoActionEnd();
 }
 
-void EditView::MoveParagraphs( long nDiff )
+void EditView::MoveParagraphs( tools::Long nDiff )
 {
     ESelection aSel = GetSelection();
     Range aRange( aSel.nStartPara, aSel.nEndPara );
     aRange.Justify();
-    long nDest = ( nDiff > 0  ? aRange.Max() : aRange.Min() ) + nDiff;
+    tools::Long nDest = ( nDiff > 0  ? aRange.Max() : aRange.Min() ) + nDiff;
     if ( nDiff > 0 )
         nDest++;
     DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= 
pImpEditView->pEditEngine->GetParagraphCount() ), "MoveParagraphs - wrong 
Parameters!" );
@@ -1429,7 +1429,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& 
rSet, const FontList* pFo
     while( *pWhich )
     {
         SvxFontHeightItem aFontHeightItem( static_cast<const 
SvxFontHeightItem&>(rSet.Get( *pWhich )) );
-        long nHeight = aFontHeightItem.GetHeight();
+        tools::Long nHeight = aFontHeightItem.GetHeight();
         const MapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich );
         nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, 
MapUnit::MapPoint);
 
@@ -1486,7 +1486,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& 
rSet, const FontList* pFo
         {
             nHeight = OutputDevice::LogicToLogic( nHeight, MapUnit::MapPoint, 
eUnit  ) / 10;
 
-            if( nHeight != static_cast<long>(aFontHeightItem.GetHeight()) )
+            if( nHeight != 
static_cast<tools::Long>(aFontHeightItem.GetHeight()) )
             {
                 aFontHeightItem.SetHeight( nHeight );
                 rSet.Put( aFontHeightItem.CloneSetWhich(*pWhich) );
diff --git a/editeng/source/editeng/eehtml.cxx 
b/editeng/source/editeng/eehtml.cxx
index ce5721787ef3..ea38d05d290d 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -602,7 +602,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
     if ( ( eUnit != MapUnit::MapPixel ) && ( eUnit != MapUnit::MapSysFont ) &&
          ( eUnit != MapUnit::MapAppFont ) && ( eUnit != MapUnit::MapRelative ) 
)
     {
-        long nPoints = 10;
+        tools::Long nPoints = 10;
         if ( nHLevel == 1 )
             nPoints = 22;
         else if ( nHLevel == 2 )
diff --git a/editeng/source/editeng/eertfpar.cxx 
b/editeng/source/editeng/eertfpar.cxx
index ea286d4a59ce..a05c3a3b9771 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -319,8 +319,8 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet 
)
             if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( 
aFntHeightIem, false, &pItem ))
             {
                 sal_uInt32 nHeight  = static_cast<const 
SvxFontHeightItem*>(pItem)->GetHeight();
-                long nNewHeight;
-                nNewHeight = OutputDevice::LogicToLogic( 
static_cast<long>(nHeight), gRTFMapUnit, eDestUnit );
+                tools::Long nNewHeight;
+                nNewHeight = OutputDevice::LogicToLogic( 
static_cast<tools::Long>(nHeight), gRTFMapUnit, eDestUnit );
 
                 SvxFontHeightItem aFntHeightItem( nNewHeight, 100, 
aFntHeightIem );
                 aFntHeightItem.SetProp(
@@ -334,8 +334,8 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet 
)
     if( SfxItemState::SET == rSet.GetAttrSet().GetItemState( 
EE_CHAR_ESCAPEMENT, false, &pItem ))
     {
         // the correct one
-        long nEsc = static_cast<const SvxEscapementItem*>(pItem)->GetEsc();
-        long nEscFontHeight = 0;
+        tools::Long nEsc = static_cast<const 
SvxEscapementItem*>(pItem)->GetEsc();
+        tools::Long nEscFontHeight = 0;
         if( ( DFLT_ESC_AUTO_SUPER != nEsc ) && ( DFLT_ESC_AUTO_SUB != nEsc ) )
         {
             nEsc *= 10; //HalfPoints => Twips was embezzled in RTFITEM.CXX!
diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index c879c5ff51c5..411a63766020 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -318,8 +318,8 @@ void ImpEditView::lokSelectionCallback(const 
std::unique_ptr<tools::PolyPolygon>
 
     if (pParent && pParent->GetLOKWindowId() != 0)
     {
-        const long nX = pOutWin->GetOutOffXPixel() - 
pParent->GetOutOffXPixel();
-        const long nY = pOutWin->GetOutOffYPixel() - 
pParent->GetOutOffYPixel();
+        const tools::Long nX = pOutWin->GetOutOffXPixel() - 
pParent->GetOutOffXPixel();
+        const tools::Long nY = pOutWin->GetOutOffYPixel() - 
pParent->GetOutOffYPixel();
 
         std::vector<tools::Rectangle> aRectangles;
         aRegion.GetRegionRectangles(aRectangles);
@@ -532,7 +532,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
         if ( !pTmpPortion->IsVisible() || pTmpPortion->IsInvalid() )
             continue;
 
-        long nParaStart = pEditEngine->GetParaPortions().GetYOffset( 
pTmpPortion );
+        tools::Long nParaStart = pEditEngine->GetParaPortions().GetYOffset( 
pTmpPortion );
         if ( ( nParaStart + pTmpPortion->GetHeight() ) < GetVisDocTop() )
             continue;
         if ( nParaStart > GetVisDocBottom() )
@@ -607,8 +607,8 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 
                     DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, 
"DrawSelectionXOR, Start >= End?" );
 
-                    long nX1 = pEditEngine->GetXPos(pTmpPortion, &rLine, 
nTmpStartIndex, true);
-                    long nX2 = pEditEngine->GetXPos(pTmpPortion, &rLine, 
nTmpEndIndex);
+                    tools::Long nX1 = pEditEngine->GetXPos(pTmpPortion, 
&rLine, nTmpStartIndex, true);
+                    tools::Long nX2 = pEditEngine->GetXPos(pTmpPortion, 
&rLine, nTmpEndIndex);
 
                     Point aPt1( std::min( nX1, nX2 ), aTopLeft.Y() );
                     Point aPt2( std::max( nX1, nX2 ), aBottomRight.Y() );
@@ -1089,7 +1089,7 @@ tools::Rectangle ImpEditView::ImplGetEditCursor(EditPaM& 
aPaM, GetCursorFlags nS
         }
     }
 
-    long nMaxHeight = !IsVertical() ? aOutArea.GetHeight() : 
aOutArea.GetWidth();
+    tools::Long nMaxHeight = !IsVertical() ? aOutArea.GetHeight() : 
aOutArea.GetWidth();
     if ( aEditCursor.GetHeight() > nMaxHeight )
     {
         aEditCursor.SetBottom( aEditCursor.Top() + nMaxHeight - 1 );
@@ -1173,13 +1173,13 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
     {
         // check if scrolling is necessary...
         // if scrolling, then update () and Scroll ()!
-        long nDocDiffX = 0;
-        long nDocDiffY = 0;
+        tools::Long nDocDiffX = 0;
+        tools::Long nDocDiffY = 0;
 
         tools::Rectangle aTmpVisArea( GetVisDocArea() );
         // aTmpOutArea: if OutputArea > Paper width and
         // Text > Paper width ( over large fields )
-        long nMaxTextWidth = !IsVertical() ? 
pEditEngine->pImpEditEngine->GetPaperSize().Width() : 
pEditEngine->pImpEditEngine->GetPaperSize().Height();
+        tools::Long nMaxTextWidth = !IsVertical() ? 
pEditEngine->pImpEditEngine->GetPaperSize().Width() : 
pEditEngine->pImpEditEngine->GetPaperSize().Height();
         if ( aTmpVisArea.GetWidth() > nMaxTextWidth )
             aTmpVisArea.SetRight( aTmpVisArea.Left() + nMaxTextWidth );
 
@@ -1201,7 +1201,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
                 nDocDiffX += GetScrollDiffX();
             else
             {
-                long n = nMaxTextWidth - aEditCursor.Right();
+                tools::Long n = nMaxTextWidth - aEditCursor.Right();
                 // If MapMode != RefMapMode then the EditCursor can go beyond
                 // the paper width!
                 nDocDiffX += ( n > 0 ? n : -n );
@@ -1212,7 +1212,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
             // Scroll right, negative:
             nDocDiffX = aEditCursor.Left() - aTmpVisArea.Left();
             // Can it be a little more?
-            if ( aEditCursor.Left() > ( - static_cast<long>(GetScrollDiffX()) 
) )
+            if ( aEditCursor.Left() > ( - 
static_cast<tools::Long>(GetScrollDiffX()) ) )
                 nDocDiffX -= GetScrollDiffX();
             else
                 nDocDiffX -= aEditCursor.Left();
@@ -1229,8 +1229,8 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 
         if ( nDocDiffX | nDocDiffY )
         {
-            long nDiffX = !IsVertical() ? nDocDiffX : (IsTopToBottom() ? 
-nDocDiffY : nDocDiffY);
-            long nDiffY = !IsVertical() ? nDocDiffY : (IsTopToBottom() ? 
nDocDiffX : -nDocDiffX);
+            tools::Long nDiffX = !IsVertical() ? nDocDiffX : (IsTopToBottom() 
? -nDocDiffY : nDocDiffY);
+            tools::Long nDiffY = !IsVertical() ? nDocDiffY : (IsTopToBottom() 
? nDocDiffX : -nDocDiffX);
 
             if ( nDiffX )
                 pEditEngine->GetInternalEditStatus().GetStatusWord() = 
pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::HSCROLL;
@@ -1253,7 +1253,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
 
     const OutputDevice& rOutDev = GetOutputDevice();
 
-    long nOnePixel = rOutDev.PixelToLogic( Size( 1, 0 ) ).Width();
+    tools::Long nOnePixel = rOutDev.PixelToLogic( Size( 1, 0 ) ).Width();
 
     if ( ( aEditCursor.Top() + nOnePixel >= GetVisDocTop() ) &&
          ( aEditCursor.Bottom() - nOnePixel <= GetVisDocBottom() ) &&
@@ -1268,7 +1268,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
         aCursorSz.AdjustHeight( -1 );
         if ( !aCursorSz.Width() || !aCursorSz.Height() )
         {
-            long nCursorSz = 
rOutDev.GetSettings().GetStyleSettings().GetCursorSize();
+            tools::Long nCursorSz = 
rOutDev.GetSettings().GetStyleSettings().GetCursorSize();
             nCursorSz = rOutDev.PixelToLogic( Size( nCursorSz, 0 ) ).Width();
             if ( !aCursorSz.Width() )
                 aCursorSz.setWidth( nCursorSz );
@@ -1444,7 +1444,7 @@ void ImpEditView::ScrollStateChange()
         pCallbacks->EditViewScrollStateChange();
 }
 
-Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
+Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck 
nRangeCheck )
 {
     DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not 
formatted!" );
     if ( !ndX && !ndY )
@@ -1480,10 +1480,10 @@ Pair ImpEditView::Scroll( long ndX, long ndY, 
ScrollRangeCheck nRangeCheck )
             aNewVisArea.AdjustBottom( -ndX );
         }
     }
-    if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( 
aNewVisArea.Bottom() > 
static_cast<long>(pEditEngine->pImpEditEngine->GetTextHeight()) ) )
+    if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( 
aNewVisArea.Bottom() > 
static_cast<tools::Long>(pEditEngine->pImpEditEngine->GetTextHeight()) ) )
     {
         // GetTextHeight still optimizing!
-        long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - 
aNewVisArea.Bottom(); // negative
+        tools::Long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - 
aNewVisArea.Bottom(); // negative
         aNewVisArea.Move( 0, nDiff );   // could end up in the negative area...
     }
     if ( aNewVisArea.Top() < 0 )
@@ -1508,24 +1508,24 @@ Pair ImpEditView::Scroll( long ndX, long ndY, 
ScrollRangeCheck nRangeCheck )
             aNewVisArea.AdjustRight(ndY );
         }
     }
-    if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( 
aNewVisArea.Right() > 
static_cast<long>(pEditEngine->pImpEditEngine->CalcTextWidth( false )) ) )
+    if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( 
aNewVisArea.Right() > 
static_cast<tools::Long>(pEditEngine->pImpEditEngine->CalcTextWidth( false )) ) 
)
     {
-        long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( false ) - 
aNewVisArea.Right();     // negative
+        tools::Long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( false 
) - aNewVisArea.Right();     // negative
         aNewVisArea.Move( nDiff, 0 );   // could end up in the negative area...
     }
     if ( aNewVisArea.Left() < 0 )
         aNewVisArea.Move( -aNewVisArea.Left(), 0 );
 
     // The difference must be alignt on pixel (due to scroll!)
-    long nDiffX = !IsVertical() ? ( GetVisDocLeft() - aNewVisArea.Left() ) : 
(IsTopToBottom() ? -( GetVisDocTop() - aNewVisArea.Top() ) : (GetVisDocTop() - 
aNewVisArea.Top()));
-    long nDiffY = !IsVertical() ? ( GetVisDocTop() - aNewVisArea.Top() ) : 
(IsTopToBottom() ? (GetVisDocLeft() - aNewVisArea.Left()) : -(GetVisDocTop() - 
aNewVisArea.Top()));
+    tools::Long nDiffX = !IsVertical() ? ( GetVisDocLeft() - 
aNewVisArea.Left() ) : (IsTopToBottom() ? -( GetVisDocTop() - aNewVisArea.Top() 
) : (GetVisDocTop() - aNewVisArea.Top()));
+    tools::Long nDiffY = !IsVertical() ? ( GetVisDocTop() - aNewVisArea.Top() 
) : (IsTopToBottom() ? (GetVisDocLeft() - aNewVisArea.Left()) : 
-(GetVisDocTop() - aNewVisArea.Top()));
 
     Size aDiffs( nDiffX, nDiffY );
     aDiffs = rOutDev.LogicToPixel( aDiffs );
     aDiffs = rOutDev.PixelToLogic( aDiffs );
 
-    long nRealDiffX = aDiffs.Width();
-    long nRealDiffY = aDiffs.Height();
+    tools::Long nRealDiffX = aDiffs.Width();
+    tools::Long nRealDiffY = aDiffs.Height();
 
 
     if ( nRealDiffX || nRealDiffY )
@@ -1837,7 +1837,7 @@ bool ImpEditView::IsBulletArea( const Point& rPos, 
sal_Int32* pPara )
     {
         sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
         tools::Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara );
-        long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
+        tools::Long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
         const ParaPortion* pParaPortion = 
pEditEngine->GetParaPortions()[nPara];
         nY += pParaPortion->GetFirstLineOffset();
         if ( ( aDocPos.Y() > ( nY + aBulletArea.Top() ) ) &&
@@ -2462,8 +2462,8 @@ void ImpEditView::dragOver(const 
css::datatransfer::dnd::DropTargetDragEvent& rD
             bool bAllowScroll = DoAutoScroll();
             if ( bAllowScroll )
             {
-                long nScrollX = 0;
-                long nScrollY = 0;
+                tools::Long nScrollX = 0;
+                tools::Long nScrollY = 0;
                 // Check if in the sensitive area
                 if ( ( (aMousePos.X()-pDragAndDropInfo->nSensibleRange) < 
GetOutputArea().Left() ) && ( ( aMousePos.X() + 
pDragAndDropInfo->nSensibleRange ) > GetOutputArea().Left() ) )
                         nScrollX = GetOutputArea().GetWidth() / SCRLRANGE;
@@ -2491,8 +2491,8 @@ void ImpEditView::dragOver(const 
css::datatransfer::dnd::DropTargetDragEvent& rD
                 ParaPortion* pPPortion = 
pEditEngine->GetParaPortions().SafeGetObject( nPara );
                 if (pPPortion)
                 {
-                    long nDestParaStartY = 
pEditEngine->GetParaPortions().GetYOffset( pPPortion );
-                    long nRel = aDocPos.Y() - nDestParaStartY;
+                    tools::Long nDestParaStartY = 
pEditEngine->GetParaPortions().GetYOffset( pPPortion );
+                    tools::Long nRel = aDocPos.Y() - nDestParaStartY;
                     if ( nRel < ( pPPortion->GetHeight() / 2 ) )
                     {
                         pDragAndDropInfo->nOutlinerDropDest = nPara;
@@ -2526,7 +2526,7 @@ void ImpEditView::dragOver(const 
css::datatransfer::dnd::DropTargetDragEvent& rD
                 tools::Rectangle aEditCursor;
                 if ( pDragAndDropInfo->bOutlinerMode )
                 {
-                    long nDDYPos(0);
+                    tools::Long nDDYPos(0);
                     if ( pDragAndDropInfo->nOutlinerDropDest < 
pEditEngine->GetEditDoc().Count() )
                     {
                         ParaPortion* pPPortion = 
pEditEngine->GetParaPortions().SafeGetObject( 
pDragAndDropInfo->nOutlinerDropDest );
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 91239dd0e1aa..a6ebf55c7ccc 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -222,10 +222,10 @@ public:
     bool IsVertical() const;
     bool IsTopToBottom() const;
 
-    long GetVisDocLeft() const { return maVisDocStartPos.X(); }
-    long GetVisDocTop() const  { return maVisDocStartPos.Y(); }
-    long GetVisDocRight() const  { return maVisDocStartPos.X() + 
(!IsVertical() ? maOutArea.GetWidth() : maOutArea.GetHeight()); }
-    long GetVisDocBottom() const { return maVisDocStartPos.Y() + 
(!IsVertical() ? maOutArea.GetHeight() : maOutArea.GetWidth()); }
+    tools::Long GetVisDocLeft() const { return maVisDocStartPos.X(); }
+    tools::Long GetVisDocTop() const  { return maVisDocStartPos.Y(); }
+    tools::Long GetVisDocRight() const  { return maVisDocStartPos.X() + 
(!IsVertical() ? maOutArea.GetWidth() : maOutArea.GetHeight()); }
+    tools::Long GetVisDocBottom() const { return maVisDocStartPos.Y() + 
(!IsVertical() ? maOutArea.GetHeight() : maOutArea.GetWidth()); }
     tools::Rectangle GetVisDocArea() const;
 
     Point            GetWindowPos(const Point& rDocPos, MapUnit eDocPosUnit) 
const;
@@ -271,7 +271,7 @@ private:
     css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > 
mxDnDListener;
 
 
-    long                nInvMore;
+    tools::Long                nInvMore;
     EVControlBits       nControl;
     sal_uInt32          nTravelXPos;
     GetCursorFlags      nExtraCursorFlags;
@@ -375,10 +375,10 @@ public:
 
     void            SetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = 
rPos; }
 
-    long            GetVisDocLeft() const { return aVisDocStartPos.X(); }
-    long            GetVisDocTop() const { return aVisDocStartPos.Y(); }
-    long            GetVisDocRight() const { return aVisDocStartPos.X() + ( 
!IsVertical() ? aOutArea.GetWidth() : aOutArea.GetHeight() ); }
-    long            GetVisDocBottom() const { return aVisDocStartPos.Y() + ( 
!IsVertical() ? aOutArea.GetHeight() : aOutArea.GetWidth() ); }
+    tools::Long            GetVisDocLeft() const { return aVisDocStartPos.X(); 
}
+    tools::Long            GetVisDocTop() const { return aVisDocStartPos.Y(); }
+    tools::Long            GetVisDocRight() const { return aVisDocStartPos.X() 
+ ( !IsVertical() ? aOutArea.GetWidth() : aOutArea.GetHeight() ); }
+    tools::Long            GetVisDocBottom() const { return 
aVisDocStartPos.Y() + ( !IsVertical() ? aOutArea.GetHeight() : 
aOutArea.GetWidth() ); }
     tools::Rectangle       GetVisDocArea() const;
 
     const EditSelection&  GetEditSelection() const { return aEditSelection; }
@@ -422,7 +422,7 @@ public:
     tools::Rectangle GetEditCursor() const;
 
     void            ShowCursor( bool bGotoCursor, bool bForceVisCursor );
-    Pair            Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck = 
ScrollRangeCheck::NoNegative );
+    Pair            Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck 
nRangeCheck = ScrollRangeCheck::NoNegative );
 
     void        SetInsertMode( bool bInsert );
     bool        IsInsertMode() const            { return !( nControl & 
EVControlBits::OVERWRITE ); }
@@ -616,9 +616,9 @@ private:
 
     EditPaM             GetPaM( Point aDocPos, bool bSmart = true );
     EditPaM             GetPaM( ParaPortion* pPortion, Point aPos, bool bSmart 
);
-    long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, 
sal_Int32 nIndex, bool bPreferPortionStart = false) const;
-    long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* 
pLine, sal_Int32 nTextPortion) const;
-    sal_Int32 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, 
long nX, bool bSmart = true);
+    tools::Long GetXPos(const ParaPortion* pParaPortion, const EditLine* 
pLine, sal_Int32 nIndex, bool bPreferPortionStart = false) const;
+    tools::Long GetPortionXOffset(const ParaPortion* pParaPortion, const 
EditLine* pLine, sal_Int32 nTextPortion) const;
+    sal_Int32 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, 
tools::Long nX, bool bSmart = true);
     Range               GetInvalidYOffsets( ParaPortion* pPortion );
     Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, const 
EditLine* pLine ) const;
 
@@ -644,8 +644,8 @@ private:
     void                RecalcFormatterFontMetrics( FormatterFontMetric& 
rCurMetrics, SvxFont& rFont );
     void                CheckAutoPageSize();
 
-    void                ImpBreakLine( ParaPortion* pParaPortion, EditLine* 
pLine, TextPortion const * pPortion, sal_Int32 nPortionStart, long 
nRemainingWidth, bool bCanHyphenate );
-    void                ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* 
pLine, long nRemainingSpace );
+    void                ImpBreakLine( ParaPortion* pParaPortion, EditLine* 
pLine, TextPortion const * pPortion, sal_Int32 nPortionStart, tools::Long 
nRemainingWidth, bool bCanHyphenate );
+    void                ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* 
pLine, tools::Long nRemainingSpace );
     EditPaM             ImpConnectParagraphs( ContentNode* pLeft, ContentNode* 
pRight, bool bBackward = false );
     EditPaM             ImpDeleteSelection(const EditSelection& rCurSel);
     EditPaM             ImpInsertParaBreak( EditPaM& rPaM, bool 
bKeepEndingAttribs = true );
@@ -700,8 +700,8 @@ private:
     bool                HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) 
const;
 
     bool                ImplCalcAsianCompression( ContentNode* pNode, 
TextPortion* pTextPortion, sal_Int32 nStartPos,
-                                                  long* pDXArray, sal_uInt16 
n100thPercentFromMax, bool bManipulateDXArray );
-    void                ImplExpandCompressedPortions( EditLine* pLine, 
ParaPortion* pParaPortion, long nRemainingWidth );
+                                                  tools::Long* pDXArray, 
sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray );
+    void                ImplExpandCompressedPortions( EditLine* pLine, 
ParaPortion* pParaPortion, tools::Long nRemainingWidth );
 
     void                ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 
nPara, sal_Int32 nIndex );
     LanguageType        ImplCalcDigitLang(LanguageType eCurLang) const;
@@ -723,7 +723,7 @@ private:
     sal_Int32           LogicToTwips( sal_Int32 n );
 
     inline short        GetXValue( short nXValue ) const;
-    inline long         GetXValue( long nXValue ) const;
+    inline tools::Long         GetXValue( tools::Long nXValue ) const;
 
     inline short        GetYValue( short nYValue ) const;
     inline sal_uInt16   GetYValue( sal_uInt16 nYValue ) const;
@@ -737,7 +737,7 @@ private:
     void                SetBackgroundColor( const Color& rColor ) { 
maBackgroundColor = rColor; }
     const Color&        GetBackgroundColor() const { return maBackgroundColor; 
}
 
-    long                CalcVertLineSpacing(Point& rStartPos) const;
+    tools::Long                CalcVertLineSpacing(Point& rStartPos) const;
 
     Color               GetAutoColor() const;
     void                EnableAutoColor( bool b ) { bUseAutoColor = b; }
@@ -1234,11 +1234,11 @@ inline short ImpEditEngine::GetXValue( short nXValue ) 
const
     if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
         return nXValue;
 
-    return static_cast<short>(static_cast<long>(nXValue)*nStretchX/100);
+    return static_cast<short>(static_cast<tools::Long>(nXValue)*nStretchX/100);
 }
 
 
-inline long ImpEditEngine::GetXValue( long nXValue ) const
+inline tools::Long ImpEditEngine::GetXValue( tools::Long nXValue ) const
 {
     if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
         return nXValue;
@@ -1251,7 +1251,7 @@ inline short ImpEditEngine::GetYValue( short nYValue ) 
const
     if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
         return nYValue;
 
-    return static_cast<short>(static_cast<long>(nYValue)*nStretchY/100);
+    return static_cast<short>(static_cast<tools::Long>(nYValue)*nStretchY/100);
 }
 
 inline sal_uInt16 ImpEditEngine::GetYValue( sal_uInt16 nYValue ) const
@@ -1259,7 +1259,7 @@ inline sal_uInt16 ImpEditEngine::GetYValue( sal_uInt16 
nYValue ) const
     if ( !aStatus.DoStretch() || ( nStretchY == 100 ) )
         return nYValue;
 
-    return static_cast<sal_uInt16>(static_cast<long>(nYValue)*nStretchY/100);
+    return 
static_cast<sal_uInt16>(static_cast<tools::Long>(nYValue)*nStretchY/100);
 }
 
 inline PointerStyle ImpEditView::GetPointer()
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 471159845118..a490f3fa39e4 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1115,7 +1115,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView 
const * pEditView, const
             bool bRTLPortion = rTextPortion.IsRightToLeft();
 
             // -1: We are 'behind' the character
-            long nVisPos = static_cast<long>(ubidi_getVisualIndex( pBidi, 
bWasBehind ? nPosInLine-1 : nPosInLine, &nError ));
+            tools::Long nVisPos = 
static_cast<tools::Long>(ubidi_getVisualIndex( pBidi, bWasBehind ? nPosInLine-1 
: nPosInLine, &nError ));
             if ( bVisualToLeft )
             {
                 if ( !bWasBehind || bRTLPortion )
@@ -1230,7 +1230,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, 
EditView const * pView )
     sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
     const EditLine& rLine = pPPortion->GetLines()[nLine];
 
-    long nX;
+    tools::Long nX;
     if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
     {
         nX = GetXPos( pPPortion, &rLine, rPaM.GetIndex() );
@@ -1273,7 +1273,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, 
EditView const * pView )
     OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" );
     sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() );
 
-    long nX;
+    tools::Long nX;
     if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW )
     {
         const EditLine& rLine = pPPortion->GetLines()[nLine];
@@ -1410,7 +1410,7 @@ EditPaM ImpEditEngine::PageDown( const EditPaM& rPaM, 
EditView const * pView )
     Point aBottomRight = aRect.BottomRight();
     aBottomRight.AdjustY(pView->GetVisArea().GetHeight() *9/10 );
     aBottomRight.AdjustX(nOnePixelInRef );
-    long nHeight = GetTextHeight();
+    tools::Long nHeight = GetTextHeight();
     if ( aBottomRight.Y() > nHeight )
     {
         aBottomRight.setY( nHeight-2 );
@@ -1674,7 +1674,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
         rTypes.back().nEndPos = nPos;
 
         nScriptType = _xBI->getScriptType( aText, nPos );
-        long nEndPos = _xBI->endOfScript( aText, nPos, nScriptType );
+        tools::Long nEndPos = _xBI->endOfScript( aText, nPos, nScriptType );
 
         if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == 
rTypes.back().nScriptType ) )
         {
@@ -2096,9 +2096,9 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, 
sal_Int32 nChars )
 EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_Int32 
nNewPos )
 {
     aOldPositions.Justify();
-    bool bValidAction = ( static_cast<long>(nNewPos) < aOldPositions.Min() ) 
|| ( static_cast<long>(nNewPos) > aOldPositions.Max() );
+    bool bValidAction = ( static_cast<tools::Long>(nNewPos) < 
aOldPositions.Min() ) || ( static_cast<tools::Long>(nNewPos) > 
aOldPositions.Max() );
     OSL_ENSURE( bValidAction, "Move in itself?" );
-    OSL_ENSURE( aOldPositions.Max() <= 
static_cast<long>(GetParaPortions().Count()), "totally over it: MoveParagraphs" 
);
+    OSL_ENSURE( aOldPositions.Max() <= 
static_cast<tools::Long>(GetParaPortions().Count()), "totally over it: 
MoveParagraphs" );
 
     EditSelection aSelection;
 
@@ -2152,7 +2152,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range 
aOldPositions, sal_Int32 n
     ParaPortion* pDestPortion = GetParaPortions().SafeGetObject( nNewPos );
 
     ParaPortionList aTmpPortionList;
-    for (long i = aOldPositions.Min(); i <= aOldPositions.Max(); i++  )
+    for (tools::Long i = aOldPositions.Min(); i <= aOldPositions.Max(); i++  )
     {
         // always aOldPositions.Min(), since Remove().
         std::unique_ptr<ParaPortion> pTmpPortion = 
GetParaPortions().Release(aOldPositions.Min());
@@ -3032,7 +3032,7 @@ tools::Rectangle ImpEditEngine::PaMtoEditCursor( EditPaM 
aPaM, GetCursorFlags nF
     OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: 
PaMtoEditCursor" );
 
     tools::Rectangle aEditCursor;
-    long nY = 0;
+    tools::Long nY = 0;
     for ( sal_Int32 nPortion = 0; nPortion < GetParaPortions().Count(); 
nPortion++ )
     {
         ParaPortion* pPortion = GetParaPortions()[nPortion];
@@ -3058,13 +3058,13 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, bool 
bSmart )
 {
     OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: 
GetPaM" );
 
-    long nY = 0;
+    tools::Long nY = 0;
     EditPaM aPaM;
     sal_Int32 nPortion;
     for ( nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
     {
         ParaPortion* pPortion = GetParaPortions()[nPortion];
-        const long nTmpHeight = pPortion->GetHeight();     // should also be 
correct for !bVisible!
+        const tools::Long nTmpHeight = pPortion->GetHeight();     // should 
also be correct for !bVisible!
         nY += nTmpHeight;
         if ( nY > aDocPos.Y() )
         {
@@ -3128,7 +3128,7 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, 
bool bIgnoreExtraSpace
     if ( !IsFormatted() && !IsFormatting() )
         FormatDoc();
 
-    long nMaxWidth = 0;
+    tools::Long nMaxWidth = 0;
 
     // Over all the paragraphs ...
 
@@ -3151,10 +3151,10 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 
nPara, bool bIgnoreExtraSpace
             // width, here not preferred. I general, it is best not leave it
             // to StartPosX, also the right indents have to be taken into
             // account!
-            long nCurWidth = GetXValue( rLRItem.GetTextLeft() + 
nSpaceBeforeAndMinLabelWidth );
+            tools::Long nCurWidth = GetXValue( rLRItem.GetTextLeft() + 
nSpaceBeforeAndMinLabelWidth );
             if ( nLine == 0 )
             {
-                long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() );
+                tools::Long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() 
);
                 nCurWidth -= nFI;
                 if ( pPortion->GetBulletX() > nCurWidth )
                 {
@@ -3696,7 +3696,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, 
Point aDocPos, bool bSmart
     sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == 
SvxInterLineSpaceRule::Fix )
                         ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
 
-    long nY = pPortion->GetFirstLineOffset();
+    tools::Long nY = pPortion->GetFirstLineOffset();
 
     OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" );
 
@@ -3740,7 +3740,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, 
Point aDocPos, bool bSmart
 }
 
 sal_Int32 ImpEditEngine::GetChar(
-    const ParaPortion* pParaPortion, const EditLine* pLine, long nXPos, bool 
bSmart)
+    const ParaPortion* pParaPortion, const EditLine* pLine, tools::Long nXPos, 
bool bSmart)
 {
     OSL_ENSURE( pLine, "No line received: GetChar" );
 
@@ -3752,8 +3752,8 @@ sal_Int32 ImpEditEngine::GetChar(
     for ( sal_Int32 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); 
i++ )
     {
         const TextPortion& rPortion = pParaPortion->GetTextPortions()[i];
-        long nXLeft = GetPortionXOffset( pParaPortion, pLine, i );
-        long nXRight = nXLeft + rPortion.GetSize().Width();
+        tools::Long nXLeft = GetPortionXOffset( pParaPortion, pLine, i );
+        tools::Long nXRight = nXLeft + rPortion.GetSize().Width();
         if ( ( nXLeft <= nXPos ) && ( nXRight >= nXPos ) )
         {
             nChar = nCurIndex;
@@ -3766,8 +3766,8 @@ sal_Int32 ImpEditEngine::GetChar(
                 // ...but check on which side
                 if ( bSmart )
                 {
-                    long nLeftDiff = nXPos-nXLeft;
-                    long nRightDiff = nXRight-nXPos;
+                    tools::Long nLeftDiff = nXPos-nXLeft;
+                    tools::Long nRightDiff = nXRight-nXPos;
                     if ( nRightDiff < nLeftDiff )
                         nChar++;
                 }
@@ -3778,20 +3778,20 @@ sal_Int32 ImpEditEngine::GetChar(
                 sal_Int32 nOffset = -1;
                 sal_Int32 nTmpCurIndex = nChar - pLine->GetStart();
 
-                long nXInPortion = nXPos - nXLeft;
+                tools::Long nXInPortion = nXPos - nXLeft;
                 if ( rPortion.IsRightToLeft() )
                     nXInPortion = nXRight - nXPos;
 
                 // Search in Array...
                 for ( sal_Int32 x = 0; x < nMax; x++ )
                 {
-                    long nTmpPosMax = pLine->GetCharPosArray()[nTmpCurIndex+x];
+                    tools::Long nTmpPosMax = 
pLine->GetCharPosArray()[nTmpCurIndex+x];
                     if ( nTmpPosMax > nXInPortion )
                     {
                         // Check whether this or the previous...
-                        long nTmpPosMin = x ? 
pLine->GetCharPosArray()[nTmpCurIndex+x-1] : 0;
-                        long nDiffLeft = nXInPortion - nTmpPosMin;
-                        long nDiffRight = nTmpPosMax - nXInPortion;
+                        tools::Long nTmpPosMin = x ? 
pLine->GetCharPosArray()[nTmpCurIndex+x-1] : 0;
+                        tools::Long nDiffLeft = nXInPortion - nTmpPosMin;
+                        tools::Long nDiffRight = nTmpPosMax - nXInPortion;
                         OSL_ENSURE( nDiffLeft >= 0, "DiffLeft negative" );
                         OSL_ENSURE( nDiffRight >= 0, "DiffRight negative" );
                         nOffset = ( bSmart && ( nDiffRight < nDiffLeft ) ) ? 
x+1 : x;
@@ -3800,7 +3800,7 @@ sal_Int32 ImpEditEngine::GetChar(
                         // Skip all 0-positions, cheaper than using 
XBreakIterator:
                         if ( nOffset < nMax )
                         {
-                            const long nX = pLine->GetCharPosArray()[nOffset];
+                            const tools::Long nX = 
pLine->GetCharPosArray()[nOffset];
                             while ( ( (nOffset+1) < nMax ) && ( 
pLine->GetCharPosArray()[nOffset+1] == nX ) )
                                 nOffset++;
                         }
@@ -3879,10 +3879,10 @@ Range ImpEditEngine::GetLineXPosStartEnd( const 
ParaPortion* pParaPortion, const
     return aLineXPosStartEnd;
 }
 
-long ImpEditEngine::GetPortionXOffset(
+tools::Long ImpEditEngine::GetPortionXOffset(
     const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 
nTextPortion) const
 {
-    long nX = pLine->GetStartPosX();
+    tools::Long nX = pLine->GetStartPosX();
 
     for ( sal_Int32 i = pLine->GetStartPortion(); i < nTextPortion; i++ )
     {
@@ -3970,7 +3970,7 @@ long ImpEditEngine::GetPortionXOffset(
     return nX;
 }
 
-long ImpEditEngine::GetXPos(
+tools::Long ImpEditEngine::GetXPos(
     const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, 
bool bPreferPortionStart) const
 {
     OSL_ENSURE( pLine, "No line received: GetXPos" );
@@ -3990,11 +3990,11 @@ long ImpEditEngine::GetXPos(
 
     const TextPortion& rPortion = 
pParaPortion->GetTextPortions()[nTextPortion];
 
-    long nX = GetPortionXOffset( pParaPortion, pLine, nTextPortion );
+    tools::Long nX = GetPortionXOffset( pParaPortion, pLine, nTextPortion );
 
     // calc text width, portion size may include CJK/CTL spacing...
     // But the array might not be init yet, if using text ranger this method 
is called within CreateLines()...
-    long nPortionTextWidth = rPortion.GetSize().Width();
+    tools::Long nPortionTextWidth = rPortion.GetSize().Width();
     if ( ( rPortion.GetKind() == PortionKind::TEXT ) && rPortion.GetLen() && 
!GetTextRanger() )
         nPortionTextWidth = pLine->GetCharPosArray()[nTextPortionStart + 
rPortion.GetLen() - 1 - pLine->GetStart()];
 
@@ -4042,7 +4042,7 @@ long ImpEditEngine::GetXPos(
                 }
 
                 // old code restored see #i112788 (which leaves #i74188 
unfixed again)
-                long nPosInPortion = pLine->GetCharPosArray()[nPos];
+                tools::Long nPosInPortion = pLine->GetCharPosArray()[nPos];
 
                 if ( !rPortion.IsRightToLeft() )
                 {
@@ -4062,7 +4062,7 @@ long ImpEditEngine::GetXPos(
                         if ( nType == AsianCompressionFlags::PunctuationRight 
&& !pLine->GetCharPosArray().empty() )
                         {
                             sal_Int32 n = nIndex - nTextPortionStart;
-                            const long* pDXArray = 
pLine->GetCharPosArray().data()+( nTextPortionStart-pLine->GetStart() );
+                            const tools::Long* pDXArray = 
pLine->GetCharPosArray().data()+( nTextPortionStart-pLine->GetStart() );
                             sal_Int32 nCharWidth = ( ( (n+1) < 
rPortion.GetLen() ) ? pDXArray[n] : rPortion.GetSize().Width() )
                                                             - ( n ? 
pDXArray[n-1] : 0 );
                             if ( (n+1) < rPortion.GetLen() )
@@ -4214,7 +4214,7 @@ tools::Rectangle ImpEditEngine::GetEditCursor( 
ParaPortion* pPortion, sal_Int32
                 - Selection...
     */
 
-    long nY = pPortion->GetFirstLineOffset();
+    tools::Long nY = pPortion->GetFirstLineOffset();
 
     const SvxLineSpacingItem& rLSItem = 
pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
     sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == 
SvxInterLineSpaceRule::Fix )
@@ -4259,7 +4259,7 @@ tools::Rectangle ImpEditEngine::GetEditCursor( 
ParaPortion* pPortion, sal_Int32
     aEditCursor.SetBottom( nY-1 );
 
     // Search within the line...
-    long nX;
+    tools::Long nX;
 
     if ( ( nIndex == pLine->GetStart() ) && ( nFlags & 
GetCursorFlags::StartOfLine ) )
     {
@@ -4291,10 +4291,10 @@ void ImpEditEngine::SetValidPaperSize( const Size& 
rNewSz )
 {
     aPaperSize = rNewSz;
 
-    long nMinWidth = aStatus.AutoPageWidth() ? aMinAutoPaperSize.Width() : 0;
-    long nMaxWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : 
0x7FFFFFFF;
-    long nMinHeight = aStatus.AutoPageHeight() ? aMinAutoPaperSize.Height() : 
0;
-    long nMaxHeight = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : 
0x7FFFFFFF;
+    tools::Long nMinWidth = aStatus.AutoPageWidth() ? 
aMinAutoPaperSize.Width() : 0;
+    tools::Long nMaxWidth = aStatus.AutoPageWidth() ? 
aMaxAutoPaperSize.Width() : 0x7FFFFFFF;
+    tools::Long nMinHeight = aStatus.AutoPageHeight() ? 
aMinAutoPaperSize.Height() : 0;
+    tools::Long nMaxHeight = aStatus.AutoPageHeight() ? 
aMaxAutoPaperSize.Height() : 0x7FFFFFFF;
 
     // Minimum/Maximum width:
     if ( aPaperSize.Width() < nMinWidth )
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 0d88eeba800d..23d00bb7dc1b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -91,8 +91,8 @@ struct TabInfo
 
     SvxTabStop  aTabStop;
     sal_Int32   nTabPortion;
-    long        nStartPosX;
-    long        nTabPos;
+    tools::Long        nStartPosX;
+    tools::Long        nTabPos;
 
     TabInfo()
         : bValid(false)
@@ -118,8 +118,8 @@ Point Rotate( const Point& rPoint, short nOrientation, 
const Point& rOrigin )
     aTranslatedPos -= rOrigin;
 
     // Rotation...
-    aRotatedPos.setX( static_cast<long>( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
-    aRotatedPos.setY( static_cast<long>(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
+    aRotatedPos.setX( static_cast<tools::Long>( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
+    aRotatedPos.setY( static_cast<tools::Long>(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
     aTranslatedPos = aRotatedPos;
 
     // Translation...
@@ -152,11 +152,11 @@ AsianCompressionFlags GetCharTypeForCompression( 
sal_Unicode cChar )
 }
 
 static void lcl_DrawRedLines( OutputDevice* pOutDev,
-                              long nFontHeight,
+                              tools::Long nFontHeight,
                               const Point& rPoint,
                               size_t nIndex,
                               size_t nMaxEnd,
-                              const long* pDXArray,
+                              const tools::Long* pDXArray,
                               WrongList const * pWrongs,
                               short nOrientation,
                               const Point& rOrigin,
@@ -164,7 +164,7 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
                               bool bIsRightToLeft )
 {
     // But only if font is not too small...
-    long nHeight = pOutDev->LogicToPixel(Size(0, nFontHeight)).Height();
+    tools::Long nHeight = pOutDev->LogicToPixel(Size(0, nFontHeight)).Height();
     if (WRONG_SHOW_MIN >= nHeight)
         return;
 
@@ -187,8 +187,8 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
         {
             // VCL doesn't know that the text is vertical, and is manipulating
             // the positions a little bit in y direction...
-            long nOnePixel = pOutDev->PixelToLogic(Size(0, 1)).Height();
-            long nCorrect = 2 * nOnePixel;
+            tools::Long nOnePixel = pOutDev->PixelToLogic(Size(0, 1)).Height();
+            tools::Long nCorrect = 2 * nOnePixel;
             aPoint1.AdjustY(-nCorrect);
             aPoint1.AdjustX(-nCorrect);
         }
@@ -244,8 +244,8 @@ static Point lcl_ImplCalcRotatedPos( Point rPos, Point 
rOrigin, double nSin, dou
     Point aTranslatedPos( rPos);
     aTranslatedPos -= rOrigin;
 
-    aRotatedPos.setX( static_cast<long>( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
-    aRotatedPos.setY( static_cast<long>(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
+    aRotatedPos.setX( static_cast<tools::Long>( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
+    aRotatedPos.setY( static_cast<tools::Long>(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
     aTranslatedPos = aRotatedPos;
     // Translation...
     aTranslatedPos += rOrigin;
@@ -371,7 +371,7 @@ void ImpEditEngine::FormatDoc()
     if ( GetStatus().DoOnlineSpelling() )
         StartOnlineSpellTimer();
 
-    long nY = 0;
+    tools::Long nY = 0;
     bool bGrow = false;
 
     // Here already, so that not always in CreateLines...
@@ -416,7 +416,7 @@ void ImpEditEngine::FormatDoc()
             if ( aInvalidRect.IsEmpty() )
             {
                 // For Paperwidth 0 (AutoPageSize) it would otherwise be 
Empty()...
-                long nWidth = std::max( long(1), ( !IsVertical() ? 
aPaperSize.Width() : aPaperSize.Height() ) );
+                tools::Long nWidth = std::max( tools::Long(1), ( !IsVertical() 
? aPaperSize.Width() : aPaperSize.Height() ) );
                 Range aInvRange( GetInvalidYOffsets( pParaPortion ) );
                 aInvalidRect = tools::Rectangle( Point( 0, nY+aInvRange.Min() 
),
                     Size( nWidth, aInvRange.Len() ) );
@@ -438,12 +438,12 @@ void ImpEditEngine::FormatDoc()
     {
         sal_uInt32 nNewHeightNTP;
         sal_uInt32 nNewHeight = CalcTextHeight( &nNewHeightNTP );
-        long nDiff = nNewHeight - nCurTextHeight;
+        tools::Long nDiff = nNewHeight - nCurTextHeight;
         if ( nDiff )
             aStatus.GetStatusWord() |= !IsVertical() ? 
EditStatusFlags::TextHeightChanged : EditStatusFlags::TEXTWIDTHCHANGED;
         if ( nNewHeight < nCurTextHeight )
         {
-            aInvalidRect.SetBottom( static_cast<long>(std::max( nNewHeight, 
nCurTextHeight )) );
+            aInvalidRect.SetBottom( static_cast<tools::Long>(std::max( 
nNewHeight, nCurTextHeight )) );
             if ( aInvalidRect.IsEmpty() )
             {
                 aInvalidRect.SetTop( 0 );
@@ -775,10 +775,10 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
         sal_Int32 nPortionStart = 0;
         sal_Int32 nPortionEnd = 0;
 
-        long nStartX = GetXValue( rLRItem.GetTextLeft() + 
nSpaceBeforeAndMinLabelWidth );
+        tools::Long nStartX = GetXValue( rLRItem.GetTextLeft() + 
nSpaceBeforeAndMinLabelWidth );
         if ( nIndex == 0 )
         {
-            long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() );
+            tools::Long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() );
             nStartX += nFI;
 
             if ( !nLine && ( pParaPortion->GetBulletX() > nStartX ) )
@@ -787,7 +787,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             }
         }
 
-        long nMaxLineWidth;
+        tools::Long nMaxLineWidth;
         if ( !IsVertical() )
             nMaxLineWidth = aStatus.AutoPageWidth() ? 
aMaxAutoPaperSize.Width() : aPaperSize.Width();
         else
@@ -815,18 +815,18 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
         sal_Int32 nTmpPos = nIndex;
         sal_Int32 nTmpPortion = pLine->GetStartPortion();
-        long nTmpWidth = 0;
-        long nXWidth = nMaxLineWidth;
+        tools::Long nTmpWidth = 0;
+        tools::Long nXWidth = nMaxLineWidth;
 
         std::deque<long>* pTextRanges = nullptr;
-        long nTextExtraYOffset = 0;
-        long nTextXOffset = 0;
-        long nTextLineHeight = 0;
+        tools::Long nTextExtraYOffset = 0;
+        tools::Long nTextXOffset = 0;
+        tools::Long nTextLineHeight = 0;
         if ( GetTextRanger() )
         {
             GetTextRanger()->SetVertical( IsVertical() );
 
-            long nTextY = nStartPosY + GetEditCursor( pParaPortion, 
pLine->GetStart() ).Top();
+            tools::Long nTextY = nStartPosY + GetEditCursor( pParaPortion, 
pLine->GetStart() ).Top();
             if ( !bSameLineAgain )
             {
                 SeekCursor( pNode, nTmpPos+1, aTmpFont );
@@ -850,27 +850,27 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             nXWidth = 0;
             while ( !nXWidth )
             {
-                long nYOff = nTextY + nTextExtraYOffset;
-                long nYDiff = nTextLineHeight;
+                tools::Long nYOff = nTextY + nTextExtraYOffset;
+                tools::Long nYDiff = nTextLineHeight;
                 if ( IsVertical() )
                 {
-                    long nMaxPolygonX = 
GetTextRanger()->GetBoundRect().Right();
+                    tools::Long nMaxPolygonX = 
GetTextRanger()->GetBoundRect().Right();
                     nYOff = nMaxPolygonX-nYOff;
                     nYDiff = -nTextLineHeight;
                 }
                 pTextRanges = GetTextRanger()->GetTextRanges( Range( nYOff, 
nYOff + nYDiff ) );
                 DBG_ASSERT( pTextRanges, "GetTextRanges?!" );
-                long nMaxRangeWidth = 0;
+                tools::Long nMaxRangeWidth = 0;
                 // Use the widest range...
                 // The widest range could be a bit confusing, so normally it
                 // is the first one. Best with gaps.
                 assert(pTextRanges->size() % 2 == 0 && "textranges are always 
in pairs");
                 if (!pTextRanges->empty())
                 {
-                    long nA = pTextRanges->at(0);
-                    long nB = pTextRanges->at(1);
+                    tools::Long nA = pTextRanges->at(0);
+                    tools::Long nB = pTextRanges->at(1);
                     DBG_ASSERT( nA <= nB, "TextRange distorted?" );
-                    long nW = nB - nA;
+                    tools::Long nW = nB - nA;
                     if ( nW > nMaxRangeWidth )
                     {
                         nMaxRangeWidth = nW;
@@ -884,7 +884,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 {
                     // Try further down in the polygon.
                     // Below the polygon use the Paper Width.
-                    nTextExtraYOffset += std::max( 
static_cast<long>(nTextLineHeight / 10), long(1) );
+                    nTextExtraYOffset += std::max( 
static_cast<tools::Long>(nTextLineHeight / 10), tools::Long(1) );
                     if ( ( nTextY + nTextExtraYOffset  ) > 
GetTextRanger()->GetBoundRect().Bottom() )
                     {
                         nXWidth = !IsVertical() ? GetPaperSize().Width() : 
GetPaperSize().Height();
@@ -966,17 +966,17 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 {
                     case EE_FEATURE_TAB:
                     {
-                        long nOldTmpWidth = nTmpWidth;
+                        tools::Long nOldTmpWidth = nTmpWidth;
 
                         // Search for Tab-Pos...
-                        long nCurPos = nTmpWidth+nStartX;
+                        tools::Long nCurPos = nTmpWidth+nStartX;
                         // consider scaling
                         if ( aStatus.DoStretch() && ( nStretchX != 100 ) )
                             nCurPos = 
nCurPos*100/std::max(static_cast<sal_Int32>(nStretchX), 
static_cast<sal_Int32>(1));
 
                         short nAllSpaceBeforeText = static_cast< short 
>(rLRItem.GetTextLeft()/* + rLRItem.GetTextLeft()*/ + 
nSpaceBeforeAndMinLabelWidth);
                         aCurrentTab.aTabStop = 
pNode->GetContentAttribs().FindTabStop( nCurPos - nAllSpaceBeforeText 
/*rLRItem.GetTextLeft()*/, aEditDoc.GetDefTab() );
-                        aCurrentTab.nTabPos = GetXValue( static_cast<long>( 
aCurrentTab.aTabStop.GetTabPos() + nAllSpaceBeforeText 
/*rLRItem.GetTextLeft()*/ ) );
+                        aCurrentTab.nTabPos = GetXValue( 
static_cast<tools::Long>( aCurrentTab.aTabStop.GetTabPos() + 
nAllSpaceBeforeText /*rLRItem.GetTextLeft()*/ ) );
                         aCurrentTab.bValid = false;
 
                         // Switch direction in R2L para...
@@ -1180,7 +1180,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 // And now check for Compression:
                 if ( !bContinueLastPortion && nPortionLen && 
GetAsianCompressionMode() != CharCompressType::NONE )
                 {
-                    long* pDXArray = rArray.data() + nTmpPos - 
pLine->GetStart();
+                    tools::Long* pDXArray = rArray.data() + nTmpPos - 
pLine->GetStart();
                     bCompressedChars |= ImplCalcAsianCompression(
                         pNode, pPortion, nTmpPos, pDXArray, 10000, false);
                 }
@@ -1199,7 +1199,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     // No spacing within L2R/R2L nesting
                     if ( bAllow )
                     {
-                        long nExtraSpace = pPortion->GetSize().Height()/5;
+                        tools::Long nExtraSpace = 
pPortion->GetSize().Height()/5;
                         nExtraSpace = GetXValue( nExtraSpace );
                         pPortion->GetSize().AdjustWidth(nExtraSpace );
                         nTmpWidth += nExtraSpace;
@@ -1209,13 +1209,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
             if ( aCurrentTab.bValid && ( nTmpPortion != 
aCurrentTab.nTabPortion ) )
             {
-                long nWidthAfterTab = 0;
+                tools::Long nWidthAfterTab = 0;
                 for ( sal_Int32 n = aCurrentTab.nTabPortion+1; n <= 
nTmpPortion; n++  )
                 {
                     const TextPortion& rTP = 
pParaPortion->GetTextPortions()[n];
                     nWidthAfterTab += rTP.GetSize().Width();
                 }
-                long nW = nWidthAfterTab;   // Length before tab position
+                tools::Long nW = nWidthAfterTab;   // Length before tab 
position
                 if ( aCurrentTab.aTabStop.GetAdjustment() == 
SvxTabAdjust::Right )
                 {
                 }
@@ -1239,7 +1239,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 {
                     OSL_FAIL( "CreateLines: Tab not handled!" );
                 }
-                long nMaxW = aCurrentTab.nTabPos - aCurrentTab.nStartPosX - 
nStartX;
+                tools::Long nMaxW = aCurrentTab.nTabPos - 
aCurrentTab.nStartPosX - nStartX;
                 if ( nW >= nMaxW )
                 {
                     nW = nMaxW;
@@ -1348,12 +1348,12 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
         else if ( !bEOL && !bContinueLastPortion )
         {
             DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == 
pPortion->GetLen()), "However, another portion?!" );
-            long nRemainingWidth = nMaxLineWidth - nTmpWidth;
+            tools::Long nRemainingWidth = nMaxLineWidth - nTmpWidth;
             bool bCanHyphenate = ( aTmpFont.GetCharSet() != 
RTL_TEXTENCODING_SYMBOL );
             if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && 
pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
             {
                 // I need the manipulated DXArray for determining the break 
position...
-                long* pDXArray = pLine->GetCharPosArray().data() + 
(nPortionStart - pLine->GetStart());
+                tools::Long* pDXArray = pLine->GetCharPosArray().data() + 
(nPortionStart - pLine->GetStart());
                 ImplCalcAsianCompression(
                     pNode, pPortion, nPortionStart, pDXArray, 10000, true);
             }
@@ -1422,7 +1422,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                 if ( nTxtHeight < nMinHeight )
                 {
                     // The Ascent has to be adjusted for the difference:
-                    long nDiff = nMinHeight - nTxtHeight;
+                    tools::Long nDiff = nMinHeight - nTxtHeight;
                     pLine->SetMaxAscent( 
static_cast<sal_uInt16>(pLine->GetMaxAscent() + nDiff) );
                     pLine->SetHeight( nMinHeight, nTxtHeight );
                 }
@@ -1456,7 +1456,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
                     sal_uInt16 nTxtHeight = pLine->GetHeight();
                     sal_Int32 nPropTextHeight = nTxtHeight * 
rLSItem.GetPropLineSpace() / 100;
                     // The Ascent has to be adjusted for the difference:
-                    long nDiff = pLine->GetHeight() - nPropTextHeight;
+                    tools::Long nDiff = pLine->GetHeight() - nPropTextHeight;
                     pLine->SetMaxAscent( static_cast<sal_uInt16>( 
pLine->GetMaxAscent() - nDiff ) );
                     pLine->SetHeight( static_cast<sal_uInt16>( nPropTextHeight 
), nTxtHeight );
                 }
@@ -1470,7 +1470,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             // has to be used for the Alignment. If it does not fit or if it
             // will change the paper width, it will be formatted again for
             // Justification! = LEFT anyway.
-            long nMaxLineWidthFix = ( !IsVertical() ? aPaperSize.Width() : 
aPaperSize.Height() )
+            tools::Long nMaxLineWidthFix = ( !IsVertical() ? 
aPaperSize.Width() : aPaperSize.Height() )
                                         - GetXValue( rLRItem.GetRight() ) - 
nStartX;
             if ( aTextSize.Width() < nMaxLineWidthFix )
                 nMaxLineWidth = nMaxLineWidthFix;
@@ -1478,7 +1478,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
         if ( bCompressedChars )
         {
-            long nRemainingWidth = nMaxLineWidth - aTextSize.Width();
+            tools::Long nRemainingWidth = nMaxLineWidth - aTextSize.Width();
             if ( nRemainingWidth > 0 )
             {
                 ImplExpandCompressedPortions( pLine, pParaPortion, 
nRemainingWidth );
@@ -1490,10 +1490,10 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
         {
             // Width from HangingPunctuation was set to 0 in ImpBreakLine,
             // check for rel width now, maybe create compression...
-            long n = nMaxLineWidth - aTextSize.Width();
+            tools::Long n = nMaxLineWidth - aTextSize.Width();
             TextPortion& rTP = 
pParaPortion->GetTextPortions()[pLine->GetEndPortion()];
             sal_Int32 nPosInArray = pLine->GetEnd()-1-pLine->GetStart();
-            long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ 
nPosInArray-1 ] : 0 ) + n;
+            tools::Long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ 
nPosInArray-1 ] : 0 ) + n;
             pLine->GetCharPosArray()[ nPosInArray ] = nNewValue;
             rTP.GetSize().AdjustWidth(n );
         }
@@ -1503,7 +1503,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
         {
             case SvxAdjust::Center:
             {
-                long n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
+                tools::Long n = ( nMaxLineWidth - aTextSize.Width() ) / 2;
                 n += nStartX;  // Indentation is kept.
                 pLine->SetStartPosX( n );
             }
@@ -1512,7 +1512,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             {
                 // For automatically wrapped lines, which has a blank at the 
end
                 // the blank must not be displayed!
-                long n = nMaxLineWidth - aTextSize.Width();
+                tools::Long n = nMaxLineWidth - aTextSize.Width();
                 n += nStartX;  // Indentation is kept.
                 pLine->SetStartPosX( n );
             }
@@ -1520,7 +1520,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
             case SvxAdjust::Block:
             {
                 bool bDistLastLine = (GetJustifyMethod(nPara) == 
SvxCellJustifyMethod::Distribute);
-                long nRemainingSpace = nMaxLineWidth - aTextSize.Width();
+                tools::Long nRemainingSpace = nMaxLineWidth - 
aTextSize.Width();
                 pLine->SetStartPosX( nStartX );
                 if ( nRemainingSpace > 0 && (!bEOC || bDistLastLine) )
                     ImpAdjustBlocks( pParaPortion, pLine, nRemainingSpace );
@@ -1684,7 +1684,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
     sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( 
pParaPortion->GetNode(), &nSpaceBefore );
     const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pParaPortion->GetNode() );
     const SvxLineSpacingItem& rLSItem = 
pParaPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
-    long nStartX = GetXValue( rLRItem.GetTextLeft() + 
rLRItem.GetTextFirstLineOffset() + nSpaceBefore );
+    tools::Long nStartX = GetXValue( rLRItem.GetTextLeft() + 
rLRItem.GetTextFirstLineOffset() + nSpaceBefore );
 
     tools::Rectangle aBulletArea { Point(), Point() };
     if ( bLineBreak )
@@ -1727,7 +1727,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
     {
         sal_Int32 nPara = GetParaPortions().GetPos( pParaPortion );
         SvxAdjust eJustification = GetJustification( nPara );
-        long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : 
aPaperSize.Height();
+        tools::Long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : 
aPaperSize.Height();
         nMaxLineWidth -= GetXValue( rLRItem.GetRight() );
         if ( nMaxLineWidth < 0 )
             nMaxLineWidth = 1;
@@ -1748,7 +1748,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
             if ( nTxtHeight < nMinHeight )
             {
                 // The Ascent has to be adjusted for the difference:
-                long nDiff = nMinHeight - nTxtHeight;
+                tools::Long nDiff = nMinHeight - nTxtHeight;
                 pTmpLine->SetMaxAscent( 
static_cast<sal_uInt16>(pTmpLine->GetMaxAscent() + nDiff) );
                 pTmpLine->SetHeight( nMinHeight, nTxtHeight );
             }
@@ -1775,7 +1775,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
                     nH *= rLSItem.GetPropLineSpace();
                     nH /= 100;
                     // The Ascent has to be adjusted for the difference:
-                    long nDiff = pTmpLine->GetHeight() - nH;
+                    tools::Long nDiff = pTmpLine->GetHeight() - nH;
                     if ( nDiff > pTmpLine->GetMaxAscent() )
                         nDiff = pTmpLine->GetMaxAscent();
                     pTmpLine->SetMaxAscent( 
static_cast<sal_uInt16>(pTmpLine->GetMaxAscent() - nDiff) );
@@ -1787,10 +1787,10 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion )
 
     if ( !bLineBreak )
     {
-        long nMinHeight = aBulletArea.GetHeight();
-        if ( nMinHeight > static_cast<long>(pTmpLine->GetHeight()) )
+        tools::Long nMinHeight = aBulletArea.GetHeight();
+        if ( nMinHeight > static_cast<tools::Long>(pTmpLine->GetHeight()) )
         {
-            long nDiff = nMinHeight - static_cast<long>(pTmpLine->GetHeight());
+            tools::Long nDiff = nMinHeight - 
static_cast<tools::Long>(pTmpLine->GetHeight());
             // distribute nDiff upwards and downwards
             pTmpLine->SetMaxAscent( 
static_cast<sal_uInt16>(pTmpLine->GetMaxAscent() + nDiff/2) );
             pTmpLine->SetHeight( static_cast<sal_uInt16>(nMinHeight) );
@@ -1813,7 +1813,7 @@ bool ImpEditEngine::FinishCreateLines( ParaPortion* 
pParaPortion )
 {
 //  CalcCharPositions( pParaPortion );
     pParaPortion->SetValid();
-    long nOldHeight = pParaPortion->GetHeight();
+    tools::Long nOldHeight = pParaPortion->GetHeight();
     CalcHeight( pParaPortion );
 
     DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "FinishCreateLines: 
No Text-Portion?" );
@@ -1821,7 +1821,7 @@ bool ImpEditEngine::FinishCreateLines( ParaPortion* 
pParaPortion )
     return bRet;
 }
 
-void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, 
TextPortion const * pPortion, sal_Int32 nPortionStart, long nRemainingWidth, 
bool bCanHyphenate )
+void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, 
TextPortion const * pPortion, sal_Int32 nPortionStart, tools::Long 
nRemainingWidth, bool bCanHyphenate )
 {
     ContentNode* const pNode = pParaPortion->GetNode();
 
@@ -2081,7 +2081,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
     pLine->SetEndPortion( nEndPortion );
 }
 
-void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* 
pLine, long nRemainingSpace )
+void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* 
pLine, tools::Long nRemainingSpace )
 {
     DBG_ASSERT( nRemainingSpace > 0, "AdjustBlocks: Somewhat too little..." );
     DBG_ASSERT( pLine, "AdjustBlocks: Line ?!" );
@@ -2145,8 +2145,8 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
         sal_Int32 nPortionStart, nPortion;
         nPortion = pParaPortion->GetTextPortions().FindPortion( nLastChar+1, 
nPortionStart );
         TextPortion& rLastPortion = pParaPortion->GetTextPortions()[ nPortion 
];
-        long nRealWidth = pLine->GetCharPosArray()[nLastChar-nFirstChar];
-        long nBlankWidth = nRealWidth;
+        tools::Long nRealWidth = 
pLine->GetCharPosArray()[nLastChar-nFirstChar];
+        tools::Long nBlankWidth = nRealWidth;
         if ( nLastChar > nPortionStart )
             nBlankWidth -= pLine->GetCharPosArray()[nLastChar-nFirstChar-1];
         // Possibly the blank has already been deducted in ImpBreakLine:
@@ -2162,10 +2162,10 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* 
pParaPortion, EditLine* pLine,
     }
 
     size_t nGaps = aPositions.size();
-    const long nMore4Everyone = nRemainingSpace / nGaps;
-    long nSomeExtraSpace = nRemainingSpace - nMore4Everyone*nGaps;
+    const tools::Long nMore4Everyone = nRemainingSpace / nGaps;
+    tools::Long nSomeExtraSpace = nRemainingSpace - nMore4Everyone*nGaps;
 
-    DBG_ASSERT( nSomeExtraSpace < static_cast<long>(nGaps), "AdjustBlocks: 
ExtraSpace too large" );
+    DBG_ASSERT( nSomeExtraSpace < static_cast<tools::Long>(nGaps), 
"AdjustBlocks: ExtraSpace too large" );
     DBG_ASSERT( nSomeExtraSpace >= 0, "AdjustBlocks: ExtraSpace < 0 " );
 
     // Correct the positions in the Array and the portion widths:
@@ -2797,7 +2797,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, 
sal_Int32 nPos, SvxFont& rFo
                     aRealSz.setWidth( aRealSz.Width() / 100 );
 
                     // Also the Kerning: (long due to handle Interim results)
-                    long nKerning = rFont.GetFixKerning();
+                    tools::Long nKerning = rFont.GetFixKerning();
 /*
   The consideration was: If negative kerning, but StretchX = 200
   => Do not double the kerning, thus pull the letters closer together
@@ -2940,13 +2940,13 @@ void ImpEditEngine::RecalcFormatterFontMetrics( 
FormatterFontMetric& rCurMetrics
     short nDiff = 
static_cast<short>(rFont.GetFontSize().Height()*rFont.GetEscapement()/100);
     if ( rFont.GetEscapement() > 0 )
     {
-        nAscent = 
static_cast<sal_uInt16>(static_cast<long>(nAscent)*nPropr/100 + nDiff);
+        nAscent = 
static_cast<sal_uInt16>(static_cast<tools::Long>(nAscent)*nPropr/100 + nDiff);
         if ( nAscent > rCurMetrics.nMaxAscent )
             rCurMetrics.nMaxAscent = nAscent;
     }
     else    // has to be < 0
     {
-        nDescent = 
static_cast<sal_uInt16>(static_cast<long>(nDescent)*nPropr/100 - nDiff);
+        nDescent = 
static_cast<sal_uInt16>(static_cast<tools::Long>(nDescent)*nPropr/100 - nDiff);
         if ( nDescent > rCurMetrics.nMaxDescent )
             rCurMetrics.nMaxDescent= nDescent;
     }
@@ -2960,8 +2960,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
     if ( !IsFormatted() )
         FormatDoc();
 
-    long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
-    long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
+    tools::Long nFirstVisXPos = - pOutDev->GetMapMode().GetOrigin().X();
+    tools::Long nFirstVisYPos = - pOutDev->GetMapMode().GetOrigin().Y();
 
     const EditLine* pLine = nullptr;
     Point aTmpPos;
@@ -2988,7 +2988,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
     GDIMetaFile* pMtf = pOutDev->GetConnectMetaFile();
     const bool bMetafileValid( pMtf != nullptr );
 
-    long nVertLineSpacing = CalcVertLineSpacing(aStartPos);
+    tools::Long nVertLineSpacing = CalcVertLineSpacing(aStartPos);
 
 
     // Over all the paragraphs...
@@ -3005,7 +3005,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
         if ( pPDFExtOutDevData )
             pPDFExtOutDevData->BeginStructureElement( 
vcl::PDFWriter::Paragraph );
 
-        long nParaHeight = pPortion->GetHeight();
+        tools::Long nParaHeight = pPortion->GetHeight();
         sal_Int32 nIndex = 0;
         if ( pPortion->IsVisible() && (
                 ( !IsVertical() && ( ( aStartPos.Y() + nParaHeight ) > 
aClipRect.Top() ) ) ||
@@ -3102,7 +3102,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                         DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line 
without Textportion in Paint!" );
                         const TextPortion& rTextPortion = 
pPortion->GetTextPortions()[nPortion];
 
-                        long nPortionXOffset = GetPortionXOffset( pPortion, 
pLine, nPortion );
+                        tools::Long nPortionXOffset = GetPortionXOffset( 
pPortion, pLine, nPortion );
                         if ( !IsVertical() )
                         {
                             aTmpPos.setX( aStartPos.X() + nPortionXOffset );
@@ -3174,7 +3174,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                                 OUString aText;
                                 sal_Int32 nTextStart = 0;
                                 sal_Int32 nTextLen = 0;
-                                const long* pDXArray = nullptr;
+                                const tools::Long* pDXArray = nullptr;
                                 std::unique_ptr<long[]> pTmpDXArray;
 
                                 if ( rTextPortion.GetKind() == 
PortionKind::TEXT )
@@ -3203,12 +3203,12 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
 
                                             if ( 0x200B == cChar || 0x2060 == 
cChar )
                                             {
-                                                long nHalfBlankWidth = 
aTmpFont.QuickGetTextSize( pOutDev, " ", 0, 1 ).Width() / 2;
+                                                tools::Long nHalfBlankWidth = 
aTmpFont.QuickGetTextSize( pOutDev, " ", 0, 1 ).Width() / 2;
 
-                                                const long nAdvanceX = ( 
nTmpIdx == nTmpEnd ?
+                                                const tools::Long nAdvanceX = 
( nTmpIdx == nTmpEnd ?
                                                                          
rTextPortion.GetSize().Width() :
                                                                          
pDXArray[ nTmpIdx - nTextStart ] ) - nHalfBlankWidth;
-                                                const long nAdvanceY = 
-pLine->GetMaxAscent();
+                                                const tools::Long nAdvanceY = 
-pLine->GetMaxAscent();
 
                                                 Point aTopLeftRectPos( aTmpPos 
);
                                                 if ( !IsVertical() )
@@ -3273,7 +3273,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
 
                                                     const Size aSlashSize = 
aTmpFont.QuickGetTextSize( pOutDev, aSlash, 0, 1 );
                                                     Point aSlashPos( aTmpPos );
-                                                    const long nAddX = 
nHalfBlankWidth - aSlashSize.Width() / 2;
+                                                    const tools::Long nAddX = 
nHalfBlankWidth - aSlashSize.Width() / 2;
                                                     if ( !IsVertical() )
                                                     {
                                                         aSlashPos.setX( 
aTopLeftRectPos.X() + nAddX );
@@ -3395,7 +3395,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                                     aTmpFont.QuickGetTextSize( GetRefDevice(), 
aText, 0, aText.getLength(), pTmpDXArray.get() );
                                 }
 
-                                long nTxtWidth = 
rTextPortion.GetSize().Width();
+                                tools::Long nTxtWidth = 
rTextPortion.GetSize().Width();
 
                                 Point aOutPos( aTmpPos );
                                 aRedLineTmpPos = aTmpPos;
@@ -3511,7 +3511,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                                         // In case of high/low do it yourself:
                                         if ( aTmpFont.GetEscapement() )
                                         {
-                                            long nDiff = 
aTmpFont.GetFontSize().Height() * aTmpFont.GetEscapement() / 100L;
+                                            tools::Long nDiff = 
aTmpFont.GetFontSize().Height() * aTmpFont.GetEscapement() / 100L;
                                             if ( !IsVertical() )
                                                 aOutPos.AdjustY( -nDiff );
                                             else
@@ -3646,7 +3646,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                                             short _nEsc = 
aTmpFont.GetEscapement();
                                             if( _nEsc )
                                             {
-                                                long nShift = (_nEsc * 
aTmpFont.GetFontSize().Height()) / 100L;
+                                                tools::Long nShift = (_nEsc * 
aTmpFont.GetFontSize().Height()) / 100L;
                                                 if( !IsVertical() )
                                                     aRedLineTmpPos.AdjustY( 
-nShift );
                                                 else
@@ -3698,7 +3698,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
                                     aTmpFont.SetTransparent( false );
                                     aTmpFont.SetEscapement( 0 );
                                     aTmpFont.SetPhysFont( pOutDev );
-                                    long nCharWidth = 
aTmpFont.QuickGetTextSize( pOutDev,
+                                    tools::Long nCharWidth = 
aTmpFont.QuickGetTextSize( pOutDev,
                                         
OUString(rTextPortion.GetExtraValue()), 0, 1 ).Width();
                                     sal_Int32 nChars = 2;
                                     if( nCharWidth )
@@ -3790,7 +3790,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
tools::Rectangle aClipRect, Po
             if ( !aStatus.IsOutliner() )
             {
                 const SvxULSpaceItem& rULItem = 
pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
-                long nUL = GetYValue( rULItem.GetLower() );
+                tools::Long nUL = GetYValue( rULItem.GetLower() );
                 if ( !IsVertical() )
                     aStartPos.AdjustY(nUL );
                 else
@@ -3891,7 +3891,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const 
tools::Rectangle& rRect, Ou
     // there)
     if ( !IsVertical() && ( pView->GetOutputArea().GetWidth() > 
GetPaperSize().Width() ) )
     {
-        long nMaxX = pView->GetOutputArea().Left() + GetPaperSize().Width();
+        tools::Long nMaxX = pView->GetOutputArea().Left() + 
GetPaperSize().Width();
         if ( aClipRect.Left() > nMaxX )
             return;
         if ( aClipRect.Right() > nMaxX )
@@ -4126,9 +4126,9 @@ const ParaPortion* ImpEditEngine::GetNextVisPortion( 
const ParaPortion* pCurPort
     return pPortion;
 }
 
-long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
+tools::Long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
 {
-    long nTotalOccupiedHeight = 0;
+    tools::Long nTotalOccupiedHeight = 0;
     sal_Int32 nTotalLineCount = 0;
     const ParaPortionList& rParaPortions = GetParaPortions();
     sal_Int32 nParaCount = rParaPortions.Count();
@@ -4147,7 +4147,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) 
const
                             ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
 
         const SvxULSpaceItem& rULItem = 
pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_ULSPACE);
-        long nUL = GetYValue( rULItem.GetLower() );
+        tools::Long nUL = GetYValue( rULItem.GetLower() );
 
         const EditLineList& rLines = pPortion->GetLines();
         sal_Int32 nLineCount = rLines.Count();
@@ -4162,7 +4162,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) 
const
         }
     }
 
-    long nTotalSpace = IsVertical() ? aPaperSize.Width() : aPaperSize.Height();
+    tools::Long nTotalSpace = IsVertical() ? aPaperSize.Width() : 
aPaperSize.Height();
     nTotalSpace -= nTotalOccupiedHeight;
     if (nTotalSpace <= 0 || nTotalLineCount <= 1)
         return 0;
@@ -4459,7 +4459,7 @@ Color ImpEditEngine::GetAutoColor() const
 
 bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
                                              TextPortion* pTextPortion, 
sal_Int32 nStartPos,
-                                             long* pDXArray, sal_uInt16 
n100thPercentFromMax,
+                                             tools::Long* pDXArray, sal_uInt16 
n100thPercentFromMax,
                                              bool bManipulateDXArray)
 {
     DBG_ASSERT( GetAsianCompressionMode() != CharCompressType::NONE, 
"ImplCalcAsianCompression - Why?" );
@@ -4473,7 +4473,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* 
pNode,
 
     if ( GetI18NScriptType( EditPaM( pNode, nStartPos+1 ) ) == 
i18n::ScriptType::ASIAN )
     {
-        long nNewPortionWidth = pTextPortion->GetSize().Width();
+        tools::Long nNewPortionWidth = pTextPortion->GetSize().Width();
         sal_Int32 nPortionLen = pTextPortion->GetLen();
         for ( sal_Int32 n = 0; n < nPortionLen; n++ )
         {
@@ -4495,7 +4495,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* 
pNode,
                 pTextPortion->GetExtraInfos()->nMaxCompression100thPercent = 
n100thPercentFromMax;
                 pTextPortion->GetExtraInfos()->nAsianCompressionTypes |= nType;
 
-                long nOldCharWidth;
+                tools::Long nOldCharWidth;
                 if ( (n+1) < nPortionLen )
                 {
                     nOldCharWidth = pDXArray[n];
@@ -4509,7 +4509,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* 
pNode,
                 }
                 nOldCharWidth -= ( n ? pDXArray[n-1] : 0 );
 
-                long nCompress = 0;
+                tools::Long nCompress = 0;
 
                 if ( bCompressPunctuation )
                 {
@@ -4574,10 +4574,10 @@ bool 
ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
         if ( pTextPortion->GetExtraInfos() && ( n100thPercentFromMax != 10000 
) )
         {
             // Maybe rounding errors in nNewPortionWidth, assure that width 
not bigger than expected
-            long nShrink = pTextPortion->GetExtraInfos()->nOrgWidth - 
pTextPortion->GetExtraInfos()->nWidthFullCompression;
+            tools::Long nShrink = pTextPortion->GetExtraInfos()->nOrgWidth - 
pTextPortion->GetExtraInfos()->nWidthFullCompression;
             nShrink *= n100thPercentFromMax;
             nShrink /= 10000;
-            long nNewWidth = pTextPortion->GetExtraInfos()->nOrgWidth - 
nShrink;
+            tools::Long nNewWidth = pTextPortion->GetExtraInfos()->nOrgWidth - 
nShrink;
             if ( nNewWidth < pTextPortion->GetSize().Width() )
                 pTextPortion->GetSize().setWidth( nNewWidth );
         }
@@ -4586,10 +4586,10 @@ bool 
ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
 }
 
 
-void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, 
ParaPortion* pParaPortion, long nRemainingWidth )
+void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, 
ParaPortion* pParaPortion, tools::Long nRemainingWidth )
 {
     bool bFoundCompressedPortion = false;
-    long nCompressed = 0;
+    tools::Long nCompressed = 0;
     std::vector<TextPortion*> aCompressedPortions;
 
     sal_Int32 nPortion = pLine->GetEndPortion();
@@ -4608,7 +4608,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( 
EditLine* pLine, ParaPortion*
     if ( !bFoundCompressedPortion )
         return;
 
-    long nCompressPercent = 0;
+    tools::Long nCompressPercent = 0;
     if ( nCompressed > nRemainingWidth )
     {
         nCompressPercent = nCompressed - nRemainingWidth;
@@ -4627,7 +4627,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( 
EditLine* pLine, ParaPortion*
             sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( 
pTP );
             sal_Int32 nTxtPortionStart = 
pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
             DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion 
doesn't belong to the line!!!" );
-            long* pDXArray = pLine->GetCharPosArray().data() + 
(nTxtPortionStart - pLine->GetStart());
+            tools::Long* pDXArray = pLine->GetCharPosArray().data() + 
(nTxtPortionStart - pLine->GetStart());
             if ( pTP->GetExtraInfos()->pOrgDXArray )
                 memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), 
(pTP->GetLen()-1)*sizeof(sal_Int32) );
             ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, 
nTxtPortionStart, pDXArray, static_cast<sal_uInt16>(nCompressPercent), true );
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 42525141c461..cdb2995acc43 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -923,7 +923,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             ContentNode* pNode = aEditDoc.GetObject( nPara );
             SeekCursor( pNode, nPos, aFont );
             MapMode aPntMode( MapUnit::MapPoint );
-            long nFontHeight = GetRefDevice()->LogicToLogic(
+            tools::Long nFontHeight = GetRefDevice()->LogicToLogic(

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to