Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "AccessibleScrollPanel.hxx"
31 : :
32 : : #include "taskpane/ScrollPanel.hxx"
33 : : #include "taskpane/ControlContainer.hxx"
34 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
35 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36 : : #include <unotools/accessiblestatesethelper.hxx>
37 : :
38 : : #include <osl/mutex.hxx>
39 : : #include <vcl/svapp.hxx>
40 : :
41 : : using ::rtl::OUString;
42 : : using namespace ::com::sun::star;
43 : : using namespace ::com::sun::star::accessibility;
44 : : using namespace ::com::sun::star::uno;
45 : : using namespace ::sd::toolpanel;
46 : :
47 : : namespace accessibility {
48 : :
49 : 0 : AccessibleScrollPanel::AccessibleScrollPanel (
50 : : ::sd::toolpanel::ScrollPanel& rScrollPanel,
51 : : const ::rtl::OUString& rsName,
52 : : const ::rtl::OUString& rsDescription)
53 : : : AccessibleTreeNode(
54 : : rScrollPanel,
55 : : rsName,
56 : : rsDescription,
57 : 0 : AccessibleRole::PANEL)
58 : : {
59 : 0 : }
60 : :
61 : :
62 : :
63 : :
64 : 0 : AccessibleScrollPanel::~AccessibleScrollPanel (void)
65 : : {
66 [ # # ]: 0 : }
67 : :
68 : :
69 : :
70 : :
71 : : //===== XAccessibleContext ==================================================
72 : :
73 : : sal_Int32 SAL_CALL
74 : 0 : AccessibleScrollPanel::getAccessibleChildCount (void)
75 : : throw (RuntimeException)
76 : : {
77 [ # # ]: 0 : ThrowIfDisposed();
78 [ # # ]: 0 : const SolarMutexGuard aSolarGuard;
79 : :
80 [ # # ][ # # ]: 0 : sal_Int32 nChildCount (mrTreeNode.GetControlContainer().GetControlCount());
81 [ # # ][ # # ]: 0 : if (GetScrollPanel().IsVerticalScrollBarVisible())
82 : 0 : ++nChildCount;
83 [ # # ][ # # ]: 0 : if (GetScrollPanel().IsHorizontalScrollBarVisible())
84 : 0 : ++nChildCount;
85 : :
86 [ # # ]: 0 : return nChildCount;
87 : : }
88 : :
89 : :
90 : :
91 : :
92 : : Reference<XAccessible> SAL_CALL
93 : 0 : AccessibleScrollPanel::getAccessibleChild (sal_Int32 nIndex)
94 : : throw (lang::IndexOutOfBoundsException,
95 : : RuntimeException)
96 : : {
97 [ # # ]: 0 : ThrowIfDisposed();
98 [ # # ]: 0 : const SolarMutexGuard aSolarGuard;
99 : :
100 : 0 : Reference<XAccessible> xChild;
101 : :
102 : 0 : ScrollPanel& rPanel (GetScrollPanel());
103 : :
104 [ # # ][ # # ]: 0 : sal_uInt32 nControlCount (mrTreeNode.GetControlContainer().GetControlCount());
105 : :
106 : : // The children of this accessible object include the tree node children
107 : : // and the two scroll bars (when they are visible).
108 [ # # ]: 0 : if (nIndex < 0)
109 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
110 [ # # ]: 0 : else if ((sal_uInt32)nIndex < nControlCount)
111 [ # # ][ # # ]: 0 : xChild = AccessibleTreeNode::getAccessibleChild(nIndex);
112 [ # # ]: 0 : else if ((sal_uInt32)nIndex == nControlCount)
113 : : {
114 [ # # ][ # # ]: 0 : if (rPanel.IsVerticalScrollBarVisible())
115 [ # # ][ # # ]: 0 : xChild = rPanel.GetVerticalScrollBar().GetAccessible();
[ # # ]
116 [ # # ][ # # ]: 0 : else if (rPanel.IsHorizontalScrollBarVisible())
117 [ # # ][ # # ]: 0 : xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
[ # # ]
118 : : }
119 [ # # ]: 0 : else if ((sal_uInt32)nIndex == nControlCount+1)
120 : : {
121 [ # # ][ # # ]: 0 : if (rPanel.IsVerticalScrollBarVisible() && rPanel.IsHorizontalScrollBarVisible())
[ # # ][ # # ]
[ # # ]
122 [ # # ][ # # ]: 0 : xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
[ # # ]
123 : : }
124 : : else
125 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
126 : :
127 [ # # ]: 0 : return xChild;
128 : : }
129 : :
130 : :
131 : :
132 : :
133 : : //===== XServiceInfo ========================================================
134 : :
135 : : OUString SAL_CALL
136 : 0 : AccessibleScrollPanel::getImplementationName (void)
137 : : throw (RuntimeException)
138 : : {
139 : 0 : return OUString("AccessibleScrollPanel");
140 : : }
141 : :
142 : :
143 : :
144 : :
145 : 0 : ScrollPanel& AccessibleScrollPanel::GetScrollPanel (void) const
146 : : {
147 : 0 : return static_cast<ScrollPanel&>(mrTreeNode);
148 : : }
149 : :
150 : : } // end of namespace accessibility
151 : :
152 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|