LibreOffice Module editeng (master) 1
AccessibleHyperlink.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
21#include <com/sun/star/uno/Any.hxx>
22#include <com/sun/star/uno/Reference.hxx>
24
26#include <editeng/unoedprx.hxx>
27#include <editeng/flditem.hxx>
28#include <vcl/keycodes.hxx>
29
30using namespace ::com::sun::star;
31
32
33// AccessibleHyperlink implementation
34
35
36namespace accessibility
37{
38
39 AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_Int32 nStt, sal_Int32 nEnd, const OUString& rD )
40 : rTA( r )
41 {
42 pFld.reset( p );
43 nStartIdx = nStt;
44 nEndIdx = nEnd;
45 aDescription = rD;
46 }
47
49 {
50 }
51
52 // XAccessibleAction
54 {
55 return isValid() ? 1 : 0;
56 }
57
59 {
60 bool bRet = false;
61 if ( isValid() && ( nIndex == 0 ) )
62 {
64 bRet = true;
65 }
66 return bRet;
67 }
68
69 OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex )
70 {
71 OUString aDesc;
72
73 if ( isValid() && ( nIndex == 0 ) )
74 aDesc = aDescription;
75
76 return aDesc;
77 }
78
79 uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
80 {
81 uno::Reference< css::accessibility::XAccessibleKeyBinding > xKeyBinding;
82
83 if( isValid() && ( nIndex == 0 ) )
84 {
85 rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
86 xKeyBinding = pKeyBindingHelper;
87
88 awt::KeyStroke aKeyStroke;
89 aKeyStroke.Modifiers = 0;
90 aKeyStroke.KeyCode = KEY_RETURN;
91 aKeyStroke.KeyChar = 0;
92 aKeyStroke.KeyFunc = 0;
93 pKeyBindingHelper->AddKeyBinding( aKeyStroke );
94 }
95
96 return xKeyBinding;
97 }
98
99 // XAccessibleHyperlink
101 {
102 return uno::Any();
103 }
104
106 {
107 return uno::Any();
108 }
109
111 {
112 return nStartIdx;
113 }
114
116 {
117 return nEndIdx;
118 }
119
121 {
122 return rTA.IsValid();
123 }
124
125} // end of namespace accessibility
126
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool IsValid() const override
Query state of forwarder.
Definition: unoedprx.cxx:653
virtual void FieldClicked(const SvxFieldItem &rField) override
Definition: unoedprx.cxx:637
This item stores a field (SvxFieldData).
Definition: flditem.hxx:70
sal_Int32 nIndex
void * p
constexpr sal_uInt16 KEY_RETURN
unsigned char sal_Bool