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>
24 #include <svx/svdoole2.hxx>
26 #include <cppuhelper/queryinterface.hxx>
28 using namespace accessibility
;
29 using namespace ::com::sun::star
;
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::accessibility
;
34 AccessibleOLEShape::AccessibleOLEShape (
35 const AccessibleShapeInfo
& rShapeInfo
,
36 const AccessibleShapeTreeInfo
& rShapeTreeInfo
)
37 : AccessibleShape (rShapeInfo
, rShapeTreeInfo
)
44 AccessibleOLEShape::~AccessibleOLEShape()
49 sal_Int32 SAL_CALL
AccessibleOLEShape::getAccessibleActionCount()
50 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
58 sal_Bool SAL_CALL
AccessibleOLEShape::doAccessibleAction (sal_Int32
/*nIndex*/)
59 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
, std::exception
)
61 throw lang::IndexOutOfBoundsException();
67 OUString SAL_CALL
AccessibleOLEShape::getAccessibleActionDescription (sal_Int32
/*nIndex*/)
68 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
69 ::com::sun::star::uno::RuntimeException
, std::exception
)
71 throw lang::IndexOutOfBoundsException();
77 Reference
<XAccessibleKeyBinding
> SAL_CALL
AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32
/*nIndex*/)
78 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
79 ::com::sun::star::uno::RuntimeException
, std::exception
)
81 throw lang::IndexOutOfBoundsException();
85 com::sun::star::uno::Any SAL_CALL
86 AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type
& rType
)
87 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
89 ::com::sun::star::uno::Any aReturn
= AccessibleShape::queryInterface (rType
);
90 if ( ! aReturn
.hasValue())
91 aReturn
= ::cppu::queryInterface (rType
,
92 static_cast<XAccessibleAction
*>(this));
99 AccessibleOLEShape::acquire()
102 AccessibleShape::acquire ();
108 AccessibleOLEShape::release()
111 AccessibleShape::release ();
116 AccessibleOLEShape::getImplementationName()
117 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
119 return OUString("AccessibleOLEShape");
125 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
126 AccessibleOLEShape::getSupportedServiceNames()
127 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
130 // Get list of supported service names from base class...
131 uno::Sequence
< OUString
> aServiceNames
=
132 AccessibleShape::getSupportedServiceNames();
133 sal_Int32
nCount (aServiceNames
.getLength());
135 // ...and add additional names.
136 aServiceNames
.realloc (nCount
+ 1);
137 aServiceNames
[nCount
] = "com.sun.star.drawing.AccessibleOLEShape";
139 return aServiceNames
;
143 uno::Sequence
<uno::Type
> SAL_CALL
144 AccessibleOLEShape::getTypes()
145 throw (uno::RuntimeException
, std::exception
)
147 // Get list of types from the context base implementation...
148 uno::Sequence
<uno::Type
> aTypeList (AccessibleShape::getTypes());
149 // ...and add the additional type for the component.
150 long nTypeCount
= aTypeList
.getLength();
151 aTypeList
.realloc (nTypeCount
+ 1);
152 const uno::Type aActionType
=
153 cppu::UnoType
<XAccessibleAction
>::get();
154 aTypeList
[nTypeCount
] = aActionType
;
159 // XAccessibleExtendedAttributes
160 uno::Any SAL_CALL
AccessibleOLEShape::getExtendedAttributes()
161 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
, std::exception
)
164 ::rtl::OUString style
;
167 style
= "style:" + static_cast<SdrOle2Obj
*>(m_pShape
)->GetStyleString();
174 /// Set this object's name if is different to the current name.
176 AccessibleOLEShape::CreateAccessibleBaseName()
177 throw (::com::sun::star::uno::RuntimeException
)
181 ShapeTypeId nShapeType
= ShapeTypeHandler::Instance().GetTypeId (mxShape
);
185 sName
= "AppletOLEShape";
188 sName
= "FrameOLEShape";
194 sName
= "PluginOLEShape";
198 sName
= "UnknownAccessibleOLEShape";
199 uno::Reference
<drawing::XShapeDescriptor
> xDescriptor (mxShape
, uno::UNO_QUERY
);
200 if (xDescriptor
.is())
201 sName
+= ": " + xDescriptor
->getShapeType();
210 AccessibleOLEShape::CreateAccessibleDescription()
211 throw (::com::sun::star::uno::RuntimeException
)
213 return CreateAccessibleName ();
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */