LibreOffice Module winaccessibility (master) 1
AccHypertext.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 "AccHypertext.h"
23#include "AccHyperLink.h"
24#include "acccommon.h"
25
26#include <vcl/svapp.hxx>
27
28
29using namespace com::sun::star::accessibility;
30using namespace com::sun::star::uno;
31
32
40COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::addSelection(long startOffset, long endOffset)
41{
42
44}
45
46
55COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
56{
57
58 return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
59}
60
66COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_caretOffset(long * offset)
67{
68
70}
71
81COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
82{
83
84 return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
85}
86
92COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nSelections(long * nSelections)
93{
94
96}
97
106COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
107{
109}
110
118COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_selection(long selection, long * startOffset, long * endOffset)
119{
120
122}
123
131COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_text(long startOffset, long endOffset, BSTR * text)
132{
133
135}
136
146COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
147{
148
149 return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
151}
152
162COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
163{
164
165 return CAccTextBase::get_textAfterOffset(offset, boundaryType,
167}
168
178COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
179{
180
181 return CAccTextBase::get_textAtOffset(offset, boundaryType,
183}
184
191COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::removeSelection(long selectionIndex)
192{
193
194 return CAccTextBase::removeSelection(selectionIndex);
195}
196
203COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setCaretOffset(long offset)
204{
205
207}
208
217COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::setSelection(long selectionIndex, long startOffset, long endOffset)
218{
219
220 return CAccTextBase::setSelection(selectionIndex, startOffset,
221 endOffset);
222}
223
229COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nCharacters(long * nCharacters)
230{
231
233}
234
235COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_newText( IA2TextSegment *newText)
236{
238}
239
240COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_oldText( IA2TextSegment *oldText)
241{
243}
244
251COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
252{
253
254 return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
255}
256COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
257{
258
260}
261
267COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount)
268{
270
271 try {
272
273 // #CHECK#
274 if(hyperlinkCount == nullptr)
275 return E_INVALIDARG;
276 // #CHECK XInterface#
277 if(!pHyperText.is())
278 {
279 return E_FAIL;
280 }
281
282 *hyperlinkCount = pHyperText->getHyperLinkCount();
283 return S_OK;
284
285 } catch(...) { return E_FAIL; }
286}
287
294COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hyperlink)
295{
297
298 try {
299
300 // #CHECK#
301 if(hyperlink == nullptr)
302 return E_INVALIDARG;
303 // #CHECK XInterface#
304 if(!pHyperText.is())
305 {
306 return E_FAIL;
307 }
308
309 Reference<XAccessibleHyperlink> pRLink = pHyperText->getHyperLink(index);
310 if(!pRLink.is())
311 {
312 *hyperlink = nullptr;
313 return E_FAIL;
314 }
315
316 IAccessibleHyperlink* plink = nullptr;
317 HRESULT hr = createInstance<CAccHyperLink>(IID_IAccessibleHyperlink, &plink);
318 if( SUCCEEDED(hr) )
319 {
320 IUNOXWrapper* wrapper = nullptr;
321 plink->QueryInterface(IID_IUNOXWrapper, reinterpret_cast<void**>(&wrapper));
322 if(wrapper)
323 {
324 wrapper->put_XSubInterface(reinterpret_cast<hyper>(pRLink.get()));
325 wrapper->Release();
326 }
327 *hyperlink = plink;
328 return S_OK;
329 }
330
331 return E_FAIL;
332
333 } catch(...) { return E_FAIL; }
334}
335
342COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex)
343{
345
346 try {
347
348 // #CHECK#
349 if(hyperlinkIndex == nullptr)
350 return E_INVALIDARG;
351 // #CHECK XInterface#
352 if(!pHyperText.is())
353 {
354 return E_FAIL;
355 }
356
357 *hyperlinkIndex = pHyperText->getHyperLinkIndex(charIndex);
358 return S_OK;
359
360 } catch(...) { return E_FAIL; }
361}
362
368COM_DECLSPEC_NOTHROW STDMETHODIMP CAccHypertext::put_XInterface(hyper pXInterface)
369{
370 // internal IUNOXWrapper - no mutex meeded
371
372 try {
373
374 CAccTextBase::put_XInterface(pXInterface);
375 //special query.
376 if(pUNOInterface == nullptr)
377 return E_FAIL;
378 Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
379 if( !pRContext.is() )
380 {
381 return E_FAIL;
382 }
383 Reference<XAccessibleHypertext> pRXI(pRContext,UNO_QUERY);
384 if( !pRXI.is() )
385 pHyperText = nullptr;
386 else
387 pHyperText = pRXI.get();
388 return S_OK;
389
390 } catch(...) { return E_FAIL; }
391}
392
393/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHOD() put_XInterface(hyper pXInterface) override
Put UNO interface.
STDMETHOD() get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long *offset) override
Get offset of some special point.
STDMETHOD() scrollSubstringToPoint(long startIndex, long endIndex, enum IA2CoordinateType coordinateType, long x, long y) override
Scroll to special sub-string .
css::uno::Reference< css::accessibility::XAccessibleHypertext > pHyperText
Definition: AccHypertext.h:149
STDMETHOD() get_selection(long selection, long *startOffset, long *endOffset) override
Get selection range.
STDMETHOD() get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long *startOffset, long *endOffset, BSTR *text) override
Get special text after some position.
STDMETHOD() get_attributes(long offset, long *startOffset, long *endOffset, BSTR *textAttributes) override
Get special attributes.
STDMETHOD() get_hyperlink(long index, IAccessibleHyperlink **hyperlink) override
Get special hyperlink.
STDMETHOD() addSelection(long startOffset, long endOffset) override
Get special selection.
STDMETHOD() scrollSubstringTo(long startIndex, long endIndex, enum IA2ScrollType scrollType) override
Makes a specific part of string visible on screen.
STDMETHOD() get_oldText(IA2TextSegment *oldText) override
STDMETHOD() removeSelection(long selectionIndex) override
Remove selection.
STDMETHOD() get_nHyperlinks(long *hyperlinkCount) override
Get hyperlink count.
STDMETHOD() get_caretOffset(long *offset) override
Get caret position.
STDMETHOD() get_newText(IA2TextSegment *newText) override
STDMETHOD() setSelection(long selectionIndex, long startOffset, long endOffset) override
Set special selection.
STDMETHOD() get_nSelections(long *nSelections) override
Get selections count.
STDMETHOD() get_nCharacters(long *nCharacters) override
Get characters count.
STDMETHOD() setCaretOffset(long offset) override
Set caret position.
STDMETHOD() get_hyperlinkIndex(long charIndex, long *hyperlinkIndex) override
Returns the index of the hyperlink that is associated with this character index.
STDMETHOD() get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long *startOffset, long *endOffset, BSTR *text) override
Get special text at some position.
STDMETHOD() get_text(long startOffset, long endOffset, BSTR *text) override
Get special text.
STDMETHOD() get_characterExtents(long offset, IA2CoordinateType coordType, long *x, long *y, long *width, long *height) override
Get character extents.
STDMETHOD() get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long *startOffset, long *endOffset, BSTR *text) override
Get special text before some position.
STDMETHOD() get_nSelections(long *nSelections)
Get selections count.
STDMETHOD() get_caretOffset(long *offset)
Get caret position.
long long long * endOffset
Definition: AccTextBase.h:43
long long endIndex
Definition: AccTextBase.h:102
STDMETHOD() put_XInterface(hyper pXInterface) override
Put UNO interface.
STDMETHOD() setSelection(long selectionIndex, long startOffset, long endOffset)
Set special selection.
STDMETHOD() get_selection(long selectionIndex, long *startOffset, long *endOffset)
Get selection range.
STDMETHOD() get_text(long startOffset, long endOffset, BSTR *text)
Get special text.
long IA2TextBoundaryType boundaryType
Definition: AccTextBase.h:71
long IA2CoordinateType long long long long * height
Definition: AccTextBase.h:54
long IA2CoordinateType long long long * width
Definition: AccTextBase.h:54
long IA2CoordinateType long * x
Definition: AccTextBase.h:54
STDMETHOD() setCaretOffset(long offset)
Set caret position.
STDMETHOD() get_addSelection(long startOffset, long endOffset)
Get special selection.
Definition: AccTextBase.cxx:91
STDMETHOD() get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long *offset)
Get offset of some special point.
STDMETHOD() get_nCharacters(long *nCharacters)
Get characters count.
STDMETHOD() get_newText(IA2TextSegment *newText)
STDMETHOD() scrollSubstringTo(long startIndex, long endIndex, enum IA2ScrollType scrollType)
STDMETHOD() get_oldText(IA2TextSegment *oldText)
long IA2TextBoundaryType long long BSTR * text
Definition: AccTextBase.h:71
long long * startOffset
Definition: AccTextBase.h:43
long IA2CoordinateType coordType
Definition: AccTextBase.h:54
STDMETHOD() removeSelection(long selectionIndex)
Remove selection.
long long long BSTR * textAttributes
Definition: AccTextBase.h:43
long IA2CoordinateType long long * y
Definition: AccTextBase.h:54
css::accessibility::XAccessible * pUNOInterface
Definition: UNOXWrapper.h:34
IA2ScrollType
These constants control the scrolling of an object or substring into a window.
IA2CoordinateType
These constants define which coordinate system a point is located in.
IA2TextBoundaryType
This enum defines values which specify a text boundary type.
long hyperlinkIndex([in] long charIndex)
Returns the index of the hyperlink that is associated with this character index.
IAccessibleHyperlink hyperlink([in] long index)
Returns the specified link.
IA2TextSegment oldText
Returns any removed text.
long nCharacters
Returns total number of characters.
long nSelections
Returns the number of active non-contiguous selections.
IA2TextSegment newText
Returns any inserted text.
long selection([in] long selectionIndex,[out] long startOffset)
Returns the character offsets of Nth active text selection.
HRESULT put_XSubInterface(hyper pXSubInterface)
index
return hr
A structure containing a substring and the start and end offsets in the enclosing string.