From cf4f0b425a41bb823489bcbb388b33d71d75de40 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 12 May 2014 14:28:18 +0200 Subject: [PATCH] Resolves: fdo#78119 bad july month name support in czech localization --- ...ind-the-longest-match-for-month-name.patch | 125 ++++++++++++++++++ libreoffice.spec | 7 +- 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 0001-fdo-78119-find-the-longest-match-for-month-name.patch diff --git a/0001-fdo-78119-find-the-longest-match-for-month-name.patch b/0001-fdo-78119-find-the-longest-match-for-month-name.patch new file mode 100644 index 0000000..6d186cd --- /dev/null +++ b/0001-fdo-78119-find-the-longest-match-for-month-name.patch @@ -0,0 +1,125 @@ +From 624e5c34ce815af6f65ce6699ad6b3f2aa1bf0da Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 12 May 2014 14:02:13 +0200 +Subject: [PATCH] fdo#78119 find the longest match for month name + +Change-Id: Idad7b083ce5528f5c735f3a8bd091819bf043fc8 +--- + svl/source/numbers/zforfind.cxx | 69 ++++++++++++++++++++++++++++------------- + 1 file changed, 48 insertions(+), 21 deletions(-) + +diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx +index a022d2d..c77bb0a 100644 +--- a/svl/source/numbers/zforfind.cxx ++++ b/svl/source/numbers/zforfind.cxx +@@ -563,6 +563,7 @@ short ImpSvNumberInputScan::GetMonth( const OUString& rString, sal_Int32& nPos ) + static const OUString aSepShortened("SEP"); + + short res = 0; // no month found ++ int nMatchLen = 0; + + if (rString.getLength() > nPos) // only if needed + { +@@ -571,52 +572,78 @@ short ImpSvNumberInputScan::GetMonth( const OUString& rString, sal_Int32& nPos ) + InitText(); + } + sal_Int16 nMonths = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); ++ // Find the longest match. This is needed for, e.g., Czech, as Červen (June) ++ // is fully contained in Červenec (July), so the latter could never be found ++ // if we stopped at the first match. + for ( sal_Int16 i = 0; i < nMonths; i++ ) + { + if ( bScanGenitiveMonths && StringContains( pUpperGenitiveMonthText[i], rString, nPos ) ) + { // genitive full names first +- nPos = nPos + pUpperGenitiveMonthText[i].getLength(); +- res = i + 1; +- break; // for ++ const int nMonthLen = pUpperGenitiveMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = i + 1; ++ } + } + else if ( bScanGenitiveMonths && StringContains( pUpperGenitiveAbbrevMonthText[i], rString, nPos ) ) + { // genitive abbreviated +- nPos = nPos + pUpperGenitiveAbbrevMonthText[i].getLength(); +- res = sal::static_int_cast< short >(-(i+1)); // negative +- break; // for ++ const int nMonthLen = pUpperGenitiveAbbrevMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = sal::static_int_cast< short >(-(i+1)); // negative ++ } + } + else if ( bScanPartitiveMonths && StringContains( pUpperPartitiveMonthText[i], rString, nPos ) ) + { // partitive full names +- nPos = nPos + pUpperPartitiveMonthText[i].getLength(); +- res = i+1; +- break; // for ++ const int nMonthLen = pUpperPartitiveMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = i+1; ++ } + } + else if ( bScanPartitiveMonths && StringContains( pUpperPartitiveAbbrevMonthText[i], rString, nPos ) ) + { // partitive abbreviated +- nPos = nPos + pUpperPartitiveAbbrevMonthText[i].getLength(); +- res = sal::static_int_cast< short >(-(i+1)); // negative +- break; // for ++ const int nMonthLen = pUpperPartitiveAbbrevMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = sal::static_int_cast< short >(-(i+1)); // negative ++ } + } + else if ( StringContains( pUpperMonthText[i], rString, nPos ) ) + { // noun full names +- nPos = nPos + pUpperMonthText[i].getLength(); +- res = i+1; +- break; // for ++ const int nMonthLen = pUpperMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = i+1; ++ } + } + else if ( StringContains( pUpperAbbrevMonthText[i], rString, nPos ) ) + { // noun abbreviated +- nPos = nPos + pUpperAbbrevMonthText[i].getLength(); +- res = sal::static_int_cast< short >(-(i+1)); // negative +- break; // for ++ const int nMonthLen = pUpperAbbrevMonthText[i].getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = sal::static_int_cast< short >(-(i+1)); // negative ++ } + } + else if ( i == 8 && pUpperAbbrevMonthText[i] == aSeptCorrect && + StringContains( aSepShortened, rString, nPos ) ) + { // #102136# SEPT/SEP +- nPos = nPos + aSepShortened.getLength(); +- res = sal::static_int_cast< short >(-(i+1)); // negative +- break; // for ++ const int nMonthLen = aSepShortened.getLength(); ++ if (nMonthLen > nMatchLen) ++ { ++ nMatchLen = nMonthLen; ++ res = sal::static_int_cast< short >(-(i+1)); // negative ++ } + } + } ++ ++ nPos += nMatchLen; + } + + return res; +-- +1.9.0 + diff --git a/libreoffice.spec b/libreoffice.spec index 8f3fcbd..f2a01fa 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -37,7 +37,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 9%{?libo_prerelease}%{?dist} +Release: 10%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 Group: Applications/Productivity URL: http://www.libreoffice.org/ @@ -307,6 +307,7 @@ Patch46: 0001-rhbz-1071604-don-t-crash-if-slide-layout-configs-are.patch Patch47: 0001-Related-rhbz-1071604-don-t-paint-anim.-effect-icon.patch Patch48: 0001-Resolves-rhbz-1096486-avoid-access-to-nonexisting-pa.patch Patch49: 0001-Resolves-rhbz-1096295-hard-to-distinguish-selected-f.patch +Patch50: 0001-fdo-78119-find-the-longest-match-for-month-name.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -2270,6 +2271,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Mon May 12 2014 David Tardon - 1:4.2.4.2-10 +- Resolves: fdo#78119 bad july (červenec) month name support in czech + localization + * Mon May 12 2014 Caolán McNamara - 1:4.2.4.2-9 - Resolves: rhbz#1096486 avoid access to nonexisting parent - Resolves: rhbz#1096295 hard to distinguish slides in slide pane