summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/column2.cxx9
-rw-r--r--sc/source/core/data/fillinfo.cxx6
2 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index a29505584a27..0a54f877c0b1 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -939,9 +939,12 @@ void ScColumn::GetOptimalHeight(
{
aOptions.pPattern = pPattern;
const ScPatternAttr* pOldPattern = pPattern;
- sal_uInt16 nHeight = static_cast<sal_uInt16>( GetNeededSize( nRow, rCxt.getOutputDevice(), rCxt.getPPTX(), rCxt.getPPTY(),
- rCxt.getZoomX(), rCxt.getZoomY(), false, aOptions,
- &pPattern) / rCxt.getPPTY() );
+ sal_uInt16 nHeight = static_cast<sal_uInt16>(
+ std::min(
+ GetNeededSize( nRow, rCxt.getOutputDevice(), rCxt.getPPTX(), rCxt.getPPTY(),
+ rCxt.getZoomX(), rCxt.getZoomY(), false, aOptions,
+ &pPattern) / rCxt.getPPTY(),
+ double(std::numeric_limits<sal_uInt16>::max())));
if (nHeight > rHeights.getValue(nRow))
rHeights.setValue(nRow, nRow, nHeight);
// Pattern changed due to calculation? => sync.
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index abe95752ff68..48749179a0a3 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -213,9 +213,9 @@ void initRowInfo(const ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow
RowInfo* pThisRowInfo = &pRowInfo[rArrRow];
pThisRowInfo->pCellInfo = nullptr; // is loaded below
- sal_uInt16 nHeight = static_cast<sal_uInt16>( nDocHeight * fRowScale );
- if (!nHeight)
- nHeight = 1;
+ sal_uInt16 nHeight = static_cast<sal_uInt16>(
+ std::clamp(
+ nDocHeight * fRowScale, 1.0, double(std::numeric_limits<sal_uInt16>::max())));
pThisRowInfo->nRowNo = nY; //TODO: case < 0 ?
pThisRowInfo->nHeight = nHeight;