Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / access / accembedded.cxx
blob1eb54cf258787caae81cbd829bace80b9c8daa0b
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 <vcl/svapp.hxx>
21 #include <com/sun/star/accessibility/AccessibleRole.hpp>
22 #include <cppuhelper/queryinterface.hxx>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <flyfrm.hxx>
25 #include "accembedded.hxx"
26 #include <cntfrm.hxx>
27 #include <notxtfrm.hxx>
28 #include <ndole.hxx>
30 using namespace ::com::sun::star;
31 using namespace ::com::sun::star::lang;
32 using namespace ::com::sun::star::accessibility;
34 constexpr OUStringLiteral sImplementationName = u"com.sun.star.comp.Writer.SwAccessibleEmbeddedObject";
36 SwAccessibleEmbeddedObject::SwAccessibleEmbeddedObject(
37 std::shared_ptr<SwAccessibleMap> const& pInitMap,
38 const SwFlyFrame* pFlyFrame ) :
39 SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrame )
43 SwAccessibleEmbeddedObject::~SwAccessibleEmbeddedObject()
47 // XInterface
48 css::uno::Any SAL_CALL
49 SwAccessibleEmbeddedObject::queryInterface (const css::uno::Type & rType)
51 css::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType);
52 if ( ! aReturn.hasValue())
53 aReturn = ::cppu::queryInterface (rType,
54 static_cast< css::accessibility::XAccessibleExtendedAttributes* >(this) );
55 return aReturn;
58 void SAL_CALL
59 SwAccessibleEmbeddedObject::acquire()
60 noexcept
62 SwAccessibleNoTextFrame::acquire ();
65 void SAL_CALL
66 SwAccessibleEmbeddedObject::release()
67 noexcept
69 SwAccessibleNoTextFrame::release ();
72 OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName()
74 return sImplementationName;
77 sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService(const OUString& sTestServiceName)
79 return cppu::supportsService(this, sTestServiceName);
82 uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames()
84 return { "com.sun.star.text.AccessibleTextEmbeddedObject", sAccessibleServiceName };
87 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId()
89 return css::uno::Sequence<sal_Int8>();
92 // XAccessibleExtendedAttributes
93 css::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes()
95 SolarMutexGuard g;
97 css::uno::Any strRet;
98 OUString style;
99 SwFlyFrame* pFFrame = getFlyFrame();
101 if( pFFrame )
103 style = "style:";
104 SwContentFrame* pCFrame;
105 pCFrame = pFFrame->ContainsContent();
106 if( pCFrame )
108 assert(pCFrame->IsNoTextFrame());
109 SwContentNode *const pCNode = static_cast<SwNoTextFrame*>(pCFrame)->GetNode();
110 if( pCNode )
112 style += static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString();
115 style += ";";
117 strRet <<= style;
118 return strRet;
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */