summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-07 18:15:20 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-02-10 17:31:36 +0100
commit8232965cfb5f50bb2e01f7749d04c227a9622860 (patch)
tree9d1d73ef4d9c4b740776ab46cdf5b6a09590bdcc /sc/source/ui
parent1db6e8b7760de1abd49d62df230d89480ffd2161 (diff)
replace various sal_uLong that might overflow with huge sheets
16Mx16k cells is more than 32bit, so things like cell counts or progress -> sal_uInt64. Height/widths of complete rows/columns -> tools::Long. Change-Id: I8077ec0c97782310db024c20c335cfcbc3833227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129634 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/view/output.cxx8
-rw-r--r--sc/source/ui/view/output2.cxx8
-rw-r--r--sc/source/ui/view/printfun.cxx2
-rw-r--r--sc/source/ui/view/select.cxx2
-rw-r--r--sc/source/ui/view/tabview.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx8
-rw-r--r--sc/source/ui/view/viewfun5.cxx2
8 files changed, 17 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 91483f02476e..46d4b188053d 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3883,7 +3883,7 @@ uno::Reference<util::XReplaceDescriptor> SAL_CALL ScCellRangesBase::createReplac
sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSearchDescriptor>& xDesc )
{
SolarMutexGuard aGuard;
- sal_Int32 nReplaced = 0;
+ sal_uInt64 nReplaced = 0;
if ( pDocShell && xDesc.is() )
{
ScCellSearchObj* pSearch = comphelper::getFromUnoTunnel<ScCellSearchObj>( xDesc );
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 810b01812769..d689dbd72777 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2527,9 +2527,9 @@ void ScOutputData::DrawClipMarks()
const ScMergeAttr* pMerge = mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE );
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += static_cast<tools::Long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ nOutWidth += mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX;
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += static_cast<tools::Long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY));
+ nOutHeight += mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
if ( bLayoutRTL )
nStartPosX -= nOutWidth - 1;
@@ -2548,9 +2548,9 @@ void ScOutputData::DrawClipMarks()
&pInfo->pPatternAttr->GetItem(ATTR_MERGE);
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += static_cast<tools::Long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX );
+ nOutWidth += mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX;
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += static_cast<tools::Long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY));
+ nOutHeight += mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY);
}
tools::Long nStartPosX = nPosX;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 78cec1f661ef..4fc1e84b1f2a 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1278,7 +1278,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too
++nCompRow;
}
}
- nCellPosY -= static_cast<tools::Long>(mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY ));
+ nCellPosY -= mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY );
const ScMergeAttr* pMerge = &rPattern.GetItem( ATTR_MERGE );
bool bMerged = pMerge->IsMerged();
@@ -1306,7 +1306,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, tools::Long nPosX, too
nDirect = 1; // skip in loop
}
// following rows always from document
- nMergeSizeY += static_cast<tools::Long>(mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY));
+ nMergeSizeY += mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY);
--nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines)
@@ -4634,9 +4634,9 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
{
SCCOL nCountX = pMerge->GetColMerge();
for (SCCOL i=1; i<nCountX; i++)
- nOutWidth += static_cast<tools::Long>( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX );
+ nOutWidth += mpDoc->GetColWidth(nX+i,nTab) * mnPPTX;
SCROW nCountY = pMerge->GetRowMerge();
- nOutHeight += static_cast<tools::Long>(mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY));
+ nOutHeight += mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY);
}
SvxCellVerJustify eVerJust =
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index dd2195b61401..c9d376a1e3e4 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -532,7 +532,7 @@ void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPri
tools::Long nTwipsSizeX = 0;
for (SCCOL i=nX1; i<=nX2; i++)
nTwipsSizeX += rDoc.GetColWidth( i, nTab );
- tools::Long nTwipsSizeY = static_cast<tools::Long>(rDoc.GetRowHeight( nY1, nY2, nTab ));
+ tools::Long nTwipsSizeY = rDoc.GetRowHeight( nY1, nY2, nTab );
// if no lines, still space for the outline frame (20 Twips = 1pt)
// (HasLines initializes aLines to 0,0,0,0)
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index c2433e57c277..18ac99b0ccd9 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -520,7 +520,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
tools::Long nSizeX = 0;
for (SCCOL i=nPosX+1; i<=nEndX; i++)
nSizeX += rDoc.GetColWidth( i, nTab );
- tools::Long nSizeY = static_cast<tools::Long>(rDoc.GetRowHeight( nPosY+1, nEndY, nTab ));
+ tools::Long nSizeY = rDoc.GetRowHeight( nPosY+1, nEndY, nTab );
SCCOL nDelStartX = nStartX;
SCROW nDelStartY = nStartY;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 8f0ce9d9bd06..5862d87a8fa0 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1678,7 +1678,7 @@ Point ScTabView::GetInsertPos() const
nPosX = o3tl::convert(nPosX, o3tl::Length::twip, o3tl::Length::mm100);
if ( rDoc.IsNegativePage( nTab ) )
nPosX = -nPosX;
- tools::Long nPosY = static_cast<tools::Long>(rDoc.GetRowHeight( 0, nRow-1, nTab));
+ tools::Long nPosY = rDoc.GetRowHeight( 0, nRow-1, nTab);
nPosY = o3tl::convert(nPosY, o3tl::Length::twip, o3tl::Length::mm100);
return Point(nPosX,nPosY);
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index fa0ab9c868bc..c6ed2d5519c7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2419,7 +2419,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
const_cast<ScViewData*>(this)->aScrSize.setHeight( pView->GetGridHeight(eWhichY) );
}
- sal_uLong nTSize;
+ tools::Long nTSize;
bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
@@ -2505,13 +2505,13 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
nScrPosY = 0x7FFFFFFF;
else if (bAllowNeg || bIsTiledRendering)
{
- sal_uLong nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY);
+ tools::Long nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY);
nScrPosY += nSizeYPix;
}
else
{
- sal_uLong nMaxHeight = aScrSize.getHeight() - nScrPosY;
- sal_uLong nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY, &nMaxHeight);
+ tools::Long nMaxHeight = aScrSize.getHeight() - nScrPosY;
+ tools::Long nSizeYPix = mrDoc.GetScaledRowHeight(nStartPosY, nWhereY - 1, nForTab, nPPTY, &nMaxHeight);
nScrPosY += nSizeYPix;
}
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index ac61b30f593b..1ca4c7ba7809 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -99,7 +99,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
nXT += rDoc.GetColWidth(i,nTab);
if (rDoc.IsNegativePage(nTab))
nXT = -nXT;
- sal_uLong nYT = rDoc.GetRowHeight( 0, nPosY-1, nTab);
+ tools::Long nYT = rDoc.GetRowHeight( 0, nPosY-1, nTab);
aPos = Point(o3tl::convert(nXT, o3tl::Length::twip, o3tl::Length::mm100),
o3tl::convert(nYT, o3tl::Length::twip, o3tl::Length::mm100));
}