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>
22 #include <com/sun/star/uno/RuntimeException.hpp>
25 #include <flyfrm.hxx>
26 #include "accembedded.hxx"
27 #include <cntfrm.hxx>
28 #include <notxtfrm.hxx>
29 #include <ndole.hxx>
30 #include <doc.hxx>
31 #include <docsh.hxx>
32 
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::lang;
35 using namespace ::com::sun::star::accessibility;
36 
37 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject";
38 
40  std::shared_ptr<SwAccessibleMap> const& pInitMap,
41  const SwFlyFrame* pFlyFrame ) :
42  SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrame )
43 {
44 }
45 
47 {
48 }
49 
50 // XInterface
51 css::uno::Any SAL_CALL
52  SwAccessibleEmbeddedObject::queryInterface (const css::uno::Type & rType)
53 {
54  css::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType);
55  if ( ! aReturn.hasValue())
56  aReturn = ::cppu::queryInterface (rType,
57  static_cast< css::accessibility::XAccessibleExtendedAttributes* >(this) );
58  return aReturn;
59 }
60 
61 void SAL_CALL
63  throw ()
64 {
66 }
67 
68 void SAL_CALL
70  throw ()
71 {
73 }
74 
76 {
77  return sImplementationName;
78 }
79 
80 sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService(const OUString& sTestServiceName)
81 {
82  return cppu::supportsService(this, sTestServiceName);
83 }
84 
85 uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames()
86 {
87  return { "com.sun.star.text.AccessibleTextEmbeddedObject", sAccessibleServiceName };
88 }
89 
90 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId()
91 {
92  return css::uno::Sequence<sal_Int8>();
93 }
94 
95 // XAccessibleExtendedAttributes
97 {
99 
100  css::uno::Any strRet;
101  OUString style;
102  SwFlyFrame* pFFrame = getFlyFrame();
103 
104  if( pFFrame )
105  {
106  style = "style:";
107  SwContentFrame* pCFrame;
108  pCFrame = pFFrame->ContainsContent();
109  if( pCFrame )
110  {
111  assert(pCFrame->IsNoTextFrame());
112  SwContentNode *const pCNode = static_cast<SwNoTextFrame*>(pCFrame)->GetNode();
113  if( pCNode )
114  {
115  style += static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString();
116  }
117  }
118  style += ";";
119  }
120  strRet <<= style;
121  return strRet;
122 }
123 
124 /* 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:756
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:80
virtual OUString SAL_CALL getImplementationName() override
Definition: accembedded.cxx:75
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:85
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: accembedded.cxx:52
const sal_Char sImplementationName[]
Definition: accembedded.cxx:37
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
Definition: accembedded.cxx:96
char sal_Char
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL release() override
Definition: accembedded.cxx:69
SwFlyFrame * getFlyFrame() const
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: accembedded.cxx:90
unsigned char sal_Bool
virtual void SAL_CALL acquire() override
Definition: accembedded.cxx:62
SwAccessibleEmbeddedObject(std::shared_ptr< SwAccessibleMap > const &pInitMap, const SwFlyFrame *pFlyFrame)
Definition: accembedded.cxx:39
virtual void SAL_CALL release() override
virtual ~SwAccessibleEmbeddedObject() override
Definition: accembedded.cxx:46
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)