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

(-)DEV300_m16-original/sc/inc/cell.hxx (+3 lines)
Lines 428-433 Link Here
428
	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
428
	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
429
	EditTextObject*		CreateURLObject() ;
429
	EditTextObject*		CreateURLObject() ;
430
    void            GetURLResult( String& rURL, String& rCellText );
430
    void            GetURLResult( String& rURL, String& rCellText );
431
432
    /** Determines whether or not the result string contains more than one paragraph */
433
    BOOL            IsMultilineResult();
431
};
434
};
432
435
433
//			Iterator fuer Referenzen in einer Formelzelle
436
//			Iterator fuer Referenzen in einer Formelzelle
(-)DEV300_m16-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,
(-)DEV300_m16-original/sc/inc/formularesult.hxx (-3 / +37 lines)
Lines 38-43 Link Here
38
    and memory consumption. */
38
    and memory consumption. */
39
class ScFormulaResult
39
class ScFormulaResult
40
{
40
{
41
    enum Multiline
42
    {
43
        MULTILINE_UNKNOWN = 0,
44
        MULTILINE_FALSE,
45
        MULTILINE_TRUE
46
    };
41
    union
47
    union
42
    {
48
    {
43
        double          mfValue;    // double result direct for performance and memory consumption
49
        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
53
    bool                mbToken :1; // whether content of union is a token
48
    bool                mbEmpty :1; // empty cell result
54
    bool                mbEmpty :1; // empty cell result
49
    bool                mbEmptyDisplayedAsString :1;    // only if mbEmpty
55
    bool                mbEmptyDisplayedAsString :1;    // only if mbEmpty
56
    Multiline           meMultiline :2; // result is multiline
50
57
51
    /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults
58
    /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults
52
        prior to assigning other types */
59
        prior to assigning other types */
Lines 69-80 Link Here
69
                                /** Effectively type svUnknown. */
76
                                /** Effectively type svUnknown. */
70
                                ScFormulaResult()
77
                                ScFormulaResult()
71
                                    : mpToken(NULL), mnError(0), mbToken(true),
78
                                    : mpToken(NULL), mnError(0), mbToken(true),
72
                                    mbEmpty(false), mbEmptyDisplayedAsString(false) {}
79
                                    mbEmpty(false), mbEmptyDisplayedAsString(false),
80
                                    meMultiline(MULTILINE_UNKNOWN) {}
73
81
74
                                ScFormulaResult( const ScFormulaResult & r )
82
                                ScFormulaResult( const ScFormulaResult & r )
75
                                    : mnError( r.mnError), mbToken( r.mbToken),
83
                                    : mnError( r.mnError), mbToken( r.mbToken),
76
                                    mbEmpty( r.mbEmpty),
84
                                    mbEmpty( r.mbEmpty),
77
                                    mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString)
85
                                    mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString),
86
                                    meMultiline( r.meMultiline)
78
                                {
87
                                {
79
                                    if (mbToken)
88
                                    if (mbToken)
80
                                    {
89
                                    {
Lines 99-105 Link Here
99
    /** Same comments as for SetToken() apply! */
108
    /** Same comments as for SetToken() apply! */
100
    explicit                    ScFormulaResult( const ScToken* p )
109
    explicit                    ScFormulaResult( const ScToken* p )
101
                                    : mnError(0), mbToken(false),
110
                                    : mnError(0), mbToken(false),
102
                                    mbEmpty(false), mbEmptyDisplayedAsString(false)
111
                                    mbEmpty(false), mbEmptyDisplayedAsString(false),
112
                                    meMultiline(MULTILINE_UNKNOWN)
103
                                {
113
                                {
104
                                    SetToken( p);
114
                                    SetToken( p);
105
                                }
115
                                }
Lines 153-158 Link Here
153
        details instead. */
163
        details instead. */
154
    inline  bool                IsValue() const;
164
    inline  bool                IsValue() const;
155
165
166
    /** Determines whether or not the result is a string containing more than 
167
        one paragraph */
168
    inline  bool                IsMultiline();
169
156
    /** Get error code if set or GetCellResultType() is svError or svUnknown,
170
    /** Get error code if set or GetCellResultType() is svError or svUnknown,
157
        else 0. */
171
        else 0. */
158
    inline  USHORT              GetResultError() const;
172
    inline  USHORT              GetResultError() const;
Lines 211-216 Link Here
211
    mnError = 0;
225
    mnError = 0;
212
    mbEmpty = false;
226
    mbEmpty = false;
213
    mbEmptyDisplayedAsString = false;
227
    mbEmptyDisplayedAsString = false;
228
    meMultiline = MULTILINE_UNKNOWN;
214
}
229
}
215
230
216
231
Lines 232-241 Link Here
232
                mbToken = false;
247
                mbToken = false;
233
                // set in case mnError is 0 now, which shouldn't happen but ...
248
                // set in case mnError is 0 now, which shouldn't happen but ...
234
                mfValue = 0.0;
249
                mfValue = 0.0;
250
                meMultiline = MULTILINE_FALSE;
235
                break;
251
                break;
236
            case svEmptyCell:
252
            case svEmptyCell:
237
                mbEmpty = true;
253
                mbEmpty = true;
238
                mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
254
                mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
255
                meMultiline = MULTILINE_FALSE;
239
                p->DecRef();
256
                p->DecRef();
240
                mbToken = false;
257
                mbToken = false;
241
                break;
258
                break;
Lines 243-248 Link Here
243
                mfValue = p->GetDouble();
260
                mfValue = p->GetDouble();
244
                p->DecRef();
261
                p->DecRef();
245
                mbToken = false;
262
                mbToken = false;
263
                meMultiline = MULTILINE_FALSE;
246
                break;
264
                break;
247
            default:
265
            default:
248
                mpToken = p;
266
                mpToken = p;
Lines 270-275 Link Here
270
        mbToken = false;
288
        mbToken = false;
271
        mbEmpty = true;
289
        mbEmpty = true;
272
        mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
290
        mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
291
        meMultiline = r.meMultiline;
273
    }
292
    }
274
    else if (r.mbToken)
293
    else if (r.mbToken)
275
    {
294
    {
Lines 352-357 Link Here
352
            mpToken->DecRef();
371
            mpToken->DecRef();
353
        mfValue = f;
372
        mfValue = f;
354
        mbToken = false;
373
        mbToken = false;
374
        meMultiline = MULTILINE_FALSE;
355
    }
375
    }
356
}
376
}
357
377
Lines 404-409 Link Here
404
    return sv == svDouble || sv == svError || sv == svEmptyCell;
424
    return sv == svDouble || sv == svError || sv == svEmptyCell;
405
}
425
}
406
426
427
inline bool ScFormulaResult::IsMultiline()
428
{
429
    if (meMultiline == MULTILINE_UNKNOWN)
430
    {
431
        const String& rStr = GetString();
432
        if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND)
433
            meMultiline = MULTILINE_TRUE;
434
        else
435
            meMultiline = MULTILINE_FALSE;
436
    }
437
    return meMultiline == MULTILINE_TRUE;
438
}
439
407
440
408
inline USHORT ScFormulaResult::GetResultError() const
441
inline USHORT ScFormulaResult::GetResultError() const
409
{
442
{
Lines 537-542 Link Here
537
    {
570
    {
538
        mfValue = f;
571
        mfValue = f;
539
        mbToken = false;
572
        mbToken = false;
573
        meMultiline = MULTILINE_FALSE;
540
    }
574
    }
541
}
575
}
542
576
(-)DEV300_m16-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
(-)DEV300_m16-original/sc/source/core/data/cell.cxx (+7 lines)
Lines 1832-1837 Link Here
1832
    }
1832
    }
1833
}
1833
}
1834
1834
1835
BOOL ScFormulaCell::IsMultilineResult()
1836
{
1837
    if (!IsValue())
1838
        return aResult.IsMultiline();
1839
    return false;
1840
}
1841
1835
EditTextObject* ScFormulaCell::CreateURLObject()
1842
EditTextObject* ScFormulaCell::CreateURLObject()
1836
{
1843
{
1837
    String aCellText;
1844
    String aCellText;
(-)DEV300_m16-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
		{
(-)DEV300_m16-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 ) )
(-)DEV300_m16-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;
(-)DEV300_m16-original/sc/source/core/tool/editutil.cxx (+13 lines)
Lines 82-87 Link Here
82
	return aRet;
82
	return aRet;
83
}
83
}
84
84
85
String ScEditUtil::GetMultilineString( const EditEngine& rEngine )
86
{
87
	String aRet;
88
	USHORT nParCount = rEngine.GetParagraphCount();
89
	for (USHORT nPar=0; nPar<nParCount; nPar++)
90
	{
91
		if (nPar > 0)
92
			aRet += '\n';
93
		aRet += rEngine.GetText( nPar );
94
	}
95
	return aRet;
96
}
97
85
String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
98
String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
86
{
99
{
87
	String aRet;
100
	String aRet;
(-)DEV300_m16-original/sc/source/filter/excel/xestyle.cxx (-2 / +2 lines)
Lines 1965-1973 Link Here
1965
    return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
1965
    return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
1966
}
1966
}
1967
1967
1968
sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt )
1968
sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt, bool bForceLineBreak )
1969
{
1969
{
1970
    return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, false );
1970
    return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak );
1971
}
1971
}
1972
1972
1973
sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
1973
sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
(-)DEV300_m16-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 *** --------------------------------
(-)DEV300_m16-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 );
(-)DEV300_m16-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
(-)DEV300_m16-original/sc/source/ui/docshell/impex.cxx (+2 lines)
Lines 1606-1611 Link Here
1606
1606
1607
BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
1607
BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
1608
{
1608
{
1609
    const String SYLK_LF = String::CreateFromAscii("\x1b :");
1609
	SCCOL nCol;
1610
	SCCOL nCol;
1610
	SCROW nRow;
1611
	SCROW nRow;
1611
	SCCOL nStartCol = aRange.aStart.Col();
1612
	SCCOL nStartCol = aRange.aStart.Col();
Lines 1660-1665 Link Here
1660
				case CELLTYPE_EDIT:
1661
				case CELLTYPE_EDIT:
1661
				hasstring:
1662
				hasstring:
1662
					pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
1663
					pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
1664
                    aCellStr.SearchAndReplaceAll( _LF, SYLK_LF );
1663
1665
1664
					aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" ));
1666
					aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" ));
1665
					aBufStr += String::CreateFromInt32( c );
1667
					aBufStr += String::CreateFromInt32( c );
(-)DEV300_m16-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