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
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
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.
19f6e50924SAndrew Rist  *
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 #include <svx/svdoole2.hxx>
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 
AccessibleOLEShape(const AccessibleShapeInfo & rShapeInfo,const AccessibleShapeTreeInfo & rShapeTreeInfo)40cdf0e10cSrcweir AccessibleOLEShape::AccessibleOLEShape (
41cdf0e10cSrcweir     const AccessibleShapeInfo& rShapeInfo,
42cdf0e10cSrcweir     const AccessibleShapeTreeInfo& rShapeTreeInfo)
43cdf0e10cSrcweir     : AccessibleShape (rShapeInfo, rShapeTreeInfo)
44cdf0e10cSrcweir {
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 
~AccessibleOLEShape(void)50cdf0e10cSrcweir AccessibleOLEShape::~AccessibleOLEShape (void)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //=====  XAccessibleAction  ===================================================
58cdf0e10cSrcweir 
getAccessibleActionCount(void)59cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
60cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     return 0;
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
doAccessibleAction(sal_Int32)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 
getAccessibleActionDescription(sal_Int32)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 
getAccessibleActionKeyBinding(sal_Int32)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
queryInterface(const com::sun::star::uno::Type & rType)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
acquire(void)113cdf0e10cSrcweir     AccessibleOLEShape::acquire (void)
114cdf0e10cSrcweir     throw ()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     AccessibleShape::acquire ();
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir void SAL_CALL
release(void)122cdf0e10cSrcweir     AccessibleOLEShape::release (void)
123cdf0e10cSrcweir     throw ()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     AccessibleShape::release ();
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
131cdf0e10cSrcweir //=====  XServiceInfo  ========================================================
132cdf0e10cSrcweir 
133cdf0e10cSrcweir ::rtl::OUString SAL_CALL
getImplementationName(void)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
getSupportedServiceNames(void)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
getTypes(void)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 }
182*9b8096d0SSteve Yin //=====  XAccessibleExtendedAttributes  ========================================================
getExtendedAttributes()183*9b8096d0SSteve Yin uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes()
184*9b8096d0SSteve Yin 		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
185*9b8096d0SSteve Yin {
186*9b8096d0SSteve Yin 	uno::Any strRet;
187*9b8096d0SSteve Yin 	::rtl::OUString style;
188*9b8096d0SSteve Yin 	if( m_pShape )
189*9b8096d0SSteve Yin 	{
190*9b8096d0SSteve Yin 		//style = ::rtl::OUString::createFromAscii("style=");
191*9b8096d0SSteve Yin 		style = ::rtl::OUString::createFromAscii("style:");
192*9b8096d0SSteve Yin 		style += ((SdrOle2Obj*)m_pShape)->GetStyleString();
193*9b8096d0SSteve Yin 	}
194*9b8096d0SSteve Yin 	style += ::rtl::OUString::createFromAscii(";");
195*9b8096d0SSteve Yin 	strRet <<= style;
196*9b8096d0SSteve Yin 	return strRet;
197*9b8096d0SSteve Yin }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir ///	Set this object's name if is different to the current name.
201cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleBaseName(void)202cdf0e10cSrcweir     AccessibleOLEShape::CreateAccessibleBaseName (void)
203cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir     ::rtl::OUString sName;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
208cdf0e10cSrcweir     switch (nShapeType)
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         case DRAWING_APPLET:
211cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape"));
212cdf0e10cSrcweir             break;
213cdf0e10cSrcweir         case DRAWING_FRAME:
214cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape"));
215cdf0e10cSrcweir             break;
216cdf0e10cSrcweir         case DRAWING_OLE:
217cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape"));
218cdf0e10cSrcweir             break;
219cdf0e10cSrcweir         case DRAWING_PLUGIN:
220cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape"));
221cdf0e10cSrcweir             break;
222cdf0e10cSrcweir 
223cdf0e10cSrcweir         default:
224cdf0e10cSrcweir             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape"));
225cdf0e10cSrcweir             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
226cdf0e10cSrcweir             if (xDescriptor.is())
227cdf0e10cSrcweir                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
228cdf0e10cSrcweir                     + xDescriptor->getShapeType();
229cdf0e10cSrcweir     }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     return sName;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 
236cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleDescription(void)237cdf0e10cSrcweir     AccessibleOLEShape::CreateAccessibleDescription (void)
238cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
239cdf0e10cSrcweir {
240cdf0e10cSrcweir     return CreateAccessibleName ();
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243