ooo-build r15358 - in branches/ooo-build-3-0-1: . patches/dev300
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15358 - in branches/ooo-build-3-0-1: . patches/dev300
- Date: Tue, 17 Feb 2009 18:08:16 +0000 (UTC)
Author: kyoshida
Date: Tue Feb 17 18:08:16 2009
New Revision: 15358
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15358&view=rev
Log:
2009-02-17 Kohei Yoshida <kyoshida novell com>
* patches/dev300/chart-odf-always-calc-a1.diff: handle old range syntax
in chart ranges, to correctly load chart objects that were generated by
older versions of OOo. (n#476293)
Modified:
branches/ooo-build-3-0-1/ChangeLog
branches/ooo-build-3-0-1/patches/dev300/chart-odf-always-calc-a1.diff
Modified: branches/ooo-build-3-0-1/patches/dev300/chart-odf-always-calc-a1.diff
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/chart-odf-always-calc-a1.diff (original)
+++ branches/ooo-build-3-0-1/patches/dev300/chart-odf-always-calc-a1.diff Tue Feb 17 18:08:16 2009
@@ -912,7 +912,7 @@
xResult.set(new ScChart2DataSequence(m_pDocument, this, aRangeList));
return xResult;
-@@ -1042,23 +1042,109 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
+@@ -1042,23 +1042,122 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
if( m_pDocument )
{
ScRangeList aList;
@@ -928,18 +928,32 @@
+static bool lcl_parseSingleRangeToken(
+ ScRange& rRange, const rtl::OUString& rToken, ScDocument* pDoc, ScAddress::Convention eConv,
-+ const sal_Unicode cSep, const sal_Unicode cQuote)
++ const sal_Unicode cQuote, bool bOldSyntaxWorkAround)
+{
+ sal_Int32 nSepPos = ScRangeStringConverter::IndexOf(rToken, ':', 0, cQuote);
+ if (nSepPos >= 0)
+ {
-+ rtl::OUString aStartAddr = rToken.copy(0, nSepPos);
-+ rtl::OUString aEndAddr = rToken.copy(nSepPos+1);
-+ USHORT nRes = rRange.aStart.Parse(aStartAddr, pDoc, eConv);
++ // Cell range
++ rtl::OUString aBeginCell = rToken.copy(0, nSepPos);
++ rtl::OUString aEndCell = rToken.copy(nSepPos+1);
++
++ if (!aBeginCell.getLength() || !aEndCell.getLength())
++ // both cell addresses must exist for this to work.
++ return false;
++
++ if (bOldSyntaxWorkAround && aEndCell.getStr()[0] == '.')
++ {
++ // workaround for old syntax (probably pre-chart2 age?)
++ // e.g. Sheet1.A1:.B2
++ sal_Int32 nDotPos = ScRangeStringConverter::IndexOf(aBeginCell, sal_Unicode('.'), 0, cQuote);
++ rtl::OUString aTabName = aBeginCell.copy(0, nDotPos);
++ aEndCell = aTabName + aEndCell;
++ }
++ USHORT nRes = rRange.aStart.Parse(aBeginCell, pDoc, eConv);
+ if ((nRes & SCA_VALID) != SCA_VALID)
+ return false;
+
-+ nRes = rRange.aEnd.Parse(aEndAddr, pDoc, eConv);
++ nRes = rRange.aEnd.Parse(aEndCell, pDoc, eConv);
+ if ((nRes & SCA_VALID) != SCA_VALID)
+ return false;
+ }
@@ -981,8 +995,7 @@
+ break;
+
+ // Chart always saves ranges using CONV_OOO convention.
-+ sal_Int32 nSepPos = ScRangeStringConverter::IndexOf(aToken, ':', 0, cQuote);
-+ bool bSuccess = lcl_parseSingleRangeToken(aRange, aToken, m_pDocument, ScAddress::CONV_OOO, cSep, cQuote);
++ bool bSuccess = lcl_parseSingleRangeToken(aRange, aToken, m_pDocument, ScAddress::CONV_OOO, cQuote, true);
+
+ if (bSuccess)
+ {
@@ -1005,7 +1018,7 @@
+ // regardless of address conventions when stored in ODF. This means,
+ // for example, Sheet1!A1:A3 in Excel A1 syntax was expressed as
+ // Sheet1!A1:Sheet1!A3.
-+ bSuccess = lcl_parseSingleRangeToken(aRange, aToken, m_pDocument, eConvUI, cSep, cQuote);
++ bSuccess = lcl_parseSingleRangeToken(aRange, aToken, m_pDocument, eConvUI, cQuote, false);
+ if (!bSuccess)
+ continue;
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]