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 #include <svx/svdmodel.hxx>
26 
27 #include <com/sun/star/accessibility/AccessibleRole.hpp>
28 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
29 #include <comphelper/sequence.hxx>
31 
32 using namespace ::accessibility;
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::accessibility;
35 
36 // internal
37 AccessibleGraphicShape::AccessibleGraphicShape (
38  const AccessibleShapeInfo& rShapeInfo,
39  const AccessibleShapeTreeInfo& rShapeTreeInfo)
40  : AccessibleShape (rShapeInfo, rShapeTreeInfo)
41 {
42 }
43 
44 
46 {
47 }
48 
49 // XAccessibleImage
51 {
52  if (m_pShape)
53  return m_pShape->GetTitle();
55 }
56 
57 
59 {
60  return AccessibleShape::getSize().Height;
61 }
62 
63 
65 {
66  return AccessibleShape::getSize().Width;
67 }
68 
69 // XInterface
70 css::uno::Any SAL_CALL
71  AccessibleGraphicShape::queryInterface (const css::uno::Type & rType)
72 {
73  css::uno::Any aReturn = AccessibleShape::queryInterface (rType);
74  if ( ! aReturn.hasValue())
75  aReturn = ::cppu::queryInterface (rType,
76  static_cast<XAccessibleImage*>(this));
77  return aReturn;
78 }
79 
80 
81 void SAL_CALL
83  throw ()
84 {
86 }
87 
88 
89 void SAL_CALL
91  throw ()
92 {
94 }
95 
96 // XServiceInfo
97 OUString SAL_CALL
99 {
100  return "AccessibleGraphicShape";
101 }
102 
103 
104 css::uno::Sequence< OUString> SAL_CALL
106 {
107  ThrowIfDisposed ();
108  // Get list of supported service names from base class...
109  uno::Sequence<OUString> aServiceNames =
111  sal_Int32 nCount (aServiceNames.getLength());
112 
113  // ...and add additional names.
114  aServiceNames.realloc (nCount + 1);
115  aServiceNames[nCount] = "com.sun.star.drawing.AccessibleGraphicShape";
116 
117  return aServiceNames;
118 }
119 
120 // XTypeProvider
121 uno::Sequence<uno::Type> SAL_CALL
123 {
124  // Get list of types from the context base implementation...
126  uno::Sequence { cppu::UnoType<XAccessibleImage>::get() });
127 }
128 
129 
131 OUString
133 {
134  OUString sName;
135 
137  switch (nShapeType)
138  {
140  sName = "GraphicObjectShape";
141  break;
142 
143  default:
144  sName = "UnknownAccessibleGraphicShape";
145  uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
146  if (xDescriptor.is())
147  sName += ": " + xDescriptor->getShapeType();
148  }
149 
150  return sName;
151 }
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Sequence< OUString > aServiceNames
virtual css::awt::Size SAL_CALL getSize() override
virtual void SAL_CALL acquire() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
int nCount
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:769
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