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