Line data Source code
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>
23 : #include <comphelper/servicehelper.hxx>
24 : #include <cppuhelper/supportsservice.hxx>
25 : #include <flyfrm.hxx>
26 : #include "accembedded.hxx"
27 : #include "cntfrm.hxx"
28 : #include "ndole.hxx"
29 : #include <doc.hxx>
30 : #include <docsh.hxx>
31 :
32 : using namespace ::com::sun::star;
33 : using namespace ::com::sun::star::lang;
34 : using namespace ::com::sun::star::accessibility;
35 :
36 : const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleEmbeddedObject";
37 :
38 0 : SwAccessibleEmbeddedObject::SwAccessibleEmbeddedObject(
39 : SwAccessibleMap* pInitMap,
40 : const SwFlyFrm* pFlyFrm ) :
41 0 : SwAccessibleNoTextFrame( pInitMap, AccessibleRole::EMBEDDED_OBJECT, pFlyFrm )
42 : {
43 0 : }
44 :
45 0 : SwAccessibleEmbeddedObject::~SwAccessibleEmbeddedObject()
46 : {
47 0 : }
48 :
49 : // XInterface
50 : com::sun::star::uno::Any SAL_CALL
51 0 : SwAccessibleEmbeddedObject::queryInterface (const com::sun::star::uno::Type & rType)
52 : throw (::com::sun::star::uno::RuntimeException, std::exception)
53 : {
54 0 : ::com::sun::star::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType);
55 0 : if ( ! aReturn.hasValue())
56 0 : aReturn = ::cppu::queryInterface (rType,
57 0 : static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this) );
58 0 : return aReturn;
59 : }
60 :
61 : void SAL_CALL
62 0 : SwAccessibleEmbeddedObject::acquire (void)
63 : throw ()
64 : {
65 0 : SwAccessibleNoTextFrame::acquire ();
66 0 : }
67 :
68 : void SAL_CALL
69 0 : SwAccessibleEmbeddedObject::release (void)
70 : throw ()
71 : {
72 0 : SwAccessibleNoTextFrame::release ();
73 0 : }
74 :
75 0 : OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName()
76 : throw( uno::RuntimeException, std::exception )
77 : {
78 0 : return OUString(sImplementationName);
79 : }
80 :
81 0 : sal_Bool SAL_CALL SwAccessibleEmbeddedObject::supportsService(const OUString& sTestServiceName)
82 : throw (uno::RuntimeException, std::exception)
83 : {
84 0 : return cppu::supportsService(this, sTestServiceName);
85 : }
86 :
87 0 : uno::Sequence< OUString > SAL_CALL SwAccessibleEmbeddedObject::getSupportedServiceNames()
88 : throw( uno::RuntimeException, std::exception )
89 : {
90 0 : uno::Sequence< OUString > aRet(2);
91 0 : OUString* pArray = aRet.getArray();
92 0 : pArray[0] = "com.sun.star.text.AccessibleTextEmbeddedObject";
93 0 : pArray[1] = OUString( sAccessibleServiceName );
94 0 : return aRet;
95 : }
96 :
97 0 : uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementationId()
98 : throw(uno::RuntimeException, std::exception)
99 : {
100 0 : return css::uno::Sequence<sal_Int8>();
101 : }
102 :
103 : // XAccessibleExtendedAttributes
104 0 : ::com::sun::star::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes()
105 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
106 : {
107 0 : SolarMutexGuard g;
108 :
109 0 : ::com::sun::star::uno::Any strRet;
110 0 : OUString style;
111 0 : SwFlyFrm* pFFrm = getFlyFrm();
112 :
113 0 : if( pFFrm )
114 : {
115 0 : style = "style:";
116 : SwCntntFrm* pCFrm;
117 0 : pCFrm = pFFrm->ContainsCntnt();
118 0 : if( pCFrm )
119 : {
120 0 : SwCntntNode* pCNode = pCFrm->GetNode();
121 0 : if( pCNode )
122 : {
123 0 : style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString();
124 : }
125 : }
126 0 : style += ";";
127 : }
128 0 : strRet <<= style;
129 0 : return strRet;
130 270 : }
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|