2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsCellMap_h__
|
|
|
|
#define nsCellMap_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
1998-07-11 04:47:29 +04:00
|
|
|
#include "celldata.h"
|
1998-09-15 21:58:24 +04:00
|
|
|
#include "nsVoidArray.h"
|
2002-02-19 18:48:28 +03:00
|
|
|
#include "nsRect.h"
|
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
class nsTableColFrame;
|
|
|
|
class nsTableCellFrame;
|
1999-12-14 01:56:31 +03:00
|
|
|
class nsIPresContext;
|
2000-01-13 08:29:38 +03:00
|
|
|
class nsTableRowGroupFrame;
|
|
|
|
class nsTableFrame;
|
|
|
|
class nsCellMap;
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
struct nsColInfo
|
|
|
|
{
|
|
|
|
PRInt32 mNumCellsOrig; // number of cells originating in the col
|
|
|
|
PRInt32 mNumCellsSpan; // number of cells spanning into the col via colspans (not rowspans)
|
2000-02-01 06:23:29 +03:00
|
|
|
// for simplicity, a colspan=0 cell is only counted as spanning the
|
|
|
|
// 1st col to the right of where it orginates
|
1999-12-14 01:56:31 +03:00
|
|
|
nsColInfo();
|
|
|
|
nsColInfo(PRInt32 aNumCellsOrig,
|
|
|
|
PRInt32 aNumCellsSpan);
|
|
|
|
};
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
enum Corner
|
|
|
|
{
|
|
|
|
eTopLeft = 0,
|
|
|
|
eTopRight = 1,
|
|
|
|
eBottomRight = 2,
|
|
|
|
eBottomLeft = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BCInfo
|
|
|
|
{
|
|
|
|
nsVoidArray mRightBorders;
|
|
|
|
nsVoidArray mBottomBorders;
|
|
|
|
BCData mLowerRightCorner;
|
|
|
|
};
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
class nsTableCellMap
|
|
|
|
{
|
|
|
|
public:
|
2002-02-19 18:48:28 +03:00
|
|
|
nsTableCellMap(nsIPresContext* aPresContext,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
PRBool aBorderCollapse);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
/** destructor
|
|
|
|
* NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
|
|
|
|
*/
|
|
|
|
~nsTableCellMap();
|
|
|
|
|
|
|
|
void RemoveGroupCellMap(nsTableRowGroupFrame* aRowGroup);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2000-09-14 10:49:47 +04:00
|
|
|
void InsertGroupCellMap(nsTableRowGroupFrame& aNewRowGroup,
|
|
|
|
nsTableRowGroupFrame*& aPrevRowGroup);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
nsCellMap* GetMapFor(nsTableRowGroupFrame& aRowGroup);
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
nsTableCellFrame* GetCellFrame(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
CellData& aData,
|
|
|
|
PRBool aUseRowIfOverlap) const;
|
|
|
|
|
|
|
|
/** return the CellData for the cell at (aTableRowIndex, aTableColIndex) */
|
2002-02-19 18:48:28 +03:00
|
|
|
CellData* GetDataAt(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool aUpdateZeroSpan = PR_TRUE);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
nsColInfo* GetColInfoAt(PRInt32 aColIndex);
|
|
|
|
|
|
|
|
/** append the cellFrame at the end of the row at aRowIndex and return the col index
|
|
|
|
*/
|
2002-02-19 18:48:28 +03:00
|
|
|
CellData* AppendCell(nsTableCellFrame& aCellFrame,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRBool aRebuildIfNecessary,
|
|
|
|
nsRect& aDamageArea);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
void InsertCells(nsVoidArray& aCellFrames,
|
|
|
|
PRInt32 aRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aColIndexBefore,
|
|
|
|
nsRect& aDamageArea);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
void RemoveCell(nsTableCellFrame* aCellFrame,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aRowIndex,
|
|
|
|
nsRect& aDamageArea);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void InsertRows(nsIPresContext* aPresContext,
|
|
|
|
nsTableRowGroupFrame& aRowGroup,
|
2000-01-13 08:29:38 +03:00
|
|
|
nsVoidArray& aRows,
|
|
|
|
PRInt32 aFirstRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aConsiderSpans,
|
|
|
|
nsRect& aDamageArea);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void RemoveRows(nsIPresContext* aPresContext,
|
|
|
|
PRInt32 aFirstRowIndex,
|
|
|
|
PRInt32 aNumRowsToRemove,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aConsiderSpans,
|
|
|
|
nsRect& aDamageArea);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2000-05-11 05:04:39 +04:00
|
|
|
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRInt32 GetEffectiveRowSpan(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex);
|
|
|
|
PRInt32 GetEffectiveColSpan(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
/** return the total number of columns in the table represented by this CellMap */
|
|
|
|
PRInt32 GetColCount() const;
|
|
|
|
|
|
|
|
/** return the actual number of rows in the table represented by this CellMap */
|
|
|
|
PRInt32 GetRowCount() const;
|
|
|
|
|
|
|
|
nsTableCellFrame* GetCellInfoAt(PRInt32 aRowX,
|
|
|
|
PRInt32 aColX,
|
|
|
|
PRBool* aOriginates = nsnull,
|
|
|
|
PRInt32* aColSpan = nsnull);
|
|
|
|
|
|
|
|
void AddColsAtEnd(PRUint32 aNumCols);
|
2001-05-17 16:40:27 +04:00
|
|
|
void RemoveColsAtEnd();
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
PRBool RowIsSpannedInto(PRInt32 aRowIndex);
|
|
|
|
PRBool RowHasSpanningCells(PRInt32 aRowIndex);
|
|
|
|
PRBool ColIsSpannedInto(PRInt32 aColIndex);
|
|
|
|
PRBool ColHasSpanningCells(PRInt32 aColIndex);
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
BCData* GetBCData(PRUint8 aSide,
|
|
|
|
nsCellMap& aCellMap,
|
|
|
|
PRUint32 aYPos,
|
|
|
|
PRUint32 aXPos,
|
|
|
|
PRBool aIsLowerRight = PR_FALSE);
|
|
|
|
|
|
|
|
void SetBCBorderEdge(PRUint8 aEdge,
|
|
|
|
nsCellMap& aCellMap,
|
|
|
|
PRUint32 aCellMapStart,
|
|
|
|
PRUint32 aYPos,
|
|
|
|
PRUint32 aXPos,
|
|
|
|
PRUint32 aLength,
|
|
|
|
BCBorderOwner aOwner,
|
|
|
|
nscoord aSize,
|
|
|
|
PRBool aChanged);
|
|
|
|
|
|
|
|
void SetBCBorderCorner(Corner aCorner,
|
|
|
|
nsCellMap& aCellMap,
|
|
|
|
PRUint32 aCellMapStart,
|
|
|
|
PRUint32 aYPos,
|
|
|
|
PRUint32 aXPos,
|
|
|
|
PRUint8 aOwner,
|
|
|
|
nscoord aSubSize,
|
|
|
|
PRBool aBevel,
|
|
|
|
PRBool aIsBottomRight = PR_FALSE);
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
/** dump a representation of the cell map to stdout for debugging */
|
|
|
|
#ifdef NS_DEBUG
|
2001-11-20 03:58:53 +03:00
|
|
|
void Dump(char* aString = nsnull) const;
|
2000-01-13 08:29:38 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2002-02-19 18:48:28 +03:00
|
|
|
BCData* GetRightMostBorder(PRInt32 aRowIndex);
|
|
|
|
BCData* GetBottomMostBorder(PRInt32 aColIndex);
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
friend class nsCellMap;
|
2002-02-19 18:48:28 +03:00
|
|
|
friend class BCMapCellIterator;
|
|
|
|
friend class BCMapBorderIterator;
|
2000-01-13 08:29:38 +03:00
|
|
|
void InsertGroupCellMap(nsCellMap* aPrevMap,
|
|
|
|
nsCellMap& aNewMap);
|
2002-02-19 18:48:28 +03:00
|
|
|
void DeleteRightBottomBorders();
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
nsTableFrame& mTableFrame;
|
2001-09-07 01:11:44 +04:00
|
|
|
nsAutoVoidArray mCols;
|
2002-02-19 18:48:28 +03:00
|
|
|
nsCellMap* mFirstMap;
|
|
|
|
// border collapsing info
|
|
|
|
BCInfo* mBCInfo;
|
2000-01-13 08:29:38 +03:00
|
|
|
};
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** nsCellMap is a support class for nsTablePart.
|
|
|
|
* It maintains an Rows x Columns grid onto which the cells of the table are mapped.
|
|
|
|
* This makes processing of rowspan and colspan attributes much easier.
|
|
|
|
* Each cell is represented by a CellData object.
|
|
|
|
*
|
|
|
|
* @see CellData
|
1998-09-01 01:23:28 +04:00
|
|
|
* @see nsTableFrame::AddCellToMap
|
1998-06-17 20:38:24 +04:00
|
|
|
* @see nsTableFrame::GrowCellMap
|
|
|
|
* @see nsTableFrame::BuildCellIntoMap
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
1998-09-01 01:23:28 +04:00
|
|
|
* mRows is an array of rows. a row cannot be null.
|
|
|
|
* each row is an array of cells. a cell can be null.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
class nsCellMap
|
|
|
|
{
|
|
|
|
public:
|
1998-09-01 01:23:28 +04:00
|
|
|
/** constructor
|
1999-07-28 12:09:02 +04:00
|
|
|
* @param aNumRows - initial number of rows
|
|
|
|
* @param aNumColumns - initial number of columns
|
1998-09-19 02:37:14 +04:00
|
|
|
*/
|
2000-01-13 08:29:38 +03:00
|
|
|
nsCellMap(nsTableRowGroupFrame& aRowGroupFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** destructor
|
|
|
|
* NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
|
1999-07-28 12:09:02 +04:00
|
|
|
*/
|
1998-04-14 00:24:54 +04:00
|
|
|
~nsCellMap();
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
nsCellMap* GetNextSibling() const;
|
|
|
|
void SetNextSibling(nsCellMap* aSibling);
|
|
|
|
|
|
|
|
nsTableRowGroupFrame* GetRowGroup() const;
|
|
|
|
|
|
|
|
nsTableCellFrame* GetCellFrame(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
CellData& aData,
|
|
|
|
PRBool aUseRowSpanIfOverlap) const;
|
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
/** append the cellFrame at the end of the row at aRowIndex and return the col index
|
|
|
|
*/
|
2002-02-19 18:48:28 +03:00
|
|
|
CellData* AppendCell(nsTableCellMap& aMap,
|
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRBool aRebuildIfNecessary,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void InsertCells(nsTableCellMap& aMap,
|
|
|
|
nsVoidArray& aCellFrames,
|
|
|
|
PRInt32 aRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aColIndexBefore,
|
|
|
|
nsRect& aDamageArea);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void RemoveCell(nsTableCellMap& aMap,
|
|
|
|
nsTableCellFrame* aCellFrame,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aRowIndex,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void InsertRows(nsIPresContext* aPresContext,
|
|
|
|
nsTableCellMap& aMap,
|
2000-01-13 08:29:38 +03:00
|
|
|
nsVoidArray& aRows,
|
|
|
|
PRInt32 aFirstRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aConsiderSpans,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void RemoveRows(nsIPresContext* aPresContext,
|
|
|
|
nsTableCellMap& aMap,
|
2000-01-13 08:29:38 +03:00
|
|
|
PRInt32 aFirstRowIndex,
|
|
|
|
PRInt32 aNumRowsToRemove,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aConsiderSpans,
|
|
|
|
nsRect& aDamageArea);
|
1999-02-11 09:22:33 +03:00
|
|
|
|
1999-08-26 01:49:18 +04:00
|
|
|
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
|
|
|
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
1999-02-11 09:22:33 +03:00
|
|
|
|
2001-03-29 01:25:13 +04:00
|
|
|
/** return the number of rows in the table represented by this CellMap */
|
|
|
|
PRInt32 GetRowCount(PRBool aConsiderDeadRowSpanRows = PR_FALSE) const;
|
1998-07-11 04:00:31 +04:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
nsTableCellFrame* GetCellInfoAt(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowX,
|
|
|
|
PRInt32 aColX,
|
|
|
|
PRBool* aOriginates = nsnull,
|
|
|
|
PRInt32* aColSpan = nsnull);
|
1998-09-19 02:37:14 +04:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRBool RowIsSpannedInto(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRBool RowHasSpanningCells(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRBool ColHasSpanningCells(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aColIndex);
|
1999-08-19 23:52:37 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 GetRowSpan(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool aGetEffective,
|
|
|
|
PRBool& aIsZeroRowSpan);
|
|
|
|
|
|
|
|
PRInt32 GetEffectiveColSpan(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool& aIsZeroColSpan);
|
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** dump a representation of the cell map to stdout for debugging */
|
1999-07-28 12:09:02 +04:00
|
|
|
#ifdef NS_DEBUG
|
2002-02-19 18:48:28 +03:00
|
|
|
void Dump(PRBool aIsBorderCollapse) const;
|
1999-07-28 12:09:02 +04:00
|
|
|
#endif
|
|
|
|
|
1999-10-02 04:02:54 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const;
|
|
|
|
#endif
|
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
protected:
|
2000-01-13 08:29:38 +03:00
|
|
|
friend class nsTableCellMap;
|
2002-02-19 18:48:28 +03:00
|
|
|
friend class BCMapCellIterator;
|
|
|
|
friend class BCMapBorderIterator;
|
|
|
|
friend class nsTableFrame;
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
PRBool Grow(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aNumRows,
|
|
|
|
PRInt32 aRowIndex = -1);
|
|
|
|
|
|
|
|
void GrowRow(nsVoidArray& aRow,
|
|
|
|
PRInt32 aNumCols);
|
1999-07-28 12:09:02 +04:00
|
|
|
|
|
|
|
/** assign aCellData to the cell at (aRow,aColumn) */
|
2002-02-19 18:48:28 +03:00
|
|
|
void SetDataAt(nsTableCellMap& aMap,
|
|
|
|
CellData& aCellData,
|
|
|
|
PRInt32 aMapRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool aCountZeroSpanAsSpan);
|
1999-07-28 12:09:02 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
CellData* GetDataAt(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aMapRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool aUpdateZeroSpan);
|
1999-07-28 12:09:02 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
PRInt32 GetNumCellsIn(PRInt32 aColIndex) const;
|
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void ExpandWithRows(nsIPresContext* aPresContext,
|
|
|
|
nsTableCellMap& aMap,
|
2000-01-13 08:29:38 +03:00
|
|
|
nsVoidArray& aRowFrames,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aStartRowIndex,
|
|
|
|
nsRect& aDamageArea);
|
1999-07-28 12:09:02 +04:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void ExpandWithCells(nsTableCellMap& aMap,
|
|
|
|
nsVoidArray& aCellFrames,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRInt32 aRowSpan,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aRowSpanIsZero,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void ShrinkWithoutRows(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aFirstRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aNumRowsToRemove,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void ShrinkWithoutCell(nsTableCellMap& aMap,
|
|
|
|
nsTableCellFrame& aCellFrame,
|
1999-12-14 01:56:31 +03:00
|
|
|
PRInt32 aRowIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aColIndex,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void RebuildConsideringRows(nsIPresContext* aPresContext,
|
|
|
|
nsTableCellMap& aMap,
|
2000-01-13 08:29:38 +03:00
|
|
|
PRInt32 aStartRowIndex,
|
|
|
|
nsVoidArray* aRowsToInsert,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRInt32 aNumRowsToRemove,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void RebuildConsideringCells(nsTableCellMap& aMap,
|
|
|
|
nsVoidArray* aCellFrames,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool aInsert,
|
|
|
|
nsRect& aDamageArea);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRBool CellsSpanOut(nsIPresContext* aPresContext,
|
|
|
|
nsVoidArray& aNewRows);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRBool CellsSpanInOrOut(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aStartRowIndex,
|
|
|
|
PRInt32 aEndRowIndex,
|
|
|
|
PRInt32 aStartColIndex,
|
|
|
|
PRInt32 aEndColIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
void ExpandForZeroSpan(nsTableCellFrame* aCellFrame,
|
|
|
|
PRInt32 aNumColsInTable);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
PRBool CreateEmptyRow(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aNumCols);
|
2000-01-04 08:31:56 +03:00
|
|
|
|
2000-02-01 06:23:29 +03:00
|
|
|
PRInt32 GetRowSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRBool& aIsZeroRowSpan);
|
|
|
|
|
|
|
|
PRInt32 GetColSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRInt32 aNumColsInTable,
|
|
|
|
PRBool& aIsZeroColSpan);
|
|
|
|
|
|
|
|
void AdjustForZeroSpan(nsTableCellMap& aMap,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex);
|
2000-01-13 08:29:38 +03:00
|
|
|
|
|
|
|
PRBool IsZeroColSpan(PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex) const;
|
2000-01-04 08:31:56 +03:00
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
/** an array containing col array. It can be larger than mRowCount due to
|
|
|
|
* row spans extending beyond the table */
|
2001-09-07 01:11:44 +04:00
|
|
|
nsAutoVoidArray mRows;
|
1999-07-28 12:09:02 +04:00
|
|
|
|
|
|
|
/** the number of rows in the table which is <= the number of rows in the cell map
|
|
|
|
* due to row spans extending beyond the end of the table (dead rows) */
|
|
|
|
PRInt32 mRowCount;
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
// the row group that corresponds to this map
|
|
|
|
nsTableRowGroupFrame* mRowGroupFrame;
|
|
|
|
|
|
|
|
// the next row group cell map
|
|
|
|
nsCellMap* mNextSibling;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
/* ----- inline methods ----- */
|
2000-01-13 08:29:38 +03:00
|
|
|
inline PRInt32 nsTableCellMap::GetColCount() const
|
1999-07-28 12:09:02 +04:00
|
|
|
{
|
2000-01-13 08:29:38 +03:00
|
|
|
return mCols.Count();
|
1999-07-28 12:09:02 +04:00
|
|
|
}
|
1998-07-11 04:00:31 +04:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
inline nsCellMap* nsCellMap::GetNextSibling() const
|
1998-06-08 23:57:04 +04:00
|
|
|
{
|
2000-01-13 08:29:38 +03:00
|
|
|
return mNextSibling;
|
1998-06-08 23:57:04 +04:00
|
|
|
}
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
inline void nsCellMap::SetNextSibling(nsCellMap* aSibling)
|
|
|
|
{
|
|
|
|
mNextSibling = aSibling;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsTableRowGroupFrame* nsCellMap::GetRowGroup() const
|
|
|
|
{
|
|
|
|
return mRowGroupFrame;
|
1998-06-08 23:57:04 +04:00
|
|
|
}
|
|
|
|
|
2001-03-29 01:25:13 +04:00
|
|
|
inline PRInt32 nsCellMap::GetRowCount(PRBool aConsiderDeadRowSpanRows) const
|
1998-06-08 23:57:04 +04:00
|
|
|
{
|
2001-03-29 01:25:13 +04:00
|
|
|
PRInt32 rowCount = (aConsiderDeadRowSpanRows) ? mRows.Count() : mRowCount;
|
|
|
|
return rowCount;
|
1998-06-08 23:57:04 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
// nsColInfo
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
inline nsColInfo::nsColInfo()
|
|
|
|
:mNumCellsOrig(0), mNumCellsSpan(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
inline nsColInfo::nsColInfo(PRInt32 aNumCellsOrig,
|
|
|
|
PRInt32 aNumCellsSpan)
|
|
|
|
:mNumCellsOrig(aNumCellsOrig), mNumCellsSpan(aNumCellsSpan)
|
|
|
|
{}
|
1998-10-14 20:32:45 +04:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif
|