[Libreoffice-commits] core.git: 2 commits - sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri Dec 26 22:02:24 PST 2014
sc/source/core/data/global2.cxx | 2 -
sc/source/core/tool/compiler.cxx | 46 +++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
New commits:
commit 18cccd62fb5b730319878df6fac748d5cdf73f1f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Dec 27 06:51:52 2014 +0100
handle index based external refs in formulas in ooxml import, fdo#85617
Change-Id: Ie4f43f041f5d614b9c2826c74574c854af05c266
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 0c273b3..1c292aa 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1322,6 +1322,52 @@ struct ConventionXL_OOX : public ConventionXL_A1
* CellStr. */
}
+ static void parseExternalDocNameOOX(const OUString& rFormula, sal_Int32& rSrcPos)
+ {
+ 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;
+ }
+ }
+ }
+
+ virtual ParseResult parseAnyToken( const OUString& rFormula,
+ sal_Int32 nSrcPos,
+ const CharClass* pCharClass) const SAL_OVERRIDE
+ {
+ parseExternalDocNameOOX(rFormula, nSrcPos);
+
+ ParseResult aRet;
+ if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
+ return aRet;
+
+ static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
+ KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR;
+ static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT;
+ // '?' allowed in range names
+ const OUString aAddAllowed("?!");
+ return pCharClass->parseAnyToken( rFormula,
+ nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
+ }
+
+ virtual bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName,
+ const ScDocument* pDoc,
+ const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) const SAL_OVERRIDE
+ {
+ return ConventionXL::parseExternalName( rSymbol, rFile, rName, pDoc, pExternalLinks);
+ }
+
virtual void makeExternalRefStr(
OUStringBuffer& rBuffer, const ScAddress& rPos, sal_uInt16 nFileId, const OUString& /*rFileName*/,
const OUString& rTabName, const ScSingleRefData& rRef ) const SAL_OVERRIDE
commit 808b0bf831d4a4fdb60c01865d0a7dd36cf9d521
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Dec 27 06:42:16 2014 +0100
NO_DECODE breaks non-ascii urls, fdo#85617
Change-Id: Ic76346d20dc7fdbb5d77ba08d87f0d6c6e7b3c88
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index 93da6d3..5fd14cc 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -327,7 +327,7 @@ OUString ScGlobal::GetAbsDocName( const OUString& rFileName,
if ( pMedium )
{
bool bWasAbs = true;
- aAbsName = pMedium->GetURLObject().smartRel2Abs( rFileName, bWasAbs ).GetMainURL(INetURLObject::NO_DECODE);
+ aAbsName = pMedium->GetURLObject().smartRel2Abs( rFileName, bWasAbs ).GetMainURL(INetURLObject::DECODE_TO_IURI);
}
else
{ // This can't happen, but ...
More information about the Libreoffice-commits
mailing list