Lines 1087-1092
struct Convention_A1 : public ScCompiler::Convention
Link Here
|
1087 |
xub_StrLen nSrcPos, |
1087 |
xub_StrLen nSrcPos, |
1088 |
const CharClass* pCharClass) const |
1088 |
const CharClass* pCharClass) const |
1089 |
{ |
1089 |
{ |
|
|
1090 |
//Tokens that start at ' can have anything in them until a final ' |
1091 |
//but '' marks an escaped ' |
1092 |
//We've earlier guaranteed that a string containing '' will be |
1093 |
//surrounded by ' |
1094 |
if (rFormula.GetChar(nSrcPos) == '\'') |
1095 |
{ |
1096 |
xub_StrLen nPos = nSrcPos+1; |
1097 |
while (nPos < rFormula.Len()) |
1098 |
{ |
1099 |
if (rFormula.GetChar(nPos) == '\'') |
1100 |
{ |
1101 |
if ( (nPos+1 == rFormula.Len()) || (rFormula.GetChar(nPos+1) != '\'') ) |
1102 |
{ |
1103 |
ParseResult aRet; |
1104 |
aRet.TokenType = KParseType::SINGLE_QUOTE_NAME; |
1105 |
aRet.EndPos = nPos+1; |
1106 |
return aRet; |
1107 |
} |
1108 |
++nPos; |
1109 |
} |
1110 |
++nPos; |
1111 |
} |
1112 |
} |
1113 |
|
1090 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1114 |
static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | |
1091 |
KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; |
1115 |
KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; |
1092 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
1116 |
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; |
Lines 1261-1266
struct ConventionOOO_A1 : public Convention_A1
Link Here
|
1261 |
{ |
1285 |
{ |
1262 |
MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, false); |
1286 |
MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, false); |
1263 |
} |
1287 |
} |
|
|
1288 |
|
1289 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1290 |
{ |
1291 |
switch (eSymType) |
1292 |
{ |
1293 |
case ScCompiler::Convention::ABS_SHEET_PREFIX: |
1294 |
return '$'; |
1295 |
case ScCompiler::Convention::SHEET_SEPARATOR: |
1296 |
return '.'; |
1297 |
} |
1298 |
|
1299 |
return sal_Unicode(0); |
1300 |
} |
1264 |
}; |
1301 |
}; |
1265 |
|
1302 |
|
1266 |
|
1303 |
|
Lines 1370-1375
struct ConventionXL
Link Here
|
1370 |
rBuf.append( sal_Unicode( '!' ) ); |
1407 |
rBuf.append( sal_Unicode( '!' ) ); |
1371 |
} |
1408 |
} |
1372 |
} |
1409 |
} |
|
|
1410 |
|
1411 |
static sal_Unicode getSpecialSymbol( ScCompiler::Convention::SpecialSymbolType eSymType ) |
1412 |
{ |
1413 |
switch (eSymType) |
1414 |
{ |
1415 |
case ScCompiler::Convention::SHEET_SEPARATOR: |
1416 |
return '!'; |
1417 |
} |
1418 |
return sal_Unicode(0); |
1419 |
} |
1373 |
}; |
1420 |
}; |
1374 |
|
1421 |
|
1375 |
struct ConventionXL_A1 : public Convention_A1, public ConventionXL |
1422 |
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 ); |
1493 |
MakeRowStr( rBuf, aRef.Ref2.nRow ); |
1447 |
} |
1494 |
} |
1448 |
} |
1495 |
} |
|
|
1496 |
|
1497 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1498 |
{ |
1499 |
return ConventionXL::getSpecialSymbol(eSymType); |
1500 |
} |
1449 |
}; |
1501 |
}; |
1450 |
|
1502 |
|
1451 |
static const ConventionXL_A1 ConvXL_A1; |
1503 |
static const ConventionXL_A1 ConvXL_A1; |
Lines 1564-1569
struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
Link Here
|
1564 |
return pCharClass->parseAnyToken( rFormula, |
1616 |
return pCharClass->parseAnyToken( rFormula, |
1565 |
nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed ); |
1617 |
nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed ); |
1566 |
} |
1618 |
} |
|
|
1619 |
|
1620 |
virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const |
1621 |
{ |
1622 |
return ConventionXL::getSpecialSymbol(eSymType); |
1623 |
} |
1567 |
}; |
1624 |
}; |
1568 |
|
1625 |
|
1569 |
static const ConventionXL_R1C1 ConvXL_R1C1; |
1626 |
static const ConventionXL_R1C1 ConvXL_R1C1; |
Lines 1621-1649
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,
Link Here
|
1621 |
void ScCompiler::CheckTabQuotes( String& rString, |
1678 |
void ScCompiler::CheckTabQuotes( String& rString, |
1622 |
const ScAddress::Convention eConv ) |
1679 |
const ScAddress::Convention eConv ) |
1623 |
{ |
1680 |
{ |
1624 |
register const xub_StrLen nLen = rString.Len(); |
1681 |
using namespace ::com::sun::star::i18n; |
1625 |
register xub_StrLen i; |
1682 |
sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER | KParseTokens::ASC_UNDERSCORE; |
1626 |
|
1683 |
sal_Int32 nContFlags = nStartFlags; |
1627 |
bool bNeedsQuote = false; |
1684 |
ParseResult aRes = ScGlobal::pCharClass->parsePredefinedToken( |
1628 |
|
1685 |
KParseType::IDENTNAME, rString, 0, nStartFlags, EMPTY_STRING, nContFlags, EMPTY_STRING); |
1629 |
for ( i = 0 ; i < nLen ; i++ ) |
1686 |
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 |
|
1687 |
|
1642 |
switch ( eConv ) { |
1688 |
switch ( eConv ) { |
1643 |
default : |
1689 |
default : |
1644 |
case ScAddress::CONV_UNSPECIFIED : |
1690 |
case ScAddress::CONV_UNSPECIFIED : |
1645 |
case ScAddress::CONV_OOO : |
|
|
1646 |
break; |
1691 |
break; |
|
|
1692 |
case ScAddress::CONV_OOO : |
1647 |
case ScAddress::CONV_XL_A1 : |
1693 |
case ScAddress::CONV_XL_A1 : |
1648 |
case ScAddress::CONV_XL_R1C1 : |
1694 |
case ScAddress::CONV_XL_R1C1 : |
1649 |
if( bNeedsQuote ) |
1695 |
if( bNeedsQuote ) |
Lines 1756-1761
xub_StrLen ScCompiler::NextSymbol()
Link Here
|
1756 |
sal_Unicode cSep = mxSymbols->getSymbol( ocSep).GetChar(0); |
1802 |
sal_Unicode cSep = mxSymbols->getSymbol( ocSep).GetChar(0); |
1757 |
sal_Unicode cDecSep = (mxSymbols->isEnglish() ? '.' : |
1803 |
sal_Unicode cDecSep = (mxSymbols->isEnglish() ? '.' : |
1758 |
ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0)); |
1804 |
ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0)); |
|
|
1805 |
|
1806 |
// special symbols specific to address convention used |
1807 |
sal_Unicode cSheetPrefix = pConv->getSpecialSymbol(ScCompiler::Convention::ABS_SHEET_PREFIX); |
1808 |
sal_Unicode cSheetSep = pConv->getSpecialSymbol(ScCompiler::Convention::SHEET_SEPARATOR); |
1809 |
|
1759 |
int nDecSeps = 0; |
1810 |
int nDecSeps = 0; |
1760 |
int nRefInSheetName = 0; |
1811 |
int nRefInSheetName = 0; |
1761 |
mnPredetectedReference = 0; |
1812 |
mnPredetectedReference = 0; |
Lines 2063-2070
xub_StrLen ScCompiler::NextSymbol()
Link Here
|
2063 |
do |
2114 |
do |
2064 |
{ |
2115 |
{ |
2065 |
bi18n = FALSE; |
2116 |
bi18n = FALSE; |
2066 |
// special case $'sheetname' |
2117 |
// special case (e.g. $'sheetname' in OOO A1) |
2067 |
if ( pStart[nSrcPos] == '$' && pStart[nSrcPos+1] == '\'' ) |
2118 |
if ( pStart[nSrcPos] == cSheetPrefix && pStart[nSrcPos+1] == '\'' ) |
2068 |
aSymbol += pStart[nSrcPos++]; |
2119 |
aSymbol += pStart[nSrcPos++]; |
2069 |
|
2120 |
|
2070 |
ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, pCharClass ); |
2121 |
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 ); |
2133 |
aSymbol.Append( pStart + nSrcPos, (xub_StrLen)aRes.EndPos - nSrcPos ); |
2083 |
nSrcPos = (xub_StrLen) aRes.EndPos; |
2134 |
nSrcPos = (xub_StrLen) aRes.EndPos; |
2084 |
if ( aRes.TokenType & KParseType::SINGLE_QUOTE_NAME ) |
2135 |
if ( aRes.TokenType & KParseType::SINGLE_QUOTE_NAME ) |
2085 |
{ // special cases 'sheetname'. 'filename'# |
2136 |
{ // special cases (e.g. 'sheetname'. or 'filename'# in OOO A1) |
2086 |
c = pStart[nSrcPos]; |
2137 |
c = pStart[nSrcPos]; |
2087 |
bi18n = (c == '.' || c == SC_COMPILER_FILE_TAB_SEP); |
2138 |
bi18n = (c == cSheetSep || c == SC_COMPILER_FILE_TAB_SEP); |
2088 |
if ( bi18n ) |
2139 |
if ( bi18n ) |
2089 |
aSymbol += pStart[nSrcPos++]; |
2140 |
aSymbol += pStart[nSrcPos++]; |
2090 |
} |
2141 |
} |