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