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

Generated by: LCOV version 1.10