From 89b5dccad85eb95058d127108734ae02ab27bc9a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 17 Dec 2010 10:00:05 +0100 Subject: gridsort: removed setter methods from ITableModel - they're an aspect of concret implementations, if at all --- svtools/inc/svtools/table/tablemodel.hxx | 47 ++++++-------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 3da396d9d86c..f67bfe72b05b 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -322,9 +322,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 , the renderer returned by @@ -333,15 +330,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 +347,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 @@ -395,7 +375,7 @@ namespace svt { namespace table @return the renderer to use. Must not be */ - SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0; + virtual PTableRenderer getRenderer() const = 0; /** returns the component handling input in a view associated with the model */ @@ -407,9 +387,7 @@ namespace svt { namespace table the logical height of rows in the table, in 1/100 millimeters. 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 @@ -420,7 +398,7 @@ namespace svt { namespace table the logical height of the column header row, in 1/100 millimeters. 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 @@ -431,7 +409,7 @@ namespace svt { namespace table the logical width of the row header column, in 1/100 millimeters. 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 @@ -444,32 +422,23 @@ namespace svt { namespace table @param actWidth the given width of the table */ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0; - virtual bool hasVerticalScrollbar() =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& cellColumnContent)=0; + /** gets title of header rows */ virtual std::vector& 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; /// destroys the table model instance virtual ~ITableModel() { } -- cgit From 6531aff8404bb4a26f4dfeaf9c253c0147e3fa34 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 17 Dec 2010 13:38:24 +0100 Subject: gridsort: more refactoring of the relationship (especially with respect to listeners) between the various table/grid classes. Now we're not as strict as before with respect to the construction order. Also, updating various aspects of a column model (e.g. inserting a new column) will work now even if there already is a control for the model. Still a long way to go to fix some more obvious problems, which make using the grid control API a PITA (you're lost if you do now know *exactly* which things to do in which order). --- svtools/inc/svtools/table/tablecontrol.hxx | 139 +++++++++++++++-------------- svtools/inc/svtools/table/tablemodel.hxx | 71 ++++++++------- 2 files changed, 107 insertions(+), 103 deletions(-) mode change 100644 => 100755 svtools/inc/svtools/table/tablemodel.hxx (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index f3b7ed88b565..07384540261b 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -33,8 +33,10 @@ #include #include #include -#include #include + +#include + //........................................................................ namespace svt { namespace table @@ -69,17 +71,18 @@ namespace svt { namespace table class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { private: - DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); - TableControl_Impl* m_pImpl; + ::boost::shared_ptr< 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; @@ -157,22 +160,25 @@ 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& 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(); + 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& 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(); // Window overridables virtual void GetFocus(); @@ -180,55 +186,54 @@ 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( BOOL bCreate = 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, BOOL _bOnScreen = TRUE ); - virtual Rectangle calcTableRect( BOOL _bOnScreen = 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(); + /** 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( BOOL bCreate = 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, BOOL _bOnScreen = TRUE ); + virtual Rectangle calcTableRect( BOOL _bOnScreen = 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(); + ::svt::IAccessibleFactory& getAccessibleFactory(); private: TableControl(); // never implemented diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx old mode 100644 new mode 100755 index f67bfe72b05b..a9d6c7325e65 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -28,16 +28,20 @@ #define SVTOOLS_INC_TABLE_TABLEMODEL_HXX #include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include +#include "svtools/table/tabletypes.hxx" +#include "svtools/table/tablerenderer.hxx" +#include "svtools/table/tableinputhandler.hxx" + #include -#include #include #include +#include +#include + +#include +#include + //........................................................................ namespace svt { namespace table { @@ -81,10 +85,9 @@ namespace svt { namespace table /** 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 @@ -122,9 +125,9 @@ namespace svt { namespace table the table @param first - the old index of the first removed row + the old index of the first removed column @param last - the old index of the last removed row. Must not be smaller + the old index of the last removed column. Must not be smaller than ->first */ virtual void columnsRemoved( ColPos first, ColPos last ) = 0; @@ -355,21 +358,9 @@ namespace svt { namespace table @return the model of the column in question. Must not be - - @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 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 @@ -423,22 +414,30 @@ namespace svt { namespace table */ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0; - virtual bool hasVerticalScrollbar() = 0; - virtual bool hasHorizontalScrollbar() = 0; + /** adds a listener to be notified of changes in the table model + */ + virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0; - /** gets the content of the cells - */ - virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; + /** remove a listener to be notified of changes in the table model + */ + virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; - /** gets title of header rows - */ - virtual std::vector& getRowHeaderName() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; - SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; + virtual bool hasVerticalScrollbar() = 0; + virtual bool hasHorizontalScrollbar() = 0; + + /** gets the content of the cells + */ + virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; + + /** gets title of header rows + */ + virtual std::vector& getRowHeaderName() = 0; + virtual ::com::sun::star::util::Color getLineColor() = 0; + virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; + virtual ::com::sun::star::util::Color getTextColor() = 0; + virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; /// destroys the table model instance virtual ~ITableModel() { } -- cgit From 6f7105ef88fcb3e8979617cbbac3a8503e4766ea Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 23 Dec 2010 15:48:53 +0100 Subject: gridsort: re-factoring the column-resizing thingie, step 1 In the current implementation, this is rather complex, and hardly maintainable. Also, it all happens in TableControl_Impl and TableDataWindow, while in the original design, the InputHandler was intended to care for this kind of tasks (one class - one responsibility). --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 23 +++++++++++----------- svtools/inc/svtools/table/tablecontrol.hxx | 3 +-- svtools/inc/svtools/table/tablemodel.hxx | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 9206f20ecbcb..ac91006e42f5 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -73,7 +73,6 @@ namespace svt { namespace table /// selects the row, from the actual cursor till bottom cursorSelectRowAreaBottom, - /// invalid and final enumeration value, not to be actually used invalidTableControlAction }; @@ -113,16 +112,18 @@ namespace svt { namespace table @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; + + /** returns selection engine*/ + virtual SelectionEngine* getSelEngine() = 0; + virtual void activateCellAt( const Point& rPoint ) = 0; + virtual bool isTooltipActive() = 0; + virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; + virtual RowPos getRowAtPoint( const Point& rPoint ) = 0; + virtual ColPos getColAtPoint( const Point& rPoint ) = 0; + virtual void resizeColumn(const Point& rPoint ) = 0; + virtual bool checkResizeColumn(const Point& rPoint) = 0; + virtual bool endResizeColumn(const Point& rPoint) = 0; + virtual bool isRowSelected(RowPos _nRow) = 0; virtual ~IAbstractTableControl() {}; }; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 07384540261b..b75ebe0dcc88 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -111,8 +111,7 @@ namespace svt { namespace table sal_Int32 GetCurrentRow() const; /** returns the row, which contains the input point*/ - - ColPos GetCurrentRow (const Point& rPoint); + ColPos GetRowAtPoint( const Point& rPoint ); /** retrieves the current column diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index a9d6c7325e65..99cd0e2792d6 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -232,7 +232,7 @@ namespace svt { namespace table If there is more than one column with width COLWIDTH_FIT_TO_VIEW in a model, they're all layouted equal-width. - If the columns with a read width (i.e. other than COLWIDTH_FIT_TO_VIEW) are, + If the columns with a real 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. -- cgit From 1d52df1454476ab4ca2d0e297746719c7a9212f1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 23 Dec 2010 15:49:18 +0100 Subject: gridsort: simplified the scrollbar handling --- svtools/inc/svtools/table/tablemodel.hxx | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 99cd0e2792d6..72438bd0e357 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -48,19 +48,6 @@ namespace svt { namespace table //........................................................................ - //==================================================================== - //= cell data - //==================================================================== - struct TableContentType - { - ::rtl::OUString sContent; - Image* pImage; - TableContentType() : - sContent(), - pImage( ) - { - } - }; //==================================================================== //= ScrollbarVisibility //==================================================================== @@ -402,17 +389,13 @@ namespace svt { namespace table */ 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 ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0; /** adds a listener to be notified of changes in the table model */ @@ -422,9 +405,6 @@ namespace svt { namespace table */ virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; - virtual bool hasVerticalScrollbar() = 0; - virtual bool hasHorizontalScrollbar() = 0; - /** gets the content of the cells */ virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; -- cgit From cb2f6f86c9de551b806f20e68c50e4037ec51590 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 3 Jan 2011 16:01:14 +0100 Subject: gridsort: removed methods from ITableModel which exposed implementation details of the UnoControlTableModel. Also, instead of exposing those implementation details in UnoControlTableModel, added atomar operations for stuff like adding / clearing of rows, and the like. --- svtools/inc/svtools/table/gridtablerenderer.hxx | 7 ++++--- svtools/inc/svtools/table/tablemodel.hxx | 9 +++++---- svtools/inc/svtools/table/tablerenderer.hxx | 6 ++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index e474306c0423..01a2e308f3c0 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -87,17 +87,18 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle ); virtual void PaintRowHeader( + RowPos const i_rowPos, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ); + const StyleSettings& _rStyle ); virtual void PaintCellImage( ColPos _nColumn, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData ); - virtual void PaintCellString( ColPos _nColumn, + virtual void PaintCellString( ColPos _nColumn, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ); + const StyleSettings& _rStyle, rtl::OUString& _rText ); virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect); virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect); }; diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 72438bd0e357..273ed003d7aa 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -405,13 +405,14 @@ namespace svt { namespace table */ virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; - /** gets the content of the cells + /** retrieves the content of the given cell */ - virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; + virtual void getCellContent( RowPos const i_row, ColPos const i_col, ::com::sun::star::uno::Any& o_cellContent ) = 0; - /** gets title of header rows + /** retrieves title of a given row */ - virtual std::vector& getRowHeaderName() = 0; + virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const = 0; + virtual ::com::sun::star::util::Color getLineColor() = 0; virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; virtual ::com::sun::star::util::Color getTextColor() = 0; diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index f81771dd22e6..a0c54f7a9538 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -175,12 +175,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, + virtual void PaintRowHeader( RowPos const i_rowPos, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0; + const StyleSettings& _rStyle ) = 0; /** paints a certain cell -- cgit From d48dfdc09b7880b1d22e8fe44f70c81209bd1f19 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 3 Jan 2011 23:18:47 +0100 Subject: gridsort: IColumnModel: make the ID attribute an css.uno.Any, so it can be exchanged with XGridColumn's identifier --- svtools/inc/svtools/table/tablemodel.hxx | 5 +++-- svtools/inc/svtools/table/tabletypes.hxx | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 273ed003d7aa..a9137eab28a2 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -162,7 +162,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 @@ -173,7 +174,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 diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx index 645120e30d4b..0d285d420323 100644 --- a/svtools/inc/svtools/table/tabletypes.hxx +++ b/svtools/inc/svtools/table/tabletypes.hxx @@ -49,9 +49,6 @@ 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 -- cgit From 891179797b83156811f4a0607c64ad14cf5c90ff Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 4 Jan 2011 10:26:14 +0100 Subject: gridsort: don't decide in the TableControl whether a cell content is a image or a string-convertible - this is the renderer's task in the original design. --- svtools/inc/svtools/table/gridtablerenderer.hxx | 28 +++++++++++------- svtools/inc/svtools/table/tablerenderer.hxx | 39 ++----------------------- 2 files changed, 20 insertions(+), 47 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index 01a2e308f3c0..01492ae26fc4 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -43,9 +43,6 @@ 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 { @@ -74,7 +71,7 @@ namespace svt { namespace table */ RowPos getCurrentRow(); - protected: + public: // ITableRenderer overridables virtual void PaintHeaderArea( OutputDevice& _rDevice, const Rectangle& _rArea, @@ -91,16 +88,27 @@ namespace svt { namespace table bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ); - virtual void PaintCellImage( ColPos _nColumn, - bool _bActive, bool _bSelected, - OutputDevice& _rDevice, const Rectangle& _rArea, - const StyleSettings& _rStyle, Image* _pCellData ); - virtual void PaintCellString( ColPos _nColumn, + 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); + + 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/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index a0c54f7a9538..4477f7065001 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -205,46 +205,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 - 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. -
- Note that this flag is equal to the respective flag in the - previous ->PrepareRow call, it's passed here for convinience - only. - @param _bActive - if the cell is currently active. -
- 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 -- cgit From 5d1ef9978feb9479746f9039f2d6ca17f9e2052e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 4 Jan 2011 10:37:54 +0100 Subject: gridsort: getCellContent: (col,row) instead of (row,col) parameters --- svtools/inc/svtools/table/tablemodel.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index a9137eab28a2..cdbc1be6a3cd 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -408,7 +408,7 @@ namespace svt { namespace table /** retrieves the content of the given cell */ - virtual void getCellContent( RowPos const i_row, ColPos const i_col, ::com::sun::star::uno::Any& o_cellContent ) = 0; + virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) = 0; /** retrieves title of a given row */ -- cgit From b198150a3cdb7f1f3838bf39853f2ea680bcaf6c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 4 Jan 2011 22:23:17 +0100 Subject: gridsort: don't let the SVTXGridControl listen for XGridColumn changes. Instead, the non-UNO wrapper around the XGridColumn (UnoControlTableColumn, implementing IColumnModel) should do this, and then multiplex the changes to the TableControl(_Impl) instance. This way, other IColumnModel implementations also properly trigger control updates, provided they simply properly notify their changes. --- svtools/inc/svtools/table/tablemodel.hxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index cdbc1be6a3cd..dc25788bc491 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -66,6 +66,18 @@ namespace svt { namespace table ScrollbarShowAlways }; + //==================================================================== + //= 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 (0xFFFFFFFF) + //==================================================================== //= ITableModelListener //==================================================================== @@ -137,6 +149,16 @@ namespace svt { namespace table */ virtual void cellsUpdated( ColPos firstCol, ColPos lastCol, RowPos firstRow, RowPos 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 COL_ATTRS_* flags, denoting the attribute group(s) + in which changes occurred. + */ + virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0; + /// deletes the listener instance virtual ~ITableModelListener(){}; }; -- cgit From 5a256f4486e4b9875ea62c9a8f65ad110fda71b9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 10:58:26 +0100 Subject: gridsort: removed XGridControl::setTooltip. It had a rather strange semantics, seems to be unused in the current OOo code base, and would belong to the model, if at all. Still one thing to do: do not unconditionally display the cell content as tooltip, but make this dependent on whether or not the cell content fits into the cell. --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 2 -- svtools/inc/svtools/table/tablecontrol.hxx | 13 ++++--------- svtools/inc/svtools/table/tabledatawindow.hxx | 1 + svtools/inc/svtools/table/tablemodel.hxx | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 11 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index ac91006e42f5..eb70a6967e6f 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -116,8 +116,6 @@ namespace svt { namespace table /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; virtual void activateCellAt( const Point& rPoint ) = 0; - virtual bool isTooltipActive() = 0; - virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; virtual RowPos getRowAtPoint( const Point& rPoint ) = 0; virtual ColPos getColAtPoint( const Point& rPoint ) = 0; virtual void resizeColumn(const Point& rPoint ) = 0; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index b75ebe0dcc88..d557597b6ff8 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -77,11 +77,8 @@ namespace svt { namespace table DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); ::boost::shared_ptr< 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; @@ -110,8 +107,8 @@ namespace svt { namespace table */ sal_Int32 GetCurrentRow() const; - /** returns the row, which contains the input point*/ - ColPos GetRowAtPoint( const Point& rPoint ); + IAbstractTableControl& + getTableControlInterface(); /** retrieves the current column @@ -194,6 +191,7 @@ namespace svt { namespace table virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const; + //// Window virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; virtual void GrabFocus(); @@ -224,12 +222,9 @@ namespace svt { namespace table 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: ::svt::IAccessibleFactory& getAccessibleFactory(); diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index 829feecd5836..1cc030be512b 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -75,6 +75,7 @@ namespace svt { namespace table virtual long Notify(NotifyEvent& rNEvt); virtual void SetControlBackground(const Color& rColor); virtual void SetControlBackground(); + virtual void RequestHelp( const HelpEvent& rHEvt ); void SetBackground(const Wallpaper& rColor); void SetBackground(); diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index dc25788bc491..b8c13822a460 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -432,6 +432,23 @@ namespace svt { namespace table */ 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. ROW_COL_HEADERS is a valid argument. + @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 ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const = 0; -- cgit From 012b72f48860433345989eedc9cd1ccb9350b455 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 11:42:27 +0100 Subject: gridsort: +XGridColumn::HelpText, to be displayed as tooltip for the column header --- svtools/inc/svtools/table/tablemodel.hxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index b8c13822a460..3eb87f1eb40e 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -213,6 +213,14 @@ namespace svt { namespace table */ virtual void setName( const String& _rName ) = 0; + /** 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 resized @see getMinWidth @@ -443,7 +451,7 @@ namespace svt { namespace table @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. ROW_COL_HEADERS is a valid argument. + The row index of the cell in question. @param o_cellToolTip takes the tooltip object upon return. */ -- cgit From 3d7ca63d0efdc25200133c4086b48982b3a20eca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 13:26:40 +0100 Subject: gridsort: IAbstractTableControl renamed to ITableControl, added a few more methods previously found at the TableControl_Impl only --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 133 ------------------- svtools/inc/svtools/table/defaultinputhandler.hxx | 20 +-- svtools/inc/svtools/table/tablecontrol.hxx | 6 +- .../inc/svtools/table/tablecontrolinterface.hxx | 143 +++++++++++++++++++++ svtools/inc/svtools/table/tableinputhandler.hxx | 22 ++-- 5 files changed, 168 insertions(+), 156 deletions(-) delete mode 100644 svtools/inc/svtools/table/abstracttablecontrol.hxx create mode 100644 svtools/inc/svtools/table/tablecontrolinterface.hxx (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx deleted file mode 100644 index eb70a6967e6f..000000000000 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ /dev/null @@ -1,133 +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 - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX -#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX - -#include -#include -#include -#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 - 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; - virtual void activateCellAt( const Point& rPoint ) = 0; - virtual RowPos getRowAtPoint( const Point& rPoint ) = 0; - virtual ColPos getColAtPoint( const Point& rPoint ) = 0; - virtual void resizeColumn(const Point& rPoint ) = 0; - virtual bool checkResizeColumn(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..31b5db319290 100644 --- a/svtools/inc/svtools/table/defaultinputhandler.hxx +++ b/svtools/inc/svtools/table/defaultinputhandler.hxx @@ -50,16 +50,16 @@ namespace svt { namespace table 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 ); }; //........................................................................ diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index d557597b6ff8..259b390071bb 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -107,7 +107,7 @@ namespace svt { namespace table */ sal_Int32 GetCurrentRow() const; - IAbstractTableControl& + ITableControl& getTableControlInterface(); /** retrieves the current column @@ -192,7 +192,8 @@ namespace svt { namespace table ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const; - //// Window + // ............................................................................................................. + // IAccessibleTable virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; virtual void GrabFocus(); virtual XACC GetAccessible( BOOL bCreate = TRUE ); @@ -222,6 +223,7 @@ namespace svt { namespace table 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; + // ............................................................................................................. void clearSelection(); void selectionChanged(bool _bChanged); diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx new file mode 100644 index 000000000000..c1ed1bf432b6 --- /dev/null +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX +#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX + +#include +#include +#include + +#include "svtools/table/tabletypes.hxx" +#include "svtools/table/tablemodel.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 + }; + + //==================================================================== + //= 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; + + virtual void activateCellAt( const Point& rPoint ) = 0; + virtual RowPos getRowAtPoint( const Point& rPoint ) = 0; + virtual ColPos getColAtPoint( const Point& rPoint ) = 0; + virtual void resizeColumn(const Point& rPoint ) = 0; + virtual bool checkResizeColumn(const Point& rPoint) = 0; + virtual bool endResizeColumn(const Point& rPoint) = 0; + virtual bool isRowSelected(RowPos _nRow) = 0; + + virtual ~ITableControl() {}; + }; + +//........................................................................ +} } // namespace svt::table +//........................................................................ + +#endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_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 // (). - 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() { } }; -- cgit From 0bbace39b3f04c82ec8d38ef6aedef7d14fcafc4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 14:00:09 +0100 Subject: gridsort: XGridControl: add methods to retrieve the current row/col --- svtools/inc/svtools/table/tablecontrolinterface.hxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx index c1ed1bf432b6..359fd65815ef 100644 --- a/svtools/inc/svtools/table/tablecontrolinterface.hxx +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -125,13 +125,19 @@ namespace svt { namespace table */ 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; + virtual void activateCellAt( const Point& rPoint ) = 0; - virtual RowPos getRowAtPoint( const Point& rPoint ) = 0; - virtual ColPos getColAtPoint( const Point& rPoint ) = 0; + virtual RowPos getRowAtPoint( const Point& rPoint ) const = 0; + virtual ColPos getColAtPoint( const Point& rPoint ) const = 0; virtual void resizeColumn(const Point& rPoint ) = 0; virtual bool checkResizeColumn(const Point& rPoint) = 0; virtual bool endResizeColumn(const Point& rPoint) = 0; - virtual bool isRowSelected(RowPos _nRow) = 0; + virtual bool isRowSelected( RowPos _nRow ) const = 0; virtual ~ITableControl() {}; }; -- cgit From 5e725b448fcb0f732b2b492d7452b9304de0bbce Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 17:21:55 +0100 Subject: gridsort: PaintRowHeader's RowPos argument was superfluous - removed --- svtools/inc/svtools/table/gridtablerenderer.hxx | 1 - svtools/inc/svtools/table/tablerenderer.hxx | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index 01492ae26fc4..72dfa503fea0 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -84,7 +84,6 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle ); virtual void PaintRowHeader( - RowPos const i_rowPos, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ); diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index 4477f7065001..7490afae35b4 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: @@ -176,7 +177,7 @@ namespace svt { namespace table @param _rStyle the style to be used for drawing */ - virtual void PaintRowHeader( RowPos const i_rowPos, bool _bActive, bool _bSelected, + virtual void PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) = 0; -- cgit From 76365bac02b0ee3ffc3755699034b8d790d2c97a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 Jan 2011 21:45:47 +0100 Subject: gridsort: don't display cell tooltips unconditionally. Instead, when we use the cell content as tooltip, display it if and only if the renderer tells us it would not fit into the cell --- svtools/inc/svtools/table/gridtablerenderer.hxx | 6 +++++ svtools/inc/svtools/table/tablerenderer.hxx | 35 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index 72dfa503fea0..3b4160b1fd6a 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -93,6 +93,12 @@ namespace svt { namespace table 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; diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index 7490afae35b4..3d50c9d70ee7 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -226,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 if and only if the renderer should assume the cell content would be painted for the active + cell. + + @param i_selected + is 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 + 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() { } }; -- cgit From 6c8d7babb69985bf3f676b59cf767952c971ebc5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 12 Jan 2011 12:34:24 +0100 Subject: gridsort: reworked the color model for grid controls. Now supporting more than two alternating colors, having more reasonable defaults for the colors (VOID instead of some hard-coded values, which thus are unusable). Also, introduced new property UseGridLines controlling whether or not to paint the table grid. --- svtools/inc/svtools/table/gridtablerenderer.hxx | 14 ++++++- svtools/inc/svtools/table/tablemodel.hxx | 52 ++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 8 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index 3b4160b1fd6a..c472fa408574 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -29,6 +29,8 @@ #include +#include + //........................................................................ namespace svt { namespace table { @@ -47,7 +49,7 @@ namespace svt { namespace table 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 @@ -69,7 +71,15 @@ 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; + + /** controls whether or not to paint grid lines + */ + void useGridLines( bool const i_use ); public: // ITableRenderer overridables diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 3eb87f1eb40e..50030de7a31d 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -40,6 +40,7 @@ #include #include +#include #include //........................................................................ @@ -461,12 +462,51 @@ namespace svt { namespace table */ virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const = 0; - virtual ::com::sun::star::util::Color getLineColor() = 0; - virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; - virtual ::com::sun::star::util::Color getTextColor() = 0; - virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; - virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; - virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 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; + + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0; /// destroys the table model instance virtual ~ITableModel() { } -- cgit From 4c08b4b3d3b5427ffa843868704e8dd44c8b1826 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 13 Jan 2011 14:08:36 +0100 Subject: gridsort: reworked the notification system for inserted/removed rows In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though we're not there, yet). Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl. And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no preparation whatsoever for column selection, anywhere, thus it was a complete dummy.) Also, its de/selectRows methods have been removed: They have questionable use, and make implementation rather difficult, compared with multiple calls to de/selectRow. --- svtools/inc/svtools/table/tablecontrol.hxx | 15 +++++++-------- svtools/inc/svtools/table/tablemodel.hxx | 23 ++++++++--------------- 2 files changed, 15 insertions(+), 23 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 259b390071bb..595ff5bae847 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -87,7 +87,7 @@ namespace svt { namespace table ~TableControl(); /// sets a new table model - SVT_DLLPRIVATE void SetModel( PTableModel _pModel ); + void SetModel( PTableModel _pModel ); /// retrieves the current table model PTableModel GetModel() const; @@ -159,17 +159,13 @@ namespace svt { namespace table 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; } + 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& 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 */ @@ -221,13 +217,16 @@ namespace svt { namespace table 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 ::std::vector< sal_Int32 >& GetSelectedRows(); virtual void RemoveSelectedRow(RowPos _nRowPos); virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; // ............................................................................................................. - void clearSelection(); void selectionChanged(bool _bChanged); + void SelectRow( RowPos const i_rowIndex, bool const i_select ); + void SelectAll( bool const i_select ); + protected: ::svt::IAccessibleFactory& getAccessibleFactory(); diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 50030de7a31d..83054b5d0a57 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -103,7 +103,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 -1, 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 @@ -119,27 +120,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 column - @param last - the old index of the last removed column. 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 -- cgit From 2702fbdf06551b8f8ddbd9bb2ae5f6589939139d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 13 Jan 2011 15:07:42 +0100 Subject: gridsort: moved *all* members from TableControl to TableControl_Impl - this is what the PIMPL pattern is good for, right? (Removed the AccessibleTableControl_Impl class in this course, not needed anymore) --- svtools/inc/svtools/table/tablecontrol.hxx | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 595ff5bae847..336e56a2b01a 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -36,6 +36,7 @@ #include #include +#include //........................................................................ @@ -45,7 +46,6 @@ namespace svt { namespace table class TableControl_Impl; class TableDataWindow; - class AccessibleTableControl_Impl; //==================================================================== //= TableControl @@ -71,18 +71,10 @@ namespace svt { namespace table class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { private: - DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); - DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); - - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + ::boost::shared_ptr< TableControl_Impl > m_pImpl; - ::boost::shared_ptr< TableControl_Impl > m_pImpl; - Link m_aSelectHdl; - bool m_bSelectionChanged; public: - ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; - TableControl( Window* _pParent, WinBits _nStyle ); ~TableControl(); @@ -159,8 +151,8 @@ namespace svt { namespace table SVT_DLLPRIVATE virtual void Resize(); virtual void Select(); - void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } - const Link& GetSelectHdl() const { return m_aSelectHdl; } + void SetSelectHdl( const Link& rLink ); + const Link& GetSelectHdl() const; /**invalidates the table if table has been changed e.g. new row added */ @@ -170,7 +162,7 @@ namespace svt { namespace table if the row, which should be removed, is selected, it will be erased from the vector */ SelectionEngine* getSelEngine(); - TableDataWindow* getDataWindow(); + TableDataWindow& getDataWindow(); // Window overridables virtual void GetFocus(); @@ -215,20 +207,19 @@ namespace svt { namespace table 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 ::std::vector< sal_Int32 >& GetSelectedRows(); virtual void RemoveSelectedRow(RowPos _nRowPos); virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; // ............................................................................................................. - void selectionChanged(bool _bChanged); - void SelectRow( RowPos const i_rowIndex, bool const i_select ); void SelectAll( bool const i_select ); - protected: - ::svt::IAccessibleFactory& getAccessibleFactory(); + private: + DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); private: TableControl(); // never implemented -- cgit From 3fbbc7662deb5d5758667b51e24a2ac9b1b4bb34 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 13 Jan 2011 16:28:06 +0100 Subject: gridsort: cleaned up (parts of) the selection-related code --- svtools/inc/svtools/table/tablecontrol.hxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 336e56a2b01a..5671c7607281 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -154,9 +154,8 @@ namespace svt { namespace table void SetSelectHdl( const Link& rLink ); const Link& GetSelectHdl() const; - /**invalidates the table if table has been changed e.g. new row added - */ - void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved); + /// invalidates those areas of the data window which are covered by the given rows + void InvalidateDataWindow( RowPos const i_firstRow, RowPos const i_lastRow ); /**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 -- cgit From d41461c3de4108c5e09c64e30a38079b01217e96 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 09:50:02 +0100 Subject: gridsort: replaced RemoveSelectedRow by ClearSelection - the first implementation was buggy, anyway, and ClearSelection is the same as SelectAll( false ) (which was the only use case) --- svtools/inc/svtools/accessiblefactory.hxx | 15 ++++++++------- svtools/inc/svtools/accessibletable.hxx | 2 +- svtools/inc/svtools/table/tablecontrol.hxx | 13 ++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) mode change 100755 => 100644 svtools/inc/svtools/accessibletable.hxx (limited to 'svtools/inc') 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 -#endif -#ifndef _RTL_REF_HXX #include -#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 old mode 100755 new mode 100644 index 8ff17a2b71c7..e332c8a46ad5 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -123,7 +123,7 @@ public: 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& GetSelectedRows() = 0; - virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0; + virtual void ClearSelection() = 0; virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; }; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 5671c7607281..2ba571542de4 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -28,12 +28,13 @@ #define SVTOOLS_INC_TABLE_TABLECONTROL_HXX #include "svtools/svtdllapi.h" -#include +#include "svtools/table/tablemodel.hxx" +#include "svtools/table/tabledatawindow.hxx" +#include "svtools/accessibletable.hxx" +#include "svtools/accessiblefactory.hxx" + #include #include -#include -#include -#include #include #include @@ -65,8 +66,6 @@ namespace svt { namespace table The control supports the concept of a current (or active cell). The control supports accessibility, this is encapsulated in IAccessibleTable - - // TODO: scrolling? */ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { @@ -207,7 +206,7 @@ namespace svt { namespace table virtual sal_Bool HasRowHeader(); virtual sal_Bool HasColHeader(); virtual ::std::vector< sal_Int32 >& GetSelectedRows(); - virtual void RemoveSelectedRow(RowPos _nRowPos); + virtual void ClearSelection(); virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; // ............................................................................................................. -- cgit From dfe2edc22c03fc4b0f536749cdf9550412ef7e89 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 11:04:24 +0100 Subject: gridsort: ouch. Removed IAccessibleTable::GetSelectedRows. It exposed an internal implementation detail, and in fact some clients (the A11Y API implementation) exploited this, e.g. by simply adding elements to the array, without the owner (the TableControl/_Impl) ever noticing it. Replaced that with a working API. In this course, removed XGridSelection::getMin/MaxSelectionIndex. Pretty useless IMO, unused, and ugly to implement. --- svtools/inc/svtools/accessibletable.hxx | 10 ++++++---- svtools/inc/svtools/table/tablecontrol.hxx | 13 ++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index e332c8a46ad5..dfa5a603fc5d 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, BOOL _bOnScreen = TRUE ) = 0; virtual Rectangle calcTableRect( BOOL _bOnScreen = 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& GetSelectedRows() = 0; - virtual void ClearSelection() = 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/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 2ba571542de4..4077f9fc053a 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -190,8 +190,6 @@ namespace svt { namespace table 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, BOOL _bOnScreen = TRUE ); virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ); @@ -205,13 +203,14 @@ namespace svt { namespace table virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; virtual sal_Bool HasRowHeader(); virtual sal_Bool HasColHeader(); - virtual ::std::vector< sal_Int32 >& GetSelectedRows(); - virtual void ClearSelection(); virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; - // ............................................................................................................. - void SelectRow( RowPos const i_rowIndex, bool const i_select ); - void SelectAll( bool const i_select ); + 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* ); -- cgit From b7f4e6a2d6725a6a0b9c415996d035da7e37cb7b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 11:07:02 +0100 Subject: gridsort: respect runtime-changes of the table metrics (in the UNO control model) --- svtools/inc/svtools/table/tablemodel.hxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 83054b5d0a57..026b792c39e8 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -153,6 +153,13 @@ namespace svt { namespace table */ 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(){}; }; -- cgit From acaf4f1d75540acd79b7380c7f0ade4e04b75bd8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 14 Jan 2011 11:44:35 +0100 Subject: gridsort: moved tabledatawindow from svtools/inc/svtools to svtools/source/table - this is not a public file, after all --- svtools/inc/svtools/table/tablecontrol.hxx | 6 +- svtools/inc/svtools/table/tabledatawindow.hxx | 87 --------------------------- 2 files changed, 2 insertions(+), 91 deletions(-) delete mode 100644 svtools/inc/svtools/table/tabledatawindow.hxx (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 4077f9fc053a..a5360145bc46 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -29,7 +29,6 @@ #include "svtools/svtdllapi.h" #include "svtools/table/tablemodel.hxx" -#include "svtools/table/tabledatawindow.hxx" #include "svtools/accessibletable.hxx" #include "svtools/accessiblefactory.hxx" @@ -46,7 +45,6 @@ namespace svt { namespace table //........................................................................ class TableControl_Impl; - class TableDataWindow; //==================================================================== //= TableControl @@ -159,8 +157,8 @@ namespace svt { namespace table /**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(); + SelectionEngine* getSelEngine(); + Window& getDataWindow(); // Window overridables virtual void GetFocus(); diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx deleted file mode 100644 index 1cc030be512b..000000000000 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ /dev/null @@ -1,87 +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 - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX -#define SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX - -#ifndef _SV_WINDOW_HXX -#include -#endif -#include - -//........................................................................ -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(); - virtual void RequestHelp( const HelpEvent& rHEvt ); - - void SetBackground(const Wallpaper& rColor); - void SetBackground(); - }; -//........................................................................ -} } // namespace svt::table -//........................................................................ - -#endif // SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX -- cgit From 00abb7e08b1a2de2200878ec58c968bc8717565a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 16 Jan 2011 21:18:35 +0100 Subject: gridsort: GCC WaE --- svtools/inc/svtools/table/tablemodel.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 026b792c39e8..be2d21fff42c 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -77,7 +77,7 @@ namespace svt { namespace table /// 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 (0xFFFFFFFF) + #define COL_ATTRS_ALL (0x7FFFFFFF) //==================================================================== //= ITableModelListener -- cgit From 70315564786969decd1ee9eeb2549ce6545be1f3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 16 Jan 2011 22:18:58 +0100 Subject: gridsort: made the row title a row heading, being an Any instead of a string --- svtools/inc/svtools/table/tablemodel.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index be2d21fff42c..c5855414db97 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -460,7 +460,7 @@ namespace svt { namespace table /** retrieves title of a given row */ - virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const = 0; + virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0; /** returns the color to be used for rendering the grid lines. -- cgit From dbff9efb818fa543dac91591930d75bfee429a11 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 17 Jan 2011 12:19:05 +0100 Subject: gridsort: delegated the column resize functionality to the DefaultInputHandler implementation --- svtools/inc/svtools/table/defaultinputhandler.hxx | 5 +- .../inc/svtools/table/tablecontrolinterface.hxx | 103 ++++++++++++++++++--- 2 files changed, 93 insertions(+), 15 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx index 31b5db319290..5be517d2c623 100644 --- a/svtools/inc/svtools/table/defaultinputhandler.hxx +++ b/svtools/inc/svtools/table/defaultinputhandler.hxx @@ -27,7 +27,8 @@ #ifndef SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX #define SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX -#include +#include "svtools/table/tableinputhandler.hxx" +#include "svtools/table/tabletypes.hxx" //........................................................................ namespace svt { namespace table @@ -44,7 +45,7 @@ namespace svt { namespace table friend class TableDataWindow; private: DefaultInputHandler_Impl* m_pImpl; - bool m_bResize; + ColPos m_nResizingColumn; public: DefaultInputHandler(); diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx index 359fd65815ef..038a701173be 100644 --- a/svtools/inc/svtools/table/tablecontrolinterface.hxx +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -34,11 +34,16 @@ #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 @@ -80,9 +85,70 @@ namespace svt { namespace table 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 ) + { + } + }; + + //================================================================================================================== //= ITableControl - //==================================================================== + //================================================================================================================== /** defines a callback interface to be implemented by a concrete table control */ class SAL_NO_VTABLE ITableControl @@ -126,24 +192,35 @@ namespace svt { namespace table virtual PTableModel getModel() const = 0; /// returns the index of the currently active column - virtual ColPos getCurrentColumn() const = 0; + virtual ColPos getCurrentColumn() const = 0; /// returns the index of the currently active row - virtual RowPos getCurrentRow() const = 0; + virtual RowPos getCurrentRow() const = 0; + + virtual ::Size getTableSizePixel() const = 0; + virtual void setPointer( Pointer const & i_pointer ) = 0; + virtual void captureMouse() = 0; + virtual void releaseMouse() = 0; + virtual void invalidate() = 0; + virtual long pixelWidthToAppFont( long const i_pixels ) const = 0; + + virtual void hideTracking() = 0; + virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0; virtual void activateCellAt( const Point& rPoint ) = 0; - virtual RowPos getRowAtPoint( const Point& rPoint ) const = 0; - virtual ColPos getColAtPoint( const Point& rPoint ) const = 0; - virtual void resizeColumn(const Point& rPoint ) = 0; - virtual bool checkResizeColumn(const Point& rPoint) = 0; - virtual bool endResizeColumn(const Point& rPoint) = 0; + + virtual RowPos getRowAtPoint( const Point& rPoint ) const = 0; + virtual ColPos getColAtPoint( const Point& rPoint ) const = 0; + virtual TableCell hitTest( const Point& rPoint ) const = 0; + virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0; + virtual bool isRowSelected( RowPos _nRow ) const = 0; virtual ~ITableControl() {}; }; -//........................................................................ +//...................................................................................................................... } } // namespace svt::table -//........................................................................ +//...................................................................................................................... #endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX -- cgit From 1a31d1f55bf8d28069dd4b9d353f42e12bcb3e04 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 17 Jan 2011 13:14:28 +0100 Subject: gridsort: outsourced the column-resizing functionality into a dedicated class. Less cluttering in the InputHandler implementation this way. Same outsourcing is still to happen to the row selection functionality. The upcoming feature of column sorting will be a IMouseFunction implementation, too. --- svtools/inc/svtools/table/defaultinputhandler.hxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx index 5be517d2c623..6990f903cdb2 100644 --- a/svtools/inc/svtools/table/defaultinputhandler.hxx +++ b/svtools/inc/svtools/table/defaultinputhandler.hxx @@ -30,22 +30,22 @@ #include "svtools/table/tableinputhandler.hxx" #include "svtools/table/tabletypes.hxx" -//........................................................................ +#include + +//...................................................................................................................... namespace svt { namespace table { -//........................................................................ +//...................................................................................................................... struct DefaultInputHandler_Impl; - //==================================================================== + //================================================================================================================== //= DefaultInputHandler - //==================================================================== + //================================================================================================================== class DefaultInputHandler : public ITableInputHandler { - friend class TableDataWindow; private: - DefaultInputHandler_Impl* m_pImpl; - ColPos m_nResizingColumn; + ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl; public: DefaultInputHandler(); @@ -63,8 +63,8 @@ namespace svt { namespace table virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ); }; -//........................................................................ +//...................................................................................................................... } } // namespace svt::table -//........................................................................ +//...................................................................................................................... #endif // SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX -- cgit From 4a593d1851b4673f7b9a68c7f336f182fc6b43bb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 18 Jan 2011 11:49:19 +0100 Subject: gridsort: initial support for sorting the table data (unfinished) What's there is a IMouseFunction implementation which cares for sorting the ITableModel's data, by the column whose header was clicked. This is dependent on the model declaring support for sorting, by exposing a ITableSort interface. Missing pieces: - no UNO equivalent, yet (neither as design nor as implementation) - visualization of the current sort order/column --- .../inc/svtools/table/tablecontrolinterface.hxx | 25 +++++- svtools/inc/svtools/table/tablemodel.hxx | 10 +++ svtools/inc/svtools/table/tablesort.hxx | 91 ++++++++++++++++++++++ 3 files changed, 122 insertions(+), 4 deletions(-) create mode 100755 svtools/inc/svtools/table/tablesort.hxx (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx index 038a701173be..6ff2b07e84ed 100644 --- a/svtools/inc/svtools/table/tablecontrolinterface.hxx +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -197,23 +197,40 @@ namespace svt { namespace table /// 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() = 0; + + /// calculates a width, given in pixels, into a AppFont-based width virtual long pixelWidthToAppFont( long const i_pixels ) const = 0; - virtual void hideTracking() = 0; + /// shows a trackign rectangle virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0; - virtual void activateCellAt( const Point& rPoint ) = 0; + /// hides a prviously shown tracking rectangle + virtual void hideTracking() = 0; - virtual RowPos getRowAtPoint( const Point& rPoint ) const = 0; - virtual ColPos getColAtPoint( const Point& rPoint ) const = 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() {}; diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index c5855414db97..80ce012b05d0 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -31,6 +31,7 @@ #include "svtools/table/tabletypes.hxx" #include "svtools/table/tablerenderer.hxx" #include "svtools/table/tableinputhandler.hxx" +#include "svtools/table/tablesort.hxx" #include #include @@ -313,6 +314,7 @@ namespace svt { namespace table @see getWidth */ virtual TableMetrics getPreferredWidth() const = 0; + /** sets the preferred width of the column, to be used when user resizes column @see getMaxWidth @@ -506,8 +508,16 @@ namespace svt { namespace table 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 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/tablesort.hxx b/svtools/inc/svtools/table/tablesort.hxx new file mode 100755 index 000000000000..a8f86a3953e1 --- /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 + * + * 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 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 nColumnIndex member of the returned srtructure is COL_INVALID, then + the data is currently not sorted. + */ + virtual ColumnSort getCurrentSortOrder() const = 0; + }; + +//...................................................................................................................... +} } // namespace svt::table +//...................................................................................................................... + +#endif // SVTOOLS_TABLESORT_HXX -- cgit From 961e924dbc7ebd1cea9927134524a443a7666240 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 18 Jan 2011 11:49:20 +0100 Subject: gridsort: #163172# added UNO API support for sorting grid data. Implementation still unfinished. Things missing in the SortableGridData implementation - add as listener to the delegator, so we're notified of changes - translate and multiplex those changes - do own notifications (XGridDataListener.dataChanged) when the sort order changed - (possibly) update the sort order when the data in the current sort-column changed --- svtools/inc/svtools/table/tablesort.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablesort.hxx b/svtools/inc/svtools/table/tablesort.hxx index a8f86a3953e1..1690b4d51344 100755 --- a/svtools/inc/svtools/table/tablesort.hxx +++ b/svtools/inc/svtools/table/tablesort.hxx @@ -57,7 +57,7 @@ namespace svt { namespace table { } - ColumnSort( ColPos const i_columnPos, ColumnSortDirection i_sortDirection ) + ColumnSort( ColPos const i_columnPos, ColumnSortDirection const i_sortDirection ) :nColumnPos( i_columnPos ) ,eSortDirection( i_sortDirection ) { -- cgit From e8f649b5ad64a2a3f07dfab1a52033d126da211b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 19 Jan 2011 11:11:29 +0100 Subject: gridsort: render indicator for current column sort --- svtools/inc/svtools/table/tablecontrolinterface.hxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrolinterface.hxx b/svtools/inc/svtools/table/tablecontrolinterface.hxx index 6ff2b07e84ed..74e9688d01db 100644 --- a/svtools/inc/svtools/table/tablecontrolinterface.hxx +++ b/svtools/inc/svtools/table/tablecontrolinterface.hxx @@ -146,6 +146,17 @@ namespace svt { namespace table } }; + //================================================================================================================== + //= TableArea + //================================================================================================================== + enum TableArea + { + TableAreaColumnHeaders, + TableAreaRowHeaders, + TableAreaDataArea, + TableAreaAll + }; + //================================================================================================================== //= ITableControl //================================================================================================================== @@ -213,7 +224,7 @@ namespace svt { namespace table virtual void releaseMouse() = 0; /// invalidates the table window - virtual void invalidate() = 0; + 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; -- cgit From 903ddf534a9a71cb54867d7c40eedf456acb018a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 19 Jan 2011 12:39:41 +0100 Subject: gridsort: introduce XGridColumn::DataModelIndex. this allows for column removal/insertion at the GridColumnModel, without the need to touch the GridDataModel --- svtools/inc/svtools/table/tablecontrol.hxx | 3 --- svtools/inc/svtools/table/tablemodel.hxx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index a5360145bc46..a8324e0bc13d 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -151,9 +151,6 @@ namespace svt { namespace table void SetSelectHdl( const Link& rLink ); const Link& GetSelectHdl() const; - /// invalidates those areas of the data window which are covered by the given rows - void InvalidateDataWindow( RowPos const i_firstRow, RowPos const i_lastRow ); - /**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 */ diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 80ce012b05d0..b6c0c466edd0 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -142,7 +142,7 @@ 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 -- cgit From 7406b40991a58899180e5dd20572d078d878881d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 24 Jan 2011 11:44:36 +0100 Subject: gridsort: re-did the column resizing - introduced XGridColumn.Flexibility, determining to which degree the column is resized during auto-column-resizing - removed XGridColumn.PreferredWidth - there really is no need for this anymore now - documented the relationship between XGridColumn.Flexibility and XGridColumn.Resizeable - re-implemented TableControl_Impl::impl_ni_updateColumnWidths, with (hopefully) less magic --- svtools/inc/svtools/table/tablemodel.hxx | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index b6c0c466edd0..6408efd249a8 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -223,7 +223,7 @@ namespace svt { namespace table */ virtual void setHelpText( const String& i_helpText ) = 0; - /** determines whether the column can be resized + /** determines whether the column can be interactively resized @see getMinWidth @see getMaxWidth @@ -239,6 +239,9 @@ namespace svt { namespace table */ virtual void setResizable( bool _bResizable ) = 0; + virtual sal_Int32 getFlexibility() const = 0; + virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0; + /** returns the width of the column, in 1/100 millimeters The returned value must be a positive ->TableMetrics value. @@ -306,23 +309,6 @@ 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 - */ - virtual TableMetrics getPreferredWidth() const = 0; - - /** sets the preferred width of the column, to be used when user resizes column - - @see getMaxWidth - @see setMinWidth - @see setWidth - */ - 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 -- cgit From 38cec087c0a584ad6cbf02ff4f4b3ca3d444e494 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 24 Jan 2011 16:04:17 +0100 Subject: gridsort: adjusted ITableModel documentation to the new realities --- svtools/inc/svtools/table/tablemodel.hxx | 50 +++++++++++++++++--------------- svtools/inc/svtools/table/tabletypes.hxx | 4 --- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 6408efd249a8..94f03b684e64 100755 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -239,43 +239,41 @@ namespace svt { namespace table */ virtual void setResizable( bool _bResizable ) = 0; - virtual sal_Int32 getFlexibility() const = 0; - virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0; + /** denotes the relative flexibility of the column - /** returns the width of the column, in 1/100 millimeters + 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. - The returned value must be a positive ->TableMetrics value. + A value of 0 means the column is not auto-resized at all. + */ + virtual sal_Int32 getFlexibility() const = 0; - 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. + /** sets a new flexibility value for the column - If there is more than one column with width COLWIDTH_FIT_TO_VIEW in a model, - they're all layouted equal-width. + @see getFlexibility + */ + virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0; - If the columns with a real 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. + /** 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 @@ -284,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 @@ -292,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 @@ -301,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 @@ -309,8 +307,14 @@ namespace svt { namespace table */ virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0; + /** retrieves the horizontal alignment to be used for content in this cell + */ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0; + + /** sets a new the horizontal alignment to be used for content in this cell + */ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0; + /// deletes the column model instance virtual ~IColumnModel() { } }; @@ -382,7 +386,7 @@ 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. */ virtual TableMetrics getRowHeight() const = 0; @@ -393,7 +397,7 @@ namespace svt { namespace table returned . @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. */ virtual TableMetrics getColumnHeaderHeight() const = 0; @@ -404,7 +408,7 @@ namespace svt { namespace table returned . @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. */ virtual TableMetrics getRowHeaderWidth() const = 0; diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx index 0d285d420323..ae20851992e3 100644 --- a/svtools/inc/svtools/table/tabletypes.hxx +++ b/svtools/inc/svtools/table/tabletypes.hxx @@ -50,10 +50,6 @@ namespace svt { namespace table typedef sal_Int32 AnyPos; 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) -- cgit