Lines 1075-1080
for (i = 97; i < 123; i++)
Link Here
|
1075 |
|
1075 |
|
1076 |
//----------------------------------------------------------------------------- |
1076 |
//----------------------------------------------------------------------------- |
1077 |
|
1077 |
|
|
|
1078 |
static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, ParseResult& rRes ) |
1079 |
{ |
1080 |
//Tokens that start at ' can have anything in them until a final ' |
1081 |
//but '' marks an escaped ' |
1082 |
//We've earlier guaranteed that a string containing '' will be |
1083 |
//surrounded by ' |
1084 |
if (rFormula.GetChar(nSrcPos) == '\'') |
1085 |
{ |
1086 |
xub_StrLen nPos = nSrcPos+1; |
1087 |
while (nPos < rFormula.Len()) |
1088 |
{ |
1089 |
if (rFormula.GetChar(nPos) == '\'') |
1090 |
{ |
1091 |
if ( (nPos+1 == rFormula.Len()) || (rFormula.GetChar(nPos+1) != '\'') ) |
1092 |
{ |
1093 |
rRes.TokenType = KParseType::SINGLE_QUOTE_NAME; |
1094 |
rRes.EndPos = nPos+1; |
1095 |
return false; |
1096 |
} |
1097 |
++nPos; |
1098 |
} |
1099 |
++nPos; |
1100 |
} |
1101 |
} |
1102 |
|
1103 |
return true; |
1104 |
} |
1105 |
|
1078 |
struct Convention_A1 : public ScCompiler::Convention |
1106 |
struct Convention_A1 : public ScCompiler::Convention |
1079 |
{ |
1107 |
{ |
1080 |
Convention_A1( ScAddress::Convention eConv ) : ScCompiler::Convention( eConv ) { } |
1108 |
Convention_A1( ScAddress::Convention eConv ) : ScCompiler::Convention( eConv ) { } |
Lines 1087-1092
struct Convention_A1 : public ScCompiler::Convention
Link Here
|
1087 |
xub_StrLen nSrcPos, |
1115 |
xub_StrLen nSrcPos, |
1088 |
const CharClass* pCharClass) const |
1116 |
const CharClass* pCharClass) const |
1089 |
{ |
1117 |
{ |
|
|
1118 |
ParseResult aRet; |
1119 |
if ( !lcl_isValidQuotedText(rFormula, nSrcPos, aRet) ) |
1120 |
return aRet; |
1121 |
|
1090 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1122 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1091 |
KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; |
1123 |
KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; |
1092 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
1124 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
Lines 1261-1266
struct ConventionOOO_A1 : public Convention_A1
Link Here
|
1261 |
{ |
1293 |
{ |
1262 |
MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, false); |
1294 |
MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, false); |
1263 |
} |
1295 |
} |
|
|
1296 |
|
1297 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1298 |
{ |
1299 |
switch (eSymType) |
1300 |
{ |
1301 |
case ScCompiler::Convention::ABS_SHEET_PREFIX: |
1302 |
return '$'; |
1303 |
case ScCompiler::Convention::SHEET_SEPARATOR: |
1304 |
return '.'; |
1305 |
} |
1306 |
|
1307 |
return sal_Unicode(0); |
1308 |
} |
1264 |
}; |
1309 |
}; |
1265 |
|
1310 |
|
1266 |
|
1311 |
|
Lines 1370-1375
struct ConventionXL
Link Here
|
1370 |
rBuf.append( sal_Unicode( '!' ) ); |
1415 |
rBuf.append( sal_Unicode( '!' ) ); |
1371 |
} |
1416 |
} |
1372 |
} |
1417 |
} |
|
|
1418 |
|
1419 |
static sal_Unicode getSpecialSymbol( ScCompiler::Convention::SpecialSymbolType eSymType ) |
1420 |
{ |
1421 |
switch (eSymType) |
1422 |
{ |
1423 |
case ScCompiler::Convention::SHEET_SEPARATOR: |
1424 |
return '!'; |
1425 |
} |
1426 |
return sal_Unicode(0); |
1427 |
} |
1373 |
}; |
1428 |
}; |
1374 |
|
1429 |
|
1375 |
struct ConventionXL_A1 : public Convention_A1, public ConventionXL |
1430 |
struct ConventionXL_A1 : public Convention_A1, public ConventionXL |
Lines 1446-1451
struct ConventionXL_A1 : public Convention_A1, public ConventionXL
Link Here
|
1446 |
MakeRowStr( rBuf, aRef.Ref2.nRow ); |
1501 |
MakeRowStr( rBuf, aRef.Ref2.nRow ); |
1447 |
} |
1502 |
} |
1448 |
} |
1503 |
} |
|
|
1504 |
|
1505 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1506 |
{ |
1507 |
return ConventionXL::getSpecialSymbol(eSymType); |
1508 |
} |
1449 |
}; |
1509 |
}; |
1450 |
|
1510 |
|
1451 |
static const ConventionXL_A1 ConvXL_A1; |
1511 |
static const ConventionXL_A1 ConvXL_A1; |
Lines 1555-1560
struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
Link Here
|
1555 |
xub_StrLen nSrcPos, |
1615 |
xub_StrLen nSrcPos, |
1556 |
const CharClass* pCharClass) const |
1616 |
const CharClass* pCharClass) const |
1557 |
{ |
1617 |
{ |
|
|
1618 |
ParseResult aRet; |
1619 |
if ( !lcl_isValidQuotedText(rFormula, nSrcPos, aRet) ) |
1620 |
return aRet; |
1621 |
|
1558 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1622 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1559 |
KParseTokens::ASC_UNDERSCORE ; |
1623 |
KParseTokens::ASC_UNDERSCORE ; |
1560 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
1624 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
Lines 1564-1569
struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
Link Here
|
1564 |
return pCharClass->parseAnyToken( rFormula, |
1628 |
return pCharClass->parseAnyToken( rFormula, |
1565 |
nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed ); |
1629 |
nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed ); |
1566 |
} |
1630 |
} |
|
|
1631 |
|
1632 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1633 |
{ |
1634 |
return ConventionXL::getSpecialSymbol(eSymType); |
1635 |
} |
1567 |
}; |
1636 |
}; |
1568 |
|
1637 |
|
1569 |
static const ConventionXL_R1C1 ConvXL_R1C1; |
1638 |
static const ConventionXL_R1C1 ConvXL_R1C1; |
Lines 1621-1649
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,
Link Here
|
1621 |
void ScCompiler::CheckTabQuotes( String& rString, |
1690 |
void ScCompiler::CheckTabQuotes( String& rString, |
1622 |
const ScAddress::Convention eConv ) |
1691 |
const ScAddress::Convention eConv ) |
1623 |
{ |
1692 |
{ |
1624 |
register const xub_StrLen nLen = rString.Len(); |
1693 |
using namespace ::com::sun::star::i18n; |
1625 |
register xub_StrLen i; |
1694 |
sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | KParseTokens::ASC_UNDERSCORE; |
1626 |
|
1695 |
sal_Int32 nContFlags = nStartFlags; |
1627 |
bool bNeedsQuote = false; |
1696 |
ParseResult aRes = ScGlobal::pCharClass->parsePredefinedToken( |
1628 |
|
1697 |
KParseType::IDENTNAME, rString, 0, nStartFlags, EMPTY_STRING, nContFlags, EMPTY_STRING); |
1629 |
for ( i = 0 ; i < nLen ; i++ ) |
1698 |
bool bNeedsQuote = !((aRes.TokenType & KParseType::IDENTNAME) && aRes.EndPos == rString.Len()); |
1630 |
{ |
|
|
1631 |
if( !IsWordChar( rString, i ) ) |
1632 |
{ |
1633 |
bNeedsQuote = true; |
1634 |
break; |
1635 |
} |
1636 |
} |
1637 |
if ( !bNeedsQuote && CharClass::isAsciiNumeric( rString ) ) |
1638 |
{ |
1639 |
bNeedsQuote = true; |
1640 |
} |
1641 |
|
1699 |
|
1642 |
switch ( eConv ) { |
1700 |
switch ( eConv ) { |
1643 |
default : |
1701 |
default : |
1644 |
case ScAddress::CONV_UNSPECIFIED : |
1702 |
case ScAddress::CONV_UNSPECIFIED : |
1645 |
case ScAddress::CONV_OOO : |
|
|
1646 |
break; |
1703 |
break; |
|
|
1704 |
case ScAddress::CONV_OOO : |
1647 |
case ScAddress::CONV_XL_A1 : |
1705 |
case ScAddress::CONV_XL_A1 : |
1648 |
case ScAddress::CONV_XL_R1C1 : |
1706 |
case ScAddress::CONV_XL_R1C1 : |
1649 |
if( bNeedsQuote ) |
1707 |
if( bNeedsQuote ) |
Lines 1756-1761
xub_StrLen ScCompiler::NextSymbol()
Link Here
|
1756 |
sal_Unicode cSep = mxSymbols->getSymbol( ocSep).GetChar(0); |
1814 |
sal_Unicode cSep = mxSymbols->getSymbol( ocSep).GetChar(0); |
1757 |
sal_Unicode cDecSep = (mxSymbols->isEnglish() ? '.' : |
1815 |
sal_Unicode cDecSep = (mxSymbols->isEnglish() ? '.' : |
1758 |
ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0)); |
1816 |
ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0)); |
|
|
1817 |
|
1818 |
// special symbols specific to address convention used |
1819 |
sal_Unicode cSheetPrefix = pConv->getSpecialSymbol(ScCompiler::Convention::ABS_SHEET_PREFIX); |
1820 |
sal_Unicode cSheetSep = pConv->getSpecialSymbol(ScCompiler::Convention::SHEET_SEPARATOR); |
1821 |
|
1759 |
int nDecSeps = 0; |
1822 |
int nDecSeps = 0; |
1760 |
int nRefInSheetName = 0; |
1823 |
int nRefInSheetName = 0; |
1761 |
mnPredetectedReference = 0; |
1824 |
mnPredetectedReference = 0; |
Lines 2063-2070
xub_StrLen ScCompiler::NextSymbol()
Link Here
|
2063 |
do |
2126 |
do |
2064 |
{ |
2127 |
{ |
2065 |
bi18n = FALSE; |
2128 |
bi18n = FALSE; |
2066 |
// special case $'sheetname' |
2129 |
// special case (e.g. $'sheetname' in OOO A1) |
2067 |
if ( pStart[nSrcPos] == '$' && pStart[nSrcPos+1] == '\'' ) |
2130 |
if ( pStart[nSrcPos] == cSheetPrefix && pStart[nSrcPos+1] == '\'' ) |
2068 |
aSymbol += pStart[nSrcPos++]; |
2131 |
aSymbol += pStart[nSrcPos++]; |
2069 |
|
2132 |
|
2070 |
ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, pCharClass ); |
2133 |
ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, pCharClass ); |
Lines 2082-2090
xub_StrLen ScCompiler::NextSymbol()
Link Here
|
2082 |
aSymbol.Append( pStart + nSrcPos, (xub_StrLen)aRes.EndPos - nSrcPos ); |
2145 |
aSymbol.Append( pStart + nSrcPos, (xub_StrLen)aRes.EndPos - nSrcPos ); |
2083 |
nSrcPos = (xub_StrLen) aRes.EndPos; |
2146 |
nSrcPos = (xub_StrLen) aRes.EndPos; |
2084 |
if ( aRes.TokenType & KParseType::SINGLE_QUOTE_NAME ) |
2147 |
if ( aRes.TokenType & KParseType::SINGLE_QUOTE_NAME ) |
2085 |
{ // special cases 'sheetname'. 'filename'# |
2148 |
{ // special cases (e.g. 'sheetname'. or 'filename'# in OOO A1) |
2086 |
c = pStart[nSrcPos]; |
2149 |
c = pStart[nSrcPos]; |
2087 |
bi18n = (c == '.' || c == SC_COMPILER_FILE_TAB_SEP); |
2150 |
bi18n = (c == cSheetSep || c == SC_COMPILER_FILE_TAB_SEP); |
2088 |
if ( bi18n ) |
2151 |
if ( bi18n ) |
2089 |
aSymbol += pStart[nSrcPos++]; |
2152 |
aSymbol += pStart[nSrcPos++]; |
2090 |
} |
2153 |
} |