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



Author: kyoshida
Date: Wed Dec  3 21:48:05 2008
New Revision: 14731
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14731&view=rev

Log:
2008-12-03  William S Fulton  <wsf fultondesigns co uk>

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

	- Copy/paste text - add in quotes around the cell contents (string 
	delimiter) if cell text is multiline (like it does if string contains a
	tab): impex.cxx
	
	- Export and paste as HTML fix for multiline text (both formula and 
	non-formula cells): htmlexp.cxx
	
	- Fix multiline DIF format import and paste special (formula and non-
	formula cells) for example when importing from Excel: dif.hxx difimp.cxx
	
	- Fix SYLK import containing newlines - now OOo is compatible with 
	Excel: impex.cxx (Doc2Sylk and Sylk2Doc).
	
	- Fix SYLK import/export containing the quote character (") and 
	semicolon. The escaping of these characters is now the same as other 
	spreadsheets, I checked Excel, Quattro Pro and Gnumeric. Fixes copy from
	OOo to Excel as Excel chooses the SYLK format as the default when 
	pasting from OOo. Note that this is only noticeable if from the menu 
	Tools, Autocorrect, Double Quotes, Custom Quotes, Replace is not ticked.
	Note that this is ticked by default: impex.cxx
	
	- Auto resize cell heights so multiline cells display correctly when 
	importing formats DIF and SYLK : docsh.cxx
	
	- QuattroPro import filter fix for multi-line non-formula cells: 
	qpro.cxx


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	Wed Dec  3 21:48:05 2008
@@ -1,8 +1,8 @@
-diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
-index e3c6bed..e5d9fb6 100644
+diff --git sc/inc/cell.hxx sc/inc/cell.hxx
+index 387f564..0328c25 100644
 --- sc/inc/cell.hxx
 +++ sc/inc/cell.hxx
-@@ -475,6 +475,9 @@ public:
+@@ -594,6 +594,9 @@ public:
  	inline BOOL		IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
  	EditTextObject*		CreateURLObject() ;
      void            GetURLResult( String& rURL, String& rCellText );
@@ -12,7 +12,7 @@
  };
  
  //			Iterator fuer Referenzen in einer Formelzelle
-diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
+diff --git sc/inc/editutil.hxx sc/inc/editutil.hxx
 index 8072f26..0838d6a 100644
 --- sc/inc/editutil.hxx
 +++ sc/inc/editutil.hxx
@@ -30,7 +30,7 @@
  public:
  				ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
  							const Point& rScrPosPixel,
-diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
+diff --git sc/inc/formularesult.hxx sc/inc/formularesult.hxx
 index 727476c..b91159f 100644
 --- sc/inc/formularesult.hxx
 +++ sc/inc/formularesult.hxx
@@ -165,11 +165,11 @@
      }
  }
  
-diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
-index 6964b43..636f46e 100644
+diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
+index 9b4f91a..c1a7317 100644
 --- sc/source/core/data/cell.cxx
 +++ sc/source/core/data/cell.cxx
-@@ -1818,6 +1818,13 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText )
+@@ -1821,6 +1821,13 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText )
      }
  }
  
@@ -183,11 +183,11 @@
  EditTextObject* ScFormulaCell::CreateURLObject()
  {
      String aCellText;
-diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
-index a4c9a1c..fc6df5f 100644
+diff --git sc/source/core/data/cell2.cxx sc/source/core/data/cell2.cxx
+index b0423a4..d68124b 100644
 --- sc/source/core/data/cell2.cxx
 +++ sc/source/core/data/cell2.cxx
-@@ -163,7 +163,7 @@ void ScEditCell::GetString( String& rString ) const
+@@ -134,7 +134,7 @@ void ScEditCell::GetString( String& rString ) const
          // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine
          EditEngine& rEngine = pDoc->GetEditEngine();
          rEngine.SetText( *pData );
@@ -196,11 +196,11 @@
          // kurze Strings fuer Formeln merken
          if ( rString.Len() < MAXSTRLEN )
              ((ScEditCell*)this)->pString = new String( rString );   //! non-const
-diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
-index 1c80b6d..209dc77 100644
+diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
+index f4555dc..ea70bbe 100644
 --- sc/source/core/data/column.cxx
 +++ sc/source/core/data/column.cxx
-@@ -2281,8 +2281,10 @@ BOOL ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
+@@ -2246,8 +2246,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;
@@ -213,11 +213,11 @@
  		{
  			rFirst = nRow;
  			return TRUE;
-diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
-index 8e75dcd..888a51e 100644
+diff --git sc/source/core/data/column2.cxx sc/source/core/data/column2.cxx
+index 29d21f8..0fb27e0 100644
 --- sc/source/core/data/column2.cxx
 +++ sc/source/core/data/column2.cxx
-@@ -793,9 +793,12 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
+@@ -325,9 +325,12 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
  		}
  
  		BOOL bAddMargin = TRUE;
@@ -232,7 +232,7 @@
  
  		if (!bEditEngine)									// direkte Ausgabe
  		{
-diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
+diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
 index 1f5f531..76ddd16 100644
 --- sc/source/core/data/column3.cxx
 +++ sc/source/core/data/column3.cxx
@@ -256,7 +256,7 @@
  						}
  					}
  					if ( pNew && pSource->GetNotePtr() && ( nFlags & IDF_NOTE ) )
-diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
+diff --git sc/source/core/tool/editutil.cxx sc/source/core/tool/editutil.cxx
 index 65605ce..31dc996 100644
 --- sc/source/core/tool/editutil.cxx
 +++ sc/source/core/tool/editutil.cxx
@@ -292,8 +292,272 @@
  //------------------------------------------------------------------------
  
  Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, BOOL bForceToTop )
-diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
-index 55edbf1..0a5231e 100644
+diff --git sc/source/filter/dif/difimp.cxx sc/source/filter/dif/difimp.cxx
+index ece5a74..293fd3f 100644
+--- sc/source/filter/dif/difimp.cxx
++++ sc/source/filter/dif/difimp.cxx
+@@ -337,7 +337,7 @@ TOPIC DifParser::GetNextTopic( void )
+ 
+ 	while( eS != S_END )
+ 	{
+-		if( !rIn.ReadUniOrByteStringLine( aLine ) )
++		if( !ReadNextLine( aLine ) )
+ 		{
+ 			eS = S_END;
+ 			eRet = T_END;
+@@ -405,10 +405,10 @@ TOPIC DifParser::GetNextTopic( void )
+ 				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:
+@@ -420,7 +420,7 @@ TOPIC DifParser::GetNextTopic( void )
+ }
+ 
+ 
+-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
+@@ -436,25 +436,107 @@ void lcl_DeEscapeQuotesDif( String& rString )
+ 	}
+ }
+ 
++// 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() ) )
+@@ -462,37 +544,16 @@ DATASET	DifParser::GetNextDataset( void )
+ 			}
+ 			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(')');
+@@ -504,18 +565,62 @@ DATASET	DifParser::GetNextDataset( void )
+ 		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 --git sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xestyle.cxx
+index 1a86eb1..115f1e8 100644
 --- sc/source/filter/excel/xestyle.cxx
 +++ sc/source/filter/excel/xestyle.cxx
 @@ -1963,9 +1963,9 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In
@@ -308,7 +572,7 @@
  }
  
  sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
-diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
+diff --git sc/source/filter/excel/xetable.cxx sc/source/filter/excel/xetable.cxx
 index 91f4736..9323d86 100644
 --- sc/source/filter/excel/xetable.cxx
 +++ sc/source/filter/excel/xetable.cxx
@@ -329,11 +593,73 @@
      }
  
      // *** Convert the formula token array *** --------------------------------
-diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
-index 16bd7ed..810e301 100644
+diff --git sc/source/filter/html/htmlexp.cxx sc/source/filter/html/htmlexp.cxx
+index eef4768..4c03e12 100644
+--- sc/source/filter/html/htmlexp.cxx
++++ sc/source/filter/html/htmlexp.cxx
+@@ -1152,9 +1152,31 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
+ 	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 @@ BOOL ScHTMLExport::WriteFieldText( const ScEditCell* pCell )
+ 		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 --git sc/source/filter/inc/dif.hxx sc/source/filter/inc/dif.hxx
+index 602a356..3e9d3bc 100644
+--- sc/source/filter/inc/dif.hxx
++++ sc/source/filter/inc/dif.hxx
+@@ -82,7 +82,11 @@ private:
+ 	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 --git sc/source/filter/inc/xestyle.hxx sc/source/filter/inc/xestyle.hxx
+index 7625c16..8a17a74 100644
 --- sc/source/filter/inc/xestyle.hxx
 +++ sc/source/filter/inc/xestyle.hxx
-@@ -617,10 +617,13 @@ public:
+@@ -618,10 +618,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.
@@ -348,8 +674,21 @@
      /** 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 --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
-index 8ba7cad..8a7e52b 100644
+diff --git sc/source/filter/qpro/qpro.cxx sc/source/filter/qpro/qpro.cxx
+index 0773f4b..deceae2 100644
+--- sc/source/filter/qpro/qpro.cxx
++++ sc/source/filter/qpro/qpro.cxx
+@@ -71,7 +71,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
+                 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 --git sc/source/filter/xml/XMLExportIterator.cxx sc/source/filter/xml/XMLExportIterator.cxx
+index 768c926..29a2e2c 100644
 --- sc/source/filter/xml/XMLExportIterator.cxx
 +++ sc/source/filter/xml/XMLExportIterator.cxx
 @@ -568,6 +568,7 @@ ScMyCell::ScMyCell() :
@@ -360,8 +699,8 @@
  	bIsAutoStyle( sal_False ),
  	bHasShape( sal_False ),
  	bIsMergedBase( sal_False ),
-diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx
-index abe9185..0b0d51c 100644
+diff --git sc/source/filter/xml/XMLExportIterator.hxx sc/source/filter/xml/XMLExportIterator.hxx
+index a55f746..9d1834c 100644
 --- sc/source/filter/xml/XMLExportIterator.hxx
 +++ sc/source/filter/xml/XMLExportIterator.hxx
 @@ -48,6 +48,7 @@ class	ScHorizontalCellIterator;
@@ -372,7 +711,7 @@
  
  //==============================================================================
  
-@@ -312,6 +313,8 @@ struct ScMyCell
+@@ -313,6 +314,8 @@ struct ScMyCell
  	sal_Int32					nNumberFormat;
  	com::sun::star::table::CellContentType	nType;
  
@@ -381,11 +720,11 @@
  	sal_Bool					bIsAutoStyle;
  
  	sal_Bool					bHasShape;
-diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
-index 52f5145..fcf3e8b 100644
+diff --git sc/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
+index 61ac047..29b4fa1 100644
 --- sc/source/filter/xml/xmlexprt.cxx
 +++ sc/source/filter/xml/xmlexprt.cxx
-@@ -2390,7 +2390,8 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
+@@ -2489,7 +2489,8 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
  
  	if (!bIsEmpty)
  	{
@@ -395,7 +734,7 @@
  		{
              bEditCell = sal_True;
              uno::Reference<text::XText> xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY);
-@@ -2856,12 +2857,15 @@ sal_Bool ScXMLExport::IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& a
+@@ -2962,12 +2963,15 @@ sal_Bool ScXMLExport::IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& a
  	return (aCell1.nType == aCell2.nType);
  }
  
@@ -412,7 +751,7 @@
  	if (pBaseCell)
  		return (pBaseCell->GetCellType() == CELLTYPE_EDIT);
  	return sal_False;
-@@ -2881,12 +2885,36 @@ sal_Bool ScXMLExport::IsEditCell(ScMyCell& rCell) const
+@@ -2987,12 +2991,36 @@ sal_Bool ScXMLExport::IsEditCell(ScMyCell& rCell) const
  		return rCell.bIsEditCell;
  	else
  	{
@@ -450,11 +789,11 @@
  //UNUSED2008-05  sal_Bool ScXMLExport::IsAnnotationEqual(const uno::Reference<table::XCell>& /* xCell1 */,
  //UNUSED2008-05                                          const uno::Reference<table::XCell>& /* xCell2 */)
  //UNUSED2008-05  {
-diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
-index 779f94e..e4fcc10 100644
+diff --git sc/source/filter/xml/xmlexprt.hxx sc/source/filter/xml/xmlexprt.hxx
+index 3ca7d38..a15a3ab 100644
 --- sc/source/filter/xml/xmlexprt.hxx
 +++ sc/source/filter/xml/xmlexprt.hxx
-@@ -60,6 +60,7 @@ class XMLNumberFormatAttributesExportHelper;
+@@ -62,6 +62,7 @@ class XMLNumberFormatAttributesExportHelper;
  class ScChartListener;
  class SfxItemPool;
  class ScAddress;
@@ -462,7 +801,7 @@
  
  typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
  
-@@ -181,9 +182,10 @@ class ScXMLExport : public SvXMLExport
+@@ -194,9 +195,10 @@ class ScXMLExport : public SvXMLExport
  	void SetRepeatAttribute (const sal_Int32 nEqualCellCount);
  
  	sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
@@ -472,9 +811,9 @@
  	sal_Bool IsEditCell(ScMyCell& rCell) const;
 +    sal_Bool IsMultiLineFormulaCell(ScMyCell& rCell);
  //UNUSED2008-05  sal_Bool IsAnnotationEqual(const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell1,
- 								const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
+ //UNUSED2008-05                             const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
  	sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
-diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
+diff --git sc/source/ui/app/transobj.cxx sc/source/ui/app/transobj.cxx
 index d13e4b9..d324b1b 100644
 --- sc/source/ui/app/transobj.cxx
 +++ sc/source/ui/app/transobj.cxx
@@ -490,19 +829,162 @@
  				}
  				pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
  
-diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
-index 5ecaa46..7c21c4a 100644
+diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
+index e37455b..bd1a653 100644
+--- sc/source/ui/docshell/docsh.cxx
++++ sc/source/ui/docshell/docsh.cxx
+@@ -1172,6 +1172,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
+ 			}
+ 			bSetColWidths = TRUE;
+ 			bSetSimpleTextColWidths = TRUE;
++			bSetRowHeights = TRUE;
+ 		}
+ 		else if (aFltName.EqualsAscii(pFilterSylk))
+ 		{
+@@ -1199,6 +1200,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
+ 				SetError(eError);
+ 			bSetColWidths = TRUE;
+ 			bSetSimpleTextColWidths = TRUE;
++			bSetRowHeights = TRUE;
+ 		}
+ 		else if (aFltName.EqualsAscii(pFilterQPro6))
+         {
+diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
+index 5ecaa46..344dcae 100644
 --- sc/source/ui/docshell/impex.cxx
 +++ sc/source/ui/docshell/impex.cxx
-@@ -1606,6 +1606,7 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+@@ -93,6 +93,12 @@ class StarBASIC;
  
- BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
- {
+ //========================================================================
+ 
++namespace
++{
 +    const String SYLK_LF = String::CreateFromAscii("\x1b :");
- 	SCCOL nCol;
- 	SCROW nRow;
- 	SCCOL nStartCol = aRange.aStart.Col();
-@@ -1660,6 +1661,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
++    const String SEMICOLON = String::CreateFromAscii(";");
++    const String DOUBLE_SEMICOLON = String::CreateFromAscii(";;");
++}
+ 
+ // Gesamtdokument ohne Undo
+ 
+@@ -575,6 +581,7 @@ void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const String& rS
+ }
+ 
+ 
++// This function could be replaced by endlub()
+ // static
+ void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm )
+ {
+@@ -605,7 +612,7 @@ enum DoubledQuoteMode
+ 	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 @@ const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
+ 	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<xub_StrLen>( 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 @@ void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr )
+ 		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 );
+@@ -1303,10 +1333,12 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+ 						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 );
++
++                            BOOL bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND );
++                            if( bMultiLineText || aCell.Search( cSep ) != STRING_NOTFOUND )
++                                lcl_WriteString( rStrm, aCell, cStr );
++                            else
++                                lcl_WriteSimpleString( rStrm, aCell );
+ 						}
+ 					}
+ 					break;
+@@ -1322,7 +1354,9 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
+ 					default:
+ 					{
+ 						pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell );
+-						if( aCell.Search( cSep ) != STRING_NOTFOUND )
++
++                        BOOL bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND );
++						if( bMultiLineText || aCell.Search( cSep ) != STRING_NOTFOUND )
+ 							lcl_WriteString( rStrm, aCell, cStr );
+ 						else
+ 							lcl_WriteSimpleString( rStrm, aCell );
+@@ -1424,8 +1458,8 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+                             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 +1469,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+                             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 +1503,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
+ 								break;
+                             aText = '=';
+ 							if( *p == '"' )
+-                                p = lcl_ScanString( p, aText, '"', DQM_ESCAPE );
++                            {
++                                p = lcl_ScanSylkString( p, aText );
++                            }
+ 							else
+ 							{
+                                 const sal_Unicode* q = p;
+@@ -1660,14 +1698,19 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
  				case CELLTYPE_EDIT:
  				hasstring:
  					pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
@@ -510,11 +992,24 @@
  
  					aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" ));
  					aBufStr += String::CreateFromInt32( c );
-diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
-index c472906..c92818e 100644
+ 					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 --git sc/source/ui/view/output2.cxx sc/source/ui/view/output2.cxx
+index 56c2900..ddeb4d3 100644
 --- sc/source/ui/view/output2.cxx
 +++ sc/source/ui/view/output2.cxx
-@@ -1427,11 +1427,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
+@@ -1353,11 +1353,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
  				}
  				if (bDoCell && !bNeedEdit)
  				{



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