summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-27 06:51:52 +0100
committerEike Rathke <erack@redhat.com>2015-01-10 16:06:08 +0000
commit6c5748de1826f9a712a9a5795b1bc81cb7c63d1d (patch)
treea2b83930c4aa64197306fa7972570ac57c2b26f4
parent95b0f165e30a7dc99a76925c613a51992c85ec54 (diff)
handle index based external refs in formulas in ooxml import, fdo#85617
(cherry picked from commit 18cccd62fb5b730319878df6fac748d5cdf73f1f) return after finding the reference (cherry picked from commit cef36587674b6472471478524e87b1add4109507) that method is the same as in the base class (cherry picked from commit 02caf8f2eef75d8b5acb6a4ec40277355c3c6c6e) remove copy&paste code (cherry picked from commit 757ce63f7346aea132f11c3d9a328b0a1a776403) a22b97b0a45d8d840095737638c2ccf68373e27a 8cb6f59795d9461c0e02ab70d7edd60af1410c1f 5710856fdb9fb91573de89eeb5a29d3d106ad7a6 Change-Id: Ie4f43f041f5d614b9c2826c74574c854af05c266 Reviewed-on: https://gerrit.libreoffice.org/13671 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/tool/compiler.cxx31
1 files changed, 28 insertions, 3 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5320d7e9bd9b..69b6fcc8a2af 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -986,6 +986,10 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
struct ConventionXL
{
+ virtual ~ConventionXL()
+ {
+ }
+
static void GetTab(
const ScAddress& rPos, const std::vector<OUString>& rTabNames,
const ScSingleRefData& rRef, OUString& rTabName )
@@ -1100,7 +1104,7 @@ struct ConventionXL
}
}
- static void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos )
+ virtual void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos ) const
{
sal_Int32 nLen = rFormula.getLength();
const sal_Unicode* p = rFormula.getStr();
@@ -1236,7 +1240,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
sal_Int32 nSrcPos,
const CharClass* pCharClass) const SAL_OVERRIDE
{
- ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+ parseExternalDocName(rFormula, nSrcPos);
ParseResult aRet;
if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
@@ -1322,6 +1326,27 @@ struct ConventionXL_OOX : public ConventionXL_A1
* CellStr. */
}
+ virtual void parseExternalDocName(const OUString& rFormula, sal_Int32& rSrcPos) const SAL_OVERRIDE
+ {
+ sal_Int32 nLen = rFormula.getLength();
+ const sal_Unicode* p = rFormula.getStr();
+ for (sal_Int32 i = rSrcPos; i < nLen; ++i)
+ {
+ sal_Unicode c = p[i];
+ if (i == rSrcPos)
+ {
+ // first character must be '['.
+ if (c != '[')
+ return;
+ }
+ else if (c == ']')
+ {
+ rSrcPos = i + 1;
+ return;
+ }
+ }
+ }
+
virtual void makeExternalRefStr(
OUStringBuffer& rBuffer, const ScAddress& rPos, sal_uInt16 nFileId, const OUString& /*rFileName*/,
const OUString& rTabName, const ScSingleRefData& rRef ) const SAL_OVERRIDE
@@ -1461,7 +1486,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
sal_Int32 nSrcPos,
const CharClass* pCharClass) const SAL_OVERRIDE
{
- ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+ parseExternalDocName(rFormula, nSrcPos);
ParseResult aRet;
if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )