Branch data 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/AccessibleGraphicShape.hxx>
21 : :
22 : : #include <svx/ShapeTypeHandler.hxx>
23 : : #include <svx/SvxShapeTypes.hxx>
24 : :
25 : : using namespace ::accessibility;
26 : : using namespace ::rtl;
27 : : using namespace ::com::sun::star;
28 : : using namespace ::com::sun::star::accessibility;
29 : :
30 : : //===== internal ============================================================
31 : :
32 : 0 : AccessibleGraphicShape::AccessibleGraphicShape (
33 : : const AccessibleShapeInfo& rShapeInfo,
34 : : const AccessibleShapeTreeInfo& rShapeTreeInfo)
35 : 0 : : AccessibleShape (rShapeInfo, rShapeTreeInfo)
36 : : {
37 : 0 : }
38 : :
39 : :
40 : :
41 : :
42 : 0 : AccessibleGraphicShape::~AccessibleGraphicShape (void)
43 : : {
44 [ # # ]: 0 : }
45 : :
46 : :
47 : :
48 : :
49 : : //===== XAccessibleImage ====================================================
50 : :
51 : 0 : ::rtl::OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void)
52 : : throw (::com::sun::star::uno::RuntimeException)
53 : : {
54 : 0 : return AccessibleShape::getAccessibleDescription ();
55 : : }
56 : :
57 : :
58 : :
59 : :
60 : 0 : sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageHeight (void)
61 : : throw (::com::sun::star::uno::RuntimeException)
62 : : {
63 : 0 : return AccessibleShape::getSize().Height;
64 : : }
65 : :
66 : :
67 : :
68 : :
69 : 0 : sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageWidth (void)
70 : : throw (::com::sun::star::uno::RuntimeException)
71 : : {
72 : 0 : return AccessibleShape::getSize().Width;
73 : : }
74 : :
75 : :
76 : :
77 : :
78 : : //===== XInterface ==========================================================
79 : :
80 : : com::sun::star::uno::Any SAL_CALL
81 : 0 : AccessibleGraphicShape::queryInterface (const com::sun::star::uno::Type & rType)
82 : : throw (::com::sun::star::uno::RuntimeException)
83 : : {
84 : 0 : ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
85 [ # # ]: 0 : if ( ! aReturn.hasValue())
86 : : aReturn = ::cppu::queryInterface (rType,
87 [ # # ]: 0 : static_cast<XAccessibleImage*>(this));
88 : 0 : return aReturn;
89 : : }
90 : :
91 : :
92 : :
93 : : void SAL_CALL
94 : 0 : AccessibleGraphicShape::acquire (void)
95 : : throw ()
96 : : {
97 : 0 : AccessibleShape::acquire ();
98 : 0 : }
99 : :
100 : :
101 : :
102 : : void SAL_CALL
103 : 0 : AccessibleGraphicShape::release (void)
104 : : throw ()
105 : : {
106 : 0 : AccessibleShape::release ();
107 : 0 : }
108 : :
109 : :
110 : :
111 : :
112 : : //===== XServiceInfo ========================================================
113 : :
114 : : ::rtl::OUString SAL_CALL
115 : 0 : AccessibleGraphicShape::getImplementationName (void)
116 : : throw (::com::sun::star::uno::RuntimeException)
117 : : {
118 : : return ::rtl::OUString(
119 : 0 : RTL_CONSTASCII_USTRINGPARAM("AccessibleGraphicShape"));
120 : : }
121 : :
122 : :
123 : :
124 : :
125 : : ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
126 : 0 : AccessibleGraphicShape::getSupportedServiceNames (void)
127 : : throw (::com::sun::star::uno::RuntimeException)
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 : : static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
138 [ # # ][ # # ]: 0 : "com.sun.star.drawing.AccessibleGraphicShape"));
[ # # ][ # # ]
139 [ # # ]: 0 : aServiceNames[nCount] = sAdditionalServiceName;
140 : :
141 : 0 : return aServiceNames;
142 : : }
143 : :
144 : :
145 : :
146 : :
147 : : //===== XTypeProvider ===================================================
148 : :
149 : : uno::Sequence<uno::Type> SAL_CALL
150 : 0 : AccessibleGraphicShape::getTypes (void)
151 : : throw (uno::RuntimeException)
152 : : {
153 : : // Get list of types from the context base implementation...
154 [ # # ]: 0 : uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
155 : : // ...and add the additional type for the component.
156 : 0 : long nTypeCount = aTypeList.getLength();
157 [ # # ]: 0 : aTypeList.realloc (nTypeCount + 1);
158 : : const uno::Type aImageType =
159 [ # # ]: 0 : ::getCppuType((const uno::Reference<XAccessibleImage>*)0);
160 [ # # ]: 0 : aTypeList[nTypeCount] = aImageType;
161 : :
162 : 0 : return aTypeList;
163 : : }
164 : :
165 : :
166 : :
167 : :
168 : : /// Create the base name of this object, i.e. the name without appended number.
169 : : ::rtl::OUString
170 : 0 : AccessibleGraphicShape::CreateAccessibleBaseName (void)
171 : : throw (::com::sun::star::uno::RuntimeException)
172 : : {
173 : 0 : ::rtl::OUString sName;
174 : :
175 [ # # ][ # # ]: 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
176 [ # # ]: 0 : switch (nShapeType)
177 : : {
178 : : case DRAWING_GRAPHIC_OBJECT:
179 [ # # ]: 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape"));
180 : : break;
181 : :
182 : : default:
183 [ # # ]: 0 : sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleGraphicShape"));
184 [ # # ]: 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
185 [ # # ]: 0 : if (xDescriptor.is())
186 : : sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
187 [ # # ][ # # ]: 0 : + xDescriptor->getShapeType();
[ # # ]
188 : : }
189 : :
190 : 0 : return sName;
191 : : }
192 : :
193 : :
194 : :
195 : : ::rtl::OUString
196 : 0 : AccessibleGraphicShape::CreateAccessibleDescription (void)
197 : : throw (::com::sun::star::uno::RuntimeException)
198 : : {
199 : 0 : return CreateAccessibleName ();
200 : : }
201 : :
202 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|