LibreOffice Module sw (master)  1
accembedded.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 
20 #include <vcl/svapp.hxx>
21 #include <com/sun/star/accessibility/AccessibleRole.hpp>
24 #include <flyfrm.hxx>
25 #include "accembedded.hxx"
26 #include <cntfrm.hxx>
27 #include <notxtfrm.hxx>
28 #include <ndole.hxx>
29 
30 using namespace ::com::sun::star;
31 using namespace ::com::sun::star::lang;
32 using namespace ::com::sun::star::accessibility;
33 
34 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject";
35 
37  std::shared_ptr<SwAccessibleMap> const& pInitMap,
38  const SwFlyFrame* pFlyFrame ) :
39  SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrame )
40 {
41 }
42 
44 {
45 }
46 
47 // XInterface
48 css::uno::Any SAL_CALL
49  SwAccessibleEmbeddedObject::queryInterface (const css::uno::Type & rType)
50 {
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;
56 }
57 
58 void SAL_CALL
60  throw ()
61 {
63 }
64 
65 void SAL_CALL
67  throw ()
68 {
70 }
71 
73 {
74  return sImplementationName;
75 }
76 
77 sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService(const OUString& sTestServiceName)
78 {
79  return cppu::supportsService(this, sTestServiceName);
80 }
81 
82 uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames()
83 {
84  return { "com.sun.star.text.AccessibleTextEmbeddedObject", sAccessibleServiceName };
85 }
86 
87 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId()
88 {
89  return css::uno::Sequence<sal_Int8>();
90 }
91 
92 // XAccessibleExtendedAttributes
94 {
96 
97  css::uno::Any strRet;
98  OUString style;
99  SwFlyFrame* pFFrame = getFlyFrame();
100 
101  if( pFFrame )
102  {
103  style = "style:";
104  SwContentFrame* pCFrame;
105  pCFrame = pFFrame->ContainsContent();
106  if( pCFrame )
107  {
108  assert(pCFrame->IsNoTextFrame());
109  SwContentNode *const pCNode = static_cast<SwNoTextFrame*>(pCFrame)->GetNode();
110  if( pCNode )
111  {
112  style += static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString();
113  }
114  }
115  style += ";";
116  }
117  strRet <<= style;
118  return strRet;
119 }
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:754
virtual void SAL_CALL acquire() override
const sal_Char sAccessibleServiceName[]
Definition: acccontext.hxx:43
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
Definition: accembedded.cxx:77
virtual OUString SAL_CALL getImplementationName() override
Definition: accembedded.cxx:72
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: accembedded.cxx:82
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: accembedded.cxx:49
const sal_Char sImplementationName[]
Definition: accembedded.cxx:34
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
Definition: accembedded.cxx:93
char sal_Char
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL release() override
Definition: accembedded.cxx:66
SwFlyFrame * getFlyFrame() const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: accembedded.cxx:87
unsigned char sal_Bool
virtual void SAL_CALL acquire() override
Definition: accembedded.cxx:59
SwAccessibleEmbeddedObject(std::shared_ptr< SwAccessibleMap > const &pInitMap, const SwFlyFrame *pFlyFrame)
Definition: accembedded.cxx:36
virtual void SAL_CALL release() override
virtual ~SwAccessibleEmbeddedObject() override
Definition: accembedded.cxx:43
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
bool IsNoTextFrame() const
Definition: frame.hxx:1214
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:66
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)