1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/AccessibleOLEShape.hxx>
22 #include <svx/ShapeTypeHandler.hxx>
23 #include <svx/SvxShapeTypes.hxx>
25 using namespace accessibility
;
26 using namespace ::com::sun::star
;
27 using namespace ::com::sun::star::uno
;
28 using namespace ::com::sun::star::accessibility
;
30 //===== internal ============================================================
32 AccessibleOLEShape::AccessibleOLEShape (
33 const AccessibleShapeInfo
& rShapeInfo
,
34 const AccessibleShapeTreeInfo
& rShapeTreeInfo
)
35 : AccessibleShape (rShapeInfo
, rShapeTreeInfo
)
42 AccessibleOLEShape::~AccessibleOLEShape (void)
49 //===== XAccessibleAction ===================================================
51 sal_Int32 SAL_CALL
AccessibleOLEShape::getAccessibleActionCount (void)
52 throw (::com::sun::star::uno::RuntimeException
)
60 sal_Bool SAL_CALL
AccessibleOLEShape::doAccessibleAction (sal_Int32
/*nIndex*/)
61 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
)
63 throw lang::IndexOutOfBoundsException();
69 OUString SAL_CALL
AccessibleOLEShape::getAccessibleActionDescription (sal_Int32
/*nIndex*/)
70 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
71 ::com::sun::star::uno::RuntimeException
)
73 throw lang::IndexOutOfBoundsException();
79 Reference
<XAccessibleKeyBinding
> SAL_CALL
AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32
/*nIndex*/)
80 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
81 ::com::sun::star::uno::RuntimeException
)
83 throw lang::IndexOutOfBoundsException();
89 //===== XInterface ==========================================================
91 com::sun::star::uno::Any SAL_CALL
92 AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type
& rType
)
93 throw (::com::sun::star::uno::RuntimeException
)
95 ::com::sun::star::uno::Any aReturn
= AccessibleShape::queryInterface (rType
);
96 if ( ! aReturn
.hasValue())
97 aReturn
= ::cppu::queryInterface (rType
,
98 static_cast<XAccessibleAction
*>(this));
105 AccessibleOLEShape::acquire (void)
108 AccessibleShape::acquire ();
114 AccessibleOLEShape::release (void)
117 AccessibleShape::release ();
123 //===== XServiceInfo ========================================================
126 AccessibleOLEShape::getImplementationName (void)
127 throw (::com::sun::star::uno::RuntimeException
)
129 return OUString("AccessibleOLEShape");
135 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
136 AccessibleOLEShape::getSupportedServiceNames (void)
137 throw (::com::sun::star::uno::RuntimeException
)
140 // Get list of supported service names from base class...
141 uno::Sequence
< OUString
> aServiceNames
=
142 AccessibleShape::getSupportedServiceNames();
143 sal_Int32
nCount (aServiceNames
.getLength());
145 // ...and add additional names.
146 aServiceNames
.realloc (nCount
+ 1);
147 static const OUString
sAdditionalServiceName ("com.sun.star.drawing.AccessibleOLEShape");
148 aServiceNames
[nCount
] = sAdditionalServiceName
;
150 return aServiceNames
;
156 //===== XTypeProvider ===================================================
158 uno::Sequence
<uno::Type
> SAL_CALL
159 AccessibleOLEShape::getTypes (void)
160 throw (uno::RuntimeException
)
162 // Get list of types from the context base implementation...
163 uno::Sequence
<uno::Type
> aTypeList (AccessibleShape::getTypes());
164 // ...and add the additional type for the component.
165 long nTypeCount
= aTypeList
.getLength();
166 aTypeList
.realloc (nTypeCount
+ 1);
167 const uno::Type aActionType
=
168 ::getCppuType((const uno::Reference
<XAccessibleAction
>*)0);
169 aTypeList
[nTypeCount
] = aActionType
;
177 /// Set this object's name if is different to the current name.
179 AccessibleOLEShape::CreateAccessibleBaseName (void)
180 throw (::com::sun::star::uno::RuntimeException
)
184 ShapeTypeId nShapeType
= ShapeTypeHandler::Instance().GetTypeId (mxShape
);
188 sName
= "AppletOLEShape";
191 sName
= "FrameOLEShape";
197 sName
= "PluginOLEShape";
201 sName
= "UnknownAccessibleOLEShape";
202 uno::Reference
<drawing::XShapeDescriptor
> xDescriptor (mxShape
, uno::UNO_QUERY
);
203 if (xDescriptor
.is())
204 sName
+= ": " + xDescriptor
->getShapeType();
213 AccessibleOLEShape::CreateAccessibleDescription (void)
214 throw (::com::sun::star::uno::RuntimeException
)
216 return CreateAccessibleName ();
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */