LCOV - code coverage report
Current view: top level - include/svtools - svtabbx.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 8 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 6 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 INCLUDED_SVTOOLS_SVTABBX_HXX
      20             : #define INCLUDED_SVTOOLS_SVTABBX_HXX
      21             : 
      22             : #include <svtools/svtdllapi.h>
      23             : #include <svtools/treelistbox.hxx>
      24             : #include <svtools/accessibletableprovider.hxx>
      25             : 
      26             : #include <vector>
      27             : 
      28             : enum SvTabJustify
      29             : {
      30             :     AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT),
      31             :     AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT),
      32             :     AdjustCenter = static_cast<int>(SvLBoxTabFlags::ADJUST_CENTER),
      33             :     AdjustNumeric = static_cast<int>(SvLBoxTabFlags::ADJUST_NUMERIC)
      34             : };
      35             : 
      36           0 : struct TabListBoxEventData
      37             : {
      38             :     SvTreeListEntry*    m_pEntry;
      39             :     sal_uInt16          m_nColumn;
      40             :     OUString            m_sOldText;
      41             : 
      42           0 :     TabListBoxEventData( SvTreeListEntry* pEntry, sal_uInt16 nColumn, const OUString& rOldText ) :
      43           0 :         m_pEntry( pEntry ), m_nColumn( nColumn ), m_sOldText( rOldText ) {}
      44             : };
      45             : 
      46             : class SVT_DLLPUBLIC SvTabListBox : public SvTreeListBox
      47             : {
      48             : private:
      49             :     SvLBoxTab*                  pTabList;
      50             :     sal_uInt16                  nTabCount;
      51             :     OUString                    aCurEntry;
      52             : 
      53             : protected:
      54             :     SvTreeListEntry*                pViewParent;
      55             : 
      56             :     static OUString             GetToken( const OUString &sStr, sal_Int32 &nIndex );
      57             : 
      58             :     virtual void                SetTabs() SAL_OVERRIDE;
      59             :     virtual void                InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind) SAL_OVERRIDE;
      60             : 
      61             :     OUString                    GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const;
      62             :     SvTreeListEntry*            GetEntryOnPos( sal_uLong _nEntryPos ) const;
      63             :     SvTreeListEntry*            GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const;
      64             : 
      65             : public:
      66             :     SvTabListBox( vcl::Window* pParent, WinBits = WB_BORDER );
      67             :     virtual ~SvTabListBox();
      68             :     virtual void dispose() SAL_OVERRIDE;
      69             :     void            SetTabs(const long* pTabs, MapUnit = MAP_APPFONT);
      70           0 :     sal_uInt16      TabCount() const { return (sal_uInt16)nTabCount; }
      71             :     using SvTreeListBox::GetTab;
      72             :     long            GetTab( sal_uInt16 nTab ) const;
      73             :     void            SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT );
      74             :     long            GetLogicTab( sal_uInt16 nTab );
      75             : 
      76             :     virtual SvTreeListEntry*    InsertEntry( const OUString& rText, SvTreeListEntry* pParent = 0,
      77             :                                          bool bChildrenOnDemand = false,
      78             :                                          sal_uLong nPos=TREELIST_APPEND, void* pUserData = 0,
      79             :                                          SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox ) SAL_OVERRIDE;
      80             : 
      81             :     virtual SvTreeListEntry*    InsertEntry( const OUString& rText,
      82             :                                          const Image& rExpandedEntryBmp,
      83             :                                          const Image& rCollapsedEntryBmp,
      84             :                                          SvTreeListEntry* pParent = 0,
      85             :                                          bool bChildrenOnDemand = false,
      86             :                                          sal_uLong nPos = TREELIST_APPEND, void* pUserData = 0,
      87             :                                          SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox ) SAL_OVERRIDE;
      88             : 
      89             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, sal_uLong nPos = TREELIST_APPEND,
      90             :                                  sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
      91             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
      92             :                                  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL );
      93             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
      94             :                                  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
      95             :                                  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
      96             : 
      97             :     virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
      98             :     static OUString  GetEntryText( SvTreeListEntry*, sal_uInt16 nCol );
      99             :     OUString         GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const;
     100             :     using SvTreeListBox::SetEntryText;
     101             :     void             SetEntryText(const OUString&, sal_uLong, sal_uInt16 nCol=0xffff);
     102             :     void             SetEntryText(const OUString&, SvTreeListEntry*, sal_uInt16 nCol=0xffff);
     103             :     OUString         GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const;
     104             :     sal_uLong        GetEntryPos( const OUString&, sal_uInt16 nCol = 0xffff );
     105             :     sal_uLong        GetEntryPos( const SvTreeListEntry* pEntry ) const;
     106             : 
     107             :     virtual void     Resize() SAL_OVERRIDE;
     108             :     void             SetTabJustify( sal_uInt16 nTab, SvTabJustify );
     109             : };
     110             : 
     111           0 : inline long SvTabListBox::GetTab( sal_uInt16 nTab ) const
     112             : {
     113             :     DBG_ASSERT( nTab < nTabCount, "GetTabPos:Invalid Tab" );
     114           0 :     return pTabList[nTab].GetPos();
     115             : }
     116             : 
     117             : // class SvHeaderTabListBox ---------------------------------------------------
     118             : 
     119             : class HeaderBar;
     120             : namespace svt {
     121             :     class IAccessibleTabListBox;
     122             :     struct SvHeaderTabListBoxImpl;
     123             : }
     124             : 
     125             : class SVT_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public svt::IAccessibleTableProvider
     126             : {
     127             : private:
     128             :     typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
     129             : 
     130             :     bool                            m_bFirstPaint;
     131             :     ::svt::SvHeaderTabListBoxImpl*  m_pImpl;
     132             :     ::svt::IAccessibleTabListBox*   m_pAccessible;
     133             :     AccessibleChildren              m_aAccessibleChildren;
     134             : 
     135             :     DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, void* );
     136             :     DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, void* );
     137             : 
     138             :     void            RecalculateAccessibleChildren();
     139             : 
     140             : public:
     141             :     SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
     142             :     virtual ~SvHeaderTabListBox();
     143             :     virtual void dispose() SAL_OVERRIDE;
     144             : 
     145             :     virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) SAL_OVERRIDE;
     146             : 
     147             :     void            InitHeaderBar( HeaderBar* pHeaderBar );
     148             :     static bool     IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol );
     149             : 
     150             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, sal_uLong nPos = TREELIST_APPEND,
     151             :                                  sal_uInt16 nCol = 0xffff, void* pUserData = NULL ) SAL_OVERRIDE;
     152             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, SvTreeListEntry* pParent,
     153             :                                  sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL ) SAL_OVERRIDE;
     154             :     virtual SvTreeListEntry* InsertEntryToColumn( const OUString&, const Image& rExpandedEntryBmp,
     155             :                                  const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
     156             :                                  sal_uLong nPos = TREELIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL ) SAL_OVERRIDE;
     157             :     virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND) SAL_OVERRIDE;
     158             :     virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = TREELIST_APPEND ) SAL_OVERRIDE;
     159             :     void            RemoveEntry( SvTreeListEntry* _pEntry );
     160             :     void            Clear();
     161             : 
     162             :     // Accessible -------------------------------------------------------------
     163             : 
     164           0 :     inline void     DisableTransientChildren()          { SetChildrenNotTransient(); }
     165           0 :     inline bool     IsTransientChildrenDisabled() const { return !AreChildrenTransient(); }
     166             : 
     167             :     bool            IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState );
     168             : 
     169             :     /** @return  The count of the rows. */
     170             :     virtual long                    GetRowCount() const SAL_OVERRIDE;
     171             :     /** @return  The count of the columns. */
     172             :     virtual sal_uInt16              GetColumnCount() const SAL_OVERRIDE;
     173             : 
     174             :     /** @return  The position of the current row. */
     175             :     virtual sal_Int32               GetCurrRow() const SAL_OVERRIDE;
     176             :     /** @return  The position of the current column. */
     177             :     virtual sal_uInt16              GetCurrColumn() const SAL_OVERRIDE;
     178             : 
     179             :     /** @return  The description of a row.
     180             :         @param _nRow The row which description is in demand. */
     181             :     virtual OUString         GetRowDescription( sal_Int32 _nRow ) const SAL_OVERRIDE;
     182             :     /** @return  The description of a column.
     183             :         @param _nColumn The column which description is in demand. */
     184             :     virtual OUString         GetColumnDescription( sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     185             : 
     186             :     /** @return  <TRUE/>, if the object has a row header. */
     187             :     virtual bool                    HasRowHeader() const SAL_OVERRIDE; //GetColumnId
     188             :     /** @return  <TRUE/>, if the object can focus a cell. */
     189             :     virtual bool                    IsCellFocusable() const SAL_OVERRIDE;
     190             :     virtual bool                    GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) SAL_OVERRIDE;
     191             : 
     192             :     virtual void                    SetNoSelection() SAL_OVERRIDE;
     193             :     using SvListView::SelectAll;
     194             :     virtual void                    SelectAll() SAL_OVERRIDE;
     195             :     virtual void                    SelectAll( bool bSelect, bool bPaint = true ) SAL_OVERRIDE;
     196             :     virtual void                    SelectRow( long _nRow, bool _bSelect = true, bool bExpand = true ) SAL_OVERRIDE;
     197             :     virtual void                    SelectColumn( sal_uInt16 _nColumn, bool _bSelect = true ) SAL_OVERRIDE;
     198             :     virtual sal_Int32               GetSelectedRowCount() const SAL_OVERRIDE;
     199             :     virtual sal_Int32               GetSelectedColumnCount() const SAL_OVERRIDE;
     200             :     /** @return  <TRUE/>, if the row is selected. */
     201             :     virtual bool                    IsRowSelected( long _nRow ) const SAL_OVERRIDE;
     202             :     virtual bool                    IsColumnSelected( long _nColumn ) const SAL_OVERRIDE;
     203             :     virtual void                    GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const SAL_OVERRIDE;
     204             :     virtual void                    GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const SAL_OVERRIDE;
     205             : 
     206             :     /** @return  <TRUE/>, if the cell is visible. */
     207             :     virtual bool                    IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     208             :     virtual OUString                GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const SAL_OVERRIDE;
     209             : 
     210             :     virtual Rectangle               calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) SAL_OVERRIDE;
     211             :     virtual Rectangle               calcTableRect( bool _bOnScreen = true ) SAL_OVERRIDE;
     212             :     virtual Rectangle               GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen = true ) SAL_OVERRIDE;
     213             : 
     214             :     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) SAL_OVERRIDE;
     215             :     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) SAL_OVERRIDE;
     216             :     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) SAL_OVERRIDE;
     217             : 
     218             :     virtual sal_Int32               GetAccessibleControlCount() const SAL_OVERRIDE;
     219             :     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) SAL_OVERRIDE;
     220             :     virtual bool                    ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) SAL_OVERRIDE;
     221             : 
     222             :     virtual bool                    ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) SAL_OVERRIDE;
     223             :     virtual bool                    ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) SAL_OVERRIDE;
     224             :     virtual bool                    ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) SAL_OVERRIDE;
     225             : 
     226             :     virtual OUString                GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const SAL_OVERRIDE;
     227             :     virtual OUString                GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const SAL_OVERRIDE;
     228             :     virtual vcl::Window*                 GetWindowInstance() SAL_OVERRIDE;
     229             : 
     230             :     virtual void                    FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const SAL_OVERRIDE;
     231             :     virtual void                    FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const SAL_OVERRIDE;
     232             :     virtual void                    GrabTableFocus() SAL_OVERRIDE;
     233             : 
     234             :     // OutputDevice
     235             :     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) SAL_OVERRIDE;
     236             : 
     237             :     // Window
     238             :     virtual Rectangle               GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const SAL_OVERRIDE;
     239             :     virtual void                    GrabFocus() SAL_OVERRIDE;
     240             :     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) SAL_OVERRIDE;
     241             :     virtual vcl::Window*                 GetAccessibleParentWindow() const SAL_OVERRIDE;
     242             : 
     243             :     /** Creates and returns the accessible object of the whole BrowseBox. */
     244             :     virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     245             : 
     246             :     virtual Rectangle               GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
     247             :     virtual sal_Int32               GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
     248             : };
     249             : 
     250             : #endif // INCLUDED_SVTOOLS_SVTABBX_HXX
     251             : 
     252             : 
     253             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11