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