From 4b1a9790abce87517b4c393f8e5e9f8c01c5a888 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Aug 10 2015 20:02:15 +0000 Subject: Resolves: tdf#86024 do not attempt to shorten numeric value output --- diff --git a/0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch b/0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch new file mode 100644 index 0000000..35be99e --- /dev/null +++ b/0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch @@ -0,0 +1,100 @@ +From 94a58c16d3f311a04e9861c0e9900a589e09da5f Mon Sep 17 00:00:00 2001 +Message-Id: <94a58c16d3f311a04e9861c0e9900a589e09da5f.1439236617.git.erack@redhat.com> +From: Eike Rathke +Date: Mon, 10 Aug 2015 21:03:28 +0200 +Subject: [PATCH] Resolves: tdf#86024 do not attempt to shorten numeric value + output +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------erAck-patch-parts" + +This is a multi-part message in MIME format. +--------------erAck-patch-parts +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + + +Regression of 087a79db1272858f107656c5ca3c6efb45680986 + +Change-Id: I903e05234882c79e6da6499cb17e16fd7226f91c +(cherry picked from commit 2a06a052b920f696a794c2fb847fce63038220e9) +--- + sc/source/ui/view/output2.cxx | 52 +++++++++++++++++++++++++------------------ + 1 file changed, 30 insertions(+), 22 deletions(-) + + +--------------erAck-patch-parts +Content-Type: text/x-patch; name="0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch" +Content-Transfer-Encoding: 8bit +Content-Disposition: attachment; filename="0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch" + +diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx +index 6a1bbf1..9a07957 100644 +--- a/sc/source/ui/view/output2.cxx ++++ b/sc/source/ui/view/output2.cxx +@@ -2036,32 +2036,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); ++ } + } + } + + +--------------erAck-patch-parts-- + + diff --git a/libreoffice.spec b/libreoffice.spec index 92ad256..8adec45 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -402,6 +402,7 @@ Patch92: 0001-ppc64-simplify-this-a-little.patch Patch93: 0002-ppc64-using-a-fp-register-also-consumes-a-gp-registe.patch Patch94: 0001-Resolves-tdf-92767-use-ISO-8601-for-internal-date-st.patch Patch95: 0001-check-annotation-caption-pointers-blind-fix-for-rhbz.patch +Patch96: 0001-Resolves-tdf-86024-do-not-attempt-to-shorten-numeric.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -2377,9 +2378,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog -* Mon Jul 20 2015 Eike Rathke - 1:4.3.7.2-10-UNBUILT +* Mon Aug 10 2015 Eike Rathke - 1:4.3.7.2-10 - Resolves: tdf#92767 use ISO 8601 for internal date string representation - check annotation caption pointers, blind fix for rhbz#1242099 +- Resolves: tdf#86024 do not attempt to shorten numeric value output * Sat Jul 11 2015 Eike Rathke - 1:4.3.7.2-9 - Resolves: rhbz#1146058 using a fp register also consumes a gp register slot