xref: /AOO41X/main/svx/source/accessibility/AccessibleOLEShape.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svx/AccessibleOLEShape.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <svx/ShapeTypeHandler.hxx>
31cdf0e10cSrcweir #include <svx/SvxShapeTypes.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace accessibility;
34cdf0e10cSrcweir using namespace ::com::sun::star;
35cdf0e10cSrcweir using namespace ::com::sun::star::uno;
36cdf0e10cSrcweir using namespace	::com::sun::star::accessibility;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //=====  internal  ============================================================
39cdf0e10cSrcweir 
40cdf0e10cSrcweir AccessibleOLEShape::AccessibleOLEShape (
41cdf0e10cSrcweir     const AccessibleShapeInfo& rShapeInfo,
42cdf0e10cSrcweir     const AccessibleShapeTreeInfo& rShapeTreeInfo)
43cdf0e10cSrcweir     : AccessibleShape (rShapeInfo, rShapeTreeInfo)
44cdf0e10cSrcweir {
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 
50cdf0e10cSrcweir AccessibleOLEShape::~AccessibleOLEShape (void)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //=====  XAccessibleAction  ===================================================
58cdf0e10cSrcweir 
59cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
60cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     return 0;
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
69cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     throw lang::IndexOutOfBoundsException();
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
78cdf0e10cSrcweir     throw (::com::sun::star::lang::IndexOutOfBoundsException,
79cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     throw lang::IndexOutOfBoundsException();
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 
87cdf0e10cSrcweir Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
88cdf0e10cSrcweir     throw (::com::sun::star::lang::IndexOutOfBoundsException,
89cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     throw lang::IndexOutOfBoundsException();
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
97cdf0e10cSrcweir //=====  XInterface  ==========================================================
98cdf0e10cSrcweir 
99cdf0e10cSrcweir com::sun::star::uno::Any SAL_CALL
100cdf0e10cSrcweir     AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
101cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
104cdf0e10cSrcweir     if ( ! aReturn.hasValue())
105cdf0e10cSrcweir         aReturn = ::cppu::queryInterface (rType,
106cdf0e10cSrcweir             static_cast<XAccessibleAction*>(this));
107cdf0e10cSrcweir     return aReturn;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir void SAL_CALL
113cdf0e10cSrcweir     AccessibleOLEShape::acquire (void)
114cdf0e10cSrcweir     throw ()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     AccessibleShape::acquire ();
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir void SAL_CALL
122cdf0e10cSrcweir     AccessibleOLEShape::release (void)
123cdf0e10cSrcweir     throw ()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     AccessibleShape::release ();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
131cdf0e10cSrcweir //=====  XServiceInfo  ========================================================
132cdf0e10cSrcweir 
133cdf0e10cSrcweir ::rtl::OUString SAL_CALL
134cdf0e10cSrcweir     AccessibleOLEShape::getImplementationName (void)
135cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOLEShape"));
138cdf0e10cSrcweir }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 
143cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
144cdf0e10cSrcweir     AccessibleOLEShape::getSupportedServiceNames (void)
145cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
146cdf0e10cSrcweir {
147cdf0e10cSrcweir     ThrowIfDisposed();
148cdf0e10cSrcweir     // Get list of supported service names from base class...
149cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString > aServiceNames =
150cdf0e10cSrcweir         AccessibleShape::getSupportedServiceNames();
151cdf0e10cSrcweir     sal_Int32 nCount (aServiceNames.getLength());
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     // ...and add additional names.
154cdf0e10cSrcweir     aServiceNames.realloc (nCount + 1);
155cdf0e10cSrcweir     static const ::rtl::OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
156cdf0e10cSrcweir         "com.sun.star.drawing.AccessibleOLEShape"));
157cdf0e10cSrcweir     aServiceNames[nCount] = sAdditionalServiceName;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     return aServiceNames;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 
165cdf0e10cSrcweir //=====  XTypeProvider  ===================================================
166cdf0e10cSrcweir 
167cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL
168cdf0e10cSrcweir     AccessibleOLEShape::getTypes (void)
169cdf0e10cSrcweir     throw (uno::RuntimeException)
170cdf0e10cSrcweir {
171cdf0e10cSrcweir     // Get list of types from the context base implementation...
172cdf0e10cSrcweir 	uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
173cdf0e10cSrcweir     // ...and add the additional type for the component.
174cdf0e10cSrcweir     long nTypeCount = aTypeList.getLength();
175cdf0e10cSrcweir     aTypeList.realloc (nTypeCount + 1);
176cdf0e10cSrcweir     const uno::Type aActionType =
177cdf0e10cSrcweir     	::getCppuType((const uno::Reference<XAccessibleAction>*)0);
178cdf0e10cSrcweir     aTypeList[nTypeCount] = aActionType;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	return aTypeList;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 
186cdf0e10cSrcweir ///	Set this object's name if is different to the current name.
187cdf0e10cSrcweir ::rtl::OUString
188cdf0e10cSrcweir     AccessibleOLEShape::CreateAccessibleBaseName (void)
189cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir     ::rtl::OUString sName;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
194cdf0e10cSrcweir     switch (nShapeType)
195cdf0e10cSrcweir     {
196cdf0e10cSrcweir         case DRAWING_APPLET:
197cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape"));
198cdf0e10cSrcweir             break;
199cdf0e10cSrcweir         case DRAWING_FRAME:
200cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape"));
201cdf0e10cSrcweir             break;
202cdf0e10cSrcweir         case DRAWING_OLE:
203cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape"));
204cdf0e10cSrcweir             break;
205cdf0e10cSrcweir         case DRAWING_PLUGIN:
206cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape"));
207cdf0e10cSrcweir             break;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir         default:
210cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape"));
211cdf0e10cSrcweir             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
212cdf0e10cSrcweir             if (xDescriptor.is())
213cdf0e10cSrcweir                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
214cdf0e10cSrcweir                     + xDescriptor->getShapeType();
215cdf0e10cSrcweir     }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     return sName;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 
222cdf0e10cSrcweir ::rtl::OUString
223cdf0e10cSrcweir     AccessibleOLEShape::CreateAccessibleDescription (void)
224cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
225cdf0e10cSrcweir {
226cdf0e10cSrcweir     return CreateAccessibleName ();
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
229