ooo-build r14238 - in trunk: . patches/test
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14238 - in trunk: . patches/test
- Date: Tue, 7 Oct 2008 15:19:55 +0000 (UTC)
Author: kyoshida
Date: Tue Oct 7 15:19:54 2008
New Revision: 14238
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14238&view=rev
Log:
2008-10-07 Kohei Yoshida <kyoshida novell com>
* patches/test/calc-xls-import-formula-cache.diff: experimental patch
to speed up xls file import, by making use of cached formula results &
row heights stored in the xls file.
Added:
trunk/patches/test/calc-xls-import-formula-cache.diff
Modified:
trunk/ChangeLog
Added: trunk/patches/test/calc-xls-import-formula-cache.diff
==============================================================================
--- (empty file)
+++ trunk/patches/test/calc-xls-import-formula-cache.diff Tue Oct 7 15:19:54 2008
@@ -0,0 +1,205 @@
+diff --git sc/inc/cell.hxx sc/inc/cell.hxx
+index a5aa3cf..fa5f62b 100644
+--- sc/inc/cell.hxx
++++ sc/inc/cell.hxx
+@@ -341,6 +341,8 @@ public:
+ void GetFormula( rtl::OUStringBuffer& rBuffer,
+ const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT ) const;
+
++ void SetCachedResult(const String& rStrVal);
++ void SetCachedResult(double fVal);
+ void SetDirty();
+ void SetDirtyVar();
+ // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
+diff --git sc/inc/document.hxx sc/inc/document.hxx
+index 35fd858..65106e6 100644
+--- sc/inc/document.hxx
++++ sc/inc/document.hxx
+@@ -826,7 +826,7 @@ SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
+ void SetDirty( const ScRange& );
+ void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
+ void CalcAll();
+- void CalcAfterLoad();
++ void CalcAfterLoad(bool bSetDirtyAfterLoad = true);
+ void CompileAll();
+ void CompileXML();
+
+diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
+index c330826..d9ab45f 100644
+--- sc/source/core/data/cell.cxx
++++ sc/source/core/data/cell.cxx
+@@ -943,6 +943,12 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress )
+
+ void ScFormulaCell::CalcAfterLoad()
+ {
++ if (!bDirty)
++ {
++ StartListeningTo( pDocument );
++ return;
++ }
++
+ BOOL bNewCompiled = FALSE;
+ // Falls ein Calc 1.0-Doc eingelesen wird, haben wir ein Ergebnis,
+ // aber kein TokenArray
+@@ -1666,6 +1672,20 @@ void __EXPORT ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
+ }
+ }
+
++void ScFormulaCell::SetCachedResult(const String& rStrVal)
++{
++ aResult.SetHybridString(rStrVal);
++ aResult.SetResultError(0);
++ bDirty = false;
++}
++
++void ScFormulaCell::SetCachedResult(double fVal)
++{
++ aResult.SetDouble(fVal);
++ aResult.SetResultError(0);
++ bDirty = false;
++}
++
+ void ScFormulaCell::SetDirty()
+ {
+ if ( !IsInChangeTrack() )
+diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
+index a94a264..5a811db 100644
+--- sc/source/core/data/document.cxx
++++ sc/source/core/data/document.cxx
+@@ -2594,7 +2594,7 @@ void ScDocument::CompileXML()
+ }
+
+
+-void ScDocument::CalcAfterLoad()
++void ScDocument::CalcAfterLoad(bool bSetDirtyAfterLoad)
+ {
+ SCTAB i;
+
+@@ -2604,8 +2604,13 @@ void ScDocument::CalcAfterLoad()
+ bCalcingAfterLoad = TRUE;
+ for ( i = 0; i <= MAXTAB; i++)
+ if (pTab[i]) pTab[i]->CalcAfterLoad();
+- for (i=0; i<=MAXTAB; i++)
+- if (pTab[i]) pTab[i]->SetDirtyAfterLoad();
++
++ if (bSetDirtyAfterLoad)
++ {
++ for (i = 0; i <= MAXTAB; ++i)
++ if (pTab[i])
++ pTab[i]->SetDirtyAfterLoad();
++ }
+ bCalcingAfterLoad = FALSE;
+
+ SetDetectiveDirty(FALSE); // noch keine wirklichen Aenderungen
+diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
+index fd87dbf..6aa412c 100644
+--- sc/source/filter/excel/excform.cxx
++++ sc/source/filter/excel/excform.cxx
+@@ -161,6 +161,8 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
+
+ if( pZelle )
+ {
++ pLastFormCell = pZelle;
++
+ if( eErr != ConvOK )
+ ExcelToSc::SetError( *pZelle, eErr );
+ #if 0
+@@ -169,6 +171,10 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
+ #else
+ (void)rCurVal;
+ #endif
++ if (!rtl::math::isNan(rCurVal))
++ pZelle->SetCachedResult(rCurVal);
++ else
++ pZelle->SetDirty();
+ }
+
+ GetXFRangeBuffer().SetXF( aScPos, nXF );
+diff --git sc/source/filter/excel/impop.cxx sc/source/filter/excel/impop.cxx
+index b532a58..28992c9 100644
+--- sc/source/filter/excel/impop.cxx
++++ sc/source/filter/excel/impop.cxx
+@@ -124,7 +124,8 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
+ ImportTyp( &rImpData.mrDoc, rImpData.meTextEnc ),
+ XclImpRoot( rImpData ),
+ maStrm( rStrm, GetRoot() ),
+- aIn( maStrm )
++ aIn( maStrm ),
++ pLastFormCell(NULL)
+ {
+ nBdshtTab = 0;
+ nIxfeIndex = 0; // zur Sicherheit auf 0
+@@ -352,6 +353,18 @@ void ImportExcel::ReadRk()
+ }
+ }
+
++void ImportExcel::ReadString()
++{
++ if (GetBiff() == EXC_BIFF8 && pLastFormCell)
++ {
++ sal_uInt16 nLen;
++ sal_uInt8 nOpt;
++ maStrm >> nLen >> nOpt;
++ String aStr = maStrm.ReadUniString(nLen, nOpt);
++ pLastFormCell->SetCachedResult(aStr);
++ }
++}
++
+
+ void ImportExcel::Window1()
+ {
+diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
+index a868e17..3855335 100644
+--- sc/source/filter/excel/read.cxx
++++ sc/source/filter/excel/read.cxx
+@@ -1094,6 +1094,7 @@ FltError ImportExcel8::Read( void )
+ case EXC_ID2_BOOLERR:
+ case EXC_ID3_BOOLERR: ReadBoolErr(); break;
+ case EXC_ID_RK: ReadRk(); break;
++ case EXC_ID3_STRING: ReadString(); break;
+
+ case 0x0006:
+ case 0x0206:
+@@ -1171,10 +1172,16 @@ FltError ImportExcel8::Read( void )
+
+ pProgress.reset();
+
++#if 0
++ // Excel documents look much better without this call; better in the
++ // sense that the row heights are near-identical to the original
++ // heights in Excel (running on Linux via wine). We need to test this
++ // on Windows to see how it looks there.
+ AdjustRowHeight();
++#endif
+ PostDocLoad();
+
+- pD->CalcAfterLoad();
++ pD->CalcAfterLoad(false);
+
+ // import change tracking data
+ XclImpChangeTrack aImpChTr( GetRoot(), maStrm );
+diff --git sc/source/filter/inc/fdumper.hxx sc/source/filter/inc/fdumper.hxx
+index aea8de6..8f57403 100644
+--- sc/source/filter/inc/fdumper.hxx
++++ sc/source/filter/inc/fdumper.hxx
+@@ -31,7 +31,7 @@
+ #ifndef SC_FDUMPER_HXX
+ #define SC_FDUMPER_HXX
+
+-#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0)
++#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0
+
+ #include <map>
+ #include <math.h>
+diff --git sc/source/filter/inc/imp_op.hxx sc/source/filter/inc/imp_op.hxx
+index 4a7e8c6..8969ef3 100644
+--- sc/source/filter/inc/imp_op.hxx
++++ sc/source/filter/inc/imp_op.hxx
+@@ -127,6 +127,7 @@ protected:
+ void ReadLabel();
+ void ReadBoolErr();
+ void ReadRk();
++ void ReadString();
+
+ void Window1();
+ void Formula25( void ); // 0x06 -> excform.cxx
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]