Added nsITableLayout::GetTableSize() to get number of rows and columns in table. Fixup up comments for new methods

This commit is contained in:
cmanske%netscape.com 1999-08-01 16:20:14 +00:00
Родитель b520526a86
Коммит 1f9ca60e19
12 изменённых файлов: 112 добавлений и 2 удалений

Просмотреть файл

@ -64,6 +64,12 @@ public:
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected)=0;
/** Get the number of rows and column for a table from the frame's cellmap
* Some rows may not have enough cells (the number returned is the maximum possible),
* which displays as a ragged-right edge table
*/
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)=0;
};
#endif

Просмотреть файл

@ -108,6 +108,8 @@ public:
// there is no set row index because row index depends on the cell's parent row only
/*---------------- nsITableCellLayout methods ------------------------*/
/**
* return the cell's starting row index (starting at 0 for the first row).
* for continued cell frames the row index is that of the cell's first-in-flow

Просмотреть файл

@ -5347,6 +5347,7 @@ void nsTableFrame::GetCellInfoAt(PRInt32 aRowX,
cellMap->GetCellInfoAt(aRowX, aColX, aCellFrame, aOriginates, aColSpan);
}
/*------------------ nsITableLayout methods ------------------------------*/
NS_IMETHODIMP
nsTableFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
@ -5454,6 +5455,22 @@ TEST_IF_SELECTED:
return result;
}
NS_IMETHODIMP nsTableFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
{
nsCellMap* cellMap = GetCellMap();
// Initialize out params
aRowCount = 0;
aColCount = 0;
if (!cellMap) { return NS_ERROR_NOT_INITIALIZED;}
aRowCount = cellMap->GetRowCount();
aColCount = cellMap->GetColCount();
return NS_OK;
}
/*---------------- end of nsITableLayout implementation ------------------*/
PRInt32 nsTableFrame::GetNumCellsOriginatingIn(PRInt32 aColIndex)
{
nsCellMap* cellMap = GetCellMap();

Просмотреть файл

@ -806,12 +806,22 @@ public: /* ----- Cell Map public methods ----- */
PRBool RequiresPass1Layout();
/*---------------- nsITableLayout methods ------------------------*/
/** Get the cell and associated data for a table cell from the frame's cellmap */
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected);
/** Get the number of rows and column for a table from the frame's cellmap
* Some rows may not have enough cells (the number returned is the maximum possible),
* which displays as a ragged-right edge table
*/
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
/*------------end of nsITableLayout methods -----------------------*/
public:
static nsIAtom* gColGroupAtom;
void Dump(PRBool aDumpCols, PRBool aDumpCellMap);

Просмотреть файл

@ -1227,6 +1227,9 @@ nsTableOuterFrame::GetFrameType(nsIAtom** aType) const
return NS_OK;
}
/* ----- global methods ----- */
/*------------------ nsITableLayout methods ------------------------------*/
NS_IMETHODIMP
nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
@ -1246,7 +1249,20 @@ nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
return NS_ERROR_NULL_POINTER;
}
/* ----- global methods ----- */
NS_IMETHODIMP nsTableOuterFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
{
if (!mInnerTableFrame) { return NS_ERROR_NOT_INITIALIZED; }
nsITableLayout *inner;
nsresult result = mInnerTableFrame->QueryInterface(nsITableLayout::GetIID(), (void **)&inner);
if (NS_SUCCEEDED(result) && inner)
{
return (inner->GetTableSize(aRowCount, aColCount));
}
return NS_ERROR_NULL_POINTER;
}
/*---------------- end of nsITableLayout implementation ------------------*/
nsresult
NS_NewTableOuterFrame(nsIFrame** aNewFrame)

Просмотреть файл

@ -93,12 +93,16 @@ public:
nscoord GetMinCaptionWidth();
/*---------------- nsITableLayout methods ------------------------*/
/** @see nsITableFrame::GetCellDataAt */
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected);
/** @see nsITableFrame::GetTableSize */
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
protected:

Просмотреть файл

@ -64,6 +64,12 @@ public:
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected)=0;
/** Get the number of rows and column for a table from the frame's cellmap
* Some rows may not have enough cells (the number returned is the maximum possible),
* which displays as a ragged-right edge table
*/
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)=0;
};
#endif

Просмотреть файл

@ -108,6 +108,8 @@ public:
// there is no set row index because row index depends on the cell's parent row only
/*---------------- nsITableCellLayout methods ------------------------*/
/**
* return the cell's starting row index (starting at 0 for the first row).
* for continued cell frames the row index is that of the cell's first-in-flow

Просмотреть файл

@ -5347,6 +5347,7 @@ void nsTableFrame::GetCellInfoAt(PRInt32 aRowX,
cellMap->GetCellInfoAt(aRowX, aColX, aCellFrame, aOriginates, aColSpan);
}
/*------------------ nsITableLayout methods ------------------------------*/
NS_IMETHODIMP
nsTableFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
@ -5454,6 +5455,22 @@ TEST_IF_SELECTED:
return result;
}
NS_IMETHODIMP nsTableFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
{
nsCellMap* cellMap = GetCellMap();
// Initialize out params
aRowCount = 0;
aColCount = 0;
if (!cellMap) { return NS_ERROR_NOT_INITIALIZED;}
aRowCount = cellMap->GetRowCount();
aColCount = cellMap->GetColCount();
return NS_OK;
}
/*---------------- end of nsITableLayout implementation ------------------*/
PRInt32 nsTableFrame::GetNumCellsOriginatingIn(PRInt32 aColIndex)
{
nsCellMap* cellMap = GetCellMap();

Просмотреть файл

@ -806,12 +806,22 @@ public: /* ----- Cell Map public methods ----- */
PRBool RequiresPass1Layout();
/*---------------- nsITableLayout methods ------------------------*/
/** Get the cell and associated data for a table cell from the frame's cellmap */
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected);
/** Get the number of rows and column for a table from the frame's cellmap
* Some rows may not have enough cells (the number returned is the maximum possible),
* which displays as a ragged-right edge table
*/
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
/*------------end of nsITableLayout methods -----------------------*/
public:
static nsIAtom* gColGroupAtom;
void Dump(PRBool aDumpCols, PRBool aDumpCellMap);

Просмотреть файл

@ -1227,6 +1227,9 @@ nsTableOuterFrame::GetFrameType(nsIAtom** aType) const
return NS_OK;
}
/* ----- global methods ----- */
/*------------------ nsITableLayout methods ------------------------------*/
NS_IMETHODIMP
nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
@ -1246,7 +1249,20 @@ nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
return NS_ERROR_NULL_POINTER;
}
/* ----- global methods ----- */
NS_IMETHODIMP nsTableOuterFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
{
if (!mInnerTableFrame) { return NS_ERROR_NOT_INITIALIZED; }
nsITableLayout *inner;
nsresult result = mInnerTableFrame->QueryInterface(nsITableLayout::GetIID(), (void **)&inner);
if (NS_SUCCEEDED(result) && inner)
{
return (inner->GetTableSize(aRowCount, aColCount));
}
return NS_ERROR_NULL_POINTER;
}
/*---------------- end of nsITableLayout implementation ------------------*/
nsresult
NS_NewTableOuterFrame(nsIFrame** aNewFrame)

Просмотреть файл

@ -93,12 +93,16 @@ public:
nscoord GetMinCaptionWidth();
/*---------------- nsITableLayout methods ------------------------*/
/** @see nsITableFrame::GetCellDataAt */
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell, //out params
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
PRInt32& aRowSpan, PRInt32& aColSpan,
PRBool& aIsSelected);
/** @see nsITableFrame::GetTableSize */
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
protected: