1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <svx/ChildrenManager.hxx>
27 #ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_IMPL_HXX
28 #include "ChildrenManagerImpl.hxx"
29 #endif
30 #include <svx/AccessibleShape.hxx>
31 
32 using namespace ::com::sun::star;
33 using namespace	::com::sun::star::accessibility;
34 using ::com::sun::star::uno::Reference;
35 
36 namespace accessibility {
37 
38 
39 //=====  AccessibleChildrenManager  ===========================================
40 
41 ChildrenManager::ChildrenManager (
42     const ::com::sun::star::uno::Reference<XAccessible>& rxParent,
43     const ::com::sun::star::uno::Reference<drawing::XShapes>& rxShapeList,
44     const AccessibleShapeTreeInfo& rShapeTreeInfo,
45     AccessibleContextBase& rContext)
46     : mpImpl (NULL)
47 {
48     mpImpl = new ChildrenManagerImpl (rxParent, rxShapeList, rShapeTreeInfo, rContext);
49     if (mpImpl != NULL)
50         mpImpl->Init ();
51     else
52         throw uno::RuntimeException(
53             ::rtl::OUString::createFromAscii(
54 				"ChildrenManager::ChildrenManager can't create implementation object"), NULL);
55 }
56 
57 
58 
59 
60 ChildrenManager::~ChildrenManager (void)
61 {
62     if (mpImpl != NULL)
63         mpImpl->dispose();
64 
65     // emtpy
66     OSL_TRACE ("~ChildrenManager");
67 }
68 
69 
70 
71 
72 long ChildrenManager::GetChildCount (void) const throw ()
73 {
74     OSL_ASSERT (mpImpl != NULL);
75     return mpImpl->GetChildCount();
76 }
77 
78 
79 
80 
81 ::com::sun::star::uno::Reference<XAccessible> ChildrenManager::GetChild (long nIndex)
82     throw (::com::sun::star::uno::RuntimeException,
83            ::com::sun::star::lang::IndexOutOfBoundsException)
84 {
85     OSL_ASSERT (mpImpl != NULL);
86     return mpImpl->GetChild (nIndex);
87 }
88 
89 //IAccessibility2 Implementation 2009-----
90 Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
91     throw (::com::sun::star::uno::RuntimeException)
92 {
93     OSL_ASSERT (mpImpl != NULL);
94     return mpImpl->GetChild (xShape);
95 }
96 
97 ::com::sun::star::uno::Reference<
98         ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
99     throw (::com::sun::star::uno::RuntimeException)
100 {
101 	OSL_ASSERT (mpImpl != NULL);
102     return mpImpl->GetChildShape(nIndex);
103 }
104 //-----IAccessibility2 Implementation 2009
105 
106 
107 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
108 {
109     OSL_ASSERT (mpImpl != NULL);
110     mpImpl->Update (bCreateNewObjectsOnDemand);
111 }
112 
113 
114 
115 
116 void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
117     ::com::sun::star::drawing::XShapes>& xShapeList)
118 {
119     OSL_ASSERT (mpImpl != NULL);
120     mpImpl->SetShapeList (xShapeList);
121 }
122 
123 
124 
125 
126 void ChildrenManager::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
127 {
128     OSL_ASSERT (mpImpl != NULL);
129     mpImpl->AddAccessibleShape (pShape);
130 }
131 
132 
133 
134 
135 void ChildrenManager::ClearAccessibleShapeList (void)
136 {
137     OSL_ASSERT (mpImpl != NULL);
138     mpImpl->ClearAccessibleShapeList ();
139 }
140 
141 
142 
143 
144 void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
145 {
146     OSL_ASSERT (mpImpl != NULL);
147     mpImpl->SetInfo (rShapeTreeInfo);
148 }
149 
150 
151 
152 
153 void ChildrenManager::UpdateSelection (void)
154 {
155     OSL_ASSERT (mpImpl != NULL);
156     mpImpl->UpdateSelection ();
157 }
158 
159 
160 
161 
162 bool ChildrenManager::HasFocus (void)
163 {
164     OSL_ASSERT (mpImpl != NULL);
165     return mpImpl->HasFocus ();
166 }
167 
168 
169 
170 
171 void ChildrenManager::RemoveFocus (void)
172 {
173     OSL_ASSERT (mpImpl != NULL);
174     mpImpl->RemoveFocus ();
175 }
176 
177 
178 
179 
180 //=====  IAccessibleViewForwarderListener  ====================================
181 void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
182         const IAccessibleViewForwarder* pViewForwarder)
183 {
184     OSL_ASSERT (mpImpl != NULL);
185     mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
186 }
187 
188 
189 
190 } // end of namespace accessibility
191 
192