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:07:32 +0000
commit90bbc9e6f51a2281f7cf06577252791e62a9189b (patch)
tree298cfd58446a0e3e4c584d9b9a4bfa138be40262
parentcabf7158a8fa3eabda8d6436f46bdaf1a6ae8516 (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/13839 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 13639ccc8716..510a2b842e38 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -991,6 +991,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 )
@@ -1105,7 +1109,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();
@@ -1241,7 +1245,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) )
@@ -1327,6 +1331,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
@@ -1466,7 +1491,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) )