summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-27 06:51:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-13 14:47:27 +0000
commit6d26deaa4c40f554fb6bc036047564d466b361fd (patch)
treefafb04d8fa2392775ed6d952fa4a0dee83f0a09e
parent0e4df45891035e9f18070173a02c5bdc2eda9a49 (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/13837 Tested-by: Eike Rathke <erack@redhat.com> Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@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 37c234acfc90..40f1de7b7dde 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) )