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