[Libreoffice-commits] core.git: comphelper/source connectivity/source cppcanvas/source cui/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 21 12:34:23 UTC 2020


 comphelper/source/misc/graphicmimetype.cxx    |    4 
 comphelper/source/misc/numberedcollection.cxx |    3 
 connectivity/source/drivers/calc/CTable.cxx   |    2 
 connectivity/source/drivers/dbase/DTable.cxx  |    8 -
 cppcanvas/source/inc/implrenderer.hxx         |    2 
 cppcanvas/source/mtfrenderer/implrenderer.cxx |   18 ++--
 cppcanvas/source/mtfrenderer/textaction.cxx   |    6 -
 cppcanvas/source/mtfrenderer/textaction.hxx   |    2 
 cui/source/dialogs/AdditionsDialog.cxx        |    4 
 cui/source/dialogs/QrCodeGenDialog.cxx        |    4 
 cui/source/dialogs/SpellDialog.cxx            |   20 ++--
 cui/source/dialogs/about.cxx                  |    4 
 cui/source/dialogs/colorpicker.cxx            |   32 +++----
 cui/source/dialogs/cuicharmap.cxx             |   10 +-
 cui/source/dialogs/cuigrfflt.cxx              |    8 -
 cui/source/dialogs/hangulhanjadlg.cxx         |    4 
 cui/source/dialogs/hltpbase.cxx               |    4 
 cui/source/dialogs/insdlg.cxx                 |    8 -
 cui/source/dialogs/splitcelldlg.cxx           |    6 -
 cui/source/factory/dlgfact.cxx                |    6 -
 cui/source/factory/dlgfact.hxx                |    6 -
 cui/source/inc/QrCodeGenDialog.hxx            |    4 
 cui/source/inc/SpellDialog.hxx                |    2 
 cui/source/inc/border.hxx                     |    2 
 cui/source/inc/cuitabline.hxx                 |    2 
 cui/source/inc/grfpage.hxx                    |   12 +-
 cui/source/inc/page.hxx                       |   20 ++--
 cui/source/inc/paragrph.hxx                   |    6 -
 cui/source/inc/splitcelldlg.hxx               |    8 -
 cui/source/inc/swpossizetabpage.hxx           |    2 
 cui/source/inc/tabstpge.hxx                   |    2 
 cui/source/options/optchart.cxx               |    4 
 cui/source/options/optcolor.cxx               |   10 +-
 cui/source/options/optpath.cxx                |    4 
 cui/source/tabpages/border.cxx                |   14 +--
 cui/source/tabpages/chardlg.cxx               |   30 +++----
 cui/source/tabpages/grfpage.cxx               |   60 +++++++-------
 cui/source/tabpages/labdlg.cxx                |    4 
 cui/source/tabpages/measure.cxx               |    2 
 cui/source/tabpages/numfmt.cxx                |    6 -
 cui/source/tabpages/numpages.cxx              |  110 +++++++++++++-------------
 cui/source/tabpages/page.cxx                  |   82 +++++++++----------
 cui/source/tabpages/paragrph.cxx              |   12 +-
 cui/source/tabpages/swpossizetabpage.cxx      |    4 
 cui/source/tabpages/tabstpge.cxx              |   10 +-
 cui/source/tabpages/textanim.cxx              |    6 -
 cui/source/tabpages/tpbitmap.cxx              |   20 ++--
 cui/source/tabpages/tpcolor.cxx               |    8 -
 cui/source/tabpages/tpgradnt.cxx              |    8 -
 cui/source/tabpages/tphatch.cxx               |   10 +-
 cui/source/tabpages/tpline.cxx                |   30 +++----
 cui/source/tabpages/tplnedef.cxx              |   18 ++--
 cui/source/tabpages/tplneend.cxx              |   14 +--
 cui/source/tabpages/tppattern.cxx             |    8 -
 cui/source/tabpages/transfrm.cxx              |   10 +-
 55 files changed, 353 insertions(+), 352 deletions(-)

New commits:
commit 5e43e888f6b9bc32fc5d3361be5a7962796726ea
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Wed Oct 21 09:30:59 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 21 14:33:39 2020 +0200

    use tools::Long in comphelper..cui
    
    Change-Id: I65167999c6049038f8f5d530a0c5cb0552ab0e06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104609
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/misc/graphicmimetype.cxx b/comphelper/source/misc/graphicmimetype.cxx
index 290050df13f8..0aea5afdde98 100644
--- a/comphelper/source/misc/graphicmimetype.cxx
+++ b/comphelper/source/misc/graphicmimetype.cxx
@@ -52,8 +52,8 @@ OUString GraphicMimeTypeHelper::GetMimeTypeForExtension(const OString& rExt)
 
     OUString aMimeType;
 
-    long const nCount = SAL_N_ELEMENTS(aMapper);
-    for (long i = 0; (i < nCount) && aMimeType.isEmpty(); ++i)
+    tools::Long const nCount = SAL_N_ELEMENTS(aMapper);
+    for (tools::Long i = 0; (i < nCount) && aMimeType.isEmpty(); ++i)
     {
         if (rExt == aMapper[i].pExt)
             aMimeType = OUString(aMapper[i].pMimeType, strlen(aMapper[i].pMimeType),
diff --git a/comphelper/source/misc/numberedcollection.cxx b/comphelper/source/misc/numberedcollection.cxx
index c4ed3319d5c2..e0615656c231 100644
--- a/comphelper/source/misc/numberedcollection.cxx
+++ b/comphelper/source/misc/numberedcollection.cxx
@@ -21,6 +21,7 @@
 #include <comphelper/numberedcollection.hxx>
 #include <com/sun/star/frame/UntitledNumbersConst.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <tools/long.hxx>
 
 namespace comphelper{
 
@@ -229,7 +230,7 @@ OUString SAL_CALL NumberedCollection::getUntitledPrefix()
 void NumberedCollection::impl_cleanUpDeadItems (      TNumberedItemHash& lItems    ,
                                                 const TDeadItemList&     lDeadItems)
 {
-    for (const long& rDeadItem : lDeadItems)
+    for (const tools::Long& rDeadItem : lDeadItems)
     {
         lItems.erase(rDeadItem);
     }
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 045ea54190ac..56214c9f3881 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -377,7 +377,7 @@ static void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& x
                 double fCellVal = xCell->getValue();
                 double fDays = ::rtl::math::approxFloor( fCellVal );
                 double fTime = fCellVal - fDays;
-                long nIntDays = static_cast<long>(fDays);
+                tools::Long nIntDays = static_cast<tools::Long>(fDays);
                 sal_Int64 nIntTime = ::rtl::math::round( fTime * static_cast<double>(::tools::Time::nanoSecPerDay) );
                 if ( nIntTime == ::tools::Time::nanoSecPerDay )
                 {
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index f4d671911739..f16d2f1ee3eb 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -945,7 +945,7 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
                 case DataType::BINARY:
                 case DataType::LONGVARCHAR:
                 {
-                    const long nBlockNo = aStr.toInt32();   // read blocknumber
+                    const tools::Long nBlockNo = aStr.toInt32();   // read blocknumber
                     if (nBlockNo > 0 && m_pMemoStream) // Read data from memo-file, only if
                     {
                         if ( !ReadMemo(nBlockNo, (*_rRow)[i]->get()) )
@@ -1512,7 +1512,7 @@ bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow, const
         return false;
 
     // position on desired record:
-    std::size_t nPos = m_aHeader.headerLength + static_cast<long>(m_nFilePos-1) * m_aHeader.recordLength;
+    std::size_t nPos = m_aHeader.headerLength + static_cast<tools::Long>(m_nFilePos-1) * m_aHeader.recordLength;
     m_pFileStream->Seek(nPos);
     m_pFileStream->ReadBytes(m_pBuffer.get(), m_aHeader.recordLength);
 
@@ -1539,7 +1539,7 @@ bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols)
 {
     // Set the Delete-Flag (be it set or not):
     // Position on desired record:
-    std::size_t nFilePos = m_aHeader.headerLength + static_cast<long>(m_nFilePos-1) * m_aHeader.recordLength;
+    std::size_t nFilePos = m_aHeader.headerLength + static_cast<tools::Long>(m_nFilePos-1) * m_aHeader.recordLength;
     m_pFileStream->Seek(nFilePos);
 
     OValueRefRow aRow = new OValueRefVector(_rCols.size());
@@ -2718,7 +2718,7 @@ bool ODbaseTable::WriteBuffer()
     OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: invalid record position");
 
     // position on desired record:
-    std::size_t nPos = m_aHeader.headerLength + static_cast<long>(m_nFilePos-1) * m_aHeader.recordLength;
+    std::size_t nPos = m_aHeader.headerLength + static_cast<tools::Long>(m_nFilePos-1) * m_aHeader.recordLength;
     m_pFileStream->Seek(nPos);
     return m_pFileStream->WriteBytes(m_pBuffer.get(), m_aHeader.recordLength) > 0;
 }
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 81702c332d0b..4b432f898260 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -192,7 +192,7 @@ namespace cppcanvas::internal
                                    const OUString&                rString,
                                    int                            nIndex,
                                    int                            nLength,
-                                   const long*                    pCharWidths,
+                                   const tools::Long*                    pCharWidths,
                                    const ActionFactoryParameters& rParms,
                                    bool                           bSubsettable );
 
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index c78b958f31f5..e957ca79697a 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -857,7 +857,7 @@ namespace cppcanvas::internal
                                              const OUString&                rString,
                                              int                            nIndex,
                                              int                            nLength,
-                                             const long*                    pCharWidths,
+                                             const ::tools::Long*                    pCharWidths,
                                              const ActionFactoryParameters& rParms,
                                              bool                           bSubsettableActions )
         {
@@ -964,7 +964,7 @@ namespace cppcanvas::internal
 
             if ( rState.textStrikeoutStyle == STRIKEOUT_X || rState.textStrikeoutStyle == STRIKEOUT_SLASH )
             {
-                long nWidth = rParms.mrVDev.GetTextWidth( rString,nIndex,nLength );
+                ::tools::Long nWidth = rParms.mrVDev.GetTextWidth( rString,nIndex,nLength );
 
                 sal_Unicode pChars[4];
                 if ( rState.textStrikeoutStyle == STRIKEOUT_X )
@@ -973,18 +973,18 @@ namespace cppcanvas::internal
                     pChars[0] = '/';
                 pChars[3]=pChars[2]=pChars[1]=pChars[0];
 
-                long nStrikeoutWidth = (rParms.mrVDev.GetTextWidth(
+                ::tools::Long nStrikeoutWidth = (rParms.mrVDev.GetTextWidth(
                     OUString(pChars, SAL_N_ELEMENTS(pChars))) + 2) / 4;
 
                 if( nStrikeoutWidth <= 0 )
                     nStrikeoutWidth = 1;
 
-                long nMaxWidth = nStrikeoutWidth/2;
+                ::tools::Long nMaxWidth = nStrikeoutWidth/2;
                 if ( nMaxWidth < 2 )
                     nMaxWidth = 2;
                 nMaxWidth += nWidth + 1;
 
-                long nFullStrikeoutWidth = 0;
+                ::tools::Long nFullStrikeoutWidth = 0;
                 OUStringBuffer aStrikeoutText;
                 while( (nFullStrikeoutWidth+=nStrikeoutWidth ) < nMaxWidth+1 )
                     aStrikeoutText.append(pChars[0]);
@@ -993,9 +993,9 @@ namespace cppcanvas::internal
 
                 if( nLen )
                 {
-                    long nInterval = ( nWidth - nStrikeoutWidth * nLen ) / nLen;
+                    ::tools::Long nInterval = ( nWidth - nStrikeoutWidth * nLen ) / nLen;
                     nStrikeoutWidth += nInterval;
-                    long* pStrikeoutCharWidths = new long[nLen];
+                    ::tools::Long* pStrikeoutCharWidths = new long[nLen];
 
                     for ( int i = 0;i<nLen; i++)
                     {
@@ -2575,7 +2575,7 @@ namespace cppcanvas::internal
                         const sal_Int32 nWidthDifference( pAct->GetWidth() - pDXArray[ nLen-1 ] );
 
                         // Last entry of pDXArray contains total width of the text
-                        long* p = pDXArray.get();
+                        ::tools::Long* p = pDXArray.get();
                         for (sal_Int32 i = 1; i <= nLen; ++i)
                         {
                             // calc ratio for every array entry, to
@@ -2584,7 +2584,7 @@ namespace cppcanvas::internal
                             // entry represents the 'end' position of
                             // the corresponding character, thus, we
                             // let i run from 1 to nLen.
-                            *p++ += static_cast<long>(i)*nWidthDifference/nLen;
+                            *p++ += static_cast<::tools::Long>(i)*nWidthDifference/nLen;
                         }
 
                         createTextAction(
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 408b180ecf58..df64f58c44e1 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -157,7 +157,7 @@ namespace cppcanvas::internal
                 rLayoutWidth = *(std::max_element(rOffsets.begin(), rOffsets.end()));
             }
 
-            uno::Sequence< double > setupDXArray( const long*   pCharWidths,
+            uno::Sequence< double > setupDXArray( const ::tools::Long*   pCharWidths,
                                                   sal_Int32          nLen,
                                                   const OutDevState& rState )
             {
@@ -1988,7 +1988,7 @@ namespace cppcanvas::internal
                                            const OUString&                  rText,
                                            sal_Int32                        nStartPos,
                                            sal_Int32                        nLen,
-                                           const long*                      pDXArray,
+                                           const ::tools::Long*                      pDXArray,
                                            VirtualDevice&                   rVDev,
                                            const CanvasSharedPtr&           rCanvas,
                                            const OutDevState&               rState,
@@ -2118,7 +2118,7 @@ namespace cppcanvas::internal
                                                              const OUString&                rText,
                                                              sal_Int32                      nStartPos,
                                                              sal_Int32                      nLen,
-                                                             const long*                    pDXArray,
+                                                             const ::tools::Long*                    pDXArray,
                                                              VirtualDevice&                 rVDev,
                                                              const CanvasSharedPtr&         rCanvas,
                                                              const OutDevState&             rState,
diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx
index 2023aeec74ea..aabad2245727 100644
--- a/cppcanvas/source/mtfrenderer/textaction.hxx
+++ b/cppcanvas/source/mtfrenderer/textaction.hxx
@@ -67,7 +67,7 @@ namespace cppcanvas::internal
                                                      const OUString&                rText,
                                                      sal_Int32                      nStartPos,
                                                      sal_Int32                      nLen,
-                                                     const long*                    pDXArray,
+                                                     const ::tools::Long*                    pDXArray,
                                                      VirtualDevice&                 rVDev,
                                                      const CanvasSharedPtr&         rCanvas,
                                                      const OutDevState&             rState,
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index cf9a605d5970..b8e2cee3febc 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -117,7 +117,7 @@ std::string curlGet(const OString& rURL)
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, static_cast<void*>(&response_body));
 
     CURLcode cc = curl_easy_perform(curl);
-    long http_code = 0;
+    tools::Long http_code = 0;
     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
 
     if (http_code != 200)
@@ -150,7 +150,7 @@ void curlDownload(const OString& rURL, const OUString& sFileURL)
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, static_cast<void*>(&aFile));
 
     CURLcode cc = curl_easy_perform(curl);
-    long http_code = 0;
+    tools::Long http_code = 0;
     curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
 
     if (http_code != 200)
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index 7f3f6a806cf5..0c33d35d6aa7 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -264,7 +264,7 @@ void QrCodeGenDialog::Apply()
 #endif
 }
 
-OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRBorder)
+OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, tools::Long aQRECC, int aQRBorder)
 {
 #if ENABLE_QRCODEGEN
     //Select ECC:: value from aQrECC
@@ -311,7 +311,7 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRB
 #endif
 }
 
-void QrCodeGenDialog::GetErrorCorrection(long ErrorCorrection)
+void QrCodeGenDialog::GetErrorCorrection(tools::Long ErrorCorrection)
 {
     switch (ErrorCorrection)
     {
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 29bf889ec6fd..bdb46b8bae29 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -90,14 +90,14 @@ class SpellUndoAction_Impl : public SfxUndoAction
     bool            m_bEnableChangePB;
     bool            m_bEnableChangeAllPB;
     //undo of MarkNextError - used in change and change all, ignore and ignore all
-    long            m_nOldErrorStart;
-    long            m_nOldErrorEnd;
+    tools::Long            m_nOldErrorStart;
+    tools::Long            m_nOldErrorEnd;
     bool            m_bIsErrorLanguageSelected;
     //undo of AddToDictionary
     Reference<XDictionary>  m_xDictionary;
     OUString                m_sAddedWord;
     //move end of error - ::ChangeMarkedWord()
-    long            m_nOffset;
+    tools::Long            m_nOffset;
 
 public:
     SpellUndoAction_Impl(sal_uInt16 nId, const Link<SpellUndoAction_Impl&,void>& rActionLink) :
@@ -120,13 +120,13 @@ public:
     void                    SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;}
     bool                    IsEnableChangeAllPB() const {return m_bEnableChangeAllPB;}
 
-    void                    SetErrorMove(long nOldStart, long nOldEnd)
+    void                    SetErrorMove(tools::Long nOldStart, tools::Long nOldEnd)
                                 {
                                         m_nOldErrorStart = nOldStart;
                                         m_nOldErrorEnd = nOldEnd;
                                 }
-    long                    GetOldErrorStart() const { return m_nOldErrorStart;}
-    long                    GetOldErrorEnd() const { return m_nOldErrorEnd;}
+    tools::Long                    GetOldErrorStart() const { return m_nOldErrorStart;}
+    tools::Long                    GetOldErrorEnd() const { return m_nOldErrorEnd;}
 
     void                    SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;}
     bool                    IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;}
@@ -136,8 +136,8 @@ public:
     void                    SetAddedWord(const OUString& rWord) {m_sAddedWord = rWord;}
     const OUString&         GetAddedWord() const { return m_sAddedWord;}
 
-    void                    SetOffset(long nSet) {m_nOffset = nSet;}
-    long                    GetOffset() const {return m_nOffset;}
+    void                    SetOffset(tools::Long nSet) {m_nOffset = nSet;}
+    tools::Long                    GetOffset() const {return m_nOffset;}
 };
 }//namespace svx
 using namespace ::svx;
@@ -1744,7 +1744,7 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language
     m_xEditEngine->SetModified();
 
     //adjust end position
-    long nEndTemp = m_nErrorEnd;
+    tools::Long nEndTemp = m_nErrorEnd;
     nEndTemp += nDiffLen;
     m_nErrorEnd = static_cast<sal_Int32>(nEndTemp);
 
@@ -2029,7 +2029,7 @@ void SentenceEditWindow_Impl::UndoActionEnd()
     m_xEditEngine->UndoActionEnd();
 }
 
-void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset)
+void SentenceEditWindow_Impl::MoveErrorEnd(tools::Long nOffset)
 {
     // Shouldn't we always add the real signed value instead???
     if(nOffset > 0)
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 99729ee2f10d..ff7173763e11 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -72,7 +72,7 @@ AboutDialog::AboutDialog(weld::Window *pParent)
 
   OUString sbuildId = GetBuildString();
   if (IsStringValidGitHash(sbuildId)) {
-    const long nMaxChar = 25;
+    const tools::Long nMaxChar = 25;
     m_pBuildLabel->set_uri("https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h="
                            + sbuildId);
     m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt(
@@ -90,7 +90,7 @@ AboutDialog::AboutDialog(weld::Window *pParent)
   m_pCopyrightLabel->set_label(GetCopyrightString());
 
   // Images
-  const long nWidth(m_pCopyrightLabel->get_preferred_size().getWidth());
+  const tools::Long nWidth(m_pCopyrightLabel->get_preferred_size().getWidth());
   BitmapEx aBackgroundBitmap;
 
   if (SfxApplication::loadBrandSvg(Application::GetSettings()
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index da948f9492b1..9eb92c2dba05 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -402,8 +402,8 @@ void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate )
 
     const Size aSize(mxBitmap->GetOutputSizePixel());
 
-    long nX = rPos.X();
-    long nY = rPos.Y();
+    tools::Long nX = rPos.X();
+    tools::Long nY = rPos.Y();
     if (nX < 0)
         nX = 0;
     else if (nX >= aSize.Width())
@@ -510,7 +510,7 @@ void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, doub
 void ColorFieldControl::UpdatePosition()
 {
     Size aSize(GetOutputSizePixel());
-    ShowPosition(Point(static_cast<long>(mdX * aSize.Width()), static_cast<long>((1.0 - mdY) * aSize.Height())), false);
+    ShowPosition(Point(static_cast<tools::Long>(mdX * aSize.Width()), static_cast<tools::Long>((1.0 - mdY) * aSize.Height())), false);
 }
 
 namespace {
@@ -530,7 +530,7 @@ public:
     virtual void Resize() override;
 
     void UpdateBitmap();
-    void ChangePosition( long nY );
+    void ChangePosition( tools::Long nY );
     void Modify();
 
     void SetValue( const Color& rColor, ColorMode eMode, double dValue );
@@ -582,7 +582,7 @@ void ColorSliderControl::UpdateBitmap()
         mxBitmap->SetOutputSizePixel(aSize);
     }
 
-    const long nY = aSize.Height() - 1;
+    const tools::Long nY = aSize.Height() - 1;
 
     Color aBitmapColor(maColor);
 
@@ -596,7 +596,7 @@ void ColorSliderControl::UpdateBitmap()
     case HUE:
         nSat = 100;
         nBri = 100;
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
             nHue = static_cast<sal_uInt16>((359 * y) / nY);
             mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -605,7 +605,7 @@ void ColorSliderControl::UpdateBitmap()
 
     case SATURATION:
         nBri = std::max(sal_uInt16(32), nBri);
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
             nSat = static_cast<sal_uInt16>((100 * y) / nY);
             mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -613,7 +613,7 @@ void ColorSliderControl::UpdateBitmap()
         break;
 
     case BRIGHTNESS:
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
             nBri = static_cast<sal_uInt16>((100 * y) / nY);
             mxBitmap->DrawPixel(Point(0, nY - y), Color::HSBtoRGB(nHue, nSat, nBri));
@@ -621,34 +621,34 @@ void ColorSliderControl::UpdateBitmap()
         break;
 
     case RED:
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
-            aBitmapColor.SetRed(sal_uInt8((long(255) * y) / nY));
+            aBitmapColor.SetRed(sal_uInt8((tools::Long(255) * y) / nY));
             mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
         }
         break;
 
     case GREEN:
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
-            aBitmapColor.SetGreen(sal_uInt8((long(255) * y) / nY));
+            aBitmapColor.SetGreen(sal_uInt8((tools::Long(255) * y) / nY));
             mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
         }
         break;
 
     case BLUE:
-        for (long y = 0; y <= nY; y++)
+        for (tools::Long y = 0; y <= nY; y++)
         {
-            aBitmapColor.SetBlue(sal_uInt8((long(255) * y) / nY));
+            aBitmapColor.SetBlue(sal_uInt8((tools::Long(255) * y) / nY));
             mxBitmap->DrawPixel(Point(0, nY - y), aBitmapColor);
         }
         break;
     }
 }
 
-void ColorSliderControl::ChangePosition(long nY)
+void ColorSliderControl::ChangePosition(tools::Long nY)
 {
-    const long nHeight = GetOutputSizePixel().Height() - 1;
+    const tools::Long nHeight = GetOutputSizePixel().Height() - 1;
 
     if (nY < 0)
         nY = 0;
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index f78b70a29662..d674cda9c48f 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -1143,8 +1143,8 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
     const OUString aText = GetText();
 
     Size aSize(GetOutputSizePixel());
-    long nAvailWidth = aSize.Width();
-    long nWinHeight = aSize.Height();
+    tools::Long nAvailWidth = aSize.Width();
+    tools::Long nWinHeight = aSize.Height();
 
     bool bGotBoundary = true;
     bool bShrankFont = false;
@@ -1152,7 +1152,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
     Size aFontSize(aOrigFont.GetFontSize());
     ::tools::Rectangle aBoundRect;
 
-    for (long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 5)
+    for (tools::Long nFontHeight = aFontSize.Height(); nFontHeight > 0; nFontHeight -= 5)
     {
         if (!rRenderContext.GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty())
         {
@@ -1162,7 +1162,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
         if (!mbCenter)
             break;
         //only shrink in the single glyph large view mode
-        long nTextWidth = aBoundRect.GetWidth();
+        tools::Long nTextWidth = aBoundRect.GetWidth();
         if (nAvailWidth > nTextWidth)
             break;
         vcl::Font aFont(aOrigFont);
@@ -1217,7 +1217,7 @@ void SvxShowText::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
 
 void SvxShowText::SetFont( const vcl::Font& rFont )
 {
-    long nWinHeight = GetOutputSizePixel().Height();
+    tools::Long nWinHeight = GetOutputSizePixel().Height();
 
     m_aFont = rFont;
     m_aFont.SetWeight(WEIGHT_NORMAL);
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index baaa6603c60d..c949bf61e0ac 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -93,13 +93,13 @@ void CuiGraphicPreviewWindow::ScaleImageToFit()
 
         if( fGrfWH < fPreWH )
         {
-            aGrfSize.setWidth( static_cast<long>( aPreviewSize.Height() * fGrfWH ) );
+            aGrfSize.setWidth( static_cast<tools::Long>( aPreviewSize.Height() * fGrfWH ) );
             aGrfSize.setHeight( aPreviewSize.Height() );
         }
         else
         {
             aGrfSize.setWidth( aPreviewSize.Width() );
-            aGrfSize.setHeight( static_cast<long>( aPreviewSize.Width() / fGrfWH ) );
+            aGrfSize.setHeight( static_cast<tools::Long>( aPreviewSize.Width() / fGrfWH ) );
         }
 
         mfScaleX = static_cast<double>(aGrfSize.Width()) / maOrigGraphicSizePixel.Width();
@@ -189,8 +189,8 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
                                                  double fScaleX, double fScaleY )
 {
     Graphic         aRet;
-    long            nTileWidth = static_cast<long>(mxMtrWidth->get_value(FieldUnit::PIXEL));
-    long            nTileHeight = static_cast<long>(mxMtrHeight->get_value(FieldUnit::PIXEL));
+    tools::Long            nTileWidth = static_cast<tools::Long>(mxMtrWidth->get_value(FieldUnit::PIXEL));
+    tools::Long            nTileHeight = static_cast<tools::Long>(mxMtrHeight->get_value(FieldUnit::PIXEL));
     const Size      aSize( std::max( FRound( nTileWidth * fScaleX ), 1L ),
                            std::max( FRound( nTileHeight * fScaleY ), 1L ) );
 
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 8bf1e1ccdd12..bd252a2fe5a8 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -132,7 +132,7 @@ namespace svx
         // the font for the secondary text:
         vcl::Font aSmallerFont(rRenderContext.GetFont());
         // heuristic: 80% of the original size
-        aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
+        aSmallerFont.SetFontHeight( static_cast<tools::Long>( 0.8 * aSmallerFont.GetFontHeight() ) );
 
         // let's calculate the size of our two texts
         ::tools::Rectangle aPrimaryRect = rRenderContext.GetTextRect( _rRect, m_sPrimaryText, nTextStyle );
@@ -249,7 +249,7 @@ namespace svx
     Size RubyRadioButton::GetOptimalSize() const
     {
         vcl::Font aSmallerFont(m_xVirDev->GetFont());
-        aSmallerFont.SetFontHeight( static_cast<long>( 0.8 * aSmallerFont.GetFontHeight() ) );
+        aSmallerFont.SetFontHeight( static_cast<tools::Long>( 0.8 * aSmallerFont.GetFontHeight() ) );
         ::tools::Rectangle rect( Point(), Size( SAL_MAX_INT32, SAL_MAX_INT32 ) );
 
         Size aPrimarySize = m_xVirDev->GetTextRect( rect, m_aRubyText.getPrimaryText() ).GetSize();
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index f79f5644e710..5e95ed6c5e6b 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -204,13 +204,13 @@ void SvxHyperlinkTabPageBase::ShowMarkWnd()
         else
         {
             // Pos Extrawindow on the left side of Dialog
-            MoveToExtraWnd( Point(0,0) - Point( long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
+            MoveToExtraWnd( Point(0,0) - Point( tools::Long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
         }
     }
     else
     {
         // Pos Extrawindow on the right side of Dialog
-        MoveToExtraWnd ( Point( long(1.05*aDlgSize.getWidth()), 0 ) );
+        MoveToExtraWnd ( Point( tools::Long(1.05*aDlgSize.getWidth()), 0 ) );
     }
 
     // Set size of Extra-Window
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index f1752922e066..3e94ad472e63 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -509,15 +509,15 @@ short SfxInsertFloatingFrameDialog::run()
 
                 bool bHasBorder = m_xRBFrameBorderOn->get_active();
 
-                long lMarginWidth;
+                tools::Long lMarginWidth;
                 if (!m_xCBMarginWidthDefault->get_active())
-                    lMarginWidth = static_cast<long>(m_xNMMarginWidth->get_text().toInt32());
+                    lMarginWidth = static_cast<tools::Long>(m_xNMMarginWidth->get_text().toInt32());
                 else
                     lMarginWidth = SIZE_NOT_SET;
 
-                long lMarginHeight;
+                tools::Long lMarginHeight;
                 if (!m_xCBMarginHeightDefault->get_active())
-                    lMarginHeight = static_cast<long>(m_xNMMarginHeight->get_text().toInt32());
+                    lMarginHeight = static_cast<tools::Long>(m_xNMMarginHeight->get_text().toInt32());
                 else
                     lMarginHeight = SIZE_NOT_SET;
 
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index 40b798b7c2c9..58d6b7e4f8a0 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -19,7 +19,7 @@
 
 #include <splitcelldlg.hxx>
 
-SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal)
+SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical, tools::Long nMaxHorizontal)
     : GenericDialogController(pParent, "cui/ui/splitcellsdialog.ui", "SplitCellsDialog")
     , m_xCountEdit(m_xBuilder->weld_spin_button("countnf"))
     , m_xHorzBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("hori") : m_xBuilder->weld_radio_button("vert"))
@@ -54,7 +54,7 @@ SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical,
 IMPL_LINK(SvxSplitTableDlg, ClickHdl, weld::Button&, rButton, void)
 {
     const bool bIsVert = &rButton == m_xVertBox.get();
-    long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
+    tools::Long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
     m_xPropCB->set_sensitive(!bIsVert);
     m_xCountEdit->set_max(nMax);
 }
@@ -69,7 +69,7 @@ bool SvxSplitTableDlg::IsProportional() const
     return m_xPropCB->get_active() && m_xHorzBox->get_active();
 }
 
-long SvxSplitTableDlg::GetCount() const
+tools::Long SvxSplitTableDlg::GetCount() const
 {
     return m_xCountEdit->get_value();
 }
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index f970e4a10503..ea2675694f07 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -704,12 +704,12 @@ TransliterationFlags AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFla
     return m_xDlg->GetTransliterationFlags();
 }
 
-void AbstractFmInputRecordNoDialog_Impl::SetValue(long nNew)
+void AbstractFmInputRecordNoDialog_Impl::SetValue(tools::Long nNew)
 {
     m_xDlg->SetValue(nNew);
 }
 
-long AbstractFmInputRecordNoDialog_Impl::GetValue() const
+tools::Long AbstractFmInputRecordNoDialog_Impl::GetValue() const
 {
     return m_xDlg->GetValue();
 }
@@ -1600,7 +1600,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDia
     return VclPtr<CuiAbstractTabController_Impl>::Create(std::make_shared<SvxFormatCellsDialog>(pParent, pAttr, rModel));
 }
 
-VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical)
+VclPtr<SvxAbstractSplitTableDialog> AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical)
 {
     return VclPtr<SvxSplitTableDlg>::Create( pParent, bIsTableVertical, nMaxVertical, 99 );
 }
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 4d0b569108dd..89ba22069339 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -403,8 +403,8 @@ public:
     {
     }
     virtual short Execute() override;
-    virtual void SetValue(long nNew) override ;
-    virtual long GetValue() const override ;
+    virtual void SetValue(tools::Long nNew) override ;
+    virtual tools::Long GetValue() const override ;
 };
 
 class SvxNewDictionaryDialog;
@@ -909,7 +909,7 @@ public:
 
     virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel) override;
 
-    virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) override;
+    virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) override;
 
     virtual std::shared_ptr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) override ;
 
diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx
index c0f338f91812..7c39fe07ced6 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -39,9 +39,9 @@ private:
 
     css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
 
-    void GetErrorCorrection(long);
+    void GetErrorCorrection(tools::Long);
     //Function contains QR Code Generating Library Calls
-    static OUString GenerateQRCode(OUString aQrText, long aQrECC, int aQrBorder);
+    static OUString GenerateQRCode(OUString aQrText, tools::Long aQrECC, int aQrBorder);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 0276f3a3a723..f184f8e78ad2 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -110,7 +110,7 @@ public:
     void            UndoActionStart( sal_uInt16 nId );
     void            UndoActionEnd();
 
-    void            MoveErrorEnd(long nOffset);
+    void            MoveErrorEnd(tools::Long nOffset);
 
     void            ResetIgnoreErrorsAt()   { m_aIgnoreErrorsAt.clear(); }
 };
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 57f5d5d0919f..8637f6e8943b 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -98,7 +98,7 @@ private:
     std::vector<Image> m_aShadowImgVec;
     std::vector<Image> m_aBorderImgVec;
 
-    long                nMinValue;  ///< minimum distance
+    tools::Long                nMinValue;  ///< minimum distance
     SwBorderModes       nSWMode;    ///< table, textframe, paragraph
     sal_uInt16          mnBoxSlot;
     sal_uInt16          mnShadowSlot;
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 74980bbd5911..2839927c1bc8 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -95,7 +95,7 @@ private:
     bool                m_bNewSize;
     /// a graphic to be displayed in the preview in case that an automatic symbol is chosen
     Graphic             m_aAutoSymbolGraphic;
