diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-05-01 11:59:45 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-25 15:42:51 +0000 |
commit | 9a2b656dbd4acadcfc144ba8db7c9657c7a72f1f (patch) | |
tree | fc659ad24b4a2384d9ee2ad34bf87ad18778e253 /svl | |
parent | f3de0caba189ff7d17a2f37495147673e68c2e7f (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>
(cherry picked from commit 88a79589843efc24f8af99bd511a1fff0f7bebef)
Reviewed-on: https://gerrit.libreoffice.org/25453
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@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 c9f08ad20837..29402f801910 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1110,13 +1110,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 [ | @@ -1147,7 +1152,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 @@ -1351,7 +1357,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); @@ -1479,7 +1490,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; } @@ -1488,6 +1504,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 == ']') { |