1 diff --git sc/inc/rangeutl.hxx sc/inc/rangeutl.hxx
2 index 58c00b2..d540256 100644
3 --- sc/inc/rangeutl.hxx
4 +++ sc/inc/rangeutl.hxx
6 #include <com/sun/star/table/CellRangeAddress.hpp>
7 #include <com/sun/star/uno/Sequence.hxx>
9 +// Chart always stores cell range addresses using CONV_OOO convention. But
10 +// if parsing with CONV_OOO fails, try parsing it using the current address
12 +#define CHART_ADDRESS_CONV_WORKAROUND 1
14 //------------------------------------------------------------------------
17 diff --git sc/source/core/tool/rangeutl.cxx sc/source/core/tool/rangeutl.cxx
18 index 82d07bc..84a410c 100644
19 --- sc/source/core/tool/rangeutl.cxx
20 +++ sc/source/core/tool/rangeutl.cxx
21 @@ -480,6 +480,11 @@ sal_Bool ScRangeStringConverter::GetAddressFromString(
23 if ((rAddress.Parse( sToken, const_cast<ScDocument*>(pDocument), eConv ) & SCA_VALID) == SCA_VALID)
25 +#if CHART_ADDRESS_CONV_WORKAROUND
26 + ::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
27 + if (eConv != eConvUI)
28 + return ((rAddress.Parse(sToken, const_cast<ScDocument*>(pDocument), eConvUI) & SCA_VALID) == SCA_VALID);
33 @@ -506,6 +511,11 @@ sal_Bool ScRangeStringConverter::GetRangeFromString(
34 if ( aUIString.GetChar(0) == (sal_Unicode) '.' )
35 aUIString.Erase( 0, 1 );
36 bResult = ((rRange.aStart.Parse( aUIString, const_cast<ScDocument*> (pDocument), eConv) & SCA_VALID) == SCA_VALID);
37 +#if CHART_ADDRESS_CONV_WORKAROUND
38 + if (!bResult && eConv != eConv)
39 + bResult = ((rRange.aStart.Parse(
40 + aUIString, const_cast<ScDocument*>(pDocument), eConv) & SCA_VALID) == SCA_VALID);
42 rRange.aEnd = rRange.aStart;
45 @@ -530,6 +540,15 @@ sal_Bool ScRangeStringConverter::GetRangeFromString(
46 eConv) & SCA_VALID) == SCA_VALID) &&
47 ((rRange.aEnd.Parse( aUIString.Copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
48 eConv) & SCA_VALID) == SCA_VALID);
49 +#if CHART_ADDRESS_CONV_WORKAROUND
50 + if (!bResult && eConv != eConv)
52 + bResult = ((rRange.aStart.Parse( aUIString.Copy(0, (xub_StrLen)nIndex), const_cast<ScDocument*>(pDocument),
53 + eConv) & SCA_VALID) == SCA_VALID) &&
54 + ((rRange.aEnd.Parse( aUIString.Copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
55 + eConv) & SCA_VALID) == SCA_VALID);
61 @@ -864,6 +885,8 @@ static void lcl_appendCellRangeAddress(
63 void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, const OUString& rXMLRange, ScDocument* pDoc )
65 + FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
66 + const OUString aRangeSep = GetScCompilerNativeSymbol(ocSep);
67 const sal_Unicode cSep = ' ';
68 const sal_Unicode cQuote = '\'';
70 @@ -903,13 +926,37 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
72 USHORT nRet = aCell1.Parse(aBeginCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
73 if ((nRet & SCA_VALID) != SCA_VALID)
75 // first cell is invalid.
76 +#if CHART_ADDRESS_CONV_WORKAROUND
77 + if (eConv == FormulaGrammar::CONV_OOO)
80 + nRet = aCell1.Parse(aBeginCell, pDoc, eConv, &aExtInfo1);
81 + if ((nRet & SCA_VALID) != SCA_VALID)
82 + // first cell is really invalid.
89 nRet = aCell2.Parse(aEndCell, pDoc, FormulaGrammar::CONV_OOO, &aExtInfo2);
90 if ((nRet & SCA_VALID) != SCA_VALID)
92 // second cell is invalid.
93 +#if CHART_ADDRESS_CONV_WORKAROUND
94 + if (eConv == FormulaGrammar::CONV_OOO)
97 + nRet = aCell2.Parse(aEndCell, pDoc, eConv, &aExtInfo2);
98 + if ((nRet & SCA_VALID) != SCA_VALID)
99 + // second cell is really invalid.
106 if (aExtInfo1.mnFileId != aExtInfo2.mnFileId || aExtInfo1.mbExternal != aExtInfo2.mbExternal)
107 // external info inconsistency.
108 @@ -920,7 +967,7 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
112 - aRetStr.appendAscii(";");
113 + aRetStr.append(aRangeSep);
115 lcl_appendCellRangeAddress(aRetStr, pDoc, aCell1, aCell2, aExtInfo1, aExtInfo2);
117 @@ -931,14 +978,22 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
119 USHORT nRet = aCell.Parse(aToken, pDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
120 if ((nRet & SCA_VALID) != SCA_VALID)
122 +#if CHART_ADDRESS_CONV_WORKAROUND
123 + nRet = aCell.Parse(aToken, pDoc, eConv, &aExtInfo);
124 + if ((nRet & SCA_VALID) != SCA_VALID)
136 - aRetStr.appendAscii(";");
137 + aRetStr.append(aRangeSep);
139 lcl_appendCellAddress(aRetStr, pDoc, aCell, aExtInfo);