-    long                m_nSymbolType;
+    tools::Long                m_nSymbolType;
     /// attributes for the shown symbols; only necessary if not equal to line properties
     SfxItemSet*         m_pSymbolAttr;
 
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index d905622c2faa..35653eaf6ade 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -37,10 +37,10 @@ public:
     virtual void Resize() override;
     virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
 
-    void SetTop( long nVal )                { m_aTopLeft.setX(nVal); }
-    void SetBottom( long nVal )             { m_aBottomRight.setX(nVal); }
-    void SetLeft( long nVal )               { m_aTopLeft.setY(nVal); }
-    void SetRight( long nVal)               { m_aBottomRight.setY(nVal); }
+    void SetTop( tools::Long nVal )                { m_aTopLeft.setX(nVal); }
+    void SetBottom( tools::Long nVal )             { m_aBottomRight.setX(nVal); }
+    void SetLeft( tools::Long nVal )               { m_aTopLeft.setY(nVal); }
+    void SetRight( tools::Long nVal)               { m_aBottomRight.setY(nVal); }
     void SetFrameSize( const Size& rSz );
     void SetGraphic( const Graphic& rGrf )  { m_aGrf = rGrf; }
 };
@@ -53,8 +53,8 @@ class SvxGrfCropPage : public SfxTabPage
     Size            aOrigSize;
     Size            aOrigPixelSize;
     Size            aPageSize;
-    long            nOldWidth;
-    long            nOldHeight;
+    tools::Long            nOldWidth;
+    tools::Long            nOldHeight;
     bool            bSetOrigSize;
 
     SvxCropExample m_aExampleWN;
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index d16b8adaf297..23501f1fd25e 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -66,14 +66,14 @@ class SvxPageDescPage : public SfxTabPage
     static const sal_uInt16 pRanges[];
 private:
     OUString            sStandardRegister;
-    long                nFirstLeftMargin;
-    long                nFirstRightMargin;
-    long                nFirstTopMargin;
-    long                nFirstBottomMargin;
-    long                nLastLeftMargin;
-    long                nLastRightMargin;
-    long                nLastTopMargin;
-    long                nLastBottomMargin;
+    tools::Long                nFirstLeftMargin;
+    tools::Long                nFirstRightMargin;
+    tools::Long                nFirstTopMargin;
+    tools::Long                nFirstBottomMargin;
+    tools::Long                nLastLeftMargin;
+    tools::Long                nLastRightMargin;
+    tools::Long                nLastTopMargin;
+    tools::Long                nLastBottomMargin;
 
     bool                bLandscape;
     bool                bBorderModified;
@@ -151,8 +151,8 @@ private:
     /** Disables vertical page direction entries in the text flow listbox. */
     void                DisableVerticalPageDir();
 
-    bool                IsPrinterRangeOverflow(weld::MetricSpinButton& rField, long nFirstMargin,
-                                               long nLastMargin, MarginPosition nPos);
+    bool                IsPrinterRangeOverflow(weld::MetricSpinButton& rField, tools::Long nFirstMargin,
+                                               tools::Long nLastMargin, MarginPosition nPos);
     void                CheckMarginEdits( bool _bClear );
     bool                IsMarginOutOfRange() const;
 
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 47c4e888c2d7..1f2305b54ce7 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -43,8 +43,8 @@ class SvxStdParagraphTabPage: public SfxTabPage
     static const sal_uInt16 pStdRanges[];
 
 private:
-    long                    nWidth;
-    long                    nMinFixDist;
+    tools::Long                    nWidth;
+    tools::Long                    nMinFixDist;
     bool                    bRelativeMode;
     OUString                sAbsDist;
 
@@ -113,7 +113,7 @@ public:
     void                    EnableRegisterMode();
     void                    EnableContextualMode();
     void                    EnableAutoFirstLine();
-    void                    EnableAbsLineDist(long nMinTwip);
+    void                    EnableAbsLineDist(tools::Long nMinTwip);
     void                    EnableNegativeMode();
     virtual void            PageCreated(const SfxAllItemSet& aSet) override;
 };
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 3b0275acebc4..88b1de85c9a7 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -29,17 +29,17 @@ private:
     std::unique_ptr<weld::RadioButton> m_xVertBox;
     std::unique_ptr<weld::CheckButton> m_xPropCB;
 
-    long                mnMaxVertical;
-    long                mnMaxHorizontal;
+    tools::Long                mnMaxVertical;
+    tools::Long                mnMaxHorizontal;
 
 public:
-    SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal);
+    SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, tools::Long nMaxVertical, tools::Long nMaxHorizontal);
 
     DECL_LINK(ClickHdl, weld::Button&, void);
 
     virtual bool IsHorizontal() const override;
     virtual bool IsProportional() const override;
-    virtual long GetCount() const override;
+    virtual tools::Long GetCount() const override;
 
     virtual short Execute() override;
     virtual void SetSplitVerticalByDefault() override;
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index 03d536512240..d9c72495acde 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -94,7 +94,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage
 
     void            InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
                             sal_uInt16 nV,  sal_uInt16 nVRel,
-                            long   nX,  long   nY);
+                            tools::Long   nX,  tools::Long   nY);
     static sal_uInt16   GetMapPos(FrmMap const *pMap, const weld::ComboBox& rAlignLB);
     static short        GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBox& rRelationLB);
     static short        GetRelation(const weld::ComboBox& rRelationLB);
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index 394c8a44cf18..c6e7e70f748d 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -79,7 +79,7 @@ private:
     // local variables, internal functions
     SvxTabStop      aCurrentTab;
     std::unique_ptr<SvxTabStopItem>  aNewTabs;
-    long            nDefDist;
+    tools::Long            nDefDist;
 
     TabWin_Impl    m_aLeftWin;
     TabWin_Impl    m_aRightWin;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 7d740cfd2000..b8499c5ee886 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -82,8 +82,8 @@ void SvxDefaultColorOptPage::FillBoxChartColorLB()
 
     m_xLbChartColors->freeze();
     ClearColorEntries();
-    const long nCount(m_SvxChartColorTableUniquePtr->size());
-    for (long i = 0; i < nCount; ++i)
+    const tools::Long nCount(m_SvxChartColorTableUniquePtr->size());
+    for (tools::Long i = 0; i < nCount; ++i)
         InsertColorEntry((*m_SvxChartColorTableUniquePtr)[i]);
     m_xLbChartColors->thaw();
 }
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index f7807adc57e9..b4e992133fef 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -207,7 +207,7 @@ private:
     {
     public:
         Entry(weld::Window* pTopLevel, weld::Builder& rBuilder, const char* pTextWidget, const char* pColorWidget,
-              const Color& rColor, long nCheckBoxLabelOffset, bool bCheckBox, bool bShow);
+              const Color& rColor, tools::Long nCheckBoxLabelOffset, bool bCheckBox, bool bShow);
     public:
         void SetText(const OUString& rLabel) { dynamic_cast<weld::Label&>(*m_xText).set_label(rLabel); }
         void set_width_request(int nTextWidth) { m_xText->set_size_request(nTextWidth, -1); }
@@ -280,7 +280,7 @@ ColorConfigWindow_Impl::Chapter::Chapter(weld::Builder& rBuilder, const char* pL
 ColorConfigWindow_Impl::Entry::Entry(weld::Window* pTopLevel, weld::Builder& rBuilder,
                                      const char* pTextWidget, const char* pColorWidget,
                                      const Color& rColor,
-                                     long nCheckBoxLabelOffset, bool bCheckBox, bool bShow)
+                                     tools::Long nCheckBoxLabelOffset, bool bCheckBox, bool bShow)
     : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget), pTopLevel))
     , m_aDefaultColor(rColor)
 {
@@ -384,7 +384,7 @@ void ColorConfigWindow_Impl::CreateEntries()
 
     // Here we want to get the amount to add to the position of a FixedText to
     // get it to align its contents with that of a CheckBox
-    long nCheckBoxLabelOffset = 0;
+    tools::Long nCheckBoxLabelOffset = 0;
     {
         OUString sSampleText("X");
         std::unique_ptr<weld::CheckButton> xCheckBox(m_xBuilder->weld_check_button("docboundaries"));
@@ -602,11 +602,11 @@ public:
     void SetConfig (EditableColorConfig& rConfig) { pColorConfig = &rConfig; }
     void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { pExtColorConfig = &rConfig; }
     void Update();
-    long GetScrollPosition() const
+    tools::Long GetScrollPosition() const
     {
         return m_xVScroll->vadjustment_get_value();
     }
-    void SetScrollPosition(long nSet)
+    void SetScrollPosition(tools::Long nSet)
     {
         m_xVScroll->vadjustment_set_value(nSet);
     }
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index d3f3b419a835..45b2c14d5c0d 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -603,7 +603,7 @@ void SvxPathTabPage::GetPathList(
         Sequence< OUString > aPathSeq;
         if ( aAny >>= aPathSeq )
         {
-            long i, nCount = aPathSeq.getLength();
+            tools::Long i, nCount = aPathSeq.getLength();
             const OUString* pPaths = aPathSeq.getConstArray();
 
             for ( i = 0; i < nCount; ++i )
@@ -618,7 +618,7 @@ void SvxPathTabPage::GetPathList(
             sCfgName + POSTFIX_USER);
         if ( aAny >>= aPathSeq )
         {
-            long i, nCount = aPathSeq.getLength();
+            tools::Long i, nCount = aPathSeq.getLength();
             const OUString* pPaths = aPathSeq.getConstArray();
 
             for ( i = 0; i < nCount; ++i )
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 0c8fda14defe..d952ae97ad8c 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -678,19 +678,19 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
                             m_xTopMF->set_min(0, FieldUnit::NONE);
                             m_xBottomMF->set_min(0, FieldUnit::NONE);
                         }
-                        long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT);
+                        tools::Long nLeftDist = pBoxItem->GetDistance( SvxBoxItemLine::LEFT);
                         SetMetricValue(*m_xLeftMF, nLeftDist, eCoreUnit);
-                        long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT);
+                        tools::Long nRightDist = pBoxItem->GetDistance( SvxBoxItemLine::RIGHT);
                         SetMetricValue(*m_xRightMF, nRightDist, eCoreUnit);
-                        long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP);
+                        tools::Long nTopDist = pBoxItem->GetDistance( SvxBoxItemLine::TOP);
                         SetMetricValue( *m_xTopMF, nTopDist, eCoreUnit );
-                        long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM);
+                        tools::Long nBottomDist = pBoxItem->GetDistance( SvxBoxItemLine::BOTTOM);
                         SetMetricValue( *m_xBottomMF, nBottomDist, eCoreUnit );
 
                         // if the distance is set with no active border line
                         // or it is null with an active border line
                         // no automatic changes should be made
-                        const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
+                        const tools::Long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
                         bool bDiffDist = (nDefDist != nLeftDist ||
                                     nDefDist != nRightDist ||
                                     nDefDist != nTopDist   ||
@@ -732,7 +732,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
 
     {
         // Do all visible lines show the same line widths?
-        long nWidth;
+        tools::Long nWidth;
         SvxBorderLineStyle nStyle;
         bool bWidthEq = m_aFrameSel.GetVisibleWidth( nWidth, nStyle );
         if( bWidthEq )
@@ -1331,7 +1331,7 @@ void SvxBorderTabPage::FillLineListBox_Impl()
 
     static struct {
         SvxBorderLineStyle mnStyle;
-        long mnMinWidth;
+        tools::Long mnMinWidth;
         SvtLineListBox::ColorFunc mpColor1Fn;
         SvtLineListBox::ColorFunc mpColor2Fn;
         SvtLineListBox::ColorDistFunc mpColorDistFn;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index b7f9b17165fc..4ec72e217772 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -440,18 +440,18 @@ namespace
             const SvxFontHeightItem& rOldItem = static_cast<const SvxFontHeightItem&>(_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ));
 
             // old value, scaled
-            long nHeight;
+            tools::Long nHeight;
             if ( _pFontSizeLB->IsPtRelative() )
-                nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) );
+                nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<tools::Long>(_pFontSizeLB->get_value() / 10) );
             else
-                nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
+                nHeight = static_cast<tools::Long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
 
             // conversion twips for the example-window
             aSize.setHeight(
                 ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), FieldUnit::TWIP ) );
         }
         else if ( !_pFontSizeLB->get_active_text().isEmpty() )
-            aSize.setHeight( PointToTwips( static_cast<long>(_pFontSizeLB->get_value() / 10) ) );
+            aSize.setHeight( PointToTwips( static_cast<tools::Long>(_pFontSizeLB->get_value() / 10) ) );
         else
             aSize.setHeight( 200 );   // default 10pt
         aFontMetrics.SetFontSize( aSize );
@@ -1012,11 +1012,11 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
         rSet.InvalidateItem(nWhich);
 
     // FontSize
-    long nSize = pSizeBox->get_value();
+    tools::Long nSize = pSizeBox->get_value();
 
     if ( pSizeBox->get_active_text().isEmpty() )   // GetValue() returns the min-value
         nSize = 0;
-    long nSavedSize = pSizeBox->get_saved_value();
+    tools::Long nSavedSize = pSizeBox->get_saved_value();
     const bool bRel = pSizeBox->IsRelative();
 
     switch ( eLangGrp )
@@ -1033,7 +1033,7 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
          pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET )
     {
         float fSize = static_cast<float>(nSize) / 10;
-        long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
+        tools::Long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
         if ( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() != static_cast<sal_uInt32>(nVal) )
             bChanged = true;
     }
@@ -2583,9 +2583,9 @@ IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::ToggleButton&, voi
 
 IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, weld::MetricSpinButton&, void)
 {
-    long nVal = static_cast<long>(m_xKerningMF->get_value(FieldUnit::POINT));
+    tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
     nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip );
-    long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
+    tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
 
     SvxFont& rFont = GetPreviewFont();
     SvxFont& rCJKFont = GetPreviewCJKFont();
@@ -2761,17 +2761,17 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
     {
         const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>(rSet->Get( nWhich ));
         MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
-        long nBig = static_cast<long>(m_xKerningMF->normalize( static_cast<long>(rItem.GetValue()) ));
-        long nKerning = OutputDevice::LogicToLogic(nBig, eUnit, MapUnit::MapPoint);
+        tools::Long nBig = static_cast<tools::Long>(m_xKerningMF->normalize( static_cast<tools::Long>(rItem.GetValue()) ));
+        tools::Long nKerning = OutputDevice::LogicToLogic(nBig, eUnit, MapUnit::MapPoint);
 
         // set Kerning at the Font, convert into Twips before
-        long nKern = OutputDevice::LogicToLogic(rItem.GetValue(), eUnit, MapUnit::MapTwip);
+        tools::Long nKern = OutputDevice::LogicToLogic(rItem.GetValue(), eUnit, MapUnit::MapTwip);
         rFont.SetFixKerning( static_cast<short>(nKern) );
         rCJKFont.SetFixKerning( static_cast<short>(nKern) );
         rCTLFont.SetFixKerning( static_cast<short>(nKern) );
 
         //the attribute value must be displayed also if it's above the maximum allowed value
-        long nVal = static_cast<long>(m_xKerningMF->get_max(FieldUnit::POINT));
+        tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_max(FieldUnit::POINT));
         if(nVal < nKerning)
             m_xKerningMF->set_max(nKerning, FieldUnit::POINT);
         m_xKerningMF->set_value(nKerning, FieldUnit::POINT);
@@ -2929,8 +2929,8 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
     short nKerning = 0;
     MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
 
-    long nTmp = static_cast<long>(m_xKerningMF->get_value(FieldUnit::POINT));
-    long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, eUnit);
+    tools::Long nTmp = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
+    tools::Long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, eUnit);
     nKerning = static_cast<short>(m_xKerningMF->denormalize( nVal ));
 
     SfxItemState eOldKernState = rOldSet.GetItemState( nWhich, false );
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 583bedecf0df..707c954703e2 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -361,7 +361,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
 
     if (&rField == m_xWidthZoomMF.get())
     {
-        long nLRBorders = lcl_GetValue(*m_xLeftMF, eUnit)
+        tools::Long nLRBorders = lcl_GetValue(*m_xLeftMF, eUnit)
                          +lcl_GetValue(*m_xRightMF, eUnit);
         m_xWidthMF->set_value( m_xWidthMF->normalize(
             ((aOrigSize.Width() - nLRBorders) * rField.get_value(FieldUnit::NONE))/100),
@@ -369,7 +369,7 @@ IMPL_LINK( SvxGrfCropPage, ZoomHdl, weld::MetricSpinButton&, rField, void )
     }
     else
     {
-        long nULBorders = lcl_GetValue(*m_xTopMF, eUnit)
+        tools::Long nULBorders = lcl_GetValue(*m_xTopMF, eUnit)
                          +lcl_GetValue(*m_xBottomMF, eUnit);
         m_xHeightMF->set_value( m_xHeightMF->normalize(
             ((aOrigSize.Height() - nULBorders ) * rField.get_value(FieldUnit::NONE))/100) ,
@@ -393,7 +393,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
 
     if(&rField == m_xWidthMF.get())
     {
-        long nWidth = aOrigSize.Width() -
+        tools::Long nWidth = aOrigSize.Width() -
                 ( lcl_GetValue(*m_xLeftMF, eUnit) +
                   lcl_GetValue(*m_xRightMF, eUnit) );
         if(!nWidth)
@@ -403,7 +403,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, weld::MetricSpinButton&, rField, void )
     }
     else
     {
-        long nHeight = aOrigSize.Height() -
+        tools::Long nHeight = aOrigSize.Height() -
                 ( lcl_GetValue(*m_xTopMF, eUnit) +
                   lcl_GetValue(*m_xBottomMF, eUnit));
         if(!nHeight)
@@ -427,9 +427,9 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
     bool bZoom = m_xZoomConstRB->get_active();
     if (&rField == m_xLeftMF.get() || &rField == m_xRightMF.get())
     {
-        long nLeft = lcl_GetValue( *m_xLeftMF, eUnit );
-        long nRight = lcl_GetValue( *m_xRightMF, eUnit );
-        long nWidthZoom = static_cast<long>(m_xWidthZoomMF->get_value(FieldUnit::NONE));
+        tools::Long nLeft = lcl_GetValue( *m_xLeftMF, eUnit );
+        tools::Long nRight = lcl_GetValue( *m_xRightMF, eUnit );
+        tools::Long nWidthZoom = static_cast<tools::Long>(m_xWidthZoomMF->get_value(FieldUnit::NONE));
         if (bZoom && nWidthZoom != 0 && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom )
                             / 100 >= aPageSize.Width() ) )
         {
@@ -464,9 +464,9 @@ IMPL_LINK( SvxGrfCropPage, CropModifyHdl, weld::MetricSpinButton&, rField, void
     }
     else
     {
-        long nTop = lcl_GetValue( *m_xTopMF, eUnit );
-        long nBottom = lcl_GetValue( *m_xBottomMF, eUnit );
-        long nHeightZoom = static_cast<long>(m_xHeightZoomMF->get_value(FieldUnit::NONE));
+        tools::Long nTop = lcl_GetValue( *m_xTopMF, eUnit );
+        tools::Long nBottom = lcl_GetValue( *m_xBottomMF, eUnit );
+        tools::Long nHeightZoom = static_cast<tools::Long>(m_xHeightZoomMF->get_value(FieldUnit::NONE));
         if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom)
                                             / 100 >= aPageSize.Height()))
         {
@@ -509,11 +509,11 @@ IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void)
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
-    long nWidth = aOrigSize.Width() -
+    tools::Long nWidth = aOrigSize.Width() -
         lcl_GetValue( *m_xLeftMF, eUnit ) -
         lcl_GetValue( *m_xRightMF, eUnit );
     m_xWidthMF->set_value( m_xWidthMF->normalize( nWidth ), eUnit );
-    long nHeight = aOrigSize.Height() -
+    tools::Long nHeight = aOrigSize.Height() -
         lcl_GetValue( *m_xTopMF, eUnit ) -
         lcl_GetValue( *m_xBottomMF, eUnit );
     m_xHeightMF->set_value( m_xHeightMF->normalize( nHeight ), eUnit );
@@ -532,14 +532,14 @@ void SvxGrfCropPage::CalcZoom()
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
                                                     SID_ATTR_GRAF_CROP ) ) );
 
