f81af8f7a5
Let VCLXAccessibleEdit::getAccessibleName take care of returning the same accessible name as the combobox parent for the combobox subedit instead of trying to set the same name when that combobox child is requested the first time. This makes sure the name remains in sync, and prevents trying to get the combobox a11y name while a dialog containing it might still be in the process of getting constructed by VclBuilder, in which case e.g. the AccessibleRelation::LABELLED_BY relation that gets used in Window::getDefaultAccessibleName may not have been set. That relation e.g. gets set if a label has the combobox set as its "mnemonic-widget" in a .ui file. The previous logic was triggering an assert when opening the "Fonts" page in the "Tools" -> "Options" dialog or using the search feature in that dialog on Windows with an AT (like NVDA) active when trying to set the a11y name of the "font2" combobox's entry (UI file: cui/uiconfig/ui/optfontspage.ui): Assertion failed: GetChildCount() == 4 || pWindowImpl->mbInDispose, file .../vcl/source/window/layout.cxx, line 1945 Backtrace: 1 abort ucrtbase 0x7ffad46e286e 2 get_wpgmptr ucrtbase 0x7ffad46e426e 3 get_wpgmptr ucrtbase 0x7ffad46e4165 4 wassert ucrtbase 0x7ffad46e44f1 5 VclScrolledWindow::get_child layout.cxx 1945 0x7ffa88f67e35 6 nextLogicalChildOfParent dialog.cxx 139 0x7ffa88f147cf 7 nextLogicalChildOfParent dialog.cxx 157 0x7ffa88f14884 8 nextLogicalChildOfParent dialog.cxx 157 0x7ffa88f14884 9 ImplGetSubChildWindow dlgctrl.cxx 137 0x7ffa88f197e1 10 ImplGetChildWindow dlgctrl.cxx 151 0x7ffa88f18dae 11 ImplGetNextWindow dlgctrl.cxx 180 0x7ffa88f19600 12 ImplFindDlgCtrlWindow dlgctrl.cxx 362 0x7ffa88f18a2b 13 vcl::ImplGetLabeledBy legacyaccessibility.cxx 122 0x7ffa88e65437 14 vcl::Window::getLegacyNonLayoutAccessibleRelationLabeledBy legacyaccessibility.cxx 178 0x7ffa88e657ac 15 vcl::Window::GetAccessibleRelationLabeledBy accessibility.cxx 604 0x7ffa88e6193a 16 vcl::Window::getDefaultAccessibleName accessibility.cxx 470 0x7ffa88e63c73 17 vcl::Window::GetAccessibleName accessibility.cxx 441 0x7ffa88e614ba 18 vcl::Window::SetAccessibleName accessibility.cxx 427 0x7ffa88e623bc 19 VCLXAccessibleBox::getAccessibleChild vclxaccessiblebox.cxx 319 0x7ffa853e3e02 20 AccObjectWinManager::InsertChildrenAccObj AccObjectWinManager.cxx 536 0x7ffa855b2ed1 21 AccEventListener::HandleChildChangedEvent AccEventListener.cxx 109 0x7ffa855b9593 22 AccEventListener::notifyEvent AccEventListener.cxx 64 0x7ffa855ba6ef 23 AccContainerEventListener::notifyEvent AccContainerEventListener.cxx 95 0x7ffa855bdfbc 24 comphelper::AccessibleEventNotifier::addEvent accessibleeventnotifier.cxx 256 0x7ffa916598c0 25 comphelper::OCommonAccessibleComponent::NotifyAccessibleEvent accessiblecomponenthelper.cxx 127 0x7ffa9165071e 26 VCLXAccessibleComponent::ProcessWindowChildEvent vclxaccessiblecomponent.cxx 165 0x7ffa8b7e6029 27 VCLXAccessibleComponent::WindowChildEventListener vclxaccessiblecomponent.cxx 124 0x7ffa8b7e6d62 28 VCLXAccessibleComponent::LinkStubWindowChildEventListener vclxaccessiblecomponent.cxx 114 0x7ffa8b7e5ee6 29 Link<VclWindowEvent &,void>::Call link.hxx 111 0x7ffa88f3bf43 30 vcl::Window::CallEventListeners event.cxx 300 0x7ffa88f3c57c 31 vcl::Window::ImplSetReallyVisible window.cxx 1331 0x7ffa8904394d 32 vcl::Window::ImplSetReallyVisible window.cxx 1344 0x7ffa89043a1d 33 vcl::Window::Show window.cxx 2336 0x7ffa89047671 34 vcl::Window::Show window.cxx 2349 0x7ffa8904776e 35 vcl::Window::set_property window2.cxx 1537 0x7ffa8902d4b3 36 ComboBox::set_property combobox.cxx 1553 0x7ffa89097521 37 BuilderUtils::set_properties builder.cxx 2192 0x7ffa88ef13c5 38 VclBuilder::insertObject builder.cxx 2469 0x7ffa88ee18df 39 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject widgetbuilder.hxx 230 0x7ffa88e23d54 40 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 41 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 42 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 43 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 44 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 45 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 46 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 47 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleObject widgetbuilder.hxx 234 0x7ffa88e23dff 48 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::handleChild widgetbuilder.hxx 127 0x7ffa88e22c30 49 WidgetBuilder<vcl::Window,VclPtr<vcl::Window>,PopupMenu,VclPtr<PopupMenu>>::processUIFile widgetbuilder.hxx 70 0x7ffa88e24b4a 50 VclBuilder::VclBuilder builder.cxx 523 0x7ffa88ea53be 51 SalInstanceBuilder::SalInstanceBuilder salvtables.cxx 7088 0x7ffa895da3ff 52 std::make_unique<SalInstanceBuilder,vcl::Window * &,rtl::OUString const &,rtl::OUString const &,0> memory 3434 0x7ffa895d44c8 53 SalInstance::CreateBuilder salvtables.cxx 7470 0x7ffa895ef18e 54 Application::CreateBuilder builder.cxx 198 0x7ffa88ebed2a 55 BuilderPage::BuilderPage weldutils.cxx 28 0x7ffa89684128 56 SfxTabPage::SfxTabPage tabdlg.cxx 137 0x7ffa8cd5f0e5 57 SvxFontSubstTabPage::SvxFontSubstTabPage fontsubs.cxx 36 0x7ffa8372d1cd 58 std::make_unique<SvxFontSubstTabPage,weld::Container * &,weld::DialogController * &,SfxItemSet const &,0> memory 3434 0x7ffa8372cdbf 59 SvxFontSubstTabPage::Create fontsubs.cxx 146 0x7ffa8372f692 60 CreateGeneralTabPage treeopt.cxx 289 0x7ffa8383199a 61 OfaTreeOptionsDialog::SelectHdl_Impl treeopt.cxx 1317 0x7ffa838372e7 62 OfaTreeOptionsDialog::ShowPageHdl_Impl treeopt.cxx 623 0x7ffa83837f11 63 OfaTreeOptionsDialog::LinkStubShowPageHdl_Impl treeopt.cxx 620 0x7ffa83834366 64 Link<weld::TreeView &,void>::Call link.hxx 111 0x7ffa88ebdf13 65 weld::TreeView::signal_changed weld.hxx 969 0x7ffa88ef210f 66 SalInstanceTreeView::SelectHdl salvtables.cxx 5304 0x7ffa895f4b39 67 SalInstanceTreeView::LinkStubSelectHdl salvtables.cxx 5299 0x7ffa895f38c6 68 Link<SvTreeListBox *,void>::Call link.hxx 111 0x7ffa88ebe413 69 SvTreeListBox::SelectHdl treelistbox.cxx 454 0x7ffa892ba7a1 70 SvTreeListBox::Select treelistbox.cxx 2128 0x7ffa892ba514 71 SvImpLBox::SetCursor svimpbox.cxx 617 0x7ffa892d05e8 72 ImpLBSelEng::SetCursorAtPoint svimpbox.cxx 2596 0x7ffa892d08a9 73 SelectionEngine::SelMouseButtonDown seleng.cxx 174 0x7ffa88fd0071 74 SvImpLBox::MouseButtonDown svimpbox.cxx 2016 0x7ffa892cc580 75 SvTreeListBox::MouseButtonDown treelistbox.cxx 2277 0x7ffa892b71e2 76 ImplHandleMouseEvent winproc.cxx 708 0x7ffa89059867 77 ImplHandleSalMouseButtonDown winproc.cxx 2338 0x7ffa8905afef 78 ImplWindowFrameProc winproc.cxx 2683 0x7ffa8905ca47 79 SalFrame::CallCallback salframe.hxx 312 0x7ffa88e1ee56 80 ImplHandleMouseMsg salframe.cxx 3335 0x7ffa85c270bf 81 SalFrameWndProc salframe.cxx 5987 0x7ffa85c2de7d 82 SalFrameWndProcW salframe.cxx 6342 0x7ffa85c2ec60 83 CallWindowProcW USER32 0x7ffad61cef5c 84 DispatchMessageW USER32 0x7ffad61ce684 85 ImplSalDispatchMessage salinst.cxx 475 0x7ffa85b8cf98 86 ImplSalYield salinst.cxx 552 0x7ffa85b8d6bd 87 WinSalInstance::DoYield salinst.cxx 581 0x7ffa85b8cc61 88 ImplYield svapp.cxx 385 0x7ffa89656364 89 Application::Yield svapp.cxx 474 0x7ffa89659fe2 90 Dialog::Execute dialog.cxx 1077 0x7ffa88f0c017 91 SalInstanceDialog::run salvtables.cxx 1882 0x7ffa896149af 92 weld::DialogController::run weld.hxx 2691 0x7ffa88eef436 93 OfaTreeOptionsDialog::run treeopt.cxx 2514 0x7ffa83841dd2 94 CuiAbstractController_Impl::Execute dlgfact.cxx 144 0x7ffa837085c8 95 SfxApplication::OfaExec_Impl appserv.cxx 1641 0x7ffa8cb36506 96 SfxStubSfxApplicationOfaExec_Impl sfxslots.hxx 1307 0x7ffa8cb10165 97 SfxDispatcher::Call_Impl dispatch.cxx 257 0x7ffa8cc1f4ae 98 SfxDispatcher::Execute_ dispatch.cxx 754 0x7ffa8cc2260f 99 SfxBindings::Execute_Impl bindings.cxx 1062 0x7ffa8cc0086d 100 SfxDispatchController_Impl::dispatch unoctitm.cxx 736 0x7ffa8cc93caa 101 SfxOfficeDispatch::dispatch unoctitm.cxx 254 0x7ffa8cc945b0 102 framework::MenuBarManager::Select menubarmanager.cxx 821 0x7ffa8d8574d4 103 framework::MenuBarManager::LinkStubSelect menubarmanager.cxx 776 0x7ffa8d855796 104 Link<Menu *,bool>::Call link.hxx 111 0x7ffa88f77d88 105 Menu::Select menu.cxx 360 0x7ffa88f83e19 106 Menu::ImplCallSelect menu.cxx 2152 0x7ffa88f7c761 107 Menu::LinkStubImplCallSelect menu.cxx 2148 0x7ffa88f82366 108 Link<void *,void>::Call link.hxx 111 0x7ffa890529b3 109 ImplHandleUserEvent winproc.cxx 2288 0x7ffa8905ba97 110 ImplWindowFrameProc winproc.cxx 2850 0x7ffa8905d256 111 SalFrame::CallCallback salframe.hxx 312 0x7ffa88e1ee56 112 ImplHandleUserEvent salframe.cxx 4471 0x7ffa85c28fab 113 SalFrameWndProc salframe.cxx 6236 0x7ffa85c2e654 114 SalFrameWndProcW salframe.cxx 6342 0x7ffa85c2ec60 115 CallWindowProcW USER32 0x7ffad61cef5c 116 DispatchMessageW USER32 0x7ffad61ce684 117 ImplSalDispatchMessage salinst.cxx 475 0x7ffa85b8cf98 118 ImplSalYield salinst.cxx 506 0x7ffa85b8d09b 119 WinSalInstance::DoYield salinst.cxx 581 0x7ffa85b8cc61 120 ImplYield svapp.cxx 385 0x7ffa89656364 121 Application::Yield svapp.cxx 474 0x7ffa89659fe2 122 Application::Execute svapp.cxx 361 0x7ffa89653aa6 123 desktop::Desktop::Main app.cxx 1679 0x7ffa9336887f 124 ImplSVMain svmain.cxx 228 0x7ffa8966b310 125 SVMain svmain.cxx 247 0x7ffa8966baf2 126 soffice_main sofficemain.cxx 121 0x7ffa933b86f4 127 sal_main main.c 51 0x7ff64a491013 128 main main.c 49 0x7ff64a49105a 129 __scrt_common_main_seh exe_common.inl 288 0x7ff64a491344 130 BaseThreadInitThunk KERNEL32 0x7ffad5c07374 131 RtlUserThreadStart ntdll 0x7ffad679cc91 Change-Id: I3be8a8e4acd1c87fdfa495c755fd947e9a11b9aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177314 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
110 lines
5.6 KiB
C++
110 lines
5.6 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <standard/vclxaccessibletextcomponent.hxx>
|
|
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
|
|
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
|
|
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
|
|
|
|
#include <cppuhelper/implbase.hxx>
|
|
|
|
|
|
|
|
|
|
class VCLXAccessibleEdit : public cppu::ImplInheritanceHelper<
|
|
VCLXAccessibleTextComponent,
|
|
css::accessibility::XAccessibleAction,
|
|
css::accessibility::XAccessibleEditableText>
|
|
{
|
|
friend class VCLXAccessibleBox;
|
|
|
|
private:
|
|
sal_Int32 m_nCaretPosition;
|
|
|
|
protected:
|
|
virtual ~VCLXAccessibleEdit() override = default;
|
|
|
|
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override;
|
|
virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override;
|
|
sal_Int16 implGetAccessibleRole();
|
|
|
|
// OCommonAccessibleText
|
|
virtual OUString implGetText() override;
|
|
virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
|
|
|
|
// VCLXAccessibleTextComponent
|
|
virtual bool PreferFullTextInTextChangedEvent() override;
|
|
|
|
public:
|
|
VCLXAccessibleEdit( VCLXWindow* pVCLXindow );
|
|
|
|
// XServiceInfo
|
|
virtual OUString SAL_CALL getImplementationName() override;
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
|
|
|
// XAccessibleContext
|
|
virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
|
|
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
|
|
virtual OUString SAL_CALL getAccessibleName() override;
|
|
virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
|
|
|
|
// XAccessibleAction
|
|
virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
|
|
virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
|
|
virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
|
|
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
|
|
|
|
// XAccessibleText
|
|
virtual sal_Int32 SAL_CALL getCaretPosition( ) override;
|
|
virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
|
|
virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
|
|
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
|
|
virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
|
|
virtual sal_Int32 SAL_CALL getCharacterCount( ) override;
|
|
virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
|
|
virtual OUString SAL_CALL getSelectedText( ) override;
|
|
virtual sal_Int32 SAL_CALL getSelectionStart( ) override;
|
|
virtual sal_Int32 SAL_CALL getSelectionEnd( ) override;
|
|
virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
|
|
virtual OUString SAL_CALL getText( ) override;
|
|
virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
|
|
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
|
|
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
|
|
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
|
|
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
|
|
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
|
|
|
|
// XAccessibleEditableText
|
|
virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
|
|
virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) override;
|
|
virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
|
|
virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) override;
|
|
virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) override;
|
|
virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue >& aAttributeSet ) override;
|
|
virtual sal_Bool SAL_CALL setText( const OUString& sText ) override;
|
|
|
|
private:
|
|
bool isComboBoxChild();
|
|
bool isEditable();
|
|
};
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|