Kaydet (Commit) 2a06a052 authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#86024 do not attempt to shorten numeric value output

Regression of 087a79db

Change-Id: I903e05234882c79e6da6499cb17e16fd7226f91c
üst 326777b5
...@@ -2017,32 +2017,40 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA ...@@ -2017,32 +2017,40 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
OUString aShort = aString; OUString aShort = aString;
double fVisibleRatio = 1.0; // But never fiddle with numeric values.
double fTextWidth = aVars.GetTextSize().Width(); // (Which was the cause of tdf#86024).
sal_Int32 nTextLen = aString.getLength(); // The General automatic format output takes
if (eOutHorJust == SVX_HOR_JUSTIFY_LEFT && aAreaParam.mnRightClipLength > 0) // care of this, or fixed width numbers either fit
// or display as ###.
if (!bCellIsValue)
{ {
fVisibleRatio = (fTextWidth - aAreaParam.mnRightClipLength) / fTextWidth; double fVisibleRatio = 1.0;
if (0.0 < fVisibleRatio && fVisibleRatio < 1.0) double fTextWidth = aVars.GetTextSize().Width();
sal_Int32 nTextLen = aString.getLength();
if (eOutHorJust == SVX_HOR_JUSTIFY_LEFT && aAreaParam.mnRightClipLength > 0)
{ {
// Only show the left-end segment. fVisibleRatio = (fTextWidth - aAreaParam.mnRightClipLength) / fTextWidth;
sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1; if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
aShort = aShort.copy(0, nShortLen); {
// Only show the left-end segment.
sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
aShort = aShort.copy(0, nShortLen);
}
} }
} else if (eOutHorJust == SVX_HOR_JUSTIFY_RIGHT && aAreaParam.mnLeftClipLength > 0)
else if (eOutHorJust == SVX_HOR_JUSTIFY_RIGHT && aAreaParam.mnLeftClipLength > 0)
{
fVisibleRatio = (fTextWidth - aAreaParam.mnLeftClipLength) / fTextWidth;
if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
{ {
// Only show the right-end segment. fVisibleRatio = (fTextWidth - aAreaParam.mnLeftClipLength) / fTextWidth;
sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1; if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
aShort = aShort.copy(nTextLen-nShortLen); {
// Only show the right-end segment.
// Adjust the text position after shortening of the string. sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
double fShortWidth = pFmtDevice->GetTextWidth(aShort); aShort = aShort.copy(nTextLen-nShortLen);
double fOffset = fTextWidth - fShortWidth;
aDrawTextPos.Move(fOffset, 0); // Adjust the text position after shortening of the string.
double fShortWidth = pFmtDevice->GetTextWidth(aShort);
double fOffset = fTextWidth - fShortWidth;
aDrawTextPos.Move(fOffset, 0);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment