Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/gridctrl.hxx
Line
Count
Source
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
24
#include <tools/ref.hxx>
25
#include <svtools/editbrowsebox.hxx>
26
#include <svtools/recorditemwindow.hxx>
27
#include <osl/mutex.hxx>
28
#include <svx/svxdllapi.h>
29
#include <o3tl/typed_flags_set.hxx>
30
#include <map>
31
#include <memory>
32
#include <vector>
33
34
namespace comphelper { class OPropertyChangeMultiplexer; }
35
namespace com::sun::star::beans { struct PropertyChangeEvent; }
36
namespace com::sun::star::container { class XIndexAccess; }
37
namespace com::sun::star::sdbc { class XRowSet; }
38
namespace com::sun::star::uno { class XComponentContext; }
39
namespace com::sun::star::util { class XNumberFormatter; }
40
41
class CursorWrapper;
42
class GridFieldValueListener;
43
class RowSetEventListener;
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
80
0
    bool HasField(sal_uInt32 nPos) const { return nPos < m_aVariants.size(); }
81
0
    const ::svxform::DataColumn& GetField(sal_uInt32 nPos) const { return *m_aVariants[ nPos ]; }
82
83
0
    void            SetStatus(GridRowStatus _eStat) { m_eStatus = _eStat; }
84
0
    GridRowStatus   GetStatus() const               { return m_eStatus; }
85
0
    void            SetNew(bool _bNew)              { m_bIsNew = _bNew; }
86
0
    bool            IsNew() const                   { return m_bIsNew; }
87
88
0
    const css::uno::Any& GetBookmark() const { return m_aBookmark; }
89
90
0
    bool    IsValid() const { return m_eStatus == GridRowStatus::Clean || m_eStatus == GridRowStatus::Modified; }
91
0
    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:
108
0
    ~FmGridListener() {}
