Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <svx/AccessibleOLEShape.hxx>
21 :
22 : #include <svx/ShapeTypeHandler.hxx>
23 : #include <svx/SvxShapeTypes.hxx>
24 : #include <svx/svdoole2.hxx>
25 :
26 : using namespace accessibility;
27 : using namespace ::com::sun::star;
28 : using namespace ::com::sun::star::uno;
29 : using namespace ::com::sun::star::accessibility;
30 :
31 : //===== internal ============================================================
32 :
33 0 : AccessibleOLEShape::AccessibleOLEShape (
34 : const AccessibleShapeInfo& rShapeInfo,
35 : const AccessibleShapeTreeInfo& rShapeTreeInfo)
36 0 : : AccessibleShape (rShapeInfo, rShapeTreeInfo)
37 : {
38 0 : }
39 :
40 :
41 :
42 :
43 0 : AccessibleOLEShape::~AccessibleOLEShape (void)
44 : {
45 0 : }
46 :
47 :
48 :
49 :
50 : //===== XAccessibleAction ===================================================
51 :
52 0 : sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
53 : throw (::com::sun::star::uno::RuntimeException, std::exception)
54 : {
55 0 : return 0;
56 : }
57 :
58 :
59 :
60 :
61 0 : sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
62 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception)
63 : {
64 0 : throw lang::IndexOutOfBoundsException();
65 : }
66 :
67 :
68 :
69 :
70 0 : OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
71 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
72 : ::com::sun::star::uno::RuntimeException, std::exception)
73 : {
74 0 : throw lang::IndexOutOfBoundsException();
75 : }
76 :
77 :
78 :
79 :
80 0 : Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
81 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
82 : ::com::sun::star::uno::RuntimeException, std::exception)
83 : {
84 0 : throw lang::IndexOutOfBoundsException();
85 : }
86 :
87 :
88 :
89 :
90 : //===== XInterface ==========================================================
91 :
92 : com::sun::star::uno::Any SAL_CALL
93 0 : AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
94 : throw (::com::sun::star::uno::RuntimeException, std::exception)
95 : {
96 0 : ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
97 0 : if ( ! aReturn.hasValue())
98 0 : aReturn = ::cppu::queryInterface (rType,
99 0 : static_cast<XAccessibleAction*>(this));
100 0 : return aReturn;
101 : }
102 :
103 :
104 :
105 : void SAL_CALL
106 0 : AccessibleOLEShape::acquire (void)
107 : throw ()
108 : {
109 0 : AccessibleShape::acquire ();
110 0 : }
111 :
112 :
113 :
114 : void SAL_CALL
115 0 : AccessibleOLEShape::release (void)
116 : throw ()
117 : {
118 0 : AccessibleShape::release ();
119 0 : }
120 :
121 :
122 :
123 :
124 : //===== XServiceInfo ========================================================
125 :
126 : OUString SAL_CALL
127 0 : AccessibleOLEShape::getImplementationName (void)
128 : throw (::com::sun::star::uno::RuntimeException, std::exception)
129 : {
130 0 : return OUString("AccessibleOLEShape");
131 : }
132 :
133 :
134 :
135 :
136 : ::com::sun::star::uno::Sequence< OUString> SAL_CALL
137 0 : AccessibleOLEShape::getSupportedServiceNames (void)
138 : throw (::com::sun::star::uno::RuntimeException, std::exception)
139 : {
140 0 : ThrowIfDisposed();
141 : // Get list of supported service names from base class...
142 : uno::Sequence< OUString > aServiceNames =
143 0 : AccessibleShape::getSupportedServiceNames();
144 0 : sal_Int32 nCount (aServiceNames.getLength());
145 :
146 : // ...and add additional names.
147 0 : aServiceNames.realloc (nCount + 1);
148 0 : static const OUString sAdditionalServiceName ("com.sun.star.drawing.AccessibleOLEShape");
149 0 : aServiceNames[nCount] = sAdditionalServiceName;
150 :
151 0 : return aServiceNames;
152 : }
153 :
154 :
155 :
156 :
157 : //===== XTypeProvider ===================================================
158 :
159 : uno::Sequence<uno::Type> SAL_CALL
160 0 : AccessibleOLEShape::getTypes (void)
161 : throw (uno::RuntimeException, std::exception)
162 : {
163 : // Get list of types from the context base implementation...
164 0 : uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
165 : // ...and add the additional type for the component.
166 0 : long nTypeCount = aTypeList.getLength();
167 0 : aTypeList.realloc (nTypeCount + 1);
168 : const uno::Type aActionType =
169 0 : ::getCppuType((const uno::Reference<XAccessibleAction>*)0);
170 0 : aTypeList[nTypeCount] = aActionType;
171 :
172 0 : return aTypeList;
173 : }
174 :
175 : //===== XAccessibleExtendedAttributes ========================================================
176 0 : uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes()
177 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
178 : {
179 0 : uno::Any strRet;
180 0 : ::rtl::OUString style;
181 0 : if( m_pShape )
182 : {
183 : //style = ::rtl::OUString::createFromAscii("style=");
184 0 : style = ::rtl::OUString::createFromAscii("style:");
185 0 : style += ((SdrOle2Obj*)m_pShape)->GetStyleString();
186 : }
187 0 : style += ::rtl::OUString::createFromAscii(";");
188 0 : strRet <<= style;
189 0 : return strRet;
190 : }
191 :
192 : /// Set this object's name if is different to the current name.
193 : OUString
194 0 : AccessibleOLEShape::CreateAccessibleBaseName (void)
195 : throw (::com::sun::star::uno::RuntimeException)
196 : {
197 0 : OUString sName;
198 :
199 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
200 0 : switch (nShapeType)
201 : {
202 : case DRAWING_APPLET:
203 0 : sName = "AppletOLEShape";
204 0 : break;
205 : case DRAWING_FRAME:
206 0 : sName = "FrameOLEShape";
207 0 : break;
208 : case DRAWING_OLE:
209 0 : sName = "OLEShape";
210 0 : break;
211 : case DRAWING_PLUGIN:
212 0 : sName = "PluginOLEShape";
213 0 : break;
214 :
215 : default:
216 0 : sName = "UnknownAccessibleOLEShape";
217 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
218 0 : if (xDescriptor.is())
219 0 : sName += ": " + xDescriptor->getShapeType();
220 : }
221 :
222 0 : return sName;
223 : }
224 :
225 :
226 :
227 : OUString
228 0 : AccessibleOLEShape::CreateAccessibleDescription (void)
229 : throw (::com::sun::star::uno::RuntimeException)
230 : {
231 0 : return CreateAccessibleName ();
232 : }
233 :
234 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|