Lines 93-98
Link Here
|
93 |
|
93 |
|
94 |
//======================================================================== |
94 |
//======================================================================== |
95 |
|
95 |
|
|
|
96 |
namespace |
97 |
{ |
98 |
const String SYLK_LF = String::CreateFromAscii("\x1b :"); |
99 |
const String SEMICOLON = String::CreateFromAscii(";"); |
100 |
const String DOUBLE_SEMICOLON = String::CreateFromAscii(";;"); |
101 |
} |
96 |
|
102 |
|
97 |
// Gesamtdokument ohne Undo |
103 |
// Gesamtdokument ohne Undo |
98 |
|
104 |
|
Lines 575-580
Link Here
|
575 |
} |
581 |
} |
576 |
|
582 |
|
577 |
|
583 |
|
|
|
584 |
// This function could be replaced by endlub() |
578 |
// static |
585 |
// static |
579 |
void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm ) |
586 |
void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm ) |
580 |
{ |
587 |
{ |
Lines 605-611
Link Here
|
605 |
DQM_SEPARATE // end one string and begin next |
612 |
DQM_SEPARATE // end one string and begin next |
606 |
}; |
613 |
}; |
607 |
|
614 |
|
608 |
const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString, |
615 |
static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString, |
609 |
sal_Unicode cStr, DoubledQuoteMode eMode ) |
616 |
sal_Unicode cStr, DoubledQuoteMode eMode ) |
610 |
{ |
617 |
{ |
611 |
p++; //! jump over opening quote |
618 |
p++; //! jump over opening quote |
Lines 653-660
Link Here
|
653 |
return p; |
660 |
return p; |
654 |
} |
661 |
} |
655 |
|
662 |
|
|
|
663 |
static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p, String& rString ) |
664 |
{ |
665 |
const sal_Unicode* pStartQuote = p; |
666 |
const sal_Unicode* pEndQuote = 0; |
667 |
while( *(++p) ) |
668 |
{ |
669 |
if( *p == '"' ) |
670 |
pEndQuote = p; |
671 |
} |
672 |
if( pEndQuote ) |
673 |
{ |
674 |
p = pEndQuote; |
675 |
rString.Append( pStartQuote + 1, sal::static_int_cast<xub_StrLen>( pEndQuote - pStartQuote - 1 ) ); |
676 |
rString.SearchAndReplaceAll( DOUBLE_SEMICOLON, ';' ); |
677 |
rString.SearchAndReplaceAll( SYLK_LF, _LF ); |
678 |
} |
679 |
return p; |
680 |
} |
656 |
|
681 |
|
657 |
void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr ) |
682 |
static void lcl_DoubleEscapeChar( String& rString, sal_Unicode cStr ) |
658 |
{ |
683 |
{ |
659 |
xub_StrLen n = 0; |
684 |
xub_StrLen n = 0; |
660 |
while( ( n = rString.Search( cStr, n ) ) != STRING_NOTFOUND ) |
685 |
while( ( n = rString.Search( cStr, n ) ) != STRING_NOTFOUND ) |
Lines 662-667
Link Here
|
662 |
rString.Insert( cStr, n ); |
687 |
rString.Insert( cStr, n ); |
663 |
n += 2; |
688 |
n += 2; |
664 |
} |
689 |
} |
|
|
690 |
} |
691 |
|
692 |
static void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr ) |
693 |
{ |
694 |
lcl_DoubleEscapeChar( rString, cStr ); |
665 |
|
695 |
|
666 |
rString.Insert( cStr, 0 ); |
696 |
rString.Insert( cStr, 0 ); |
667 |
rString.Append( cStr ); |
697 |
rString.Append( cStr ); |
Lines 1303-1312
Link Here
|
1303 |
else |
1333 |
else |
1304 |
{ |
1334 |
{ |
1305 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); |
1335 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); |
1306 |
if( aCell.Search( cSep ) != STRING_NOTFOUND ) |
1336 |
|
1307 |
lcl_WriteString( rStrm, aCell, cStr ); |
1337 |
BOOL bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); |
1308 |
else |
1338 |
if( bMultiLineText || aCell.Search( cSep ) != STRING_NOTFOUND ) |
1309 |
lcl_WriteSimpleString( rStrm, aCell ); |
1339 |
lcl_WriteString( rStrm, aCell, cStr ); |
|
|
1340 |
else |
1341 |
lcl_WriteSimpleString( rStrm, aCell ); |
1310 |
} |
1342 |
} |
1311 |
} |
1343 |
} |
1312 |
break; |
1344 |
break; |
Lines 1322-1328
Link Here
|
1322 |
default: |
1354 |
default: |
1323 |
{ |
1355 |
{ |
1324 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); |
1356 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); |
1325 |
if( aCell.Search( cSep ) != STRING_NOTFOUND ) |
1357 |
|
|
|
1358 |
BOOL bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); |
1359 |
if( bMultiLineText || aCell.Search( cSep ) != STRING_NOTFOUND ) |
1326 |
lcl_WriteString( rStrm, aCell, cStr ); |
1360 |
lcl_WriteString( rStrm, aCell, cStr ); |
1327 |
else |
1361 |
else |
1328 |
lcl_WriteSimpleString( rStrm, aCell ); |
1362 |
lcl_WriteSimpleString( rStrm, aCell ); |
Lines 1424-1431
Link Here
|
1424 |
if( *p == '"' ) |
1458 |
if( *p == '"' ) |
1425 |
{ |
1459 |
{ |
1426 |
bText = TRUE; |
1460 |
bText = TRUE; |
1427 |
aText = '\''; // force string cell |
1461 |
aText.Erase(); |
1428 |
p = lcl_ScanString( p, aText, '"', DQM_ESCAPE ); |
1462 |
p = lcl_ScanSylkString( p, aText ); |
1429 |
} |
1463 |
} |
1430 |
else |
1464 |
else |
1431 |
bText = FALSE; |
1465 |
bText = FALSE; |
Lines 1435-1441
Link Here
|
1435 |
if ( !(*q == ';' && *(q+1) == 'I') ) |
1469 |
if ( !(*q == ';' && *(q+1) == 'I') ) |
1436 |
{ // don't ignore value |
1470 |
{ // don't ignore value |
1437 |
if( bText ) |
1471 |
if( bText ) |
1438 |
pDoc->SetString( nCol, nRow, aRange.aStart.Tab(), aText ); |
1472 |
{ |
|
|
1473 |
pDoc->PutCell( nCol, nRow, aRange.aStart.Tab(), ScBaseCell::CreateTextCell( aText, pDoc ), (BOOL) TRUE ); |
1474 |
} |
1439 |
else |
1475 |
else |
1440 |
{ |
1476 |
{ |
1441 |
double fVal = rtl_math_uStringToDouble( p, |
1477 |
double fVal = rtl_math_uStringToDouble( p, |
Lines 1467-1473
Link Here
|
1467 |
break; |
1503 |
break; |
1468 |
aText = '='; |
1504 |
aText = '='; |
1469 |
if( *p == '"' ) |
1505 |
if( *p == '"' ) |
1470 |
p = lcl_ScanString( p, aText, '"', DQM_ESCAPE ); |
1506 |
{ |
|
|
1507 |
p = lcl_ScanSylkString( p, aText ); |
1508 |
} |
1471 |
else |
1509 |
else |
1472 |
{ |
1510 |
{ |
1473 |
const sal_Unicode* q = p; |
1511 |
const sal_Unicode* q = p; |
Lines 1660-1673
Link Here
|
1660 |
case CELLTYPE_EDIT: |
1698 |
case CELLTYPE_EDIT: |
1661 |
hasstring: |
1699 |
hasstring: |
1662 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr ); |
1700 |
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr ); |
|
|
1701 |
aCellStr.SearchAndReplaceAll( _LF, SYLK_LF ); |
1663 |
|
1702 |
|
1664 |
aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" )); |
1703 |
aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" )); |
1665 |
aBufStr += String::CreateFromInt32( c ); |
1704 |
aBufStr += String::CreateFromInt32( c ); |
1666 |
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";Y" )); |
1705 |
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";Y" )); |
1667 |
aBufStr += String::CreateFromInt32( r ); |
1706 |
aBufStr += String::CreateFromInt32( r ); |
1668 |
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";K" )); |
1707 |
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";K" )); |
|
|
1708 |
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\"" )); |
1669 |
lcl_WriteSimpleString( rStrm, aBufStr ); |
1709 |
lcl_WriteSimpleString( rStrm, aBufStr ); |
1670 |
lcl_WriteString( rStrm, aCellStr, '"' ); |
1710 |
lcl_DoubleEscapeChar( aCellStr, ';' ); |
|
|
1711 |
lcl_WriteSimpleString( rStrm, aCellStr ); |
1712 |
aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "\"" )); |
1713 |
lcl_WriteSimpleString( rStrm, aBufStr ); |
1671 |
|
1714 |
|
1672 |
checkformula: |
1715 |
checkformula: |
1673 |
if( bForm ) |
1716 |
if( bForm ) |