1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "AccHyperLink.h"
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
29 #pragma clang diagnostic pop
32 #include <vcl/svapp.hxx>
34 #include <com/sun/star/accessibility/XAccessible.hpp>
35 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
36 #include "MAccessible.h"
38 using namespace com::sun::star::accessibility
;
39 using namespace com::sun::star::uno
;
40 using namespace com::sun::star::awt
;
43 * Returns the number of action.
45 * @param nActions the number of action.
47 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::nActions(/*[out,retval]*/long* nActions
)
50 return CAccActionBase::nActions(nActions
);
54 * Performs specified action on the object.
56 * @param actionIndex the index of action.
58 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::doAction(/* [in] */ long actionIndex
)
61 return CAccActionBase::doAction(actionIndex
);
65 * Gets description of specified action.
67 * @param actionIndex the index of action.
68 * @param description the description string of the specified action.
70 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_description(long actionIndex
,BSTR __RPC_FAR
*description
)
73 return CAccActionBase::get_description(actionIndex
, description
);
76 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_name( long actionIndex
, BSTR __RPC_FAR
*name
)
79 return CAccActionBase::get_name(actionIndex
, name
);
82 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_localizedName( long actionIndex
, BSTR __RPC_FAR
*localizedName
)
85 return CAccActionBase::get_name(actionIndex
, localizedName
);
89 * Returns key binding object (if any) associated with specified action
90 * key binding is string.
91 * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
93 * @param actionIndex the index of action.
94 * @param nMaxBinding the max number of key binding.
95 * @param keyBinding the key binding array.
96 * @param nBinding the actual number of key binding returned.
98 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_keyBinding(
99 /* [in] */ long actionIndex
,
100 /* [in] */ long nMaxBinding
,
101 /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR
*__RPC_FAR
*keyBinding
,
102 /* [retval][out] */ long __RPC_FAR
*nBinding
)
105 return CAccActionBase::get_keyBinding(actionIndex
, nMaxBinding
, keyBinding
, nBinding
);
113 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_anchor(/* [in] */ long index
,
114 /* [retval][out] */ VARIANT __RPC_FAR
*anchor
)
118 ENTER_PROTECTED_BLOCK
121 if(anchor
== nullptr)
125 // #CHECK XInterface#
130 // Get Any type value via pRXLink.
131 css::uno::Any anyVal
= GetXInterface()->getAccessibleActionAnchor(index
);
132 // Convert Any to VARIANT.
133 CMAccessible::ConvertAnyToVariant(anyVal
, anchor
);
137 LEAVE_PROTECTED_BLOCK
145 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_anchorTarget(/* [in] */ long index
,
146 /* [retval][out] */ VARIANT __RPC_FAR
*anchorTarget
)
150 ENTER_PROTECTED_BLOCK
153 if(anchorTarget
== nullptr)
157 // #CHECK XInterface#
162 // Get Any type value via pRXLink.
163 css::uno::Any anyVal
= GetXInterface()->getAccessibleActionObject(index
);
164 // Convert Any to VARIANT.
165 CMAccessible::ConvertAnyToVariant(anyVal
, anchorTarget
);
169 LEAVE_PROTECTED_BLOCK
175 * @param index Variant to get start index.
178 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR
*index
)
182 ENTER_PROTECTED_BLOCK
189 *index
= GetXInterface()->getStartIndex();
193 LEAVE_PROTECTED_BLOCK
198 * @param index Variant to get end index.
201 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR
*index
)
205 ENTER_PROTECTED_BLOCK
212 // #CHECK XInterface#
217 *index
= GetXInterface()->getEndIndex();
221 LEAVE_PROTECTED_BLOCK
225 * Judge if the hyperlink is valid.
226 * @param valid Variant to get validity.
229 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR
*valid
)
233 ENTER_PROTECTED_BLOCK
240 // #CHECK XInterface#
245 *valid
= GetXInterface()->isValid();
249 LEAVE_PROTECTED_BLOCK
254 * @param pXInterface XAccessibleContext interface.
257 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::put_XInterface(hyper pXInterface
)
259 // internal IUNOXWrapper - no mutex meeded
261 ENTER_PROTECTED_BLOCK
263 CAccActionBase::put_XInterface(pXInterface
);
265 if(pUNOInterface
!= nullptr)
267 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
268 if( !pRContext
.is() )
272 Reference
<XAccessibleHyperlink
> pRXI(pRContext
,UNO_QUERY
);
278 pRXLink
= pRXI
.get();
282 LEAVE_PROTECTED_BLOCK
287 * @param pXSubInterface XAccessibleHyperlink interface.
290 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccHyperLink::put_XSubInterface(hyper pXSubInterface
)
292 // internal IUNOXWrapper - no mutex meeded
294 pRXLink
= reinterpret_cast<XAccessibleHyperlink
*>(pXSubInterface
);
295 pRXAct
= reinterpret_cast<XAccessibleAction
*>(pXSubInterface
);
300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */