Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / AccessibleFilterMenu.hxx
blob2078e6a4241757ee698eb693f3d047da629b97e9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_ACCESSIBLEFILTERMENU_HXX
21 #define SC_ACCESSIBLEFILTERMENU_HXX
23 #include "AccessibleContextBase.hxx"
24 #include "cppuhelper/implbase1.hxx"
26 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 #include <com/sun/star/accessibility/XAccessibleText.hpp>
28 #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
29 #include <com/sun/star/accessibility/TextSegment.hpp>
31 #include <vector>
33 namespace com { namespace sun { namespace star {
34 namespace accessibility {
35 struct AccessibleEventObject;
37 }}}
39 class ScMenuFloatingWindow;
41 typedef ::cppu::ImplHelper1<
42 ::com::sun::star::accessibility::XAccessibleSelection > ScAccessibleFilterMenu_BASE;
44 class ScAccessibleFilterMenu :
45 public ScAccessibleContextBase,
46 public ScAccessibleFilterMenu_BASE
48 public:
49 explicit ScAccessibleFilterMenu(
50 const ::com::sun::star::uno::Reference<
51 ::com::sun::star::accessibility::XAccessible>& rxParent,
52 ScMenuFloatingWindow* pWin, const OUString& rName, size_t nMenuPos);
53 virtual ~ScAccessibleFilterMenu();
55 /// XAccessibleComponent
57 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
58 SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
59 throw (::com::sun::star::uno::RuntimeException);
61 virtual sal_Bool SAL_CALL isVisible()
62 throw (::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL grabFocus()
65 throw (::com::sun::star::uno::RuntimeException);
67 virtual sal_Int32 SAL_CALL getForeground()
68 throw (::com::sun::star::uno::RuntimeException);
70 virtual sal_Int32 SAL_CALL getBackground()
71 throw (::com::sun::star::uno::RuntimeException);
73 /// XAccessibleContext
75 virtual OUString SAL_CALL getAccessibleName()
76 throw (::com::sun::star::uno::RuntimeException);
78 virtual sal_Int32 SAL_CALL getAccessibleChildCount()
79 throw (::com::sun::star::uno::RuntimeException);
81 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
82 getAccessibleChild(sal_Int32 nIndex)
83 throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
85 virtual ::com::sun::star::uno::Reference<
86 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
87 getAccessibleStateSet()
88 throw (::com::sun::star::uno::RuntimeException);
90 virtual OUString SAL_CALL getImplementationName()
91 throw (::com::sun::star::uno::RuntimeException);
93 /// XAccessibleEventBroadcaster
94 virtual void SAL_CALL
95 addAccessibleEventListener(
96 const ::com::sun::star::uno::Reference<
97 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
98 throw (com::sun::star::uno::RuntimeException);
100 /// Remove an existing event listener.
101 virtual void SAL_CALL
102 removeAccessibleEventListener(
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
105 throw (com::sun::star::uno::RuntimeException);
107 /// XAccessibleSelection
109 virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex)
110 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
112 virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex)
113 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL clearAccessibleSelection()
116 throw (::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL selectAllAccessibleChildren()
119 throw (::com::sun::star::uno::RuntimeException);
121 virtual ::sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
122 throw (::com::sun::star::uno::RuntimeException);
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
125 getSelectedAccessibleChild(sal_Int32 nChildIndex)
126 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
128 virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex)
129 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
131 /// XInterface
133 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
134 ::com::sun::star::uno::Type const & rType )
135 throw (::com::sun::star::uno::RuntimeException);
137 virtual void SAL_CALL acquire() throw ();
138 virtual void SAL_CALL release() throw ();
140 /// XTypeProvider
142 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
143 throw (::com::sun::star::uno::RuntimeException);
145 /// non-UNO methods
147 void appendMenuItem(const OUString& rName, bool bEnabled, size_t nMenuPos);
148 void setMenuPos(size_t nMenuPos);
149 void setEnabled(bool bEnabled);
151 protected:
153 sal_Int32 getMenuItemCount() const;
155 virtual Rectangle GetBoundingBoxOnScreen() const
156 throw (::com::sun::star::uno::RuntimeException);
158 virtual Rectangle GetBoundingBox() const
159 throw (::com::sun::star::uno::RuntimeException);
161 private:
162 bool isSelected() const;
163 bool isFocused() const;
165 void updateStates();
167 private:
168 ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > maMenuItems;
169 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
171 size_t mnMenuPos;
172 ScMenuFloatingWindow* mpWindow;
174 bool mbEnabled:1;
177 #endif
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */