1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/AccessibleGraphicShape.hxx>
22 #include <svx/ShapeTypeHandler.hxx>
23 #include <svx/SvxShapeTypes.hxx>
24 #include <svx/svdobj.hxx>
26 #include <com/sun/star/drawing/XShape.hpp>
27 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
28 #include <comphelper/sequence.hxx>
29 #include <cppuhelper/queryinterface.hxx>
31 using namespace ::accessibility
;
32 using namespace ::com::sun::star
;
33 using namespace ::com::sun::star::accessibility
;
36 AccessibleGraphicShape::AccessibleGraphicShape (
37 const AccessibleShapeInfo
& rShapeInfo
,
38 const AccessibleShapeTreeInfo
& rShapeTreeInfo
)
39 : AccessibleShape (rShapeInfo
, rShapeTreeInfo
)
44 AccessibleGraphicShape::~AccessibleGraphicShape()
49 OUString SAL_CALL
AccessibleGraphicShape::getAccessibleImageDescription()
52 return m_pShape
->GetTitle();
53 return AccessibleShape::getAccessibleDescription ();
57 sal_Int32 SAL_CALL
AccessibleGraphicShape::getAccessibleImageHeight()
59 return AccessibleShape::getSize().Height
;
63 sal_Int32 SAL_CALL
AccessibleGraphicShape::getAccessibleImageWidth()
65 return AccessibleShape::getSize().Width
;
69 css::uno::Any SAL_CALL
70 AccessibleGraphicShape::queryInterface (const css::uno::Type
& rType
)
72 css::uno::Any aReturn
= AccessibleShape::queryInterface (rType
);
73 if ( ! aReturn
.hasValue())
74 aReturn
= ::cppu::queryInterface (rType
,
75 static_cast<XAccessibleImage
*>(this));
81 AccessibleGraphicShape::acquire()
84 AccessibleShape::acquire ();
89 AccessibleGraphicShape::release()
92 AccessibleShape::release ();
97 AccessibleGraphicShape::getImplementationName()
99 return "AccessibleGraphicShape";
103 css::uno::Sequence
< OUString
> SAL_CALL
104 AccessibleGraphicShape::getSupportedServiceNames()
107 const css::uno::Sequence
<OUString
> vals
{ "com.sun.star.drawing.AccessibleGraphicShape" };
108 return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals
);
112 uno::Sequence
<uno::Type
> SAL_CALL
113 AccessibleGraphicShape::getTypes()
115 // Get list of types from the context base implementation...
116 return comphelper::concatSequences(AccessibleShape::getTypes(),
117 uno::Sequence
{ cppu::UnoType
<XAccessibleImage
>::get() });
121 /// Create the base name of this object, i.e. the name without appended number.
123 AccessibleGraphicShape::CreateAccessibleBaseName()
127 ShapeTypeId nShapeType
= ShapeTypeHandler::Instance().GetTypeId (mxShape
);
130 case DRAWING_GRAPHIC_OBJECT
:
131 sName
= "GraphicObjectShape";
135 sName
= "UnknownAccessibleGraphicShape";
136 uno::Reference
<drawing::XShapeDescriptor
> xDescriptor (mxShape
);
137 if (xDescriptor
.is())
138 sName
+= ": " + xDescriptor
->getShapeType();
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */