emfio/inc/mtftools.hxx                        |    4 -
 emfio/source/reader/mtftools.cxx              |    8 +--
 emfio/source/reader/wmfreader.cxx             |    6 +-
 extensions/source/bibliography/bibbeam.cxx    |    2 
 extensions/source/bibliography/bibconfig.hxx  |   13 +++---
 extensions/source/bibliography/bibcont.cxx    |    8 +--
 extensions/source/bibliography/general.cxx    |    4 -
 extensions/source/scanner/grid.cxx            |    8 +--
 extensions/source/scanner/sanedlg.cxx         |   14 +++---
 filter/source/graphicfilter/egif/egif.cxx     |   22 +++++-----
 filter/source/graphicfilter/eps/eps.cxx       |   52 ++++++++++++-------------
 filter/source/graphicfilter/icgm/actimpr.cxx  |   30 +++++++-------
 filter/source/graphicfilter/icgm/bitmap.cxx   |   10 ++--
 filter/source/graphicfilter/icgm/bitmap.hxx   |    2 
 filter/source/graphicfilter/icgm/bundles.hxx  |   10 ++--
 filter/source/graphicfilter/icgm/cgm.cxx      |    2 
 filter/source/graphicfilter/icgm/cgmtypes.hxx |    6 +-
 filter/source/graphicfilter/icgm/class1.cxx   |    2 
 filter/source/graphicfilter/icgm/class3.cxx   |    4 -
 filter/source/graphicfilter/icgm/class4.cxx   |   26 ++++++------
 filter/source/graphicfilter/icgm/class5.cxx   |    4 -
 filter/source/graphicfilter/icgm/classx.cxx   |    2 
 filter/source/graphicfilter/icgm/elements.cxx |    6 +-
 filter/source/graphicfilter/icgm/elements.hxx |   12 ++---
 filter/source/graphicfilter/icgm/outact.hxx   |    4 -
 filter/source/graphicfilter/idxf/dxf2mtf.cxx  |   32 +++++++--------
 filter/source/graphicfilter/idxf/dxf2mtf.hxx  |    6 +-
 filter/source/graphicfilter/idxf/dxfblkrd.hxx |    2 
 filter/source/graphicfilter/idxf/dxfentrd.hxx |   53 +++++++++++++-------------
 filter/source/graphicfilter/idxf/dxfgrprd.cxx |    2 
 filter/source/graphicfilter/idxf/dxfgrprd.hxx |    9 ++--
 filter/source/graphicfilter/idxf/dxftblrd.cxx |    2 
 filter/source/graphicfilter/idxf/dxftblrd.hxx |   34 ++++++++--------
 filter/source/graphicfilter/idxf/dxfvec.cxx   |    4 -
 filter/source/graphicfilter/ieps/ieps.cxx     |   24 +++++------
 filter/source/graphicfilter/ipcd/ipcd.cxx     |   24 +++++------
 filter/source/graphicfilter/ipict/ipict.cxx   |   16 +++----
 filter/source/graphicfilter/ipict/shape.cxx   |   40 +++++++++----------
 filter/source/graphicfilter/itga/itga.cxx     |    2 
 filter/source/graphicfilter/itiff/itiff.cxx   |   14 +++---
 filter/source/msfilter/msdffimp.cxx           |   36 ++++++++---------
 filter/source/msfilter/mstoolbar.cxx          |    2 
 filter/source/msfilter/svdfppt.cxx            |   14 +++---
 filter/source/msfilter/util.cxx               |    2 
 filter/source/pdf/pdfexport.cxx               |   10 ++--
 filter/source/svg/svgfilter.cxx               |    2 
 filter/source/svg/svgwriter.cxx               |   48 +++++++++++------------
 filter/source/svg/svgwriter.hxx               |   14 +++---
 include/filter/msfilter/msdffimp.hxx          |   20 ++++-----
 include/filter/msfilter/mstoolbar.hxx         |    2 
 include/filter/msfilter/util.hxx              |    3 -
 51 files changed, 342 insertions(+), 336 deletions(-)

New commits:
commit 180dd91c189de0bf03d5062e33c20da94c5d35d9
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Wed Oct 21 15:26:38 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 22 08:07:45 2020 +0200

    long->tools::Long in emfio..filter
    
    Change-Id: I961cee10d45d628ff70dea0694a7a63a4fe867ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104624
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 9506b4f5f31c..5c0c60973350 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -625,8 +625,8 @@ namespace emfio
         );
         void                DrawText(Point& rPosition,
             OUString const & rString,
-            long* pDXArry = nullptr,
-            long* pDYArry = nullptr,
+            tools::Long* pDXArry = nullptr,
+            tools::Long* pDYArry = nullptr,
             bool bRecordPath = false,
             sal_Int32 nGraphicsMode = GM_COMPATIBLE);
 
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 080521ed0523..e32b0f2be502 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -266,7 +266,7 @@ namespace emfio
             aFont.SetFontSize( aFontSize );
             pVDev->SetFont( aFont );
             FontMetric aMetric( pVDev->GetFontMetric() );
-            long nHeight = aMetric.GetAscent() + aMetric.GetDescent();
+            tools::Long nHeight = aMetric.GetAscent() + aMetric.GetDescent();
             if (nHeight)
             {
                 double fHeight = (static_cast<double>(aFontSize.Height()) * 
rFont.lfHeight ) / nHeight;
@@ -743,7 +743,7 @@ namespace emfio
                 if ( pLineStyle->aLineInfo.GetStyle() == LineStyle::Dash )
                 {
                     aSize.AdjustWidth(1 );
-                    long nDotLen = ImplMap( aSize ).Width();
+                    tools::Long nDotLen = ImplMap( aSize ).Width();
                     pLineStyle->aLineInfo.SetDistance( nDotLen );
                     pLineStyle->aLineInfo.SetDotLen( nDotLen );
                     pLineStyle->aLineInfo.SetDashLen( nDotLen * 3 );
@@ -1413,7 +1413,7 @@ namespace emfio
         }
     }
 
-    void MtfTools::DrawText( Point& rPosition, OUString const & rText, long* 
pDXArry, long* pDYArry, bool bRecordPath, sal_Int32 nGfxMode )
+    void MtfTools::DrawText( Point& rPosition, OUString const & rText, 
tools::Long* pDXArry, tools::Long* pDYArry, bool bRecordPath, sal_Int32 
nGfxMode )
     {
         UpdateClipRegion();
         rPosition = ImplMap( rPosition );
@@ -1589,7 +1589,7 @@ namespace emfio
             {
                 /* because text without dx array is badly scaled, we
                    will create such an array if necessary */
-                long* pDX = pDXArry;
+                tools::Long* pDX = pDXArry;
                 if (!pDXArry)
                 {
                     // #i117968# VirtualDevice is not thread safe, but filter 
is used in multithreading
diff --git a/emfio/source/reader/wmfreader.cxx 
b/emfio/source/reader/wmfreader.cxx
index 27c42bdc0171..155a74bec48b 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -821,9 +821,9 @@ namespace emfio
                 if ( !!aBmp )
                 {
                     Bitmap::ScopedReadAccess pBmp(aBmp);
-                    for ( long y = 0; y < pBmp->Height(); y++ )
+                    for ( tools::Long y = 0; y < pBmp->Height(); y++ )
                     {
-                        for ( long x = 0; x < pBmp->Width(); x++ )
+                        for ( tools::Long x = 0; x < pBmp->Width(); x++ )
                         {
                             const BitmapColor aColor( pBmp->GetColor( y, x ) );
 
@@ -1234,7 +1234,7 @@ namespace emfio
         }
     }
 
-    const long   aMaxWidth = 1024;
+    const tools::Long   aMaxWidth = 1024;
 
     bool WmfReader::ReadHeader()
     {
diff --git a/extensions/source/bibliography/bibbeam.cxx 
b/extensions/source/bibliography/bibbeam.cxx
index e31c21ee9d7f..a38c723852bc 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -258,7 +258,7 @@ namespace bib
 
     IMPL_LINK_NOARG( BibBeamer, RecalcLayout_Impl, void*, void )
     {
-        long nHeight = pToolBar->get_preferred_size().Height();
+        tools::Long nHeight = pToolBar->get_preferred_size().Height();
         SetItemSize( ID_TOOLBAR, nHeight );
     }
 
diff --git a/extensions/source/bibliography/bibconfig.hxx 
b/extensions/source/bibliography/bibconfig.hxx
index 0240b69c036a..37559999abf0 100644
--- a/extensions/source/bibliography/bibconfig.hxx
+++ b/extensions/source/bibliography/bibconfig.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX
 
 #include <unotools/configitem.hxx>
+#include <tools/long.hxx>
 #include <vector>
 #include <memory>
 
@@ -95,8 +96,8 @@ class BibConfig : public utl::ConfigItem
     OUString   sQueryField;
     OUString   sQueryText;
     MappingArray    mvMappings;
-    long            nBeamerSize;
-    long            nViewSize;
+    tools::Long            nBeamerSize;
+    tools::Long            nViewSize;
     bool        bShowColumnAssignmentWarning;
 
     OUString               aColumnDefaults[COLUMN_COUNT];
@@ -121,10 +122,10 @@ public:
                                             {return aColumnDefaults[nIndex];}
 
 
-    void                    setBeamerSize(long nSize) {SetModified(); 
nBeamerSize = nSize;}
-    long                    getBeamerSize()const {return nBeamerSize;}
-    void                    setViewSize(long nSize) {SetModified(); nViewSize 
= nSize;}
-    long                    getViewSize() const {return nViewSize;}
+    void                    setBeamerSize(tools::Long nSize) {SetModified(); 
nBeamerSize = nSize;}
+    tools::Long                    getBeamerSize()const {return nBeamerSize;}
+    void                    setViewSize(tools::Long nSize) {SetModified(); 
nViewSize = nSize;}
+    tools::Long                    getViewSize() const {return nViewSize;}
 
     const OUString&         getQueryField() const {return sQueryField;}
     void                    setQueryField(const OUString& rSet) 
{SetModified(); sQueryField = rSet;}
diff --git a/extensions/source/bibliography/bibcont.cxx 
b/extensions/source/bibliography/bibcont.cxx
index 562d720a35e8..7c24b0fb3fd2 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -146,7 +146,7 @@ void BibBookContainer::Split()
 }
 IMPL_LINK_NOARG( BibBookContainer, SplitHdl, Timer*, void)
 {
-    long nSize= GetItemSize( TOP_WINDOW);
+    tools::Long nSize= GetItemSize( TOP_WINDOW);
     BibConfig* pConfig = BibModul::GetConfig();
     pConfig->setBeamerSize(nSize);
     nSize = GetItemSize( BOTTOM_WINDOW);
@@ -163,7 +163,7 @@ void BibBookContainer::createTopFrame( BibShortCutHandler* 
pWin )
     pTopWin=VclPtr<BibWindowContainer>::Create(this,pWin);
     pTopWin->Show();
     BibConfig* pConfig = BibModul::GetConfig();
-    long nSize = pConfig->getBeamerSize();
+    tools::Long nSize = pConfig->getBeamerSize();
     InsertItem(TOP_WINDOW, pTopWin, nSize, 1, 0, 
SplitWindowItemFlags::PercentSize  );
 
 }
@@ -179,7 +179,7 @@ void BibBookContainer::createBottomFrame( 
BibShortCutHandler* pWin )
     pBottomWin=VclPtr<BibWindowContainer>::Create(this,pWin);
 
     BibConfig* pConfig = BibModul::GetConfig();
-    long nSize = pConfig->getViewSize();
+    tools::Long nSize = pConfig->getViewSize();
     InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, 
SplitWindowItemFlags::PercentSize  );
 
 }
@@ -208,7 +208,7 @@ bool BibBookContainer::PreNotify( NotifyEvent& rNEvt )
                 {
                     sal_uInt16 nFirstWinId = KEY_UP == nKey ? TOP_WINDOW : 
BOTTOM_WINDOW;
                     sal_uInt16 nSecondWinId = KEY_UP == nKey ? BOTTOM_WINDOW : 
TOP_WINDOW;
-                    long nHeight = GetItemSize( nFirstWinId );
+                    tools::Long nHeight = GetItemSize( nFirstWinId );
                     nHeight -= WIN_STEP_SIZE;
                     if(nHeight < WIN_MIN_HEIGHT)
                         nHeight = WIN_MIN_HEIGHT;
diff --git a/extensions/source/bibliography/general.cxx 
b/extensions/source/bibliography/general.cxx
index ea4f8d059e39..deaaafa4d9dc 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -596,13 +596,13 @@ void BibGeneralPage::focusGained(const awt::FocusEvent& 
rEvent)
     ::Size aOutSize = pScrolledWindow->getVisibleChildSize();
     awt::Rectangle aRect = xCtrWin->getPosSize();
     Point aOffset(pGrid->GetPosPixel());
-    long nX = aRect.X + aOffset.X();
+    tools::Long nX = aRect.X + aOffset.X();
     if (nX < 0 || nX > aOutSize.Width())
     {
         pScrolledWindow->getHorzScrollBar().DoScroll(aRect.X);
     }
 
-    long nY = aRect.Y + aOffset.Y();
+    tools::Long nY = aRect.Y + aOffset.Y();
     if (nY < 0 || nY > aOutSize.Height())
     {
         pScrolledWindow->getVertScrollBar().DoScroll(aRect.Y);
diff --git a/extensions/source/scanner/grid.cxx 
b/extensions/source/scanner/grid.cxx
index 4560d8f2baf7..38046f67b7d2 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -301,10 +301,10 @@ Point GridWindow::transform( double x, double y )
 {
     Point aRet;
 
-    aRet.setX( static_cast<long>( ( x - m_fMinX ) *
+    aRet.setX( static_cast<tools::Long>( ( x - m_fMinX ) *
         static_cast<double>(m_aGridArea.GetWidth()) / ( m_fMaxX - m_fMinX )
         + m_aGridArea.Left() ) );
-    aRet.setY( static_cast<long>(
+    aRet.setY( static_cast<tools::Long>(
         m_aGridArea.Bottom() -
         ( y - m_fMinY ) *
         static_cast<double>(m_aGridArea.GetHeight()) / ( m_fMaxY - m_fMinY ) ) 
);
@@ -313,8 +313,8 @@ Point GridWindow::transform( double x, double y )
 
 void GridWindow::transform( const Point& rOriginal, double& x, double& y )
 {
-    const long nWidth = m_aGridArea.GetWidth();
-    const long nHeight = m_aGridArea.GetHeight();
+    const tools::Long nWidth = m_aGridArea.GetWidth();
+    const tools::Long nHeight = m_aGridArea.GetHeight();
     if (!nWidth || !nHeight)
         return;
     x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / 
static_cast<double>(nWidth) + m_fMinX;
diff --git a/extensions/source/scanner/sanedlg.cxx 
b/extensions/source/scanner/sanedlg.cxx
index 96c2144c5bdd..197da88d94fd 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -143,25 +143,25 @@ public:
         rBottomRight = maMaxBottomRight;
 
     }
-    void ChangePreviewLogicTopLeftY(long Y)
+    void ChangePreviewLogicTopLeftY(tools::Long Y)
     {
         Point aPoint(0, Y);
         aPoint = GetPixelPos(aPoint);
         maTopLeft.setY( aPoint.Y() );
     }
-    void ChangePreviewLogicTopLeftX(long X)
+    void ChangePreviewLogicTopLeftX(tools::Long X)
     {
         Point aPoint(X, 0);
         aPoint = GetPixelPos(aPoint);
         maTopLeft.setX( aPoint.X() );
     }
-    void ChangePreviewLogicBottomRightY(long Y)
+    void ChangePreviewLogicBottomRightY(tools::Long Y)
     {
         Point aPoint(0, Y);
         aPoint = GetPixelPos(aPoint);
         maBottomRight.setY( aPoint.Y() );
     }
-    void ChangePreviewLogicBottomRightX(long X)
+    void ChangePreviewLogicBottomRightX(tools::Long X)
     {
         Point aPoint(X, 0);
         aPoint = GetPixelPos(aPoint);
@@ -440,11 +440,11 @@ void SaneDlg::InitFields()
             {
                 if( pDouble )
                 {
-                    pField->set_min( static_cast<long>(pDouble[0]), 
FieldUnit::NONE );
+                    pField->set_min( static_cast<tools::Long>(pDouble[0]), 
FieldUnit::NONE );
                     if( nValue )
-                        pField->set_max( static_cast<long>(pDouble[ nValue-1 
]), FieldUnit::NONE );
+                        pField->set_max( static_cast<tools::Long>(pDouble[ 
nValue-1 ]), FieldUnit::NONE );
                     else
-                        pField->set_max( static_cast<long>(pDouble[ 1 ]), 
FieldUnit::NONE );
+                        pField->set_max( static_cast<tools::Long>(pDouble[ 1 
]), FieldUnit::NONE );
                 }
                 switch( i ) {
                     case 0: aMinTopLeft.setX( pField->get_min(FieldUnit::NONE) 
);break;
diff --git a/filter/source/graphicfilter/egif/egif.cxx 
b/filter/source/graphicfilter/egif/egif.cxx
index 13521944c7bb..314a899bef00 100644
--- a/filter/source/graphicfilter/egif/egif.cxx
+++ b/filter/source/graphicfilter/egif/egif.cxx
@@ -38,8 +38,8 @@ class GIFWriter
     sal_uInt32          nMinPercent;
     sal_uInt32          nMaxPercent;
     sal_uInt32          nLastPercent;
-    long                nActX;
-    long                nActY;
+    tools::Long                nActX;
+    tools::Long                nActY;
     sal_Int32           nInterlaced;
     bool                bStatus;
     bool                bTransparent;
@@ -49,7 +49,7 @@ class GIFWriter
     void                WriteGlobalHeader( const Size& rSize );
     void                WriteLoopExtension( const Animation& rAnimation );
     void                WriteLogSizeExtension( const Size& rSize100 );
-    void                WriteImageExtension( long nTimer, Disposal eDisposal );
+    void                WriteImageExtension( tools::Long nTimer, Disposal 
eDisposal );
     void                WriteLocalHeader();
     void                WritePalette();
     void                WriteAccess();
@@ -60,7 +60,7 @@ class GIFWriter
 
     void                WriteAnimation( const Animation& rAnimation );
     void                WriteBitmapEx( const BitmapEx& rBmpEx, const Point& 
rPoint, bool bExtended,
-                                       long nTimer = 0, Disposal eDisposal = 
Disposal::Not );
+                                       tools::Long nTimer = 0, Disposal 
eDisposal = Disposal::Not );
 
     css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator;
 
@@ -171,7 +171,7 @@ bool GIFWriter::WriteGIF(const Graphic& rGraphic, 
FilterConfigItem* pFilterConfi
 
 
 void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint,
-                               bool bExtended, long nTimer, Disposal eDisposal 
)
+                               bool bExtended, tools::Long nTimer, Disposal 
eDisposal )
 {
     if( !CreateAccess( rBmpEx ) )
         return;
@@ -368,7 +368,7 @@ void GIFWriter::WriteLogSizeExtension( const Size& rSize100 
)
 }
 
 
-void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal )
+void GIFWriter::WriteImageExtension( tools::Long nTimer, Disposal eDisposal )
 {
     if( !bStatus )
         return;
@@ -458,8 +458,8 @@ void GIFWriter::WritePalette()
 void GIFWriter::WriteAccess()
 {
     GIFLZWCompressor    aCompressor;
-    const long          nWidth = m_pAcc->Width();
-    const long          nHeight = m_pAcc->Height();
+    const tools::Long          nWidth = m_pAcc->Width();
+    const tools::Long          nHeight = m_pAcc->Height();
     std::unique_ptr<sal_uInt8[]> pBuffer;
     bool                bNative = m_pAcc->GetScanlineFormat() == 
ScanlineFormat::N8BitPal;
 
@@ -471,9 +471,9 @@ void GIFWriter::WriteAccess()
 
     aCompressor.StartCompression( m_rGIF, m_pAcc->GetBitCount() );
 
-    long nY, nT;
+    tools::Long nY, nT;
 
-    for( long i = 0; i < nHeight; ++i )
+    for( tools::Long i = 0; i < nHeight; ++i )
     {
         if( nInterlaced )
         {
@@ -505,7 +505,7 @@ void GIFWriter::WriteAccess()
         else
         {
             Scanline pScanline = m_pAcc->GetScanline( nY );
-            for( long nX = 0; nX < nWidth; nX++ )
+            for( tools::Long nX = 0; nX < nWidth; nX++ )
                 pBuffer[ nX ] = m_pAcc->GetIndexFromData( pScanline, nX );
 
             aCompressor.Compress( pBuffer.get(), nWidth );
diff --git a/filter/source/graphicfilter/eps/eps.cxx 
b/filter/source/graphicfilter/eps/eps.cxx
index e8cca292467c..38d234e3108f 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -100,7 +100,7 @@ private:
     bool                mbLevelWarning;     // if there any embedded eps file 
which was not exported
     sal_uInt32          mnLatestPush;       // offset to streamposition, where 
last push was done
 
-    long                mnLevel;            // dialog options
+    tools::Long                mnLevel;            // dialog options
     bool                mbGrayScale;
     bool                mbCompression;
     sal_Int32           mnPreview;
@@ -200,10 +200,10 @@ private:
 
     void                ImplSetClipRegion( vcl::Region const & rRegion );
     void                ImplBmp( Bitmap const *, Bitmap const *, const Point 
&, double nWidth, double nHeight );
-    void                ImplText( const OUString& rUniString, const Point& 
rPos, const long* pDXArry, sal_Int32 nWidth, VirtualDevice const & rVDev );
+    void                ImplText( const OUString& rUniString, const Point& 
rPos, const tools::Long* pDXArry, sal_Int32 nWidth, VirtualDevice const & rVDev 
);
     void                ImplSetAttrForText( const Point & rPoint );
     void                ImplWriteCharacter( char );
-    void                ImplWriteString( const OString&, VirtualDevice const & 
rVDev, const long* pDXArry, bool bStretch );
+    void                ImplWriteString( const OString&, VirtualDevice const & 
rVDev, const tools::Long* pDXArry, bool bStretch );
     void                ImplDefineFont( const char*, const char* );
 
     void                ImplClosePathDraw();
@@ -496,12 +496,12 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
             ImplWriteLong( nLines );
             sal_Int32 nCount2, nCount = 4;
             const BitmapColor aBlack( pAcc->GetBestMatchingColor( COL_BLACK ) 
);
-            for ( long nY = 0; nY < aSizeBitmap.Height(); nY++ )
+            for ( tools::Long nY = 0; nY < aSizeBitmap.Height(); nY++ )
             {
                 nCount2 = 0;
                 char nVal = 0;
                 Scanline pScanline = pAcc->GetScanline( nY );
-                for ( long nX = 0; nX < aSizeBitmap.Width(); nX++ )
+                for ( tools::Long nX = 0; nX < aSizeBitmap.Width(); nX++ )
                 {
                     if ( !nCount2 )
                     {
@@ -1179,7 +1179,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
                 const Size      aDestSize( pA->GetSize() );
                 const double    fScaleX = aSrcSize.Width() ? 
static_cast<double>(aDestSize.Width()) / aSrcSize.Width() : 1.0;
                 const double    fScaleY = aSrcSize.Height() ? 
static_cast<double>(aDestSize.Height()) / aSrcSize.Height() : 1.0;
-                long            nMoveX, nMoveY;
+                tools::Long            nMoveX, nMoveY;
 
                 if( fScaleX != 1.0 || fScaleY != 1.0 )
                 {
@@ -1655,13 +1655,13 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
 
     sal_Int32   nHeightOrg = pBitmap->GetSizePixel().Height();
     sal_Int32   nHeightLeft = nHeightOrg;
-    long    nWidth = pBitmap->GetSizePixel().Width();
+    tools::Long    nWidth = pBitmap->GetSizePixel().Width();
     Point   aSourcePos( rPoint );
 
     while ( nHeightLeft )
     {
         Bitmap  aTileBitmap( *pBitmap );
-        long    nHeight = nHeightLeft;
+        tools::Long    nHeight = nHeightLeft;
         double  nYHeight = nYHeightOrg;
 
         bool    bDoTrans = false;
@@ -1708,7 +1708,7 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
 
             RectangleVector aRectangles;
             aRegion.GetRegionRectangles(aRectangles);
-            const long nMoveVertical(nHeightLeft - nHeightOrg);
+            const tools::Long nMoveVertical(nHeightLeft - nHeightOrg);
 
             for (auto & rectangle : aRectangles)
             {
@@ -1754,10 +1754,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
             ImplWriteLong( nWidth );
             ImplWriteLine( "string readhexstring pop}" );
             ImplWriteLine( "image" );
-            for ( long y = 0; y < nHeight; y++ )
+            for ( tools::Long y = 0; y < nHeight; y++ )
             {
                 Scanline pScanlineRead = pAcc->GetScanline( y );
-                for ( long x = 0; x < nWidth; x++ )
+                for ( tools::Long x = 0; x < nWidth; x++ )
                 {
                     ImplWriteHexByte( pAcc->GetIndexFromData( pScanlineRead, x 
) );
                 }
@@ -1793,10 +1793,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                 if ( mbCompression )
                 {
                     StartCompression();
-                    for ( long y = 0; y < nHeight; y++ )
+                    for ( tools::Long y = 0; y < nHeight; y++ )
                     {
                         Scanline pScanlineRead = pAcc->GetScanline( y );
-                        for ( long x = 0; x < nWidth; x++ )
+                        for ( tools::Long x = 0; x < nWidth; x++ )
                         {
                             Compress( pAcc->GetIndexFromData( pScanlineRead, x 
) );
                         }
@@ -1805,10 +1805,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                 }
                 else
                 {
-                    for ( long y = 0; y < nHeight; y++ )
+                    for ( tools::Long y = 0; y < nHeight; y++ )
                     {
                         Scanline pScanlineRead = pAcc->GetScanline( y );
-                        for ( long x = 0; x < nWidth; x++ )
+                        for ( tools::Long x = 0; x < nWidth; x++ )
                         {
                             ImplWriteHexByte( pAcc->GetIndexFromData( 
pScanlineRead, x ) );
                         }
@@ -1858,10 +1858,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                     if ( mbCompression )
                     {
                         StartCompression();
-                        for ( long y = 0; y < nHeight; y++ )
+                        for ( tools::Long y = 0; y < nHeight; y++ )
                         {
                             Scanline pScanlineRead = pAcc->GetScanline( y );
-                            for ( long x = 0; x < nWidth; x++ )
+                            for ( tools::Long x = 0; x < nWidth; x++ )
                             {
                                 Compress( pAcc->GetIndexFromData( 
pScanlineRead, x ) );
                             }
@@ -1870,10 +1870,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                     }
                     else
                     {
-                        for ( long y = 0; y < nHeight; y++ )
+                        for ( tools::Long y = 0; y < nHeight; y++ )
                         {
                             Scanline pScanlineRead = pAcc->GetScanline( y );
-                            for ( long x = 0; x < nWidth; x++ )
+                            for ( tools::Long x = 0; x < nWidth; x++ )
                             {
                                 ImplWriteHexByte( pAcc->GetIndexFromData( 
pScanlineRead, x ) );
                             }
@@ -1907,10 +1907,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                     if ( mbCompression )
                     {
                         StartCompression();
-                        for ( long y = 0; y < nHeight; y++ )
+                        for ( tools::Long y = 0; y < nHeight; y++ )
                         {
                             Scanline pScanlineRead = pAcc->GetScanline( y );
-                            for ( long x = 0; x < nWidth; x++ )
+                            for ( tools::Long x = 0; x < nWidth; x++ )
                             {
                                 const BitmapColor aBitmapColor( 
pAcc->GetPixelFromData( pScanlineRead, x ) );
                                 Compress( aBitmapColor.GetRed() );
@@ -1922,10 +1922,10 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
                     }
                     else
                     {
-                        for ( long y = 0; y < nHeight; y++ )
+                        for ( tools::Long y = 0; y < nHeight; y++ )
                         {
                             Scanline pScanline = pAcc->GetScanline( y );
-                            for ( long x = 0; x < nWidth; x++ )
+                            for ( tools::Long x = 0; x < nWidth; x++ )
                             {
                                 const BitmapColor aBitmapColor( 
pAcc->GetPixelFromData( pScanline, x ) );
                                 ImplWriteHexByte( aBitmapColor.GetRed() );
@@ -1948,7 +1948,7 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap 
const * pMaskBitmap, cons
         if ( nHeightLeft )
         {
             nHeightLeft++;
-            aSourcePos.setY( static_cast<long>( rPoint.Y() + ( nYHeightOrg * ( 
nHeightOrg - nHeightLeft ) ) / nHeightOrg ) );
+            aSourcePos.setY( static_cast<tools::Long>( rPoint.Y() + ( 
nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg ) );
         }
     }
 }
@@ -1965,7 +1965,7 @@ void PSWriter::ImplWriteCharacter( char nChar )
     ImplWriteByte( static_cast<sal_uInt8>(nChar), PS_NONE );
 }
 
-void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & 
rVDev, const long* pDXArry, bool bStretch )
+void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & 
rVDev, const tools::Long* pDXArry, bool bStretch )
 {
     sal_Int32 nLen = rString.getLength();
     if ( !nLen )
@@ -1995,7 +1995,7 @@ void PSWriter::ImplWriteString( const OString& rString, 
VirtualDevice const & rV
     }
 }
 
-void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const 
long* pDXArry, sal_Int32 nWidth, VirtualDevice const & rVDev )
+void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const 
tools::Long* pDXArry, sal_Int32 nWidth, VirtualDevice const & rVDev )
 {
     if ( rUniString.isEmpty() )
         return;
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx 
b/filter/source/graphicfilter/icgm/actimpr.cxx
index 0f1352dfc7eb..728c74b44c03 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -453,9 +453,9 @@ void CGMImpressOutAct::DrawRectangle( FloatRect const & 
rFloatRect )
     {
         if ( ImplCreateShape( "com.sun.star.drawing.RectangleShape" ) )
         {
-            awt::Size aSize( static_cast<long>(rFloatRect.Right - 
rFloatRect.Left ), static_cast<long>(rFloatRect.Bottom-rFloatRect.Top ) );
+            awt::Size aSize( static_cast<tools::Long>(rFloatRect.Right - 
rFloatRect.Left ), static_cast<tools::Long>(rFloatRect.Bottom-rFloatRect.Top ) 
);
             maXShape->setSize( aSize );
-            maXShape->setPosition( awt::Point( 
static_cast<long>(rFloatRect.Left), static_cast<long>(rFloatRect.Top) ) );
+            maXShape->setPosition( awt::Point( 
static_cast<tools::Long>(rFloatRect.Left), 
static_cast<tools::Long>(rFloatRect.Top) ) );
             ImplSetFillBundle();
         }
     }
@@ -470,14 +470,14 @@ void CGMImpressOutAct::DrawEllipse( FloatPoint const & 
rCenter, FloatPoint const
     uno::Any aAny( &eCircleKind, ::cppu::UnoType<drawing::CircleKind>::get() );
     maXPropSet->setPropertyValue( "CircleKind", aAny );
 
-    long nXSize = static_cast<long>( rSize.X * 2.0 );      // strange 
behaviour with an awt::Size of 0
-    long nYSize = static_cast<long>( rSize.Y * 2.0 );
+    tools::Long nXSize = static_cast<tools::Long>( rSize.X * 2.0 );      // 
strange behaviour with an awt::Size of 0
+    tools::Long nYSize = static_cast<tools::Long>( rSize.Y * 2.0 );
     if ( nXSize < 1 )
         nXSize = 1;
     if ( nYSize < 1 )
         nYSize = 1;
     maXShape->setSize( awt::Size( nXSize, nYSize ) );
-    maXShape->setPosition( awt::Point( static_cast<long>( rCenter.X - rSize.X 
), static_cast<long>( rCenter.Y - rSize.Y ) ) );
+    maXShape->setPosition( awt::Point( static_cast<tools::Long>( rCenter.X - 
rSize.X ), static_cast<tools::Long>( rCenter.Y - rSize.Y ) ) );
 
     if ( rOrientation != 0 )
     {
@@ -496,8 +496,8 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const 
& rCenter, FloatPoint
     drawing::CircleKind eCircleKind;
 
 
-    long nXSize = static_cast<long>( rSize.X * 2.0 );      // strange 
behaviour with an awt::Size of 0
-    long nYSize = static_cast<long>( rSize.Y * 2.0 );
+    tools::Long nXSize = static_cast<tools::Long>( rSize.X * 2.0 );      // 
strange behaviour with an awt::Size of 0
+    tools::Long nYSize = static_cast<tools::Long>( rSize.Y * 2.0 );
     if ( nXSize < 1 )
         nXSize = 1;
     if ( nYSize < 1 )
@@ -517,7 +517,7 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const 
& rCenter, FloatPoint
         case 2 : eCircleKind = drawing::CircleKind_ARC; break;
         default : eCircleKind = drawing::CircleKind_FULL; break;
     }
-    if ( static_cast<long>(fStartAngle) == static_cast<long>(fEndAngle) )
+    if ( static_cast<tools::Long>(fStartAngle) == 
static_cast<tools::Long>(fEndAngle) )
     {
         eCircleKind = drawing::CircleKind_FULL;
         maXPropSet->setPropertyValue( "CircleKind", uno::Any(eCircleKind) );
@@ -528,7 +528,7 @@ void CGMImpressOutAct::DrawEllipticalArc( FloatPoint const 
& rCenter, FloatPoint
         maXPropSet->setPropertyValue( "CircleStartAngle", 
uno::Any(static_cast<sal_Int32>( fStartAngle * 100 )) );
         maXPropSet->setPropertyValue( "CircleEndAngle", 
uno::Any(static_cast<sal_Int32>( fEndAngle * 100 )) );
     }
-    maXShape->setPosition( awt::Point( static_cast<long>( rCenter.X - rSize.X 
), static_cast<long>( rCenter.Y - rSize.Y ) ) );
+    maXShape->setPosition( awt::Point( static_cast<tools::Long>( rCenter.X - 
rSize.X ), static_cast<tools::Long>( rCenter.Y - rSize.Y ) ) );
     if ( rOrientation != 0 )
     {
         ImplSetOrientation( rCenter, rOrientation );
@@ -571,8 +571,8 @@ void CGMImpressOutAct::DrawBitmap( CGMBitmapDescriptor* 
pBmpDesc )
     if ( !ImplCreateShape( "com.sun.star.drawing.GraphicObjectShape" ) )
         return;
 
-    maXShape->setSize( awt::Size( static_cast<long>(fdx), 
static_cast<long>(fdy) ) );
-    maXShape->setPosition( awt::Point( static_cast<long>(aOrigin.X), 
static_cast<long>(aOrigin.Y) ) );
+    maXShape->setSize( awt::Size( static_cast<tools::Long>(fdx), 
static_cast<tools::Long>(fdy) ) );
+    maXShape->setPosition( awt::Point( static_cast<tools::Long>(aOrigin.X), 
static_cast<tools::Long>(aOrigin.Y) ) );
 
     if ( pBmpDesc->mnOrientation != 0 )
     {
@@ -725,8 +725,8 @@ void CGMImpressOutAct::DrawText(awt::Point const & 
rTextPos, awt::Size const & r
         return;
 
     uno::Any    aAny;
-    long    nWidth = rTextSize.Width;
-    long    nHeight = rTextSize.Height;
+    tools::Long    nWidth = rTextSize.Width;
+    tools::Long    nHeight = rTextSize.Height;
 
     awt::Point aTextPos( rTextPos );
     switch ( mpCGM->pElement->eTextAlignmentV )
@@ -960,7 +960,7 @@ void CGMImpressOutAct::RegPolyLine( tools::Polygon const & 
rPolygon, bool bRever
     }
 }
 
-void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, long nVertOfs )
+void CGMImpressOutAct::SetGradientOffset( tools::Long nHorzOfs, tools::Long 
nVertOfs )
 {
     if ( !mpGradient )
         mpGradient.reset( new awt::Gradient );
@@ -968,7 +968,7 @@ void CGMImpressOutAct::SetGradientOffset( long nHorzOfs, 
long nVertOfs )
     mpGradient->YOffset = ( static_cast<sal_uInt16>(nVertOfs) & 0x7f );
 }
 
-void CGMImpressOutAct::SetGradientAngle( long nAngle )
+void CGMImpressOutAct::SetGradientAngle( tools::Long nAngle )
 {
     if ( !mpGradient )
         mpGradient.reset( new awt::Gradient );
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx 
b/filter/source/graphicfilter/icgm/bitmap.cxx
index 75a958474979..d857c5848ed6 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -87,9 +87,9 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
 
             // the picture may either be read from left to right or right to 
left, from top to bottom ...
 
-            long nxCount = rDesc.mnX + 1;   // +1 because we are using prefix 
decreasing
-            long nyCount = rDesc.mnY + 1;
-            long    nx, ny, nxC;
+            tools::Long nxCount = rDesc.mnX + 1;   // +1 because we are using 
prefix decreasing
+            tools::Long nyCount = rDesc.mnY + 1;
+            tools::Long    nx, ny, nxC;
 
             switch ( rDesc.mnDstBitsPerPixel ) {
             case 1 : {
@@ -291,7 +291,7 @@ bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& 
rDesc )
     rDesc.mnScanSize = 0;
     switch( rDesc.mnLocalColorPrecision )
     {
-        case long(0x80000001) :                 // monochrome ( bit = 
0->backgroundcolor )
+        case tools::Long(0x80000001) :                 // monochrome ( bit = 
0->backgroundcolor )
         case 0 :                                //              bit = 
1->fillcolor
             rDesc.mnDstBitsPerPixel = 1;
             break;
@@ -420,7 +420,7 @@ std::unique_ptr<CGMBitmap> CGMBitmap::GetNext()
     if (!!pCGMBitmapDescriptor->mxBitmap && pCGMBitmapDescriptor->mbStatus)
     {
         xCGMTempBitmap.reset(new CGMBitmap(*mpCGM));
-        if ( ( 
static_cast<long>(xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation) == 
static_cast<long>(pCGMBitmapDescriptor->mnOrientation) ) &&
+        if ( ( 
static_cast<tools::Long>(xCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation) 
== static_cast<tools::Long>(pCGMBitmapDescriptor->mnOrientation) ) &&
             ( ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == 
pCGMBitmapDescriptor->mnQ.X ) &&
                     ( xCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == 
pCGMBitmapDescriptor->mnQ.Y ) ) ||
             ( ( xCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == 
pCGMBitmapDescriptor->mnR.X ) &&
diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx 
b/filter/source/graphicfilter/icgm/bitmap.hxx
index 971a33cf071b..2fb7de98b32f 100644
--- a/filter/source/graphicfilter/icgm/bitmap.hxx
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -43,7 +43,7 @@ class CGMBitmapDescriptor
         double                  mnOrientation;
 
         sal_uInt32              mnX, mnY;
-        long                    mnLocalColorPrecision;
+        tools::Long                    mnLocalColorPrecision;
         sal_uInt32              mnCompressionMode;
 
         CGMBitmapDescriptor()
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx 
b/filter/source/graphicfilter/icgm/bundles.hxx
index 8d87bac2082b..d4cd01839acc 100644
--- a/filter/source/graphicfilter/icgm/bundles.hxx
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -29,14 +29,14 @@
 class Bundle
 {
 
-    long                mnBundleIndex;
+    tools::Long                mnBundleIndex;
     sal_uInt32          mnColor;
 
 public:
     void                SetColor( sal_uInt32 nColor ) ;
     sal_uInt32          GetColor() const { return mnColor;}
-    long                GetIndex() const { return mnBundleIndex; } ;
-    void                SetIndex( long nBundleIndex ) { mnBundleIndex = 
nBundleIndex; } ;
+    tools::Long                GetIndex() const { return mnBundleIndex; } ;
+    void                SetIndex( tools::Long nBundleIndex ) { mnBundleIndex = 
nBundleIndex; } ;
 
     Bundle()
         : mnBundleIndex( 0 )
@@ -126,8 +126,8 @@ class FillBundle : public Bundle
 public:
 
     FillInteriorStyle   eFillInteriorStyle;
-    long                nFillPatternIndex;
-    long                nFillHatchIndex;
+    tools::Long                nFillPatternIndex;
+    tools::Long                nFillHatchIndex;
 
     FillBundle()
         : eFillInteriorStyle(FIS_HOLLOW)
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx 
b/filter/source/graphicfilter/icgm/cgm.cxx
index b9736b610dc6..02f1d0219f02 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -212,7 +212,7 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, 
sal_uInt32 nRealSize )
     }
     else // ->RP_FIXED
     {
-        long    nVal;
+        tools::Long    nVal;
         const int nSwitch = bCompatible ? 0 : 1 ;
         if ( nRealSize == 4 )
         {
diff --git a/filter/source/graphicfilter/icgm/cgmtypes.hxx 
b/filter/source/graphicfilter/icgm/cgmtypes.hxx
index b9a80fb4c83a..e78d2757a8d3 100644
--- a/filter/source/graphicfilter/icgm/cgmtypes.hxx
+++ b/filter/source/graphicfilter/icgm/cgmtypes.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ICGM_CGMTYPES_HXX
 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ICGM_CGMTYPES_HXX
 
+#include <tools/long.hxx>
+
 struct FloatPoint
 {
         double          X;
@@ -55,8 +57,8 @@ struct FloatRect
 struct HatchEntry
 {
     int     HatchStyle;
-    long    HatchDistance;
-    long    HatchAngle;
+    tools::Long    HatchDistance;
+    tools::Long    HatchAngle;
 };
 
 #define ASF_LINETYPE            0x00000001UL
diff --git a/filter/source/graphicfilter/icgm/class1.cxx 
b/filter/source/graphicfilter/icgm/class1.cxx
index 289e28db428f..07a6fe253e4e 100644
--- a/filter/source/graphicfilter/icgm/class1.cxx
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -29,7 +29,7 @@
 
 void CGM::ImplDoClass1()
 {
-    long    nInteger, nI0, nI1;
+    tools::Long    nInteger, nI0, nI1;
     sal_uInt32  nUInteger;
 
     switch ( mnElementID )
diff --git a/filter/source/graphicfilter/icgm/class3.cxx 
b/filter/source/graphicfilter/icgm/class3.cxx
index c3d56367947b..3cc25730fffa 100644
--- a/filter/source/graphicfilter/icgm/class3.cxx
+++ b/filter/source/graphicfilter/icgm/class3.cxx
@@ -41,8 +41,8 @@ void CGM::ImplDoClass3()
         case 0x02 : /*VDC Real Precision*/
         {
             nUInteger = ImplGetUI16();
-            const long nI0 = ImplGetI( pElement->nIntegerPrecision );  // 
exponent
-            const long nI1 = ImplGetI( pElement->nIntegerPrecision );  // 
mantissa
+            const tools::Long nI0 = ImplGetI( pElement->nIntegerPrecision );  
// exponent
+            const tools::Long nI1 = ImplGetI( pElement->nIntegerPrecision );  
// mantissa
             switch( nUInteger )
             {
                 case 0 :
diff --git a/filter/source/graphicfilter/icgm/class4.cxx 
b/filter/source/graphicfilter/icgm/class4.cxx
index 394c2ada5f89..18eff3452451 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -132,7 +132,7 @@ void CGM::ImplDoClass4()
                 {
                     FloatPoint  aFloatPoint;
                     ImplGetPoint( aFloatPoint, true );
-                    aPolygon.SetPoint( Point( 
static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), i );
+                    aPolygon.SetPoint( Point( 
static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) ), i );
                 }
                 if ( mbFigure )
                     mpOutAct->RegPolyLine( aPolygon );
@@ -155,7 +155,7 @@ void CGM::ImplDoClass4()
                         for ( sal_uInt16 i = 0; i < nPoints; i++ )
                         {
                             ImplGetPoint( aFloatPoint, true );
-                            aPolygon.SetPoint( Point( 
static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 0 );
+                            aPolygon.SetPoint( Point( 
static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) ), 0 );
                         }
                         mpOutAct->RegPolyLine( aPolygon );
                     }
@@ -166,9 +166,9 @@ void CGM::ImplDoClass4()
                         for ( sal_uInt16 i = 0; i < nPoints; i++ )
                         {
                             ImplGetPoint( aFloatPoint, true );
-                            aPolygon.SetPoint( Point( 
static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 0 );
+                            aPolygon.SetPoint( Point( 
static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) ), 0 );
                             ImplGetPoint( aFloatPoint, true );
-                            aPolygon.SetPoint( Point( 
static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) ), 1);
+                            aPolygon.SetPoint( Point( 
static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) ), 1);
                             mpOutAct->DrawPolyLine( aPolygon );
                         }
                         mpOutAct->EndGroup();
@@ -195,7 +195,7 @@ void CGM::ImplDoClass4()
                 OUString aStr(reinterpret_cast<char*>(mpSource) + mnParaSize, 
nSize, RTL_TEXTENCODING_ASCII_US);
 
                 awt::Size aSize;
-                awt::Point aPoint( static_cast<long>(aFloatPoint.X), 
static_cast<long>(aFloatPoint.Y) );
+                awt::Point aPoint( static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) );
                 mpOutAct->DrawText(aPoint, aSize, aStr, 
static_cast<FinalFlag>(nType));
                 mnParaSize = mnElementSize;
             }
@@ -231,8 +231,8 @@ void CGM::ImplDoClass4()
 
                 OUString aStr(reinterpret_cast<char*>(mpSource) + mnParaSize, 
nSize, RTL_TEXTENCODING_ASCII_US);
 
-                awt::Point aPoint( static_cast<long>(aFloatPoint.X), 
static_cast<long>(aFloatPoint.Y) );
-                awt::Size aSize(static_cast<long>(dx), static_cast<long>(dy));
+                awt::Point aPoint( static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) );
+                awt::Size aSize(static_cast<tools::Long>(dx), 
static_cast<tools::Long>(dy));
                 mpOutAct->DrawText(aPoint, aSize , aStr, 
static_cast<FinalFlag>(nType));
                 mnParaSize = mnElementSize;
             }
@@ -265,7 +265,7 @@ void CGM::ImplDoClass4()
                 {
                     FloatPoint  aFloatPoint;
                     ImplGetPoint( aFloatPoint, true );
-                    aPolygon.SetPoint( Point ( static_cast<long>( 
aFloatPoint.X ), static_cast<long>( aFloatPoint.Y ) ), i );
+                    aPolygon.SetPoint( Point ( static_cast<tools::Long>( 
aFloatPoint.X ), static_cast<tools::Long>( aFloatPoint.Y ) ), i );
                 }
                 mpOutAct->DrawPolygon( aPolygon );
             }
@@ -286,7 +286,7 @@ void CGM::ImplDoClass4()
                 {
                     ImplGetPoint( aFloatPoint, true );
                     nEdgeFlag = ImplGetUI16();
-                    pPoints[ nPoints++ ] = Point( 
static_cast<long>(aFloatPoint.X), static_cast<long>(aFloatPoint.Y) );
+                    pPoints[ nPoints++ ] = Point( 
static_cast<tools::Long>(aFloatPoint.X), 
static_cast<tools::Long>(aFloatPoint.Y) );
                     if ( ( nEdgeFlag & 2 ) || ( mnParaSize == mnElementSize ) )
                     {
                         tools::Polygon aPolygon( nPoints );
@@ -414,7 +414,7 @@ void CGM::ImplDoClass4()
                     {
                         tools::Rectangle aBoundingBox(aCenterPoint.X - 
fRadius, aCenterPoint.Y - fRadius);
                         aBoundingBox.SaturatingSetSize(Size(2 * fRadius, 2 * 
fRadius));
-                        tools::Polygon aPolygon( aBoundingBox, Point( 
static_cast<long>(aStartingPoint.X), static_cast<long>(aStartingPoint.Y) ) 
,Point( static_cast<long>(aEndingPoint.X), static_cast<long>(aEndingPoint.Y) ), 
PolyStyle::Arc );
+                        tools::Polygon aPolygon( aBoundingBox, Point( 
static_cast<tools::Long>(aStartingPoint.X), 
static_cast<tools::Long>(aStartingPoint.Y) ) ,Point( 
static_cast<tools::Long>(aEndingPoint.X), 
static_cast<tools::Long>(aEndingPoint.Y) ), PolyStyle::Arc );
                         if ( nSwitch )
                             mpOutAct->RegPolyLine( aPolygon, true );
                         else
@@ -534,8 +534,8 @@ void CGM::ImplDoClass4()
                     tools::Rectangle aBoundingBox(aCenter.X - aRadius.X, 
aCenter.Y - aRadius.X);
                     aBoundingBox.SaturatingSetSize(Size(2 * aRadius.X, 2 * 
aRadius.X));
                     tools::Polygon aPolygon( aBoundingBox,
-                        Point( static_cast<long>(vector[ 0 ]), 
static_cast<long>(vector[ 1 ]) ),
-                        Point( static_cast<long>(vector[ 2 ]), 
static_cast<long>(vector[ 3 ]) ), PolyStyle::Arc );
+                        Point( static_cast<tools::Long>(vector[ 0 ]), 
static_cast<tools::Long>(vector[ 1 ]) ),
+                        Point( static_cast<tools::Long>(vector[ 2 ]), 
static_cast<tools::Long>(vector[ 3 ]) ), PolyStyle::Arc );
                     mpOutAct->RegPolyLine( aPolygon );
                 }
                 else
@@ -724,7 +724,7 @@ void CGM::ImplDoClass4()
                 {
                     FloatPoint  aFloatPoint;
                     ImplGetPoint( aFloatPoint, true );
-                    aPolygon.SetPoint( Point ( static_cast<long>( 
aFloatPoint.X ), static_cast<long>( aFloatPoint.Y ) ), i );
+                    aPolygon.SetPoint( Point ( static_cast<tools::Long>( 
aFloatPoint.X ), static_cast<tools::Long>( aFloatPoint.Y ) ), i );
                 }
                 if ( nOrder & 4 )
                 {
diff --git a/filter/source/graphicfilter/icgm/class5.cxx 
b/filter/source/graphicfilter/icgm/class5.cxx
index 888a9ca1259c..7cfd9911c7d4 100644
--- a/filter/source/graphicfilter/icgm/class5.cxx
+++ b/filter/source/graphicfilter/icgm/class5.cxx
@@ -446,8 +446,8 @@ void CGM::ImplDoClass5()
         case 0x72 : /*External Leading*/ break;
         case 0x7a : /*set Gradient Offset*/
         {
-            long nHorzOffset = ImplGetI( pElement->nIndexPrecision );
-            long nVertOffset = ImplGetI( pElement->nIndexPrecision );
+            tools::Long nHorzOffset = ImplGetI( pElement->nIndexPrecision );
+            tools::Long nVertOffset = ImplGetI( pElement->nIndexPrecision );
             (void)ImplGetUI16(); // nType
             mpOutAct->SetGradientOffset( nHorzOffset, nVertOffset );
             mnAct4PostReset |= ACT4_GRADIENT_ACTION;
diff --git a/filter/source/graphicfilter/icgm/classx.cxx 
b/filter/source/graphicfilter/icgm/classx.cxx
index ea1fc79196a9..2b624f63b206 100644
--- a/filter/source/graphicfilter/icgm/classx.cxx
+++ b/filter/source/graphicfilter/icgm/classx.cxx
@@ -43,7 +43,7 @@ void CGM::ImplDoClass6()
     {
         case 0x01 : /*Escape*/
         {
-            long    nIdentifier = ImplGetI( pElement->nIntegerPrecision );
+            tools::Long    nIdentifier = ImplGetI( pElement->nIntegerPrecision 
);
             switch ( nIdentifier )
             {
                 case 0 : /*inquire function support */break;
diff --git a/filter/source/graphicfilter/icgm/elements.cxx 
b/filter/source/graphicfilter/icgm/elements.cxx
index 2be08c32f04b..9a0221066fec 100644
--- a/filter/source/graphicfilter/icgm/elements.cxx
+++ b/filter/source/graphicfilter/icgm/elements.cxx
@@ -278,7 +278,7 @@ void CGMElements::Init()
 }
 
 
-void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, 
long nAngle )
+void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, tools::Long 
nDistance, tools::Long nAngle )
 {
     HatchEntry& rEntry = maHatchMap[nKey];
     rEntry.HatchStyle = nStyle;
@@ -298,7 +298,7 @@ void CGMElements::CopyAllBundles( const BundleList& 
rSource, BundleList& rDest )
 };
 
 
-Bundle* CGMElements::GetBundleIndex( long nIndex, BundleList& rList, Bundle& 
rBundle )
+Bundle* CGMElements::GetBundleIndex( tools::Long nIndex, BundleList& rList, 
Bundle& rBundle )
 {
     rBundle.SetIndex( nIndex );
     Bundle* pBundle = GetBundle( rList, nIndex );
@@ -308,7 +308,7 @@ Bundle* CGMElements::GetBundleIndex( long nIndex, 
BundleList& rList, Bundle& rBu
 }
 
 
-Bundle* CGMElements::GetBundle( BundleList& rList, long nIndex )
+Bundle* CGMElements::GetBundle( BundleList& rList, tools::Long nIndex )
 {
     for (auto const & i : rList) {
         if ( i->GetIndex() == nIndex ) {
diff --git a/filter/source/graphicfilter/icgm/elements.hxx 
b/filter/source/graphicfilter/icgm/elements.hxx
index 4dbd0e9aa08e..8a7812cb699c 100644
--- a/filter/source/graphicfilter/icgm/elements.hxx
+++ b/filter/source/graphicfilter/icgm/elements.hxx
@@ -30,9 +30,9 @@ typedef ::std::vector< std::unique_ptr<Bundle> > BundleList;
 
 class CGMElements
 {
-        void                ImplInsertHatch( sal_Int32 Key, int Style, long 
Distance, long Angle );
+        void                ImplInsertHatch( sal_Int32 Key, int Style, 
tools::Long Distance, tools::Long Angle );
     public:
-        long                nMetaFileVersion;
+        tools::Long                nMetaFileVersion;
 
         sal_uInt32          nIntegerPrecision;  // maybe 1, 2, 4 Bytes
         sal_uInt32          nIndexPrecision;    //   "      "       "
@@ -105,8 +105,8 @@ class CGMElements
         TextAlignmentV      eTextAlignmentV;
         double              nTextAlignmentHCont;
         double              nTextAlignmentVCont;
-        long                nCharacterSetIndex;
-        long                nAlternateCharacterSetIndex;
+        tools::Long                nCharacterSetIndex;
+        tools::Long                nAlternateCharacterSetIndex;
         CharacterCodingA    eCharacterCodingA;
         CGMFList            aFontList;
 
@@ -128,8 +128,8 @@ class CGMElements
         ~CGMElements();
         CGMElements&        operator=( const CGMElements& );
         void                Init();
-        static Bundle*      GetBundleIndex( long nIndex, BundleList&, Bundle& 
);
-        static Bundle*      GetBundle( BundleList& rList, long nIndex );
+        static Bundle*      GetBundleIndex( tools::Long nIndex, BundleList&, 
Bundle& );
+        static Bundle*      GetBundle( BundleList& rList, tools::Long nIndex );
         static Bundle*      InsertBundle( BundleList&, Bundle& );
         static void         CopyAllBundles( const BundleList& Source, 
BundleList& Dest );
 };
diff --git a/filter/source/graphicfilter/icgm/outact.hxx 
b/filter/source/graphicfilter/icgm/outact.hxx
index 43af85d10844..2364c787fea1 100644
--- a/filter/source/graphicfilter/icgm/outact.hxx
+++ b/filter/source/graphicfilter/icgm/outact.hxx
@@ -99,8 +99,8 @@ public:
     void                        NewRegion();
     void                        EndFigure();
     void                        RegPolyLine( tools::Polygon const &, bool 
bReverse = false );
-    void                        SetGradientOffset( long nHorzOfs, long 
nVertOfs );
-    void                        SetGradientAngle( long nAngle );
+    void                        SetGradientOffset( tools::Long nHorzOfs, 
tools::Long nVertOfs );
+    void                        SetGradientAngle( tools::Long nAngle );
     void                        SetGradientDescriptor( sal_uInt32 nColorFrom, 
sal_uInt32 nColorTo );
     void                        SetGradientStyle( sal_uInt32 nStyle );
 };
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx 
b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index f6fc91ae792d..4b8de3428759 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -46,9 +46,9 @@ Color DXF2GDIMetaFile::ConvertColor(sal_uInt8 nColor)
         pDXF->aPalette.GetBlue( nColor ) );
 }
 
-long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
+tools::Long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
 {
-    long nColor;
+    tools::Long nColor;
 
     nColor=rE.nColor;
     if (nColor==256) {
@@ -75,7 +75,7 @@ DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(OString 
const& rLineType)
     }
     else {
         aDXFLineInfo.eStyle = LineStyle::Dash;
-        for (long i=0; i < (pLT->nDashCount); i++) {
+        for (tools::Long i=0; i < (pLT->nDashCount); i++) {
             const double x = pLT->fDash[i] * pDXF->getGlobalLineTypeScale();
             if ( x >= 0.0 ) {
                 if ( aDXFLineInfo.nDotCount == 0 ) {
@@ -145,7 +145,7 @@ DXFLineInfo DXF2GDIMetaFile::GetEntityDXFLineInfo(const 
DXFBasicEntity & rE)
 
 bool DXF2GDIMetaFile::SetLineAttribute(const DXFBasicEntity & rE)
 {
-    long nColor;
+    tools::Long nColor;
     Color aColor;
 
     nColor=GetEntityColor(rE);
@@ -167,7 +167,7 @@ bool DXF2GDIMetaFile::SetLineAttribute(const DXFBasicEntity 
& rE)
 
 bool DXF2GDIMetaFile::SetAreaAttribute(const DXFBasicEntity & rE)
 {
-    long nColor;
+    tools::Long nColor;
     Color aColor;
 
     nColor=GetEntityColor(rE);
@@ -189,7 +189,7 @@ bool DXF2GDIMetaFile::SetAreaAttribute(const DXFBasicEntity 
& rE)
 
 bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short 
nAngle, sal_uInt16 nHeight)
 {
-    long nColor;
+    tools::Long nColor;
     Color aColor;
     vcl::Font aFont;
 
@@ -267,8 +267,8 @@ void DXF2GDIMetaFile::DrawCircleEntity(const 
DXFCircleEntity & rE, const DXFTran
     rTransform.Transform(rE.aP0,aC);
     if (rE.fThickness==0 && 
rTransform.TransCircleToEllipse(rE.fRadius,frx,fry)) {
         pVirDev->DrawEllipse(
-            
tools::Rectangle(static_cast<long>(aC.fx-frx+0.5),static_cast<long>(aC.fy-fry+0.5),
-                      
static_cast<long>(aC.fx+frx+0.5),static_cast<long>(aC.fy+fry+0.5)));
+            
tools::Rectangle(static_cast<tools::Long>(aC.fx-frx+0.5),static_cast<tools::Long>(aC.fy-fry+0.5),
+                      
static_cast<tools::Long>(aC.fx+frx+0.5),static_cast<tools::Long>(aC.fy+fry+0.5)));
     }
     else {
         double fAng;
@@ -338,8 +338,8 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & 
rE, const DXFTransform
             rTransform.Transform(aVE,aPS);
         }
         pVirDev->DrawArc(
-            
tools::Rectangle(static_cast<long>(aC.fx-frx+0.5),static_cast<long>(aC.fy-fry+0.5),
-                      
static_cast<long>(aC.fx+frx+0.5),static_cast<long>(aC.fy+fry+0.5)),
+            
tools::Rectangle(static_cast<tools::Long>(aC.fx-frx+0.5),static_cast<tools::Long>(aC.fy-fry+0.5),
+                      
static_cast<tools::Long>(aC.fx+frx+0.5),static_cast<tools::Long>(aC.fy+fry+0.5)),
             aPS,aPE
         );
     }
@@ -461,7 +461,7 @@ void DXF2GDIMetaFile::DrawInsertEntity(const 
DXFInsertEntity & rE, const DXFTran
         DXFTransform( aDXFTransform1, aDXFTransform2 ),
         rTransform
     );
-    long nSavedBlockColor, nSavedParentLayerColor;
+    tools::Long nSavedBlockColor, nSavedParentLayerColor;
     DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
     nSavedBlockColor=nBlockColor;
     nSavedParentLayerColor=nParentLayerColor;
@@ -661,7 +661,7 @@ void DXF2GDIMetaFile::DrawDimensionEntity(const 
DXFDimensionEntity & rE, const D
         DXFTransform(1.0,1.0,1.0,DXFVector(0.0,0.0,0.0)-pB->aBasePoint),
         rTransform
     );
-    long nSavedBlockColor, nSavedParentLayerColor;
+    tools::Long nSavedBlockColor, nSavedParentLayerColor;
     DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
     nSavedBlockColor=nBlockColor;
     nSavedParentLayerColor=nParentLayerColor;
@@ -854,8 +854,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & 
rDXF, GDIMetaFile & rMTF
                                                    
pDXF->aBoundingBox.fMaxY*fScale,
                                                   
-pDXF->aBoundingBox.fMinZ*fScale));
             }
-            aPrefSize.setWidth(static_cast<long>(fWidth*fScale+1.5) );
-            aPrefSize.setHeight(static_cast<long>(fHeight*fScale+1.5) );
+            aPrefSize.setWidth(static_cast<tools::Long>(fWidth*fScale+1.5) );
+            aPrefSize.setHeight(static_cast<tools::Long>(fHeight*fScale+1.5) );
         }
     }
     else {
@@ -876,8 +876,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & 
rDXF, GDIMetaFile & rMTF
                 )
             );
         }
-        aPrefSize.setWidth(static_cast<long>(fWidth*fScale+1.5) );
-        aPrefSize.setHeight(static_cast<long>(fHeight*fScale+1.5) );
+        aPrefSize.setWidth(static_cast<tools::Long>(fWidth*fScale+1.5) );
+        aPrefSize.setHeight(static_cast<tools::Long>(fHeight*fScale+1.5) );
     }
 
     if (bStatus)
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx 
b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
index de10b865f7f3..426932fd1fba 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx
@@ -40,9 +40,9 @@ private:
     sal_uInt16 nLastPercent;
     sal_uInt16 nMainEntitiesCount;
 
-    long        nBlockColor;
+    tools::Long        nBlockColor;
     DXFLineInfo aBlockDXFLineInfo;
-    long        nParentLayerColor;
+    tools::Long        nParentLayerColor;
     DXFLineInfo aParentLayerDXFLineInfo;
     Color       aActLineColor;
     Color       aActFillColor;
@@ -53,7 +53,7 @@ private:
 
     Color ConvertColor(sal_uInt8 nColor);
 
-    long GetEntityColor(const DXFBasicEntity & rE);
+    tools::Long GetEntityColor(const DXFBasicEntity & rE);
 
     DXFLineInfo LTypeToDXFLineInfo(OString const& rLineType);
 
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.hxx 
b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
index 5547f571134f..6aa488641d1a 100644
--- a/filter/source/graphicfilter/idxf/dxfblkrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfblkrd.hxx
@@ -36,7 +36,7 @@ public:
     // properties of blocks; commented with group codes:
     OString m_sName;                      //  2
     OString m_sAlsoName;                  //  3
-    long nFlags;                          // 70
+    tools::Long nFlags;                          // 70
     DXFVector aBasePoint;                 // 10,20,30
     OString m_sXRef;                      //  1
 
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.hxx 
b/filter/source/graphicfilter/idxf/dxfentrd.hxx
index 8c56ba6317c1..35b05bdbf4dc 100644
--- a/filter/source/graphicfilter/idxf/dxfentrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfentrd.hxx
@@ -22,6 +22,7 @@
 
 #include "dxfgrprd.hxx"
 #include "dxfvec.hxx"
+#include <tools/long.hxx>
 
 #include <memory>
 #include <vector>
@@ -64,8 +65,8 @@ public:
     OString m_sLayer;                     //  8
     OString m_sLineType;                  //  6
     double fThickness;                    // 39
-    long nColor;                          // 62
-    long nSpace;                          // 67
+    tools::Long nColor;                          // 62
+    tools::Long nSpace;                          // 67
     DXFVector aExtrusion;                 // 210,220,230
 
 protected:
@@ -192,9 +193,9 @@ public:
     double fXScale;                    // 41
     double fOblAngle;                  // 42
     OString m_sStyle;                  //  7
-    long nGenFlags;                    // 71
-    long nHorzJust;                    // 72
-    long nVertJust;                    // 73
+    tools::Long nGenFlags;                    // 71
+    tools::Long nHorzJust;                    // 72
+    tools::Long nVertJust;                    // 73
     DXFVector aAlign;                  // 11,21,31
 
     DXFTextEntity();
@@ -226,15 +227,15 @@ class DXFInsertEntity : public DXFBasicEntity {
 
 public:
 
-    long nAttrFlag;                   // 66
+    tools::Long nAttrFlag;                   // 66
     OString m_sName;                  //  2
     DXFVector aP0;                    // 10,20,30
     double fXScale;                   // 41
     double fYScale;                   // 42
     double fZScale;                   // 43
     double fRotAngle;                 // 50
-    long nColCount;                   // 70
-    long nRowCount;                   // 71
+    tools::Long nColCount;                   // 70
+    tools::Long nRowCount;                   // 71
     double fColSpace;                 // 44
     double fRowSpace;                 // 45
 
@@ -252,15 +253,15 @@ class DXFAttDefEntity : public DXFBasicEntity {
     OString m_sDefVal;                  //  1
     OString m_sPrompt;                  //  3
     OString m_sTagStr;                  //  2
-    long nAttrFlags;                    // 70
-    long nFieldLen;                     // 73
+    tools::Long nAttrFlags;                    // 70
+    tools::Long nFieldLen;                     // 73
     double fRotAngle;                   // 50
     double fXScale;                     // 41
     double fOblAngle;                   // 51
     OString m_sStyle;                   //  7
-    long nGenFlags;                     // 71
-    long nHorzJust;                     // 72
-    long nVertJust;                     // 74
+    tools::Long nGenFlags;                     // 71
+    tools::Long nHorzJust;                     // 72
+    tools::Long nVertJust;                     // 74
     DXFVector aAlign;                   // 11,21,31
 
 public:
@@ -280,15 +281,15 @@ public:
     double fHeight;                     // 40
     OString m_sText;                    //  1
     OString m_sTagStr;                  //  2
-    long nAttrFlags;                    // 70
-    long nFieldLen;                     // 73
+    tools::Long nAttrFlags;                    // 70
+    tools::Long nFieldLen;                     // 73
     double fRotAngle;                   // 50
     double fXScale;                     // 41
     double fOblAngle;                   // 51
     OString m_sStyle;                   //  7
-    long nGenFlags;                     // 71
-    long nHorzJust;                     // 72
-    long nVertJust;                     // 74
+    tools::Long nGenFlags;                     // 71
+    tools::Long nHorzJust;                     // 72
+    tools::Long nVertJust;                     // 74
     DXFVector aAlign;                   // 11,21,31
 
     DXFAttribEntity();
@@ -302,14 +303,14 @@ class DXFPolyLineEntity : public DXFBasicEntity {
 
 public:
 
-    long nFlags;       // 70
+    tools::Long nFlags;       // 70
     double fSWidth;    // 40
     double fEWidth;    // 41
-    long nMeshMCount;  // 71
-    long nMeshNCount;  // 72
-    long nMDensity;    // 73
-    long nNDensity;    // 74
-    long nCSSType;     // 75
+    tools::Long nMeshMCount;  // 71
+    tools::Long nMeshNCount;  // 72
+    tools::Long nMDensity;    // 73
+    tools::Long nNDensity;    // 74
+    tools::Long nCSSType;     // 75
 
     DXFPolyLineEntity();
 
@@ -456,7 +457,7 @@ public:
     double fSWidth;    // 40 (if <0.0, then one has DXFPolyLine::fSWidth)
     double fEWidth;    // 41 (if <0.0, then one has DXFPolyLine::fEWidth)
     double fBulge;     // 42
-    long nFlags;       // 70
+    tools::Long nFlags;       // 70
     double fCFTDir;    // 50
 
     DXFVertexEntity();
@@ -481,7 +482,7 @@ public:
     DXFVector aP1; // 11,21,31
     DXFVector aP2; // 12,22,32
     DXFVector aP3; // 13,23,33
-    long nIEFlags; // 70
+    tools::Long nIEFlags; // 70
 
     DXF3DFaceEntity();
 
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx 
b/filter/source/graphicfilter/idxf/dxfgrprd.cxx
index 9a65e560c57f..f5d42106c2ad 100644
--- a/filter/source/graphicfilter/idxf/dxfgrprd.cxx
+++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx
@@ -155,7 +155,7 @@ sal_uInt16 DXFGroupReader::Read()
     return nG;
 }
 
-long DXFGroupReader::ReadI()
+tools::Long DXFGroupReader::ReadI()
 {
     OString s = DXFReadLine(rIS);
     char *p=s.pData->buffer;
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.hxx 
b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
index d97f81a48e1b..f114f043eea8 100644
--- a/filter/source/graphicfilter/idxf/dxfgrprd.hxx
+++ b/filter/source/graphicfilter/idxf/dxfgrprd.hxx
@@ -23,6 +23,7 @@
 #include <rtl/string.hxx>
 #include <sal/types.h>
 #include <tools/solar.h>
+#include <tools/long.hxx>
 
 class SvStream;
 
@@ -44,7 +45,7 @@ public:
     sal_uInt16 GetG() const;
         // Return the last group code (the one the last Read() did return).
 
-    long   GetI() const;
+    tools::Long   GetI() const;
         // Returns the integer value of the group which was read earlier with 
Read().
         // This read must have returned a group code for datatype Integer.
         // If not 0 is returned
@@ -62,7 +63,7 @@ public:
     sal_uInt64 remainingSize() const;
 private:
 
-    long   ReadI();
+    tools::Long   ReadI();
     double ReadF();
     void   ReadS();
 
@@ -73,7 +74,7 @@ private:
     OString S;
     union {
         double F;
-        long I;
+        tools::Long I;
     };
 };
 
@@ -94,7 +95,7 @@ inline sal_uInt16 DXFGroupReader::GetG() const
     return nLastG;
 }
 
-inline long DXFGroupReader::GetI() const
+inline tools::Long DXFGroupReader::GetI() const
 {
     return I;
 }
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx 
b/filter/source/graphicfilter/idxf/dxftblrd.cxx
index e328c797a0f1..7820b04f4343 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx
@@ -32,7 +32,7 @@ DXFLType::DXFLType()
 
 void DXFLType::Read(DXFGroupReader & rDGR)
 {
-    long nDashIndex=-1;
+    tools::Long nDashIndex=-1;
 
     while (rDGR.Read()!=0)
     {
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx 
b/filter/source/graphicfilter/idxf/dxftblrd.hxx
index fa9eb2ae6bba..9549458dabd5 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.hxx
@@ -36,9 +36,9 @@ public:
     DXFLType * pSucc;
 
     OString m_sName;                         //  2
-    long nFlags;                             // 70
+    tools::Long nFlags;                             // 70
     OString m_sDescription;                  //  3
-    long nDashCount;                         // 73
+    tools::Long nDashCount;                         // 73
     double fPatternLength;                   // 40
     double fDash[DXF_MAX_DASH_COUNT];        // 49,49,...
 
@@ -57,8 +57,8 @@ public:
     DXFLayer * pSucc;
 
     OString m_sName;                      //  2
-    long nFlags;                          // 70
-    long nColor;                          // 62
+    tools::Long nFlags;                          // 70
+    tools::Long nColor;                          // 62
     OString m_sLineType;                  //  6
 
     DXFLayer();
@@ -76,11 +76,11 @@ public:
     DXFStyle * pSucc;
 
     OString m_sName;                          //  2
-    long nFlags;                              // 70
+    tools::Long nFlags;                              // 70
     double fHeight;                           // 40
     double fWidthFak;                         // 41
     double fOblAngle;                         // 50
-    long nTextGenFlags;                       // 71
+    tools::Long nTextGenFlags;                       // 71
     double fLastHeightUsed;                   // 42
     OString m_sPrimFontFile;                  //  3
     OString m_sBigFontFile;                   //  4
@@ -100,7 +100,7 @@ public:
     DXFVPort * pSucc;
 
     OString m_sName;                  //  2
-    long nFlags;                      // 70
+    tools::Long nFlags;                      // 70
     double fMinX;                     // 10
     double fMinY;                     // 20
     double fMaxX;                     // 11
@@ -121,16 +121,16 @@ public:
     double fFrontClipPlane;           // 43
     double fBackClipPlane;            // 44
     double fTwistAngle;               // 51
-    long nStatus;                     // 68
-    long nID;                         // 69
-    long nMode;                       // 71
-    long nCircleZoomPercent;          // 72
-    long nFastZoom;                   // 73
-    long nUCSICON;                    // 74
-    long nSnap;                       // 75
-    long nGrid;                       // 76
-    long nSnapStyle;                  // 77
-    long nSnapIsopair;                // 78
+    tools::Long nStatus;                     // 68
+    tools::Long nID;                         // 69
+    tools::Long nMode;                       // 71
+    tools::Long nCircleZoomPercent;          // 72
+    tools::Long nFastZoom;                   // 73
+    tools::Long nUCSICON;                    // 74
+    tools::Long nSnap;                       // 75
+    tools::Long nGrid;                       // 76
+    tools::Long nSnapStyle;                  // 77
+    tools::Long nSnapIsopair;                // 78
 
     DXFVPort();
     void Read(DXFGroupReader & rDGR);
diff --git a/filter/source/graphicfilter/idxf/dxfvec.cxx 
b/filter/source/graphicfilter/idxf/dxfvec.cxx
index e0189c3eca51..fb1ff647d591 100644
--- a/filter/source/graphicfilter/idxf/dxfvec.cxx
+++ b/filter/source/graphicfilter/idxf/dxfvec.cxx
@@ -152,8 +152,8 @@ void DXFTransform::Transform(const DXFVector & rSrc, 
DXFVector & rTgt) const
 
 void DXFTransform::Transform(const DXFVector & rSrc, Point & rTgt) const
 {
-    rTgt.setX(static_cast<long>( rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + rSrc.fz 
* aMZ.fx + aMP.fx + 0.5 ) );
-    rTgt.setY(static_cast<long>( rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + rSrc.fz 
* aMZ.fy + aMP.fy + 0.5 ) );
+    rTgt.setX(static_cast<tools::Long>( rSrc.fx * aMX.fx + rSrc.fy * aMY.fx + 
rSrc.fz * aMZ.fx + aMP.fx + 0.5 ) );
+    rTgt.setY(static_cast<tools::Long>( rSrc.fx * aMX.fy + rSrc.fy * aMY.fy + 
rSrc.fz * aMZ.fy + aMP.fy + 0.5 ) );
 }
 
 
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index ee1315f2bf28..010d984d3eb0 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -70,11 +70,11 @@ static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, 
sal_uInt8 const * pDest,
 
 
 // SecurityCount is the buffersize of the buffer in which we will parse for a 
number
-static long ImplGetNumber(sal_uInt8* &rBuf, sal_uInt32& nSecurityCount)
+static tools::Long ImplGetNumber(sal_uInt8* &rBuf, sal_uInt32& nSecurityCount)
 {
     bool    bValid = true;
     bool    bNegative = false;
-    long    nRetValue = 0;
+    tools::Long    nRetValue = 0;
     while (nSecurityCount && (*rBuf == ' ' || *rBuf == 0x9))
     {
         ++rBuf;
@@ -466,7 +466,7 @@ static void CreateMtfReplacementAction( GDIMetaFile& rMtf, 
SvStream& rStrm, sal_
 
 //there is no preview -> make a red box
 static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
-    long nWidth, long nHeight, Graphic &rGraphic)
+    tools::Long nWidth, tools::Long nHeight, Graphic &rGraphic)
 {
     GDIMetaFile aMtf;
     ScopedVclPtrInstance< VirtualDevice > pVDev;
@@ -664,15 +664,15 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
                 {
                     pDest += 15;
                     nSecurityCount = nRemainingBytes - 15;
-                    long nWidth = ImplGetNumber(pDest, nSecurityCount);
-                    long nHeight = ImplGetNumber(pDest, nSecurityCount);
-                    long nBitDepth = ImplGetNumber(pDest, nSecurityCount);
-                    long nScanLines = ImplGetNumber(pDest, nSecurityCount);
+                    tools::Long nWidth = ImplGetNumber(pDest, nSecurityCount);
+                    tools::Long nHeight = ImplGetNumber(pDest, nSecurityCount);
+                    tools::Long nBitDepth = ImplGetNumber(pDest, 
nSecurityCount);
+                    tools::Long nScanLines = ImplGetNumber(pDest, 
nSecurityCount);
                     pDest = ImplSearchEntry(pDest, reinterpret_cast<sal_uInt8 
const *>("%"), nSecurityCount, 1);       // go to the first Scanline
                     bOk = pDest && nWidth > 0 && nHeight > 0 && ( ( nBitDepth 
== 1 ) || ( nBitDepth == 8 ) ) && nScanLines;
                     if (bOk)
                     {
-                        long nResult;
+                        tools::Long nResult;
                         bOk = !o3tl::checked_multiply(nWidth, nHeight, 
nResult) && nResult <= SAL_MAX_INT32/2/3;
                     }
                     if (bOk)
@@ -684,10 +684,10 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
                             bool bIsValid = true;
                             sal_uInt8 nDat = 0;
                             char nByte;
-                            for (long y = 0; bIsValid && y < nHeight; ++y)
+                            for (tools::Long y = 0; bIsValid && y < nHeight; 
++y)
                             {
                                 int nBitsLeft = 0;
-                                for (long x = 0; x < nWidth; ++x)
+                                for (tools::Long x = 0; x < nWidth; ++x)
                                 {
                                     if ( --nBitsLeft < 0 )
                                     {
@@ -770,14 +770,14 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
             {
                 pDest += 14;
                 nSecurityCount = std::min<sal_uInt32>(nRemainingBytes - 14, 
100);
-                long nNumb[4];
+                tools::Long nNumb[4];
                 nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
                 for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
                 {
                     nNumb[ i ] = ImplGetNumber(pDest, nSecurityCount);
                 }
                 bool bFail = nSecurityCount == 0;
-                long nWidth(0), nHeight(0);
+                tools::Long nWidth(0), nHeight(0);
                 if (!bFail)
                     bFail = o3tl::checked_sub(nNumb[2], nNumb[0], nWidth) || 
o3tl::checked_add(nWidth, 1L, nWidth);
                 if (!bFail)
diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx 
b/filter/source/graphicfilter/ipcd/ipcd.cxx
index 4aa33c116796..b2b585606286 100644
--- a/filter/source/graphicfilter/ipcd/ipcd.cxx
+++ b/filter/source/graphicfilter/ipcd/ipcd.cxx
@@ -184,7 +184,7 @@ void PCDReader::ReadOrientation()
 void PCDReader::ReadImage()
 {
     sal_uInt32  nx,ny,nW2,nH2,nYPair,ndy,nXPair;
-    long   nL,nCb,nCr,nRed,nGreen,nBlue;
+    tools::Long   nL,nCb,nCr,nRed,nGreen,nBlue;
     sal_uInt8 * pt;
     sal_uInt8 * pL0; // luminance for each pixel of the 1st row of the current 
pair of rows
     sal_uInt8 * pL1; // luminance for each pixel of the 2nd row of the current 
pair of rows
@@ -271,31 +271,31 @@ void PCDReader::ReadImage()
                 nXPair = nx >> 1;
                 if ( ndy == 0 )
                 {
-                    nL = static_cast<long>(pL0[ nx ]);
+                    nL = static_cast<tools::Long>(pL0[ nx ]);
                     if (( nx & 1 ) == 0 )
                     {
-                        nCb = static_cast<long>(pCb[ nXPair ]);
-                        nCr = static_cast<long>(pCr[ nXPair ]);
+                        nCb = static_cast<tools::Long>(pCb[ nXPair ]);
+                        nCr = static_cast<tools::Long>(pCr[ nXPair ]);
                     }
                     else
                     {
-                        nCb = ( static_cast<long>(pCb[ nXPair ]) + 
static_cast<long>(pCb[ nXPair + 1 ]) ) >> 1;
-                        nCr = ( static_cast<long>(pCr[ nXPair ]) + 
static_cast<long>(pCr[ nXPair + 1 ]) ) >> 1;
+                        nCb = ( static_cast<tools::Long>(pCb[ nXPair ]) + 
static_cast<tools::Long>(pCb[ nXPair + 1 ]) ) >> 1;
+                        nCr = ( static_cast<tools::Long>(pCr[ nXPair ]) + 
static_cast<tools::Long>(pCr[ nXPair + 1 ]) ) >> 1;
                     }
                 }
                 else {
                     nL = pL1[ nx ];
                     if ( ( nx & 1 ) == 0 )
                     {
-                        nCb = ( static_cast<long>(pCb[ nXPair ]) + 
static_cast<long>(pCbN[ nXPair ]) ) >> 1;
-                        nCr = ( static_cast<long>(pCr[ nXPair ]) + 
static_cast<long>(pCrN[ nXPair ]) ) >> 1;
+                        nCb = ( static_cast<tools::Long>(pCb[ nXPair ]) + 
static_cast<tools::Long>(pCbN[ nXPair ]) ) >> 1;
+                        nCr = ( static_cast<tools::Long>(pCr[ nXPair ]) + 
static_cast<tools::Long>(pCrN[ nXPair ]) ) >> 1;
                     }
                     else
                     {
-                        nCb = ( static_cast<long>(pCb[ nXPair ]) + 
static_cast<long>(pCb[ nXPair + 1 ]) +
-                               static_cast<long>(pCbN[ nXPair ]) + 
static_cast<long>(pCbN[ nXPair + 1 ]) ) >> 2;
-                        nCr = ( static_cast<long>(pCr[ nXPair ]) + 
static_cast<long>(pCr[ nXPair + 1]) +
-                               static_cast<long>(pCrN[ nXPair ]) + 
static_cast<long>(pCrN[ nXPair + 1 ]) ) >> 2;
+                        nCb = ( static_cast<tools::Long>(pCb[ nXPair ]) + 
static_cast<tools::Long>(pCb[ nXPair + 1 ]) +
+                               static_cast<tools::Long>(pCbN[ nXPair ]) + 
static_cast<tools::Long>(pCbN[ nXPair + 1 ]) ) >> 2;
+                        nCr = ( static_cast<tools::Long>(pCr[ nXPair ]) + 
static_cast<tools::Long>(pCr[ nXPair + 1]) +
+                               static_cast<tools::Long>(pCrN[ nXPair ]) + 
static_cast<tools::Long>(pCrN[ nXPair + 1 ]) ) >> 2;
                     }
                 }
                 // conversion of nL,nCb,nCr in nRed,nGreen,nBlue:
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx 
b/filter/source/graphicfilter/ipict/ipict.cxx
index d494543fb1b4..43b872f09558 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -365,8 +365,8 @@ Point PictReader::ReadPoint()
 
     pPict->ReadInt16( ny ).ReadInt16( nx );
 
-    Point aPoint( static_cast<long>(nx) - aBoundingRect.Left(),
-                 static_cast<long>(ny) - aBoundingRect.Top() );
+    Point aPoint( static_cast<tools::Long>(nx) - aBoundingRect.Left(),
+                 static_cast<tools::Long>(ny) - aBoundingRect.Top() );
 
     SAL_INFO("filter.pict", "ReadPoint: " << aPoint);
     return aPoint;
@@ -378,7 +378,7 @@ Point PictReader::ReadDeltaH(Point aBase)
 
     pPict->ReadChar( reinterpret_cast<char&>(ndh) );
 
-    return Point( aBase.X() + static_cast<long>(ndh), aBase.Y() );
+    return Point( aBase.X() + static_cast<tools::Long>(ndh), aBase.Y() );
 }
 
 Point PictReader::ReadDeltaV(Point aBase)
@@ -387,7 +387,7 @@ Point PictReader::ReadDeltaV(Point aBase)
 
     pPict->ReadChar( reinterpret_cast<char&>(ndv) );
 
-    return Point( aBase.X(), aBase.Y() + static_cast<long>(ndv) );
+    return Point( aBase.X(), aBase.Y() + static_cast<tools::Long>(ndv) );
 }
 
 Point PictReader::ReadUnsignedDeltaH(Point aBase)
@@ -396,7 +396,7 @@ Point PictReader::ReadUnsignedDeltaH(Point aBase)
 
     pPict->ReadUChar( ndh );
 
-    return Point( aBase.X() + static_cast<long>(ndh), aBase.Y() );
+    return Point( aBase.X() + static_cast<tools::Long>(ndh), aBase.Y() );
 }
 
 Point PictReader::ReadUnsignedDeltaV(Point aBase)
@@ -405,7 +405,7 @@ Point PictReader::ReadUnsignedDeltaV(Point aBase)
 
     pPict->ReadUChar( ndv );
 
-    return Point( aBase.X(), aBase.Y() + static_cast<long>(ndv) );
+    return Point( aBase.X(), aBase.Y() + static_cast<tools::Long>(ndv) );
 }
 
 Size PictReader::ReadSize()
@@ -414,7 +414,7 @@ Size PictReader::ReadSize()
 
     pPict->ReadInt16( ny ).ReadInt16( nx );
 
-    return Size( static_cast<long>(nx), static_cast<long>(ny) );
+    return Size( static_cast<tools::Long>(nx), static_cast<tools::Long>(ny) );
 }
 
 Color PictReader::ReadColor()
@@ -1444,7 +1444,7 @@ sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode)
     case 0x000d:   // TxSize
     {
         pPict->ReadUInt16( nUSHORT );
-        aActFont.SetFontSize( Size( 0, static_cast<long>(nUSHORT) ) );
+        aActFont.SetFontSize( Size( 0, static_cast<tools::Long>(nUSHORT) ) );
         eActMethod = PictDrawingMethod::UNDEFINED;
         nDataSize=2;
     }
diff --git a/filter/source/graphicfilter/ipict/shape.cxx 
b/filter/source/graphicfilter/ipict/shape.cxx
index f058dcf5d87f..79643123639c 100644
--- a/filter/source/graphicfilter/ipict/shape.cxx
+++ b/filter/source/graphicfilter/ipict/shape.cxx
@@ -40,11 +40,11 @@ namespace PictReaderShapePrivate {
       when we draw a frame in wide length*/
   static tools::Rectangle contractRectangle(bool drawFrame, tools::Rectangle 
const &rect, Size const &pSize) {
     if (!drawFrame) return rect;
-    long penSize=(pSize.Width()+pSize.Height())/2;
+    tools::Long penSize=(pSize.Width()+pSize.Height())/2;
     if (2*penSize > rect.Right()-rect.Left()) penSize = 
(rect.Right()-rect.Left()+1)/2;
     if (2*penSize > rect.Bottom()-rect.Top()) penSize = 
(rect.Bottom()-rect.Top()+1)/2;
-    long const X[2] = { rect.Left()+penSize/2, rect.Right()-(penSize+1)/2 };
-    long const Y[2] = { rect.Top()+penSize/2, rect.Bottom()-(penSize+1)/2 };
+    tools::Long const X[2] = { rect.Left()+penSize/2, 
rect.Right()-(penSize+1)/2 };
+    tools::Long const Y[2] = { rect.Top()+penSize/2, 
rect.Bottom()-(penSize+1)/2 };
     return tools::Rectangle(Point(X[0],Y[0]), Point(X[1], Y[1]));
   }
 }
@@ -52,7 +52,7 @@ namespace PictReaderShapePrivate {
 namespace PictReaderShape {
   //--------- draws a horizontal/vertical/small line (by creating a 
"rectangle/polygon")  ---------
   static bool drawLineHQ(VirtualDevice *dev, Point const &orig, Point const 
&dest, Size const &pSize) {
-    long dir[2] = { dest.X()-orig.X(), dest.Y()-orig.Y() };
+    tools::Long dir[2] = { dest.X()-orig.X(), dest.Y()-orig.Y() };
     bool vertic = dir[0] == 0;
     bool horiz = dir[1] == 0;
     if (!horiz && !vertic && dir[0]*dir[0]+dir[1]*dir[1] > 25) return false;
@@ -60,7 +60,7 @@ namespace PictReaderShape {
     using namespace basegfx;
     B2DPolygon poly;
     if (horiz || vertic) {
-      long X[2]={ orig.X(), dest.X() }, Y[2] = { orig.Y(), dest.Y() };
+      tools::Long X[2]={ orig.X(), dest.X() }, Y[2] = { orig.Y(), dest.Y() };
       if (horiz) {
     if (X[0] < X[1]) X[1]+=pSize.Width();
     else X[0]+=pSize.Width();
@@ -76,11 +76,11 @@ namespace PictReaderShape {
       poly.append(B2DPoint(X[0], Y[0]));
     }
     else {
-      long origPt[4][2] = { { orig.X(), orig.Y() }, { orig.X()+pSize.Width(), 
orig.Y() },
+      tools::Long origPt[4][2] = { { orig.X(), orig.Y() }, { 
orig.X()+pSize.Width(), orig.Y() },
                { orig.X()+pSize.Width(), orig.Y()+pSize.Height() },
                { orig.X(), orig.Y()+pSize.Height() }};
       int origAvoid = dir[0] > 0 ? (dir[1] > 0 ? 2 : 1) : (dir[1] > 0 ? 3 : 0);
-      long destPt[4][2] = { { dest.X(), dest.Y() }, { dest.X()+pSize.Width(), 
dest.Y() },
+      tools::Long destPt[4][2] = { { dest.X(), dest.Y() }, { 
dest.X()+pSize.Width(), dest.Y() },
                { dest.X()+pSize.Width(), dest.Y()+pSize.Height() },
                { dest.X(), dest.Y()+pSize.Height() }};
       for (int w = origAvoid+1; w < origAvoid+4; w++) {
@@ -111,8 +111,8 @@ namespace PictReaderShape {
   void drawLine(VirtualDevice *dev, Point const &orig, Point const &dest, Size 
const &pSize) {
     if (drawLineHQ(dev,orig,dest,pSize)) return;
 
-    long penSize=(pSize.Width()+pSize.Height())/2;
-    long decal[2] = { pSize.Width()/2, pSize.Height()/2};
+    tools::Long penSize=(pSize.Width()+pSize.Height())/2;
+    tools::Long decal[2] = { pSize.Width()/2, pSize.Height()/2};
 
     using namespace basegfx;
     B2DPolygon poly;
@@ -128,8 +128,8 @@ namespace PictReaderShape {
   void drawRectangle(VirtualDevice *dev, bool drawFrame, tools::Rectangle 
const &orig, Size const &pSize) {
     int penSize=(pSize.Width()+pSize.Height())/2;
     tools::Rectangle rect = 
PictReaderShapePrivate::contractRectangle(drawFrame, orig, pSize);
-    long const X[2] = { rect.Left(), rect.Right() };
-    long const Y[2] = { rect.Top(), rect.Bottom() };
+    tools::Long const X[2] = { rect.Left(), rect.Right() };
+    tools::Long const Y[2] = { rect.Top(), rect.Bottom() };
 
     using namespace basegfx;
     B2DPolygon poly;
@@ -148,8 +148,8 @@ namespace PictReaderShape {
     int penSize=(pSize.Width()+pSize.Height())/2;
     tools::Rectangle oval = 
PictReaderShapePrivate::contractRectangle(drawFrame, orig, pSize);
     using namespace basegfx;
-    long const X[2] = { oval.Left(), oval.Right() };
-    long const Y[2] = { oval.Top(), oval.Bottom() };
+    tools::Long const X[2] = { oval.Left(), oval.Right() };
+    tools::Long const Y[2] = { oval.Top(), oval.Bottom() };
     B2DPoint center(0.5*(X[1]+X[0]), 0.5*(Y[1]+Y[0]));
     B2DPolygon poly = basegfx::utils::createPolygonFromEllipse(center, 
0.5*(X[1]-X[0]), 0.5*(Y[1]-Y[0]));
     if (drawFrame)
@@ -167,8 +167,8 @@ namespace PictReaderShape {
     // pict angle are CW with 0 at twelve o'clock (with Y-axis inverted)...
     double angl1 = angle1-M_PI_2;
     double angl2 = angle2-M_PI_2;
-    long const X[2] = { arc.Left(), arc.Right() };
-    long const Y[2] = { arc.Top(), arc.Bottom() };
+    tools::Long const X[2] = { arc.Left(), arc.Right() };
+    tools::Long const Y[2] = { arc.Top(), arc.Bottom() };
     B2DPoint center(0.5*(X[1]+X[0]), 0.5*(Y[1]+Y[0]));
 
     // We must have angl1 between 0 and F_2PI
@@ -198,10 +198,10 @@ namespace PictReaderShape {
     tools::Rectangle oval = 
PictReaderShapePrivate::contractRectangle(drawFrame, orig, pSize);
     int ovalW=ovalSize.Width(), ovalH=ovalSize.Height();
     using namespace basegfx;
-    long const X[2] = { oval.Left(), oval.Right() };
-    long const Y[2] = { oval.Top(), oval.Bottom() };
-    long width = X[1] - X[0];
-    long height = Y[1] - Y[0];
+    tools::Long const X[2] = { oval.Left(), oval.Right() };
+    tools::Long const Y[2] = { oval.Top(), oval.Bottom() };
+    tools::Long width = X[1] - X[0];
+    tools::Long height = Y[1] - Y[0];
     if (ovalW > width) ovalW = static_cast< int >( width );
     if (ovalH > height) ovalH = static_cast< int >( height );
 
@@ -217,7 +217,7 @@ namespace PictReaderShape {
   //--------------------  draws a polygon --------------------
 void drawPolygon(VirtualDevice *dev, bool drawFrame, tools::Polygon const 
&orig, Size const &pSize) {
     int penSize=(pSize.Width()+pSize.Height())/2;
-    long decalTL[2] = {0, 0}, decalBR[2] = { pSize.Width(), pSize.Height()};
+    tools::Long decalTL[2] = {0, 0}, decalBR[2] = { pSize.Width(), 
pSize.Height()};
     if (drawFrame) {
       decalTL[0] += penSize/2; decalTL[1] += penSize/2;
       decalBR[0] -= (penSize+1)/2; decalBR[1] -= (penSize+1)/2;
diff --git a/filter/source/graphicfilter/itga/itga.cxx 
b/filter/source/graphicfilter/itga/itga.cxx
index ddf2db50f30d..beec1bc8781e 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -268,7 +268,7 @@ bool TGAReader::ImplReadBody()
     sal_uInt8   nRed, nGreen, nBlue, nRunCount, nDummy, nDepth;
 
     // this four variables match the image direction
-    long    nY, nYAdd, nX, nXAdd, nXStart;
+    tools::Long    nY, nYAdd, nX, nXAdd, nXStart;
 
     nX = nXStart = nY = 0;
     nXCount = nYCount = 0;
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 7d62e3f45500..370371ece4fe 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -124,9 +124,9 @@ private:
 
     bool HasAlphaChannel() const;
 
-    void SetPixel(long nY, long nX, sal_uInt8 cIndex);
-    void SetPixel(long nY, long nX, Color c);
-    void SetPixelAlpha(long nY, long nX, sal_uInt8 nAlpha);
+    void SetPixel(tools::Long nY, tools::Long nX, sal_uInt8 cIndex);
+    void SetPixel(tools::Long nY, tools::Long nX, Color c);
+    void SetPixelAlpha(tools::Long nY, tools::Long nX, sal_uInt8 nAlpha);
 
 public:
 
@@ -825,13 +825,13 @@ sal_uInt32 TIFFReader::GetBits( const sal_uInt8 * pSrc, 
sal_uInt32 nBitsPos, sal
     return nRes;
 }
 
-void TIFFReader::SetPixel(long nY, long nX, sal_uInt8 cIndex)
+void TIFFReader::SetPixel(tools::Long nY, tools::Long nX, sal_uInt8 cIndex)
 {
     maBitmap[(maBitmapPixelSize.Width() * nY + nX) * (HasAlphaChannel() ? 4 : 
3)] = cIndex;
     nLargestPixelIndex = std::max<int>(nLargestPixelIndex, cIndex);
 }
 
-void TIFFReader::SetPixel(long nY, long nX, Color c)
+void TIFFReader::SetPixel(tools::Long nY, tools::Long nX, Color c)
 {
     auto p = maBitmap.data() + ((maBitmapPixelSize.Width() * nY + nX) * 
(HasAlphaChannel() ? 4 : 3));
     *p = c.GetRed();
@@ -846,7 +846,7 @@ void TIFFReader::SetPixel(long nY, long nX, Color c)
     }
 }
 
-void TIFFReader::SetPixelAlpha(long nY, long nX, sal_uInt8 nAlpha)
+void TIFFReader::SetPixelAlpha(tools::Long nY, tools::Long nX, sal_uInt8 
nAlpha)
 {
     assert(HasAlphaChannel());
     maBitmap[((maBitmapPixelSize.Width() * nY + nX) * 4) + 3] = nAlpha;
@@ -980,7 +980,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
                                 nSamp[ ns ]= static_cast<sal_uInt8>(GetBits( 
getMapData(ns), nx * nBitsPerSample, nBitsPerSample ));
                         }
                     }
-                    const long nBlack = nSamp[ 3 ];
+                    const tools::Long nBlack = nSamp[ 3 ];
                     nRed = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( 
static_cast<sal_Int32>(nSamp[ 0 ]) + nBlack - 
static_cast<sal_Int32>(nMinSampleValue << 1U ) ) *
                                 
255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) ));
                     nGreen = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( 
static_cast<sal_Int32>(nSamp[ 1 ]) + nBlack - 
static_cast<sal_Int32>(nMinSampleValue << 1U ) ) *
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index a32eed5a017d..31ec360272a5 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1158,9 +1158,9 @@ static void ApplyRectangularGradientAsBitmap( const 
SvxMSDffManager& rManager, S
 
     vcl::bitmap::RawBitmap aBitmap(aBitmapSizePixel, 24);
 
-    for ( long nY = 0; nY < aBitmapSizePixel.Height(); nY++ )
+    for ( tools::Long nY = 0; nY < aBitmapSizePixel.Height(); nY++ )
     {
-        for ( long nX = 0; nX < aBitmapSizePixel.Width(); nX++ )
+        for ( tools::Long nX = 0; nX < aBitmapSizePixel.Width(); nX++ )
         {
             double fX = static_cast< double >( nX ) / aBitmapSizePixel.Width();
             double fY = static_cast< double >( nY ) / 
aBitmapSizePixel.Height();
@@ -1406,10 +1406,10 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& 
rIn, SfxItemSet& rSet, co
                             {
                                 Bitmap::ScopedReadAccess pRead(aBmp);
 
-                                for (long y = 0; y < aResult.Height(); ++y)
+                                for (tools::Long y = 0; y < aResult.Height(); 
++y)
                                 {
                                     Scanline pScanlineRead = 
pRead->GetScanline( y );
-                                    for (long x = 0; x < aResult.Width(); ++x)
+                                    for (tools::Long x = 0; x < 
aResult.Width(); ++x)
                                     {
                                         Color aReadColor;
                                         if (pRead->HasPalette())
@@ -3126,8 +3126,8 @@ sal_uInt32 SvxMSDffManager::ScalePt( sal_uInt32 nVal ) 
const
 {
     MapUnit eMap = pSdrModel->GetScaleUnit();
     Fraction aFact( GetMapFactor( MapUnit::MapPoint, eMap ).X() );
-    long aMul = aFact.GetNumerator();
-    long aDiv = aFact.GetDenominator() * 65536;
+    tools::Long aMul = aFact.GetNumerator();
+    tools::Long aDiv = aFact.GetDenominator() * 65536;
     aFact = Fraction( aMul, aDiv ); // try again to shorten it
     return BigMulDiv( nVal, aFact.GetNumerator(), aFact.GetDenominator() );
 }
@@ -3137,7 +3137,7 @@ sal_Int32 SvxMSDffManager::ScalePoint( sal_Int32 nVal ) 
const
     return BigMulDiv( nVal, nPntMul, nPntDiv );
 };
 
-void SvxMSDffManager::SetModel(SdrModel* pModel, long nApplicationScale)
+void SvxMSDffManager::SetModel(SdrModel* pModel, tools::Long nApplicationScale)
 {
     pSdrModel = pModel;
     if( pModel && (0 < nApplicationScale) )
@@ -3146,8 +3146,8 @@ void SvxMSDffManager::SetModel(SdrModel* pModel, long 
nApplicationScale)
         // WW on the other side uses twips, i.e. 1440DPI.
         MapUnit eMap = pSdrModel->GetScaleUnit();
         Fraction aFact( GetMapFactor(MapUnit::MapInch, eMap).X() );
-        long nMul=aFact.GetNumerator();
-        long nDiv=aFact.GetDenominator()*nApplicationScale;
+        tools::Long nMul=aFact.GetNumerator();
+        tools::Long nDiv=aFact.GetDenominator()*nApplicationScale;
         aFact=Fraction(nMul,nDiv); // try again to shorten it
         // For 100TH_MM -> 2540/576=635/144
         // For Twip     -> 1440/576=5/2
@@ -4077,8 +4077,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const 
DffRecordHeader& rHd, SvStream& r
                 sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
                 Point aTopLeft( aClientRect.Left() + nHalfWidth - nHalfHeight,
                                 aClientRect.Top() + nHalfHeight - nHalfWidth );
-                const long nRotatedWidth = aClientRect.GetHeight();
-                const long nRotatedHeight = aClientRect.GetWidth();
+                const tools::Long nRotatedWidth = aClientRect.GetHeight();
+                const tools::Long nRotatedHeight = aClientRect.GetWidth();
                 Size aNewSize(nRotatedWidth, nRotatedHeight);
                 tools::Rectangle aNewRect( aTopLeft, aNewSize );
                 aClientRect = aNewRect;
@@ -4286,7 +4286,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
     {   // apply rotation to the BoundingBox BEFORE an object has been 
generated
         if( mnFix16Angle )
         {
-            long nAngle = mnFix16Angle;
+            tools::Long nAngle = mnFix16Angle;
             if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && 
nAngle <= 31500 ) )
             {
                 sal_Int32 nHalfWidth = ( aObjData.aBoundRect.GetWidth() + 1 ) 
>> 1;
@@ -5258,7 +5258,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                 {
                     case 9000:
                         {
-                            long nWidth = rTextRect.GetWidth();
+                            tools::Long nWidth = rTextRect.GetWidth();
                             rTextRect.SetRight( rTextRect.Left() + 
rTextRect.GetHeight() );
                             rTextRect.SetBottom( rTextRect.Top() + nWidth );
 
@@ -5275,7 +5275,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                         break;
                     case 27000:
                         {
-                            long nWidth = rTextRect.GetWidth();
+                            tools::Long nWidth = rTextRect.GetWidth();
                             rTextRect.SetRight( rTextRect.Left() + 
rTextRect.GetHeight() );
                             rTextRect.SetBottom( rTextRect.Top() + nWidth );
 
@@ -5429,7 +5429,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
 
             if (nTextRotationAngle)
             {
-                long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ?
+                tools::Long nMinWH = rTextRect.GetWidth() < 
rTextRect.GetHeight() ?
                     rTextRect.GetWidth() : rTextRect.GetHeight();
                 nMinWH /= 2;
                 Point aPivot(rTextRect.TopLeft());
@@ -5677,7 +5677,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
                                  sal_uInt32 nOffsDgg_,
                                  SvStream* pStData_,
                                  SdrModel* pSdrModel_,// see SetModel() below
-                                 long      nApplicationScale,
+                                 tools::Long      nApplicationScale,
                                  Color     mnDefaultColor_,
                                  SvStream* pStData2_,
                                  bool bSkipImages )
@@ -6078,7 +6078,7 @@ bool SvxMSDffManager::GetShapeGroupContainerData( 
SvStream& rSt,
                                                   sal_uInt16 
nDrawingContainerId )
 {
     sal_uInt8 nVer;sal_uInt16 nInst;sal_uInt16 nFbt;sal_uInt32 nLength;
-    long nStartShapeGroupCont = rSt.Tell();
+    tools::Long nStartShapeGroupCont = rSt.Tell();
     // We are now in a shape group container (conditionally multiple per page)
     // and we now have to iterate through all contained shape containers
     bool  bFirst = !bPatriarch;
@@ -6121,7 +6121,7 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& 
rSt,
                                              sal_uInt16 nDrawingContainerId )
 {
     sal_uInt8 nVer;sal_uInt16 nInst;sal_uInt16 nFbt;sal_uInt32 nLength;
-    long  nStartShapeCont = rSt.Tell();
+    tools::Long  nStartShapeCont = rSt.Tell();
 
     // We are in a shape container (possibly more than one per shape group) 
and we now
     // have to fetch the shape id and file position (to be able to access them 
again later)
diff --git a/filter/source/msfilter/mstoolbar.cxx 
b/filter/source/msfilter/mstoolbar.cxx
index fee6cae04c2d..441b60c3ca98 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
 
 int TBBase::nIndent = 0;
 
-void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic 
>& xGraphic, long nNewSize )
+void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic 
>& xGraphic, tools::Long nNewSize )
 {
     Graphic aGraphic( xGraphic );
     Size aSize = aGraphic.GetSizePixel();
diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index 786c538e18ea..e63d8eb588b7 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2512,7 +2512,7 @@ Size SdrPowerPointImport::GetPageSize() const
     {
         MapUnit eMap = pSdrModel->GetScaleUnit();
         bool bInch = IsInch( eMap );
-        long nInchMul = 1, nInchDiv = 1;
+        tools::Long nInchMul = 1, nInchDiv = 1;
         if ( bInch )
         {   // temporarily convert size (for rounding it) from inch to metric 
units
             Fraction aFact(GetMapFactor(eMap,MapUnit::Map100thMM).X());
@@ -5655,15 +5655,15 @@ void PPTPortionObj::ApplyTo(  SfxItemSet& rSet, 
SdrPowerPointImport& rManager, T
                         if( pAcc )
                         {
                             sal_uLong nRt = 0, nGn = 0, nBl = 0;
-                            const long nWidth = aSize.Width();
-                            const long nHeight = aSize.Height();
+                            const tools::Long nWidth = aSize.Width();
+                            const tools::Long nHeight = aSize.Height();
 
                             if( pAcc->HasPalette() )
                             {
-                                for( long nY = 0; nY < nHeight; nY++ )
+                                for( tools::Long nY = 0; nY < nHeight; nY++ )
                                 {
                                     Scanline pScanline = pAcc->GetScanline( nY 
);
-                                    for( long nX = 0; nX < nWidth; nX++ )
+                                    for( tools::Long nX = 0; nX < nWidth; nX++ 
)
                                     {
                                         const BitmapColor& rCol = 
pAcc->GetPaletteColor( pAcc->GetIndexFromData( pScanline, nX ) );
                                         nRt+=rCol.GetRed(); 
nGn+=rCol.GetGreen(); nBl+=rCol.GetBlue();
@@ -5672,10 +5672,10 @@ void PPTPortionObj::ApplyTo(  SfxItemSet& rSet, 
SdrPowerPointImport& rManager, T
                             }
                             else
                             {
-                                for( long nY = 0; nY < nHeight; nY++ )
+                                for( tools::Long nY = 0; nY < nHeight; nY++ )
                                 {

... 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