LibreOffice Module svtools (master) 1
brwbox.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <svtools/svtdllapi.h>
22#include <vcl/ctrl.hxx>
23#include <vcl/vclptr.hxx>
24#include <tools/multisel.hxx>
25#include <vcl/event.hxx>
26#include <vcl/headbar.hxx>
27#include <vcl/transfer.hxx>
28#include <vcl/timer.hxx>
31#include <vector>
32#include <stack>
33
34#include <limits.h>
35#include <memory>
37
38class BrowserColumn;
39class BrowserHeader;
40class ScrollAdaptor;
42
43namespace svt {
44 class BrowseBoxImpl;
45}
46
47namespace vcl {
48 class IAccessibleFactory;
49}
50
51namespace weld {
52 class Scrollbar;
53}
54
55#define BROWSER_INVALIDID SAL_MAX_UINT16
57
58enum class BrowserMode
59{
60 NONE = 0x000000,
61 COLUMNSELECTION = 0x000001,
62 MULTISELECTION = 0x000002,
63 KEEPHIGHLIGHT = 0x000008,
64 HLINES = 0x000010,
65 VLINES = 0x000020,
66
67 HIDESELECT = 0x000100,
68 HIDECURSOR = 0x000200,
69
70 NO_HSCROLL = 0x000400,
71
72 AUTO_VSCROLL = 0x001000,
73 AUTO_HSCROLL = 0x002000,
74
75 TRACKING_TIPS = 0x004000,
76
77 NO_VSCROLL = 0x008000,
78
79 HEADERBAR_NEW = 0x040000,
80 AUTOSIZE_LASTCOL = 0x080000,
81
82 CURSOR_WO_FOCUS = 0x200000,
83 // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
84 // situations which require to temporarily hide the cursor (such as scrolling).
85
86};
87namespace o3tl
88{
89 template<> struct typed_flags<BrowserMode> : is_typed_flags<BrowserMode, 0x2cf73b> {};
90}
91
92#define BROWSER_NONE 0
93#define BROWSER_SELECT 720
94#define BROWSER_ENHANCESELECTION 722
95#define BROWSER_SELECTDOWN 724
96#define BROWSER_SELECTUP 725
97#define BROWSER_CURSORDOWN 731
98#define BROWSER_CURSORUP 732
99#define BROWSER_CURSORLEFT 733
100#define BROWSER_CURSORRIGHT 734
101#define BROWSER_CURSORPAGEDOWN 735
102#define BROWSER_CURSORPAGEUP 736
103#define BROWSER_CURSORENDOFFILE 741
104#define BROWSER_CURSORTOPOFFILE 742
105#define BROWSER_CURSORENDOFSCREEN 743
106#define BROWSER_CURSORTOPOFSCREEN 744
107#define BROWSER_CURSORHOME 745
108#define BROWSER_CURSOREND 746
109#define BROWSER_SCROLLDOWN 751
110#define BROWSER_SCROLLUP 752
111#define BROWSER_SELECTHOME 753
112#define BROWSER_SELECTEND 754
113#define BROWSER_SELECTCOLUMN 755
114#define BROWSER_MOVECOLUMNLEFT 756
115#define BROWSER_MOVECOLUMNRIGHT 757
116
117
119{
122 sal_Int32 nRow;
123 sal_uInt16 nCol;
124 sal_uInt16 nColId;
125
126public:
127 BrowseEvent( vcl::Window* pWindow,
128 sal_Int32 nAbsRow,
129 sal_uInt16 nColumn, sal_uInt16 nColumnId,
130 const tools::Rectangle& rRect );
131
132 vcl::Window* GetWindow() const { return pWin; }
133 sal_Int32 GetRow() const { return nRow; }
134 sal_uInt16 GetColumn() const { return nCol; }
135 sal_uInt16 GetColumnId() const { return nColId; }
136 const tools::Rectangle& GetRect() const { return aRect; }
137};
138
139class BrowseBox;
141
142class BrowserDataWin final
143 :public Control
144 ,public DragSourceHelper
145 ,public DropTargetHelper
146{
147public:
148 VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
150 AutoTimer aMouseTimer; // recalls MouseMove on dragging out
151 MouseEvent aRepeatEvt; // a MouseEvent to repeat
152 Point aLastMousePos; // prevents pseudo-MouseMoves
153
154 OUString aRealRowCount; // to show in VScrollBar
155
156 std::vector<tools::Rectangle> aInvalidRegion; // invalidated Rectangles during !UpdateMode
157 bool bInPaint; // TRUE while in Paint
158 bool bInCommand; // TRUE while in Command
159 bool bNoHScroll; // no horizontal scrollbar
160 bool bNoVScroll; // no vertical scrollbar
161 bool bAutoHScroll; // autohide horizontaler Scrollbar
162 bool bAutoVScroll; // autohide horizontaler Scrollbar
163 bool bUpdateMode; // not SV-UpdateMode because of Invalidate()
164 bool bAutoSizeLastCol; // last column always fills up window
165 bool bResizeOnPaint; // outstanding resize-event
166 bool bUpdateOnUnlock; // Update() while locked
167 bool bInUpdateScrollbars; // prevents recursions
168 bool bHadRecursion; // a recursion occurred
169 bool bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop currently
170 sal_uInt16 nUpdateLock; // lock count, don't call Control::Update()!
171 short nCursorHidden; // new counter for DoHide/ShowCursor
172
175
176public:
177 explicit BrowserDataWin( BrowseBox* pParent );
178 virtual ~BrowserDataWin() override;
179 virtual void dispose() override;
180
181 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
182 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
183 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
184 virtual void Command( const CommandEvent& rEvt ) override;
185 virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
186 virtual void MouseMove( const MouseEvent& rEvt ) override;
187 DECL_LINK( RepeatedMouseMove, Timer *, void );
188
189 virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
190 virtual void KeyInput( const KeyEvent& rEvt ) override;
191 virtual void Tracking( const TrackingEvent& rTEvt ) override;
192
193 // DropTargetHelper overridables
194 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
195 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
196
197 // DragSourceHelper overridables
198 virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
199
200
201 BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
202 BrowseBox* GetParent() const;
203 const OUString& GetRealRowCount() const { return aRealRowCount; }
204
205 void SetUpdateMode( bool bMode );
206 bool GetUpdateMode() const { return bUpdateMode; }
208 void LeaveUpdateLock();
209 void Update();
211
212private:
213 virtual void ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags ) override;
214 void StartRowDividerDrag( const Point& _rStartPos );
215 bool ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent ) const;
216};
217
219{
220public:
223 sal_Int32 nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId,
224 const tools::Rectangle& rRect );
225};
226
227
229{
230public:
232};
233
234
236{
237public:
239};
240
241// TODO
242// The whole selection thingie in this class is somewhat... suspicious to me.
243// some oddities:
244// * method parameters named like members (and used in both semantics within the method!)
245// * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
246// it's for column selection, too (and sometimes in an even stranger way :)
247// * it is not really defined like all these hundreds selection related flags/methods work together
248// and influence each other. I do not understand it very well, but this may be my fault :)
249// * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
250// not without a const_cast)
251//
252// We should clearly define this somewhere in the future. Or, even better, we should re-implement this
253// whole class, which is planned for a long time :)
254//
255// sorry for the ranting. could not resist
256
258 :public Control
259 ,public DragSourceHelper
260 ,public DropTargetHelper
262{
263 friend class BrowserDataWin;
264 friend class ::svt::BrowseBoxImpl;
265
266public:
267 static const sal_uInt16 HandleColumnId = 0;
268
269private:
270 VclPtr<BrowserDataWin> pDataWin; // window to display data rows
271 VclPtr<ScrollAdaptor> pVScroll; // vertical scrollbar
272 VclPtr<ScrollAdaptor> aHScroll; // horizontal scrollbar
273 VclPtr<MeasureStatusBar> aStatusBarHeight; // statusbar, just to measure its height
274
275 tools::Long m_nDataRowHeight; // height of a single data-row
276 tools::Long m_nCornerHeight; // height of scrollbox corner
277 tools::Long m_nCornerWidth; // width of scrollbox corner
278 tools::Long m_nActualCornerWidth; // size of scrollbox corner
279 sal_uInt16 nTitleLines; // number of lines in title row
280 sal_uLong nControlAreaWidth; // width of fixed area beneath hscroll
281 bool bColumnCursor; // single columns and fields selectable
282 bool bMultiSelection;// allow multiple selected rows
283 bool bKeepHighlight; // don't hide selection on LoseFocus
284
285 bool bHLines; // draw lines between rows
286 bool bVLines; // draw lines between columns
287 bool bBootstrapped; // child windows resized etc.
288 sal_Int32 nTopRow; // no. of first visible row (0...)
289 sal_Int32 nCurRow; // no. of row with cursor
290 sal_Int32 nRowCount; // total number of rows in model
291 sal_uInt16 nFirstCol; // no. of first visible scrollable column
292 sal_uInt16 nCurColId; // column id of cursor
293
296 bool bHit;
298
299 tools::Long nResizeX; // mouse position at start of resizing
300 tools::Long nMinResizeX; // never drag more left
301 tools::Long nDragX; // last dragged column (MouseMove)
302 sal_uInt16 nResizeCol; // resize this column in MouseMove
303 bool bResizing; // mouse captured for column resizing
304
305 bool bSelect;
306 bool bSelectionIsVisible; // depending on focus
307 bool bScrolling; // hidden cursor while scrolling
308 bool bNotToggleSel; // set while in ToggleSelection() etc.
309 bool bHasFocus; // set/unset in Get/LoseFocus
310 bool bHideSelect; // hide selection (highlight)
311 TriState bHideCursor; // hide cursor (frame)
312 Range aSelRange; // for selection expansion
313
314 ::std::vector< std::unique_ptr<BrowserColumn> > mvCols; // array of column-descriptions
315 union
316 {
317 MultiSelection* pSel; // selected rows for multi-selection
318 sal_Int32 nSel; // selected row for single-selection
319 } uRow;
320 std::unique_ptr<MultiSelection> pColSel; // selected column-ids
321
322 // fdo#83943, detect if making the cursor position visible is impossible to achieve
324 {
325 sal_Int32 m_nCol;
326 sal_Int32 m_nRow;
328 CursorMoveAttempt(sal_Int32 nCol, sal_Int32 nRow, bool bScrolledToReachCell)
329 : m_nCol(nCol)
330 , m_nRow(nRow)
331 , m_bScrolledToReachCell(bScrolledToReachCell)
332 {
333 }
334 bool operator==(const CursorMoveAttempt& r) const
335 {
336 return m_nCol == r.m_nCol &&
337 m_nRow == r.m_nRow &&
338 m_bScrolledToReachCell == r.m_bScrolledToReachCell;
339 }
340 bool operator!=(const CursorMoveAttempt& r) const { return !(*this == r); }
341 };
342 std::stack<CursorMoveAttempt>
344
345 ::std::unique_ptr< ::svt::BrowseBoxImpl > m_pImpl; // impl structure of the BrowseBox object
346
347 bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus
348 Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
349 BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too)
350
351private:
352 SVT_DLLPRIVATE void ConstructImpl(BrowserMode nMode);
353 SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt );
354 SVT_DLLPRIVATE void ToggleSelection();
355
356 SVT_DLLPRIVATE void UpdateScrollbars();
357 SVT_DLLPRIVATE void AutoSizeLastColumn();
358
359 SVT_DLLPRIVATE tools::Long ImpGetDataRowHeight() const;
360 SVT_DLLPRIVATE tools::Rectangle ImplFieldRectPixel( sal_Int32 nRow, sal_uInt16 nColId ) const;
361 SVT_DLLPRIVATE sal_uInt16 FrozenColCount() const;
362
363 SVT_DLLPRIVATE void ColumnInserted( sal_uInt16 nPos );
364
365 DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar&, void);
366 DECL_DLLPRIVATE_LINK(HorzScrollHdl, weld::Scrollbar&, void);
367 DECL_DLLPRIVATE_LINK( StartDragHdl, HeaderBar*, void );
368
369 SVT_DLLPRIVATE tools::Long GetFrozenWidth() const;
370
371 SVT_DLLPRIVATE tools::Long GetBarHeight() const;
372
373 bool GoToRow(sal_Int32 nRow, bool bRowColMove, bool bDoNotModifySelection = false );
374
375 bool GoToColumnId( sal_uInt16 nColId, bool bMakeVisible, bool bRowColMove = false);
376 void SelectColumnPos( sal_uInt16 nCol, bool _bSelect, bool bMakeVisible);
377
378 void ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRect, bool _bForeignDevice);
379
380 bool PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor && !HasFocus(); }
381
382 sal_uInt16 ToggleSelectedColumn();
383 void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId);
384
385protected:
387 ::vcl::IAccessibleFactory& getAccessibleFactory();
388
389protected:
391
392 sal_uInt16 ColCount() const;
393
394 // software plug for database access
395 // RowCount is counted automatically
396 // (with the help of RowInserted and RowRemoved), so overriding of
397 // the method is needless
398public:
399 virtual sal_Int32 GetRowCount() const override;
400
401protected:
402 // for display in VScrollBar set it e.g. on "?"
403 void SetRealRowCount( const OUString &rRealRowCount );
404
405 // Return Value has to be sal_True always - SeekRow *has* to work!
406 // (else ASSERT) MI: who integrated that? It must not be like that!
407
412 virtual bool SeekRow( sal_Int32 nRow ) = 0;
413 void DrawCursor();
414 void PaintData(vcl::Window const & rWin, vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
415 virtual void PaintField(vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId) const = 0;
416 // Advice for the subclass: the visible scope of rows has changed.
417 // The subclass is able to announce changes of the model with the
418 // help of the methods RowInserted and RowRemoved. Because of the
419 // new status a paint is induced (SeekRow is called etc).
420 //
421 // parameters: nNewTopRow: number of the new TopRow (can get changed from
422 // VisibleRowsChanged by request of RowInserted and RowDeleted).
423 // nNumRows: number of visible rows (a partial visible row is counted too)
424 //
425 // Possible reason for changing the visible scope:
426 // - in front of the visible scope rows were inserted or removed, so the
427 // numbering of the visible scope has changed
428 // - Scrolling (and thereof resulting in another first visible row)
429 // - Resize the window
430 virtual void VisibleRowsChanged( sal_Int32 nNewTopRow, sal_uInt16 nNumRows);
431
432 // number of visible rows in the window (incl. "truncated" rows)
433 sal_uInt16 GetVisibleRows() const;
434 sal_Int32 GetTopRow() const { return nTopRow; }
435 sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; }
436
437 // Focus-Rect enable / disable
438 void DoShowCursor();
439 void DoHideCursor();
440 short GetCursorHideCount() const;
441
442 virtual VclPtr<BrowserHeader> CreateHeaderBar( BrowseBox* pParent );
443
444 // HACK(virtual create is not called in Ctor)
445 void SetHeaderBar( BrowserHeader* );
446
447 tools::Long CalcReverseZoom(tools::Long nVal) const;
448
449 const DataFlavorExVector&
450 GetDataFlavors() const;
451
452 bool IsDropFormatSupported( SotClipboardFormatId nFormat ) const; // need this because the base class' IsDropFormatSupported is not const ...
453
454 void DisposeAccessible();
455
456protected:
457 // callbacks for the data window
458 virtual void ImplStartTracking();
459 virtual void ImplEndTracking();
460
461public:
462 BrowseBox( vcl::Window* pParent, WinBits nBits,
464 virtual ~BrowseBox() override;
465 virtual void dispose() override;
466
467 // override inherited handler
468 virtual void StateChanged( StateChangedType nStateChange ) override;
469 virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
470 virtual void MouseMove( const MouseEvent& rEvt ) override;
471 virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
472 virtual void KeyInput( const KeyEvent& rEvt ) override;
473 virtual void LoseFocus() override;
474 virtual void GetFocus() override;
475 virtual void Resize() override;
476 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
477 virtual void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override;
478 virtual void Command( const CommandEvent& rEvt ) override;
479 virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
480
481 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; // will forward everything got to the second AcceptDrop method
482 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; // will forward everything got to the second ExecuteDrop method
483
484 virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
485 virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
486
487 // new handlers
488 virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
489 virtual void MouseButtonUp( const BrowserMouseEvent& rEvt );
490 void StartScroll();
491 virtual void EndScroll();
492 virtual void Select();
493 virtual void DoubleClick( const BrowserMouseEvent& rEvt );
494 virtual bool IsCursorMoveAllowed( sal_Int32 nNewRow, sal_uInt16 nNewColId ) const;
495 virtual void CursorMoved();
496 virtual void ColumnMoved( sal_uInt16 nColId );
497 virtual void ColumnResized( sal_uInt16 nColId );
499 virtual void RowHeightChanged();
500 virtual tools::Long QueryMinimumRowHeight();
501
502 // Window-Control (pass to DataWindow)
503 void SetUpdateMode( bool bUpdate );
504 bool GetUpdateMode() const;
505
506 // map-mode and font control
507 void SetFont( const vcl::Font& rNewFont );
508 const vcl::Font& GetFont() const;
509 void SetTitleFont( const vcl::Font& rNewFont )
510 { Control::SetFont( rNewFont ); }
511
512 // inserting, changing, removing and freezing of columns
513 void InsertHandleColumn( sal_uLong nWidth );
514 void InsertDataColumn( sal_uInt16 nItemId, const OUString& rText,
515 tools::Long nSize, HeaderBarItemBits nBits = HeaderBarItemBits::STDSTYLE,
516 sal_uInt16 nPos = HEADERBAR_APPEND );
517 void SetColumnTitle( sal_uInt16 nColumnId, const OUString &rTitle );
518 void SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
519 void SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
520 void FreezeColumn( sal_uInt16 nColumnId );
521 void RemoveColumn( sal_uInt16 nColumnId );
522 void RemoveColumns();
523
524 // control of title and data row height
525 void SetDataRowHeight( tools::Long nPixel );
526 tools::Long GetDataRowHeight() const;
527 void SetTitleLines( sal_uInt16 nLines );
528 tools::Long GetTitleHeight() const;
529
530 // access to dynamic values of cursor row
531 OUString GetColumnTitle( sal_uInt16 nColumnId ) const;
532 tools::Rectangle GetFieldRect( sal_uInt16 nColumnId ) const;
533 sal_uLong GetColumnWidth( sal_uInt16 nColumnId ) const;
534 sal_uInt16 GetColumnId( sal_uInt16 nPos ) const;
535 sal_uInt16 GetColumnPos( sal_uInt16 nColumnId ) const;
536 bool IsFrozen( sal_uInt16 nColumnId ) const;
537
538 // movement of visible area
539 sal_Int32 ScrollColumns( sal_Int32 nColumns );
540 sal_Int32 ScrollRows( sal_Int32 nRows );
541 void MakeFieldVisible( sal_Int32 nRow, sal_uInt16 nColId );
542
543 // access and movement of cursor
544 sal_Int32 GetCurRow() const { return nCurRow; }
545 sal_uInt16 GetCurColumnId() const { return nCurColId; }
546 bool GoToRow( sal_Int32 nRow );
547 bool GoToColumnId( sal_uInt16 nColId );
548 bool GoToRowColumnId( sal_Int32 nRow, sal_uInt16 nColId );
549
550 // selections
551 virtual void SetNoSelection() override;
552 virtual void SelectAll() override;
553 virtual void SelectRow( sal_Int32 nRow, bool _bSelect = true, bool bExpand = true ) override;
554 void SelectColumnPos( sal_uInt16 nCol, bool _bSelect = true )
555 { SelectColumnPos( nCol, _bSelect, true); }
556 void SelectColumnId( sal_uInt16 nColId )
557 { SelectColumnPos( GetColumnPos(nColId), true, true); }
558 sal_Int32 GetSelectRowCount() const;
559 sal_uInt16 GetSelectColumnCount() const;
560 virtual bool IsRowSelected( sal_Int32 nRow ) const override;
561 bool IsColumnSelected( sal_uInt16 nColumnId ) const;
562 sal_Int32 FirstSelectedRow();
563 sal_Int32 LastSelectedRow();
564 sal_Int32 NextSelectedRow();
565 const MultiSelection* GetColumnSelection() const { return pColSel.get(); }
567 { return bMultiSelection ? uRow.pSel : nullptr; }
568
569 sal_Int32 FirstSelectedColumn( ) const;
570
571 bool IsResizing() const { return bResizing; }
572
573 // access to positions of fields, column and rows
574 BrowserDataWin& GetDataWindow() const;
575 tools::Rectangle GetRowRectPixel( sal_Int32 nRow ) const;
576 tools::Rectangle GetFieldRectPixel( sal_Int32 nRow, sal_uInt16 nColId,
577 bool bRelToBrowser = true) const;
578 bool IsFieldVisible( sal_Int32 nRow, sal_uInt16 nColId,
579 bool bComplete = false ) const;
580 sal_Int32 GetRowAtYPosPixel( tools::Long nY,
581 bool bRelToBrowser = true ) const;
582 sal_uInt16 GetColumnAtXPosPixel( tools::Long nX ) const;
583
584 // invalidations
585 void Clear();
586 void RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true );
587 void RowModified( sal_Int32 nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
588 void RowInserted( sal_Int32 nRow, sal_Int32 nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
589
590 // miscellaneous
591 bool ReserveControlArea(sal_uInt16 nWidth = USHRT_MAX);
592 tools::Rectangle GetControlArea() const;
593 virtual bool ProcessKey(const KeyEvent& rEvt);
594 virtual void ChildFocusIn();
595 virtual void ChildFocusOut();
596 void Dispatch( sal_uInt16 nId );
597 void SetMode( BrowserMode nMode );
598 BrowserMode GetMode( ) const { return m_nCurrentMode; }
599
600 void SetCursorColor(const Color& _rCol);
601
608 void EnableInteractiveRowHeight() { mbInteractiveRowHeight = true; }
609 bool IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
610
612 struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
615 void DoPaintField( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
616 { PaintField( rDev, rRect, nColumnId ); }
617
622 sal_uLong GetDefaultColumnWidth( const OUString& _rText ) const;
623
632 virtual OUString GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const;
633
637 sal_uInt16 GetColumnCount() const override { return ColCount(); }
638
647 void commitBrowseBoxEvent(sal_Int16 nEventId,
648 const css::uno::Any& rNewValue,
649 const css::uno::Any& rOldValue);
650
659 void commitTableEvent(sal_Int16 nEventId,
660 const css::uno::Any& rNewValue,
661 const css::uno::Any& rOldValue);
662
672 void commitHeaderBarEvent(sal_Int16 nEventId,
673 const css::uno::Any& rNewValue,
674 const css::uno::Any& rOldValue,
675 bool _bColumnHeaderBar
676 );
677
686 virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen = true) override;
687
694 virtual tools::Rectangle calcTableRect(bool _bOnScreen = true) override;
695
706 virtual tools::Rectangle GetFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen) override;
707
709 bool isAccessibleAlive( ) const;
710
711public:
713 virtual css::uno::Reference<
714 css::accessibility::XAccessible > CreateAccessible() override;
715
716 // Children ---------------------------------------------------------------
717
722 virtual css::uno::Reference<
723 css::accessibility::XAccessible >
724 CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) override;
725
729 virtual css::uno::Reference<
730 css::accessibility::XAccessible >
731 CreateAccessibleRowHeader( sal_Int32 nRow ) override;
732
736 virtual css::uno::Reference<
737 css::accessibility::XAccessible >
738 CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) override;
739
741 virtual sal_Int32 GetAccessibleControlCount() const override;
742
746 virtual css::uno::Reference<
747 css::accessibility::XAccessible >
748 CreateAccessibleControl( sal_Int32 nIndex ) override;
749
755 virtual bool ConvertPointToCellAddress(
756 sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint ) override;
757
763 virtual bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint ) override;
764
770 virtual bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint ) override;
771
777 virtual bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint ) override;
778
787 virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
788
797 virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
798
800 virtual OUString GetRowDescription( sal_Int32 nRow ) const override;
801
803 virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
804
807 virtual void FillAccessibleStateSet(
808 sal_Int64& rStateSet,
809 AccessibleBrowseBoxObjType eObjType ) const override;
810
814 sal_Int64& _rStateSet,
815 sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
816
818 virtual void GrabTableFocus() override;
819
820 // IAccessibleTableProvider
821 virtual sal_Int32 GetCurrRow() const override;
822 virtual sal_uInt16 GetCurrColumn() const override;
823 virtual bool HasRowHeader() const override;
824 virtual bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
825 virtual void SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) override;
826 virtual bool IsColumnSelected( sal_Int32 _nColumn ) const override;
827 virtual sal_Int32 GetSelectedRowCount() const override;
828 virtual sal_Int32 GetSelectedColumnCount() const override;
829 virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const override;
830 virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const override;
831 virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
832 virtual OUString GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos) const override;
833 virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override;
834 virtual tools::Rectangle GetWindowExtentsAbsolute() const override;
835 virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override;
836 virtual void GrabFocus() override;
837 virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
838 virtual vcl::Window* GetAccessibleParentWindow() const override;
839 virtual vcl::Window* GetWindowInstance() override;
840
841private:
842 // the following declares some Window/OutputDevice methods private. This happened in the course
843 // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
844 // upper module, you should investigate whether you really wanted to call base class methods,
845 // or the versions at this class. In the latter case, use the renamed versions above.
846
847 // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
848 // and not doing as intended
849 using Window::ToTop;
850};
851
852/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AccessibleBrowseBoxObjType
SystemTextColorFlags
constexpr sal_Int32 BROWSER_ENDOFSELECTION
Definition: brwbox.hxx:56
#define BROWSER_INVALIDID
Definition: brwbox.hxx:55
BrowserMode
Definition: brwbox.hxx:59
bool bHLines
Definition: brwbox.hxx:285
MultiSelection * pSel
Definition: brwbox.hxx:317
const MultiSelection * GetColumnSelection() const
Definition: brwbox.hxx:565
tools::Long m_nCornerHeight
Definition: brwbox.hxx:276
virtual void PaintField(vcl::RenderContext &rDev, const tools::Rectangle &rRect, sal_uInt16 nColumnId) const =0
bool IsResizing() const
Definition: brwbox.hxx:571
VclPtr< BrowserDataWin > pDataWin
Definition: brwbox.hxx:270
bool bSelectionIsVisible
select or deselect
Definition: brwbox.hxx:306
tools::Long nResizeX
Definition: brwbox.hxx:299
bool bMultiSelection
Definition: brwbox.hxx:282
VclPtr< ScrollAdaptor > pVScroll
Definition: brwbox.hxx:271
void SetTitleFont(const vcl::Font &rNewFont)
Definition: brwbox.hxx:509
bool bHideSelect
Definition: brwbox.hxx:310
tools::Long nMinResizeX
Definition: brwbox.hxx:300
sal_Int32 GetCurRow() const
Definition: brwbox.hxx:544
sal_uInt16 nResizeCol
Definition: brwbox.hxx:302
tools::Long m_nDataRowHeight
Definition: brwbox.hxx:275
sal_uLong nControlAreaWidth
Definition: brwbox.hxx:280
const MultiSelection * GetSelection() const
Definition: brwbox.hxx:566
bool bHit
Definition: brwbox.hxx:296
bool mbInteractiveRowHeight
Definition: brwbox.hxx:297
BrowserMode m_nCurrentMode
Definition: brwbox.hxx:349
bool bNotToggleSel
Definition: brwbox.hxx:308
std::stack< CursorMoveAttempt > m_aGotoStack
Definition: brwbox.hxx:343
sal_Int32 GetTopRow() const
Definition: brwbox.hxx:434
bool IsInteractiveRowHeightEnabled() const
Definition: brwbox.hxx:609
DECL_DLLPRIVATE_LINK(StartDragHdl, HeaderBar *, void)
bool bSelect
Definition: brwbox.hxx:305
VclPtr< MeasureStatusBar > aStatusBarHeight
Definition: brwbox.hxx:273
bool m_bFocusOnlyCursor
Definition: brwbox.hxx:347
bool PaintCursorIfHiddenOnce() const
Definition: brwbox.hxx:380
bool bBootstrapped
Definition: brwbox.hxx:287
TriState bHideCursor
Definition: brwbox.hxx:311
void DoPaintField(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColumnId, BrowserColumnAccess) const
public version of PaintField, with selected access rights for the BrowserColumn
Definition: brwbox.hxx:615
void SelectColumnId(sal_uInt16 nColId)
Definition: brwbox.hxx:556
bool bColumnCursor
Definition: brwbox.hxx:281
sal_Int32 nSel
Definition: brwbox.hxx:318
sal_uInt16 GetCurColumnId() const
Definition: brwbox.hxx:545
sal_Int32 nTopRow
Definition: brwbox.hxx:288
bool bKeepHighlight
Definition: brwbox.hxx:283
bool bSelecting
Definition: brwbox.hxx:294
DECL_DLLPRIVATE_LINK(HorzScrollHdl, weld::Scrollbar &, void)
bool bHasFocus
Definition: brwbox.hxx:309
virtual bool SeekRow(sal_Int32 nRow)=0
seeks for the given row position
sal_Int32 nRowCount
Definition: brwbox.hxx:290
Range aSelRange
Definition: brwbox.hxx:312
sal_uInt16 GetFirstVisibleColNumber() const
Definition: brwbox.hxx:435
bool m_bNavigationBar
Definition: brwbox.hxx:390
tools::Long nDragX
Definition: brwbox.hxx:301
void SelectColumnPos(sal_uInt16 nCol, bool _bSelect=true)
Definition: brwbox.hxx:554
bool bRowDividerDrag
Definition: brwbox.hxx:295
tools::Long m_nActualCornerWidth
Definition: brwbox.hxx:278
sal_Int32 nCurRow
Definition: brwbox.hxx:289
bool bScrolling
Definition: brwbox.hxx:307
void EnableInteractiveRowHeight()
specifies that the user is allowed to interactively change the height of a row, by simply dragging an...
Definition: brwbox.hxx:608
bool bResizing
Definition: brwbox.hxx:303
BrowserMode GetMode() const
Definition: brwbox.hxx:598
tools::Long m_nCornerWidth
Definition: brwbox.hxx:277
sal_uInt16 nFirstCol
Definition: brwbox.hxx:291
DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar &, void)
::std::vector< std::unique_ptr< BrowserColumn > > mvCols
Definition: brwbox.hxx:314
bool bVLines
Definition: brwbox.hxx:286
sal_uInt16 nCurColId
Definition: brwbox.hxx:292
::std::unique_ptr< ::svt::BrowseBoxImpl > m_pImpl
Definition: brwbox.hxx:345
sal_uInt16 nTitleLines
Definition: brwbox.hxx:279
VclPtr< ScrollAdaptor > aHScroll
Definition: brwbox.hxx:272
std::unique_ptr< MultiSelection > pColSel
Definition: brwbox.hxx:320
Color m_aCursorColor
Definition: brwbox.hxx:348
sal_uInt16 GetColumnCount() const override
Definition: brwbox.hxx:637
sal_Int32 GetRow() const
Definition: brwbox.hxx:133
VclPtr< vcl::Window > pWin
Definition: brwbox.hxx:120
BrowseEvent(vcl::Window *pWindow, sal_Int32 nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, const tools::Rectangle &rRect)
Definition: datwin.cxx:573
vcl::Window * GetWindow() const
Definition: brwbox.hxx:132
const tools::Rectangle & GetRect() const
Definition: brwbox.hxx:136
sal_Int32 nRow
Definition: brwbox.hxx:122
sal_uInt16 GetColumn() const
Definition: brwbox.hxx:134
sal_uInt16 nColId
Definition: brwbox.hxx:124
tools::Rectangle aRect
Definition: brwbox.hxx:121
sal_uInt16 nCol
Definition: brwbox.hxx:123
sal_uInt16 GetColumnId() const
Definition: brwbox.hxx:135
BrowserAcceptDropEvent(BrowserDataWin *pWin, const AcceptDropEvent &rEvt)
Definition: datwin.cxx:602
virtual void KeyInput(const KeyEvent &rEvt) override
Definition: datwin.cxx:559
void DoOutstandingInvalidations()
Definition: datwin.cxx:628
bool bAutoHScroll
Definition: brwbox.hxx:161
virtual ~BrowserDataWin() override
Definition: datwin.cxx:204
bool bCallingDropCallback
Definition: brwbox.hxx:169
bool bUpdateMode
Definition: brwbox.hxx:163
short nCursorHidden
Definition: brwbox.hxx:171
tools::Long m_nDragRowDividerLimit
Definition: brwbox.hxx:173
bool bAutoSizeLastCol
Definition: brwbox.hxx:164
bool bInUpdateScrollbars
Definition: brwbox.hxx:167
bool bUpdateOnUnlock
Definition: brwbox.hxx:166
BrowserDataWin(BrowseBox *pParent)
Definition: datwin.cxx:175
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: datwin.cxx:336
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: datwin.cxx:517
BrowseBox * GetParent() const
Definition: datwin.cxx:288
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: datwin.cxx:268
bool bResizeOnPaint
Definition: brwbox.hxx:165
MouseEvent aRepeatEvt
Definition: brwbox.hxx:151
DECL_LINK(RepeatedMouseMove, Timer *, void)
AutoTimer aMouseTimer
Definition: brwbox.hxx:150
const OUString & GetRealRowCount() const
Definition: brwbox.hxx:203
bool GetUpdateMode() const
Definition: brwbox.hxx:206
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: datwin.cxx:567
virtual void dispose() override
Definition: datwin.cxx:209
void Update()
Definition: datwin.cxx:243
std::vector< tools::Rectangle > aInvalidRegion
Definition: brwbox.hxx:156
virtual void MouseMove(const MouseEvent &rEvt) override
Definition: datwin.cxx:437
virtual void Command(const CommandEvent &rEvt) override
Definition: datwin.cxx:365
VclPtr< BrowserHeader > pHeaderBar
Definition: brwbox.hxx:148
bool ImplRowDividerHitTest(const BrowserMouseEvent &_rEvent) const
Definition: datwin.cxx:407
void EnterUpdateLock()
Definition: brwbox.hxx:207
virtual void StartDrag(sal_Int8 _nAction, const Point &_rPosPixel) override
Definition: datwin.cxx:354
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: datwin.cxx:345
virtual void MouseButtonDown(const MouseEvent &rEvt) override
Definition: datwin.cxx:422
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: datwin.cxx:252
bool bNoVScroll
Definition: brwbox.hxx:160
void StartRowDividerDrag(const Point &_rStartPos)
Definition: datwin.cxx:493
BrowseEvent CreateBrowseEvent(const Point &rPosPixel)
Definition: datwin.cxx:293
Point aLastMousePos
Definition: brwbox.hxx:152
bool bInCommand
Definition: brwbox.hxx:158
virtual void MouseButtonUp(const MouseEvent &rEvt) override
Definition: datwin.cxx:476
void SetUpdateMode(bool bMode)
Definition: datwin.cxx:616
void LeaveUpdateLock()
Definition: datwin.cxx:220
sal_uInt16 nUpdateLock
Definition: brwbox.hxx:170
bool bAutoVScroll
Definition: brwbox.hxx:162
tools::Long m_nDragRowDividerOffset
Definition: brwbox.hxx:174
bool bHadRecursion
Definition: brwbox.hxx:168
bool bNoHScroll
Definition: brwbox.hxx:159
virtual void ImplInvalidate(const vcl::Region *pRegion, InvalidateFlags nFlags) override
Definition: datwin.cxx:638
OUString aRealRowCount
Definition: brwbox.hxx:154
BrowserExecuteDropEvent(BrowserDataWin *pWin, const ExecuteDropEvent &rEvt)
Definition: datwin.cxx:609
BrowserMouseEvent(BrowserDataWin *pWin, const MouseEvent &rEvt)
Definition: datwin.cxx:585
virtual void StateChanged(StateChangedType nStateChange) override
virtual void Resize() override
virtual void dispose() override
virtual sal_Int32 GetSelectedColumnCount() const=0
virtual void FillAccessibleStateSetForCell(sal_Int64 &_rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos) const=0
virtual OUString GetRowDescription(sal_Int32 _nRow) const=0
virtual void SelectRow(sal_Int32 _nRow, bool _bSelect=true, bool bExpand=true)=0
virtual bool ConvertPointToColumnHeader(sal_uInt16 &_rnColPos, const Point &_rPoint)=0
virtual sal_Int32 GetRowCount() const=0
virtual vcl::Window * GetWindowInstance()=0
virtual bool ConvertPointToRowHeader(sal_Int32 &_rnRow, const Point &_rPoint)=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos)=0
virtual sal_uInt16 GetCurrColumn() const=0
virtual void GrabTableFocus()=0
virtual void GetAllSelectedRows(css::uno::Sequence< sal_Int32 > &_rRows) const=0
virtual bool IsRowSelected(sal_Int32 _nRow) const=0
virtual void SelectColumn(sal_uInt16 _nColumnPos, bool _bSelect=true)=0
virtual sal_Int32 GetAccessibleControlCount() const=0
virtual bool ConvertPointToCellAddress(sal_Int32 &_rnRow, sal_uInt16 &_rnColPos, const Point &_rPoint)=0
virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen=true)=0
virtual bool HasRowHeader() const=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader(sal_Int32 _nRow)=0
virtual tools::Rectangle GetFieldRectPixel(sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen)=0
virtual bool IsCellVisible(sal_Int32 _nRow, sal_uInt16 _nColumnPos) const=0
virtual tools::Rectangle calcTableRect(bool _bOnScreen=true)=0
virtual bool GetGlyphBoundRects(const Point &rOrigin, const OUString &rStr, int nIndex, int nLen, std::vector< tools::Rectangle > &rVector)=0
virtual void GetAllSelectedColumns(css::uno::Sequence< sal_Int32 > &_rColumns) const=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl(sal_Int32 _nIndex)=0
virtual OUString GetColumnDescription(sal_uInt16 _nColumnPos) const=0
virtual OUString GetAccessibleObjectName(AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos=-1) const=0
virtual void SetNoSelection()=0
virtual bool ConvertPointToControlIndex(sal_Int32 &_rnIndex, const Point &_rPoint)=0
virtual sal_Int32 GetSelectedRowCount() const=0
virtual sal_Int32 GetCurrRow() const=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader(sal_uInt16 _nColumnPos)=0
virtual bool IsColumnSelected(sal_Int32 _nColumnPos) const=0
virtual OUString GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColumnPos) const=0
virtual void FillAccessibleStateSet(sal_Int64 &_rStateSet, AccessibleBrowseBoxObjType _eType) const=0
virtual OUString GetAccessibleObjectDescription(AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos=-1) const=0
virtual bool GoToCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos)=0
void SetFont(const vcl::Font &rNewFont)
void SetUpdateMode(bool bUpdate)
tools::Rectangle GetWindowExtentsAbsolute() const
virtual void GetFocus()
virtual void Command(const CommandEvent &rCEvt)
void GrabFocus()
bool HasFocus() const
virtual void MouseButtonDown(const MouseEvent &rMEvt)
vcl::Window * GetAccessibleParentWindow() const
virtual void MouseButtonUp(const MouseEvent &rMEvt)
virtual void KeyInput(const KeyEvent &rKEvt)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
void ToTop(ToTopFlags nFlags=ToTopFlags::NONE)
const vcl::Font & GetFont() const
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
virtual void MouseMove(const MouseEvent &rMEvt)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
virtual void Draw(::OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags)
virtual void LoseFocus()
tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const
::std::vector< DataFlavorEx > DataFlavorExVector
SotClipboardFormatId
TriState
HeaderBarItemBits
#define SFX_ENDOFSELECTION
void Clear(EHistoryType eHistory)
NONE
long Long
sal_uIntPtr sal_uLong
access to selected methods, to be granted to the BrowserColumn
Definition: brwbox.hxx:612
CursorMoveAttempt(sal_Int32 nCol, sal_Int32 nRow, bool bScrolledToReachCell)
Definition: brwbox.hxx:328
bool operator==(const CursorMoveAttempt &r) const
Definition: brwbox.hxx:334
bool operator!=(const CursorMoveAttempt &r) const
Definition: brwbox.hxx:340
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27
#define SVT_DLLPRIVATE
Definition: svtdllapi.h:29
signed char sal_Int8
StateChangedType
InvalidateFlags
sal_Int64 WinBits