109
};
110
111
0
#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 DbGridControl;
164
165
// NavigationBar
166
class NavigationBar final : public InterimItemWindow
167
{
168
    class AbsolutePos final : public RecordItemWindowBase
169
    {
170
    public:
171
        AbsolutePos(std::unique_ptr<weld::Entry> xEntry, NavigationBar* pBar);
172
173
        virtual bool DoKeyInput(const KeyEvent& rEvt) override;
174
        virtual void PositionFired(sal_Int64 nRecord) override;
175
176
0
        weld::Entry* GetWidget() { return m_xWidget.get(); }
177
    private:
178
        VclPtr<NavigationBar> m_xParent;
179
    };
180
181
    friend class NavigationBar::AbsolutePos;
182
183
    //  additional controls
184
    std::unique_ptr<weld::Label> m_xRecordText;
185
    std::unique_ptr<AbsolutePos> m_xAbsolute;         // absolute positioning
186
    std::unique_ptr<weld::Label> m_xRecordOf;
187
    std::unique_ptr<weld::Label> m_xRecordCount;
188
189
    std::unique_ptr<weld::Button> m_xFirstBtn;        // Button for 'go to the first record'
190
    std::unique_ptr<weld::Button> m_xPrevBtn;         // Button for 'go to the previous record'
191
    std::unique_ptr<weld::Button> m_xNextBtn;         // Button for 'go to the next record'
192
    std::unique_ptr<weld::Button> m_xLastBtn;         // Button for 'go to the last record'
193
    std::unique_ptr<weld::Button> m_xNewBtn;          // Button for 'go to a new record'
194
195
    std::shared_ptr<weld::ButtonPressRepeater> m_xPrevRepeater;
196
    std::shared_ptr<weld::ButtonPressRepeater> m_xNextRepeater;
197
198
    Size                 m_aLastAllocSize;
199
200
    sal_Int32            m_nCurrentPos;
201
202
    bool                 m_bPositioning;     // protect PositionDataSource against recursion
203
204
public:
205
    NavigationBar(DbGridControl* pParent);
206
    virtual ~NavigationBar() override;
207
    virtual void dispose() override;
208
209
    DECL_LINK(SizeAllocHdl, const Size&, void);
210
211
    // Status methods for Controls
212
    void InvalidateAll(sal_Int32 nCurrentPos, bool bAll = false);
213
0
    void InvalidateState(DbGridControlNavigationBarState nWhich) {SetState(nWhich);}
214
    void SetState(DbGridControlNavigationBarState nWhich);
215
    bool GetState(DbGridControlNavigationBarState nWhich) const;
216
    void SetPointFontAndZoom(const vcl::Font& rFont, double fZoom);
217
    sal_uInt16 GetPreferredWidth() const;
218
219
private:
220
221
    DECL_LINK(OnClick, weld::Button&, void);
222
223
    void PositionDataSource(sal_Int32 nRecord);
224
};
225
226
class UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) DbGridControl : public svt::EditBrowseBox
227
{
228
    friend class FmXGridSourcePropListener;
229
    friend class GridFieldValueListener;
230
    friend class DisposeListenerGridBridge;
231
232
public:
233
234
    friend class NavigationBar;
235
236
private:
237
    Link<DbGridControlNavigationBarState,int>    m_aMasterStateProvider;
238
    Link<DbGridControlNavigationBarState,bool>   m_aMasterSlotExecutor;
239
240
    css::uno::Reference< css::util::XNumberFormatter >    m_xFormatter;
241
    css::uno::Reference< css::uno::XComponentContext >    m_xContext;
242
243
    std::vector< std::unique_ptr<DbGridColumn> > m_aColumns;         // Column description
244
    VclPtr<NavigationBar>   m_aBar;
245
    DbGridRowRef    m_xDataRow;         // Row which can be modified
246
                                        // comes from the data cursor
247
    DbGridRowRef    m_xSeekRow,         // Row to which the iterator can set
248
                                        // comes from the data cursor
249
250
                    m_xEmptyRow;        // record set to insert
251
252
    ImplSVEvent *   m_nAsynAdjustEvent;
253
254
    // if we modify the row for the new record, we automatically insert a "new new row".
255
    // But if somebody else inserts a new record into the data source, we have to do the same.
256
    // For that reason we have to listen to some properties of our data source.
257
    rtl::Reference<::comphelper::OPropertyChangeMultiplexer>  m_pDataSourcePropMultiplexer;
258
    FmXGridSourcePropListener*                      m_pDataSourcePropListener;
259
    rtl::Reference<RowSetEventListener>             m_xRowSetListener; // get notification when rows were changed
260
261
    std::map<sal_uInt16, GridFieldValueListener*>   m_aFieldListeners;
262
        // property listeners for field values
263
264
    std::unique_ptr<DisposeListenerGridBridge>      m_pCursorDisposeListener;
265
        // need to know about the disposing of the seek cursor
266
        // construct analogous to the data source proplistener/multiplexer above :
267
        // DisposeListenerGridBridge is a bridge from FmXDisposeListener which I don't want to be derived from
268
269
    FmGridListener*                                 m_pGridListener;
270
271
protected:
272
    std::unique_ptr<CursorWrapper> m_pDataCursor;      // Cursor for Updates
273
    std::unique_ptr<CursorWrapper> m_pSeekCursor;      // Cursor for Seeking
274
275
private:
276
    // iteration variables
277
    DbGridRowRef        m_xCurrentRow;
278
    DbGridRowRef        m_xPaintRow;        // Row to be displayed
279
    sal_Int32           m_nSeekPos;         // Position of the SeekCursor
280
    sal_Int32           m_nTotalCount;      // is set when the data cursor finished counting the
281
                                            // records. Initial value is -1
282
    osl::Mutex          m_aDestructionSafety;
283
    osl::Mutex          m_aAdjustSafety;
284
285
    Idle                m_aRearrangeIdle;
286
287
    css::util::Date
288
                        m_aNullDate;        // NullDate of the Numberformatter;
289
290
    BrowserMode         m_nMode;
291
    sal_Int32           m_nCurrentPos;      // Current position;
292
    ImplSVEvent *       m_nDeleteEvent;     // EventId for asynchronous deletion of rows
293
    DbGridControlOptions m_nOptions;        // What is it able to do (Insert, Update, Delete)
294
                                            // default readonly
295
    DbGridControlOptions m_nOptionMask;     // the mask of options to be enabled in setDataSource
296
                                            // (with respect to the data source capabilities)
297
                                            // defaults to (insert | update | delete)
298
    sal_uInt16          m_nLastColId;
299
    sal_Int32           m_nLastRowId;
300
301
    bool                m_bDesignMode : 1;      // default = sal_False
302
    bool                m_bRecordCountFinal : 1;
303
304
    bool                m_bSynchDisplay : 1;
305
    bool                m_bHandle : 1;
306
    bool                m_bFilterMode : 1;
307
    bool                m_bWantDestruction : 1;
308
    bool                m_bPendingAdjustRows : 1;   // if an async adjust is pending, is it for AdjustRows or AdjustDataSource ?
309
    bool                m_bHideScrollbars : 1;
310
311
protected:
312
    bool                m_bUpdating : 1;            // are any updates being executed right now?
313
314
protected:
315
    virtual bool SeekRow(sal_Int32 nRow) override;
316
    virtual void VisibleRowsChanged( sal_Int32 nNewTopRow, sal_uInt16 nNumRows) override;
317
    virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColId) const override;
318
    virtual RowStatus GetRowStatus(sal_Int32 nRow) const override;
319
    virtual bool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol) override;
320
    virtual void CursorMoved() override;
321
    virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY) override;
322
    virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
323
    virtual void Command(const CommandEvent& rEvt) override;
324
    virtual bool PreNotify(NotifyEvent& rEvt) override;
325
    virtual void KeyInput(const KeyEvent& rEvt) override;
326
    virtual void StateChanged( StateChangedType nType ) override;
327
    virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
328
    virtual void Select() override;
329
330
    virtual ::svt::CellController* GetController(sal_Int32 nRow, sal_uInt16 nCol) override;
331
332
    virtual void CellModified() override;
333
    virtual bool SaveModified() override;
334
    virtual bool IsModified() const override;
335
336
    virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1)) override;
337
    void RemoveColumn(sal_uInt16 nId);
338
    std::unique_ptr<DbGridColumn> CreateColumn(sal_uInt16 nId);
339
    virtual void ColumnMoved(sal_uInt16 nId) override;
340
    virtual bool SaveRow() override;
341
    virtual bool IsTabAllowed(bool bForward) const override;
342
343
    /// hide a column
344
    virtual void    HideColumn(sal_uInt16 nId);
345
    /// show a column
346
    virtual void    ShowColumn(sal_uInt16 nId);
347
348
    /** This is called before executing a context menu for a row. rMenu contains the initial entries
349
        handled by this base class' method (which always has to be called).
350
        Derived classes may alter the menu in any way and handle any additional entries in
351
        PostExecuteColumnContextMenu.
352
        All disabled entries will be removed before executing the menu, so be careful with separators
353
        near entries you probably wish to disable ...
354
    */
355
    virtual void PreExecuteRowContextMenu(weld::Menu& rMenu);
356
    /** After executing the context menu for a row this method is called.
357
    */
358
    virtual void PostExecuteRowContextMenu(const OUString& rExecutionResult);
359
360
    /// @throws css::uno::RuntimeException
361
    void DataSourcePropertyChanged(const css::beans::PropertyChangeEvent& evt);
362
363
    void FieldValueChanged(sal_uInt16 _nId);
364
    void FieldListenerDisposing(sal_uInt16 _nId);
365
366
    void disposing(sal_uInt16 _nId);
367
368
    // own overridables
369
    /// called when the current row changed
370
    virtual void onRowChange();
371
    /// called when the current column changed
372
    virtual void onColumnChange();
373
374
    // DragSourceHelper overridables
375
    virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
376
377
    void    executeRowContextMenu(const Point& _rPreferredPos);
378
379
public:
380
    DbGridControl(
381
        css::uno::Reference< css::uno::XComponentContext > const & _rxContext,
382
        vcl::Window* pParent,
383
        WinBits nBits);
384
385
    virtual ~DbGridControl() override;
386
    virtual void dispose() override;
387
388
    virtual void Init() override;
389
    virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess >& xFields) = 0;
390
    virtual void RemoveRows() override;
391
392
    /** GetCellText returns the text at the given position
393
        @param  _nRow
394
            the number of the row
395
        @param  _nColId
396
            the ID of the column
397
        @return
398
            the text out of the cell
399
    */
400
    virtual OUString  GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const override;
401
402
    void RemoveRows(bool bNewCursor);
403
404
0
    const css::uno::Reference< css::util::XNumberFormatter >& getNumberFormatter() const {return m_xFormatter;}
405
406
    // the data source
407
    // the options can restrict but not extend the update abilities
408
    void setDataSource(const css::uno::Reference< css::sdbc::XRowSet >& rCursor,
409
        DbGridControlOptions nOpts = DbGridControlOptions::Insert | DbGridControlOptions::Update | DbGridControlOptions::Delete);
410
    virtual void Dispatch(BrowserDispatchId eId) override;
411
412
0
    CursorWrapper* getDataSource() const {return m_pDataCursor.get();}
413
0
    const std::vector< std::unique_ptr<DbGridColumn> >& GetColumns() const {return m_aColumns;}
414
415
    void EnableHandle(bool bEnable);
416
0
    bool HasHandle() const {return m_bHandle;}
417
    void InsertHandleColumn();
418
419
    // which position does the column with the id in the View have, the handle column doesn't count
420
0
    sal_uInt16 GetViewColumnPos( sal_uInt16 nId ) const { sal_uInt16 nPos = GetColumnPos(nId); return (nPos==BROWSER_INVALIDID) ? GRID_COLUMN_NOT_FOUND : nPos-1; }
421
422
    // which position does the column with the id in m_aColumns have, that means the css::sdbcx::Container
423
    // returned from the GetColumns (may be different from the position returned by GetViewColumnPos
424
    // if there are hidden columns)
425
    sal_uInt16 GetModelColumnPos( sal_uInt16 nId ) const;
426
427
    // the number of columns in the model
428
0
    sal_uInt16 GetViewColCount() const { return ColCount() - 1; }
429
0
    sal_uInt16 GetModelColCount() const { return static_cast<sal_uInt16>(m_aColumns.size()); }
430
    // reverse to GetViewColumnPos: Id of position, the first non-handle column has position 0
431
0
    sal_uInt16 GetColumnIdFromViewPos( sal_uInt16 nPos ) const { return GetColumnId(nPos + 1); }
432
    sal_uInt16 GetColumnIdFromModelPos( sal_uInt16 nPos ) const;
433
434
    virtual void SetDesignMode(bool bMode);
435
0
    bool IsDesignMode() const {return m_bDesignMode;}
436
0
    bool IsOpen() const {return m_pSeekCursor != nullptr;}
437
438
    void SetFilterMode(bool bMode);
439
0
    bool IsFilterMode() const {return m_bFilterMode;}
440
0
    bool IsFilterRow(sal_Int32 nRow) const {return m_bFilterMode && nRow == 0;}
441
442
    void EnableNavigationBar(bool bEnable);
443
0
    bool HasNavigationBar() const {return m_bNavigationBar;}
444
445
0
    DbGridControlOptions GetOptions() const {return m_nOptions;}
446
0
    NavigationBar& GetNavigationBar() {return *m_aBar;}
447
    DbGridControlOptions SetOptions(DbGridControlOptions nOpt);
448
        // The new options are interpreted with respect to the current data source. If it is unable
449
        // to update, to insert or to restore, the according options are ignored. If the grid isn't
450
        // connected to a data source, all options except OPT_READONLY are ignored.
451
452
0
    const css::util::Date&   getNullDate() const {return m_aNullDate;}
453
454
    // positioning
455
    void MoveToPosition(sal_uInt32 nPos);
456
    void MoveToFirst();
457
    void MoveToNext();
458
    void MoveToPrev();
459
    void MoveToLast();
460
    void AppendNew();
461
462
    // adjustment of the cursors in case the data cursor has been
463
    // moved from the outside.
464
    // the flag indicates if an adjustment of the row count should be
465
    // done as well
466
    void AdjustDataSource(bool bFull = false);
467
    void Undo();
468
469
    virtual void BeginCursorAction();
470
    virtual void EndCursorAction();
471
472
    // is the current line being updated
473
0
    bool IsUpdating() const {return m_bUpdating;}
474
475
    void RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
476
    void RowInserted( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
477
    void RowModified( sal_Int32 nRow );
478
479
    void resetCurrentRow();
480
481
0
    bool getDisplaySynchron() const { return m_bSynchDisplay; }
482
    void setDisplaySynchron(bool bSync);
483
        // when set to sal_False, the display is no longer in sync with the current cursor position
484
        // (means that in AdjustDataSource we are jumping to a row not belonging to CursorPosition)
485
        // when using this, you should know what you are doing, because for example entering data
486
        // in a row in the display that is not in sync with the position of the cursor can be very critical
487
488
0
    const DbGridRowRef& GetCurrentRow() const {return m_xCurrentRow;}
489
490
0
    void SetStateProvider(const Link<DbGridControlNavigationBarState,int>& rProvider) { m_aMasterStateProvider = rProvider; }
491
        // if this link is set the given provider will be asked for the state of my items.
492
        // the return values are interpreted as follows :
493
        // <0 -> not specified (use default mechanism to determine the state)
494
        // ==0 -> the item is disabled
495
        // >0 -> the item is enabled
496
0
    void SetSlotExecutor(const Link<DbGridControlNavigationBarState,bool>& rExecutor) { m_aMasterSlotExecutor = rExecutor; }
497
        // analogous : if this link is set, all nav-bar slots will be routed through it when executed
498
        // if the handler returns nonzero, no further handling of the slot occurs
499
500
    void EnablePermanentCursor(bool bEnable);
501
    bool IsPermanentCursorEnabled() const;
502
503
    /** forces both scrollbars to be hidden
504
505
        For the horizontal scrollbar, this is overruled by enabling the navigation bar: A navigation
506
        bar <b>always</b> implies a horizontal scroll bar
507
        @seealso EnableNavigationBar
508
    */
509
    void        ForceHideScrollbars();
510
511
    const css::uno::Reference< css::uno::XComponentContext >&
512
0
        getContext() const { return m_xContext; }
513
514
    /// returns <TRUE/> if the text of the given cell can be copied into the clipboard
515
    bool    canCopyCellText(sal_Int32 _nRow, sal_uInt16 _nColId);
516
    /// copies the text of the given cell into the clipboard
517
    void        copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId);
518
519
    // select in listener handling
520
0
    void                        setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; }
521
522
    // helper class to grant access to selected methods from within the DbCellControl class
523
    struct GrantControlAccess final
524
    {
525
        friend class DbCellControl;
526
        friend class RowSetEventListener;
527
    };
528
529
    /// called when a controller needs to be re-initialized
530
    void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess);
531
532
0
    CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const    { return m_pSeekCursor.get(); }
533
0
    const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const  { return m_xSeekRow;    }
534
0
    void  SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;}
535
536
    /**
537
        @return
538
            The count of additional controls of the control area.
539
    */
540
    virtual sal_Int32 GetAccessibleControlCount() const override;
541
542
    /** Creates the accessible object of an additional control.
543
        @param _nIndex
544
            The 0-based index of the control.
545
        @return
546
            The accessible object of the specified control.
547
    */
548
    virtual rtl::Reference<comphelper::OAccessible>
549
    CreateAccessibleControl(sal_Int32 _nIndex) override;
550
551
    // IAccessibleTableProvider
552
    /** Creates the accessible object of a data table cell.
553
        @param nRow  The row index of the cell.
554
        @param nColumnId  The column ID of the cell.
555
        @return  The accessible object of the specified cell. */
556
    virtual rtl::Reference<comphelper::OAccessible>
557
    CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
558
559
    void RearrangeAtIdle();
560
561
protected:
562
    void RecalcRows(sal_Int32 nNewTopRow, sal_uInt16 nLinesOnScreen, bool bUpdateCursor);
563
    bool SeekCursor(sal_Int32 nRow, bool bAbsolute = false);
564
    void RemoveColumns();       // cleaning of own structures
565
    void AdjustRows();
566
    sal_Int32 AlignSeekCursor();
567
    bool SetCurrent(sal_Int32 nNewRow);
568
569
    OUString GetCurrentRowCellText(DbGridColumn const * pCol,const DbGridRowRef& _rRow) const;
570
    virtual void DeleteSelectedRows();
571
0
    static bool IsValid(const DbGridRowRef& _xRow) { return _xRow.is() && _xRow->IsValid(); }
572
573
    // row which is currently being appended
574
    bool IsCurrentAppending() const;
575
576
    // empty row for insertion
577
    bool IsInsertionRow(sal_Int32 nRow) const;
578
579
0
    void  SetSeekPos(sal_Int32 nPos) {m_nSeekPos = nPos;}
580
0
    sal_Int32 GetCurrentPos() const {return m_nCurrentPos;}
581
0
    sal_Int32 GetSeekPos() const {return m_nSeekPos;}
582
0
    sal_Int32 GetTotalCount() const {return m_nTotalCount;}
583
584
0
    const DbGridRowRef& GetEmptyRow() const { return m_xEmptyRow;   }
585
0
    const DbGridRowRef& GetSeekRow() const  { return m_xSeekRow;    }
586
0
    const DbGridRowRef& GetPaintRow() const { return m_xPaintRow;   }
587
588
    void ConnectToFields();
589
    void DisconnectFromFields();
590
591
    void implAdjustInSolarThread(bool _bRows);
592
        // calls AdjustRows or AdjustDataSource, synchronous if the caller is running in the solar thread, else asynchronous
593
594
protected:
595
    void ImplInitWindow( const InitWindowFacet _eInitWhat );
596
    DECL_DLLPRIVATE_LINK(OnDelete, void*, void);
597
    DECL_DLLPRIVATE_LINK(RearrangeHdl, Timer*, void);
598
599
    DECL_DLLPRIVATE_LINK(OnAsyncAdjust, void*, void);
600
        // if the param is != nullptr, AdjustRows will be called, else AdjustDataSource
601
602
private:
603
    using BrowseBox::InsertHandleColumn;
604
};
605
606
#endif // INCLUDED_SVX_GRIDCTRL_HXX
607
608
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */