incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject svn commit: r1388427 - in /incubator/ooo/trunk/main/sc: inc/ source/core/data/ source/filter/excel/ source/filter/inc/
Date Fri, 21 Sep 2012 11:18:00 GMT
Author: leiw
Date: Fri Sep 21 11:17:59 2012
New Revision: 1388427

URL: http://svn.apache.org/viewvc?rev=1388427&view=rev
Log:
#i121073 Loading performance for xls file with row banded style is bad 

          Patch by: Wang Lei
          Review by: Wang Lei

Modified:
    incubator/ooo/trunk/main/sc/inc/column.hxx
    incubator/ooo/trunk/main/sc/inc/document.hxx
    incubator/ooo/trunk/main/sc/inc/patattr.hxx
    incubator/ooo/trunk/main/sc/inc/table.hxx
    incubator/ooo/trunk/main/sc/source/core/data/column.cxx
    incubator/ooo/trunk/main/sc/source/core/data/document.cxx
    incubator/ooo/trunk/main/sc/source/core/data/patattr.cxx
    incubator/ooo/trunk/main/sc/source/core/data/table2.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx
    incubator/ooo/trunk/main/sc/source/filter/inc/xistyle.hxx

Modified: incubator/ooo/trunk/main/sc/inc/column.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/column.hxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/column.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/column.hxx Fri Sep 21 11:17:59 2012
@@ -295,6 +295,7 @@ public:
 
 	const SfxPoolItem*		GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
 	const ScPatternAttr*	GetPattern( SCROW nRow ) const;
+	const ScPatternAttr* GetPatternRange( SCROW& rStartRow, SCROW& rEndRow, SCROW nRow
) const;
     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
 
 	sal_uLong		GetNumberFormat( SCROW nRow ) const;

Modified: incubator/ooo/trunk/main/sc/inc/document.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/document.hxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/document.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/document.hxx Fri Sep 21 11:17:59 2012
@@ -1228,6 +1228,9 @@ public:
 	SC_DLLPUBLIC void			ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
 											SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
 											const ScPatternAttr& rAttr );
+	SC_DLLPUBLIC void			ApplyPooledPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
+											SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
+											const ScPatternAttr& rPooledAttr, const ScPatternAttr& rAttr );
 	SC_DLLPUBLIC void			ApplyPatternIfNumberformatIncompatible(
 							const ScRange& rRange, const ScMarkData& rMark,
 							const ScPatternAttr& rPattern, short nNewType );

Modified: incubator/ooo/trunk/main/sc/inc/patattr.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/patattr.hxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/patattr.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/patattr.hxx Fri Sep 21 11:17:59 2012
@@ -26,6 +26,7 @@
 
 #include <svl/poolitem.hxx>
 #include <svl/itemset.hxx>
+#include <svl/brdcst.hxx>
 #include <unotools/fontcvt.hxx>
 #include <editeng/svxenum.hxx>
 #include "scdllapi.h"
@@ -52,7 +53,7 @@ enum ScAutoFontColorMode
 };
 
 
-class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem
+class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem, public SfxBroadcaster
 {
 	String*			pName;
 	ScStyleSheet*	pStyle;

Modified: incubator/ooo/trunk/main/sc/inc/table.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/table.hxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/table.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/table.hxx Fri Sep 21 11:17:59 2012
@@ -547,6 +547,8 @@ public:
 	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
 	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
 	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
const ScPatternAttr& rAttr );
+	void		ApplyPooledPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
const ScPatternAttr& rPooledAttr, const ScPatternAttr& rAttr ); 
+
 	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool
= sal_False )
 					{
                         if (ValidColRow(rPos.Col(),rPos.Row()))

Modified: incubator/ooo/trunk/main/sc/source/core/data/column.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/column.cxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/column.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/column.cxx Fri Sep 21 11:17:59 2012
@@ -319,6 +319,10 @@ const ScPatternAttr* ScColumn::GetPatter
 	return pAttrArray->GetPattern( nRow );
 }
 
+const ScPatternAttr* ScColumn::GetPatternRange( SCROW& rStartRow, SCROW& rEndRow,
SCROW nRow ) const
+{
+	return pAttrArray->GetPatternRange( rStartRow, rEndRow, nRow );
+}
 
 const SfxPoolItem* ScColumn::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const
 {

Modified: incubator/ooo/trunk/main/sc/source/core/data/document.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/document.cxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/document.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/document.cxx Fri Sep 21 11:17:59 2012
@@ -3941,6 +3941,14 @@ void ScDocument::ApplyPatternAreaTab( SC
 			pTab[nTab]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr );
 }
 
+void ScDocument::ApplyPooledPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
+						SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr& rPooledAttr, const
ScPatternAttr& rAttr )
+{
+	if (VALIDTAB(nTab))
+		if (pTab[nTab])
+			pTab[nTab]->ApplyPooledPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rPooledAttr,
rAttr );
+}
+
 void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
 		const ScMarkData& rMark, const ScPatternAttr& rPattern, short nNewType )
 {

Modified: incubator/ooo/trunk/main/sc/source/core/data/patattr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/patattr.cxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/patattr.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/patattr.cxx Fri Sep 21 11:17:59 2012
@@ -118,6 +118,7 @@ ScPatternAttr::ScPatternAttr( const ScPa
 __EXPORT ScPatternAttr::~ScPatternAttr()
 {
 	delete pName;
+	Broadcast(SfxHint());
 }
 
 SfxPoolItem* __EXPORT ScPatternAttr::Clone( SfxItemPool *pPool ) const

Modified: incubator/ooo/trunk/main/sc/source/core/data/table2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/table2.cxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/table2.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/table2.cxx Fri Sep 21 11:17:59 2012
@@ -1906,6 +1906,29 @@ void ScTable::ApplyPatternArea( SCCOL nS
 	}
 }
 
+void ScTable::ApplyPooledPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW
nEndRow,
+									 const ScPatternAttr& rPooledAttr, const ScPatternAttr& rAttr )
+{
+	if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
+	{
+		PutInOrder(nStartCol, nEndCol);
+		PutInOrder(nStartRow, nEndRow);
+		for (SCCOL i = nStartCol; i <= nEndCol; i++)
+		{
+			sal_Bool bSet = sal_True;
+			SCROW nStar, nEnd;
+			const ScPatternAttr* pAttr = aCol[i].GetPatternRange(nStar, nEnd, nStartRow);
+			if (nStar >nStartRow || nEnd < nEndRow || pAttr!=pDocument->GetDefPattern())
+				bSet = sal_False; 
+
+			if (bSet) 
+				aCol[i].SetPatternArea(nStartRow, nEndRow, rPooledAttr);				
+			else		
+				aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr);
+		}
+	}
+}
+
 void ScTable::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
 		const ScPatternAttr& rPattern, short nNewType )
 {

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xistyle.cxx Fri Sep 21 11:17:59 2012
@@ -982,7 +982,8 @@ XclImpXF::XclImpXF( const XclImpRoot& rR
     XclImpRoot( rRoot ),
     mpStyleSheet( 0 ),
     mnXclNumFmt( 0 ),
-    mnXclFont( 0 )
+    mnXclFont( 0 ),
+	mpPooledPattern( 0 )
 {
 }
 
@@ -1199,10 +1200,33 @@ void XclImpXF::ApplyPattern(
 
     // insert into document
     ScDocument& rDoc = GetDoc();
-    if( IsCellXF() && mpStyleSheet )
-        rDoc.ApplyStyleAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, *mpStyleSheet
);
-    if( HasUsedFlags() )
-        rDoc.ApplyPatternAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, rPattern );
+	sal_Bool bApplyPattern = sal_False;
+
+	if (IsCellXF() && mpPooledPattern && mpPooledPattern->GetRefCount()>0
&& mpPooledPattern->GetRefCount() <= SFX_ITEMS_MAXREF)
+	{
+		rDoc.ApplyPooledPatternAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, *mpPooledPattern,
rPattern );
+		mpPooledPattern->AddRef();
+	}
+	else
+	{
+		if( IsCellXF() && mpStyleSheet )
+		{
+			rDoc.ApplyStyleAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, *mpStyleSheet );
+			bApplyPattern = sal_True;
+		}
+		if( HasUsedFlags() )
+		{
+			rDoc.ApplyPatternAreaTab( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, rPattern );
+			bApplyPattern = sal_True;
+		}
+	}		
+
+	if (IsCellXF() && !mpPooledPattern && bApplyPattern)
+	{
+		mpPooledPattern = rDoc.GetPattern(nScCol1, nScRow1, nScTab);
+		ScPatternAttr* pPooledPattern = const_cast<ScPatternAttr*>(mpPooledPattern);
+		StartListening(*pPooledPattern);
+	}
 
     // #108770# apply special number format
     if( nForceScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -1213,6 +1237,11 @@ void XclImpXF::ApplyPattern(
     }
 }
 
+void XclImpXF::Notify(SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+	mpPooledPattern = 0;
+}
+
 /*static*/ void XclImpXF::ApplyPatternForBiff2CellFormat( const XclImpRoot& rRoot,
         const ScAddress& rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3
)
 {

Modified: incubator/ooo/trunk/main/sc/source/filter/inc/xistyle.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/inc/xistyle.hxx?rev=1388427&r1=1388426&r2=1388427&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/inc/xistyle.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/inc/xistyle.hxx Fri Sep 21 11:17:59 2012
@@ -26,6 +26,7 @@
 
 #include <list>
 #include <tools/mempool.hxx>
+#include <svl/lstner.hxx>
 #include "rangelst.hxx"
 #include "patattr.hxx"
 #include "xladdress.hxx"
@@ -387,7 +388,7 @@ inline bool operator!=( const XclImpXFIn
 // ----------------------------------------------------------------------------
 
 /** Contains all data of a XF record and a Calc item set. */
-class XclImpXF : public XclXFBase, protected XclImpRoot, ScfNoCopy
+class XclImpXF : public XclXFBase, protected XclImpRoot, ScfNoCopy, public SfxListener
 {
 public:
     explicit            XclImpXF( const XclImpRoot& rRoot );
@@ -413,7 +414,7 @@ public:
                             SCCOL nScCol2, SCROW nScRow2,
                             SCTAB nScTab,
                             sal_uLong nForceScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND );
-
+	virtual void 		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
     /** Converts formatting information from BIFF2 cell record data directly. */
     static void         ApplyPatternForBiff2CellFormat(
                             const XclImpRoot& rRoot, const ScAddress& rScPos,
@@ -435,6 +436,7 @@ private:
     typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr;
 
     ScPatternAttrPtr    mpPattern;          /// Calc item set.
+	const ScPatternAttr*    mpPooledPattern;
     ScStyleSheet*       mpStyleSheet;       /// Calc cell style sheet.
 
     XclImpCellProt      maProtection;       /// Cell protection flags.



Mime
View raw message