Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/accessibility/AccessibleGraphicShape.cxx
Line
Count
Source
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
#include <svx/svdobj.hxx>
25
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>
30
31
using namespace ::accessibility;
32
using namespace ::com::sun::star;
33
using namespace ::com::sun::star::accessibility;
34
35
// internal
36
AccessibleGraphicShape::AccessibleGraphicShape (
37
    const AccessibleShapeInfo& rShapeInfo,
38
    const AccessibleShapeTreeInfo& rShapeTreeInfo)
39
0
    : AccessibleShape (rShapeInfo, rShapeTreeInfo)
40
0
{
41
0
}
42
43
44
AccessibleGraphicShape::~AccessibleGraphicShape()
45
0
{
46
0
}
47
48
// XAccessibleImage
49
OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription()
50
0
{
51
0
    if (m_pShape)
52
0
        return m_pShape->GetTitle();
53
0
    return AccessibleShape::getAccessibleDescription ();
54
0
}
55
56
57
sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageHeight()
58
0
{
59
0
    return AccessibleShape::getSize().Height;
60
0
}
61
62
63
sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageWidth()
64
0
{
65
0
    return AccessibleShape::getSize().Width;
66
0
}
67
68
// XInterface
69
css::uno::Any SAL_CALL
70
    AccessibleGraphicShape::queryInterface (const css::uno::Type & rType)
71
0
{
72
0
    css::uno::Any aReturn = AccessibleShape::queryInterface (rType);
73
0
    if ( ! aReturn.hasValue())
74
0
        aReturn = ::cppu::queryInterface (rType,
75
0
            static_cast<XAccessibleImage*>(this));
76
0
    return aReturn;
77
0
}
78
79
80
void SAL_CALL
81
    AccessibleGraphicShape::acquire()
82
    noexcept
83
0
{
84
0
    AccessibleShape::acquire ();
85
0
}
86
87
88
void SAL_CALL
89
    AccessibleGraphicShape::release()
90
    noexcept
91
0
{
92
0
    AccessibleShape::release ();
93
0
}
94
95
// XServiceInfo
96
OUString SAL_CALL
97
    AccessibleGraphicShape::getImplementationName()
98
0
{
99
0
    return u"AccessibleGraphicShape"_ustr;
100
0
}
101
102
103
css::uno::Sequence< OUString> SAL_CALL
104
    AccessibleGraphicShape::getSupportedServiceNames()
105
0
{
106
0
    ensureAlive();
107
0
    const css::uno::Sequence<OUString> vals { u"com.sun.star.drawing.AccessibleGraphicShape"_ustr };
108
0
    return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals);
109
0
}
110
111
// XTypeProvider
112
uno::Sequence<uno::Type> SAL_CALL
113
    AccessibleGraphicShape::getTypes()
114
0
{
115
    // Get list of types from the context base implementation...
116
0
    return comphelper::concatSequences(AccessibleShape::getTypes(),
117
0
            uno::Sequence { cppu::UnoType<XAccessibleImage>::get() });
118
0
}
119
120
121
/// Create the base name of this object, i.e. the name without appended number.
122
OUString
123
    AccessibleGraphicShape::CreateAccessibleBaseName()
124
0
{
125
0
    OUString sName;
126
127
0
    ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
128
0
    switch (nShapeType)
129
0
    {
130
0
        case DRAWING_GRAPHIC_OBJECT:
131
0
            sName = "GraphicObjectShape";
132
0
            break;
133
134
0
        default:
135
0
            sName = "UnknownAccessibleGraphicShape";
136
0
            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
137
0
            if (xDescriptor.is())
138
0
                sName += ": " + xDescriptor->getShapeType();
139
0
    }
140
141
0
    return sName;
142
0
}
143
144
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */