LCOV - code coverage report
Current view: top level - include/svtools - brwbox.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 17 48 35.4 %
Date: 2015-06-13 12:38:46 Functions: 14 35 40.0 %
Legend: Lines: hit not hit

          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 INCLUDED_SVTOOLS_BRWBOX_HXX
      20             : #define INCLUDED_SVTOOLS_BRWBOX_HXX
      21             : 
      22             : #include <svtools/svtdllapi.h>
      23             : #include <vcl/scrbar.hxx>
      24             : #include <vcl/ctrl.hxx>
      25             : #include <vcl/vclptr.hxx>
      26             : #include <tools/multisel.hxx>
      27             : #include <svtools/headbar.hxx>
      28             : #include <svtools/transfer.hxx>
      29             : #include <svtools/AccessibleBrowseBoxObjType.hxx>
      30             : #include <svtools/accessibletableprovider.hxx>
      31             : #include <vector>
      32             : #include <stack>
      33             : 
      34             : #include <limits.h>
      35             : #include <memory>
      36             : #include <o3tl/typed_flags_set.hxx>
      37             : 
      38             : class BrowserColumn;
      39             : class BrowserDataWin;
      40             : class MultiSelection;
      41             : class BrowserHeader;
      42             : 
      43             : typedef ::std::vector< BrowserColumn* > BrowserColumns;
      44             : 
      45             : namespace svt {
      46             :     class BrowseBoxImpl;
      47             :     class IAccessibleFactory;
      48             : }
      49             : namespace utl {
      50             :     class AccessibleStateSetHelper;
      51             : }
      52             : 
      53             : 
      54             : // - BrowseBox-Types -
      55             : 
      56             : 
      57             : #define BROWSER_INVALIDID           SAL_MAX_UINT16
      58             : #define BROWSER_ENDOFSELECTION      (static_cast<long>(SFX_ENDOFSELECTION))
      59             : 
      60             : enum class BrowserMode
      61             : {
      62             :     NONE                 = 0x000000,
      63             :     COLUMNSELECTION      = 0x000001,
      64             :     MULTISELECTION       = 0x000002,
      65             :     THUMBDRAGGING        = 0x000004,
      66             :     KEEPHIGHLIGHT        = 0x000008,
      67             :     HLINES               = 0x000010,
      68             :     VLINES               = 0x000020,
      69             : 
      70             :     HIDESELECT           = 0x000100, // old => don't use!
      71             :     HIDECURSOR           = 0x000200,
      72             : 
      73             :     NO_HSCROLL           = 0x000400,
      74             :     NO_SCROLLBACK        = 0x000800,
      75             : 
      76             :     AUTO_VSCROLL         = 0x001000,
      77             :     AUTO_HSCROLL         = 0x002000,
      78             : 
      79             :     TRACKING_TIPS        = 0x004000,
      80             : 
      81             :     NO_VSCROLL           = 0x008000,
      82             : 
      83             :     HEADERBAR_NEW        = 0x040000,
      84             :     AUTOSIZE_LASTCOL     = 0x080000,
      85             :     OWN_DATACHANGED      = 0x100000,
      86             : 
      87             :     CURSOR_WO_FOCUS      = 0x200000,
      88             :     // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
      89             :     // situations which require to temporarily hide the cursor (such as scrolling).
      90             : 
      91             :     SMART_HIDECURSOR     = 0x400000,
      92             :     // is an enhanced version of BrowserMode::HIDECURSOR.
      93             :     // When set, BrowserMode::HIDECURSOR is overruled, and the cursor is hidden as long as no selection exists,
      94             :     // but shown otherwise. This does not affect other situations which require to temporarily hide the
      95             :     // cursor (such as scrolling).
      96             : };
      97             : namespace o3tl
      98             : {
      99             :     template<> struct typed_flags<BrowserMode> : is_typed_flags<BrowserMode, 0x7cff3f> {};
     100             : }
     101             : 
     102             : #define BROWSER_NONE                      0
     103             : #define BROWSER_SELECT                  720
     104             : #define BROWSER_ENHANCESELECTION        722
     105             : #define BROWSER_SELECTDOWN              724
     106             : #define BROWSER_SELECTUP                725
     107             : #define BROWSER_CURSORDOWN              731
     108             : #define BROWSER_CURSORUP                732
     109             : #define BROWSER_CURSORLEFT              733
     110             : #define BROWSER_CURSORRIGHT             734
     111             : #define BROWSER_CURSORPAGEDOWN          735
     112             : #define BROWSER_CURSORPAGEUP            736
     113             : #define BROWSER_CURSORENDOFFILE         741
     114             : #define BROWSER_CURSORTOPOFFILE         742
     115             : #define BROWSER_CURSORENDOFSCREEN       743
     116             : #define BROWSER_CURSORTOPOFSCREEN       744
     117             : #define BROWSER_CURSORHOME              745
     118             : #define BROWSER_CURSOREND               746
     119             : #define BROWSER_SCROLLDOWN              751
     120             : #define BROWSER_SCROLLUP                752
     121             : #define BROWSER_SELECTHOME              753
     122             : #define BROWSER_SELECTEND               754
     123             : #define BROWSER_SELECTCOLUMN            755
     124             : #define BROWSER_MOVECOLUMNLEFT          756
     125             : #define BROWSER_MOVECOLUMNRIGHT         757
     126             : 
     127             : 
     128             : // - BrowseEvent -
     129             : 
     130             : 
     131           0 : class BrowseEvent
     132             : {
     133             :     VclPtr<vcl::Window>     pWin;
     134             :     long                    nRow;
     135             :     Rectangle               aRect;
     136             :     sal_uInt16              nCol;
     137             :     sal_uInt16              nColId;
     138             : 
     139             : public:
     140             :                         BrowseEvent();
     141             :                         BrowseEvent( vcl::Window* pWindow,
     142             :                                      long nAbsRow,
     143             :                                      sal_uInt16 nColumn, sal_uInt16 nColumnId,
     144             :                                      const Rectangle& rRect );
     145             : 
     146           0 :     vcl::Window*        GetWindow() const { return pWin; }
     147           0 :     long                GetRow() const { return nRow; }
     148           0 :     sal_uInt16          GetColumn() const { return nCol; }
     149           0 :     sal_uInt16          GetColumnId() const { return nColId; }
     150           0 :     const Rectangle&    GetRect() const { return aRect; }
     151             : };
     152             : 
     153             : 
     154             : // - BrowserMouseEvent -
     155             : 
     156             : 
     157           0 : class BrowserMouseEvent: public MouseEvent, public BrowseEvent
     158             : {
     159             : public:
     160             :     BrowserMouseEvent();
     161             :     BrowserMouseEvent( BrowserDataWin* pWin, const MouseEvent& rEvt );
     162             :     BrowserMouseEvent( vcl::Window* pWin, const MouseEvent& rEvt,
     163             :                        long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId,
     164             :                        const Rectangle& rRect );
     165             : };
     166             : 
     167             : 
     168             : // - BrowserAcceptDropEvent -
     169             : 
     170             : 
     171           0 : class BrowserAcceptDropEvent : public AcceptDropEvent, public BrowseEvent
     172             : {
     173             : public:
     174             :     BrowserAcceptDropEvent();
     175             :     BrowserAcceptDropEvent( BrowserDataWin* pWin, const AcceptDropEvent& rEvt );
     176             : };
     177             : 
     178             : 
     179             : // - BrowserExecuteDropEvent -
     180             : 
     181             : 
     182           0 : class BrowserExecuteDropEvent : public ExecuteDropEvent, public BrowseEvent
     183             : {
     184             : public:
     185             :     BrowserExecuteDropEvent();
     186             :     BrowserExecuteDropEvent( BrowserDataWin* pWin, const ExecuteDropEvent& rEvt );
     187             : };
     188             : 
     189             : 
     190             : // - BrowseBox -
     191             : 
     192             : 
     193             : // TODO
     194             : // The whole selection thingie in this class is somewhat .... suspicious to me.
     195             : // some oddities:
     196             : // * method parameters named like members (and used in both semantics within the method!)
     197             : // * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
     198             : //   it's for column selection, too (and sometimes in an even stranger way :)
     199             : // * it is not really defined like all these hundreds selection related flags/methods work together
     200             : //   and influence each other. I do not understand it very well, but this may be my fault :)
     201             : // * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
     202             : //   not without a const_cast)
     203             : //
     204             : // We should clearly define this somewhere in the future. Or, even better, we should re-implement this
     205             : // whole class, which is planned for a long time :)
     206             : //
     207             : // sorry for the ranting. could not resist
     208             : 
     209             : class SVT_DLLPUBLIC BrowseBox
     210             :         :public Control
     211             :         ,public DragSourceHelper
     212             :         ,public DropTargetHelper
     213             :         ,public svt::IAccessibleTableProvider
     214             : {
     215             :     friend class BrowserDataWin;
     216             :     friend class ::svt::BrowseBoxImpl;
     217             : 
     218             : public:
     219             :     static const sal_uInt16 HandleColumnId = 0;
     220             : 
     221             : private:
     222             :     VclPtr<vcl::Window> pDataWin;       // window to display data rows
     223             :     VclPtr<ScrollBar>  pVScroll;       // vertical scrollbar
     224             :     VclPtr<ScrollBar>  aHScroll;       // horizontal scrollbar
     225             : 
     226             :     long            nDataRowHeight; // height of a single data-row
     227             :     sal_uInt16      nTitleLines;    // number of lines in title row
     228             :     sal_uLong       nControlAreaWidth; // width of fixed area beneeth hscroll
     229             :     bool            bThumbDragging; // handle thumb dragging
     230             :     bool            bColumnCursor;  // single columns and fields selectable
     231             :     bool            bMultiSelection;// allow multiple selected rows
     232             :     bool            bKeepHighlight; // don't hide selection on LoseFocus
     233             : 
     234             :     bool            bHLines;        // draw lines between rows
     235             :     bool            bVLines;        // draw lines between columns
     236             :     Color           aGridLineColor;     // color for lines, default dark grey
     237             :     bool            bBootstrapped;  // child windows resized etc.
     238             :     long            nTopRow;        // no. of first visible row (0...)
     239             :     long            nCurRow;        // no. of row with cursor
     240             :     long            nRowCount;      // total number of rows in model
     241             :     sal_uInt16      nFirstCol;      // no. of first visible scrollable column
     242             :     sal_uInt16      nCurColId;      // column id of cursor
     243             : 
     244             :     bool            bSelecting;
     245             :     bool            bRowDividerDrag;
     246             :     bool            bHit;
     247             :     bool            mbInteractiveRowHeight;
     248             :     Point           a1stPoint;
     249             :     Point           a2ndPoint;
     250             : 
     251             :     long            nResizeX;       // mouse position at start of resizing
     252             :     long            nMinResizeX;    // never drag more left
     253             :     long            nDragX;         // last dragged column (MouseMove)
     254             :     sal_uInt16      nResizeCol;     // resize this column in MouseMove
     255             :     bool            bResizing;      // mouse captured for column resizing
     256             : 
     257             :     bool            bSelect;        /// select or deselect
     258             :     bool            bSelectionIsVisible; // depending on focus
     259             :     bool            bScrolling;     // hidden cursor while scrolling
     260             :     bool            bNotToggleSel;  // set while in ToggleSelection() etc.
     261             :     bool            bHasFocus;      // set/unset in Get/LoseFocus
     262             :     bool            bHideSelect;    // hide selection (highlight)
     263             :     TriState        bHideCursor;    // hide cursor (frame)
     264             :     Range           aSelRange;      // for selection expansion
     265             : 
     266             :     BrowserColumns* pCols;          // array of column-descriptions
     267             :     union
     268             :     {
     269             :         MultiSelection* pSel;       // selected rows for multi-selection
     270             :         long            nSel;       // selected row for single-selection
     271             :     }               uRow;
     272             :     MultiSelection* pColSel;        // selected column-ids
     273             : 
     274             :     //fdo#83943, detect if making the cursor position
     275             :     //visible is impossible to achieve
     276             :     struct CursorMoveAttempt
     277             :     {
     278             :         long m_nCol;
     279             :         long m_nRow;
     280             :         bool m_bScrolledToReachCell;
     281           0 :         CursorMoveAttempt(long nCol, long nRow, bool bScrolledToReachCell)
     282             :             : m_nCol(nCol)
     283             :             , m_nRow(nRow)
     284           0 :             , m_bScrolledToReachCell(bScrolledToReachCell)
     285             :         {
     286           0 :         }
     287           0 :         bool operator==(const CursorMoveAttempt& r) const
     288             :         {
     289           0 :             return m_nCol == r.m_nCol &&
     290           0 :                    m_nRow == r.m_nRow &&
     291           0 :                    m_bScrolledToReachCell == r.m_bScrolledToReachCell;
     292             :         }
     293           0 :         bool operator!=(const CursorMoveAttempt& r) const { return !(*this == r); }
     294             :     };
     295             :     typedef std::stack<CursorMoveAttempt> GotoStack;
     296             :     GotoStack       m_aGotoStack;
     297             : 
     298             :     ::std::unique_ptr< ::svt::BrowseBoxImpl >  m_pImpl;       // impl structure of the BrowseBox object
     299             : 
     300             :     bool            m_bFocusOnlyCursor; // hide cursor if we don't have the focus
     301             :     Color           m_aCursorColor;     // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
     302             :     BrowserMode     m_nCurrentMode;     // last argument of SetMode (redundant, as our other members represent the current settings, too)
     303             : 
     304             : private:
     305             :     SVT_DLLPRIVATE void            ConstructImpl(BrowserMode nMode);
     306             :     SVT_DLLPRIVATE void            ExpandRowSelection( const BrowserMouseEvent& rEvt );
     307             :     SVT_DLLPRIVATE void            ToggleSelection( bool bForce = false );
     308             : 
     309             :     SVT_DLLPRIVATE void            UpdateScrollbars();
     310             :     SVT_DLLPRIVATE void            AutoSizeLastColumn();
     311             : 
     312             :     SVT_DLLPRIVATE long            ImpGetDataRowHeight() const;
     313             :     SVT_DLLPRIVATE Rectangle       ImplFieldRectPixel( long nRow, sal_uInt16 nColId ) const;
     314             :     SVT_DLLPRIVATE sal_uInt16          FrozenColCount() const;
     315             : 
     316             :     SVT_DLLPRIVATE void            ColumnInserted( sal_uInt16 nPos );
     317             : 
     318             :     DECL_DLLPRIVATE_LINK(       ScrollHdl, ScrollBar * );
     319             :     DECL_DLLPRIVATE_LINK(       EndScrollHdl, void * );
     320             :     DECL_DLLPRIVATE_LINK(       StartDragHdl, HeaderBar * );
     321             : 
     322             :     SVT_DLLPRIVATE long            GetFrozenWidth() const;
     323             : 
     324             :     bool            GoToRow(long nRow, bool bRowColMove, bool bDoNotModifySelection = false );
     325             : 
     326             :     bool            GoToColumnId( sal_uInt16 nColId, bool bMakeVisible, bool bRowColMove = false);
     327             :     void            SelectColumnPos( sal_uInt16 nCol, bool _bSelect, bool bMakeVisible);
     328           0 :     void            SelectColumnId( sal_uInt16 nColId, bool _bSelect, bool bMakeVisible)
     329           0 :                         { SelectColumnPos( GetColumnPos(nColId), _bSelect, bMakeVisible); }
     330             : 
     331             :     void            ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, bool _bForeignDevice, bool _bDrawSelections);
     332             : 
     333        1068 :     bool            PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor && !HasFocus(); }
     334             : 
     335             :     sal_uInt16      ToggleSelectedColumn();
     336             :     void            SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId);
     337             : 
     338             : protected:
     339             :     /// retrieves the XAccessible implementation associated with the BrowseBox instance
     340             :     ::svt::IAccessibleFactory&   getAccessibleFactory();
     341             : 
     342             : protected:
     343             :     sal_uInt16          ColCount() const;
     344             : 
     345             :     // software plug for database access
     346             :     // RowCount is counted automatically
     347             :     // (with the help of RowInserted and RowRemoved), so overriding of
     348             :     // the method is needless
     349             : public:
     350             :     virtual long    GetRowCount() const SAL_OVERRIDE;
     351             : 
     352             : protected:
     353             :     // for display in VScrollBar set it e.g. on  "?"
     354             :     void            SetRealRowCount( const OUString &rRealRowCount );
     355             : 
     356             :     // Return Value has to be sal_True always - SeekRow *has* to work!
     357             :     // (else ASSERT) MI: who integrated that? It must not be like that!
     358             : 
     359             :     /** seeks for the given row position
     360             :         @param nRow
     361             :             nRow starts at 0
     362             :     */
     363             :     virtual bool    SeekRow( long nRow ) = 0;
     364             :     void            DrawCursor();
     365             :     void            PaintData(vcl::Window& rWin, vcl::RenderContext& rRenderContext, const Rectangle& rRect);
     366             :     virtual void    PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const = 0;
     367             :     // Advice for the subclass: the visible scope of rows has changed.
     368             :     // The subclass is able to announce changes of the model with the
     369             :     // help of the methods RowInserted and RowRemoved. Because of the
     370             :     // new status a paint is induced (SeekRow is called etc).
     371             :     //
     372             :     // parameters: nNewTopRow: number of the new TopRow (can get changed from
     373             :     // VisibleRowsChanged by request of RowInserted and RowDeleted).
     374             :     // nNumRows: number of visible rows (a partial visible row is counted too)
     375             :     //
     376             :     // Possible reason for changing the visible scope:
     377             :     // - in front of the visible scope rows were inserted or removed, so the
     378             :     //   numbering of the visible scope has changed
     379             :     // - Scrolling (and thereof resulting in another first visible row)
     380             :     // - Resize the window
     381             :     virtual void    VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
     382             : 
     383             :     // number of visible rows in the window (incl. "truncated" rows)
     384           1 :     sal_uInt16      GetVisibleRows()
     385           1 :                         { return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
     386           2 :     long            GetTopRow() { return nTopRow; }
     387           0 :     sal_uInt16      GetFirstVisibleColNumber() const { return nFirstCol; }
     388             : 
     389             :     // Focus-Rect enable / disable
     390             :     void            DoShowCursor( const char *pWhoLog );
     391             :     void            DoHideCursor( const char *pWhoLog );
     392             :     short           GetCursorHideCount() const;
     393             : 
     394             :     virtual VclPtr<BrowserHeader> CreateHeaderBar( BrowseBox* pParent );
     395             : 
     396             :     // HACK(virtual create is not called in Ctor)
     397             :     void            SetHeaderBar( BrowserHeader* );
     398             : 
     399             :     long            CalcReverseZoom(long nVal);
     400             : 
     401             :     inline const DataFlavorExVector&
     402             :                     GetDataFlavors() const;
     403             : 
     404             :     bool            IsDropFormatSupported( SotClipboardFormatId nFormat );     // need this because the base class' IsDropFormatSupported is not const ...
     405             :     bool            IsDropFormatSupported( SotClipboardFormatId nFormat ) const;
     406             : 
     407             :     bool            IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor );        // need this because the base class' IsDropFormatSupported is not const ...
     408             :     bool            IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor ) const;
     409             : 
     410             : private:
     411             :     void*           implGetDataFlavors() const;
     412             :         // with this we can make GetDataFlavors() inline, which is strongly needed as SVTOOLS does not export
     413             :         // any sysbols containing an "_STL", so a non-inlined method would not be exported ....
     414             : 
     415             : protected:
     416             :     // callbacks for the data window
     417             :     virtual void    ImplStartTracking();
     418             :     virtual void    ImplTracking();
     419             :     virtual void    ImplEndTracking();
     420             : 
     421             : public:
     422             :                     BrowseBox( vcl::Window* pParent, WinBits nBits = 0,
     423             :                                BrowserMode nMode = BrowserMode::NONE );
     424             :                     BrowseBox( vcl::Window* pParent, const ResId& rId,
     425             :                                BrowserMode nMode = BrowserMode::NONE );
     426             :     virtual         ~BrowseBox();
     427             :     virtual void    dispose() SAL_OVERRIDE;
     428             : 
     429             :     // override inherited handler
     430             :     virtual void    StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     431             :     virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
     432             :     virtual void    MouseMove( const MouseEvent& rEvt ) SAL_OVERRIDE;
     433             :     virtual void    MouseButtonUp( const MouseEvent& rEvt ) SAL_OVERRIDE;
     434             :     virtual void    KeyInput( const KeyEvent& rEvt ) SAL_OVERRIDE;
     435             :     virtual void    LoseFocus() SAL_OVERRIDE;
     436             :     virtual void    GetFocus() SAL_OVERRIDE;
     437             :     virtual void    Resize() SAL_OVERRIDE;
     438             :     virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
     439             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
     440             :     virtual void    Command( const CommandEvent& rEvt ) SAL_OVERRIDE;
     441             :     virtual void    StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
     442             : 
     443             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;     // will forward everything got to the second AcceptDrop method
     444             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;   // will forward everything got to the second ExecuteDrop method
     445             : 
     446             :     virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
     447             :     virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
     448             : 
     449             :     // neue Handler
     450             :     virtual void    MouseButtonDown( const BrowserMouseEvent& rEvt );
     451             :     virtual void    MouseButtonUp( const BrowserMouseEvent& rEvt );
     452             :     void            StartScroll();
     453             :     virtual void    EndScroll();
     454             :     virtual void    Select();
     455             :     virtual void    DoubleClick( const BrowserMouseEvent& rEvt );
     456             :     virtual bool    IsCursorMoveAllowed( long nNewRow, sal_uInt16 nNewColId ) const;
     457             :     virtual void    CursorMoved();
     458             :     virtual void    ColumnMoved( sal_uInt16 nColId );
     459             :     virtual void    ColumnResized( sal_uInt16 nColId );
     460             :     static long     QueryColumnResize( sal_uInt16 nColId, long nWidth );
     461             :     /// called when the row height has been changed interactively
     462             :     virtual void    RowHeightChanged();
     463             :     virtual long    QueryMinimumRowHeight();
     464             : 
     465             :     // Window-Control (pass to DataWindow)
     466             :     void            SetUpdateMode( bool bUpdate );
     467             :     bool            GetUpdateMode() const;
     468             : 
     469             :     // map-mode and font control
     470             :     void            SetFont( const vcl::Font& rNewFont );
     471           0 :     const vcl::Font& GetFont() const { return pDataWin->GetFont(); }
     472           0 :     void            SetTitleFont( const vcl::Font& rNewFont )
     473           0 :                         { Control::SetFont( rNewFont ); }
     474             :     const vcl::Font& GetTitleFont() const { return Control::GetFont(); }
     475             : 
     476             :     // color for line painting
     477          20 :     void            SetGridLineColor(const Color& rColor) {aGridLineColor = rColor;}
     478             :     const Color&    GetGridLineColor() const {return aGridLineColor;}
     479             : 
     480             :     // inserting, changing, removing and freezing of columns
     481             :     void            InsertHandleColumn( sal_uLong nWidth );
     482             :     void            InsertDataColumn( sal_uInt16 nItemId, const OUString& rText,
     483             :                                     long nSize, HeaderBarItemBits nBits = HeaderBarItemBits::STDSTYLE,
     484             :                                     sal_uInt16 nPos = HEADERBAR_APPEND );
     485             :     void            SetColumnTitle( sal_uInt16 nColumnId, const OUString &rTitle );
     486             :     void            SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
     487             :     void            SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
     488             :     void            FreezeColumn( sal_uInt16 nColumnId, bool bFreeze = true );
     489             :     void            UnfreezeColumns();
     490             :     void            RemoveColumn( sal_uInt16 nColumnId );
     491             :     void            RemoveColumns();
     492             : 
     493             :     // control of title and data row height
     494             :     void            SetDataRowHeight( long nPixel );
     495             :     long            GetDataRowHeight() const;
     496             :     void            SetTitleLines( sal_uInt16 nLines );
     497             :     sal_uInt16      GetTitleLines() const { return nTitleLines; }
     498             :     long            GetTitleHeight() const;
     499             : 
     500             :     // access to dynamic values of cursor row
     501             :     OUString        GetColumnTitle( sal_uInt16 nColumnId ) const;
     502             :     Rectangle       GetFieldRect( sal_uInt16 nColumnId ) const;
     503             :     sal_uLong       GetColumnWidth( sal_uInt16 nColumnId ) const;
     504             :     sal_uInt16      GetColumnId( sal_uInt16 nPos ) const;
     505             :     sal_uInt16      GetColumnPos( sal_uInt16 nColumnId ) const;
     506             :     bool            IsFrozen( sal_uInt16 nColumnId ) const;
     507             : 
     508             :     // movement of visible area
     509             :     void            ResetScroll();
     510             :     long            ScrollColumns( long nColumns );
     511             :     long            ScrollRows( long nRows );
     512             :     bool            MakeFieldVisible( long nRow, sal_uInt16 nColId, bool bComplete = false );
     513             : 
     514             :     // access and movement of cursor
     515         280 :     long            GetCurRow() const { return nCurRow; }
     516         136 :     sal_uInt16      GetCurColumnId() const { return nCurColId; }
     517             :     bool            GoToRow( long nRow );
     518             :     bool            GoToColumnId( sal_uInt16 nColId );
     519             :     bool            GoToRowColumnId( long nRow, sal_uInt16 nColId );
     520             : 
     521             :     // selections
     522             :     virtual void    SetNoSelection() SAL_OVERRIDE;
     523             :     virtual void    SelectAll() SAL_OVERRIDE;
     524             :     virtual void    SelectRow( long nRow, bool _bSelect = true, bool bExpand = true ) SAL_OVERRIDE;
     525           0 :     void            SelectColumnPos( sal_uInt16 nCol, bool _bSelect = true )
     526           0 :                         { SelectColumnPos( nCol, _bSelect, true); }
     527           0 :     void            SelectColumnId( sal_uInt16 nColId, bool _bSelect = true )
     528           0 :                         { SelectColumnPos( GetColumnPos(nColId), _bSelect, true); }
     529             :     long            GetSelectRowCount() const;
     530             :     sal_uInt16          GetSelectColumnCount() const;
     531             :     virtual bool    IsRowSelected( long nRow ) const SAL_OVERRIDE;
     532             :     bool            IsColumnSelected( sal_uInt16 nColumnId ) const;
     533             :     long            FirstSelectedRow( bool bInverse = false );
     534             :     long            LastSelectedRow();
     535             :     long            NextSelectedRow();
     536          25 :     const MultiSelection* GetColumnSelection() const { return pColSel; }
     537           2 :     const MultiSelection* GetSelection() const
     538           2 :                     { return bMultiSelection ? uRow.pSel : 0; }
     539             : 
     540             :     long            FirstSelectedColumn( ) const;
     541             : 
     542           1 :     bool            IsResizing() const { return bResizing; }
     543             : 
     544             :     // access to positions of fields, column and rows
     545        2670 :     vcl::Window&         GetDataWindow() const { return *pDataWin; }
     546             :     Rectangle       GetRowRectPixel( long nRow,
     547             :                                      bool bRelToBrowser = true ) const;
     548             :     Rectangle       GetFieldRectPixel( long nRow, sal_uInt16 nColId,
     549             :                                        bool bRelToBrowser = true) const;
     550             :     bool            IsFieldVisible( long nRow, sal_uInt16 nColId,
     551             :                                     bool bComplete = false ) const;
     552             :     long            GetRowAtYPosPixel( long nY,
     553             :                                         bool bRelToBrowser = true  ) const;
     554             :     sal_uInt16      GetColumnAtXPosPixel( long nX,
     555             :                                           bool bRelToBrowser = true  ) const;
     556             : 
     557             :     // invalidations
     558             :     void            Clear();
     559             :     void            RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true );
     560             :     void            RowModified( long nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
     561             :     void            RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
     562             : 
     563             :     // miscellaneous
     564             :     void            ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX );
     565             :     Rectangle       GetControlArea() const;
     566             :     bool            ProcessKey( const KeyEvent& rEvt );
     567             :     void            Dispatch( sal_uInt16 nId );
     568             :     void            SetMode( BrowserMode nMode = BrowserMode::NONE );
     569          95 :     BrowserMode     GetMode( ) const { return m_nCurrentMode; }
     570             : 
     571             :     void            SetCursorColor(const Color& _rCol);
     572             :     Color           GetCursorColor() const { return m_aCursorColor; }
     573             :     void            ResetSelecting() { bSelecting = false; }
     574             : 
     575             :     /** specifies that the user is allowed to interactively change the height of a row,
     576             :         by simply dragging an arbitrary row separator.
     577             : 
     578             :         Note that this works only if there's a handle column, since only in this case,
     579             :         there *is* something for the user to click onto
     580             :     */
     581          20 :     void            EnableInteractiveRowHeight( bool _bEnable = true ) { mbInteractiveRowHeight = _bEnable; }
     582           0 :     bool            IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
     583             : 
     584             :     /// access to selected methods, to be granted to the BrowserColumn
     585         112 :     struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
     586             :     /** public version of PaintField, with selected access rights for the BrowserColumn
     587             :     */
     588         112 :     void            DoPaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
     589         112 :                     { PaintField( rDev, rRect, nColumnId ); }
     590             : 
     591             :     /** suggests a default width for a column containing a given text
     592             : 
     593             :         The width is calculated so that the text fits completely, plus som margin.
     594             :     */
     595             :     sal_uLong         GetDefaultColumnWidth( const OUString& _rText ) const;
     596             : 
     597             :     /** GetCellText returns the text at the given position
     598             :         @param  _nRow
     599             :             the number of the row
     600             :         @param  _nColId
     601             :             the ID of the column
     602             :         @return
     603             :             the text out of the cell
     604             :     */
     605             :     virtual OUString  GetCellText(long _nRow, sal_uInt16 _nColId) const;
     606             : 
     607             :     /** @return
     608             :             the current column count
     609             :     */
     610           0 :     sal_uInt16 GetColumnCount() const SAL_OVERRIDE { return ColCount(); }
     611             : 
     612             :     /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
     613             :         @param nEventId
     614             :             the event id
     615             :         @param rNewValue
     616             :             the new value
     617             :         @param rOldValue
     618             :             the old value
     619             :     */
     620             :     void commitBrowseBoxEvent(sal_Int16 nEventId,
     621             :             const css::uno::Any& rNewValue,
     622             :             const css::uno::Any& rOldValue);
     623             : 
     624             :     /** commitTableEvent commit the event at all listeners of the table
     625             :         @param nEventId
     626             :             the event id
     627             :         @param rNewValue
     628             :             the new value
     629             :         @param rOldValue
     630             :             the old value
     631             :     */
     632             :     void commitTableEvent(sal_Int16 nEventId,
     633             :             const css::uno::Any& rNewValue,
     634             :             const css::uno::Any& rOldValue);
     635             : 
     636             :     /** fires an AccessibleEvent relative to a header bar AccessibleContext
     637             : 
     638             :         @param nEventId
     639             :             the event id
     640             :         @param rNewValue
     641             :             the new value
     642             :         @param rOldValue
     643             :             the old value
     644             :     */
     645             :     void commitHeaderBarEvent(sal_Int16 nEventId,
     646             :             const css::uno::Any& rNewValue,
     647             :             const css::uno::Any& rOldValue,
     648             :             bool _bColumnHeaderBar
     649             :          );
     650             : 
     651             :     /** returns the Rectangle for either the column header bar ot the row header bar
     652             :         @param  _bIsColumnBar
     653             :             <TRUE/> when column header bar is used
     654             :         @param  _bOnScreen
     655             :             <TRUE/> when the rectangle should be calculated OnScreen
     656             :         @return
     657             :             the Rectangle
     658             :     */
     659             :     virtual Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen = true) SAL_OVERRIDE;
     660             : 
     661             :     /** calculates the Rectangle of the table
     662             :         @param  _bOnScreen
     663             :             <TRUE/> when the rectangle should be calculated OnScreen
     664             :         @return
     665             :             the Rectangle
     666             :     */
     667             :     virtual Rectangle calcTableRect(bool _bOnScreen = true) SAL_OVERRIDE;
     668             : 
     669             :     /**
     670             :         @param  _nRowId
     671             :             the current row
     672             :         @param  _nColId
     673             :             the column id
     674             :         @param  _bOnScreen
     675             :             <TRUE/> when the rectangle should be calculated OnScreen
     676             :         @return
     677             :             the Rectangle
     678             :     */
     679             :     virtual Rectangle GetFieldRectPixelAbs(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen = true) SAL_OVERRIDE;
     680             : 
     681             :     /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
     682             :     bool isAccessibleAlive( ) const;
     683             : 
     684             :     // ACCESSIBILITY ==========================================================
     685             : public:
     686             :     /** Creates and returns the accessible object of the whole BrowseBox. */
     687             :     virtual css::uno::Reference<
     688             :         css::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     689             : 
     690             :     // Children ---------------------------------------------------------------
     691             : 
     692             :     /** Creates the accessible object of a data table cell.
     693             :         @param nRow  The row index of the cell.
     694             :         @param nColumnId  The column pos of the cell.
     695             :         @return  The XAccessible interface of the specified cell. */
     696             :     virtual css::uno::Reference<
     697             :         css::accessibility::XAccessible >
     698             :     CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) SAL_OVERRIDE;
     699             : 
     700             :     /** Creates the accessible object of a row header.
     701             :         @param nRow  The row index of the header.
     702             :         @return  The XAccessible interface of the specified row header. */
     703             :     virtual css::uno::Reference<
     704             :         css::accessibility::XAccessible >
     705             :     CreateAccessibleRowHeader( sal_Int32 nRow ) SAL_OVERRIDE;
     706             : 
     707             :     /** Creates the accessible object of a column header.
     708             :         @param nColumnId  The column ID of the header.
     709             :         @return  The XAccessible interface of the specified column header. */
     710             :     virtual css::uno::Reference<
     711             :         css::accessibility::XAccessible >
     712             :     CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) SAL_OVERRIDE;
     713             : 
     714             :     /** @return  The count of additional controls of the control area. */
     715             :     virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE;
     716             : 
     717             :     /** Creates the accessible object of an additional control.
     718             :         @param nIndex  The 0-based index of the control.
     719             :         @return  The XAccessible interface of the specified control. */
     720             :     virtual css::uno::Reference<
     721             :         css::accessibility::XAccessible >
     722             :     CreateAccessibleControl( sal_Int32 nIndex ) SAL_OVERRIDE;
     723             : 
     724             :     // Conversions ------------------------------------------------------------
     725             : 
     726             :     /** Converts a point relative to the data window origin to a cell address.
     727             :         @param rnRow  Out-parameter that takes the row index.
     728             :         @param rnColumnId  Out-parameter that takes the column ID.
     729             :         @param rPoint  The position in pixels relative to the data window.
     730             :         @return <TRUE/>, if the point could be converted to a valid address. */
     731             :     virtual bool ConvertPointToCellAddress(
     732             :         sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint ) SAL_OVERRIDE;
     733             : 
     734             :     /** Converts a point relative to the row header bar origin to a row header
     735             :         index.
     736             :         @param rnRow  Out-parameter that takes the row index.
     737             :         @param rPoint  The position in pixels relative to the header bar.
     738             :         @return <TRUE/>, if the point could be converted to a valid index. */
     739             :     virtual bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint ) SAL_OVERRIDE;
     740             : 
     741             :     /** Converts a point relative to the column header bar origin to a column
     742             :         header index.
     743             :         @param rnColumnId  Out-parameter that takes the column ID.
     744             :         @param rPoint  The position in pixels relative to the header bar.
     745             :         @return <TRUE/>, if the point could be converted to a valid index. */
     746             :     virtual bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint ) SAL_OVERRIDE;
     747             : 
     748             :     /** Converts a point relative to the BrowseBox origin to the index of an
     749             :         existing control.
     750             :         @param rnRow  Out-parameter that takes the 0-based control index.
     751             :         @param rPoint  The position in pixels relative to the BrowseBox.
     752             :         @return <TRUE/>, if the point could be converted to a valid index. */
     753             :     virtual bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint ) SAL_OVERRIDE;
     754             : 
     755             :     // Object data and state --------------------------------------------------
     756             : 
     757             :     /** return the name of the specified object.
     758             :         @param  eObjType
     759             :             The type to ask for
     760             :         @param  _nPosition
     761             :             The position of a tablecell (index position), header bar  column/row cell
     762             :         @return
     763             :             The name of the specified object.
     764             :     */
     765             :     virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     766             : 
     767             :     /** return the description of the specified object.
     768             :         @param  eObjType
     769             :             The type to ask for
     770             :         @param  _nPosition
     771             :             The position of a tablecell (index position), header bar  column/row cell
     772             :         @return
     773             :             The description of the specified object.
     774             :     */
     775             :     virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     776             : 
     777             :     /** @return  The header text of the specified row. */
     778             :     virtual OUString GetRowDescription( sal_Int32 nRow ) const SAL_OVERRIDE;
     779             : 
     780             :     /** @return  The header text of the specified column. */
     781             :     virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     782             : 
     783             :     /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
     784             :         the accessible object), depending on the specified object type. */
     785             :     virtual void FillAccessibleStateSet(
     786             :             ::utl::AccessibleStateSetHelper& rStateSet,
     787             :             ::svt::AccessibleBrowseBoxObjType eObjType ) const SAL_OVERRIDE;
     788             : 
     789             :     /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
     790             :         the accessible object). */
     791             :     virtual void FillAccessibleStateSetForCell(
     792             :             ::utl::AccessibleStateSetHelper& _rStateSet,
     793             :             sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     794             : 
     795             :     /** Sets focus to current cell of the data table. */
     796             :     virtual void GrabTableFocus() SAL_OVERRIDE;
     797             : 
     798             :     // IAccessibleTableProvider
     799             :     virtual sal_Int32               GetCurrRow() const SAL_OVERRIDE;
     800             :     virtual sal_uInt16              GetCurrColumn() const SAL_OVERRIDE;
     801             :     virtual bool                    HasRowHeader() const SAL_OVERRIDE;
     802             :     virtual bool                    IsCellFocusable() const SAL_OVERRIDE;
     803             :     virtual bool                    GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) SAL_OVERRIDE;
     804             :     virtual void                    SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) SAL_OVERRIDE;
     805             :     virtual bool                    IsColumnSelected( long _nColumn ) const SAL_OVERRIDE;
     806             :     virtual sal_Int32               GetSelectedRowCount() const SAL_OVERRIDE;
     807             :     virtual sal_Int32               GetSelectedColumnCount() const SAL_OVERRIDE;
     808             :     virtual void                    GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const SAL_OVERRIDE;
     809             :     virtual void                    GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const SAL_OVERRIDE;
     810             :     virtual bool                    IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     811             :     virtual OUString                GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const SAL_OVERRIDE;
     812             :     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) SAL_OVERRIDE;
     813             :     virtual Rectangle               GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const SAL_OVERRIDE;
     814             :     virtual void                    GrabFocus() SAL_OVERRIDE;
     815             :     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) SAL_OVERRIDE;
     816             :     virtual vcl::Window*            GetAccessibleParentWindow() const SAL_OVERRIDE;
     817             :     virtual vcl::Window*            GetWindowInstance() SAL_OVERRIDE;
     818             : 
     819             : private:
     820             :     // the following declares some Window/OutputDevice methods private. This happened in the course
     821             :     // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
     822             :     // upper module, you should investigate whether you really wanted to call base class methods,
     823             :     // or the versions at this class. In the latter case, use the renamed versions above.
     824             : 
     825             :     // Set/GetLineColor - superseded by Set/GetGridLineColor
     826             :     using OutputDevice::SetLineColor;
     827             :     using OutputDevice::GetLineColor;
     828             : 
     829             :     // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
     830             :     // and not doing as intended
     831             :     using Window::ToTop;
     832             : };
     833             : 
     834             : 
     835           0 : inline const DataFlavorExVector& BrowseBox::GetDataFlavors() const
     836             : {
     837           0 :     return *static_cast<DataFlavorExVector*>(implGetDataFlavors());
     838             : }
     839             : 
     840             : #endif
     841             : 
     842             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11