From 9124f7e8bc2b9b718d82e3734b4d4799ed1fcff1 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 6 May 2014 15:29:12 +0300 Subject: Move headers included only in svtools to svtools Change-Id: I66e443b5b641aaf16e1918f139a6b6a173ef7d4c --- svtools/inc/roadmap.hxx | 123 +++++++++++++ svtools/inc/table/defaultinputhandler.hxx | 65 +++++++ svtools/inc/table/gridtablerenderer.hxx | 121 +++++++++++++ svtools/inc/table/tablecontrol.hxx | 218 +++++++++++++++++++++++ svtools/inc/table/tablecontrolinterface.hxx | 257 ++++++++++++++++++++++++++++ svtools/inc/vclxaccessibleheaderbar.hxx | 84 +++++++++ svtools/inc/vclxaccessibleheaderbaritem.hxx | 114 ++++++++++++ 7 files changed, 982 insertions(+) create mode 100644 svtools/inc/roadmap.hxx create mode 100644 svtools/inc/table/defaultinputhandler.hxx create mode 100644 svtools/inc/table/gridtablerenderer.hxx create mode 100644 svtools/inc/table/tablecontrol.hxx create mode 100644 svtools/inc/table/tablecontrolinterface.hxx create mode 100644 svtools/inc/vclxaccessibleheaderbar.hxx create mode 100644 svtools/inc/vclxaccessibleheaderbaritem.hxx (limited to 'svtools/inc') diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx new file mode 100644 index 000000000000..429806706b1e --- /dev/null +++ b/svtools/inc/roadmap.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVTOOLS_ROADMAP_HXX +#define INCLUDED_SVTOOLS_ROADMAP_HXX + +#include +#include +#include + +#include + + + + +class Bitmap; + +namespace svt +{ + + + struct RoadmapTypes + { + public: + typedef sal_Int16 ItemId; + typedef sal_Int32 ItemIndex; + }; + + class RoadmapImpl; + class RoadmapItem; + + + //= Roadmap + + class SVT_DLLPUBLIC ORoadmap : public Control, public RoadmapTypes + { + protected: + RoadmapImpl* m_pImpl; + // Window overridables + void Paint( const Rectangle& _rRect ) SAL_OVERRIDE; + void implInit(); + + public: + ORoadmap( Window* _pParent, WinBits _nWinStyle = 0 ); + virtual ~ORoadmap( ); + + void SetRoadmapBitmap( const BitmapEx& maBitmap, bool _bInvalidate = true ); + + void EnableRoadmapItem( ItemId _nItemId, bool _bEnable, ItemIndex _nStartIndex = 0 ); + + void ChangeRoadmapItemLabel( ItemId _nID, const OUString& sLabel, ItemIndex _nStartIndex = 0 ); + void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 ); + + void SetRoadmapInteractive( bool _bInteractive ); + bool IsRoadmapInteractive(); + + void SetRoadmapComplete( bool _bComplete ); + bool IsRoadmapComplete() const; + + ItemIndex GetItemCount() const; + ItemId GetItemID( ItemIndex _nIndex ) const; + + void InsertRoadmapItem( ItemIndex _Index, const OUString& _RoadmapItem, ItemId _nUniqueId, bool _bEnabled = true ); + void ReplaceRoadmapItem( ItemIndex _Index, const OUString& _RoadmapItem, ItemId _nUniqueId, bool _bEnabled ); + void DeleteRoadmapItem( ItemIndex _nIndex ); + + ItemId GetCurrentRoadmapItemID() const; + bool SelectRoadmapItemByID( ItemId _nItemID ); + + void SetItemSelectHdl( const Link& _rHdl ); + Link GetItemSelectHdl( ) const; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; + virtual void GetFocus() SAL_OVERRIDE; + + + protected: + bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; + + protected: + /// called when an item has been selected by any means + virtual void Select(); + + private: + DECL_LINK(ImplClickHdl, HyperLabel*); + + RoadmapItem* GetByIndex( ItemIndex _nItemIndex ); + const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const; + + RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ); + const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const; + RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index); + + void DrawHeadline(); + void DeselectOldRoadmapItems(); + ItemId GetNextAvailableItemId( ItemIndex _NewIndex ); + ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex ); + RoadmapItem* GetByPointer(Window* pWindow); + RoadmapItem* InsertHyperLabel( ItemIndex _Index, const OUString& _aStr, ItemId _RMID, bool _bEnabled = true ); + void UpdatefollowingHyperLabels( ItemIndex _Index ); + }; + + +} // namespace svt + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/table/defaultinputhandler.hxx b/svtools/inc/table/defaultinputhandler.hxx new file mode 100644 index 000000000000..24945278a4c0 --- /dev/null +++ b/svtools/inc/table/defaultinputhandler.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX +#define INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX + +#include +#include + +#include + + +namespace svt { namespace table +{ + + + struct DefaultInputHandler_Impl; + + + //= DefaultInputHandler + + class DefaultInputHandler : public ITableInputHandler + { + private: + ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl; + + public: + DefaultInputHandler(); + virtual ~DefaultInputHandler(); + + virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE; + virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) SAL_OVERRIDE; + virtual bool GetFocus ( ITableControl& _rControl ) SAL_OVERRIDE; + virtual bool LoseFocus ( ITableControl& _rControl ) SAL_OVERRIDE; + virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ) SAL_OVERRIDE; + virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ) SAL_OVERRIDE; + virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ) SAL_OVERRIDE; + virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ) SAL_OVERRIDE; + }; + + +} } // namespace svt::table + + +#endif // INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/table/gridtablerenderer.hxx b/svtools/inc/table/gridtablerenderer.hxx new file mode 100644 index 000000000000..c06f0baadd15 --- /dev/null +++ b/svtools/inc/table/gridtablerenderer.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX +#define INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX + +#include + +#include + + +namespace svt { namespace table +{ + + + struct GridTableRenderer_Impl; + + + //= GridTableRenderer + + /** a default implementation for the ->ITableRenderer interface + + This class is able to paint a table grid, table headers, and cell + backgrounds according to the selected/active state of cells. + */ + class GridTableRenderer : public ITableRenderer + { + private: + ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl; + + public: + /** creates a table renderer associated with the given model + + @param _rModel + the model which should be rendered. The caller is responsible + for lifetime control, that is, the model instance must live + at least as long as the renderer instance lives + */ + GridTableRenderer( ITableModel& _rModel ); + virtual ~GridTableRenderer(); + + /** determines whether or not to paint grid lines + */ + bool useGridLines() const; + + /** controls whether or not to paint grid lines + */ + void useGridLines( bool const i_use ); + + public: + // ITableRenderer overridables + virtual void PaintHeaderArea( + OutputDevice& _rDevice, const Rectangle& _rArea, + bool _bIsColHeaderArea, bool _bIsRowHeaderArea, + const StyleSettings& _rStyle ) SAL_OVERRIDE; + virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rArea, + const StyleSettings& _rStyle ) SAL_OVERRIDE; + virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rRowArea, + const StyleSettings& _rStyle ) SAL_OVERRIDE; + virtual void PaintRowHeader( + bool i_hasControlFocus, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rArea, + const StyleSettings& _rStyle ) SAL_OVERRIDE; + virtual void PaintCell( ColPos const i_col, + bool i_hasControlFocus, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rArea, + const StyleSettings& _rStyle ) SAL_OVERRIDE; + virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE; + virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE; + virtual bool FitsIntoCell( + ::com::sun::star::uno::Any const & i_cellContent, + ColPos const i_colPos, RowPos const i_rowPos, + bool const i_active, bool const i_selected, + OutputDevice& i_targetDevice, Rectangle const & i_targetArea + ) const SAL_OVERRIDE; + virtual bool GetFormattedCellString( + ::com::sun::star::uno::Any const & i_cellValue, + ColPos const i_colPos, RowPos const i_rowPos, + OUString & o_cellString + ) const SAL_OVERRIDE; + + private: + struct CellRenderContext; + + void impl_paintCellContent( + CellRenderContext const & i_context + ); + void impl_paintCellImage( + CellRenderContext const & i_context, + Image const & i_image + ); + void impl_paintCellText( + CellRenderContext const & i_context, + OUString const & i_text + ); + }; + +} } // namespace svt::table + + +#endif // INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx new file mode 100644 index 000000000000..4d05ee2d8371 --- /dev/null +++ b/svtools/inc/table/tablecontrol.hxx @@ -0,0 +1,218 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX +#define INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX + +#include +#include +#include +#include + +#include +#include + +#include +#include + + + +namespace svt { namespace table +{ + + + class TableControl_Impl; + + + //= TableControl + + /** a basic control which manages table-like data, i.e. a number of cells + organized in m rows and n 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. + + 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 current (or active + cell). + The control supports accessibility, this is encapsulated in IAccessibleTable + */ + class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable + { + private: + ::boost::shared_ptr< TableControl_Impl > m_pImpl; + + + public: + TableControl( Window* _pParent, WinBits _nStyle ); + virtual ~TableControl(); + + /// sets a new table model + void SetModel( 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. + */ + sal_Int32 GetCurrentRow() const SAL_OVERRIDE; + + ITableControl& + getTableControlInterface(); + + /** retrieves the current column + + 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 SAL_OVERRIDE; + + /** activates the cell at the given position + + @return + if the move was successful, otherwise. Usual + failure conditions include some other instance vetoing the move, + or impossibility to execute the move at all (for instance because + of invalid coordinates). + */ + bool GoTo( ColPos _nColumnPos, RowPos _nRow); + + /** moves the active cell to the given column, by keeping the active row + + @return + if the move was successful, otherwise. Usual + failure conditions include some other instance vetoing the move, + or impossibility to execute the move at all (for instance because + of invalid coordinates). + */ + inline bool GoToColumn( ColPos _nColumn ) + { + return GoTo( _nColumn, GetCurrentRow() ); + } + + /** moves the active cell to the given row, by keeping the active column + + @return + if the move was successful, otherwise. Usual + failure conditions include some other instance vetoing the move, + or impossibility to execute the move at all (for instance because + of invalid coordinates). + */ + bool GoToRow( RowPos _nRow ) + { + return GoTo( GetCurrentColumn(), _nRow ); + } + + SVT_DLLPRIVATE virtual void Resize() SAL_OVERRIDE; + virtual void Select(); + + /**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(); + Window& getDataWindow(); + + // Window overridables + virtual void GetFocus() SAL_OVERRIDE; + virtual void LoseFocus() SAL_OVERRIDE; + virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; + virtual void StateChanged( StateChangedType i_nStateChange ) SAL_OVERRIDE; + + /** Creates and returns the accessible object of the whole GridControl. */ + SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; + SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) SAL_OVERRIDE; + SVT_DLLPRIVATE virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const SAL_OVERRIDE; + SVT_DLLPRIVATE virtual bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) SAL_OVERRIDE; + SVT_DLLPRIVATE virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const SAL_OVERRIDE; + SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const SAL_OVERRIDE; + + // 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 commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue ); + void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue ); + + + // IAccessibleTable + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const SAL_OVERRIDE; + virtual void GrabFocus() SAL_OVERRIDE; + virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) SAL_OVERRIDE; + virtual Window* GetAccessibleParentWindow() const SAL_OVERRIDE; + virtual Window* GetWindowInstance() SAL_OVERRIDE; + virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE; + virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) SAL_OVERRIDE; + virtual long GetRowCount() const SAL_OVERRIDE; + virtual long GetColumnCount() const SAL_OVERRIDE; + virtual bool HasRowHeader() const SAL_OVERRIDE; + virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) SAL_OVERRIDE; + virtual Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) SAL_OVERRIDE; + virtual Rectangle calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos) SAL_OVERRIDE; + virtual Rectangle calcTableRect( bool _bOnScreen = true ) SAL_OVERRIDE; + virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) SAL_OVERRIDE; + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE; + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE; + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const SAL_OVERRIDE; + virtual OUString GetRowDescription( sal_Int32 _nRow ) const SAL_OVERRIDE; + virtual OUString GetRowName(sal_Int32 _nIndex) const SAL_OVERRIDE; + virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const SAL_OVERRIDE; + virtual OUString GetColumnName( sal_Int32 _nIndex ) const SAL_OVERRIDE; + virtual css::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const SAL_OVERRIDE; + virtual bool HasRowHeader() SAL_OVERRIDE; + virtual bool HasColHeader() SAL_OVERRIDE; + virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const SAL_OVERRIDE; + + virtual sal_Int32 GetSelectedRowCount() const SAL_OVERRIDE; + virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const SAL_OVERRIDE; + virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const SAL_OVERRIDE; + virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) SAL_OVERRIDE; + virtual void SelectAllRows( bool const i_select ) SAL_OVERRIDE; + + + private: + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + + private: + TableControl(); // never implemented + TableControl( const TableControl& ); // never implemented + TableControl& operator=( const TableControl& ); // never implemented + }; + + +} } // namespace svt::table + + +#endif // INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/table/tablecontrolinterface.hxx b/svtools/inc/table/tablecontrolinterface.hxx new file mode 100644 index 000000000000..553ce4078729 --- /dev/null +++ b/svtools/inc/table/tablecontrolinterface.hxx @@ -0,0 +1,257 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX +#define INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX + +#include +#include +#include + +#include +#include + +class Pointer; + + +namespace svt { namespace table +{ + + + + //= TableControlAction + + enum TableControlAction + { + /// moves the cursor in the table control one row up, if possible, by keeping the current column + cursorUp, + /// moves the cursor in the table control one row down, if possible, by keeping the current column + cursorDown, + /// moves the cursor in the table control one column to the left, if possible, by keeping the current row + cursorLeft, + /// moves the cursor in the table control one column to the right, if possible, by keeping the current row + cursorRight, + /// moves the cursor to the beginning of the current line + cursorToLineStart, + /// moves the cursor to the end of the current line + cursorToLineEnd, + /// moves the cursor to the first row, keeping the current column + cursorToFirstLine, + /// moves the cursor to the last row, keeping the current column + cursorToLastLine, + /// moves the cursor one page up, keeping the current column + cursorPageUp, + /// moves the cursor one page down, keeping the current column + cursorPageDown, + /// moves the cursor to the top-most, left-most cell + cursorTopLeft, + /// moves the cursor to the bottom-most, right-most cell + cursorBottomRight, + /// selects the row, where the actual cursor is + cursorSelectRow, + /// selects the rows, above the actual cursor is + cursorSelectRowUp, + /// selects the row, beneath the actual cursor is + cursorSelectRowDown, + /// selects the row, from the actual cursor till top + cursorSelectRowAreaTop, + /// selects the row, from the actual cursor till bottom + cursorSelectRowAreaBottom, + + /// invalid and final enumeration value, not to be actually used + invalidTableControlAction + }; + + + //= TableCellArea + + enum TableCellArea + { + CellContent, + ColumnDivider + }; + + + //= TableCell + + struct TableCell + { + ColPos nColumn; + RowPos nRow; + TableCellArea eArea; + + TableCell() + :nColumn( COL_INVALID ) + ,nRow( ROW_INVALID ) + ,eArea( CellContent ) + { + } + + TableCell( ColPos const i_column, RowPos const i_row ) + :nColumn( i_column ) + ,nRow( i_row ) + ,eArea( CellContent ) + { + } + }; + + + //= ColumnMetrics + + struct ColumnMetrics + { + /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible + area. Note: see below. + */ + long nStartPixel; + + /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns + up to the current one. + + Huh? Earlier you said that the nStartPixel of columns + scrolled out (to the left) of the visible area is + negative. Also, where is the promise that there is no gap + between columns? The above claim would be true only if the + first column always started at zero, and there is never a + gap. So these doc comments are inconsistent. How + surprising. + */ + long nEndPixel; + + ColumnMetrics() + :nStartPixel(0) + ,nEndPixel(0) + { + } + + ColumnMetrics( long const i_start, long const i_end ) + :nStartPixel( i_start ) + ,nEndPixel( i_end ) + { + } + }; + + + //= TableArea + + enum TableArea + { + TableAreaColumnHeaders, + TableAreaRowHeaders, + TableAreaDataArea, + TableAreaAll + }; + + + //= ITableControl + + /** defines a callback interface to be implemented by a concrete table control + */ + class SAL_NO_VTABLE ITableControl + { + public: + /** hides the cell cursor + + The method cares for successive calls, that is, for every call to + ->hideCursor(), you need one call to ->showCursor. Only if the number + of both calls matches, the cursor is really shown. + + @see showCursor + */ + virtual void hideCursor() = 0; + + /** shows the cell cursor + + @see hideCursor + */ + virtual void showCursor() = 0; + + /** dispatches an action to the table control + + @return + if the action could be dispatched successfully, otherwise. Usual + failure conditions include some other instance vetoing the action, or impossibility + to execute the action at all (for instance moving up one row when already positioned + on the very first row). + + @see TableControlAction + */ + virtual bool dispatchAction( TableControlAction _eAction ) = 0; + + /** returns selection engine*/ + virtual SelectionEngine* getSelEngine() = 0; + + /** returns the table model + + The returned model is guaranteed to not be . + */ + virtual PTableModel getModel() const = 0; + + /// returns the index of the currently active column + virtual ColPos getCurrentColumn() const = 0; + + /// returns the index of the currently active row + virtual RowPos getCurrentRow() const = 0; + + /// activates the given cell + virtual bool activateCell( ColPos const i_col, RowPos const i_row ) = 0; + + /// retrieves the size of the table window, in pixels + virtual ::Size getTableSizePixel() const = 0; + + /// sets a new mouse pointer for the table window + virtual void setPointer( Pointer const & i_pointer ) = 0; + + /// captures the mouse to the table window + virtual void captureMouse() = 0; + + /// releases the mouse, after it had previously been captured + virtual void releaseMouse() = 0; + + /// invalidates the table window + virtual void invalidate( TableArea const i_what ) = 0; + + /// calculates a width, given in pixels, into a AppFont-based width + virtual long pixelWidthToAppFont( long const i_pixels ) const = 0; + + /// shows a trackign rectangle + virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0; + + /// hides a prviously shown tracking rectangle + virtual void hideTracking() = 0; + + /// does a hit test for the given pixel coordinates + virtual TableCell hitTest( const Point& rPoint ) const = 0; + + /// retrieves the metrics for a given column + virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0; + + /// determines whether a given row is selected + virtual bool isRowSelected( RowPos _nRow ) const = 0; + + virtual ~ITableControl() {}; + }; + + +} } // namespace svt::table + + +#endif // INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/vclxaccessibleheaderbar.hxx b/svtools/inc/vclxaccessibleheaderbar.hxx new file mode 100644 index 000000000000..9fda343e9ab0 --- /dev/null +++ b/svtools/inc/vclxaccessibleheaderbar.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX +#define INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX + +#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_ +#include +#endif +#ifndef _HEADBAR_HXX +#include +#endif +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#include "toolkit/awt/vclxwindow.hxx" +#endif +class HeaderBar; + + +// class VCLXAccessibleHeaderBar + + +typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > > + ListItems; + +class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent +{ + +public: + HeaderBar* m_pHeadBar; + virtual ~VCLXAccessibleHeaderBar(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE; + + VCLXAccessibleHeaderBar( VCLXWindow* pVCLXindow ); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +public: + virtual void SAL_CALL disposing (void) SAL_OVERRIDE; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateChild(sal_Int32 i); + +private: + ListItems m_aAccessibleChildren; + + +}; + +class VCLXHeaderBar : public VCLXWindow +{ +public: + VCLXHeaderBar(Window* pHeaderBar); + virtual ~VCLXHeaderBar(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext() SAL_OVERRIDE; + +}; + +#endif // INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/vclxaccessibleheaderbaritem.hxx b/svtools/inc/vclxaccessibleheaderbaritem.hxx new file mode 100644 index 000000000000..28b80b1e7340 --- /dev/null +++ b/svtools/inc/vclxaccessibleheaderbaritem.hxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBARITEM_HXX +#define INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBARITEM_HXX + +#include +#include +#include +#include + +#include + +#include + +class HeaderBar; +class VCLExternalSolarLock; +class VclSimpleEvent; +class VclWindowEvent; + +namespace utl { +class AccessibleStateSetHelper; +} + + +// ---------------------------------------------------- +// class VCLXAccessibleHeaderBarItem +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +typedef ::cppu::ImplHelper2< +::com::sun::star::accessibility::XAccessible, +::com::sun::star::lang::XServiceInfo > VCLXAccessibleHeaderBarItem_BASE; + +class VCLXAccessibleHeaderBarItem : public AccessibleExtendedComponentHelper_BASE, + public VCLXAccessibleHeaderBarItem_BASE +{ +private: + VCLExternalSolarLock* m_pExternalLock; + HeaderBar* m_pHeadBar; + sal_Int32 m_nIndexInParent; + +protected: + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE; + + // XComponent + virtual void SAL_CALL disposing() SAL_OVERRIDE; + +public: + VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ); + virtual ~VCLXAccessibleHeaderBarItem(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE {}; + virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +}; + +#endif // INCLUDED_SVTOOLS_VCLXACCESSIBLEHEADERBARITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit