Added support for Ctrl+Shift+mouseclick to select block of cells. Rewrote nsITableLayout::nsGetCellData() to be much more efficient, eliminating a method in the process. Implemented nsTableCellFrame::Get[Previous|Next]CellInColumn for cursor key navigation in tables. r=mjudge,karnaze.

This commit is contained in:
cmanske@netscape.com
2000-03-23 04:24:58 +00:00
parent 01c32c5b0a
commit e6b31901b6
15 changed files with 312 additions and 250 deletions

View File

@@ -1057,6 +1057,54 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
return NS_OK;
}
NS_IMETHODIMP
nsTableCellFrame::GetPreviousCellInColumn(nsITableCellLayout **aCellLayout)
{
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
*aCellLayout = nsnull;
nsTableFrame* tableFrame = nsnull;
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
if (NS_FAILED(rv)) return rv;
if (!tableFrame) return NS_ERROR_FAILURE;
// Get current cell location
PRInt32 rowIndex, colIndex;
GetCellIndexes(rowIndex, colIndex);
if (colIndex > 0)
{
// Get the cellframe at previous colIndex
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex-1);
if (cellFrame)
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
}
return NS_OK;
}
NS_IMETHODIMP
nsTableCellFrame::GetNextCellInColumn(nsITableCellLayout **aCellLayout)
{
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
*aCellLayout = nsnull;
nsTableFrame* tableFrame = nsnull;
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
if (NS_FAILED(rv)) return rv;
if (!tableFrame) return NS_ERROR_FAILURE;
// Get current cell location
PRInt32 rowIndex, colIndex;
GetCellIndexes(rowIndex, colIndex);
// Get the cellframe at next colIndex
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex+1);
if (cellFrame)
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
return NS_OK;
}
nsresult
NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
{