[Libreoffice-commits] core.git: avmedia/source canvas/source chart2/source cppcanvas/source cui/source dbaccess/source editeng/source emfio/source framework/source include/tools include/vcl oox/source reportdesign/source sc/qa sc/source sd/qa sd/source sfx2/source starmath/source svtools/source svx/source sw/inc sw/qa sw/source tools/qa tools/source vcl/headless vcl/inc vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/source vcl/unx vcl/workben writerfilter/source

Stephan Bergmann sbergman at redhat.com
Sat Apr 7 12:13:48 UTC 2018


 avmedia/source/viewer/mediawindow_impl.cxx               |    2 
 canvas/source/vcl/spritehelper.cxx                       |    2 
 chart2/source/controller/main/ChartController_Window.cxx |    8 
 cppcanvas/source/mtfrenderer/implrenderer.cxx            |    8 
 cui/source/options/optcolor.cxx                          |    2 
 cui/source/options/optjava.cxx                           |    2 
 cui/source/tabpages/tpbitmap.cxx                         |    8 
 dbaccess/source/ui/querydesign/JoinController.cxx        |    8 
 editeng/source/editeng/editdbg.cxx                       |   16 -
 editeng/source/editeng/editeng.cxx                       |    6 
 editeng/source/editeng/impedit2.cxx                      |    8 
 editeng/source/editeng/impedit3.cxx                      |   12 
 emfio/source/reader/emfreader.cxx                        |    8 
 framework/source/layoutmanager/layoutmanager.cxx         |    4 
 framework/source/layoutmanager/toolbarlayoutmanager.cxx  |   22 -
 include/tools/gen.hxx                                    |  225 +++++++--------
 include/vcl/fixed.hxx                                    |    4 
 include/vcl/outdev.hxx                                   |   12 
 include/vcl/salbtype.hxx                                 |    8 
 include/vcl/salgtype.hxx                                 |   24 -
 oox/source/export/vmlexport.cxx                          |    8 
 reportdesign/source/core/sdr/RptObject.cxx               |    2 
 sc/qa/unit/bugfix-test.cxx                               |    4 
 sc/qa/unit/filters-test.cxx                              |    8 
 sc/qa/unit/helper/qahelper.cxx                           |    4 
 sc/qa/unit/subsequent_filters-test.cxx                   |    2 
 sc/source/core/data/drawpage.cxx                         |    2 
 sc/source/filter/excel/xepage.cxx                        |    4 
 sc/source/filter/html/htmlexp2.cxx                       |    8 
 sc/source/filter/xcl97/xcl97rec.cxx                      |    3 
 sc/source/filter/xml/xmlexprt.cxx                        |    8 
 sc/source/ui/Accessibility/AccessibleText.cxx            |    6 
 sc/source/ui/cctrl/cbuttonw.cxx                          |    2 
 sc/source/ui/cctrl/checklistmenu.cxx                     |    2 
 sc/source/ui/cctrl/dpcontrol.cxx                         |    4 
 sc/source/ui/docshell/docsh4.cxx                         |   20 -
 sc/source/ui/docshell/docsh6.cxx                         |    6 
 sc/source/ui/view/hdrcont.cxx                            |    8 
 sc/source/ui/view/printfun.cxx                           |    4 
 sc/source/ui/view/tabview3.cxx                           |    4 
 sd/qa/unit/import-tests.cxx                              |   14 
 sd/source/ui/slidesorter/view/SlsFramePainter.cxx        |    8 
 sd/source/ui/unoidl/unopage.cxx                          |    4 
 sd/source/ui/view/ViewShellBase.cxx                      |    4 
 sd/source/ui/view/drviews3.cxx                           |    2 
 sd/source/ui/view/frmview.cxx                            |   24 -
 sfx2/source/appl/newhelp.cxx                             |    2 
 sfx2/source/doc/iframe.cxx                               |    4 
 sfx2/source/sidebar/SidebarToolBox.cxx                   |    2 
 starmath/source/view.cxx                                 |    2 
 svtools/source/brwbox/brwbox1.cxx                        |    4 
 svtools/source/brwbox/brwbox2.cxx                        |    8 
 svtools/source/brwbox/brwbox3.cxx                        |    2 
 svtools/source/brwbox/datwin.cxx                         |    2 
 svtools/source/contnr/imivctl.hxx                        |    4 
 svtools/source/contnr/imivctl1.cxx                       |   10 
 svtools/source/contnr/treelistbox.cxx                    |    2 
 svtools/source/control/ctrlbox.cxx                       |    2 
 svtools/source/control/scriptedtext.cxx                  |    6 
 svtools/source/control/toolbarmenu.cxx                   |    6 
 svtools/source/control/valueset.cxx                      |    2 
 svtools/source/dialogs/addresstemplate.cxx               |    2 
 svtools/source/misc/imap2.cxx                            |    8 
 svtools/source/svhtml/htmlout.cxx                        |   20 -
 svx/source/dialog/pagectrl.cxx                           |    2 
 svx/source/dialog/swframeexample.cxx                     |    4 
 svx/source/fmcomp/fmgridcl.cxx                           |    4 
 svx/source/fmcomp/fmgridif.cxx                           |    2 
 svx/source/gallery2/galbrws2.cxx                         |    4 
 svx/source/sidebar/PanelLayout.cxx                       |    4 
 svx/source/svdraw/svdotextpathdecomposition.cxx          |    2 
 sw/inc/ndarr.hxx                                         |    2 
 sw/inc/swrect.hxx                                        |  140 ++++-----
 sw/inc/swtypes.hxx                                       |    6 
 sw/qa/extras/htmlexport/htmlexport.cxx                   |    2 
 sw/qa/extras/rtfexport/rtfexport2.cxx                    |    4 
 sw/qa/extras/rtfimport/rtfimport.cxx                     |    4 
 sw/qa/extras/tiledrendering/tiledrendering.cxx           |    4 
 sw/source/core/access/acccontext.cxx                     |    2 
 sw/source/core/bastyp/swrect.cxx                         |   70 ++--
 sw/source/core/bastyp/tabcol.cxx                         |    2 
 sw/source/core/doc/htmltbl.cxx                           |    4 
 sw/source/core/doc/notxtfrm.cxx                          |    6 
 sw/source/core/doc/tblrwcl.cxx                           |    6 
 sw/source/core/docnode/ndtbl.cxx                         |   14 
 sw/source/core/docnode/ndtbl1.cxx                        |    4 
 sw/source/core/draw/dflyobj.cxx                          |    2 
 sw/source/core/frmedt/fefly1.cxx                         |    2 
 sw/source/core/frmedt/feshview.cxx                       |    4 
 sw/source/core/frmedt/fetab.cxx                          |    4 
 sw/source/core/frmedt/tblsel.cxx                         |   10 
 sw/source/core/inc/frame.hxx                             |  126 ++++----
 sw/source/core/inc/frmtool.hxx                           |    4 
 sw/source/core/inc/tabfrm.hxx                            |    4 
 sw/source/core/layout/calcmove.cxx                       |   24 -
 sw/source/core/layout/colfrm.cxx                         |    4 
 sw/source/core/layout/flowfrm.cxx                        |    8 
 sw/source/core/layout/fly.cxx                            |   14 
 sw/source/core/layout/flycnt.cxx                         |   38 +-
 sw/source/core/layout/flylay.cxx                         |   10 
 sw/source/core/layout/frmtool.cxx                        |    2 
 sw/source/core/layout/ftnfrm.cxx                         |   20 -
 sw/source/core/layout/hffrm.cxx                          |    4 
 sw/source/core/layout/newfrm.cxx                         |   10 
 sw/source/core/layout/pagechg.cxx                        |   18 -
 sw/source/core/layout/paintfrm.cxx                       |   16 -
 sw/source/core/layout/sectfrm.cxx                        |   10 
 sw/source/core/layout/ssfrm.cxx                          |   28 -
 sw/source/core/layout/tabfrm.cxx                         |   90 +++---
 sw/source/core/layout/trvlfrm.cxx                        |    8 
 sw/source/core/layout/wsfrm.cxx                          |   30 +-
 sw/source/core/text/frmcrsr.cxx                          |   12 
 sw/source/core/text/frmform.cxx                          |    4 
 sw/source/core/text/itrcrsr.cxx                          |    8 
 sw/source/core/text/itrform2.cxx                         |   10 
 sw/source/core/text/txtfly.cxx                           |    4 
 sw/source/core/text/txtfrm.cxx                           |    6 
 sw/source/core/text/txtftn.cxx                           |    6 
 sw/source/core/text/widorp.cxx                           |    2 
 sw/source/core/text/xmldump.cxx                          |   24 -
 sw/source/core/unocore/unostyle.cxx                      |    4 
 sw/source/core/view/pagepreviewlayout.cxx                |    6 
 sw/source/core/view/viewsh.cxx                           |   14 
 sw/source/core/view/vnew.cxx                             |    2 
 sw/source/filter/basflt/shellio.cxx                      |    4 
 sw/source/filter/html/css1atr.cxx                        |    4 
 sw/source/filter/html/htmldrawwriter.cxx                 |    4 
 sw/source/filter/html/htmlflywriter.cxx                  |   16 -
 sw/source/filter/html/htmlforw.cxx                       |   14 
 sw/source/filter/html/htmlplug.cxx                       |    4 
 sw/source/filter/html/htmltabw.cxx                       |    8 
 sw/source/filter/html/swhtml.cxx                         |    2 
 sw/source/filter/inc/fltshell.hxx                        |    2 
 sw/source/filter/ww8/docxsdrexport.cxx                   |   26 +
 sw/source/filter/ww8/rtfattributeoutput.cxx              |    8 
 sw/source/filter/ww8/rtfexport.cxx                       |    4 
 sw/source/filter/ww8/rtfsdrexport.cxx                    |    6 
 sw/source/filter/ww8/wrtw8esh.cxx                        |    2 
 sw/source/filter/ww8/ww8atr.cxx                          |    6 
 sw/source/filter/ww8/ww8par.hxx                          |    2 
 sw/source/filter/ww8/ww8scan.cxx                         |   12 
 sw/source/filter/ww8/ww8scan.hxx                         |    2 
 sw/source/filter/xml/xmltexte.cxx                        |    4 
 sw/source/filter/xml/xmltexti.cxx                        |    4 
 sw/source/ui/dbui/dbinsdlg.cxx                           |    4 
 sw/source/ui/envelp/label1.cxx                           |    2 
 sw/source/ui/fldui/flddok.cxx                            |    4 
 sw/source/ui/frmdlg/frmpage.cxx                          |   20 -
 sw/source/ui/index/cnttab.cxx                            |    2 
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx     |    4 
 sw/source/uibase/docvw/PageBreakWin.cxx                  |    4 
 sw/source/uibase/docvw/edtwin.cxx                        |    8 
 sw/source/uibase/frmdlg/frmmgr.cxx                       |   14 
 sw/source/uibase/misc/redlndlg.cxx                       |    6 
 sw/source/uibase/ribbar/drawbase.cxx                     |    4 
 sw/source/uibase/shells/textsh.cxx                       |    4 
 sw/source/uibase/table/tablemgr.cxx                      |    2 
 sw/source/uibase/uiview/swcli.cxx                        |    2 
 sw/source/uibase/uiview/view.cxx                         |    4 
 sw/source/uibase/uiview/view2.cxx                        |    2 
 sw/source/uibase/uiview/viewport.cxx                     |   18 -
 sw/source/uibase/wrtsh/select.cxx                        |    2 
 tools/qa/cppunit/test_rectangle.cxx                      |   24 -
 tools/source/generic/gen.cxx                             |    4 
 tools/source/generic/point.cxx                           |   22 -
 vcl/headless/svpframe.cxx                                |    2 
 vcl/inc/headless/svpframe.hxx                            |    2 
 vcl/inc/osx/salframe.h                                   |    2 
 vcl/inc/osx/salprn.h                                     |    2 
 vcl/inc/salframe.hxx                                     |    2 
 vcl/inc/salgdi.hxx                                       |   38 +-
 vcl/inc/salprn.hxx                                       |    2 
 vcl/inc/unx/genprn.h                                     |    2 
 vcl/inc/unx/gtk/gtkframe.hxx                             |    2 
 vcl/inc/unx/salbmp.h                                     |   10 
 vcl/inc/unx/salframe.h                                   |    2 
 vcl/opengl/gdiimpl.cxx                                   |   16 -
 vcl/osx/salframe.cxx                                     |    2 
 vcl/osx/salprn.cxx                                       |    2 
 vcl/qa/cppunit/BitmapTest.cxx                            |   36 +-
 vcl/qa/cppunit/graphicfilter/filters-test.cxx            |    6 
 vcl/qa/cppunit/jpeg/JpegReaderTest.cxx                   |   12 
 vcl/qt5/Qt5Frame.cxx                                     |    2 
 vcl/qt5/Qt5Frame.hxx                                     |    2 
 vcl/source/control/button.cxx                            |    2 
 vcl/source/control/combobox.cxx                          |    4 
 vcl/source/control/edit.cxx                              |   12 
 vcl/source/control/field.cxx                             |    2 
 vcl/source/control/field2.cxx                            |   18 -
 vcl/source/control/fixed.cxx                             |    2 
 vcl/source/control/imp_listbox.cxx                       |    6 
 vcl/source/control/listbox.cxx                           |    2 
 vcl/source/control/notebookbar.cxx                       |    4 
 vcl/source/control/tabctrl.cxx                           |    8 
 vcl/source/gdi/bmpacc.cxx                                |    6 
 vcl/source/gdi/pdfwriter_impl.cxx                        |   64 ++--
 vcl/source/gdi/salgdilayout.cxx                          |   36 +-
 vcl/source/graphic/GraphicObject.cxx                     |    4 
 vcl/source/outdev/rect.cxx                               |    4 
 vcl/source/outdev/text.cxx                               |    8 
 vcl/source/outdev/textline.cxx                           |   16 -
 vcl/source/window/layout.cxx                             |    4 
 vcl/source/window/menu.cxx                               |    6 
 vcl/source/window/toolbox.cxx                            |   18 -
 vcl/source/window/window.cxx                             |    4 
 vcl/source/window/winproc.cxx                            |    4 
 vcl/unx/generic/app/i18n_status.cxx                      |    2 
 vcl/unx/generic/gdi/salbmp.cxx                           |   10 
 vcl/unx/generic/print/common_gfx.cxx                     |   21 -
 vcl/unx/generic/print/genprnpsp.cxx                      |    2 
 vcl/unx/generic/window/salframe.cxx                      |    2 
 vcl/unx/gtk/gtksalframe.cxx                              |    2 
 vcl/unx/gtk3/gtk3gtkframe.cxx                            |    2 
 vcl/workben/vcldemo.cxx                                  |    2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx        |    4 
 215 files changed, 1119 insertions(+), 1122 deletions(-)

New commits:
commit d36f7c5bd2115fcdd26ba8ff7b6a0446dea70bd4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Apr 7 11:45:13 2018 +0200

    Revert "long->sal_Int32 in tools/gen.hxx"
    
    This reverts commit 8bc951daf79decbd8a599a409c6d33c5456710e0.
    
    As discussed at
    <https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html>
    "long->sal_Int32 in tools/gen.hxx", that commit caused lots of problems with
    signed integer overflow, and the original plan was to redo it to consistently
    use sal_Int64 instead of sal_Int32.  <https://gerrit.libreoffice.org/#/c/52471/>
    "sal_Int32->sal_Int64 in tools/gen.hxx" tried that.  However, it failed
    miserably on Windows, causing odd failures like not writing out Pictures/*.svm
    streams out into .odp during CppunitTest_sd_export_ooxml2.  So the next best
    approach is to just revert the original commit, at least for now.
    
    Includes revert of follow-up 8c50aff2175e85c54957d98ce32af40a3a87e168 "Fix
    Library_vclplug_qt5".
    
    Change-Id: Ia8bf34272d1ed38aac00e5d07a9d13fb03f439ae
    Reviewed-on: https://gerrit.libreoffice.org/52532
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index ce5efb11cf97..da0d87ba5ad8 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -529,7 +529,7 @@ void MediaWindowImpl::Resize()
     if (mpMediaWindowControl)
     {
         const sal_Int32 nControlHeight = mpMediaWindowControl->GetSizePixel().Height();
-        const sal_Int32 nControlY = std::max<sal_Int32>(aCurSize.Height() - nControlHeight - nOffset, 0);
+        const sal_Int32 nControlY = std::max(aCurSize.Height() - nControlHeight - nOffset, 0L);
 
         aPlayerWindowSize.setHeight( nControlY - (nOffset << 1) );
         mpMediaWindowControl->SetPosSizePixel(Point(nOffset, nControlY ), Size(aCurSize.Width() - (nOffset << 1), nControlHeight));
diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx
index f8f3a59b0fa2..366d0a5b9829 100644
--- a/canvas/source/vcl/spritehelper.cxx
+++ b/canvas/source/vcl/spritehelper.cxx
@@ -306,7 +306,7 @@ namespace vclcanvas
 
                     // paint sprite prio
                     vcl::Font aVCLFont;
-                    aVCLFont.SetFontHeight( std::min<sal_Int32>(20,aOutputSize.Height()) );
+                    aVCLFont.SetFontHeight( std::min(long(20),aOutputSize.Height()) );
                     aVCLFont.SetColor( COL_RED );
 
                     rTargetSurface.SetTextAlign(ALIGN_TOP);
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 4225a269c535..83dfc4a1a0c0 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -2035,10 +2035,10 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
     sal_Int32 nDimensionIndex = sDimensionIndex.toInt32();
 
     awt::Rectangle xRectangle {
-        aRectangle.Left(),
-        aRectangle.Top(),
-        aRectangle.GetWidth(),
-        aRectangle.GetHeight()
+        sal_Int32(aRectangle.Left()),
+        sal_Int32(aRectangle.Top()),
+        sal_Int32(aRectangle.GetWidth()),
+        sal_Int32(aRectangle.GetHeight())
     };
 
     uno::Sequence<beans::PropertyValue> aCallbackData = comphelper::InitPropertySequence(
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 01d479a27449..806353dbe543 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -1564,8 +1564,8 @@ namespace cppcanvas
                         // least one dimension
                       
                         // Remark the 1L cannot be replaced, that would cause max to compare long/int
-                        const Size aMtfSizePix( std::max<sal_Int32>( aMtfSizePixPre.Width(), 1 ),
-                                                std::max<sal_Int32>( aMtfSizePixPre.Height(), 1 ) );
+                        const Size aMtfSizePix( std::max( aMtfSizePixPre.Width(), 1L ),
+                                                std::max( aMtfSizePixPre.Height(), 1L ) );
 
                         // Setup local transform, such that the
                         // metafile renders itself into the given
@@ -2878,8 +2878,8 @@ namespace cppcanvas
             // #i44110# correct null-sized output - there are shapes
             // which have zero size in at least one dimension
             // Remark the 1L cannot be replaced, that would cause max to compare long/int
-            const Size aMtfSizePix( std::max<sal_Int32>( aMtfSizePixPre.Width(), 1 ),
-                                    std::max<sal_Int32>( aMtfSizePixPre.Height(), 1 ) );
+            const Size aMtfSizePix( std::max( aMtfSizePixPre.Width(), 1L ),
+                                    std::max( aMtfSizePixPre.Height(), 1L ) );
 
             sal_Int32 nCurrActions(0);
             ActionFactoryParameters aParms(aStateStack,
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index ca131aec41d8..a273888772c6 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -508,7 +508,7 @@ void ColorConfigWindow_Impl::CreateEntries()
         ScopedVclPtrInstance< FixedText > aFixedText(this);
         aCheckBox->SetText(sSampleText);
         aFixedText->SetText(sSampleText);
-        Size aCheckSize(aCheckBox->CalcMinimumSize(RECT_MAX));
+        Size aCheckSize(aCheckBox->CalcMinimumSize(0x7fffffff));
         Size aFixedSize(aFixedText->CalcMinimumSize());
         nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
     }
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 2d9618f7f128..2534247494aa 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -82,7 +82,7 @@ public:
         HeaderBar &rBar = GetTheHeaderBar();
         if (rBar.GetItemCount() < 4)
             return;
-        long nCheckWidth = std::max<sal_Int32>(GetControlColumnWidth() + 12,
+        long nCheckWidth = std::max(GetControlColumnWidth() + 12,
             rBar.LogicToPixel(Size(15, 0), MapMode(MapUnit::MapAppFont)).Width());
         long nVersionWidth = 12 +
             std::max(rBar.GetTextWidth(rBar.GetItemText(3)),
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 4d4093f210a8..b2ced9344e0b 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -316,8 +316,8 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
     {
         BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx());
         Size aTempBitmapSize = aBmpEx.GetSizePixel();
-        rBitmapSize.setWidth( (OutputDevice::LogicToLogic(aTempBitmapSize.Width(),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
-        rBitmapSize.setHeight( (OutputDevice::LogicToLogic(aTempBitmapSize.Height(),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+        rBitmapSize.setWidth( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+        rBitmapSize.setHeight( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
         CalculateBitmapPresetSize();
     }
 
@@ -531,8 +531,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void)
         Size aTempBitmapSize = aBmpEx.GetSizePixel();
         const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0);
 
-        rBitmapSize.setWidth( (OutputDevice::LogicToLogic(aTempBitmapSize.Width(),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
-        rBitmapSize.setHeight( (OutputDevice::LogicToLogic(aTempBitmapSize.Height(),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+        rBitmapSize.setWidth( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
+        rBitmapSize.setHeight( (OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale );
         CalculateBitmapPresetSize();
         ModifyBitmapStyleHdl( *m_pBitmapStyleLB );
         ModifyBitmapPositionHdl( *m_pPositionLB );
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 7ba38b159bb1..8e056acb2186 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -394,10 +394,10 @@ void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rV
             aWindowData.put( "ComposedName", elem->GetComposedName() );
             aWindowData.put( "TableName", elem->GetTableName() );
             aWindowData.put( "WindowName", elem->GetWinName() );
-            aWindowData.put( "WindowTop", elem->GetPosition().Y() );
-            aWindowData.put( "WindowLeft", elem->GetPosition().X() );
-            aWindowData.put( "WindowWidth", elem->GetSize().Width() );
-            aWindowData.put( "WindowHeight", elem->GetSize().Height() );
+            aWindowData.put( "WindowTop", static_cast<sal_Int32>(elem->GetPosition().Y()) );
+            aWindowData.put( "WindowLeft", static_cast<sal_Int32>(elem->GetPosition().X()) );
+            aWindowData.put( "WindowWidth", static_cast<sal_Int32>(elem->GetSize().Width()) );
+            aWindowData.put( "WindowHeight", static_cast<sal_Int32>(elem->GetSize().Height()) );
             aWindowData.put( "ShowAll", elem->IsShowAll() );
 
             const OUString sTableName( "Table" + OUString::number( i++ ) );
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 6b929d7f1358..3dbdadb6af22 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -212,7 +212,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
             MapMode aPntMap( MapUnit::MapPoint );
             aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
             aDebStr.append(" Points=");
-            aDebStr.append(aSz.Height());
+            aDebStr.append(static_cast<sal_Int32>(aSz.Height()));
         }
         break;
         case EE_CHAR_FONTWIDTH:
@@ -282,7 +282,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
             MapMode aPntMap( MapUnit::MapPoint );
             aSz = OutputDevice::LogicToLogic( aSz, aItemMapMode, aPntMap );
             aDebStr.append(" Points=");
-            aDebStr.append(aSz.Height());
+            aDebStr.append(static_cast<sal_Int32>(aSz.Height()));
         }
         break;
         case EE_CHAR_WLM:
@@ -389,7 +389,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
             aPortionStr.append(' ');
             aPortionStr.append(rPortion.GetLen());
             aPortionStr.append('(');
-            aPortionStr.append(rPortion.GetSize().Width());
+            aPortionStr.append(static_cast<sal_Int32>(rPortion.GetSize().Width()));
             aPortionStr.append(')');
             aPortionStr.append('[');
             aPortionStr.append(static_cast<sal_Int32>(rPortion.GetKind()));
@@ -456,9 +456,9 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
     fprintf( fp, "\n================================================================================" );
     fprintf( fp, "\nControl: %x", unsigned( pEE->GetControlWord() ) );
     fprintf( fp, "\nRefMapMode: %i", int( pEE->pImpEditEngine->pRefDev->GetMapMode().GetMapUnit() ) );
-    fprintf( fp, "\nPaperSize: %" SAL_PRIdINT32 " x %" SAL_PRIdINT32, pEE->GetPaperSize().Width(), pEE->GetPaperSize().Height() );
-    fprintf( fp, "\nMaxAutoPaperSize: %" SAL_PRIdINT32 " x %" SAL_PRIdINT32, pEE->GetMaxAutoPaperSize().Width(), pEE->GetMaxAutoPaperSize().Height() );
-    fprintf( fp, "\nMinAutoPaperSize: %" SAL_PRIdINT32 " x %" SAL_PRIdINT32, pEE->GetMinAutoPaperSize().Width(), pEE->GetMinAutoPaperSize().Height() );
+    fprintf( fp, "\nPaperSize: %li x %li", pEE->GetPaperSize().Width(), pEE->GetPaperSize().Height() );
+    fprintf( fp, "\nMaxAutoPaperSize: %li x %li", pEE->GetMaxAutoPaperSize().Width(), pEE->GetMaxAutoPaperSize().Height() );
+    fprintf( fp, "\nMinAutoPaperSize: %li x %li", pEE->GetMinAutoPaperSize().Width(), pEE->GetMinAutoPaperSize().Height() );
     fprintf( fp, "\nUpdate: %i", pEE->GetUpdateMode() );
     fprintf( fp, "\nNumber of Views: %" SAL_PRI_SIZET "i", pEE->GetViewCount() );
     for ( size_t nView = 0; nView < pEE->GetViewCount(); nView++ )
@@ -467,9 +467,9 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
         DBG_ASSERT( pV, "View not found!" );
         fprintf( fp, "\nView %zu: Focus=%i", nView, pV->GetWindow()->HasFocus() );
         tools::Rectangle aR( pV->GetOutputArea() );
-        fprintf( fp, "\n  OutputArea: nX=%" SAL_PRIdINT32 ", nY=%" SAL_PRIdINT32 ", dX=%" SAL_PRIdINT32 ", dY=%" SAL_PRIdINT32 ", MapMode = %i", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() , int( pV->GetWindow()->GetMapMode().GetMapUnit() ) );
+        fprintf( fp, "\n  OutputArea: nX=%li, nY=%li, dX=%li, dY=%li, MapMode = %i", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() , int( pV->GetWindow()->GetMapMode().GetMapUnit() ) );
         aR = pV->GetVisArea();
-        fprintf( fp, "\n  VisArea: nX=%" SAL_PRIdINT32 ", nY=%" SAL_PRIdINT32 ", dX=%" SAL_PRIdINT32 ", dY=%" SAL_PRIdINT32, aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() );
+        fprintf( fp, "\n  VisArea: nX=%li, nY=%li, dX=%li, dY=%li", aR.TopLeft().X(), aR.TopLeft().Y(), aR.GetSize().Width(), aR.GetSize().Height() );
         ESelection aSel = pV->GetSelection();
         fprintf( fp, "\n  Selection: Start=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32 ", End=%" SAL_PRIdINT32 ",%" SAL_PRIdINT32, aSel.nStartPara, aSel.nStartPos, aSel.nEndPara, aSel.nEndPos );
     }
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 01bc8dadc7e2..6e7ffce529f3 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1813,17 +1813,17 @@ SvxFont EditEngine::GetStandardSvxFont( sal_Int32 nPara )
 void EditEngine::StripPortions()
 {
     ScopedVclPtrInstance< VirtualDevice > aTmpDev;
-    tools::Rectangle aBigRect( Point( 0, 0 ), Size( RECT_MAX, RECT_MAX ) );
+    tools::Rectangle aBigRect( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) );
     if ( IsVertical() )
     {
         if( IsTopToBottom() )
         {
             aBigRect.SetRight( 0 );
-            aBigRect.SetLeft( RECT_MIN );
+            aBigRect.SetLeft( -0x7FFFFFFF );
         }
         else
         {
-            aBigRect.SetTop( RECT_MIN );
+            aBigRect.SetTop( -0x7FFFFFFF );
             aBigRect.SetBottom( 0 );
         }
     }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index c58c76b4e8a5..19e035fafccd 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -87,9 +87,9 @@ static sal_uInt16 lcl_CalcExtraSpace( const SvxLineSpacingItem& rLSItem )
 
 ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
     pSharedVCL(EditDLL::Get().GetSharedVclResources()),
-    aPaperSize( RECT_MAX, RECT_MAX ),
+    aPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ),
     aMinAutoPaperSize( 0x0, 0x0 ),
-    aMaxAutoPaperSize( RECT_MAX, RECT_MAX ),
+    aMaxAutoPaperSize( 0x7FFFFFFF, 0x7FFFFFFF ),
     aEditDoc( pItemPool ),
     aWordDelimiters(" .,;:-`'?!_=\"{}()[]"),
     bKernAsianPunctuation(false),
@@ -4265,9 +4265,9 @@ void ImpEditEngine::SetValidPaperSize( const Size& rNewSz )
     aPaperSize = rNewSz;
 
     long nMinWidth = aStatus.AutoPageWidth() ? aMinAutoPaperSize.Width() : 0;
-    long nMaxWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : RECT_MAX;
+    long nMaxWidth = aStatus.AutoPageWidth() ? aMaxAutoPaperSize.Width() : 0x7FFFFFFF;
     long nMinHeight = aStatus.AutoPageHeight() ? aMinAutoPaperSize.Height() : 0;
-    long nMaxHeight = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : RECT_MAX;
+    long nMaxHeight = aStatus.AutoPageHeight() ? aMaxAutoPaperSize.Height() : 0x7FFFFFFF;
 
     // Minimum/Maximum width:
     if ( aPaperSize.Width() < nMinWidth )
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 369017cac794..7cc6dfddb695 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -404,7 +404,7 @@ void ImpEditEngine::FormatDoc()
             if ( aInvalidRect.IsEmpty() )
             {
                 // For Paperwidth 0 (AutoPageSize) it would otherwise be Empty()...
-                long nWidth = std::max<sal_Int32>( 1, ( !IsVertical() ? aPaperSize.Width() : aPaperSize.Height() ) );
+                long nWidth = std::max( long(1), ( !IsVertical() ? aPaperSize.Width() : aPaperSize.Height() ) );
                 Range aInvRange( GetInvalidYOffsets( pParaPortion ) );
                 aInvalidRect = tools::Rectangle( Point( 0, nY+aInvRange.Min() ),
                     Size( nWidth, aInvRange.Len() ) );
@@ -733,7 +733,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
     {
         aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
         if ( aBulletArea.Right() > 0 )
-            pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( long(aBulletArea.Right()) )) );
+            pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) );
         else
             pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly
     }
@@ -1711,7 +1711,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion )
     {
         aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
         if ( aBulletArea.Right() > 0 )
-            pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( long(aBulletArea.Right()) )) );
+            pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) );
         else
             pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly.
         if ( pParaPortion->GetBulletX() > nStartX )
@@ -4038,8 +4038,8 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_Int32 nNew
     {
         // in this case one can redraw directly without invalidating the
         // Portions
-        sal_Int32 nFirstPortion = std::min( aOldPositions.Min(), nNewPos );
-        sal_Int32 nLastPortion = std::max( aOldPositions.Max(), nNewPos );
+        sal_Int32 nFirstPortion = std::min( static_cast<sal_Int32>(aOldPositions.Min()), nNewPos );
+        sal_Int32 nLastPortion = std::max( static_cast<sal_Int32>(aOldPositions.Max()), nNewPos );
 
         ParaPortion* pUpperPortion = GetParaPortions().SafeGetObject( nFirstPortion );
         ParaPortion* pLowerPortion = GetParaPortions().SafeGetObject( nLastPortion );
@@ -4057,7 +4057,7 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_Int32 nNew
     else
     {
         // redraw from the upper invalid position
-        sal_Int32 nFirstInvPara = std::min( aOldPositions.Min(), nNewPos );
+        sal_Int32 nFirstInvPara = std::min( static_cast<sal_Int32>(aOldPositions.Min()), nNewPos );
         InvalidateFromParagraph( nFirstInvPara );
     }
     return aSel;
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index bc13659a2631..5164450bcece 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -750,9 +750,6 @@ namespace emfio
                     case EMR_SETWINDOWEXTEX :
                     {
                         mpInputStream->ReadUInt32( nW ).ReadUInt32( nH );
-                        // clamp to valid range
-                        nW = std::max<sal_Int32>(std::min<sal_Int32>(nW, RECT_MAX), RECT_MIN);
-                        nH = std::max<sal_Int32>(std::min<sal_Int32>(nH, RECT_MAX), RECT_MIN);
                         SetWinExt( Size( nW, nH ), true);
                     }
                     break;
@@ -1930,11 +1927,6 @@ namespace emfio
 
         SetrclFrame(rclFrame);
         SetrclBounds(rclBounds);
-        // clamp to valid range
-        nPixX = std::max<sal_Int32>(std::min<sal_Int32>(nPixX, RECT_MAX), RECT_MIN);
-        nPixY = std::max<sal_Int32>(std::min<sal_Int32>(nPixY, RECT_MAX), RECT_MIN);
-        nMillX = std::max<sal_Int32>(std::min<sal_Int32>(nMillX, RECT_MAX), RECT_MIN);
-        nMillY = std::max<sal_Int32>(std::min<sal_Int32>(nMillY, RECT_MAX), RECT_MIN);
         SetRefPix(Size( nPixX, nPixY ) );
         SetRefMill(Size( nMillX, nMillY ) );
 
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 1c3cf233d12e..3eed6268f3f0 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -2343,7 +2343,7 @@ bool LayoutManager::implts_doLayout( bool bForceRequestBorderSpace, bool bOuterR
             // Position the status bar
             if ( aStatusBarSize.Height() > 0 )
             {
-                implts_setStatusBarPosSize( ::Point( 0, std::max<sal_Int32>( aContainerSize.Height(), 0 )),
+                implts_setStatusBarPosSize( ::Point( 0, std::max(( aContainerSize.Height() ), long( 0 ))),
                                             ::Size( aContainerSize.Width(),aStatusBarSize.Height() ));
             }
 
@@ -2466,7 +2466,7 @@ void LayoutManager::implts_setDockingAreaWindowSizes()
     // Position the status bar
     if ( aStatusBarSize.Height() > 0 )
     {
-        implts_setStatusBarPosSize( ::Point( 0, std::max<sal_Int32>(( aContainerClientSize.Height - aStatusBarSize.Height() ), 0)),
+        implts_setStatusBarPosSize( ::Point( 0, std::max(( aContainerClientSize.Height - aStatusBarSize.Height() ), long( 0 ))),
                                     ::Size( aContainerClientSize.Width, aStatusBarSize.Height() ));
     }
 }
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 2048f9a9b3ae..e8925e9de098 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -2211,7 +2211,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
 
         if ( nSpace > 0 )
         {
-            sal_Int32 nMove = std::min( nSpace, aFrontDockingRect.getWidth() );
+            sal_Int32 nMove = std::min( nSpace, static_cast<sal_Int32>(aFrontDockingRect.getWidth()) );
             if ( bHorzDockArea )
                 aFrontDockingRect.Move( -nMove, 0 );
             else
@@ -2700,7 +2700,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                         if ( bHorizontalDockArea )
                         {
                             sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( aContainerWinSize.Width() -  aWindowRect.Left() ),
-                                                                                    aTrackingRect.getWidth() ));
+                                                                                    sal_Int32( aTrackingRect.getWidth() )));
                             if ( nSize == 0 )
                                 nSize = aWindowRect.getWidth();
 
@@ -2715,7 +2715,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                         {
                             sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32(
                                                     nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Top() ),
-                                                    aTrackingRect.getHeight() ));
+                                                    sal_Int32( aTrackingRect.getHeight() )));
                             if ( nSize == 0 )
                                 nSize = aWindowRect.getHeight();
 
@@ -2737,7 +2737,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                         if ( bHorizontalDockArea )
                         {
                             sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32(( aContainerWinSize.Width() ) - aWindowRect.Right() ),
-                                                                                    aTrackingRect.getWidth() ));
+                                                                                    sal_Int32( aTrackingRect.getWidth() )));
                             if ( nSize == 0 )
                             {
                                 aUIElementRect.SetPos( ::Point( aContainerWinSize.Width() - aTrackingRect.getWidth(), aWindowRect.Top() ));
@@ -2758,7 +2758,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                         else
                         {
                             sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Bottom() ),
-                                                                                    aTrackingRect.getHeight() ));
+                                                                                    sal_Int32( aTrackingRect.getHeight() )));
                             aUIElementRect.SetPos( ::Point( aWindowRect.Left(), aWindowRect.Bottom() ));
                             aUIElementRect.SetSize( ::Size( aWindowRect.getWidth(), nSize ));
 
@@ -2852,14 +2852,14 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
 
         if ( bHorizontalDockArea )
         {
-            sal_Int32 nPosX( std::max( rTrackingRect.Left(), sal_Int32( 0 )));
+            sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 )));
             if (( nPosX + rTrackingRect.getWidth()) > aContainerWinSize.Width() )
                 nPosX = std::min( nPosX,
                                 std::max( sal_Int32( aContainerWinSize.Width() - rTrackingRect.getWidth() ),
                                           sal_Int32( 0 )));
 
             sal_Int32 nSize = std::min( aContainerWinSize.Width(), rTrackingRect.getWidth() );
-            sal_Int32 nDockHeight = std::max<sal_Int32>( aDockingAreaRect.getHeight(), 0 );
+            sal_Int32 nDockHeight = std::max( static_cast<sal_Int32>(aDockingAreaRect.getHeight()), sal_Int32( 0 ));
             if ( nDockHeight == 0 )
             {
                 sal_Int32 nPosY( std::max( aDockingAreaRect.Top(), aDockingAreaRect.Bottom() ));
@@ -2904,8 +2904,8 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                                 std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() ),
                                                      nTopDockingAreaSize ));
 
-            sal_Int32 nSize = std::min( nMaxDockingAreaHeight, aTrackingRect.getHeight() );
-            sal_Int32 nDockWidth = std::max<sal_Int32>( aDockingAreaRect.getWidth(), 0 );
+            sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) );
+            sal_Int32 nDockWidth = std::max( static_cast<sal_Int32>(aDockingAreaRect.getWidth()), sal_Int32( 0 ));
             if ( nDockWidth == 0 )
             {
                 sal_Int32 nPosX( std::max( aDockingAreaRect.Left(), aDockingAreaRect.Right() ));
@@ -3009,7 +3009,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
     ::tools::Rectangle aTrackingRect( rTrackingRect );
     if ( bHorizontalDockArea )
     {
-        sal_Int32 nPosX( std::max<sal_Int32>( rTrackingRect.Left(), 0 ));
+        sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 )));
         if (( nPosX + rTrackingRect.getWidth()) > rContainerWinSize.Width() )
             nPosX = std::min( nPosX,
                                 std::max( sal_Int32( rContainerWinSize.Width() - rTrackingRect.getWidth() ),
@@ -3035,7 +3035,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
                                 std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() ),
                                                      nTopDockingAreaSize ));
 
-        sal_Int32 nSize = std::min( nMaxDockingAreaHeight, aTrackingRect.getHeight() );
+        sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) );
 
         aTrackingRect.SetPos( ::Point( rRowColumnRect.Left(), nPosY ));
         aTrackingRect.setWidth( rRowColumnRect.getWidth() );
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 3254d2cba844..90486536c401 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -25,7 +25,6 @@
 #include <algorithm>
 #include <ostream>
 #include <cstdlib>
-#include <cassert>
 
 class SvStream;
 namespace rtl
@@ -35,30 +34,27 @@ namespace rtl
 
 enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, TRISTATE_INDET };
 
-#define RECT_MAX    (SAL_MAX_INT32)
-#define RECT_MIN    (SAL_MIN_INT32)
-
 // Pair
 
 class SAL_WARN_UNUSED Pair
 {
 public:
                         Pair() : nA(0), nB(0) {}
-                        Pair( sal_Int32 _nA, sal_Int32 _nB ) : nA(_nA), nB(_nB) {}
+                        Pair( long _nA, long _nB ) : nA(_nA), nB(_nB) {}
 
-    sal_Int32           A() const { return nA; }
-    sal_Int32           B() const { return nB; }
+    long                A() const { return nA; }
+    long                B() const { return nB; }
 
-    sal_Int32&          A() { return nA; }
-    sal_Int32&          B() { return nB; }
+    long&               A() { return nA; }
+    long&               B() { return nB; }
 
     TOOLS_DLLPUBLIC rtl::OString        toString() const;
     TOOLS_DLLPUBLIC friend SvStream&    ReadPair( SvStream& rIStream, Pair& rPair );
     TOOLS_DLLPUBLIC friend SvStream&    WritePair( SvStream& rOStream, const Pair& rPair );
 
 protected:
-    sal_Int32           nA;
-    sal_Int32           nB;
+    long                nA;
+    long                nB;
 };
 
 namespace tools { namespace detail {
@@ -78,35 +74,33 @@ class SAL_WARN_UNUSED SAL_DLLPUBLIC_EXPORT Point final : protected Pair
 {
 public:
                         Point() {}
-                        Point( sal_Int32 nX, sal_Int32 nY ) : Pair( nX, nY )
-                        {
-                        }
+                        Point( long nX, long nY ) : Pair( nX, nY ) {}
 
-    sal_Int32           X() const { return nA; }
-    sal_Int32           Y() const { return nB; }
+    long                X() const { return nA; }
+    long                Y() const { return nB; }
 
-    void                Move( sal_Int32 nHorzMove, sal_Int32 nVertMove );
+    void                Move( long nHorzMove, long nVertMove );
     void                Move( Size const & s );
-    sal_Int32           AdjustX( sal_Int32 nHorzMove ) { nA += nHorzMove; return nA; }
-    sal_Int32           AdjustY( sal_Int32 nVertMove ) { nB += nVertMove; return nB; }
+    long                AdjustX( long nHorzMove ) { nA += nHorzMove; return nA; }
+    long                AdjustY( long nVertMove ) { nB += nVertMove; return nB; }
 
-    void                RotateAround( sal_Int32& rX, sal_Int32& rY, short nOrientation ) const;
+    void                RotateAround( long& rX, long& rY, short nOrientation ) const;
     void                RotateAround( Point&, short nOrientation ) const;
 
     Point&              operator += ( const Point& rPoint );
     Point&              operator -= ( const Point& rPoint );
-    Point&              operator *= ( const sal_Int32 nVal );
-    Point&              operator /= ( const sal_Int32 nVal );
+    Point&              operator *= ( const long nVal );
+    Point&              operator /= ( const long nVal );
 
     friend inline Point operator+( const Point &rVal1, const Point &rVal2 );
     friend inline Point operator-( const Point &rVal1, const Point &rVal2 );
-    friend inline Point operator*( const Point &rVal1, const sal_Int32 nVal2 );
-    friend inline Point operator/( const Point &rVal1, const sal_Int32 nVal2 );
+    friend inline Point operator*( const Point &rVal1, const long nVal2 );
+    friend inline Point operator/( const Point &rVal1, const long nVal2 );
 
-    sal_Int32           getX() const { return X(); }
-    sal_Int32           getY() const { return Y(); }
-    void                setX(sal_Int32 nX)  { nA = nX; }
-    void                setY(sal_Int32 nY)  { nB = nY; }
+    long                getX() const { return X(); }
+    long                getY() const { return Y(); }
+    void                setX(long nX)  { nA = nX; }
+    void                setY(long nY)  { nB = nY; }
 
     Pair const &        toPair() const { return *this; }
     Pair &              toPair() { return *this; }
@@ -114,7 +108,7 @@ public:
     using Pair::toString;
 };
 
-inline void Point::Move( sal_Int32 nHorzMove, sal_Int32 nVertMove )
+inline void Point::Move( long nHorzMove, long nVertMove )
 {
     nA += nHorzMove;
     nB += nVertMove;
@@ -134,14 +128,14 @@ inline Point& Point::operator -= ( const Point& rPoint )
     return *this;
 }
 
-inline Point& Point::operator *= ( const sal_Int32 nVal )
+inline Point& Point::operator *= ( const long nVal )
 {
     nA *= nVal;
     nB *= nVal;
     return *this;
 }
 
-inline Point& Point::operator /= ( const sal_Int32 nVal )
+inline Point& Point::operator /= ( const long nVal )
 {
     nA /= nVal;
     nB /= nVal;
@@ -158,12 +152,12 @@ inline Point operator-( const Point &rVal1, const Point &rVal2 )
     return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
 }
 
-inline Point operator*( const Point &rVal1, const sal_Int32 nVal2 )
+inline Point operator*( const Point &rVal1, const long nVal2 )
 {
     return Point( rVal1.nA*nVal2, rVal1.nB*nVal2 );
 }
 
-inline Point operator/( const Point &rVal1, const sal_Int32 nVal2 )
+inline Point operator/( const Point &rVal1, const long nVal2 )
 {
     return Point( rVal1.nA/nVal2, rVal1.nB/nVal2 );
 }
@@ -191,20 +185,18 @@ class SAL_WARN_UNUSED Size final : protected Pair
 {
 public:
                     Size() {}
-                    Size( sal_Int32 nWidth, sal_Int32 nHeight ) : Pair( nWidth, nHeight )
-                    {
-                    }
+                    Size( long nWidth, long nHeight ) : Pair( nWidth, nHeight ) {}
 
-    sal_Int32       Width() const  { return nA; }
-    sal_Int32       Height() const { return nB; }
+    long            Width() const  { return nA; }
+    long            Height() const { return nB; }
 
-    sal_Int32       AdjustWidth( sal_Int32 n ) { nA += n; return nA; }
-    sal_Int32       AdjustHeight( sal_Int32 n ) { nB += n; return nB; }
+    long            AdjustWidth( long n ) { nA += n; return nA; }
+    long            AdjustHeight( long n ) { nB += n; return nB; }
 
-    sal_Int32       getWidth() const { return Width(); }
-    sal_Int32       getHeight() const { return Height(); }
-    void            setWidth(sal_Int32 nWidth)  { nA = nWidth; }
-    void            setHeight(sal_Int32 nHeight)  { nB = nHeight; }
+    long            getWidth() const { return Width(); }
+    long            getHeight() const { return Height(); }
+    void            setWidth(long nWidth)  { nA = nWidth; }
+    void            setHeight(long nHeight)  { nB = nHeight; }
 
     Pair const &    toPair() const { return *this; }
     Pair &          toPair() { return *this; }
@@ -237,22 +229,22 @@ inline void Point::Move( Size const & s )
 
 // Range
 
-#define RANGE_MAX   SAL_MAX_INT32
+#define RANGE_MAX   LONG_MAX
 
 class SAL_WARN_UNUSED Range final : protected Pair
 {
 public:
                     Range() {}
-                    Range( sal_Int32 nMin, sal_Int32 nMax ) : Pair( nMin, nMax ) {}
+                    Range( long nMin, long nMax ) : Pair( nMin, nMax ) {}
 
-    sal_Int32       Min() const { return nA; }
-    sal_Int32       Max() const { return nB; }
-    sal_Int32       Len() const { return nB - nA + 1; }
+    long            Min() const { return nA; }
+    long            Max() const { return nB; }
+    long            Len() const { return nB - nA + 1; }
 
-    sal_Int32&      Min() { return nA; }
-    sal_Int32&      Max() { return nB; }
+    long&           Min() { return nA; }
+    long&           Max() { return nB; }
 
-    bool            IsInside( sal_Int32 nIs ) const;
+    bool            IsInside( long nIs ) const;
 
     void            Justify();
 
@@ -262,7 +254,7 @@ public:
     using Pair::toString;
 };
 
-inline bool Range::IsInside( sal_Int32 nIs ) const
+inline bool Range::IsInside( long nIs ) const
 {
     return ((nA <= nIs) && (nIs <= nB ));
 }
@@ -271,7 +263,7 @@ inline void Range::Justify()
 {
     if ( nA > nB )
     {
-        sal_Int32 nHelp = nA;
+        long nHelp = nA;
         nA = nB;
         nB = nHelp;
     }
@@ -296,32 +288,32 @@ inline std::basic_ostream<charT, traits> & operator <<(
 
 // Selection
 
-#define SELECTION_MIN   SAL_MIN_INT32
-#define SELECTION_MAX   SAL_MAX_INT32
+#define SELECTION_MIN   LONG_MIN
+#define SELECTION_MAX   LONG_MAX
 
 class SAL_WARN_UNUSED Selection final : protected Pair
 {
 public:
                     Selection() {}
-                    Selection( sal_Int32 nPos ) : Pair( nPos, nPos ) {}
-                    Selection( sal_Int32 nMin, sal_Int32 nMax ) : Pair( nMin, nMax ) {}
+                    Selection( long nPos ) : Pair( nPos, nPos ) {}
+                    Selection( long nMin, long nMax ) : Pair( nMin, nMax ) {}
 
-    sal_Int32       Min() const { return nA; }
-    sal_Int32       Max() const { return nB; }
-    sal_Int32       Len() const { return nB - nA; }
+    long            Min() const { return nA; }
+    long            Max() const { return nB; }
+    long            Len() const { return nB - nA; }
 
-    sal_Int32&      Min() { return nA; }
-    sal_Int32&      Max() { return nB; }
+    long&           Min() { return nA; }
+    long&           Max() { return nB; }
 
-    bool            IsInside( sal_Int32 nIs ) const;
+    bool            IsInside( long nIs ) const;
 
     void            Justify();
 
     bool            operator !() const { return !Len(); }
 
-    sal_Int32       getMin() const { return Min(); }
-    void            setMin(sal_Int32 nMin)  { Min() = nMin; }
-    void            setMax(sal_Int32 nMax)  { Max() = nMax; }
+    long            getMin() const { return Min(); }
+    void            setMin(long nMin)  { Min() = nMin; }
+    void            setMax(long nMax)  { Max() = nMax; }
 
     Pair const &    toPair() const { return *this; }
     Pair &          toPair() { return *this; }
@@ -329,7 +321,7 @@ public:
     using Pair::toString;
 };
 
-inline bool Selection::IsInside( sal_Int32 nIs ) const
+inline bool Selection::IsInside( long nIs ) const
 {
     return ((nA <= nIs) && (nIs < nB ));
 }
@@ -338,7 +330,7 @@ inline void Selection::Justify()
 {
     if ( nA > nB )
     {
-        sal_Int32 nHelp = nA;
+        long nHelp = nA;
         nA = nB;
         nB = nHelp;
     }
@@ -362,6 +354,9 @@ inline std::basic_ostream<charT, traits> & operator <<(
 }
 // Rectangle
 
+#define RECT_MAX    LONG_MAX
+#define RECT_MIN    LONG_MIN
+
 /// Note: this class is a true marvel of engineering: because the author
 /// could not decide whether it's better to have a closed or half-open
 /// interval, they just implemented *both* in the same class!
@@ -373,28 +368,27 @@ inline std::basic_ostream<charT, traits> & operator <<(
 /// Ok, now is the time for despair.
 namespace tools
 {
-
 class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Rectangle final
 {
-    static constexpr sal_Int32 RECT_EMPTY = -32767;
+    static constexpr short RECT_EMPTY = -32767;
 public:
                         Rectangle();
                         Rectangle( const Point& rLT, const Point& rRB );
-                        Rectangle( sal_Int32 nLeft, sal_Int32 nTop,
-                                   sal_Int32 nRight, sal_Int32 nBottom );
+                        Rectangle( long nLeft, long nTop,
+                                   long nRight, long nBottom );
     /// Constructs an empty Rectangle, with top/left at the specified params
-                        Rectangle( sal_Int32 nLeft, sal_Int32 nTop );
+                        Rectangle( long nLeft, long nTop );
                         Rectangle( const Point& rLT, const Size& rSize );
 
-    sal_Int32           Left() const    { return nLeft;   }
-    sal_Int32           Right() const   { return nRight;  }
-    sal_Int32           Top() const     { return nTop;    }
-    sal_Int32           Bottom() const  { return nBottom; }
+    long                Left() const    { return nLeft;   }
+    long                Right() const   { return nRight;  }
+    long                Top() const     { return nTop;    }
+    long                Bottom() const  { return nBottom; }
 
-    void                SetLeft(sal_Int32 v)    { nLeft = v;   }
-    void                SetRight(sal_Int32 v)   { nRight = v;  }
-    void                SetTop(sal_Int32 v)     { nTop = v;    }
-    void                SetBottom(sal_Int32 v)  { nBottom = v; }
+    void                SetLeft(long v)    { nLeft = v;   }
+    void                SetRight(long v)   { nRight = v;  }
+    void                SetTop(long v)     { nTop = v;    }
+    void                SetBottom(long v)  { nBottom = v; }
 
     inline Point        TopLeft() const;
     inline Point        TopRight() const;
@@ -407,21 +401,20 @@ public:
     inline Point        Center() const;
 
     /// Move the top and left edges by a delta, preserving width and height
-    inline void         Move( sal_Int32 nHorzMoveDelta, sal_Int32 nVertMoveDelta );
+    inline void         Move( long nHorzMoveDelta, long nVertMoveDelta );
     void                Move( Size const & s ) { Move(s.Width(), s.Height()); }
-    sal_Int32           AdjustLeft( sal_Int32 nHorzMoveDelta ) { nLeft += nHorzMoveDelta; return nLeft; }
-    sal_Int32           AdjustRight( sal_Int32 nHorzMoveDelta ) { nRight += nHorzMoveDelta; return nRight; }
-    sal_Int32           AdjustTop( sal_Int32 nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; }
-    sal_Int32           AdjustBottom( sal_Int32 nVertMoveDelta ) { nBottom += nVertMoveDelta; return nBottom; }
-
+    long                AdjustLeft( long nHorzMoveDelta ) { nLeft += nHorzMoveDelta; return nLeft; }
+    long                AdjustRight( long nHorzMoveDelta ) { nRight += nHorzMoveDelta; return nRight; }
+    long                AdjustTop( long nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; }
+    long                AdjustBottom( long nVertMoveDelta ) { nBottom += nVertMoveDelta; return nBottom; }
     inline void         SetPos( const Point& rPoint );
     void                SetSize( const Size& rSize );
     inline Size         GetSize() const;
 
     /// Returns the difference between right and left, assuming the range is inclusive.
-    inline sal_Int32    GetWidth() const;
+    inline long         GetWidth() const;
     /// Returns the difference between bottom and top, assuming the range is inclusive.
-    inline sal_Int32    GetHeight() const;
+    inline long         GetHeight() const;
 
     tools::Rectangle&          Union( const tools::Rectangle& rRect );
     tools::Rectangle&          Intersection( const tools::Rectangle& rRect );
@@ -454,39 +447,39 @@ public:
     TOOLS_DLLPUBLIC friend SvStream&    WriteRectangle( SvStream& rOStream, const tools::Rectangle& rRect );
 
     // ONE
-    sal_Int32           getX() const { return nLeft; }
-    sal_Int32           getY() const { return nTop; }
+    long                getX() const { return nLeft; }
+    long                getY() const { return nTop; }
     /// Returns the difference between right and left, assuming the range includes one end, but not the other.
-    sal_Int32           getWidth() const { return nRight - nLeft; }
+    long                getWidth() const { return nRight - nLeft; }
     /// Returns the difference between bottom and top, assuming the range includes one end, but not the other.
-    sal_Int32           getHeight() const { return nBottom - nTop; }
+    long                getHeight() const { return nBottom - nTop; }
     /// Set the left edge of the rectangle to x, preserving the width
-    void                setX( sal_Int32 x ) { nRight  += x - nLeft; nLeft = x; }
+    void                setX( long x ) { nRight  += x - nLeft; nLeft = x; }
     /// Set the top edge of the rectangle to y, preserving the height
-    void                setY( sal_Int32 y ) { nBottom += y - nTop;  nTop  = y; }
-    void                setWidth( sal_Int32 n ) { nRight = nLeft + n; }
-    void                setHeight( sal_Int32 n ) { nBottom = nTop + n; }
+    void                setY( long y ) { nBottom += y - nTop;  nTop  = y; }
+    void                setWidth( long n ) { nRight = nLeft + n; }
+    void                setHeight( long n ) { nBottom = nTop + n; }
     /// Returns the string representation of the rectangle, format is "x, y, width, height".
     rtl::OString        toString() const;
 
     /**
      * Expands the rectangle in all directions by the input value.
      */
-    inline void expand(sal_Int32 nExpandBy);
-    inline void shrink(sal_Int32 nShrinkBy);
+    inline void expand(long nExpandBy);
+    inline void shrink(long nShrinkBy);
 
     /**
      * Sanitizing variants for handling data from the outside
      */
     void                SaturatingSetSize(const Size& rSize);
-    void                SaturatingSetX(sal_Int32 x);
-    void                SaturatingSetY(sal_Int32 y);
+    void                SaturatingSetX(long x);
+    void                SaturatingSetY(long y);
 
 private:
-    sal_Int32           nLeft;
-    sal_Int32           nTop;
-    sal_Int32           nRight;
-    sal_Int32           nBottom;
+    long                nLeft;
+    long                nTop;
+    long                nRight;
+    long                nBottom;
 };
 }
 
@@ -504,8 +497,8 @@ inline tools::Rectangle::Rectangle( const Point& rLT, const Point& rRB )
     nBottom = rRB.Y();
 }
 
-inline tools::Rectangle::Rectangle( sal_Int32 _nLeft,  sal_Int32 _nTop,
-                             sal_Int32 _nRight, sal_Int32 _nBottom )
+inline tools::Rectangle::Rectangle( long _nLeft,  long _nTop,
+                             long _nRight, long _nBottom )
 {
     nLeft   = _nLeft;
     nTop    = _nTop;
@@ -513,7 +506,7 @@ inline tools::Rectangle::Rectangle( sal_Int32 _nLeft,  sal_Int32 _nTop,
     nBottom = _nBottom;
 }
 
-inline tools::Rectangle::Rectangle( sal_Int32 _nLeft,  sal_Int32 _nTop )
+inline tools::Rectangle::Rectangle( long _nLeft,  long _nTop )
 {
     nLeft   = _nLeft;
     nTop    = _nTop;
@@ -596,7 +589,7 @@ inline Point tools::Rectangle::Center() const
         return Point( nLeft+(nRight-nLeft)/2 , nTop+(nBottom-nTop)/2 );
 }
 
-inline void tools::Rectangle::Move( sal_Int32 nHorzMove, sal_Int32 nVertMove )
+inline void tools::Rectangle::Move( long nHorzMove, long nVertMove )
 {
     nLeft += nHorzMove;
     nTop  += nVertMove;
@@ -616,9 +609,9 @@ inline void tools::Rectangle::SetPos( const Point& rPoint )
     nTop  = rPoint.Y();
 }
 
-inline sal_Int32 tools::Rectangle::GetWidth() const
+inline long tools::Rectangle::GetWidth() const
 {
-    sal_Int32 n;
+    long n;
     if ( nRight == RECT_EMPTY )
         n = 0;
     else
@@ -633,9 +626,9 @@ inline sal_Int32 tools::Rectangle::GetWidth() const
     return n;
 }
 
-inline sal_Int32 tools::Rectangle::GetHeight() const
+inline long tools::Rectangle::GetHeight() const
 {
-    sal_Int32 n;
+    long n;
     if ( nBottom == RECT_EMPTY )
         n = 0;
     else
@@ -724,7 +717,7 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt )
 }
 }
 
-inline void tools::Rectangle::expand(sal_Int32 nExpandBy)
+inline void tools::Rectangle::expand(long nExpandBy)
 {
     nLeft   -= nExpandBy;
     nTop    -= nExpandBy;
@@ -732,7 +725,7 @@ inline void tools::Rectangle::expand(sal_Int32 nExpandBy)
     nBottom += nExpandBy;
 }
 
-inline void tools::Rectangle::shrink(sal_Int32 nShrinkBy)
+inline void tools::Rectangle::shrink(long nShrinkBy)
 {
     nLeft   += nShrinkBy;
     nTop    += nShrinkBy;
diff --git a/include/vcl/fixed.hxx b/include/vcl/fixed.hxx
index 77b529b14671..49fdef75ddef 100644
--- a/include/vcl/fixed.hxx
+++ b/include/vcl/fixed.hxx
@@ -69,9 +69,9 @@ public:
 
     void            setMaxWidthChars(sal_Int32 nWidth);
     void            setMinWidthChars(sal_Int32 nWidth);
-    static Size     CalcMinimumTextSize(Control const* pControl, long nMaxWidth = RECT_MAX);
+    static Size     CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff);
     static Size     getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth);
-    Size            CalcMinimumSize(long nMaxWidth = RECT_MAX) const;
+    Size            CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
     virtual Size    GetOptimalSize() const override;
     virtual bool    set_property(const OString &rKey, const OUString &rValue) override;
     void            set_mnemonic_widget(vcl::Window *pWindow);
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 3dcc52de5355..649faa6388ef 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -356,14 +356,14 @@ private:
     long                            mnOutOffX;
     /// Output offset for device output in pixel (pseudo window offset within window system's frames)
     long                            mnOutOffY;
-    sal_Int32                       mnOutWidth;
-    sal_Int32                       mnOutHeight;
+    long                            mnOutWidth;
+    long                            mnOutHeight;
     sal_Int32                       mnDPIX;
     sal_Int32                       mnDPIY;
     sal_Int32                       mnDPIScalePercentage; ///< For Hi-DPI displays, we want to draw elements for a percentage larger
     /// font specific text alignment offsets in pixel units
-    mutable sal_Int32               mnTextOffX;
-    mutable sal_Int32               mnTextOffY;
+    mutable long                    mnTextOffX;
+    mutable long                    mnTextOffY;
     mutable long                    mnEmphasisAscent;
     mutable long                    mnEmphasisDescent;
     DrawModeFlags                   mnDrawMode;
@@ -1177,13 +1177,13 @@ private:
     SAL_DLLPRIVATE void         ImplDrawSpecialText( SalLayout& );
     SAL_DLLPRIVATE void         ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
 
-    SAL_DLLPRIVATE static void  ImplDrawWavePixel( long nOriginX, long nOriginY, sal_Int32 nCurX, sal_Int32 nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev,
+    SAL_DLLPRIVATE static void  ImplDrawWavePixel( long nOriginX, long nOriginY, long nCurX, long nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev,
                                                    bool bDrawPixAsRect, long nPixWidth, long nPixHeight );
     SAL_DLLPRIVATE void         ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
     SAL_DLLPRIVATE void         ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
     SAL_DLLPRIVATE void         ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
     SAL_DLLPRIVATE void         ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
-    SAL_DLLPRIVATE void         ImplDrawStrikeoutChar( long nBaseX, long nBaseY, sal_Int32 nX, sal_Int32 nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
+    SAL_DLLPRIVATE void         ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
     SAL_DLLPRIVATE void         ImplDrawMnemonicLine( long nX, long nY, long nWidth );
 
     SAL_DLLPRIVATE static bool  ImplIsUnderlineAbove( const vcl::Font& );
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 78628616f7a9..1a940214501d 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -327,10 +327,10 @@ public:
 
 struct VCL_DLLPUBLIC BitmapBuffer
 {
-    ScanlineFormat  mnFormat;
-    sal_Int32       mnWidth;
-    sal_Int32       mnHeight;
-    sal_Int32       mnScanlineSize;
+    ScanlineFormat       mnFormat;
+    long            mnWidth;
+    long            mnHeight;
+    long            mnScanlineSize;
     sal_uInt16      mnBitCount;
     ColorMask       maColorMask;
     BitmapPalette   maPalette;
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index d6c8dd8e11d5..0e37300f3dbd 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -38,25 +38,25 @@ constexpr ::Color SALCOLOR_NONE ( 0xFF, 0xFF, 0xFF, 0xFF );
 // must equal to class Point
 struct SalPoint
 {
-    sal_Int32        mnX;
-    sal_Int32        mnY;
+    long        mnX;
+    long        mnY;
 };
 
 typedef const SalPoint*   PCONSTSALPOINT;
 
 struct SalTwoRect
 {
-    sal_Int32        mnSrcX;
-    sal_Int32        mnSrcY;
-    sal_Int32        mnSrcWidth;
-    sal_Int32        mnSrcHeight;
-    sal_Int32        mnDestX;
-    sal_Int32        mnDestY;
-    sal_Int32        mnDestWidth;
-    sal_Int32        mnDestHeight;
+    long        mnSrcX;
+    long        mnSrcY;
+    long        mnSrcWidth;
+    long        mnSrcHeight;
+    long        mnDestX;
+    long        mnDestY;
+    long        mnDestWidth;
+    long        mnDestHeight;
 
-    SalTwoRect(sal_Int32 nSrcX, sal_Int32 nSrcY, sal_Int32 nSrcWidth, sal_Int32 nSrcHeight,
-               sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight)
+    SalTwoRect(long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight,
+               long nDestX, long nDestY, long nDestWidth, long nDestHeight)
         : mnSrcX(nSrcX), mnSrcY(nSrcY), mnSrcWidth(nSrcWidth), mnSrcHeight(nSrcHeight)
         , mnDestX(nDestX), mnDestY(nDestY), mnDestWidth(nDestWidth), mnDestHeight(nDestHeight)
     {
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 90284382ad22..2ec6992381a6 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -158,13 +158,13 @@ sal_uInt32 VMLExport::EnterGroup( const OUString& rShapeName, const tools::Recta
     if ( pRect && ( mnGroupLevel == 1 ) )
     {
         pAttrList->add( XML_coordorigin,
-                OStringBuffer( 20 ).append( pRect->Left() )
-                .append( "," ).append( pRect->Top() )
+                OStringBuffer( 20 ).append( sal_Int32( pRect->Left() ) )
+                .append( "," ).append( sal_Int32( pRect->Top() ) )
                 .makeStringAndClear() );
 
         pAttrList->add( XML_coordsize,
-                OStringBuffer( 20 ).append( pRect->Right() - pRect->Left() )
-                .append( "," ).append( pRect->Bottom() - pRect->Top() )
+                OStringBuffer( 20 ).append( sal_Int32( pRect->Right() ) - sal_Int32( pRect->Left() ) )
+                .append( "," ).append( sal_Int32( pRect->Bottom() ) - sal_Int32( pRect->Top() ) )
                 .makeStringAndClear() );
     }
 
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 737c87e3b1fe..8d38b5ddf478 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -407,7 +407,7 @@ void OObjectBase::SetPropsFromRect(const tools::Rectangle& _rRect)
     {
         uno::Reference<report::XSection> xSection = pPage->getSection();
         assert(_rRect.getHeight() >= 0);
-        const sal_uInt32 newHeight( ::std::max<sal_Int32>(0, _rRect.getHeight()+_rRect.Top()) );
+        const sal_uInt32 newHeight( ::std::max(0l, _rRect.getHeight()+_rRect.Top()) );
         if ( xSection.is() && ( newHeight > xSection->getHeight() ) )
             xSection->setHeight( newHeight );
 
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index d59b78d4a586..94fa2d188189 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -163,8 +163,8 @@ void ScFiltersTest::testTdf91979()
     Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true);
     int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(0, 0), aViewData.GetPPTX());
     int nRowHeight = ScViewData::ToPixel(pDoc->GetRowHeight(0, 0), aViewData.GetPPTY());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32((MAXCOL - 1) * nColWidth), aPos.getX());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(10000 * nRowHeight), aPos.getY());
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>((MAXCOL - 1) * nColWidth), aPos.getX());
+    CPPUNIT_ASSERT_EQUAL(static_cast<long>(10000 * nRowHeight), aPos.getY());
 
     xComponent->dispose();
 }
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 705627e79f75..0c4eeb808145 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -445,13 +445,13 @@ void impl_testLegacyCellAnchoredRotatedShape( ScDocument& rDoc, tools::Rectangle
 
     SdrObject* pObj = pPage->GetObj(0);
     const tools::Rectangle& aSnap = pObj->GetSnapRect();
-    printf("expected height %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", aRect.GetHeight(), aSnap.GetHeight() );
+    printf("expected height %ld actual %ld\n", aRect.GetHeight(), aSnap.GetHeight() );
     CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRect.GetHeight(), aSnap.GetHeight(), TOLERANCE ) );
-    printf("expected width %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", aRect.GetWidth(), aSnap.GetWidth() );
+    printf("expected width %ld actual %ld\n", aRect.GetWidth(), aSnap.GetWidth() );
     CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRect.GetWidth(), aSnap.GetWidth(), TOLERANCE ) );
-    printf("expected left %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", aRect.Left(), aSnap.Left() );
+    printf("expected left %ld actual %ld\n", aRect.Left(), aSnap.Left() );
     CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRect.Left(), aSnap.Left(), TOLERANCE ) );
-    printf("expected right %" SAL_PRIdINT32 " actual %" SAL_PRIdINT32 "\n", aRect.Top(), aSnap.Top() );
+    printf("expected right %ld actual %ld\n", aRect.Top(), aSnap.Top() );
     CPPUNIT_ASSERT_EQUAL( true, testEqualsWithTolerance( aRect.Top(), aSnap.Top(), TOLERANCE ) );
 
     ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 279664b401ca..3f7c93198312 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -178,11 +178,11 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
     pPattern = pDoc->GetPattern(0,0,1);
     vcl::Font aFont;
     pPattern->GetFont(aFont,SC_AUTOCOL_RAW);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", sal_Int32(200), aFont.GetFontSize().getHeight());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", 200l, aFont.GetFontSize().getHeight());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aFont.GetColor());
     pPattern = pDoc->GetPattern(0,1,1);
     pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 12", sal_Int32(240), aFont.GetFontSize().getHeight());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 12", 240l, aFont.GetFontSize().getHeight());
     pPattern = pDoc->GetPattern(0,2,1);
     pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be italic", ITALIC_NORMAL, aFont.GetItalic());
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 3e602c95b8af..2e876434ce49 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1678,7 +1678,7 @@ void ScFiltersTest::testChartImportXLS()
     const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 0);
     CPPUNIT_ASSERT_MESSAGE("Failed to retrieve a chart object from the 2nd sheet.", pOleObj);
 
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(11137), pOleObj->GetLogicRect().getWidth());
+    CPPUNIT_ASSERT_EQUAL(11137L, pOleObj->GetLogicRect().getWidth());
     CPPUNIT_ASSERT(8640L > pOleObj->GetLogicRect().getHeight());
 
     xDocSh->DoClose();
diff --git a/sc/source/core/data/drawpage.cxx b/sc/source/core/data/drawpage.cxx
index 5ccd3cdd5598..302f0e93ff45 100644
--- a/sc/source/core/data/drawpage.cxx
+++ b/sc/source/core/data/drawpage.cxx
@@ -27,7 +27,7 @@
 ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage)
 :   FmFormPage(rNewModel, bMasterPage)
 {
-    SetSize( Size( RECT_MAX, RECT_MAX ) );
+    SetSize( Size( LONG_MAX, LONG_MAX ) );
 }
 
 ScDrawPage::~ScDrawPage()
diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx
index 6d7d65edbf43..0e0ce7163354 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -283,7 +283,7 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
                 // dynamic height: calculate header height, add header <-> sheet area distance
                 (aHFConv.GetTotalHeight() + rHdrItemSet.Get( ATTR_ULSPACE ).GetLower()) :
                 // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
-                ( rHdrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
+                static_cast< sal_Int32 >( rHdrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
             maData.mfHeaderMargin = maData.mfTopMargin;
             maData.mfTopMargin += XclTools::GetInchFromTwips( nHdrHeight );
         }
@@ -300,7 +300,7 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
                 // dynamic height: calculate footer height, add sheet area <-> footer distance
                 (aHFConv.GetTotalHeight() + rFtrItemSet.Get( ATTR_ULSPACE ).GetUpper()) :
                 // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
-                ( rFtrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
+                static_cast< sal_Int32 >( rFtrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
             maData.mfFooterMargin = maData.mfBottomMargin;
             maData.mfBottomMargin += XclTools::GetInchFromTwips( nFtrHeight );
         }
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index d6887744f517..45743fb88518 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -119,15 +119,15 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
     SdrObject* pObject = pE->pObject;
     OStringBuffer aBuf;
     aBuf.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).append('=').
-        append(pE->aSize.Width());
+        append(static_cast<sal_Int32>(pE->aSize.Width()));
     aBuf.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height).append('=').
-        append(pE->aSize.Height());
+        append(static_cast<sal_Int32>(pE->aSize.Height()));
     if ( pE->bInCell )
     {
         aBuf.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_hspace).append('=').
-            append(pE->aSpace.Width());
+            append(static_cast<sal_Int32>(pE->aSpace.Width()));
         aBuf.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_vspace).append('=').
-            append(pE->aSpace.Height());
+            append(static_cast<sal_Int32>(pE->aSpace.Height()));
     }
     OString aOpt = aBuf.makeStringAndClear();
     switch ( pObject->GetObjIdentifier() )
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 5151e39c77f5..a4ecfd8860fe 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -653,8 +653,7 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement )
 {
     char pAnchor[100];
     sax_fastparser::FSHelperPtr pVmlDrawing = GetFS();
-    snprintf( pAnchor, 100, "%" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32
-                  ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32,
+    snprintf( pAnchor, 100, "%ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld",
                   maFrom.Left(), maFrom.Top(), maFrom.Right(), maFrom.Bottom(),
                   maTo.Left(), maTo.Top(), maTo.Right(), maTo.Bottom() );
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 42b24e02812f..1289cd238473 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4882,13 +4882,13 @@ void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
                     tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
                     sal_uInt16 i(0);
                     pProps[i].Name = "VisibleAreaTop";
-                    pProps[i].Value <<= aRect.getY();
+                    pProps[i].Value <<= static_cast<sal_Int32>(aRect.getY());
                     pProps[++i].Name = "VisibleAreaLeft";
-                    pProps[i].Value <<= aRect.getX();
+                    pProps[i].Value <<= static_cast<sal_Int32>(aRect.getX());
                     pProps[++i].Name = "VisibleAreaWidth";
-                    pProps[i].Value <<= aRect.getWidth();
+                    pProps[i].Value <<= static_cast<sal_Int32>(aRect.getWidth());
                     pProps[++i].Name = "VisibleAreaHeight";
-                    pProps[i].Value <<= aRect.getHeight();
+                    pProps[i].Value <<= static_cast<sal_Int32>(aRect.getHeight());
                 }
             }
         }
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index b61983665892..66bcc5f4ad88 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -750,9 +750,9 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
         const SfxInt32Item* pItem = rDoc.GetAttr( aCellPos, ATTR_ROTATE_VALUE );
         if( pItem && (pItem->GetValue() != 0) )
         {
-            pEditEngine->SetPaperSize( Size( RECT_MAX, aSize.getHeight() ) );
+            pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
             long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
-            aSize.setWidth( std::max<sal_Int32>( aSize.getWidth(), nTxtWidth + 2 ) );
+            aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) );
         }
         else
         {
@@ -762,7 +762,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
             if ( !bLineBreak )
             {
                 long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
-                aSize.setWidth( ::std::max<sal_Int32>( aSize.getWidth(), nTxtWidth ) );
+                aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) );
             }
         }
 
diff --git a/sc/source/ui/cctrl/cbuttonw.cxx b/sc/source/ui/cctrl/cbuttonw.cxx
index afce592d640e..c4067be67f3a 100644
--- a/sc/source/ui/cctrl/cbuttonw.cxx
+++ b/sc/source/ui/cctrl/cbuttonw.cxx
@@ -45,7 +45,7 @@ void ScDDComboBoxButton::SetOutputDevice( OutputDevice* pOutputDevice )
 void ScDDComboBoxButton::SetOptSizePixel()
 {
     aBtnSize = pOut->LogicToPixel(Size(8, 11), MapMode(MapUnit::MapAppFont));
-    aBtnSize.setWidth( std::max<sal_Int32>(aBtnSize.Width(), pOut->GetSettings().GetStyleSettings().GetScrollBarSize()) );
+    aBtnSize.setWidth( std::max(aBtnSize.Width(), pOut->GetSettings().GetStyleSettings().GetScrollBarSize()) );
 }
 
 void ScDDComboBoxButton::Draw( const Point& rAt,
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index d52230d080fc..fcffd7809543 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -995,7 +995,7 @@ void ScCheckListMenuWindow::getSectionPosSize(
         break;
         case CHECK_TOGGLE_ALL:
         {
-            long h = std::min<sal_Int32>(maChkToggleAll->CalcMinimumSize().Height(), 26);
+            long h = std::min(maChkToggleAll->CalcMinimumSize().Height(), 26L);
             rPos = Point(nListBoxMargin, nSingleBtnAreaY);
             rPos.AdjustX(5 );
             rPos.AdjustY((nSingleItemBtnAreaHeight - h)/2 );
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 022cc66bb257..a714f116f9c5 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -149,8 +149,8 @@ void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
 
     long nMaxSize = 18 * fScaleFactor; // Button max size in either dimension
 
-    long nW = std::min<sal_Int32>(maSize.getWidth() / 2, nMaxSize);
-    long nH = std::min<sal_Int32>(maSize.getHeight(),    nMaxSize);
+    long nW = std::min(maSize.getWidth() / 2, nMaxSize);
+    long nH = std::min(maSize.getHeight(),    nMaxSize);
 
     // #i114944# AutoFilter button is left-aligned in RTL.
     // DataPilot button is always right-aligned for now, so text output isn't affected.
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index a0b2cf8b8678..c5d96d47b00b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2120,14 +2120,14 @@ tools::Rectangle ScDocShell::GetVisArea( sal_uInt16 nAspect ) const
 namespace {
 
 SAL_WARN_UNUSED_RESULT
-sal_Int32 SnapHorizontal( const ScDocument& rDoc, SCTAB nTab, sal_Int32 nVal, SCCOL& rStartCol )
+long SnapHorizontal( const ScDocument& rDoc, SCTAB nTab, long nVal, SCCOL& rStartCol )
 {
     SCCOL nCol = 0;
-    sal_Int32 nTwips = static_cast<long>(nVal / HMM_PER_TWIPS);
-    sal_Int32 nSnap = 0;
+    long nTwips = static_cast<long>(nVal / HMM_PER_TWIPS);
+    long nSnap = 0;
     while ( nCol<MAXCOL )
     {
-        sal_Int32 nAdd = rDoc.GetColWidth(nCol, nTab);
+        long nAdd = rDoc.GetColWidth(nCol, nTab);
         if ( nSnap + nAdd/2 < nTwips || nCol < rStartCol )
         {
             nSnap += nAdd;
@@ -2136,17 +2136,17 @@ sal_Int32 SnapHorizontal( const ScDocument& rDoc, SCTAB nTab, sal_Int32 nVal, SC
         else
             break;
     }
-    nVal = nSnap * HMM_PER_TWIPS;
+    nVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
     rStartCol = nCol;
     return nVal;
 }
 
 SAL_WARN_UNUSED_RESULT
-sal_Int32 SnapVertical( const ScDocument& rDoc, SCTAB nTab, sal_Int32 nVal, SCROW& rStartRow )
+long SnapVertical( const ScDocument& rDoc, SCTAB nTab, long nVal, SCROW& rStartRow )
 {
     SCROW nRow = 0;
-    sal_Int32 nTwips = static_cast<sal_Int32>(nVal / HMM_PER_TWIPS);
-    sal_Int32 nSnap = 0;
+    long nTwips = static_cast<long>(nVal / HMM_PER_TWIPS);
+    long nSnap = 0;
 
     bool bFound = false;
     for (SCROW i = nRow; i <= MAXROW; ++i)
@@ -2159,7 +2159,7 @@ sal_Int32 SnapVertical( const ScDocument& rDoc, SCTAB nTab, sal_Int32 nVal, SCRO
         }
 
         nRow = i;
-        sal_Int32 nAdd = rDoc.GetRowHeight(i, nTab);
+        long nAdd = rDoc.GetRowHeight(i, nTab);
         if ( nSnap + nAdd/2 < nTwips || nRow < rStartRow )
         {
             nSnap += nAdd;
@@ -2174,7 +2174,7 @@ sal_Int32 SnapVertical( const ScDocument& rDoc, SCTAB nTab, sal_Int32 nVal, SCRO
     if (!bFound)
         nRow = MAXROW;  // all hidden down to the bottom
 
-    nVal = nSnap * HMM_PER_TWIPS;
+    nVal = static_cast<long>( nSnap * HMM_PER_TWIPS );
     rStartRow = nRow;
     return nVal;
 }
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index e08b18801609..8e3a28280e2a 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -86,15 +86,15 @@ void ScDocShell::SetVisAreaOrSize( const tools::Rectangle& rVisArea )
             //  Move the VisArea, otherwise only the upper left position would
             //  be changed in SnapVisArea, and the size would be wrong.
 
-            Point aNewPos( 0, std::max<sal_Int32>( aArea.Top(), 0 ) );
+            Point aNewPos( 0, std::max( aArea.Top(), long(0) ) );
             if ( bNegativePage )
             {
-                aNewPos.setX( std::min<sal_Int32>( aArea.Right(), 0 ) );
+                aNewPos.setX( std::min( aArea.Right(), long(0) ) );
                 lcl_SetTopRight( aArea, aNewPos );
             }
             else
             {
-                aNewPos.setX( std::max<sal_Int32>( aArea.Left(), 0 ) );
+                aNewPos.setX( std::max( aArea.Left(), long(0) ) );
                 aArea.SetPos( aNewPos );
             }
         }
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index b2146106f40e..6a46c87e47a5 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -709,13 +709,13 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
         tools::Rectangle aVis( Point(), GetOutputSizePixel() );
         if (bVertical)
         {
-            aVis.SetLeft( RECT_MIN );
-            aVis.SetRight( RECT_MAX );
+            aVis.SetLeft( LONG_MIN );
+            aVis.SetRight( LONG_MAX );
         }
         else
         {
-            aVis.SetTop( RECT_MIN );
-            aVis.SetBottom( RECT_MAX );
+            aVis.SetTop( LONG_MIN );
+            aVis.SetBottom( LONG_MAX );
         }
         pSelEngine->SetVisibleArea( aVis );
 
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 58316cf16907..7728f7fcfa3e 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -518,8 +518,8 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
 
     //  if no lines, still space for the outline frame (20 Twips = 1pt)
     //  (HasLines initializes aLines to 0,0,0,0)
-    nTwipsSizeX += aLines.Left() + std::max<sal_Int32>( aLines.Right(), 20 );
-    nTwipsSizeY += aLines.Top() +  std::max<sal_Int32>( aLines.Bottom(), 20 );
+    nTwipsSizeX += aLines.Left() + std::max( aLines.Right(), 20L );
+    nTwipsSizeY += aLines.Top() +  std::max( aLines.Bottom(), 20L );
 
     double nScaleX = static_cast<double>(nDevSizeX) / nTwipsSizeX;
     double nScaleY = static_cast<double>(nDevSizeY) / nTwipsSizeY;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 94c71db6ec69..41bd76e976ad 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2817,7 +2817,7 @@ void ScTabView::ActivatePart( ScSplitPos eWhich )
             pColBar[eNewH]->SetIgnoreMove(false);
             pHdrSelEng->SetWindow( pColBar[eNewH] );
             long nWidth = pColBar[eNewH]->GetOutputSizePixel().Width();
-            pHdrSelEng->SetVisibleArea( tools::Rectangle( 0, RECT_MIN, nWidth-1, RECT_MAX ) );
+            pHdrSelEng->SetVisibleArea( tools::Rectangle( 0, LONG_MIN, nWidth-1, LONG_MAX ) );
             pColBar[eNewH]->CaptureMouse();
         }
         if ( bLeftCap && pRowBar[eNewV] )
@@ -2826,7 +2826,7 @@ void ScTabView::ActivatePart( ScSplitPos eWhich )
             pRowBar[eNewV]->SetIgnoreMove(false);
             pHdrSelEng->SetWindow( pRowBar[eNewV] );
             long nHeight = pRowBar[eNewV]->GetOutputSizePixel().Height();
-            pHdrSelEng->SetVisibleArea( tools::Rectangle( RECT_MIN, 0, RECT_MAX, nHeight-1 ) );
+            pHdrSelEng->SetVisibleArea( tools::Rectangle( LONG_MIN, 0, LONG_MAX, nHeight-1 ) );
             pRowBar[eNewV]->CaptureMouse();
         }
         aHdrFunc.SetWhich(eWhich);
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 33c2e47e49f7..39129f2540a3 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1563,10 +1563,10 @@ void SdImportTest::testTdf103473()
     SdrTextObj *const pObj = dynamic_cast<SdrTextObj *const>(pPage->GetObj(0));
     CPPUNIT_ASSERT(pObj);
     ::tools::Rectangle aRect = pObj->GetGeoRect();
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(3629), aRect.Left());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(4431), aRect.Top());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(8353), aRect.Right());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(9155), aRect.Bottom());
+    CPPUNIT_ASSERT_EQUAL(3629L, aRect.Left());
+    CPPUNIT_ASSERT_EQUAL(4431L, aRect.Top());
+    CPPUNIT_ASSERT_EQUAL(8353L, aRect.Right());
+    CPPUNIT_ASSERT_EQUAL(9155L, aRect.Bottom());
 
     xDocShRef->DoClose();
 }
@@ -1905,8 +1905,8 @@ bool SdImportTest::checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeN
             ReadDIB(aBitmap, aBitmapStream, true);
         }
     }
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBitmap.GetSizePixel().Width());
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBitmap.GetSizePixel().Height());
+    CPPUNIT_ASSERT_EQUAL(8L, aBitmap.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL(8L, aBitmap.GetSizePixel().Height());
     return checkPatternValues(rExpected, aBitmap);
 }
 
@@ -2343,7 +2343,7 @@ void SdImportTest::testTdf114913()
     CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
     const SvxNumBulletItem *pItem = pTxtObj->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET);
     CPPUNIT_ASSERT(pItem);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(691), pItem->GetNumRule()->GetLevel(0).GetGraphicSize().getHeight());
+    CPPUNIT_ASSERT_EQUAL(long(691), pItem->GetNumRule()->GetLevel(0).GetGraphicSize().getHeight());
 
     xDocShRef->DoClose();
 }
diff --git a/sd/source/ui/slidesorter/view/SlsFramePainter.cxx b/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
index 6ad0831b7e49..07027c1d1e18 100644
--- a/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
@@ -182,7 +182,7 @@ void FramePainter::OffsetBitmap::PaintSide (
         {
             rDevice.DrawBitmapEx(
                 Point(nX,nY),
-                Size(std::min(aBitmapSize.Width(),nRight-nX+1),aBitmapSize.Height()),
+                Size(std::min(aBitmapSize.Width(),static_cast<long>(nRight-nX+1)),aBitmapSize.Height()),
                 maBitmap);
         }
     }
@@ -202,7 +202,7 @@ void FramePainter::OffsetBitmap::PaintSide (
         {
             rDevice.DrawBitmapEx(
                 Point(nX,nY),
-                Size(aBitmapSize.Width(), std::min(aBitmapSize.Height(), nBottom-nY+1)),
+                Size(aBitmapSize.Width(), std::min(aBitmapSize.Height(), static_cast<long>(nBottom-nY+1))),
                 maBitmap);
         }
     }
@@ -223,8 +223,8 @@ void FramePainter::OffsetBitmap::PaintCenter (
             rDevice.DrawBitmapEx(
                 Point(nX,nY),
                 Size(
-                    ::std::min<sal_Int32>(aBitmapSize.Width(), rBox.Right()-nX+1),
-                    std::min<sal_Int32>(aBitmapSize.Height(), rBox.Bottom()-nY+1)),
+                    ::std::min(aBitmapSize.Width(), rBox.Right()-nX+1),
+                    std::min(aBitmapSize.Height(), rBox.Bottom()-nY+1)),
                 maBitmap);
 }
 
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 7a34f2a80277..e5e48f13d411 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1030,10 +1030,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
         aAny <<= GetPage()->GetLowerBorder();
         break;
     case WID_PAGE_WIDTH:
-        aAny <<= GetPage()->GetSize().getWidth();
+        aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getWidth() );
         break;
     case WID_PAGE_HEIGHT:
-        aAny <<= GetPage()->GetSize().getHeight();
+        aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getHeight() );
         break;
     case WID_PAGE_ORIENT:
         aAny <<= view::PaperOrientation(
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 67c74771fc16..22dcf4538640 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -478,8 +478,8 @@ void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize, b
         aSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) );
         Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel(aObjSize, MapMode(MapUnit::Map100thMM));
         SfxViewShell::SetZoomFactor(
-            Fraction( aSize.Width(), std::max<sal_Int32>( aObjSizePixel.Width(), 1 ) ),
-            Fraction( aSize.Height(), std::max<sal_Int32>( aObjSizePixel.Height(), 1) ) );
+            Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), static_cast<long int>(1) ) ),
+            Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), static_cast<long int>(1)) ) );
     }
 
     mpImpl->ResizePixel(rOrigin, rSize, false);
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index af0b99c0a7f0..14f4fac32271 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -861,7 +861,7 @@ void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
     if( mpDrawView->IsTextEdit() )
     {
         Point aPnt1 = GetActiveWindow()->GetWinViewPos();
-        ::tools::Rectangle aMinMaxRect = ::tools::Rectangle( aPnt1, Size(RECT_MAX, RECT_MAX) );
+        ::tools::Rectangle aMinMaxRect = ::tools::Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
     }
     else
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index b08896abf358..ffaf3d3ab582 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -349,17 +349,17 @@ static OUString createHelpLinesString( const SdrHelpLineList& rHelpLines )
         {
             case SdrHelpLineKind::Point:
                 aLines.append( 'P' );
-                aLines.append( rPos.X() );
+                aLines.append( static_cast<sal_Int32>(rPos.X()) );
                 aLines.append( ',' );
-                aLines.append( rPos.Y() );
+                aLines.append( static_cast<sal_Int32>(rPos.Y()) );
                 break;
             case SdrHelpLineKind::Vertical:
                 aLines.append( 'V' );
-                aLines.append( rPos.X() );
+                aLines.append( static_cast<sal_Int32>(rPos.X()) );
                 break;
             case SdrHelpLineKind::Horizontal:
                 aLines.append( 'H' );
-                aLines.append( rPos.Y() );
+                aLines.append( static_cast<sal_Int32>(rPos.Y()) );
                 break;
             default:
                 OSL_FAIL( "Unsupported helpline Kind!" );
@@ -427,16 +427,16 @@ void FrameView::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert
     {
         const ::tools::Rectangle aVisArea = GetVisArea();
 
-        aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( aVisArea.Top() ) );
-        aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( aVisArea.Left() ) );
-        aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( aVisArea.GetWidth() ) );
-        aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( aVisArea.GetHeight() ) );
+        aUserData.addValue( sUNO_View_VisibleAreaTop, makeAny( static_cast<sal_Int32>(aVisArea.Top()) ) );
+        aUserData.addValue( sUNO_View_VisibleAreaLeft, makeAny( static_cast<sal_Int32>(aVisArea.Left()) ) );
+        aUserData.addValue( sUNO_View_VisibleAreaWidth, makeAny( static_cast<sal_Int32>(aVisArea.GetWidth()) ) );
+        aUserData.addValue( sUNO_View_VisibleAreaHeight, makeAny( static_cast<sal_Int32>(aVisArea.GetHeight()) ) );
     }
 
-    aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( GetGridCoarse().Width() ) );
-    aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( GetGridCoarse().Height() ) );
-    aUserData.addValue( sUNO_View_GridFineWidth, makeAny( GetGridFine().Width() ) );
-    aUserData.addValue( sUNO_View_GridFineHeight, makeAny( GetGridFine().Height() ) );
+    aUserData.addValue( sUNO_View_GridCoarseWidth, makeAny( static_cast<sal_Int32>(GetGridCoarse().Width()) ) );
+    aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( static_cast<sal_Int32>(GetGridCoarse().Height()) ) );
+    aUserData.addValue( sUNO_View_GridFineWidth, makeAny( static_cast<sal_Int32>(GetGridFine().Width()) ) );
+    aUserData.addValue( sUNO_View_GridFineHeight, makeAny( static_cast<sal_Int32>(GetGridFine().Height()) ) );
     aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( GetSnapGridWidthX().GetNumerator() ) );
     aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( GetSnapGridWidthX().GetDenominator() ) );
     aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( GetSnapGridWidthY().GetNumerator() ) );
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1458fed74c2b..47f5a4c09c77 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2086,7 +2086,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox()
 
 void SfxHelpTextWindow_Impl::SetOnStartupBoxPosition()
 {
-    long nX = std::max<sal_Int32>( GetOutputSizePixel().Width() - aOnStartupCB->GetSizePixel().Width(), nMinPos );
+    long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB->GetSizePixel().Width(), nMinPos );
     Point aPos = aOnStartupCB->GetPosPixel();
     aPos.setX( nX );
     aOnStartupCB->SetPosPixel( aPos );
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index fced99a75c0b..7d7fdb02ad98 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -361,12 +361,12 @@ uno::Any SAL_CALL IFrameObject::getPropertyValue(const OUString& aPropertyName)
     break;
     case WID_FRAME_MARGIN_WIDTH:
     {
-        aAny <<= maFrmDescr.GetMargin().Width();
+        aAny <<= static_cast<sal_Int32>(maFrmDescr.GetMargin().Width());
     }
     break;
     case WID_FRAME_MARGIN_HEIGHT:
     {
-        aAny <<= maFrmDescr.GetMargin().Height();
+        aAny <<= static_cast<sal_Int32>(maFrmDescr.GetMargin().Height());
     }
     break;
     default: ;
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 467f360fdddc..ba44d821371e 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -118,7 +118,7 @@ void SidebarToolBox::InsertItem(const OUString& rCommand,
 
     ToolBox::InsertItem(aCommand, rFrame, nBits, rRequestedSize, nPos);
 
-    CreateController(GetItemId(aCommand), rFrame, std::max<sal_Int32>(rRequestedSize.Width(), 0));
+    CreateController(GetItemId(aCommand), rFrame, std::max(rRequestedSize.Width(), 0L));
     RegisterHandlers();
 }
 
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 23420cd111aa..d7a52d82caa3 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -977,7 +977,7 @@ Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rTex
                 aLine = aLine.replaceAt(0, m, "");
                 aSize = GetTextLineSize(rDevice, aText);
                 aTextSize.AdjustHeight(aSize.Height() );
-                aTextSize.setWidth( std::max(aTextSize.Width(), std::min<sal_Int32>(aSize.Width(), MaxWidth)) );
+                aTextSize.setWidth( std::max(aTextSize.Width(), std::min(aSize.Width(), MaxWidth)) );
 
                 aLine = comphelper::string::stripStart(aLine, ' ');
                 aLine = comphelper::string::stripStart(aLine, '\t');
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 3f3f1d600c85..ee4326154038 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2034,8 +2034,8 @@ tools::Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId
     // assemble the Rectangle relative to DataWin
     return tools::Rectangle(
         Point( nColX + MIN_COLUMNWIDTH, nRowY ),
-        Size( (pCols[nCol]->Width() == RECT_MAX
-               ? RECT_MAX - (nColX + MIN_COLUMNWIDTH) : pCols[ nCol ]->Width() - 2*MIN_COLUMNWIDTH),
+        Size( (pCols[nCol]->Width() == LONG_MAX
+               ? LONG_MAX - (nColX + MIN_COLUMNWIDTH) : pCols[ nCol ]->Width() - 2*MIN_COLUMNWIDTH),
               GetDataRowHeight() - 1 ) );
 }
 
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index a26159073aac..89c3babea3c7 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -941,7 +941,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec
             if (nY <= aOverallAreaBRPos.Y())
                 _rOut.DrawLine( Point( nHLineX, nY ),
                                 Point( bVLines
-                                        ? std::min<sal_Int32>(aPos.X() - 1, aOverallAreaBRPos.X())
+                                        ? std::min(long(aPos.X() - 1), aOverallAreaBRPos.X())
                                         : aOverallAreaBRPos.X(),
                                       nY ) );
             _rOut.Pop();
@@ -1357,7 +1357,7 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt )
     // event occurred out of data area
     if ( rEvt.IsRight() )
         pDataWin->Command(
-            CommandEvent( Point( 1, RECT_MAX ), CommandEventId::ContextMenu, true ) );
+            CommandEvent( Point( 1, LONG_MAX ), CommandEventId::ContextMenu, true ) );
     else
         SetNoSelection();
 }
@@ -1392,7 +1392,7 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt )
                     pDataWin->HideTracking() ;
 
                     // check allowed width and new delta
-                    nDragX = std::max<sal_Int32>( rEvt.GetPosPixel().X(), nMinResizeX );
+                    nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX );
                     long nDeltaX = nDragX - nResizeX;
                     sal_uInt16 nId = GetColumnId(nResizeCol);
                     sal_uLong nOldWidth = GetColumnWidth(nId);
@@ -1422,7 +1422,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
         pDataWin->HideTracking();
 
         // width changed?
-        nDragX = std::max<sal_Int32>( rEvt.GetPosPixel().X(), nMinResizeX );
+        nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX );
         if ( (nDragX - nResizeX) != static_cast<long>(pCols[ nResizeCol ]->Width()) )
         {
             // resize column
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 12a4772af1cf..e43f634e36bd 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -507,7 +507,7 @@ void BrowseBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumn
     {
         const Range& rRange = pColumnSel->GetRange( nRange );
         // loop has to include aRange.Max()
-        for( sal_Int32 nCol = rRange.Min(); nCol <= rRange.Max(); ++nCol )
+        for( sal_Int32 nCol = rRange.Min(); nCol <= static_cast<sal_Int32>(rRange.Max()); ++nCol )
         {
             DBG_ASSERT( nIndex < nCount,
                 "GetAllSelectedColumns - range overflow" );
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index 4598b9f8af3c..881396dfa853 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -153,7 +153,7 @@ void BrowserColumn::Draw( BrowseBox const & rBox, OutputDevice& rDev, const Poin
     else
     {
         // paint data column
-        long nWidth = Width() == RECT_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width();
+        long nWidth = Width() == LONG_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width();
 
         rBox.DoPaintField( rDev,
             tools::Rectangle(
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index df71c7bcabad..12e574e345f9 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -386,10 +386,10 @@ public:
     const tools::Rectangle&    GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
     void                InvalidateBoundingRect( tools::Rectangle& rRect )
                         {
-                            rRect.SetRight(RECT_MAX);
+                            rRect.SetRight(LONG_MAX);
                             bBoundRectsDirty = true;
                         }
-    static bool         IsBoundingRectValid( const tools::Rectangle& rRect ) { return ( rRect.Right() != RECT_MAX ); }
+    static bool         IsBoundingRectValid( const tools::Rectangle& rRect ) { return ( rRect.Right() != LONG_MAX ); }
 
     void                PaintEmphasis(const tools::Rectangle& rRect1, bool bSelected,
                                       bool bDropTarget, bool bCursored, vcl::RenderContext& rRenderContext );
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 059948681d62..48c65c97deb6 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -289,7 +289,7 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t
     // If the UpdateMode is true, don't set all bounding rectangles to
     // 'to be checked', but only the bounding rectangle of the new entry.
     // Thus, don't call InvalidateBoundingRect!
-    pEntry->aRect.SetRight( RECT_MAX );
+    pEntry->aRect.SetRight( LONG_MAX );
     if( bUpdateMode )
     {
         FindBoundingRect( pEntry );
@@ -1859,7 +1859,7 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingWidth() const
     switch( nWinBits & VIEWMODE_MASK )
     {
         case WB_ICON:
-            nWidth = std::max<sal_Int32>( nStringWidth, aImageSize.Width() );
+            nWidth = std::max( nStringWidth, aImageSize.Width() );
             break;
 
         case WB_SMALLICON:
@@ -1887,7 +1887,7 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingHeight() const
 
         case WB_SMALLICON:
         case WB_DETAILS:
-            nHeight = std::max<sal_Int32>( aImageSize.Height(), nStringHeight );
+            nHeight = std::max( aImageSize.Height(), nStringHeight );
             break;
     }
     if( nHeight > nMaxBoundHeight )
@@ -2349,7 +2349,7 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcMaxTextRect( const SvxIconChoiceCtr
         if( aBoundRect.Left() > aBoundRect.Right())
             aBoundRect.SetLeft( aBoundRect.Right() );
         if( pEntry->GetTextMode() == SvxIconChoiceCtrlTextMode::Full )
-            aBoundRect.SetBottom( RECT_MAX );
+            aBoundRect.SetBottom( LONG_MAX );
     }
     else
     {
@@ -3267,7 +3267,7 @@ bool SvxIconChoiceCtrl_Impl::RequestHelp( const HelpEvent& rHEvt )
         return false;
 
     tools::Rectangle aOptTextRect( aTextRect );
-    aOptTextRect.SetBottom( RECT_MAX );
+    aOptTextRect.SetBottom( LONG_MAX );
     DrawTextFlags nNewFlags = nCurTextDrawFlags;
     nNewFlags &= ~DrawTextFlags( DrawTextFlags::Clip | DrawTextFlags::EndEllipsis );
     aOptTextRect = pView->GetTextRect( aOptTextRect, aEntryText, nNewFlags );
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index c8771a383b25..49ac834eecac 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3159,7 +3159,7 @@ Size SvTreeListBox::GetOptimalSize() const
         aRet.AdjustHeight(rStyleSettings.GetBorderSize() * 2 );
     }
     long nMinWidth = nMinWidthInChars * approximate_char_width();
-    aRet.setWidth( std::max<sal_Int32>(aRet.Width(), nMinWidth) );
+    aRet.setWidth( std::max(aRet.Width(), nMinWidth) );
     return aRet;
 }
 
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 918b6984845e..82cd893e9710 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -415,7 +415,7 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
     //line within that
     long nMinWidth = GetTextWidth("----------");
     Size aSize = CalcSubEditSize();
-    aSize.setWidth( std::max<sal_Int32>(nMinWidth, aSize.Width()) );
+    aSize.setWidth( std::max(nMinWidth, aSize.Width()) );
     aSize.AdjustWidth( -(aTxtSize.Width()) );
     aSize.AdjustWidth( -6 );
     aSize.setHeight( aTxtSize.Height() );
diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx
index 9b3eb3e95749..16b90aedd764 100644
--- a/svtools/source/control/scriptedtext.cxx
+++ b/svtools/source/control/scriptedtext.cxx
@@ -138,11 +138,11 @@ void SvtScriptedTextHelper_Impl::CalculateSizes()
 
     // calculate maximum font height
     SetOutDevFont( i18n::ScriptType::LATIN );
-    maTextSize.setHeight( std::max<sal_Int32>( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
+    maTextSize.setHeight( std::max( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
     SetOutDevFont( i18n::ScriptType::ASIAN );
-    maTextSize.setHeight( std::max<sal_Int32>( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
+    maTextSize.setHeight( std::max( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
     SetOutDevFont( i18n::ScriptType::COMPLEX );
-    maTextSize.setHeight( std::max<sal_Int32>( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
+    maTextSize.setHeight( std::max( maTextSize.Height(), mrOutDevice.GetTextHeight() ) );
 
     mrOutDevice.Pop();
 }
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 048208233b97..dd94ed5fd8f3 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -541,7 +541,7 @@ static long ImplGetNativeCheckAndRadioSize(vcl::RenderContext const & rRenderCon
         )
         {
             rRadioHeight = aNativeBounds.GetHeight();
-            rMaxWidth = std::max<sal_Int32>(rMaxWidth, aNativeContent.GetWidth());
+            rMaxWidth = std::max (rMaxWidth, aNativeContent.GetWidth());
         }
     }
     return std::max(rCheckHeight, rRadioHeight);
@@ -570,7 +570,7 @@ Size ToolbarMenu::implCalcSize()
             if( pEntry && pEntry->mbHasImage )
             {
                 Size aImgSz( pEntry->maImage.GetSizePixel() );
-                nMinMenuItemHeight = std::max<sal_Int32>( nMinMenuItemHeight, aImgSz.Height() + 6 );
+                nMinMenuItemHeight = std::max( nMinMenuItemHeight, aImgSz.Height() + 6 );
                 aMaxImgSz.setWidth( std::max( aMaxImgSz.Width(), aImgSz.Width() ) );
             }
         }
@@ -604,7 +604,7 @@ Size ToolbarMenu::implCalcSize()
             {
                 Size aControlSize( pEntry->mpControl->GetOutputSizePixel() );
 
-                nMaxTextWidth = std::max<sal_Int32>( aControlSize.Width(), nMaxTextWidth );
+                nMaxTextWidth = std::max( aControlSize.Width(), nMaxTextWidth );
                 pEntry->maSize.setHeight( aControlSize.Height() + 1 );
             }
 
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 85823fd25e5b..54d7e3bbbf02 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2244,7 +2244,7 @@ Size ValueSet::GetLargestItemSize()
         {
             aSize.AdjustHeight(3 * NAME_LINE_HEIGHT +
                 maVirDev->GetTextHeight() );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list