tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / svx / source / accessibility / AccessibleGraphicShape.cxx
blobff5e92e955276b2807a29d7161a69580c40f1760
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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;
35 // internal
36 AccessibleGraphicShape::AccessibleGraphicShape (
37 const AccessibleShapeInfo& rShapeInfo,
38 const AccessibleShapeTreeInfo& rShapeTreeInfo)
39 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
44 AccessibleGraphicShape::~AccessibleGraphicShape()
48 // XAccessibleImage
49 OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription()
51 if (m_pShape)
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;
68 // XInterface
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));
76 return aReturn;
80 void SAL_CALL
81 AccessibleGraphicShape::acquire()
82 noexcept
84 AccessibleShape::acquire ();
88 void SAL_CALL
89 AccessibleGraphicShape::release()
90 noexcept
92 AccessibleShape::release ();
95 // XServiceInfo
96 OUString SAL_CALL
97 AccessibleGraphicShape::getImplementationName()
99 return u"AccessibleGraphicShape"_ustr;
103 css::uno::Sequence< OUString> SAL_CALL
104 AccessibleGraphicShape::getSupportedServiceNames()
106 ThrowIfDisposed ();
107 const css::uno::Sequence<OUString> vals { u"com.sun.star.drawing.AccessibleGraphicShape"_ustr };
108 return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals);
111 // XTypeProvider
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.
122 OUString
123 AccessibleGraphicShape::CreateAccessibleBaseName()
125 OUString sName;
127 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
128 switch (nShapeType)
130 case DRAWING_GRAPHIC_OBJECT:
131 sName = "GraphicObjectShape";
132 break;
134 default:
135 sName = "UnknownAccessibleGraphicShape";
136 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
137 if (xDescriptor.is())
138 sName += ": " + xDescriptor->getShapeType();
141 return sName;
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */