summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-01-11 10:43:42 +0300
committerJustin Luth <justin_luth@sil.org>2017-01-16 04:24:50 +0000
commit0611017c1df3c98684fbb904c1ab5ec7f68074d8 (patch)
tree0e035d6e858cb3777145711b169a27529cdd9ee2
parenta1784cc9a73c5f43d084f31ac37b78b3642d46d3 (diff)
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@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/source/core/fields/cellfml.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 1d55ab872fd4..79432e27ae14 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