incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject svn commit: r1391286 - in /incubator/ooo/trunk/main/sc: inc/ source/core/data/ source/filter/excel/
Date Fri, 28 Sep 2012 03:07:23 GMT
Author: leiw
Date: Fri Sep 28 03:07:22 2012
New Revision: 1391286

URL: http://svn.apache.org/viewvc?rev=1391286&view=rev
Log:
#i119707 Cell border lost when saving and reopening the attached xls file. 

          Patch by: Zhang Lu
          Review by: Wang Lei

Modified:
    incubator/ooo/trunk/main/sc/inc/attarray.hxx
    incubator/ooo/trunk/main/sc/inc/column.hxx
    incubator/ooo/trunk/main/sc/inc/document.hxx
    incubator/ooo/trunk/main/sc/inc/table.hxx
    incubator/ooo/trunk/main/sc/source/core/data/attarray.cxx
    incubator/ooo/trunk/main/sc/source/core/data/column2.cxx
    incubator/ooo/trunk/main/sc/source/core/data/documen4.cxx
    incubator/ooo/trunk/main/sc/source/core/data/table1.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xetable.cxx

Modified: incubator/ooo/trunk/main/sc/inc/attarray.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/attarray.hxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/attarray.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/attarray.hxx Fri Sep 28 03:07:22 2012
@@ -166,6 +166,10 @@ public:
 
     sal_Bool    GetFirstVisibleAttr( SCROW& rFirstRow ) const;
     sal_Bool    GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const;
+	/*
+	Get the last cell's row number , which have visual atribute or visual data in attribute
list
+	*/
+	sal_Bool    GetLastAttr( SCROW& rLastRow, SCROW nLastData ) const;
 	sal_Bool	HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 	sal_Bool	IsVisibleEqual( const ScAttrArray& rOther,
 							SCROW nStartRow, SCROW nEndRow ) const;

Modified: incubator/ooo/trunk/main/sc/inc/column.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/column.hxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/column.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/column.hxx Fri Sep 28 03:07:22 2012
@@ -171,6 +171,10 @@ public:
 
     sal_Bool        GetFirstVisibleAttr( SCROW& rFirstRow ) const;
     sal_Bool        GetLastVisibleAttr( SCROW& rLastRow ) const;
+	/*
+	Get the last cell's row number , which have visual atribute or visual data in a column
+	*/
+	sal_Bool		GetLastAttr( SCROW& rLastRow ) const;
 	sal_Bool		HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 	sal_Bool		IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
 									SCROW nEndRow = MAXROW ) 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=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/document.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/document.hxx Fri Sep 28 03:07:22 2012
@@ -956,6 +956,10 @@ public:
 										SCROW& rEndRow, sal_Bool bNotes = sal_True ) const;
 	void			InvalidateTableArea();
 
+	/*
+	Get the last cell's row number , which have visual atribute or visual data in specific table
+	*/
+	SC_DLLPUBLIC void			GetLastAttrCell( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow
) const;
 
     SC_DLLPUBLIC sal_Bool			GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow
) const;
 

Modified: incubator/ooo/trunk/main/sc/inc/table.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/table.hxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/table.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/table.hxx Fri Sep 28 03:07:22 2012
@@ -418,6 +418,10 @@ public:
 	sal_Bool		GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
 								SCROW& rEndRow, sal_Bool bNotes ) const;
 
+	/*
+	Get the last cell's postion, which has visual attribute or data and has max row number among
all columns.
+	*/
+	void		GetLastAttrCell( SCCOL& rEndCol, SCROW& rEndRow ) const;
 	sal_Bool		GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
 
 	void		ExtendPrintArea( OutputDevice* pDev,

Modified: incubator/ooo/trunk/main/sc/source/core/data/attarray.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/attarray.cxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/attarray.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/attarray.cxx Fri Sep 28 03:07:22 2012
@@ -1920,6 +1920,30 @@ sal_Bool ScAttrArray::GetLastVisibleAttr
     return bFound;
 }
 
+sal_Bool ScAttrArray::GetLastAttr( SCROW& rLastRow, SCROW nLastData ) const
+{
+    if ( nLastData == MAXROW )
+    {
+        rLastRow = MAXROW;
+        return sal_True;
+    }
+	sal_Bool bFound = sal_False;
+    SCSIZE nEndPos = nCount - 1;
+    SCSIZE nStartPos = nEndPos;
+    while ( nStartPos > 0 && pData[nStartPos-1].nRow > nLastData &&
+            !pData[nStartPos].pPattern->IsVisible() )
+        --nStartPos;
+	
+	if(nStartPos >= 0 && pData[nStartPos].nRow > nLastData)
+	{
+		bFound = sal_True;
+		rLastRow = pData[nStartPos].nRow;
+	}
+	else
+		rLastRow = nLastData;
+    return bFound;
+}
+
 
 sal_Bool ScAttrArray::HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const
 {

Modified: incubator/ooo/trunk/main/sc/source/core/data/column2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/column2.cxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/column2.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/column2.cxx Fri Sep 28 03:07:22 2012
@@ -1564,6 +1564,19 @@ sal_Bool ScColumn::GetLastVisibleAttr( S
         return sal_False;
 }
 
+sal_Bool ScColumn::GetLastAttr( SCROW& rLastRow ) const
+{
+    if ( pAttrArray )
+    {
+        // Row of last cell is needed, always including notes, 0 if none.
+        SCROW nLastData = GetLastVisDataPos( sal_True );
+        return pAttrArray->GetLastAttr( rLastRow, nLastData );
+    }
+    else
+    {
+        return sal_False;
+    }
+}
 sal_Bool ScColumn::HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const
 {
 	if (pAttrArray)

Modified: incubator/ooo/trunk/main/sc/source/core/data/documen4.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/documen4.cxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/documen4.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/documen4.cxx Fri Sep 28 03:07:22 2012
@@ -417,6 +417,14 @@ void ScDocument::InvalidateTableArea()
 	}
 }
 
+void ScDocument::GetLastAttrCell( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const
+{
+	if ( ValidTab( nTab ) && pTab[nTab] )
+	{
+		pTab[nTab]->GetLastAttrCell( rEndCol, rEndRow );
+	}
+}
+
 sal_Int32 ScDocument::GetMaxStringLen( SCTAB nTab, SCCOL nCol,
         SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const
 {

Modified: incubator/ooo/trunk/main/sc/source/core/data/table1.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/table1.cxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/table1.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/table1.cxx Fri Sep 28 03:07:22 2012
@@ -432,6 +432,24 @@ sal_Bool ScTable::GetTableArea( SCCOL& r
 	return bRet;
 }
 
+void ScTable::GetLastAttrCell( SCCOL& rEndCol, SCROW& rEndRow ) const
+{
+	SCCOL nMaxX = 0;
+	SCROW nMaxY = 0;
+	SCCOL i;
+	for ( i = 0; i <= MAXCOL; i++ )
+	{
+		SCROW nLastRow;
+		aCol[i].GetLastAttr( nLastRow );
+		if ( nLastRow > nMaxY && nLastRow > 0 && nLastRow <= MAXROW )
+		{
+			nMaxY = nLastRow;
+			nMaxX = i;
+		}
+	}
+	rEndCol = nMaxX;
+	rEndRow = nMaxY;
+}
 /*		vorher:
 
 	sal_Bool bFound = sal_False;

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xetable.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xetable.cxx?rev=1391286&r1=1391285&r2=1391286&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xetable.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xetable.cxx Fri Sep 28 03:07:22 2012
@@ -2358,6 +2358,16 @@ XclExpCellTable::XclExpCellTable( const 
     // range for cell iterator
     SCCOL nLastIterScCol = nMaxScCol;
     SCROW nLastIterScRow = ulimit_cast< SCROW >( nLastUsedScRow + 128, nMaxScRow );
+	// modified for 119707 by zhanglu
+	SCCOL rEndColAtt = 0;
+	SCROW rEndRowAtt = 0;
+	rDoc.GetLastAttrCell( nScTab, rEndColAtt,rEndRowAtt ); // To get the real last cell's row
number, which has visual data or attribute.
+	if( rEndRowAtt > nLastIterScRow )
+		nLastIterScRow = rEndRowAtt;
+
+	if (nLastIterScRow > nMaxScRow)
+		nLastIterScRow = nMaxScRow;
+	// modified for 119707 end
     ScUsedAreaIterator aIt( &rDoc, nScTab, 0, 0, nLastIterScCol, nLastIterScRow );
 
     // activate the correct segment and sub segment at the progress bar



Mime
View raw message