diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-02-17 16:53:53 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-02-17 16:53:53 +0100 |
commit | 7b54316a19fab04f52ab5bb55e7f5845eba56530 (patch) | |
tree | 2f3d090c899cb6d2ed42d81b8b7ceea8ec91e3d3 /svtools/inc | |
parent | 8eb916a342a3b1f217a7141aa3c0a7ea1d7bd53f (diff) | |
parent | db8eb68761bee1f15efa5484c24ac8599fb5188b (diff) |
CWS-TOOLING: integrate CWS gridsort
Diffstat (limited to 'svtools/inc')
-rwxr-xr-x | svtools/inc/svtools/accessiblefactory.hxx | 15 | ||||
-rw-r--r-- | svtools/inc/svtools/accessibletable.hxx | 10 | ||||
-rw-r--r-- | svtools/inc/svtools/table/abstracttablecontrol.hxx | 134 | ||||
-rw-r--r-- | svtools/inc/svtools/table/defaultinputhandler.hxx | 41 | ||||
-rw-r--r-- | svtools/inc/svtools/table/gridtablerenderer.hxx | 50 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tablecontrol.hxx | 165 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tablecontrolinterface.hxx | 254 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tabledatawindow.hxx | 86 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tableinputhandler.hxx | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | svtools/inc/svtools/table/tablemodel.hxx | 331 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tablerenderer.hxx | 79 | ||||
-rwxr-xr-x | svtools/inc/svtools/table/tablesort.hxx | 91 | ||||
-rw-r--r-- | svtools/inc/svtools/table/tabletypes.hxx | 7 |
13 files changed, 725 insertions, 560 deletions
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index 9606e93a2fa0..372af4fdca25 100755 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -28,16 +28,12 @@ #ifndef SVTOOLS_ACCESSIBLE_FACTORY_HXX #define SVTOOLS_ACCESSIBLE_FACTORY_HXX -#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX +#include "AccessibleBrowseBoxObjType.hxx" +#include "accessibletableprovider.hxx" + #include <com/sun/star/uno/Reference.hxx> -#endif -#ifndef _RTL_REF_HXX #include <rtl/ref.hxx> -#endif -#include "AccessibleBrowseBoxObjType.hxx" -#include "accessibletableprovider.hxx" -#include "accessibletable.hxx" namespace com { namespace sun { namespace star { namespace accessibility { @@ -64,6 +60,11 @@ namespace svt class ToolPanelDeck; class IToolPanelDeck; class PanelTabBar; + namespace table + { + class IAccessibleTable; + class IAccessibleTableControl; + } /** a function which is able to create a factory for the standard Accessible/Context components needed for standard toolkit controls diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index 807760ef9b97..d7bd98481404 100644 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -109,8 +109,6 @@ public: virtual long GetRowCount() const= 0; virtual long GetColumnCount() const= 0; virtual sal_Bool HasRowHeader() const= 0; - virtual sal_Int32 GetSelectedRowCount() const= 0; - virtual bool IsRowSelected( long _nRow ) const= 0; virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0; virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0; virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0; @@ -122,9 +120,13 @@ public: virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0; virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; - virtual std::vector<sal_Int32>& GetSelectedRows() = 0; - virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0; virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; + + virtual sal_Int32 GetSelectedRowCount() const = 0; + virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0; + virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0; + virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0; + virtual void SelectAllRows( bool const i_select ) = 0; }; // ---------------------------------------------------------------------------- diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx deleted file mode 100644 index 9206f20ecbcb..000000000000 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX -#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX - -#include <sal/types.h> -#include <vcl/event.hxx> -#include <vcl/seleng.hxx> -#include "tabletypes.hxx" -//........................................................................ -namespace svt { namespace table -{ -//........................................................................ - - 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 - }; - - //==================================================================== - //= IAbstractTableControl - //==================================================================== - /** defines a callback interface to be implemented by a concrete table control - */ - class SAL_NO_VTABLE IAbstractTableControl - { - 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 - <TRUE/> if the action could be dispatched successfully, <FALSE/> 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; - virtual void setCursorAtCurrentCell(const Point& rPoint) = 0; - virtual bool isTooltipActive() = 0; - virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; - virtual RowPos getCurrentRow(const Point& rPoint ) = 0; - virtual void resizeColumn(const Point& rPoint ) = 0; - virtual bool startResizeColumn(const Point& rPoint) = 0; - virtual bool endResizeColumn(const Point& rPoint) = 0; - virtual bool isRowSelected(RowPos _nRow) = 0; - - virtual ~IAbstractTableControl() {}; - }; - -//........................................................................ -} } // namespace svt::table -//........................................................................ - -#endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx index ca760896d539..6990f903cdb2 100644 --- a/svtools/inc/svtools/table/defaultinputhandler.hxx +++ b/svtools/inc/svtools/table/defaultinputhandler.hxx @@ -27,43 +27,44 @@ #ifndef SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX #define SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX -#include <svtools/table/tableinputhandler.hxx> +#include "svtools/table/tableinputhandler.hxx" +#include "svtools/table/tabletypes.hxx" -//........................................................................ +#include <boost/scoped_ptr.hpp> + +//...................................................................................................................... namespace svt { namespace table { -//........................................................................ +//...................................................................................................................... struct DefaultInputHandler_Impl; - //==================================================================== + //================================================================================================================== //= DefaultInputHandler - //==================================================================== + //================================================================================================================== class DefaultInputHandler : public ITableInputHandler { - friend class TableDataWindow; private: - DefaultInputHandler_Impl* m_pImpl; - bool m_bResize; + ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl; public: DefaultInputHandler(); ~DefaultInputHandler(); - virtual bool MouseMove ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ); - virtual bool MouseButtonDown ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ); - virtual bool MouseButtonUp ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ); - virtual bool KeyInput ( IAbstractTableControl& _rControl, const KeyEvent& rKEvt ); - virtual bool GetFocus ( IAbstractTableControl& _rControl ); - virtual bool LoseFocus ( IAbstractTableControl& _rControl ); - virtual bool RequestHelp ( IAbstractTableControl& _rControl, const HelpEvent& rHEvt ); - virtual bool Command ( IAbstractTableControl& _rControl, const CommandEvent& rCEvt ); - virtual bool PreNotify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ); - virtual bool Notify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ); + virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ); + virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ); + virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ); + virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ); + virtual bool GetFocus ( ITableControl& _rControl ); + virtual bool LoseFocus ( ITableControl& _rControl ); + virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ); + virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ); + virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ); + virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ); }; -//........................................................................ +//...................................................................................................................... } } // namespace svt::table -//........................................................................ +//...................................................................................................................... #endif // SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index e474306c0423..c472fa408574 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -29,6 +29,8 @@ #include <svtools/table/tablemodel.hxx> +#include <boost/scoped_ptr.hpp> + //........................................................................ namespace svt { namespace table { @@ -43,14 +45,11 @@ namespace svt { namespace table This class is able to paint a table grid, table headers, and cell backgrounds according to the selected/active state of cells. - - TODO update the documentation when it's decided whether this renderer - also does value handling */ class GridTableRenderer : public ITableRenderer { private: - GridTableRenderer_Impl* m_pImpl; + ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl; public: /** creates a table renderer associated with the given model @@ -72,9 +71,17 @@ namespace svt { namespace table This method returns the index of the last row which has been prepared */ - RowPos getCurrentRow(); + RowPos getCurrentRow() const; + + /** determines whether or not to paint grid lines + */ + bool useGridLines() const; - protected: + /** 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, @@ -89,17 +96,34 @@ namespace svt { namespace table virtual void PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ); - virtual void PaintCellImage( ColPos _nColumn, - bool _bActive, bool _bSelected, - OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, Image* _pCellData ); - virtual void PaintCellString( ColPos _nColumn, + const StyleSettings& _rStyle ); + virtual void PaintCell( ColPos const i_col, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ); + const StyleSettings& _rStyle ); virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect); virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect); + 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 + ); + + 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, + ::rtl::OUString const & i_text + ); }; //........................................................................ } } // namespace svt::table diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 28ac3583bd5a..8afc2209227c 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -28,13 +28,16 @@ #define SVTOOLS_INC_TABLE_TABLECONTROL_HXX #include "svtools/svtdllapi.h" -#include <svtools/table/tablemodel.hxx> +#include "svtools/table/tablemodel.hxx" +#include "svtools/accessibletable.hxx" +#include "svtools/accessiblefactory.hxx" + #include <vcl/ctrl.hxx> #include <vcl/seleng.hxx> -#include <svtools/table/tabledatawindow.hxx> -#include <svtools/accessibletable.hxx> -#include <com/sun/star/util/Color.hpp> -#include <svtools/accessiblefactory.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> + //........................................................................ namespace svt { namespace table @@ -42,8 +45,6 @@ namespace svt { namespace table //........................................................................ class TableControl_Impl; - class TableDataWindow; - class AccessibleTableControl_Impl; //==================================================================== //= TableControl @@ -63,31 +64,19 @@ namespace svt { namespace table The control supports the concept of a <em>current</em> (or <em>active</em> cell). The control supports accessibility, this is encapsulated in IAccessibleTable - - // TODO: scrolling? */ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { private: - DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + ::boost::shared_ptr< TableControl_Impl > m_pImpl; - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); - TableControl_Impl* m_pImpl; - ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols; - ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; - Link m_aSelectHdl; - bool m_bSelectionChanged; - bool m_bTooltip; public: - ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; - TableControl( Window* _pParent, WinBits _nStyle ); ~TableControl(); /// sets a new table model - SVT_DLLPRIVATE void SetModel( PTableModel _pModel ); + void SetModel( PTableModel _pModel ); /// retrieves the current table model PTableModel GetModel() const; @@ -107,9 +96,8 @@ namespace svt { namespace table */ sal_Int32 GetCurrentRow() const; - /** returns the row, which contains the input point*/ - - ColPos GetCurrentRow (const Point& rPoint); + ITableControl& + getTableControlInterface(); /** retrieves the current column @@ -125,7 +113,7 @@ namespace svt { namespace table /** activates the cell at the given position @return - <TRUE/> if the move was successful, <FALSE/> otherwise. Usual + <sal_True/> if the move was successful, <FALSE/> 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). @@ -135,7 +123,7 @@ namespace svt { namespace table /** moves the active cell to the given column, by keeping the active row @return - <TRUE/> if the move was successful, <FALSE/> otherwise. Usual + <sal_True/> if the move was successful, <FALSE/> 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). @@ -148,7 +136,7 @@ namespace svt { namespace table /** moves the active cell to the given row, by keeping the active column @return - <TRUE/> if the move was successful, <FALSE/> otherwise. Usual + <sal_True/> if the move was successful, <FALSE/> 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). @@ -157,22 +145,17 @@ namespace svt { namespace table { return GoTo( GetCurrentColumn(), _nRow ); } - SVT_DLLPRIVATE virtual void Resize(); - virtual void Select(); - SVT_DLLPRIVATE void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } - const Link& GetSelectHdl() const { return m_aSelectHdl; } - /**invalidates the table if table has been changed e.g. new row added - */ - void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved); - /**gets the vector, which contains the selected rows - */ - std::vector<sal_Int32>& GetSelectedRows(); - /**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(); - TableDataWindow* getDataWindow(); + SVT_DLLPRIVATE virtual void Resize(); + virtual void Select(); + void SetSelectHdl( const Link& rLink ); + const Link& GetSelectHdl() const; + + /**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(); @@ -180,55 +163,55 @@ namespace svt { namespace table virtual void KeyInput( const KeyEvent& rKEvt ); virtual void StateChanged( StateChangedType i_nStateChange ); - /** Creates and returns the accessible object of the whole GridControl. */ - SVT_DLLPRIVATE virtual XACC CreateAccessible(); - SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); - SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; - SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); - SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; - virtual void FillAccessibleStateSet( - ::utl::AccessibleStateSetHelper& rStateSet, - AccessibleTableControlObjType eObjType ) const; - //// Window - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; - virtual void GrabFocus(); - virtual XACC GetAccessible( sal_Bool bCreate = sal_True ); - virtual Window* GetAccessibleParentWindow() const; - virtual Window* GetWindowInstance(); - virtual sal_Int32 GetAccessibleControlCount() const; - virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ); - virtual long GetRowCount() const; - virtual long GetColumnCount() const; - virtual sal_Bool HasRowHeader() const; - virtual sal_Int32 GetSelectedRowCount() const; - virtual bool IsRowSelected( long _nRow ) const; - virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ); - virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ); - virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ); - virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); - virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); - virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const; - virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const; - virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const; - virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const; - virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; - virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; - virtual sal_Bool HasRowHeader(); - virtual sal_Bool HasColHeader(); - virtual sal_Bool isAccessibleAlive( ) const; - virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); - virtual void RemoveSelectedRow(RowPos _nRowPos); - virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; - ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); - ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); - void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); - void clearSelection(); - void selectionChanged(bool _bChanged); - bool isTooltip(); - - protected: - /// retrieves the XAccessible implementation associated with the GridControl instance - ::svt::IAccessibleFactory& getAccessibleFactory(); + /** Creates and returns the accessible object of the whole GridControl. */ + SVT_DLLPRIVATE virtual XACC CreateAccessible(); + SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); + SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; + SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); + SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; + virtual void FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const; + + // ............................................................................................................. + // IAccessibleTable + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; + virtual void GrabFocus(); + virtual XACC GetAccessible( sal_Bool bCreate = sal_True ); + virtual Window* GetAccessibleParentWindow() const; + virtual Window* GetWindowInstance(); + virtual sal_Int32 GetAccessibleControlCount() const; + virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ); + virtual long GetRowCount() const; + virtual long GetColumnCount() const; + virtual sal_Bool HasRowHeader() const; + virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ); + virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ); + virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ); + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const; + virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const; + virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; + virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; + virtual sal_Bool HasRowHeader(); + virtual sal_Bool HasColHeader(); + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; + + virtual sal_Int32 GetSelectedRowCount() const; + virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const; + virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const; + virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ); + virtual void SelectAllRows( bool const i_select ); + // ............................................................................................................. + + private: + DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); private: TableControl(); // never implemented diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx new file mode 100644 index 000000000000..74e9688d01db --- /dev/null +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX +#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX + +#include <sal/types.h> +#include <vcl/event.hxx> +#include <vcl/seleng.hxx> + +#include "svtools/table/tabletypes.hxx" +#include "svtools/table/tablemodel.hxx" + +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. + */ + 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. + */ + 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 + <TRUE/> if the action could be dispatched successfully, <FALSE/> 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 <NULL/>. + */ + 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 // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx deleted file mode 100644 index 829feecd5836..000000000000 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX -#define SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX - -#ifndef _SV_WINDOW_HXX -#include <vcl/window.hxx> -#endif -#include <vcl/seleng.hxx> - -//........................................................................ -namespace svt { namespace table -{ -//........................................................................ - - class TableControl_Impl; - class TableFunctionSet; - - - //==================================================================== - //= TableDataWindow - //==================================================================== - /** the window containing the content area (including headers) of - a table control - */ - class TableDataWindow : public Window - { - friend class TableFunctionSet; - private: - TableControl_Impl& m_rTableControl; - Link m_aMouseButtonDownHdl; - Link m_aMouseButtonUpHdl; - Link m_aSelectHdl; - public: - TableDataWindow( TableControl_Impl& _rTableControl ); - inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; } - inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; } - inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; } - inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; } - inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } - inline const Link& GetSelectHdl() const { return m_aSelectHdl; } - - // Window overridables - virtual void Paint( const Rectangle& rRect ); - virtual void MouseMove( const MouseEvent& rMEvt); - virtual void MouseButtonDown( const MouseEvent& rMEvt); - virtual void MouseButtonUp( const MouseEvent& rMEvt); - virtual void SetPointer( const Pointer& rPointer ); - virtual void CaptureMouse(); - virtual void ReleaseMouse(); - virtual long Notify(NotifyEvent& rNEvt); - virtual void SetControlBackground(const Color& rColor); - virtual void SetControlBackground(); - - void SetBackground(const Wallpaper& rColor); - void SetBackground(); - }; -//........................................................................ -} } // namespace svt::table -//........................................................................ - -#endif // SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX diff --git a/svtools/inc/svtools/table/tableinputhandler.hxx b/svtools/inc/svtools/table/tableinputhandler.hxx index 6d6af9f641bb..87803f03e240 100644 --- a/svtools/inc/svtools/table/tableinputhandler.hxx +++ b/svtools/inc/svtools/table/tableinputhandler.hxx @@ -40,7 +40,7 @@ namespace svt { namespace table { //........................................................................ - class IAbstractTableControl; + class ITableControl; //==================================================================== //= ITableInputHandler @@ -56,16 +56,16 @@ namespace svt { namespace table // or whether it has been sufficiently handled by the ->ITableInputHandler instance // (<FALSE/>). - virtual bool MouseMove ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0; - virtual bool MouseButtonDown ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0; - virtual bool MouseButtonUp ( IAbstractTableControl& _rControl, const MouseEvent& rMEvt ) = 0; - virtual bool KeyInput ( IAbstractTableControl& _rControl, const KeyEvent& rKEvt ) = 0; - virtual bool GetFocus ( IAbstractTableControl& _rControl ) = 0; - virtual bool LoseFocus ( IAbstractTableControl& _rControl ) = 0; - virtual bool RequestHelp ( IAbstractTableControl& _rControl, const HelpEvent& rHEvt ) = 0; - virtual bool Command ( IAbstractTableControl& _rControl, const CommandEvent& rCEvt ) = 0; - virtual bool PreNotify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ) = 0; - virtual bool Notify ( IAbstractTableControl& _rControl, NotifyEvent& rNEvt ) = 0; + virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) = 0; + virtual bool GetFocus ( ITableControl& _rControl ) = 0; + virtual bool LoseFocus ( ITableControl& _rControl ) = 0; + virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ) = 0; + virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ) = 0; + virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0; + virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0; virtual ~ITableInputHandler() { } }; diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 3da396d9d86c..94f03b684e64 100644..100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -28,16 +28,22 @@ #define SVTOOLS_INC_TABLE_TABLEMODEL_HXX #include "svtools/svtdllapi.h" -#include <svtools/table/tabletypes.hxx> -#include <svtools/table/tablerenderer.hxx> -#include <svtools/table/tableinputhandler.hxx> -#include <rtl/ref.hxx> -#include <sal/types.h> +#include "svtools/table/tabletypes.hxx" +#include "svtools/table/tablerenderer.hxx" +#include "svtools/table/tableinputhandler.hxx" +#include "svtools/table/tablesort.hxx" + #include <com/sun/star/util/Color.hpp> -#include <boost/shared_ptr.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/style/HorizontalAlignment.hpp> +#include <rtl/ref.hxx> +#include <sal/types.h> + +#include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> +#include <boost/enable_shared_from_this.hpp> + //........................................................................ namespace svt { namespace table { @@ -45,19 +51,6 @@ namespace svt { namespace table //==================================================================== - //= cell data - //==================================================================== - struct TableContentType - { - ::rtl::OUString sContent; - Image* pImage; - TableContentType() : - sContent(), - pImage( ) - { - } - }; - //==================================================================== //= ScrollbarVisibility //==================================================================== enum ScrollbarVisibility @@ -78,13 +71,24 @@ namespace svt { namespace table //==================================================================== //= ITableModelListener //==================================================================== + typedef sal_Int32 ColumnAttributeGroup; + #define COL_ATTRS_NONE (0x00000000) + /// denotes column attributes related to the width of the column + #define COL_ATTRS_WIDTH (0x00000001) + /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering + #define COL_ATTRS_APPEARANCE (0x00000002) + /// denotes the entirety of column attributes + #define COL_ATTRS_ALL (0x7FFFFFFF) + + //==================================================================== + //= ITableModelListener + //==================================================================== /** declares an interface to be implemented by components interested in changes in an ->ITableModel */ - class SAL_NO_VTABLE ITableModelListener + class SAL_NO_VTABLE ITableModelListener : public ::boost::enable_shared_from_this< ITableModelListener > { public: - //virtual void onTableModelChanged(PTableModel pTableModel) = 0; /** notifies the listener that one or more rows have been inserted into the table @@ -100,7 +104,8 @@ namespace svt { namespace table the table @param first - the old index of the first removed row + the old index of the first removed row. If this is <code>-1</code>, then all + rows have been removed from the model. @param last the old index of the last removed row. Must not be smaller than ->first @@ -116,27 +121,19 @@ namespace svt { namespace table the index of the last newly inserted row. Must not be smaller than ->first */ - virtual void columnsInserted( ColPos first, ColPos last ) = 0; + virtual void columnInserted( ColPos const i_colIndex ) = 0; /** notifies the listener that one or more columns have been removed from the table - @param first - the old index of the first removed row - @param last - the old index of the last removed row. Must not be smaller - than ->first + @param i_colIndex + the old index of the removed column */ - virtual void columnsRemoved( ColPos first, ColPos last ) = 0; - - /** notifies the listener that a column in the table has moved + virtual void columnRemoved( ColPos const i_colIndex ) = 0; - @param oldIndex - the old index of the column within the model - @param newIndex - the new index of the column within the model + /** notifies the listener that all columns have been removed form the model */ - virtual void columnMoved( ColPos oldIndex, ColPos newIndex ) = 0; + virtual void allColumnsRemoved() = 0; /** notifies the listener that a rectangular cell range in the table has been updated @@ -145,7 +142,24 @@ namespace svt { namespace table they have about the cells in question, in particular any possibly cached cell values. */ - virtual void cellsUpdated( ColPos firstCol, ColPos lastCol, RowPos firstRow, RowPos lastRow ) = 0; + virtual void cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow ) = 0; + + /** notifies the listener that attributes of a given column changed + + @param i_column + the position of the column whose attributes changed + @param i_attributeGroup + a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s) + in which changes occurred. + */ + virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0; + + /** notifies the listener that the metrics of the table changed. + + Metrics here include the column header height, the row header width, the row height, and the presence + of both the row and column header. + */ + virtual void tableMetricsChanged() = 0; /// deletes the listener instance virtual ~ITableModelListener(){}; @@ -172,7 +186,8 @@ namespace svt { namespace table @see setID */ - virtual ColumnID getID() const = 0; + virtual ::com::sun::star::uno::Any + getID() const = 0; /** sets a new column ID @@ -183,7 +198,7 @@ namespace svt { namespace table @see getID */ - virtual bool setID( const ColumnID _nID ) = 0; + virtual void setID( const ::com::sun::star::uno::Any& _nID ) = 0; /** returns the name of the column @@ -200,7 +215,15 @@ namespace svt { namespace table */ virtual void setName( const String& _rName ) = 0; - /** determines whether the column can be resized + /** retrieves the help text to be displayed for the column. + */ + virtual String getHelpText() const = 0; + + /** sets a new the help text to be displayed for the column. + */ + virtual void setHelpText( const String& i_helpText ) = 0; + + /** determines whether the column can be interactively resized @see getMinWidth @see getMaxWidth @@ -216,40 +239,41 @@ namespace svt { namespace table */ virtual void setResizable( bool _bResizable ) = 0; - /** returns the width of the column, in 1/100 millimeters + /** denotes the relative flexibility of the column - The returned value must be a positive ->TableMetrics value. + This flexibility is taken into account when a table control auto-resizes its columns, because the available + space changed. In this case, the columns grow or shrink according to their flexibility. - It can also be COLWIDTH_FIT_TO_VIEW, to indicate that the width of the column - should automatically be adjusted to completely fit the view. For instance, a - model's last column could return this value, to indicate that it is to occupy - all horizontal space remaining in the view, after all other columns have been - layouted. + A value of 0 means the column is not auto-resized at all. + */ + virtual sal_Int32 getFlexibility() const = 0; - If there is more than one column with width COLWIDTH_FIT_TO_VIEW in a model, - they're all layouted equal-width. + /** sets a new flexibility value for the column - If the columns with a read width (i.e. other than COLWIDTH_FIT_TO_VIEW) are, - in sum, wider than the view, then the view is free to choose a real width for any - columns which return COLWIDTH_FIT_TO_VIEW here. + @see getFlexibility + */ + virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0; + + /** returns the width of the column, in app-font unitss + + The returned value must be a positive ->TableMetrics value. @see setWidth @see getMinWidth @see getMaxWidth - @see COLWIDTH_FIT_TO_VIEW */ virtual TableMetrics getWidth() const = 0; /** sets a new width for the column @param _nWidth - the new width, in 1/100 millimeters + the new width, app-font units @see getWidth */ virtual void setWidth( TableMetrics _nWidth ) = 0; - /** returns the minimum width of the column, in 1/100 millimeters, or 0 if the column + /** returns the minimum width of the column, in app-font units, or 0 if the column does not have a minimal width @see setMinWidth @@ -258,7 +282,7 @@ namespace svt { namespace table */ virtual TableMetrics getMinWidth() const = 0; - /** sets the minimum width of the column, in 1/100 millimeters + /** sets the minimum width of the column, in app-font units @see getMinWidth @see setMaxWidth @@ -266,7 +290,7 @@ namespace svt { namespace table */ virtual void setMinWidth( TableMetrics _nMinWidth ) = 0; - /** returns the maximum width of the column, in 1/100 millimeters, or 0 if the column + /** returns the maximum width of the column, in app-font units, or 0 if the column does not have a minimal width @see setMaxWidth @@ -275,7 +299,7 @@ namespace svt { namespace table */ virtual TableMetrics getMaxWidth() const = 0; - /** sets the maximum width of the column, in 1/100 millimeters + /** sets the maximum width of the column, in app-font units @see getMaxWidth @see setMinWidth @@ -283,24 +307,14 @@ namespace svt { namespace table */ virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0; - /** returns the preferred width of the column, or 0 if the column - does not have a preferred width. - - @see setMaxWidth - @see getMinWidth - @see getWidth + /** retrieves the horizontal alignment to be used for content in this cell */ - virtual TableMetrics getPreferredWidth() const = 0; - /** sets the preferred width of the column, to be used when user resizes column + virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0; - @see getMaxWidth - @see setMinWidth - @see setWidth + /** sets a new the horizontal alignment to be used for content in this cell */ - virtual void setPreferredWidth( TableMetrics _nPrefWidth ) = 0; - - virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0; virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0; + /// deletes the column model instance virtual ~IColumnModel() { } }; @@ -322,9 +336,6 @@ namespace svt { namespace table */ virtual TableSize getRowCount() const = 0; - SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0; - SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0; - /** determines whether the table has column headers If this method returns <TRUE/>, the renderer returned by @@ -333,15 +344,6 @@ namespace svt { namespace table @see IColumnRenderer */ virtual bool hasColumnHeaders() const = 0; - /** sets whether the table should have row headers - @see IColumnRenderer - */ - SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0; - - /** sets whether the table should have column headers - @see IColumnRenderer - */ - SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0; /** determines whether the table has row headers @@ -359,14 +361,6 @@ namespace svt { namespace table */ virtual bool isCellEditable( ColPos col, RowPos row ) const = 0; - /** adds the given listener to the list of ->ITableModelListener's - */ - SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0; - - /** revokes the given listener from the list of ->ITableModelListener's - */ - SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0; - /** returns a model for a certain column @param column @@ -375,27 +369,15 @@ namespace svt { namespace table @return the model of the column in question. Must not be <NULL/> - - @see getColumnModelByID */ virtual PColumnModel getColumnModel( ColPos column ) = 0; - /** finds a column model by ID - - @param id - the id of the column which is to be looked up - @return - the column model with the given ID, or <NULL/> if there is - no such column - */ - virtual PColumnModel getColumnModelByID( ColumnID id ) = 0; - /** returns a renderer which is able to paint the table represented by this table model @return the renderer to use. Must not be <NULL/> */ - SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0; + virtual PTableRenderer getRenderer() const = 0; /** returns the component handling input in a view associated with the model */ @@ -404,12 +386,10 @@ namespace svt { namespace table /** determines the height of rows in the table. @return - the logical height of rows in the table, in 1/100 millimeters. The height must be + the logical height of rows in the table, in app-font units. The height must be greater 0. */ - SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0; - - SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0; + virtual TableMetrics getRowHeight() const = 0; /** determines the height of the column header row @@ -417,10 +397,10 @@ namespace svt { namespace table returned <FALSE/>. @return - the logical height of the column header row, in 1/100 millimeters. + the logical height of the column header row, in app-font units. Must be greater than 0. */ - SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0; + virtual TableMetrics getColumnHeaderHeight() const = 0; /** determines the width of the row header column @@ -428,48 +408,105 @@ namespace svt { namespace table returned <FALSE/>. @return - the logical width of the row header column, in 1/100 millimeters. + the logical width of the row header column, in app-font units. Must be greater than 0. */ - SVT_DLLPRIVATE virtual TableMetrics getRowHeaderWidth() const = 0; + virtual TableMetrics getRowHeaderWidth() const = 0; - /** determines the visibility of the vertical scrollbar of the table control - @param overAllHeight the height of the table with all rows - @param actHeight the given height of the table + /** returns the visibilit mode of the vertical scrollbar */ - virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight,int actHeight) const = 0; + virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0; - /** determines the visibility of the horizontal scrollbar of the table control - @param overAllWidth the width of the table with all columns - @param actWidth the given width of the table + /** returns the visibilit mode of the horizontal scrollbar */ - virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0; - virtual bool hasVerticalScrollbar() =0; - virtual bool hasHorizontalScrollbar() = 0; - /** fills cells with content - */ - virtual void setCellContent(const std::vector< std::vector< ::com::sun::star::uno::Any > >& cellContent)=0; - /** gets the content of the cells - */ - virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; - /**sets title of header rows - */ - SVT_DLLPRIVATE virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)=0; - /** gets title of header rows - */ - virtual std::vector<rtl::OUString>& getRowHeaderName() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0; - SVT_DLLPRIVATE virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; - SVT_DLLPRIVATE virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0; - SVT_DLLPRIVATE virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; - SVT_DLLPRIVATE virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; - SVT_DLLPRIVATE virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; - SVT_DLLPRIVATE virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0; + virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0; + + /** adds a listener to be notified of changes in the table model + */ + virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0; + + /** remove a listener to be notified of changes in the table model + */ + virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; + + /** retrieves the content of the given cell + */ + virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) = 0; + + /** returns an object which should be displayed as tooltip for the given cell + + At the moment, only string-convertible values are supported here. In the future, one might imagine displaying + scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip. + + If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell + if and only if it doesn't fit into the cell's space itself. + + @param i_col + The column index of the cell in question. COL_ROW_HEADERS is a valid argument here. + @param i_row + The row index of the cell in question. + @param o_cellToolTip + takes the tooltip object upon return. + */ + virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip ) = 0; + + /** retrieves title of a given row + */ + virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0; + + /** returns the color to be used for rendering the grid lines. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getLineColor() const = 0; + + /** returns the color to be used for rendering the header background. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const = 0; + + /** returns the color to be used for rendering the header text. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0; + + /** returns the color to be used for rendering cell texts. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getTextColor() const = 0; + + /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::boost::optional< ::Color > getTextLineColor() const = 0; + + /** returns the colors to be used for the row backgrounds. + + If this value is not set, every second row will have a background color derived from the style settings's + selection color, the other rows will not have a special background at all. + + If this value is an empty sequence, the rows will not have a special background at all, instead the + normal background of the complete control will be used. + + If value is a non-empty sequence, then rows will have the background colors as specified in the sequence, + in alternating order. + */ + virtual ::boost::optional< ::std::vector< ::Color > > + getRowBackgroundColors() const = 0; + + /** determines the vertical alignment of content within a cell + */ + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0; + + /** returns an adapter to the sorting functionality of the model + + It is legitimate to return <NULL/> here, in this case, the table model does not support sorting. + */ + virtual ITableDataSort* getSortAdapter() = 0; /// destroys the table model instance virtual ~ITableModel() { } diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index f81771dd22e6..3d50c9d70ee7 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -46,6 +46,7 @@ namespace svt { namespace table class SAL_NO_VTABLE ITableRenderer { public: + /** paints a (part of) header area There are two header areas in a table control: @@ -175,12 +176,10 @@ namespace svt { namespace table the are into which the row header should be painted @param _rStyle the style to be used for drawing - @param _rText - the title of the header row */ virtual void PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0; + const StyleSettings& _rStyle ) = 0; /** paints a certain cell @@ -207,46 +206,11 @@ namespace svt { namespace table the are into which the cell should be painted @param _rStyle the style to be used for drawing - @param _pCellData - the content of the cell */ - virtual void PaintCellImage( ColPos _nColumn, + virtual void PaintCell( ColPos const i_col, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, Image* _pCellData ) = 0; - - /** paints a certain cell - - The row to be painted is denoted by the most recent call to - ->PrepareRow. - - @param _bSelected - <TRUE/> if and only if the cell to be painted is - selected currently. This is the case if either - the row or the column of the cell is currently selected. - <br/> - Note that this flag is equal to the respective flag in the - previous ->PrepareRow call, it's passed here for convinience - only. - @param _bActive - <TRUE/> if the cell is currently active. - <br/> - Note that this flag is equal to the respective flag in the - previous ->PrepareRow call, it's passed here for convinience - only. - @param _rDevice - denotes the device to paint onto - @param _rArea - the are into which the cell should be painted - @param _rStyle - the style to be used for drawing - @param _rText - the content of the cell - */ - virtual void PaintCellString( ColPos _nColumn, - bool _bActive, bool _bSelected, - OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0; + const StyleSettings& _rStyle ) = 0; /** draws a cell cursor in the given rectangle @@ -262,6 +226,41 @@ namespace svt { namespace table */ virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0; + /** checks whether a given cell content fits into a given target area on a given device. + + @param i_colPos + denotes the column which the cell content would be painted into. Your renderer implementation + would only need this parameter if rendering is done differently for different columns. + + @param i_rowPos + denotes the row which the cell content would be painted into. Your renderer implementation + would only need this parameter if rendering is done differently for different rows. + + @param i_active + is <TRUE/> if and only if the renderer should assume the cell content would be painted for the active + cell. + + @param i_selected + is <TRUE/> if and only if the renderer should assume the cell content would be painted for a selected + cell. + + @param i_targetDevice + denotes the target device for the assumed rendering operation + + @param i_targetArea + denotes the area within the target device for the assumed rendering operation. + + @return + <TRUE/> if and only if the given cell content could be rendered into the given device and the + given area. + */ + 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 + ) = 0; + /// deletes the renderer instance virtual ~ITableRenderer() { } }; diff --git a/svtools/inc/svtools/table/tablesort.hxx b/svtools/inc/svtools/table/tablesort.hxx new file mode 100755 index 000000000000..1690b4d51344 --- /dev/null +++ b/svtools/inc/svtools/table/tablesort.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_TABLESORT_HXX +#define SVTOOLS_TABLESORT_HXX + +#include "svtools/table/tabletypes.hxx" + +//...................................................................................................................... +namespace svt { namespace table +{ +//...................................................................................................................... + + //================================================================================================================== + //= ColumnSortDirection + //================================================================================================================== + enum ColumnSortDirection + { + ColumnSortAscending, + ColumnSortDescending + }; + + //================================================================================================================== + //= ColumnSort + //================================================================================================================== + struct ColumnSort + { + ColPos nColumnPos; + ColumnSortDirection eSortDirection; + + ColumnSort() + :nColumnPos( COL_INVALID ) + ,eSortDirection( ColumnSortAscending ) + { + } + + ColumnSort( ColPos const i_columnPos, ColumnSortDirection const i_sortDirection ) + :nColumnPos( i_columnPos ) + ,eSortDirection( i_sortDirection ) + { + } + }; + + //================================================================================================================== + //= ITableDataSort + //================================================================================================================== + /** provides sorting functionality for the datta underlying an ITableModel + */ + class SAL_NO_VTABLE ITableDataSort + { + public: + /** sorts the rows in the model by the given column's data, in the given direction. + */ + virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) = 0; + + /** retrieves the current sort order of the data + + If the <code>nColumnIndex</code> member of the returned srtructure is <code>COL_INVALID</code>, then + the data is currently not sorted. + */ + virtual ColumnSort getCurrentSortOrder() const = 0; + }; + +//...................................................................................................................... +} } // namespace svt::table +//...................................................................................................................... + +#endif // SVTOOLS_TABLESORT_HXX diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx index 645120e30d4b..ae20851992e3 100644 --- a/svtools/inc/svtools/table/tabletypes.hxx +++ b/svtools/inc/svtools/table/tabletypes.hxx @@ -49,14 +49,7 @@ namespace svt { namespace table */ typedef sal_Int32 AnyPos; - /// the ID of a column in a table - typedef sal_Int32 ColumnID; - typedef sal_Int32 TableMetrics; -/** special column width value which indicates that the column should be - automatically resized to fit the view -*/ -#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1) /// denotes the column containing the row headers #define COL_ROW_HEADERS ((::svt::table::ColPos)-1) |