diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/inc/cell.hxx OOO300_m7/sc/inc/cell.hxx --- OOO300_m7-original/sc/inc/cell.hxx 2008-07-08 08:18:44.000000000 +0100 +++ OOO300_m7/sc/inc/cell.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -422,6 +422,9 @@ inline BOOL IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); } EditTextObject* CreateURLObject() ; void GetURLResult( String& rURL, String& rCellText ); + + /** Determines whether or not the result string contains more than one paragraph */ + bool IsMultilineResult(); }; // Iterator fuer Referenzen in einer Formelzelle diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/inc/editutil.hxx OOO300_m7/sc/inc/editutil.hxx --- OOO300_m7-original/sc/inc/editutil.hxx 2008-04-10 19:31:47.000000000 +0100 +++ OOO300_m7/sc/inc/editutil.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -63,8 +63,13 @@ public: static String ModifyDelimiters( const String& rOld ); + + /// Retrieves string with paragraphs delimited by spaces static String GetSpaceDelimitedString( const EditEngine& rEngine ); + /// Retrieves string with paragraphs delimited by new lines ('\n'). + static String GetMultilineString( const EditEngine& rEngine ); + public: ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ, const Point& rScrPosPixel, diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/inc/formularesult.hxx OOO300_m7/sc/inc/formularesult.hxx --- OOO300_m7-original/sc/inc/formularesult.hxx 2008-04-10 19:34:58.000000000 +0100 +++ OOO300_m7/sc/inc/formularesult.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -38,6 +38,11 @@ and memory consumption. */ class ScFormulaResult { + typedef unsigned char Multiline; + static const Multiline MULTILINE_UNKNOWN = 0; + static const Multiline MULTILINE_FALSE = 1; + static const Multiline MULTILINE_TRUE = 2; + union { double mfValue; // double result direct for performance and memory consumption @@ -47,6 +52,7 @@ bool mbToken :1; // whether content of union is a token bool mbEmpty :1; // empty cell result bool mbEmptyDisplayedAsString :1; // only if mbEmpty + Multiline meMultiline :2; // result is multiline /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults prior to assigning other types */ @@ -69,12 +75,14 @@ /** Effectively type svUnknown. */ ScFormulaResult() : mpToken(NULL), mnError(0), mbToken(true), - mbEmpty(false), mbEmptyDisplayedAsString(false) {} + mbEmpty(false), mbEmptyDisplayedAsString(false), + meMultiline(MULTILINE_UNKNOWN) {} ScFormulaResult( const ScFormulaResult & r ) : mnError( r.mnError), mbToken( r.mbToken), mbEmpty( r.mbEmpty), - mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString) + mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString), + meMultiline( r.meMultiline) { if (mbToken) { @@ -99,7 +107,8 @@ /** Same comments as for SetToken() apply! */ explicit ScFormulaResult( const ScToken* p ) : mnError(0), mbToken(false), - mbEmpty(false), mbEmptyDisplayedAsString(false) + mbEmpty(false), mbEmptyDisplayedAsString(false), + meMultiline(MULTILINE_UNKNOWN) { SetToken( p); } @@ -153,6 +162,10 @@ details instead. */ inline bool IsValue() const; + /** Determines whether or not the result is a string containing more than + one paragraph */ + inline bool IsMultiline(); + /** Get error code if set or GetCellResultType() is svError or svUnknown, else 0. */ inline USHORT GetResultError() const; @@ -211,6 +224,7 @@ mnError = 0; mbEmpty = false; mbEmptyDisplayedAsString = false; + meMultiline = MULTILINE_UNKNOWN; } @@ -232,10 +246,12 @@ mbToken = false; // set in case mnError is 0 now, which shouldn't happen but ... mfValue = 0.0; + meMultiline = MULTILINE_FALSE; break; case svEmptyCell: mbEmpty = true; mbEmptyDisplayedAsString = static_cast(p)->IsDisplayedAsString(); + meMultiline = MULTILINE_FALSE; p->DecRef(); mbToken = false; break; @@ -243,6 +259,7 @@ mfValue = p->GetDouble(); p->DecRef(); mbToken = false; + meMultiline = MULTILINE_FALSE; break; default: mpToken = p; @@ -270,6 +287,7 @@ mbToken = false; mbEmpty = true; mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString; + meMultiline = r.meMultiline; } else if (r.mbToken) { @@ -352,6 +370,7 @@ mpToken->DecRef(); mfValue = f; mbToken = false; + meMultiline = MULTILINE_FALSE; } } @@ -404,6 +423,19 @@ return sv == svDouble || sv == svError || sv == svEmptyCell; } +inline bool ScFormulaResult::IsMultiline() +{ + if (meMultiline == MULTILINE_UNKNOWN) + { + const String& rStr = GetString(); + if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND) + meMultiline = MULTILINE_TRUE; + else + meMultiline = MULTILINE_FALSE; + } + return meMultiline == MULTILINE_TRUE; +} + inline USHORT ScFormulaResult::GetResultError() const { @@ -537,6 +569,7 @@ { mfValue = f; mbToken = false; + meMultiline = MULTILINE_FALSE; } } diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/data/cell2.cxx OOO300_m7/sc/source/core/data/cell2.cxx --- OOO300_m7-original/sc/source/core/data/cell2.cxx 2008-05-14 10:50:24.000000000 +0100 +++ OOO300_m7/sc/source/core/data/cell2.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -162,7 +162,7 @@ // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine EditEngine& rEngine = pDoc->GetEditEngine(); rEngine.SetText( *pData ); - rString = ScEditUtil::GetSpaceDelimitedString(rEngine); // space between paragraphs + rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs // kurze Strings fuer Formeln merken if ( rString.Len() < MAXSTRLEN ) ((ScEditCell*)this)->pString = new String( rString ); //! non-const diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/data/cell.cxx OOO300_m7/sc/source/core/data/cell.cxx --- OOO300_m7-original/sc/source/core/data/cell.cxx 2008-07-08 08:19:36.000000000 +0100 +++ OOO300_m7/sc/source/core/data/cell.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -1808,6 +1808,13 @@ } } +bool ScFormulaCell::IsMultilineResult() +{ + if (!IsValue()) + return aResult.IsMultiline(); + return false; +} + EditTextObject* ScFormulaCell::CreateURLObject() { String aCellText; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/data/column2.cxx OOO300_m7/sc/source/core/data/column2.cxx --- OOO300_m7-original/sc/source/core/data/column2.cxx 2008-04-10 20:20:05.000000000 +0100 +++ OOO300_m7/sc/source/core/data/column2.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -793,9 +793,12 @@ } BOOL bAddMargin = TRUE; - BOOL bEditEngine = ( pCell->GetCellType() == CELLTYPE_EDIT || + CellType eCellType = pCell->GetCellType(); + + BOOL bEditEngine = ( eCellType == CELLTYPE_EDIT || eOrient == SVX_ORIENTATION_STACKED || - IsAmbiguousScript( nScript ) ); + IsAmbiguousScript( nScript ) || + ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) ); if (!bEditEngine) // direkte Ausgabe { diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/data/column3.cxx OOO300_m7/sc/source/core/data/column3.cxx --- OOO300_m7-original/sc/source/core/data/column3.cxx 2008-04-10 20:20:27.000000000 +0100 +++ OOO300_m7/sc/source/core/data/column3.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -887,8 +887,17 @@ String aString; pForm->GetString(aString); if ( aString.Len() ) - pNew = new ScStringCell(aString); - // #33224# LeerStrings nicht kopieren + { + if ( pForm->IsMultilineResult() ) + { + pNew = new ScEditCell( aString, pDestDoc ); + } + else + { + pNew = new ScStringCell(aString); + // #33224# LeerStrings nicht kopieren + } + } } } if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) ) diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/data/column.cxx OOO300_m7/sc/source/core/data/column.cxx --- OOO300_m7-original/sc/source/core/data/column.cxx 2008-04-10 20:19:38.000000000 +0100 +++ OOO300_m7/sc/source/core/data/column.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -2264,8 +2264,10 @@ while ( (nIndex < nCount) ? ((nRow=pItems[nIndex].nRow) <= nEndRow) : FALSE ) { ScBaseCell* pCell = pItems[nIndex].pCell; - if ( pCell->GetCellType() == CELLTYPE_EDIT || - IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) ) + CellType eCellType = pCell->GetCellType(); + if ( eCellType == CELLTYPE_EDIT || + IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) || + ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) ) { rFirst = nRow; return TRUE; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/core/tool/editutil.cxx OOO300_m7/sc/source/core/tool/editutil.cxx --- OOO300_m7-original/sc/source/core/tool/editutil.cxx 2008-04-10 20:52:15.000000000 +0100 +++ OOO300_m7/sc/source/core/tool/editutil.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -82,19 +82,29 @@ return aRet; } -String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine ) +static String lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c ) { String aRet; USHORT nParCount = rEngine.GetParagraphCount(); for (USHORT nPar=0; nPar 0) - aRet += ' '; + aRet += c; aRet += rEngine.GetText( nPar ); } return aRet; } +String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine ) +{ + return lcl_GetDelimitedString(rEngine, ' '); +} + +String ScEditUtil::GetMultilineString( const EditEngine& rEngine ) +{ + return lcl_GetDelimitedString(rEngine, '\n'); +} + //------------------------------------------------------------------------ Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, BOOL bForceToTop ) diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/dif/difimp.cxx OOO300_m7/sc/source/filter/dif/difimp.cxx --- OOO300_m7-original/sc/source/filter/dif/difimp.cxx 2008-04-10 21:03:54.000000000 +0100 +++ OOO300_m7/sc/source/filter/dif/difimp.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -338,7 +338,7 @@ while( eS != S_END ) { - if( !rIn.ReadUniOrByteStringLine( aLine ) ) + if( !ReadNextLine( aLine ) ) { eS = S_END; eRet = T_END; @@ -406,10 +406,10 @@ break; case S_UNKNOWN: // 2 Zeilen ueberlesen - rIn.ReadUniOrByteStringLine( aLine ); + ReadNextLine( aLine ); case S_ERROR_L2: // Fehler in Line 2 aufgetreten // eine Zeile ueberlesen - rIn.ReadUniOrByteStringLine( aLine ); + ReadNextLine( aLine ); eS = S_END; break; default: @@ -421,7 +421,7 @@ } -void lcl_DeEscapeQuotesDif( String& rString ) +static void lcl_DeEscapeQuotesDif( String& rString ) { // Special handling for DIF import: Escaped (duplicated) quotes are resolved. // Single quote characters are left in place because older versions didn't @@ -437,25 +437,107 @@ } } +// Determine if passed in string is numeric data and set fVal/nNumFormat if so +DATASET DifParser::GetNumberDataset( const sal_Unicode* pPossibleNumericData ) +{ + DATASET eRet = D_SYNT_ERROR; + if( bPlain ) + { + if( ScanFloatVal( pPossibleNumericData ) ) + eRet = D_NUMERIC; + else + eRet = D_SYNT_ERROR; + } + else + { // ...und zur Strafe mit'm Numberformatter... + DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" ); + String aTestVal( pPossibleNumericData ); + sal_uInt32 nFormat = 0; + double fTmpVal; + if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) ) + { + fVal = fTmpVal; + nNumFormat = nFormat; + eRet = D_NUMERIC; + } + else + eRet = D_SYNT_ERROR; + } + return eRet; +} + +bool DifParser::ReadNextLine( String& rStr ) +{ + if( aLookAheadLine.Len() == 0 ) + { + return rIn.ReadUniOrByteStringLine( rStr ); + } + else + { + rStr = aLookAheadLine; + aLookAheadLine.Erase(); + return true; + } +} + +// Look ahead in the stream to determine if the next line is the first line of +// a valid data record structure +bool DifParser::LookAhead() +{ + const sal_Unicode* pAktBuffer; + bool bValidStructure = false; + + DBG_ASSERT( aLookAheadLine.Len() == 0, "*DifParser::LookAhead(): LookAhead called twice in a row" ); + rIn.ReadUniOrByteStringLine( aLookAheadLine ); + + pAktBuffer = aLookAheadLine.GetBuffer(); + + switch( *pAktBuffer ) + { + case '-': // Special Datatype + pAktBuffer++; + + if( Is1_0( pAktBuffer ) ) + { + bValidStructure = true; + } + break; + case '0': // Numeric Data + pAktBuffer++; + if( *pAktBuffer == ',' ) + { + pAktBuffer++; + bValidStructure = ( GetNumberDataset(pAktBuffer) != D_SYNT_ERROR ); + } + break; + case '1': // String Data + if( Is1_0( aLookAheadLine.GetBuffer() ) ) + { + bValidStructure = true; + } + break; + } + return bValidStructure; +} DATASET DifParser::GetNextDataset( void ) { DATASET eRet = D_UNKNOWN; String aLine; - const sal_Unicode* pAkt; + const sal_Unicode* pAktBuffer; - rIn.ReadUniOrByteStringLine( aLine ); + ReadNextLine( aLine ); - pAkt = aLine.GetBuffer(); + pAktBuffer = aLine.GetBuffer(); - switch( *pAkt ) + switch( *pAktBuffer ) { case '-': // Special Datatype - pAkt++; + pAktBuffer++; - if( Is1_0( pAkt ) ) + if( Is1_0( pAktBuffer ) ) { - rIn.ReadUniOrByteStringLine( aLine ); + ReadNextLine( aLine ); if( IsBOT( aLine.GetBuffer() ) ) eRet = D_BOT; else if( IsEOD( aLine.GetBuffer() ) ) @@ -463,37 +545,16 @@ } break; case '0': // Numeric Data - pAkt++; // Wert in fVal, 2. Zeile in aData - if( *pAkt == ',' ) + pAktBuffer++; // Wert in fVal, 2. Zeile in aData + if( *pAktBuffer == ',' ) { - pAkt++; - if( bPlain ) - { - if( ScanFloatVal( pAkt ) ) - eRet = D_NUMERIC; - else - eRet = D_SYNT_ERROR; - } - else - { // ...und zur Strafe mit'm Numberformatter... - DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" ); - String aTestVal( pAkt ); - sal_uInt32 nFormat = 0; - double fTmpVal; - if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) ) - { - fVal = fTmpVal; - nNumFormat = nFormat; - eRet = D_NUMERIC; - } - else - eRet = D_SYNT_ERROR; - } - rIn.ReadUniOrByteStringLine( aData ); + pAktBuffer++; + eRet = GetNumberDataset(pAktBuffer); + ReadNextLine( aData ); if ( eRet == D_SYNT_ERROR ) { // for broken records write "#ERR: data" to cell String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#ERR: " )); - aTmp += pAkt; + aTmp += pAktBuffer; aTmp.AppendAscii( " (" ); aTmp += aData; aTmp += sal_Unicode(')'); @@ -505,18 +566,62 @@ case '1': // String Data if( Is1_0( aLine.GetBuffer() ) ) { - rIn.ReadUniOrByteStringLine( aLine ); - DBG_ASSERT( aLine.Len() >= 2, - "*DifParser::GetNextTopic(): Text ist zu kurz (mind. \"\")!" ); - aData = aLine.Copy( 1, aLine.Len() - 2 ); - lcl_DeEscapeQuotesDif( aData ); - eRet = D_STRING; + ReadNextLine( aLine ); + xub_StrLen nLineLength = aLine.Len(); + const sal_Unicode* pLine = aLine.GetBuffer(); + + if( nLineLength >= 1 && *pLine == '"' ) + { + // Quotes are not always escaped (duplicated), see lcl_DeEscapeQuotesDif + // A look ahead into the next line is needed in order to deal with + // multiline strings containing quotes + if( LookAhead() ) + { + // Single line string + if( nLineLength >= 2 && pLine[nLineLength - 1] == '"' ) + { + aData = aLine.Copy( 1, nLineLength - 2 ); + lcl_DeEscapeQuotesDif( aData ); + eRet = D_STRING; + } + } + else + { + // Multiline string + aData = aLine.Copy( 1 ); + bool bContinue = true; + while ( bContinue ) + { + aData.Append( '\n' ); + bContinue = !rIn.IsEof() && ReadNextLine( aLine ); + if( bContinue ) + { + nLineLength = aLine.Len(); + if( nLineLength >= 1 ) + { + pLine = aLine.GetBuffer(); + bContinue = !LookAhead(); + if( bContinue ) + { + aData.Append( aLine ); + } + else if( pLine[nLineLength - 1] == '"' ) + { + aData.Append( pLine, nLineLength - 1 ); + lcl_DeEscapeQuotesDif( aData ); + eRet = D_STRING; + } + } + } + }; + } + } } break; } if( eRet == D_UNKNOWN ) - rIn.ReadUniOrByteStringLine( aLine ); + ReadNextLine( aLine ); if( rIn.IsEof() ) eRet = D_EOD; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/excel/xestyle.cxx OOO300_m7/sc/source/filter/excel/xestyle.cxx --- OOO300_m7-original/sc/source/filter/excel/xestyle.cxx 2008-07-02 10:04:30.000000000 +0100 +++ OOO300_m7/sc/source/filter/excel/xestyle.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -1963,9 +1963,9 @@ return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak ); } -sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt ) +sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt, bool bForceLineBreak ) { - return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, false ); + return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak ); } sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet ) diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/excel/xetable.cxx OOO300_m7/sc/source/filter/excel/xetable.cxx --- OOO300_m7-original/sc/source/filter/excel/xetable.cxx 2008-04-10 21:15:04.000000000 +0100 +++ OOO300_m7/sc/source/filter/excel/xetable.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -760,13 +760,15 @@ // #i41420# find script type according to result type (always latin for numeric results) sal_Int16 nScript = ApiScriptType::LATIN; + bool bForceLineBreak = false; if( nFormatType == NUMBERFORMAT_TEXT ) { String aResult; mrScFmlaCell.GetString( aResult ); + bForceLineBreak = mrScFmlaCell.IsMultilineResult(); nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult ); } - SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt ) ); + SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt, bForceLineBreak ) ); } // *** Convert the formula token array *** -------------------------------- diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/html/htmlexp.cxx OOO300_m7/sc/source/filter/html/htmlexp.cxx --- OOO300_m7-original/sc/source/filter/html/htmlexp.cxx 2008-04-10 21:26:13.000000000 +0100 +++ OOO300_m7/sc/source/filter/html/htmlexp.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -1152,9 +1152,31 @@ if ( !bFieldText ) { if ( !aStrOut.Len() ) + { TAG_ON( sHTML_linebreak ); // #42573# keine komplett leere Zelle + } else - OUT_STR( aStrOut ); + { + xub_StrLen nPos = aStrOut.Search( _LF ); + if ( nPos == STRING_NOTFOUND ) + { + OUT_STR( aStrOut ); + } + else + { + xub_StrLen nStartPos = 0; + do + { + String aSingleLine( aStrOut, nStartPos, nPos - nStartPos ); + OUT_STR( aSingleLine ); + TAG_ON( sHTML_linebreak ); + nStartPos = nPos + 1; + } + while( ( nPos = aStrOut.Search( _LF, nStartPos ) ) != STRING_NOTFOUND ); + String aSingleLine( aStrOut, nStartPos, aStrOut.Len() - nStartPos ); + OUT_STR( aSingleLine ); + } + } } if ( pGraphEntry ) WriteGraphEntry( pGraphEntry ); @@ -1192,7 +1214,7 @@ for ( USHORT nPar=0; nPar < nParas; nPar++ ) { if ( nPar > 0 ) - rStrm << ' '; // blank between paragraphs + TAG_ON( sHTML_linebreak ); SvUShorts aPortions; rEngine.GetPortions( nPar, aPortions ); USHORT nCnt = aPortions.Count(); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/inc/dif.hxx OOO300_m7/sc/source/filter/inc/dif.hxx --- OOO300_m7-original/sc/source/filter/inc/dif.hxx 2008-07-02 10:08:40.000000000 +0100 +++ OOO300_m7/sc/source/filter/inc/dif.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -82,7 +82,11 @@ SvNumberFormatter* pNumFormatter; SvStream& rIn; BOOL bPlain; + String aLookAheadLine; + bool ReadNextLine( String& rStr ); + bool LookAhead(); + DATASET GetNumberDataset( const sal_Unicode* pPossibleNumericData ); static inline BOOL IsBOT( const sal_Unicode* pRef ); static inline BOOL IsEOD( const sal_Unicode* pRef ); static inline BOOL Is1_0( const sal_Unicode* pRef ); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/inc/xestyle.hxx OOO300_m7/sc/source/filter/inc/xestyle.hxx --- OOO300_m7-original/sc/source/filter/inc/xestyle.hxx 2008-04-10 21:46:20.000000000 +0100 +++ OOO300_m7/sc/source/filter/inc/xestyle.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -617,10 +617,13 @@ @param nXFFlags Additional flags allowing to control the creation of an XF. @param nForceScNumFmt The number format to be exported, e.g. formula result type. This format will always overwrite the cell's number format. + @param bForceLineBreak true = Set line break flag unconditionally. + This is required for cells that contain multi-line text. @return A unique XF record ID. */ sal_uInt32 InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, - ULONG nForceScNumFmt ); + ULONG nForceScNumFmt, + bool bForceLineBreak ); /** Inserts the passed cell style. Creates a style XF record and a STYLE record. @return A unique XF record ID. */ sal_uInt32 InsertStyle( const SfxStyleSheetBase* pStyleSheet ); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/qpro/qpro.cxx OOO300_m7/sc/source/filter/qpro/qpro.cxx --- OOO300_m7-original/sc/source/filter/qpro/qpro.cxx 2008-04-10 22:00:57.000000000 +0100 +++ OOO300_m7/sc/source/filter/qpro/qpro.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -71,7 +71,7 @@ readString( aLabel, getLength() - 7 ); nStyle = nStyle >> 3; pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle ); - pDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aLabel ), (BOOL) TRUE ); + pDoc->PutCell( nCol, nRow, nTab, ScBaseCell::CreateTextCell( aLabel, pDoc ), (BOOL) TRUE ); } break; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.cxx OOO300_m7/sc/source/filter/xml/XMLExportIterator.cxx --- OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.cxx 2008-04-10 22:16:31.000000000 +0100 +++ OOO300_m7/sc/source/filter/xml/XMLExportIterator.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -568,6 +568,7 @@ aShapeList(), aDetectiveObjVec(), nValidationIndex(-1), + pBaseCell(NULL), bIsAutoStyle( sal_False ), bHasShape( sal_False ), bIsMergedBase( sal_False ), diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.hxx OOO300_m7/sc/source/filter/xml/XMLExportIterator.hxx --- OOO300_m7-original/sc/source/filter/xml/XMLExportIterator.hxx 2008-07-02 10:33:38.000000000 +0100 +++ OOO300_m7/sc/source/filter/xml/XMLExportIterator.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -48,6 +48,7 @@ struct ScMyCell; class ScXMLExport; class ScFormatRangeStyles; +class ScBaseCell; //============================================================================== @@ -312,6 +313,8 @@ sal_Int32 nNumberFormat; com::sun::star::table::CellContentType nType; + ScBaseCell* pBaseCell; + sal_Bool bIsAutoStyle; sal_Bool bHasShape; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/xml/xmlexprt.cxx OOO300_m7/sc/source/filter/xml/xmlexprt.cxx --- OOO300_m7-original/sc/source/filter/xml/xmlexprt.cxx 2008-05-28 11:18:09.000000000 +0100 +++ OOO300_m7/sc/source/filter/xml/xmlexprt.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -2381,7 +2381,8 @@ if (!bIsEmpty) { - if ((aCell.nType == table::CellContentType_TEXT) && IsEditCell(aCell)) + if ((aCell.nType == table::CellContentType_TEXT && IsEditCell(aCell)) || + (aCell.nType == table::CellContentType_FORMULA && IsMultiLineFormulaCell(aCell))) { bEditCell = sal_True; uno::Reference xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY); @@ -2820,12 +2821,15 @@ return (aCell1.nType == aCell2.nType); } -sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress) const +sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell) const { ScAddress aCoreAddress(static_cast(aAddress.Column), static_cast(aAddress.Row), static_cast(aAddress.Sheet)); ScBaseCell* pBaseCell = GetDocument() ? GetDocument()->GetCell(aCoreAddress) : NULL; + if (pMyCell) + pMyCell->pBaseCell = pBaseCell; + if (pBaseCell) return (pBaseCell->GetCellType() == CELLTYPE_EDIT); return sal_False; @@ -2845,12 +2849,36 @@ return rCell.bIsEditCell; else { - rCell.bIsEditCell = IsEditCell(rCell.aCellAddress); + rCell.bIsEditCell = IsEditCell(rCell.aCellAddress, &rCell); rCell.bKnowWhetherIsEditCell = sal_True; return rCell.bIsEditCell; } } +sal_Bool ScXMLExport::IsMultiLineFormulaCell(ScMyCell& rCell) +{ + if (rCell.pBaseCell) + { + if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA) + return false; + + return static_cast(rCell.pBaseCell)->IsMultilineResult(); + } + + ScAddress aAddr(static_cast(rCell.aCellAddress.Column), + static_cast(rCell.aCellAddress.Row), + static_cast(rCell.aCellAddress.Sheet)); + ScBaseCell* pBaseCell = pDoc ? pDoc->GetCell(aAddr) : NULL; + if (!pBaseCell) + return false; + + rCell.pBaseCell = pBaseCell; + if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA) + return false; + + return static_cast(rCell.pBaseCell)->IsMultilineResult(); +} + sal_Bool ScXMLExport::IsAnnotationEqual(const uno::Reference& /* xCell1 */, const uno::Reference& /* xCell2 */) { diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/filter/xml/xmlexprt.hxx OOO300_m7/sc/source/filter/xml/xmlexprt.hxx --- OOO300_m7-original/sc/source/filter/xml/xmlexprt.hxx 2008-07-02 10:39:58.000000000 +0100 +++ OOO300_m7/sc/source/filter/xml/xmlexprt.hxx 2009-03-05 13:07:59.000000000 +0000 @@ -60,6 +60,7 @@ class ScChartListener; class SfxItemPool; class ScAddress; +class ScBaseCell; typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec; @@ -181,9 +182,10 @@ void SetRepeatAttribute (const sal_Int32 nEqualCellCount); sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const; - sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress) const; + sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell = NULL) const; sal_Bool IsEditCell(const com::sun::star::uno::Reference & xCell) const; sal_Bool IsEditCell(ScMyCell& rCell) const; + sal_Bool IsMultiLineFormulaCell(ScMyCell& rCell); sal_Bool IsAnnotationEqual(const com::sun::star::uno::Reference& xCell1, const com::sun::star::uno::Reference& xCell2); sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/app/transobj.cxx OOO300_m7/sc/source/ui/app/transobj.cxx --- OOO300_m7-original/sc/source/ui/app/transobj.cxx 2008-04-18 12:34:38.000000000 +0100 +++ OOO300_m7/sc/source/ui/app/transobj.cxx 2009-03-05 22:43:52.000000000 +0000 @@ -312,6 +312,8 @@ BOOL bIncludeFiltered = pDoc->IsCutMode() || bUsedForLink; ScImportExport aObj( pDoc, aBlock ); + if ( bUsedForLink ) + aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) ); aObj.SetFormulas( pDoc->GetViewOptions().GetOption( VOPT_FORMULAS ) ); aObj.SetIncludeFiltered( bIncludeFiltered ); @@ -815,7 +817,10 @@ { String aStr; pFCell->GetString(aStr); - pNew = new ScStringCell( aStr ); + if ( pFCell->IsMultilineResult() ) + pNew = new ScEditCell( aStr, pDestDoc ); + else + pNew = new ScStringCell( aStr ); } pDestDoc->PutCell( nCol,nRow,nDestTab, pNew ); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/docshell/docsh4.cxx OOO300_m7/sc/source/ui/docshell/docsh4.cxx --- OOO300_m7-original/sc/source/ui/docshell/docsh4.cxx 2008-07-08 10:43:31.000000000 +0100 +++ OOO300_m7/sc/source/ui/docshell/docsh4.cxx 2009-03-05 23:22:49.000000000 +0000 @@ -2420,10 +2420,12 @@ if( aDdeTextFmt.EqualsAscii( "CSV" ) || aDdeTextFmt.EqualsAscii( "FCSV" ) ) aObj.SetSeparator( ',' ); + aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, NULL, false ) ); return aObj.ExportData( rMimeType, rValue ) ? 1 : 0; } ScImportExport aObj( &aDocument, rItem ); + aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, NULL, false ) ); if( aObj.IsRef() ) return aObj.ExportData( rMimeType, rValue ) ? 1 : 0; return 0; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/docshell/docsh.cxx OOO300_m7/sc/source/ui/docshell/docsh.cxx --- OOO300_m7-original/sc/source/ui/docshell/docsh.cxx 2008-07-08 10:43:20.000000000 +0100 +++ OOO300_m7/sc/source/ui/docshell/docsh.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -1278,6 +1278,7 @@ } bSetColWidths = TRUE; bSetSimpleTextColWidths = TRUE; + bSetRowHeights = TRUE; } else if (aFltName.EqualsAscii(pFilterSylk)) { @@ -1305,6 +1306,7 @@ SetError(eError); bSetColWidths = TRUE; bSetSimpleTextColWidths = TRUE; + bSetRowHeights = TRUE; } else if (aFltName.EqualsAscii(pFilterQPro6)) { diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/docshell/impex.cxx OOO300_m7/sc/source/ui/docshell/impex.cxx --- OOO300_m7-original/sc/source/ui/docshell/impex.cxx 2008-05-14 10:57:21.000000000 +0100 +++ OOO300_m7/sc/source/ui/docshell/impex.cxx 2009-03-05 22:56:34.000000000 +0000 @@ -93,6 +93,12 @@ //======================================================================== +namespace +{ + const String SYLK_LF = String::CreateFromAscii("\x1b :"); + const String SEMICOLON = String::CreateFromAscii(";"); + const String DOUBLE_SEMICOLON = String::CreateFromAscii(";;"); +} // Gesamtdokument ohne Undo @@ -102,7 +108,7 @@ nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( FALSE ), bIncludeFiltered( TRUE ), bAll( TRUE ), bSingle( TRUE ), bUndo( FALSE ), - bOverflow( FALSE ), mbApi( true ) + bOverflow( FALSE ), mbApi( true ), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -117,7 +123,7 @@ nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( FALSE ), bIncludeFiltered( TRUE ), bAll( FALSE ), bSingle( TRUE ), bUndo( BOOL( pDocSh != NULL ) ), - bOverflow( FALSE ), mbApi( true ) + bOverflow( FALSE ), mbApi( true ), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -133,7 +139,7 @@ nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( FALSE ), bIncludeFiltered( TRUE ), bAll( FALSE ), bSingle( FALSE ), bUndo( BOOL( pDocSh != NULL ) ), - bOverflow( FALSE ), mbApi( true ) + bOverflow( FALSE ), mbApi( true ), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -150,7 +156,7 @@ nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ), bFormulas( FALSE ), bIncludeFiltered( TRUE ), bAll( FALSE ), bSingle( TRUE ), bUndo( BOOL( pDocSh != NULL ) ), - bOverflow( FALSE ), mbApi( true ) + bOverflow( FALSE ), mbApi( true ), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -575,6 +581,7 @@ } +// This function could be replaced by endlub() // static void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm ) { @@ -605,7 +612,7 @@ DQM_SEPARATE // end one string and begin next }; -const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString, +static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString, sal_Unicode cStr, DoubledQuoteMode eMode ) { p++; //! jump over opening quote @@ -653,8 +660,26 @@ return p; } +static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p, String& rString ) +{ + const sal_Unicode* pStartQuote = p; + const sal_Unicode* pEndQuote = 0; + while( *(++p) ) + { + if( *p == '"' ) + pEndQuote = p; + } + if( pEndQuote ) + { + p = pEndQuote; + rString.Append( pStartQuote + 1, sal::static_int_cast( pEndQuote - pStartQuote - 1 ) ); + rString.SearchAndReplaceAll( DOUBLE_SEMICOLON, ';' ); + rString.SearchAndReplaceAll( SYLK_LF, _LF ); + } + return p; +} -void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr ) +static void lcl_DoubleEscapeChar( String& rString, sal_Unicode cStr ) { xub_StrLen n = 0; while( ( n = rString.Search( cStr, n ) ) != STRING_NOTFOUND ) @@ -662,6 +687,11 @@ rString.Insert( cStr, n ); n += 2; } +} + +static void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr ) +{ + lcl_DoubleEscapeChar( rString, cStr ); rString.Insert( cStr, 0 ); rString.Append( cStr ); @@ -1279,6 +1309,7 @@ SCCOL nEndCol = aRange.aEnd.Col(); SCROW nEndRow = aRange.aEnd.Row(); String aCell; + bool bConvertLF = (GetSystemLineEnd() != LINEEND_LF); for (nRow = nStartRow; nRow <= nEndRow; nRow++) { @@ -1302,11 +1333,24 @@ } else { - pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); - if( aCell.Search( cSep ) != STRING_NOTFOUND ) - lcl_WriteString( rStrm, aCell, cStr ); - else - lcl_WriteSimpleString( rStrm, aCell ); + pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); + + bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); + if( bMultiLineText ) + { + if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace ) + aCell.SearchAndReplaceAll( _LF, ' ' ); + else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF ) + aCell.ConvertLineEnd(); + } + + if( mExportTextOptions.mcSeparatorConvertTo && cSep ) + aCell.SearchAndReplaceAll( cSep, mExportTextOptions.mcSeparatorConvertTo ); + + if( mExportTextOptions.mbAddQuotes && ( aCell.Search( cSep ) != STRING_NOTFOUND ) ) + lcl_WriteString( rStrm, aCell, cStr ); + else + lcl_WriteSimpleString( rStrm, aCell ); } } break; @@ -1322,10 +1366,23 @@ default: { pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell ); - if( aCell.Search( cSep ) != STRING_NOTFOUND ) - lcl_WriteString( rStrm, aCell, cStr ); - else - lcl_WriteSimpleString( rStrm, aCell ); + + bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND ); + if( bMultiLineText ) + { + if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace ) + aCell.SearchAndReplaceAll( _LF, ' ' ); + else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF ) + aCell.ConvertLineEnd(); + } + + if( mExportTextOptions.mcSeparatorConvertTo && cSep ) + aCell.SearchAndReplaceAll( cSep, mExportTextOptions.mcSeparatorConvertTo ); + + if( mExportTextOptions.mbAddQuotes && ( aCell.Search( cSep ) != STRING_NOTFOUND ) ) + lcl_WriteString( rStrm, aCell, cStr ); + else + lcl_WriteSimpleString( rStrm, aCell ); } } if( nCol < nEndCol ) @@ -1424,8 +1481,8 @@ if( *p == '"' ) { bText = TRUE; - aText = '\''; // force string cell - p = lcl_ScanString( p, aText, '"', DQM_ESCAPE ); + aText.Erase(); + p = lcl_ScanSylkString( p, aText ); } else bText = FALSE; @@ -1435,7 +1492,9 @@ if ( !(*q == ';' && *(q+1) == 'I') ) { // don't ignore value if( bText ) - pDoc->SetString( nCol, nRow, aRange.aStart.Tab(), aText ); + { + pDoc->PutCell( nCol, nRow, aRange.aStart.Tab(), ScBaseCell::CreateTextCell( aText, pDoc ), (BOOL) TRUE ); + } else { double fVal = rtl_math_uStringToDouble( p, @@ -1467,7 +1526,9 @@ break; aText = '='; if( *p == '"' ) - p = lcl_ScanString( p, aText, '"', DQM_ESCAPE ); + { + p = lcl_ScanSylkString( p, aText ); + } else { const sal_Unicode* q = p; @@ -1660,14 +1721,19 @@ case CELLTYPE_EDIT: hasstring: pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr ); + aCellStr.SearchAndReplaceAll( _LF, SYLK_LF ); aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" )); aBufStr += String::CreateFromInt32( c ); aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";Y" )); aBufStr += String::CreateFromInt32( r ); aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";K" )); + aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\"" )); lcl_WriteSimpleString( rStrm, aBufStr ); - lcl_WriteString( rStrm, aCellStr, '"' ); + lcl_DoubleEscapeChar( aCellStr, ';' ); + lcl_WriteSimpleString( rStrm, aCellStr ); + aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "\"" )); + lcl_WriteSimpleString( rStrm, aBufStr ); checkformula: if( bForm ) diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/docshell/servobj.cxx OOO300_m7/sc/source/ui/docshell/servobj.cxx --- OOO300_m7-original/sc/source/ui/docshell/servobj.cxx 2008-05-14 10:57:35.000000000 +0100 +++ OOO300_m7/sc/source/ui/docshell/servobj.cxx 2009-03-05 22:43:52.000000000 +0000 @@ -200,10 +200,12 @@ if( aDdeTextFmt.EqualsAscii( "CSV" ) || aDdeTextFmt.EqualsAscii( "FCSV" ) ) aObj.SetSeparator( ',' ); + aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) ); return aObj.ExportData( rMimeType, rData ) ? 1 : 0; } ScImportExport aObj( pDoc, aRange ); + aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) ); if( aObj.IsRef() ) return aObj.ExportData( rMimeType, rData ) ? 1 : 0; return 0; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/inc/impex.hxx OOO300_m7/sc/source/ui/inc/impex.hxx --- OOO300_m7-original/sc/source/ui/inc/impex.hxx 2008-04-11 00:03:31.000000000 +0100 +++ OOO300_m7/sc/source/ui/inc/impex.hxx 2009-03-05 22:50:07.000000000 +0000 @@ -42,6 +42,17 @@ class SfxMedium; class ScAsciiOptions; +struct ScExportTextOptions +{ + enum NewlineConversion { ToSystem, ToSpace, None }; + ScExportTextOptions( NewlineConversion eNewlineConversion = ToSystem, sal_Unicode cSeparatorConvertTo = NULL, bool bAddQuotes = false ) : + meNewlineConversion( eNewlineConversion ), mcSeparatorConvertTo( cSeparatorConvertTo ), mbAddQuotes( bAddQuotes ) {} + + NewlineConversion meNewlineConversion; + sal_Unicode mcSeparatorConvertTo; // Convert separator to this character + bool mbAddQuotes; +}; + class ScImportExport { ScDocShell* pDocSh; @@ -60,6 +71,7 @@ BOOL bUndo; // Mit Undo? BOOL bOverflow; // zuviele Zeilen/Spalten bool mbApi; + ScExportTextOptions mExportTextOptions; ScAsciiOptions* pExtOptions; // erweiterte Optionen @@ -138,6 +150,8 @@ bool IsApi() const { return mbApi; } void SetApi( bool bApi ) { mbApi = bApi; } + const ScExportTextOptions& GetExportTextOptions() { return mExportTextOptions; } + void SetExportTextOptions( const ScExportTextOptions& options ) { mExportTextOptions = options; } }; diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/view/cellsh2.cxx OOO300_m7/sc/source/ui/view/cellsh2.cxx --- OOO300_m7-original/sc/source/ui/view/cellsh2.cxx 2008-07-01 17:27:32.000000000 +0100 +++ OOO300_m7/sc/source/ui/view/cellsh2.cxx 2009-03-05 22:43:53.000000000 +0000 @@ -1024,6 +1024,7 @@ DBG_ASSERT( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" ); ScImportExport aExport( pDoc, aRange ); + aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, NULL, false ) ); // #i87703# text to columns fails with tab separator aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) ); diff -Naur --exclude='unxlngi6.*' --exclude='*.swp' OOO300_m7-original/sc/source/ui/view/output2.cxx OOO300_m7/sc/source/ui/view/output2.cxx --- OOO300_m7-original/sc/source/ui/view/output2.cxx 2008-04-11 02:34:35.000000000 +0100 +++ OOO300_m7/sc/source/ui/view/output2.cxx 2009-03-05 13:07:59.000000000 +0000 @@ -1427,11 +1427,13 @@ } if (bDoCell && !bNeedEdit) { - if ( pCell->GetCellType() == CELLTYPE_FORMULA ) + BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA ); + if ( bFormulaCell ) lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell ); if ( aVars.SetText(pCell) ) pOldPattern = NULL; - bNeedEdit = aVars.HasEditCharacters(); + bNeedEdit = aVars.HasEditCharacters() || + (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult()); } if (bDoCell && !bNeedEdit) {