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