diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-05-01 11:59:45 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-05-03 12:07:47 +0000 |
commit | 88a79589843efc24f8af99bd511a1fff0f7bebef (patch) | |
tree | e08c7d95393e9430cf6a0fbff6c3745ba374fd1b /svl | |
parent | f23c32e4bf42a80455ebae10d830b7ffded4fa9f (diff) |
tdf#61996 Skip quoted text in number format
Quoted text should be detected and skiped
before detecting conditions
Change-Id: I1c78fed7f543fb335fbb8ec9ed50d9ab9dd10aa7
Reviewed-on: https://gerrit.libreoffice.org/24550
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 8da58b524b61..eebee2a358d8 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1109,13 +1109,18 @@ SvNumberformat::~SvNumberformat() * ---------------+-------------------+----------------------------+--------------- * Old State | Symbol read | Event | New state * ---------------+-------------------+----------------------------+--------------- - * SsStart | ; | Pos-- | SsGetString + * SsStart | " | Symbol += Character | SsGetQuoted + * | ; | Pos-- | SsGetString * | [ | Symbol += Character | SsGetBracketed * | ] | Error | SsStop * | BLANK | | * | Else | Symbol += Character | SsGetString * ---------------+-------------------+----------------------------+--------------- - * SsGetString | ; | | SsStop + * SsGetString | " | Symbol += Character | SsGetQuoted + * | ; | | SsStop + * | Else | Symbol += Character | + * ---------------+-------------------+----------------------------+--------------- + * SsGetQuoted | " | Symbol += Character | SsGetString * | Else | Symbol += Character | * ---------------+-------------------+----------------------------+--------------- * SsGetBracketed | <, > = | del [ | @@ -1146,7 +1151,8 @@ enum ScanState SsGetString, // format string SsGetPrefix, // color or NatNumN SsGetTime, // [HH] for time - SsGetBracketed // any [...] not decided yet + SsGetBracketed, // any [...] not decided yet + SsGetQuoted // quoted text }; // read a string until ']' and delete spaces in input @@ -1350,7 +1356,12 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, switch (eState) { case SsStart: - if (cToken == '[') + if (cToken == '\"') + { + eState = SsGetQuoted; + sBuffSymbol.append(cToken); + } + else if (cToken == '[') { eState = SsGetBracketed; sBuffSymbol.append(cToken); @@ -1478,7 +1489,12 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, } break; case SsGetString: - if (cToken == ';' && (nPos < 2 || !IsCombiningSymbol( rString, nPos-2))) + if (cToken == '\"') + { + eState = SsGetQuoted; + sBuffSymbol.append(cToken); + } + else if (cToken == ';' && (nPos < 2 || !IsCombiningSymbol( rString, nPos-2))) { eState = SsStop; } @@ -1487,6 +1503,17 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, sBuffSymbol.append(cToken); } break; + case SsGetQuoted: + if (cToken == '\"') + { + eState = SsGetString; + sBuffSymbol.append(cToken); + } + else + { + sBuffSymbol.append(cToken); + } + break; case SsGetTime: if (cToken == ']') { |