[Libreoffice-commits] core.git: sw/source

Justin Luth justin_luth at sil.org
Mon Jan 16 04:25:12 UTC 2017


 sw/source/core/fields/cellfml.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 0611017c1df3c98684fbb904c1ab5ec7f68074d8
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Jan 11 10:43:42 2017 +0300

    tdf#74177 Writer table: comment shouldn't prevent IsNumberFormat
    
    This patch allows processing a number even if a comment is the
    first item in the string. Previously the result was formula
    cells displaying an error message.
    
    Only fields were handled for annotation anchors. Allow other
    non-word-breaking markers to be checked for number validity.
    
    Change-Id: I13b3566bf93f0029a28bada470cdd4196271bccd
    Reviewed-on: https://gerrit.libreoffice.org/32949
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 1d55ab8..79432e2 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -150,13 +150,13 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const
         // if there is a calculation field at position 1, get the value of it
         const bool bOK = nSttPos<sText.getLength();
         const sal_Unicode Char = bOK ? sText[nSttPos] : 0;
+        SwTextField * pTextField = nullptr;
         if ( bOK && (Char==CH_TXTATR_BREAKWORD || Char==CH_TXTATR_INWORD) )
         {
-            SwTextField * const pTextField =
-                static_txtattr_cast<SwTextField*>(pTextNd->GetTextAttrForCharAt(nSttPos, RES_TXTATR_FIELD));
-            if ( pTextField == nullptr )
-                break;
-
+            pTextField = static_txtattr_cast<SwTextField*>(pTextNd->GetTextAttrForCharAt(nSttPos, RES_TXTATR_FIELD));
+        }
+        if ( pTextField != nullptr )
+        {
             rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // reset status
 
             const SwField* pField = pTextField->GetFormatField().GetField();
@@ -206,7 +206,7 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const
                 break;
             nRet = rCalcPara.rCalc.Calculate( pTextInputField->GetFieldContent() ).GetDouble();
         }
-        else
+        else if ( Char != CH_TXTATR_BREAKWORD )
         {
             // result is 0 but no error!
             rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // reset status


More information about the Libreoffice-commits mailing list