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

Generated by: LCOV version 1.10