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