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 mxAccListBox;
66 : case 1:
67 0 : return mxAccToggleAll;
68 : case 2:
69 0 : return mxAccSingleOnBtn;
70 : case 3:
71 0 : return mxAccSingleOffBtn;
72 : case 4:
73 0 : return mxAccOkBtn;
74 : case 5:
75 0 : return mxAccCancelBtn;
76 : default:
77 : ;
78 : }
79 :
80 0 : return Reference<XAccessible>();
81 : }
82 :
83 0 : OUString ScAccessibleFilterTopWindow::getImplementationName() throw (RuntimeException, std::exception)
84 : {
85 0 : return OUString("ScAccessibleFilterTopWindow");
86 : }
87 :
88 0 : void ScAccessibleFilterTopWindow::setAccessibleChild(
89 : const Reference<XAccessible>& rAccessible, ChildControlType eType)
90 : {
91 0 : switch (eType)
92 : {
93 : case LISTBOX:
94 0 : mxAccListBox = rAccessible;
95 0 : break;
96 : case TOGGLE_ALL:
97 0 : mxAccToggleAll = rAccessible;
98 0 : break;
99 : case SINGLE_ON_BTN:
100 0 : mxAccSingleOnBtn = rAccessible;
101 0 : break;
102 : case SINGLE_OFF_BTN:
103 0 : mxAccSingleOffBtn = rAccessible;
104 0 : break;
105 : case OK_BTN:
106 0 : mxAccOkBtn = rAccessible;
107 0 : break;
108 : case CANCEL_BTN:
109 0 : mxAccCancelBtn = rAccessible;
110 0 : break;
111 : }
112 228 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|