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