LCOV - code coverage report
Current view: top level - include/svx - gridctrl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 28 50 56.0 %
Date: 2015-06-13 12:38:46 Functions: 28 51 54.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SVX_GRIDCTRL_HXX
      20             : #define INCLUDED_SVX_GRIDCTRL_HXX
      21             : 
      22             : #include <com/sun/star/sdbc/XRowSet.hpp>
      23             : #include <com/sun/star/sdbc/XRowSetListener.hpp>
      24             : #include <com/sun/star/sdb/XRowsChangeListener.hpp>
      25             : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
      26             : #include <com/sun/star/util/XNumberFormatter.hpp>
      27             : #include <com/sun/star/util/Date.hpp>
      28             : #include <com/sun/star/container/XIndexAccess.hpp>
      29             : #include <vcl/fixed.hxx>
      30             : #include <vcl/field.hxx>
      31             : 
      32             : #include <vcl/button.hxx>
      33             : #include <tools/ref.hxx>
      34             : #include <svtools/editbrowsebox.hxx>
      35             : #include <osl/mutex.hxx>
      36             : #include <comphelper/propmultiplex.hxx>
      37             : #include <svtools/transfer.hxx>
      38             : #include <svx/svxdllapi.h>
      39             : #include <vector>
      40             : 
      41             : class DbGridControl;
      42             : class CursorWrapper;
      43             : 
      44             : bool CompareBookmark(const ::com::sun::star::uno::Any& aLeft, const ::com::sun::star::uno::Any& aRight);
      45             : 
      46             : namespace svxform
      47             : {
      48             :     class DataColumn;
      49             : }
      50             : typedef ::std::vector< ::svxform::DataColumn* > DbDataColumns;
      51             : 
      52             : enum GridRowStatus
      53             : {
      54             :     GRS_CLEAN,
      55             :     GRS_MODIFIED,
      56             :     GRS_DELETED,
      57             :     GRS_INVALID
      58             : };
      59             : 
      60             : 
      61             : // DbGridRow, description of rows
      62             : 
      63             : 
      64             : class DbGridRow : public SvRefBase
      65             : {
      66             :     ::com::sun::star::uno::Any  m_aBookmark;        // Bookmark of the row, can be set
      67             :     DbDataColumns               m_aVariants;
      68             :     GridRowStatus               m_eStatus;
      69             :     bool                        m_bIsNew;
      70             :                                                     // row is no longer valid
      71             :                                                     // is removed on the next positioning
      72             : public:
      73           1 :     DbGridRow():m_eStatus(GRS_CLEAN), m_bIsNew(true) { }
      74             :     DbGridRow(CursorWrapper* pCur, bool bPaintCursor);
      75             :     void SetState(CursorWrapper* pCur, bool bPaintCursor);
      76             : 
      77             :     virtual ~DbGridRow();
      78             : 
      79          94 :     bool HasField(sal_uInt32 nPos) const { return nPos < m_aVariants.size(); }
      80          94 :     const ::svxform::DataColumn& GetField(sal_uInt32 nPos) const { return *m_aVariants[ nPos ]; }
      81             : 
      82           0 :     void            SetStatus(GridRowStatus _eStat) { m_eStatus = _eStat; }
      83           0 :     GridRowStatus   GetStatus() const               { return m_eStatus; }
      84           0 :     void            SetNew(bool _bNew)              { m_bIsNew = _bNew; }
      85          24 :     bool            IsNew() const                   { return m_bIsNew; }
      86             : 
      87           0 :     const ::com::sun::star::uno::Any& GetBookmark() const { return m_aBookmark; }
      88             : 
      89         244 :     bool    IsValid() const { return m_eStatus == GRS_CLEAN || m_eStatus == GRS_MODIFIED; }
      90           4 :     bool    IsModified() const { return m_eStatus == GRS_MODIFIED; }
      91             : };
      92             : 
      93             : typedef tools::SvRef<DbGridRow> DbGridRowRef;
      94             : 
      95             : 
      96             : // DbGridControl
      97             : 
      98             : class DbGridColumn;
      99             : typedef ::std::vector< DbGridColumn* > DbGridColumns;
     100             : 
     101             : 
     102          20 : class FmGridListener
     103             : {
     104             : public:
     105             :     virtual void selectionChanged() = 0;
     106             :     virtual void columnChanged() = 0;
     107             : 
     108             : protected:
     109          20 :     ~FmGridListener() {}
     110             : };
     111             : 
     112             : #define GRID_COLUMN_NOT_FOUND   SAL_MAX_UINT16
     113             : 
     114             : 
     115             : // InitWindowFacet, describing which aspect of a column's Window to (re-)initialize
     116             : 
     117             : enum InitWindowFacet
     118             : {
     119             :     InitFontFacet   = 0x01,
     120             :     InitForeground  = 0x02,
     121             :     InitBackground  = 0x04,
     122             :     InitWritingMode = 0x08,
     123             :     InitAll         = 0xFF
     124             : };
     125             : 
     126             : 
     127             : class FmXGridSourcePropListener;
     128             : class DisposeListenerGridBridge;
     129             : typedef ::svt::EditBrowseBox    DbGridControl_Base;
     130             : class SVX_DLLPUBLIC DbGridControl : public DbGridControl_Base
     131             : {
     132             :     friend class FmXGridSourcePropListener;
     133             :     friend class GridFieldValueListener;
     134             :     friend class DisposeListenerGridBridge;
     135             : 
     136             : public:
     137             : 
     138             :     // NavigationBar
     139             : 
     140             :     class NavigationBar: public Control
     141             :     {
     142           0 :         class AbsolutePos : public NumericField
     143             :         {
     144             :         public:
     145             :             AbsolutePos(vcl::Window* pParent, WinBits nStyle = 0);
     146             : 
     147             :             virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
     148             :             virtual void LoseFocus() SAL_OVERRIDE;
     149             :         };
     150             : 
     151             :         friend class NavigationBar::AbsolutePos;
     152             : 
     153             :         //  zusaetzliche Controls
     154             :         VclPtr<FixedText>    m_aRecordText;
     155             :         VclPtr<AbsolutePos>  m_aAbsolute;            // absolute positioning
     156             :         VclPtr<FixedText>    m_aRecordOf;
     157             :         VclPtr<FixedText>    m_aRecordCount;
     158             : 
     159             :         VclPtr<ImageButton>  m_aFirstBtn;            // ImageButton for 'go to the first record'
     160             :         VclPtr<ImageButton>  m_aPrevBtn;         // ImageButton for 'go to the previous record'
     161             :         VclPtr<ImageButton>  m_aNextBtn;         // ImageButton for 'go to the next record'
     162             :         VclPtr<ImageButton>  m_aLastBtn;         // ImageButton for 'go to the last record'
     163             :         VclPtr<ImageButton>  m_aNewBtn;          // ImageButton for 'go to a new record'
     164             :         sal_uInt16           m_nDefaultWidth;
     165             :         sal_Int32            m_nCurrentPos;
     166             : 
     167             :         bool                 m_bPositioning;     // protect PositionDataSource against recursion
     168             : 
     169             :     public:
     170             :         //  StatusIds for Controls of the Bar
     171             :         //  important for invalidation
     172             :         enum State
     173             :         {
     174             :             RECORD_TEXT = 1,
     175             :             RECORD_ABSOLUTE,
     176             :             RECORD_OF,
     177             :             RECORD_COUNT,
     178             :             RECORD_FIRST,
     179             :             RECORD_NEXT,
     180             :             RECORD_PREV,
     181             :             RECORD_LAST,
     182             :             RECORD_NEW
     183             :         };
     184             : 
     185             :         NavigationBar(vcl::Window* pParent, WinBits nStyle = 0);
     186             :         virtual ~NavigationBar();
     187             :         virtual void dispose() SAL_OVERRIDE;
     188             : 
     189             :         // Status methods for Controls
     190             :         void InvalidateAll(sal_Int32 nCurrentPos = -1, bool bAll = false);
     191           2 :         void InvalidateState(sal_uInt16 nWhich) {SetState(nWhich);}
     192             :         void SetState(sal_uInt16 nWhich);
     193             :         bool GetState(sal_uInt16 nWhich) const;
     194          98 :         sal_uInt16 GetDefaultWidth() const {return m_nDefaultWidth;}
     195             : 
     196             :     protected:
     197             :         virtual void Resize() SAL_OVERRIDE;
     198             :         virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
     199             :         virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     200             : 
     201             :     private:
     202             :         DECL_LINK(OnClick, Button*);
     203             :         sal_uInt16 ArrangeControls();
     204             : 
     205             :         void PositionDataSource(sal_Int32 nRecord);
     206             :     };
     207             : 
     208             :     friend class DbGridControl::NavigationBar;
     209             : 
     210             : public:
     211             :     // these options are or'ed and indicate, which of the single
     212             :     // features can be released, default is readonly which means 0
     213             :     enum Option
     214             :     {
     215             :         OPT_READONLY    = 0x00,
     216             :         OPT_INSERT      = 0x01,
     217             :         OPT_UPDATE      = 0x02,
     218             :         OPT_DELETE      = 0x04
     219             :     };
     220             : 
     221             : private:
     222             :     vcl::Font      m_aDefaultFont;
     223             :     Link<>          m_aMasterStateProvider;
     224             :     Link<>          m_aMasterSlotExecutor;
     225             : 
     226             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >    m_xFormatter;
     227             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
     228             : 
     229             :     DbGridColumns   m_aColumns;         // Column description
     230             :     VclPtr<NavigationBar>   m_aBar;
     231             :     DbGridRowRef    m_xDataRow;         // Row which can be modified
     232             :                                         // comes from the data cursor
     233             :     DbGridRowRef    m_xSeekRow,         // Row to which the iterator can set
     234             :                                         // comes from the data cursor
     235             : 
     236             :                     m_xEmptyRow;        // record set to insert
     237             : 
     238             :     ImplSVEvent *   m_nAsynAdjustEvent;
     239             : 
     240             :     // if we modify the row for the new record, we automatically insert a "new new row".
     241             :     // But if somebody else inserts a new record into the data source, we have to do the same.
     242             :     // For that reason we have to listen to some properties of our data source.
     243             :     ::comphelper::OPropertyChangeMultiplexer*       m_pDataSourcePropMultiplexer;
     244             :     FmXGridSourcePropListener*                      m_pDataSourcePropListener;
     245             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener>
     246             :                                                     m_xRowSetListener; // get notification when rows were changed
     247             : 
     248             :     void*                                           m_pFieldListeners;
     249             :         // property listeners for field values
     250             : 
     251             :     DisposeListenerGridBridge*                      m_pCursorDisposeListener;
     252             :         // need to know about the diposing of the seek cursor
     253             :         // construct analogous to the data source proplistener/multiplexer above :
     254             :         // DisposeListenerGridBridge is a bridge from FmXDisposeListener which I don't want to be derived from
     255             : 
     256             :     FmGridListener*                                 m_pGridListener;
     257             : 
     258             : protected:
     259             :     CursorWrapper*  m_pDataCursor;      // Cursor for Updates
     260             :     CursorWrapper*  m_pSeekCursor;      // Cursor for Seeking
     261             : 
     262             : private:
     263             :     // iteration variables
     264             :     DbGridRowRef        m_xCurrentRow;
     265             :     DbGridRowRef        m_xPaintRow;        // Row to be displayed
     266             :     sal_Int32           m_nSeekPos;         // Position of the SeekCursor
     267             :     sal_Int32           m_nTotalCount;      // is set when the data cursor finished counting the
     268             :                                             // records. Initial value is -1
     269             :     osl::Mutex          m_aDestructionSafety;
     270             :     osl::Mutex          m_aAdjustSafety;
     271             : 
     272             :     com::sun::star::util::Date
     273             :                         m_aNullDate;        // NullDate of the Numberformatter;
     274             : 
     275             :     BrowserMode         m_nMode;
     276             :     sal_Int32           m_nCurrentPos;      // Current position;
     277             :     ImplSVEvent *       m_nDeleteEvent;     // EventId for asychronous deletion of rows
     278             :     sal_uInt16          m_nOptions;         // What is the able to do (Insert, Update, Delete)
     279             :                                         // default readonly
     280             :     sal_uInt16          m_nOptionMask;      // the mask of options to be enabled in setDataSource
     281             :                                         // (with respect to the data source capabilities)
     282             :                                         // defaults to (insert | update | delete)
     283             :     sal_uInt16          m_nLastColId;
     284             :     long                m_nLastRowId;
     285             : 
     286             :     bool                m_bDesignMode : 1;      // default = sal_False
     287             :     bool                m_bRecordCountFinal : 1;
     288             :     bool                m_bMultiSelection   : 1;
     289             :     bool                m_bNavigationBar      : 1;
     290             : 
     291             :     bool                m_bSynchDisplay : 1;
     292             :     bool                m_bForceROController : 1;
     293             :     bool                m_bHandle : 1;
     294             :     bool                m_bFilterMode : 1;
     295             :     bool                m_bWantDestruction : 1;
     296             :     bool                m_bInAdjustDataSource : 1;
     297             :     bool                m_bPendingAdjustRows : 1;   // if an async adjust is pending, is it for AdjustRows or AdjustDataSource ?
     298             :     bool                m_bHideScrollbars : 1;
     299             : 
     300             : protected:
     301             :     bool                m_bUpdating : 1;            // are any updates being executed right now?
     302             : 
     303             : protected:
     304             :     virtual bool SeekRow(long nRow) SAL_OVERRIDE;
     305             :     virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows) SAL_OVERRIDE;
     306             :     virtual void PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const SAL_OVERRIDE;
     307             :     virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const SAL_OVERRIDE;
     308             :     virtual RowStatus GetRowStatus(long nRow) const SAL_OVERRIDE;
     309             :     virtual bool CursorMoving(long nNewRow, sal_uInt16 nNewCol) SAL_OVERRIDE;
     310             :     virtual void CursorMoved() SAL_OVERRIDE;
     311             :     virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY) SAL_OVERRIDE;
     312             :     virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
     313             :     virtual void Command(const CommandEvent& rEvt) SAL_OVERRIDE;
     314             :     virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE;
     315             :     virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
     316             :     virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     317             :     virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     318             :     virtual void Select() SAL_OVERRIDE;
     319             : 
     320             :     virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol) SAL_OVERRIDE;
     321             : 
     322             :     virtual void CellModified() SAL_OVERRIDE;
     323             :     virtual bool SaveModified() SAL_OVERRIDE;
     324             :     virtual bool IsModified() const SAL_OVERRIDE;
     325             : 
     326             :     virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth = 0, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1) SAL_OVERRIDE;
     327             :     void RemoveColumn(sal_uInt16 nId);
     328             :     DbGridColumn* CreateColumn(sal_uInt16 nId) const;
     329             :     virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE;
     330             :     virtual bool SaveRow() SAL_OVERRIDE;
     331             :     virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE;
     332             : 
     333             :     /// hide a column
     334             :     virtual void    HideColumn(sal_uInt16 nId);
     335             :     /// show a column
     336             :     virtual void    ShowColumn(sal_uInt16 nId);
     337             : 
     338             :     /** This is called before executing a context menu for a row. rMenu contains the initial entries
     339             :         handled by this base class' method (which always has to be called).
     340             :         Derived classes may alter the menu in any way and handle any additional entries in
     341             :         PostExecuteColumnContextMenu.
     342             :         All disabled entries will be removed before executing the menu, so be careful with separators
     343             :         near entries you probably wish to disable ...
     344             :     */
     345             :     virtual void PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu);
     346             :     /** After executing the context menu for a row this method is called.
     347             :     */
     348             :     virtual void PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
     349             : 
     350             :     void DataSourcePropertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
     351             : 
     352             :     void FieldValueChanged(sal_uInt16 _nId, const ::com::sun::star::beans::PropertyChangeEvent& _evt);
     353             :     void FieldListenerDisposing(sal_uInt16 _nId);
     354             : 
     355             :     void disposing(sal_uInt16 _nId, const ::com::sun::star::lang::EventObject& _rEvt);
     356             : 
     357             :     // own overridables
     358             :     /// called when the current row changed
     359             :     virtual void onRowChange();
     360             :     /// called when the current column changed
     361             :     virtual void onColumnChange();
     362             : 
     363             :     // DragSourceHelper overridables
     364             :     virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
     365             : 
     366             :     void    executeRowContextMenu( long _nRow, const Point& _rPreferredPos );
     367             : 
     368             : public:
     369             :     DbGridControl(
     370             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >,
     371             :         vcl::Window* pParent,
     372             :         WinBits nBits = WB_BORDER);
     373             : 
     374             :     virtual ~DbGridControl();
     375             :     virtual void dispose() SAL_OVERRIDE;
     376             : 
     377             :     virtual void Init() SAL_OVERRIDE;
     378             :     virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) = 0;
     379             :     virtual void RemoveRows() SAL_OVERRIDE;
     380             : 
     381             :     /** GetCellText returns the text at the given position
     382             :         @param  _nRow
     383             :             the number of the row
     384             :         @param  _nColId
     385             :             the ID of the column
     386             :         @return
     387             :             the text out of the cell
     388             :     */
     389             :     virtual OUString  GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
     390             : 
     391             :     void RemoveRows(bool bNewCursor);
     392             : 
     393             :     void InvalidateStatus();
     394             : 
     395          94 :     const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& getNumberFormatter() const {return m_xFormatter;}
     396             : 
     397             :     // the data source
     398             :     // the options can restrict but not extend the update abilities
     399             :     void setDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& rCursor,
     400             :         sal_uInt16 nOpts = OPT_INSERT | OPT_UPDATE | OPT_DELETE);
     401             :     virtual void Dispatch(sal_uInt16 nId) SAL_OVERRIDE;
     402             : 
     403          68 :     CursorWrapper* getDataSource() const {return m_pDataCursor;}
     404         120 :     const DbGridColumns& GetColumns() const {return m_aColumns;}
     405             : 
     406             :     void EnableHandle(bool bEnable);
     407          33 :     bool HasHandle() const {return m_bHandle;}
     408             :     void InsertHandleColumn();
     409             : 
     410             :     // which position does the column with the id in the View have, the handle column doesn't count
     411          46 :     sal_uInt16 GetViewColumnPos( sal_uInt16 nId ) const { sal_uInt16 nPos = GetColumnPos(nId); return (nPos==BROWSER_INVALIDID) ? GRID_COLUMN_NOT_FOUND : nPos-1; }
     412             : 
     413             :     // which position does the column with the id in m_aColumns have, that means the ::com::sun::star::sdbcx::Container
     414             :     // returned from the GetColumns (may be different from the position returned by GetViewColumnPos
     415             :     // if there are hidden columns)
     416             :     sal_uInt16 GetModelColumnPos( sal_uInt16 nId ) const;
     417             : 
     418             :     // the number of columns in the model
     419           0 :     sal_uInt16 GetViewColCount() const { return ColCount() - 1; }
     420          71 :     sal_uInt16 GetModelColCount() const { return (sal_uInt16)m_aColumns.size(); }
     421             :     // reverse to GetViewColumnPos: Id of position, the first non-handle column has position 0
     422          15 :     sal_uInt16 GetColumnIdFromViewPos( sal_uInt16 nPos ) const { return GetColumnId(nPos + 1); }
     423             :     sal_uInt16 GetColumnIdFromModelPos( sal_uInt16 nPos ) const;
     424             : 
     425             :     virtual void SetDesignMode(bool bMode);
     426         343 :     bool IsDesignMode() const {return m_bDesignMode;}
     427         587 :     bool IsOpen() const {return m_pSeekCursor != NULL;}
     428             : 
     429             :     void SetFilterMode(bool bMode);
     430          95 :     bool IsFilterMode() const {return m_bFilterMode;}
     431          35 :     bool IsFilterRow(long nRow) const {return m_bFilterMode && nRow == 0;}
     432             : 
     433             :     void EnableNavigationBar(bool bEnable);
     434           0 :     bool HasNavigationBar() const {return m_bNavigationBar;}
     435             : 
     436          71 :     sal_uInt16 GetOptions() const {return m_nOptions;}
     437           0 :     NavigationBar& GetNavigationBar() {return *m_aBar.get();}
     438             :     sal_uInt16 SetOptions(sal_uInt16 nOpt);
     439             :         // The new options are interpreted with respect to the current data source. If it is unable
     440             :         // to update, to insert or to restore, the according options are ignored. If the grid isn't
     441             :         // connected to a data source, all options except OPT_READONLY are ignored.
     442             : 
     443           0 :     const com::sun::star::util::Date&   getNullDate() const {return m_aNullDate;}
     444             : 
     445             :     // positioning
     446             :     void MoveToPosition(sal_uInt32 nPos);
     447             :     void MoveToFirst();
     448             :     void MoveToNext();
     449             :     void MoveToPrev();
     450             :     void MoveToLast();
     451             :     void AppendNew();
     452             : 
     453             :     // adjustment of the cursors in case the data cursor has been
     454             :     // moved from the outside.
     455             :     // the flag indicates if an adjustment of the row count should be
     456             :     // done as well
     457             :     void AdjustDataSource(bool bFull = false);
     458             :     void Undo();
     459             : 
     460             :     virtual void BeginCursorAction();
     461             :     virtual void EndCursorAction();
     462             : 
     463             :     // is the current line being updated
     464           1 :     bool IsUpdating() const {return m_bUpdating;}
     465             : 
     466             :     void RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true );
     467             :     void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
     468             :     void RowModified( long nRow, sal_uInt16 nColId = USHRT_MAX );
     469             : 
     470             :     void resetCurrentRow();
     471             : 
     472           2 :     bool getDisplaySynchron() const { return m_bSynchDisplay; }
     473             :     void setDisplaySynchron(bool bSync);
     474             :         // when set to sal_False, the display is no longer in sync with the current cursor position
     475             :         // (means that in AdjustDataSource we are jumping to a row not belonging to CursorPosition)
     476             :         // when using this, you should know what you are doing, because for example entering data
     477             :         // in a row in the display that is not in sync with the position of the cursor can be very critical
     478             : 
     479           0 :     const DbGridRowRef& GetCurrentRow() const {return m_xCurrentRow;}
     480             : 
     481          20 :     void SetStateProvider(const Link<>& rProvider) { m_aMasterStateProvider = rProvider; }
     482             :         // if this link is set the given provider will be asked for the state of my items.
     483             :         // the return values are interpreted as follows :
     484             :         // <0 -> not specified (use default mechanism to determine the state)
     485             :         // ==0 -> the item is disabled
     486             :         // >0 -> the item is enabled
     487          20 :     void SetSlotExecutor(const Link<>& rExecutor) { m_aMasterSlotExecutor = rExecutor; }
     488             :         // analogous : if this link is set, all nav-bar slots will be routed through it when executed
     489             :         // if the handler returns nonzero, no further handling of the slot occurs
     490             : 
     491             :     void EnablePermanentCursor(bool bEnable);
     492             :     bool IsPermanentCursorEnabled() const;
     493             : 
     494             :     /** forces both scrollbars to be hidden
     495             : 
     496             :         For the horizontal srollbar, this is overruled by enabling the navigation bar: A navigation
     497             :         bar <b>always</b> implies a horizontal scroll bar
     498             :         @seealso EnableNavigationBar
     499             :     */
     500             :     void        ForceHideScrollbars( bool _bForce );
     501             : 
     502             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
     503           0 :         getContext() const { return m_xContext; }
     504             : 
     505             :     /// returns <TRUE/> if the text of the given cell can be copied into the clipboard
     506             :     bool    canCopyCellText(sal_Int32 _nRow, sal_Int16 _nColId);
     507             :     /// copies the text of the given cell into the clipboard
     508             :     void        copyCellText(sal_Int32 _nRow, sal_Int16 _nColId);
     509             : 
     510             :     // selectin listener handling
     511             :     FmGridListener*             getGridListener() const { return m_pGridListener; }
     512          20 :     void                        setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; }
     513             : 
     514             :     // helper class to grant access to selected methods from within the DbCellControl class
     515             :     struct GrantControlAccess
     516             :     {
     517             :         friend class DbCellControl;
     518             :         friend class RowSetEventListener;
     519             :     protected:
     520           0 :         GrantControlAccess() { }
     521             :     };
     522             : 
     523             :     /// called when a controller needs to be re-initialized
     524             :     void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess);
     525             : 
     526           0 :     CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const    { return m_pSeekCursor; }
     527           0 :     const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const  { return m_xSeekRow;    }
     528           0 :     void  SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;}
     529             : 
     530             :     /**
     531             :         @return
     532             :             The count of additional controls of the control area.
     533             :     */
     534             :     virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE;
     535             : 
     536             :     /** Creates the accessible object of an additional control.
     537             :         @param _nIndex
     538             :             The 0-based index of the control.
     539             :         @return
     540             :             The XAccessible interface of the specified control.
     541             :     */
     542             :     virtual ::com::sun::star::uno::Reference<
     543             :         ::com::sun::star::accessibility::XAccessible >
     544             :     CreateAccessibleControl( sal_Int32 _nIndex ) SAL_OVERRIDE;
     545             : 
     546             :     // IAccessibleTableProvider
     547             :     /** Creates the accessible object of a data table cell.
     548             :         @param nRow  The row index of the cell.
     549             :         @param nColumnId  The column ID of the cell.
     550             :         @return  The XAccessible interface of the specified cell. */
     551             :     virtual ::com::sun::star::uno::Reference<
     552             :         ::com::sun::star::accessibility::XAccessible >
     553             :     CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) SAL_OVERRIDE;
     554             : 
     555             : protected:
     556             :     void RecalcRows(long nNewTopRow, sal_uInt16 nLinesOnScreen, bool bUpdateCursor);
     557             :     bool SeekCursor(long nRow, bool bAbsolute = false);
     558             :     void RemoveColumns();       // cleaning of own structures
     559             :     void AdjustRows();
     560             :     sal_Int32 AlignSeekCursor();
     561             :     bool SetCurrent(long nNewRow);
     562             : 
     563             :     OUString GetCurrentRowCellText(DbGridColumn* pCol,const DbGridRowRef& _rRow) const;
     564             :     virtual void DeleteSelectedRows();
     565         136 :     static bool IsValid(const DbGridRowRef& _xRow) { return _xRow && _xRow->IsValid(); }
     566             : 
     567             :     // row which is currently being appended
     568             :     bool IsCurrentAppending() const;
     569             : 
     570             :     // empty row for insertion
     571             :     bool IsInsertionRow(long nRow) const;
     572             : 
     573           0 :     void  SetSeekPos(sal_Int32 nPos) {m_nSeekPos = nPos;}
     574           0 :     sal_Int32 GetCurrentPos() const {return m_nCurrentPos;}
     575           0 :     sal_Int32 GetSeekPos() const {return m_nSeekPos;}
     576           0 :     sal_Int32 GetTotalCount() const {return m_nTotalCount;}
     577             : 
     578           0 :     const DbGridRowRef& GetEmptyRow() const { return m_xEmptyRow;   }
     579           0 :     const DbGridRowRef& GetSeekRow() const  { return m_xSeekRow;    }
     580           0 :     const DbGridRowRef& GetPaintRow() const { return m_xPaintRow;   }
     581             :     CursorWrapper* GetSeekCursor() const    { return m_pSeekCursor; }
     582             : 
     583             : 
     584             :     void ConnectToFields();
     585             :     void DisconnectFromFields();
     586             : 
     587             :     void implAdjustInSolarThread(bool _bRows);
     588             :         // calls AdjustRows or AdjustDataSource, synchron if the caller is running in the solar thread, else asynchron
     589             : 
     590             : protected:
     591             :     void Construct();
     592             :     void ImplInitWindow( const InitWindowFacet _eInitWhat );
     593             :     DECL_LINK(OnDelete, void*);
     594             : 
     595             :     DECL_LINK(OnAsyncAdjust, void*);
     596             :         // if the param is != NULL, AdjustRows will be called, else AdjustDataSource
     597             : 
     598             : private:
     599             :     using BrowseBox::InsertHandleColumn;
     600             : };
     601             : 
     602             : #endif // INCLUDED_SVX_GRIDCTRL_HXX
     603             : 
     604             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11