toolkit: clang-format TableControl code
This in particular also gets rid of an extra level of indentation. Change-Id: I57f636a694a99910d2a04a037a6cda0a8f385e61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210628 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -13260,7 +13260,6 @@ toolkit/inc/controls/table/AccessibleGridControlTable.hxx
|
||||
toolkit/inc/controls/table/AccessibleGridControlTableBase.hxx
|
||||
toolkit/inc/controls/table/defaultinputhandler.hxx
|
||||
toolkit/inc/controls/table/gridtablerenderer.hxx
|
||||
toolkit/inc/controls/table/tablecontrol.hxx
|
||||
toolkit/inc/controls/table/tablecontrolinterface.hxx
|
||||
toolkit/inc/controls/table/tablemodel.hxx
|
||||
toolkit/inc/controls/table/tablerenderer.hxx
|
||||
@@ -13330,7 +13329,6 @@ toolkit/source/controls/table/cellvalueconversion.hxx
|
||||
toolkit/source/controls/table/defaultinputhandler.cxx
|
||||
toolkit/source/controls/table/gridtablerenderer.cxx
|
||||
toolkit/source/controls/table/mousefunction.cxx
|
||||
toolkit/source/controls/table/tablecontrol.cxx
|
||||
toolkit/source/controls/table/tablecontrol_impl.cxx
|
||||
toolkit/source/controls/table/tablecontrol_impl.hxx
|
||||
toolkit/source/controls/table/tabledatawindow.cxx
|
||||
|
||||
@@ -29,147 +29,142 @@
|
||||
|
||||
enum class AccessibleTableControlObjType
|
||||
{
|
||||
GRIDCONTROL, /// The GridControl itself.
|
||||
TABLE, /// The data table.
|
||||
ROWHEADERBAR, /// The row header bar.
|
||||
COLUMNHEADERBAR, /// The horizontal column header bar.
|
||||
TABLECELL, /// A cell of the data table.
|
||||
ROWHEADERCELL, /// A cell of the row header bar.
|
||||
COLUMNHEADERCELL, /// A cell of the column header bar.
|
||||
GRIDCONTROL, /// The GridControl itself.
|
||||
TABLE, /// The data table.
|
||||
ROWHEADERBAR, /// The row header bar.
|
||||
COLUMNHEADERBAR, /// The horizontal column header bar.
|
||||
TABLECELL, /// A cell of the data table.
|
||||
ROWHEADERCELL, /// A cell of the row header bar.
|
||||
COLUMNHEADERCELL, /// A cell of the column header bar.
|
||||
};
|
||||
|
||||
namespace svt::table
|
||||
{
|
||||
class TableControl_Impl;
|
||||
class TableControl_Impl;
|
||||
|
||||
//= TableControl
|
||||
//= TableControl
|
||||
|
||||
/** a basic control which manages table-like data, i.e. a number of cells
|
||||
organized in <code>m</code> rows and <code>n</code> columns.
|
||||
/** a basic control which manages table-like data, i.e. a number of cells
|
||||
organized in <code>m</code> rows and <code>n</code> columns.
|
||||
|
||||
The control itself does not do any assumptions about the concrete data
|
||||
it displays, this is encapsulated in an instance supporting the
|
||||
->ITableModel interface.
|
||||
The control itself does not do any assumptions about the concrete data
|
||||
it displays, this is encapsulated in an instance supporting the
|
||||
->ITableModel interface.
|
||||
|
||||
Also, the control does not do any assumptions about how the model's
|
||||
content is rendered. This is the responsibility of a component
|
||||
supporting the ->ITableRenderer interface (the renderer is obtained from
|
||||
the model).
|
||||
Also, the control does not do any assumptions about how the model's
|
||||
content is rendered. This is the responsibility of a component
|
||||
supporting the ->ITableRenderer interface (the renderer is obtained from
|
||||
the model).
|
||||
|
||||
The control supports the concept of a <em>current</em> (or <em>active</em>
|
||||
cell).
|
||||
The control supports the concept of a <em>current</em> (or <em>active</em>
|
||||
cell).
|
||||
*/
|
||||
class TableControl final : public Control
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<TableControl_Impl> m_pImpl;
|
||||
|
||||
public:
|
||||
TableControl(vcl::Window* _pParent, WinBits _nStyle);
|
||||
virtual ~TableControl() override;
|
||||
virtual void dispose() override;
|
||||
|
||||
/// sets a new table model
|
||||
void SetModel(const PTableModel& _pModel);
|
||||
/// retrieves the current table model
|
||||
PTableModel GetModel() const;
|
||||
|
||||
/** retrieves the current row
|
||||
|
||||
The current row is the one which contains the active cell.
|
||||
|
||||
@return
|
||||
the row index of the active cell, or ->ROW_INVALID
|
||||
if there is no active cell, e.g. because the table does
|
||||
not contain any rows or columns.
|
||||
*/
|
||||
class TableControl final : public Control
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<TableControl_Impl> m_pImpl;
|
||||
sal_Int32 GetCurrentRow() const;
|
||||
|
||||
/** retrieves the current column
|
||||
|
||||
public:
|
||||
TableControl( vcl::Window* _pParent, WinBits _nStyle );
|
||||
virtual ~TableControl() override;
|
||||
virtual void dispose() override;
|
||||
The current col is the one which contains the active cell.
|
||||
|
||||
/// sets a new table model
|
||||
void SetModel( const PTableModel& _pModel );
|
||||
/// retrieves the current table model
|
||||
PTableModel GetModel() const;
|
||||
@return
|
||||
the column index of the active cell, or ->COL_INVALID
|
||||
if there is no active cell, e.g. because the table does
|
||||
not contain any rows or columns.
|
||||
*/
|
||||
sal_Int32 GetCurrentColumn() const;
|
||||
|
||||
/** retrieves the current row
|
||||
|
||||
The current row is the one which contains the active cell.
|
||||
|
||||
@return
|
||||
the row index of the active cell, or ->ROW_INVALID
|
||||
if there is no active cell, e.g. because the table does
|
||||
not contain any rows or columns.
|
||||
/** activates the cell at the given position
|
||||
*/
|
||||
sal_Int32 GetCurrentRow() const;
|
||||
void GoTo(ColPos _nColumnPos, RowPos _nRow);
|
||||
|
||||
/** retrieves the current column
|
||||
virtual void Resize() override;
|
||||
void Select();
|
||||
|
||||
The current col is the one which contains the active cell.
|
||||
|
||||
@return
|
||||
the column index of the active cell, or ->COL_INVALID
|
||||
if there is no active cell, e.g. because the table does
|
||||
not contain any rows or columns.
|
||||
*/
|
||||
sal_Int32 GetCurrentColumn() const;
|
||||
|
||||
/** activates the cell at the given position
|
||||
*/
|
||||
void GoTo( ColPos _nColumnPos, RowPos _nRow);
|
||||
|
||||
virtual void Resize() override;
|
||||
void Select();
|
||||
|
||||
/**after removing a row, updates the vector which contains the selected rows
|
||||
/**after removing a row, updates the vector which contains the selected rows
|
||||
if the row, which should be removed, is selected, it will be erased from the vector
|
||||
*/
|
||||
SelectionEngine* getSelEngine();
|
||||
vcl::Window& getDataWindow();
|
||||
SelectionEngine* getSelEngine();
|
||||
vcl::Window& getDataWindow();
|
||||
|
||||
// Window overridables
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
virtual void KeyInput( const KeyEvent& rKEvt ) override;
|
||||
virtual void StateChanged( StateChangedType i_nStateChange ) override;
|
||||
// Window overridables
|
||||
virtual void GetFocus() override;
|
||||
virtual void LoseFocus() override;
|
||||
virtual void KeyInput(const KeyEvent& rKEvt) override;
|
||||
virtual void StateChanged(StateChangedType i_nStateChange) override;
|
||||
|
||||
/** Creates and returns the accessible object of the whole GridControl. */
|
||||
virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
|
||||
OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType,
|
||||
sal_Int32 _nRow, sal_Int32 _nCol) const;
|
||||
void GoToCell(sal_Int32 _nColumnPos, sal_Int32 _nRow);
|
||||
OUString
|
||||
GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const;
|
||||
void FillAccessibleStateSet(sal_Int64& rStateSet,
|
||||
AccessibleTableControlObjType eObjType) const;
|
||||
/** Creates and returns the accessible object of the whole GridControl. */
|
||||
virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
|
||||
OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow,
|
||||
sal_Int32 _nCol) const;
|
||||
void GoToCell(sal_Int32 _nColumnPos, sal_Int32 _nRow);
|
||||
OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const;
|
||||
void FillAccessibleStateSet(sal_Int64& rStateSet, AccessibleTableControlObjType eObjType) const;
|
||||
|
||||
// temporary methods
|
||||
// Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
|
||||
// firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
|
||||
// instead of something triggered externally.
|
||||
void commitCellEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue);
|
||||
void commitTableEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue);
|
||||
// temporary methods
|
||||
// Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
|
||||
// firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
|
||||
// instead of something triggered externally.
|
||||
void commitCellEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue,
|
||||
const css::uno::Any& i_oldValue);
|
||||
void commitTableEvent(sal_Int16 const i_eventID, const css::uno::Any& i_newValue,
|
||||
const css::uno::Any& i_oldValue);
|
||||
|
||||
sal_Int32 GetAccessibleControlCount() const;
|
||||
sal_Int32 GetRowCount() const;
|
||||
sal_Int32 GetColumnCount() const;
|
||||
bool ConvertPointToCellAddress(sal_Int32& _rnRow, sal_Int32& _rnColPos,
|
||||
const Point& _rPoint);
|
||||
tools::Rectangle calcHeaderRect(bool _bIsColumnBar);
|
||||
tools::Rectangle calcHeaderCellRect(bool _bIsColumnBar, sal_Int32 nPos);
|
||||
tools::Rectangle calcTableRect();
|
||||
tools::Rectangle calcCellRect(sal_Int32 _nRowPos, sal_Int32 _nColPos);
|
||||
void FillAccessibleStateSetForCell(sal_Int64& _rStateSet, sal_Int32 _nRow,
|
||||
sal_uInt16 _nColumnPos) const;
|
||||
OUString GetRowName(sal_Int32 _nIndex) const;
|
||||
OUString GetColumnName(sal_Int32 _nIndex) const;
|
||||
bool HasRowHeader();
|
||||
bool HasColHeader();
|
||||
OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
|
||||
sal_Int32 GetAccessibleControlCount() const;
|
||||
sal_Int32 GetRowCount() const;
|
||||
sal_Int32 GetColumnCount() const;
|
||||
bool ConvertPointToCellAddress(sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint);
|
||||
tools::Rectangle calcHeaderRect(bool _bIsColumnBar);
|
||||
tools::Rectangle calcHeaderCellRect(bool _bIsColumnBar, sal_Int32 nPos);
|
||||
tools::Rectangle calcTableRect();
|
||||
tools::Rectangle calcCellRect(sal_Int32 _nRowPos, sal_Int32 _nColPos);
|
||||
void FillAccessibleStateSetForCell(sal_Int64& _rStateSet, sal_Int32 _nRow,
|
||||
sal_uInt16 _nColumnPos) const;
|
||||
OUString GetRowName(sal_Int32 _nIndex) const;
|
||||
OUString GetColumnName(sal_Int32 _nIndex) const;
|
||||
bool HasRowHeader();
|
||||
bool HasColHeader();
|
||||
OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
|
||||
|
||||
sal_Int32 GetSelectedRowCount() const;
|
||||
sal_Int32 GetSelectedRowIndex(sal_Int32 const i_selectionIndex) const;
|
||||
bool IsRowSelected(sal_Int32 const i_rowIndex) const;
|
||||
void SelectRow(sal_Int32 const i_rowIndex, bool const i_select);
|
||||
void SelectAllRows(bool const i_select);
|
||||
sal_Int32 GetSelectedRowCount() const;
|
||||
sal_Int32 GetSelectedRowIndex(sal_Int32 const i_selectionIndex) const;
|
||||
bool IsRowSelected(sal_Int32 const i_rowIndex) const;
|
||||
void SelectRow(sal_Int32 const i_rowIndex, bool const i_select);
|
||||
void SelectAllRows(bool const i_select);
|
||||
|
||||
TableCell hitTest(const Point& rPoint) const;
|
||||
void invalidate(const TableArea aArea);
|
||||
TableCell hitTest(const Point& rPoint) const;
|
||||
void invalidate(const TableArea aArea);
|
||||
|
||||
private:
|
||||
DECL_LINK( ImplSelectHdl, LinkParamNone*, void );
|
||||
|
||||
private:
|
||||
TableControl( const TableControl& ) = delete;
|
||||
TableControl& operator=( const TableControl& ) = delete;
|
||||
};
|
||||
private:
|
||||
DECL_LINK(ImplSelectHdl, LinkParamNone*, void);
|
||||
|
||||
private:
|
||||
TableControl(const TableControl&) = delete;
|
||||
TableControl& operator=(const TableControl&) = delete;
|
||||
};
|
||||
|
||||
} // namespace svt::table
|
||||
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -36,578 +36,486 @@ using namespace ::com::sun::star::accessibility;
|
||||
|
||||
namespace svt::table
|
||||
{
|
||||
namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
|
||||
|
||||
//= TableControl
|
||||
|
||||
namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
|
||||
TableControl::TableControl(vcl::Window* _pParent, WinBits _nStyle)
|
||||
: Control(_pParent, _nStyle)
|
||||
, m_pImpl(std::make_shared<TableControl_Impl>(*this))
|
||||
{
|
||||
TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
|
||||
rDataWindow.SetSelectHdl(LINK(this, TableControl, ImplSelectHdl));
|
||||
|
||||
// by default, use the background as determined by the style settings
|
||||
const Color aWindowColor(GetSettings().GetStyleSettings().GetFieldColor());
|
||||
SetBackground(Wallpaper(aWindowColor));
|
||||
GetOutDev()->SetFillColor(aWindowColor);
|
||||
|
||||
//= TableControl
|
||||
SetCompoundControl(true);
|
||||
}
|
||||
|
||||
TableControl::~TableControl() { disposeOnce(); }
|
||||
|
||||
TableControl::TableControl( vcl::Window* _pParent, WinBits _nStyle )
|
||||
:Control( _pParent, _nStyle )
|
||||
,m_pImpl( std::make_shared<TableControl_Impl>( *this ) )
|
||||
void TableControl::dispose()
|
||||
{
|
||||
CallEventListeners(VclEventId::ObjectDying);
|
||||
|
||||
m_pImpl->setModel(PTableModel());
|
||||
m_pImpl->disposeAccessible();
|
||||
m_pImpl.reset();
|
||||
Control::dispose();
|
||||
}
|
||||
|
||||
void TableControl::GetFocus()
|
||||
{
|
||||
if (m_pImpl)
|
||||
m_pImpl->showCursor();
|
||||
|
||||
Control::GetFocus();
|
||||
}
|
||||
|
||||
void TableControl::LoseFocus()
|
||||
{
|
||||
if (m_pImpl)
|
||||
m_pImpl->hideCursor();
|
||||
|
||||
Control::LoseFocus();
|
||||
}
|
||||
|
||||
void TableControl::KeyInput(const KeyEvent& rKEvt)
|
||||
{
|
||||
bool bHandled = false;
|
||||
if (m_pImpl)
|
||||
{
|
||||
TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
|
||||
rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
|
||||
const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
|
||||
sal_uInt16 nKeyCode = rKeyCode.GetCode();
|
||||
|
||||
// by default, use the background as determined by the style settings
|
||||
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
|
||||
SetBackground( Wallpaper( aWindowColor ) );
|
||||
GetOutDev()->SetFillColor( aWindowColor );
|
||||
|
||||
SetCompoundControl( true );
|
||||
}
|
||||
|
||||
|
||||
TableControl::~TableControl()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
void TableControl::dispose()
|
||||
{
|
||||
CallEventListeners( VclEventId::ObjectDying );
|
||||
|
||||
m_pImpl->setModel( PTableModel() );
|
||||
m_pImpl->disposeAccessible();
|
||||
m_pImpl.reset();
|
||||
Control::dispose();
|
||||
}
|
||||
|
||||
|
||||
void TableControl::GetFocus()
|
||||
{
|
||||
if (m_pImpl)
|
||||
m_pImpl->showCursor();
|
||||
|
||||
Control::GetFocus();
|
||||
}
|
||||
|
||||
|
||||
void TableControl::LoseFocus()
|
||||
{
|
||||
if (m_pImpl)
|
||||
m_pImpl->hideCursor();
|
||||
|
||||
Control::LoseFocus();
|
||||
}
|
||||
|
||||
|
||||
void TableControl::KeyInput( const KeyEvent& rKEvt )
|
||||
{
|
||||
bool bHandled = false;
|
||||
if (m_pImpl)
|
||||
struct ActionMapEntry
|
||||
{
|
||||
const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
|
||||
sal_uInt16 nKeyCode = rKeyCode.GetCode();
|
||||
|
||||
struct ActionMapEntry
|
||||
sal_uInt16 nKeyCode;
|
||||
sal_uInt16 nKeyModifier;
|
||||
TableControlAction eAction;
|
||||
} static const aKnownActions[]
|
||||
= { { KEY_DOWN, 0, TableControlAction::cursorDown },
|
||||
{ KEY_UP, 0, TableControlAction::cursorUp },
|
||||
{ KEY_LEFT, 0, TableControlAction::cursorLeft },
|
||||
{ KEY_RIGHT, 0, TableControlAction::cursorRight },
|
||||
{ KEY_HOME, 0, TableControlAction::cursorToLineStart },
|
||||
{ KEY_END, 0, TableControlAction::cursorToLineEnd },
|
||||
{ KEY_PAGEUP, 0, TableControlAction::cursorPageUp },
|
||||
{ KEY_PAGEDOWN, 0, TableControlAction::cursorPageDown },
|
||||
{ KEY_PAGEUP, KEY_MOD1, TableControlAction::cursorToFirstLine },
|
||||
{ KEY_PAGEDOWN, KEY_MOD1, TableControlAction::cursorToLastLine },
|
||||
{ KEY_HOME, KEY_MOD1, TableControlAction::cursorTopLeft },
|
||||
{ KEY_END, KEY_MOD1, TableControlAction::cursorBottomRight },
|
||||
{ KEY_SPACE, KEY_MOD1, TableControlAction::cursorSelectRow },
|
||||
{ KEY_UP, KEY_SHIFT, TableControlAction::cursorSelectRowUp },
|
||||
{ KEY_DOWN, KEY_SHIFT, TableControlAction::cursorSelectRowDown },
|
||||
{ KEY_END, KEY_SHIFT, TableControlAction::cursorSelectRowAreaBottom },
|
||||
{ KEY_HOME, KEY_SHIFT, TableControlAction::cursorSelectRowAreaTop } };
|
||||
for (const ActionMapEntry& rAction : aKnownActions)
|
||||
{
|
||||
if ((rAction.nKeyCode == nKeyCode) && (rAction.nKeyModifier == rKeyCode.GetModifier()))
|
||||
{
|
||||
sal_uInt16 nKeyCode;
|
||||
sal_uInt16 nKeyModifier;
|
||||
TableControlAction eAction;
|
||||
}
|
||||
static const aKnownActions[] = {
|
||||
{ KEY_DOWN, 0, TableControlAction::cursorDown },
|
||||
{ KEY_UP, 0, TableControlAction::cursorUp },
|
||||
{ KEY_LEFT, 0, TableControlAction::cursorLeft },
|
||||
{ KEY_RIGHT, 0, TableControlAction::cursorRight },
|
||||
{ KEY_HOME, 0, TableControlAction::cursorToLineStart },
|
||||
{ KEY_END, 0, TableControlAction::cursorToLineEnd },
|
||||
{ KEY_PAGEUP, 0, TableControlAction::cursorPageUp },
|
||||
{ KEY_PAGEDOWN, 0, TableControlAction::cursorPageDown },
|
||||
{ KEY_PAGEUP, KEY_MOD1, TableControlAction::cursorToFirstLine },
|
||||
{ KEY_PAGEDOWN, KEY_MOD1, TableControlAction::cursorToLastLine },
|
||||
{ KEY_HOME, KEY_MOD1, TableControlAction::cursorTopLeft },
|
||||
{ KEY_END, KEY_MOD1, TableControlAction::cursorBottomRight },
|
||||
{ KEY_SPACE, KEY_MOD1, TableControlAction::cursorSelectRow },
|
||||
{ KEY_UP, KEY_SHIFT, TableControlAction::cursorSelectRowUp },
|
||||
{ KEY_DOWN, KEY_SHIFT, TableControlAction::cursorSelectRowDown },
|
||||
{ KEY_END, KEY_SHIFT, TableControlAction::cursorSelectRowAreaBottom },
|
||||
{ KEY_HOME, KEY_SHIFT, TableControlAction::cursorSelectRowAreaTop }
|
||||
};
|
||||
for (const ActionMapEntry& rAction : aKnownActions)
|
||||
{
|
||||
if ((rAction.nKeyCode == nKeyCode) && (rAction.nKeyModifier == rKeyCode.GetModifier()))
|
||||
{
|
||||
bHandled = m_pImpl->dispatchAction(rAction.eAction);
|
||||
break;
|
||||
}
|
||||
bHandled = m_pImpl->dispatchAction(rAction.eAction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bHandled)
|
||||
Control::KeyInput( rKEvt );
|
||||
else
|
||||
{
|
||||
m_pImpl->commitCellEvent( AccessibleEventId::STATE_CHANGED,
|
||||
Any( AccessibleStateType::FOCUSED ),
|
||||
Any()
|
||||
);
|
||||
// Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every
|
||||
// (handled) key stroke?
|
||||
|
||||
m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
|
||||
Any(),
|
||||
Any()
|
||||
);
|
||||
// ditto: Why do we notify this unconditionally? We should find the right place to notify the
|
||||
// ACTIVE_DESCENDANT_CHANGED event.
|
||||
// Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are
|
||||
// transient, aren't they?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TableControl::StateChanged( StateChangedType i_nStateChange )
|
||||
if (!bHandled)
|
||||
Control::KeyInput(rKEvt);
|
||||
else
|
||||
{
|
||||
Control::StateChanged( i_nStateChange );
|
||||
m_pImpl->commitCellEvent(AccessibleEventId::STATE_CHANGED,
|
||||
Any(AccessibleStateType::FOCUSED), Any());
|
||||
// Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every
|
||||
// (handled) key stroke?
|
||||
|
||||
// forward certain settings to the data window
|
||||
switch ( i_nStateChange )
|
||||
{
|
||||
m_pImpl->commitTableEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any());
|
||||
// ditto: Why do we notify this unconditionally? We should find the right place to notify the
|
||||
// ACTIVE_DESCENDANT_CHANGED event.
|
||||
// Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are
|
||||
// transient, aren't they?
|
||||
}
|
||||
}
|
||||
|
||||
void TableControl::StateChanged(StateChangedType i_nStateChange)
|
||||
{
|
||||
Control::StateChanged(i_nStateChange);
|
||||
|
||||
// forward certain settings to the data window
|
||||
switch (i_nStateChange)
|
||||
{
|
||||
case StateChangedType::ControlFocus:
|
||||
m_pImpl->invalidateSelectedRows();
|
||||
break;
|
||||
|
||||
case StateChangedType::ControlBackground:
|
||||
if ( IsControlBackground() )
|
||||
getDataWindow().SetControlBackground( GetControlBackground() );
|
||||
if (IsControlBackground())
|
||||
getDataWindow().SetControlBackground(GetControlBackground());
|
||||
else
|
||||
getDataWindow().SetControlBackground();
|
||||
break;
|
||||
|
||||
case StateChangedType::ControlForeground:
|
||||
if ( IsControlForeground() )
|
||||
getDataWindow().SetControlForeground( GetControlForeground() );
|
||||
if (IsControlForeground())
|
||||
getDataWindow().SetControlForeground(GetControlForeground());
|
||||
else
|
||||
getDataWindow().SetControlForeground();
|
||||
break;
|
||||
|
||||
case StateChangedType::ControlFont:
|
||||
if ( IsControlFont() )
|
||||
getDataWindow().SetControlFont( GetControlFont() );
|
||||
if (IsControlFont())
|
||||
getDataWindow().SetControlFont(GetControlFont());
|
||||
else
|
||||
getDataWindow().SetControlFont();
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TableControl::Resize()
|
||||
{
|
||||
Control::Resize();
|
||||
m_pImpl->onResize();
|
||||
}
|
||||
|
||||
void TableControl::SetModel(const PTableModel& _pModel) { m_pImpl->setModel(_pModel); }
|
||||
|
||||
PTableModel TableControl::GetModel() const { return m_pImpl->getModel(); }
|
||||
|
||||
sal_Int32 TableControl::GetCurrentRow() const { return m_pImpl->getCurrentRow(); }
|
||||
|
||||
sal_Int32 TableControl::GetCurrentColumn() const { return m_pImpl->getCurrentColumn(); }
|
||||
|
||||
void TableControl::GoTo(ColPos _nColumn, RowPos _nRow) { m_pImpl->goTo(_nColumn, _nRow); }
|
||||
|
||||
void TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
|
||||
{
|
||||
m_pImpl->goTo(_nColPos, _nRowPos);
|
||||
}
|
||||
|
||||
sal_Int32 TableControl::GetSelectedRowCount() const
|
||||
{
|
||||
return sal_Int32(m_pImpl->getSelectedRowCount());
|
||||
}
|
||||
|
||||
sal_Int32 TableControl::GetSelectedRowIndex(sal_Int32 const i_selectionIndex) const
|
||||
{
|
||||
return m_pImpl->getSelectedRowIndex(i_selectionIndex);
|
||||
}
|
||||
|
||||
bool TableControl::IsRowSelected(sal_Int32 const i_rowIndex) const
|
||||
{
|
||||
return m_pImpl->isRowSelected(i_rowIndex);
|
||||
}
|
||||
|
||||
void TableControl::SelectRow(sal_Int32 const i_rowIndex, bool const i_select)
|
||||
{
|
||||
ENSURE_OR_RETURN_VOID((i_rowIndex >= 0) && (i_rowIndex < m_pImpl->getModel()->getRowCount()),
|
||||
"TableControl::SelectRow: invalid row index!");
|
||||
|
||||
if (i_select)
|
||||
{
|
||||
if (!m_pImpl->markRowAsSelected(i_rowIndex))
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pImpl->markRowAsDeselected(i_rowIndex);
|
||||
}
|
||||
|
||||
m_pImpl->invalidateRowRange(i_rowIndex, i_rowIndex);
|
||||
Select();
|
||||
}
|
||||
|
||||
void TableControl::Resize()
|
||||
void TableControl::SelectAllRows(bool const i_select)
|
||||
{
|
||||
if (i_select)
|
||||
{
|
||||
Control::Resize();
|
||||
m_pImpl->onResize();
|
||||
if (!m_pImpl->markAllRowsAsSelected())
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_pImpl->markAllRowsAsDeselected())
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
// TODO: can't we do better than this, and invalidate only the rows which changed?
|
||||
Select();
|
||||
}
|
||||
|
||||
void TableControl::SetModel( const PTableModel& _pModel )
|
||||
SelectionEngine* TableControl::getSelEngine() { return m_pImpl->getSelEngine(); }
|
||||
|
||||
vcl::Window& TableControl::getDataWindow() { return m_pImpl->getDataWindow(); }
|
||||
|
||||
rtl::Reference<comphelper::OAccessible> TableControl::CreateAccessible()
|
||||
{
|
||||
rtl::Reference<comphelper::OAccessible> pParent = GetAccessibleParent();
|
||||
return m_pImpl->getAccessible(pParent);
|
||||
}
|
||||
|
||||
OUString TableControl::GetAccessibleObjectName(AccessibleTableControlObjType eObjType,
|
||||
sal_Int32 _nRow, sal_Int32 _nCol) const
|
||||
{
|
||||
OUString aRetText;
|
||||
//Window* pWin;
|
||||
switch (eObjType)
|
||||
{
|
||||
m_pImpl->setModel( _pModel );
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
aRetText = "Grid control";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
aRetText = "Grid control";
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
aRetText = "RowHeaderBar";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
aRetText = "ColumnHeaderBar";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
//the name of the cell consists of column name and row name if defined
|
||||
//if the name is equal to cell content, it'll be read twice
|
||||
if (GetModel()->hasColumnHeaders())
|
||||
{
|
||||
aRetText = GetColumnName(_nCol) + " , ";
|
||||
}
|
||||
if (GetModel()->hasRowHeaders())
|
||||
{
|
||||
aRetText += GetRowName(_nRow) + " , ";
|
||||
}
|
||||
//aRetText = GetAccessibleCellText(_nRow, _nCol);
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
aRetText = GetRowName(_nRow);
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
aRetText = GetColumnName(_nCol);
|
||||
break;
|
||||
default:
|
||||
OSL_FAIL("GridControl::GetAccessibleName: invalid enum!");
|
||||
}
|
||||
return aRetText;
|
||||
}
|
||||
|
||||
|
||||
PTableModel TableControl::GetModel() const
|
||||
OUString TableControl::GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const
|
||||
{
|
||||
OUString aRetText;
|
||||
switch (eObjType)
|
||||
{
|
||||
return m_pImpl->getModel();
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
aRetText = "Grid control description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
aRetText = "TABLE description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
aRetText = "ROWHEADERBAR description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
aRetText = "COLUMNHEADERBAR description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
// the description of the cell consists of column name and row name if defined
|
||||
// if the name is equal to cell content, it'll be read twice
|
||||
if (GetModel()->hasColumnHeaders())
|
||||
{
|
||||
aRetText = GetColumnName(GetCurrentColumn()) + " , ";
|
||||
}
|
||||
if (GetModel()->hasRowHeaders())
|
||||
{
|
||||
aRetText += GetRowName(GetCurrentRow());
|
||||
}
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
aRetText = "ROWHEADERCELL description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
aRetText = "COLUMNHEADERCELL description";
|
||||
break;
|
||||
}
|
||||
return aRetText;
|
||||
}
|
||||
|
||||
OUString TableControl::GetRowName(sal_Int32 _nIndex) const
|
||||
{
|
||||
OUString sRowName;
|
||||
GetModel()->getRowHeading(_nIndex) >>= sRowName;
|
||||
return sRowName;
|
||||
}
|
||||
|
||||
sal_Int32 TableControl::GetCurrentRow() const
|
||||
OUString TableControl::GetColumnName(sal_Int32 _nIndex) const
|
||||
{
|
||||
return GetModel()->getColumnModel(_nIndex)->getName();
|
||||
}
|
||||
|
||||
OUString TableControl::GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const
|
||||
{
|
||||
return m_pImpl->getCellContentAsString(_nRowPos, _nColPos);
|
||||
}
|
||||
|
||||
void TableControl::FillAccessibleStateSet(sal_Int64& rStateSet,
|
||||
AccessibleTableControlObjType eObjType) const
|
||||
{
|
||||
switch (eObjType)
|
||||
{
|
||||
return m_pImpl->getCurrentRow();
|
||||
}
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
|
||||
rStateSet |= AccessibleStateType::FOCUSABLE;
|
||||
|
||||
sal_Int32 TableControl::GetCurrentColumn() const
|
||||
{
|
||||
return m_pImpl->getCurrentColumn();
|
||||
}
|
||||
if (m_pImpl->getSelEngine()->GetSelectionMode() == SelectionMode::Multiple)
|
||||
rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
|
||||
|
||||
if (HasChildPathFocus())
|
||||
rStateSet |= AccessibleStateType::FOCUSED;
|
||||
|
||||
void TableControl::GoTo( ColPos _nColumn, RowPos _nRow )
|
||||
{
|
||||
m_pImpl->goTo( _nColumn, _nRow );
|
||||
}
|
||||
if (IsActive())
|
||||
rStateSet |= AccessibleStateType::ACTIVE;
|
||||
|
||||
if (m_pImpl->getDataWindow().IsEnabled())
|
||||
{
|
||||
rStateSet |= AccessibleStateType::ENABLED;
|
||||
rStateSet |= AccessibleStateType::SENSITIVE;
|
||||
}
|
||||
|
||||
void TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
|
||||
{
|
||||
m_pImpl->goTo( _nColPos, _nRowPos );
|
||||
}
|
||||
|
||||
|
||||
sal_Int32 TableControl::GetSelectedRowCount() const
|
||||
{
|
||||
return sal_Int32( m_pImpl->getSelectedRowCount() );
|
||||
}
|
||||
|
||||
|
||||
sal_Int32 TableControl::GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const
|
||||
{
|
||||
return m_pImpl->getSelectedRowIndex( i_selectionIndex );
|
||||
}
|
||||
|
||||
|
||||
bool TableControl::IsRowSelected( sal_Int32 const i_rowIndex ) const
|
||||
{
|
||||
return m_pImpl->isRowSelected( i_rowIndex );
|
||||
}
|
||||
|
||||
|
||||
void TableControl::SelectRow( sal_Int32 const i_rowIndex, bool const i_select )
|
||||
{
|
||||
ENSURE_OR_RETURN_VOID( ( i_rowIndex >= 0 ) && ( i_rowIndex < m_pImpl->getModel()->getRowCount() ),
|
||||
"TableControl::SelectRow: invalid row index!" );
|
||||
|
||||
if ( i_select )
|
||||
{
|
||||
if ( !m_pImpl->markRowAsSelected( i_rowIndex ) )
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pImpl->markRowAsDeselected( i_rowIndex );
|
||||
}
|
||||
|
||||
m_pImpl->invalidateRowRange( i_rowIndex, i_rowIndex );
|
||||
Select();
|
||||
}
|
||||
|
||||
|
||||
void TableControl::SelectAllRows( bool const i_select )
|
||||
{
|
||||
if ( i_select )
|
||||
{
|
||||
if ( !m_pImpl->markAllRowsAsSelected() )
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_pImpl->markAllRowsAsDeselected() )
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Invalidate();
|
||||
// TODO: can't we do better than this, and invalidate only the rows which changed?
|
||||
Select();
|
||||
}
|
||||
|
||||
SelectionEngine* TableControl::getSelEngine()
|
||||
{
|
||||
return m_pImpl->getSelEngine();
|
||||
}
|
||||
|
||||
|
||||
vcl::Window& TableControl::getDataWindow()
|
||||
{
|
||||
return m_pImpl->getDataWindow();
|
||||
}
|
||||
|
||||
|
||||
rtl::Reference<comphelper::OAccessible> TableControl::CreateAccessible()
|
||||
{
|
||||
rtl::Reference<comphelper::OAccessible> pParent = GetAccessibleParent();
|
||||
return m_pImpl->getAccessible(pParent);
|
||||
}
|
||||
|
||||
OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
|
||||
{
|
||||
OUString aRetText;
|
||||
//Window* pWin;
|
||||
switch( eObjType )
|
||||
{
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
aRetText = "Grid control";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
aRetText = "Grid control";
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
aRetText = "RowHeaderBar";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
aRetText = "ColumnHeaderBar";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
//the name of the cell consists of column name and row name if defined
|
||||
//if the name is equal to cell content, it'll be read twice
|
||||
if(GetModel()->hasColumnHeaders())
|
||||
{
|
||||
aRetText = GetColumnName(_nCol) + " , ";
|
||||
}
|
||||
if(GetModel()->hasRowHeaders())
|
||||
{
|
||||
aRetText += GetRowName(_nRow) + " , ";
|
||||
}
|
||||
//aRetText = GetAccessibleCellText(_nRow, _nCol);
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
aRetText = GetRowName(_nRow);
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
aRetText = GetColumnName(_nCol);
|
||||
break;
|
||||
default:
|
||||
OSL_FAIL("GridControl::GetAccessibleName: invalid enum!");
|
||||
}
|
||||
return aRetText;
|
||||
}
|
||||
|
||||
|
||||
OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType ) const
|
||||
{
|
||||
OUString aRetText;
|
||||
switch( eObjType )
|
||||
{
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
aRetText = "Grid control description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
aRetText = "TABLE description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
aRetText = "ROWHEADERBAR description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
aRetText = "COLUMNHEADERBAR description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
// the description of the cell consists of column name and row name if defined
|
||||
// if the name is equal to cell content, it'll be read twice
|
||||
if ( GetModel()->hasColumnHeaders() )
|
||||
{
|
||||
aRetText = GetColumnName( GetCurrentColumn() ) + " , ";
|
||||
}
|
||||
if ( GetModel()->hasRowHeaders() )
|
||||
{
|
||||
aRetText += GetRowName( GetCurrentRow() );
|
||||
}
|
||||
break;
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
aRetText = "ROWHEADERCELL description";
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
aRetText = "COLUMNHEADERCELL description";
|
||||
break;
|
||||
}
|
||||
return aRetText;
|
||||
}
|
||||
|
||||
|
||||
OUString TableControl::GetRowName( sal_Int32 _nIndex) const
|
||||
{
|
||||
OUString sRowName;
|
||||
GetModel()->getRowHeading( _nIndex ) >>= sRowName;
|
||||
return sRowName;
|
||||
}
|
||||
|
||||
|
||||
OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
|
||||
{
|
||||
return GetModel()->getColumnModel(_nIndex)->getName();
|
||||
}
|
||||
|
||||
|
||||
OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
|
||||
{
|
||||
return m_pImpl->getCellContentAsString( _nRowPos, _nColPos );
|
||||
}
|
||||
|
||||
|
||||
void TableControl::FillAccessibleStateSet(
|
||||
sal_Int64& rStateSet,
|
||||
AccessibleTableControlObjType eObjType ) const
|
||||
{
|
||||
switch( eObjType )
|
||||
{
|
||||
case AccessibleTableControlObjType::GRIDCONTROL:
|
||||
case AccessibleTableControlObjType::TABLE:
|
||||
|
||||
rStateSet |= AccessibleStateType::FOCUSABLE;
|
||||
|
||||
if ( m_pImpl->getSelEngine()->GetSelectionMode() == SelectionMode::Multiple )
|
||||
rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
|
||||
|
||||
if ( HasChildPathFocus() )
|
||||
rStateSet |= AccessibleStateType::FOCUSED;
|
||||
|
||||
if ( IsActive() )
|
||||
rStateSet |= AccessibleStateType::ACTIVE;
|
||||
|
||||
if ( m_pImpl->getDataWindow().IsEnabled() )
|
||||
{
|
||||
rStateSet |= AccessibleStateType::ENABLED;
|
||||
rStateSet |= AccessibleStateType::SENSITIVE;
|
||||
}
|
||||
|
||||
if ( IsReallyVisible() )
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
|
||||
if ( eObjType == AccessibleTableControlObjType::TABLE )
|
||||
rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
if (IsReallyVisible())
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
|
||||
if (eObjType == AccessibleTableControlObjType::TABLE)
|
||||
rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
|
||||
break;
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
{
|
||||
rStateSet |= AccessibleStateType::FOCUSABLE;
|
||||
if ( HasChildPathFocus() )
|
||||
rStateSet |= AccessibleStateType::FOCUSED;
|
||||
rStateSet |= AccessibleStateType::ACTIVE;
|
||||
rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
rStateSet |= AccessibleStateType::SELECTABLE;
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
rStateSet |= AccessibleStateType::SHOWING;
|
||||
if ( IsRowSelected( GetCurrentRow() ) )
|
||||
// Hmm? Wouldn't we expect the affected row to be a parameter to this function?
|
||||
rStateSet |= AccessibleStateType::SELECTED;
|
||||
}
|
||||
break;
|
||||
case AccessibleTableControlObjType::COLUMNHEADERBAR:
|
||||
case AccessibleTableControlObjType::ROWHEADERBAR:
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
break;
|
||||
case AccessibleTableControlObjType::TABLECELL:
|
||||
{
|
||||
rStateSet |= AccessibleStateType::FOCUSABLE;
|
||||
if (HasChildPathFocus())
|
||||
rStateSet |= AccessibleStateType::FOCUSED;
|
||||
rStateSet |= AccessibleStateType::ACTIVE;
|
||||
rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
rStateSet |= AccessibleStateType::SELECTABLE;
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
rStateSet |= AccessibleStateType::SHOWING;
|
||||
if (IsRowSelected(GetCurrentRow()))
|
||||
// Hmm? Wouldn't we expect the affected row to be a parameter to this function?
|
||||
rStateSet |= AccessibleStateType::SELECTED;
|
||||
}
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::ROWHEADERCELL:
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
break;
|
||||
|
||||
case AccessibleTableControlObjType::COLUMNHEADERCELL:
|
||||
rStateSet |= AccessibleStateType::VISIBLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TableControl::commitCellEvent(sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue)
|
||||
{
|
||||
m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
|
||||
}
|
||||
void TableControl::commitCellEvent(sal_Int16 const i_eventID, const Any& i_newValue,
|
||||
const Any& i_oldValue)
|
||||
{
|
||||
m_pImpl->commitCellEvent(i_eventID, i_newValue, i_oldValue);
|
||||
}
|
||||
|
||||
void TableControl::commitTableEvent(sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue)
|
||||
{
|
||||
m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
|
||||
}
|
||||
void TableControl::commitTableEvent(sal_Int16 const i_eventID, const Any& i_newValue,
|
||||
const Any& i_oldValue)
|
||||
{
|
||||
m_pImpl->commitTableEvent(i_eventID, i_newValue, i_oldValue);
|
||||
}
|
||||
|
||||
bool TableControl::HasRowHeader()
|
||||
{
|
||||
return GetModel()->hasRowHeaders();
|
||||
}
|
||||
bool TableControl::HasRowHeader() { return GetModel()->hasRowHeaders(); }
|
||||
|
||||
bool TableControl::HasColHeader() { return GetModel()->hasColumnHeaders(); }
|
||||
|
||||
bool TableControl::HasColHeader()
|
||||
{
|
||||
return GetModel()->hasColumnHeaders();
|
||||
}
|
||||
sal_Int32 TableControl::GetAccessibleControlCount() const
|
||||
{
|
||||
// TC_TABLE is always defined, no matter whether empty or not
|
||||
sal_Int32 count = 1;
|
||||
if (GetModel()->hasRowHeaders())
|
||||
++count;
|
||||
if (GetModel()->hasColumnHeaders())
|
||||
++count;
|
||||
return count;
|
||||
}
|
||||
|
||||
sal_Int32 TableControl::GetRowCount() const { return GetModel()->getRowCount(); }
|
||||
|
||||
sal_Int32 TableControl::GetAccessibleControlCount() const
|
||||
{
|
||||
// TC_TABLE is always defined, no matter whether empty or not
|
||||
sal_Int32 count = 1;
|
||||
if ( GetModel()->hasRowHeaders() )
|
||||
++count;
|
||||
if ( GetModel()->hasColumnHeaders() )
|
||||
++count;
|
||||
return count;
|
||||
}
|
||||
sal_Int32 TableControl::GetColumnCount() const { return GetModel()->getColumnCount(); }
|
||||
|
||||
sal_Int32 TableControl::GetRowCount() const
|
||||
{
|
||||
return GetModel()->getRowCount();
|
||||
}
|
||||
bool TableControl::ConvertPointToCellAddress(sal_Int32& _rnRow, sal_Int32& _rnColPos,
|
||||
const Point& _rPoint)
|
||||
{
|
||||
_rnRow = m_pImpl->getRowAtPoint(_rPoint);
|
||||
_rnColPos = m_pImpl->getColAtPoint(_rPoint);
|
||||
return _rnRow >= 0;
|
||||
}
|
||||
|
||||
void TableControl::FillAccessibleStateSetForCell(sal_Int64& _rStateSet, sal_Int32 _nRow,
|
||||
sal_uInt16) const
|
||||
{
|
||||
if (IsRowSelected(_nRow))
|
||||
_rStateSet |= AccessibleStateType::SELECTED;
|
||||
if (HasChildPathFocus())
|
||||
_rStateSet |= AccessibleStateType::FOCUSED;
|
||||
else // only transient when column is not focused
|
||||
_rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
|
||||
sal_Int32 TableControl::GetColumnCount() const
|
||||
{
|
||||
return GetModel()->getColumnCount();
|
||||
}
|
||||
_rStateSet |= AccessibleStateType::VISIBLE;
|
||||
_rStateSet |= AccessibleStateType::SHOWING;
|
||||
_rStateSet |= AccessibleStateType::ENABLED;
|
||||
_rStateSet |= AccessibleStateType::SENSITIVE;
|
||||
_rStateSet |= AccessibleStateType::ACTIVE;
|
||||
}
|
||||
|
||||
tools::Rectangle TableControl::calcHeaderRect(bool _bIsColumnBar)
|
||||
{
|
||||
return m_pImpl->calcHeaderRect(_bIsColumnBar);
|
||||
}
|
||||
|
||||
bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
|
||||
{
|
||||
_rnRow = m_pImpl->getRowAtPoint( _rPoint );
|
||||
_rnColPos = m_pImpl->getColAtPoint( _rPoint );
|
||||
return _rnRow >= 0;
|
||||
}
|
||||
tools::Rectangle TableControl::calcHeaderCellRect(bool _bIsColumnBar, sal_Int32 nPos)
|
||||
{
|
||||
return m_pImpl->calcHeaderCellRect(_bIsColumnBar, nPos);
|
||||
}
|
||||
|
||||
tools::Rectangle TableControl::calcTableRect() { return m_pImpl->calcTableRect(); }
|
||||
|
||||
void TableControl::FillAccessibleStateSetForCell( sal_Int64& _rStateSet, sal_Int32 _nRow, sal_uInt16 ) const
|
||||
{
|
||||
if ( IsRowSelected( _nRow ) )
|
||||
_rStateSet |= AccessibleStateType::SELECTED;
|
||||
if ( HasChildPathFocus() )
|
||||
_rStateSet |= AccessibleStateType::FOCUSED;
|
||||
else // only transient when column is not focused
|
||||
_rStateSet |= AccessibleStateType::TRANSIENT;
|
||||
tools::Rectangle TableControl::calcCellRect(sal_Int32 _nRowPos, sal_Int32 _nColPos)
|
||||
{
|
||||
return m_pImpl->calcCellRect(_nRowPos, _nColPos);
|
||||
}
|
||||
|
||||
_rStateSet |= AccessibleStateType::VISIBLE;
|
||||
_rStateSet |= AccessibleStateType::SHOWING;
|
||||
_rStateSet |= AccessibleStateType::ENABLED;
|
||||
_rStateSet |= AccessibleStateType::SENSITIVE;
|
||||
_rStateSet |= AccessibleStateType::ACTIVE;
|
||||
}
|
||||
IMPL_LINK_NOARG(TableControl, ImplSelectHdl, LinkParamNone*, void) { Select(); }
|
||||
|
||||
void TableControl::Select()
|
||||
{
|
||||
ImplCallEventListenersAndHandler(VclEventId::TableRowSelect, nullptr);
|
||||
m_pImpl->commitAccessibleEvent(AccessibleEventId::SELECTION_CHANGED);
|
||||
|
||||
tools::Rectangle TableControl::calcHeaderRect(bool _bIsColumnBar )
|
||||
{
|
||||
return m_pImpl->calcHeaderRect(_bIsColumnBar);
|
||||
}
|
||||
m_pImpl->commitTableEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any());
|
||||
// TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
|
||||
// actually, when the active descendant, i.e. the current cell, *really* changed?
|
||||
}
|
||||
|
||||
TableCell TableControl::hitTest(const Point& rPoint) const { return m_pImpl->hitTest(rPoint); }
|
||||
|
||||
tools::Rectangle TableControl::calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos )
|
||||
{
|
||||
return m_pImpl->calcHeaderCellRect( _bIsColumnBar, nPos );
|
||||
}
|
||||
|
||||
|
||||
tools::Rectangle TableControl::calcTableRect()
|
||||
{
|
||||
return m_pImpl->calcTableRect();
|
||||
}
|
||||
|
||||
|
||||
tools::Rectangle TableControl::calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos )
|
||||
{
|
||||
return m_pImpl->calcCellRect( _nRowPos, _nColPos );
|
||||
}
|
||||
|
||||
|
||||
IMPL_LINK_NOARG(TableControl, ImplSelectHdl, LinkParamNone*, void)
|
||||
{
|
||||
Select();
|
||||
}
|
||||
|
||||
|
||||
void TableControl::Select()
|
||||
{
|
||||
ImplCallEventListenersAndHandler( VclEventId::TableRowSelect, nullptr );
|
||||
m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED );
|
||||
|
||||
m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() );
|
||||
// TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
|
||||
// actually, when the active descendant, i.e. the current cell, *really* changed?
|
||||
}
|
||||
|
||||
TableCell TableControl::hitTest(const Point& rPoint) const
|
||||
{
|
||||
return m_pImpl->hitTest(rPoint);
|
||||
}
|
||||
|
||||
void TableControl::invalidate(const TableArea aArea)
|
||||
{
|
||||
return m_pImpl->invalidate(aArea);
|
||||
}
|
||||
void TableControl::invalidate(const TableArea aArea) { return m_pImpl->invalidate(aArea); }
|
||||
|
||||
} // namespace svt::table
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user