tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / svx / source / accessibility / AccessibleOLEShape.cxx
blob33cce7ac3b90729a7e8e0498cde9cb909397bbeb
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/AccessibleOLEShape.hxx>
22 #include <svx/ShapeTypeHandler.hxx>
23 #include <svx/SvxShapeTypes.hxx>
24 #include <svx/svdoole2.hxx>
26 #include <comphelper/sequence.hxx>
27 #include <cppuhelper/queryinterface.hxx>
29 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30 #include <com/sun/star/drawing/XShape.hpp>
31 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
33 using namespace ::accessibility;
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::accessibility;
38 // internal
39 AccessibleOLEShape::AccessibleOLEShape (
40 const AccessibleShapeInfo& rShapeInfo,
41 const AccessibleShapeTreeInfo& rShapeTreeInfo)
42 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
47 AccessibleOLEShape::~AccessibleOLEShape()
51 // XAccessibleAction
52 sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount()
54 return 0;
58 sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
60 throw lang::IndexOutOfBoundsException();
64 OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
66 throw lang::IndexOutOfBoundsException();
70 Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
72 throw lang::IndexOutOfBoundsException();
75 // XInterface
76 css::uno::Any SAL_CALL
77 AccessibleOLEShape::queryInterface (const css::uno::Type & rType)
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;
87 void SAL_CALL
88 AccessibleOLEShape::acquire()
89 noexcept
91 AccessibleShape::acquire ();
95 void SAL_CALL
96 AccessibleOLEShape::release()
97 noexcept
99 AccessibleShape::release ();
102 // XServiceInfo
103 OUString SAL_CALL
104 AccessibleOLEShape::getImplementationName()
106 return u"AccessibleOLEShape"_ustr;
110 css::uno::Sequence< OUString> SAL_CALL
111 AccessibleOLEShape::getSupportedServiceNames()
113 ThrowIfDisposed();
114 const css::uno::Sequence<OUString> vals { u"com.sun.star.drawing.AccessibleOLEShape"_ustr };
115 return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals);
118 // XTypeProvider
119 uno::Sequence<uno::Type> SAL_CALL AccessibleOLEShape::getTypes()
121 // Get list of types from the context base implementation...
122 return comphelper::concatSequences(AccessibleShape::getTypes(),
123 uno::Sequence { cppu::UnoType<XAccessibleAction>::get() } );
126 // XAccessibleExtendedAttributes
127 uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes()
129 uno::Any strRet;
130 OUString style;
131 if( m_pShape )
133 style = "style:" + static_cast<SdrOle2Obj*>(m_pShape)->GetStyleString();
135 style += ";";
136 strRet <<= style;
137 return strRet;
140 /// Set this object's name if is different to the current name.
141 OUString
142 AccessibleOLEShape::CreateAccessibleBaseName()
144 OUString sName;
146 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
147 switch (nShapeType)
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;
162 default:
163 sName = "UnknownAccessibleOLEShape";
164 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
165 if (xDescriptor.is())
166 sName += ": " + xDescriptor->getShapeType();
169 return sName;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */