void FPropertyTable::SelectCellRange( const TSharedRef< class IPropertyTableCell >& StartingCell, const TSharedRef< class IPropertyTableCell >& EndingCell )
{
	SelectedColumns.Empty();
	SelectedRows.Empty();
	SelectedCells.Empty();

	const int32 StartingCellRowIndex = Rows.Find( StartingCell->GetRow() );
	const int32 EndingCellRowIndex = Rows.Find( EndingCell->GetRow() );

	for (int RowIndex = StartingCellRowIndex; RowIndex < Rows.Num() && RowIndex <= EndingCellRowIndex; RowIndex++)
	{
		SelectedRows.Add( Rows[ RowIndex ] );
	}

	const int32 StartingCellColumnIndex = Columns.Find( StartingCell->GetColumn() );
	const int32 EndingCellColumnIndex = Columns.Find( EndingCell->GetColumn() );

	for (int ColumnsIndex = StartingCellColumnIndex; ColumnsIndex < Columns.Num() && ColumnsIndex <= EndingCellColumnIndex; ColumnsIndex++)
	{
		SelectedColumns.Add( Columns[ ColumnsIndex ] );

		for( auto RowIter = SelectedRows.CreateConstIterator(); RowIter; ++RowIter )
		{
			SelectedCells.Add( Columns[ ColumnsIndex ]->GetCell( *RowIter ) );
		}
	}

	if ( CurrentRow.IsValid() && !SelectedRows.Contains( CurrentRow.ToSharedRef() ) )
	{
		CurrentRow = NULL;
	}

	if ( CurrentColumn.IsValid() && !SelectedColumns.Contains( CurrentColumn.ToSharedRef() ) )
	{
		CurrentColumn = NULL;
	}

	StartingCellSelectionRange = StartingCell;
	EndingCellSelectionRange = EndingCell;

	if ( CurrentCell.IsValid() && !SelectedCells.Contains( CurrentCell.ToSharedRef() ) )
	{
		CurrentCell->ExitEditMode();
		CurrentCell = NULL;
	}

	SelectionChanged.Broadcast();
}
void FPropertyTable::SetSelectedRows( const TSet< TSharedRef< IPropertyTableRow > >& InSelectedRows )
{
	SelectedColumns.Empty();
	SelectedRows.Empty(); 

	if ( !CanSelectRows() )
	{
		return;
	}

	SelectedRows.Append( InSelectedRows ); 

	TSet< TSharedRef< IPropertyTableCell > > PreviouslySelectedCells( SelectedCells );

	bool RemovedCells = false;
	for( auto CellIter = PreviouslySelectedCells.CreateConstIterator(); CellIter; ++CellIter )
	{
		const TSharedRef< IPropertyTableCell > Cell = *CellIter;
		if ( !SelectedRows.Contains( Cell->GetRow() ) )
		{
			SelectedCells.Remove( Cell );
			SelectedColumns.Add( Cell->GetColumn() );
			RemovedCells = true;
		}
	}

	if ( RemovedCells )
	{
		StartingCellSelectionRange = NULL;
		EndingCellSelectionRange = NULL;
	}

	if ( CurrentRow.IsValid() && !SelectedRows.Contains( CurrentRow.ToSharedRef() ) )
	{
		CurrentRow = NULL;
	}

	if ( CurrentColumn.IsValid() && !SelectedColumns.Contains( CurrentColumn.ToSharedRef() ) )
	{
		CurrentColumn = NULL;
	}

	if ( CurrentCell.IsValid() && !SelectedCells.Contains( CurrentCell.ToSharedRef() ) )
	{
		CurrentCell->ExitEditMode();
		CurrentCell = NULL;
	}

	SelectionChanged.Broadcast();
}
TSharedPtr< class IPropertyTableCell > FPropertyTable::GetPreviousCellInColumn( const TSharedRef< class IPropertyTableCell >& Cell ) 
{
	const int32 FoundIndex = Rows.Find( Cell->GetRow() );

	if ( FoundIndex == INDEX_NONE )
	{
		return NULL;
	}

	const int32 StartIndex = FoundIndex - 1;
	const int32 Step = -1;
	TSharedPtr< IPropertyTableRow > NextRow = ScanForRowWithCells( StartIndex, Step );

	if ( !NextRow.IsValid() )
	{
		return NULL;
	}

	return Cell->GetColumn()->GetCell( NextRow.ToSharedRef() );
}
TSharedPtr< class IPropertyTableCell > FPropertyTable::GetPreviousCellInRow( const TSharedRef< class IPropertyTableCell >& Cell ) 
{
	const int32 FoundIndex = Columns.Find( Cell->GetColumn() );

	if ( FoundIndex == INDEX_NONE )
	{
		return NULL;
	}

	const int32 StartIndex = FoundIndex - 1;
	const int32 Step = -1;
	TSharedPtr< IPropertyTableColumn > PreviousColumn = ScanForColumnWithSelectableCells( StartIndex, Step );

	if ( !PreviousColumn.IsValid() )
	{
		return NULL;
	}

	return PreviousColumn->GetCell( Cell->GetRow() );
}