summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-06-04 13:10:51 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-10 15:04:50 +0200
commitc9f071ff49bace0809d3a55d4d4b76a26d933f9c (patch)
tree8646c444c2349ba08480dfe162a159deb78e51e5 /chart2/source
parent6185d1ff0130b3d178d5e50eeb6944ab70db41f9 (diff)
tdf#139658 OOXML: fix broken chart import at labels with quotes
During the import of the internal data table, incomplete parsing of category labels with escaped quotation marks resulted broken category labels and charts. Change-Id: If5af3d527b80d1e055562f589bdaf17096ad49f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116714 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 1b2f6ae28351..9595cf2375d7 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -518,7 +518,14 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, st
bool bInQuote = false;
for (; p != pEnd; ++p)
{
- if (*p == '"')
+ // Skip next "" within the title text: it's an escaped double quotation mark.
+ if (bInQuote && *p == '"' && *(p + 1) == '"')
+ {
+ if (!pElem)
+ pElem = p;
+ ++p;
+ }
+ else if (*p == '"')
{
bInQuote = !bInQuote;
if (bInQuote)
@@ -534,7 +541,8 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, st
// Non empty string
if (!aElem.isEmpty())
bAllNumeric = false;
- aRawElems.push_back(aElem);
+ // Restore also escaped double quotation marks
+ aRawElems.push_back(aElem.replaceAll("\"\"", "\""));
pElem = nullptr;
aElem.clear();