summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2009-08-12 13:25:44 +0000
committerEike Rathke <er@openoffice.org>2009-08-12 13:25:44 +0000
commit0cc82b81a5bba3b81269a056a11aea8785f24fc4 (patch)
tree35399c589777c53f7d84a64a798029362373d75f
parent73419896e5bcd82bdc8820fbb26ed7394680511b (diff)
reverting bad commit to tags/OOO310_m18ooo/OOO310_m18
-rw-r--r--sc/inc/compiler.hxx13
-rw-r--r--sc/inc/externalrefmgr.hxx16
-rw-r--r--sc/source/core/data/cell2.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx82
-rw-r--r--sc/source/core/tool/rangeutl.cxx4
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx2
-rw-r--r--sc/source/core/tool/token.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx5
8 files changed, 21 insertions, 107 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index ac0e5ff7a..8f18f5a7a 100644
--- a/sc/inc/compiler.hxx
+++ b/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 1024 /* maximum length of input string of one symbol */
+#define MAXSTRLEN 256 /* maximum length of input string of one symbol */
#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */
// flag values of CharTable
@@ -217,14 +217,6 @@ typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef;
class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
{
public:
-
- enum EncodeUrlMode
- {
- ENCODE_BY_GRAMMAR,
- ENCODE_ALWAYS,
- ENCODE_NEVER,
- };
-
struct Convention
{
const formula::FormulaGrammar::AddressConvention meConv;
@@ -321,7 +313,6 @@ private:
SCsTAB nMaxTab; // last sheet in document
sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol
const Convention *pConv;
- EncodeUrlMode meEncodeUrlMode;
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
bool mbExtendedErrorDetection;
bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
@@ -381,8 +372,6 @@ public:
void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
- void SetEncodeUrlMode( EncodeUrlMode eMode );
- EncodeUrlMode GetEncodeUrlMode() const;
private:
/** Set grammar and reference convention from within SetFormulaLanguage()
or SetGrammar().
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 22e114df4..f5b6e3fc7 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -579,21 +579,7 @@ public:
*/
void convertToAbsName(String& rFile) const;
sal_uInt16 getExternalFileId(const String& rFile);
-
- /**
- * It returns a pointer to the name of the URI associated with a given
- * external file ID. In case the original document has moved, it returns
- * an URI adjusted for the relocation.
- *
- * @param nFileId file ID for an external document
- * @param bForceOriginal If true, it always returns the original document
- * URI even if the referring document has relocated.
- * If false, it returns an URI adjusted for
- * relocated document.
- *
- * @return const String* external document URI.
- */
- const String* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false);
+ const String* getExternalFileName(sal_uInt16 nFileId);
bool hasExternalFile(sal_uInt16 nFileId) const;
bool hasExternalFile(const String& rFile) const;
const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const;
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 32559399d..f32392040 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -130,8 +130,8 @@ void ScEditCell::GetString( String& rString ) const
EditEngine& rEngine = pDoc->GetEditEngine();
rEngine.SetText( *pData );
rString = ScEditUtil::GetSpaceDelimitedString(rEngine); // space between paragraphs
- // cache short strings for formulas
- if ( rString.Len() < 256 )
+ // kurze Strings fuer Formeln merken
+ if ( rString.Len() < MAXSTRLEN )
((ScEditCell*)this)->pString = new String( rString ); //! non-const
}
else
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e45fe28ec..564f6cbeb 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -432,15 +432,6 @@ void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar )
SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
}
-void ScCompiler::SetEncodeUrlMode( EncodeUrlMode eMode )
-{
- meEncodeUrlMode = eMode;
-}
-
-ScCompiler::EncodeUrlMode ScCompiler::GetEncodeUrlMode() const
-{
- return meEncodeUrlMode;
-}
void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap )
{
@@ -1064,19 +1055,14 @@ struct ConventionOOO_A1 : public Convention_A1
bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId,
const String& rTabName, const ScSingleRefData& rRef,
- ScExternalRefManager* pRefMgr, bool bDisplayTabName, bool bEncodeUrl ) const
+ ScExternalRefManager* pRefMgr, bool bDisplayTabName ) const
{
if (bDisplayTabName)
{
String aFile;
const String* p = pRefMgr->getExternalFileName(nFileId);
if (p)
- {
- if (bEncodeUrl)
- aFile = *p;
- else
- aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
- }
+ aFile = *p;
aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
rBuffer.append(sal_Unicode('\''));
@@ -1110,23 +1096,7 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( sal_Unicode('['));
-
- bool bEncodeUrl = true;
- switch (rCompiler.GetEncodeUrlMode())
- {
- case ScCompiler::ENCODE_BY_GRAMMAR:
- bEncodeUrl = bODF;
- break;
- case ScCompiler::ENCODE_ALWAYS:
- bEncodeUrl = true;
- break;
- case ScCompiler::ENCODE_NEVER:
- bEncodeUrl = false;
- break;
- default:
- ;
- }
- makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true, bEncodeUrl);
+ makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true);
if (bODF)
rBuffer.append( sal_Unicode(']'));
}
@@ -1148,25 +1118,9 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( sal_Unicode('['));
// Ensure that there's always a closing bracket, no premature returns.
- bool bEncodeUrl = true;
- switch (rCompiler.GetEncodeUrlMode())
- {
- case ScCompiler::ENCODE_BY_GRAMMAR:
- bEncodeUrl = bODF;
- break;
- case ScCompiler::ENCODE_ALWAYS:
- bEncodeUrl = true;
- break;
- case ScCompiler::ENCODE_NEVER:
- bEncodeUrl = false;
- break;
- default:
- ;
- }
-
do
{
- if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true, bEncodeUrl))
+ if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true))
break;
rBuffer.append(sal_Unicode(':'));
@@ -1192,7 +1146,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, bEncodeUrl);
+ aRef.Ref2, pRefMgr, bDisplayTabName);
} while (0);
if (bODF)
rBuffer.append( sal_Unicode(']'));
@@ -1354,7 +1308,7 @@ struct ConventionXL
return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('!'), false);
}
- static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName, bool bEncodeUrl )
+ static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName )
{
// Format that is easier to deal with inside OOo, because we use file
// URL, and all characetrs are allowed. Check if it makes sense to do
@@ -1365,14 +1319,8 @@ struct ConventionXL
rBuffer.append(sal_Unicode('['));
rBuffer.append(sal_Unicode('\''));
- String aFullName;
- if (bEncodeUrl)
- aFullName = rFullName;
- else
- aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
-
- const sal_Unicode* pBuf = aFullName.GetBuffer();
- xub_StrLen nLen = aFullName.Len();
+ const sal_Unicode* pBuf = rFullName.GetBuffer();
+ xub_StrLen nLen = rFullName.Len();
for (xub_StrLen i = 0; i < nLen; ++i)
{
const sal_Unicode c = pBuf[i];
@@ -1585,8 +1533,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScSingleRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append(sal_Unicode('!'));
@@ -1609,8 +1556,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScComplexRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef);
rBuffer.append(sal_Unicode('!'));
@@ -1791,8 +1737,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScSingleRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append(sal_Unicode('!'));
@@ -1816,8 +1761,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScComplexRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(
- rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
+ ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef);
rBuffer.append(sal_Unicode('!'));
@@ -1869,7 +1813,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
- meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
mbCloseBrackets( true ),
mbExtendedErrorDetection( false ),
mbRewind( false )
@@ -1885,7 +1828,6 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
- meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
mbCloseBrackets( true ),
mbExtendedErrorDetection( false ),
mbRewind( false )
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 801cf173b..62474c3d4 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -786,7 +786,7 @@ static void lcl_appendCellAddress(
if (rExtInfo.mbExternal)
{
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId, true);
+ const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId);
if (!pFilePath)
return;
@@ -821,7 +821,7 @@ static void lcl_appendCellRangeAddress(
DBG_ASSERT(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not match between 1st and 2nd addresses.");
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true);
+ const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId);
if (!pFilePath)
return;
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 15f86a45c..07db9fd51 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -51,7 +51,7 @@ using ::rtl::OUString;
void ScRefTokenHelper::compileRangeRepresentation(
vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc)
{
- const sal_Unicode cSep = GetScCompilerNativeSymbol(ocSep).GetChar(0);
+ const sal_Unicode cSep = ';';
const sal_Unicode cQuote = '\'';
bool bFailure = false;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index fddce0549..6571a074d 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -119,7 +119,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator, 32, 16 )
// Align MemPools on 4k boundaries - 64 bytes (4k is a MUST for OS/2)
// Since RawTokens are temporary for the compiler, don't align on 4k and waste memory.
-// ScRawToken size is FixMembers + MAXSTRLEN + ~4 ~= 1036
+// ScRawToken size is FixMembers + MAXSTRLEN ~= 264
IMPL_FIXEDMEMPOOL_NEWDEL( ScRawToken, 8, 4 )
// Some ScDoubleRawToken, FixMembers + sizeof(double) ~= 16
const USHORT nMemPoolDoubleRawToken = 0x0400 / sizeof(ScDoubleRawToken);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 1a4154c40..15eaf6774 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2085,14 +2085,11 @@ sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile)
return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
}
-const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal)
+const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId)
{
if (nFileId >= maSrcFiles.size())
return NULL;
- if (bForceOriginal)
- return &maSrcFiles[nFileId].maFileName;
-
maybeCreateRealFileName(nFileId);
if (maSrcFiles[nFileId].maRealFileName.Len())