[Libreoffice-commits] core.git: compilerplugins/clang drawinglayer/source include/cui include/drawinglayer include/sfx2 include/svx include/test include/toolkit sfx2/source svx/inc svx/qa svx/source toolkit/inc toolkit/source ucb/source uui/source vbahelper/source writerfilter/source writerperfect/inc writerperfect/qa writerperfect/source xmloff/inc xmloff/source xmlsecurity/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 26 06:36:26 UTC 2020


 compilerplugins/clang/toolslong.cxx                        |  556 +++++++++++++
 drawinglayer/source/primitive2d/textprimitive2d.cxx        |    3 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |    8 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx    |   26 
 drawinglayer/source/processor2d/vclprocessor2d.cxx         |    9 
 drawinglayer/source/tools/wmfemfhelper.cxx                 |    2 
 include/cui/cuicharmap.hxx                                 |    2 
 include/drawinglayer/primitive2d/textprimitive2d.hxx       |    7 
 include/sfx2/templatelocalview.hxx                         |    4 
 include/svx/ChildrenManager.hxx                            |    7 
 include/svx/CommonStyleManager.hxx                         |    2 
 include/svx/IAccessibleParent.hxx                          |    3 
 include/svx/PaletteManager.hxx                             |    6 
 include/svx/ShapeTypeHandler.hxx                           |    5 
 include/svx/charmap.hxx                                    |    8 
 include/svx/dialcontrol.hxx                                |    8 
 include/svx/dlgctrl.hxx                                    |   14 
 include/svx/fmgridcl.hxx                                   |    2 
 include/svx/fontwork.hxx                                   |    8 
 include/svx/framelinkarray.hxx                             |   32 
 include/svx/frmsel.hxx                                     |    4 
 include/svx/gridctrl.hxx                                   |   34 
 include/svx/nbdtmg.hxx                                     |    6 
 include/svx/obj3d.hxx                                      |    2 
 include/svx/pagectrl.hxx                                   |   82 -
 include/svx/paraprev.hxx                                   |    8 
 include/svx/pszctrl.hxx                                    |    2 
 include/svx/rubydialog.hxx                                 |    8 
 include/svx/ruler.hxx                                      |   86 +-
 include/svx/rulritem.hxx                                   |   98 +-
 include/svx/scene3d.hxx                                    |    2 
 include/svx/sderitm.hxx                                    |    2 
 include/svx/sdmetitm.hxx                                   |    2 
 include/svx/sdsxyitm.hxx                                   |    4 
 include/svx/sdtaaitm.hxx                                   |    2 
 include/svx/sdtditm.hxx                                    |    8 
 include/svx/sdtmfitm.hxx                                   |    8 
 include/svx/sidebar/LinePropertyPanelBase.hxx              |    2 
 include/svx/sidebar/LineWidthPopup.hxx                     |    4 
 include/svx/svddrag.hxx                                    |    4 
 include/svx/svddrgmt.hxx                                   |    4 
 include/svx/svdedtv.hxx                                    |   10 
 include/svx/svdglev.hxx                                    |    2 
 include/svx/svdglue.hxx                                    |   16 
 include/svx/svdhdl.hxx                                     |    4 
 include/svx/svdmodel.hxx                                   |   12 
 include/svx/svdoashp.hxx                                   |    6 
 include/svx/svdobj.hxx                                     |   16 
 include/svx/svdocirc.hxx                                   |   20 
 include/svx/svdoedge.hxx                                   |   18 
 include/svx/svdogrp.hxx                                    |   12 
 include/svx/svdomeas.hxx                                   |    6 
 include/svx/svdopath.hxx                                   |    4 
 include/svx/svdorect.hxx                                   |    6 
 include/svx/svdotext.hxx                                   |   28 
 include/svx/svdovirt.hxx                                   |   12 
 include/svx/svdpoev.hxx                                    |    2 
 include/svx/svdsnpv.hxx                                    |   14 
 include/svx/svdtrans.hxx                                   |   34 
 include/svx/svxdlg.hxx                                     |    8 
 include/svx/sxcecitm.hxx                                   |    4 
 include/svx/sxcgitm.hxx                                    |    2 
 include/svx/sxciaitm.hxx                                   |    4 
 include/svx/sxcllitm.hxx                                   |    2 
 include/svx/sxelditm.hxx                                   |    6 
 include/svx/sxenditm.hxx                                   |   12 
 include/svx/sxmlhitm.hxx                                   |   10 
 include/svx/sxmtfitm.hxx                                   |    2 
 include/svx/xflbmsxy.hxx                                   |    4 
 include/svx/xflhtit.hxx                                    |    2 
 include/svx/xftdiit.hxx                                    |    2 
 include/svx/xftshxy.hxx                                    |    4 
 include/svx/xftstit.hxx                                    |    2 
 include/svx/xhatch.hxx                                     |    9 
 include/svx/xlndsit.hxx                                    |    2 
 include/svx/xlnedwit.hxx                                   |    2 
 include/svx/xlnstwit.hxx                                   |    2 
 include/svx/xlnwtit.hxx                                    |    2 
 include/svx/xpoly.hxx                                      |   10 
 include/svx/xtable.hxx                                     |   72 -
 include/svx/zoomsliderctrl.hxx                             |    4 
 include/test/sheet/xsheetannotations.hxx                   |    3 
 include/toolkit/controls/unocontrol.hxx                    |    3 
 sfx2/source/control/templatelocalview.cxx                  |    2 
 sfx2/source/control/thumbnailview.cxx                      |   18 
 svx/inc/CommonStylePreviewRenderer.hxx                     |    2 
 svx/inc/sxallitm.hxx                                       |    8 
 svx/inc/sxcaitm.hxx                                        |    2 
 svx/inc/sxlogitm.hxx                                       |    4 
 svx/inc/sxmoitm.hxx                                        |    2 
 svx/inc/sxmtaitm.hxx                                       |    2 
 svx/inc/sxoneitm.hxx                                       |    8 
 svx/inc/sxsaitm.hxx                                        |    2 
 svx/inc/sxtraitm.hxx                                       |    8 
 svx/qa/unit/customshapes.cxx                               |    4 
 svx/source/accessibility/ChildrenManager.cxx               |    6 
 svx/source/accessibility/ChildrenManagerImpl.cxx           |    8 
 svx/source/accessibility/ChildrenManagerImpl.hxx           |    8 
 svx/source/accessibility/DescriptionGenerator.cxx          |    4 
 svx/source/accessibility/GraphCtlAccessibleContext.cxx     |    2 
 svx/source/accessibility/ShapeTypeHandler.cxx              |    4 
 svx/source/accessibility/lookupcolorname.cxx               |    8 
 svx/source/accessibility/lookupcolorname.hxx               |    2 
 svx/source/accessibility/svxpixelctlaccessiblecontext.cxx  |   12 
 svx/source/accessibility/svxrectctaccessiblecontext.cxx    |   22 
 svx/source/customshapes/EnhancedCustomShape2d.cxx          |    2 
 svx/source/customshapes/EnhancedCustomShape3d.cxx          |    6 
 svx/source/customshapes/EnhancedCustomShapeEngine.cxx      |    4 
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx    |    2 
 svx/source/dialog/_bmpmask.cxx                             |   14 
 svx/source/dialog/_contdlg.cxx                             |    2 
 svx/source/dialog/charmap.cxx                              |   12 
 svx/source/dialog/compressgraphicdialog.cxx                |    8 
 svx/source/dialog/connctrl.cxx                             |   12 
 svx/source/dialog/dialcontrol.cxx                          |   22 
 svx/source/dialog/dlgctrl.cxx                              |   32 
 svx/source/dialog/dlgunit.hxx                              |    2 
 svx/source/dialog/fntctrl.cxx                              |   48 -
 svx/source/dialog/fontwork.cxx                             |    2 
 svx/source/dialog/framelinkarray.cxx                       |   48 -
 svx/source/dialog/frmsel.cxx                               |   40 
 svx/source/dialog/graphctl.cxx                             |   12 
 svx/source/dialog/hdft.cxx                                 |   56 -
 svx/source/dialog/hyperdlg.cxx                             |    8 
 svx/source/dialog/imapdlg.cxx                              |    4 
 svx/source/dialog/imapwnd.cxx                              |    2 
 svx/source/dialog/measctrl.cxx                             |    8 
 svx/source/dialog/optgrid.cxx                              |   10 
 svx/source/dialog/pagectrl.cxx                             |   28 
 svx/source/dialog/paraprev.cxx                             |   12 
 svx/source/dialog/rubydialog.cxx                           |   32 
 svx/source/dialog/rulritem.cxx                             |   38 
 svx/source/dialog/svxbmpnumvalueset.cxx                    |   14 
 svx/source/dialog/svxruler.cxx                             |  346 ++++----
 svx/source/dialog/swframeexample.cxx                       |   12 
 svx/source/engine3d/dragmt3d.cxx                           |    8 
 svx/source/engine3d/obj3d.cxx                              |    2 
 svx/source/engine3d/scene3d.cxx                            |   10 
 svx/source/engine3d/view3d.cxx                             |   32 
 svx/source/fmcomp/fmgridcl.cxx                             |   10 
 svx/source/fmcomp/gridctrl.cxx                             |   60 -
 svx/source/form/fmvwimp.cxx                                |   12 
 svx/source/form/tabwin.cxx                                 |    4 
 svx/source/gallery2/galctrl.cxx                            |    4 
 svx/source/gallery2/gallerybinaryengine.cxx                |    5 
 svx/source/gallery2/galobj.cxx                             |    4 
 svx/source/inc/GraphCtlAccessibleContext.hxx               |    2 
 svx/source/inc/cell.hxx                                    |    8 
 svx/source/inc/frmselimpl.hxx                              |   12 
 svx/source/inc/svxpixelctlaccessiblecontext.hxx            |    8 
 svx/source/inc/svxrectctaccessiblecontext.hxx              |   10 
 svx/source/items/algitem.cxx                               |   18 
 svx/source/items/numfmtsh.cxx                              |    6 
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx   |    8 
 svx/source/sdr/overlay/overlaymanager.cxx                  |    8 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx          |    4 
 svx/source/sidebar/inspector/InspectorTextPanel.cxx        |    2 
 svx/source/sidebar/line/LinePropertyPanelBase.cxx          |    4 
 svx/source/sidebar/line/LineWidthPopup.cxx                 |    8 
 svx/source/sidebar/line/LineWidthValueSet.cxx              |    4 
 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx    |    4 
 svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx    |    3 
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx         |   16 
 svx/source/sidebar/paragraph/ParaPropertyPanel.hxx         |    6 
 svx/source/sidebar/paragraph/ParaSpacingWindow.cxx         |    6 
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx        |   42 
 svx/source/sidebar/possize/PosSizePropertyPanel.hxx        |    4 
 svx/source/sidebar/shadow/ShadowPropertyPanel.cxx          |    2 
 svx/source/sidebar/shadow/ShadowPropertyPanel.hxx          |    4 
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx    |   10 
 svx/source/sidebar/text/TextCharacterSpacingControl.hxx    |    4 
 svx/source/sidebar/tools/ValueSetWithTextControl.cxx       |    4 
 svx/source/stbctrls/modctrl.cxx                            |    4 
 svx/source/stbctrls/pszctrl.cxx                            |    4 
 svx/source/stbctrls/xmlsecctrl.cxx                         |    2 
 svx/source/stbctrls/zoomsliderctrl.cxx                     |   72 -
 svx/source/styles/CommonStyleManager.cxx                   |    2 
 svx/source/styles/CommonStylePreviewRenderer.cxx           |    2 
 svx/source/svdraw/sdrpagewindow.cxx                        |   16 
 svx/source/svdraw/svdattr.cxx                              |    8 
 svx/source/svdraw/svddrag.cxx                              |   14 
 svx/source/svdraw/svddrgm1.hxx                             |   14 
 svx/source/svdraw/svddrgmt.cxx                             |   54 -
 svx/source/svdraw/svdedtv1.cxx                             |  134 +--
 svx/source/svdraw/svdedxv.cxx                              |    8 
 svx/source/svdraw/svdfmtf.cxx                              |   14 
 svx/source/svdraw/svdglev.cxx                              |    2 
 svx/source/svdraw/svdglue.cxx                              |   44 -
 svx/source/svdraw/svdhdl.cxx                               |    6 
 svx/source/svdraw/svdmodel.cxx                             |   16 
 svx/source/svdraw/svdmrkv.cxx                              |   24 
 svx/source/svdraw/svdoashp.cxx                             |   62 -
 svx/source/svdraw/svdobj.cxx                               |   78 -
 svx/source/svdraw/svdocapt.cxx                             |   10 
 svx/source/svdraw/svdocirc.cxx                             |   74 -
 svx/source/svdraw/svdoedge.cxx                             |  100 +-
 svx/source/svdraw/svdograf.cxx                             |   16 
 svx/source/svdraw/svdogrp.cxx                              |   32 
 svx/source/svdraw/svdomeas.cxx                             |  124 +-
 svx/source/svdraw/svdomedia.cxx                            |    4 
 svx/source/svdraw/svdoole2.cxx                             |   20 
 svx/source/svdraw/svdopath.cxx                             |  124 +-
 svx/source/svdraw/svdorect.cxx                             |   14 
 svx/source/svdraw/svdotext.cxx                             |   74 -
 svx/source/svdraw/svdotxat.cxx                             |   16 
 svx/source/svdraw/svdotxdr.cxx                             |   24 
 svx/source/svdraw/svdotxed.cxx                             |   12 
 svx/source/svdraw/svdotxtr.cxx                             |   24 
 svx/source/svdraw/svdovirt.cxx                             |   12 
 svx/source/svdraw/svdpagv.cxx                              |   44 -
 svx/source/svdraw/svdpntv.cxx                              |   10 
 svx/source/svdraw/svdpoev.cxx                              |    2 
 svx/source/svdraw/svdsnpv.cxx                              |   46 -
 svx/source/svdraw/svdtrans.cxx                             |  110 +-
 svx/source/svdraw/svdview.cxx                              |    4 
 svx/source/svdraw/svdxcgv.cxx                              |    4 
 svx/source/table/cell.cxx                                  |    8 
 svx/source/table/svdotable.cxx                             |    4 
 svx/source/table/tablertfexporter.cxx                      |    4 
 svx/source/table/tablertfimporter.cxx                      |    4 
 svx/source/tbxctrls/PaletteManager.cxx                     |    4 
 svx/source/tbxctrls/SvxPresetListBox.cxx                   |    2 
 svx/source/tbxctrls/colrctrl.cxx                           |    4 
 svx/source/tbxctrls/grafctrl.cxx                           |    4 
 svx/source/tbxctrls/itemwin.cxx                            |   20 
 svx/source/tbxctrls/layctrl.cxx                            |   68 -
 svx/source/tbxctrls/linectrl.cxx                           |    8 
 svx/source/tbxctrls/tbcontrl.cxx                           |   40 
 svx/source/tbxctrls/tbunocontroller.cxx                    |   12 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx             |    2 
 svx/source/tbxctrls/tbxcolorupdate.cxx                     |    2 
 svx/source/uitest/sdrobject.cxx                            |   12 
 svx/source/unodraw/UnoGraphicExporter.cxx                  |   12 
 svx/source/unodraw/XPropertyTable.cxx                      |   26 
 svx/source/unodraw/unoctabl.cxx                            |   12 
 svx/source/unodraw/unopage.cxx                             |    4 
 svx/source/unodraw/unoshap3.cxx                            |    2 
 svx/source/unodraw/unoshape.cxx                            |   14 
 svx/source/xoutdev/_xpoly.cxx                              |   66 -
 svx/source/xoutdev/xattr.cxx                               |   30 
 svx/source/xoutdev/xattr2.cxx                              |    4 
 svx/source/xoutdev/xtabbtmp.cxx                            |   12 
 svx/source/xoutdev/xtabcolr.cxx                            |   10 
 svx/source/xoutdev/xtabdash.cxx                            |    6 
 svx/source/xoutdev/xtabgrdt.cxx                            |   10 
 svx/source/xoutdev/xtabhtch.cxx                            |   10 
 svx/source/xoutdev/xtable.cxx                              |   18 
 svx/source/xoutdev/xtablend.cxx                            |    4 
 svx/source/xoutdev/xtabptrn.cxx                            |   12 
 toolkit/inc/helper/btndlg.hxx                              |    6 
 toolkit/inc/helper/scrollabledialog.hxx                    |   12 
 toolkit/source/awt/animatedimagespeer.cxx                  |    2 
 toolkit/source/awt/scrollabledialog.cxx                    |   14 
 toolkit/source/awt/vclxgraphics.cxx                        |    4 
 toolkit/source/awt/vclxspinbutton.cxx                      |    2 
 toolkit/source/awt/vclxtoolkit.cxx                         |   12 
 toolkit/source/awt/vclxwindows.cxx                         |   14 
 toolkit/source/controls/filectrl.cxx                       |    6 
 toolkit/source/controls/unocontrolmodel.cxx                |   19 
 toolkit/source/helper/btndlg.cxx                           |   18 
 ucb/source/cacher/cachedcontentresultset.cxx               |    5 
 ucb/source/sorter/sortdynres.cxx                           |    5 
 ucb/source/ucp/cmis/cmis_content.cxx                       |    5 
 ucb/source/ucp/webdav-neon/NeonSession.cxx                 |    5 
 uui/source/nameclashdlg.cxx                                |    6 
 vbahelper/source/msforms/vbacontrol.cxx                    |    8 
 vbahelper/source/vbahelper/vbaapplicationbase.cxx          |    4 
 writerfilter/source/dmapper/PropertyMap.cxx                |    2 
 writerfilter/source/dmapper/WrapPolygonHandler.cxx         |    6 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx             |    6 
 writerfilter/source/rtftok/rtfdocumentimpl.hxx             |    3 
 writerfilter/source/rtftok/rtfsdrimport.cxx                |    2 
 writerperfect/inc/DirectoryStream.hxx                      |    5 
 writerperfect/inc/WPXSvInputStream.hxx                     |    5 
 writerperfect/qa/unit/WPXSvStreamTest.cxx                  |    6 
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx      |    4 
 writerperfect/source/common/DirectoryStream.cxx            |    4 
 writerperfect/source/common/WPXSvInputStream.cxx           |   25 
 xmloff/inc/RDFaExportHelper.hxx                            |    3 
 xmloff/source/core/xmlexp.cxx                              |    2 
 xmloff/source/draw/sdxmlexp.cxx                            |  168 +--
 xmloff/source/text/txtlists.cxx                            |    3 
 xmlsecurity/source/dialogs/certificatechooser.cxx          |    2 
 xmlsecurity/source/dialogs/certificateviewer.cxx           |    2 
 284 files changed, 2859 insertions(+), 2279 deletions(-)

New commits:
commit 4fbd63860500b2db76df4d5aedbe5e3aa31fac69
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Mon Oct 12 09:52:12 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 26 07:35:36 2020 +0100

    switching long to a 64-bit type on 64-bit windows
    
    (*) create a rewriting plugin to do most of the work, heavily
        based on the fakebool plugin
    (*) but there are still a number of "long"s in the codebase
        that will need to be done by hand
    (*) the plugin needs lots of handholding, due to needing to
        add #include and update macros
    
    Change-Id: I8184d7000ca482c0469514bb73178c3a1123b1e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104203
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/toolslong.cxx b/compilerplugins/clang/toolslong.cxx
new file mode 100644
index 000000000000..591ce6a5cc7c
--- /dev/null
+++ b/compilerplugins/clang/toolslong.cxx
@@ -0,0 +1,556 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <algorithm>
+#include <cassert>
+#include <limits>
+#include <map>
+#include <string>
+#include <iostream>
+
+#include "clang/AST/Attr.h"
+#include "clang/Basic/Builtins.h"
+
+#include "check.hxx"
+#include "compat.hxx"
+#include "plugin.hxx"
+
+namespace
+{
+bool isLong(QualType type)
+{
+    type = type.getNonReferenceType();
+    // ignore sal_Int64
+    if (type->getAs<TypedefType>())
+        return false;
+    // some parts of the STL have ::difference_type => long
+    if (type->getAs<AutoType>() || type->getAs<DecltypeType>())
+        return false;
+    if (type->isSpecificBuiltinType(BuiltinType::Kind::Long))
+        return true;
+    auto arrayType = type->getAsArrayTypeUnsafe();
+    if (arrayType)
+        return isLong(arrayType->getElementType());
+    if (type->isPointerType())
+        return isLong(type->getPointeeType());
+    return false;
+}
+
+enum class OverrideKind
+{
+    NO,
+    YES,
+    MAYBE
+};
+
+OverrideKind getOverrideKind(FunctionDecl const* decl)
+{
+    CXXMethodDecl const* m = dyn_cast<CXXMethodDecl>(decl);
+    if (m == nullptr)
+        return OverrideKind::NO;
+    if (m->size_overridden_methods() != 0 || m->hasAttr<OverrideAttr>())
+        return OverrideKind::YES;
+    if (!dyn_cast<CXXRecordDecl>(m->getDeclContext())->hasAnyDependentBases())
+        return OverrideKind::NO;
+    return OverrideKind::MAYBE;
+}
+
+class ToolsLong : public loplugin::FilteringRewritePlugin<ToolsLong>
+{
+public:
+    explicit ToolsLong(loplugin::InstantiationData const& data)
+        : loplugin::FilteringRewritePlugin<ToolsLong>(data)
+    {
+    }
+
+    virtual void run() override;
+
+    bool VisitCStyleCastExpr(CStyleCastExpr* expr);
+
+    bool VisitCXXStaticCastExpr(CXXStaticCastExpr* expr);
+
+    bool VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr);
+
+    bool WalkUpFromParmVarDecl(ParmVarDecl const* decl);
+    bool VisitParmVarDecl(ParmVarDecl const* decl);
+
+    bool WalkUpFromVarDecl(VarDecl const* decl);
+    bool VisitVarDecl(VarDecl const* decl);
+
+    bool WalkUpFromFieldDecl(FieldDecl const* decl);
+    bool VisitFieldDecl(FieldDecl const* decl);
+
+    bool WalkUpFromFunctionDecl(FunctionDecl const* decl);
+    bool VisitFunctionDecl(FunctionDecl const* decl);
+
+private:
+    bool rewrite(SourceLocation location);
+    bool isExcludedFile(SourceLocation spellingLocation) const;
+    /** sort by the reverse of source order, so we can do replacing from the end of the file backwards,
+        which means we reduce the chances of having overlapping changes. */
+    template <class T>
+    std::vector<std::pair<T, bool>> reverseSourceOrder(std::map<T, bool> const& map) const
+    {
+        std::vector<std::pair<T, bool>> vec(map.begin(), map.end());
+        std::sort(vec.begin(), vec.end(),
+                  [&](std::pair<T, bool> const& lhs, std::pair<T, bool> const& rhs) {
+                      return compiler.getSourceManager().getCharacterData(
+                                 compat::getBeginLoc(lhs.first))
+                             > compiler.getSourceManager().getCharacterData(
+                                   compat::getBeginLoc(rhs.first));
+                  });
+        return vec;
+    }
+
+    std::map<VarDecl const*, bool> varDecls_;
+    std::map<FieldDecl const*, bool> fieldDecls_;
+    std::map<ParmVarDecl const*, bool> parmVarDecls_;
+    std::map<FunctionDecl const*, bool> functionDecls_;
+    std::map<CXXStaticCastExpr const*, bool> staticCasts_;
+    std::map<CXXFunctionalCastExpr const*, bool> functionalCasts_;
+};
+
+void ToolsLong::run()
+{
+    if (!compiler.getLangOpts().CPlusPlus)
+        return;
+
+    TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+    for (auto const& dcl : reverseSourceOrder(varDecls_))
+    {
+        auto const decl = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(decl) };
+        TypeSourceInfo* tsi = decl->getTypeSourceInfo();
+        if (tsi != nullptr)
+        {
+            SourceLocation l{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getBeginLoc()) };
+            SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getEndLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (l == end || compiler.getSourceManager().isBeforeInTranslationUnit(l, end))
+            {
+                for (;;)
+                {
+                    unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                           compiler.getLangOpts());
+                    std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == "long")
+                    {
+                        loc = l;
+                        break;
+                    }
+                    if (l == end)
+                    {
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+        }
+        if (!rewrite(loc))
+        {
+            report(DiagnosticsEngine::Warning, "VarDecl, use \"tools::Long\" instead of %0", loc)
+                << decl->getType().getLocalUnqualifiedType() << decl->getSourceRange();
+        }
+    }
+    for (auto const& dcl : reverseSourceOrder(fieldDecls_))
+    {
+        auto const decl = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(decl) };
+        TypeSourceInfo* tsi = decl->getTypeSourceInfo();
+        if (tsi != nullptr)
+        {
+            SourceLocation l{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getBeginLoc()) };
+            SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getEndLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (l == end || compiler.getSourceManager().isBeforeInTranslationUnit(l, end))
+            {
+                for (;;)
+                {
+                    unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                           compiler.getLangOpts());
+                    std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == "long")
+                    {
+                        loc = l;
+                        break;
+                    }
+                    if (l == end)
+                    {
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+        }
+        if (!rewrite(loc))
+        {
+            report(DiagnosticsEngine::Warning, "FieldDecl, use \"tools::Long\" instead of %0", loc)
+                << decl->getType().getLocalUnqualifiedType() << decl->getSourceRange();
+        }
+    }
+    for (auto const& dcl : reverseSourceOrder(parmVarDecls_))
+    {
+        auto const decl = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(decl) };
+        TypeSourceInfo* tsi = decl->getTypeSourceInfo();
+        if (tsi != nullptr)
+        {
+            SourceLocation l{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getBeginLoc()) };
+            SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getEndLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (l == end || (compiler.getSourceManager().isBeforeInTranslationUnit(l, end)))
+            {
+                for (;;)
+                {
+                    unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                           compiler.getLangOpts());
+                    std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == "long")
+                    {
+                        loc = l;
+                        break;
+                    }
+                    if (l == end)
+                    {
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+        }
+        FunctionDecl const* f = dyn_cast_or_null<FunctionDecl>(decl->getDeclContext());
+        if (f)
+            f = f->getCanonicalDecl();
+        OverrideKind k = f ? getOverrideKind(f) : OverrideKind::NO;
+        if (k == OverrideKind::MAYBE || !rewrite(loc))
+        {
+            report(DiagnosticsEngine::Warning,
+                   ("ParmVarDecl, use \"tools::Long\" instead of"
+                    " %0%1"),
+                   loc)
+                << decl->getType().getNonReferenceType().getLocalUnqualifiedType()
+                << (k == OverrideKind::MAYBE ? (" (unless this member function overrides a"
+                                                " dependent base member function, even"
+                                                " though it is not marked 'override')")
+                                             : "")
+                << decl->getSourceRange();
+        }
+    }
+    for (auto const& dcl : functionDecls_)
+    {
+        auto const decl = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(decl) };
+        SourceLocation l{ compiler.getSourceManager().getExpansionLoc(loc) };
+        SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+            decl->getNameInfo().getLoc()) };
+        assert(l.isFileID() && end.isFileID());
+        if (compiler.getSourceManager().isBeforeInTranslationUnit(l, end))
+        {
+            while (l != end)
+            {
+                unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                       compiler.getLangOpts());
+                std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                if (s == "long")
+                {
+                    loc = l;
+                    break;
+                }
+                l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+            }
+        }
+        if (rewrite(loc))
+            continue;
+        report(DiagnosticsEngine::Warning, "use \"tools::Long\" instead of %0 as return type%1",
+               loc)
+            << decl->getReturnType().getNonReferenceType().getLocalUnqualifiedType()
+            << (getOverrideKind(decl) == OverrideKind::MAYBE
+                    ? (" (unless this member function overrides a dependent"
+                       " base member function, even though it is not marked"
+                       " 'override')")
+                    : "")
+            << decl->getSourceRange();
+    }
+
+    for (auto const& dcl : staticCasts_)
+    {
+        auto const expr = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(expr) };
+        TypeSourceInfo* tsi = expr->getTypeInfoAsWritten();
+        if (tsi != nullptr)
+        {
+            SourceLocation l{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getBeginLoc()) };
+            SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getEndLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (l == end || compiler.getSourceManager().isBeforeInTranslationUnit(l, end))
+            {
+                for (;;)
+                {
+                    unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                           compiler.getLangOpts());
+                    std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == "long")
+                    {
+                        loc = l;
+                        break;
+                    }
+                    if (l == end)
+                    {
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+        }
+        if (!rewrite(loc))
+        {
+            report(DiagnosticsEngine::Warning, "CXXStaticCastExpr, suspicious cast from %0 to %1",
+                   compat::getBeginLoc(expr))
+                << expr->getSubExpr()->IgnoreParenImpCasts()->getType() << expr->getType()
+                << expr->getSourceRange();
+        }
+    }
+
+    for (auto const& dcl : functionalCasts_)
+    {
+        auto const expr = dcl.first;
+        SourceLocation loc{ compat::getBeginLoc(expr) };
+        TypeSourceInfo* tsi = expr->getTypeInfoAsWritten();
+        if (tsi != nullptr)
+        {
+            SourceLocation l{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getBeginLoc()) };
+            SourceLocation end{ compiler.getSourceManager().getExpansionLoc(
+                tsi->getTypeLoc().getEndLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (l == end || compiler.getSourceManager().isBeforeInTranslationUnit(l, end))
+            {
+                for (;;)
+                {
+                    unsigned n = Lexer::MeasureTokenLength(l, compiler.getSourceManager(),
+                                                           compiler.getLangOpts());
+                    std::string s{ compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == "long")
+                    {
+                        loc = l;
+                        break;
+                    }
+                    if (l == end)
+                    {
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+        }
+        if (!rewrite(loc))
+        {
+            report(DiagnosticsEngine::Warning,
+                   "CXXFunctionalCastExpr, suspicious cast from %0 to %1",
+                   compat::getBeginLoc(expr))
+                << expr->getSubExpr()->IgnoreParenImpCasts()->getType() << expr->getType()
+                << expr->getSourceRange();
+        }
+    }
+}
+
+bool ToolsLong::VisitCStyleCastExpr(CStyleCastExpr* expr)
+{
+    if (ignoreLocation(expr))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))))
+        return true;
+    auto const k = isLong(expr->getType());
+    if (!k)
+        return true;
+    SourceLocation loc{ compat::getBeginLoc(expr) };
+    while (compiler.getSourceManager().isMacroArgExpansion(loc))
+        loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
+    report(DiagnosticsEngine::Warning, "CStyleCastExpr, suspicious cast from %0 to %1",
+           compat::getBeginLoc(expr))
+        << expr->getSubExpr()->IgnoreParenImpCasts()->getType() << expr->getType()
+        << expr->getSourceRange();
+    return true;
+}
+
+bool ToolsLong::VisitCXXStaticCastExpr(CXXStaticCastExpr* expr)
+{
+    if (ignoreLocation(expr))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))))
+        return true;
+    auto const k = isLong(expr->getType());
+    if (!k)
+        return true;
+    staticCasts_.insert({ expr, k });
+    return true;
+}
+
+bool ToolsLong::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr)
+{
+    if (ignoreLocation(expr))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))))
+        return true;
+    auto const k = isLong(expr->getType());
+    if (!k)
+        return true;
+    functionalCasts_.insert({ expr, k });
+    return true;
+}
+
+bool ToolsLong::WalkUpFromParmVarDecl(ParmVarDecl const* decl) { return VisitParmVarDecl(decl); }
+
+bool ToolsLong::VisitParmVarDecl(ParmVarDecl const* decl)
+{
+    if (ignoreLocation(decl))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(decl->getLocation())))
+        return true;
+    auto const fbk = isLong(decl->getType());
+    if (!fbk)
+        return true;
+    FunctionDecl const* f = dyn_cast<FunctionDecl>(decl->getDeclContext());
+    if (f) // e.g.: typedef sal_Bool (* FuncPtr )( sal_Bool );
+    {
+        auto canonicalF = f->getCanonicalDecl();
+        if (canonicalF->isDeletedAsWritten() && isa<CXXConversionDecl>(canonicalF))
+            return true;
+        // Only rewrite declarations in include files if a definition is
+        // also seen, to avoid compilation of a definition (in a main file
+        // only processed later) to fail with a "mismatch" error before the
+        // rewriter had a chance to act upon the definition (but use the
+        // heuristic of assuming pure virtual functions do not have
+        // definitions):
+        bool ok = canonicalF->isDefined() || canonicalF->isPure()
+                  || compiler.getSourceManager().isInMainFile(
+                         compiler.getSourceManager().getSpellingLoc(f->getNameInfo().getLoc()));
+        if (!ok)
+            return true;
+    }
+    parmVarDecls_.insert({ decl, fbk });
+    return true;
+}
+
+bool ToolsLong::WalkUpFromVarDecl(VarDecl const* decl) { return VisitVarDecl(decl); }
+
+bool ToolsLong::VisitVarDecl(VarDecl const* decl)
+{
+    if (ignoreLocation(decl))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(decl->getLocation())))
+        return true;
+    auto k = isLong(decl->getType());
+    if (!k)
+        return true;
+    varDecls_.insert({ decl, k });
+    return true;
+}
+
+bool ToolsLong::WalkUpFromFieldDecl(FieldDecl const* decl) { return VisitFieldDecl(decl); }
+
+bool ToolsLong::VisitFieldDecl(FieldDecl const* decl)
+{
+    if (ignoreLocation(decl))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(decl->getLocation())))
+        return true;
+    auto k = isLong(decl->getType());
+    if (!k)
+        return true;
+    TagDecl const* td = dyn_cast<TagDecl>(decl->getDeclContext());
+    if (td == nullptr)
+    {
+        //TODO: ObjCInterface
+        return true;
+    }
+    fieldDecls_.insert({ decl, k });
+    return true;
+}
+
+bool ToolsLong::WalkUpFromFunctionDecl(FunctionDecl const* decl) { return VisitFunctionDecl(decl); }
+
+bool ToolsLong::VisitFunctionDecl(FunctionDecl const* decl)
+{
+    if (ignoreLocation(decl))
+        return true;
+    if (isExcludedFile(compiler.getSourceManager().getSpellingLoc(decl->getLocation())))
+        return true;
+    auto const fbk = isLong(decl->getReturnType());
+    if (!fbk)
+        return true;
+    if (decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl))
+        return true;
+    if (decl->isPure() || decl->isDefined()
+        || compiler.getSourceManager().isInMainFile(
+               compiler.getSourceManager().getSpellingLoc(decl->getNameInfo().getLoc())))
+    {
+        functionDecls_.insert({ decl, fbk });
+    }
+    return true;
+}
+
+bool ToolsLong::rewrite(SourceLocation location)
+{
+    if (rewriter != nullptr)
+    {
+        SourceLocation loc{ compiler.getSourceManager().getExpansionLoc(location) };
+        unsigned n
+            = Lexer::MeasureTokenLength(loc, compiler.getSourceManager(), compiler.getLangOpts());
+        if (std::string(compiler.getSourceManager().getCharacterData(loc), n) == "long")
+        {
+            return replaceText(loc, n, "tools::Long");
+        }
+    }
+    return false;
+}
+
+bool ToolsLong::isExcludedFile(SourceLocation spellingLocation) const
+{
+    if (isInUnoIncludeFile(spellingLocation))
+        return true;
+    auto f = getFilenameOfLocation(spellingLocation);
+    return loplugin::hasPathnamePrefix(f, SRCDIR "/include/cppu/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/cppuhelper/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/registry/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/osl/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/rtl/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/sal/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/salhelper/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/typelib/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/include/LibreOfficeKit/") // TODO
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/bridges/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/codemaker/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/configmgr/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/cppu/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/cppuhelper/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/external/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/libreofficekit/") // TODO
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/registry/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/rtl/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/sal/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/salhelper/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/soltools/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/unoidl/")
+           || loplugin::hasPathnamePrefix(f, SRCDIR "/workdir/");
+}
+
+loplugin::Plugin::Registration<ToolsLong> X("toolslong", true);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index a756fc22899c..1cd145c33839 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -202,7 +202,8 @@ TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D(
     const basegfx::B2DHomMatrix& rNewTransform, const OUString& rText, sal_Int32 nTextPosition,
     sal_Int32 nTextLength, const std::vector<double>& rDXArray,
     const attribute::FontAttribute& rFontAttribute, const css::lang::Locale& rLocale,
-    const basegfx::BColor& rFontColor, bool bFilled, long nWidthToFill, const Color& rTextFillColor)
+    const basegfx::BColor& rFontColor, bool bFilled, tools::Long nWidthToFill,
+    const Color& rTextFillColor)
     : BufferedDecompositionPrimitive2D()
     , maTextTransform(rNewTransform)
     , maText(rText)
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 13883b50412f..04603bc03f77 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2331,10 +2331,10 @@ VclMetafileProcessor2D::CreateBufferDevice(const basegfx::B2DRange& rCandidateRa
     constexpr double fMaxQuadratPixels = 500000;
     basegfx::B2DRange aViewRange(rCandidateRange);
     aViewRange.transform(maCurrentTransformation);
-    rRectLogic = tools::Rectangle(static_cast<long>(std::floor(aViewRange.getMinX())),
-                                  static_cast<long>(std::floor(aViewRange.getMinY())),
-                                  static_cast<long>(std::ceil(aViewRange.getMaxX())),
-                                  static_cast<long>(std::ceil(aViewRange.getMaxY())));
+    rRectLogic = tools::Rectangle(static_cast<tools::Long>(std::floor(aViewRange.getMinX())),
+                                  static_cast<tools::Long>(std::floor(aViewRange.getMinY())),
+                                  static_cast<tools::Long>(std::ceil(aViewRange.getMaxX())),
+                                  static_cast<tools::Long>(std::ceil(aViewRange.getMaxY())));
     const tools::Rectangle aRectPixel(mpOutputDevice->LogicToPixel(rRectLogic));
     rSizePixel = aRectPixel.GetSize();
     const double fViewVisibleArea(rSizePixel.getWidth() * rSizePixel.getHeight());
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 1e5a04baf30d..266e118f19ef 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1045,10 +1045,11 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv
         bitmapRange.intersect(viewRange);
         if (!bitmapRange.isEmpty())
         {
-            const tools::Rectangle aRect(static_cast<long>(std::floor(bitmapRange.getMinX())),
-                                         static_cast<long>(std::floor(bitmapRange.getMinY())),
-                                         static_cast<long>(std::ceil(bitmapRange.getMaxX())),
-                                         static_cast<long>(std::ceil(bitmapRange.getMaxY())));
+            const tools::Rectangle aRect(
+                static_cast<tools::Long>(std::floor(bitmapRange.getMinX())),
+                static_cast<tools::Long>(std::floor(bitmapRange.getMinY())),
+                static_cast<tools::Long>(std::ceil(bitmapRange.getMaxX())),
+                static_cast<tools::Long>(std::ceil(bitmapRange.getMaxY())));
             BitmapEx bmpEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize());
             mpOutputDevice->SetAntialiasing(aPrevAA);
 
@@ -1106,10 +1107,11 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
         bitmapRange.intersect(viewRange);
         if (!bitmapRange.isEmpty())
         {
-            const tools::Rectangle aRect(static_cast<long>(std::floor(bitmapRange.getMinX())),
-                                         static_cast<long>(std::floor(bitmapRange.getMinY())),
-                                         static_cast<long>(std::ceil(bitmapRange.getMaxX())),
-                                         static_cast<long>(std::ceil(bitmapRange.getMaxY())));
+            const tools::Rectangle aRect(
+                static_cast<tools::Long>(std::floor(bitmapRange.getMinX())),
+                static_cast<tools::Long>(std::floor(bitmapRange.getMinY())),
+                static_cast<tools::Long>(std::ceil(bitmapRange.getMaxX())),
+                static_cast<tools::Long>(std::ceil(bitmapRange.getMaxY())));
             BitmapEx bitmap = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize());
 
             AlphaMask aMask = bitmap.GetAlpha();
@@ -1155,10 +1157,10 @@ void VclPixelProcessor2D::processShadowPrimitive2D(const primitive2d::ShadowPrim
 
         process(rCandidate);
 
-        const tools::Rectangle aRect(static_cast<long>(std::floor(aRange.getMinX())),
-                                     static_cast<long>(std::floor(aRange.getMinY())),
-                                     static_cast<long>(std::ceil(aRange.getMaxX())),
-                                     static_cast<long>(std::ceil(aRange.getMaxY())));
+        const tools::Rectangle aRect(static_cast<tools::Long>(std::floor(aRange.getMinX())),
+                                     static_cast<tools::Long>(std::floor(aRange.getMinY())),
+                                     static_cast<tools::Long>(std::ceil(aRange.getMaxX())),
+                                     static_cast<tools::Long>(std::ceil(aRange.getMaxY())));
 
         BitmapEx bitmapEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), aRect.GetSize());
 
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 042ca9d765cd..9f5f5d77c0d5 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -290,7 +290,8 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
             sal_Int32 nPos = rTextCandidate.getTextPosition();
             sal_Int32 nLen = rTextCandidate.getTextLength();
 
-            long* pDXArray = !aTransformedDXArray.empty() ? aTransformedDXArray.data() : nullptr;
+            tools::Long* pDXArray
+                = !aTransformedDXArray.empty() ? aTransformedDXArray.data() : nullptr;
 
             if (rTextCandidate.isFilled())
             {
@@ -299,12 +300,12 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
                 rTextCandidate.getTextTransform().decompose(aOldFontScaling, aOldTranslate,
                                                             fOldRotate, fOldShearX);
 
-                long nWidthToFill = static_cast<long>(
+                tools::Long nWidthToFill = static_cast<tools::Long>(
                     rTextCandidate.getWidthToFill() * aFontScaling.getX() / aOldFontScaling.getX());
 
-                long nWidth
+                tools::Long nWidth
                     = mpOutputDevice->GetTextArray(rTextCandidate.getText(), pDXArray, 0, 1);
-                long nChars = 2;
+                tools::Long nChars = 2;
                 if (nWidth)
                     nChars = nWidthToFill / nWidth;
 
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 60bf9ea6ae9f..8439b10957de 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1844,7 +1844,7 @@ namespace wmfemfhelper
                     {
                         // prepare DXArray (if used)
                         std::vector< double > aDXArray;
-                        long* pDXArray = pA->GetDXArray();
+                        tools::Long* pDXArray = pA->GetDXArray();
 
                         if(pDXArray)
                         {
diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx
index 76dd6c637f62..4548f7013e87 100644
--- a/include/cui/cuicharmap.hxx
+++ b/include/cui/cuicharmap.hxx
@@ -47,7 +47,7 @@ class CUI_DLLPUBLIC SvxShowText final : public weld::CustomWidgetController
 private:
     ScopedVclPtr<VirtualDevice> m_xVirDev;
     OUString m_sText;
-    long mnY;
+    tools::Long mnY;
     bool mbCenter;
     vcl::Font m_aFont;
 
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx
index 6bbc14aa498a..516d715c93d6 100644
--- a/include/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -27,6 +27,7 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/color.hxx>
+#include <tools/long.hxx>
 #include <basegfx/color/bcolor.hxx>
 #include <com/sun/star/lang/Locale.hpp>
 #include <vector>
@@ -119,7 +120,7 @@ private:
     bool mbFilled;
 
     // the width to fill
-    long mnWidthToFill;
+    tools::Long mnWidthToFill;
 
     /// The fill color of the text
     Color maTextFillColor;
@@ -141,7 +142,7 @@ public:
                                  const attribute::FontAttribute& rFontAttribute,
                                  const css::lang::Locale& rLocale,
                                  const basegfx::BColor& rFontColor, bool bFilled = false,
-                                 long nWidthToFill = 0,
+                                 tools::Long nWidthToFill = 0,
                                  const Color& rTextFillColor = COL_TRANSPARENT);
 
     /** get text outlines as polygons and their according ObjectTransformation. Handles all
@@ -161,7 +162,7 @@ public:
     const basegfx::BColor& getFontColor() const { return maFontColor; }
     const Color& getTextFillColor() const { return maTextFillColor; }
     bool isFilled() const { return mbFilled; }
-    long getWidthToFill() const { return mnWidthToFill; }
+    tools::Long getWidthToFill() const { return mnWidthToFill; }
 
     /// compare operator
     virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index d77a7c781eb4..69019ab2451c 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -165,8 +165,8 @@ protected:
 
     TemplateViewItem *maSelectedItem;
 
-    long mnThumbnailWidth;
-    long mnThumbnailHeight;
+    tools::Long mnThumbnailWidth;
+    tools::Long mnThumbnailHeight;
 
     Point maPosition; //store the point of click event
 
diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index 14a90c7549bf..f7cdd01c0cfc 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/uno/Reference.hxx>
 #include <rtl/ref.hxx>
 #include <svx/svxdllapi.h>
+#include <tools/long.hxx>
 
 namespace com::sun::star {
      namespace accessibility { class XAccessible; }
@@ -110,7 +111,7 @@ public:
         @return
             If there are no children a 0 is returned.
     */
-    long GetChildCount() const throw ();
+    tools::Long GetChildCount() const throw ();
 
     /** Return the requested accessible child or throw and
         IndexOutOfBoundsException if the given index is invalid.
@@ -127,10 +128,10 @@ public:
     */
     css::uno::Reference<
             css::accessibility::XAccessible>
-        GetChild (long nIndex);
+        GetChild (tools::Long nIndex);
     /// @throws css::lang::IndexOutOfBoundsException
     /// @throws css::uno::RuntimeException
-    css::uno::Reference< css::drawing::XShape> GetChildShape (long nIndex);
+    css::uno::Reference< css::drawing::XShape> GetChildShape (tools::Long nIndex);
 
     /** Update the child manager.  Take care of a modified set of children
         and modified visible area.  This method can optimize the update
diff --git a/include/svx/CommonStyleManager.hxx b/include/svx/CommonStyleManager.hxx
index b7820beb5e07..a7f2a7ae3ce2 100644
--- a/include/svx/CommonStyleManager.hxx
+++ b/include/svx/CommonStyleManager.hxx
@@ -31,7 +31,7 @@ public:
 
     virtual std::unique_ptr<sfx2::StylePreviewRenderer> CreateStylePreviewRenderer(
                                             OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle,
-                                            long nMaxHeight) override;
+                                            tools::Long nMaxHeight) override;
 };
 
 } // end namespace svx
diff --git a/include/svx/IAccessibleParent.hxx b/include/svx/IAccessibleParent.hxx
index 19284a7d0ce7..50530c0a0f85 100644
--- a/include/svx/IAccessibleParent.hxx
+++ b/include/svx/IAccessibleParent.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SVX_IACCESSIBLEPARENT_HXX
 
 #include <com/sun/star/uno/Reference.hxx>
+#include <tools/long.hxx>
 
 namespace accessibility { class AccessibleControlShape; }
 namespace com::sun::star::accessibility { class XAccessible; }
@@ -80,7 +81,7 @@ public:
     virtual bool ReplaceChild (
         AccessibleShape* pCurrentChild,
         const css::uno::Reference< css::drawing::XShape >& _rxShape,
-        const long _nIndex,
+        const tools::Long _nIndex,
         const AccessibleShapeTreeInfo& _rShapeTreeInfo
     ) = 0;
     //Add this method to support Form Controls
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 637f7d0e1a40..dbcf789f5cfd 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -38,7 +38,7 @@ class SVXCORE_DLLPUBLIC PaletteManager
     sal_uInt16              mnNumOfPalettes;
     sal_uInt16              mnCurrentPalette;
 
-    long                    mnColorCount;
+    tools::Long                    mnColorCount;
     svx::ToolboxButtonColorUpdaterBase* mpBtnUpdater;
 
     XColorListRef           pColorList;
@@ -62,8 +62,8 @@ public:
     OUString    GetPaletteName();
     OUString    GetSelectedPalettePath();
 
-    long        GetColorCount() const;
-    long        GetRecentColorCount() const;
+    tools::Long        GetColorCount() const;
+    tools::Long        GetRecentColorCount() const;
     void        AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
 
     void        SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx
index b58463879f55..ccf61121876f 100644
--- a/include/svx/ShapeTypeHandler.hxx
+++ b/include/svx/ShapeTypeHandler.hxx
@@ -24,6 +24,7 @@
 
 #include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
+#include <tools/long.hxx>
 #include <unordered_map>
 #include <vector>
 
@@ -178,7 +179,7 @@ private:
              Returns the slot id of the shape with the given service name or
              0 when the service name is not known.
      */
-    SVX_DLLPRIVATE long GetSlotId (const OUString& aServiceName) const;
+    SVX_DLLPRIVATE tools::Long GetSlotId (const OUString& aServiceName) const;
 
     /**  Determine the slot id of the specified shape type.  With this id
          internal methods can access the associated type descriptor.
@@ -188,7 +189,7 @@ private:
              Returns the slot id of the shape with the given service name or
              0 when the service name is not known.
      */
-    SVX_DLLPRIVATE long GetSlotId (const css::uno::Reference<
+    SVX_DLLPRIVATE tools::Long GetSlotId (const css::uno::Reference<
         css::drawing::XShape>& rxShape) const;
 };
 
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index 4b47a785b860..25341d5f8e8c 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -129,10 +129,10 @@ protected:
 
     rtl::Reference<svx::SvxShowCharSetAcc> m_xAccessible;
     uno::Reference< uno::XComponentContext > mxContext;
-    long            nX;
-    long            nY;
-    long            m_nXGap;
-    long            m_nYGap;
+    tools::Long            nX;
+    tools::Long            nY;
+    tools::Long            m_nXGap;
+    tools::Long            m_nYGap;
     bool            bDrag;
 
     sal_Int32       nSelectedIndex;
diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx
index 29c255506c89..3c5435bb9787 100644
--- a/include/svx/dialcontrol.hxx
+++ b/include/svx/dialcontrol.hxx
@@ -54,8 +54,8 @@ private:
     tools::Rectangle    maRect;
     bool                mbEnabled;
     OutputDevice&       mrParent;
-    long                mnCenterX;
-    long                mnCenterY;
+    tools::Long                mnCenterX;
+    tools::Long                mnCenterY;
 };
 
 /** This control allows to input a rotation angle, visualized by a dial.
@@ -141,8 +141,8 @@ private:
         sal_Int32           mnAngle;
         sal_Int32           mnInitialAngle;
         sal_Int32           mnOldAngle;
-        long                mnCenterX;
-        long                mnCenterY;
+        tools::Long                mnCenterX;
+        tools::Long                mnCenterY;
         bool                mbNoRot;
 
         explicit            DialControl_Impl(OutputDevice& rReference);
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 3fd0dc2f8b9e..1aefcd2fff32 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -194,16 +194,16 @@ public:
     virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
     a11yrelationset get_accessible_relation_set() const { return GetDrawingArea()->get_accessible_relation_set(); }
 
-    static long GetSquares() { return nSquares ; }
-    long GetWidth() const { return aRectSize.getWidth() ; }
-    long GetHeight() const { return aRectSize.getHeight() ; }
+    static tools::Long GetSquares() { return nSquares ; }
+    tools::Long GetWidth() const { return aRectSize.getWidth() ; }
+    tools::Long GetHeight() const { return aRectSize.getHeight() ; }
 
     //Device Pixel .
-    long ShowPosition( const Point &pt);
+    tools::Long ShowPosition( const Point &pt);
 
-    long PointToIndex(const Point &pt) const;
-    Point IndexToPoint(long nIndex) const ;
-    long GetFocusPosIndex() const ;
+    tools::Long PointToIndex(const Point &pt) const;
+    Point IndexToPoint(tools::Long nIndex) const ;
+    tools::Long GetFocusPosIndex() const ;
     //Keyboard function for key input and focus handling function
     virtual bool        KeyInput( const KeyEvent& rKEvt ) override;
     virtual void        GetFocus() override;
diff --git a/include/svx/fmgridcl.hxx b/include/svx/fmgridcl.hxx
index 2483a4a5f652..c9007b397ccb 100644
--- a/include/svx/fmgridcl.hxx
+++ b/include/svx/fmgridcl.hxx
@@ -149,7 +149,7 @@ protected:
     virtual void Command(const CommandEvent& rEvt) override;
 
     virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
-    virtual long QueryMinimumRowHeight() override;
+    virtual tools::Long QueryMinimumRowHeight() override;
     virtual void RowHeightChanged() override;
     virtual void ColumnResized(sal_uInt16 nId) override;
     virtual void ColumnMoved(sal_uInt16 nId) override;
diff --git a/include/svx/fontwork.hxx b/include/svx/fontwork.hxx
index cca06cc6959b..31d350fa13cc 100644
--- a/include/svx/fontwork.hxx
+++ b/include/svx/fontwork.hxx
@@ -80,10 +80,10 @@ class SAL_WARN_UNUSED SvxFontWorkDialog final : public SfxDockingWindow
     OString         m_sLastAdjustTbxId;
     OString         m_sLastShadowTbxId;
 
-    long            nSaveShadowX;
-    long            nSaveShadowY;
-    long            nSaveShadowAngle;
-    long            nSaveShadowSize;
+    tools::Long            nSaveShadowX;
+    tools::Long            nSaveShadowY;
+    tools::Long            nSaveShadowAngle;
+    tools::Long            nSaveShadowSize;
 
     SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT];
 
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 7c40b336108b..7cdfd90d794b 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -207,22 +207,22 @@ public:
     /** Sets an additional left width for the merged range that contains (nCol,nRow).
         @descr  Useful to handle merged ranges that are not completely part of the array.
         @precond  The merged range must be at the left border of the array. */
-    void                SetAddMergedLeftSize( size_t nCol, size_t nRow, long nAddSize );
+    void                SetAddMergedLeftSize( size_t nCol, size_t nRow, tools::Long nAddSize );
 
     /** Sets an additional right width for the merged range that contains (nCol,nRow).
         @descr  Useful to handle merged ranges that are not completely part of the array.
         @precond  The merged range must be at the right border of the array. */
-    void                SetAddMergedRightSize( size_t nCol, size_t nRow, long nAddSize );
+    void                SetAddMergedRightSize( size_t nCol, size_t nRow, tools::Long nAddSize );
 
     /** Sets an additional top height for the merged range that contains (nCol,nRow).
         @descr  Useful to handle merged ranges that are not completely part of the array.
         @precond  The merged range must be at the top border of the array. */
-    void                SetAddMergedTopSize( size_t nCol, size_t nRow, long nAddSize );
+    void                SetAddMergedTopSize( size_t nCol, size_t nRow, tools::Long nAddSize );
 
     /** Sets an additional bottom height for the merged range that contains (nCol,nRow).
         @descr  Useful to handle merged ranges that are not completely part of the array.
         @precond  The merged range must be at the bottom border of the array. */
-    void                SetAddMergedBottomSize( size_t nCol, size_t nRow, long nAddSize );
+    void                SetAddMergedBottomSize( size_t nCol, size_t nRow, tools::Long nAddSize );
 
     /** Returns true, if the cell (nCol,nRow) is part of a merged range. */
     bool                IsMerged( size_t nCol, size_t nRow ) const;
@@ -250,44 +250,44 @@ public:
     // cell coordinates
 
     /** Sets the X output coordinate of the left column. */
-    void                SetXOffset( long nXOffset );
+    void                SetXOffset( tools::Long nXOffset );
 
     /** Sets the Y output coordinate of the top row. */
-    void                SetYOffset( long nYOffset );
+    void                SetYOffset( tools::Long nYOffset );
 
     /** Sets the output width of the specified column. */
-    void                SetColWidth( size_t nCol, long nWidth );
+    void                SetColWidth( size_t nCol, tools::Long nWidth );
 
     /** Sets the output height of the specified row. */
-    void                SetRowHeight( size_t nRow, long nHeight );
+    void                SetRowHeight( size_t nRow, tools::Long nHeight );
 
     /** Sets the same output width for all columns. */
-    void                SetAllColWidths( long nWidth );
+    void                SetAllColWidths( tools::Long nWidth );
 
     /** Sets the same output height for all rows. */
-    void                SetAllRowHeights( long nHeight );
+    void                SetAllRowHeights( tools::Long nHeight );
 
     /** Returns the X output coordinate of the left border of the specified column.
         @descr  The column index <array-width> returns the X output coordinate
                 of the right array border. */
-    long                GetColPosition( size_t nCol ) const;
+    tools::Long                GetColPosition( size_t nCol ) const;
 
     /** Returns the Y output coordinate of the top border of the specified row.
         @descr  The row index <array-height> returns the Y output coordinate
                 of the bottom array border. */
-    long                GetRowPosition( size_t nRow ) const;
+    tools::Long                GetRowPosition( size_t nRow ) const;
 
     /** Returns the output width of the specified range of columns. */
-    long                GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
+    tools::Long                GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
 
     /** Returns the output height of the specified range of rows. */
-    long                GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
+    tools::Long                GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
 
     /** Returns the output width of the entire array. */
-    long                GetWidth() const;
+    tools::Long                GetWidth() const;
 
     /** Returns the output height of the entire array. */
-    long                GetHeight() const;
+    tools::Long                GetHeight() const;
 
     /** Returns the output range of the cell (nCol,nRow).
         Returns total output range of merged ranges, if bExpandMerged is true. */
diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx
index f9a6195258eb..5c07aa370d8c 100644
--- a/include/svx/frmsel.hxx
+++ b/include/svx/frmsel.hxx
@@ -121,7 +121,7 @@ public:
     /** Returns true, if all visible frame borders have equal widths.
         @descr  Ignores hidden and "don't care" frame borders. On success,
         returns the width in the passed parameter. */
-    bool                GetVisibleWidth( long& rnWidth, SvxBorderLineStyle& rnStyle ) const;
+    bool                GetVisibleWidth( tools::Long& rnWidth, SvxBorderLineStyle& rnStyle ) const;
     /** Returns true, if all visible frame borders have equal color.
         @descr  Ignores hidden and "don't care" frame borders. On success,
         returns the color in the passed parameter. */
@@ -149,7 +149,7 @@ public:
     void                SelectAllVisibleBorders();
 
     /** Sets the passed line widths to all selected frame borders (in twips). */
-    void                SetStyleToSelection( long nWidth, SvxBorderLineStyle nStyle );
+    void                SetStyleToSelection( tools::Long nWidth, SvxBorderLineStyle nStyle );
     /** Sets the passed color to all selected frame borders. */
     void                SetColorToSelection( const Color& rColor );
 
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index dfcf5cb151af..f2fa49b7759c 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -295,7 +295,7 @@ private:
                                             // (with respect to the data source capabilities)
                                             // defaults to (insert | update | delete)
     sal_uInt16          m_nLastColId;
-    long                m_nLastRowId;
+    tools::Long                m_nLastRowId;
 
     bool                m_bDesignMode : 1;      // default = sal_False
     bool                m_bRecordCountFinal : 1;
@@ -312,14 +312,14 @@ protected:
     bool                m_bUpdating : 1;            // are any updates being executed right now?
 
 protected:
-    virtual bool SeekRow(long nRow) override;
-    virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows) override;
+    virtual bool SeekRow(tools::Long nRow) override;
+    virtual void VisibleRowsChanged( tools::Long nNewTopRow, sal_uInt16 nNumRows) override;
     virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId) const override;
-    virtual RowStatus GetRowStatus(long nRow) const override;
-    virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) override;
+    virtual RowStatus GetRowStatus(tools::Long nRow) const override;
+    virtual bool CursorMoving(tools::Long nNewRow, sal_uInt16 nNewCol) override;
     virtual void CursorMoved() override;
     virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY) override;
-    virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
+    virtual sal_uInt32 GetTotalCellWidth(tools::Long nRow, sal_uInt16 nColId) override;
     virtual void Command(const CommandEvent& rEvt) override;
     virtual bool PreNotify(NotifyEvent& rEvt) override;
     virtual void KeyInput(const KeyEvent& rEvt) override;
@@ -327,7 +327,7 @@ protected:
     virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
     virtual void Select() override;
 
-    virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) override;
+    virtual ::svt::CellController* GetController(tools::Long nRow, sal_uInt16 nCol) override;
 
     virtual void CellModified() override;
     virtual bool SaveModified() override;
@@ -374,7 +374,7 @@ protected:
     // DragSourceHelper overridables
     virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
 
-    void    executeRowContextMenu( long _nRow, const Point& _rPreferredPos );
+    void    executeRowContextMenu( tools::Long _nRow, const Point& _rPreferredPos );
 
 public:
     DbGridControl(
@@ -397,7 +397,7 @@ public:
         @return
             the text out of the cell
     */
-    virtual OUString  GetCellText(long _nRow, sal_uInt16 _nColId) const override;
+    virtual OUString  GetCellText(tools::Long _nRow, sal_uInt16 _nColId) const override;
 
     void RemoveRows(bool bNewCursor);
 
@@ -437,7 +437,7 @@ public:
 
     void SetFilterMode(bool bMode);
     bool IsFilterMode() const {return m_bFilterMode;}
-    bool IsFilterRow(long nRow) const {return m_bFilterMode && nRow == 0;}
+    bool IsFilterRow(tools::Long nRow) const {return m_bFilterMode && nRow == 0;}
 
     void EnableNavigationBar(bool bEnable);
     bool HasNavigationBar() const {return m_bNavigationBar;}
@@ -472,9 +472,9 @@ public:
     // is the current line being updated
     bool IsUpdating() const {return m_bUpdating;}
 
-    void RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true );
-    void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true );
-    void RowModified( long nRow );
+    void RowRemoved( tools::Long nRow, tools::Long nNumRows = 1, bool bDoPaint = true );
+    void RowInserted( tools::Long nRow, tools::Long nNumRows = 1, bool bDoPaint = true );
+    void RowModified( tools::Long nRow );
 
     void resetCurrentRow();
 
@@ -560,12 +560,12 @@ public:
     CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
 
 protected:
-    void RecalcRows(long nNewTopRow, sal_uInt16 nLinesOnScreen, bool bUpdateCursor);
-    bool SeekCursor(long nRow, bool bAbsolute = false);
+    void RecalcRows(tools::Long nNewTopRow, sal_uInt16 nLinesOnScreen, bool bUpdateCursor);
+    bool SeekCursor(tools::Long nRow, bool bAbsolute = false);
     void RemoveColumns();       // cleaning of own structures
     void AdjustRows();
     sal_Int32 AlignSeekCursor();
-    bool SetCurrent(long nNewRow);
+    bool SetCurrent(tools::Long nNewRow);
 
     OUString GetCurrentRowCellText(DbGridColumn const * pCol,const DbGridRowRef& _rRow) const;
     virtual void DeleteSelectedRows();
@@ -575,7 +575,7 @@ protected:
     bool IsCurrentAppending() const;
 
     // empty row for insertion
-    bool IsInsertionRow(long nRow) const;
+    bool IsInsertionRow(tools::Long nRow) const;
 
     void  SetSeekPos(sal_Int32 nPos) {m_nSeekPos = nPos;}
     sal_Int32 GetCurrentPos() const {return m_nCurrentPos;}
diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
index eceb96b8337e..8b89c82549b4 100644
--- a/include/svx/nbdtmg.hxx
+++ b/include/svx/nbdtmg.hxx
@@ -41,10 +41,10 @@ class  SVX_DLLPUBLIC NumSettings_Impl
         SvxNumType      nNumberType;
         short           nParentNumbering;
         SvxNumberFormat::LabelFollowedBy eLabelFollowedBy;
-        long            nTabValue;
+        tools::Long            nTabValue;
         SvxAdjust       eNumAlign;
-        long            nNumAlignAt;
-        long            nNumIndentAt;
+        tools::Long            nNumAlignAt;
+        tools::Long            nNumIndentAt;
         OUString   sPrefix;
         OUString   sSuffix;
         OUString   sBulletChar;
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index c986cd68d0ab..5a51cc34c603 100644
--- a/include/svx/obj3d.hxx
+++ b/include/svx/obj3d.hxx
@@ -116,7 +116,7 @@ public:
     // which is vertical to the screen, plus a shift of the scene.
     // This means that also the scene (E3dScene) must define this
     // routine as virtual in its class.
-    virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs) override;
+    virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override;
 
     // get wireframe polygon for local object. No transform is applied.
     basegfx::B3DPolyPolygon CreateWireframe() const;
diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx
index b5abe5c6aec6..07186afdd838 100644
--- a/include/svx/pagectrl.hxx
+++ b/include/svx/pagectrl.hxx
@@ -32,24 +32,24 @@ private:
     Size aWinSize;
     Size aSize;
 
-    long nTop;
-    long nBottom;
-    long nLeft;
-    long nRight;
+    tools::Long nTop;
+    tools::Long nBottom;
+    tools::Long nLeft;
+    tools::Long nRight;
 
     bool bResetBackground;
     bool bFrameDirection;
     SvxFrameDirection nFrameDirection;
 
-    long nHdLeft;
-    long nHdRight;
-    long nHdDist;
-    long nHdHeight;
+    tools::Long nHdLeft;
+    tools::Long nHdRight;
+    tools::Long nHdDist;
+    tools::Long nHdHeight;
 
-    long nFtLeft;
-    long nFtRight;
-    long nFtDist;
-    long nFtHeight;
+    tools::Long nFtLeft;
+    tools::Long nFtRight;
+    tools::Long nFtDist;
+    tools::Long nFtHeight;
 
     drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maHeaderFillAttributes;
     drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maFooterFillAttributes;
@@ -103,35 +103,35 @@ public:
         return aSize;
     }
 
-    void SetTop(long nNew) { nTop = nNew; }
-    void SetBottom(long nNew) { nBottom = nNew; }
-    void SetLeft(long nNew) { nLeft = nNew; }
-    void SetRight(long nNew) { nRight = nNew; }
-
-    long GetTop() const { return nTop; }
-    long GetBottom() const { return nBottom; }
-    long GetLeft() const { return nLeft; }
-    long GetRight() const { return nRight; }
-
-    void SetHdLeft(long nNew) { nHdLeft = nNew; }
-    void SetHdRight(long nNew) { nHdRight = nNew; }
-    void SetHdDist(long nNew) { nHdDist = nNew; }
-    void SetHdHeight(long nNew) { nHdHeight = nNew; }
-
-    long GetHdLeft() const { return nHdLeft; }
-    long GetHdRight() const { return nHdRight; }
-    long GetHdDist() const { return nHdDist; }
-    long GetHdHeight() const { return nHdHeight; }
-
-    void SetFtLeft(long nNew) { nFtLeft = nNew; }
-    void SetFtRight(long nNew) { nFtRight = nNew; }
-    void SetFtDist(long nNew) { nFtDist = nNew; }
-    void SetFtHeight(long nNew) { nFtHeight = nNew; }
-
-    long GetFtLeft() const { return nFtLeft; }
-    long GetFtRight() const { return nFtRight; }
-    long GetFtDist() const { return nFtDist; }
-    long GetFtHeight() const { return nFtHeight; }
+    void SetTop(tools::Long nNew) { nTop = nNew; }
+    void SetBottom(tools::Long nNew) { nBottom = nNew; }
+    void SetLeft(tools::Long nNew) { nLeft = nNew; }
+    void SetRight(tools::Long nNew) { nRight = nNew; }
+
+    tools::Long GetTop() const { return nTop; }
+    tools::Long GetBottom() const { return nBottom; }
+    tools::Long GetLeft() const { return nLeft; }
+    tools::Long GetRight() const { return nRight; }
+
+    void SetHdLeft(tools::Long nNew) { nHdLeft = nNew; }
+    void SetHdRight(tools::Long nNew) { nHdRight = nNew; }
+    void SetHdDist(tools::Long nNew) { nHdDist = nNew; }
+    void SetHdHeight(tools::Long nNew) { nHdHeight = nNew; }
+
+    tools::Long GetHdLeft() const { return nHdLeft; }
+    tools::Long GetHdRight() const { return nHdRight; }
+    tools::Long GetHdDist() const { return nHdDist; }
+    tools::Long GetHdHeight() const { return nHdHeight; }
+
+    void SetFtLeft(tools::Long nNew) { nFtLeft = nNew; }
+    void SetFtRight(tools::Long nNew) { nFtRight = nNew; }
+    void SetFtDist(tools::Long nNew) { nFtDist = nNew; }
+    void SetFtHeight(tools::Long nNew) { nFtHeight = nNew; }
+
+    tools::Long GetFtLeft() const { return nFtLeft; }
+    tools::Long GetFtRight() const { return nFtRight; }
+    tools::Long GetFtDist() const { return nFtDist; }
+    tools::Long GetFtHeight() const { return nFtHeight; }
 
     void SetUsage(SvxPageUsage eU) { eUsage = eU; }
     SvxPageUsage GetUsage() const { return eUsage; }
diff --git a/include/svx/paraprev.hxx b/include/svx/paraprev.hxx
index 8eb4001a75d7..bb6607318dc6 100644
--- a/include/svx/paraprev.hxx
+++ b/include/svx/paraprev.hxx
@@ -39,8 +39,8 @@ class SVX_DLLPUBLIC SvxParaPrevWindow final : public weld::CustomWidgetControlle
     Size                aSize;
 
     // indentation
-    long                nLeftMargin;
-    long                nRightMargin;
+    tools::Long                nLeftMargin;
+    tools::Long                nRightMargin;
     short               nFirstLineOffset;
     // distances
     sal_uInt16          nUpper;
@@ -63,11 +63,11 @@ public:
     {
         nFirstLineOffset = nNew;
     }
-    void SetLeftMargin( long nNew )
+    void SetLeftMargin( tools::Long nNew )
     {
         nLeftMargin = nNew;
     }
-    void SetRightMargin( long nNew )
+    void SetRightMargin( tools::Long nNew )
     {
         nRightMargin = nNew;
     }
diff --git a/include/svx/pszctrl.hxx b/include/svx/pszctrl.hxx
index b63950292daf..0961f3b5b867 100644
--- a/include/svx/pszctrl.hxx
+++ b/include/svx/pszctrl.hxx
@@ -29,7 +29,7 @@ class SVX_DLLPUBLIC SvxPosSizeStatusBarControl final : public SfxStatusBarContro
 {
 private:
     std::unique_ptr<SvxPosSizeStatusBarControl_Impl>    pImpl;
-    SVX_DLLPRIVATE OUString       GetMetricStr_Impl( long nVal );
+    SVX_DLLPRIVATE OUString       GetMetricStr_Impl( tools::Long nVal );
 public:
     SFX_DECL_STATUSBAR_CONTROL();
 
diff --git a/include/svx/rubydialog.hxx b/include/svx/rubydialog.hxx
index 1df1f51ae5ff..5bdd4c9e66d7 100644
--- a/include/svx/rubydialog.hxx
+++ b/include/svx/rubydialog.hxx
@@ -57,8 +57,8 @@ class SvxRubyDialog : public SfxModelessDialogController
     friend class RubyPreview;
 
 
-    long                nLastPos;
-    long                nCurrentEdit;
+    tools::Long                nLastPos;
+    tools::Long                nCurrentEdit;
     bool                bModified;
     SfxBindings*        pBindings;
     rtl::Reference<SvxRubyData_Impl> m_pImpl;
@@ -117,8 +117,8 @@ class SvxRubyDialog : public SfxModelessDialogController
     void                Update();
     virtual void        Close() override;
 
-    long                GetLastPos() const {return nLastPos;}
-    void                SetLastPos(long nSet) {nLastPos = nSet;}
+    tools::Long                GetLastPos() const {return nLastPos;}
+    void                SetLastPos(tools::Long nSet) {nLastPos = nSet;}
 
     bool                IsModified() const {return bModified;}
     void                SetModified(bool bSet) {bModified = bSet;}
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index d0dd4e68228e..c0b587cdc583 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -101,16 +101,16 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
 
     bool            bAppSetNullOffset :1;
     bool            bHorz :1;
-    long            lLogicNullOffset;     // in logic coordinates
-    long            lAppNullOffset;       // in logic coordinates
-    long            lInitialDragPos;
+    tools::Long            lLogicNullOffset;     // in logic coordinates
+    tools::Long            lAppNullOffset;       // in logic coordinates
+    tools::Long            lInitialDragPos;
     SvxRulerSupportFlags nFlags;
     SvxRulerDragFlags    nDragType;
     sal_uInt16      nDefTabType;
     sal_uInt16      nTabCount;
     sal_uInt16      nTabBufSize;
-    long            lDefTabDist;
-    long            lTabPos;
+    tools::Long            lDefTabDist;
+    tools::Long            lTabPos;
 
     std::vector<RulerTab>    mpTabs;    // tab positions in pixel
     std::vector<RulerIndent> mpIndents; // paragraph margins in pixel
@@ -118,9 +118,9 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
     std::vector<RulerBorder> mpObjectBorders;
 
     SfxBindings*    pBindings;
-    long            nDragOffset;
-    long            nMaxLeft;
-    long            nMaxRight;
+    tools::Long            nDragOffset;
+    tools::Long            nMaxLeft;
+    tools::Long            nMaxRight;
     bool            bValid;
     bool            bListening;
     bool            bActive;
@@ -129,8 +129,8 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
     bool mbSnapping;
 
     void StartListening_Impl();
-    long GetCorrectedDragPos(bool bLeft = true, bool bRight = true );
-    void DrawLine_Impl(long &lTabPos, int, bool Horizontal);
+    tools::Long GetCorrectedDragPos(bool bLeft = true, bool bRight = true );
+    void DrawLine_Impl(tools::Long &lTabPos, int, bool Horizontal);
     sal_uInt16 GetObjectBordersOff(sal_uInt16 nIdx) const;
 
     // page borders or surrounding frame
@@ -162,44 +162,44 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
     void UpdateObject();
 
     // Convert position to stick to ruler ticks
-    long MakePositionSticky(long rValue, long aPointOfReference, bool aSnapToFrameMargin = true) const;
+    tools::Long MakePositionSticky(tools::Long rValue, tools::Long aPointOfReference, bool aSnapToFrameMargin = true) const;
 
-    long PixelHAdjust(long lPos, long lPos2) const;
-    long PixelVAdjust(long lPos, long lPos2) const;
-    long PixelAdjust(long lPos, long lPos2) const;
+    tools::Long PixelHAdjust(tools::Long lPos, tools::Long lPos2) const;
+    tools::Long PixelVAdjust(tools::Long lPos, tools::Long lPos2) const;
+    tools::Long PixelAdjust(tools::Long lPos, tools::Long lPos2) const;
 
-    long ConvertHPosPixel(long lPos) const;
-    long ConvertVPosPixel(long lPos) const;
-    long ConvertHSizePixel(long lSize) const;
-    long ConvertVSizePixel(long lSize) const;
+    tools::Long ConvertHPosPixel(tools::Long lPos) const;
+    tools::Long ConvertVPosPixel(tools::Long lPos) const;
+    tools::Long ConvertHSizePixel(tools::Long lSize) const;
+    tools::Long ConvertVSizePixel(tools::Long lSize) const;
 
-    long ConvertPosPixel(long lPos) const;
-    long ConvertSizePixel(long lSize) const;
+    tools::Long ConvertPosPixel(tools::Long lPos) const;
+    tools::Long ConvertSizePixel(tools::Long lSize) const;
 
-    long ConvertHPosLogic(long lPos) const;
-    long ConvertVPosLogic(long lPos) const;
-    long ConvertHSizeLogic(long lSize) const;
-    long ConvertVSizeLogic(long lSize) const;
+    tools::Long ConvertHPosLogic(tools::Long lPos) const;
+    tools::Long ConvertVPosLogic(tools::Long lPos) const;
+    tools::Long ConvertHSizeLogic(tools::Long lSize) const;
+    tools::Long ConvertVSizeLogic(tools::Long lSize) const;
 
-    long ConvertPosLogic(long lPos) const;
-    long ConvertSizeLogic(long lSize) const;
+    tools::Long ConvertPosLogic(tools::Long lPos) const;
+    tools::Long ConvertSizeLogic(tools::Long lSize) const;
 
-    long RoundToCurrentMapMode(long lValue) const;
+    tools::Long RoundToCurrentMapMode(tools::Long lValue) const;
 
-    long GetFirstLineIndent() const;
-    long GetLeftIndent() const;
-    long GetRightIndent() const;
-    long GetLogicRightIndent() const;
+    tools::Long GetFirstLineIndent() const;
+    tools::Long GetLeftIndent() const;
+    tools::Long GetRightIndent() const;
+    tools::Long GetLogicRightIndent() const;
 
-    long GetLeftFrameMargin() const;
-    long GetRightFrameMargin() const;
+    tools::Long GetLeftFrameMargin() const;
+    tools::Long GetRightFrameMargin() const;
 
     void CalcMinMax();
 
     void EvalModifier();
     void DragMargin1();
     //adjust the left margin either after DragMargin1() or after DragBorders()
-    void AdjustMargin1(long lDiff);
+    void AdjustMargin1(tools::Long lDiff);
     void DragMargin2();
     void DragIndents();
     void DragTabs();
@@ -212,10 +212,10 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
     void ApplyBorders();
     void ApplyObject();
 
-    long GetFrameLeft() const;
+    tools::Long GetFrameLeft() const;
 
-    long GetLeftMin() const;
-    long GetRightMax() const;
+    tools::Long GetLeftMin() const;
+    tools::Long GetRightMax() const;
 
     DECL_LINK( TabMenuSelect, Menu *, bool );
     DECL_LINK( MenuSelect, Menu *, bool );
@@ -226,7 +226,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
         MoveLeft,
         MoveRight
     };
-    void UpdateParaContents_Impl(long lDiff, UpdateType);
+    void UpdateParaContents_Impl(tools::Long lDiff, UpdateType);
 
 protected:
     virtual void    Command( const CommandEvent& rCEvt ) override;
@@ -253,7 +253,7 @@ protected:
     sal_uInt16 GetActRightColumn (
                 bool bForceDontConsiderHidden = false,
                 sal_uInt16 nAct=USHRT_MAX ) const;
-    long CalcPropMaxRight(sal_uInt16 nCol = USHRT_MAX) const;
+    tools::Long CalcPropMaxRight(sal_uInt16 nCol = USHRT_MAX) const;
 
 public:
 
@@ -262,10 +262,10 @@ public:
     virtual ~SvxRuler() override;
     virtual void dispose() override;
 
-    void SetDefTabDist(long);
+    void SetDefTabDist(tools::Long);
 
     // set/get NullOffset in logic units
-    void SetNullOffsetLogic(long lOff);
+    void SetNullOffsetLogic(tools::Long lOff);
 
     void SetActive(bool bOn = true);
 
@@ -276,8 +276,8 @@ public:
 
     //#i24363# tab stops relative to indent
     void SetTabsRelativeToIndent( bool bRel );
-    void SetValues(RulerChangeType type, long value);
-    long GetPageWidth() const;
+    void SetValues(RulerChangeType type, tools::Long value);
+    tools::Long GetPageWidth() const;
 };
 
 #endif
diff --git a/include/svx/rulritem.hxx b/include/svx/rulritem.hxx
index 2f0df198f099..4f5d78083809 100644
--- a/include/svx/rulritem.hxx
+++ b/include/svx/rulritem.hxx
@@ -26,8 +26,8 @@
 
 class SVX_DLLPUBLIC SvxLongLRSpaceItem final : public SfxPoolItem
 {
-    long    mlLeft;         // nLeft or the negative first-line indentation
-    long    mlRight;        // the unproblematic right edge
+    tools::Long    mlLeft;         // nLeft or the negative first-line indentation
+    tools::Long    mlRight;        // the unproblematic right edge
 
     virtual bool             operator==( const SfxPoolItem& ) const override;
     virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
@@ -44,19 +44,19 @@ class SVX_DLLPUBLIC SvxLongLRSpaceItem final : public SfxPoolItem
 
 public:
     static SfxPoolItem* CreateDefault();
-    SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId);
+    SvxLongLRSpaceItem(tools::Long lLeft, tools::Long lRight, sal_uInt16 nId);
     SvxLongLRSpaceItem();
 
-    long GetLeft() const { return mlLeft;}
-    long GetRight() const { return mlRight;}
-    void SetLeft(long lArgLeft);
-    void SetRight(long lArgRight);
+    tools::Long GetLeft() const { return mlLeft;}
+    tools::Long GetRight() const { return mlRight;}
+    void SetLeft(tools::Long lArgLeft);
+    void SetRight(tools::Long lArgRight);
 };
 
 class SVX_DLLPUBLIC SvxLongULSpaceItem final : public SfxPoolItem
 {
-    long    mlLeft;         // nLeft or the negative first-line indentation
-    long    mlRight;        // the unproblematic right edge
+    tools::Long    mlLeft;         // nLeft or the negative first-line indentation
+    tools::Long    mlRight;        // the unproblematic right edge
 
     virtual bool             operator==( const SfxPoolItem& ) const override;
     virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
@@ -73,20 +73,20 @@ class SVX_DLLPUBLIC SvxLongULSpaceItem final : public SfxPoolItem
 
 public:
     static SfxPoolItem* CreateDefault();
-    SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId);
+    SvxLongULSpaceItem(tools::Long lUpper, tools::Long lLower, sal_uInt16 nId);
     SvxLongULSpaceItem();
 
-    long GetUpper() const { return mlLeft;}
-    long GetLower() const { return mlRight;}
-    void SetUpper(long lArgLeft);
-    void SetLower(long lArgRight);
+    tools::Long GetUpper() const { return mlLeft;}
+    tools::Long GetLower() const { return mlRight;}
+    void SetUpper(tools::Long lArgLeft);
+    void SetLower(tools::Long lArgRight);
 };
 
 class SVX_DLLPUBLIC SvxPagePosSizeItem final : public SfxPoolItem
 {
     Point aPos;
-    long lWidth;
-    long lHeight;
+    tools::Long lWidth;
+    tools::Long lHeight;
 
     virtual bool             operator==( const SfxPoolItem& ) const override;
     virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
@@ -103,31 +103,31 @@ private:
     const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &) = delete;
 public:
     static SfxPoolItem* CreateDefault();
-    SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight);
+    SvxPagePosSizeItem(const Point &rPos, tools::Long lWidth, tools::Long lHeight);
     SvxPagePosSizeItem();
 
     const Point &GetPos() const { return aPos; }
-    long    GetWidth() const { return lWidth; }
-    long    GetHeight() const { return lHeight; }
+    tools::Long    GetWidth() const { return lWidth; }
+    tools::Long    GetHeight() const { return lHeight; }
 };
 
 struct SVX_DLLPUBLIC SvxColumnDescription
 {
-    long     nStart;    /* Start of the column */
-    long     nEnd;      /* End of the column */
+    tools::Long     nStart;    /* Start of the column */
+    tools::Long     nEnd;      /* End of the column */
     bool     bVisible;  /* Visibility */
 
-    long nEndMin; //min. possible position of end
-    long nEndMax; //max. possible position of end
+    tools::Long nEndMin; //min. possible position of end
+    tools::Long nEndMax; //max. possible position of end
 
-    SvxColumnDescription(long start, long end, bool bVis);
+    SvxColumnDescription(tools::Long start, tools::Long end, bool bVis);
 
-    SvxColumnDescription(long start, long end,
-                         long endMin, long endMax, bool bVis);
+    SvxColumnDescription(tools::Long start, tools::Long end,
+                         tools::Long endMin, tools::Long endMax, bool bVis);
 
     bool operator==(const SvxColumnDescription &rCmp) const;
     bool operator!=(const SvxColumnDescription &rCmp) const;
-    long GetWidth() const;
+    tools::Long GetWidth() const;
 };
 
 template<typename charT, typename traits>
@@ -144,8 +144,8 @@ class SVX_DLLPUBLIC SvxColumnItem final : public SfxPoolItem
 {
     std::vector<SvxColumnDescription>  aColumns; // Column array
 
-    long nLeft;             // Left edge for the table
-    long nRight;            // Right edge for the table; for columns always
+    tools::Long nLeft;             // Left edge for the table
+    tools::Long nRight;            // Right edge for the table; for columns always
                             // equal to the surrounding frame
     sal_uInt16 nActColumn;  // the current column
     bool       bTable;      // table?
@@ -177,13 +177,13 @@ public:
 
     sal_uInt16  Count() const;
     void        Append(const SvxColumnDescription& rDesc);
-    void        SetLeft(long aLeft);
-    void        SetRight(long aRight);
+    void        SetLeft(tools::Long aLeft);
+    void        SetRight(tools::Long aRight);
     sal_uInt16  GetActColumn() const { return nActColumn;}
     bool        IsFirstAct() const;
     bool        IsLastAct() const;
-    long        GetLeft() const { return nLeft;}
-    long        GetRight() const { return nRight;}
+    tools::Long        GetLeft() const { return nLeft;}
+    tools::Long        GetRight() const { return nRight;}
     bool        IsTable() const { return bTable;}
     bool        CalcOrtho() const;
     void        SetOrtho(bool bVal);
@@ -192,10 +192,10 @@ public:
 
 class SVX_DLLPUBLIC SvxObjectItem final : public SfxPoolItem
 {
-    long nStartX;   /* Start in x direction */
-    long nEndX;     /* End in x direction */
-    long nStartY;   /* Start in y direction */
-    long nEndY;     /* End in y direction */
+    tools::Long nStartX;   /* Start in x direction */
+    tools::Long nEndX;     /* End in x direction */
+    tools::Long nStartY;   /* Start in y direction */
+    tools::Long nEndY;     /* End in y direction */
     bool bLimits;   /* boundary limit control by the application */
 
     virtual bool             operator==( const SfxPoolItem& ) const override;
@@ -213,18 +213,18 @@ class SVX_DLLPUBLIC SvxObjectItem final : public SfxPoolItem
 
 public:
     static SfxPoolItem* CreateDefault();
-    SvxObjectItem(long nStartX, long nEndX,
-                  long nStartY, long nEndY);
-
-    long GetStartX() const { return nStartX;}
-    long GetEndX() const { return nEndX;}
-    long GetStartY() const { return nStartY;}
-    long GetEndY() const { return nEndY;}
-
-    void SetStartX(long lValue);
-    void SetEndX(long lValue);
-    void SetStartY(long lValue);
-    void SetEndY(long lValue);
+    SvxObjectItem(tools::Long nStartX, tools::Long nEndX,
+                  tools::Long nStartY, tools::Long nEndY);
+
+    tools::Long GetStartX() const { return nStartX;}
+    tools::Long GetEndX() const { return nEndX;}
+    tools::Long GetStartY() const { return nStartY;}
+    tools::Long GetEndY() const { return nEndY;}
+
+    void SetStartX(tools::Long lValue);
+    void SetEndX(tools::Long lValue);
+    void SetStartY(tools::Long lValue);
+    void SetEndY(tools::Long lValue);
 };
 
 #endif
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index 837c2da43a39..e3fb1b5c779c 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -137,7 +137,7 @@ public:
     virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) override;
     virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix) override;
 
-    virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs) override;
+    virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override;
     void RotateScene(const Point& rRef, double sn, double cs);
 
     // TakeObjName...() is for the display in the UI, for example "3 frames selected".
diff --git a/include/svx/sderitm.hxx b/include/svx/sderitm.hxx
index ad03621c50fb..9a41860f5c83 100644
--- a/include/svx/sderitm.hxx
+++ b/include/svx/sderitm.hxx
@@ -22,7 +22,7 @@
 #include <svx/sdmetitm.hxx>
 #include <svx/svddef.hxx>
 
-inline SdrMetricItem makeSdrEckenradiusItem(long nRadius) {
+inline SdrMetricItem makeSdrEckenradiusItem(tools::Long nRadius) {
     return SdrMetricItem(SDRATTR_ECKENRADIUS, nRadius);
 }
 
diff --git a/include/svx/sdmetitm.hxx b/include/svx/sdmetitm.hxx
index 8abecbad394c..0e7e3a7897b4 100644
--- a/include/svx/sdmetitm.hxx
+++ b/include/svx/sdmetitm.hxx
@@ -32,7 +32,7 @@ public:
     SdrMetricItem(sal_uInt16 nId, sal_Int32 nVal):  SfxInt32Item(nId,nVal) {}
     virtual SdrMetricItem* Clone(SfxItemPool* pPool=nullptr) const override;
     virtual bool HasMetrics() const override;
-    virtual void ScaleMetrics(long nMul, long nDiv) override;
+    virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
 
     virtual bool GetPresentation(SfxItemPresentation ePres,
                                  MapUnit eCoreMetric,
diff --git a/include/svx/sdsxyitm.hxx b/include/svx/sdsxyitm.hxx
index e2686a5689a9..ac270699d22d 100644
--- a/include/svx/sdsxyitm.hxx
+++ b/include/svx/sdsxyitm.hxx
@@ -22,11 +22,11 @@
 #include <svx/sdmetitm.hxx>
 #include <svx/svddef.hxx>
 
-inline SdrMetricItem makeSdrShadowXDistItem(long nDist) {
+inline SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist) {
     return SdrMetricItem(SDRATTR_SHADOWXDIST, nDist);
 }
 
-inline SdrMetricItem makeSdrShadowYDistItem(long nDist) {
+inline SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist) {
     return SdrMetricItem(SDRATTR_SHADOWYDIST, nDist);
 }
 
diff --git a/include/svx/sdtaaitm.hxx b/include/svx/sdtaaitm.hxx
index 71764b2962a3..1a4a51c0e07f 100644
--- a/include/svx/sdtaaitm.hxx
+++ b/include/svx/sdtaaitm.hxx
@@ -28,7 +28,7 @@ public:
     SdrTextAniAmountItem(sal_Int16 nVal=0): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT,nVal) {}
     virtual SdrTextAniAmountItem* Clone(SfxItemPool* pPool=nullptr) const override;
     virtual bool HasMetrics() const override;
-    virtual void ScaleMetrics(long nMul, long nDiv) override;
+    virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override;
 
     virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override;
 };
diff --git a/include/svx/sdtditm.hxx b/include/svx/sdtditm.hxx
index 9e363c7627e6..d9b1d3ab3e9b 100644
--- a/include/svx/sdtditm.hxx
+++ b/include/svx/sdtditm.hxx
@@ -22,19 +22,19 @@
 #include <svx/sdmetitm.hxx>
 #include <svx/svddef.hxx>
 
-inline SdrMetricItem makeSdrTextLeftDistItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_LEFTDIST, mnHeight);
 }
 
-inline SdrMetricItem makeSdrTextRightDistItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_RIGHTDIST, mnHeight);
 }
 
-inline SdrMetricItem makeSdrTextUpperDistItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_UPPERDIST, mnHeight);
 }
 
-inline SdrMetricItem makeSdrTextLowerDistItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_LOWERDIST, mnHeight);
 }
 
diff --git a/include/svx/sdtmfitm.hxx b/include/svx/sdtmfitm.hxx
index 838d938c3336..25890361accf 100644
--- a/include/svx/sdtmfitm.hxx
+++ b/include/svx/sdtmfitm.hxx
@@ -22,19 +22,19 @@
 #include <svx/sdmetitm.hxx>
 #include <svx/svddef.hxx>
 
-inline SdrMetricItem makeSdrTextMinFrameHeightItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, mnHeight);
 }
 
-inline SdrMetricItem makeSdrTextMaxFrameHeightItem(long mnHeight) {
+inline SdrMetricItem makeSdrTextMaxFrameHeightItem(tools::Long mnHeight) {
     return SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT, mnHeight);
 }
 
-inline SdrMetricItem makeSdrTextMinFrameWidthItem(long mnWidth) {
+inline SdrMetricItem makeSdrTextMinFrameWidthItem(tools::Long mnWidth) {
     return SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, mnWidth);
 };
 
-inline SdrMetricItem makeSdrTextMaxFrameWidthItem(long mnWidth) {
+inline SdrMetricItem makeSdrTextMaxFrameWidthItem(tools::Long mnWidth) {
     return SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH, mnWidth);
 }
 
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index 359b822e16b1..0442510d7537 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -49,7 +49,7 @@ public:
     virtual ~LinePropertyPanelBase() override;
     virtual void dispose() override;
 
-    void SetWidth(long nWidth);
+    void SetWidth(tools::Long nWidth);
     void SetWidthIcon(int n);
     void SetWidthIcon();
 
diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
index c16924d0cec8..718ff68ce24a 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -38,7 +38,7 @@ public:
     LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent);
     ~LineWidthPopup();
 
-    void SetWidthSelect (long lValue, bool bValuable, MapUnit eMapUnit);
+    void SetWidthSelect (tools::Long lValue, bool bValuable, MapUnit eMapUnit);
 
     weld::Container* getTopLevel() const { return m_xTopLevel.get(); }
 
@@ -49,7 +49,7 @@ private:
     MapUnit m_eMapUnit;
     bool m_bVSFocus;
     bool m_bCustom;
-    long m_nCustomWidth;
+    tools::Long m_nCustomWidth;
     Image  m_aIMGCus;
     Image m_aIMGCusGray;
 
diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx
index 0deef29e4f10..80c2406b9046 100644
--- a/include/svx/svddrag.hxx
+++ b/include/svx/svddrag.hxx
@@ -145,8 +145,8 @@ public:
     void         NextPoint();
     void         PrevPoint();
     bool         CheckMinMoved(const Point& rPnt);
-    long         GetDX() const                     { return GetNow().X()-GetPrev().X(); }
-    long         GetDY() const                     { return GetNow().Y()-GetPrev().Y(); }
+    tools::Long         GetDX() const                     { return GetNow().X()-GetPrev().X(); }
+    tools::Long         GetDY() const                     { return GetNow().Y()-GetPrev().Y(); }
     Fraction     GetXFact() const;
     Fraction     GetYFact() const;
 
diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx
index 26e88a7dbcd1..72d8ad3ff154 100644
--- a/include/svx/svddrgmt.hxx
+++ b/include/svx/svddrgmt.hxx
@@ -229,8 +229,8 @@ inline const tools::Rectangle& SdrDragMethod::GetMarkedRect() const
 class SVXCORE_DLLPUBLIC SdrDragMove : public SdrDragMethod
 {
 private:
-    long                        nBestXSnap;
-    long                        nBestYSnap;
+    tools::Long                        nBestXSnap;
+    tools::Long                        nBestYSnap;
     bool                        bXSnapped;
     bool                        bYSnapped;
 
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 03ca5fc3a022..b215108c24c8 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -212,13 +212,13 @@ public:
     void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
     void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
     void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bWdh, const bool bHgt);
-    long GetMarkedObjRotate() const;
-    void RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy=false);
+    tools::Long GetMarkedObjRotate() const;
+    void RotateMarkedObj(const Point& rRef, tools::Long nAngle, bool bCopy=false);
     void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false);
     void MirrorMarkedObjHorizontal();
     void MirrorMarkedObjVertical();
-    long GetMarkedObjShear() const;
-    void ShearMarkedObj(const Point& rRef, long nAngle, bool bVShear=false, bool bCopy=false);
+    tools::Long GetMarkedObjShear() const;
+    void ShearMarkedObj(const Point& rRef, tools::Long nAngle, bool bVShear=false, bool bCopy=false);
     void CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false);
     void DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy=false);
 
@@ -227,7 +227,7 @@ public:
     void SetAllMarkedRect(const tools::Rectangle& rRect) { SetMarkedObjRect(rRect); }
     void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj(rSiz,bCopy); }
     void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { ResizeMarkedObj(rRef,xFact,yFact); }
-    void RotateAllMarked(const Point& rRef, long nAngle) { RotateMarkedObj(rRef,nAngle); }
+    void RotateAllMarked(const Point& rRef, tools::Long nAngle) { RotateMarkedObj(rRef,nAngle); }
     void MirrorAllMarkedHorizontal() { MirrorMarkedObjHorizontal(); }
     void MirrorAllMarkedVertical() { MirrorMarkedObjVertical(); }
     void CopyMarked() { CopyMarkedObj(); }
diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx
index 53dbef281786..7469444a743b 100644
--- a/include/svx/svdglev.hxx
+++ b/include/svx/svdglev.hxx
@@ -77,7 +77,7 @@ public:
 
     void MoveMarkedGluePoints  (const Size& rSiz, bool bCopy);
     void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy);
-    void RotateMarkedGluePoints(const Point& rRef, long nAngle, bool bCopy);
+    void RotateMarkedGluePoints(const Point& rRef, tools::Long nAngle, bool bCopy);
 };
 
 #endif // INCLUDED_SVX_SVDGLEV_HXX
diff --git a/include/svx/svdglue.hxx b/include/svx/svdglue.hxx
index ab6d6760c085..a7eb9b9d76b2 100644
--- a/include/svx/svdglue.hxx
+++ b/include/svx/svdglue.hxx
@@ -104,12 +104,12 @@ public:
     void         Invalidate(vcl::Window& rWin, const SdrObject* pObj) const;
     Point        GetAbsolutePos(const SdrObject& rObj) const;
     void         SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj);
-    long         GetAlignAngle() const;
-    void         SetAlignAngle(long nAngle);
-    static long  EscDirToAngle(SdrEscapeDirection nEsc);
-    static SdrEscapeDirection EscAngleToDir(long nAngle);
-    void         Rotate(const Point& rRef, long nAngle, double sn, double cs, const SdrObject* pObj);
-    void         Mirror(const Point& rRef1, const Point& rRef2, long nAngle, const SdrObject* pObj);
+    tools::Long         GetAlignAngle() const;
+    void         SetAlignAngle(tools::Long nAngle);
+    static tools::Long  EscDirToAngle(SdrEscapeDirection nEsc);
+    static SdrEscapeDirection EscAngleToDir(tools::Long nAngle);
+    void         Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj);
+    void         Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj);
     void         Shear (const Point& rRef, double tn, bool bVShear, const SdrObject* pObj);
 };
 
@@ -137,9 +137,9 @@ public:
     void                Invalidate(vcl::Window& rWin, const SdrObject* pObj) const;
     // temp for transformations on the reference object
     void                SetReallyAbsolute(bool bOn, const SdrObject& rObj);
-    void                Rotate(const Point& rRef, long nAngle, double sn, double cs, const SdrObject* pObj);
+    void                Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj);
     void                Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj);
-    void                Mirror(const Point& rRef1, const Point& rRef2, long nAngle, const SdrObject* pObj);
+    void                Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj);
     void                Shear (const Point& rRef, double tn, bool bVShear, const SdrObject* pObj);
 };
 
diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx
index 29bb9336838a..e5cc1379ab94 100644
--- a/include/svx/svdhdl.hxx
+++ b/include/svx/svdhdl.hxx
@@ -143,7 +143,7 @@ protected:
 
     SdrHdlKind                  eKind;
 
-    long                        nRotationAngle; // turn handle or mousepointer
+    tools::Long                        nRotationAngle; // turn handle or mousepointer
     sal_uInt32                  nObjHdlNum;     // required by MarkView
     sal_uInt32                  nPolyNum;       // Polygonpoint
     sal_uInt32                  nPPntNum;       // Point number of the polygon
@@ -207,7 +207,7 @@ public:
     void SetSelected(bool bJa=true);
 
     void Set1PixMore(bool bJa=true);
-    void SetRotationAngle(long n);
+    void SetRotationAngle(tools::Long n);
 
     bool IsCornerHdl() const { return eKind==SdrHdlKind::UpperLeft || eKind==SdrHdlKind::UpperRight || eKind==SdrHdlKind::LowerLeft || eKind==SdrHdlKind::LowerRight; }
     bool IsVertexHdl() const { return eKind==SdrHdlKind::Upper || eKind==SdrHdlKind::Lower || eKind==SdrHdlKind::Left  || eKind==SdrHdlKind::Right; }
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index c35b259a51dc..6f4581d1618a 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -232,10 +232,10 @@ public:
     // including PresObj's in higher derivations
     virtual void adaptSizeAndBorderForAllPages(
         const Size& rNewSize,
-        long nLeft = 0,
-        long nRight = 0,
-        long nUpper = 0,
-        long nLower = 0);
+        tools::Long nLeft = 0,
+        tools::Long nRight = 0,
+        tools::Long nUpper = 0,
+        tools::Long nLower = 0);
 
 protected:
     virtual css::uno::Reference< css::uno::XInterface > createUnoModel();
@@ -384,8 +384,8 @@ public:
     void             SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
 
     static OUString  GetUnitString(FieldUnit eUnit);
-    OUString         GetMetricString(long nVal, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
-    static OUString  GetAngleString(long nAngle);
+    OUString         GetMetricString(tools::Long nVal, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
+    static OUString  GetAngleString(tools::Long nAngle);
     static OUString  GetPercentString(const Fraction& rVal);
 
     // RecalcPageNums is ordinarily only called by the Page.
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index dd1a86d24bca..040302faa4c0 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -168,16 +168,16 @@ public:
     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
 
     virtual void Move(const Size& rSiz) override;
-    virtual void Shear(const Point& rRef, long nAngle, double tn, bool bVShear) override;
+    virtual void Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override;
     virtual void SetSnapRect(const tools::Rectangle& rRect) override;
     virtual void SetLogicRect(const tools::Rectangle& rRect) override;
     virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
 
     virtual void NbcMove(const Size& rSiz) override;
     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
-    virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs) override;
+    virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override;
     virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
-    virtual void NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear) override;
+    virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override;
     virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
     virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
 
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index cb98d67a2891..bb09c6856d3e 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -589,16 +589,16 @@ public:
     virtual void NbcMove  (const Size& rSiz);
     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
     virtual void NbcCrop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
-    virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs);
+    virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs);
     virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
-    virtual void NbcShear (const Point& rRef, long nAngle, double tn, bool bVShear);
+    virtual void NbcShear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear);
 
     virtual void Move  (const Size& rSiz);
     virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
     virtual void Crop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
-    virtual void Rotate(const Point& rRef, long nAngle, double sn, double cs);
+    virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs);
     virtual void Mirror(const Point& rRef1, const Point& rRef2);
-    virtual void Shear (const Point& rRef, long nAngle, double tn, bool bVShear);
+    virtual void Shear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear);
 
     /// The relative position of a SdrObject is the distance of the upper
     /// left corner of the logic bounding rectangle (SnapRect) to the anchor.
@@ -631,8 +631,8 @@ public:
     virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false );
 
     // rotation and shear angle
-    virtual long GetRotateAngle() const;
-    virtual long GetShearAngle(bool bVertical = false) const;
+    virtual tools::Long GetRotateAngle() const;
+    virtual tools::Long GetShearAngle(bool bVertical = false) const;
 
     /// snap to special points of an Object (polygon points, center of circle)
     virtual sal_uInt32 GetSnapPointCount() const;
@@ -729,7 +729,7 @@ public:
 
     // to be set temporarily when transforming related object(?)
     void SetGlueReallyAbsolute(bool bOn);
-    void NbcRotateGluePoints(const Point& rRef, long nAngle, double sn, double cs);
+    void NbcRotateGluePoints(const Point& rRef, tools::Long nAngle, double sn, double cs);
     void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
     void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear);
 
@@ -964,7 +964,7 @@ protected:
 
     void ImpForcePlusData();
 
-    OUString GetMetrStr(long nVal) const;
+    OUString GetMetrStr(tools::Long nVal) const;
 
     /// A derived class must override these 3 methods if it has own geometric
     /// data that must be saved for Undo.
diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx
index 105850fa3f84..dc0956388ed1 100644
--- a/include/svx/svdocirc.hxx
+++ b/include/svx/svdocirc.hxx
@@ -32,8 +32,8 @@ namespace sdr::properties {
 class SdrCircObjGeoData final : public SdrTextObjGeoData
 {
 public:
-    long                        nStartAngle;
-    long                        nEndAngle;
+    tools::Long                        nStartAngle;
+    tools::Long                        nEndAngle;
 };
 
 enum class SdrCircKind { Full, Section, Cut, Arc };
@@ -51,10 +51,10 @@ private:
     virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
 
     SdrCircKind                 meCircleKind;
-    long                        nStartAngle;
-    long                        nEndAngle;
+    tools::Long                        nStartAngle;
+    tools::Long                        nEndAngle;
 
-    SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, long nStart, long nEnd) const;
+    SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, tools::Long nStart, tools::Long nEnd) const;
     SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat);
     SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
     SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
@@ -86,8 +86,8 @@ public:
         SdrModel& rSdrModel,
         SdrCircKind eNewKind,
         const tools::Rectangle& rRect,
-        long nNewStartAngle,
-        long nNewEndWink);
+        tools::Long nNewStartAngle,
+        tools::Long nNewEndWink);
 
     SdrCircKind GetCircleKind() const { return meCircleKind; }
 
@@ -129,7 +129,7 @@ public:
     virtual void NbcMove(const Size& aSiz) override;
     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
     virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
-    virtual void NbcShear (const Point& rRef, long nAngle, double tn, bool bVShear) override;
+    virtual void NbcShear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override;
     virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
 
 private:
@@ -137,8 +137,8 @@ private:
     virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
     virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
 public:
-    long GetStartAngle() const { return nStartAngle; }
-    long GetEndAngle() const { return nEndAngle; }
+    tools::Long GetStartAngle() const { return nStartAngle; }
+    tools::Long GetEndAngle() const { return nEndAngle; }
 
 };
 
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index 2320091ab1a1..d1f9558a0648 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -84,8 +84,8 @@ public:
     Point                       aMiddleLine;
 
     // Following values are set by ImpCalcEdgeTrack
-    long                        nAngle1;           // exit angle at Obj1
-    long                        nAngle2;           // exit angle at Obj2
+    tools::Long                        nAngle1;           // exit angle at Obj1
+    tools::Long                        nAngle2;           // exit angle at Obj2
     sal_uInt16                  nObj1Lines;        // 1..3
     sal_uInt16                  nObj2Lines;        // 1..3
     sal_uInt16                  nMiddleLine;       // 0xFFFF=none, otherwise point number of the beginning of the line
@@ -102,8 +102,8 @@ public:
     Point& ImpGetLineOffsetPoint(SdrEdgeLineCode eLineCode);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list