-    long nWidth = lcl_GetValue( *m_xWidthMF, eUnit );
-    long nHeight = lcl_GetValue( *m_xHeightMF, eUnit );
-    long nLRBorders = lcl_GetValue( *m_xLeftMF, eUnit ) +
+    tools::Long nWidth = lcl_GetValue( *m_xWidthMF, eUnit );
+    tools::Long nHeight = lcl_GetValue( *m_xHeightMF, eUnit );
+    tools::Long nLRBorders = lcl_GetValue( *m_xLeftMF, eUnit ) +
                       lcl_GetValue( *m_xRightMF, eUnit );
-    long nULBorders = lcl_GetValue( *m_xTopMF, eUnit ) +
+    tools::Long nULBorders = lcl_GetValue( *m_xTopMF, eUnit ) +
                       lcl_GetValue( *m_xBottomMF, eUnit );
     sal_uInt16 nZoom = 0;
-    long nDen;
+    tools::Long nDen;
     if( (nDen = aOrigSize.Width() - nLRBorders) > 0)
         nZoom = static_cast<sal_uInt16>((( nWidth  * 1000 / nDen )+5)/10);
     m_xWidthZoomMF->set_value(nZoom, FieldUnit::NONE);
@@ -560,21 +560,21 @@ void SvxGrfCropPage::CalcMinMaxBorder()
     DBG_ASSERT( pPool, "Where is the pool?" );
     FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich(
                                                     SID_ATTR_GRAF_CROP ) ) );
-    long nR = lcl_GetValue(*m_xRightMF, eUnit );
-    long nMinWidth = (aOrigSize.Width() * 10) /11;
-    long nMin = nMinWidth - (nR >= 0 ? nR : 0);
+    tools::Long nR = lcl_GetValue(*m_xRightMF, eUnit );
+    tools::Long nMinWidth = (aOrigSize.Width() * 10) /11;
+    tools::Long nMin = nMinWidth - (nR >= 0 ? nR : 0);
     m_xLeftMF->set_max( m_xLeftMF->normalize(nMin), eUnit );
 
-    long nL = lcl_GetValue(*m_xLeftMF, eUnit );
+    tools::Long nL = lcl_GetValue(*m_xLeftMF, eUnit );
     nMin = nMinWidth - (nL >= 0 ? nL : 0);
     m_xRightMF->set_max( m_xRightMF->normalize(nMin), eUnit );
 
-    long nUp  = lcl_GetValue( *m_xTopMF, eUnit );
-    long nMinHeight = (aOrigSize.Height() * 10) /11;
+    tools::Long nUp  = lcl_GetValue( *m_xTopMF, eUnit );
+    tools::Long nMinHeight = (aOrigSize.Height() * 10) /11;
     nMin = nMinHeight - (nUp >= 0 ? nUp : 0);
     m_xBottomMF->set_max( m_xBottomMF->normalize(nMin), eUnit );
 
-    long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
+    tools::Long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
     nMin = nMinHeight - (nLow >= 0 ? nLow : 0);
     m_xTopMF->set_max( m_xTopMF->normalize(nMin), eUnit );
 }
@@ -597,21 +597,21 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
                                                eUnit, m_xLeftMF->get_unit());
 
         // if the margin is too big, it is set to 1/3 on both pages
-        long nR = lcl_GetValue( *m_xRightMF, eUnit );
-        long nL = lcl_GetValue( *m_xLeftMF, eUnit );
+        tools::Long nR = lcl_GetValue( *m_xRightMF, eUnit );
+        tools::Long nL = lcl_GetValue( *m_xLeftMF, eUnit );
         if((nL + nR) < - aOrigSize.Width())
         {
-            long nVal = aOrigSize.Width() / -3;
+            tools::Long nVal = aOrigSize.Width() / -3;
             m_xRightMF->set_value( m_xRightMF->normalize( nVal ), eUnit );
             m_xLeftMF->set_value( m_xLeftMF->normalize( nVal ), eUnit );
             m_aExampleWN.SetLeft(nVal);
             m_aExampleWN.SetRight(nVal);
         }
-        long nUp  = lcl_GetValue(*m_xTopMF, eUnit );
-        long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
+        tools::Long nUp  = lcl_GetValue(*m_xTopMF, eUnit );
+        tools::Long nLow = lcl_GetValue(*m_xBottomMF, eUnit );
         if((nUp + nLow) < - aOrigSize.Height())
         {
-            long nVal = aOrigSize.Height() / -3;
+            tools::Long nVal = aOrigSize.Height() / -3;
             m_xTopMF->set_value( m_xTopMF->normalize( nVal ), eUnit );
             m_xBottomMF->set_value( m_xBottomMF->normalize( nVal ), eUnit );
             m_aExampleWN.SetTop(nVal);
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index 0ae754eeb2e7..c12ebc53601e 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -177,7 +177,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet*  _rOutAttrs)
 
     if( bEscRel )
     {
-        long    nVal = 0;
+        tools::Long    nVal = 0;
 
         switch (m_xLB_POSITION->get_active())
         {
@@ -246,7 +246,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet*  )
     nEscAbs = m_xMF_BY->get_value(FieldUnit::NONE);
 
     nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
-    nEscRel = static_cast<long>(static_cast<const SdrCaptionEscRelItem&>( rOutAttrs.Get( nWhich ) ).GetValue());
+    nEscRel = static_cast<tools::Long>(static_cast<const SdrCaptionEscRelItem&>( rOutAttrs.Get( nWhich ) ).GetValue());
 
     //------- line length ----------
     nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index 60e473d68494..14c9fef1e09b 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -232,7 +232,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
     // SdrMeasureUnitItem
     if( rAttrs->GetItemState( SDRATTR_MEASUREUNIT ) != SfxItemState::DONTCARE )
     {
-        long nFieldUnit = static_cast<long>(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue());
+        tools::Long nFieldUnit = static_cast<tools::Long>(rAttrs->Get( SDRATTR_MEASUREUNIT ).GetValue());
 
         for (sal_Int32 i = 0; i < m_xLbUnit->get_count(); ++i)
         {
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 9cefae5d85ae..960aab9c0101 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -147,7 +147,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
     vcl::Font aDrawFont = rRenderContext.GetFont();
     Size aSzWnd(GetOutputSizePixel());
     OUString aTmpStr( aPrevStr );
-    long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
+    tools::Long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
 
     aDrawFont.SetTransparent(true);
     aDrawFont.SetColor(aPrevCol);
@@ -155,7 +155,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
 
     if (mnPos != -1)
     {
-        long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
+        tools::Long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
 
         int nNumCharsToInsert = 0;
         if (nCharWidth > 0)
@@ -168,7 +168,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::
         }
     }
 
-    long nX = 0;
+    tools::Long nX = 0;
     if (mnPos == -1 && nLeadSpace > 0) //tdf#122120 if it won't fit anyway, then left align it
     {
         nX = nLeadSpace;
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 4e9b322f4f87..35674698a6b7 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -956,18 +956,18 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
     GraphicConverter::Import( *pIn, aGraphic );
 
     BitmapEx aBitmap = aGraphic.GetBitmapEx();
-    long nPixelX = aBitmap.GetSizePixel().Width();
-    long nPixelY = aBitmap.GetSizePixel().Height();
+    tools::Long nPixelX = aBitmap.GetSizePixel().Width();
+    tools::Long nPixelY = aBitmap.GetSizePixel().Height();
     double ratio = nPixelY/static_cast<double>(nPixelX);
     if(nPixelX > 30)
     {
         nPixelX = 30;
-        nPixelY = static_cast<long>(nPixelX*ratio);
+        nPixelY = static_cast<tools::Long>(nPixelX*ratio);
     }
     if(nPixelY > 30)
     {
         nPixelY = 30;
-        nPixelX = static_cast<long>(nPixelY/ratio);
+        nPixelX = static_cast<tools::Long>(nPixelY/ratio);
     }
 
     aBitmap.Scale( Size( nPixelX, nPixelY ), BmpScaleFlag::Fast );
@@ -1986,8 +1986,8 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
     bool bWidth = &rField == m_xWidthMF.get();
     bLastWidthModified = bWidth;
     bool bRatio = m_xRatioCB->get_active();
-    long nWidthVal = static_cast<long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
-    long nHeightVal = static_cast<long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
+    tools::Long nWidthVal = static_cast<tools::Long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
+    tools::Long nHeightVal = static_cast<tools::Long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
     nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
                                                 MapUnit::Map100thMM, eCoreUnit );
     nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
@@ -2013,11 +2013,11 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
 
                 if(bWidth)
                 {
-                    long nDelta = nWidthVal - aInitSize[i].Width();
+                    tools::Long nDelta = nWidthVal - aInitSize[i].Width();
                     aSize.setWidth( nWidthVal );
                     if (bRatio)
                     {
-                        aSize.setHeight( aInitSize[i].Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) );
+                        aSize.setHeight( aInitSize[i].Height() + static_cast<tools::Long>(static_cast<double>(nDelta) / fSizeRatio) );
                         m_xHeightMF->set_value(m_xHeightMF->normalize(
                             OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )),
                                 FieldUnit::MM_100TH);
@@ -2025,11 +2025,11 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
                 }
                 else
                 {
-                    long nDelta = nHeightVal - aInitSize[i].Height();
+                    tools::Long nDelta = nHeightVal - aInitSize[i].Height();
                     aSize.setHeight( nHeightVal );
                     if (bRatio)
                     {
-                        aSize.setWidth( aInitSize[i].Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) );
+                        aSize.setWidth( aInitSize[i].Width() + static_cast<tools::Long>(static_cast<double>(nDelta) * fSizeRatio) );
                         m_xWidthMF->set_value(m_xWidthMF->normalize(
                             OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )),
                                 FieldUnit::MM_100TH);
@@ -2118,11 +2118,11 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::Entry* pEdit)
     SetModified();
 }
 
-static long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, long nXStart,
-                        long nYMiddle, long nDivision)
+static tools::Long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, tools::Long nXStart,
+                        tools::Long nYMiddle, tools::Long nDivision)
 {
     const SvxBrushItem* pBrushItem = rFmt.GetBrush();
-    long nRet = 0;
+    tools::Long nRet = 0;
     if(pBrushItem)
     {
         const Graphic* pGrf = pBrushItem->GetGraphic();
@@ -2140,9 +2140,9 @@ static long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, l
 
 }
 
-static long lcl_DrawBullet(VirtualDevice* pVDev,
-            const SvxNumberFormat& rFmt, long nXStart,
-            long nYStart, const Size& rSize)
+static tools::Long lcl_DrawBullet(VirtualDevice* pVDev,
+            const SvxNumberFormat& rFmt, tools::Long nXStart,
+            tools::Long nYStart, const Size& rSize)
 {
     vcl::Font aTmpFont(pVDev->GetFont());
 
@@ -2167,10 +2167,10 @@ static long lcl_DrawBullet(VirtualDevice* pVDev,
     pVDev->SetFont( aFont );
     sal_UCS4 cChar = rFmt.GetBulletChar();
     OUString aText(&cChar, 1);
-    long nY = nYStart;
+    tools::Long nY = nYStart;
     nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
     pVDev->DrawText( Point(nXStart, nY), aText );
-    long nRet = pVDev->GetTextWidth(aText);
+    tools::Long nRet = pVDev->GetTextWidth(aText);
 
     pVDev->SetFont(aTmpFont);
     return nRet;
@@ -2205,21 +2205,21 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
 
     if (pActNum)
     {
-        long nWidthRelation = 30; // chapter dialog
+        tools::Long nWidthRelation = 30; // chapter dialog
 
         // height per level
-        long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
+        tools::Long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
         if (pActNum->GetLevelCount() < 10)
             nXStep /= 2;
-        long nYStart = 4;
+        tools::Long nYStart = 4;
         // the whole height mustn't be used for a single level
-        long nYStep = (aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5);
+        tools::Long nYStep = (aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5);
 
         aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getSystemLanguage(), GetDefaultFontFlags::OnlyOne);
         aStdFont.SetColor(aTextColor);
         aStdFont.SetFillColor(aBackColor);
 
-        long nFontHeight = nYStep * 6 / 10;
+        tools::Long nFontHeight = nYStep * 6 / 10;
         if (bPosition)
             nFontHeight = nYStep * 15 / 10;
         aStdFont.SetFontSize(Size( 0, nFontHeight ));
@@ -2229,7 +2229,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
 
         if (bPosition)
         {
-            long nLineHeight = nFontHeight * 8 / 7;
+            tools::Long nLineHeight = nFontHeight * 8 / 7;
             sal_uInt8 nStart = 0;
             while (!(nActLevel & (1<<nStart)))
             {
@@ -2243,15 +2243,15 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
                 aNum.GetLevelVal()[nLevel] = rFmt.GetStart();
 
-                long nXStart( 0 );
+                tools::Long nXStart( 0 );
                 short nTextOffset( 0 );
-                long nNumberXPos( 0 );
+                tools::Long nNumberXPos( 0 );
                 if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
                 {
                     nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
                     nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
                     nNumberXPos = nXStart;
-                    long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
+                    tools::Long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
 
                     if (nFirstLineOffset <= nNumberXPos)
                         nNumberXPos = nNumberXPos - nFirstLineOffset;
@@ -2263,7 +2263,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                 }
                 else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
                 {
-                    const long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
+                    const tools::Long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
                     if (nTmpNumberXPos < 0)
                     {
                         nNumberXPos = 0;
@@ -2274,10 +2274,10 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                     }
                 }
 
-                long nBulletWidth = 0;
+                tools::Long nBulletWidth = 0;
                 if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
                 {
-                    long nYMiddle = nYStart + ( nFontHeight / 2 );
+                    tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
                     nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
                 }
                 else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
@@ -2314,7 +2314,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                     nBulletWidth = nBulletWidth + pVDev->GetTextWidth(aText);
                 }
 
-                long nTextXPos( 0 );
+                tools::Long nTextXPos( 0 );
                 if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
                 {
                     nTextXPos = nXStart;
@@ -2360,10 +2360,10 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
         else
         {
             //#i5153# painting gray or black rectangles as 'normal' numbering text
-            long nWidth = pVDev->GetTextWidth("Preview");
-            long nTextHeight = pVDev->GetTextHeight();
-            long nRectHeight = nTextHeight * 2 / 3;
-            long nTopOffset = nTextHeight - nRectHeight;
+            tools::Long nWidth = pVDev->GetTextWidth("Preview");
+            tools::Long nTextHeight = pVDev->GetTextHeight();
+            tools::Long nRectHeight = nTextHeight * 2 / 3;
+            tools::Long nTopOffset = nTextHeight - nRectHeight;
             Color aBlackColor(COL_BLACK);
             if (aBlackColor == aBackColor)
                 aBlackColor.Invert();
@@ -2372,7 +2372,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
             {
                 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
                 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
-                long nXStart( 0 );
+                tools::Long nXStart( 0 );
                 pVDev->SetFillColor( aBackColor );
 
                 if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
@@ -2381,7 +2381,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                 }
                 else if (rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
                 {
-                    const long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
+                    const tools::Long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
                     if (nTmpXStart < 0)
                     {
                         nXStart = 0;
@@ -2393,12 +2393,12 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                 }
                 nXStart /= 2;
                 nXStart += 2;
-                long nTextOffset = 2 * nXStep;
+                tools::Long nTextOffset = 2 * nXStep;
                 if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
                 {
                     if (rFmt.IsShowSymbol())
                     {
-                        long nYMiddle = nYStart + ( nFontHeight / 2 );
+                        tools::Long nYMiddle = nYStart + ( nFontHeight / 2 );
                         nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
                         nTextOffset = nTextOffset + nXStep;
                     }
@@ -2436,7 +2436,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tool
                     if (pActNum->IsContinuousNumbering())
                         aNum.GetLevelVal()[nLevel] = nPreNum;
                     OUString aText(pActNum->MakeNumString(aNum));
-                    long nY = nYStart;
+                    tools::Long nY = nYStart;
                     nY -= (pVDev->GetTextHeight() - nTextHeight - pVDev->GetFontMetric().GetDescent());
                     pVDev->DrawText(Point(nXStart, nY), aText);
                     nTextOffset = pVDev->GetTextWidth(aText);
@@ -2575,7 +2575,7 @@ void SvxNumPositionTabPage::InitControls()
     const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
     sal_uInt16 nMask = 1;
     sal_uInt16 nLvl = SAL_MAX_UINT16;
-    long nFirstBorderTextRelative = -1;
+    tools::Long nFirstBorderTextRelative = -1;
     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     {
         aNumFmtArr[i] = &pActNum->GetLevel(i);
@@ -2633,16 +2633,16 @@ void SvxNumPositionTabPage::InitControls()
 
     if(bSameDistBorderNum)
     {
-        long nDistBorderNum;
+        tools::Long nDistBorderNum;
         if(bRelative)
         {
-            nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+            nDistBorderNum = static_cast<tools::Long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
             if(nLvl)
-                nDistBorderNum -= static_cast<long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
+                nDistBorderNum -= static_cast<tools::Long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
         }
         else
         {
-            nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+            nDistBorderNum = static_cast<tools::Long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
         }
         SetMetricValue(*m_xDistBorderMF, nDistBorderNum, eCoreUnit);
     }
@@ -3042,7 +3042,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
 {
     if(bInInintControl)
         return;
-    long nValue = GetCoreValue(rFld, eCoreUnit);
+    tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
     sal_uInt16 nMask = 1;
     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     {
@@ -3061,7 +3061,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
                     }
                     else
                     {
-                        long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
+                        tools::Long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
                                     pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
                                     pActNum->GetLevel( i ).GetFirstLineOffset();
 
@@ -3080,7 +3080,7 @@ IMPL_LINK(SvxNumPositionTabPage, DistanceHdl_Impl, weld::MetricSpinButton&, rFld
             else if (&rFld == m_xIndentMF.get())
             {
                 // together with the FirstLineOffset the AbsLSpace must be changed, too
-                long nDiff = nValue + aNumFmt.GetFirstLineOffset();
+                tools::Long nDiff = nValue + aNumFmt.GetFirstLineOffset();
                 auto const nAbsLSpace = aNumFmt.GetAbsLSpace();
                 aNumFmt.SetAbsLSpace(nAbsLSpace + nDiff);
                 aNumFmt.SetFirstLineOffset( -nValue );
@@ -3103,7 +3103,7 @@ IMPL_LINK(SvxNumPositionTabPage, RelativeHdl_Impl, weld::ToggleButton&, rBox, vo
     bool bOn = rBox.get_active();
     bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 && SAL_MAX_UINT16 != nActNumLvl;
     bool bSetValue = false;
-    long nValue = 0;
+    tools::Long nValue = 0;
     if(bOn || bSingleSelection)
     {
         sal_uInt16 nMask = 1;
@@ -3203,7 +3203,7 @@ IMPL_LINK_NOARG(SvxNumPositionTabPage, LabelFollowedByHdl_Impl, weld::ComboBox&,
 IMPL_LINK(SvxNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rFld, void)
 {
     // determine value to be set at the chosen list levels
-    const long nValue = GetCoreValue(rFld, eCoreUnit);
+    const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
 
     // set value at the chosen list levels
     sal_uInt16 nMask = 1;
@@ -3224,7 +3224,7 @@ IMPL_LINK(SvxNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rF
 IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld, void)
 {
     // determine value to be set at the chosen list levels
-    const long nValue = GetCoreValue(rFld, eCoreUnit);
+    const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
 
     // set value at the chosen list levels
     sal_uInt16 nMask = 1;
@@ -3233,7 +3233,7 @@ IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld,
         if ( nActNumLvl & nMask )
         {
             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
-            const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
+            const tools::Long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
             aNumFmt.SetFirstLineIndent( nFirstLineIndent );
             pActNum->SetLevel( i, aNumFmt );
         }
@@ -3246,7 +3246,7 @@ IMPL_LINK(SvxNumPositionTabPage, AlignAtHdl_Impl, weld::MetricSpinButton&, rFld,
 IMPL_LINK(SvxNumPositionTabPage, IndentAtHdl_Impl, weld::MetricSpinButton&, rFld, void)
 {
     // determine value to be set at the chosen list levels
-    const long nValue = GetCoreValue(rFld, eCoreUnit);
+    const tools::Long nValue = GetCoreValue(rFld, eCoreUnit);
 
     // set value at the chosen list levels
     sal_uInt16 nMask = 1;
@@ -3255,10 +3255,10 @@ IMPL_LINK(SvxNumPositionTabPage, IndentAtHdl_Impl, weld::MetricSpinButton&, rFld
         if ( nActNumLvl & nMask )
         {
             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
-            const long nAlignedAt = aNumFmt.GetIndentAt() +
+            const tools::Long nAlignedAt = aNumFmt.GetIndentAt() +
                                     aNumFmt.GetFirstLineIndent();
             aNumFmt.SetIndentAt( nValue );
-            const long nNewFirstLineIndent = nAlignedAt - nValue;
+            const tools::Long nNewFirstLineIndent = nAlignedAt - nValue;
             aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
             pActNum->SetLevel( i, aNumFmt );
         }
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index c0606c2f65be..e478fbc5f492 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -56,7 +56,7 @@
 // static ----------------------------------------------------------------
 
 // #i19922# - tdf#126051 see svx/source/dialog/hdft.cxx and sw/source/uibase/sidebar/PageMarginControl.hxx
-const long MINBODY = 56;  // 1mm in twips rounded
+const tools::Long MINBODY = 56;  // 1mm in twips rounded
 
 const sal_uInt16 SvxPageDescPage::pRanges[] =
 {
@@ -107,7 +107,7 @@ static Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxIt
 }
 
 
-static long ConvertLong_Impl( const long nIn, MapUnit eUnit )
+static tools::Long ConvertLong_Impl( const tools::Long nIn, MapUnit eUnit )
 {
     return OutputDevice::LogicToLogic( nIn, eUnit, MapUnit::MapTwip );
 }
@@ -117,8 +117,8 @@ static bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
     if ( pSize )
     {
         Size aSize = pSize->GetSize();
-        long nDiffW = std::abs( rSize.Width () - aSize.Width () );
-        long nDiffH = std::abs( rSize.Height() - aSize.Height() );
+        tools::Long nDiffW = std::abs( rSize.Width () - aSize.Width () );
+        tools::Long nDiffH = std::abs( rSize.Height() - aSize.Height() );
         return ( nDiffW < 10 && nDiffH < 10 );
     }
     else
@@ -344,10 +344,10 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
         const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
         SetMetricValue( *m_xTopMarginEdit, rULSpace.GetUpper(), eUnit );
         m_aBspWin.SetTop(
-            static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetUpper()), eUnit )) );
+            static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetUpper()), eUnit )) );
         SetMetricValue( *m_xBottomMarginEdit, rULSpace.GetLower(), eUnit );
         m_aBspWin.SetBottom(
-            static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<long>(rULSpace.GetLower()), eUnit )) );
+            static_cast<sal_uInt16>(ConvertLong_Impl( static_cast<tools::Long>(rULSpace.GetLower()), eUnit )) );
     }
 
     // general page data
@@ -855,7 +855,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
         return;
 
     // Draw: if paper format the margin shall be 1 cm
-    long nTmp = 0;
+    tools::Long nTmp = 0;
     bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
 
     if ( !bScreen )
@@ -908,8 +908,8 @@ IMPL_LINK(SvxPageDescPage, SwapOrientation_Impl, weld::Button&, rBtn, void)
 
     bLandscape = m_xLandscapeBtn->get_active();
 
-    const long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
-    const long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
+    const tools::Long lWidth = GetCoreValue( *m_xPaperWidthEdit, MapUnit::Map100thMM );
+    const tools::Long lHeight = GetCoreValue( *m_xPaperHeightEdit, MapUnit::Map100thMM );
 
     // swap width and height
     SetMetricValue(*m_xPaperWidthEdit, lHeight, MapUnit::Map100thMM);
@@ -956,10 +956,10 @@ void SvxPageDescPage::SwapFirstValues_Impl( bool bSet )
     sal_Int64 nSetB = m_xBottomMarginEdit->denormalize(
                     m_xBottomMarginEdit->get_value( FieldUnit::TWIP ) );
 
-    long nNewL = aPrintOffset.X();
-    long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
-    long nNewT = aPrintOffset.Y();
-    long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
+    tools::Long nNewL = aPrintOffset.X();
+    tools::Long nNewR = aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X();
+    tools::Long nNewT = aPrintOffset.Y();
+    tools::Long nNewB = aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y();
 
     nFirstLeftMargin = m_xLeftMarginEdit->convert_value_from(m_xLeftMarginEdit->normalize(nNewL), FieldUnit::TWIP);
     nFirstRightMargin = m_xRightMarginEdit->convert_value_from(m_xRightMarginEdit->normalize(nNewR), FieldUnit::TWIP);
@@ -1139,7 +1139,7 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
                 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
             const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
                 rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
-            long nDist = rUL.GetLower();
+            tools::Long nDist = rUL.GetLower();
             m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
             m_aBspWin.SetHdDist( nDist );
             const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
@@ -1194,7 +1194,7 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
             rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
         const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
             rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
-        long nDist = rUL.GetUpper();
+        tools::Long nDist = rUL.GetUpper();
         m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
         m_aBspWin.SetFtDist( nDist );
         const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
@@ -1298,20 +1298,20 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
 void SvxPageDescPage::RangeHdl_Impl()
 {
     // example window
-    long nHHeight = m_aBspWin.GetHdHeight();
-    long nHDist = m_aBspWin.GetHdDist();
+    tools::Long nHHeight = m_aBspWin.GetHdHeight();
+    tools::Long nHDist = m_aBspWin.GetHdDist();
 
-    long nFHeight = m_aBspWin.GetFtHeight();
-    long nFDist = m_aBspWin.GetFtDist();
+    tools::Long nFHeight = m_aBspWin.GetFtHeight();
+    tools::Long nFDist = m_aBspWin.GetFtDist();
 
-    long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
-    long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
+    tools::Long nHFLeft = std::max(m_aBspWin.GetHdLeft(), m_aBspWin.GetFtLeft());
+    tools::Long nHFRight = std::max(m_aBspWin.GetHdRight(), m_aBspWin.GetFtRight());
 
     // current values for page margins
-    long nBT = static_cast<long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
-    long nBB = static_cast<long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
-    long nBL = static_cast<long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
-    long nBR = static_cast<long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nBT = static_cast<tools::Long>(m_xTopMarginEdit->denormalize(m_xTopMarginEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nBB = static_cast<tools::Long>(m_xBottomMarginEdit->denormalize(m_xBottomMarginEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nBL = static_cast<tools::Long>(m_xLeftMarginEdit->denormalize(m_xLeftMarginEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nBR = static_cast<tools::Long>(m_xRightMarginEdit->denormalize(m_xRightMarginEdit->get_value(FieldUnit::TWIP)));
 
     // calculate width of page border
     const SfxItemSet* _pSet = &GetItemSet();
@@ -1330,18 +1330,18 @@ void SvxPageDescPage::RangeHdl_Impl()
     // limits paper
     // maximum is 54 cm
 
-    long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
+    tools::Long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
                 MINBODY + aBorder.Height();
     m_xPaperHeightEdit->set_min(m_xPaperHeightEdit->normalize(nMin), FieldUnit::TWIP);
 
     nMin = MINBODY + nBL + nBR + aBorder.Width();
     m_xPaperWidthEdit->set_min(m_xPaperWidthEdit->normalize(nMin), FieldUnit::TWIP);
 
-    long nH = static_cast<long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
-    long nW = static_cast<long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nH = static_cast<tools::Long>(m_xPaperHeightEdit->denormalize(m_xPaperHeightEdit->get_value(FieldUnit::TWIP)));
+    tools::Long nW = static_cast<tools::Long>(m_xPaperWidthEdit->denormalize(m_xPaperWidthEdit->get_value(FieldUnit::TWIP)));
 
     // Top
-    long nMax = nH - nBB - aBorder.Height() - MINBODY -
+    tools::Long nMax = nH - nBB - aBorder.Height() - MINBODY -
                 nFDist - nFHeight - nHDist - nHHeight;
 
     m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(nMax), FieldUnit::TWIP);
@@ -1364,24 +1364,24 @@ void SvxPageDescPage::RangeHdl_Impl()
 void SvxPageDescPage::CalcMargin_Impl()
 {
     // current values for page margins
-    long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
-    long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
+    tools::Long nBT = GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip );
+    tools::Long nBB = GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip );
 
-    long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
-    long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
+    tools::Long nBL = GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip );
+    tools::Long nBR = GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip );
 
-    long nH  = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
-    long nW  = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
+    tools::Long nH  = GetCoreValue( *m_xPaperHeightEdit, MapUnit::MapTwip );
+    tools::Long nW  = GetCoreValue( *m_xPaperWidthEdit, MapUnit::MapTwip );
 
-    long nWidth = nBL + nBR + MINBODY;
-    long nHeight = nBT + nBB + MINBODY;
+    tools::Long nWidth = nBL + nBR + MINBODY;
+    tools::Long nHeight = nBT + nBB + MINBODY;
 
     if ( nWidth <= nW && nHeight <= nH )
         return;
 
     if ( nWidth > nW )
     {
-        long nTmp = nBL <= nBR ? nBR : nBL;
+        tools::Long nTmp = nBL <= nBR ? nBR : nBL;
         nTmp -= nWidth - nW;
 
         if ( nBL <= nBR )
@@ -1392,7 +1392,7 @@ void SvxPageDescPage::CalcMargin_Impl()
 
     if ( nHeight > nH )
     {
-        long nTmp = nBT <= nBB ? nBB : nBT;
+        tools::Long nTmp = nBT <= nBB ? nBB : nBT;
         nTmp -= nHeight - nH;
 
         if ( nBT <= nBB )
@@ -1457,11 +1457,11 @@ IMPL_LINK_NOARG(SvxPageDescPage, FrameDirectionModify_Impl, weld::ComboBox&, voi
 }
 
 bool SvxPageDescPage::IsPrinterRangeOverflow(
-    weld::MetricSpinButton& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
+    weld::MetricSpinButton& rField, tools::Long nFirstMargin, tools::Long nLastMargin, MarginPosition nPos )
 {
     bool bRet = false;
     bool bCheck = ( ( m_nPos & nPos ) == 0 );
-    long nValue = rField.get_value(FieldUnit::NONE);
+    tools::Long nValue = rField.get_value(FieldUnit::NONE);
     if ( bCheck &&
          (  nValue < nFirstMargin || nValue > nLastMargin ) &&
          rField.get_value_changed_from_saved() )
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 5f6ae38d3ad9..4788969bcf4e 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -100,10 +100,10 @@ enum LineSpaceList
 
 }
 
-static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
+static void SetLineSpace_Impl( SvxLineSpacingItem&, int, tools::Long lValue = 0 );
 
 void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
-                        int eSpace, long lValue )
+                        int eSpace, tools::Long lValue )
 {
     switch ( eSpace )
     {
@@ -247,7 +247,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
 
             case LLINESPACE_PROP:
                 SetLineSpace_Impl( aSpacing, nPos,
-                                   static_cast<long>(m_xLineDistAtPercentBox->denormalize(
+                                   static_cast<tools::Long>(m_xLineDistAtPercentBox->denormalize(
                                    m_xLineDistAtPercentBox->get_value(FieldUnit::NONE) )) );
                 break;
 
@@ -895,8 +895,8 @@ void SvxStdParagraphTabPage::Init_Impl()
 void SvxStdParagraphTabPage::UpdateExample_Impl()
 {
     m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
-    m_aExampleWin.SetLeftMargin( static_cast<long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
-    m_aExampleWin.SetRightMargin( static_cast<long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
+    m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
+    m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
     m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
     m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
 
@@ -941,7 +941,7 @@ void SvxStdParagraphTabPage::EnableAutoFirstLine()
     m_xAutoCB->show();
 }
 
-void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
+void SvxStdParagraphTabPage::EnableAbsLineDist(tools::Long nMinTwip)
 {
     m_xLineDist->append_text(sAbsDist);
     nMinFixDist = nMinTwip;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 803b56081007..b0366bf48053 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1463,8 +1463,8 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
                                 sal_uInt16 nHRel,
                                 sal_uInt16 nV,
                                 sal_uInt16 nVRel,
-                                long   nX,
-                                long   nY)
+                                tools::Long   nX,
+                                tools::Long   nY)
 {
     int nPos = m_xVertLB->get_active();
     if (nPos != -1 && m_pVMap)
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 939a51e41256..202576bff30d 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -39,7 +39,7 @@ const sal_uInt16 SvxTabulatorTabPage::pRanges[] =
     0
 };
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list