diff options
134 files changed, 450 insertions, 423 deletions
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 const tools::Long coMinLen = 100; #else - const long coMinLen = 50; + const tools::Long coMinLen = 50; #endif tools::Long const nTimeout = 800, nDiff = std::max( diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index e0d8c517cda6..e2e1f28e2e7c 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -102,7 +102,7 @@ private: using SwEditShell::AutoCorrect; using SwCursorShell::GotoMark; - typedef long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); + typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp ); typedef void (SwWrtShell::*SELECTFUNC2)(const Point *, bool bProp ); SELECTFUNC2 m_fnDrag = &SwWrtShell::BeginDrag; diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index ecf9b6deafc6..7fc050f83803 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -145,7 +145,7 @@ void SwTableFUNC::SetColWidth(sal_uInt16 nNum, SwTwips nNewWidth ) aCols[ GetRightSeparator(nNum-1) ] -= nDiff; } else - aCols.SetRight( std::min( nNewWidth, aCols.GetRightMax()) ); + aCols.SetRight( std::min( nNewWidth, SwTwips(aCols.GetRightMax()) ) ); pSh->StartAllAction(); pSh->SetTabCols( aCols, bCurrentOnly ); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 679e08fc8025..fdfff47b13f3 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -131,14 +131,14 @@ tools::Long SwView::SetHScrollMax( tools::Long lMax ) // At negative values the document is completely visible. // In this case, no scrolling. - return std::max( std::min( lMax, lSize ), 0L ); + return std::max( std::min( lMax, lSize ), tools::Long(0) ); } tools::Long SwView::SetVScrollMax( tools::Long lMax ) { const tools::Long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2; tools::Long lSize = GetDocSz().Height() + lBorder - m_aVisArea.GetHeight(); - return std::max( std::min( lMax, lSize), 0L ); // see horizontal + return std::max( std::min( lMax, lSize), tools::Long(0) ); // see horizontal } Point SwView::AlignToPixel(const Point &rPt) const @@ -346,12 +346,12 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, if(nDesHeight > nCurHeight) // the height is not sufficient, then nYScroll is no longer of interest { pPt->setY( rRect.Top() ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) ); } else if ( rRect.Top() < m_aVisArea.Top() ) // Upward shift { pPt->setY( rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll) ); - pPt->setY( std::max( lMin, pPt->Y() ) ); + pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) ); } else if( rRect.Bottom() > m_aVisArea.Bottom() ) // Downward shift { @@ -373,7 +373,7 @@ void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect, pPt->setX( rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll) ); pPt->setX( std::max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() ) ); pPt->setX( std::min( rRect.Left() - nScrollX, pPt->X() ) ); - pPt->setX( std::max( 0L, pPt->X() ) ); + pPt->setX( std::max( tools::Long(0), pPt->X() ) ); } } @@ -570,7 +570,7 @@ bool SwView::PageUp() Point aPos(m_aVisArea.TopLeft()); aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) ); - aPos.setY( std::max(0L, aPos.Y()) ); + aPos.setY( std::max(tools::Long(0), aPos.Y()) ); SetVisArea( aPos ); return true; } diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 7924d5b04ca7..d4f34c04d7cb 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -2111,8 +2111,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) { nEnd = aTabCols.GetRight() - rEntry.nPos; SvxColumnDescription aColDesc( nStart, nEnd, - std::max(0L, aTabCols.GetRight() - rEntry.nMax), - std::max(0L, aTabCols.GetRight() - rEntry.nMin), + std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMax), + std::max(tools::Long(0), aTabCols.GetRight() - rEntry.nMin), !aTabCols.IsHidden(i) ); aColItem.Append(aColDesc); } diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index 2f1134eabdce..f7159c1bedd6 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -156,7 +156,7 @@ sal_Int32 VCLXFont::getStringWidthArray( const OUString& str, css::uno::Sequence { vcl::Font aOldFont = pOutDev->GetFont(); pOutDev->SetFont( maFont ); - std::unique_ptr<long []> pDXA(new long[str.getLength()]); + std::unique_ptr<tools::Long []> pDXA(new tools::Long[str.getLength()]); nRet = pOutDev->GetTextArray( str, pDXA.get() ); rDXArray = css::uno::Sequence<sal_Int32>( str.getLength() ); for(int i = 0; i < str.getLength(); i++) diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 5b6cf29334c5..54f6286b8993 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -465,7 +465,7 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex if( mpOutputDevice ) { InitOutputDevice( InitOutDevFlags::COLORS|InitOutDevFlags::FONT ); - std::unique_ptr<long []> pDXA(new long[rText.getLength()]); + std::unique_ptr<tools::Long []> pDXA(new tools::Long[rText.getLength()]); for(int i = 0; i < rText.getLength(); i++) { pDXA[i] = rLongs[i]; diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx index 20a06c010618..db5d1f1b05f4 100644 --- a/toolkit/source/awt/vclxspinbutton.cxx +++ b/toolkit/source/awt/vclxspinbutton.cxx @@ -95,7 +95,7 @@ namespace toolkit namespace { typedef void (SpinButton::*SetSpinButtonValue) (tools::Long); - typedef long (SpinButton::*GetSpinButtonValue) () const; + typedef tools::Long (SpinButton::*GetSpinButtonValue) () const; void lcl_setSpinButtonValue(vcl::Window* _pWindow, SetSpinButtonValue _pSetter, sal_Int32 _nValue ) diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 5c43a051d609..73be2beaf6de 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -31,16 +31,16 @@ void Color::IncreaseLuminance(sal_uInt8 cLumInc) { - R = sal_uInt8(std::clamp(tools::Long(R) + cLumInc, 0L, 255L)); - G = sal_uInt8(std::clamp(tools::Long(G) + cLumInc, 0L, 255L)); - B = sal_uInt8(std::clamp(tools::Long(B) + cLumInc, 0L, 255L)); + R = sal_uInt8(std::clamp(R + cLumInc, 0, 255)); + G = sal_uInt8(std::clamp(G + cLumInc, 0, 255)); + B = sal_uInt8(std::clamp(B + cLumInc, 0, 255)); } void Color::DecreaseLuminance(sal_uInt8 cLumDec) { - R = sal_uInt8(std::clamp(tools::Long(R) - cLumDec, 0L, 255L)); - G = sal_uInt8(std::clamp(tools::Long(G) - cLumDec, 0L, 255L)); - B = sal_uInt8(std::clamp(tools::Long(B) - cLumDec, 0L, 255L)); + R = sal_uInt8(std::clamp(R - cLumDec, 0, 255)); + G = sal_uInt8(std::clamp(G - cLumDec, 0, 255)); + B = sal_uInt8(std::clamp(B - cLumDec, 0, 255)); } void Color::DecreaseContrast(sal_uInt8 nContDec) @@ -50,9 +50,9 @@ void Color::DecreaseContrast(sal_uInt8 nContDec) const double fM = (128.0 - 0.4985 * nContDec) / 128.0; const double fOff = 128.0 - fM * 128.0; - R = sal_uInt8(std::clamp(FRound(R * fM + fOff), 0L, 255L)); - G = sal_uInt8(std::clamp(FRound(G * fM + fOff), 0L, 255L)); - B = sal_uInt8(std::clamp(FRound(B * fM + fOff), 0L, 255L)); + R = sal_uInt8(std::clamp(FRound(R * fM + fOff), tools::Long(0), tools::Long(255))); + G = sal_uInt8(std::clamp(FRound(G * fM + fOff), tools::Long(0), tools::Long(255))); + B = sal_uInt8(std::clamp(FRound(B * fM + fOff), tools::Long(0), tools::Long(255))); } } diff --git a/vcl/inc/bitmap/impoctree.hxx b/vcl/inc/bitmap/impoctree.hxx index 6b242a2a367c..aab1c53f5019 100644 --- a/vcl/inc/bitmap/impoctree.hxx +++ b/vcl/inc/bitmap/impoctree.hxx @@ -100,8 +100,9 @@ inline void ImpErrorQuad::ImplAddColorError7(const ImpErrorQuad& rErrQuad) inline BitmapColor ImpErrorQuad::ImplGetColor() { - return BitmapColor(std::clamp(nRed, 0L, 8160L) >> 5, std::clamp(nGreen, 0L, 8160L) >> 5, - std::clamp(nBlue, 0L, 8160L) >> 5); + return BitmapColor(std::clamp(nRed, tools::Long(0), tools::Long(8160)) >> 5, + std::clamp(nGreen, tools::Long(0), tools::Long(8160)) >> 5, + std::clamp(nBlue, tools::Long(0), tools::Long(8160)) >> 5); } #endif // INCLUDED_VCL_INC_IMPOCTREE_HXX diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index f0c758806f71..05f907dc66b9 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -102,10 +102,10 @@ public: virtual void DrawMenuBar() override; virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; virtual void Show( bool bVisible, bool bNoActivate = false ) override; - virtual void SetMinClientSize( long nWidth, long nHeight ) override; - virtual void SetMaxClientSize( long nWidth, long nHeight ) override; - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) override; - virtual void GetClientSize( long& rWidth, long& rHeight ) override; + virtual void SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; + virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; virtual void GetWorkArea( tools::Rectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState( const SalFrameState* pState ) override; @@ -116,7 +116,7 @@ public: virtual void ToTop( SalFrameToTop nFlags ) override; virtual void SetPointer( PointerStyle ePointerStyle ) override; virtual void CaptureMouse( bool bMouse ) override; - virtual void SetPointerPos( long nX, long nY ) override; + virtual void SetPointerPos( tools::Long nX, tools::Long nY ) override; using SalFrame::Flush; virtual void Flush() override; virtual void SetInputContext( SalInputContext* pContext ) override; @@ -136,7 +136,7 @@ public: virtual void SetApplicationID( const OUString &rApplicationID ) override; virtual void ResetClipRegion() override; virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; + virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void EndSetClipRegion() override; }; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index bec473b296b4..585cdd913825 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -130,8 +130,8 @@ public: SalTwoRect getTwoRect() const { return maRects; } - long getBitmapWidth() const { return maRects.mnSrcWidth; } - long getBitmapHeight() const { return maRects.mnSrcHeight; } + tools::Long getBitmapWidth() const { return maRects.mnSrcWidth; } + tools::Long getBitmapHeight() const { return maRects.mnSrcHeight; } /// Reset the DC with the defined color. void fill(sal_uInt32 color); @@ -227,10 +227,10 @@ public: protected: virtual bool setClipRegion( const vcl::Region& ) override; // draw --> LineColor and FillColor and RasterOp and ClipRegion - virtual void drawPixel( long nX, long nY ) override; - virtual void drawPixel( long nX, long nY, Color nColor ) override; - virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override; - virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) override; @@ -255,8 +255,8 @@ protected: virtual bool implDrawGradient(basegfx::B2DPolyPolygon const & rPolyPolygon, SalGradient const & rGradient) override; // CopyArea --> No RasterOp, but ClipRegion - virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, - long nSrcHeight, bool bWindowInvalidate ) override; + virtual void copyArea( tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, + tools::Long nSrcHeight, bool bWindowInvalidate ) override; // CopyBits and DrawBitmap --> RasterOp and ClipRegion // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics @@ -269,14 +269,14 @@ protected: const SalBitmap& rSalBitmap, Color nMaskColor ) override; - virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; - virtual Color getPixel( long nX, long nY ) override; + virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; + virtual Color getPixel( tools::Long nX, tools::Long nY ) override; // invert --> ClipRegion (only Windows or VirDevs) - virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override; + virtual void invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override; virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override; - virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uInt32 nSize ) override; + virtual bool drawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize ) override; // native widget rendering methods that require mirroring protected: @@ -308,7 +308,7 @@ public: const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap) override; - virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ) override; + virtual bool drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; private: // local helpers @@ -323,7 +323,7 @@ public: // get the depth of the device virtual sal_uInt16 GetBitCount() const override; // get the width of the device - virtual long GetGraphicsWidth() const override; + virtual tools::Long GetGraphicsWidth() const override; // set the clip region to empty virtual void ResetClipRegion() override; @@ -383,9 +383,9 @@ public: // embeddable by GetDevFontList or NULL in case of error // parameters: pFont: describes the font in question // pDataLen: out parameter, contains the byte length of the returned buffer - virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override; + virtual const void* GetEmbedFontData(const PhysicalFontFace*, tools::Long* pDataLen) override; // frees the font data again - virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override; + virtual void FreeEmbedFontData( const void* pData, tools::Long nDataLen ) override; virtual void GetGlyphWidths( const PhysicalFontFace*, bool bVertical, std::vector< sal_Int32 >& rWidths, diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index c06e51c84050..bd923390d077 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -50,7 +50,7 @@ public: virtual void DestroyObject( SalObject* pObject ) override; virtual std::unique_ptr<SalVirtualDevice> CreateVirtualDevice( SalGraphics* pGraphics, - long &nDX, long &nDY, + tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pSetupData ) override; diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h index 465c9ec778ab..e76c4787eb71 100644 --- a/vcl/inc/win/salobj.h +++ b/vcl/inc/win/salobj.h @@ -41,9 +41,9 @@ public: virtual void ResetClipRegion() override; virtual void BeginSetClipRegion( sal_uInt32 nRects ) override; - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight) override; + virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override; virtual void EndSetClipRegion() override; - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) override; + virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void Show( bool bVisible ) override; virtual void Enable( bool bEnable ) override; virtual void GrabFocus() override; diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 44b88525812e..c2a47ebb941f 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -59,7 +59,7 @@ public: virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override; virtual void GetPageInfo( const ImplJobSetup* pSetupData, - long& rOutWidth, long& rOutHeight, + tools::Long& rOutWidth, tools::Long& rOutHeight, Point& rPageOffset, Size& rPaperSize ) override; virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 4121d2c89979..7a776056c3a2 100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h @@ -41,8 +41,8 @@ private: sal_uInt16 mnBitCount; // BitCount (0 or 1) bool mbGraphics; // is Graphics used bool mbForeignDC; // uses a foreign DC instead of a bitmap - long mnWidth; - long mnHeight; + tools::Long mnWidth; + tools::Long mnHeight; public: HDC getHDC() const { return mhLocalDC; } @@ -50,18 +50,18 @@ public: void setGraphics(WinSalGraphics* pVirGraphics) { mpGraphics.reset(pVirGraphics); } WinSalVirtualDevice* getNext() const { return mpNext; } - WinSalVirtualDevice(HDC hDC = nullptr, HBITMAP hBMP = nullptr, sal_uInt16 nBitCount = 0, bool bForeignDC = false, long nWidth = 0, long nHeight = 0); + WinSalVirtualDevice(HDC hDC = nullptr, HBITMAP hBMP = nullptr, sal_uInt16 nBitCount = 0, bool bForeignDC = false, tools::Long nWidth = 0, tools::Long nHeight = 0); virtual ~WinSalVirtualDevice() override; virtual SalGraphics* AcquireGraphics() override; virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; - virtual bool SetSize( long nNewDX, long nNewDY ) override; + virtual bool SetSize( tools::Long nNewDX, tools::Long nNewDY ) override; - static HBITMAP ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppDummy); + static HBITMAP ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, tools::Long nDY, sal_uInt16 nBitCount, void **ppDummy); // SalGeometryProvider - virtual long GetWidth() const override { return mnWidth; } - virtual long GetHeight() const override { return mnHeight; } + virtual tools::Long GetWidth() const override { return mnWidth; } + virtual tools::Long GetHeight() const override { return mnHeight; } }; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index d2218590091b..a44ddbff68c8 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -858,8 +858,8 @@ void OpenGLSalGraphicsImpl::DrawRect( tools::Long nX, tools::Long nY, tools::Lon tools::Long nY1( nY ); tools::Long nX2( nX + nWidth ); tools::Long nY2( nY + nHeight ); - const SalPoint aPoints[] = { { nX1, nY2 }, { nX1, nY1 }, - { nX2, nY1 }, { nX2, nY2 }}; + const SalPoint aPoints[] = { { static_cast<sal_Int32>(nX1), static_cast<sal_Int32>(nY2) }, { static_cast<sal_Int32>(nX1), static_cast<sal_Int32>(nY1) }, + { static_cast<sal_Int32>(nX2), static_cast<sal_Int32>(nY1) }, { static_cast<sal_Int32>(nX2), static_cast<sal_Int32>(nY2) }}; DrawConvexPolygon( 4, aPoints, true ); } @@ -870,8 +870,8 @@ void OpenGLSalGraphicsImpl::DrawRect( const tools::Rectangle& rRect ) tools::Long nY1( rRect.Top() ); tools::Long nX2( rRect.Right() ); tools::Long nY2( rRect.Bottom() ); - const SalPoint aPoints[] = { { nX1, nY2 }, { nX1, nY1 }, - { nX2, nY1 }, { nX2, nY2 }}; + const SalPoint aPoints[] = { { static_cast<sal_Int32>(nX1), static_cast<sal_Int32>(nY2) }, { static_cast<sal_Int32>(nX1), static_cast<sal_Int32>(nY1) }, + { static_cast<sal_Int32>(nX2), static_cast<sal_Int32>(nY1) }, { static_cast<sal_Int32>(nX2), static_cast<sal_Int32>(nY2) }}; DrawConvexPolygon( 4, aPoints, true ); } diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index d9440df0795d..9659f8c91ee9 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -754,8 +754,9 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(tools::Long nX, tools::Long nY, t // The obnoxious "-1 DrawRect()" hack that I don't understand the purpose of (and I'm not sure // if anybody does), but without it some cases do not work. The max() is needed because Skia // will not draw anything if width or height is 0. - canvas->drawIRect( - SkIRect::MakeXYWH(nX, nY, std::max(1L, nWidth - 1), std::max(1L, nHeight - 1)), paint); + canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, std::max(tools::Long(1), nWidth - 1), + std::max(tools::Long(1), nHeight - 1)), + paint); } postDraw(); } diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx index 1febdf3503c5..b92a0124b458 100644 --- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx +++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx @@ -35,8 +35,8 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const { const tools::Long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; const tools::Long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; - std::unique_ptr<long[]> pColm(new long[nWidth2]); - std::unique_ptr<long[]> pRows(new long[nHeight2]); + std::unique_ptr<tools::Long[]> pColm(new tools::Long[nWidth2]); + std::unique_ptr<tools::Long[]> pRows(new tools::Long[nHeight2]); std::unique_ptr<BitmapColor[]> pColRow1(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow2(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow3(new BitmapColor[nWidth2]); @@ -45,7 +45,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const BitmapColor* pRowTmp3 = pColRow3.get(); BitmapColor* pColor; tools::Long nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp; - std::array<std::array<long, 256>, 9> aKoeff; + std::array<std::array<tools::Long, 256>, 9> aKoeff; tools::Long* pTmp; // create LUT of products of matrix value and possible color component values diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx index a19683ab6582..aa8dff8aaa29 100644 --- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx @@ -55,7 +55,8 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const const tools::Long nLz = FRound(sin(fElev) * 255.0); const auto nZ2 = ((6 * 255) / 4) * ((6 * 255) / 4); const tools::Long nNzLz = ((6 * 255) / 4) * nLz; - const sal_uInt8 cLz = static_cast<sal_uInt8>(std::clamp(nLz, 0L, 255L)); + const sal_uInt8 cLz + = static_cast<sal_uInt8>(std::clamp(nLz, tools::Long(0), tools::Long(255))); // fill mapping tables pHMap[0] = 0; diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx b/vcl/source/bitmap/BitmapFilterStackBlur.cxx index 9bf4b810ac60..d3e1ddea9310 100644 --- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx +++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx @@ -96,7 +96,7 @@ struct BlurArrays { for (tools::Long i = 0; i < maShared.mnDiv; i++) { - maPositionTable[i] = std::clamp(i - maShared.mnRadius, 0L, nLastIndex); + maPositionTable[i] = std::clamp(i - maShared.mnRadius, tools::Long(0), nLastIndex); maWeightTable[i] = maShared.mnRadius + 1 - std::abs(i - maShared.mnRadius); } } diff --git a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx index e6609f77d9f4..e34af85df300 100644 --- a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx @@ -120,7 +120,8 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) const nSum1 = static_cast<tools::Long>( sqrt(static_cast<double>(nSum1 * nSum1 + nSum2 * nSum2))); - aGrey.SetIndex(~static_cast<sal_uInt8>(std::clamp(nSum1, 0L, 255L))); + aGrey.SetIndex(~static_cast<sal_uInt8>( + std::clamp(nSum1, tools::Long(0), tools::Long(255)))); pWriteAcc->SetPixelOnData(pScanline, nX, aGrey); if (nX < (nWidth - 1)) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 27eaddaf1949..0484797de298 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -472,14 +472,14 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl const sal_Int32 nLen = aText.getLength(); tools::Long nDXBuffer[256]; - std::unique_ptr<long[]> pDXBuffer; + std::unique_ptr<tools::Long[]> pDXBuffer; tools::Long* pDX = nDXBuffer; if (nLen) { if (o3tl::make_unsigned(2 * nLen) > SAL_N_ELEMENTS(nDXBuffer)) { - pDXBuffer.reset(new long[2 * (nLen + 1)]); + pDXBuffer.reset(new tools::Long[2 * (nLen + 1)]); pDX = pDXBuffer.get(); } @@ -1068,14 +1068,14 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) tools::Long nTextPos = 0; tools::Long nDXBuffer[256]; - std::unique_ptr<long[]> pDXBuffer; + std::unique_ptr<tools::Long[]> pDXBuffer; tools::Long* pDX = nDXBuffer; if( !aText.isEmpty() ) { if( o3tl::make_unsigned(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { - pDXBuffer.reset(new long[2*(aText.getLength()+1)]); + pDXBuffer.reset(new tools::Long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); } @@ -1192,11 +1192,11 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const OUString aText = ImplGetText(); tools::Long nDXBuffer[256]; - std::unique_ptr<long[]> pDXBuffer; + std::unique_ptr<tools::Long[]> pDXBuffer; tools::Long* pDX = nDXBuffer; if( o3tl::make_unsigned(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { - pDXBuffer.reset(new long[2*(aText.getLength()+1)]); + pDXBuffer.reset(new tools::Long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); } @@ -2131,14 +2131,14 @@ void Edit::Command( const CommandEvent& rCEvt ) { OUString aText = ImplGetText(); tools::Long nDXBuffer[256]; - std::unique_ptr<long[]> pDXBuffer; + std::unique_ptr<tools::Long[]> pDXBuffer; tools::Long* pDX = nDXBuffer; if( !aText.isEmpty() ) { if( o3tl::make_unsigned(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { - pDXBuffer.reset(new long[2*(aText.getLength()+1)]); + pDXBuffer.reset(new tools::Long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); } diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 3b3b75204f81..b0681709eb2a 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -105,7 +105,7 @@ static boolean fill_input_buffer (j_decompress_ptr cinfo) return TRUE; } -static void skip_input_data (j_decompress_ptr cinfo, tools::Long numberOfBytes) +static void skip_input_data (j_decompress_ptr cinfo, long numberOfBytes) { SourceManagerStruct * source = reinterpret_cast<SourceManagerStruct *>(cinfo->src); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 63026cd2e7dc..b2d692e339dd 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -846,18 +846,18 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, c return; sal_uInt32 nNormWidth; - std::unique_ptr<long[]> pOwnArray; + std::unique_ptr<tools::Long[]> pOwnArray; tools::Long* pDX; // get text sizes if( pDXArray ) { nNormWidth = maVDev->GetTextWidth( rText ); - pDX = const_cast<long*>(pDXArray); + pDX = const_cast<tools::Long*>(pDXArray); } else { - pOwnArray.reset(new long[ nLen ]); + pOwnArray.reset(new tools::Long[ nLen ]); nNormWidth = maVDev->GetTextArray( rText, pOwnArray.get() ); pDX = pOwnArray.get(); } diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 43463c10e62e..515468386488 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -1196,7 +1196,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) pVirDev->SetFont( aSrcFont ); const sal_Int32 nLen = aTemp.getLength(); - std::unique_ptr<long[]> pDXAry(nLen ? new long[ nLen ] : nullptr); + std::unique_ptr<tools::Long[]> pDXAry(nLen ? new tools::Long[ nLen ] : nullptr); const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() ); if (nLen && nNormSize == 0) { diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 78ac64e7961f..3b0b1cd76bfb 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -591,7 +591,7 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color const * pExtColor) pWriteAcc->SetPalette(aPalette); - for (tools::Long nY = 0; nY < std::min(nHeight, 2L); nY++, nYTmp++) + for (tools::Long nY = 0; nY < std::min(nHeight, tools::Long(2)); nY++, nYTmp++) { pQLine2 = !nY ? aErrQuad1.data() : aErrQuad2.data(); Scanline pScanlineRead = pReadAcc->GetScanline(nYTmp); @@ -872,8 +872,8 @@ bool Bitmap::Dither() tools::Long nW2 = nW - 3; tools::Long nRErr, nGErr, nBErr; tools::Long nRC, nGC, nBC; - std::unique_ptr<long[]> p1(new long[ nW ]); - std::unique_ptr<long[]> p2(new long[ nW ]); + std::unique_ptr<tools::Long[]> p1(new tools::Long[ nW ]); + std::unique_ptr<tools::Long[]> p2(new tools::Long[ nW ]); tools::Long* p1T = p1.get(); tools::Long* p2T = p2.get(); tools::Long* pTmp; @@ -991,7 +991,7 @@ bool Bitmap::Dither() return bRet; } -void Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, const Link<long,void>* pProgress ) +void Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, const Link<tools::Long,void>* pProgress ) { ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, pProgress ); } diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 40c1d7aba529..5fdcac0b3255 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2181,16 +2181,16 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla tools::Long nVal; nVal = pSearchColors[ i ].GetRed(); - aColParam.pMinR[ i ] = static_cast<sal_uLong>(std::max( nVal, 0L )); - aColParam.pMaxR[ i ] = static_cast<sal_uLong>(std::min( nVal, 255L )); + aColParam.pMinR[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) )); + aColParam.pMaxR[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) )); nVal = pSearchColors[ i ].GetGreen(); - aColParam.pMinG[ i ] = static_cast<sal_uLong>(std::max( nVal, 0L )); - aColParam.pMaxG[ i ] = static_cast<sal_uLong>(std::min( nVal, 255L )); + aColParam.pMinG[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) )); + aColParam.pMaxG[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) )); nVal = pSearchColors[ i ].GetBlue(); - aColParam.pMinB[ i ] = static_cast<sal_uLong>(std::max( nVal, 0L )); - aColParam.pMaxB[ i ] = static_cast<sal_uLong>(std::min( nVal, 255L )); + aColParam.pMinB[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) )); + aColParam.pMaxB[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) )); } aColParam.pDstCols = pReplaceColors; diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 621a3592661a..f64d5c437c26 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -49,7 +49,7 @@ static constexpr tools::Long BACK_MAP( tools::Long _def_nVal ) { return ((_def_nVal + 2) >> 2) - 1; } -static void VECT_PROGRESS( const Link<long, void>* pProgress, tools::Long _def_nVal ) +static void VECT_PROGRESS( const Link<tools::Long, void>* pProgress, tools::Long _def_nVal ) { if(pProgress) pProgress->Call(_def_nVal); @@ -642,7 +642,7 @@ void ImplChain::ImplPostProcess( const ImplPointArray& rArr ) namespace ImplVectorizer { bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, - sal_uInt8 cReduce, const Link<long,void>* pProgress ) + sal_uInt8 cReduce, const Link<tools::Long,void>* pProgress ) { bool bRet = false; diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx index 017b2dc1a728..41f0884e9626 100644 --- a/vcl/source/gdi/impvect.hxx +++ b/vcl/source/gdi/impvect.hxx @@ -27,7 +27,7 @@ namespace tools { class PolyPolygon; } namespace ImplVectorizer { bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, - sal_uInt8 cReduce, const Link<long,void>* pProgress ); + sal_uInt8 cReduce, const Link<tools::Long,void>* pProgress ); }; #endif diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index ac70349d4647..2a1bb8562438 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1091,7 +1091,7 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) : { if( rAction.mpDXAry ) { - mpDXAry.reset( new long[ mnLen ] ); + mpDXAry.reset( new tools::Long[ mnLen ] ); memcpy( mpDXAry.get(), rAction.mpDXAry.get(), mnLen * sizeof( long ) ); } } @@ -1111,7 +1111,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, if (nAryLen > 0) { - mpDXAry.reset( new long[ nAryLen ] ); + mpDXAry.reset( new tools::Long[ nAryLen ] ); memcpy( mpDXAry.get(), pDXAry, nAryLen * sizeof(long) ); } } @@ -1194,7 +1194,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) // #i9762#, #106172# Ensure that DX array is at least mnLen entries long if ( mnLen >= nAryLen ) { - mpDXAry.reset( new (std::nothrow)long[ mnLen ] ); + mpDXAry.reset( new (std::nothrow)tools::Long[ mnLen ] ); if ( mpDXAry ) { sal_Int32 i; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 16db9ad61bd4..756752275b51 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -240,7 +240,7 @@ void Printer::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly, tools::Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() ); const Size aDPISize( LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)) ); - const tools::Long nBaseExtent = std::max( FRound( aDPISize.Width() / 300. ), 1L ); + const tools::Long nBaseExtent = std::max<tools::Long>( FRound( aDPISize.Width() / 300. ), 1 ); tools::Long nMove; const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 : ( nTransparencePercent < 38 ) ? 25 : diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 16fa84ab95d5..7beea9a01091 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1486,7 +1486,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, tools::Long* pCaretXArray if( mnLevel <= 1 ) return; - std::unique_ptr<long[]> const pTempPos(new long[nMaxIndex]); + std::unique_ptr<tools::Long[]> const pTempPos(new tools::Long[nMaxIndex]); for( int n = 1; n < mnLevel; ++n ) { mpLayouts[ n ]->GetCaretPositions( nMaxIndex, pTempPos.get() ); diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index aa9220b53136..a077e50be4d6 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -363,15 +363,15 @@ std::unique_ptr<BitmapBuffer> StretchAndConvert( std::unique_ptr<Scanline[]> pSrcScan; std::unique_ptr<Scanline[]> pDstScan; - std::unique_ptr<long[]> pMapX; - std::unique_ptr<long[]> pMapY; + std::unique_ptr<tools::Long[]> pMapX; + std::unique_ptr<tools::Long[]> pMapY; try { pSrcScan.reset(new Scanline[rSrcBuffer.mnHeight]); pDstScan.reset(new Scanline[pDstBuffer->mnHeight]); - pMapX.reset(new long[pDstBuffer->mnWidth]); - pMapY.reset(new long[pDstBuffer->mnHeight]); + pMapX.reset(new tools::Long[pDstBuffer->mnWidth]); + pMapY.reset(new tools::Long[pDstBuffer->mnHeight]); } catch( const std::bad_alloc& ) { diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index 2af54eabf368..6912654a6164 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -713,7 +713,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) OUString aStr(OStringToOUString(aByteStr, eActualCharSet)); - std::unique_ptr<long[]> pDXAry; + std::unique_ptr<tools::Long[]> pDXAry; if (nAryLen > 0) { const size_t nMinRecordSize = sizeof(sal_Int32); @@ -740,7 +740,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { - pDXAry.reset(new long[nDXAryLen]); + pDXAry.reset(new tools::Long[nDXAryLen]); for (sal_Int32 j = 0; j < nAryLen; ++j) { @@ -753,7 +753,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { if (nAryLen+1 == nStrLen && nIndex >= 0) { - std::unique_ptr<long[]> pTmpAry(new long[nStrLen]); + std::unique_ptr<tools::Long[]> pTmpAry(new tools::Long[nStrLen]); aFontVDev->GetTextArray( aStr, pTmpAry.get(), nIndex, nLen ); diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 988c5bfa578f..ea86aa47b049 100644 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -207,7 +207,7 @@ namespace vcl return; } - std::unique_ptr<long[]> pCharWidths(new long[ _nLength ]); + std::unique_ptr<tools::Long[]> pCharWidths(new tools::Long[ _nLength ]); tools::Long nTextWidth = GetTextArray( _rText, pCharWidths.get(), _nStartIndex, _nLength ); m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths.get(), _nStartIndex, _nLength ); pCharWidths.reset(); diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx index aa8b5a3169b7..a34e8a064d46 100644 --- a/vcl/source/graphic/GraphicObject.cxx +++ b/vcl/source/graphic/GraphicObject.cxx @@ -527,8 +527,8 @@ void GraphicObject::DrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea const MapMode aOutMapMode( pOut->GetMapMode() ); // #106258# Clamp size to 1 for zero values. This is okay, since // logical size of zero is handled above already - const Size aOutTileSize( ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), - ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); + const Size aOutTileSize( ::std::max( tools::Long(1), pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), + ::std::max( tools::Long(1), pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); //#i69780 clip final tile size to a sane max size while ((static_cast<sal_Int64>(rSize.Width()) * nTileCacheSize1D) > SAL_MAX_UINT16) diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index ad25020a620e..7b6e8ab6be91 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -726,19 +726,19 @@ namespace struct LinearScaleContext { - std::unique_ptr<long[]> mpMapX; - std::unique_ptr<long[]> mpMapY; + std::unique_ptr<tools::Long[]> mpMapX; + std::unique_ptr<tools::Long[]> mpMapY; - std::unique_ptr<long[]> mpMapXOffset; - std::unique_ptr<long[]> mpMapYOffset; + std::unique_ptr<tools::Long[]> mpMapXOffset; + std::unique_ptr<tools::Long[]> mpMapYOffset; LinearScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const & aBitmapRect, Size const & aOutSize, tools::Long nOffX, tools::Long nOffY) - : mpMapX(new long[aDstRect.GetWidth()]) - , mpMapY(new long[aDstRect.GetHeight()]) - , mpMapXOffset(new long[aDstRect.GetWidth()]) - , mpMapYOffset(new long[aDstRect.GetHeight()]) + : mpMapX(new tools::Long[aDstRect.GetWidth()]) + , mpMapY(new tools::Long[aDstRect.GetHeight()]) + , mpMapXOffset(new tools::Long[aDstRect.GetWidth()]) + , mpMapYOffset(new tools::Long[aDstRect.GetHeight()]) { const tools::Long nSrcWidth = aBitmapRect.GetWidth(); const tools::Long nSrcHeight = aBitmapRect.GetHeight(); @@ -760,7 +760,7 @@ private: const double fReverseScale = (std::abs(nOutDimension) > 1) ? (nSrcDimension - 1) / double(std::abs(nOutDimension) - 1) : 0.0; - tools::Long nSampleRange = std::max(0L, nSrcDimension - 2); + tools::Long nSampleRange = std::max(tools::Long(0), nSrcDimension - 2); for (tools::Long i = 0; i < nDstDimension; i++) { @@ -893,14 +893,14 @@ public: struct TradScaleContext { - std::unique_ptr<long[]> mpMapX; - std::unique_ptr<long[]> mpMapY; + std::unique_ptr<tools::Long[]> mpMapX; + std::unique_ptr<tools::Long[]> mpMapY; TradScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const & aBitmapRect, Size const & aOutSize, tools::Long nOffX, tools::Long nOffY) - : mpMapX(new long[aDstRect.GetWidth()]) - , mpMapY(new long[aDstRect.GetHeight()]) + : mpMapX(new tools::Long[aDstRect.GetWidth()]) + , mpMapY(new tools::Long[aDstRect.GetHeight()]) { const tools::Long nSrcWidth = aBitmapRect.GetWidth(); const tools::Long nSrcHeight = aBitmapRect.GetHeight(); diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index d67430da187d..32852eefc34e 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -479,7 +479,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, tools::Long nStepCount = GetGradientSteps( rGradient, rRect, false/*bMtf*/, true/*bComplex*/ ); // at least three steps and at most the number of colour differences - tools::Long nSteps = std::max( nStepCount, 2L ); + tools::Long nSteps = std::max( nStepCount, tools::Long(2) ); tools::Long nCalcSteps = std::abs( nRedSteps ); tools::Long nTempSteps = std::abs( nGreenSteps ); if ( nTempSteps > nCalcSteps ) @@ -829,7 +829,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const tools::Rectangle& rRect, tools::Long nStepCount = GetGradientSteps( rGradient, rRect, true, true ); // at least three steps and at most the number of colour differences - tools::Long nSteps = std::max( nStepCount, 2L ); + tools::Long nSteps = std::max( nStepCount, tools::Long(2) ); tools::Long nCalcSteps = std::abs( nRedSteps ); tools::Long nTempSteps = std::abs( nGreenSteps ); if ( nTempSteps > nCalcSteps ) diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index bb2cb67cb1ac..44cf941149bb 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -167,7 +167,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& { tools::Rectangle aRect( rPolyPoly.GetBoundRect() ); const tools::Long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 ); - const tools::Long nWidth = ImplDevicePixelToLogicWidth( std::max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), 3L ) ); + const tools::Long nWidth = ImplDevicePixelToLogicWidth( std::max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), tools::Long(3) ) ); std::unique_ptr<Point[]> pPtBuffer(new Point[ HATCH_MAXPOINTS ]); Point aPt1, aPt2, aEndPt1; Size aInc; diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 2a1b46ae0b72..a2134bd468d5 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -588,12 +588,12 @@ LineInfo OutputDevice::ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const if( aInfo.GetStyle() == LineStyle::Dash ) { if( aInfo.GetDotCount() && aInfo.GetDotLen() ) - aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), 1L ) ); + aInfo.SetDotLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), tools::Long(1) ) ); else aInfo.SetDotCount( 0 ); if( aInfo.GetDashCount() && aInfo.GetDashLen() ) - aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), 1L ) ); + aInfo.SetDashLen( std::max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), tools::Long(1) ) ); else aInfo.SetDashCount( 0 ); diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx index 252cbc308daf..9252959d0f5e 100644 --- a/vcl/source/outdev/rect.cxx +++ b/vcl/source/outdev/rect.cxx @@ -251,8 +251,8 @@ void OutputDevice::DrawGrid( const tools::Rectangle& rRect, const Size& rDist, D if( mbOutputClipped ) return; - const tools::Long nDistX = std::max( rDist.Width(), 1L ); - const tools::Long nDistY = std::max( rDist.Height(), 1L ); + const tools::Long nDistX = std::max( rDist.Width(), tools::Long(1) ); + const tools::Long nDistY = std::max( rDist.Height(), tools::Long(1) ); tools::Long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX ); tools::Long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY ); const tools::Long nRight = aDstRect.Right(); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 8573affbae99..0057fb4a2a14 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1622,7 +1622,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta tools::Long nMnemonicY; DeviceCoordinate nMnemonicWidth; - std::unique_ptr<long[]> const pCaretXArray(new long[2 * nLineLen]); + std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * nLineLen]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLineLen ); tools::Long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; @@ -1691,7 +1691,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta DeviceCoordinate nMnemonicWidth = 0; if ( nMnemonicPos != -1 ) { - std::unique_ptr<long[]> const pCaretXArray(new long[2 * aStr.getLength()]); + std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * aStr.getLength()]); /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray.get(), 0, aStr.getLength() ); tools::Long lc_x1 = pCaretXArray[2*nMnemonicPos]; tools::Long lc_x2 = pCaretXArray[2*nMnemonicPos+1]; @@ -2129,7 +2129,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, nMnemonicPos = nLen-1; } - std::unique_ptr<long[]> const pCaretXArray(new long[2 * nLen]); + std::unique_ptr<tools::Long[]> const pCaretXArray(new tools::Long[2 * nLen]); /*sal_Bool bRet =*/ GetCaretPositions( aStr, pCaretXArray.get(), nIndex, nLen, pGlyphs ); tools::Long lc_x1 = pCaretXArray[ 2*(nMnemonicPos - nIndex) ]; tools::Long lc_x2 = pCaretXArray[ 2*(nMnemonicPos - nIndex)+1 ]; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 800b869f0676..1f13715a5e7f 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1577,7 +1577,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) if( nMaxWidth > nScreenWidth/2 ) nMaxWidth = nScreenWidth/2; - sal_uInt16 gfxExtra = static_cast<sal_uInt16>(std::max( nExtra, 7L )); // #107710# increase space between checkmarks/images/text + sal_uInt16 gfxExtra = static_cast<sal_uInt16>(std::max( nExtra, tools::Long(7) )); // #107710# increase space between checkmarks/images/text nImgOrChkPos = static_cast<sal_uInt16>(nExtra); tools::Long nImgOrChkWidth = 0; if( aMaxSize.Height() > 0 ) // NWF case @@ -2968,7 +2968,7 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R SAL_WARN_IF(nMaxHeight < 768, "vcl", "Available height misdetected as " << nMaxHeight << "px. Setting to 768px instead."); - nMaxHeight = std::max(nMaxHeight, 768l); + nMaxHeight = std::max(nMaxHeight, tools::Long(768)); if (pStartedFrom && pStartedFrom->IsMenuBar()) nMaxHeight -= pW->GetSizePixel().Height(); diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 2d26fcff10e8..d43eccb2725c 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1762,7 +1762,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) { std::vector< ImplSplitItem >& rItems = mpSplitSet->mvItems; sal_uInt16 nItems = mpSplitSet->mvItems.size(); - mpLastSizes = new long[nItems*2]; + mpLastSizes = new tools::Long[nItems*2]; for ( sal_uInt16 i = 0; i < nItems; i++ ) { mpLastSizes[i*2] = rItems[i].mnSize; diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index a16cce9c39f0..8e396207df92 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -707,15 +707,15 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) if( std::abs(g.nX-aState.mnX) < 2 && std::abs(g.nY-aState.mnY) < 5 ) { tools::Long displacement = g.nTopDecoration ? g.nTopDecoration : 20; - if( aState.mnX + displacement + aState.mnWidth + g.nRightDecoration > o3tl::make_unsigned(aDesktop.Right()) || - aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration > o3tl::make_unsigned(aDesktop.Bottom()) ) + if( static_cast<tools::Long>(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > aDesktop.Right() || + static_cast<tools::Long>(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > aDesktop.Bottom() ) { // displacing would leave screen aState.mnX = g.nLeftDecoration ? g.nLeftDecoration : 10; // should result in (0,0) aState.mnY = displacement; if( bWrapped || - aState.mnX + displacement + aState.mnWidth + g.nRightDecoration > o3tl::make_unsigned(aDesktop.Right()) || - aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration > o3tl::make_unsigned(aDesktop.Bottom()) ) + static_cast<tools::Long>(aState.mnX + displacement + aState.mnWidth + g.nRightDecoration) > aDesktop.Right() || + static_cast<tools::Long>(aState.mnY + displacement + aState.mnHeight + g.nBottomDecoration) > aDesktop.Bottom() ) break; // further displacement not possible -> break // avoid endless testing bWrapped = true; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index b5964319ab22..ecfec5c8dccf 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -247,7 +247,7 @@ void WinSalGraphicsImpl::freeResources() { } -bool WinSalGraphicsImpl::drawEPS(long, long, long, long, void*, sal_uInt32) +bool WinSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, sal_uInt32) { return false; } @@ -332,9 +332,9 @@ void ImplCalcOutSideRgn( const RECT& rSrcRect, } // namespace -void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY, - long nSrcX, long nSrcY, - long nSrcWidth, long nSrcHeight, +void WinSalGraphicsImpl::copyArea( tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate ) { bool bRestoreClipRgn = false; @@ -735,8 +735,8 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, BitBlt( hDC, nDstX, nDstY, nDstWidth, nDstHeight, hMemDC.get(), 0, 0, SRCCOPY ); } -bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) +bool WinSalGraphicsImpl::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, sal_uInt8 nTransparency ) { if( mbPen || !mbBrush || mbXORMode ) return false; // can only perform solid fills without XOR. @@ -790,7 +790,7 @@ void WinSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, ImplDrawBitmap( hDC, aPosAry, rSalBitmap, false, 0x00B8074AUL ); } -std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY ) +std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) { SAL_WARN_IF( mrParent.isPrinter(), "vcl", "No ::GetBitmap() from printer possible!" ); @@ -829,7 +829,7 @@ std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( long nX, long nY, long return pSalBitmap; } -Color WinSalGraphicsImpl::getPixel( long nX, long nY ) +Color WinSalGraphicsImpl::getPixel( tools::Long nX, tools::Long nY ) { COLORREF aWinCol = ::GetPixel( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY) ); @@ -859,7 +859,7 @@ HBRUSH Get50PercentBrush() } // namespace -void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) +void WinSalGraphicsImpl::invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags ) { if ( nFlags & SalInvert::TrackFrame ) { @@ -953,7 +953,7 @@ sal_uInt16 WinSalGraphicsImpl::GetBitCount() const return static_cast<sal_uInt16>(GetDeviceCaps( mrParent.getHDC(), BITSPIXEL )); } -long WinSalGraphicsImpl::GetGraphicsWidth() const +tools::Long WinSalGraphicsImpl::GetGraphicsWidth() const { if( mrParent.gethWnd() && IsWindow( mrParent.gethWnd() ) ) { @@ -1574,12 +1574,12 @@ void WinSalGraphicsImpl::DrawPixelImpl( long nX, long nY, COLORREF crColor ) PatBlt(hDC, static_cast<int>(nX), static_cast<int>(nY), int(1), int(1), PATINVERT); } -void WinSalGraphicsImpl::drawPixel( long nX, long nY ) +void WinSalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY ) { DrawPixelImpl( nX, nY, mnPenColor ); } -void WinSalGraphicsImpl::drawPixel( long nX, long nY, Color nColor ) +void WinSalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY, Color nColor ) { COLORREF nCol = PALETTERGB( nColor.GetRed(), nColor.GetGreen(), @@ -1593,7 +1593,7 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, Color nColor ) DrawPixelImpl( nX, nY, nCol ); } -void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 ) +void WinSalGraphicsImpl::drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) { MoveToEx( mrParent.getHDC(), static_cast<int>(nX1), static_cast<int>(nY1), nullptr ); @@ -1604,7 +1604,7 @@ void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 ) DrawPixelImpl( nX2, nY2, mnPenColor ); } -void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight ) +void WinSalGraphicsImpl::drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) { if ( !mbPen ) { diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 92ef89e3f221..c6844a2b4325 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -78,7 +78,7 @@ public: virtual sal_uInt16 GetBitCount() const override; // get the width of the device - virtual long GetGraphicsWidth() const override; + virtual tools::Long GetGraphicsWidth() const override; // set the clip region to empty virtual void ResetClipRegion() override; @@ -107,12 +107,12 @@ public: virtual void SetROPFillColor( SalROPColor nROPColor ) override; // draw --> LineColor and FillColor and RasterOp and ClipRegion - virtual void drawPixel( long nX, long nY ) override; - virtual void drawPixel( long nX, long nY, Color nColor ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY ) override; + virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; - virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override; + virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; - virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; + virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; @@ -154,9 +154,9 @@ public: // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( - long nDestX, long nDestY, - long nSrcX, long nSrcY, - long nSrcWidth, long nSrcHeight, bool bWindowInvalidate ) override; + tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate ) override; // CopyBits and DrawBitmap --> RasterOp and ClipRegion // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics @@ -174,21 +174,21 @@ public: const SalBitmap& rSalBitmap, Color nMaskColor ) override; - virtual std::shared_ptr<SalBitmap> getBitmap( long nX, long nY, long nWidth, long nHeight ) override; + virtual std::shared_ptr<SalBitmap> getBitmap( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; - virtual Color getPixel( long nX, long nY ) override; + virtual Color getPixel( tools::Long nX, tools::Long nY ) override; // invert --> ClipRegion (only Windows or VirDevs) virtual void invert( - long nX, long nY, - long nWidth, long nHeight, + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, SalInvert nFlags) override; virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override; virtual bool drawEPS( - long nX, long nY, - long nWidth, long nHeight, + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize ) override; @@ -234,8 +234,8 @@ public: fully transparent rectangle */ virtual bool drawAlphaRect( - long nX, long nY, - long nWidth, long nHeight, + tools::Long nX, tools::Long nY, + tools::Long nWidth, tools::Long nHeight, sal_uInt8 nTransparency ) override; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index ac9316a8ca29..c1d209f4d765 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1614,7 +1614,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, pEncoding, pGlyphWidths, nGlyphCount); } -const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, long* pDataLen) +const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, tools::Long* pDataLen) { // create matching FontSelectPattern // we need just enough to get to the font file data @@ -1635,7 +1635,7 @@ const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, long return pData; } -void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ ) +void WinSalGraphics::FreeEmbedFontData( const void* pData, tools::Long /*nLen*/ ) { delete[] static_cast<char const *>(pData); } diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index 813ce8c4e9da..f117bc9a9ba0 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -714,7 +714,7 @@ sal_uInt16 WinSalGraphics::GetBitCount() const return mpImpl->GetBitCount(); } -long WinSalGraphics::GetGraphicsWidth() const +tools::Long WinSalGraphics::GetGraphicsWidth() const { return mpImpl->GetGraphicsWidth(); } @@ -770,22 +770,22 @@ void WinSalGraphics::SetROPFillColor( SalROPColor nROPColor ) mpImpl->SetROPFillColor( nROPColor ); } -void WinSalGraphics::drawPixel( long nX, long nY ) +void WinSalGraphics::drawPixel( tools::Long nX, tools::Long nY ) { mpImpl->drawPixel( nX, nY ); } -void WinSalGraphics::drawPixel( long nX, long nY, Color nColor ) +void WinSalGraphics::drawPixel( tools::Long nX, tools::Long nY, Color nColor ) { mpImpl->drawPixel( nX, nY, nColor ); } -void WinSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) +void WinSalGraphics::drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) { mpImpl->drawLine( nX1, nY1, nX2, nY2 ); } -void WinSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) +void WinSalGraphics::drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) { mpImpl->drawRect( nX, nY, nWidth, nHeight ); } @@ -913,7 +913,7 @@ static bool ImplGetBoundingBox( double* nNumb, BYTE* pSource, sal_uLong nSize ) #define POSTSCRIPT_BUFSIZE 0x4000 // MAXIMUM BUFSIZE EQ 0xFFFF -bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uInt32 nSize ) +bool WinSalGraphics::drawEPS( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize ) { bool bRetValue = false; diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx index fdac864d0f32..e23ebb4430a8 100644 --- a/vcl/win/gdi/salgdi2.cxx +++ b/vcl/win/gdi/salgdi2.cxx @@ -57,9 +57,9 @@ void WinSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraph mpImpl->copyBits( rPosAry, pSrcGraphics ); } -void WinSalGraphics::copyArea( long nDestX, long nDestY, - long nSrcX, long nSrcY, - long nSrcWidth, long nSrcHeight, +void WinSalGraphics::copyArea( tools::Long nDestX, tools::Long nDestY, + tools::Long nSrcX, tools::Long nSrcY, + tools::Long nSrcWidth, tools::Long nSrcHeight, bool bWindowInvalidate ) { mpImpl->copyArea( nDestX, nDestY, nSrcX, nSrcY, @@ -212,8 +212,8 @@ void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry, } } -bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) +bool WinSalGraphics::drawAlphaRect( tools::Long nX, tools::Long nY, tools::Long nWidth, + tools::Long nHeight, sal_uInt8 nTransparency ) { return mpImpl->drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); } @@ -225,17 +225,17 @@ void WinSalGraphics::drawMask( const SalTwoRect& rPosAry, mpImpl->drawMask( rPosAry, rSSalBitmap, nMaskColor ); } -std::shared_ptr<SalBitmap> WinSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) +std::shared_ptr<SalBitmap> WinSalGraphics::getBitmap( tools::Long nX, tools::Long nY, tools::Long nDX, tools::Long nDY ) { return mpImpl->getBitmap( nX, nY, nDX, nDY ); } -Color WinSalGraphics::getPixel( long nX, long nY ) +Color WinSalGraphics::getPixel( tools::Long nX, tools::Long nY ) { return mpImpl->getPixel( nX, nY ); } -void WinSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) +void WinSalGraphics::invert( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags ) { mpImpl->invert( nX, nY, nWidth, nHeight, nFlags ); } diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index ea48833d4c3c..d552d17ed96b 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1261,7 +1261,7 @@ sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, P } void WinSalInfoPrinter::GetPageInfo( const ImplJobSetup*, - long& rOutWidth, long& rOutHeight, + tools::Long& rOutWidth, tools::Long& rOutHeight, Point& rPageOffset, Size& rPaperSize ) { diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index e1cacb8b098a..489c5f0bebf1 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -32,7 +32,7 @@ #include <sal/log.hxx> #include <o3tl/temporary.hxx> -HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, sal_uInt16 nBitCount, void **ppData) +HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, tools::Long nDY, sal_uInt16 nBitCount, void **ppData) { HBITMAP hBitmap; @@ -73,7 +73,7 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, } std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, - long &nDX, long &nDY, + tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData* pData ) { @@ -141,7 +141,7 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi return std::unique_ptr<SalVirtualDevice>(pVDev); } -WinSalVirtualDevice::WinSalVirtualDevice(HDC hDC, HBITMAP hBMP, sal_uInt16 nBitCount, bool bForeignDC, long nWidth, long nHeight) +WinSalVirtualDevice::WinSalVirtualDevice(HDC hDC, HBITMAP hBMP, sal_uInt16 nBitCount, bool bForeignDC, tools::Long nWidth, tools::Long nHeight) : mhLocalDC(hDC), // HDC or 0 for Cache Device mhBmp(hBMP), // Memory Bitmap mnBitCount(nBitCount), // BitCount (0 or 1) @@ -197,7 +197,7 @@ void WinSalVirtualDevice::ReleaseGraphics( SalGraphics* ) mbGraphics = false; } -bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) +bool WinSalVirtualDevice::SetSize( tools::Long nDX, tools::Long nDY ) { if( mbForeignDC || !mhBmp ) return true; // ??? diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 13ae25af8225..ab4102056604 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -1214,19 +1214,19 @@ void WinSalFrame::Show( bool bVisible, bool bNoActivate ) ImplSalShow( mhWnd, bVisible, bNoActivate ); } -void WinSalFrame::SetMinClientSize( long nWidth, long nHeight ) +void WinSalFrame::SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) { mnMinWidth = nWidth; mnMinHeight = nHeight; } -void WinSalFrame::SetMaxClientSize( long nWidth, long nHeight ) +void WinSalFrame::SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) { mnMaxWidth = nWidth; mnMaxHeight = nHeight; } -void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, +void WinSalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) { bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; @@ -1578,7 +1578,7 @@ void WinSalFrame::GetWorkArea( tools::Rectangle &rRect ) rRect.SetBottom( aRect.bottom-1 ); } -void WinSalFrame::GetClientSize( long& rWidth, long& rHeight ) +void WinSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) { rWidth = maGeometry.nWidth; rHeight = maGeometry.nHeight; @@ -1614,10 +1614,10 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState ) RECT aRect2 = aWinRect; AdjustWindowRectEx( &aRect2, GetWindowStyle( mhWnd ), FALSE, GetWindowExStyle( mhWnd ) ); - long nTopDeco = abs( aWinRect.top - aRect2.top ); - long nLeftDeco = abs( aWinRect.left - aRect2.left ); - long nBottomDeco = abs( aWinRect.bottom - aRect2.bottom ); - long nRightDeco = abs( aWinRect.right - aRect2.right ); + tools::Long nTopDeco = abs( aWinRect.top - aRect2.top ); + tools::Long nLeftDeco = abs( aWinRect.left - aRect2.left ); + tools::Long nBottomDeco = abs( aWinRect.bottom - aRect2.bottom ); + tools::Long nRightDeco = abs( aWinRect.right - aRect2.right ); // adjust window position/size to fit the screen if ( !(pState->mnMask & (WindowStateMask::X | WindowStateMask::Y)) ) @@ -2176,7 +2176,7 @@ void WinSalFrame::CaptureMouse( bool bCapture ) SendMessageW( mhWnd, nMsg, 0, 0 ); } -void WinSalFrame::SetPointerPos( long nX, long nY ) +void WinSalFrame::SetPointerPos( tools::Long nX, tools::Long nY ) { POINT aPt; aPt.x = static_cast<int>(nX); @@ -2927,15 +2927,15 @@ void WinSalFrame::BeginSetClipRegion( sal_uInt32 nRects ) mbFirstClipRect = true; } -void WinSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) +void WinSalFrame::UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) { if( ! mpClipRgnData ) return; RECT* pRect = mpNextClipRect; RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); - long nRight = nX + nWidth; - long nBottom = nY + nHeight; + tools::Long nRight = nX + nWidth; + tools::Long nBottom = nY + nHeight; if ( mbFirstClipRect ) { @@ -4520,7 +4520,7 @@ static LRESULT ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam ) Size checkSize( GetSystemMetrics( SM_CXMENUCHECK ), GetSystemMetrics( SM_CYMENUCHECK ) ); pMI->itemWidth = checkSize.Width() + 3 + bmpSize.Width() + 3 + strSize.cx; - pMI->itemHeight = std::max( std::max( checkSize.Height(), bmpSize.Height() ), strSize.cy ); + pMI->itemHeight = std::max( std::max( checkSize.Height(), bmpSize.Height() ), tools::Long(strSize.cy) ); pMI->itemHeight += 4; DeleteObject( SelectObject(hdc, hfntOld) ); diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx index de9a7e45fb90..e2ba3856b1de 100644 --- a/vcl/win/window/salobj.cxx +++ b/vcl/win/window/salobj.cxx @@ -622,12 +622,12 @@ void WinSalObject::BeginSetClipRegion( sal_uInt32 nRectCount ) mbFirstClipRect = true; } -void WinSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) +void WinSalObject::UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) { RECT* pRect = mpNextClipRect; RECT* pBoundRect = &(mpClipRgnData->rdh.rcBound); - long nRight = nX + nWidth; - long nBottom = nY + nHeight; + tools::Long nRight = nX + nWidth; + tools::Long nBottom = nY + nHeight; if ( mbFirstClipRect ) { @@ -682,7 +682,7 @@ void WinSalObject::EndSetClipRegion() SetWindowRgn( mhWnd, hRegion, TRUE ); } -void WinSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) +void WinSalObject::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) { sal_uLong nStyle = 0; bool bVisible = (GetWindowStyle( mhWnd ) & WS_VISIBLE) != 0; diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 36711fc58084..09b1f47608e0 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -642,7 +642,7 @@ public: } // DX array rendering - std::unique_ptr<long[]> pItems(new long[aText.getLength()+10]); + std::unique_ptr<tools::Long[]> pItems(new tools::Long[aText.getLength()+10]); rDev.GetTextArray(aText, pItems.get()); for (tools::Long j = 0; j < aText.getLength(); ++j) { diff --git a/writerperfect/inc/DirectoryStream.hxx b/writerperfect/inc/DirectoryStream.hxx index 109d6cef65af..57e8380c6b22 100644 --- a/writerperfect/inc/DirectoryStream.hxx +++ b/writerperfect/inc/DirectoryStream.hxx @@ -45,8 +45,8 @@ public: virtual librevenge::RVNGInputStream* getSubStreamById(unsigned id) override; virtual const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead) override; - virtual int seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) override; - virtual tools::Long tell() override; + virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; + virtual long tell() override; virtual bool isEnd() override; private: diff --git a/writerperfect/inc/WPXSvInputStream.hxx b/writerperfect/inc/WPXSvInputStream.hxx index becfefd1d6f5..052cf4082ed7 100644 --- a/writerperfect/inc/WPXSvInputStream.hxx +++ b/writerperfect/inc/WPXSvInputStream.hxx @@ -40,8 +40,8 @@ public: virtual librevenge::RVNGInputStream* getSubStreamById(unsigned id) override; virtual const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead) override; - virtual int seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) override; - virtual tools::Long tell() override; + virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; + virtual long tell() override; virtual bool isEnd() override; private: diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 6cf948e371ce..83035d8b9926 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -89,11 +89,11 @@ public: */ const unsigned char* read(unsigned long, unsigned long&) override { return nullptr; } //! returns actual offset position - tools::Long tell() override { return 0; } + long tell() override { return 0; } /*! \brief seeks to an offset position, from actual, beginning or ending position * \return 0 if ok */ - int seek(tools::Long, librevenge::RVNG_SEEK_TYPE) override { return 1; } + int seek(long, librevenge::RVNG_SEEK_TYPE) override { return 1; } //! returns true if we are at the end of the section/file bool isEnd() override { return true; } diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx index eb275abec5e5..19ec454b293e 100644 --- a/writerperfect/source/common/DirectoryStream.cxx +++ b/writerperfect/source/common/DirectoryStream.cxx @@ -211,9 +211,9 @@ const unsigned char* DirectoryStream::read(unsigned long, unsigned long& nNumByt return nullptr; } -int DirectoryStream::seek(tools::Long, librevenge::RVNG_SEEK_TYPE) { return -1; } +int DirectoryStream::seek(long, librevenge::RVNG_SEEK_TYPE) { return -1; } -tools::Long DirectoryStream::tell() { return 0; } +long DirectoryStream::tell() { return 0; } bool DirectoryStream::isEnd() { return true; } } diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 40c50df8de5c..ce5ff2956966 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -882,14 +882,14 @@ const unsigned char* WPXSvInputStream::read(unsigned long numBytes, unsigned lon return mpImpl->mpReadBuffer; } -tools::Long WPXSvInputStream::tell() +long WPXSvInputStream::tell() { tools::Long retVal = mpImpl->tell(); return retVal - static_cast<tools::Long>(mpImpl->mnReadBufferLength) + static_cast<tools::Long>(mpImpl->mnReadBufferPos); } -int WPXSvInputStream::seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) +int WPXSvInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) { sal_Int64 tmpOffset = offset; if (seekType == librevenge::RVNG_SEEK_CUR) |