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