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 
ChildrenManager(const::com::sun::star::uno::Reference<XAccessible> & rxParent,const::com::sun::star::uno::Reference<drawing::XShapes> & rxShapeList,const AccessibleShapeTreeInfo & rShapeTreeInfo,AccessibleContextBase & rContext)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 
~ChildrenManager(void)60 ChildrenManager::~ChildrenManager (void)
61 {
62     if (mpImpl != NULL)
63         mpImpl->dispose();
64 
65     // emtpy
66     OSL_TRACE ("~ChildrenManager");
67 }
68 
69 
70 
71 
GetChildCount(void) const72 long ChildrenManager::GetChildCount (void) const throw ()
73 {
74     OSL_ASSERT (mpImpl != NULL);
75     return mpImpl->GetChildCount();
76 }
77 
78 
79 
80 
GetChild(long nIndex)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 
GetChild(const Reference<drawing::XShape> & xShape)89 Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
90     throw (::com::sun::star::uno::RuntimeException)
91 {
92     OSL_ASSERT (mpImpl != NULL);
93     return mpImpl->GetChild (xShape);
94 }
95 
96 ::com::sun::star::uno::Reference<
GetChildShape(long nIndex)97         ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
98     throw (::com::sun::star::uno::RuntimeException)
99 {
100 	OSL_ASSERT (mpImpl != NULL);
101     return mpImpl->GetChildShape(nIndex);
102 }
103 
104 
Update(bool bCreateNewObjectsOnDemand)105 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
106 {
107     OSL_ASSERT (mpImpl != NULL);
108     mpImpl->Update (bCreateNewObjectsOnDemand);
109 }
110 
111 
112 
113 
SetShapeList(const::com::sun::star::uno::Reference<::com::sun::star::drawing::XShapes> & xShapeList)114 void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
115     ::com::sun::star::drawing::XShapes>& xShapeList)
116 {
117     OSL_ASSERT (mpImpl != NULL);
118     mpImpl->SetShapeList (xShapeList);
119 }
120 
121 
122 
123 
AddAccessibleShape(std::auto_ptr<AccessibleShape> pShape)124 void ChildrenManager::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
125 {
126     OSL_ASSERT (mpImpl != NULL);
127     mpImpl->AddAccessibleShape (pShape);
128 }
129 
130 
131 
132 
ClearAccessibleShapeList(void)133 void ChildrenManager::ClearAccessibleShapeList (void)
134 {
135     OSL_ASSERT (mpImpl != NULL);
136     mpImpl->ClearAccessibleShapeList ();
137 }
138 
139 
140 
141 
SetInfo(AccessibleShapeTreeInfo & rShapeTreeInfo)142 void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
143 {
144     OSL_ASSERT (mpImpl != NULL);
145     mpImpl->SetInfo (rShapeTreeInfo);
146 }
147 
148 
149 
150 
UpdateSelection(void)151 void ChildrenManager::UpdateSelection (void)
152 {
153     OSL_ASSERT (mpImpl != NULL);
154     mpImpl->UpdateSelection ();
155 }
156 
157 
158 
159 
HasFocus(void)160 bool ChildrenManager::HasFocus (void)
161 {
162     OSL_ASSERT (mpImpl != NULL);
163     return mpImpl->HasFocus ();
164 }
165 
166 
167 
168 
RemoveFocus(void)169 void ChildrenManager::RemoveFocus (void)
170 {
171     OSL_ASSERT (mpImpl != NULL);
172     mpImpl->RemoveFocus ();
173 }
174 
175 
176 
177 
178 //=====  IAccessibleViewForwarderListener  ====================================
ViewForwarderChanged(ChangeType aChangeType,const IAccessibleViewForwarder * pViewForwarder)179 void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
180         const IAccessibleViewForwarder* pViewForwarder)
181 {
182     OSL_ASSERT (mpImpl != NULL);
183     mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
184 }
185 
186 
187 
188 } // end of namespace accessibility
189 
190