LCOV - code coverage report
Current view: top level - libreoffice/accessibility/inc/accessibility/helper - listboxhelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 70 0.0 %
Date: 2012-12-27 Functions: 0 50 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             : 
      20             : #ifndef ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
      21             : #define ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
      22             : 
      23             : #include <accessibility/helper/IComboListBoxHelper.hxx>
      24             : #include <vcl/lstbox.hxx>
      25             : #include <vcl/combobox.hxx>
      26             : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
      27             : 
      28             : // -----------------------------------------------------------------------------
      29             : // globals
      30             : // -----------------------------------------------------------------------------
      31             : 
      32             : const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1;
      33             : 
      34             : // -----------------------------------------------------------------------------
      35             : // class VCLListBoxHelper
      36             : // -----------------------------------------------------------------------------
      37             : 
      38           0 : template< class T > class VCLListBoxHelper : public ::accessibility::IComboListBoxHelper
      39             : {
      40             : private:
      41             :     T&  m_aComboListBox;
      42             : 
      43             : public:
      44             :     inline
      45           0 :     VCLListBoxHelper( T& _pListBox ) :
      46           0 :         m_aComboListBox( _pListBox ){}
      47             : 
      48             :     // -----------------------------------------------------------------------------
      49           0 :     virtual String          GetEntry( sal_uInt16 nPos ) const
      50             :     {
      51           0 :         return m_aComboListBox.GetEntry( nPos );
      52             :     }
      53             :     // -----------------------------------------------------------------------------
      54           0 :     virtual Rectangle       GetDropDownPosSizePixel() const
      55             :     {
      56           0 :         Rectangle aTemp = m_aComboListBox.GetWindowExtentsRelative(NULL);
      57           0 :         Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel();
      58           0 :         aRet.Move(aTemp.TopLeft().X(),aTemp.TopLeft().Y());
      59           0 :         return aRet;
      60             :     }
      61             :     // -----------------------------------------------------------------------------
      62           0 :     virtual Rectangle       GetBoundingRectangle( sal_uInt16 nItem ) const
      63             :     {
      64           0 :         Rectangle aRect;
      65           0 :         if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) )
      66             :         {
      67           0 :             Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel();
      68           0 :             Size aSize = aTemp.GetSize();
      69           0 :             aSize.Height() /= m_aComboListBox.GetDisplayLineCount();
      70           0 :             Point aTopLeft = aTemp.TopLeft();
      71           0 :             aTopLeft.Y() += aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() );
      72           0 :             aRect = Rectangle( aTopLeft, aSize );
      73             :         }
      74             :         else
      75           0 :             aRect = m_aComboListBox.GetBoundingRectangle( nItem );
      76           0 :         return aRect;
      77             :     }
      78             :     // -----------------------------------------------------------------------------
      79           0 :     virtual Rectangle       GetWindowExtentsRelative( Window* pRelativeWindow )
      80             :     {
      81           0 :         return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow );
      82             :     }
      83             :     // -----------------------------------------------------------------------------
      84           0 :     virtual bool            IsActive() const
      85             :     {
      86           0 :         return m_aComboListBox.IsActive();
      87             :     }
      88             :     // -----------------------------------------------------------------------------
      89           0 :     virtual bool            IsEntryVisible( sal_uInt16 nPos ) const
      90             :     {
      91           0 :         sal_uInt16 nTopEntry = m_aComboListBox.GetTopEntry();
      92           0 :         sal_uInt16 nLines = m_aComboListBox.GetDisplayLineCount();
      93           0 :         return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) );
      94             :     }
      95             :     // -----------------------------------------------------------------------------
      96           0 :     virtual sal_uInt16      GetDisplayLineCount() const
      97             :     {
      98           0 :         return m_aComboListBox.GetDisplayLineCount();
      99             :     }
     100             :     // -----------------------------------------------------------------------------
     101           0 :     virtual void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
     102             :     {
     103           0 :         m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines);
     104           0 :     }
     105             :     // -----------------------------------------------------------------------------
     106           0 :     virtual WinBits         GetStyle() const
     107             :     {
     108           0 :         return m_aComboListBox.GetStyle();
     109             :     }
     110             :     // -----------------------------------------------------------------------------
     111           0 :     virtual bool            IsMultiSelectionEnabled() const
     112             :     {
     113           0 :         return m_aComboListBox.IsMultiSelectionEnabled();
     114             :     }
     115             :     // -----------------------------------------------------------------------------
     116           0 :     virtual sal_uInt16      GetTopEntry() const
     117             :     {
     118           0 :         return m_aComboListBox.GetTopEntry();
     119             :     }
     120             :     // -----------------------------------------------------------------------------
     121           0 :     virtual bool            IsEntryPosSelected( sal_uInt16 nPos ) const
     122             :     {
     123           0 :         return m_aComboListBox.IsEntryPosSelected(nPos);
     124             :     }
     125             :     // -----------------------------------------------------------------------------
     126           0 :     virtual sal_uInt16      GetEntryCount() const
     127             :     {
     128           0 :         return m_aComboListBox.GetEntryCount();
     129             :     }
     130             :     // -----------------------------------------------------------------------------
     131           0 :     virtual void            Select()
     132             :     {
     133           0 :         m_aComboListBox.Select();
     134           0 :     }
     135             :     // -----------------------------------------------------------------------------
     136           0 :     virtual void            SelectEntryPos( sal_uInt16 nPos, bool bSelect = sal_True )
     137             :     {
     138           0 :         m_aComboListBox.SelectEntryPos(nPos,bSelect);
     139           0 :     }
     140             :     // -----------------------------------------------------------------------------
     141           0 :     virtual sal_uInt16      GetSelectEntryCount() const
     142             :     {
     143           0 :         return m_aComboListBox.GetSelectEntryCount();
     144             :     }
     145             :     // -----------------------------------------------------------------------------
     146           0 :     virtual void    SetNoSelection()
     147             :     {
     148           0 :         m_aComboListBox.SetNoSelection();
     149           0 :     }
     150             :     // -----------------------------------------------------------------------------
     151           0 :     virtual sal_uInt16      GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const
     152             :     {
     153           0 :         return m_aComboListBox.GetSelectEntryPos(nSelIndex);
     154             :     }
     155             :     // -----------------------------------------------------------------------------
     156           0 :     virtual bool            IsInDropDown() const
     157             :     {
     158           0 :         return m_aComboListBox.IsInDropDown();
     159             :     }
     160             :     // -----------------------------------------------------------------------------
     161           0 :     virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const
     162             :     {
     163           0 :         Rectangle aRect;
     164             : 
     165           0 :         Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos );
     166           0 :         if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() )
     167             :         {
     168           0 :             long nIndex = aEntryCharacterRange.A() + _nCharacterIndex;
     169           0 :             aRect = m_aComboListBox.GetCharacterBounds( nIndex );
     170             :         }
     171           0 :         return aRect;
     172             :     }
     173             :     // -----------------------------------------------------------------------------
     174           0 :     long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const
     175             :     {
     176           0 :         return m_aComboListBox.GetIndexForPoint( rPoint, nPos );
     177             :     }
     178             :     // -----------------------------------------------------------------------------
     179             :     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >
     180           0 :         GetClipboard()
     181             :     {
     182           0 :         return m_aComboListBox.GetClipboard();
     183             :     }
     184             :     // -----------------------------------------------------------------------------
     185             : };
     186             : 
     187             : #endif  // ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10