xref: /trunk/main/svx/source/accessibility/ChildrenManager.cxx (revision 45c5a00162811bd03b87fcb4fe9996782f2b59ec)
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 {
83     OSL_ASSERT (mpImpl != NULL);
84     return mpImpl->GetChild (nIndex);
85 }
86 
87 Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
88 {
89     OSL_ASSERT (mpImpl != NULL);
90     return mpImpl->GetChild (xShape);
91 }
92 
93 ::com::sun::star::uno::Reference<
94         ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
95 {
96     OSL_ASSERT (mpImpl != NULL);
97     return mpImpl->GetChildShape(nIndex);
98 }
99 
100 
101 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
102 {
103     OSL_ASSERT (mpImpl != NULL);
104     mpImpl->Update (bCreateNewObjectsOnDemand);
105 }
106 
107 
108 
109 
110 void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
111     ::com::sun::star::drawing::XShapes>& xShapeList)
112 {
113     OSL_ASSERT (mpImpl != NULL);
114     mpImpl->SetShapeList (xShapeList);
115 }
116 
117 
118 
119 
120 void ChildrenManager::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
121 {
122     OSL_ASSERT (mpImpl != NULL);
123     mpImpl->AddAccessibleShape (pShape);
124 }
125 
126 
127 
128 
129 void ChildrenManager::ClearAccessibleShapeList (void)
130 {
131     OSL_ASSERT (mpImpl != NULL);
132     mpImpl->ClearAccessibleShapeList ();
133 }
134 
135 
136 
137 
138 void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
139 {
140     OSL_ASSERT (mpImpl != NULL);
141     mpImpl->SetInfo (rShapeTreeInfo);
142 }
143 
144 
145 
146 
147 void ChildrenManager::UpdateSelection (void)
148 {
149     OSL_ASSERT (mpImpl != NULL);
150     mpImpl->UpdateSelection ();
151 }
152 
153 
154 
155 
156 bool ChildrenManager::HasFocus (void)
157 {
158     OSL_ASSERT (mpImpl != NULL);
159     return mpImpl->HasFocus ();
160 }
161 
162 
163 
164 
165 void ChildrenManager::RemoveFocus (void)
166 {
167     OSL_ASSERT (mpImpl != NULL);
168     mpImpl->RemoveFocus ();
169 }
170 
171 
172 
173 
174 //=====  IAccessibleViewForwarderListener  ====================================
175 void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
176         const IAccessibleViewForwarder* pViewForwarder)
177 {
178     OSL_ASSERT (mpImpl != NULL);
179     mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
180 }
181 
182 
183 
184 } // end of namespace accessibility
185