LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svtools - brwbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 38 0.0 %
Date: 2012-12-27 Functions: 0 30 0.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 _SVX_BRWBOX_HXX
      20             : #define _SVX_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             :     Window*             pWin;
     132             :     long                nRow;
     133             :     Rectangle           aRect;
     134             :     sal_uInt16              nCol;
     135             :     sal_uInt16              nColId;
     136             : 
     137             : public:
     138             :                         BrowseEvent();
     139             :                         BrowseEvent( Window* pWindow,
     140             :                                      long nAbsRow,
     141             :                                      sal_uInt16 nColumn, sal_uInt16 nColumnId,
     142             :                                      const Rectangle& rRect );
     143             : 
     144           0 :     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( 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             :     #define NO_CURSOR_HIDE      0
     214             :     #define HARD_CURSOR_HIDE    1
     215             :     #define SMART_CURSOR_HIDE   2
     216             : 
     217             :     friend class BrowserDataWin;
     218             :     friend class ::svt::BrowseBoxImpl;
     219             : 
     220             : #ifdef DBG_UTIL
     221             :     friend const char* BrowseBoxCheckInvariants( const void * pVoid );
     222             : #endif
     223             : 
     224             : public:
     225             :     static const sal_uInt16 HandleColumnId = 0;
     226             : 
     227             : private:
     228             :     Window*         pDataWin;       // window to display data rows
     229             :     ScrollBar*      pVScroll;       // vertical scrollbar
     230             :     ScrollBar       aHScroll;       // horizontal scrollbar
     231             : 
     232             :     long            nDataRowHeight; // height of a single data-row
     233             :     sal_uInt16          nTitleLines;    // number of lines in title row
     234             :     sal_uLong           nControlAreaWidth; // width of fixed area beneeth hscroll
     235             :     sal_Bool            bThumbDragging; // handle thumb dragging
     236             :     sal_Bool            bColumnCursor;  // single columns and fields selectable
     237             :     sal_Bool            bMultiSelection;// allow multiple selected rows
     238             :     sal_Bool            bKeepHighlight; // don't hide selection on LoseFocus
     239             : 
     240             :     sal_Bool            bHLines;        // draw lines between rows
     241             :     sal_Bool            bVLines;        // draw lines between columns
     242             :     sal_Bool            bHDots;         // draw lines between rows dotted
     243             :     sal_Bool            bVDots;         // draw lines between columns dotted
     244             :     Color           aGridLineColor;     // color for lines, default dark grey
     245             :     sal_Bool            bBootstrapped;  // child windows resized etc.
     246             :     long            nTopRow;        // no. of first visible row (0...)
     247             :     long            nCurRow;        // no. of row with cursor
     248             :     long            nRowCount;      // total number of rows in model
     249             :     sal_uInt16          nFirstCol;      // no. of first visible scrollable column
     250             :     sal_uInt16          nCurColId;      // column id of cursor
     251             : 
     252             :     sal_Bool            bSelecting;
     253             :     sal_Bool            bRowDividerDrag;
     254             :     sal_Bool            bHit;
     255             :     sal_Bool            mbInteractiveRowHeight;
     256             :     Point           a1stPoint;
     257             :     Point           a2ndPoint;
     258             : 
     259             :     long            nResizeX;       // mouse position at start of resizing
     260             :     long            nMinResizeX;    // never drag more left
     261             :     long            nDragX;         // last dragged column (MouseMove)
     262             :     sal_uInt16          nResizeCol;     // resize this column in MouseMove
     263             :     sal_Bool            bResizing;      // mouse captured for column resizing
     264             : 
     265             :     sal_Bool            bSelect;        // select or deselect
     266             :     sal_Bool            bSelectionIsVisible; // depending on focus
     267             :     sal_Bool            bScrolling;     // hidden cursor while scrolling
     268             :     sal_Bool            bNotToggleSel;  // set while in ToggleSelection() etc.
     269             :     sal_Bool            bHasFocus;      // set/unset in Get/LoseFocus
     270             :     sal_Bool            bHideSelect;    // hide selection (highlight)
     271             :     sal_Bool            bHideCursor;    // hide cursor (frame)
     272             :     Range           aSelRange;      // for selection expansion
     273             : 
     274             :     BrowserColumns* pCols;          // array of column-descriptions
     275             :     union
     276             :     {
     277             :         MultiSelection* pSel;       // selected rows for multi-selection
     278             :         long            nSel;       // selected row for single-selection
     279             :     }               uRow;
     280             :     MultiSelection* pColSel;        // selected column-ids
     281             : 
     282             :     ::std::auto_ptr< ::svt::BrowseBoxImpl >  m_pImpl;       // impl structure of the BrowseBox object
     283             : 
     284             :     sal_Bool            m_bFocusOnlyCursor; // hide cursor if we don't have the focus
     285             :     Color           m_aCursorColor;     // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
     286             :     BrowserMode     m_nCurrentMode;     // last argument of SetMode (redundant, as our other members represent the current settings, too)
     287             : 
     288             : private:
     289             :     SVT_DLLPRIVATE void            ConstructImpl(BrowserMode nMode);
     290             :     SVT_DLLPRIVATE void            ExpandRowSelection( const BrowserMouseEvent& rEvt );
     291             :     SVT_DLLPRIVATE void            ToggleSelection( sal_Bool bForce = sal_False );
     292             : 
     293             :     SVT_DLLPRIVATE void            UpdateScrollbars();
     294             :     SVT_DLLPRIVATE void            AutoSizeLastColumn();
     295             : 
     296             :     SVT_DLLPRIVATE long            ImpGetDataRowHeight() const;
     297             :     SVT_DLLPRIVATE Rectangle       ImplFieldRectPixel( long nRow, sal_uInt16 nColId ) const;
     298             :     SVT_DLLPRIVATE sal_uInt16          FrozenColCount() const;
     299             : 
     300             :     SVT_DLLPRIVATE void            ColumnInserted( sal_uInt16 nPos );
     301             : 
     302             :     DECL_DLLPRIVATE_LINK(       ScrollHdl, ScrollBar * );
     303             :     DECL_DLLPRIVATE_LINK(       EndScrollHdl, void * );
     304             :     DECL_DLLPRIVATE_LINK(       StartDragHdl, HeaderBar * );
     305             : 
     306             :     SVT_DLLPRIVATE long            GetFrozenWidth() const;
     307             : //#endif
     308             : 
     309             :     sal_Bool            GoToRow(long nRow, sal_Bool bRowColMove, sal_Bool bDoNotModifySelection = sal_False );
     310             : 
     311             :     sal_Bool            GoToColumnId( sal_uInt16 nColId, sal_Bool bMakeVisible, sal_Bool bRowColMove = sal_False);
     312             :     void            SelectColumnPos( sal_uInt16 nCol, sal_Bool _bSelect, sal_Bool bMakeVisible);
     313           0 :     void            SelectColumnId( sal_uInt16 nColId, sal_Bool _bSelect, sal_Bool bMakeVisible)
     314           0 :                         { SelectColumnPos( GetColumnPos(nColId), _bSelect, bMakeVisible); }
     315             : 
     316             :     void            ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_Bool _bForeignDevice, sal_Bool _bDrawSelections);
     317             : 
     318           0 :     sal_Bool            PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor && !HasFocus(); }
     319             : 
     320             :     sal_uInt16          ToggleSelectedColumn();
     321             :     void            SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId);
     322             : 
     323             : protected:
     324             :     /// retrieves the XAccessible implementation associated with the BrowseBox instance
     325             :     ::svt::IAccessibleFactory&   getAccessibleFactory();
     326             : 
     327             : protected:
     328             :     sal_uInt16          ColCount() const;
     329             : 
     330             :     // software plug for database access
     331             :     // Der RowCount wird jetzt intern automatisch gezaehlt
     332             :     // (ueber RowInserted und RowRemoved), daher ist das Ueberladen
     333             :     // dieser Methode ueberfluessig!
     334             : public:
     335             :     virtual long    GetRowCount() const;
     336             : 
     337             : protected:
     338             :     // fuer Anzeige im VScrollBar z.B. auf "?" oder setzen
     339             :     void            SetRealRowCount( const String &rRealRowCount );
     340             : 
     341             :     // Return Value muss immer sal_True sein - SeekRow *muss* klappen!
     342             :     // (sonst ASSERT) MI: wer hat das eingebaut? Das darf nicht so sein!
     343             : 
     344             :     /** seeks for the given row position
     345             :         @param nRow
     346             :             nRow starts at 0
     347             :     */
     348             :     virtual sal_Bool SeekRow( long nRow ) = 0;
     349             :     virtual void    DrawCursor();
     350             :     virtual void    PaintRow( OutputDevice &rDev, const Rectangle &rRect );
     351             :     virtual void    PaintData( Window& rWin, const Rectangle& rRect );
     352             :     virtual void    PaintField( OutputDevice& rDev, const Rectangle& rRect,
     353             :                                 sal_uInt16 nColumnId ) const = 0;
     354             :     // Benachrichtigung an die abgeleitete Klasse, dass sich der sichtbare
     355             :     // Bereich von Rows geaendert hat. Aus dieser Methode heraus darf
     356             :     // die abgeleitete Klasse Aenderungen des Model mit Hilfe der Methoden
     357             :     // RowInserted und RowRemoved bekanntgeben. Mit sich daraus ergebenden
     358             :     // neuen Zustand wird anschliessend ein Paint veranlasst (und entsprechend
     359             :     // SeekRow etc. gerufen).
     360             :     //
     361             :     // Parameter: nNewTopRow: Nr. der neuen TopRow (kann von VisibleRowsChanged
     362             :     // durch Aufruf von RowInserted und RowDeleted noch veraendert werden).
     363             :     // nNumRows: Anzahl der sichtbaren Rows (auch eine teilweise sichtbare Row
     364             :     // wird mitgezaehlt).
     365             :     //
     366             :     // Moegliche Ursachen fuer die Aenderung des sichtbaren Bereiches:
     367             :     // - Vor dem sichtbaren Bereich sind Rows eingefuegt oder geloescht worden,
     368             :     //   dadurch aendert sich nur die Numerierung der sichtbaren Rows
     369             :     // - Scrollen (und daraus resultierend eine andere erste sichtbare Row)
     370             :     // - Resize des Fensters
     371             :     virtual void    VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
     372             : 
     373             :     // Anzahl sichtbarer Rows in dem Fenster (inkl. "angeschnittener" Rows)
     374           0 :     sal_uInt16          GetVisibleRows()
     375           0 :                         { return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
     376           0 :     long            GetTopRow() { return nTopRow; }
     377           0 :     sal_uInt16          GetFirstVisibleColNumber() const { return nFirstCol; }
     378             : 
     379             :     // Focus-Rect ein-/ausschalten
     380             :     void            DoShowCursor( const char *pWhoLog );
     381             :     void            DoHideCursor( const char *pWhoLog );
     382             :     short           GetCursorHideCount() const;
     383             : 
     384             :     virtual BrowserHeader*  CreateHeaderBar( BrowseBox* pParent );
     385             : 
     386             :     // HACK(virtuelles Create wird im Ctor nicht gerufen)
     387             :     void            SetHeaderBar( BrowserHeader* );
     388             : 
     389             :     long            CalcReverseZoom(long nVal);
     390             : 
     391             :     inline const DataFlavorExVector&
     392             :                     GetDataFlavors() const;
     393             : 
     394             :     sal_Bool        IsDropFormatSupported( SotFormatStringId nFormat );     // need this because the base class' IsDropFormatSupported is not const ...
     395             :     sal_Bool        IsDropFormatSupported( SotFormatStringId nFormat ) const;
     396             : 
     397             :     sal_Bool        IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor );        // need this because the base class' IsDropFormatSupported is not const ...
     398             :     sal_Bool        IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor ) const;
     399             : 
     400             : private:
     401             :     void*           implGetDataFlavors() const;
     402             :         // with this we can make GetDataFlavors() inline, which is strongly needed as SVTOOLS does not export
     403             :         // any sysbols containing an "_STL", so a non-inlined method would not be exported ....
     404             : 
     405             : protected:
     406             :     // callbacks for the data window
     407             :     virtual void    ImplStartTracking();
     408             :     virtual void    ImplTracking();
     409             :     virtual void    ImplEndTracking();
     410             : 
     411             : public:
     412             :                     BrowseBox( Window* pParent, WinBits nBits = 0,
     413             :                                BrowserMode nMode = 0 );
     414             :                     BrowseBox( Window* pParent, const ResId& rId,
     415             :                                BrowserMode nMode = 0 );
     416             :                     ~BrowseBox();
     417             : 
     418             :     // ererbte ueberladene Handler
     419             :     virtual void    StateChanged( StateChangedType nStateChange );
     420             :     virtual void    MouseButtonDown( const MouseEvent& rEvt );
     421             :     virtual void    MouseMove( const MouseEvent& rEvt );
     422             :     virtual void    MouseButtonUp( const MouseEvent& rEvt );
     423             :     virtual void    KeyInput( const KeyEvent& rEvt );
     424             :     virtual void    LoseFocus();
     425             :     virtual void    GetFocus();
     426             :     virtual void    Resize();
     427             :     virtual void    Paint( const Rectangle& rRect );
     428             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
     429             :     virtual void    Command( const CommandEvent& rEvt );
     430             :     virtual void    StartDrag( sal_Int8 _nAction, const Point& _rPosPixel );
     431             : 
     432             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );     // will forward everything got to the second AcceptDrop method
     433             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );   // will forward everything got to the second ExecuteDrop method
     434             : 
     435             :     virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
     436             :     virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
     437             : 
     438             :     // neue Handler
     439             :     virtual void    MouseButtonDown( const BrowserMouseEvent& rEvt );
     440             :     virtual void    MouseMove( const BrowserMouseEvent& rEvt );
     441             :     virtual void    MouseButtonUp( const BrowserMouseEvent& rEvt );
     442             :     virtual void    StartScroll();
     443             :     virtual void    EndScroll();
     444             :     virtual void    Select();
     445             :     virtual void    DoubleClick( const BrowserMouseEvent& rEvt );
     446             :     virtual sal_Bool    IsCursorMoveAllowed( long nNewRow, sal_uInt16 nNewColId ) const;
     447             :     virtual void    CursorMoved();
     448             :     virtual void    ColumnMoved( sal_uInt16 nColId );
     449             :     virtual void    ColumnResized( sal_uInt16 nColId );
     450             :     virtual long    QueryColumnResize( sal_uInt16 nColId, long nWidth );
     451             :     /// called when the row height has been changed interactively
     452             :     virtual void    RowHeightChanged();
     453             :     virtual long    QueryMinimumRowHeight();
     454             : 
     455             :     // Window-Control (pass to DataWindow)
     456             :     void            SetUpdateMode( sal_Bool bUpdate );
     457             :     sal_Bool            GetUpdateMode() const;
     458             : 
     459             :     // map-mode and font control
     460             :     void            SetFont( const Font& rNewFont );
     461           0 :     const Font&     GetFont() const { return pDataWin->GetFont(); }
     462           0 :     void            SetTitleFont( const Font& rNewFont )
     463           0 :                         { Control::SetFont( rNewFont ); }
     464             :     const Font&     GetTitleFont() const { return Control::GetFont(); }
     465             : 
     466             :     // color for line painting
     467           0 :     void            SetGridLineColor(const Color& rColor) {aGridLineColor = rColor;}
     468             :     const Color&    GetGridLineColor() const {return aGridLineColor;}
     469             : 
     470             :     // inserting, changing, removing and freezing of columns
     471             :     void            InsertHandleColumn( sal_uLong nWidth );
     472             :     void            InsertDataColumn( sal_uInt16 nItemId, const XubString& rText,
     473             :                                     long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE,
     474             :                                     sal_uInt16 nPos = HEADERBAR_APPEND );
     475             :     void            SetColumnTitle( sal_uInt16 nColumnId, const String &rTitle );
     476             :     void            SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
     477             :     void            SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
     478             :     void            FreezeColumn( sal_uInt16 nColumnId, sal_Bool bFreeze = sal_True );
     479             :     void            UnfreezeColumns();
     480             :     void            RemoveColumn( sal_uInt16 nColumnId );
     481             :     void            RemoveColumns();
     482             : 
     483             :     // control of title and data row height
     484             :     void            SetDataRowHeight( long nPixel );
     485             :     long            GetDataRowHeight() const;
     486             :     void            SetTitleLines( sal_uInt16 nLines );
     487             :     sal_uInt16          GetTitleLines() const { return nTitleLines; }
     488             :     virtual long    GetTitleHeight() const;
     489             : 
     490             :     // access to dynamic values of cursor row
     491             :     String          GetColumnTitle( sal_uInt16 nColumnId ) const;
     492             :     Rectangle       GetFieldRect( sal_uInt16 nColumnId ) const;
     493             :     sal_uLong           GetColumnWidth( sal_uInt16 nColumnId ) const;
     494             :     sal_uInt16          GetColumnId( sal_uInt16 nPos ) const;
     495             :     sal_uInt16          GetColumnPos( sal_uInt16 nColumnId ) const;
     496             :     sal_Bool            IsFrozen( sal_uInt16 nColumnId ) const;
     497             : 
     498             :     // movement of visible area
     499             :     void            ResetScroll();
     500             :     long            ScrollColumns( long nColumns );
     501             :     long            ScrollRows( long nRows );
     502             :     sal_Bool            MakeFieldVisible( long nRow, sal_uInt16 nColId, sal_Bool bComplete = sal_False );
     503             : 
     504             :     // access and movement of cursor
     505           0 :     long            GetCurRow() const { return nCurRow; }
     506           0 :     sal_uInt16          GetCurColumnId() const { return nCurColId; }
     507             :     sal_Bool            GoToRow( long nRow );
     508             :     sal_Bool            GoToColumnId( sal_uInt16 nColId );
     509             :     sal_Bool            GoToRowColumnId( long nRow, sal_uInt16 nColId );
     510             : 
     511             :     // selections
     512             :     virtual void    SetNoSelection();
     513             :     virtual void    SelectAll();
     514             :     virtual void    SelectRow( long nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True );
     515           0 :     void            SelectColumnPos( sal_uInt16 nCol, sal_Bool _bSelect = sal_True )
     516           0 :                         { SelectColumnPos( nCol, _bSelect, sal_True); }
     517           0 :     void            SelectColumnId( sal_uInt16 nColId, sal_Bool _bSelect = sal_True )
     518           0 :                         { SelectColumnPos( GetColumnPos(nColId), _bSelect, sal_True); }
     519             :     long            GetSelectRowCount() const;
     520             :     sal_uInt16          GetSelectColumnCount() const;
     521             :     virtual bool    IsRowSelected( long nRow ) const;
     522             :     bool            IsColumnSelected( sal_uInt16 nColumnId ) const;
     523             :     long            FirstSelectedRow( sal_Bool bInverse = sal_False );
     524             :     long            LastSelectedRow();
     525             :     long            NextSelectedRow();
     526           0 :     const MultiSelection* GetColumnSelection() const { return pColSel; }
     527           0 :     const MultiSelection* GetSelection() const
     528           0 :                     { return bMultiSelection ? uRow.pSel : 0; }
     529             : 
     530             :     long            FirstSelectedColumn( ) const;
     531             : 
     532           0 :     sal_Bool            IsResizing() const { return bResizing; }
     533             : 
     534             :     // access to positions of fields, column and rows
     535           0 :     Window&         GetDataWindow() const { return *pDataWin; }
     536             :     Rectangle       GetRowRectPixel( long nRow,
     537             :                                      sal_Bool bRelToBrowser = sal_True ) const;
     538             :     Rectangle       GetFieldRectPixel( long nRow, sal_uInt16 nColId,
     539             :                                        sal_Bool bRelToBrowser = sal_True) const;
     540             :     sal_Bool            IsFieldVisible( long nRow, sal_uInt16 nColId,
     541             :                                     sal_Bool bComplete = sal_False ) const;
     542             :     long            GetRowAtYPosPixel( long nY,
     543             :                                         sal_Bool bRelToBrowser = sal_True  ) const;
     544             :     sal_uInt16          GetColumnAtXPosPixel( long nX,
     545             :                                           sal_Bool bRelToBrowser = sal_True  ) const;
     546             : 
     547             :     // invalidations
     548             :     void            Clear();
     549             :     void            RowRemoved( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True );
     550             :     void            RowModified( long nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
     551             :     void            RowInserted( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True, sal_Bool bKeepSelection = sal_False );
     552             : 
     553             :     // miscellanous
     554             :     void            ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX );
     555             :     Rectangle       GetControlArea() const;
     556             :     sal_Bool            ProcessKey( const KeyEvent& rEvt );
     557             :     void            Dispatch( sal_uInt16 nId );
     558             :     void            SetMode( BrowserMode nMode = 0 );
     559           0 :     BrowserMode     GetMode( ) const { return m_nCurrentMode; }
     560             : 
     561             :     void            SetCursorColor(const Color& _rCol);
     562             :     Color           GetCursorColor() const { return m_aCursorColor; }
     563             :     void            ResetSelecting() { bSelecting = sal_False; }
     564             : 
     565             :     /** specifies that the user is allowed to interactively change the height of a row,
     566             :         by simply dragging an arbitrary row separator.
     567             : 
     568             :         Note that this works only if there's a handle column, since only in this case,
     569             :         there *is* something for the user to click onto
     570             :     */
     571           0 :     void            EnableInteractiveRowHeight( sal_Bool _bEnable = sal_True ) { mbInteractiveRowHeight = _bEnable; }
     572           0 :     sal_Bool            IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
     573             : 
     574             :     /// access to selected methods, to be granted to the BrowserColumn
     575           0 :     struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
     576             :     /** public version of PaintField, with selected access rights for the BrowserColumn
     577             :     */
     578           0 :     void            DoPaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
     579           0 :                     { PaintField( rDev, rRect, nColumnId ); }
     580             : 
     581             :     /** suggests a default width for a column containing a given text
     582             : 
     583             :         The width is calculated so that the text fits completely, plus som margin.
     584             :     */
     585             :     sal_uLong           GetDefaultColumnWidth( const String& _rText ) const;
     586             : 
     587             :     /** GetCellText returns the text at the given position
     588             :         @param  _nRow
     589             :             the number of the row
     590             :         @param  _nColId
     591             :             the ID of the column
     592             :         @return
     593             :             the text out of the cell
     594             :     */
     595             :     virtual String  GetCellText(long _nRow, sal_uInt16 _nColId) const;
     596             : 
     597             :     /** @return
     598             :             the current column count
     599             :     */
     600           0 :     sal_uInt16 GetColumnCount() const { return ColCount(); }
     601             : 
     602             :     /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
     603             :         @param nEventId
     604             :             the event id
     605             :         @param rNewValue
     606             :             the new value
     607             :         @param rOldValue
     608             :             the old value
     609             :     */
     610             :     void commitBrowseBoxEvent(sal_Int16 nEventId,
     611             :             const ::com::sun::star::uno::Any& rNewValue,
     612             :             const ::com::sun::star::uno::Any& rOldValue);
     613             : 
     614             :     /** commitTableEvent commit the event at all listeners of the table
     615             :         @param nEventId
     616             :             the event id
     617             :         @param rNewValue
     618             :             the new value
     619             :         @param rOldValue
     620             :             the old value
     621             :     */
     622             :     void commitTableEvent(sal_Int16 nEventId,
     623             :             const ::com::sun::star::uno::Any& rNewValue,
     624             :             const ::com::sun::star::uno::Any& rOldValue);
     625             : 
     626             :     /** fires an AccessibleEvent relative to a header bar AccessibleContext
     627             : 
     628             :         @param nEventId
     629             :             the event id
     630             :         @param rNewValue
     631             :             the new value
     632             :         @param rOldValue
     633             :             the old value
     634             :     */
     635             :     void commitHeaderBarEvent(sal_Int16 nEventId,
     636             :             const ::com::sun::star::uno::Any& rNewValue,
     637             :             const ::com::sun::star::uno::Any& rOldValue,
     638             :             sal_Bool _bColumnHeaderBar
     639             :          );
     640             : 
     641             :     /** returns the Rectangle for either the column header bar ot the row header bar
     642             :         @param  _bIsColumnBar
     643             :             <TRUE/> when column header bar is used
     644             :         @param  _bOnScreen
     645             :             <TRUE/> when the rectangle should be calculated OnScreen
     646             :         @return
     647             :             the Rectangle
     648             :     */
     649             :     virtual Rectangle calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen = sal_True);
     650             : 
     651             :     /** calculates the Rectangle of the table
     652             :         @param  _bOnScreen
     653             :             <TRUE/> when the rectangle should be calculated OnScreen
     654             :         @return
     655             :             the Rectangle
     656             :     */
     657             :     virtual Rectangle calcTableRect(sal_Bool _bOnScreen = sal_True);
     658             : 
     659             :     /**
     660             :         @param  _nRowId
     661             :             the current row
     662             :         @param  _nColId
     663             :             teh column id
     664             :         @param  _bOnScreen
     665             :             <TRUE/> when the rectangle should be calculated OnScreen
     666             :         @return
     667             :             the Rectangle
     668             :     */
     669             :     virtual Rectangle GetFieldRectPixelAbs(sal_Int32 _nRowId,sal_uInt16 _nColId, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True);
     670             : 
     671             :     /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
     672             :     sal_Bool isAccessibleAlive( ) const;
     673             : 
     674             :     // ACCESSIBILITY ==========================================================
     675             : public:
     676             :     /** Creates and returns the accessible object of the whole BrowseBox. */
     677             :     virtual ::com::sun::star::uno::Reference<
     678             :         ::com::sun::star::accessibility::XAccessible > CreateAccessible();
     679             : 
     680             :     // Children ---------------------------------------------------------------
     681             : 
     682             :     /** Creates the accessible object of a data table cell.
     683             :         @param nRow  The row index of the cell.
     684             :         @param nColumnId  The column pos of the cell.
     685             :         @return  The XAccessible interface of the specified cell. */
     686             :     virtual ::com::sun::star::uno::Reference<
     687             :         ::com::sun::star::accessibility::XAccessible >
     688             :     CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos );
     689             : 
     690             :     /** Creates the accessible object of a row header.
     691             :         @param nRow  The row index of the header.
     692             :         @return  The XAccessible interface of the specified row header. */
     693             :     virtual ::com::sun::star::uno::Reference<
     694             :         ::com::sun::star::accessibility::XAccessible >
     695             :     CreateAccessibleRowHeader( sal_Int32 nRow );
     696             : 
     697             :     /** Creates the accessible object of a column header.
     698             :         @param nColumnId  The column ID of the header.
     699             :         @return  The XAccessible interface of the specified column header. */
     700             :     virtual ::com::sun::star::uno::Reference<
     701             :         ::com::sun::star::accessibility::XAccessible >
     702             :     CreateAccessibleColumnHeader( sal_uInt16 nColumnPos );
     703             : 
     704             :     /** @return  The count of additional controls of the control area. */
     705             :     virtual sal_Int32 GetAccessibleControlCount() const;
     706             : 
     707             :     /** Creates the accessible object of an additional control.
     708             :         @param nIndex  The 0-based index of the control.
     709             :         @return  The XAccessible interface of the specified control. */
     710             :     virtual ::com::sun::star::uno::Reference<
     711             :         ::com::sun::star::accessibility::XAccessible >
     712             :     CreateAccessibleControl( sal_Int32 nIndex );
     713             : 
     714             :     // Conversions ------------------------------------------------------------
     715             : 
     716             :     /** Converts a point relative to the data window origin to a cell address.
     717             :         @param rnRow  Out-paramater that takes the row index.
     718             :         @param rnColumnId  Out-paramater that takes the column ID.
     719             :         @param rPoint  The position in pixels relative to the data window.
     720             :         @return <TRUE/>, if the point could be converted to a valid address. */
     721             :     virtual sal_Bool ConvertPointToCellAddress(
     722             :         sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint );
     723             : 
     724             :     /** Converts a point relative to the row header bar origin to a row header
     725             :         index.
     726             :         @param rnRow  Out-paramater that takes the row index.
     727             :         @param rPoint  The position in pixels relative to the header bar.
     728             :         @return <TRUE/>, if the point could be converted to a valid index. */
     729             :     virtual sal_Bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint );
     730             : 
     731             :     /** Converts a point relative to the column header bar origin to a column
     732             :         header index.
     733             :         @param rnColumnId  Out-paramater that takes the column ID.
     734             :         @param rPoint  The position in pixels relative to the header bar.
     735             :         @return <TRUE/>, if the point could be converted to a valid index. */
     736             :     virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint );
     737             : 
     738             :     /** Converts a point relative to the BrowseBox origin to the index of an
     739             :         existing control.
     740             :         @param rnRow  Out-paramater that takes the 0-based control index.
     741             :         @param rPoint  The position in pixels relative to the BrowseBox.
     742             :         @return <TRUE/>, if the point could be converted to a valid index. */
     743             :     virtual sal_Bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint );
     744             : 
     745             :     // Object data and state --------------------------------------------------
     746             : 
     747             :     /** return the name of the specified object.
     748             :         @param  eObjType
     749             :             The type to ask for
     750             :         @param  _nPosition
     751             :             The position of a tablecell (index position), header bar  colum/row cell
     752             :         @return
     753             :             The name of the specified object.
     754             :     */
     755             :     virtual ::rtl::OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
     756             : 
     757             :     /** return the description 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  colum/row cell
     762             :         @return
     763             :             The description of the specified object.
     764             :     */
     765             :     virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
     766             : 
     767             :     /** @return  The header text of the specified row. */
     768             :     virtual ::rtl::OUString GetRowDescription( sal_Int32 nRow ) const;
     769             : 
     770             :     /** @return  The header text of the specified column. */
     771             :     virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumn ) const;
     772             : 
     773             :     /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
     774             :         the accessible object), depending on the specified object type. */
     775             :     virtual void FillAccessibleStateSet(
     776             :             ::utl::AccessibleStateSetHelper& rStateSet,
     777             :             ::svt::AccessibleBrowseBoxObjType eObjType ) const;
     778             : 
     779             :     /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
     780             :         the accessible object). */
     781             :     virtual void FillAccessibleStateSetForCell(
     782             :             ::utl::AccessibleStateSetHelper& _rStateSet,
     783             :             sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
     784             : 
     785             :     /** Sets focus to current cell of the data table. */
     786             :     virtual void GrabTableFocus();
     787             : 
     788             :     // IAccessibleTableProvider
     789             :     virtual sal_Int32               GetCurrRow() const;
     790             :     virtual sal_uInt16              GetCurrColumn() const;
     791             :     virtual sal_Bool                HasRowHeader() const;
     792             :     virtual sal_Bool                IsCellFocusable() const;
     793             :     virtual sal_Bool                    GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
     794             :     virtual void                    SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect = sal_True );
     795             :     virtual sal_Bool                IsColumnSelected( long _nColumn ) const;
     796             :     virtual sal_Int32               GetSelectedRowCount() const;
     797             :     virtual sal_Int32               GetSelectedColumnCount() const;
     798             :     virtual void                    GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& _rRows ) const;
     799             :     virtual void                    GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& _rColumns ) const;
     800             :     virtual sal_Bool                IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
     801             :     virtual String                  GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const;
     802             :     virtual sal_Bool                    GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
     803             :     virtual Rectangle               GetWindowExtentsRelative( Window *pRelativeWindow ) const;
     804             :     virtual void                    GrabFocus();
     805             :     virtual XACC                    GetAccessible( sal_Bool bCreate = sal_True );
     806             :     virtual Window*                 GetAccessibleParentWindow() const;
     807             :     virtual Window*                 GetWindowInstance();
     808             : 
     809             : private:
     810             :     // the following declares some Window/OutputDevice methods private. This happened in the course
     811             :     // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
     812             :     // upper module, you should investigate whether you really wanted to call base class methods,
     813             :     // or the versions at this class. In the latter case, use the renamed versions above.
     814             : 
     815             :     // Set/GetLineColor - superseded by Set/GetGridLineColor
     816             :     using OutputDevice::SetLineColor;
     817             :     using OutputDevice::GetLineColor;
     818             : 
     819             :     // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
     820             :     // and not doing as intended
     821             :     using Window::ToTop;
     822             : };
     823             : 
     824             : //-------------------------------------------------------------------
     825           0 : inline const DataFlavorExVector& BrowseBox::GetDataFlavors() const
     826             : {
     827           0 :     return *reinterpret_cast<DataFlavorExVector*>(implGetDataFlavors());
     828             : }
     829             : 
     830             : #endif
     831             : 
     832             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10