1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <svx/ChildrenManager.hxx>
31 #ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_IMPL_HXX
32 #include "ChildrenManagerImpl.hxx"
33 #endif
34 #include <svx/AccessibleShape.hxx>
35 
36 using namespace ::com::sun::star;
37 using namespace	::com::sun::star::accessibility;
38 using ::com::sun::star::uno::Reference;
39 
40 namespace accessibility {
41 
42 
43 //=====  AccessibleChildrenManager  ===========================================
44 
45 ChildrenManager::ChildrenManager (
46     const ::com::sun::star::uno::Reference<XAccessible>& rxParent,
47     const ::com::sun::star::uno::Reference<drawing::XShapes>& rxShapeList,
48     const AccessibleShapeTreeInfo& rShapeTreeInfo,
49     AccessibleContextBase& rContext)
50     : mpImpl (NULL)
51 {
52     mpImpl = new ChildrenManagerImpl (rxParent, rxShapeList, rShapeTreeInfo, rContext);
53     if (mpImpl != NULL)
54         mpImpl->Init ();
55     else
56         throw uno::RuntimeException(
57             ::rtl::OUString::createFromAscii(
58 				"ChildrenManager::ChildrenManager can't create implementation object"), NULL);
59 }
60 
61 
62 
63 
64 ChildrenManager::~ChildrenManager (void)
65 {
66     if (mpImpl != NULL)
67         mpImpl->dispose();
68 
69     // emtpy
70     OSL_TRACE ("~ChildrenManager");
71 }
72 
73 
74 
75 
76 long ChildrenManager::GetChildCount (void) const throw ()
77 {
78     OSL_ASSERT (mpImpl != NULL);
79     return mpImpl->GetChildCount();
80 }
81 
82 
83 
84 
85 ::com::sun::star::uno::Reference<XAccessible> ChildrenManager::GetChild (long nIndex)
86     throw (::com::sun::star::uno::RuntimeException,
87            ::com::sun::star::lang::IndexOutOfBoundsException)
88 {
89     OSL_ASSERT (mpImpl != NULL);
90     return mpImpl->GetChild (nIndex);
91 }
92 
93 
94 
95 
96 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
97 {
98     OSL_ASSERT (mpImpl != NULL);
99     mpImpl->Update (bCreateNewObjectsOnDemand);
100 }
101 
102 
103 
104 
105 void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
106     ::com::sun::star::drawing::XShapes>& xShapeList)
107 {
108     OSL_ASSERT (mpImpl != NULL);
109     mpImpl->SetShapeList (xShapeList);
110 }
111 
112 
113 
114 
115 void ChildrenManager::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
116 {
117     OSL_ASSERT (mpImpl != NULL);
118     mpImpl->AddAccessibleShape (pShape);
119 }
120 
121 
122 
123 
124 void ChildrenManager::ClearAccessibleShapeList (void)
125 {
126     OSL_ASSERT (mpImpl != NULL);
127     mpImpl->ClearAccessibleShapeList ();
128 }
129 
130 
131 
132 
133 void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
134 {
135     OSL_ASSERT (mpImpl != NULL);
136     mpImpl->SetInfo (rShapeTreeInfo);
137 }
138 
139 
140 
141 
142 void ChildrenManager::UpdateSelection (void)
143 {
144     OSL_ASSERT (mpImpl != NULL);
145     mpImpl->UpdateSelection ();
146 }
147 
148 
149 
150 
151 bool ChildrenManager::HasFocus (void)
152 {
153     OSL_ASSERT (mpImpl != NULL);
154     return mpImpl->HasFocus ();
155 }
156 
157 
158 
159 
160 void ChildrenManager::RemoveFocus (void)
161 {
162     OSL_ASSERT (mpImpl != NULL);
163     mpImpl->RemoveFocus ();
164 }
165 
166 
167 
168 
169 //=====  IAccessibleViewForwarderListener  ====================================
170 void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
171         const IAccessibleViewForwarder* pViewForwarder)
172 {
173     OSL_ASSERT (mpImpl != NULL);
174     mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
175 }
176 
177 
178 
179 } // end of namespace accessibility
180 
181