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