95cc7d9625
FontInfoBase and it's descendents are missing noexcept annotations, which virally forces other code to not be noexcept as well during AuditMode checks. Apart from adding noexcept, this commit also * Passes std::wstring_view by reference. * Pass the FillLegacyNameBuffer argument as a simple pointer-to-array, allowing us to fill the buffer with a single memcpy. (gsl::span's iterators inhibit any internal STL optimizations.) * Move operator== declarations inside the class to reduce code size. All other changes are an effect of the virality of noexcept. This is an offshoot from #11623. ## Validation Steps Performed * It still compiles ✔️
76 lines
3.6 KiB
C++
76 lines
3.6 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- TermControlUiaProvider.hpp
|
|
|
|
Abstract:
|
|
- This module provides UI Automation access to the screen buffer to
|
|
support both automation tests and accessibility (screen reading)
|
|
applications.
|
|
- ConHost and Windows Terminal must use IRenderData to have access to the proper information
|
|
- Based on examples, sample code, and guidance from
|
|
https://msdn.microsoft.com/en-us/library/windows/desktop/ee671596(v=vs.85).aspx
|
|
|
|
Author(s):
|
|
- Carlos Zamora (CaZamor) 2019
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#include "ScreenInfoUiaProviderBase.h"
|
|
#include "UiaTextRangeBase.hpp"
|
|
#include "IControlAccessibilityInfo.h"
|
|
#include "TermControlUiaTextRange.hpp"
|
|
namespace Microsoft::Terminal
|
|
{
|
|
class TermControlUiaProvider : public Microsoft::Console::Types::ScreenInfoUiaProviderBase
|
|
{
|
|
public:
|
|
TermControlUiaProvider() = default;
|
|
HRESULT RuntimeClassInitialize(_In_ ::Microsoft::Console::Types::IUiaData* const uiaData,
|
|
_In_ ::Microsoft::Console::Types::IControlAccessibilityInfo* controlInfo) noexcept;
|
|
|
|
// IRawElementProviderFragment methods
|
|
IFACEMETHODIMP Navigate(_In_ NavigateDirection direction,
|
|
_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) noexcept override;
|
|
IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple** ppProvider) noexcept override;
|
|
IFACEMETHODIMP get_BoundingRectangle(_Out_ UiaRect* pRect) noexcept override;
|
|
IFACEMETHODIMP get_FragmentRoot(_COM_Outptr_result_maybenull_ IRawElementProviderFragmentRoot** ppProvider) noexcept override;
|
|
|
|
const COORD GetFontSize() const noexcept;
|
|
const RECT GetPadding() const noexcept;
|
|
const double GetScaleFactor() const noexcept;
|
|
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
|
|
|
protected:
|
|
HRESULT GetSelectionRange(_In_ IRawElementProviderSimple* pProvider, const std::wstring_view wordDelimiters, _COM_Outptr_result_maybenull_ Microsoft::Console::Types::UiaTextRangeBase** ppUtr) override;
|
|
|
|
// degenerate range
|
|
HRESULT CreateTextRange(_In_ IRawElementProviderSimple* const pProvider, const std::wstring_view wordDelimiters, _COM_Outptr_result_maybenull_ Microsoft::Console::Types::UiaTextRangeBase** ppUtr) override;
|
|
|
|
// degenerate range at cursor position
|
|
HRESULT CreateTextRange(_In_ IRawElementProviderSimple* const pProvider,
|
|
const Cursor& cursor,
|
|
const std::wstring_view wordDelimiters,
|
|
_COM_Outptr_result_maybenull_ Microsoft::Console::Types::UiaTextRangeBase** ppUtr) override;
|
|
|
|
// specific endpoint range
|
|
HRESULT CreateTextRange(_In_ IRawElementProviderSimple* const pProvider,
|
|
const COORD start,
|
|
const COORD end,
|
|
const std::wstring_view wordDelimiters,
|
|
_COM_Outptr_result_maybenull_ Microsoft::Console::Types::UiaTextRangeBase** ppUtr) override;
|
|
|
|
// range from a UiaPoint
|
|
HRESULT CreateTextRange(_In_ IRawElementProviderSimple* const pProvider,
|
|
const UiaPoint point,
|
|
const std::wstring_view wordDelimiters,
|
|
_COM_Outptr_result_maybenull_ Microsoft::Console::Types::UiaTextRangeBase** ppUtr) override;
|
|
|
|
private:
|
|
::Microsoft::Console::Types::IControlAccessibilityInfo* _controlInfo{ nullptr };
|
|
};
|
|
}
|