LibreOffice Module winaccessibility (master) 1
AccEditableText.h
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#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include "Resource.h"
27#include <com/sun/star/uno/Reference.hxx>
28#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
29#include "UNOXWrapper.h"
30
35 public CComObjectRoot,
36 public CComCoClass<CAccEditableText,&CLSID_AccEditableText>,
38 public CUNOXWrapper
39{
40public:
42 {
43
44 }
46 {
47
48 }
49
50 BEGIN_COM_MAP(CAccEditableText)
51 COM_INTERFACE_ENTRY(IAccessibleEditableText)
52 COM_INTERFACE_ENTRY(IUNOXWrapper)
53 COM_INTERFACE_ENTRY_FUNC_BLIND(0,SmartQI_)
54#if defined __clang__
55#pragma clang diagnostic push
56#pragma clang diagnostic ignored "-Winconsistent-missing-override"
57#endif
58 END_COM_MAP()
59#if defined __clang__
60#pragma clang diagnostic pop
61#endif
62
63 static HRESULT WINAPI SmartQI_(void* pv,
64 REFIID iid, void** ppvObject, DWORD_PTR)
65 {
66 return static_cast<CAccEditableText*>(pv)->SmartQI(iid,ppvObject);
67 }
68
69 HRESULT SmartQI(REFIID iid, void** ppvObject)
70 {
71 if( m_pOuterUnknown )
72 return OuterQueryInterface(iid,ppvObject);
73 return E_FAIL;
74 }
75
76 DECLARE_NO_REGISTRY()
77
78public:
79 // IAccessibleEditableText
80
81 // Copies a range of text to the clipboard.
82 STDMETHOD(copyText)(long startOffset, long endOffset) override;
83
84 // Deletes a range of text.
85 STDMETHOD(deleteText)(long startOffset, long endOffset) override;
86
87 // Inserts text at a specified offset.
88 STDMETHOD(insertText)(long offset, BSTR * text) override;
89
90 // Cuts a range of text to the clipboard.
91 STDMETHOD(cutText)(long startOffset, long endOffset) override;
92
93 // Pastes text from clipboard at specified offset.
94 STDMETHOD(pasteText)(long offset) override;
95
96 // Replaces range of text with new text.
97 STDMETHOD(replaceText)(long startOffset, long endOffset, BSTR * text) override;
98
99
100 // Sets attributes of range of text.
101 STDMETHOD(setAttributes)(long startOffset, long endOffset, BSTR * attributes) override;
102
103 // Override of IUNOXWrapper.
104 STDMETHOD(put_XInterface)(hyper pXInterface) override;
105
106private:
107
108 css::uno::Reference<css::accessibility::XAccessibleEditableText> pRXEdtTxt;
109
110 static void get_AnyFromOLECHAR(std::u16string_view ouName, const OUString &ouValue, css::uno::Any &rAny);
111
112 css::accessibility::XAccessibleEditableText* GetXInterface()
113 {
114 return pRXEdtTxt.get();
115 }
116};
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CAccEditableText implements IAccessibleEditableText interface.
STDMETHOD() setAttributes(long startOffset, long endOffset, BSTR *attributes) override
Sets attributes of range of text.
static void get_AnyFromOLECHAR(std::u16string_view ouName, const OUString &ouValue, css::uno::Any &rAny)
Convert attributes string to Any type.
STDMETHOD() copyText(long startOffset, long endOffset) override
Copy a range of text to the clipboard.
HRESULT SmartQI(REFIID iid, void **ppvObject)
STDMETHOD() replaceText(long startOffset, long endOffset, BSTR *text) override
Replaces range of text with new text.
STDMETHOD() put_XInterface(hyper pXInterface) override
Override of IUNOXWrapper.
virtual ~CAccEditableText()
css::uno::Reference< css::accessibility::XAccessibleEditableText > pRXEdtTxt
STDMETHOD() insertText(long offset, BSTR *text) override
Inserts text at a specified offset.
static HRESULT WINAPI SmartQI_(void *pv, REFIID iid, void **ppvObject, DWORD_PTR)
STDMETHOD() deleteText(long startOffset, long endOffset) override
Deletes a range of text.
STDMETHOD() pasteText(long offset) override
Pastes text from clipboard at specified offset.
STDMETHOD() cutText(long startOffset, long endOffset) override
Cuts a range of text to the clipboard.
css::accessibility::XAccessibleEditableText * GetXInterface()
CUNOXWrapper implements IUNOXWrapper interface.
Definition: UNOXWrapper.h:32
This interface provides clipboard capability to text objects.