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 .
22 #include "AccHyperLink.h"
24 #include <vcl/svapp.hxx>
26 #include <com/sun/star/accessibility/XAccessible.hpp>
27 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
28 #include "MAccessible.h"
30 using namespace com::sun::star::accessibility
;
31 using namespace com::sun::star::uno
;
32 using namespace com::sun::star::awt
;
35 * Returns the number of action.
37 * @param nActions the number of action.
39 STDMETHODIMP
CAccHyperLink::nActions(/*[out,retval]*/long* nActions
)
42 return CAccActionBase::nActions(nActions
);
46 * Performs specified action on the object.
48 * @param actionIndex the index of action.
50 STDMETHODIMP
CAccHyperLink::doAction(/* [in] */ long actionIndex
)
53 return CAccActionBase::doAction(actionIndex
);
57 * Gets description of specified action.
59 * @param actionIndex the index of action.
60 * @param description the description string of the specified action.
62 STDMETHODIMP
CAccHyperLink::get_description(long actionIndex
,BSTR __RPC_FAR
*description
)
65 return CAccActionBase::get_description(actionIndex
, description
);
68 STDMETHODIMP
CAccHyperLink::get_name( long actionIndex
, BSTR __RPC_FAR
*name
)
71 return CAccActionBase::get_name(actionIndex
, name
);
74 STDMETHODIMP
CAccHyperLink::get_localizedName( long actionIndex
, BSTR __RPC_FAR
*localizedName
)
77 return CAccActionBase::get_name(actionIndex
, localizedName
);
81 * Returns key binding object (if any) associated with specified action
82 * key binding is string.
83 * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
85 * @param actionIndex the index of action.
86 * @param nMaxBinding the max number of key binding.
87 * @param keyBinding the key binding array.
88 * @param nBinding the actual number of key binding returned.
90 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
)
97 return CAccActionBase::get_keyBinding(actionIndex
, nMaxBinding
, keyBinding
, nBinding
);
105 STDMETHODIMP
CAccHyperLink::get_anchor(/* [in] */ long index
,
106 /* [retval][out] */ VARIANT __RPC_FAR
*anchor
)
110 ENTER_PROTECTED_BLOCK
117 // #CHECK XInterface#
122 // Get Any type value via pRXLink.
123 ::com::sun::star::uno::Any anyVal
= GetXInterface()->getAccessibleActionAnchor(index
);
124 // Convert Any to VARIANT.
125 CMAccessible::ConvertAnyToVariant(anyVal
, anchor
);
129 LEAVE_PROTECTED_BLOCK
137 STDMETHODIMP
CAccHyperLink::get_anchorTarget(/* [in] */ long index
,
138 /* [retval][out] */ VARIANT __RPC_FAR
*anchorTarget
)
142 ENTER_PROTECTED_BLOCK
145 if(anchorTarget
== NULL
)
149 // #CHECK XInterface#
154 // Get Any type value via pRXLink.
155 ::com::sun::star::uno::Any anyVal
= GetXInterface()->getAccessibleActionObject(index
);
156 // Convert Any to VARIANT.
157 CMAccessible::ConvertAnyToVariant(anyVal
, anchorTarget
);
161 LEAVE_PROTECTED_BLOCK
167 * @param index Variant to get start index.
170 STDMETHODIMP
CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR
*index
)
174 ENTER_PROTECTED_BLOCK
181 *index
= GetXInterface()->getStartIndex();
185 LEAVE_PROTECTED_BLOCK
190 * @param index Variant to get end index.
193 STDMETHODIMP
CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR
*index
)
197 ENTER_PROTECTED_BLOCK
204 // #CHECK XInterface#
209 *index
= GetXInterface()->getEndIndex();
213 LEAVE_PROTECTED_BLOCK
217 * Judge if the hyperlink is valid.
218 * @param valid Variant to get validity.
221 STDMETHODIMP
CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR
*valid
)
225 ENTER_PROTECTED_BLOCK
232 // #CHECK XInterface#
237 *valid
= GetXInterface()->isValid();
241 LEAVE_PROTECTED_BLOCK
246 * @param pXInterface XAccessibleContext interface.
249 STDMETHODIMP
CAccHyperLink::put_XInterface(hyper pXInterface
)
251 // internal IUNOXWrapper - no mutex meeded
253 ENTER_PROTECTED_BLOCK
255 CAccActionBase::put_XInterface(pXInterface
);
257 if(pUNOInterface
!= NULL
)
259 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
260 if( !pRContext
.is() )
264 Reference
<XAccessibleHyperlink
> pRXI(pRContext
,UNO_QUERY
);
270 pRXLink
= pRXI
.get();
274 LEAVE_PROTECTED_BLOCK
279 * @param pXSubInterface XAccessibleHyperlink interface.
282 STDMETHODIMP
CAccHyperLink::put_XSubInterface(hyper pXSubInterface
)
284 // internal IUNOXWrapper - no mutex meeded
286 pRXLink
= reinterpret_cast<XAccessibleHyperlink
*>(pXSubInterface
);
287 pRXAct
= reinterpret_cast<XAccessibleAction
*>(pXSubInterface
);
292 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */