1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
1998-07-11 04:00:31 +04:00
|
|
|
|
|
|
|
#include "nsVoidArray.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsCellMap.h"
|
1998-07-07 05:06:51 +04:00
|
|
|
#include "nsTableFrame.h"
|
1998-09-19 02:37:14 +04:00
|
|
|
#include "nsTableCellFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
#ifdef NS_DEBUG
|
1998-09-01 01:23:28 +04:00
|
|
|
static PRBool gsDebug = PR_FALSE;
|
1998-04-14 00:24:54 +04:00
|
|
|
#else
|
1998-09-01 01:23:28 +04:00
|
|
|
static const PRBool gsDebug = PR_FALSE;
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
nsCellMap::nsCellMap(int aRowCount, int aColCount)
|
|
|
|
: mRowCount(0),
|
|
|
|
mColCount(0),
|
|
|
|
mTotalRowCount(0)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
mRows = nsnull;
|
1998-07-11 04:00:31 +04:00
|
|
|
mColFrames = nsnull;
|
1998-08-19 19:43:51 +04:00
|
|
|
mMinColSpans = nsnull;
|
1998-09-01 01:23:28 +04:00
|
|
|
Reset(aRowCount, aColCount);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCellMap::~nsCellMap()
|
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
if (nsnull!=mRows)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-03 01:51:01 +04:00
|
|
|
for (int i=mTotalRowCount-1; 0<=i; i--)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
nsVoidArray *row = (nsVoidArray *)(mRows->ElementAt(i));
|
1998-09-03 01:51:01 +04:00
|
|
|
for (int j=mColCount-1; 0<=j ;j--)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
CellData* data = (CellData *)(row->ElementAt(j));
|
1998-07-11 04:00:31 +04:00
|
|
|
if (data != nsnull)
|
|
|
|
{
|
|
|
|
delete data;
|
|
|
|
}
|
|
|
|
}
|
1998-09-01 01:23:28 +04:00
|
|
|
delete row;
|
1998-07-11 04:00:31 +04:00
|
|
|
}
|
1998-09-01 01:23:28 +04:00
|
|
|
delete mRows;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-08-19 19:43:51 +04:00
|
|
|
if (nsnull != mColFrames)
|
1998-07-11 04:00:31 +04:00
|
|
|
delete mColFrames;
|
1998-09-03 01:51:01 +04:00
|
|
|
// mMinColSpans may be null, it is only set for tables that need it
|
1998-08-19 19:43:51 +04:00
|
|
|
if (nsnull != mMinColSpans)
|
|
|
|
delete [] mMinColSpans;
|
1998-09-01 01:23:28 +04:00
|
|
|
mRows = nsnull;
|
1998-07-11 04:00:31 +04:00
|
|
|
mColFrames = nsnull;
|
1998-08-19 19:43:51 +04:00
|
|
|
mMinColSpans = nsnull;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
void nsCellMap::Reset(int aRowCount, int aColCount)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
if (gsDebug) printf("calling Reset(%d,%d) with mRC=%d, mCC=%d, mTRC=%d\n",
|
|
|
|
aRowCount, aColCount, mRowCount, mColCount, mTotalRowCount);
|
1998-07-11 04:00:31 +04:00
|
|
|
if (nsnull==mColFrames)
|
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
mColFrames = new nsVoidArray(); // don't give the array a count, because null col frames are illegal (unlike null cell entries in a row)
|
1998-07-11 04:00:31 +04:00
|
|
|
}
|
|
|
|
|
1998-09-03 01:51:01 +04:00
|
|
|
if (nsnull==mRows)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
mRows = new nsVoidArray(); // don't give the array a count, because null rows are illegal (unlike null cell entries in a row)
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
// void arrays force the caller to handle null padding elements themselves
|
|
|
|
// so if the number of columns has increased, we need to add extra cols to each row
|
|
|
|
PRInt32 newCols = mColCount-aColCount;
|
|
|
|
for (PRInt32 rowIndex=0; rowIndex<mRowCount; rowIndex++)
|
|
|
|
{
|
|
|
|
nsVoidArray *row = (nsVoidArray *)(mRows->ElementAt(rowIndex));
|
|
|
|
const PRInt32 colsInRow = row->Count();
|
|
|
|
if (colsInRow == aColCount)
|
|
|
|
break; // we already have enough columns in each row
|
|
|
|
for (PRInt32 colIndex = colsInRow; colIndex<aColCount; colIndex++)
|
|
|
|
row->AppendElement(nsnull);
|
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
// if the number of rows has increased, add the extra rows
|
|
|
|
PRInt32 newRows = aRowCount-mTotalRowCount; // (new row count) - (total row allocation)
|
|
|
|
for ( ; newRows>0; newRows--)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
nsVoidArray *row;
|
|
|
|
if (0!=aColCount)
|
|
|
|
row = new nsVoidArray(aColCount);
|
|
|
|
else
|
|
|
|
row = new nsVoidArray();
|
|
|
|
mRows->AppendElement(row);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-09-01 01:23:28 +04:00
|
|
|
|
|
|
|
mRowCount = aRowCount;
|
|
|
|
mTotalRowCount = PR_MAX(mTotalRowCount, mRowCount);
|
1998-04-14 00:24:54 +04:00
|
|
|
mColCount = aColCount;
|
1998-09-01 01:23:28 +04:00
|
|
|
if (gsDebug) printf("leaving Reset with mRC=%d, mCC=%d, mTRC=%d\n",
|
|
|
|
mRowCount, mColCount, mTotalRowCount);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsCellMap::DumpCellMap() const
|
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
if (gsDebug==PR_TRUE)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
printf("Cell Map =\n");
|
1998-09-01 01:23:28 +04:00
|
|
|
for (int rowIndex=0; rowIndex<mRowCount ; rowIndex++)
|
|
|
|
{
|
|
|
|
nsVoidArray *row = (nsVoidArray *)(mRows->ElementAt(rowIndex));
|
|
|
|
for (int colIndex=0; colIndex<mColCount; colIndex++)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
CellData* data = (CellData *)(row->ElementAt(colIndex));
|
|
|
|
printf("Cell [%d,%d] = %p for index = %d\n", rowIndex, colIndex, data);
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-09-01 01:23:28 +04:00
|
|
|
}
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
}
|
1998-06-09 02:07:15 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
void nsCellMap::GrowToRow(PRInt32 aRowCount)
|
1998-06-09 02:07:15 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
Reset(aRowCount, mColCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsCellMap::GrowToCol(PRInt32 aColCount)
|
|
|
|
{
|
|
|
|
Reset(mRowCount, aColCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsCellMap::SetCellAt(CellData *aCell, int aRowIndex, int aColIndex)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull!=aCell, "bad aCell");
|
1998-09-03 02:55:37 +04:00
|
|
|
PRInt32 newRows = (aRowIndex+1)-mTotalRowCount; // add 1 to the "index" to get a "count"
|
1998-09-01 01:23:28 +04:00
|
|
|
if (0<newRows)
|
|
|
|
{
|
|
|
|
for ( ; newRows>0; newRows--)
|
|
|
|
{
|
|
|
|
nsVoidArray *row = new nsVoidArray(mColCount);
|
|
|
|
mRows->AppendElement(row);
|
|
|
|
}
|
|
|
|
mTotalRowCount = aRowIndex+1; // remember to always add 1 to an index when you want a count
|
|
|
|
}
|
|
|
|
|
|
|
|
CellData* cell = GetCellAt(aRowIndex,aColIndex);
|
1998-06-09 02:07:15 +04:00
|
|
|
if (cell != nsnull)
|
|
|
|
delete cell;
|
1998-09-01 01:23:28 +04:00
|
|
|
nsVoidArray *row = (nsVoidArray *)(mRows->ElementAt(aRowIndex));
|
|
|
|
row->ReplaceElementAt(aCell, aColIndex);
|
|
|
|
if (gsDebug) printf("leaving SetCellAt(%p,%d,%d) with mRC=%d, mCC=%d, mTRC=%d\n",
|
|
|
|
aCell, aRowIndex, aColIndex, mRowCount, mColCount, mTotalRowCount);
|
1998-06-09 02:07:15 +04:00
|
|
|
}
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
nsTableColFrame* nsCellMap::GetColumnFrame(PRInt32 aColIndex) const
|
1998-07-11 04:00:31 +04:00
|
|
|
{
|
1998-09-01 01:23:28 +04:00
|
|
|
NS_ASSERTION(nsnull!=mColFrames, "bad state");
|
1998-07-11 04:00:31 +04:00
|
|
|
return (nsTableColFrame *)(mColFrames->ElementAt(aColIndex));
|
|
|
|
}
|
|
|
|
|
1998-06-09 02:07:15 +04:00
|
|
|
|
1998-08-19 19:43:51 +04:00
|
|
|
void nsCellMap::SetMinColSpan(PRInt32 aColIndex, PRBool aColSpan)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aColIndex<mColCount, "bad aColIndex");
|
1998-09-03 10:15:18 +04:00
|
|
|
NS_ASSERTION(aColSpan>=1, "bad aColSpan");
|
1998-08-19 19:43:51 +04:00
|
|
|
|
|
|
|
// initialize the data structure if not already done
|
|
|
|
if (nsnull==mMinColSpans)
|
|
|
|
{
|
|
|
|
mMinColSpans = new PRInt32[mColCount];
|
|
|
|
for (PRInt32 i=0; i<mColCount; i++)
|
|
|
|
mMinColSpans[i]=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
mMinColSpans[aColIndex] = aColSpan;
|
|
|
|
}
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
PRInt32 nsCellMap::GetMinColSpan(PRInt32 aColIndex) const
|
1998-08-19 19:43:51 +04:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aColIndex<mColCount, "bad aColIndex");
|
|
|
|
|
|
|
|
PRInt32 result = 1; // default is 1, mMinColSpans need not be allocated for tables with no spans
|
|
|
|
if (nsnull!=mMinColSpans)
|
|
|
|
result = mMinColSpans[aColIndex];
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** return the index of the next column in aRowIndex that does not have a cell assigned to it */
|
|
|
|
PRInt32 nsCellMap::GetNextAvailColIndex(PRInt32 aRowIndex, PRInt32 aColIndex) const
|
|
|
|
{
|
|
|
|
PRInt32 result = 0;
|
|
|
|
if (aColIndex > mColCount)
|
|
|
|
{
|
|
|
|
result = aColIndex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (aRowIndex < mRowCount)
|
|
|
|
{
|
|
|
|
result = aColIndex;
|
|
|
|
nsVoidArray *row = (nsVoidArray *)(mRows->ElementAt(aRowIndex));
|
|
|
|
PRInt32 count = row->Count();
|
|
|
|
for (PRInt32 colIndex=aColIndex; colIndex<count; colIndex++)
|
|
|
|
{
|
|
|
|
void * data = row->ElementAt(colIndex);
|
|
|
|
if (nsnull==data)
|
|
|
|
{
|
|
|
|
result = colIndex;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
result++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
1998-07-24 20:51:16 +04:00
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** returns PR_TRUE if the row at aRowIndex has any cells that are the result
|
|
|
|
* of a row-spanning cell above it. So, given this table:<BR>
|
|
|
|
* <PRE>
|
|
|
|
* TABLE
|
|
|
|
* TR
|
|
|
|
* TD ROWSPAN=2
|
|
|
|
* TD
|
|
|
|
* TR
|
|
|
|
* TD
|
|
|
|
* </PRE>
|
|
|
|
* RowIsSpannedInto(0) returns PR_FALSE, and RowIsSpannedInto(1) returns PR_TRUE.
|
|
|
|
* @see RowHasSpanningCells
|
|
|
|
*/
|
|
|
|
// if computing this and related info gets expensive, we can easily
|
|
|
|
// cache it. The only thing to remember is to rebuild the cache
|
|
|
|
// whenever a row|col|cell is added/deleted, or a span attribute is changed.
|
|
|
|
PRBool nsCellMap::RowIsSpannedInto(PRInt32 aRowIndex)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION (0<=aRowIndex && aRowIndex<GetRowCount(), "bad row index arg");
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
PRInt32 colCount = GetColCount();
|
|
|
|
for (PRInt32 colIndex=0; colIndex<colCount; colIndex++)
|
|
|
|
{
|
|
|
|
CellData *cd = GetCellAt(aRowIndex, colIndex);
|
|
|
|
if (cd != nsnull)
|
|
|
|
{ // there's really a cell at (aRowIndex, colIndex)
|
|
|
|
if (nsnull==cd->mCell)
|
|
|
|
{ // the cell at (aRowIndex, colIndex) is the result of a span
|
|
|
|
nsTableCellFrame *cell = cd->mRealCell->mCell;
|
|
|
|
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
|
1999-02-11 04:16:28 +03:00
|
|
|
PRInt32 realRowIndex;
|
|
|
|
cell->GetRowIndex (realRowIndex);
|
1998-09-19 02:37:14 +04:00
|
|
|
if (realRowIndex!=aRowIndex)
|
|
|
|
{ // the span is caused by a rowspan
|
|
|
|
result = PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** returns PR_TRUE if the row at aRowIndex has any cells that have a rowspan>1
|
|
|
|
* So, given this table:<BR>
|
|
|
|
* <PRE>
|
|
|
|
* TABLE
|
|
|
|
* TR
|
|
|
|
* TD ROWSPAN=2
|
|
|
|
* TD
|
|
|
|
* TR
|
|
|
|
* TD
|
|
|
|
* </PRE>
|
|
|
|
* RowHasSpanningCells(0) returns PR_TRUE, and RowHasSpanningCells(1) returns PR_FALSE.
|
|
|
|
* @see RowIsSpannedInto
|
|
|
|
*/
|
|
|
|
PRBool nsCellMap::RowHasSpanningCells(PRInt32 aRowIndex)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION (0<=aRowIndex && aRowIndex<GetRowCount(), "bad row index arg");
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
const PRInt32 rowCount = GetRowCount();
|
|
|
|
if (aRowIndex!=rowCount-1)
|
|
|
|
{ // aRowIndex is not the last row, so we check the next row after aRowIndex for spanners
|
|
|
|
const PRInt32 colCount = GetColCount();
|
|
|
|
for (PRInt32 colIndex=0; colIndex<colCount; colIndex++)
|
|
|
|
{
|
|
|
|
PRInt32 nextRowIndex = aRowIndex+1;
|
|
|
|
CellData *cd =GetCellAt(nextRowIndex, colIndex);
|
|
|
|
if (cd != nsnull)
|
|
|
|
{ // there's really a cell at (nextRowIndex, colIndex)
|
|
|
|
if (nsnull==cd->mCell)
|
|
|
|
{ // the cell at (nextRowIndex, colIndex) is the result of a span
|
|
|
|
nsTableCellFrame *cell = cd->mRealCell->mCell;
|
|
|
|
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
|
1999-02-11 04:16:28 +03:00
|
|
|
PRInt32 realRowIndex;
|
|
|
|
cell->GetRowIndex (realRowIndex);
|
1998-09-19 02:37:14 +04:00
|
|
|
if (realRowIndex!=nextRowIndex)
|
|
|
|
{ // the span is caused by a rowspan
|
|
|
|
CellData *spanningCell = GetCellAt(aRowIndex, colIndex);
|
|
|
|
if (nsnull!=spanningCell)
|
|
|
|
{ // there's really a cell at (aRowIndex, colIndex)
|
|
|
|
if (nsnull!=spanningCell->mCell)
|
|
|
|
{ // aRowIndex is where the rowspan originated
|
|
|
|
result = PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** returns PR_TRUE if the col at aColIndex has any cells that are the result
|
|
|
|
* of a col-spanning cell. So, given this table:<BR>
|
|
|
|
* <PRE>
|
|
|
|
* TABLE
|
|
|
|
* TR
|
|
|
|
* TD COLSPAN=2
|
|
|
|
* TD
|
|
|
|
* TD
|
|
|
|
* </PRE>
|
|
|
|
* ColIsSpannedInto(0) returns PR_FALSE, ColIsSpannedInto(1) returns PR_TRUE,
|
|
|
|
* and ColIsSpannedInto(2) returns PR_FALSE.
|
|
|
|
* @see ColHasSpanningCells
|
|
|
|
*/
|
|
|
|
PRBool nsCellMap::ColIsSpannedInto(PRInt32 aColIndex)
|
|
|
|
{
|
1998-10-20 18:35:41 +04:00
|
|
|
PRInt32 colCount = GetColCount();
|
|
|
|
NS_PRECONDITION (0<=aColIndex && aColIndex<colCount, "bad col index arg");
|
1998-09-19 02:37:14 +04:00
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
PRInt32 rowCount = GetRowCount();
|
|
|
|
for (PRInt32 rowIndex=0; rowIndex<rowCount; rowIndex++)
|
|
|
|
{
|
|
|
|
CellData *cd =GetCellAt(rowIndex, aColIndex);
|
|
|
|
if (cd != nsnull)
|
|
|
|
{ // there's really a cell at (aRowIndex, aColIndex)
|
|
|
|
if (nsnull==cd->mCell)
|
|
|
|
{ // the cell at (rowIndex, aColIndex) is the result of a span
|
|
|
|
nsTableCellFrame *cell = cd->mRealCell->mCell;
|
|
|
|
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
|
1999-02-11 04:16:28 +03:00
|
|
|
PRInt32 realColIndex;
|
|
|
|
cell->GetColIndex (realColIndex);
|
1998-09-19 02:37:14 +04:00
|
|
|
if (realColIndex!=aColIndex)
|
|
|
|
{ // the span is caused by a colspan
|
|
|
|
result = PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** returns PR_TRUE if the row at aColIndex has any cells that have a colspan>1
|
|
|
|
* So, given this table:<BR>
|
|
|
|
* <PRE>
|
|
|
|
* TABLE
|
|
|
|
* TR
|
|
|
|
* TD COLSPAN=2
|
|
|
|
* TD
|
|
|
|
* </PRE>
|
|
|
|
* ColHasSpanningCells(0) returns PR_TRUE, and ColHasSpanningCells(1) returns PR_FALSE.
|
|
|
|
* @see ColIsSpannedInto
|
|
|
|
*/
|
|
|
|
PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex)
|
|
|
|
{
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
const PRInt32 colCount = GetColCount();
|
1998-10-20 18:35:41 +04:00
|
|
|
if (aColIndex<colCount-1)
|
1998-09-19 02:37:14 +04:00
|
|
|
{ // aColIndex is not the last col, so we check the next col after aColIndex for spanners
|
|
|
|
const PRInt32 rowCount = GetRowCount();
|
|
|
|
for (PRInt32 rowIndex=0; rowIndex<rowCount; rowIndex++)
|
|
|
|
{
|
|
|
|
PRInt32 nextColIndex = aColIndex+1;
|
|
|
|
CellData *cd =GetCellAt(rowIndex, nextColIndex);
|
|
|
|
if (cd != nsnull)
|
|
|
|
{ // there's really a cell at (rowIndex, nextColIndex)
|
|
|
|
if (nsnull==cd->mCell)
|
|
|
|
{ // the cell at (rowIndex, nextColIndex) is the result of a span
|
|
|
|
nsTableCellFrame *cell = cd->mRealCell->mCell;
|
|
|
|
NS_ASSERTION(nsnull!=cell, "bad cell map state, missing real cell");
|
1999-02-11 04:16:28 +03:00
|
|
|
PRInt32 realColIndex;
|
|
|
|
cell->GetColIndex (realColIndex);
|
1998-09-19 02:37:14 +04:00
|
|
|
if (realColIndex!=nextColIndex)
|
|
|
|
{ // the span is caused by a colspan
|
|
|
|
CellData *spanningCell =GetCellAt(rowIndex, aColIndex);
|
|
|
|
if (nsnull!=spanningCell)
|
|
|
|
{ // there's really a cell at (rowIndex, aColIndex)
|
|
|
|
if (nsnull!=spanningCell->mCell)
|
|
|
|
{ // aCowIndex is where the cowspan originated
|
|
|
|
result = PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-07-24 20:51:16 +04:00
|
|
|
|