LibreOffice Module winaccessibility (master) 1
AccHyperLink.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 "stdafx.h"
21#include <UAccCOM.h>
22#include "AccHyperLink.h"
23
24#include <vcl/svapp.hxx>
25
26#include <com/sun/star/accessibility/XAccessible.hpp>
27#include <com/sun/star/accessibility/XAccessibleAction.hpp>
28#include "MAccessible.h"
29
30using namespace com::sun::star::accessibility;
31using namespace com::sun::star::uno;
32using namespace com::sun::star::awt;
33
39COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* nActions)
40{
41
43}
44
50COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long actionIndex)
51{
52
54}
55
62COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_description(long actionIndex,BSTR __RPC_FAR *description)
63{
64
66}
67
68COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_name( long actionIndex, BSTR __RPC_FAR *name)
69{
70
72}
73
74COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName)
75{
76
78}
79
90COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_keyBinding(
91 /* [in] */ long actionIndex,
92 /* [in] */ long nMaxBinding,
93 /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
94 /* [retval][out] */ long __RPC_FAR *nBinding)
95{
96
97 return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding, keyBinding, nBinding);
98}
99
105COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index,
106 /* [retval][out] */ VARIANT __RPC_FAR *anchor)
107{
109
110 try {
111
112 // #CHECK#
113 if(anchor == nullptr)
114 {
115 return E_INVALIDARG;
116 }
117 // #CHECK XInterface#
118 if(!pRXLink.is())
119 {
120 return E_FAIL;
121 }
122 // Get Any type value via pRXLink.
123 css::uno::Any anyVal = GetXInterface()->getAccessibleActionAnchor(index);
124 // Convert Any to VARIANT.
126
127 return S_OK;
128
129 } catch(...) { return E_FAIL; }
130}
131
137COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index,
138 /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget)
139{
141
142 try {
143
144 // #CHECK#
145 if(anchorTarget == nullptr)
146 {
147 return E_INVALIDARG;
148 }
149 // #CHECK XInterface#
150 if(!pRXLink.is())
151 {
152 return E_FAIL;
153 }
154 // Get Any type value via pRXLink.
155 css::uno::Any anyVal = GetXInterface()->getAccessibleActionObject(index);
156 // Convert Any to VARIANT.
158
159 return S_OK;
160
161 } catch(...) { return E_FAIL; }
162}
163
164
170COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index)
171{
173
174 try {
175
176 // #CHECK#
177 if(index == nullptr)
178 {
179 return E_INVALIDARG;
180 }
181 *index = GetXInterface()->getStartIndex();
182
183 return S_OK;
184
185 } catch(...) { return E_FAIL; }
186}
187
193COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index)
194{
196
197 try {
198
199 // #CHECK#
200 if(index == nullptr)
201 {
202 return E_INVALIDARG;
203 }
204 // #CHECK XInterface#
205 if(!pRXLink.is())
206 {
207 return E_FAIL;
208 }
209 *index = GetXInterface()->getEndIndex();
210
211 return S_OK;
212
213 } catch(...) { return E_FAIL; }
214}
215
221COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid)
222{
224
225 try {
226
227 // #CHECK#
228 if(valid == nullptr)
229 {
230 return E_INVALIDARG;
231 }
232 // #CHECK XInterface#
233 if(!pRXLink.is())
234 {
235 return E_FAIL;
236 }
237 *valid = GetXInterface()->isValid();
238
239 return S_OK;
240
241 } catch(...) { return E_FAIL; }
242}
243
249COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::put_XInterface(hyper pXInterface)
250{
251 // internal IUNOXWrapper - no mutex meeded
252
253 try {
254
256 //special query.
257 if(pUNOInterface != nullptr)
258 {
259 Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
260 if( !pRContext.is() )
261 {
262 return E_FAIL;
263 }
264 Reference<XAccessibleHyperlink> pRXI(pRContext,UNO_QUERY);
265 if( !pRXI.is() )
266 {
267 pRXLink = nullptr;
268 }
269 else
270 pRXLink = pRXI.get();
271 }
272 return S_OK;
273
274 } catch(...) { return E_FAIL; }
275}
276
282COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHyperLink::put_XSubInterface(hyper pXSubInterface)
283{
284 // internal IUNOXWrapper - no mutex meeded
285
286 pRXLink = reinterpret_cast<XAccessibleHyperlink*>(pXSubInterface);
287 pRXAct = reinterpret_cast<XAccessibleAction*>(pXSubInterface);
288
289 return S_OK;
290}
291
292/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long long BSTR __RPC_FAR *__RPC_FAR * keyBinding
Definition: AccActionBase.h:61
STDMETHOD() put_XInterface(hyper pXInterface) override
Override of IUNOXWrapper.
long long nMaxBinding
Definition: AccActionBase.h:60
STDMETHOD() nActions(long *nActions)
Returns the number of action.
STDMETHOD() doAction(long actionIndex)
Performs specified action on the object.
css::uno::Reference< css::accessibility::XAccessibleAction > pRXAct
Definition: AccActionBase.h:68
STDMETHOD() get_name(long actionIndex, BSTR __RPC_FAR *name)
long long BSTR __RPC_FAR *__RPC_FAR long __RPC_FAR * nBinding
Definition: AccActionBase.h:62
STDMETHOD() get_description(long actionIndex, BSTR __RPC_FAR *description)
Gets description of specified action.
static void ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pvData)
css::accessibility::XAccessible * pUNOInterface
Definition: UNOXWrapper.h:34
anchor
BSTR localizedName([in] long actionIndex)
Returns the localized name of specified action.
BSTR description([in] long actionIndex)
Returns a description of the specified action of the object.
BSTR name([in] long actionIndex)
Returns the non-localized name of specified action.
index