1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVTOOLS_BRWBOX_HXX
20 #define INCLUDED_SVTOOLS_BRWBOX_HXX
22 #include <svtools/svtdllapi.h>
23 #include <vcl/scrbar.hxx>
24 #include <vcl/ctrl.hxx>
25 #include <tools/multisel.hxx>
26 #include <svtools/headbar.hxx>
27 #include <svtools/transfer.hxx>
28 #include <svtools/AccessibleBrowseBoxObjType.hxx>
29 #include <svtools/accessibletableprovider.hxx>
40 typedef ::std::vector
< BrowserColumn
* > BrowserColumns
;
44 class IAccessibleFactory
;
47 class AccessibleStateSetHelper
;
50 // -------------------
51 // - BrowseBox-Types -
52 // -------------------
54 #define BROWSER_INVALIDID SAL_MAX_UINT16
55 #define BROWSER_ENDOFSELECTION (static_cast<long>(SFX_ENDOFSELECTION))
57 typedef sal_uLong BrowserMode
;
59 #define BROWSER_COLUMNSELECTION 0x0001
60 #define BROWSER_MULTISELECTION 0x0002
61 #define BROWSER_THUMBDRAGGING 0x0004
62 #define BROWSER_KEEPHIGHLIGHT 0x0008
63 #define BROWSER_KEEPSELECTION BROWSER_KEEPHIGHLIGHT // old, don't use!
64 #define BROWSER_HLINES 0x0010
65 #define BROWSER_VLINES 0x0020
66 #define BROWSER_HLINESFULL BROWSER_HLINES // old, don't use!
67 #define BROWSER_VLINESFULL BROWSER_VLINES // old, don't use!
68 #define BROWSER_HLINESDOTS 0x0000 // old => don't use!
69 #define BROWSER_VLINESDOTS 0x0000 // old => don't use!
71 #define BROWSER_HIDESELECT 0x0100 // old => don't use!
72 #define BROWSER_HIDECURSOR 0x0200
74 #define BROWSER_NO_HSCROLL 0x0400
75 #define BROWSER_NO_SCROLLBACK 0x0800
77 #define BROWSER_AUTO_VSCROLL 0x1000
78 #define BROWSER_AUTO_HSCROLL 0x2000
80 #define BROWSER_TRACKING_TIPS 0x4000
82 #define BROWSER_NO_VSCROLL 0x8000
84 #define BROWSER_HIGHLIGHT_NONE 0x0100 // == BROWSER_HIDESELECT
86 #define BROWSER_HEADERBAR_NEW 0x00040000
87 #define BROWSER_AUTOSIZE_LASTCOL 0x00080000
88 #define BROWSER_OWN_DATACHANGED 0x00100000
90 #define BROWSER_CURSOR_WO_FOCUS 0x00200000
91 // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
92 // situations which require to temporarily hide the cursor (such as scrolling).
94 #define BROWSER_SMART_HIDECURSOR 0x00400000
95 // is an enhanced version of BROWSER_HIDECURSOR.
96 // When set, BROWSER_HIDECURSOR is overruled, and the cursor is hidden as long as no selection exists,
97 // but shown otherwise. This does not affect other situations which require to temporarily hide the
98 // cursor (such as scrolling).
100 #define BROWSER_NONE 0
101 #define BROWSER_SELECT 720
102 #define BROWSER_ENHANCESELECTION 722
103 #define BROWSER_SELECTDOWN 724
104 #define BROWSER_SELECTUP 725
105 #define BROWSER_CURSORDOWN 731
106 #define BROWSER_CURSORUP 732
107 #define BROWSER_CURSORLEFT 733
108 #define BROWSER_CURSORRIGHT 734
109 #define BROWSER_CURSORPAGEDOWN 735
110 #define BROWSER_CURSORPAGEUP 736
111 #define BROWSER_CURSORENDOFFILE 741
112 #define BROWSER_CURSORTOPOFFILE 742
113 #define BROWSER_CURSORENDOFSCREEN 743
114 #define BROWSER_CURSORTOPOFSCREEN 744
115 #define BROWSER_CURSORHOME 745
116 #define BROWSER_CURSOREND 746
117 #define BROWSER_SCROLLDOWN 751
118 #define BROWSER_SCROLLUP 752
119 #define BROWSER_SELECTHOME 753
120 #define BROWSER_SELECTEND 754
121 #define BROWSER_SELECTCOLUMN 755
122 #define BROWSER_MOVECOLUMNLEFT 756
123 #define BROWSER_MOVECOLUMNRIGHT 757
139 BrowseEvent( Window
* pWindow
,
141 sal_uInt16 nColumn
, sal_uInt16 nColumnId
,
142 const Rectangle
& rRect
);
144 Window
* GetWindow() const { return pWin
; }
145 long GetRow() const { return nRow
; }
146 sal_uInt16
GetColumn() const { return nCol
; }
147 sal_uInt16
GetColumnId() const { return nColId
; }
148 const Rectangle
& GetRect() const { return aRect
; }
151 // ---------------------
152 // - BrowserMouseEvent -
153 // ---------------------
155 class BrowserMouseEvent
: public MouseEvent
, public BrowseEvent
159 BrowserMouseEvent( BrowserDataWin
* pWin
, const MouseEvent
& rEvt
);
160 BrowserMouseEvent( Window
* pWin
, const MouseEvent
& rEvt
,
161 long nAbsRow
, sal_uInt16 nColumn
, sal_uInt16 nColumnId
,
162 const Rectangle
& rRect
);
165 // --------------------------
166 // - BrowserAcceptDropEvent -
167 // --------------------------
169 class BrowserAcceptDropEvent
: public AcceptDropEvent
, public BrowseEvent
172 BrowserAcceptDropEvent();
173 BrowserAcceptDropEvent( BrowserDataWin
* pWin
, const AcceptDropEvent
& rEvt
);
176 // ---------------------------
177 // - BrowserExecuteDropEvent -
178 // ---------------------------
180 class BrowserExecuteDropEvent
: public ExecuteDropEvent
, public BrowseEvent
183 BrowserExecuteDropEvent();
184 BrowserExecuteDropEvent( BrowserDataWin
* pWin
, const ExecuteDropEvent
& rEvt
);
192 // The whole selection thingie in this class is somewhat .... suspicious to me.
194 // * method parameters named like members (and used in both semantics within the method!)
195 // * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
196 // it's for column selection, too (and sometimes in an even stranger way :)
197 // * it is not really defined like all these hundreds selection related flags/methods work together
198 // and influence each other. I do not understand it very well, but this may be my fault :)
199 // * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
200 // not without a const_cast)
202 // We should clearly define this somewhere in the future. Or, even better, we should re-implement this
203 // whole class, which is planned for a long time :)
205 // sorry for the ranting. could not resist
207 class SVT_DLLPUBLIC BrowseBox
209 ,public DragSourceHelper
210 ,public DropTargetHelper
211 ,public svt::IAccessibleTableProvider
213 #define NO_CURSOR_HIDE 0
214 #define HARD_CURSOR_HIDE 1
215 #define SMART_CURSOR_HIDE 2
217 friend class BrowserDataWin
;
218 friend class ::svt::BrowseBoxImpl
;
221 friend const char* BrowseBoxCheckInvariants( const void * pVoid
);
225 static const sal_uInt16 HandleColumnId
= 0;
228 Window
* pDataWin
; // window to display data rows
229 ScrollBar
* pVScroll
; // vertical scrollbar
230 ScrollBar aHScroll
; // horizontal scrollbar
232 long nDataRowHeight
; // height of a single data-row
233 sal_uInt16 nTitleLines
; // number of lines in title row
234 sal_uLong nControlAreaWidth
; // width of fixed area beneeth hscroll
235 sal_Bool bThumbDragging
; // handle thumb dragging
236 sal_Bool bColumnCursor
; // single columns and fields selectable
237 sal_Bool bMultiSelection
;// allow multiple selected rows
238 sal_Bool bKeepHighlight
; // don't hide selection on LoseFocus
240 sal_Bool bHLines
; // draw lines between rows
241 sal_Bool bVLines
; // draw lines between columns
242 sal_Bool bHDots
; // draw lines between rows dotted
243 sal_Bool bVDots
; // draw lines between columns dotted
244 Color aGridLineColor
; // color for lines, default dark grey
245 sal_Bool bBootstrapped
; // child windows resized etc.
246 long nTopRow
; // no. of first visible row (0...)
247 long nCurRow
; // no. of row with cursor
248 long nRowCount
; // total number of rows in model
249 sal_uInt16 nFirstCol
; // no. of first visible scrollable column
250 sal_uInt16 nCurColId
; // column id of cursor
253 sal_Bool bRowDividerDrag
;
255 sal_Bool mbInteractiveRowHeight
;
259 long nResizeX
; // mouse position at start of resizing
260 long nMinResizeX
; // never drag more left
261 long nDragX
; // last dragged column (MouseMove)
262 sal_uInt16 nResizeCol
; // resize this column in MouseMove
263 sal_Bool bResizing
; // mouse captured for column resizing
265 bool bSelect
; /// select or deselect
266 sal_Bool bSelectionIsVisible
; // depending on focus
267 sal_Bool bScrolling
; // hidden cursor while scrolling
268 sal_Bool bNotToggleSel
; // set while in ToggleSelection() etc.
269 sal_Bool bHasFocus
; // set/unset in Get/LoseFocus
270 sal_Bool bHideSelect
; // hide selection (highlight)
271 sal_Bool bHideCursor
; // hide cursor (frame)
272 Range aSelRange
; // for selection expansion
274 BrowserColumns
* pCols
; // array of column-descriptions
277 MultiSelection
* pSel
; // selected rows for multi-selection
278 long nSel
; // selected row for single-selection
280 MultiSelection
* pColSel
; // selected column-ids
282 ::std::auto_ptr
< ::svt::BrowseBoxImpl
> m_pImpl
; // impl structure of the BrowseBox object
284 sal_Bool m_bFocusOnlyCursor
; // hide cursor if we don't have the focus
285 Color m_aCursorColor
; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
286 BrowserMode m_nCurrentMode
; // last argument of SetMode (redundant, as our other members represent the current settings, too)
289 SVT_DLLPRIVATE
void ConstructImpl(BrowserMode nMode
);
290 SVT_DLLPRIVATE
void ExpandRowSelection( const BrowserMouseEvent
& rEvt
);
291 SVT_DLLPRIVATE
void ToggleSelection( sal_Bool bForce
= sal_False
);
293 SVT_DLLPRIVATE
void UpdateScrollbars();
294 SVT_DLLPRIVATE
void AutoSizeLastColumn();
296 SVT_DLLPRIVATE
long ImpGetDataRowHeight() const;
297 SVT_DLLPRIVATE Rectangle
ImplFieldRectPixel( long nRow
, sal_uInt16 nColId
) const;
298 SVT_DLLPRIVATE sal_uInt16
FrozenColCount() const;
300 SVT_DLLPRIVATE
void ColumnInserted( sal_uInt16 nPos
);
302 DECL_DLLPRIVATE_LINK( ScrollHdl
, ScrollBar
* );
303 DECL_DLLPRIVATE_LINK( EndScrollHdl
, void * );
304 DECL_DLLPRIVATE_LINK( StartDragHdl
, HeaderBar
* );
306 SVT_DLLPRIVATE
long GetFrozenWidth() const;
308 sal_Bool
GoToRow(long nRow
, sal_Bool bRowColMove
, sal_Bool bDoNotModifySelection
= sal_False
);
310 sal_Bool
GoToColumnId( sal_uInt16 nColId
, sal_Bool bMakeVisible
, sal_Bool bRowColMove
= sal_False
);
311 void SelectColumnPos( sal_uInt16 nCol
, sal_Bool _bSelect
, sal_Bool bMakeVisible
);
312 void SelectColumnId( sal_uInt16 nColId
, sal_Bool _bSelect
, sal_Bool bMakeVisible
)
313 { SelectColumnPos( GetColumnPos(nColId
), _bSelect
, bMakeVisible
); }
315 void ImplPaintData(OutputDevice
& _rOut
, const Rectangle
& _rRect
, sal_Bool _bForeignDevice
, sal_Bool _bDrawSelections
);
317 sal_Bool
PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor
&& !HasFocus(); }
319 sal_uInt16
ToggleSelectedColumn();
320 void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId
);
323 /// retrieves the XAccessible implementation associated with the BrowseBox instance
324 ::svt::IAccessibleFactory
& getAccessibleFactory();
327 sal_uInt16
ColCount() const;
329 // software plug for database access
330 // Der RowCount wird jetzt intern automatisch gezaehlt
331 // (ueber RowInserted und RowRemoved), daher ist das Ueberladen
332 // dieser Methode ueberfluessig!
334 virtual long GetRowCount() const;
337 // fuer Anzeige im VScrollBar z.B. auf "?" oder setzen
338 void SetRealRowCount( const OUString
&rRealRowCount
);
340 // Return Value muss immer sal_True sein - SeekRow *muss* klappen!
341 // (sonst ASSERT) MI: wer hat das eingebaut? Das darf nicht so sein!
343 /** seeks for the given row position
347 virtual sal_Bool
SeekRow( long nRow
) = 0;
348 virtual void DrawCursor();
349 virtual void PaintRow( OutputDevice
&rDev
, const Rectangle
&rRect
);
350 virtual void PaintData( Window
& rWin
, const Rectangle
& rRect
);
351 virtual void PaintField( OutputDevice
& rDev
, const Rectangle
& rRect
,
352 sal_uInt16 nColumnId
) const = 0;
353 // Benachrichtigung an die abgeleitete Klasse, dass sich der sichtbare
354 // Bereich von Rows geaendert hat. Aus dieser Methode heraus darf
355 // die abgeleitete Klasse Aenderungen des Model mit Hilfe der Methoden
356 // RowInserted und RowRemoved bekanntgeben. Mit sich daraus ergebenden
357 // neuen Zustand wird anschliessend ein Paint veranlasst (und entsprechend
358 // SeekRow etc. gerufen).
360 // Parameter: nNewTopRow: Nr. der neuen TopRow (kann von VisibleRowsChanged
361 // durch Aufruf von RowInserted und RowDeleted noch veraendert werden).
362 // nNumRows: Anzahl der sichtbaren Rows (auch eine teilweise sichtbare Row
363 // wird mitgezaehlt).
365 // Moegliche Ursachen fuer die Aenderung des sichtbaren Bereiches:
366 // - Vor dem sichtbaren Bereich sind Rows eingefuegt oder geloescht worden,
367 // dadurch aendert sich nur die Numerierung der sichtbaren Rows
368 // - Scrollen (und daraus resultierend eine andere erste sichtbare Row)
369 // - Resize des Fensters
370 virtual void VisibleRowsChanged( long nNewTopRow
, sal_uInt16 nNumRows
);
372 // Anzahl sichtbarer Rows in dem Fenster (inkl. "angeschnittener" Rows)
373 sal_uInt16
GetVisibleRows()
374 { return (sal_uInt16
)((pDataWin
->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
375 long GetTopRow() { return nTopRow
; }
376 sal_uInt16
GetFirstVisibleColNumber() const { return nFirstCol
; }
378 // Focus-Rect ein-/ausschalten
379 void DoShowCursor( const char *pWhoLog
);
380 void DoHideCursor( const char *pWhoLog
);
381 short GetCursorHideCount() const;
383 virtual BrowserHeader
* CreateHeaderBar( BrowseBox
* pParent
);
385 // HACK(virtuelles Create wird im Ctor nicht gerufen)
386 void SetHeaderBar( BrowserHeader
* );
388 long CalcReverseZoom(long nVal
);
390 inline const DataFlavorExVector
&
391 GetDataFlavors() const;
393 sal_Bool
IsDropFormatSupported( SotFormatStringId nFormat
); // need this because the base class' IsDropFormatSupported is not const ...
394 sal_Bool
IsDropFormatSupported( SotFormatStringId nFormat
) const;
396 sal_Bool
IsDropFormatSupported( const css::datatransfer::DataFlavor
& _rFlavor
); // need this because the base class' IsDropFormatSupported is not const ...
397 sal_Bool
IsDropFormatSupported( const css::datatransfer::DataFlavor
& _rFlavor
) const;
400 void* implGetDataFlavors() const;
401 // with this we can make GetDataFlavors() inline, which is strongly needed as SVTOOLS does not export
402 // any sysbols containing an "_STL", so a non-inlined method would not be exported ....
405 // callbacks for the data window
406 virtual void ImplStartTracking();
407 virtual void ImplTracking();
408 virtual void ImplEndTracking();
411 BrowseBox( Window
* pParent
, WinBits nBits
= 0,
412 BrowserMode nMode
= 0 );
413 BrowseBox( Window
* pParent
, const ResId
& rId
,
414 BrowserMode nMode
= 0 );
417 // ererbte ueberladene Handler
418 virtual void StateChanged( StateChangedType nStateChange
);
419 virtual void MouseButtonDown( const MouseEvent
& rEvt
);
420 virtual void MouseMove( const MouseEvent
& rEvt
);
421 virtual void MouseButtonUp( const MouseEvent
& rEvt
);
422 virtual void KeyInput( const KeyEvent
& rEvt
);
423 virtual void LoseFocus();
424 virtual void GetFocus();
425 virtual void Resize();
426 virtual void Paint( const Rectangle
& rRect
);
427 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, sal_uLong nFlags
);
428 virtual void Command( const CommandEvent
& rEvt
);
429 virtual void StartDrag( sal_Int8 _nAction
, const Point
& _rPosPixel
);
431 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
); // will forward everything got to the second AcceptDrop method
432 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
); // will forward everything got to the second ExecuteDrop method
434 virtual sal_Int8
AcceptDrop( const BrowserAcceptDropEvent
& rEvt
);
435 virtual sal_Int8
ExecuteDrop( const BrowserExecuteDropEvent
& rEvt
);
438 virtual void MouseButtonDown( const BrowserMouseEvent
& rEvt
);
439 virtual void MouseMove( const BrowserMouseEvent
& rEvt
);
440 virtual void MouseButtonUp( const BrowserMouseEvent
& rEvt
);
441 virtual void StartScroll();
442 virtual void EndScroll();
443 virtual void Select();
444 virtual void DoubleClick( const BrowserMouseEvent
& rEvt
);
445 virtual sal_Bool
IsCursorMoveAllowed( long nNewRow
, sal_uInt16 nNewColId
) const;
446 virtual void CursorMoved();
447 virtual void ColumnMoved( sal_uInt16 nColId
);
448 virtual void ColumnResized( sal_uInt16 nColId
);
449 virtual long QueryColumnResize( sal_uInt16 nColId
, long nWidth
);
450 /// called when the row height has been changed interactively
451 virtual void RowHeightChanged();
452 virtual long QueryMinimumRowHeight();
454 // Window-Control (pass to DataWindow)
455 void SetUpdateMode( sal_Bool bUpdate
);
456 sal_Bool
GetUpdateMode() const;
458 // map-mode and font control
459 void SetFont( const Font
& rNewFont
);
460 const Font
& GetFont() const { return pDataWin
->GetFont(); }
461 void SetTitleFont( const Font
& rNewFont
)
462 { Control::SetFont( rNewFont
); }
463 const Font
& GetTitleFont() const { return Control::GetFont(); }
465 // color for line painting
466 void SetGridLineColor(const Color
& rColor
) {aGridLineColor
= rColor
;}
467 const Color
& GetGridLineColor() const {return aGridLineColor
;}
469 // inserting, changing, removing and freezing of columns
470 void InsertHandleColumn( sal_uLong nWidth
);
471 void InsertDataColumn( sal_uInt16 nItemId
, const OUString
& rText
,
472 long nSize
, HeaderBarItemBits nBits
= HIB_STDSTYLE
,
473 sal_uInt16 nPos
= HEADERBAR_APPEND
);
474 void SetColumnTitle( sal_uInt16 nColumnId
, const OUString
&rTitle
);
475 void SetColumnWidth( sal_uInt16 nColumnId
, sal_uLong nWidth
);
476 void SetColumnPos( sal_uInt16 nColumnId
, sal_uInt16 nPos
);
477 void FreezeColumn( sal_uInt16 nColumnId
, sal_Bool bFreeze
= sal_True
);
478 void UnfreezeColumns();
479 void RemoveColumn( sal_uInt16 nColumnId
);
480 void RemoveColumns();
482 // control of title and data row height
483 void SetDataRowHeight( long nPixel
);
484 long GetDataRowHeight() const;
485 void SetTitleLines( sal_uInt16 nLines
);
486 sal_uInt16
GetTitleLines() const { return nTitleLines
; }
487 virtual long GetTitleHeight() const;
489 // access to dynamic values of cursor row
490 OUString
GetColumnTitle( sal_uInt16 nColumnId
) const;
491 Rectangle
GetFieldRect( sal_uInt16 nColumnId
) const;
492 sal_uLong
GetColumnWidth( sal_uInt16 nColumnId
) const;
493 sal_uInt16
GetColumnId( sal_uInt16 nPos
) const;
494 sal_uInt16
GetColumnPos( sal_uInt16 nColumnId
) const;
495 sal_Bool
IsFrozen( sal_uInt16 nColumnId
) const;
497 // movement of visible area
499 long ScrollColumns( long nColumns
);
500 long ScrollRows( long nRows
);
501 sal_Bool
MakeFieldVisible( long nRow
, sal_uInt16 nColId
, sal_Bool bComplete
= sal_False
);
503 // access and movement of cursor
504 long GetCurRow() const { return nCurRow
; }
505 sal_uInt16
GetCurColumnId() const { return nCurColId
; }
506 sal_Bool
GoToRow( long nRow
);
507 sal_Bool
GoToColumnId( sal_uInt16 nColId
);
508 sal_Bool
GoToRowColumnId( long nRow
, sal_uInt16 nColId
);
511 virtual void SetNoSelection();
512 virtual void SelectAll();
513 virtual void SelectRow( long nRow
, sal_Bool _bSelect
= sal_True
, sal_Bool bExpand
= sal_True
);
514 void SelectColumnPos( sal_uInt16 nCol
, sal_Bool _bSelect
= sal_True
)
515 { SelectColumnPos( nCol
, _bSelect
, sal_True
); }
516 void SelectColumnId( sal_uInt16 nColId
, sal_Bool _bSelect
= sal_True
)
517 { SelectColumnPos( GetColumnPos(nColId
), _bSelect
, sal_True
); }
518 long GetSelectRowCount() const;
519 sal_uInt16
GetSelectColumnCount() const;
520 virtual bool IsRowSelected( long nRow
) const;
521 bool IsColumnSelected( sal_uInt16 nColumnId
) const;
522 long FirstSelectedRow( sal_Bool bInverse
= sal_False
);
523 long LastSelectedRow();
524 long NextSelectedRow();
525 const MultiSelection
* GetColumnSelection() const { return pColSel
; }
526 const MultiSelection
* GetSelection() const
527 { return bMultiSelection
? uRow
.pSel
: 0; }
529 long FirstSelectedColumn( ) const;
531 sal_Bool
IsResizing() const { return bResizing
; }
533 // access to positions of fields, column and rows
534 Window
& GetDataWindow() const { return *pDataWin
; }
535 Rectangle
GetRowRectPixel( long nRow
,
536 sal_Bool bRelToBrowser
= sal_True
) const;
537 Rectangle
GetFieldRectPixel( long nRow
, sal_uInt16 nColId
,
538 sal_Bool bRelToBrowser
= sal_True
) const;
539 sal_Bool
IsFieldVisible( long nRow
, sal_uInt16 nColId
,
540 sal_Bool bComplete
= sal_False
) const;
541 long GetRowAtYPosPixel( long nY
,
542 sal_Bool bRelToBrowser
= sal_True
) const;
543 sal_uInt16
GetColumnAtXPosPixel( long nX
,
544 sal_Bool bRelToBrowser
= sal_True
) const;
548 void RowRemoved( long nRow
, long nNumRows
= 1, sal_Bool bDoPaint
= sal_True
);
549 void RowModified( long nRow
, sal_uInt16 nColId
= BROWSER_INVALIDID
);
550 void RowInserted( long nRow
, long nNumRows
= 1, sal_Bool bDoPaint
= sal_True
, sal_Bool bKeepSelection
= sal_False
);
553 void ReserveControlArea( sal_uInt16 nWidth
= USHRT_MAX
);
554 Rectangle
GetControlArea() const;
555 sal_Bool
ProcessKey( const KeyEvent
& rEvt
);
556 void Dispatch( sal_uInt16 nId
);
557 void SetMode( BrowserMode nMode
= 0 );
558 BrowserMode
GetMode( ) const { return m_nCurrentMode
; }
560 void SetCursorColor(const Color
& _rCol
);
561 Color
GetCursorColor() const { return m_aCursorColor
; }
562 void ResetSelecting() { bSelecting
= sal_False
; }
564 /** specifies that the user is allowed to interactively change the height of a row,
565 by simply dragging an arbitrary row separator.
567 Note that this works only if there's a handle column, since only in this case,
568 there *is* something for the user to click onto
570 void EnableInteractiveRowHeight( sal_Bool _bEnable
= sal_True
) { mbInteractiveRowHeight
= _bEnable
; }
571 sal_Bool
IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight
; }
573 /// access to selected methods, to be granted to the BrowserColumn
574 struct BrowserColumnAccess
{ friend class BrowserColumn
; private: BrowserColumnAccess() { } };
575 /** public version of PaintField, with selected access rights for the BrowserColumn
577 void DoPaintField( OutputDevice
& rDev
, const Rectangle
& rRect
, sal_uInt16 nColumnId
, BrowserColumnAccess
) const
578 { PaintField( rDev
, rRect
, nColumnId
); }
580 /** suggests a default width for a column containing a given text
582 The width is calculated so that the text fits completely, plus som margin.
584 sal_uLong
GetDefaultColumnWidth( const OUString
& _rText
) const;
586 /** GetCellText returns the text at the given position
588 the number of the row
592 the text out of the cell
594 virtual OUString
GetCellText(long _nRow
, sal_uInt16 _nColId
) const;
597 the current column count
599 sal_uInt16
GetColumnCount() const { return ColCount(); }
601 /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
609 void commitBrowseBoxEvent(sal_Int16 nEventId
,
610 const css::uno::Any
& rNewValue
,
611 const css::uno::Any
& rOldValue
);
613 /** commitTableEvent commit the event at all listeners of the table
621 void commitTableEvent(sal_Int16 nEventId
,
622 const css::uno::Any
& rNewValue
,
623 const css::uno::Any
& rOldValue
);
625 /** fires an AccessibleEvent relative to a header bar AccessibleContext
634 void commitHeaderBarEvent(sal_Int16 nEventId
,
635 const css::uno::Any
& rNewValue
,
636 const css::uno::Any
& rOldValue
,
637 sal_Bool _bColumnHeaderBar
640 /** returns the Rectangle for either the column header bar ot the row header bar
642 <TRUE/> when column header bar is used
644 <TRUE/> when the rectangle should be calculated OnScreen
648 virtual Rectangle
calcHeaderRect(sal_Bool _bIsColumnBar
,sal_Bool _bOnScreen
= sal_True
);
650 /** calculates the Rectangle of the table
652 <TRUE/> when the rectangle should be calculated OnScreen
656 virtual Rectangle
calcTableRect(sal_Bool _bOnScreen
= sal_True
);
664 <TRUE/> when the rectangle should be calculated OnScreen
668 virtual Rectangle
GetFieldRectPixelAbs(sal_Int32 _nRowId
,sal_uInt16 _nColId
, sal_Bool _bIsHeader
, sal_Bool _bOnScreen
= sal_True
);
670 /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
671 sal_Bool
isAccessibleAlive( ) const;
673 // ACCESSIBILITY ==========================================================
675 /** Creates and returns the accessible object of the whole BrowseBox. */
676 virtual css::uno::Reference
<
677 css::accessibility::XAccessible
> CreateAccessible();
679 // Children ---------------------------------------------------------------
681 /** Creates the accessible object of a data table cell.
682 @param nRow The row index of the cell.
683 @param nColumnId The column pos of the cell.
684 @return The XAccessible interface of the specified cell. */
685 virtual css::uno::Reference
<
686 css::accessibility::XAccessible
>
687 CreateAccessibleCell( sal_Int32 nRow
, sal_uInt16 nColumnPos
);
689 /** Creates the accessible object of a row header.
690 @param nRow The row index of the header.
691 @return The XAccessible interface of the specified row header. */
692 virtual css::uno::Reference
<
693 css::accessibility::XAccessible
>
694 CreateAccessibleRowHeader( sal_Int32 nRow
);
696 /** Creates the accessible object of a column header.
697 @param nColumnId The column ID of the header.
698 @return The XAccessible interface of the specified column header. */
699 virtual css::uno::Reference
<
700 css::accessibility::XAccessible
>
701 CreateAccessibleColumnHeader( sal_uInt16 nColumnPos
);
703 /** @return The count of additional controls of the control area. */
704 virtual sal_Int32
GetAccessibleControlCount() const;
706 /** Creates the accessible object of an additional control.
707 @param nIndex The 0-based index of the control.
708 @return The XAccessible interface of the specified control. */
709 virtual css::uno::Reference
<
710 css::accessibility::XAccessible
>
711 CreateAccessibleControl( sal_Int32 nIndex
);
713 // Conversions ------------------------------------------------------------
715 /** Converts a point relative to the data window origin to a cell address.
716 @param rnRow Out-parameter that takes the row index.
717 @param rnColumnId Out-parameter that takes the column ID.
718 @param rPoint The position in pixels relative to the data window.
719 @return <TRUE/>, if the point could be converted to a valid address. */
720 virtual sal_Bool
ConvertPointToCellAddress(
721 sal_Int32
& rnRow
, sal_uInt16
& rnColumnId
, const Point
& rPoint
);
723 /** Converts a point relative to the row header bar origin to a row header
725 @param rnRow Out-parameter that takes the row index.
726 @param rPoint The position in pixels relative to the header bar.
727 @return <TRUE/>, if the point could be converted to a valid index. */
728 virtual sal_Bool
ConvertPointToRowHeader( sal_Int32
& rnRow
, const Point
& rPoint
);
730 /** Converts a point relative to the column header bar origin to a column
732 @param rnColumnId Out-parameter that takes the column ID.
733 @param rPoint The position in pixels relative to the header bar.
734 @return <TRUE/>, if the point could be converted to a valid index. */
735 virtual sal_Bool
ConvertPointToColumnHeader( sal_uInt16
& rnColumnPos
, const Point
& rPoint
);
737 /** Converts a point relative to the BrowseBox origin to the index of an
739 @param rnRow Out-parameter that takes the 0-based control index.
740 @param rPoint The position in pixels relative to the BrowseBox.
741 @return <TRUE/>, if the point could be converted to a valid index. */
742 virtual sal_Bool
ConvertPointToControlIndex( sal_Int32
& rnIndex
, const Point
& rPoint
);
744 // Object data and state --------------------------------------------------
746 /** return the name of the specified object.
750 The position of a tablecell (index position), header bar colum/row cell
752 The name of the specified object.
754 virtual OUString
GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType
,sal_Int32 _nPosition
= -1) const;
756 /** return the description of the specified object.
760 The position of a tablecell (index position), header bar colum/row cell
762 The description of the specified object.
764 virtual OUString
GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType
,sal_Int32 _nPosition
= -1) const;
766 /** @return The header text of the specified row. */
767 virtual OUString
GetRowDescription( sal_Int32 nRow
) const;
769 /** @return The header text of the specified column. */
770 virtual OUString
GetColumnDescription( sal_uInt16 _nColumn
) const;
772 /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
773 the accessible object), depending on the specified object type. */
774 virtual void FillAccessibleStateSet(
775 ::utl::AccessibleStateSetHelper
& rStateSet
,
776 ::svt::AccessibleBrowseBoxObjType eObjType
) const;
778 /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
779 the accessible object). */
780 virtual void FillAccessibleStateSetForCell(
781 ::utl::AccessibleStateSetHelper
& _rStateSet
,
782 sal_Int32 _nRow
, sal_uInt16 _nColumn
) const;
784 /** Sets focus to current cell of the data table. */
785 virtual void GrabTableFocus();
787 // IAccessibleTableProvider
788 virtual sal_Int32
GetCurrRow() const;
789 virtual sal_uInt16
GetCurrColumn() const;
790 virtual sal_Bool
HasRowHeader() const;
791 virtual sal_Bool
IsCellFocusable() const;
792 virtual sal_Bool
GoToCell( sal_Int32 _nRow
, sal_uInt16 _nColumn
);
793 virtual void SelectColumn( sal_uInt16 _nColumn
, sal_Bool _bSelect
= sal_True
);
794 virtual sal_Bool
IsColumnSelected( long _nColumn
) const;
795 virtual sal_Int32
GetSelectedRowCount() const;
796 virtual sal_Int32
GetSelectedColumnCount() const;
797 virtual void GetAllSelectedRows( css::uno::Sequence
< sal_Int32
>& _rRows
) const;
798 virtual void GetAllSelectedColumns( css::uno::Sequence
< sal_Int32
>& _rColumns
) const;
799 virtual sal_Bool
IsCellVisible( sal_Int32 _nRow
, sal_uInt16 _nColumn
) const;
800 virtual OUString
GetAccessibleCellText(long _nRow
, sal_uInt16 _nColPos
) const;
801 virtual sal_Bool
GetGlyphBoundRects( const Point
& rOrigin
, const OUString
& rStr
, int nIndex
, int nLen
, int nBase
, MetricVector
& rVector
);
802 virtual Rectangle
GetWindowExtentsRelative( Window
*pRelativeWindow
) const;
803 virtual void GrabFocus();
804 virtual css::uno::Reference
< css::accessibility::XAccessible
> GetAccessible( sal_Bool bCreate
= sal_True
);
805 virtual Window
* GetAccessibleParentWindow() const;
806 virtual Window
* GetWindowInstance();
809 // the following declares some Window/OutputDevice methods private. This happened in the course
810 // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
811 // upper module, you should investigate whether you really wanted to call base class methods,
812 // or the versions at this class. In the latter case, use the renamed versions above.
814 // Set/GetLineColor - superseded by Set/GetGridLineColor
815 using OutputDevice::SetLineColor
;
816 using OutputDevice::GetLineColor
;
818 // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
819 // and not doing as intended
823 //-------------------------------------------------------------------
824 inline const DataFlavorExVector
& BrowseBox::GetDataFlavors() const
826 return *reinterpret_cast<DataFlavorExVector
*>(implGetDataFlavors());
831 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */