1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleDataPilotControl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sc.hxx"
34 #include "AccessibleGlobal.hxx"
35 #include "AccessibleFilterMenuItem.hxx"
36 #include "dpcontrol.hxx"
38 #include <com/sun/star/accessibility/XAccessible.hpp>
39 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
40 #include <com/sun/star/accessibility/AccessibleRole.hpp>
41 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
42 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
43 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
44 #include <com/sun/star/accessibility/TextSegment.hpp>
46 using namespace ::com::sun::star
;
47 using namespace ::com::sun::star::accessibility
;
48 using namespace ::com::sun::star::accessibility::AccessibleStateType
;
50 using ::com::sun::star::uno::Any
;
51 using ::com::sun::star::uno::Reference
;
52 using ::com::sun::star::uno::Sequence
;
53 using ::com::sun::star::uno::UNO_QUERY
;
54 using ::com::sun::star::lang::IndexOutOfBoundsException
;
55 using ::com::sun::star::uno::RuntimeException
;
56 using ::rtl::OUString
;
58 ScAccessibleFilterMenuItem::ScAccessibleFilterMenuItem(
59 const Reference
<XAccessible
>& rxParent
, ScMenuFloatingWindow
* pWin
, const OUString
& rName
, size_t nMenuPos
) :
60 ScAccessibleContextBase(rxParent
, AccessibleRole::MENU_ITEM
),
69 ScAccessibleFilterMenuItem::~ScAccessibleFilterMenuItem()
73 sal_Int32
ScAccessibleFilterMenuItem::getAccessibleChildCount()
74 throw (RuntimeException
)
79 Reference
<XAccessible
> ScAccessibleFilterMenuItem::getAccessibleChild(sal_Int32
/*nIndex*/)
80 throw (RuntimeException
, IndexOutOfBoundsException
)
82 throw IndexOutOfBoundsException();
83 return Reference
<XAccessible
>();
86 Reference
<XAccessibleStateSet
> ScAccessibleFilterMenuItem::getAccessibleStateSet()
87 throw (RuntimeException
)
93 OUString
ScAccessibleFilterMenuItem::getImplementationName()
94 throw (RuntimeException
)
96 return OUString::createFromAscii("ScAccessibleFilterMenuItem");
101 sal_Int32
ScAccessibleFilterMenuItem::getAccessibleActionCount() throw (RuntimeException
)
106 sal_Bool
ScAccessibleFilterMenuItem::doAccessibleAction(sal_Int32
/*nIndex*/)
107 throw (IndexOutOfBoundsException
, RuntimeException
)
109 mpWindow
->executeMenuItem(mnMenuPos
);
113 OUString
ScAccessibleFilterMenuItem::getAccessibleActionDescription(sal_Int32
/*nIndex*/)
114 throw (IndexOutOfBoundsException
, RuntimeException
)
116 return OUString::createFromAscii("click");
119 Reference
<XAccessibleKeyBinding
> ScAccessibleFilterMenuItem::getAccessibleActionKeyBinding(
120 sal_Int32
/*nIndex*/) throw (IndexOutOfBoundsException
, RuntimeException
)
122 return Reference
<XAccessibleKeyBinding
>();
125 Any SAL_CALL
ScAccessibleFilterMenuItem::queryInterface( uno::Type
const & rType
)
126 throw (RuntimeException
)
128 Any any
= ScAccessibleContextBase::queryInterface(rType
);
132 return ScAccessibleFilterMenuItem_BASE::queryInterface(rType
);
135 void SAL_CALL
ScAccessibleFilterMenuItem::acquire() throw ()
137 ScAccessibleContextBase::acquire();
140 void SAL_CALL
ScAccessibleFilterMenuItem::release() throw ()
142 ScAccessibleContextBase::release();
145 bool ScAccessibleFilterMenuItem::isSelected() const
147 return mpWindow
->isMenuItemSelected(mnMenuPos
);
150 bool ScAccessibleFilterMenuItem::isFocused() const
155 void ScAccessibleFilterMenuItem::setEnabled(bool bEnabled
)
157 mbEnabled
= bEnabled
;
160 Rectangle
ScAccessibleFilterMenuItem::GetBoundingBoxOnScreen() const
161 throw (RuntimeException
)
163 if (!mpWindow
->IsVisible())
166 Point aPos
= mpWindow
->OutputToAbsoluteScreenPixel(Point(0,0));
169 mpWindow
->getMenuItemPosSize(mnMenuPos
, aMenuPos
, aMenuSize
);
170 Rectangle
aRect(aPos
+ aMenuPos
, aMenuSize
);
174 Rectangle
ScAccessibleFilterMenuItem::GetBoundingBox() const
175 throw (RuntimeException
)
177 if (!mpWindow
->IsVisible())
182 mpWindow
->getMenuItemPosSize(mnMenuPos
, aMenuPos
, aMenuSize
);
183 Rectangle
aRect(aMenuPos
, aMenuSize
);
187 void ScAccessibleFilterMenuItem::updateStateSet()
189 if (!mxStateSet
.is())
190 mxStateSet
.set(new ScAccessibleStateSet
);
192 ScAccessibleStateSet
* p
= static_cast<ScAccessibleStateSet
*>(
198 p
->insert(FOCUSABLE
);
199 p
->insert(SELECTABLE
);
200 p
->insert(SENSITIVE
);