summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-03-18 15:53:21 +0100
committerEike Rathke <erack@redhat.com>2013-03-18 15:56:38 +0100
commit9dba77d1b5bb2d513e8d6b67c83dc6e858e35f66 (patch)
treef01c6360c9ed13758f0278e3d778b38a48400ba4
parentdc723482812e1a8d6bb7f36406142d57a57d07d0 (diff)
resolved #i119960# paste single line with quotes
Change-Id: I8dae849a39a464a0aaef7e775956c04c53038a48
-rw-r--r--sc/source/ui/docshell/impex.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 0c9d73b12128..36d7d79086cc 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -640,6 +640,7 @@ static bool lcl_appendLineData( String& rField, const sal_Unicode* p1, const sal
enum DoubledQuoteMode
{
+ DQM_KEEP_ALL, // both are taken, additionally start and end quote are included in string
DQM_KEEP, // both are taken
DQM_ESCAPE, // escaped quote, one is taken, one ignored
DQM_CONCAT, // first is end, next is start, both ignored => strings combined
@@ -649,7 +650,8 @@ enum DoubledQuoteMode
static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
const sal_Unicode* pSeps, sal_Unicode cStr, DoubledQuoteMode eMode, bool& rbOverflowCell )
{
- p++; //! jump over opening quote
+ if (eMode != DQM_KEEP_ALL)
+ p++; //! jump over opening quote
bool bCont;
do
{
@@ -677,6 +679,7 @@ static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
// doubled quote char
switch ( eMode )
{
+ case DQM_KEEP_ALL :
case DQM_KEEP :
p++; // both for us (not breaking for-loop)
break;
@@ -705,7 +708,7 @@ static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
}
if ( p0 < p )
{
- if (!lcl_appendLineData( rString, p0, ((*p || *(p-1) == cStr) ? p-1 : p)))
+ if (!lcl_appendLineData( rString, p0, ((eMode != DQM_KEEP_ALL && (*p || *(p-1) == cStr)) ? p-1 : p)))
rbOverflowCell = true;
}
} while ( bCont );
@@ -897,24 +900,21 @@ bool ScImportExport::Text2Doc( SvStream& rStrm )
while( *p )
{
aCell.Erase();
- if( *p == cStr )
+ const sal_Unicode* q = p;
+ while (*p && *p != cSep)
{
- p = lcl_ScanString( p, aCell, pSeps, cStr, DQM_KEEP, bOverflowCell );
- while( *p && *p != cSep )
- p++;
- if( *p )
- p++;
- }
- else
- {
- const sal_Unicode* q = p;
- while( *p && *p != cSep )
- p++;
+ // Always look for a pairing quote and ignore separator in between.
+ while (*p && *p == cStr)
+ q = p = lcl_ScanString( p, aCell, pSeps, cStr, DQM_KEEP_ALL, bOverflowCell );
+ // All until next separator or quote.
+ while (*p && *p != cSep && *p != cStr)
+ ++p;
if (!lcl_appendLineData( aCell, q, p))
bOverflowCell = true; // display warning on import
- if( *p )
- p++;
+ q = p;
}
+ if (*p)
+ ++p;
if (ValidCol(nCol) && ValidRow(nRow) )
{
if( bSingle )