[Libreoffice-commits] .: Branch 'libreoffice-3-6' - svl/source
svl/source/numbers/zforfind.cxx | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) New commits: commit c796f58d6ea3999268333f6cff687ee517882717 Author: Eike Rathke Date: Wed Dec 19 21:53:13 2012 +0100 resolved fdo#54344 let date pattern match overrule incomplete format match (cherry picked from commit 8041285b369e58df477b5e92df4bde68e96056a2) Conflicts: svl/source/numbers/zforfind.cxx Change-Id: Ieeba328b1e2a1e0fdcd44ad7899da257f846a6b8 Reviewed-on: https://gerrit.libreoffice.org/1426 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 9c4018c..0ccb4b4 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1571,11 +1571,21 @@ input for the following reasons: { case 0: // not found { -bool bHadExact; sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : GetDatePatternOrder()); bool bIsExact = (0xff < nExactDateOrder && nExactDateOrder <= 0x); +if (!bIsExact && bFormatTurn && IsAcceptedDatePattern( nNums[0])) +{ +// If input does not match format but pattern, use pattern +// instead, even if eEDF==NF_EVALDATEFORMAT_FORMAT_INTL. +// For example, format has "Y-M-D" and pattern is "D.M.", +// input with 2 numbers can't match format and 31.12. would +// lead to 1931-12-01 (fdo#54344) +nExactDateOrder = GetDatePatternOrder(); +bIsExact = (0xff < nExactDateOrder && nExactDateOrder <= 0x); +} +bool bHadExact; if (bIsExact) { // formatted as date and exactly 2 parts bHadExact = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - svl/source
svl/source/numbers/zforfind.cxx | 66 +--- svl/source/numbers/zforfind.hxx | 10 ++ 2 files changed, 72 insertions(+), 4 deletions(-) New commits: commit fd7a679774088cfbbadcca9434b10f0089fd2a49 Author: Eike Rathke Date: Wed Dec 19 19:21:55 2012 +0100 resolved fdo#54336 accept abbreviated combined date/time input Abbreviated combined date/time input was not accepted if the date acceptance pattern ended in a separator, like "D.M." with input "D.M. hh:mm". Additionally check that for "D.M. #" input against a "D.M." pattern the '#' (any number) is not interpreted as year if the input so far was recognized to possibly match a date without time, in which case the count of numbers in input must match the count of numbers in pattern and input here is not a date. (cherry picked from commit f2851a270eb9c617fce9bfdde5c8f2428ced7014) Conflicts: svl/source/numbers/zforfind.cxx Change-Id: I7f1f9c8477e35241ee747bf92b9d8832b2de16fe Reviewed-on: https://gerrit.libreoffice.org/1423 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index ef6015e..9c4018c 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -148,6 +148,7 @@ void ImpSvNumberInputScan::Reset() nMayBeMonthDate = 0; nAcceptedDatePattern = -2; nDatePatternStart = 0; +nDatePatternNumbers = 0; nCanForceToIso8601 = 0; } @@ -1103,6 +1104,7 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) for (sal_Int32 nPattern=0; nPattern < sDateAcceptancePatterns.getLength(); ++nPattern) { sal_uInt16 nNext = nDatePatternStart; +nDatePatternNumbers = 0; bool bOk = true; const rtl::OUString& rPat = sDateAcceptancePatterns[nPattern]; sal_Int32 nPat = 0; @@ -1114,6 +1116,8 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) case 'M': case 'D': bOk = IsNum[nNext]; +if (bOk) +++nDatePatternNumbers; break; default: bOk = !IsNum[nNext]; @@ -1145,10 +1149,43 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) if (nNext < nAnzStrings) { // Pattern end but not input end. -if (!IsNum[nNext]) +// A trailing blank may be part of the current pattern input, +// if pattern is "D.M." and input is "D.M. hh:mm" last was +// ". ", or may be following the current pattern input, if +// pattern is "D.M" and input is "D.M hh:mm" last was "M". +xub_StrLen nPos = 0; +sal_uInt16 nCheck; +if (nPat > 0 && nNext > 0) +{ +// nPat is one behind after the for loop. +sal_Int32 nPatCheck = nPat - 1; +switch (rPat[nPatCheck]) +{ +case 'Y': +case 'M': +case 'D': +nCheck = nNext; +break; +default: +{ +nCheck = nNext - 1; +// Advance position in input to match length of +// non-YMD (separator) characters in pattern. +sal_Unicode c; +do +{ +++nPos; +} while ((c = rPat[--nPatCheck]) != 'Y' && c != 'M' && c != 'D'); +} +} +} +else +{ +nCheck = nNext; +} +if (!IsNum[nCheck]) { // Trailing (or separating if time follows) blanks are ok. -xub_StrLen nPos = 0; SkipBlanks( sStrArray[nNext], nPos); if (nPos == sStrArray[nNext].Len()) { @@ -1222,6 +1259,18 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( sal_uInt16 nParticle, xub_S //--- +sal_uInt16 ImpSvNumberInputScan::GetDatePatternNumbers() +{ +// If not initialized yet start with first number, if any. +if (!IsAcceptedDatePattern( (nAnzNums ? nNums[0] : 0))) +{ +return 0; +} +return nDatePatternNumbers; +} + +//--- + sal_uInt32 ImpSvNumberInp
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - svl/source
svl/source/numbers/zforscan.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 4e57d13eca14fb4b0dd2c5a27eba1647b207b0d2 Author: Noel Power Date: Tue Nov 13 16:30:07 2012 + don't always show integer part for fraction formats with hard denom fdo#56205 fixes bug when you have a fraction format with a forced denominator e.g. '?/5' which showed the integer part of the fraction ( as if the format was '# ?/5' ) but even without the space e.g. before fix pi 3.14159265358979 with format '?/8' would be shown as "31/8" after the fix 3.14159265358979 with format '?/8' would be shown as "25/8" Change-Id: I1feb8b78af94b90db1bcc30da248077243dd8dfc Reviewed-on: https://gerrit.libreoffice.org/1047 Reviewed-by: Eike Rathke Tested-by: Eike Rathke Reviewed-on: https://gerrit.libreoffice.org/1064 diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 069d2d3..1124fc5 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -1605,7 +1605,9 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString ) nCounter = nCntPost; else if (nCntPre) nCounter = nCntPre; -if (!nCntPre) +// don't artificially increment nCntPre +// for forced denominator +if ( ( eScannedType != NUMBERFORMAT_FRACTION ) && (!nCntPre) ) nCntPre++; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - svl/source
svl/source/numbers/zforfind.cxx | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) New commits: commit 97b0efc6145cd7153c724c1135eb65ee941d60d5 Author: Eike Rathke Date: Tue Nov 13 14:23:01 2012 +0100 resolved fdo#55369 accept fraction input if preset Accept fraction input without integer portion if the format was preset as fraction, e.g. 1/5 instead of 0 1/5 and don't force to date. (cherry picked from commit 5391bd1e54157457abe1098b29f067d6e0059113) Change-Id: I326ec85b163962425efa074119405ec1395af481 Reviewed-on: https://gerrit.libreoffice.org/1045 Reviewed-by: Petr Mladek Tested-by: Petr Mladek diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index eae56da..ef6015e 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2025,14 +2025,24 @@ bool ImpSvNumberInputScan::ScanMidString( const String& rString, { if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type && eScannedType != NUMBERFORMAT_DATE) // except date -return MatchedReturn(); // => jan/31/1994 -else if (eScannedType != NUMBERFORMAT_DATE // analyzed date until now - && (eSetType == NUMBERFORMAT_FRACTION // and preset was fraction - || (nAnzNums == 3 // or 3 numbers - && nStringPos > 2) ) ) // and what ??? +return MatchedReturn(); // => jan/31/1994 +else if (eScannedType != NUMBERFORMAT_DATE // analyzed no date until now +&& ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction +|| (nAnzNums == 3 // or 3 numbers +&& (nStringPos == 3 // and 3rd string particle +|| (nStringPos == 4 // or 4th +&& nSign) // if signed { SkipBlanks(rString, nPos); -eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction +if (nPos == rString.Len()) +{ +eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction (so far) +if (eSetType == NUMBERFORMAT_FRACTION +&& nAnzNums == 2 +&& (nStringPos == 1 // for 4/5 +|| (nStringPos == 2 && nSign))) // or signed -4/5 +return true;// don't fall into date trap +} } else nPos--; // put '/' back ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - svl/source
svl/source/undo/undo.cxx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) New commits: commit a20b6ed44995c91211b090a8470e0dd64079269e Author: Ivan Timofeev Date: Thu Jun 28 13:12:56 2012 +0400 i#119400 repair broken undo Change-Id: I36d74fe1555bd436f93a5fa595e7da05bbd37493 (cherry picked from commit 1eed4c837828c00dff4ef0b2cf29b1e2962e912d) diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index e27bf00..e916675 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -635,10 +635,14 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT // merge, if required SfxUndoAction* pMergeWithAction = m_pData->pActUndoArray->nCurUndoAction ? m_pData->pActUndoArray->aUndoActions[m_pData->pActUndoArray->nCurUndoAction-1].pAction : NULL; -if ( bTryMerge && ( !pMergeWithAction || !pMergeWithAction->Merge( pAction ) ) ) +if ( bTryMerge && pMergeWithAction ) { -i_guard.markForDeletion( pAction ); -return false; +bool bMerged = pMergeWithAction->Merge( pAction ); +if ( bMerged ) +{ +i_guard.markForDeletion( pAction ); +return false; +} } // clear redo stack, if requested ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits