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 "AccessibleFilterTopWindow.hxx"
21 : #include "AccessibleFilterMenu.hxx"
22 : #include "checklistmenu.hxx"
23 :
24 : #include <com/sun/star/accessibility/AccessibleRole.hpp>
25 :
26 : using namespace ::com::sun::star;
27 : using namespace ::com::sun::star::accessibility;
28 : using ::com::sun::star::lang::IndexOutOfBoundsException;
29 : using ::com::sun::star::uno::Reference;
30 : using ::com::sun::star::uno::RuntimeException;
31 :
32 0 : ScAccessibleFilterTopWindow::ScAccessibleFilterTopWindow(
33 : const Reference<XAccessible>& rxParent, ScCheckListMenuWindow* pWin, const OUString& rName) :
34 0 : ScAccessibleFilterMenu(rxParent, pWin, rName, ScMenuFloatingWindow::MENU_NOT_SELECTED)
35 : {
36 0 : SetName(rName);
37 0 : }
38 :
39 0 : ScAccessibleFilterTopWindow::~ScAccessibleFilterTopWindow()
40 : {
41 0 : }
42 :
43 : // XAccessibleContext
44 :
45 0 : sal_Int32 ScAccessibleFilterTopWindow::getAccessibleChildCount() throw (RuntimeException, std::exception)
46 : {
47 0 : sal_Int32 nMenuCount = getMenuItemCount();
48 0 : return nMenuCount + 6;
49 : }
50 :
51 0 : Reference<XAccessible> ScAccessibleFilterTopWindow::getAccessibleChild(
52 : sal_Int32 nIndex) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
53 : {
54 0 : if (nIndex >= getAccessibleChildCount())
55 0 : throw IndexOutOfBoundsException();
56 :
57 0 : sal_Int32 nMenuCount = getMenuItemCount();
58 0 : if (nIndex < nMenuCount)
59 0 : return ScAccessibleFilterMenu::getAccessibleChild(nIndex);
60 :
61 0 : nIndex -= nMenuCount;
62 0 : switch (nIndex)
63 : {
64 : case 0:
65 0 : return mxAccEditSearchBox;
66 : case 1:
67 0 : return mxAccListBox;
68 : case 2:
69 0 : return mxAccToggleAll;
70 : case 3:
71 0 : return mxAccSingleOnBtn;
72 : case 4:
73 0 : return mxAccSingleOffBtn;
74 : case 5:
75 0 : return mxAccOkBtn;
76 : case 6:
77 0 : return mxAccCancelBtn;
78 : default:
79 : ;
80 : }
81 :
82 0 : return Reference<XAccessible>();
83 : }
84 :
85 0 : OUString ScAccessibleFilterTopWindow::getImplementationName() throw (RuntimeException, std::exception)
86 : {
87 0 : return OUString("ScAccessibleFilterTopWindow");
88 : }
89 :
90 0 : void ScAccessibleFilterTopWindow::setAccessibleChild(
91 : const Reference<XAccessible>& rAccessible, ChildControlType eType)
92 : {
93 0 : switch (eType)
94 : {
95 : case EDIT_SEARCH_BOX:
96 0 : mxAccEditSearchBox = rAccessible;
97 0 : break;
98 : case LISTBOX:
99 0 : mxAccListBox = rAccessible;
100 0 : break;
101 : case TOGGLE_ALL:
102 0 : mxAccToggleAll = rAccessible;
103 0 : break;
104 : case SINGLE_ON_BTN:
105 0 : mxAccSingleOnBtn = rAccessible;
106 0 : break;
107 : case SINGLE_OFF_BTN:
108 0 : mxAccSingleOffBtn = rAccessible;
109 0 : break;
110 : case OK_BTN:
111 0 : mxAccOkBtn = rAccessible;
112 0 : break;
113 : case CANCEL_BTN:
114 0 : mxAccCancelBtn = rAccessible;
115 0 : break;
116 : }
117 156 : }
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|