/src/libreoffice/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
Line | Count | Source |
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 | | |
24 | | #include <AccessibleTextHelper.hxx> |
25 | | #include <DrawViewWrapper.hxx> |
26 | | |
27 | | #include <vcl/svapp.hxx> |
28 | | |
29 | | #include <svx/AccessibleTextHelper.hxx> |
30 | | #include <svx/unoshtxt.hxx> |
31 | | #include <vcl/window.hxx> |
32 | | |
33 | | #include <com/sun/star/accessibility/AccessibleRole.hpp> |
34 | | #include <osl/diagnose.h> |
35 | | |
36 | | using namespace ::com::sun::star; |
37 | | using namespace ::com::sun::star::accessibility; |
38 | | |
39 | | using ::com::sun::star::uno::Reference; |
40 | | |
41 | | namespace chart |
42 | | { |
43 | | |
44 | | AccessibleTextHelper::AccessibleTextHelper( |
45 | | DrawViewWrapper * pDrawViewWrapper ) : |
46 | 0 | m_pDrawViewWrapper( pDrawViewWrapper ) |
47 | 0 | {}Unexecuted instantiation: chart::AccessibleTextHelper::AccessibleTextHelper(chart::DrawViewWrapper*) Unexecuted instantiation: chart::AccessibleTextHelper::AccessibleTextHelper(chart::DrawViewWrapper*) |
48 | | |
49 | | AccessibleTextHelper::~AccessibleTextHelper() |
50 | 0 | { |
51 | 0 | } |
52 | | |
53 | | void AccessibleTextHelper::initialize(const OUString& aCID, |
54 | | const rtl::Reference<comphelper::OAccessible>& rEventSource, |
55 | | vcl::Window* pWindow) |
56 | 0 | { |
57 | 0 | OSL_ENSURE( !aCID.isEmpty(), "Empty CID" ); |
58 | 0 | assert(rEventSource.is() && "Empty Event Source"); |
59 | 0 | if (aCID.isEmpty()) |
60 | 0 | return; |
61 | | |
62 | 0 | SolarMutexGuard aSolarGuard; |
63 | |
|
64 | 0 | m_oTextHelper.reset(); |
65 | |
|
66 | 0 | if( pWindow ) |
67 | 0 | { |
68 | 0 | if (m_pDrawViewWrapper) |
69 | 0 | { |
70 | 0 | SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID ); |
71 | 0 | if( pTextObj ) |
72 | 0 | { |
73 | 0 | m_oTextHelper.emplace(std::make_unique<SvxTextEditSource>(*pTextObj, nullptr, *m_pDrawViewWrapper, *pWindow->GetOutDev())); |
74 | 0 | m_oTextHelper->SetEventSource(rEventSource); |
75 | 0 | } |
76 | 0 | } |
77 | 0 | } |
78 | |
|
79 | 0 | OSL_ENSURE( m_oTextHelper, "Couldn't create text helper" ); |
80 | 0 | } |
81 | | |
82 | | // ____ XAccessibleContext ____ |
83 | | sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleChildCount() |
84 | 0 | { |
85 | 0 | if( m_oTextHelper ) |
86 | 0 | { |
87 | 0 | SolarMutexGuard aSolarGuard; |
88 | 0 | return m_oTextHelper->GetChildCount(); |
89 | 0 | } |
90 | 0 | return 0; |
91 | 0 | } |
92 | | |
93 | | Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( sal_Int64 i ) |
94 | 0 | { |
95 | 0 | if( m_oTextHelper ) |
96 | 0 | { |
97 | 0 | SolarMutexGuard aSolarGuard; |
98 | 0 | return m_oTextHelper->GetChild( i ); |
99 | 0 | } |
100 | 0 | return Reference< XAccessible >(); |
101 | 0 | } |
102 | | |
103 | | Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent() |
104 | 0 | { |
105 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
106 | 0 | return Reference< XAccessible >(); |
107 | 0 | } |
108 | | |
109 | | sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent() |
110 | 0 | { |
111 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
112 | 0 | return -1; |
113 | 0 | } |
114 | | |
115 | | ::sal_Int16 SAL_CALL AccessibleTextHelper::getAccessibleRole() |
116 | 0 | { |
117 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
118 | 0 | return AccessibleRole::UNKNOWN; |
119 | 0 | } |
120 | | |
121 | | OUString SAL_CALL AccessibleTextHelper::getAccessibleDescription() |
122 | 0 | { |
123 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
124 | 0 | return OUString(); |
125 | 0 | } |
126 | | |
127 | | OUString SAL_CALL AccessibleTextHelper::getAccessibleName() |
128 | 0 | { |
129 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
130 | 0 | return OUString(); |
131 | 0 | } |
132 | | |
133 | | Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessibleRelationSet() |
134 | 0 | { |
135 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
136 | 0 | return Reference< XAccessibleRelationSet >(); |
137 | 0 | } |
138 | | |
139 | | sal_Int64 SAL_CALL AccessibleTextHelper::getAccessibleStateSet() |
140 | 0 | { |
141 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
142 | 0 | return 0; |
143 | 0 | } |
144 | | |
145 | | lang::Locale SAL_CALL AccessibleTextHelper::getLocale() |
146 | 0 | { |
147 | 0 | OSL_FAIL( "Not implemented in this helper" ); |
148 | 0 | return lang::Locale(); |
149 | 0 | } |
150 | | |
151 | | } // namespace chart |
152 | | |
153 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |