LCOV - code coverage report
Current view: top level - include/svtools - brwbox.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 17 46 37.0 %
Date: 2014-11-03 Functions: 14 33 42.4 %
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 <tools/multisel.hxx>
      26             : #include <svtools/headbar.hxx>
      27             : #include <svtools/transfer.hxx>
      28             : #include <svtools/AccessibleBrowseBoxObjType.hxx>
      29             : #include <svtools/accessibletableprovider.hxx>
      30             : #include <vector>
      31             : 
      32             : #include <limits.h>
      33             : #include <memory>
      34             : 
      35             : class BrowserColumn;
      36             : class BrowserDataWin;
      37             : class MultiSelection;
      38             : class BrowserHeader;
      39             : 
      40             : typedef ::std::vector< BrowserColumn* > BrowserColumns;
      41             : 
      42             : namespace svt {
      43             :     class BrowseBoxImpl;
      44             :     class IAccessibleFactory;
      45             : }
      46             : namespace utl {
      47             :     class AccessibleStateSetHelper;
      48             : }
      49             : 
      50             : 
      51             : // - BrowseBox-Types -
      52             : 
      53             : 
      54             : #define BROWSER_INVALIDID           SAL_MAX_UINT16
      55             : #define BROWSER_ENDOFSELECTION      (static_cast<long>(SFX_ENDOFSELECTION))
      56             : 
      57             : typedef sal_uLong BrowserMode;
      58             : 
      59             : #define BROWSER_COLUMNSELECTION      0x0001
      60             : #define BROWSER_MULTISELECTION       0x0002
      61             : #define BROWSER_THUMBDRAGGING        0x0004
      62             : #define BROWSER_KEEPHIGHLIGHT        0x0008
      63             : #define BROWSER_KEEPSELECTION        BROWSER_KEEPHIGHLIGHT  // old, don't use!
      64             : #define BROWSER_HLINES               0x0010
      65             : #define BROWSER_VLINES               0x0020
      66             : #define BROWSER_HLINESFULL           BROWSER_HLINES // old, don't use!
      67             : #define BROWSER_VLINESFULL           BROWSER_VLINES // old, don't use!
      68             : #define BROWSER_HLINESDOTS           0x0000 // old => don't use!
      69             : #define BROWSER_VLINESDOTS           0x0000 // old => don't use!
      70             : 
      71             : #define BROWSER_HIDESELECT           0x0100 // old => don't use!
      72             : #define BROWSER_HIDECURSOR           0x0200
      73             : 
      74             : #define BROWSER_NO_HSCROLL           0x0400
      75             : #define BROWSER_NO_SCROLLBACK        0x0800
      76             : 
      77             : #define BROWSER_AUTO_VSCROLL         0x1000
      78             : #define BROWSER_AUTO_HSCROLL         0x2000
      79             : 
      80             : #define BROWSER_TRACKING_TIPS        0x4000
      81             : 
      82             : #define BROWSER_NO_VSCROLL           0x8000
      83             : 
      84             : #define BROWSER_HIGHLIGHT_NONE       0x0100 // == BROWSER_HIDESELECT
      85             : 
      86             : #define BROWSER_HEADERBAR_NEW    0x00040000
      87             : #define BROWSER_AUTOSIZE_LASTCOL 0x00080000
      88             : #define BROWSER_OWN_DATACHANGED  0x00100000
      89             : 
      90             : #define BROWSER_CURSOR_WO_FOCUS  0x00200000
      91             :     // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
      92             :     // situations which require to temporarily hide the cursor (such as scrolling).
      93             : 
      94             : #define BROWSER_SMART_HIDECURSOR 0x00400000
      95             :     // is an enhanced version of BROWSER_HIDECURSOR.
      96             :     // When set, BROWSER_HIDECURSOR is overruled, and the cursor is hidden as long as no selection exists,
      97             :     // but shown otherwise. This does not affect other situations which require to temporarily hide the
      98             :     // cursor (such as scrolling).
      99             : 
     100             : #define BROWSER_NONE                      0
     101             : #define BROWSER_SELECT                  720
     102             : #define BROWSER_ENHANCESELECTION        722
     103             : #define BROWSER_SELECTDOWN              724
     104             : #define BROWSER_SELECTUP                725
     105             : #define BROWSER_CURSORDOWN              731
     106             : #define BROWSER_CURSORUP                732
     107             : #define BROWSER_CURSORLEFT              733
     108             : #define BROWSER_CURSORRIGHT             734
     109             : #define BROWSER_CURSORPAGEDOWN          735
     110             : #define BROWSER_CURSORPAGEUP            736
     111             : #define BROWSER_CURSORENDOFFILE         741
     112             : #define BROWSER_CURSORTOPOFFILE         742
     113             : #define BROWSER_CURSORENDOFSCREEN       743
     114             : #define BROWSER_CURSORTOPOFSCREEN       744
     115             : #define BROWSER_CURSORHOME              745
     116             : #define BROWSER_CURSOREND               746
     117             : #define BROWSER_SCROLLDOWN              751
     118             : #define BROWSER_SCROLLUP                752
     119             : #define BROWSER_SELECTHOME              753
     120             : #define BROWSER_SELECTEND               754
     121             : #define BROWSER_SELECTCOLUMN            755
     122             : #define BROWSER_MOVECOLUMNLEFT          756
     123             : #define BROWSER_MOVECOLUMNRIGHT         757
     124             : 
     125             : 
     126             : // - BrowseEvent -
     127             : 
     128             : 
     129             : class BrowseEvent
     130             : {
     131             :     vcl::Window*             pWin;
     132             :     long                nRow;
     133             :     Rectangle           aRect;
     134             :     sal_uInt16              nCol;
     135             :     sal_uInt16              nColId;
     136             : 
     137             : public:
     138             :                         BrowseEvent();
     139             :                         BrowseEvent( vcl::Window* pWindow,
     140             :                                      long nAbsRow,
     141             :                                      sal_uInt16 nColumn, sal_uInt16 nColumnId,
     142             :                                      const Rectangle& rRect );
     143             : 
     144           0 :     vcl::Window*             GetWindow() const { return pWin; }
     145           0 :     long                GetRow() const { return nRow; }
     146           0 :     sal_uInt16              GetColumn() const { return nCol; }
     147           0 :     sal_uInt16              GetColumnId() const { return nColId; }
     148           0 :     const Rectangle&    GetRect() const { return aRect; }
     149             : };
     150             : 
     151             : 
     152             : // - BrowserMouseEvent -
     153             : 
     154             : 
     155             : class BrowserMouseEvent: public MouseEvent, public BrowseEvent
     156             : {
     157             : public:
     158             :     BrowserMouseEvent();
     159             :     BrowserMouseEvent( BrowserDataWin* pWin, const MouseEvent& rEvt );
     160             :     BrowserMouseEvent( vcl::Window* pWin, const MouseEvent& rEvt,
     161             :                        long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId,
     162             :                        const Rectangle& rRect );
     163             : };
     164             : 
     165             : 
     166             : // - BrowserAcceptDropEvent -
     167             : 
     168             : 
     169           0 : class BrowserAcceptDropEvent : public AcceptDropEvent, public BrowseEvent
     170             : {
     171             : public:
     172             :     BrowserAcceptDropEvent();
     173             :     BrowserAcceptDropEvent( BrowserDataWin* pWin, const AcceptDropEvent& rEvt );
     174             : };
     175             : 
     176             : 
     177             : // - BrowserExecuteDropEvent -
     178             : 
     179             : 
     180           0 : class BrowserExecuteDropEvent : public ExecuteDropEvent, public BrowseEvent
     181             : {
     182             : public:
     183             :     BrowserExecuteDropEvent();
     184             :     BrowserExecuteDropEvent( BrowserDataWin* pWin, const ExecuteDropEvent& rEvt );
     185             : };
     186             : 
     187             : 
     188             : // - BrowseBox -
     189             : 
     190             : 
     191             : // TODO
     192             : // The whole selection thingie in this class is somewhat .... suspicious to me.
     193             : // some oddities:
     194             : // * method parameters named like members (and used in both semantics within the method!)
     195             : // * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
     196             : //   it's for column selection, too (and sometimes in an even stranger way :)
     197             : // * it is not really defined like all these hundreds selection related flags/methods work together
     198             : //   and influence each other. I do not understand it very well, but this may be my fault :)
     199             : // * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
     200             : //   not without a const_cast)
     201             : //
     202             : // We should clearly define this somewhere in the future. Or, even better, we should re-implement this
     203             : // whole class, which is planned for a long time :)
     204             : //
     205             : // sorry for the ranting. could not resist
     206             : 
     207             : class SVT_DLLPUBLIC BrowseBox
     208             :         :public Control
     209             :         ,public DragSourceHelper
     210             :         ,public DropTargetHelper
     211             :         ,public svt::IAccessibleTableProvider
     212             : {
     213             :     friend class BrowserDataWin;
     214             :     friend class ::svt::BrowseBoxImpl;
     215             : 
     216             : public:
     217             :     static const sal_uInt16 HandleColumnId = 0;
     218             : 
     219             : private:
     220             :     vcl::Window*         pDataWin;       // window to display data rows
     221             :     ScrollBar*      pVScroll;       // vertical scrollbar
     222             :     ScrollBar       aHScroll;       // horizontal scrollbar
     223             : 
     224             :     long            nDataRowHeight; // height of a single data-row
     225             :     sal_uInt16      nTitleLines;    // number of lines in title row
     226             :     sal_uLong       nControlAreaWidth; // width of fixed area beneeth hscroll
     227             :     bool            bThumbDragging; // handle thumb dragging
     228             :     bool            bColumnCursor;  // single columns and fields selectable
     229             :     bool            bMultiSelection;// allow multiple selected rows
     230             :     bool            bKeepHighlight; // don't hide selection on LoseFocus
     231             : 
     232             :     bool            bHLines;        // draw lines between rows
     233             :     bool            bVLines;        // draw lines between columns
     234             :     bool            bHDots;         // draw lines between rows dotted
     235             :     bool            bVDots;         // draw lines between columns dotted
     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        1482 :     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 overloading 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             :     virtual void    DrawCursor();
     365             :     virtual void    PaintRow( OutputDevice &rDev, const Rectangle &rRect );
     366             :     virtual void    PaintData( vcl::Window& rWin, const Rectangle& rRect );
     367             :     virtual void    PaintField( OutputDevice& rDev, const Rectangle& rRect,
     368             :                                 sal_uInt16 nColumnId ) const = 0;
     369             :     // Advice for the subclass: the visible scope of rows has changed.
     370             :     // The subclass is able to announce changes of the model with the
     371             :     // help of the methods RowInserted and RowRemoved. Because of the
     372             :     // new status a paint is induced (SeekRow is called etc).
     373             :     //
     374             :     // parameters: nNewTopRow: number of the new TopRow (can get changed from
     375             :     // VisibleRowsChanged by request of RowInserted and RowDeleted).
     376             :     // nNumRows: number of visible rows (a partial visible row is counted too)
     377             :     //
     378             :     // Possible reason for changing the visible scope:
     379             :     // - in front of the visible scope rows were inserted or removed, so the
     380             :     //   numbering of the visible scope has changed
     381             :     // - Scrolling (and thereof resulting in another first visible row)
     382             :     // - Resize the window
     383             :     virtual void    VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
     384             : 
     385             :     // number of visible rows in the window (incl. "truncated" rows)
     386           2 :     sal_uInt16          GetVisibleRows()
     387           2 :                         { return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
     388           4 :     long            GetTopRow() { return nTopRow; }
     389           0 :     sal_uInt16          GetFirstVisibleColNumber() const { return nFirstCol; }
     390             : 
     391             :     // Focus-Rect enable / disable
     392             :     void            DoShowCursor( const char *pWhoLog );
     393             :     void            DoHideCursor( const char *pWhoLog );
     394             :     short           GetCursorHideCount() const;
     395             : 
     396             :     virtual BrowserHeader*  CreateHeaderBar( BrowseBox* pParent );
     397             : 
     398             :     // HACK(virtual create is not called in Ctor)
     399             :     void            SetHeaderBar( BrowserHeader* );
     400             : 
     401             :     long            CalcReverseZoom(long nVal);
     402             : 
     403             :     inline const DataFlavorExVector&
     404             :                     GetDataFlavors() const;
     405             : 
     406             :     bool            IsDropFormatSupported( SotFormatStringId nFormat );     // need this because the base class' IsDropFormatSupported is not const ...
     407             :     bool            IsDropFormatSupported( SotFormatStringId nFormat ) const;
     408             : 
     409             :     bool            IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor );        // need this because the base class' IsDropFormatSupported is not const ...
     410             :     bool            IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor ) const;
     411             : 
     412             : private:
     413             :     void*           implGetDataFlavors() const;
     414             :         // with this we can make GetDataFlavors() inline, which is strongly needed as SVTOOLS does not export
     415             :         // any sysbols containing an "_STL", so a non-inlined method would not be exported ....
     416             : 
     417             : protected:
     418             :     // callbacks for the data window
     419             :     virtual void    ImplStartTracking();
     420             :     virtual void    ImplTracking();
     421             :     virtual void    ImplEndTracking();
     422             : 
     423             : public:
     424             :                     BrowseBox( vcl::Window* pParent, WinBits nBits = 0,
     425             :                                BrowserMode nMode = 0 );
     426             :                     BrowseBox( vcl::Window* pParent, const ResId& rId,
     427             :                                BrowserMode nMode = 0 );
     428             :                     virtual ~BrowseBox();
     429             : 
     430             :     // inherited overloaded handler
     431             :     virtual void    StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     432             :     virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
     433             :     virtual void    MouseMove( const MouseEvent& rEvt ) SAL_OVERRIDE;
     434             :     virtual void    MouseButtonUp( const MouseEvent& rEvt ) SAL_OVERRIDE;
     435             :     virtual void    KeyInput( const KeyEvent& rEvt ) SAL_OVERRIDE;
     436             :     virtual void    LoseFocus() SAL_OVERRIDE;
     437             :     virtual void    GetFocus() SAL_OVERRIDE;
     438             :     virtual void    Resize() SAL_OVERRIDE;
     439             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     440             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     441             :     virtual void    Command( const CommandEvent& rEvt ) SAL_OVERRIDE;
     442             :     virtual void    StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
     443             : 
     444             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;     // will forward everything got to the second AcceptDrop method
     445             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;   // will forward everything got to the second ExecuteDrop method
     446             : 
     447             :     virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
     448             :     virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
     449             : 
     450             :     // neue Handler
     451             :     virtual void    MouseButtonDown( const BrowserMouseEvent& rEvt );
     452             :     virtual void    MouseMove( const BrowserMouseEvent& rEvt );
     453             :     virtual void    MouseButtonUp( const BrowserMouseEvent& rEvt );
     454             :     virtual void    StartScroll();
     455             :     virtual void    EndScroll();
     456             :     virtual void    Select();
     457             :     virtual void    DoubleClick( const BrowserMouseEvent& rEvt );
     458             :     virtual bool    IsCursorMoveAllowed( long nNewRow, sal_uInt16 nNewColId ) const;
     459             :     virtual void    CursorMoved();
     460             :     virtual void    ColumnMoved( sal_uInt16 nColId );
     461             :     virtual void    ColumnResized( sal_uInt16 nColId );
     462             :     virtual long    QueryColumnResize( sal_uInt16 nColId, long nWidth );
     463             :     /// called when the row height has been changed interactively
     464             :     virtual void    RowHeightChanged();
     465             :     virtual long    QueryMinimumRowHeight();
     466             : 
     467             :     // Window-Control (pass to DataWindow)
     468             :     void            SetUpdateMode( bool bUpdate );
     469             :     bool            GetUpdateMode() const;
     470             : 
     471             :     // map-mode and font control
     472             :     void            SetFont( const vcl::Font& rNewFont );
     473           0 :     const vcl::Font& GetFont() const { return pDataWin->GetFont(); }
     474           0 :     void            SetTitleFont( const vcl::Font& rNewFont )
     475           0 :                         { Control::SetFont( rNewFont ); }
     476             :     const vcl::Font& GetTitleFont() const { return Control::GetFont(); }
     477             : 
     478             :     // color for line painting
     479          41 :     void            SetGridLineColor(const Color& rColor) {aGridLineColor = rColor;}
     480             :     const Color&    GetGridLineColor() const {return aGridLineColor;}
     481             : 
     482             :     // inserting, changing, removing and freezing of columns
     483             :     void            InsertHandleColumn( sal_uLong nWidth );
     484             :     void            InsertDataColumn( sal_uInt16 nItemId, const OUString& rText,
     485             :                                     long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE,
     486             :                                     sal_uInt16 nPos = HEADERBAR_APPEND );
     487             :     void            SetColumnTitle( sal_uInt16 nColumnId, const OUString &rTitle );
     488             :     void            SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
     489             :     void            SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
     490             :     void            FreezeColumn( sal_uInt16 nColumnId, bool bFreeze = true );
     491             :     void            UnfreezeColumns();
     492             :     void            RemoveColumn( sal_uInt16 nColumnId );
     493             :     void            RemoveColumns();
     494             : 
     495             :     // control of title and data row height
     496             :     void            SetDataRowHeight( long nPixel );
     497             :     long            GetDataRowHeight() const;
     498             :     void            SetTitleLines( sal_uInt16 nLines );
     499             :     sal_uInt16          GetTitleLines() const { return nTitleLines; }
     500             :     virtual long    GetTitleHeight() const;
     501             : 
     502             :     // access to dynamic values of cursor row
     503             :     OUString        GetColumnTitle( sal_uInt16 nColumnId ) const;
     504             :     Rectangle       GetFieldRect( sal_uInt16 nColumnId ) const;
     505             :     sal_uLong       GetColumnWidth( sal_uInt16 nColumnId ) const;
     506             :     sal_uInt16      GetColumnId( sal_uInt16 nPos ) const;
     507             :     sal_uInt16      GetColumnPos( sal_uInt16 nColumnId ) const;
     508             :     bool            IsFrozen( sal_uInt16 nColumnId ) const;
     509             : 
     510             :     // movement of visible area
     511             :     void            ResetScroll();
     512             :     long            ScrollColumns( long nColumns );
     513             :     long            ScrollRows( long nRows );
     514             :     bool            MakeFieldVisible( long nRow, sal_uInt16 nColId, bool bComplete = false );
     515             : 
     516             :     // access and movement of cursor
     517         346 :     long            GetCurRow() const { return nCurRow; }
     518         254 :     sal_uInt16      GetCurColumnId() const { return nCurColId; }
     519             :     bool            GoToRow( long nRow );
     520             :     bool            GoToColumnId( sal_uInt16 nColId );
     521             :     bool            GoToRowColumnId( long nRow, sal_uInt16 nColId );
     522             : 
     523             :     // selections
     524             :     virtual void    SetNoSelection() SAL_OVERRIDE;
     525             :     virtual void    SelectAll() SAL_OVERRIDE;
     526             :     virtual void    SelectRow( long nRow, bool _bSelect = true, bool bExpand = true ) SAL_OVERRIDE;
     527           0 :     void            SelectColumnPos( sal_uInt16 nCol, bool _bSelect = true )
     528           0 :                         { SelectColumnPos( nCol, _bSelect, true); }
     529           0 :     void            SelectColumnId( sal_uInt16 nColId, bool _bSelect = true )
     530           0 :                         { SelectColumnPos( GetColumnPos(nColId), _bSelect, true); }
     531             :     long            GetSelectRowCount() const;
     532             :     sal_uInt16          GetSelectColumnCount() const;
     533             :     virtual bool    IsRowSelected( long nRow ) const SAL_OVERRIDE;
     534             :     bool            IsColumnSelected( sal_uInt16 nColumnId ) const;
     535             :     long            FirstSelectedRow( bool bInverse = false );
     536             :     long            LastSelectedRow();
     537             :     long            NextSelectedRow();
     538          43 :     const MultiSelection* GetColumnSelection() const { return pColSel; }
     539           4 :     const MultiSelection* GetSelection() const
     540           4 :                     { return bMultiSelection ? uRow.pSel : 0; }
     541             : 
     542             :     long            FirstSelectedColumn( ) const;
     543             : 
     544           2 :     bool            IsResizing() const { return bResizing; }
     545             : 
     546             :     // access to positions of fields, column and rows
     547        2647 :     vcl::Window&         GetDataWindow() const { return *pDataWin; }
     548             :     Rectangle       GetRowRectPixel( long nRow,
     549             :                                      bool bRelToBrowser = true ) const;
     550             :     Rectangle       GetFieldRectPixel( long nRow, sal_uInt16 nColId,
     551             :                                        bool bRelToBrowser = true) const;
     552             :     bool            IsFieldVisible( long nRow, sal_uInt16 nColId,
     553             :                                     bool bComplete = false ) const;
     554             :     long            GetRowAtYPosPixel( long nY,
     555             :                                         bool bRelToBrowser = true  ) const;
     556             :     sal_uInt16          GetColumnAtXPosPixel( long nX,
     557             :                                           bool bRelToBrowser = true  ) const;
     558             : 
     559             :     // invalidations
     560             :     void            Clear();
     561             :     void            RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true );
     562             :     void            RowModified( long nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
     563             :     void            RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false );
     564             : 
     565             :     // miscellaneous
     566             :     void            ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX );
     567             :     Rectangle       GetControlArea() const;
     568             :     bool            ProcessKey( const KeyEvent& rEvt );
     569             :     void            Dispatch( sal_uInt16 nId );
     570             :     void            SetMode( BrowserMode nMode = 0 );
     571          80 :     BrowserMode     GetMode( ) const { return m_nCurrentMode; }
     572             : 
     573             :     void            SetCursorColor(const Color& _rCol);
     574             :     Color           GetCursorColor() const { return m_aCursorColor; }
     575             :     void            ResetSelecting() { bSelecting = false; }
     576             : 
     577             :     /** specifies that the user is allowed to interactively change the height of a row,
     578             :         by simply dragging an arbitrary row separator.
     579             : 
     580             :         Note that this works only if there's a handle column, since only in this case,
     581             :         there *is* something for the user to click onto
     582             :     */
     583          41 :     void            EnableInteractiveRowHeight( bool _bEnable = true ) { mbInteractiveRowHeight = _bEnable; }
     584           0 :     bool            IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
     585             : 
     586             :     /// access to selected methods, to be granted to the BrowserColumn
     587          96 :     struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
     588             :     /** public version of PaintField, with selected access rights for the BrowserColumn
     589             :     */
     590          96 :     void            DoPaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
     591          96 :                     { PaintField( rDev, rRect, nColumnId ); }
     592             : 
     593             :     /** suggests a default width for a column containing a given text
     594             : 
     595             :         The width is calculated so that the text fits completely, plus som margin.
     596             :     */
     597             :     sal_uLong         GetDefaultColumnWidth( const OUString& _rText ) const;
     598             : 
     599             :     /** GetCellText returns the text at the given position
     600             :         @param  _nRow
     601             :             the number of the row
     602             :         @param  _nColId
     603             :             the ID of the column
     604             :         @return
     605             :             the text out of the cell
     606             :     */
     607             :     virtual OUString  GetCellText(long _nRow, sal_uInt16 _nColId) const;
     608             : 
     609             :     /** @return
     610             :             the current column count
     611             :     */
     612           0 :     sal_uInt16 GetColumnCount() const SAL_OVERRIDE { return ColCount(); }
     613             : 
     614             :     /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
     615             :         @param nEventId
     616             :             the event id
     617             :         @param rNewValue
     618             :             the new value
     619             :         @param rOldValue
     620             :             the old value
     621             :     */
     622             :     void commitBrowseBoxEvent(sal_Int16 nEventId,
     623             :             const css::uno::Any& rNewValue,
     624             :             const css::uno::Any& rOldValue);
     625             : 
     626             :     /** commitTableEvent commit the event at all listeners of the table
     627             :         @param nEventId
     628             :             the event id
     629             :         @param rNewValue
     630             :             the new value
     631             :         @param rOldValue
     632             :             the old value
     633             :     */
     634             :     void commitTableEvent(sal_Int16 nEventId,
     635             :             const css::uno::Any& rNewValue,
     636             :             const css::uno::Any& rOldValue);
     637             : 
     638             :     /** fires an AccessibleEvent relative to a header bar AccessibleContext
     639             : 
     640             :         @param nEventId
     641             :             the event id
     642             :         @param rNewValue
     643             :             the new value
     644             :         @param rOldValue
     645             :             the old value
     646             :     */
     647             :     void commitHeaderBarEvent(sal_Int16 nEventId,
     648             :             const css::uno::Any& rNewValue,
     649             :             const css::uno::Any& rOldValue,
     650             :             bool _bColumnHeaderBar
     651             :          );
     652             : 
     653             :     /** returns the Rectangle for either the column header bar ot the row header bar
     654             :         @param  _bIsColumnBar
     655             :             <TRUE/> when column header bar is used
     656             :         @param  _bOnScreen
     657             :             <TRUE/> when the rectangle should be calculated OnScreen
     658             :         @return
     659             :             the Rectangle
     660             :     */
     661             :     virtual Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen = true) SAL_OVERRIDE;
     662             : 
     663             :     /** calculates the Rectangle of the table
     664             :         @param  _bOnScreen
     665             :             <TRUE/> when the rectangle should be calculated OnScreen
     666             :         @return
     667             :             the Rectangle
     668             :     */
     669             :     virtual Rectangle calcTableRect(bool _bOnScreen = true) SAL_OVERRIDE;
     670             : 
     671             :     /**
     672             :         @param  _nRowId
     673             :             the current row
     674             :         @param  _nColId
     675             :             the column id
     676             :         @param  _bOnScreen
     677             :             <TRUE/> when the rectangle should be calculated OnScreen
     678             :         @return
     679             :             the Rectangle
     680             :     */
     681             :     virtual Rectangle GetFieldRectPixelAbs(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen = true) SAL_OVERRIDE;
     682             : 
     683             :     /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
     684             :     bool isAccessibleAlive( ) const;
     685             : 
     686             :     // ACCESSIBILITY ==========================================================
     687             : public:
     688             :     /** Creates and returns the accessible object of the whole BrowseBox. */
     689             :     virtual css::uno::Reference<
     690             :         css::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     691             : 
     692             :     // Children ---------------------------------------------------------------
     693             : 
     694             :     /** Creates the accessible object of a data table cell.
     695             :         @param nRow  The row index of the cell.
     696             :         @param nColumnId  The column pos of the cell.
     697             :         @return  The XAccessible interface of the specified cell. */
     698             :     virtual css::uno::Reference<
     699             :         css::accessibility::XAccessible >
     700             :     CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) SAL_OVERRIDE;
     701             : 
     702             :     /** Creates the accessible object of a row header.
     703             :         @param nRow  The row index of the header.
     704             :         @return  The XAccessible interface of the specified row header. */
     705             :     virtual css::uno::Reference<
     706             :         css::accessibility::XAccessible >
     707             :     CreateAccessibleRowHeader( sal_Int32 nRow ) SAL_OVERRIDE;
     708             : 
     709             :     /** Creates the accessible object of a column header.
     710             :         @param nColumnId  The column ID of the header.
     711             :         @return  The XAccessible interface of the specified column header. */
     712             :     virtual css::uno::Reference<
     713             :         css::accessibility::XAccessible >
     714             :     CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) SAL_OVERRIDE;
     715             : 
     716             :     /** @return  The count of additional controls of the control area. */
     717             :     virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE;
     718             : 
     719             :     /** Creates the accessible object of an additional control.
     720             :         @param nIndex  The 0-based index of the control.
     721             :         @return  The XAccessible interface of the specified control. */
     722             :     virtual css::uno::Reference<
     723             :         css::accessibility::XAccessible >
     724             :     CreateAccessibleControl( sal_Int32 nIndex ) SAL_OVERRIDE;
     725             : 
     726             :     // Conversions ------------------------------------------------------------
     727             : 
     728             :     /** Converts a point relative to the data window origin to a cell address.
     729             :         @param rnRow  Out-parameter that takes the row index.
     730             :         @param rnColumnId  Out-parameter that takes the column ID.
     731             :         @param rPoint  The position in pixels relative to the data window.
     732             :         @return <TRUE/>, if the point could be converted to a valid address. */
     733             :     virtual bool ConvertPointToCellAddress(
     734             :         sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint ) SAL_OVERRIDE;
     735             : 
     736             :     /** Converts a point relative to the row header bar origin to a row header
     737             :         index.
     738             :         @param rnRow  Out-parameter that takes the row index.
     739             :         @param rPoint  The position in pixels relative to the header bar.
     740             :         @return <TRUE/>, if the point could be converted to a valid index. */
     741             :     virtual bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint ) SAL_OVERRIDE;
     742             : 
     743             :     /** Converts a point relative to the column header bar origin to a column
     744             :         header index.
     745             :         @param rnColumnId  Out-parameter that takes the column ID.
     746             :         @param rPoint  The position in pixels relative to the header bar.
     747             :         @return <TRUE/>, if the point could be converted to a valid index. */
     748             :     virtual bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint ) SAL_OVERRIDE;
     749             : 
     750             :     /** Converts a point relative to the BrowseBox origin to the index of an
     751             :         existing control.
     752             :         @param rnRow  Out-parameter that takes the 0-based control index.
     753             :         @param rPoint  The position in pixels relative to the BrowseBox.
     754             :         @return <TRUE/>, if the point could be converted to a valid index. */
     755             :     virtual bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint ) SAL_OVERRIDE;
     756             : 
     757             :     // Object data and state --------------------------------------------------
     758             : 
     759             :     /** return the name of the specified object.
     760             :         @param  eObjType
     761             :             The type to ask for
     762             :         @param  _nPosition
     763             :             The position of a tablecell (index position), header bar  column/row cell
     764             :         @return
     765             :             The name of the specified object.
     766             :     */
     767             :     virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     768             : 
     769             :     /** return the description of the specified object.
     770             :         @param  eObjType
     771             :             The type to ask for
     772             :         @param  _nPosition
     773             :             The position of a tablecell (index position), header bar  column/row cell
     774             :         @return
     775             :             The description of the specified object.
     776             :     */
     777             :     virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
     778             : 
     779             :     /** @return  The header text of the specified row. */
     780             :     virtual OUString GetRowDescription( sal_Int32 nRow ) const SAL_OVERRIDE;
     781             : 
     782             :     /** @return  The header text of the specified column. */
     783             :     virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     784             : 
     785             :     /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
     786             :         the accessible object), depending on the specified object type. */
     787             :     virtual void FillAccessibleStateSet(
     788             :             ::utl::AccessibleStateSetHelper& rStateSet,
     789             :             ::svt::AccessibleBrowseBoxObjType eObjType ) const SAL_OVERRIDE;
     790             : 
     791             :     /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
     792             :         the accessible object). */
     793             :     virtual void FillAccessibleStateSetForCell(
     794             :             ::utl::AccessibleStateSetHelper& _rStateSet,
     795             :             sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     796             : 
     797             :     /** Sets focus to current cell of the data table. */
     798             :     virtual void GrabTableFocus() SAL_OVERRIDE;
     799             : 
     800             :     // IAccessibleTableProvider
     801             :     virtual sal_Int32               GetCurrRow() const SAL_OVERRIDE;
     802             :     virtual sal_uInt16              GetCurrColumn() const SAL_OVERRIDE;
     803             :     virtual bool                    HasRowHeader() const SAL_OVERRIDE;
     804             :     virtual bool                    IsCellFocusable() const SAL_OVERRIDE;
     805             :     virtual bool                    GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) SAL_OVERRIDE;
     806             :     virtual void                    SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) SAL_OVERRIDE;
     807             :     virtual bool                    IsColumnSelected( long _nColumn ) const SAL_OVERRIDE;
     808             :     virtual sal_Int32               GetSelectedRowCount() const SAL_OVERRIDE;
     809             :     virtual sal_Int32               GetSelectedColumnCount() const SAL_OVERRIDE;
     810             :     virtual void                    GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const SAL_OVERRIDE;
     811             :     virtual void                    GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const SAL_OVERRIDE;
     812             :     virtual bool                    IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     813             :     virtual OUString                GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const SAL_OVERRIDE;
     814             :     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) SAL_OVERRIDE;
     815             :     virtual Rectangle               GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const SAL_OVERRIDE;
     816             :     virtual void                    GrabFocus() SAL_OVERRIDE;
     817             :     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) SAL_OVERRIDE;
     818             :     virtual vcl::Window*                 GetAccessibleParentWindow() const SAL_OVERRIDE;
     819             :     virtual vcl::Window*                 GetWindowInstance() SAL_OVERRIDE;
     820             : 
     821             : private:
     822             :     // the following declares some Window/OutputDevice methods private. This happened in the course
     823             :     // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
     824             :     // upper module, you should investigate whether you really wanted to call base class methods,
     825             :     // or the versions at this class. In the latter case, use the renamed versions above.
     826             : 
     827             :     // Set/GetLineColor - superseded by Set/GetGridLineColor
     828             :     using OutputDevice::SetLineColor;
     829             :     using OutputDevice::GetLineColor;
     830             : 
     831             :     // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
     832             :     // and not doing as intended
     833             :     using Window::ToTop;
     834             : };
     835             : 
     836             : 
     837           0 : inline const DataFlavorExVector& BrowseBox::GetDataFlavors() const
     838             : {
     839           0 :     return *reinterpret_cast<DataFlavorExVector*>(implGetDataFlavors());
     840             : }
     841             : 
     842             : #endif
     843             : 
     844             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10