View | Details | Raw Unified | Return to issue 35913
Collapse All | Expand All

(-)OOO300_m7-original/sc/inc/cell.hxx (+3 lines)
Lines 422-427 Link Here
422
	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
422
	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
423
	EditTextObject*		CreateURLObject() ;
423
	EditTextObject*		CreateURLObject() ;
424
    void            GetURLResult( String& rURL, String& rCellText );
424
    void            GetURLResult( String& rURL, String& rCellText );
425
426
    /** Determines whether or not the result string contains more than one paragraph */
427
    bool            IsMultilineResult();
425
};
428
};
426
429
427
//			Iterator fuer Referenzen in einer Formelzelle
430
//			Iterator fuer Referenzen in einer Formelzelle
(-)OOO300_m7-original/sc/inc/editutil.hxx (+5 lines)
Lines 63-70 Link Here
63
63
64
public:
64
public:
65
	static String ModifyDelimiters( const String& rOld );
65
	static String ModifyDelimiters( const String& rOld );
66
67
    /// Retrieves string with paragraphs delimited by spaces
66
	static String GetSpaceDelimitedString( const EditEngine& rEngine );
68
	static String GetSpaceDelimitedString( const EditEngine& rEngine );
67
69
70
    /// Retrieves string with paragraphs delimited by new lines ('\n').
71
    static String GetMultilineString( const EditEngine& rEngine );
72
68
public:
73
public:
69
				ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
74
				ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
70
							const Point& rScrPosPixel,
75
							const Point& rScrPosPixel,
(-)OOO300_m7-original/sc/inc/formularesult.hxx (-3 / +36 lines)
Lines 38-43 Link Here
38
    and memory consumption. */
38
    and memory consumption. */
39
class ScFormulaResult
39
class ScFormulaResult
40
{
40
{
41
    typedef unsigned char Multiline;
42
    static const Multiline MULTILINE_UNKNOWN = 0;
43
    static const Multiline MULTILINE_FALSE   = 1;
44
    static const Multiline MULTILINE_TRUE    = 2;
45
41
    union
46
    union
42
    {
47
    {
43
        double          mfValue;    // double result direct for performance and memory consumption
48
        double          mfValue;    // double result direct for performance and memory consumption
Lines 47-52 Link Here
47
    bool                mbToken :1; // whether content of union is a token
52
    bool                mbToken :1; // whether content of union is a token
48
    bool                mbEmpty :1; // empty cell result
53
    bool                mbEmpty :1; // empty cell result
49
    bool                mbEmptyDisplayedAsString :1;    // only if mbEmpty
54
    bool                mbEmptyDisplayedAsString :1;    // only if mbEmpty
55
    Multiline           meMultiline :2; // result is multiline
50
56
51
    /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults
57
    /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults
52
        prior to assigning other types */
58
        prior to assigning other types */
Lines 69-80 Link Here
69
                                /** Effectively type svUnknown. */
75
                                /** Effectively type svUnknown. */
70
                                ScFormulaResult()
76
                                ScFormulaResult()
71
                                    : mpToken(NULL), mnError(0), mbToken(true),
77
                                    : mpToken(NULL), mnError(0), mbToken(true),
72
                                    mbEmpty(false), mbEmptyDisplayedAsString(false) {}
78
                                    mbEmpty(false), mbEmptyDisplayedAsString(false),
79
                                    meMultiline(MULTILINE_UNKNOWN) {}
73
80
74
                                ScFormulaResult( const ScFormulaResult & r )
81
                                ScFormulaResult( const ScFormulaResult & r )
75
                                    : mnError( r.mnError), mbToken( r.mbToken),
82
                                    : mnError( r.mnError), mbToken( r.mbToken),
76
                                    mbEmpty( r.mbEmpty),
83
                                    mbEmpty( r.mbEmpty),
77
                                    mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString)
84
                                    mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString),
85
                                    meMultiline( r.meMultiline)
78
                                {
86
                                {
79
                                    if (mbToken)
87
                                    if (mbToken)
80
                                    {
88
                                    {
Lines 99-105 Link Here
99
    /** Same comments as for SetToken() apply! */
107
    /** Same comments as for SetToken() apply! */
100
    explicit                    ScFormulaResult( const ScToken* p )
108
    explicit                    ScFormulaResult( const ScToken* p )
101
                                    : mnError(0), mbToken(false),
109
                                    : mnError(0), mbToken(false),
102
                                    mbEmpty(false), mbEmptyDisplayedAsString(false)
110
                                    mbEmpty(false), mbEmptyDisplayedAsString(false),
111
                                    meMultiline(MULTILINE_UNKNOWN)
103
                                {
112
                                {
104
                                    SetToken( p);
113
                                    SetToken( p);
105
                                }
114
                                }
Lines 153-158 Link Here
153
        details instead. */
162
        details instead. */
154
    inline  bool                IsValue() const;
163
    inline  bool                IsValue() const;
155
164
165
    /** Determines whether or not the result is a string containing more than 
166
        one paragraph */
167
    inline  bool                IsMultiline();
168
156
    /** Get error code if set or GetCellResultType() is svError or svUnknown,
169
    /** Get error code if set or GetCellResultType() is svError or svUnknown,
157
        else 0. */
170
        else 0. */
158
    inline  USHORT              GetResultError() const;
171
    inline  USHORT              GetResultError() const;
Lines 211-216 Link Here
211
    mnError = 0;
224
    mnError = 0;
212
    mbEmpty = false;
225
    mbEmpty = false;
213
    mbEmptyDisplayedAsString = false;
226
    mbEmptyDisplayedAsString = false;
227
    meMultiline = MULTILINE_UNKNOWN;
214
}
228
}
215
229
216
230
Lines 232-241 Link Here
232
                mbToken = false;
246
                mbToken = false;
233
                // set in case mnError is 0 now, which shouldn't happen but ...
247
                // set in case mnError is 0 now, which shouldn't happen but ...
234
                mfValue = 0.0;
248
                mfValue = 0.0;
249
                meMultiline = MULTILINE_FALSE;
235
                break;
250
                break;
236
            case svEmptyCell:
251
            case svEmptyCell:
237
                mbEmpty = true;
252
                mbEmpty = true;
238
                mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
253
                mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
254
                meMultiline = MULTILINE_FALSE;
239
                p->DecRef();
255
                p->DecRef();
240
                mbToken = false;
256
                mbToken = false;
241
                break;
257
                break;
Lines 243-248 Link Here
243
                mfValue = p->GetDouble();
259
                mfValue = p->GetDouble();
244
                p->DecRef();
260
                p->DecRef();
245
                mbToken = false;
261
                mbToken = false;
262
                meMultiline = MULTILINE_FALSE;
246
                break;
263
                break;
247
            default:
264
            default:
248
                mpToken = p;
265
                mpToken = p;
Lines 270-275 Link Here
270
        mbToken = false;
287
        mbToken = false;
271
        mbEmpty = true;
288
        mbEmpty = true;
272
        mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
289
        mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
290
        meMultiline = r.meMultiline;
273
    }
291
    }
274
    else if (r.mbToken)
292
    else if (r.mbToken)
275
    {
293
    {
Lines 352-357 Link Here
352
            mpToken->DecRef();
370
            mpToken->DecRef();
353
        mfValue = f;
371
        mfValue = f;
354
        mbToken = false;
372
        mbToken = false;
373
        meMultiline = MULTILINE_FALSE;
355
    }
374
    }
356
}
375
}
357
376
Lines 404-409 Link Here
404
    return sv == svDouble || sv == svError || sv == svEmptyCell;
423
    return sv == svDouble || sv == svError || sv == svEmptyCell;
405
}
424
}
406
425
426
inline bool ScFormulaResult::IsMultiline()
427
{
428
    if (meMultiline == MULTILINE_UNKNOWN)
429
    {
430
        const String& rStr = GetString();
431
        if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND)
432
            meMultiline = MULTILINE_TRUE;
433
        else
434
            meMultiline = MULTILINE_FALSE;
435
    }
436
    return meMultiline == MULTILINE_TRUE;
437
}
438
407
439
408
inline USHORT ScFormulaResult::GetResultError() const
440
inline USHORT ScFormulaResult::GetResultError() const
409
{
441
{
Lines 537-542 Link Here
537
    {
569
    {
538
        mfValue = f;
570
        mfValue = f;
539
        mbToken = false;
571
        mbToken = false;
572
        meMultiline = MULTILINE_FALSE;
540
    }
573
    }
541
}
574
}
542
575
(-)OOO300_m7-original/sc/source/core/data/cell.cxx (+7 lines)
Lines 1808-1813 Link Here
1808
    }
1808
    }
1809
}
1809
}
1810
1810
1811
bool ScFormulaCell::IsMultilineResult()
1812
{
1813
    if (!IsValue())
1814
        return aResult.IsMultiline();
1815
    return false;
1816
}
1817
1811
EditTextObject* ScFormulaCell::CreateURLObject()
1818
EditTextObject* ScFormulaCell::CreateURLObject()
1812
{
1819
{
1813
    String aCellText;
1820
    String aCellText;
(-)OOO300_m7-original/sc/source/core/data/cell2.cxx (-1 / +1 lines)
Lines 162-168 Link Here
162
        // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine
162
        // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine
163
        EditEngine& rEngine = pDoc->GetEditEngine();
163
        EditEngine& rEngine = pDoc->GetEditEngine();
164
        rEngine.SetText( *pData );
164
        rEngine.SetText( *pData );
165
        rString = ScEditUtil::GetSpaceDelimitedString(rEngine);     // space between paragraphs
165
        rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
166
        // kurze Strings fuer Formeln merken
166
        // kurze Strings fuer Formeln merken
167
        if ( rString.Len() < MAXSTRLEN )
167
        if ( rString.Len() < MAXSTRLEN )
168
            ((ScEditCell*)this)->pString = new String( rString );   //! non-const
168
            ((ScEditCell*)this)->pString = new String( rString );   //! non-const
(-)OOO300_m7-original/sc/source/core/data/column.cxx (-2 / +4 lines)
Lines 2264-2271 Link Here
2264
	while ( (nIndex < nCount) ? ((nRow=pItems[nIndex].nRow) <= nEndRow) : FALSE )
2264
	while ( (nIndex < nCount) ? ((nRow=pItems[nIndex].nRow) <= nEndRow) : FALSE )
2265
	{
2265
	{
2266
		ScBaseCell* pCell = pItems[nIndex].pCell;
2266
		ScBaseCell* pCell = pItems[nIndex].pCell;
2267
		if ( pCell->GetCellType() == CELLTYPE_EDIT ||
2267
        CellType eCellType = pCell->GetCellType();
2268
			 IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) )
2268
		if ( eCellType == CELLTYPE_EDIT ||
2269
			 IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) ||
2270
             ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) )
2269
		{
2271
		{
2270
			rFirst = nRow;
2272
			rFirst = nRow;
2271
			return TRUE;
2273
			return TRUE;
(-)OOO300_m7-original/sc/source/core/data/column2.cxx (-2 / +5 lines)
Lines 793-801 Link Here
793
		}
793
		}
794
794
795
		BOOL bAddMargin = TRUE;
795
		BOOL bAddMargin = TRUE;
796
		BOOL bEditEngine = ( pCell->GetCellType() == CELLTYPE_EDIT ||
796
        CellType eCellType = pCell->GetCellType();
797
798
		BOOL bEditEngine = ( eCellType == CELLTYPE_EDIT ||
797
								eOrient == SVX_ORIENTATION_STACKED ||
799
								eOrient == SVX_ORIENTATION_STACKED ||
798
								IsAmbiguousScript( nScript ) );
800
								IsAmbiguousScript( nScript ) ||
801
                                ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) );
799
802
800
		if (!bEditEngine)									// direkte Ausgabe
803
		if (!bEditEngine)									// direkte Ausgabe
801
		{
804
		{
(-)OOO300_m7-original/sc/source/core/data/column3.cxx (-2 / +11 lines)
Lines 887-894 Link Here
887
							String aString;
887
							String aString;
888
							pForm->GetString(aString);
888
							pForm->GetString(aString);
889
							if ( aString.Len() )
889
							if ( aString.Len() )
890
								pNew = new ScStringCell(aString);
890
                            {
891
								// #33224# LeerStrings nicht kopieren
891
                                if ( pForm->IsMultilineResult() )
892
                                {
893
                                    pNew = new ScEditCell( aString, pDestDoc );
894
                                }
895
                                else
896
                                {
897
                                    pNew = new ScStringCell(aString);
898
                                    // #33224# LeerStrings nicht kopieren
899
                                }
900
                            }
892
						}
901
						}
893
					}
902
					}
894
					if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
903
					if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
(-)OOO300_m7-original/sc/source/core/tool/editutil.cxx (-2 / +12 lines)
Lines 82-100 Link Here
82
	return aRet;
82
	return aRet;
83
}
83
}
84
84
85
String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
85
static String lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c )
86
{
86
{
87
	String aRet;
87
	String aRet;
88
	USHORT nParCount = rEngine.GetParagraphCount();
88
	USHORT nParCount = rEngine.GetParagraphCount();
89
	for (USHORT nPar=0; nPar<nParCount; nPar++)
89
	for (USHORT nPar=0; nPar<nParCount; nPar++)
90
	{
90
	{
91
		if (nPar > 0)
91
		if (nPar > 0)
92
			aRet += ' ';
92
			aRet += c;
93
		aRet += rEngine.GetText( nPar );
93
		aRet += rEngine.GetText( nPar );
94
	}
94
	}
95
	return aRet;
95
	return aRet;
96
}
96
}
97
97
98
String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
99
{
100
    return lcl_GetDelimitedString(rEngine, ' ');
101
}
102
103
String ScEditUtil::GetMultilineString( const EditEngine& rEngine )
104
{
105
    return lcl_GetDelimitedString(rEngine, '\n');
106
}
107
98
//------------------------------------------------------------------------
108
//------------------------------------------------------------------------
99
109
100
Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, BOOL bForceToTop )
110
Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, BOOL bForceToTop )
(-)OOO300_m7-original/sc/source/filter/dif/difimp.cxx (-45 / +150 lines)
Lines 338-344 Link Here
338
338
339
	while( eS != S_END )
339
	while( eS != S_END )
340
	{
340
	{
341
		if( !rIn.ReadUniOrByteStringLine( aLine ) )
341
		if( !ReadNextLine( aLine ) )
342
		{
342
		{
343
			eS = S_END;
343
			eS = S_END;
344
			eRet = T_END;
344
			eRet = T_END;
Lines 406-415 Link Here
406
				break;
406
				break;
407
			case S_UNKNOWN:
407
			case S_UNKNOWN:
408
				// 2 Zeilen ueberlesen
408
				// 2 Zeilen ueberlesen
409
				rIn.ReadUniOrByteStringLine( aLine );
409
				ReadNextLine( aLine );
410
			case S_ERROR_L2:				// Fehler in Line 2 aufgetreten
410
			case S_ERROR_L2:				// Fehler in Line 2 aufgetreten
411
				// eine Zeile ueberlesen
411
				// eine Zeile ueberlesen
412
				rIn.ReadUniOrByteStringLine( aLine );
412
				ReadNextLine( aLine );
413
				eS = S_END;
413
				eS = S_END;
414
				break;
414
				break;
415
			default:
415
			default:
Lines 421-427 Link Here
421
}
421
}
422
422
423
423
424
void lcl_DeEscapeQuotesDif( String& rString )
424
static void lcl_DeEscapeQuotesDif( String& rString )
425
{
425
{
426
	//	Special handling for DIF import: Escaped (duplicated) quotes are resolved.
426
	//	Special handling for DIF import: Escaped (duplicated) quotes are resolved.
427
	//	Single quote characters are left in place because older versions didn't
427
	//	Single quote characters are left in place because older versions didn't
Lines 437-461 Link Here
437
	}
437
	}
438
}
438
}
439
439
440
// Determine if passed in string is numeric data and set fVal/nNumFormat if so
441
DATASET DifParser::GetNumberDataset( const sal_Unicode* pPossibleNumericData )
442
{
443
    DATASET eRet = D_SYNT_ERROR;
444
    if( bPlain )
445
    {
446
        if( ScanFloatVal( pPossibleNumericData ) )
447
            eRet = D_NUMERIC;
448
        else
449
            eRet = D_SYNT_ERROR;
450
    }
451
    else
452
    {   // ...und zur Strafe mit'm Numberformatter...
453
        DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" );
454
        String aTestVal( pPossibleNumericData );
455
        sal_uInt32 nFormat = 0;
456
        double fTmpVal;
457
        if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
458
        {
459
            fVal = fTmpVal;
460
            nNumFormat = nFormat;
461
            eRet = D_NUMERIC;
462
        }
463
        else
464
            eRet = D_SYNT_ERROR;
465
    }
466
    return eRet;
467
}
468
469
bool DifParser::ReadNextLine( String& rStr )
470
{
471
    if( aLookAheadLine.Len() == 0 )
472
    {
473
        return rIn.ReadUniOrByteStringLine( rStr );
474
    }
475
    else
476
    {
477
        rStr = aLookAheadLine;
478
        aLookAheadLine.Erase();
479
        return true;
480
    }
481
}
482
483
// Look ahead in the stream to determine if the next line is the first line of 
484
// a valid data record structure
485
bool DifParser::LookAhead()
486
{
487
    const sal_Unicode* pAktBuffer;
488
    bool bValidStructure = false;
489
490
    DBG_ASSERT( aLookAheadLine.Len() == 0, "*DifParser::LookAhead(): LookAhead called twice in a row" );
491
    rIn.ReadUniOrByteStringLine( aLookAheadLine );
492
493
    pAktBuffer = aLookAheadLine.GetBuffer();
494
495
    switch( *pAktBuffer )
496
    {
497
        case '-':                   // Special Datatype
498
            pAktBuffer++;
499
500
            if( Is1_0( pAktBuffer ) )
501
            {
502
                bValidStructure = true;
503
            }
504
            break;
505
        case '0':                   // Numeric Data
506
            pAktBuffer++;
507
            if( *pAktBuffer == ',' )
508
            {
509
                pAktBuffer++;
510
                bValidStructure = ( GetNumberDataset(pAktBuffer) != D_SYNT_ERROR );
511
            }
512
            break;
513
        case '1':                   // String Data
514
            if( Is1_0( aLookAheadLine.GetBuffer() ) )
515
            {
516
                bValidStructure = true;
517
            }
518
            break;
519
    }
520
    return bValidStructure;
521
}
440
522
441
DATASET	DifParser::GetNextDataset( void )
523
DATASET	DifParser::GetNextDataset( void )
442
{
524
{
443
	DATASET				eRet = D_UNKNOWN;
525
	DATASET				eRet = D_UNKNOWN;
444
	String			    aLine;
526
	String			    aLine;
445
	const sal_Unicode*		pAkt;
527
	const sal_Unicode*		pAktBuffer;
446
528
447
	rIn.ReadUniOrByteStringLine( aLine );
529
	ReadNextLine( aLine );
448
530
449
	pAkt = aLine.GetBuffer();
531
	pAktBuffer = aLine.GetBuffer();
450
532
451
	switch( *pAkt )
533
	switch( *pAktBuffer )
452
	{
534
	{
453
		case '-':					// Special Datatype
535
		case '-':					// Special Datatype
454
			pAkt++;
536
			pAktBuffer++;
455
537
456
			if( Is1_0( pAkt ) )
538
			if( Is1_0( pAktBuffer ) )
457
			{
539
			{
458
				rIn.ReadUniOrByteStringLine( aLine );
540
				ReadNextLine( aLine );
459
				if( IsBOT( aLine.GetBuffer() ) )
541
				if( IsBOT( aLine.GetBuffer() ) )
460
					eRet = D_BOT;
542
					eRet = D_BOT;
461
				else if( IsEOD( aLine.GetBuffer() ) )
543
				else if( IsEOD( aLine.GetBuffer() ) )
Lines 463-499 Link Here
463
			}
545
			}
464
			break;
546
			break;
465
		case '0':					// Numeric Data
547
		case '0':					// Numeric Data
466
			pAkt++;					// Wert in fVal, 2. Zeile in aData
548
			pAktBuffer++;			// Wert in fVal, 2. Zeile in aData
467
			if( *pAkt == ',' )
549
			if( *pAktBuffer == ',' )
468
			{
550
			{
469
				pAkt++;
551
				pAktBuffer++;
470
				if( bPlain )
552
                eRet = GetNumberDataset(pAktBuffer);
471
				{
553
                ReadNextLine( aData );
472
					if( ScanFloatVal( pAkt ) )
473
						eRet = D_NUMERIC;
474
					else
475
						eRet = D_SYNT_ERROR;
476
				}
477
				else
478
				{	// ...und zur Strafe mit'm Numberformatter...
479
					DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" );
480
					String			aTestVal( pAkt );
481
					sal_uInt32		nFormat = 0;
482
					double			fTmpVal;
483
					if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
484
					{
485
						fVal = fTmpVal;
486
						nNumFormat = nFormat;
487
						eRet = D_NUMERIC;
488
					}
489
					else
490
						eRet = D_SYNT_ERROR;
491
				}
492
                rIn.ReadUniOrByteStringLine( aData );
493
                if ( eRet == D_SYNT_ERROR )
554
                if ( eRet == D_SYNT_ERROR )
494
                {   // for broken records write "#ERR: data" to cell
555
                {   // for broken records write "#ERR: data" to cell
495
                    String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#ERR: " ));
556
                    String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#ERR: " ));
496
                    aTmp += pAkt;
557
                    aTmp += pAktBuffer;
497
                    aTmp.AppendAscii( " (" );
558
                    aTmp.AppendAscii( " (" );
498
                    aTmp += aData;
559
                    aTmp += aData;
499
                    aTmp += sal_Unicode(')');
560
                    aTmp += sal_Unicode(')');
Lines 505-522 Link Here
505
		case '1':					// String Data
566
		case '1':					// String Data
506
			if( Is1_0( aLine.GetBuffer() ) )
567
			if( Is1_0( aLine.GetBuffer() ) )
507
			{
568
			{
508
				rIn.ReadUniOrByteStringLine( aLine );
569
				ReadNextLine( aLine );
509
				DBG_ASSERT( aLine.Len() >= 2,
570
                xub_StrLen nLineLength = aLine.Len();
510
					"*DifParser::GetNextTopic(): Text ist zu kurz (mind. \"\")!" );
571
                const sal_Unicode* pLine = aLine.GetBuffer();
511
				aData = aLine.Copy( 1, aLine.Len() - 2 );
572
512
				lcl_DeEscapeQuotesDif( aData );
573
                if( nLineLength >= 1 && *pLine == '"' )
513
				eRet = D_STRING;
574
                {
575
                    // Quotes are not always escaped (duplicated), see lcl_DeEscapeQuotesDif
576
                    // A look ahead into the next line is needed in order to deal with 
577
                    // multiline strings containing quotes
578
                    if( LookAhead() )
579
                    {
580
                        // Single line string
581
                        if( nLineLength >= 2 && pLine[nLineLength - 1] == '"' )
582
                        {
583
                            aData = aLine.Copy( 1, nLineLength - 2 );
584
                            lcl_DeEscapeQuotesDif( aData );
585
                            eRet = D_STRING;
586
                        }
587
                    }
588
                    else
589
                    {
590
                        // Multiline string
591
                        aData = aLine.Copy( 1 );
592
                        bool bContinue = true;
593
                        while ( bContinue )
594
                        {
595
                            aData.Append( '\n' );
596
                            bContinue = !rIn.IsEof() && ReadNextLine( aLine );
597
                            if( bContinue )
598
                            {
599
                                nLineLength = aLine.Len();
600
                                if( nLineLength >= 1 )
601
                                {
602
                                    pLine = aLine.GetBuffer();
603
                                    bContinue = !LookAhead();
604
                                    if( bContinue )
605
                                    {
606
                                        aData.Append( aLine );
607
                                    }
608
                                    else if( pLine[nLineLength - 1] == '"' )
609
                                    {
610
                                        aData.Append( pLine, nLineLength - 1 );
611
                                        lcl_DeEscapeQuotesDif( aData );
612
                                        eRet = D_STRING;
613
                                    }
614
                                }
615
                            }
616
                        };
617
                    }
618
                }
514
			}
619
			}
515
			break;
620
			break;
516
	}
621
	}
517
622
518
	if( eRet == D_UNKNOWN )
623
	if( eRet == D_UNKNOWN )
519
		rIn.ReadUniOrByteStringLine( aLine );
624
		ReadNextLine( aLine );
520
625
521
	if( rIn.IsEof() )
626
	if( rIn.IsEof() )
522
		eRet = D_EOD;
627
		eRet = D_EOD;
(-)OOO300_m7-original/sc/source/filter/excel/xestyle.cxx (-2 / +2 lines)
Lines 1963-1971 Link Here
1963
    return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
1963
    return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
1964
}
1964
}
1965
1965
1966
sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt )
1966
sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt, bool bForceLineBreak )
1967
{
1967
{
1968
    return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, false );
1968
    return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak );
1969
}
1969
}
1970
1970
1971
sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
1971
sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
(-)OOO300_m7-original/sc/source/filter/excel/xetable.cxx (-1 / +3 lines)
Lines 760-772 Link Here
760
760
761
        // #i41420# find script type according to result type (always latin for numeric results)
761
        // #i41420# find script type according to result type (always latin for numeric results)
762
        sal_Int16 nScript = ApiScriptType::LATIN;
762
        sal_Int16 nScript = ApiScriptType::LATIN;
763
        bool bForceLineBreak = false;
763
        if( nFormatType == NUMBERFORMAT_TEXT )
764
        if( nFormatType == NUMBERFORMAT_TEXT )
764
        {
765
        {
765
            String aResult;
766
            String aResult;
766
            mrScFmlaCell.GetString( aResult );
767
            mrScFmlaCell.GetString( aResult );
768
            bForceLineBreak = mrScFmlaCell.IsMultilineResult();
767
            nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult );
769
            nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult );
768
        }
770
        }
769
        SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt ) );
771
        SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt, bForceLineBreak ) );
770
    }
772
    }
771
773
772
    // *** Convert the formula token array *** --------------------------------
774
    // *** Convert the formula token array *** --------------------------------
(-)OOO300_m7-original/sc/source/filter/html/htmlexp.cxx (-2 / +24 lines)
Lines 1152-1160 Link Here
1152
	if ( !bFieldText )
1152
	if ( !bFieldText )
1153
	{
1153
	{
1154
		if ( !aStrOut.Len() )
1154
		if ( !aStrOut.Len() )
1155
        {
1155
			TAG_ON( sHTML_linebreak );		// #42573# keine komplett leere Zelle
1156
			TAG_ON( sHTML_linebreak );		// #42573# keine komplett leere Zelle
1157
        }
1156
		else
1158
		else
1157
			OUT_STR( aStrOut );
1159
        {
1160
            xub_StrLen nPos = aStrOut.Search( _LF );
1161
            if ( nPos == STRING_NOTFOUND )
1162
            {
1163
                OUT_STR( aStrOut );
1164
            }
1165
            else
1166
            {
1167
                xub_StrLen nStartPos = 0;
1168
                do
1169
                {
1170
                    String aSingleLine( aStrOut, nStartPos, nPos - nStartPos );
1171
                    OUT_STR( aSingleLine );
1172
                    TAG_ON( sHTML_linebreak );
1173
                    nStartPos = nPos + 1;
1174
                } 
1175
                while( ( nPos = aStrOut.Search( _LF, nStartPos ) ) != STRING_NOTFOUND );
1176
                String aSingleLine( aStrOut, nStartPos, aStrOut.Len() - nStartPos );
1177
                OUT_STR( aSingleLine );
1178
            }
1179
        }
1158
	}
1180
	}
1159
    if ( pGraphEntry )
1181
    if ( pGraphEntry )
1160
		WriteGraphEntry( pGraphEntry );
1182
		WriteGraphEntry( pGraphEntry );
Lines 1192-1198 Link Here
1192
		for ( USHORT nPar=0; nPar < nParas; nPar++ )
1214
		for ( USHORT nPar=0; nPar < nParas; nPar++ )
1193
		{
1215
		{
1194
			if ( nPar > 0 )
1216
			if ( nPar > 0 )
1195
				rStrm << ' ';		// blank between paragraphs
1217
                TAG_ON( sHTML_linebreak );
1196
			SvUShorts aPortions;
1218
			SvUShorts aPortions;
1197
			rEngine.GetPortions( nPar, aPortions );
1219
			rEngine.GetPortions( nPar, aPortions );
1198
			USHORT nCnt = aPortions.Count();
1220
			USHORT nCnt = aPortions.Count();
(-)OOO300_m7-original/sc/source/filter/inc/dif.hxx (+4 lines)
Lines 82-88 Link Here
82
	SvNumberFormatter*	pNumFormatter;
82
	SvNumberFormatter*	pNumFormatter;
83
	SvStream&			rIn;
83
	SvStream&			rIn;
84
	BOOL				bPlain;
84
	BOOL				bPlain;
85
    String              aLookAheadLine;
85
86
87
    bool                ReadNextLine( String& rStr );
88
    bool                LookAhead();
89
    DATASET             GetNumberDataset( const sal_Unicode* pPossibleNumericData );
86
	static inline BOOL	IsBOT( const sal_Unicode* pRef );
90
	static inline BOOL	IsBOT( const sal_Unicode* pRef );
87
	static inline BOOL	IsEOD( const sal_Unicode* pRef );
91
	static inline BOOL	IsEOD( const sal_Unicode* pRef );
88
	static inline BOOL	Is1_0( const sal_Unicode* pRef );
92
	static inline BOOL	Is1_0( const sal_Unicode* pRef );
(-)OOO300_m7-original/sc/source/filter/inc/xestyle.hxx (-1 / +4 lines)
Lines 617-626 Link Here
617
        @param nXFFlags  Additional flags allowing to control the creation of an XF.
617
        @param nXFFlags  Additional flags allowing to control the creation of an XF.
618
        @param nForceScNumFmt  The number format to be exported, e.g. formula
618
        @param nForceScNumFmt  The number format to be exported, e.g. formula
619
            result type. This format will always overwrite the cell's number format.
619
            result type. This format will always overwrite the cell's number format.
620
        @param bForceLineBreak  true = Set line break flag unconditionally.
621
            This is required for cells that contain multi-line text.
620
        @return  A unique XF record ID. */
622
        @return  A unique XF record ID. */
621
    sal_uInt32          InsertWithNumFmt(
623
    sal_uInt32          InsertWithNumFmt(
622
                            const ScPatternAttr* pPattern, sal_Int16 nScript,
624
                            const ScPatternAttr* pPattern, sal_Int16 nScript,
623
                            ULONG nForceScNumFmt );
625
                            ULONG nForceScNumFmt,
626
                            bool bForceLineBreak );
624
    /** Inserts the passed cell style. Creates a style XF record and a STYLE record.
627
    /** Inserts the passed cell style. Creates a style XF record and a STYLE record.
625
        @return  A unique XF record ID. */
628
        @return  A unique XF record ID. */
626
    sal_uInt32          InsertStyle( const SfxStyleSheetBase* pStyleSheet );
629
    sal_uInt32          InsertStyle( const SfxStyleSheetBase* pStyleSheet );
(-)OOO300_m7-original/sc/source/filter/qpro/qpro.cxx (-1 / +1 lines)
Lines 71-77 Link Here
71
                readString( aLabel, getLength() - 7 );
71
                readString( aLabel, getLength() - 7 );
72
                nStyle = nStyle >> 3;
72
                nStyle = nStyle >> 3;
73
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
73
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
74
                pDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aLabel ), (BOOL) TRUE );
74
                pDoc->PutCell( nCol, nRow, nTab, ScBaseCell::CreateTextCell( aLabel, pDoc ), (BOOL) TRUE );
75
                }
75
                }
76
                break;
76
                break;
77
77
(-)OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.cxx (+1 lines)
Lines 568-573 Link Here
568
	aShapeList(),
568
	aShapeList(),
569
	aDetectiveObjVec(),
569
	aDetectiveObjVec(),
570
    nValidationIndex(-1),
570
    nValidationIndex(-1),
571
    pBaseCell(NULL),
571
	bIsAutoStyle( sal_False ),
572
	bIsAutoStyle( sal_False ),
572
	bHasShape( sal_False ),
573
	bHasShape( sal_False ),
573
	bIsMergedBase( sal_False ),
574
	bIsMergedBase( sal_False ),
(-)OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.hxx (+3 lines)
Lines 48-53 Link Here
48
struct	ScMyCell;
48
struct	ScMyCell;
49
class	ScXMLExport;
49
class	ScXMLExport;
50
class	ScFormatRangeStyles;
50
class	ScFormatRangeStyles;
51
class   ScBaseCell;
51
52
52
//==============================================================================
53
//==============================================================================
53
54
Lines 312-317 Link Here
312
	sal_Int32					nNumberFormat;
313
	sal_Int32					nNumberFormat;
313
	com::sun::star::table::CellContentType	nType;
314
	com::sun::star::table::CellContentType	nType;
314
315
316
    ScBaseCell*                 pBaseCell;
317
315
	sal_Bool					bIsAutoStyle;
318
	sal_Bool					bIsAutoStyle;
316
319
317
	sal_Bool					bHasShape;
320
	sal_Bool					bHasShape;
(-)OOO300_m7-original/sc/source/filter/xml/xmlexprt.cxx (-3 / +31 lines)
Lines 2381-2387 Link Here
2381
2381
2382
	if (!bIsEmpty)
2382
	if (!bIsEmpty)
2383
	{
2383
	{
2384
		if ((aCell.nType == table::CellContentType_TEXT) && IsEditCell(aCell))
2384
        if ((aCell.nType == table::CellContentType_TEXT && IsEditCell(aCell)) || 
2385
            (aCell.nType == table::CellContentType_FORMULA && IsMultiLineFormulaCell(aCell)))
2385
		{
2386
		{
2386
            bEditCell = sal_True;
2387
            bEditCell = sal_True;
2387
            uno::Reference<text::XText> xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY);
2388
            uno::Reference<text::XText> xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY);
Lines 2820-2831 Link Here
2820
	return (aCell1.nType == aCell2.nType);
2821
	return (aCell1.nType == aCell2.nType);
2821
}
2822
}
2822
2823
2823
sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress) const
2824
sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell) const
2824
{
2825
{
2825
	ScAddress aCoreAddress(static_cast<SCCOL>(aAddress.Column),
2826
	ScAddress aCoreAddress(static_cast<SCCOL>(aAddress.Column),
2826
						static_cast<SCROW>(aAddress.Row),
2827
						static_cast<SCROW>(aAddress.Row),
2827
						static_cast<SCTAB>(aAddress.Sheet));
2828
						static_cast<SCTAB>(aAddress.Sheet));
2828
	ScBaseCell* pBaseCell = GetDocument() ? GetDocument()->GetCell(aCoreAddress) : NULL;
2829
	ScBaseCell* pBaseCell = GetDocument() ? GetDocument()->GetCell(aCoreAddress) : NULL;
2830
    if (pMyCell)
2831
        pMyCell->pBaseCell = pBaseCell;
2832
2829
	if (pBaseCell)
2833
	if (pBaseCell)
2830
		return (pBaseCell->GetCellType() == CELLTYPE_EDIT);
2834
		return (pBaseCell->GetCellType() == CELLTYPE_EDIT);
2831
	return sal_False;
2835
	return sal_False;
Lines 2845-2856 Link Here
2845
		return rCell.bIsEditCell;
2849
		return rCell.bIsEditCell;
2846
	else
2850
	else
2847
	{
2851
	{
2848
		rCell.bIsEditCell = IsEditCell(rCell.aCellAddress);
2852
		rCell.bIsEditCell = IsEditCell(rCell.aCellAddress, &rCell);
2849
		rCell.bKnowWhetherIsEditCell = sal_True;
2853
		rCell.bKnowWhetherIsEditCell = sal_True;
2850
		return rCell.bIsEditCell;
2854
		return rCell.bIsEditCell;
2851
	}
2855
	}
2852
}
2856
}
2853
2857
2858
sal_Bool ScXMLExport::IsMultiLineFormulaCell(ScMyCell& rCell)
2859
{
2860
    if (rCell.pBaseCell)
2861
    {
2862
        if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA)
2863
            return false;
2864
2865
        return static_cast<ScFormulaCell*>(rCell.pBaseCell)->IsMultilineResult();
2866
    }
2867
2868
    ScAddress aAddr(static_cast<SCCOL>(rCell.aCellAddress.Column), 
2869
                    static_cast<SCROW>(rCell.aCellAddress.Row),
2870
                    static_cast<SCTAB>(rCell.aCellAddress.Sheet));
2871
    ScBaseCell* pBaseCell = pDoc ? pDoc->GetCell(aAddr) : NULL;
2872
    if (!pBaseCell)
2873
        return false;
2874
2875
    rCell.pBaseCell = pBaseCell;
2876
    if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA)
2877
        return false;
2878
2879
    return static_cast<ScFormulaCell*>(rCell.pBaseCell)->IsMultilineResult();
2880
}
2881
2854
sal_Bool ScXMLExport::IsAnnotationEqual(const uno::Reference<table::XCell>& /* xCell1 */,
2882
sal_Bool ScXMLExport::IsAnnotationEqual(const uno::Reference<table::XCell>& /* xCell1 */,
2855
                                        const uno::Reference<table::XCell>& /* xCell2 */)
2883
                                        const uno::Reference<table::XCell>& /* xCell2 */)
2856
{
2884
{
(-)OOO300_m7-original/sc/source/filter/xml/xmlexprt.hxx (-1 / +3 lines)
Lines 60-65 Link Here
60
class ScChartListener;
60
class ScChartListener;
61
class SfxItemPool;
61
class SfxItemPool;
62
class ScAddress;
62
class ScAddress;
63
class ScBaseCell;
63
64
64
typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
65
typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
65
66
Lines 181-189 Link Here
181
	void SetRepeatAttribute (const sal_Int32 nEqualCellCount);
182
	void SetRepeatAttribute (const sal_Int32 nEqualCellCount);
182
183
183
	sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
184
	sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
184
	sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress) const;
185
	sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell = NULL) const;
185
	sal_Bool IsEditCell(const com::sun::star::uno::Reference <com::sun::star::table::XCell>& xCell) const;
186
	sal_Bool IsEditCell(const com::sun::star::uno::Reference <com::sun::star::table::XCell>& xCell) const;
186
	sal_Bool IsEditCell(ScMyCell& rCell) const;
187
	sal_Bool IsEditCell(ScMyCell& rCell) const;
188
    sal_Bool IsMultiLineFormulaCell(ScMyCell& rCell);
187
	sal_Bool IsAnnotationEqual(const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell1,
189
	sal_Bool IsAnnotationEqual(const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell1,
188
								const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
190
								const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
189
	sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
191
	sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
(-)OOO300_m7-original/sc/source/ui/app/transobj.cxx (-1 / +4 lines)
Lines 815-821 Link Here
815
				{
815
				{
816
					String aStr;
816
					String aStr;
817
					pFCell->GetString(aStr);
817
					pFCell->GetString(aStr);
818
					pNew = new ScStringCell( aStr );
818
                    if ( pFCell->IsMultilineResult() )
819
                        pNew = new ScEditCell( aStr, pDestDoc );
820
                    else
821
                        pNew = new ScStringCell( aStr );
819
				}
822
				}
820
				pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
823
				pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
821
824
(-)OOO300_m7-original/sc/source/ui/docshell/docsh.cxx (+2 lines)
Lines 1278-1283 Link Here
1278
			}
1278
			}
1279
			bSetColWidths = TRUE;
1279
			bSetColWidths = TRUE;
1280
			bSetSimpleTextColWidths = TRUE;
1280
			bSetSimpleTextColWidths = TRUE;
1281
			bSetRowHeights = TRUE;
1281
		}
1282
		}
1282
		else if (aFltName.EqualsAscii(pFilterSylk))
1283
		else if (aFltName.EqualsAscii(pFilterSylk))
1283
		{
1284
		{
Lines 1305-1310 Link Here
1305
				SetError(eError);
1306
				SetError(eError);
1306
			bSetColWidths = TRUE;
1307
			bSetColWidths = TRUE;
1307
			bSetSimpleTextColWidths = TRUE;
1308
			bSetSimpleTextColWidths = TRUE;
1309
			bSetRowHeights = TRUE;
1308
		}
1310
		}
1309
		else if (aFltName.EqualsAscii(pFilterQPro6))
1311
		else if (aFltName.EqualsAscii(pFilterQPro6))
1310
        {
1312
        {
(-)OOO300_m7-original/sc/source/ui/docshell/impex.cxx (-12 / +55 lines)
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 )
(-)OOO300_m7-original/sc/source/ui/view/output2.cxx (-2 / +4 lines)
Lines 1427-1437 Link Here
1427
				}
1427
				}
1428
				if (bDoCell && !bNeedEdit)
1428
				if (bDoCell && !bNeedEdit)
1429
				{
1429
				{
1430
					if ( pCell->GetCellType() == CELLTYPE_FORMULA )
1430
					BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA );
1431
					if ( bFormulaCell )
1431
						lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell );
1432
						lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell );
1432
					if ( aVars.SetText(pCell) )
1433
					if ( aVars.SetText(pCell) )
1433
						pOldPattern = NULL;
1434
						pOldPattern = NULL;
1434
                    bNeedEdit = aVars.HasEditCharacters();
1435
                    bNeedEdit = aVars.HasEditCharacters() ||
1436
					                (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
1435
                }
1437
                }
1436
                if (bDoCell && !bNeedEdit)
1438
                if (bDoCell && !bNeedEdit)
1437
                {
1439
                {

Return to issue 35913