diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx index 0c7b76d..280776d 100644 --- sc/inc/compiler.hxx +++ sc/inc/compiler.hxx @@ -64,7 +64,7 @@ // constants and data types also for external modules (ScInterpreter et al) #define MAXCODE 512 /* maximum number of tokens in formula */ -#define MAXSTRLEN 256 /* maximum length of input string of one symbol */ +#define MAXSTRLEN 1024 /* maximum length of input string of one symbol */ #define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */ // flag values of CharTable diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx index bbb62c0..5b65d91 100644 --- sc/source/core/tool/compiler.cxx +++ sc/source/core/tool/compiler.cxx @@ -1055,14 +1055,19 @@ struct ConventionOOO_A1 : public Convention_A1 bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef, - ScExternalRefManager* pRefMgr, bool bDisplayTabName ) const + ScExternalRefManager* pRefMgr, bool bDisplayTabName, bool bDecodeUrl ) const { if (bDisplayTabName) { String aFile; const String* p = pRefMgr->getExternalFileName(nFileId); if (p) - aFile = *p; + { + if (bDecodeUrl) + aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); + else + aFile = *p; + } aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''")); rBuffer.append(sal_Unicode('\'')); @@ -1096,7 +1101,7 @@ struct ConventionOOO_A1 : public Convention_A1 if (bODF) rBuffer.append( sal_Unicode('[')); - makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true); + makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true, !bODF); if (bODF) rBuffer.append( sal_Unicode(']')); } @@ -1120,7 +1125,7 @@ struct ConventionOOO_A1 : public Convention_A1 // Ensure that there's always a closing bracket, no premature returns. do { - if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true)) + if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true, !bODF)) break; rBuffer.append(sal_Unicode(':')); @@ -1146,7 +1151,7 @@ struct ConventionOOO_A1 : public Convention_A1 else if (bODF) rBuffer.append( sal_Unicode('.')); // need at least the sheet separator in ODF makeExternalSingleRefStr( rBuffer, nFileId, aLastTabName, - aRef.Ref2, pRefMgr, bDisplayTabName); + aRef.Ref2, pRefMgr, bDisplayTabName, !bODF); } while (0); if (bODF) rBuffer.append( sal_Unicode(']')); @@ -1319,8 +1324,9 @@ struct ConventionXL rBuffer.append(sal_Unicode('[')); rBuffer.append(sal_Unicode('\'')); - const sal_Unicode* pBuf = rFullName.GetBuffer(); - xub_StrLen nLen = rFullName.Len(); + String aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); + const sal_Unicode* pBuf = aFullName.GetBuffer(); + xub_StrLen nLen = aFullName.Len(); for (xub_StrLen i = 0; i < nLen; ++i) { const sal_Unicode c = pBuf[i];