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 .
20 #ifndef INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_ACCHYPERTEXT_H
21 #define INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_ACCHYPERTEXT_H
23 #include "Resource.h" // main symbols
25 #include <com/sun/star/accessibility/XAccessible.hpp>
26 #include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
27 #include "AccTextBase.h"
30 * CAccHypertext implements IAccessibleHypertext interface.
32 class ATL_NO_VTABLE CAccHypertext
:
33 public CComObjectRoot
,
34 public CComCoClass
<CAccHypertext
,&CLSID_AccHypertext
>,
35 public IAccessibleHypertext
,
43 BEGIN_COM_MAP(CAccHypertext
)
44 COM_INTERFACE_ENTRY(IAccessibleText
)
45 COM_INTERFACE_ENTRY(IAccessibleHypertext
)
46 COM_INTERFACE_ENTRY(IUNOXWrapper
)
47 COM_INTERFACE_ENTRY_FUNC_BLIND(NULL
,SmartQI_
)
49 #pragma clang diagnostic push
50 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
54 #pragma clang diagnostic pop
57 static HRESULT WINAPI
SmartQI_(void* pv
,
58 REFIID iid
, void** ppvObject
, DWORD_PTR
)
60 return static_cast<CAccHypertext
*>(pv
)->SmartQI(iid
,ppvObject
);
63 HRESULT
SmartQI(REFIID iid
, void** ppvObject
)
66 return OuterQueryInterface(iid
,ppvObject
);
75 // Adds a text selection.
76 STDMETHOD(addSelection
)(long startOffset
, long endOffset
) override
;//, unsigned char * success)
78 // Gets text attributes.
79 STDMETHOD(get_attributes
)(long offset
, long * startOffset
, long * endOffset
, BSTR
* textAttributes
) override
;
82 STDMETHOD(get_caretOffset
)(long * offset
) override
;
84 // Gets bounding rect containing the glyph(s) representing the character
85 // at the specified text offset
86 STDMETHOD(get_characterExtents
)(long offset
, IA2CoordinateType coordType
, long * x
, long * y
, long * width
, long * height
) override
;
88 // Gets number of active non-contiguous selections.
89 STDMETHOD(get_nSelections
)(long * nSelections
) override
;
91 // Gets bounding rect for the glyph at a certain point.
92 STDMETHOD(get_offsetAtPoint
)(long x
, long y
, IA2CoordinateType coordType
, long * offset
) override
;
94 // Gets character offsets of N-th active text selection.
95 STDMETHOD(get_selection
)(long selection
, long * startOffset
, long * endOffset
) override
;
97 // Gets a range of text by offset NOTE: returned string may be longer
98 // than endOffset-startOffset bytes if text contains multi-byte characters.
99 STDMETHOD(get_text
)(long startOffset
, long endOffset
, BSTR
* text
) override
;
101 // Gets a specified amount of text that ends before a specified offset.
102 STDMETHOD(get_textBeforeOffset
)(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
) override
;
104 // Gets a specified amount of text that spans the specified offset.
105 STDMETHOD(get_textAfterOffset
)(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
) override
;
107 // Gets a specified amount of text that starts after a specified offset.
108 STDMETHOD(get_textAtOffset
)(long offset
, IA2TextBoundaryType boundaryType
, long * startOffset
, long * endOffset
, BSTR
* text
) override
;
110 // Unselects a range of text.
111 STDMETHOD(removeSelection
)(long selectionIndex
) override
;
114 STDMETHOD(setCaretOffset
)(long offset
) override
;
116 // Changes the bounds of an existing selection.
117 STDMETHOD(setSelection
)(long selectionIndex
, long startOffset
, long endOffset
) override
;
119 // Gets total number of characters.
120 // NOTE: this may be different than the total number of bytes required
121 // to store the text, if the text contains multi-byte characters.
122 STDMETHOD(get_nCharacters
)(long * nCharacters
) override
;
124 // Makes specific part of string visible on screen.
125 STDMETHOD(scrollSubstringTo
)(long startIndex
, long endIndex
,enum IA2ScrollType scrollType
) override
;
127 STDMETHOD(scrollSubstringToPoint
)(long startIndex
, long endIndex
,enum IA2CoordinateType coordinateType
, long x
, long y
) override
;
129 STDMETHOD(get_newText
)( IA2TextSegment
*newText
) override
;
131 STDMETHOD(get_oldText
)( IA2TextSegment
*oldText
) override
;
133 //IAccessibleHypertext
135 // Gets the number of hyperlink.
136 STDMETHOD(get_nHyperlinks
)(long *hyperlinkCount
) override
;
138 // Gets the hyperlink object via specified index.
139 STDMETHOD(get_hyperlink
)(long index
,IAccessibleHyperlink
**hyperlink
) override
;
141 // Returns the index of the hyperlink that is associated with this
143 STDMETHOD(get_hyperlinkIndex
)(long charIndex
, long *hyperlinkIndex
) override
;
145 // Override of IUNOXWrapper.
146 STDMETHOD(put_XInterface
)(hyper pXInterface
) override
;
150 css::uno::Reference
<css::accessibility::XAccessibleHypertext
> pHyperText
;
154 #endif // INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_ACCHYPERTEXT_H
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */