avmedia/source/viewer/mediawindow_impl.cxx | 2 - canvas/source/directx/dx_textlayout_drawhelper.cxx | 2 - canvas/source/opengl/ogl_canvashelper.cxx | 2 - compilerplugins/clang/toolslong.cxx | 15 +++++++ cppcanvas/source/mtfrenderer/implrenderer.cxx | 10 ++--- cui/source/dialogs/cuigrfflt.cxx | 4 +- desktop/source/lib/init.cxx | 8 ++-- editeng/source/editeng/impedit3.cxx | 10 ++--- editeng/source/outliner/outliner.cxx | 2 - emfio/source/reader/emfreader.cxx | 6 +-- emfio/source/reader/mtftools.cxx | 2 - emfio/source/reader/wmfreader.cxx | 10 ++--- filter/source/graphicfilter/idxf/dxf2mtf.cxx | 2 - filter/source/graphicfilter/ieps/ieps.cxx | 4 +- filter/source/graphicfilter/itiff/itiff.cxx | 6 +-- filter/source/svg/svgwriter.cxx | 4 +- include/svtools/unitconv.hxx | 2 - include/tools/bigint.hxx | 4 +- include/tools/fract.hxx | 2 - include/tools/gen.hxx | 3 + include/tools/long.hxx | 12 +++--- include/vcl/bitmap.hxx | 2 - include/vcl/devicecoordinate.hxx | 3 + include/vcl/metaact.hxx | 2 - include/vcl/salgtype.hxx | 6 +-- reportdesign/source/core/sdr/RptObject.cxx | 2 - sc/source/core/data/fillinfo.cxx | 8 ++-- sc/source/filter/excel/xltools.cxx | 2 - sd/source/core/drawdoc2.cxx | 4 +- sd/source/ui/dlg/vectdlg.cxx | 2 - sd/source/ui/view/drviews3.cxx | 10 ++--- sfx2/source/sidebar/SidebarToolBox.cxx | 2 - starmath/source/accessibility.cxx | 4 +- svl/source/svdde/ddecli.cxx | 12 +++--- svl/source/svdde/ddedata.cxx | 4 +- svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 4 +- svx/source/dialog/_bmpmask.cxx | 24 ++++++------ svx/source/dialog/pagectrl.cxx | 4 +- svx/source/dialog/swframeexample.cxx | 6 +-- svx/source/gallery2/gallerybinaryengine.cxx | 2 - svx/source/gallery2/galobj.cxx | 4 +- sw/inc/swrect.hxx | 4 +- sw/source/core/doc/doccomp.cxx | 4 +- sw/source/core/doc/notxtfrm.cxx | 2 - sw/source/core/docnode/ndtbl1.cxx | 2 - sw/source/core/frmedt/tblsel.cxx | 2 - sw/source/core/inc/frame.hxx | 4 +- sw/source/core/inc/frmtool.hxx | 2 - sw/source/core/layout/anchoredobject.cxx | 4 +- sw/source/core/layout/flowfrm.cxx | 8 ++-- sw/source/core/layout/fly.cxx | 8 ++-- sw/source/core/layout/frmtool.cxx | 2 - sw/source/core/layout/ftnfrm.cxx | 6 +-- sw/source/core/layout/hffrm.cxx | 2 - sw/source/core/layout/pagechg.cxx | 4 +- sw/source/core/layout/paintfrm.cxx | 22 +++++------ sw/source/core/layout/tabfrm.cxx | 30 +++++++-------- sw/source/core/layout/wsfrm.cxx | 4 +- sw/source/core/text/frmcrsr.cxx | 8 ++-- sw/source/core/text/itrform2.cxx | 8 ++-- sw/source/core/text/itrpaint.cxx | 2 - sw/source/core/text/txtfly.cxx | 2 - sw/source/core/text/txtfrm.cxx | 2 - sw/source/core/txtnode/fntcache.cxx | 24 ++++++------ sw/source/core/view/pagepreviewlayout.cxx | 6 +-- sw/source/core/view/viewsh.cxx | 8 ++-- sw/source/filter/html/swhtml.cxx | 2 - sw/source/filter/ww8/docxsdrexport.cxx | 6 ++- sw/source/filter/ww8/wrtw8esh.cxx | 2 - sw/source/filter/ww8/ww8par6.cxx | 2 - sw/source/ui/envelp/labfmt.cxx | 12 +++--- sw/source/ui/frmdlg/column.cxx | 8 ++-- sw/source/uibase/app/appenv.cxx | 8 ++-- sw/source/uibase/docvw/edtwin.cxx | 2 - sw/source/uibase/inc/wrtsh.hxx | 2 - sw/source/uibase/table/tablemgr.cxx | 2 - sw/source/uibase/uiview/viewport.cxx | 12 +++--- sw/source/uibase/uiview/viewtab.cxx | 4 +- toolkit/source/awt/vclxfont.cxx | 2 - toolkit/source/awt/vclxgraphics.cxx | 2 - toolkit/source/awt/vclxspinbutton.cxx | 2 - tools/source/generic/color.cxx | 18 ++++----- vcl/inc/bitmap/impoctree.hxx | 5 +- vcl/inc/win/salframe.h | 12 +++--- vcl/inc/win/salgdi.h | 32 ++++++++-------- vcl/inc/win/salinst.h | 2 - vcl/inc/win/salobj.h | 4 +- vcl/inc/win/salprn.h | 2 - vcl/inc/win/salvd.h | 14 +++---- vcl/opengl/gdiimpl.cxx | 8 ++-- vcl/skia/gdiimpl.cxx | 5 +- vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx | 6 +-- vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 3 + vcl/source/bitmap/BitmapFilterStackBlur.cxx | 2 - vcl/source/bitmap/BitmapSobelGreyFilter.cxx | 3 + vcl/source/control/edit.cxx | 16 ++++---- vcl/source/filter/jpeg/JpegReader.cxx | 2 - vcl/source/filter/wmf/emfwr.cxx | 6 +-- vcl/source/filter/wmf/wmfwr.cxx | 2 - vcl/source/gdi/bitmap3.cxx | 8 ++-- vcl/source/gdi/gdimtf.cxx | 12 +++--- vcl/source/gdi/impvect.cxx | 4 +- vcl/source/gdi/impvect.hxx | 2 - vcl/source/gdi/metaact.cxx | 6 +-- vcl/source/gdi/print.cxx | 2 - vcl/source/gdi/sallayout.cxx | 2 - vcl/source/gdi/salmisc.cxx | 8 ++-- vcl/source/gdi/svmconverter.cxx | 6 +-- vcl/source/gdi/textlayout.cxx | 2 - vcl/source/graphic/GraphicObject.cxx | 4 +- vcl/source/outdev/bitmap.cxx | 26 ++++++------- vcl/source/outdev/gradient.cxx | 4 +- vcl/source/outdev/hatch.cxx | 2 - vcl/source/outdev/map.cxx | 4 +- vcl/source/outdev/rect.cxx | 4 +- vcl/source/outdev/text.cxx | 6 +-- vcl/source/window/menu.cxx | 4 +- vcl/source/window/splitwin.cxx | 2 - vcl/source/window/syswin.cxx | 8 ++-- vcl/win/gdi/gdiimpl.cxx | 28 +++++++------- vcl/win/gdi/gdiimpl.hxx | 32 ++++++++-------- vcl/win/gdi/salfont.cxx | 4 +- vcl/win/gdi/salgdi.cxx | 12 +++--- vcl/win/gdi/salgdi2.cxx | 16 ++++---- vcl/win/gdi/salprn.cxx | 2 - vcl/win/gdi/salvd.cxx | 8 ++-- vcl/win/window/salframe.cxx | 26 ++++++------- vcl/win/window/salobj.cxx | 8 ++-- vcl/workben/vcldemo.cxx | 2 - writerperfect/inc/DirectoryStream.hxx | 4 +- writerperfect/inc/WPXSvInputStream.hxx | 4 +- writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 4 +- writerperfect/source/common/DirectoryStream.cxx | 4 +- writerperfect/source/common/WPXSvInputStream.cxx | 4 +- 134 files changed, 450 insertions(+), 423 deletions(-)
New commits: commit 3d90997fb6f232d8008df4d166d7b97b869c200f Author: Noel Grandin <n...@peralex.com> AuthorDate: Wed Oct 28 08:30:36 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 11 06:34:17 2020 +0100 make tools::Long 64-bit on Windows platform This is only for the 64-bit windows platform. I don't see the point in messing with the 32-bit platforms, they are (a) become more and more rare (b) unlikely to even have enough available process memory to load extremely large calc spreadsheets The primary problem we are addressing here is bringing Windows-64bit up to same capability as Linux-64bit when it comes to handling very large spreadsheets, which is caused by things like tools::Rectangle using "long", which means that all the work done to make Libreoffice on 64-bit Linux capable of loading large spreadsheets is useless on Windows, where long is 32-bit. The operator<< for tools::Rectangle needs to be inside the tools namespace because of an interaction with the cppunit printing template stuff that I don't understand. SalPoint changed to use sal_Int32, since it needs to be the same definition as the Windows POINT structure. Change-Id: Iab6f1af88847b6c8d46995e8ceda3f82b6722ff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 914635588f4c..01c25c291ec5 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -511,7 +511,7 @@ void MediaWindowImpl::Resize() if (mpMediaWindowControl) { const sal_Int32 nControlHeight = mpMediaWindowControl->GetSizePixel().Height(); - const sal_Int32 nControlY = std::max(aCurSize.Height() - nControlHeight - nOffset, 0L); + const sal_Int32 nControlY = std::max(aCurSize.Height() - nControlHeight - nOffset, tools::Long(0)); aPlayerWindowSize.setHeight( nControlY - (nOffset << 1) ); mpMediaWindowControl->SetPosSizePixel(Point(nOffset, nControlY ), Size(aCurSize.Width() - (nOffset << 1), nControlHeight)); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index ea628079e7ff..312b72983b67 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -206,7 +206,7 @@ namespace dxcanvas { // create the DXArray const sal_Int32 nLen( rLogicalAdvancements.getLength() ); - std::unique_ptr<sal_Int32[]> pDXArray( new sal_Int32[nLen] ); + std::unique_ptr<::tools::Long[]> pDXArray( new ::tools::Long[nLen] ); for( sal_Int32 i=0; i<nLen; ++i ) pDXArray[i] = basegfx::fround( rLogicalAdvancements[i] ); diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index 6dcf933f0723..d64e1ba1d7f0 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -729,7 +729,7 @@ namespace oglcanvas { // create the DXArray const sal_Int32 nLen( aLogicalAdvancements.getLength() ); - std::unique_ptr<long[]> pDXArray( new long[nLen] ); + std::unique_ptr<tools::Long[]> pDXArray( new tools::Long[nLen] ); for( sal_Int32 i=0; i<nLen; ++i ) pDXArray[i] = basegfx::fround( aLogicalAdvancements[i] ); diff --git a/compilerplugins/clang/toolslong.cxx b/compilerplugins/clang/toolslong.cxx index b0d6a78d35ab..96c2716bd827 100644 --- a/compilerplugins/clang/toolslong.cxx +++ b/compilerplugins/clang/toolslong.cxx @@ -145,6 +145,18 @@ void ToolsLong::run() if (loplugin::isSamePathname(fn, SRCDIR "/pyuno/source/module/pyuno.cxx") || loplugin::isSamePathname(fn, SRCDIR "/ucb/source/ucp/webdav-neon/NeonSession.cxx")) return; + // these are places where the external API is actually "long" + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/filter/jpeg/JpegReader.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/writerperfect/source/common/DirectoryStream.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/writerperfect/source/common/WPXSvInputStream.cxx")) + return; + if (loplugin::isSamePathname(fn, + SRCDIR "/writerperfect/source/calc/MSWorksCalcImportFilter.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/desktop/source/lib/init.cxx")) + return; TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); @@ -453,6 +465,9 @@ bool ToolsLong::VisitParmVarDecl(ParmVarDecl const* decl) FunctionDecl const* f = dyn_cast<FunctionDecl>(decl->getDeclContext()); if (f) // e.g.: typedef sal_Bool (* FuncPtr )( sal_Bool ); { + // ignore the function in include/test/cppunitasserthelper.hxx + if (f->getIdentifier() && f->getName() == "assertEquals") + return true; auto canonicalF = f->getCanonicalDecl(); if (canonicalF->isDeletedAsWritten() && isa<CXXConversionDecl>(canonicalF)) return true; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index c16534e3dda1..eea91a021e6b 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -995,7 +995,7 @@ namespace cppcanvas::internal { ::tools::Long nInterval = ( nWidth - nStrikeoutWidth * nLen ) / nLen; nStrikeoutWidth += nInterval; - ::tools::Long* pStrikeoutCharWidths = new long[nLen]; + ::tools::Long* pStrikeoutCharWidths = new ::tools::Long[nLen]; for ( int i = 0;i<nLen; i++) { @@ -1589,8 +1589,8 @@ namespace cppcanvas::internal // least one dimension // Remark the 1L cannot be replaced, that would cause max to compare long/int - const Size aMtfSizePix( std::max( aMtfSizePixPre.Width(), 1L ), - std::max( aMtfSizePixPre.Height(), 1L ) ); + const Size aMtfSizePix( std::max( aMtfSizePixPre.Width(), ::tools::Long(1) ), + std::max( aMtfSizePixPre.Height(), ::tools::Long(1) ) ); // Setup local transform, such that the // metafile renders itself into the given @@ -2885,8 +2885,8 @@ namespace cppcanvas::internal // #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( aMtfSizePixPre.Width(), 1L ), - std::max( aMtfSizePixPre.Height(), 1L ) ); + const Size aMtfSizePix( std::max( aMtfSizePixPre.Width(), ::tools::Long(1) ), + std::max( aMtfSizePixPre.Height(), ::tools::Long(1) ) ); sal_Int32 nCurrActions(0); ActionFactoryParameters aParms(aStateStack, diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index c949bf61e0ac..2e162b4b3f4a 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -191,8 +191,8 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, Graphic aRet; tools::Long nTileWidth = static_cast<tools::Long>(mxMtrWidth->get_value(FieldUnit::PIXEL)); tools::Long nTileHeight = static_cast<tools::Long>(mxMtrHeight->get_value(FieldUnit::PIXEL)); - const Size aSize( std::max( FRound( nTileWidth * fScaleX ), 1L ), - std::max( FRound( nTileHeight * fScaleY ), 1L ) ); + const Size aSize( std::max( FRound( nTileWidth * fScaleX ), tools::Long(1) ), + std::max( FRound( nTileHeight * fScaleY ), tools::Long(1) ) ); if( rGraphic.IsAnimated() ) { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 94e34cf9dca5..8eacd7e270ce 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1037,8 +1037,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, const int nTileWidth, const int nTileHeight); static int doc_getTileMode(LibreOfficeKitDocument* pThis); static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, - tools::Long* pWidth, - tools::Long* pHeight); + long* pWidth, + long* pHeight); static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, const char* pArguments); @@ -3315,8 +3315,8 @@ static int doc_getTileMode(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis* } static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, - tools::Long* pWidth, - tools::Long* pHeight) + long* pWidth, + long* pHeight) { comphelper::ProfileZone aZone("doc_getDocumentSize"); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 2925183e9cf7..fb70bf4b1844 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -759,7 +759,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) ImplInitLayoutMode( GetRefDevice(), nPara, nIndex ); - std::unique_ptr<long[]> pBuf(new long[ pNode->Len() ]); + std::unique_ptr<tools::Long[]> pBuf(new tools::Long[ pNode->Len() ]); bool bSameLineAgain = false; // For TextRanger, if the height changes. TabInfo aCurrentTab; @@ -1050,7 +1050,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) OUString aFieldValue = static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue(); // get size, but also DXArray to allow length information in line breaking below const sal_Int32 nLength(aFieldValue.getLength()); - std::unique_ptr<long[]> pTmpDXArray(new long[nLength]); + std::unique_ptr<tools::Long[]> pTmpDXArray(new tools::Long[nLength]); pPortion->GetSize() = aTmpFont.QuickGetTextSize(GetRefDevice(), aFieldValue, 0, aFieldValue.getLength(), pTmpDXArray.get()); // So no scrolling for oversized fields @@ -3176,7 +3176,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po sal_Int32 nTextStart = 0; sal_Int32 nTextLen = 0; const tools::Long* pDXArray = nullptr; - std::unique_ptr<long[]> pTmpDXArray; + std::unique_ptr<tools::Long[]> pTmpDXArray; if ( rTextPortion.GetKind() == PortionKind::TEXT ) { @@ -3363,7 +3363,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po } } - pTmpDXArray.reset(new long[ aText.getLength() ]); + pTmpDXArray.reset(new tools::Long[ aText.getLength() ]); pDXArray = pTmpDXArray.get(); aTmpFont.SetPhysFont( GetRefDevice() ); aTmpFont.QuickGetTextSize( GetRefDevice(), aText, nTextStart, nTextLen, pTmpDXArray.get() ); @@ -3390,7 +3390,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po nTextLen = aText.getLength(); // crash when accessing 0 pointer in pDXArray - pTmpDXArray.reset(new long[ aText.getLength() ]); + pTmpDXArray.reset(new tools::Long[ aText.getLength() ]); pDXArray = pTmpDXArray.get(); aTmpFont.SetPhysFont( GetRefDevice() ); aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.getLength(), pTmpDXArray.get() ); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 73c62414bd53..d6f1301a8424 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -976,7 +976,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, if(bStrippingPortions) { const vcl::Font& aSvxFont(pOutDev->GetFont()); - std::unique_ptr<long[]> pBuf(new long[ pPara->GetText().getLength() ]); + std::unique_ptr<tools::Long[]> pBuf(new tools::Long[ pPara->GetText().getLength() ]); pOutDev->GetTextArray( pPara->GetText(), pBuf.get() ); if(bSymbol) diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 5f396bf2244a..8114584ba61f 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -1821,17 +1821,17 @@ namespace emfio SAL_INFO("emfio", "\t\tText: " << aText); SAL_INFO("emfio", "\t\tDxBuffer:"); - std::unique_ptr<long[]> pDXAry, pDYAry; + std::unique_ptr<tools::Long[]> pDXAry, pDYAry; sal_Int32 nDxSize; bool bOverflow = o3tl::checked_multiply<sal_Int32>(nLen, (nOptions & ETO_PDY) ? 8 : 4, nDxSize); if (!bOverflow && offDx && ((nCurPos + offDx + nDxSize) <= nNextPos ) && nNextPos <= mnEndPos) { mpInputStream->Seek( nCurPos + offDx ); - pDXAry.reset( new long[aText.getLength()] ); + pDXAry.reset( new tools::Long[aText.getLength()] ); if (nOptions & ETO_PDY) { - pDYAry.reset( new long[aText.getLength()] ); + pDYAry.reset( new tools::Long[aText.getLength()] ); } for (sal_Int32 i = 0; i < aText.getLength(); ++i) diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 7cd1ff58093d..4b12f38675ce 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -1595,7 +1595,7 @@ namespace emfio // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading SolarMutexGuard aGuard; ScopedVclPtrInstance< VirtualDevice > pVDev; - pDX = new long[ rText.getLength() ]; + pDX = new tools::Long[ rText.getLength() ]; pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); pVDev->SetFont( maLatestFont ); pVDev->GetTextArray( rText, pDX, 0, rText.getLength()); diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 155a74bec48b..1473930e83ec 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -609,7 +609,7 @@ namespace emfio // dxAry will not fit if ( nNewTextLen ) { - std::unique_ptr<long[]> pDXAry, pDYAry; + std::unique_ptr<tools::Long[]> pDXAry, pDYAry; auto nDxArySize = nMaxStreamPos - mpInputStream->Tell(); auto nDxAryEntries = nDxArySize >> 1; bool bUseDXAry = false; @@ -617,10 +617,10 @@ namespace emfio if ( ( ( nDxAryEntries % nOriginalTextLen ) == 0 ) && ( nNewTextLen <= nOriginalTextLen ) ) { sal_Int32 i; // needed just outside the for - pDXAry.reset(new long[ nNewTextLen ]); + pDXAry.reset(new tools::Long[ nNewTextLen ]); if ( nOptions & ETO_PDY ) { - pDYAry.reset(new long[ nNewTextLen ]); + pDYAry.reset(new tools::Long[ nNewTextLen ]); } for (i = 0; i < nNewTextLen; i++ ) { @@ -1109,7 +1109,7 @@ namespace emfio { Point aPt; sal_uInt32 nStringLen, nDXCount; - std::unique_ptr<long[]> pDXAry; + std::unique_ptr<tools::Long[]> pDXAry; SvMemoryStream aMemoryStream( nEscLen ); aMemoryStream.WriteBytes(pData.get(), nEscLen); aMemoryStream.Seek( STREAM_SEEK_TO_BEGIN ); @@ -1127,7 +1127,7 @@ namespace emfio if ( ( static_cast< sal_uInt64 >( nDXCount ) * sizeof( sal_Int32 ) ) >= ( nEscLen - aMemoryStream.Tell() ) ) nDXCount = 0; if ( nDXCount ) - pDXAry.reset(new long[ nDXCount ]); + pDXAry.reset(new tools::Long[ nDXCount ]); for (sal_uInt32 i = 0; i < nDXCount; i++ ) { sal_Int32 val; diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index 4b8de3428759..9ff520167e79 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -643,7 +643,7 @@ void DXF2GDIMetaFile::Draw3DFaceEntity(const DXF3DFaceEntity & rE, const DXFTran if ((rE.nIEFlags&0x0f)==0) pVirDev->DrawPolygon(aPoly); else { for (i=0; i<nN; i++) { - if ( (rE.nIEFlags & (1<<i)) == 0 ) { + if ( (rE.nIEFlags & (static_cast<tools::Long>(1)<<i)) == 0 ) { DrawLine(aPoly[i],aPoly[(i+1)%nN]); } } diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 0873bf9cff75..2c67a6effa3c 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -779,9 +779,9 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) bool bFail = nSecurityCount == 0; tools::Long nWidth(0), nHeight(0); if (!bFail) - bFail = o3tl::checked_sub(nNumb[2], nNumb[0], nWidth) || o3tl::checked_add(nWidth, 1L, nWidth); + bFail = o3tl::checked_sub(nNumb[2], nNumb[0], nWidth) || o3tl::checked_add(nWidth, tools::Long(1), nWidth); if (!bFail) - bFail = o3tl::checked_sub(nNumb[3], nNumb[1], nHeight) || o3tl::checked_add(nHeight, 1L, nHeight); + bFail = o3tl::checked_sub(nNumb[3], nNumb[1], nHeight) || o3tl::checked_add(nHeight, tools::Long(1), nHeight); if (!bFail && nWidth > 0 && nHeight > 0) { GDIMetaFile aMtf; diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 370371ece4fe..061d1a0ac73b 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -981,11 +981,11 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) } } const tools::Long nBlack = nSamp[ 3 ]; - nRed = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 0 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * + nRed = static_cast<sal_uInt8>(std::max<sal_Int32>( 0, 255 - ( ( static_cast<sal_Int32>(nSamp[ 0 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); - nGreen = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 1 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * + nGreen = static_cast<sal_uInt8>(std::max<sal_Int32>( 0, 255 - ( ( static_cast<sal_Int32>(nSamp[ 1 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); - nBlue = static_cast<sal_uInt8>(std::max( 0L, 255L - ( ( static_cast<sal_Int32>(nSamp[ 2 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * + nBlue = static_cast<sal_uInt8>(std::max<sal_Int32>( 0, 255 - ( ( static_cast<sal_Int32>(nSamp[ 2 ]) + nBlack - static_cast<sal_Int32>(nMinSampleValue << 1U ) ) * 255L/static_cast<sal_Int32>(nMaxSampleValue-nMinSampleValue) ) )); SetPixel(nY, nx, Color(static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue))); } diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 7d5ac70e1a0c..02de5a40e649 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -2583,12 +2583,12 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, ImplMap( rPos, aPos ); - std::unique_ptr<long[]> xTmpArray(new long[nLen]); + std::unique_ptr<tools::Long[]> xTmpArray(new tools::Long[nLen]); // get text sizes if( pDXArray ) { aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 ); - memcpy(xTmpArray.get(), pDXArray, nLen * sizeof(long)); + memcpy(xTmpArray.get(), pDXArray, nLen * sizeof(tools::Long)); } else { diff --git a/include/svtools/unitconv.hxx b/include/svtools/unitconv.hxx index d269037578ac..f763ac0743c2 100644 --- a/include/svtools/unitconv.hxx +++ b/include/svtools/unitconv.hxx @@ -30,7 +30,7 @@ namespace weld { class MetricSpinButton; } // typedef --------------------------------------------------------------- -typedef long (*FUNC_CONVERT)(tools::Long); +typedef tools::Long (*FUNC_CONVERT)(tools::Long); // Functions ------------------------------------------------------------- diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx index f80d64fe87c3..de03339f041d 100644 --- a/include/tools/bigint.hxx +++ b/include/tools/bigint.hxx @@ -88,7 +88,7 @@ public: operator sal_Int32() const; operator sal_uInt32() const; operator double() const; -#if SAL_TYPES_SIZEOFLONG == 8 +#if SAL_TYPES_SIZEOFPOINTER == 8 operator tools::Long() const; #endif @@ -156,7 +156,7 @@ inline BigInt::operator sal_uInt32() const return 0; } -#if SAL_TYPES_SIZEOFLONG == 8 +#if SAL_TYPES_SIZEOFPOINTER == 8 inline BigInt::operator tools::Long() const { // Clamp to int32 since long is int32 on Windows. diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx index 79f5b525aed4..c37859d7c17a 100644 --- a/include/tools/fract.hxx +++ b/include/tools/fract.hxx @@ -53,7 +53,7 @@ public: sal_Int32 GetDenominator() const; explicit operator sal_Int32() const; -#if SAL_TYPES_SIZEOFLONG == 8 +#if SAL_TYPES_SIZEOFPOINTER == 8 explicit operator ::tools::Long() const { return sal_Int32(*this); } #endif explicit operator double() const; diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 1198b8dbaab4..13372a916d76 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -724,6 +724,8 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) } } +namespace tools +{ template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( std::basic_ostream<charT, traits> & stream, const tools::Rectangle& rectangle ) @@ -734,6 +736,7 @@ inline std::basic_ostream<charT, traits> & operator <<( return stream << rectangle.getWidth() << 'x' << rectangle.getHeight() << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")"; } +} #endif diff --git a/include/tools/long.hxx b/include/tools/long.hxx index 0a633e0f23cc..ceda30676913 100644 --- a/include/tools/long.hxx +++ b/include/tools/long.hxx @@ -23,11 +23,13 @@ */ namespace tools { -typedef long Long; -typedef unsigned long ULong; -// stage 3: -//typedef sal_Int64 Long; -//typedef sal_uInt64 ULong; +#if SAL_TYPES_SIZEOFPOINTER == 8 +typedef sal_Int64 Long; +typedef sal_uInt64 ULong; +#else +typedef sal_Int32 Long; +typedef sal_uInt32 ULong; +#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 74d3a2e11724..b995111f16a4 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -466,7 +466,7 @@ public: void Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, - const Link<long,void>* pProgress ); + const Link<tools::Long,void>* pProgress ); /** Change various global color characteristics diff --git a/include/vcl/devicecoordinate.hxx b/include/vcl/devicecoordinate.hxx index 14e43b22c024..0d5eeb6aeb28 100644 --- a/include/vcl/devicecoordinate.hxx +++ b/include/vcl/devicecoordinate.hxx @@ -11,6 +11,7 @@ #define INCLUDED_VCL_DEVICE_COORDINATE_HXX #include <config_vcl.h> +#include <tools/long.hxx> #if VCL_FLOAT_DEVICE_PIXEL #include <basegfx/point/b2dpoint.hxx> @@ -19,7 +20,7 @@ typedef double DeviceCoordinate; #else /* !VCL_FLOAT_DEVICE_PIXEL */ #include <basegfx/point/b2ipoint.hxx> -typedef long DeviceCoordinate; +typedef tools::Long DeviceCoordinate; #endif /* ! Carpet Cushion */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 52c1bf7d935d..600afe9b6790 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -503,7 +503,7 @@ private: Point maStartPt; OUString maStr; - std::unique_ptr<long[]> + std::unique_ptr<tools::Long[]> mpDXAry; sal_Int32 mnIndex; sal_Int32 mnLen; diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx index 720c4c1d8255..d19bf776a31f 100644 --- a/include/vcl/salgtype.hxx +++ b/include/vcl/salgtype.hxx @@ -36,11 +36,11 @@ enum class DeviceFormat { constexpr ::Color SALCOLOR_NONE ( 0xFF, 0xFF, 0xFF, 0xFF ); -// must equal to class Point +// must equal to the Windows POINT type, which is why we use sal_Int32 struct SalPoint { - tools::Long mnX; - tools::Long mnY; + sal_Int32 mnX; + sal_Int32 mnY; }; typedef const SalPoint* PCONSTSALPOINT; diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 427bf45aa16a..0486c787fc2f 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -390,7 +390,7 @@ void OObjectBase::SetPropsFromRect(const tools::Rectangle& _rRect) { const uno::Reference<report::XSection>& xSection = pPage->getSection(); assert(_rRect.getHeight() >= 0); - const sal_uInt32 newHeight( ::std::max(0l, _rRect.getHeight()+_rRect.Top()) ); + const sal_uInt32 newHeight( ::std::max(tools::Long(0), _rRect.getHeight()+_rRect.Top()) ); if ( xSection.is() && ( newHeight > xSection->getHeight() ) ) xSection->setHeight( newHeight ); diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 3507a4fd7025..0a2d84f7727b 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -973,7 +973,7 @@ void ScDocument::FillInfo( { tools::Long nSize = 0; for( SCCOL nDocCol = nFirstRealDocCol; nDocCol < nFirstDocCol; ++nDocCol ) - nSize += std::max( static_cast< tools::Long >( GetColWidth( nDocCol, nTab ) * fColScale ), 1L ); + nSize += std::max( tools::Long(GetColWidth( nDocCol, nTab ) * fColScale), tools::Long(1) ); rArray.SetAddMergedLeftSize( nCol, nRow, nSize ); } // additional space after last column @@ -981,7 +981,7 @@ void ScDocument::FillInfo( { tools::Long nSize = 0; for( SCCOL nDocCol = nLastDocCol + 1; nDocCol <= nLastRealDocCol; ++nDocCol ) - nSize += std::max( static_cast< tools::Long >( GetColWidth( nDocCol, nTab ) * fColScale ), 1L ); + nSize += std::max( tools::Long(GetColWidth( nDocCol, nTab ) * fColScale), tools::Long(1) ); rArray.SetAddMergedRightSize( nCol, nRow, nSize ); } // additional space above first row @@ -989,7 +989,7 @@ void ScDocument::FillInfo( { tools::Long nSize = 0; for( SCROW nDocRow = nFirstRealDocRow; nDocRow < nFirstDocRow; ++nDocRow ) - nSize += std::max( static_cast< tools::Long >( GetRowHeight( nDocRow, nTab ) * fRowScale ), 1L ); + nSize += std::max( tools::Long(GetRowHeight( nDocRow, nTab ) * fRowScale), tools::Long(1) ); rArray.SetAddMergedTopSize( nCol, nRow, nSize ); } // additional space beyond last row @@ -997,7 +997,7 @@ void ScDocument::FillInfo( { tools::Long nSize = 0; for( SCROW nDocRow = nLastDocRow + 1; nDocRow <= nLastRealDocRow; ++nDocRow ) - nSize += std::max( static_cast< tools::Long >( GetRowHeight( nDocRow, nTab ) * fRowScale ), 1L ); + nSize += std::max( tools::Long(GetRowHeight( nDocRow, nTab ) * fRowScale), tools::Long(1) ); rArray.SetAddMergedBottomSize( nCol, nRow, nSize ); } diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 8ab44ed5a87f..8654ed5d444d 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -340,7 +340,7 @@ double XclTools::GetXclDefColWidthCorrection( tools::Long nXclDefFontHeight ) // TODO: convert this to take font digit width directly (and possibly DPI?), to avoid guessing // the digit width and pixel size. Or DPI might stay 96, to not follow Excel dependency on DPI // in addition to used font, and have absolute size of the correction fixed 5/96 in. - return 40960.0 / ::std::max( nXclDefFontHeight - 15, 60L ) + 50.0; + return 40960.0 / ::std::max( nXclDefFontHeight - 15, tools::Long(60) ) + 50.0; } // formatting diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index b5546c1d4066..2a12ebc9a600 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -569,8 +569,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const * pRefDocument /* = sal_uLong nTop = aPageOffset.Y(); sal_uLong nLeft = aPageOffset.X(); - sal_uLong nBottom = std::max(static_cast<::tools::Long>(aDefSize.Height() - aOutSize.Height() - nTop + nOffset), 0L); - sal_uLong nRight = std::max(static_cast<::tools::Long>(aDefSize.Width() - aOutSize.Width() - nLeft + nOffset), 0L); + sal_uLong nBottom = std::max(::tools::Long(aDefSize.Height() - aOutSize.Height() - nTop + nOffset), ::tools::Long(0)); + sal_uLong nRight = std::max(::tools::Long(aDefSize.Width() - aOutSize.Width() - nLeft + nOffset), ::tools::Long(0)); pPage->SetBorder(nLeft, nTop, nRight, nBottom); } diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index e84b4cce95f4..a7bcee55aaea 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -137,7 +137,7 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf ) if( !!aTmp ) { - const Link<long,void> aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) ); + const Link<::tools::Long,void> aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) ); aTmp.Vectorize( rMtf, static_cast<sal_uInt8>(m_xMtReduce->get_value(FieldUnit::NONE)), &aPrgsHdl ); if (m_xCbFillHoles->get_active()) diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 53dd0f75c688..18ec833b160f 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -565,8 +565,8 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) } else { - ::tools::Long nLeft = std::max(0L, rLRSpace.GetLeft() - aPagePos.X()); - ::tools::Long nRight = std::max(0L, rLRSpace.GetRight() + aPagePos.X() + + ::tools::Long nLeft = std::max(::tools::Long(0), rLRSpace.GetLeft() - aPagePos.X()); + ::tools::Long nRight = std::max(::tools::Long(0), rLRSpace.GetRight() + aPagePos.X() + aPageSize.Width() - aViewSize.Width()); sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); @@ -631,8 +631,8 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) } else { - ::tools::Long nUpper = std::max(0L, rULSpace.GetUpper() - aPagePos.Y()); - ::tools::Long nLower = std::max(0L, rULSpace.GetLower() + aPagePos.Y() + + ::tools::Long nUpper = std::max(::tools::Long(0), rULSpace.GetUpper() - aPagePos.Y()); + ::tools::Long nLower = std::max(::tools::Long(0), rULSpace.GetLower() + aPagePos.Y() + aPageSize.Height() - aViewSize.Height()); sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind); @@ -841,7 +841,7 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) // like that. const auto nAbsLSpace=aFormat.GetAbsLSpace(); const ::tools::Long nTxtLeft=rItem.GetTextLeft(); - const ::tools::Long nLeftIndent=std::max(0L,nTxtLeft - nAbsLSpace); + const ::tools::Long nLeftIndent=std::max(::tools::Long(0),nTxtLeft - nAbsLSpace); aLRSpaceItem.SetTextLeft(nLeftIndent); // control for clipped left indent - remainder // reduces number format first line indent diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 91b06bc90091..340c1a286cc7 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -122,7 +122,7 @@ void SidebarToolBox::InsertItem(const OUString& rCommand, ToolBox::InsertItem(aCommand, rFrame, nBits, rRequestedSize, nPos); - CreateController(GetItemId(aCommand), rFrame, std::max(rRequestedSize.Width(), 0L), mbSideBar); + CreateController(GetItemId(aCommand), rFrame, std::max(rRequestedSize.Width(), ::tools::Long(0)), mbSideBar); RegisterHandlers(); } diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 2bf71cecf8f2..efc6bc691043 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -484,7 +484,7 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde Point aTLPos (pWin->GetFormulaDrawPos() + aOffset); Size aSize (pNode->GetSize()); - std::unique_ptr<long[]> pXAry(new long[ aNodeText.getLength() ]); + std::unique_ptr<tools::Long[]> pXAry(new tools::Long[ aNodeText.getLength() ]); pWin->SetFont( pNode->GetFont() ); pWin->GetTextArray( aNodeText, pXAry.get(), 0, aNodeText.getLength() ); aTLPos.AdjustX(nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0 ); @@ -554,7 +554,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin tools::Long nNodeX = pNode->GetLeft(); - std::unique_ptr<long[]> pXAry(new long[ aTxt.getLength() ]); + std::unique_ptr<tools::Long[]> pXAry(new tools::Long[ aTxt.getLength() ]); pWin->SetFont( pNode->GetFont() ); pWin->GetTextArray( aTxt, pXAry.get(), 0, aTxt.getLength() ); for (sal_Int32 i = 0; i < aTxt.getLength() && nRes == -1; ++i) diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index 020cf71b7efa..a4d611e38741 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -234,7 +234,7 @@ const std::vector<DdeConnection*>& DdeConnection::GetConnections() } DdeTransaction::DdeTransaction( DdeConnection& d, const OUString& rItemName, - long n ) + tools::Long n ) : rDde( d ) { DdeInstData* pInst = ImpGetInstData(); @@ -336,7 +336,7 @@ void DdeTransaction::Done( bool bDataValid ) aDone.Call( bDataValid ); } -DdeLink::DdeLink( DdeConnection& d, const OUString& aItemName, long n ) +DdeLink::DdeLink( DdeConnection& d, const OUString& aItemName, tools::Long n ) : DdeTransaction (d, aItemName, n) { } @@ -352,7 +352,7 @@ void DdeLink::Notify() aNotify.Call( nullptr ); } -DdeRequest::DdeRequest( DdeConnection& d, const OUString& i, long n ) +DdeRequest::DdeRequest( DdeConnection& d, const OUString& i, tools::Long n ) : DdeTransaction( d, i, n ) { nType = XTYP_REQUEST; @@ -365,21 +365,21 @@ DdeHotLink::DdeHotLink( DdeConnection& d, const OUString& i ) } DdePoke::DdePoke( DdeConnection& d, const OUString& i, const DdeData& rData, - long n ) + tools::Long n ) : DdeTransaction( d, i, n ) { aDdeData = rData; nType = XTYP_POKE; } -DdeExecute::DdeExecute( DdeConnection& d, const OUString& rData, long n ) +DdeExecute::DdeExecute( DdeConnection& d, const OUString& rData, tools::Long n ) : DdeTransaction( d, OUString(), n ) { aDdeData = DdeData( rData.getStr(), sizeof(sal_Unicode) * (rData.getLength() + 1), SotClipboardFormatId::STRING ); nType = XTYP_EXECUTE; } -long DdeConnection::GetError() const +tools::Long DdeConnection::GetError() const { return pImp->nStatus; } diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 0a14525c8a31..cbea590c0658 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -39,7 +39,7 @@ DdeData::DdeData() xImp->nFmt = SotClipboardFormatId::STRING; } -DdeData::DdeData(const void* p, long n, SotClipboardFormatId f) +DdeData::DdeData(const void* p, tools::Long n, SotClipboardFormatId f) { xImp.reset(new DdeDataImp); xImp->hData = nullptr; @@ -99,7 +99,7 @@ void const * DdeData::getData() const return xImp->pData; } -long DdeData::getSize() const +tools::Long DdeData::getSize() const { return xImp->nData; } diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index e6e1f428bd7c..23790a4438e1 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -312,7 +312,7 @@ static void GetTextAreaOutline( const SvxCharScaleWidthItem& rCharScaleWidthItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTWIDTH ); sal_uInt16 nCharScaleWidth = rCharScaleWidthItem.GetValue(); - std::unique_ptr<long[]> pDXArry; + std::unique_ptr<tools::Long[]> pDXArry; sal_Int32 nWidth = 0; // VERTICAL @@ -365,7 +365,7 @@ static void GetTextAreaOutline( { if ( ( nCharScaleWidth != 100 ) && nCharScaleWidth ) { // applying character spacing - pDXArry.reset(new long[ rText.getLength() ]); + pDXArry.reset(new tools::Long[ rText.getLength() ]); pVirDev->GetTextArray( rText, pDXArry.get()); FontMetric aFontMetric( pVirDev->GetFontMetric() ); aFont.SetAverageFontWidth( static_cast<sal_Int32>( static_cast<double>(aFontMetric.GetAverageFontWidth()) * ( double(100) / static_cast<double>(nCharScaleWidth) ) ) ); diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 31b8f8c98946..5fc50dfca233 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -662,12 +662,12 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) tools::Long nR; tools::Long nG; tools::Long nB; - std::unique_ptr<long[]> pMinR(new long[nCount]); - std::unique_ptr<long[]> pMaxR(new long[nCount]); - std::unique_ptr<long[]> pMinG(new long[nCount]); - std::unique_ptr<long[]> pMaxG(new long[nCount]); - std::unique_ptr<long[]> pMinB(new long[nCount]); - std::unique_ptr<long[]> pMaxB(new long[nCount]); + std::unique_ptr<tools::Long[]> pMinR(new tools::Long[nCount]); + std::unique_ptr<tools::Long[]> pMaxR(new tools::Long[nCount]); + std::unique_ptr<tools::Long[]> pMinG(new tools::Long[nCount]); + std::unique_ptr<tools::Long[]> pMaxG(new tools::Long[nCount]); + std::unique_ptr<tools::Long[]> pMinB(new tools::Long[nCount]); + std::unique_ptr<tools::Long[]> pMaxB(new tools::Long[nCount]); sal_uInt16 i; aMtf.SetPrefSize( rMtf.GetPrefSize() ); @@ -679,16 +679,16 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) tools::Long nTol = ( pTols[i] * 255 ) / 100; tools::Long nVal = static_cast<tools::Long>(pSrcCols[i].GetRed()); - pMinR[i] = std::max( nVal - nTol, 0L ); - pMaxR[i] = std::min( nVal + nTol, 255L ); + pMinR[i] = std::max( nVal - nTol, tools::Long(0) ); + pMaxR[i] = std::min( nVal + nTol, tools::Long(255) ); nVal = static_cast<tools::Long>(pSrcCols[i].GetGreen()); - pMinG[i] = std::max( nVal - nTol, 0L ); - pMaxG[i] = std::min( nVal + nTol, 255L ); + pMinG[i] = std::max( nVal - nTol, tools::Long(0) ); + pMaxG[i] = std::min( nVal + nTol, tools::Long(255) ); nVal = static_cast<tools::Long>(pSrcCols[i].GetBlue()); - pMinB[i] = std::max( nVal - nTol, 0L ); - pMaxB[i] = std::min( nVal + nTol, 255L ); + pMinB[i] = std::max( nVal - nTol, tools::Long(0) ); + pMaxB[i] = std::min( nVal + nTol, tools::Long(255) ); pTrans[ i ] = (pDstCols[ i ] == COL_TRANSPARENT); } diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 2a9dfb0a30b3..a60d3f23e51d 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -75,8 +75,8 @@ void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta rRenderContext.Push(PushFlags::MAPMODE); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); - Fraction aXScale(aWinSize.Width(), std::max(tools::Long(aSize.Width() * 2 + aSize.Width() / 8), 1L)); - Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), 1L)); + Fraction aXScale(aWinSize.Width(), std::max(aSize.Width() * 2 + aSize.Width() / 8, tools::Long(1))); + Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), tools::Long(1))); MapMode aMapMode(rRenderContext.GetMapMode()); if(aYScale < aXScale) diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx index 770b58f1eee9..be970414cf8a 100644 --- a/svx/source/dialog/swframeexample.cxx +++ b/svx/source/dialog/swframeexample.cxx @@ -211,15 +211,15 @@ void SwFrameExample::InitAllRects_Impl(vcl::RenderContext& rRenderContext) aFrmSize = Size(nLBorder - 3, (aTextLine.GetHeight() + 2) * 3); break; } - aFrmSize.setWidth( std::max(5L, aFrmSize.Width()) ); - aFrmSize.setHeight( std::max(5L, aFrmSize.Height()) ); + aFrmSize.setWidth( std::max(tools::Long(5), aFrmSize.Width()) ); + aFrmSize.setHeight( std::max(tools::Long(5), aFrmSize.Height()) ); } else { sal_uInt32 nFreeWidth = aPagePrtArea.GetWidth() - rRenderContext.GetTextWidth(DEMOTEXT); aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3); - aDrawObj.SetSize(Size(std::max(5L, static_cast<tools::Long>(nFreeWidth) / 3L), std::max(5L, aFrmSize.Height() * 3L))); + aDrawObj.SetSize(Size(std::max(tools::Long(5), tools::Long(nFreeWidth / 3)), std::max(tools::Long(5), aFrmSize.Height() * 3))); aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2)); aParaPrtArea.SetRight( aDrawObj.Right() ); } diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx index a4a18f0ebe6d..b79aec7f12d6 100644 --- a/svx/source/gallery2/gallerybinaryengine.cxx +++ b/svx/source/gallery2/gallerybinaryengine.cxx @@ -781,7 +781,7 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& rOStm, const GalleryT // Fill the rest of the buffer. const tools::Long nRest - = std::max(512L - (static_cast<tools::Long>(rOStm.Tell()) - nReservePos), 0L); + = std::max(tools::Long(512 - (rOStm.Tell() - nReservePos)), tools::Long(0)); if (nRest) { diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 53bacec4709c..de1d5e147ee4 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -135,8 +135,8 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic ) else { const float fFactor = static_cast<float>(aBmpSize.Width()) / aBmpSize.Height(); - const Size aNewSize( std::max( static_cast<tools::Long>(fFactor < 1. ? S_THUMB * fFactor : S_THUMB), 8L ), - std::max( static_cast<tools::Long>(fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) ); + const Size aNewSize( std::max( tools::Long(fFactor < 1. ? S_THUMB * fFactor : S_THUMB), tools::Long(8) ), + std::max( tools::Long(fFactor < 1. ? S_THUMB : S_THUMB / fFactor), tools::Long(8) ) ); if(aThumbBmp.Scale( static_cast<double>(aNewSize.Width()) / aBmpSize.Width(), static_cast<double>(aNewSize.Height()) / aBmpSize.Height(), diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index a9c5a79c023f..c0153ef93d3f 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -152,11 +152,11 @@ public: }; typedef void (SwRect::*SwRectSet)( const tools::Long nNew ); -typedef long (SwRect::*SwRectGet)() const; +typedef tools::Long (SwRect::*SwRectGet)() const; typedef Point (SwRect::*SwRectPoint)() const; typedef Size (SwRect::*SwRectSize)() const; typedef bool (SwRect::*SwRectMax)( tools::Long ) const; -typedef long (SwRect::*SwRectDist)( tools::Long ) const; +typedef tools::Long (SwRect::*SwRectDist)( tools::Long ) const; typedef void (SwRect::*SwRectSetTwice)( tools::Long, tools::Long ); typedef void (SwRect::*SwRectSetPos)( const Point& ); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index cabd1ff97401..ac2b3c41d6bd 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -226,7 +226,7 @@ private: { CompareData &m_rData1, &m_rData2; const MovedData &m_rMoved1, &m_rMoved2; - std::unique_ptr<long[]> m_pMemory; + std::unique_ptr<tools::Long[]> m_pMemory; tools::Long *m_pFDiag, *m_pBDiag; void Compare( sal_uLong nStt1, sal_uLong nEnd1, sal_uLong nStt2, sal_uLong nEnd2 ); @@ -788,7 +788,7 @@ Compare::CompareSequence::CompareSequence( : m_rData1( rD1 ), m_rData2( rD2 ), m_rMoved1( rMD1 ), m_rMoved2( rMD2 ) { sal_uLong nSize = rMD1.GetCount() + rMD2.GetCount() + 3; - m_pMemory.reset( new long[ nSize * 2 ] ); + m_pMemory.reset( new tools::Long[ nSize * 2 ] ); m_pFDiag = m_pMemory.get() + ( rMD2.GetCount() + 1 ); m_pBDiag = m_pMemory.get() + ( nSize + rMD2.GetCount() + 1 ); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 7d8c50238ae1..e8517ba547eb 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -665,7 +665,7 @@ void SwNoTextFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBord if( nChgHght > 0) Grow( nChgHght ); else if( nChgHght < 0) - Shrink( std::min(getFramePrintArea().Height(), -nChgHght) ); + Shrink( std::min(getFramePrintArea().Height(), tools::Long(-nChgHght)) ); } bool SwNoTextFrame::GetCharRect( SwRect &rRect, const SwPosition& rPos, diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 2bacf8976553..84ebb7dd8821 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1312,7 +1312,7 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell ) // To compensate for the accuracy of calculation later on in SwTable::SetTabCols // we keep adding up a little. nRet += COLFUZZY; - return static_cast<sal_uInt16>(std::max( tools::Long(MINLAY), nRet )); + return static_cast<sal_uInt16>(std::max( SwTwips(MINLAY), nRet )); } /* The Line is within the Selection but not outlined by the TabCols. diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index aca6663389bd..11129ec7c225 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1834,7 +1834,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, const tools::Long nStSz = pStart->GetFormat()->GetFrameSize().GetWidth(); const tools::Long nEdSz = pEnd->GetFormat()->GetFrameSize().GetWidth(); - const tools::Long nWish = std::max( 1L, pTable->GetFormat()->GetFrameSize().GetWidth() ); + const tools::Long nWish = std::max( tools::Long(1), pTable->GetFormat()->GetFrameSize().GetWidth() ); while ( pTable ) { SwRectFnSet aRectFnSet(pTable); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 2a053eacd94f..90930daeabee 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1261,10 +1261,10 @@ public: SwFrameDeleteGuard& operator=(const SwFrameDeleteGuard&) =delete; }; -typedef long (SwFrame::*SwFrameGet)() const; +typedef tools::Long (SwFrame::*SwFrameGet)() const; typedef bool (SwFrame::*SwFrameMax)( tools::Long ); typedef void (SwFrame::*SwFrameMakePos)( const SwFrame*, const SwFrame*, bool ); -typedef long (*SwOperator)( tools::Long, tools::Long ); +typedef tools::Long (*SwOperator)( tools::Long, tools::Long ); typedef void (SwFrame::*SwFrameSet)( tools::Long, tools::Long ); struct SwRectFnCollection diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index cdbc4dbbd420..59e2c25769c7 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -50,7 +50,7 @@ namespace sw { struct Extent; } namespace basegfx::utils { class B2DClipState; } #define FAR_AWAY (SAL_MAX_INT32 - 20000) // initial position of a Fly -#define BROWSE_HEIGHT (56700L * 10L) // 10 Meters +constexpr tools::Long BROWSE_HEIGHT = 56700 * 10; // 10 Meters #define GRFNUM_NO 0 #define GRFNUM_YES 1 #define GRFNUM_REPLACE 2 diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 4fb8b578451f..eb2ef8016a22 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -575,8 +575,8 @@ const SwRect& SwAnchoredObject::GetObjRectWithSpaces() const const SvxULSpaceItem& rUL = rFormat.GetULSpace(); const SvxLRSpaceItem& rLR = rFormat.GetLRSpace(); { - maObjRectWithSpaces.Top ( std::max( maObjRectWithSpaces.Top() - tools::Long(rUL.GetUpper()), 0L )); - maObjRectWithSpaces.Left( std::max( maObjRectWithSpaces.Left()- rLR.GetLeft(), 0L )); + maObjRectWithSpaces.Top ( std::max( maObjRectWithSpaces.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) )); + maObjRectWithSpaces.Left( std::max( maObjRectWithSpaces.Left()- rLR.GetLeft(), tools::Long(0) )); maObjRectWithSpaces.AddHeight(rUL.GetLower() ); maObjRectWithSpaces.AddWidth(rLR.GetRight() ); } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index ae100af25d46..7b91a1bc74cc 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1465,7 +1465,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, // former consideration if ( pOwn->IsTextFrame() ) { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nAdd = std::max( nAdd, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace()) ); } nUpper += nAdd; } @@ -1491,7 +1491,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max( nAdd, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true )) ); } } nUpper += nAdd; @@ -1509,7 +1509,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, { // former consideration if ( pOwn->IsTextFrame() ) - nUpper = std::max( nUpper, static_cast<SwTextFrame*>(pOwn)->GetLineSpace() ); + nUpper = std::max( nUpper, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace()) ); if ( nPrevLineSpacing != 0 ) { nUpper = std::max( nUpper, nPrevLineSpacing ); @@ -1539,7 +1539,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nAdd = std::max( nAdd, static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true ) ); + nAdd = std::max( nAdd, SwTwips(static_cast<SwTextFrame*>(pOwn)->GetLineSpace( true )) ); } } nUpper += nAdd; diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 49f522c42d41..9987d682dbfc 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -826,10 +826,10 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, SwRect aNew( GetObjRectWithSpaces() ); SwRect aOld( getFrameArea() ); const SvxULSpaceItem &rUL = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetULSpace(); - aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), 0L ) ); + aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) ); aOld.AddHeight(rUL.GetLower() ); const SvxLRSpaceItem &rLR = static_cast<const SwFormatChg*>(pOld)->pChangedFormat->GetLRSpace(); - aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), 0L ) ); + aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) ); aOld.AddWidth(rLR.GetRight() ); aNew.Union( aOld ); NotifyBackground( FindPageFrame(), aNew, PrepareHint::Clear ); @@ -928,13 +928,13 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, if ( RES_UL_SPACE == nWhich ) { const SvxULSpaceItem &rUL = *static_cast<const SvxULSpaceItem*>(pNew); - aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), 0L ) ); + aOld.Top( std::max( aOld.Top() - tools::Long(rUL.GetUpper()), tools::Long(0) ) ); aOld.AddHeight(rUL.GetLower() ); } else { const SvxLRSpaceItem &rLR = *static_cast<const SvxLRSpaceItem*>(pNew); - aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), 0L ) ); + aOld.Left ( std::max( aOld.Left() - rLR.GetLeft(), tools::Long(0) ) ); aOld.AddWidth(rLR.GetRight() ); } } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 7f60bb165ad5..95029bbf90e9 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3561,7 +3561,7 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrame *pCell ) nLow += static_cast<SwTextFrame*>(pLow)->GetParHeight()-pLow->getFramePrintArea().Height(); else if( pLow->IsSctFrame() && static_cast<SwSectionFrame*>(pLow)->IsUndersized() ) nLow += static_cast<SwSectionFrame*>(pLow)->Undersize(); - nFlyAdd = std::max( 0L, nFlyAdd - nLow ); + nFlyAdd = std::max( tools::Long(0), nFlyAdd - nLow ); nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) ); nHeight += nLow; pLow = pLow->GetNext(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 414615267676..51e97fb1c25c 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -305,7 +305,7 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea()); if( nPrtHeight < 0 ) { - const SwTwips nTmpDiff = std::max( aRectFnSet.GetTop(getFramePrintArea()), -nPrtHeight ); + const SwTwips nTmpDiff = std::max( SwTwips(aRectFnSet.GetTop(getFramePrintArea())), -nPrtHeight ); SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this); aRectFnSet.SubTop( aPrt, nTmpDiff ); } @@ -348,8 +348,8 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) { if ( pBoss->GetMaxFootnoteHeight() != LONG_MAX ) { - nDist = std::min( nDist, pBoss->GetMaxFootnoteHeight() - - aRectFnSet.GetHeight(getFrameArea()) ); + nDist = std::min( nDist, + SwTwips(pBoss->GetMaxFootnoteHeight() - aRectFnSet.GetHeight(getFrameArea())) ); if ( nDist <= 0 ) return 0; } diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 922aab7dcd55..ec97ae693029 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -426,7 +426,7 @@ void SwHeadFootFrame::Format(vcl::RenderContext* pRenderContext, const SwBorderA { lcl_LayoutFrameEnsureMinHeight(*this); - tools::Long nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); + SwTwips nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); if ( !isFramePrintAreaValid() ) FormatPrt(nUL, pAttrs); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index c322a0d7b496..73914fda045d 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2303,8 +2303,8 @@ void SwRootFrame::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* p const bool bLastColumn = pPageToAdjust->GetNext() == pEndOfRow; const bool bLastRow = !pEndOfRow; - nMinPageLeft = std::min( nMinPageLeft, aNewPagePos.getX() ); - nMaxPageRight = std::max( nMaxPageRight, aNewPagePos.getX() + nCurrentPageWidth); + nMinPageLeft = std::min( nMinPageLeft, SwTwips(aNewPagePos.getX()) ); + nMaxPageRight = std::max( nMaxPageRight, SwTwips(aNewPagePos.getX() + nCurrentPageWidth)); // border of nGapBetweenPages around the current page: SwRect aPageRectWithBorders( aNewPagePos.getX() - nGapBetweenPages, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index b06341cb9ecb..12536c52a054 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -864,7 +864,7 @@ static void lcl_DrawDashedRect( OutputDevice * pOut, SwLineRect const & rLRect ) // Discriminate vertically stretched rect from horizontally stretched // and restrict minimum nHalfLWidth to 1 - tools::Long nHalfLWidth = std::max( static_cast<tools::Long>(std::min( rLRect.Width( ), rLRect.Height( ) ) / 2), 1L ); + tools::Long nHalfLWidth = std::max( std::min( rLRect.Width( ), rLRect.Height( ) ) / 2, tools::Long(1) ); if ( rLRect.Height( ) > rLRect.Width( ) ) { @@ -1237,7 +1237,7 @@ static tools::Long lcl_AlignWidth( const tools::Long nWidth, SwPaintProperties c const tools::Long nW = nWidth % properties.nSPixelSzW; if ( !nW || nW > properties.nSHalfPixelSzW ) - return std::max(1L, nWidth - properties.nSHalfPixelSzW); + return std::max(tools::Long(1), nWidth - properties.nSHalfPixelSzW); } return nWidth; } @@ -1249,7 +1249,7 @@ static tools::Long lcl_AlignHeight( const tools::Long nHeight, SwPaintProperties const tools::Long nH = nHeight % properties.nSPixelSzH; if ( !nH || nH > properties.nSHalfPixelSzH ) - return std::max(1L, nHeight - properties.nSHalfPixelSzH); + return std::max(tools::Long(1), nHeight - properties.nSHalfPixelSzH); } return nHeight; } @@ -5396,8 +5396,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co if( bGrid ) { nY -= nGrid; - SwTwips nPosY = std::max( aInter.Left(), nY ); - SwTwips nHeight = std::min(nRight, aTmp.Pos().X())-nPosY; + SwTwips nPosY = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nHeight = std::min(nRight, SwTwips(aTmp.Pos().X()))-nPosY; if( nHeight > 0 ) { if( bCell ) @@ -5429,8 +5429,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY -= nRuby; if( bBorder ) { - SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nPos = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nW = std::min(nRight, SwTwips(aTmp.Pos().X())) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -5455,7 +5455,7 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co { nY -= nGrid; SwTwips nHeight = aTmp.Pos().X() - - std::max(aInter.Left(), nY ); + - std::max(SwTwips(aInter.Left()), nY ); if( nHeight > 0 ) { if( bCell ) @@ -5487,8 +5487,8 @@ void SwPageFrame::PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) co nY -= nRuby; if( bBorder ) { - SwTwips nPos = std::max( aInter.Left(), nY ); - SwTwips nW = std::min(nRight, aTmp.Pos().X()) - nPos; + SwTwips nPos = std::max( SwTwips(aInter.Left()), nY ); + SwTwips nW = std::min(nRight, SwTwips(aTmp.Pos().X())) - nPos; SwRect aVert( Point( nPos, aGrid.Top() ), Size( nW, 1 ) ); if( nW > 0 ) @@ -6507,7 +6507,7 @@ static void lcl_RefreshLine( const SwLayoutFrame *pLay, const bool bHori = rP1.Y() == rP2.Y(); // use pointers to member function in order to unify flow - typedef long (Point::*pmfPtGet)() const; + typedef tools::Long (Point::*pmfPtGet)() const; typedef void (Point::*pmfPtSet)(tools::Long); const pmfPtGet pDirPtX = &Point::X; const pmfPtGet pDirPtY = &Point::Y; diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index adf3e5478176..44e31aac0993 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -552,7 +552,7 @@ static void lcl_PreprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine, SwBorderAttrAccess aAccess( SwFrame::GetCache(), pCell ); const SwBorderAttrs &rAttrs = *aAccess.Get(); - nMinHeight = std::max( nMinHeight, lcl_CalcTopAndBottomMargin( *static_cast<SwLayoutFrame*>(pCell), rAttrs ) ); + nMinHeight = std::max( nMinHeight, tools::Long(lcl_CalcTopAndBottomMargin( *static_cast<SwLayoutFrame*>(pCell), rAttrs )) ); pCell = pCell->GetNext(); } } @@ -2911,7 +2911,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA setFramePrintAreaValid(false); } - tools::Long nRightOffset = std::max( 0L, nTmpRight ); + tools::Long nRightOffset = std::max( tools::Long(0), nTmpRight ); SwTwips nLower = pAttrs->CalcBottomLine(); // #i29550# @@ -2966,7 +2966,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // surrounding fly frames on the right // -> right indent is maximum of given right offset // and wished right offset. - nRightSpacing = nRightLine + std::max( nRightOffset, nWishRight ); + nRightSpacing = nRightLine + std::max( SwTwips(nRightOffset), nWishRight ); } else { @@ -2997,7 +2997,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // surrounding fly frames on the left // -> right indent is maximum of given left offset // and wished left offset. - nLeftSpacing = nLeftLine + std::max( nLeftOffset, nWishLeft ); + nLeftSpacing = nLeftLine + std::max( SwTwips(nLeftOffset), nWishLeft ); } else { @@ -3019,11 +3019,11 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA const SwTwips nCenterSpacing = ( nMax - nWishedTableWidth ) / 2; nLeftSpacing = nLeftLine + ( (nLeftOffset > 0) ? - std::max( nCenterSpacing, nLeftOffset ) : + std::max( nCenterSpacing, SwTwips(nLeftOffset) ) : nCenterSpacing ); nRightSpacing = nRightLine + ( (nRightOffset > 0) ? - std::max( nCenterSpacing, nRightOffset ) : + std::max( nCenterSpacing, SwTwips(nRightOffset) ) : nCenterSpacing ); } break; @@ -3046,7 +3046,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of left spacing and left offset. // OD 10.03.2003 #i9040# - consider left line attribute. - nLeftSpacing = std::max( nLeftSpacing, ( nLeftOffset + nLeftLine ) ); + nLeftSpacing = std::max( nLeftSpacing, SwTwips( nLeftOffset + nLeftLine ) ); } // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)> nRightSpacing = pAttrs->CalcRight( this ); @@ -3056,7 +3056,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of right spacing and right offset. // OD 10.03.2003 #i9040# - consider right line attribute. - nRightSpacing = std::max( nRightSpacing, ( nRightOffset + nRightLine ) ); + nRightSpacing = std::max( nRightSpacing, SwTwips( nRightOffset + nRightLine ) ); } } break; @@ -3072,14 +3072,14 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // they overlap with the table. // Thus, take maximum of right spacing and right offset. // OD 10.03.2003 #i9040# - consider left line attribute. - nLeftSpacing = std::max( nLeftSpacing, ( pAttrs->CalcLeftLine() + nLeftOffset ) ); + nLeftSpacing = std::max( nLeftSpacing, SwTwips( pAttrs->CalcLeftLine() + nLeftOffset ) ); } // OD 10.03.2003 #i9040# - consider right and left line attribute. const SwTwips nWishRight = nMax - (nLeftSpacing-pAttrs->CalcLeftLine()) - nWishedTableWidth; nRightSpacing = nRightLine + ( (nRightOffset > 0) ? - std::max( nWishRight, nRightOffset ) : + std::max( nWishRight, SwTwips(nRightOffset) ) : nWishRight ); } break; @@ -3176,7 +3176,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( IsRestrictTableGrowth() ) { - nTmp = std::min( nDist, nReal + nTmp ); + nTmp = std::min( tools::Long(nDist), nReal + nTmp ); nDist = nTmp < 0 ? 0 : nTmp; } } @@ -3966,7 +3966,7 @@ tools::Long CalcHeightWithFlys( const SwFrame *pFrame ) aRectFnSet.GetBottom(pAnchoredObj->GetObjRect()), aRectFnSet.GetBottom(pFrame->getFrameArea()) ); - nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop2 ); + nHeight = std::max( nHeight, tools::Long(nDistOfFlyBottomToAnchorTop2 )); } } } @@ -4038,7 +4038,7 @@ static SwTwips lcl_CalcMinCellHeight( const SwLayoutFrame *_pCell, // #i26945# if ( _bConsiderObjs ) { - nFlyAdd = std::max( 0L, nFlyAdd - nLowHeight ); + nFlyAdd = std::max( tools::Long(0), nFlyAdd - nLowHeight ); nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) ); } } @@ -4636,7 +4636,7 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SwTwips nMinHeight = 0; if (rSz.GetHeightSizeType() == SwFrameSize::Minimum) nMinHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*this), - 0L); + tools::Long(0)); // Only necessary to calculate minimal row height if height // of pRow is at least nMinHeight. Otherwise nMinHeight is the @@ -5777,7 +5777,7 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const if (rSz.GetHeightSizeType() == SwFrameSize::Minimum) { nMinRowHeight = std::max(rSz.GetHeight() - lcl_calcHeightOfRowBeforeThisFrame(*pFirstRow), - 0L); + tools::Long(0)); } nTmpHeight += std::max( nHeightOfFirstContentLine, nMinRowHeight ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 416c44378c60..3d9c9e6056fb 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1607,7 +1607,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) if ( nDiff > 0 ) { nChg = BROWSE_HEIGHT - pUp->getFrameArea().Height(); - nChg = std::min( nDiff, nChg ); + nChg = std::min( nDiff, SwTwips(nChg) ); if ( !IsBodyFrame() ) { @@ -1621,7 +1621,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) { { SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pBody); - aFrm.Height(std::max( 0L, aFrm.Height() - nChg )); + aFrm.Height(std::max( tools::Long(0), aFrm.Height() - nChg )); } pBody->InvalidatePrt_(); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 48ba68d3a81f..303a529e3484 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -382,12 +382,12 @@ bool SwTextFrame::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const if ( aRectFnSet.IsVert() ) { if ( aRectFnSet.IsVertL2R() ) - nMaxY = std::min( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::min( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); else - nMaxY = std::max( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::max( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); } else - nMaxY = std::min( aRectFnSet.GetPrtBottom(*pFrame), nUpperMaxY ); + nMaxY = std::min( SwTwips(aRectFnSet.GetPrtBottom(*pFrame)), nUpperMaxY ); if ( pFrame->IsEmpty() || ! aRectFnSet.GetHeight(pFrame->getFramePrintArea()) ) { Point aPnt1 = pFrame->getFrameArea().Pos() + pFrame->getFramePrintArea().Pos(); @@ -1407,7 +1407,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const nFirst = nFirst - nDist; else nFirst = 0; - nDist = std::max( nDist, GetLineSpace() ); + nDist = std::max( nDist, SwTwips(GetLineSpace()) ); nDist += nLineHeight; nDiff -= nFirst; diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index fb064af7d3c9..aa4ba00b8d8d 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2069,7 +2069,7 @@ void SwTextFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom ) OSL_ENSURE( ! m_pFrame->IsVertical() || m_pFrame->IsSwapped(), "SwTextFormatter::CalcUnclipped with unswapped frame" ); - tools::Long nFlyAsc, nFlyDesc; + SwTwips nFlyAsc, nFlyDesc; m_pCurr->MaxAscentDescent( rTop, rBottom, nFlyAsc, nFlyDesc ); rTop = Y() + GetCurr()->GetAscent(); rBottom = rTop + nFlyDesc; @@ -2096,7 +2096,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, aTmpInf.SetIdx( nStartIdx ); aTmpInf.SetPos( aStart ); - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc ); const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight(); @@ -2215,7 +2215,7 @@ void SwTextFormatter::AlignFlyInCntBase( tools::Long nBaseLine ) const nFlags |= AsCharFlags::Reverse; } - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; while( pPos ) { @@ -2577,7 +2577,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf, // aBase.X() = Offset in the line after the current position // aBase.Y() = LineIter.Y() + Ascent of the current position - tools::Long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; + SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; // i#11859 - use new method <SwLineLayout::MaxAscentDescent(..)> // to change line spacing behaviour at paragraph - Compatibility to MS Word //SwLinePortion *pPos = pCurr->GetFirstPortion(); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 866eaf929979..61fd156e191c 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -143,7 +143,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, SwLinePortion *pPor = bEndPor ? m_pCurr->GetFirstPortion() : CalcPaintOfst( rPaint ); // Optimization! - SwTwips nMaxRight = std::min( rPaint.Right(), Right() ); + SwTwips nMaxRight = std::min<SwTwips>( rPaint.Right(), Right() ); const SwTwips nTmpLeft = GetInfo().X(); //compatibility setting: allow tabstop text to exceed right margin if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN)) diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 46851c08d7ad..a5fb1f6b6731 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -983,7 +983,7 @@ SwTwips SwTextFly::CalcMinBottom() const { const SwRect& aBound( pAnchoredObj->GetObjRectWithSpaces() ); if( aBound.Top() < nEndOfFrame ) - nRet = std::max( nRet, aBound.Bottom() ); + nRet = std::max( nRet, SwTwips(aBound.Bottom()) ); } } } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 3b954b6f857d..d1a5f9054462 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -3152,7 +3152,7 @@ SwTestFormat::SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPre, SwTwip { SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*pFrame); - aRectFnSet.SetHeight( aPrt, std::max( 0L , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) ); + aRectFnSet.SetHeight( aPrt, std::max( tools::Long(0) , aRectFnSet.GetHeight(pFrame->getFrameArea()) - aRectFnSet.GetTop(aPrt) - nLower ) ); aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(pFrame->getFrameArea()) - ( rAttrs.CalcLeft( pFrame ) + rAttrs.CalcRight( pFrame ) ) ); } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 8f1aca1a64b4..b544ba56a48b 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1008,7 +1008,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc); // kerning array - gives the absolute position of end of each character - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); if ( m_pPrinter ) m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(), @@ -1115,7 +1115,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) { const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); if ( m_pPrinter ) m_pPrinter->GetTextArray( rInf.GetText(), pKernArray.get(), @@ -1257,7 +1257,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // Simple kerning is handled by DrawStretchText if( rInf.GetSpace() || rInf.GetKanaComp() ) { - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); @@ -1465,12 +1465,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) bool bBullet = rInf.GetBullet(); if( m_bSymbol ) bBullet = false; - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); CreateScrFont( *rInf.GetShell(), rInf.GetOut() ); tools::Long nScrPos; // get screen array - std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pScrArray(new tools::Long[sal_Int32(rInf.GetLen())]); SwTextGlyphsKey aGlyphsKey{ &rInf.GetOut(), rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()) }; SalLayoutGlyphs* pGlyphs = lcl_CreateLayout(aGlyphsKey, m_aTextGlyphs[aGlyphsKey]); rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(), @@ -1982,7 +1982,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) aTextSize.setWidth( m_pPrinter->GetTextWidth( rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn))); aTextSize.setHeight( m_pPrinter->GetTextHeight() ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(nLn)]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(nLn)]); CreateScrFont( *rInf.GetShell(), rInf.GetOut() ); if( !GetScrFont()->IsSameInstance( rInf.GetOut().GetFont() ) ) rInf.GetOut().SetFont( *m_pScrFont ); @@ -2001,7 +2001,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) nScrPos = pKernArray[ sal_Int32(nLn) - 1 ]; else { - std::unique_ptr<long[]> pScrArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pScrArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); nScrPos = pScrArray[ 0 ]; @@ -2050,7 +2050,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) rInf.GetOut().SetFont( *m_pPrtFont ); if( bCompress ) { - std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] ); + std::unique_ptr<tools::Long[]> pKernArray( new tools::Long[sal_Int32(nLn)] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn)); rInf.SetKanaDiff( rInf.GetScriptInfo()->Compress( pKernArray.get(), @@ -2090,7 +2090,7 @@ TextFrameIndex SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf) if( 0 != nSperren ) nKern -= nSperren; - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); // be sure to have the correct layout mode at the printer if ( m_pPrinter ) @@ -2407,7 +2407,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe const SwDoc* pDoc = rInf.GetShell()->GetDoc(); const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())]); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())]); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); @@ -2438,7 +2438,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe { const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf ); - std::unique_ptr<long[]> pKernArray(new long[sal_Int32(rInf.GetLen())] ); + std::unique_ptr<tools::Long[]> pKernArray(new tools::Long[sal_Int32(rInf.GetLen())] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen())); tools::Long nCurrPos = pKernArray[sal_Int32(nTextBreak)] + nGridWidthAdd; @@ -2554,7 +2554,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, tools::Long nTe nLn = TextFrameIndex(1); else if (nLn > nTextBreak2 + nTextBreak2) nLn = nTextBreak2 + nTextBreak2; - std::unique_ptr<long[]> pKernArray( new long[sal_Int32(nLn)] ); + std::unique_ptr<tools::Long[]> pKernArray( new tools::Long[sal_Int32(nLn)] ); rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray.get(), sal_Int32(rInf.GetIdx()), sal_Int32(nLn)); if( rInf.GetScriptInfo()->Compress( pKernArray.get(), rInf.GetIdx(), nLn, diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 02f0e988172e..57fda67e4e2c 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -504,13 +504,13 @@ void SwPagePreviewLayout::CalcDocPreviewPaintRect() Size aSize; if ( mbDoesLayoutColsFitIntoWindow ) - aSize.setWidth( std::min( mnPreviewLayoutWidth, + aSize.setWidth( std::min( tools::Long(mnPreviewLayoutWidth), maPreviewDocRect.GetWidth() - aTopLeftPos.X() ) ); else aSize.setWidth( std::min( maPreviewDocRect.GetWidth() - aTopLeftPos.X(), maWinSize.Width() - maAdditionalPaintOffset.X() ) ); if ( mbDoesLayoutRowsFitIntoWindow ) - aSize.setHeight( std::min( mnPreviewLayoutHeight, + aSize.setHeight( std::min( tools::Long(mnPreviewLayoutHeight), maPreviewDocRect.GetHeight() - aTopLeftPos.Y() ) ); else aSize.setHeight( std::min( maPreviewDocRect.GetHeight() - aTopLeftPos.Y(), @@ -764,7 +764,7 @@ Point SwPagePreviewLayout::GetPreviewStartPosForNewScale( // check, if new y-position is outside document preview if ( aNewPaintStartPos.Y() > maPreviewDocRect.Bottom() ) aNewPaintStartPos.setY( - std::max( 0L, maPreviewDocRect.Bottom() - mnPreviewLayoutHeight ) ); + std::max( tools::Long(0), maPreviewDocRect.Bottom() - mnPreviewLayoutHeight ) ); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 95129e6b90dc..049ef9742cc1 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -351,9 +351,9 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) aTmp1 = GetOut()->LogicToPixel( aTmp1 ); tools::Rectangle aTmp2( GetOut()->PixelToLogic( aTmp1 ) ); if ( aTmp2.Left() > aRect.Left() ) - aTmp1.SetLeft( std::max( 0L, aTmp1.Left() - 1 ) ); + aTmp1.SetLeft( std::max( tools::Long(0), aTmp1.Left() - 1 ) ); if ( aTmp2.Top() > aRect.Top() ) - aTmp1.SetTop( std::max( 0L, aTmp1.Top() - 1 ) ); + aTmp1.SetTop( std::max<tools::Long>( 0, aTmp1.Top() - 1 ) ); aTmp1.AdjustRight(1 ); aTmp1.AdjustBottom(1 ); aTmp1 = GetOut()->PixelToLogic( aTmp1 ); @@ -1169,7 +1169,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) const tools::Rectangle &rBound = pObj->GetObjRect().SVRect(); if (rBound.Left() != FAR_AWAY) { // OD 03.03.2003 #107927# - use correct datatype - const SwTwips nL = std::max( 0L, rBound.Left() - nOfst ); + const SwTwips nL = std::max( SwTwips(0), SwTwips(rBound.Left() - nOfst) ); if ( nL < nMinLeft ) nMinLeft = nL; if( rBound.Right() + nOfst > nMaxRight ) @@ -1302,7 +1302,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to aRect.AddWidth(2*aPixSz.Width() ); aRect.Pos().setY( lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height() : aRect.Top() - aSize.Height() + aPixSz.Height() ); - aRect.Pos().setX( std::max( 0L, aRect.Left()-aPixSz.Width() ) ); + aRect.Pos().setX( std::max( tools::Long(0), aRect.Left()-aPixSz.Width() ) ); aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos())); aRect.SSize( GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize())) ); maVisArea = aRect; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c74b2d99edb7..59770d71785b 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5030,7 +5030,7 @@ sal_uInt16 SwHTMLParser::ToTwips( sal_uInt16 nPixel ) { if( nPixel && Application::GetDefaultDevice() ) { - tools::Long nTwips = Application::GetDefaultDevice()->PixelToLogic( + SwTwips nTwips = Application::GetDefaultDevice()->PixelToLogic( Size( nPixel, nPixel ), MapMode( MapUnit::MapTwip ) ).Width(); return static_cast<sal_uInt16>(std::min(nTwips, SwTwips(SAL_MAX_UINT16))); } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 41ca25235c48..8d68eb5da6f7 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -716,9 +716,11 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons * 2147483647( MAX_INTEGER_VALUE ). * Therefore changing the following accordingly so that LO sync's up with MSO. **/ - sal_uInt64 cx = TwipsToEMU(std::clamp(rSize.Width(), 0L, tools::Long(SAL_MAX_INT32))); + sal_uInt64 cx + = TwipsToEMU(std::clamp(rSize.Width(), tools::Long(0), tools::Long(SAL_MAX_INT32))); OString aWidth(OString::number(std::min(cx, sal_uInt64(SAL_MAX_INT32)))); - sal_uInt64 cy = TwipsToEMU(std::clamp(rSize.Height(), 0L, tools::Long(SAL_MAX_INT32))); + sal_uInt64 cy + = TwipsToEMU(std::clamp(rSize.Height(), tools::Long(0), tools::Long(SAL_MAX_INT32))); OString aHeight(OString::number(std::min(cy, sal_uInt64(SAL_MAX_INT32)))); m_pImpl->getSerializer()->singleElementNS(XML_wp, XML_extent, XML_cx, aWidth, XML_cy, aHeight); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fdfec6fde53a..ac7d6aed62ea 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -553,7 +553,7 @@ sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, return bRet; } -static bool RTLDrawingsHack(tools::Long &rLeft, +static bool RTLDrawingsHack(SwTwips &rLeft, sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft, SwTwips nPageRight, SwTwips nPageSize) { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 82f93536e959..adbfaf20bae3 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -5263,7 +5263,7 @@ bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap) tools::Long SwWW8ImplReader::ImportExtSprm(WW8PLCFManResult* pRes) { // array for reading of the extended ( self-defined ) SPRMs - typedef long (SwWW8ImplReader::*FNReadRecordExt)(WW8PLCFManResult*); + typedef tools::Long (SwWW8ImplReader::*FNReadRecordExt)(WW8PLCFManResult*); static const FNReadRecordExt aWwSprmTab[] = { diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 730d275901d7..1992f8ad6dd5 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -176,8 +176,8 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan : ROUND(m_aItem.m_lVDist / 10.0)); // Scale factor - const float fx = float(lOutWPix23) / std::max(1L, lDispW); - const float fy = float(lOutHPix23) / std::max(1L, lDispH); + const float fx = float(lOutWPix23) / std::max(tools::Long(1), lDispW); + const float fy = float(lOutHPix23) / std::max(tools::Long(1), lDispH); const float f = std::min(fx, fy); // zero point @@ -383,8 +383,8 @@ void SwLabFormatPage::ChangeMinMax() m_xHDistField->set_min(nMinSize, FieldUnit::CM); m_xVDistField->set_min(nMinSize, FieldUnit::CM); - m_xHDistField->set_max(tools::Long(100) * ((lMax - lLeft ) / std::max(1L, static_cast<tools::Long>(nCols))), FieldUnit::TWIP); - m_xVDistField->set_max(tools::Long(100) * ((lMax - lUpper) / std::max(1L, static_cast<tools::Long>(nRows))), FieldUnit::TWIP); + m_xHDistField->set_max(100 * ((lMax - lLeft ) / std::max(1, nCols)), FieldUnit::TWIP); + m_xVDistField->set_max(100 * ((lMax - lUpper) / std::max(1, nRows)), FieldUnit::TWIP); m_xWidthField->set_min(nMinSize, FieldUnit::CM); m_xHeightField->set_min(nMinSize, FieldUnit::CM); @@ -395,8 +395,8 @@ void SwLabFormatPage::ChangeMinMax() m_xLeftField->set_max(tools::Long(100) * (lMax - nCols * lHDist), FieldUnit::TWIP); m_xUpperField->set_max(tools::Long(100) * (lMax - nRows * lVDist), FieldUnit::TWIP); - m_xColsField->set_range(1, (lMax - lLeft ) / std::max(1L, lHDist)); - m_xRowsField->set_range(1, (lMax - lUpper) / std::max(1L, lVDist)); + m_xColsField->set_range(1, (lMax - lLeft ) / std::max(tools::Long(1), lHDist)); + m_xRowsField->set_range(1, (lMax - lUpper) / std::max(tools::Long(1), lVDist)); m_xPWidthField->set_range(tools::Long(100) * lMinPWidth, tools::Long(100) * lMax, FieldUnit::TWIP); m_xPHeightField->set_range(tools::Long(100) * lMinPHeight, tools::Long(100) * lMax, FieldUnit::TWIP); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index ac63432eb60c..4adf7cb34447 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -721,8 +721,8 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, weld::MetricSpinButton&, void ) } //set maximum values - m_xCLNrEdt->set_max(std::max(1L, - std::min(tools::Long(nMaxCols), tools::Long( m_xColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); + m_xCLNrEdt->set_max(std::max(tools::Long(1), + std::min(tools::Long(nMaxCols), tools::Long(m_xColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); //prompt example window if(!m_bLockUpdate) @@ -795,8 +795,8 @@ void SwColumnPage::Init() // set maximum number of columns // values below 1 are not allowed - m_xCLNrEdt->set_max(std::max(1L, - std::min(tools::Long(nMaxCols), tools::Long( m_xColMgr->GetActualSize() / g_nMinWidth) ))); + m_xCLNrEdt->set_max(std::max(tools::Long(1), + std::min(tools::Long(nMaxCols), tools::Long(m_xColMgr->GetActualSize() / g_nMinWidth) ))); } bool SwColumnPage::isLineNotNone() const diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index a5ba5cb27c9c..3e4129b96743 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -339,13 +339,13 @@ void SwModule::InsertEnv( SfxRequest& rReq ) switch (rItem.m_eAlign) { case ENV_HOR_LEFT: break; - case ENV_HOR_CNTR: lLeft += std::max(0L, tools::Long(aPaperSize.Width() - nPageW)) / 2; + case ENV_HOR_CNTR: lLeft += std::max(tools::Long(0), aPaperSize.Width() - nPageW) / 2; break; - case ENV_HOR_RGHT: lLeft += std::max(0L, tools::Long(aPaperSize.Width() - nPageW)); + case ENV_HOR_RGHT: lLeft += std::max(tools::Long(0), aPaperSize.Width() - nPageW); break; - case ENV_VER_LEFT: lUpper += std::max(0L, tools::Long(aPaperSize.Width() - nPageH)); + case ENV_VER_LEFT: lUpper += std::max(tools::Long(0), aPaperSize.Width() - nPageH); break; - case ENV_VER_CNTR: lUpper += std::max(0L, tools::Long(aPaperSize.Width() - nPageH)) / 2; + case ENV_VER_CNTR: lUpper += std::max(tools::Long(0), aPaperSize.Width() - nPageH) / 2; break; case ENV_VER_RGHT: break; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 50e0694471ca..2049e6f60288 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -683,7 +683,7 @@ void SwEditWin::JustifyAreaTimer() #ifdef UNX ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits