LibreOffice Module svx (master)  1
AccessibleOLEShape.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/svdoole2.hxx>
25 
26 #include <comphelper/sequence.hxx>
28 
29 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30 #include <com/sun/star/drawing/XShape.hpp>
31 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
32 
33 using namespace ::accessibility;
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::accessibility;
37 
38 // internal
39 AccessibleOLEShape::AccessibleOLEShape (
40  const AccessibleShapeInfo& rShapeInfo,
41  const AccessibleShapeTreeInfo& rShapeTreeInfo)
42  : AccessibleShape (rShapeInfo, rShapeTreeInfo)
43 {
44 }
45 
46 
48 {
49 }
50 
51 // XAccessibleAction
53 {
54  return 0;
55 }
56 
57 
58 sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
59 {
60  throw lang::IndexOutOfBoundsException();
61 }
62 
63 
64 OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
65 {
66  throw lang::IndexOutOfBoundsException();
67 }
68 
69 
70 Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
71 {
72  throw lang::IndexOutOfBoundsException();
73 }
74 
75 // XInterface
76 css::uno::Any SAL_CALL
77  AccessibleOLEShape::queryInterface (const css::uno::Type & rType)
78 {
79  css::uno::Any aReturn = AccessibleShape::queryInterface (rType);
80  if ( ! aReturn.hasValue())
81  aReturn = ::cppu::queryInterface (rType,
82  static_cast<XAccessibleAction*>(this));
83  return aReturn;
84 }
85 
86 
87 void SAL_CALL
89  throw ()
90 {
92 }
93 
94 
95 void SAL_CALL
97  throw ()
98 {
100 }
101 
102 // XServiceInfo
103 OUString SAL_CALL
105 {
106  return "AccessibleOLEShape";
107 }
108 
109 
110 css::uno::Sequence< OUString> SAL_CALL
112 {
113  ThrowIfDisposed();
114  const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleOLEShape" };
116 }
117 
118 // XTypeProvider
119 uno::Sequence<uno::Type> SAL_CALL AccessibleOLEShape::getTypes()
120 {
121  // Get list of types from the context base implementation...
123  uno::Sequence { cppu::UnoType<XAccessibleAction>::get() } );
124 }
125 
126 // XAccessibleExtendedAttributes
128 {
129  uno::Any strRet;
130  OUString style;
131  if( m_pShape )
132  {
133  style = "style:" + static_cast<SdrOle2Obj*>(m_pShape)->GetStyleString();
134  }
135  style += ";";
136  strRet <<= style;
137  return strRet;
138 }
139 
141 OUString
143 {
144  OUString sName;
145 
147  switch (nShapeType)
148  {
149  case DRAWING_APPLET:
150  sName = "AppletOLEShape";
151  break;
152  case DRAWING_FRAME:
153  sName = "FrameOLEShape";
154  break;
155  case DRAWING_OLE:
156  sName = "OLEShape";
157  break;
158  case DRAWING_PLUGIN:
159  sName = "PluginOLEShape";
160  break;
161 
162  default:
163  sName = "UnknownAccessibleOLEShape";
164  uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
165  if (xDescriptor.is())
166  sName += ": " + xDescriptor->getShapeType();
167  }
168 
169  return sName;
170 }
171 
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
sal_Int32 SAL_CALL getAccessibleActionCount() override
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
virtual void SAL_CALL acquire() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() 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.
unsigned char sal_Bool
static ShapeTypeHandler & Instance()
This function returns a reference to the only instance of this class.
css::uno::Type const & get()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual OUString CreateAccessibleBaseName() override
Create a name string that contains the accessible name.
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)
exports com.sun.star. style
This base class provides a base implementation for all shapes.
sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) 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
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...
virtual void SAL_CALL acquire() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
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...
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)