1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25
26 #include "precompiled_sc.hxx"
27 #include "AccessibleFilterTopWindow.hxx"
28 #include "AccessibleFilterMenu.hxx"
29 #include "dpcontrol.hxx"
30
31 #include <com/sun/star/accessibility/AccessibleRole.hpp>
32
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::accessibility;
35 using ::com::sun::star::lang::IndexOutOfBoundsException;
36 using ::com::sun::star::uno::Reference;
37 using ::com::sun::star::uno::RuntimeException;
38 using ::rtl::OUString;
39
ScAccessibleFilterTopWindow(const Reference<XAccessible> & rxParent,ScDPFieldPopupWindow * pWin,const OUString & rName,ScDocument * pDoc)40 ScAccessibleFilterTopWindow::ScAccessibleFilterTopWindow(
41 const Reference<XAccessible>& rxParent, ScDPFieldPopupWindow* pWin, const OUString& rName, ScDocument* pDoc) :
42 ScAccessibleFilterMenu(rxParent, pWin, rName, ScMenuFloatingWindow::MENU_NOT_SELECTED, pDoc),
43 mpWindow(pWin),
44 mpDoc(pDoc)
45 {
46 SetName(rName);
47 }
48
~ScAccessibleFilterTopWindow()49 ScAccessibleFilterTopWindow::~ScAccessibleFilterTopWindow()
50 {
51 }
52
53 // XAccessibleContext
54
getAccessibleChildCount()55 sal_Int32 ScAccessibleFilterTopWindow::getAccessibleChildCount() throw (RuntimeException)
56 {
57 sal_Int32 nMenuCount = getMenuItemCount();
58 return nMenuCount + 6;
59 }
60
getAccessibleChild(sal_Int32 nIndex)61 Reference<XAccessible> ScAccessibleFilterTopWindow::getAccessibleChild(
62 sal_Int32 nIndex) throw (RuntimeException, IndexOutOfBoundsException)
63 {
64 if (nIndex >= getAccessibleChildCount())
65 throw IndexOutOfBoundsException();
66
67 sal_Int32 nMenuCount = getMenuItemCount();
68 if (nIndex < nMenuCount)
69 return ScAccessibleFilterMenu::getAccessibleChild(nIndex);
70
71 nIndex -= nMenuCount;
72 switch (nIndex)
73 {
74 case 0:
75 return mxAccListBox;
76 case 1:
77 return mxAccToggleAll;
78 case 2:
79 return mxAccSingleOnBtn;
80 case 3:
81 return mxAccSingleOffBtn;
82 case 4:
83 return mxAccOkBtn;
84 case 5:
85 return mxAccCancelBtn;
86 default:
87 ;
88 }
89
90 return Reference<XAccessible>();
91 }
92
getImplementationName()93 OUString ScAccessibleFilterTopWindow::getImplementationName() throw (RuntimeException)
94 {
95 return OUString::createFromAscii("ScAccessibleFilterTopWindow");
96 }
97
setAccessibleChild(const Reference<XAccessible> & rAccessible,ChildControlType eType)98 void ScAccessibleFilterTopWindow::setAccessibleChild(
99 const Reference<XAccessible>& rAccessible, ChildControlType eType)
100 {
101 switch (eType)
102 {
103 case LISTBOX:
104 mxAccListBox = rAccessible;
105 break;
106 case TOGGLE_ALL:
107 mxAccToggleAll = rAccessible;
108 break;
109 case SINGLE_ON_BTN:
110 mxAccSingleOnBtn = rAccessible;
111 break;
112 case SINGLE_OFF_BTN:
113 mxAccSingleOffBtn = rAccessible;
114 break;
115 case OK_BTN:
116 mxAccOkBtn = rAccessible;
117 break;
118 case CANCEL_BTN:
119 mxAccCancelBtn = rAccessible;
120 break;
121 }
122 }
123
124