fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / svx / source / accessibility / AccessibleOLEShape.cxx
blob3c4bbac8387a5a3d757c410fb61b93079af05f96
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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;
33 // internal
34 AccessibleOLEShape::AccessibleOLEShape (
35 const AccessibleShapeInfo& rShapeInfo,
36 const AccessibleShapeTreeInfo& rShapeTreeInfo)
37 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
44 AccessibleOLEShape::~AccessibleOLEShape()
48 // XAccessibleAction
49 sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount()
50 throw (::com::sun::star::uno::RuntimeException, std::exception)
52 return 0;
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();
84 // XInterface
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));
93 return aReturn;
98 void SAL_CALL
99 AccessibleOLEShape::acquire()
100 throw ()
102 AccessibleShape::acquire ();
107 void SAL_CALL
108 AccessibleOLEShape::release()
109 throw ()
111 AccessibleShape::release ();
114 // XServiceInfo
115 OUString SAL_CALL
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)
129 ThrowIfDisposed();
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;
142 // XTypeProvider
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;
156 return aTypeList;
159 // XAccessibleExtendedAttributes
160 uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes()
161 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
163 uno::Any strRet;
164 ::rtl::OUString style;
165 if( m_pShape )
167 style = "style:" + static_cast<SdrOle2Obj*>(m_pShape)->GetStyleString();
169 style += ";";
170 strRet <<= style;
171 return strRet;
174 /// Set this object's name if is different to the current name.
175 OUString
176 AccessibleOLEShape::CreateAccessibleBaseName()
177 throw (::com::sun::star::uno::RuntimeException)
179 OUString sName;
181 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
182 switch (nShapeType)
184 case DRAWING_APPLET:
185 sName = "AppletOLEShape";
186 break;
187 case DRAWING_FRAME:
188 sName = "FrameOLEShape";
189 break;
190 case DRAWING_OLE:
191 sName = "OLEShape";
192 break;
193 case DRAWING_PLUGIN:
194 sName = "PluginOLEShape";
195 break;
197 default:
198 sName = "UnknownAccessibleOLEShape";
199 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
200 if (xDescriptor.is())
201 sName += ": " + xDescriptor->getShapeType();
204 return sName;
209 OUString
210 AccessibleOLEShape::CreateAccessibleDescription()
211 throw (::com::sun::star::uno::RuntimeException)
213 return CreateAccessibleName ();
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */