LibreOffice Module svx (master)  1
AccessibleGraphicShape.cxx
Go to the documentation of this file.
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 
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>
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  : AccessibleShape (rShapeInfo, rShapeTreeInfo)
40 {
41 }
42 
43 
45 {
46 }
47 
48 // XAccessibleImage
50 {
51  if (m_pShape)
52  return m_pShape->GetTitle();
54 }
55 
56 
58 {
59  return AccessibleShape::getSize().Height;
60 }
61 
62 
64 {
65  return AccessibleShape::getSize().Width;
66 }
67 
68 // XInterface
69 css::uno::Any SAL_CALL
70  AccessibleGraphicShape::queryInterface (const css::uno::Type & rType)
71 {
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;
77 }
78 
79 
80 void SAL_CALL
82  throw ()
83 {
85 }
86 
87 
88 void SAL_CALL
90  throw ()
91 {
93 }
94 
95 // XServiceInfo
96 OUString SAL_CALL
98 {
99  return "AccessibleGraphicShape";
100 }
101 
102 
103 css::uno::Sequence< OUString> SAL_CALL
105 {
106  ThrowIfDisposed ();
107  const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleGraphicShape" };
109 }
110 
111 // XTypeProvider
112 uno::Sequence<uno::Type> SAL_CALL
114 {
115  // Get list of types from the context base implementation...
117  uno::Sequence { cppu::UnoType<XAccessibleImage>::get() });
118 }
119 
120 
122 OUString
124 {
125  OUString sName;
126 
128  switch (nShapeType)
129  {
131  sName = "GraphicObjectShape";
132  break;
133 
134  default:
135  sName = "UnknownAccessibleGraphicShape";
136  uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
137  if (xDescriptor.is())
138  sName += ": " + xDescriptor->getShapeType();
139  }
140 
141  return sName;
142 }
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::awt::Size SAL_CALL getSize() override
virtual void SAL_CALL acquire() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString SAL_CALL getAccessibleImageDescription() override
sal_Int32 SAL_CALL getAccessibleImageWidth() override
css::uno::Reference< css::drawing::XShape > mxShape
Reference to the actual shape.
OUString sName
int ShapeTypeId
Use an integer to represent shape type ids.
OUString GetTitle() const
Definition: svdobj.cxx:742
static ShapeTypeHandler & Instance()
This function returns a reference to the only instance of this class.
sal_Int32 SAL_CALL getAccessibleImageHeight() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Type const & get()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
virtual void SAL_CALL release() override
virtual OUString CreateAccessibleBaseName() override
Create a name string that contains the accessible name.
This base class provides a base implementation for all shapes.
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
virtual void SAL_CALL acquire() override
ShapeTypeId GetTypeId(const OUString &aServiceName) const
Determines the type id of a shape with the given service name.
virtual void SAL_CALL release() override
This class is a container for the information specific for a single shape that is passed to the const...
SdrObject * m_pShape
This object can be removed when we have an extra interface to ask if the shape is selected...
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
virtual OUString SAL_CALL getAccessibleDescription() override
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override