29#include <com/sun/star/accessibility/XAccessible.hpp>
30#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
31#include <com/sun/star/accessibility/AccessibleEventId.hpp>
32#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
46#define MIN_COLUMN_WIDTH_PIXEL 4
53 using ::com::sun::star::accessibility::AccessibleTableModelChange;
54 using ::com::sun::star::uno::Any;
55 using ::com::sun::star::accessibility::XAccessible;
56 using ::com::sun::star::uno::Reference;
58 namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
59 namespace AccessibleTableModelChangeType = ::com::sun::star::accessibility::AccessibleTableModelChangeType;
72 explicit SuppressCursor( ITableControl& _rTable )
92 class EmptyTableModel :
public ITableModel
100 virtual TableSize getColumnCount()
const override
104 virtual TableSize getRowCount()
const override
108 virtual bool hasColumnHeaders()
const override
112 virtual bool hasRowHeaders()
const override
118 OSL_FAIL(
"EmptyTableModel::getColumnModel: invalid call!" );
133 virtual TableMetrics getColumnHeaderHeight()
const override
151 virtual ::std::optional< ::Color > getLineColor()
const override
153 return ::std::optional< ::Color >();
155 virtual ::std::optional< ::Color > getHeaderBackgroundColor()
const override
157 return ::std::optional< ::Color >();
159 virtual ::std::optional< ::Color > getHeaderTextColor()
const override
161 return ::std::optional< ::Color >();
163 virtual ::std::optional< ::Color > getActiveSelectionBackColor()
const override
165 return ::std::optional< ::Color >();
167 virtual ::std::optional< ::Color > getInactiveSelectionBackColor()
const override
169 return ::std::optional< ::Color >();
171 virtual ::std::optional< ::Color > getActiveSelectionTextColor()
const override
173 return ::std::optional< ::Color >();
175 virtual ::std::optional< ::Color > getInactiveSelectionTextColor()
const override
177 return ::std::optional< ::Color >();
179 virtual ::std::optional< ::Color > getTextColor()
const override
181 return ::std::optional< ::Color >();
183 virtual ::std::optional< ::Color > getTextLineColor()
const override
185 return ::std::optional< ::Color >();
187 virtual ::std::optional< ::std::vector< ::Color > > getRowBackgroundColors()
const override
189 return ::std::optional< ::std::vector< ::Color > >();
191 virtual css::style::VerticalAlignment getVerticalAlign()
const override
193 return css::style::VerticalAlignment(0);
195 virtual ITableDataSort* getSortAdapter()
override
199 virtual bool isEnabled()
const override
203 virtual void getCellContent(
ColPos const,
RowPos const, css::uno::Any& o_cellContent )
override
205 o_cellContent.clear();
207 virtual void getCellToolTip(
ColPos const,
RowPos const, css::uno::Any& )
override
210 virtual Any getRowHeading(
RowPos const )
const override
219 :m_rAntiImpl ( _rAntiImpl )
222 ,m_nRowHeightPixel ( 15 )
223 ,m_nColHeaderHeightPixel( 0 )
224 ,m_nRowHeaderWidthPixel ( 0 )
225 ,m_nColumnCount ( 0 )
231 ,m_nCursorHidden ( 1 )
233 ,m_pVScroll ( nullptr )
234 ,m_pHScroll ( nullptr )
235 ,m_pScrollCorner ( nullptr )
239 ,m_bUpdatingColWidths ( false )
240 ,m_pAccessibleTable ( nullptr )
260 SuppressCursor aHideCursor( *
this );
263 m_pModel->removeTableModelListener( shared_from_this() );
267 m_pModel = std::make_shared<EmptyTableModel>();
269 m_pModel->addTableModelListener( shared_from_this() );
289 bool lcl_adjustSelectedRows( ::std::vector< RowPos >& io_selectionIndexes,
RowPos const i_firstAffectedRowIndex,
TableSize const i_offset )
291 bool didChanges =
false;
292 for (
auto & selectionIndex : io_selectionIndexes)
294 if ( selectionIndex < i_firstAffectedRowIndex )
296 selectionIndex += i_offset;
306 OSL_PRECOND( i_last >= i_first,
"TableControl_Impl::rowsInserted: invalid row indexes!" );
308 TableSize const insertedRows = i_last - i_first + 1;
327 Any( AccessibleTableModelChange( AccessibleTableModelChangeType::ROWS_INSERTED, i_first, i_last, -1, -1 ) )
342 sal_Int32 firstRemovedRow = i_first;
343 sal_Int32 lastRemovedRow = i_last;
358 for ( sal_Int32 row = i_first; row <= i_last; ++row )
364 if ( lcl_adjustSelectedRows(
m_aSelectedRows, i_last + 1, i_first - i_last - 1 ) )
395 AccessibleEventId::TABLE_MODEL_CHANGED,
396 Any( AccessibleTableModelChange(
397 AccessibleTableModelChangeType::ROWS_REMOVED,
498 "TableControl_Impl::columnChanged: don't know how to handle this change!" );
515 ColumnPositions::const_reverse_iterator loop =
m_aColumnWidths.rbegin();
518 aArea.
SetRight(loop->getEnd() - nScrolledOutLeft);
522 && ( loop->getEnd() - nScrolledOutLeft >= aArea.
Right() )
590 if ( i_position > 0 )
592 if ( i_availableSpace >= i_neededSpace )
616 bool bHaveBar = _rpBar !=
nullptr;
619 if ( bHaveBar && !i_needBar )
621 if ( _rpBar->IsTracking() )
622 _rpBar->EndTracking();
625 else if ( !bHaveBar && i_needBar )
630 WB_DRAG | ( _bHorizontal ? WB_HSCROLL : WB_VSCROLL )
632 _rpBar->SetScrollHdl( _rScrollHandler );
634 lcl_setButtonRepeat( *_rpBar );
639 _rpBar->SetRange(
Range( 0, _nRange ) );
640 _rpBar->SetVisibleSize( _nVisibleUnits );
641 _rpBar->SetPageSize( _nVisibleUnits );
642 _rpBar->SetLineSize( 1 );
643 _rpBar->SetThumbPos( _nPosition );
647 return ( bHaveBar != i_needBar );
657 return _bAcceptPartialRow
658 ? ( _nOverallHeight + ( _nRowHeightPixel - 1 ) ) / _nRowHeightPixel
659 : _nOverallHeight / _nRowHeightPixel;
668 const TableControl_Impl& _rControl,
bool _bAcceptPartialRow )
671 TableColumnGeometry aColumn( _rControl, _rArea, _nFirstVisibleColumn );
672 while ( aColumn.isValid() )
674 if ( !_bAcceptPartialRow )
675 if ( aColumn.getRect().Right() > _rArea.
Right() )
682 return visibleColumns;
689 bool const i_assumeVerticalScrollbar, ::std::vector< tools::Long >& o_newColWidthsPixel )
const
693 ENSURE_OR_RETURN( !!
m_pModel,
"TableControl_Impl::impl_ni_calculateColumnWidths: not allowed without a model!", gridWidthPixel );
694 if (
m_pModel->hasRowHeaders() && ( gridWidthPixel != 0 ) )
702 gridWidthPixel -= nScrollbarMetrics;
708 return gridWidthPixel;
713 ::std::vector< tools::Long > currentColWidths;
714 currentColWidths.reserve( colCount );
715 typedef ::std::vector< ::std::pair< tools::Long, long > > ColumnLimits;
716 ColumnLimits effectiveColumnLimits;
717 effectiveColumnLimits.reserve( colCount );
721 ::std::vector< ::sal_Int32 > columnFlexibilities;
722 columnFlexibilities.reserve( colCount );
724 size_t flexibleColumnCount = 0;
732 currentColWidths.push_back( currentWidth );
735 accumulatedCurrentWidth += currentWidth;
738 ::sal_Int32 flexibility = pColumn->getFlexibility();
739 OSL_ENSURE( flexibility >= 0,
"TableControl_Impl::impl_ni_calculateColumnWidths: a column's flexibility should be non-negative." );
740 if ( ( flexibility < 0 )
741 || ( !pColumn->isResizable() )
742 || (
col <= i_assumeInflexibleColumnsUpToIncluding )
747 tools::Long effectiveMin = currentWidth, effectiveMax = currentWidth;
749 if ( flexibility > 0 )
753 effectiveMin = minWidth;
758 OSL_ENSURE( minWidth <= maxWidth,
"TableControl_Impl::impl_ni_calculateColumnWidths: pretty undecided 'bout its width limits, this column!" );
759 if ( ( maxWidth > 0 ) && ( maxWidth >= minWidth ) )
760 effectiveMax = maxWidth;
762 effectiveMax = gridWidthPixel;
764 if ( effectiveMin == effectiveMax )
769 columnFlexibilities.push_back( flexibility );
770 flexibilityDenominator += flexibility;
771 if ( flexibility > 0 )
772 ++flexibleColumnCount;
774 effectiveColumnLimits.emplace_back( effectiveMin, effectiveMax );
775 accumulatedMinWidth += effectiveMin;
776 accumulatedMaxWidth += effectiveMax;
779 o_newColWidthsPixel = currentColWidths;
780 if ( flexibilityDenominator == 0 )
784 else if ( gridWidthPixel > accumulatedCurrentWidth )
786 tools::Long distributePixel = gridWidthPixel - accumulatedCurrentWidth;
787 if ( gridWidthPixel > accumulatedMaxWidth )
793 o_newColWidthsPixel[
i] = effectiveColumnLimits[
i].second;
798 bool startOver =
false;
803 for (
size_t i=0;
i<o_newColWidthsPixel.size() && !startOver; ++
i )
805 tools::Long const columnFlexibility = columnFlexibilities[
i];
806 if ( columnFlexibility == 0 )
809 tools::Long newColWidth = currentColWidths[
i] + columnFlexibility * distributePixel / flexibilityDenominator;
811 if ( newColWidth > effectiveColumnLimits[
i].second )
814 newColWidth = effectiveColumnLimits[
i].second;
816 flexibilityDenominator -= columnFlexibility;
817 columnFlexibilities[
i] = 0;
818 --flexibleColumnCount;
820 tools::Long const difference = newColWidth - currentColWidths[
i];
821 distributePixel -= difference;
830 o_newColWidthsPixel[
i] = newColWidth;
836 distributePixel = gridWidthPixel - ::std::accumulate( o_newColWidthsPixel.begin(), o_newColWidthsPixel.end(), 0 );
837 while ( ( distributePixel > 0 ) && ( flexibleColumnCount > 0 ) )
841 for (
size_t i=0; (
i < o_newColWidthsPixel.size() ) && ( distributePixel > 0 ); ++
i )
843 if ( columnFlexibilities[
i] == 0 )
846 OSL_ENSURE( o_newColWidthsPixel[
i] <= effectiveColumnLimits[
i].second,
847 "TableControl_Impl::impl_ni_calculateColumnWidths: inconsistency!" );
848 if ( o_newColWidthsPixel[
i] >= effectiveColumnLimits[
i].
first )
850 columnFlexibilities[
i] = 0;
851 --flexibleColumnCount;
855 ++o_newColWidthsPixel[
i];
861 else if ( gridWidthPixel < accumulatedCurrentWidth )
863 tools::Long takeAwayPixel = accumulatedCurrentWidth - gridWidthPixel;
864 if ( gridWidthPixel < accumulatedMinWidth )
870 o_newColWidthsPixel[
i] = effectiveColumnLimits[
i].first;
875 bool startOver =
false;
880 for (
size_t i=0;
i<o_newColWidthsPixel.size() && !startOver; ++
i )
882 tools::Long const columnFlexibility = columnFlexibilities[
i];
883 if ( columnFlexibility == 0 )
886 tools::Long newColWidth = currentColWidths[
i] - columnFlexibility * takeAwayPixel / flexibilityDenominator;
888 if ( newColWidth < effectiveColumnLimits[
i].
first )
891 newColWidth = effectiveColumnLimits[
i].first;
893 flexibilityDenominator -= columnFlexibility;
894 columnFlexibilities[
i] = 0;
895 --flexibleColumnCount;
897 tools::Long const difference = currentColWidths[
i] - newColWidth;
898 takeAwayPixel -= difference;
905 o_newColWidthsPixel[
i] = newColWidth;
911 takeAwayPixel = ::std::accumulate( o_newColWidthsPixel.begin(), o_newColWidthsPixel.end(), 0 ) - gridWidthPixel;
912 while ( ( takeAwayPixel > 0 ) && ( flexibleColumnCount > 0 ) )
916 for (
size_t i=0; (
i < o_newColWidthsPixel.size() ) && ( takeAwayPixel > 0 ); ++
i )
918 if ( columnFlexibilities[
i] == 0 )
921 OSL_ENSURE( o_newColWidthsPixel[
i] >= effectiveColumnLimits[
i].
first,
922 "TableControl_Impl::impl_ni_calculateColumnWidths: inconsistency!" );
923 if ( o_newColWidthsPixel[
i] <= effectiveColumnLimits[
i].
first )
925 columnFlexibilities[
i] = 0;
926 --flexibleColumnCount;
930 --o_newColWidthsPixel[
i];
937 return gridWidthPixel;
950 SuppressCursor aHideCursor( *
this );
965 ::std::vector< tools::Long > newWidthsPixel;
978 "TableControl_Impl::impl_ni_relayout: how is this expected to work with invalid data?" );
979 tools::Long const nAllColumnsWidth = ::std::accumulate( newWidthsPixel.begin(), newWidthsPixel.end(), 0 );
985 bool bNeedVerticalScrollbar = lcl_determineScrollbarNeed(
987 bool bFirstRoundVScrollNeed =
false;
988 if ( bNeedVerticalScrollbar )
990 aDataCellPlayground.
AdjustRight( -nScrollbarMetrics );
991 bFirstRoundVScrollNeed =
true;
995 bool const bNeedHorizontalScrollbar = lcl_determineScrollbarNeed(
997 if ( bNeedHorizontalScrollbar )
1005 if ( !bFirstRoundVScrollNeed )
1007 bNeedVerticalScrollbar = lcl_determineScrollbarNeed(
1009 if ( bNeedVerticalScrollbar )
1011 aDataCellPlayground.
AdjustRight( -nScrollbarMetrics );
1018 if ( !bNeedVerticalScrollbar )
1025 bool anyColumnWidthChanged =
false;
1028 const tools::Long columnStart = accumulatedWidthPixel;
1031 accumulatedWidthPixel = columnEnd;
1035 ENSURE_OR_THROW( !!pColumn,
"invalid column returned by the model!" );
1037 tools::Long const oldColumnWidthAppFont = pColumn->getWidth();
1039 pColumn->setWidth( newColumnWidthAppFont );
1041 anyColumnWidthChanged |= ( oldColumnWidthAppFont != newColumnWidthAppFont );
1045 if ( anyColumnWidthChanged )
1063 columnWidth.move( offsetPixel );
1073 bool const i_verticalScrollbar,
bool const i_horizontalScrollbar )
1078 lcl_updateScrollbar(
1081 i_verticalScrollbar,
1094 Point( i_dataCellPlayground.
Right() + 1, 0 ),
1095 Size( nScrollbarMetrics, i_dataCellPlayground.
Bottom() + 1 )
1102 lcl_updateScrollbar(
1105 i_horizontalScrollbar,
1106 lcl_getColumnsVisibleWithin( i_dataCellPlayground,
m_nLeftColumn, *
this,
false ),
1117 TableSize const nVisibleUnits = lcl_getColumnsVisibleWithin( i_dataCellPlayground,
m_nLeftColumn, *
this,
false );
1123 m_pHScroll->SetVisibleSize( nVisibleUnits -1 );
1124 m_pHScroll->SetPageSize( nVisibleUnits - 1 );
1129 Size( i_dataCellPlayground.
Right() + 1, nScrollbarMetrics )
1138 if ( bHaveScrollCorner && !bNeedScrollCorner )
1142 else if ( !bHaveScrollCorner && bNeedScrollCorner )
1149 else if(bHaveScrollCorner && bNeedScrollCorner)
1175 DBG_ASSERT(!!pRenderer,
"TableDataWindow::doPaintContent: invalid renderer!");
1191 pRenderer->PaintHeaderArea(rRenderContext, aColRect,
true,
false, rStyle);
1201 pRenderer->PaintColumnHeader(aCell.getColumn(), rRenderContext, aCell.getRect(), rStyle);
1208 aRowHeaderArea = aAllCellsWithHeaders;
1217 pRenderer->PaintHeaderArea(rRenderContext, aRowHeaderArea,
false,
true, rStyle);
1227 pRenderer->PaintHeaderArea(rRenderContext, aInters,
true,
true, rStyle);
1242 bool const isSelectedRow =
isRowSelected(aRowIterator.getRow());
1247 pRenderer->PrepareRow(aRowIterator.getRow(), isControlFocused, isSelectedRow, rRenderContext, aRect, rStyle);
1253 pRenderer->PaintRowHeader(rRenderContext, aCurrentRowHeader, rStyle);
1262 pRenderer->PaintCell(aCell.getColumn(), isSelectedRow, isControlFocused,
1263 rRenderContext, aCell.getRect(), rStyle);
1285 bool bSuccess =
false;
1291 if (
m_pSelEngine->GetSelectionMode() == SelectionMode::Single )
1319 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::Single)
1394 bSuccess =
goTo( 0, 0 );
1403 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::NONE)
1424 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::NONE)
1426 else if(
m_pSelEngine->GetSelectionMode() == SelectionMode::Single)
1509 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::NONE)
1511 else if(
m_pSelEngine->GetSelectionMode() == SelectionMode::Single)
1591 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::NONE)
1593 else if(
m_pSelEngine->GetSelectionMode() == SelectionMode::Single)
1619 if(
m_pSelEngine->GetSelectionMode() == SelectionMode::NONE)
1621 else if(
m_pSelEngine->GetSelectionMode() == SelectionMode::Single)
1642 OSL_FAIL(
"TableControl_Impl::dispatchAction: unsupported action!" );
1705 if ( ( rColInfo.
getEnd() - 3 <= i_point.
X() )
1706 && ( rColInfo.
getEnd() >= i_point.
X() )
1707 && pColumn->isResizable()
1719 ENSURE_OR_RETURN( ( i_column >= 0 ) && ( i_column < m_pModel->getColumnCount() ),
1720 "TableControl_Impl::getColumnMetrics: illegal column index!",
ColumnMetrics() );
1781 m_pDataWindow->GetParent()->Invalidate( InvalidateFlags::Transparent );
1813 goTo( i_col, i_row );
1826 if ( _nPrevRow == _nCurRow )
1830 aInvalidateRect.
SetTop( aCellRect.
Top() );
1834 else if(_nPrevRow < _nCurRow )
1838 aInvalidateRect.
SetTop( aCellRect.
Top() );
1847 aInvalidateRect.
SetTop( aCellRect.
Top() );
1858 m_pDataWindow->GetControlBackground().IsTransparent() ? InvalidateFlags::Transparent : InvalidateFlags::NONE );
1875 RowPos const lastRow = ( ( i_lastRow ==
ROW_INVALID ) || ( i_lastRow > lastVisibleRow ) ) ? lastVisibleRow : i_lastRow;
1929 return lcl_getRowsFittingInto(
1941 return lcl_getColumnsVisibleWithin(
1958 OSL_ENSURE(
false,
"TableControl_Impl::goTo: invalid row or column index!" );
1962 SuppressCursor aHideCursor( *
this );
1976 "TableControl_Impl::ensureVisible: invalid coordinates!" );
1978 SuppressCursor aHideCursor( *
this );
1998 if ( _nRow >
m_nTopRow + nVisibleRows - 1 )
2007 m_pModel->getCellContent( i_col, i_row, aCellValue );
2009 OUString sCellStringContent;
2010 m_pModel->getRenderer()->GetFormattedCellString( aCellValue, sCellStringContent );
2012 return sCellStringContent;
2031 SuppressCursor aHideCursor( *
this );
2042 && std::abs( nPixelDelta ) < aDataArea.GetHeight()
2045 m_pDataWindow->Scroll( 0,
static_cast<tools::Long>(-nPixelDelta), aDataArea, ScrollFlags::Clip | ScrollFlags::Update | ScrollFlags::Children);
2050 m_pDataWindow->GetParent()->Invalidate( InvalidateFlags::Transparent );
2083 const ColPos nNewLeftColumn =
2095 SuppressCursor aHideCursor( *
this );
2112 columnWidth.move(nPixelDelta);
2117 && std::abs( nPixelDelta ) < aDataArea.
GetWidth()
2120 m_pDataWindow->Scroll( nPixelDelta, 0, aDataArea, ScrollFlags::Clip | ScrollFlags::Update );
2125 m_pDataWindow->GetParent()->Invalidate( InvalidateFlags::Transparent );
2170 std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
2171 if ( it != selectedRows.end() )
2173 return it - selectedRows.begin();
2187 ColumnPositions::const_iterator lowerBound = ::std::lower_bound(
2207 if ( i_abscissa < 0 )
2238 case SelectionMode::Single:
2241 OSL_ENSURE(
m_aSelectedRows.size() == 1,
"TableControl::markRowAsSelected: SingleSelection with more than one selected element?" );
2247 case SelectionMode::Multiple:
2252 OSL_ENSURE(
false,
"TableControl_Impl::markRowAsSelected: unsupported selection mode!" );
2273 ENSURE_OR_RETURN_FALSE( eSelMode == SelectionMode::Multiple,
"TableControl_Impl::markAllRowsAsSelected: unsupported selection mode!" );
2277 #if OSL_DEBUG_LEVEL > 0
2280 OSL_ENSURE(
isRowSelected( row ),
"TableControl_Impl::markAllRowsAsSelected: inconsistency in the selected rows!" );
2318 Size const aSizeTableWithHeaders( aRectTableWithHeaders.
GetSize() );
2362 DBG_ASSERT( ( _pScrollbar == m_pVScroll ) || ( _pScrollbar == m_pHScroll ),
2363 "TableControl_Impl::OnScroll: where did this come from?" );
2365 if ( _pScrollbar == m_pVScroll )
2366 impl_ni_ScrollRows( _pScrollbar->GetDelta() );
2368 impl_ni_ScrollColumns( _pScrollbar->GetDelta() );
2377 Reference< XAccessible >
const xAccParent = i_parentWindow.
GetAccessible();
2378 if ( xAccParent.is() )
2386 Reference< XAccessible > xAccessible;
2418 :m_pTableControl( _pTableControl)
2457 if ( bDontSelectAtCursor )
const MouseSettings & GetMouseSettings() const
void SetMouseSettings(const MouseSettings &rSet)
const StyleSettings & GetStyleSettings() const
bool HasControlFocus() const
void SetButtonRepeat(sal_Int32 nRepeat)
const AllSettings & GetSettings() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
SelectionMode GetSelectionMode() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
static VclPtr< reference_type > Create(Arg &&... arg)
a helper representing geometry information of a cell
tools::Rectangle getRect() const
bool markAllRowsAsSelected()
marks all rows as selected
void impl_getCellRect(ColPos _nColumn, RowPos _nRow, tools::Rectangle &_rCellRect) const
determines the rectangle occupied by the given cell
RowPos getRowAtPoint(const Point &rPoint) const
virtual void invalidate(TableArea const i_what) override
invalidates the table window
void checkCursorPosition()
TableSize impl_getVisibleColumns(bool _bAcceptPartialCol) const
returns the number of visible columns
void invalidateRowRange(RowPos const i_firstRow, RowPos const i_lastRow)
invalidates the part of the data window which is covered by the given rows
tools::Long m_nRowHeightPixel
the height of a single row in the table, measured in pixels
tools::Long m_nRowHeaderWidthPixel
the width of the row header column in the table, measured in pixels
bool hasRowSelection() const
TableSize impl_ni_ScrollColumns(TableSize _nColumnDelta)
scrolls the view by the given number of columns
virtual TableCell hitTest(const Point &rPoint) const override
does a hit test for the given pixel coordinates
void commitAccessibleEvent(sal_Int16 const i_eventID)
tools::Rectangle calcHeaderCellRect(bool bColHeader, sal_Int32 nPos)
tools::Rectangle calcCellRect(sal_Int32 nRow, sal_Int32 nCol) const
PTableInputHandler m_pInputHandler
the input handler to use, usually the input handler as provided by ->m_pModel
virtual void columnChanged(ColPos const i_column, ColumnAttributeGroup const i_attributeGroup) override
notifies the listener that attributes of a given column changed
TableSize impl_getVisibleRows(bool _bAcceptPartialRow) const
returns the number of visible rows.
virtual void allColumnsRemoved() override
notifies the listener that all columns have been removed from the model
static int getRowSelectedNumber(const ::std::vector< RowPos > &selectedRows, RowPos current)
returns the position of the current row in the selection vector
virtual void tableMetricsChanged() override
notifies the listener that the metrics of the table changed.
virtual void columnInserted() override
notifies the listener that one or more columns have been inserted into the table
virtual void rowsInserted(RowPos first, RowPos last) override
notifies the listener that one or more rows have been inserted into the table
virtual void columnRemoved() override
notifies the listener that one or more columns have been removed from the table
void invalidateSelectedRows()
invalidates all selected rows
OUString getCellContentAsString(RowPos const i_row, ColPos const i_col)
retrieves the content of the given cell, converted to a string
TableSize impl_ni_ScrollRows(TableSize _nRowDelta)
scrolls the view by the given number of rows
ColumnPositions m_aColumnWidths
info about the widths of our columns
void setModel(const PTableModel &_pModel)
void setAnchor(RowPos const i_anchor)
void invalidateRect(const tools::Rectangle &rInvalidateRect)
ColPos getColAtPoint(const Point &rPoint) const
virtual void showTracking(tools::Rectangle const &i_location, ShowTrackFlags const i_flags) override
shows a tracking rectangle
virtual void setPointer(PointerStyle i_pointer) override
sets a new mouse pointer for the table window
bool m_bUpdatingColWidths
void commitCellEvent(sal_Int16 const i_eventID, const css::uno::Any &i_newValue, const css::uno::Any &i_oldValue)
tools::Long m_nColHeaderHeightPixel
the height of the column header row in the table, measured in pixels
tools::Long appFontWidthToPixel(tools::Long const i_appFontUnits) const
tools::Rectangle impl_getAllVisibleDataCellArea() const
retrieves the area occupied by all (at least partially) visible data cells.
virtual void hideTracking() override
hides a previously shown tracking rectangle
virtual ~TableControl_Impl() override
virtual ColPos getCurrentColumn() const override
returns the index of the currently active column
RowPos impl_getRowForAbscissa(tools::Long const i_abscissa) const
retrieves the row which covers the given abscissa
void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow)
???
virtual tools::Long pixelWidthToAppFont(tools::Long const i_pixels) const override
calculates a width, given in pixels, into an AppFont-based width
void impl_ni_relayout(ColPos const i_assumeInflexibleColumnsUpToIncluding=COL_INVALID)
does a relayout of the table control
VclPtr< ScrollBar > m_pVScroll
the vertical scrollbar, if any
ColPos impl_getColumnForOrdinate(tools::Long const i_ordinate) const
retrieves the column which covers the given ordinate
std::vector< RowPos > m_aSelectedRows
VclPtr< TableDataWindow > m_pDataWindow
the window to contain all data content, including header bars
css::uno::Reference< css::accessibility::XAccessible > getAccessible(vcl::Window &i_parentWindow)
void doPaintContent(vcl::RenderContext &rRenderContext, const tools::Rectangle &_rUpdateRect)
paints the table control content which intersects with the given rectangle
virtual RowPos getCurrentRow() const override
returns the index of the currently active row
virtual PTableModel getModel() const override
returns the table model
TableControl & m_rAntiImpl
the control whose impl-instance we implement
VclPtr< ScrollBarBox > m_pScrollCorner
tools::Rectangle calcTableRect() const
bool markRowAsDeselected(RowPos const i_rowIndex)
removes the given row index from m_aSelectedRows
std::unique_ptr< SelectionEngine > m_pSelEngine
virtual bool isRowSelected(RowPos i_row) const override
determines whether a given row is selected
virtual void hideCursor() override
hides the cell cursor
void invalidateRow(RowPos const i_row)
invalidates the part of the data window which is covered by the given row
void impl_ni_updateCachedTableMetrics()
updates the cached table metrics (row height etc.)
PTableModel m_pModel
the model of the table control
virtual ::Size getTableSizePixel() const override
retrieves the size of the table window, in pixels
std::unique_ptr< TableFunctionSet > m_pTableFunctionSet
TableSize m_nRowCount
the number of rows in the table control. Cached model value.
TableSize m_nColumnCount
the number of columns in the table control. Cached model value.
virtual void captureMouse() override
captures the mouse to the table window
void impl_commitAccessibleEvent(sal_Int16 const i_eventID, css::uno::Any const &i_newValue)
VclPtr< ScrollBar > m_pHScroll
the horizontal scrollbar, if any
bool markAllRowsAsDeselected()
marks all rows as deselected
void onResize()
to be called when the anti-impl instance has been resized
tools::Rectangle impl_getAllVisibleCellsArea() const
retrieves the area occupied by the totality of (at least partially) visible cells
virtual void rowsRemoved(RowPos first, RowPos last) override
notifies the listener that one or more rows have been removed from the table
virtual void showCursor() override
shows the cell cursor
void impl_ni_positionChildWindows(tools::Rectangle const &i_dataCellPlayground, bool const i_verticalScrollbar, bool const i_horizontalScrollbar)
positions all child windows, e.g.
sal_Int32 m_nCursorHidden
vcl::AccessibleFactoryAccess m_aFactoryAccess
virtual void releaseMouse() override
releases the mouse, after it had previously been captured
void commitTableEvent(sal_Int16 const i_eventID, const css::uno::Any &i_newValue, const css::uno::Any &i_oldValue)
TableControl_Impl(TableControl &_rAntiImpl)
void impl_ni_doSwitchCursor(bool _bOn)
toggles the cursor visibility
size_t getSelectedRowCount() const
tools::Rectangle calcHeaderRect(bool bColHeader)
bool markRowAsSelected(RowPos const i_rowIndex)
marks the given row as selected, by putting it into m_aSelectedRows
virtual SelectionEngine * getSelEngine() override
returns selection engine
TableSize impl_scrollColumns(TableSize const i_columnDelta)
equivalent to impl_ni_ScrollColumns, but checks the instances invariants beforehand (in a non-product...
void impl_invalidateColumn(ColPos const i_column)
invalidates the window area occupied by the given column
bool impl_isAccessibleAlive() const
RowPos getSelectedRowIndex(size_t const i_selectionIndex) const
virtual void activateCell(ColPos const i_col, RowPos const i_row) override
activates the given cell
virtual bool dispatchAction(TableControlAction _eAction) override
dispatches an action to the table control
tools::Long impl_ni_calculateColumnWidths(ColPos const i_assumeInflexibleColumnsUpToIncluding, bool const i_assumeVerticalScrollbar, ::std::vector< tools::Long > &o_newColWidthsPixel) const
calculates the new width of our columns, taking into account their min and max widths,...
virtual void cellsUpdated(RowPos const i_firstRow, RowPos const i_lastRow) override
notifies the listener that a rectangular cell range in the table has been updated
TableSize impl_scrollRows(TableSize const i_rowDelta)
equivalent to impl_ni_ScrollRows, but checks the instances invariants beforehand (in a non-product bu...
vcl::table::IAccessibleTableControl * m_pAccessibleTable
void impl_ni_updateCachedModelValues()
updates all cached model values
bool goTo(ColPos _nColumn, RowPos _nRow)
moves the cursor to the cell with the given coordinates
virtual ColumnMetrics getColumnMetrics(ColPos const i_column) const override
retrieves the metrics for a given column
ColPos getLeftColumn() const
void ensureVisible(ColPos _nColumn, RowPos _nRow)
ensures that the given coordinate is visible
a basic control which manages table-like data, i.e.
the window containing the content area (including headers) of a table control
virtual void SetCursorAtPoint(const Point &rPoint, bool bDontSelectAtCursor=false) override
virtual void DeselectAtPoint(const Point &rPoint) override
virtual ~TableFunctionSet() override
virtual void DestroyAnchor() override
virtual bool IsSelectionAtPoint(const Point &rPoint) override
virtual void DeselectAll() override
virtual void CreateAnchor() override
virtual void BeginDrag() override
TableControl_Impl * m_pTableControl
TableFunctionSet(TableControl_Impl *_pTableControl)
const tools::Rectangle & getRect() const
Point LogicToPixel(const Point &rLogicPt) const
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
const AllSettings & GetSettings() const
void SetSettings(const AllSettings &rSettings)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
Size GetOutputSizePixel() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual css::uno::Reference< css::accessibility::XAccessible > getMyself()=0
virtual void DisposeAccessImpl()=0
virtual void commitCellEvent(sal_Int16 nEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue)=0
virtual bool isAlive() const=0
virtual void commitEvent(sal_Int16 nEventId, const css::uno::Any &rNewValue)=0
virtual void commitTableEvent(sal_Int16 nEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue)=0
#define DBG_ASSERT(sCon, aError)
#define DBG_TESTSOLARMUTEX()
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
#define ENSURE_OR_RETURN(c, m, r)
#define ENSURE_OR_RETURN_VOID(c, m)
#define LINK(Instance, Class, Member)
virtual DECL_LISTENERMULTIPLEXER_END void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
void SAL_CALL first(const css::awt::SpinEvent &rEvent) override
RttiCompleteObjectLocator col
std::shared_ptr< T > make_shared(Args &&... args)
IMPL_LINK(TableControl_Impl, OnScroll, ScrollBar *, _pScrollbar, void)
IMPL_LINK_NOARG(TableControl, ImplSelectHdl, LinkParamNone *, void)
sal_Int32 TableSize
a value denoting the size of a table
sal_Int32 RowPos
a value denoting a row position within a table
std::shared_ptr< ITableModel > PTableModel
std::shared_ptr< ITableRenderer > PTableRenderer
@ ScrollbarShowNever
enumeration value denoting that a scrollbar should never be visible, even if needed normally
@ ScrollbarShowAlways
enumeration value denoting that a scrollbar should always be visible, even if not needed normally
sal_Int32 ColPos
a value denoting a column position within a table
std::shared_ptr< ITableInputHandler > PTableInputHandler
@ cursorToFirstLine
moves the cursor to the first row, keeping the current column
@ cursorToLineStart
moves the cursor to the beginning of the current line
@ cursorLeft
moves the cursor in the table control one column to the left, if possible, by keeping the current row
@ cursorPageDown
moves the cursor one page down, keeping the current column
@ cursorSelectRowUp
selects the rows, above the actual cursor is
@ cursorBottomRight
moves the cursor to the bottom-most, right-most cell
@ cursorDown
moves the cursor in the table control one row down, if possible, by keeping the current column
@ cursorPageUp
moves the cursor one page up, keeping the current column
@ cursorSelectRowDown
selects the row, beneath the actual cursor is
@ cursorUp
moves the cursor in the table control one row up, if possible, by keeping the current column
@ cursorToLineEnd
moves the cursor to the end of the current line
@ cursorSelectRow
selects the row, where the actual cursor is
@ cursorTopLeft
moves the cursor to the top-most, left-most cell
@ cursorSelectRowAreaBottom
selects the row, from the actual cursor till bottom
@ cursorRight
moves the cursor in the table control one column to the right, if possible, by keeping the current ro...
@ cursorSelectRowAreaTop
selects the row, from the actual cursor till top
@ cursorToLastLine
moves the cursor to the last row, keeping the current column
std::shared_ptr< IColumnModel > PColumnModel
std::shared_ptr< ITableModelListener > PTableModelListener
tools::Long getEnd() const
#define MIN_COLUMN_WIDTH_PIXEL
@ APPEARANCE
denotes column attributes related to the appearance of the column, i.e. those relevant for rendering
@ WIDTH
denotes column attributes related to the width of the column
@ ALL
denotes the entirety of column attributes
#define COL_ROW_HEADERS
denotes the column containing the row headers
#define ROW_INVALID
denotes an invalid row index
#define COL_INVALID
denotes an invalid column index
#define ROW_COL_HEADERS
denotes the row containing the column headers