ooo-build r15514 - in trunk: . patches/dev300



Author: kyoshida
Date: Tue Mar 10 01:03:31 2009
New Revision: 15514
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15514&view=rev

Log:
2009-03-09  William S Fulton  <wsf fultondesigns co uk>

	* patches/dev300/calc-multiline-formula-ref.diff: 

	- Newlines are converted into spaces for DDE linking.
	
	- Pasting cell contents as text into external application never adds
	quotes.  The text is now pasted exactly as stored in the cell,
	including newlines.

	- Fixed DDE linking when a cell contains a tab - it gets converted to a
	space.
	
	


Modified:
   trunk/ChangeLog
   trunk/patches/dev300/calc-multiline-formula-ref.diff

Modified: trunk/patches/dev300/calc-multiline-formula-ref.diff
==============================================================================
--- trunk/patches/dev300/calc-multiline-formula-ref.diff	(original)
+++ trunk/patches/dev300/calc-multiline-formula-ref.diff	Tue Mar 10 01:03:31 2009
@@ -1,8 +1,8 @@
 diff --git sc/inc/cell.hxx sc/inc/cell.hxx
-index eaf6f7b..494d9d8 100644
+index 3f99c56..0bef331 100644
 --- sc/inc/cell.hxx
 +++ sc/inc/cell.hxx
-@@ -460,6 +460,9 @@ public:
+@@ -647,6 +647,9 @@ public:
  	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
  	EditTextObject*		CreateURLObject() ;
      void            GetURLResult( String& rURL, String& rCellText );
@@ -31,7 +31,7 @@
  				ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
  							const Point& rScrPosPixel,
 diff --git sc/inc/formularesult.hxx sc/inc/formularesult.hxx
-index 8c70f43..ea364dc 100644
+index 8c70f43..5865f60 100644
 --- sc/inc/formularesult.hxx
 +++ sc/inc/formularesult.hxx
 @@ -38,6 +38,11 @@
@@ -137,10 +137,10 @@
      }
  }
  
-@@ -404,6 +423,19 @@ inline bool ScFormulaResult::IsValue() const
-     return sv == formula::svDouble || sv == formula::svError || sv == formula::svEmptyCell;
+@@ -405,6 +424,20 @@ inline bool ScFormulaResult::IsValue() const
  }
  
+ 
 +inline bool ScFormulaResult::IsMultiline()
 +{
 +    if (meMultiline == MULTILINE_UNKNOWN)
@@ -154,10 +154,11 @@
 +    return meMultiline == MULTILINE_TRUE;
 +}
 +
- 
++
  inline USHORT ScFormulaResult::GetResultError() const
  {
-@@ -537,6 +569,7 @@ inline void ScFormulaResult::SetHybridDouble( double f )
+     if (mnError)
+@@ -537,6 +570,7 @@ inline void ScFormulaResult::SetHybridDouble( double f )
      {
          mfValue = f;
          mbToken = false;
@@ -166,10 +167,10 @@
  }
  
 diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index 9d1d58c..f284865 100644
+index 232a2ae..f26401e 100644
 --- sc/source/core/data/cell.cxx
 +++ sc/source/core/data/cell.cxx
-@@ -1796,6 +1796,13 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText )
+@@ -1938,6 +1938,13 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText )
      }
  }
  
@@ -184,10 +185,10 @@
  {
      String aCellText;
 diff --git sc/source/core/data/cell2.cxx sc/source/core/data/cell2.cxx
-index b744d84..af14bfc 100644
+index 5014e6b..4c38b39 100644
 --- sc/source/core/data/cell2.cxx
 +++ sc/source/core/data/cell2.cxx
-@@ -136,7 +136,7 @@ void ScEditCell::GetString( String& rString ) const
+@@ -131,7 +131,7 @@ void ScEditCell::GetString( String& rString ) const
          // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine
          EditEngine& rEngine = pDoc->GetEditEngine();
          rEngine.SetText( *pData );
@@ -197,10 +198,10 @@
          if ( rString.Len() < MAXSTRLEN )
              ((ScEditCell*)this)->pString = new String( rString );   //! non-const
 diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
-index 31a43d4..2c95181 100644
+index 48bad18..9e03b31 100644
 --- sc/source/core/data/column.cxx
 +++ sc/source/core/data/column.cxx
-@@ -2246,8 +2246,10 @@ BOOL ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
+@@ -2174,8 +2174,10 @@ BOOL ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
  	while ( (nIndex < nCount) ? ((nRow=pItems[nIndex].nRow) <= nEndRow) : FALSE )
  	{
  		ScBaseCell* pCell = pItems[nIndex].pCell;
@@ -214,10 +215,10 @@
  			rFirst = nRow;
  			return TRUE;
 diff --git sc/source/core/data/column2.cxx sc/source/core/data/column2.cxx
-index 29d21f8..0fb27e0 100644
+index 9e129e2..cc8e369 100644
 --- sc/source/core/data/column2.cxx
 +++ sc/source/core/data/column2.cxx
-@@ -325,9 +325,12 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
+@@ -319,9 +319,12 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
  		}
  
  		BOOL bAddMargin = TRUE;
@@ -233,10 +234,10 @@
  		if (!bEditEngine)									// direkte Ausgabe
  		{
 diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
-index 68007bf..1009cb8 100644
+index 621c19f..ba6a42f 100644
 --- sc/source/core/data/column3.cxx
 +++ sc/source/core/data/column3.cxx
-@@ -841,7 +841,16 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE n
+@@ -854,7 +854,16 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
                      rForm.GetString( aString );
                      // #33224# do not clone empty string
                      if (aString.Len() > 0)
@@ -244,21 +245,21 @@
 +                    {
 +                        if ( rForm.IsMultilineResult() )
 +                        {
-+                            pNew = new ScEditCell( aString, &rDestDoc );
++                            pNew = new ScEditCell(aString, &rDestDoc);
 +                        }
 +                        else
 +                        {
-+                            pNew = new ScStringCell( aString );
++                            pNew = new ScStringCell(aString);
 +                        }
 +                    }
                  }
              }
          break;
 diff --git sc/source/core/tool/editutil.cxx sc/source/core/tool/editutil.cxx
-index 65605ce..31dc996 100644
+index 5c771a1..8199a21 100644
 --- sc/source/core/tool/editutil.cxx
 +++ sc/source/core/tool/editutil.cxx
-@@ -82,19 +82,29 @@ String ScEditUtil::ModifyDelimiters( const String& rOld )
+@@ -84,19 +84,29 @@ String ScEditUtil::ModifyDelimiters( const String& rOld )
  	return aRet;
  }
  
@@ -555,10 +556,10 @@
  	if( rIn.IsEof() )
  		eRet = D_EOD;
 diff --git sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xestyle.cxx
-index 575d453..d93eec3 100644
+index 71abe16..de32a64 100644
 --- sc/source/filter/excel/xestyle.cxx
 +++ sc/source/filter/excel/xestyle.cxx
-@@ -2319,9 +2319,9 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In
+@@ -2320,9 +2320,9 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In
      return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
  }
  
@@ -571,7 +572,7 @@
  
  sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
 diff --git sc/source/filter/excel/xetable.cxx sc/source/filter/excel/xetable.cxx
-index 006b819..2554280 100644
+index 1c7c945..8d27d2d 100644
 --- sc/source/filter/excel/xetable.cxx
 +++ sc/source/filter/excel/xetable.cxx
 @@ -839,13 +839,15 @@ XclExpFormulaCell::XclExpFormulaCell(
@@ -654,10 +655,10 @@
  	static inline BOOL	IsEOD( const sal_Unicode* pRef );
  	static inline BOOL	Is1_0( const sal_Unicode* pRef );
 diff --git sc/source/filter/inc/xestyle.hxx sc/source/filter/inc/xestyle.hxx
-index 55cbc25..8485bb1 100644
+index f3b3c4f..9508c8b 100644
 --- sc/source/filter/inc/xestyle.hxx
 +++ sc/source/filter/inc/xestyle.hxx
-@@ -643,10 +643,13 @@ public:
+@@ -644,10 +644,13 @@ public:
          @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.
@@ -686,7 +687,7 @@
                  break;
  
 diff --git sc/source/filter/xml/XMLExportIterator.cxx sc/source/filter/xml/XMLExportIterator.cxx
-index 8ba7cad..8a7e52b 100644
+index 768c926..29a2e2c 100644
 --- sc/source/filter/xml/XMLExportIterator.cxx
 +++ sc/source/filter/xml/XMLExportIterator.cxx
 @@ -568,6 +568,7 @@ ScMyCell::ScMyCell() :
@@ -698,7 +699,7 @@
  	bHasShape( sal_False ),
  	bIsMergedBase( sal_False ),
 diff --git sc/source/filter/xml/XMLExportIterator.hxx sc/source/filter/xml/XMLExportIterator.hxx
-index abe9185..0b0d51c 100644
+index a55f746..9d1834c 100644
 --- sc/source/filter/xml/XMLExportIterator.hxx
 +++ sc/source/filter/xml/XMLExportIterator.hxx
 @@ -48,6 +48,7 @@ class	ScHorizontalCellIterator;
@@ -709,7 +710,7 @@
  
  //==============================================================================
  
-@@ -312,6 +313,8 @@ struct ScMyCell
+@@ -313,6 +314,8 @@ struct ScMyCell
  	sal_Int32					nNumberFormat;
  	com::sun::star::table::CellContentType	nType;
  
@@ -719,10 +720,10 @@
  
  	sal_Bool					bHasShape;
 diff --git sc/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
-index b5e508a..5c7a39a 100644
+index 0a03262..97916e2 100644
 --- sc/source/filter/xml/xmlexprt.cxx
 +++ sc/source/filter/xml/xmlexprt.cxx
-@@ -2474,7 +2474,8 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
+@@ -2452,7 +2452,8 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
  
  	if (!bIsEmpty)
  	{
@@ -732,7 +733,7 @@
  		{
              bEditCell = sal_True;
              uno::Reference<text::XText> xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY);
-@@ -2940,12 +2941,15 @@ sal_Bool ScXMLExport::IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& a
+@@ -2901,12 +2902,15 @@ sal_Bool ScXMLExport::IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& a
  	return (aCell1.nType == aCell2.nType);
  }
  
@@ -749,12 +750,12 @@
  	if (pBaseCell)
  		return (pBaseCell->GetCellType() == CELLTYPE_EDIT);
  	return sal_False;
-@@ -2965,12 +2969,36 @@ sal_Bool ScXMLExport::IsEditCell(ScMyCell& rCell) const
+@@ -2926,12 +2930,36 @@ sal_Bool ScXMLExport::IsEditCell(ScMyCell& rCell) const
  		return rCell.bIsEditCell;
  	else
  	{
 -		rCell.bIsEditCell = IsEditCell(rCell.aCellAddress);
-+		rCell.bIsEditCell = IsEditCell(rCell.aCellAddress, &rCell);
++        rCell.bIsEditCell = IsEditCell(rCell.aCellAddress, &rCell);
  		rCell.bKnowWhetherIsEditCell = sal_True;
  		return rCell.bIsEditCell;
  	}
@@ -788,7 +789,7 @@
  //UNUSED2008-05                                          const uno::Reference<table::XCell>& /* xCell2 */)
  //UNUSED2008-05  {
 diff --git sc/source/filter/xml/xmlexprt.hxx sc/source/filter/xml/xmlexprt.hxx
-index 172af18..7d55e81 100644
+index 7f99237..d98151c 100644
 --- sc/source/filter/xml/xmlexprt.hxx
 +++ sc/source/filter/xml/xmlexprt.hxx
 @@ -62,6 +62,7 @@ class XMLNumberFormatAttributesExportHelper;
@@ -799,7 +800,7 @@
  
  typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
  
-@@ -188,9 +189,10 @@ class ScXMLExport : public SvXMLExport
+@@ -193,9 +194,10 @@ class ScXMLExport : public SvXMLExport
  	void SetRepeatAttribute (const sal_Int32 nEqualCellCount);
  
  	sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
@@ -812,10 +813,19 @@
  //UNUSED2008-05                             const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
  	sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
 diff --git sc/source/ui/app/transobj.cxx sc/source/ui/app/transobj.cxx
-index d13e4b9..d324b1b 100644
+index 69fd72a..1620f95 100644
 --- sc/source/ui/app/transobj.cxx
 +++ sc/source/ui/app/transobj.cxx
-@@ -815,7 +815,10 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
+@@ -312,6 +312,8 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
+ 			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 );
+ 
+@@ -816,7 +818,10 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
  				{
  					String aStr;
  					pFCell->GetString(aStr);
@@ -828,10 +838,10 @@
  				pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
  
 diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index d01cca3..688271d 100644
+index 8526d08..ec2bc6d 100644
 --- sc/source/ui/docshell/docsh.cxx
 +++ sc/source/ui/docshell/docsh.cxx
-@@ -1097,6 +1097,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
+@@ -1179,6 +1179,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
  			}
  			bSetColWidths = TRUE;
  			bSetSimpleTextColWidths = TRUE;
@@ -839,7 +849,7 @@
  		}
  		else if (aFltName.EqualsAscii(pFilterSylk))
  		{
-@@ -1124,6 +1125,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
+@@ -1206,6 +1207,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
  				SetError(eError);
  			bSetColWidths = TRUE;
  			bSetSimpleTextColWidths = TRUE;
@@ -847,8 +857,25 @@
  		}
  		else if (aFltName.EqualsAscii(pFilterQPro6))
          {
+diff --git sc/source/ui/docshell/docsh4.cxx sc/source/ui/docshell/docsh4.cxx
+index 78269ba..8921396 100644
+--- sc/source/ui/docshell/docsh4.cxx
++++ sc/source/ui/docshell/docsh4.cxx
+@@ -2406,10 +2406,12 @@ long __EXPORT ScDocShell::DdeGetData( const String& rItem,
+ 		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 --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
-index 6c7b171..4cccca0 100644
+index c1bc6bb..cc51d67 100644
 --- sc/source/ui/docshell/impex.cxx
 +++ sc/source/ui/docshell/impex.cxx
 @@ -93,6 +93,12 @@ class StarBASIC;
@@ -864,6 +891,42 @@
  
  // Gesamtdokument ohne Undo
  
+@@ -102,7 +108,7 @@ ScImportExport::ScImportExport( ScDocument* p )
+       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 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt )
+       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 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange& r )
+       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 @@ ScImportExport::ScImportExport( ScDocument* p, const String& rPos )
+       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 @@ void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const String& rS
  }
  
@@ -921,35 +984,73 @@
  
  	rString.Insert( cStr, 0 );
  	rString.Append( cStr );
-@@ -1309,10 +1339,12 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+@@ -1285,6 +1315,7 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+ 	SCCOL nEndCol = aRange.aEnd.Col();
+ 	SCROW nEndRow = aRange.aEnd.Row();
+ 	String aCell;
++    bool bConvertLF = (GetSystemLineEnd() != LINEEND_LF);
+ 
+ 	for (nRow = nStartRow; nRow <= nEndRow; nRow++)
+ 	{
+@@ -1308,11 +1339,24 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+ 						}
  						else
  						{
- 							pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell );
+-							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 || aCell.Search( cSep ) != STRING_NOTFOUND )
++                            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;
-@@ -1328,7 +1360,9 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+@@ -1328,10 +1372,23 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
  					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 || aCell.Search( cSep ) != STRING_NOTFOUND )
- 							lcl_WriteString( rStrm, aCell, cStr );
- 						else
- 							lcl_WriteSimpleString( rStrm, aCell );
-@@ -1430,8 +1464,8 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
++                        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 )
+@@ -1430,8 +1487,8 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
                              if( *p == '"' )
                              {
                                  bText = TRUE;
@@ -960,7 +1061,7 @@
                              }
                              else
                                  bText = FALSE;
-@@ -1441,7 +1475,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+@@ -1441,7 +1498,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
                              if ( !(*q == ';' && *(q+1) == 'I') )
                              {   // don't ignore value
                                  if( bText )
@@ -971,7 +1072,7 @@
                                  else
                                  {
                                      double fVal = rtl_math_uStringToDouble( p,
-@@ -1473,7 +1509,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+@@ -1473,7 +1532,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
  								break;
                              aText = '=';
  							if( *p == '"' )
@@ -982,7 +1083,7 @@
  							else
  							{
                                  const sal_Unicode* q = p;
-@@ -1667,14 +1705,19 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
+@@ -1667,14 +1728,19 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
  				case CELLTYPE_EDIT:
  				hasstring:
  					pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
@@ -1003,8 +1104,76 @@
  
  				checkformula:
  					if( bForm )
+diff --git sc/source/ui/docshell/servobj.cxx sc/source/ui/docshell/servobj.cxx
+index 51e2ec6..1d07f29 100644
+--- sc/source/ui/docshell/servobj.cxx
++++ sc/source/ui/docshell/servobj.cxx
+@@ -200,10 +200,12 @@ BOOL __EXPORT ScServerObject::GetData(
+ 		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 --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
+index aaddeeb..d2fe3a3 100644
+--- sc/source/ui/inc/impex.hxx
++++ sc/source/ui/inc/impex.hxx
+@@ -42,6 +42,17 @@ class SvStream;
+ 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 @@ class ScImportExport
+ 	BOOL		bUndo;					// Mit Undo?
+ 	BOOL		bOverflow;				// zuviele Zeilen/Spalten
+     bool        mbApi;
++    ScExportTextOptions mExportTextOptions;
+ 
+ 	ScAsciiOptions*	pExtOptions;		// erweiterte Optionen
+ 
+@@ -138,6 +150,8 @@ public:
+ 
+     bool IsApi() const { return mbApi; }
+     void SetApi( bool bApi ) { mbApi = bApi; }
++    const ScExportTextOptions& GetExportTextOptions() { return mExportTextOptions; }
++    void SetExportTextOptions( const ScExportTextOptions& options ) { mExportTextOptions = options; }
+ };
+ 
+ 
+diff --git sc/source/ui/view/cellsh2.cxx sc/source/ui/view/cellsh2.cxx
+index 3e17451..365a2c7 100644
+--- sc/source/ui/view/cellsh2.cxx
++++ sc/source/ui/view/cellsh2.cxx
+@@ -1064,6 +1064,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
+                     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 --git sc/source/ui/view/output2.cxx sc/source/ui/view/output2.cxx
-index cb1aff9..63ecbcd 100644
+index cb1aff9..d01a843 100644
 --- sc/source/ui/view/output2.cxx
 +++ sc/source/ui/view/output2.cxx
 @@ -1358,11 +1358,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
@@ -1012,14 +1181,14 @@
  				if (bDoCell && !bNeedEdit)
  				{
 -					if ( pCell->GetCellType() == CELLTYPE_FORMULA )
-+					BOOL bFormulaCell = (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());
++                        (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
                  }
                  if (bDoCell && !bNeedEdit)
                  {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]