ooo-build r14271 - in trunk: . patches/test
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14271 - in trunk: . patches/test
- Date: Thu, 9 Oct 2008 16:44:09 +0000 (UTC)
Author: kyoshida
Date: Thu Oct 9 16:44:09 2008
New Revision: 14271
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14271&view=rev
Log:
2008-10-09 Kohei Yoshida <kyoshida novell com>
* patches/test/calc-csv-import-quoted-text.diff: experimental patch to
always import quoted fields as text (n#433378).
Added:
trunk/patches/test/calc-csv-import-quoted-text.diff
Modified:
trunk/ChangeLog
Added: trunk/patches/test/calc-csv-import-quoted-text.diff
==============================================================================
--- (empty file)
+++ trunk/patches/test/calc-csv-import-quoted-text.diff Thu Oct 9 16:44:09 2008
@@ -0,0 +1,89 @@
+diff --git sc/source/ui/dbgui/csvgrid.cxx sc/source/ui/dbgui/csvgrid.cxx
+index ddbfb44..5725645 100644
+--- sc/source/ui/dbgui/csvgrid.cxx
++++ sc/source/ui/dbgui/csvgrid.cxx
+@@ -737,7 +737,8 @@ void ScCsvGrid::ImplSetTextLineSep(
+ while( *pChar && (nColIx < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT)) )
+ {
+ // scan for next cell text
+- pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
++ bool bIsQuoted = false;
++ pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted );
+
+ // update column width
+ sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) );
+diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
+index 7c21c4a..07d6a80 100644
+--- sc/source/ui/docshell/impex.cxx
++++ sc/source/ui/docshell/impex.cxx
+@@ -762,12 +762,10 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm )
+ //
+
+
+-bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
+- const String& rStr, BYTE nColFormat,
+- ::utl::TransliterationWrapper& rTransliteration,
+- CalendarWrapper& rCalendar,
+- ::utl::TransliterationWrapper* pSecondTransliteration,
+- CalendarWrapper* pSecondCalendar )
++static bool lcl_PutString(
++ ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat,
++ ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
++ ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
+ {
+ bool bMultiLine = false;
+ if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) )
+@@ -1138,7 +1136,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
+ // SC_COL_SKIP.
+ while (*p && nCol <= MAXCOL+1)
+ {
+- p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge );
++ bool bIsQuoted = false;
++ p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted );
+
+ BYTE nFmt = SC_COL_STANDARD;
+ for ( i=nInfoStart; i<nInfoCount; i++ )
+@@ -1155,10 +1154,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
+ if (nCol > MAXCOL)
+ bOverflow = TRUE; // display warning on import
+ else if (!bDetermineRange)
++ {
++ if (bIsQuoted)
++ nFmt = SC_COL_TEXT;
++
+ bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
+ nTab, aCell, nFmt, aTransliteration,
+ aCalendar, pEnglishTransliteration,
+ pEnglishCalendar);
++ }
+ ++nCol;
+ }
+
+@@ -1232,11 +1236,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
+
+ // static
+ const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p,
+- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps )
++ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted )
+ {
++ rbIsQuoted = false;
+ rField.Erase();
+ if ( *p == cStr ) // String in Anfuehrungszeichen
+ {
++ rbIsQuoted = true;
+ const sal_Unicode* p1;
+ p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE );
+ while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) )
+diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
+index 515063a..aaddeeb 100644
+--- sc/source/ui/inc/impex.hxx
++++ sc/source/ui/inc/impex.hxx
+@@ -98,7 +98,7 @@ public:
+
+ static BOOL IsFormatSupported( ULONG nFormat );
+ static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p,
+- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps );
++ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted );
+ static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE );
+ static void WriteUnicodeOrByteEndl( SvStream& rStrm );
+ static inline BOOL IsEndianSwap( const SvStream& rStrm );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]