summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-08-10 21:03:28 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-08-11 13:28:01 +0000
commit0f3d6a1bfb397d661390aaf3456adfcf418165e9 (patch)
tree7331a81f2f0b6a957a72f8ac1910a68412099f21
parent04f704066e60f10c68c76d757033746e9fa2aaa7 (diff)
Resolves: tdf#86024 do not attempt to shorten numeric value output
Regression of 087a79db1272858f107656c5ca3c6efb45680986 Change-Id: I903e05234882c79e6da6499cb17e16fd7226f91c (cherry picked from commit 2a06a052b920f696a794c2fb847fce63038220e9) Reviewed-on: https://gerrit.libreoffice.org/17637 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/view/output2.cxx52
1 files changed, 30 insertions, 22 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 5fa3e2909164..45e866ab092d 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2012,32 +2012,40 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
OUString aShort = aString;
- double fVisibleRatio = 1.0;
- double fTextWidth = aVars.GetTextSize().Width();
- sal_Int32 nTextLen = aString.getLength();
- if (eOutHorJust == SVX_HOR_JUSTIFY_LEFT && aAreaParam.mnRightClipLength > 0)
+ // But never fiddle with numeric values.
+ // (Which was the cause of tdf#86024).
+ // The General automatic format output takes
+ // care of this, or fixed width numbers either fit
+ // or display as ###.
+ if (!bCellIsValue)
{
- fVisibleRatio = (fTextWidth - aAreaParam.mnRightClipLength) / fTextWidth;
- if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
+ double 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.
- sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
- aShort = aShort.copy(0, nShortLen);
+ fVisibleRatio = (fTextWidth - aAreaParam.mnRightClipLength) / fTextWidth;
+ if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
+ {
+ // 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)
- {
- fVisibleRatio = (fTextWidth - aAreaParam.mnLeftClipLength) / fTextWidth;
- if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
+ else if (eOutHorJust == SVX_HOR_JUSTIFY_RIGHT && aAreaParam.mnLeftClipLength > 0)
{
- // Only show the right-end segment.
- sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
- aShort = aShort.copy(nTextLen-nShortLen);
-
- // Adjust the text position after shortening of the string.
- double fShortWidth = pFmtDevice->GetTextWidth(aShort);
- double fOffset = fTextWidth - fShortWidth;
- aDrawTextPos.Move(fOffset, 0);
+ fVisibleRatio = (fTextWidth - aAreaParam.mnLeftClipLength) / fTextWidth;
+ if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
+ {
+ // Only show the right-end segment.
+ sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
+ aShort = aShort.copy(nTextLen-nShortLen);
+
+ // Adjust the text position after shortening of the string.
+ double fShortWidth = pFmtDevice->GetTextWidth(aShort);
+ double fOffset = fTextWidth - fShortWidth;
+ aDrawTextPos.Move(fOffset, 0);
+ }
}
}