LibreOffice Module chart2 (master) 1
AccessibleTextHelper.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 <sal/config.h>
21
22#include <memory>
23
25#include <DrawViewWrapper.hxx>
26
27#include <vcl/svapp.hxx>
28
30#include <svx/unoshtxt.hxx>
32#include <vcl/window.hxx>
33
34#include <com/sun/star/awt/XWindow.hpp>
35#include <com/sun/star/accessibility/AccessibleRole.hpp>
36#include <osl/diagnose.h>
37
38using namespace ::com::sun::star;
39using namespace ::com::sun::star::accessibility;
40
41using ::com::sun::star::uno::Reference;
42using ::com::sun::star::uno::Sequence;
43
44namespace chart
45{
46
48 DrawViewWrapper * pDrawViewWrapper ) :
49 m_pDrawViewWrapper( pDrawViewWrapper )
50{}
51
53{
54}
55
56// ____ XInitialization ____
58{
59 OUString aCID;
60 Reference< XAccessible > xEventSource;
62
63 if( aArguments.getLength() >= 3 )
64 {
65 aArguments[0] >>= aCID;
66 aArguments[1] >>= xEventSource;
67 aArguments[2] >>= xWindow;
68 }
69 OSL_ENSURE( !aCID.isEmpty(), "Empty CID" );
70 OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
71 OSL_ENSURE( xWindow.is(), "Empty Window" );
72 if( !xEventSource.is() || aCID.isEmpty() )
73 return;
74
75 SolarMutexGuard aSolarGuard;
76
77 m_pTextHelper.reset();
78
80 if( pWindow )
81 {
83 if( pView )
84 {
86 if( pTextObj )
87 {
88 m_pTextHelper.reset( new ::accessibility::AccessibleTextHelper(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *pView, *pWindow->GetOutDev())) );
89 m_pTextHelper->SetEventSource( xEventSource );
90 }
91 }
92 }
93
94 OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" );
95}
96
97// ____ XAccessibleContext ____
99{
100 if( m_pTextHelper )
101 {
102 SolarMutexGuard aSolarGuard;
103 return m_pTextHelper->GetChildCount();
104 }
105 return 0;
106}
107
109{
110 if( m_pTextHelper )
111 {
112 SolarMutexGuard aSolarGuard;
113 return m_pTextHelper->GetChild( i );
114 }
116}
117
119{
120 OSL_FAIL( "Not implemented in this helper" );
122}
123
125{
126 OSL_FAIL( "Not implemented in this helper" );
127 return -1;
128}
129
131{
132 OSL_FAIL( "Not implemented in this helper" );
133 return AccessibleRole::UNKNOWN;
134}
135
137{
138 OSL_FAIL( "Not implemented in this helper" );
139 return OUString();
140}
141
143{
144 OSL_FAIL( "Not implemented in this helper" );
145 return OUString();
146}
147
149{
150 OSL_FAIL( "Not implemented in this helper" );
152}
153
155{
156 OSL_FAIL( "Not implemented in this helper" );
157 return 0;
158}
159
160lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
161{
162 OSL_FAIL( "Not implemented in this helper" );
163 return lang::Locale();
164}
165
166} // namespace chart
167
168/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
AccessibleTextHelper(DrawViewWrapper *pDrawViewWrapper)
virtual ~AccessibleTextHelper() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual OUString SAL_CALL getAccessibleName() override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual css::lang::Locale SAL_CALL getLocale() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual OUString SAL_CALL getAccessibleDescription() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
std::unique_ptr<::accessibility::AccessibleTextHelper > m_pTextHelper
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Must be called at least once for this helper class to work.
virtual ::sal_Int16 SAL_CALL getAccessibleRole() override
SdrObject * getNamedSdrObject(const OUString &rName) const
Sequence< PropertyValue > aArguments
int i