LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/Accessibility - AccessibleFilterMenuItem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 74 0.0 %
Date: 2012-12-27 Functions: 0 20 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             : 
      21             : #include "AccessibleGlobal.hxx"
      22             : #include "AccessibleFilterMenuItem.hxx"
      23             : #include "checklistmenu.hxx"
      24             : 
      25             : #include <com/sun/star/accessibility/XAccessible.hpp>
      26             : #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
      27             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      28             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
      30             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      31             : #include <com/sun/star/accessibility/TextSegment.hpp>
      32             : 
      33             : using namespace ::com::sun::star;
      34             : using namespace ::com::sun::star::accessibility;
      35             : using namespace ::com::sun::star::accessibility::AccessibleStateType;
      36             : 
      37             : using ::com::sun::star::uno::Any;
      38             : using ::com::sun::star::uno::Reference;
      39             : using ::com::sun::star::uno::Sequence;
      40             : using ::com::sun::star::uno::UNO_QUERY;
      41             : using ::com::sun::star::lang::IndexOutOfBoundsException;
      42             : using ::com::sun::star::uno::RuntimeException;
      43             : using ::rtl::OUString;
      44             : 
      45           0 : ScAccessibleFilterMenuItem::ScAccessibleFilterMenuItem(
      46             :     const Reference<XAccessible>& rxParent, ScMenuFloatingWindow* pWin, const OUString& rName, size_t nMenuPos) :
      47             :     ScAccessibleContextBase(rxParent, AccessibleRole::MENU_ITEM),
      48             :     mpWindow(pWin),
      49             :     maName(rName),
      50             :     mnMenuPos(nMenuPos),
      51           0 :     mbEnabled(true)
      52             : {
      53           0 :     SetName(rName);
      54           0 : }
      55             : 
      56           0 : ScAccessibleFilterMenuItem::~ScAccessibleFilterMenuItem()
      57             : {
      58           0 : }
      59             : 
      60           0 : sal_Int32 ScAccessibleFilterMenuItem::getAccessibleChildCount()
      61             :     throw (RuntimeException)
      62             : {
      63           0 :     return 0;
      64             : }
      65             : 
      66           0 : Reference<XAccessible> ScAccessibleFilterMenuItem::getAccessibleChild(sal_Int32 /*nIndex*/)
      67             :     throw (RuntimeException, IndexOutOfBoundsException)
      68             : {
      69           0 :     throw IndexOutOfBoundsException();
      70             : }
      71             : 
      72           0 : Reference<XAccessibleStateSet> ScAccessibleFilterMenuItem::getAccessibleStateSet()
      73             :     throw (RuntimeException)
      74             : {
      75           0 :     updateStateSet();
      76           0 :     return mxStateSet;
      77             : }
      78             : 
      79           0 : OUString ScAccessibleFilterMenuItem::getImplementationName()
      80             :     throw (RuntimeException)
      81             : {
      82           0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessibleFilterMenuItem"));
      83             : }
      84             : 
      85             : // XAccessibleAction
      86             : 
      87           0 : sal_Int32 ScAccessibleFilterMenuItem::getAccessibleActionCount() throw (RuntimeException)
      88             : {
      89           0 :     return 1;
      90             : }
      91             : 
      92           0 : sal_Bool ScAccessibleFilterMenuItem::doAccessibleAction(sal_Int32 /*nIndex*/)
      93             :     throw (IndexOutOfBoundsException, RuntimeException)
      94             : {
      95           0 :     mpWindow->executeMenuItem(mnMenuPos);
      96           0 :     return true;
      97             : }
      98             : 
      99           0 : OUString ScAccessibleFilterMenuItem::getAccessibleActionDescription(sal_Int32 /*nIndex*/)
     100             :     throw (IndexOutOfBoundsException, RuntimeException)
     101             : {
     102           0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM("click"));
     103             : }
     104             : 
     105           0 : Reference<XAccessibleKeyBinding> ScAccessibleFilterMenuItem::getAccessibleActionKeyBinding(
     106             :     sal_Int32 /*nIndex*/) throw (IndexOutOfBoundsException, RuntimeException)
     107             : {
     108           0 :     return Reference<XAccessibleKeyBinding>();
     109             : }
     110             : 
     111           0 : Any SAL_CALL ScAccessibleFilterMenuItem::queryInterface( uno::Type const & rType )
     112             :     throw (RuntimeException)
     113             : {
     114           0 :     Any any = ScAccessibleContextBase::queryInterface(rType);
     115           0 :     if (any.hasValue())
     116           0 :         return any;
     117             : 
     118           0 :     return ScAccessibleFilterMenuItem_BASE::queryInterface(rType);
     119             : }
     120             : 
     121           0 : void SAL_CALL ScAccessibleFilterMenuItem::acquire() throw ()
     122             : {
     123           0 :     ScAccessibleContextBase::acquire();
     124           0 : }
     125             : 
     126           0 : void SAL_CALL ScAccessibleFilterMenuItem::release() throw ()
     127             : {
     128           0 :     ScAccessibleContextBase::release();
     129           0 : }
     130             : 
     131           0 : bool ScAccessibleFilterMenuItem::isSelected() const
     132             : {
     133           0 :     return mpWindow->isMenuItemSelected(mnMenuPos);
     134             : }
     135             : 
     136           0 : bool ScAccessibleFilterMenuItem::isFocused() const
     137             : {
     138           0 :     return isSelected();
     139             : }
     140             : 
     141           0 : void ScAccessibleFilterMenuItem::setEnabled(bool bEnabled)
     142             : {
     143           0 :     mbEnabled = bEnabled;
     144           0 : }
     145             : 
     146           0 : Rectangle ScAccessibleFilterMenuItem::GetBoundingBoxOnScreen() const
     147             :     throw (RuntimeException)
     148             : {
     149           0 :     if (!mpWindow->IsVisible())
     150           0 :         return Rectangle();
     151             : 
     152           0 :     Point aPos = mpWindow->OutputToAbsoluteScreenPixel(Point(0,0));
     153           0 :     Point aMenuPos;
     154           0 :     Size aMenuSize;
     155           0 :     mpWindow->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
     156           0 :     Rectangle aRect(aPos + aMenuPos, aMenuSize);
     157           0 :     return aRect;
     158             : }
     159             : 
     160           0 : Rectangle ScAccessibleFilterMenuItem::GetBoundingBox() const
     161             :     throw (RuntimeException)
     162             : {
     163           0 :     if (!mpWindow->IsVisible())
     164           0 :         return Rectangle();
     165             : 
     166           0 :     Point aMenuPos;
     167           0 :     Size aMenuSize;
     168           0 :     mpWindow->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
     169           0 :     Rectangle aRect(aMenuPos, aMenuSize);
     170           0 :     return aRect;
     171             : }
     172             : 
     173           0 : void ScAccessibleFilterMenuItem::updateStateSet()
     174             : {
     175           0 :     if (!mxStateSet.is())
     176           0 :         mxStateSet.set(new ScAccessibleStateSet);
     177             : 
     178             :     ScAccessibleStateSet* p = static_cast<ScAccessibleStateSet*>(
     179           0 :         mxStateSet.get());
     180             : 
     181           0 :     p->clear();
     182             : 
     183           0 :     p->insert(ENABLED);
     184           0 :     p->insert(FOCUSABLE);
     185           0 :     p->insert(SELECTABLE);
     186           0 :     p->insert(SENSITIVE);
     187           0 :     p->insert(OPAQUE);
     188             : 
     189           0 :     if (isFocused())
     190           0 :         p->insert(FOCUSED);
     191             : 
     192           0 :     if (isSelected())
     193           0 :         p->insert(SELECTED);
     194           0 : }
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10