basctl/Library_basctl.mk | 2 basctl/source/basicide/baside2b.cxx | 35 ++++++++++ basctl/source/basicide/textwindowaccessibility.cxx | 7 +- basctl/source/basicide/textwindowaccessibility.hxx | 5 + basctl/source/basicide/textwindowpeer.cxx | 69 --------------------- basctl/source/basicide/textwindowpeer.hxx | 37 ----------- include/vcl/accessiblefactory.hxx | 3 solenv/clang-format/excludelist | 5 - vcl/Library_vcl.mk | 1 vcl/source/accessibility/acc_factory.cxx | 8 -- 10 files changed, 47 insertions(+), 125 deletions(-)
New commits: commit d997c4fd03d76faf4d72f29a927be43d630f3a64 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 30 15:37:20 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 1 09:52:37 2025 +0200 basicide a11y: Move TextWindow a11y classes to basctl, create directly Move the a11y classes used for implementing Basic IDE a11y from vcl to basctl. Move them into a namespace "accessibility" to avoid a name clash with the Paragraph class declared in include/editeng/outliner.hxx. In TextWindowPeer::CreateAccessibleContext, call the Document ctor directly and drop the now unused AccessibleFactory::createAccessibleTextWindowContext. Change-Id: I396507e5fca17b4e7a1b65b28797569bc31d6a04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184838 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index d8e3cb33f0dc..3dfb2f2522f4 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\ basctl/source/basicide/ObjectCatalog \ basctl/source/basicide/sbxitem \ basctl/source/basicide/scriptdocument \ + basctl/source/basicide/textwindowaccessibility \ basctl/source/basicide/uiobject \ basctl/source/basicide/unomodel \ basctl/source/dlged/dlgedclip \ diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index a9588d4b2e4a..2e5dd6c7daad 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -69,6 +69,7 @@ #include <vector> #include <com/sun/star/reflection/theCoreReflection.hpp> #include <unotools/charclass.hxx> +#include "textwindowaccessibility.hxx" #include "uiobject.hxx" #include <basegfx/utils/zoomtools.hxx> #include <svl/itemset.hxx> @@ -1705,7 +1706,7 @@ TextWindowPeer::TextWindowPeer(TextView& view) css::uno::Reference<css::accessibility::XAccessibleContext> TextWindowPeer::CreateAccessibleContext() { - return AccessibleFactory::createAccessibleTextWindowContext(GetWindow(), m_rEngine, m_rView); + return new ::accessibility::Document(GetWindow(), m_rEngine, m_rView); } struct WatchItem diff --git a/vcl/source/accessibility/textwindowaccessibility.cxx b/basctl/source/basicide/textwindowaccessibility.cxx similarity index 99% rename from vcl/source/accessibility/textwindowaccessibility.cxx rename to basctl/source/basicide/textwindowaccessibility.cxx index 8bed55efb786..633cb6c1069f 100644 --- a/vcl/source/accessibility/textwindowaccessibility.cxx +++ b/basctl/source/basicide/textwindowaccessibility.cxx @@ -19,7 +19,7 @@ #include <sal/config.h> -#include <accessibility/textwindowaccessibility.hxx> +#include "textwindowaccessibility.hxx" #include <sal/log.hxx> @@ -48,6 +48,9 @@ #include <numeric> #include <vector> +namespace accessibility +{ + void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier) { assert(m_pNotifier == nullptr && "called more than once"); @@ -2104,4 +2107,6 @@ css::uno::Any Document::mapFontWeight(::FontWeight nWeight) : WEIGHT_BLACK; } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/textwindowaccessibility.hxx b/basctl/source/basicide/textwindowaccessibility.hxx similarity index 99% rename from vcl/inc/accessibility/textwindowaccessibility.hxx rename to basctl/source/basicide/textwindowaccessibility.hxx index 6a0ec734c0b2..7ee39ce81545 100644 --- a/vcl/inc/accessibility/textwindowaccessibility.hxx +++ b/basctl/source/basicide/textwindowaccessibility.hxx @@ -46,6 +46,9 @@ class TextEngine; class TextView; +namespace accessibility +{ + class Document; class SfxListenerGuard @@ -541,4 +544,6 @@ private: bool m_bInParagraphNotificationsHandler = false; }; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/accessiblefactory.hxx b/include/vcl/accessiblefactory.hxx index 29cd8c3635c2..71fdc103197c 100644 --- a/include/vcl/accessiblefactory.hxx +++ b/include/vcl/accessiblefactory.hxx @@ -88,9 +88,6 @@ public: createAccessibleContext(FormattedField* pFormattedField); static css::uno::Reference<css::accessibility::XAccessibleContext> createAccessibleContext(vcl::Window* pWindow); - - static css::uno::Reference<css::accessibility::XAccessibleContext> - createAccessibleTextWindowContext(vcl::Window* pWindow, TextEngine& rEngine, TextView& rView); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 86d3141e4e90..52dbb3e2f2a8 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -91,6 +91,8 @@ basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.hxx basctl/source/basicide/sbxitem.cxx basctl/source/basicide/scriptdocument.cxx +basctl/source/basicide/textwindowaccessibility.cxx +basctl/source/basicide/textwindowaccessibility.hxx basctl/source/basicide/unomodel.cxx basctl/source/basicide/unomodel.hxx basctl/source/dlged/dlged.cxx @@ -14094,7 +14096,6 @@ vcl/inc/accessibility/accessiblemenuitemcomponent.hxx vcl/inc/accessibility/accessibletablistbox.hxx vcl/inc/accessibility/accessibletablistboxtable.hxx vcl/inc/accessibility/listboxhelper.hxx -vcl/inc/accessibility/textwindowaccessibility.hxx vcl/inc/accessibility/vclxaccessiblebox.hxx vcl/inc/accessibility/vclxaccessiblebutton.hxx vcl/inc/accessibility/vclxaccessiblecheckbox.hxx @@ -14133,7 +14134,6 @@ vcl/source/accessibility/accessiblelistboxentry.cxx vcl/source/accessibility/accessibletablistbox.cxx vcl/source/accessibility/accessibletablistboxtable.cxx vcl/source/accessibility/floatingwindowaccessible.cxx -vcl/source/accessibility/textwindowaccessibility.cxx vcl/source/accessibility/vclxaccessiblebox.cxx vcl/source/accessibility/vclxaccessiblebutton.cxx vcl/source/accessibility/vclxaccessiblecheckbox.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a4402914132e..8e5ecb88778c 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -119,7 +119,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/accessibility/accessibletablistbox \ vcl/source/accessibility/accessibletablistboxtable \ vcl/source/accessibility/characterattributeshelper \ - vcl/source/accessibility/textwindowaccessibility \ vcl/source/accessibility/floatingwindowaccessible \ vcl/source/accessibility/IComboListBoxHelper \ vcl/source/accessibility/svtaccessiblenumericfield \ diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 8069d2f9e7dc..6cdac506282e 100644 --- a/vcl/source/accessibility/acc_factory.cxx +++ b/vcl/source/accessibility/acc_factory.cxx @@ -42,7 +42,6 @@ #include <accessibility/accessibletablistbox.hxx> #include <accessibility/AccessibleIconView.hxx> #include <accessibility/accessiblelistbox.hxx> -#include <accessibility/textwindowaccessibility.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <vcl/toolkit/lstbox.hxx> #include <vcl/toolkit/combobox.hxx> @@ -180,11 +179,4 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext(Forma return new SVTXAccessibleNumericField(pFormattedField); } -Reference<XAccessibleContext> -AccessibleFactory::createAccessibleTextWindowContext(vcl::Window* pWindow, TextEngine& rEngine, - TextView& rView) -{ - return new Document(pWindow, rEngine, rView ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 9e96699b4040949699b86e11fd23100f6d59368d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 30 15:09:24 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 1 09:52:30 2025 +0200 basicide a11y: Move basctl::createTextWindowPeer logic to caller Drop the helper method basctl::createTextWindowPeer that calls the TextWindowPeer ctor, and instead call the ctor directly from EditorWindow::GetComponentInterface. In order for the class to be known there, move it to the anonymous namespace in the same source file. This is an intermediate step towards getting rid of TextWindowPeer altogether. Change-Id: I58111af8fadb45c6471af942b300665f3df189c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184837 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index 9006a9aadd17..d8e3cb33f0dc 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -107,7 +107,6 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\ basctl/source/basicide/ObjectCatalog \ basctl/source/basicide/sbxitem \ basctl/source/basicide/scriptdocument \ - basctl/source/basicide/textwindowpeer \ basctl/source/basicide/uiobject \ basctl/source/basicide/unomodel \ basctl/source/dlged/dlgedclip \ diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 7e9318a283a6..a9588d4b2e4a 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -48,11 +48,13 @@ #include <sfx2/viewfrm.hxx> #include <tools/debug.hxx> #include <utility> +#include <vcl/accessiblefactory.hxx> #include <vcl/image.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> #include <svl/urihelper.hxx> #include <svx/svxids.hrc> +#include <toolkit/awt/vclxwindow.hxx> #include <vcl/commandevent.hxx> #include <vcl/xtextedt.hxx> #include <vcl/textview.hxx> @@ -67,7 +69,6 @@ #include <vector> #include <com/sun/star/reflection/theCoreReflection.hpp> #include <unotools/charclass.hxx> -#include "textwindowpeer.hxx" #include "uiobject.hxx" #include <basegfx/utils/zoomtools.hxx> #include <svl/itemset.hxx> @@ -1678,6 +1679,35 @@ void BreakPointWindow::setBackgroundColor(Color aColor) namespace { +class TextWindowPeer final : public VCLXWindow +{ +public: + explicit TextWindowPeer(TextView& view); + + TextWindowPeer(const TextWindowPeer&) = delete; + TextWindowPeer& operator=(const TextWindowPeer&) = delete; + +private: + virtual css::uno::Reference<css::accessibility::XAccessibleContext> + CreateAccessibleContext() override; + + TextEngine& m_rEngine; + TextView& m_rView; +}; + +TextWindowPeer::TextWindowPeer(TextView& view) + : m_rEngine(*view.GetTextEngine()) + , m_rView(view) +{ + SetWindow(view.GetWindow()); +} + +css::uno::Reference<css::accessibility::XAccessibleContext> +TextWindowPeer::CreateAccessibleContext() +{ + return AccessibleFactory::createAccessibleTextWindowContext(GetWindow(), m_rEngine, m_rView); +} + struct WatchItem { OUString maName; @@ -2161,7 +2191,7 @@ EditorWindow::GetComponentInterface(bool bCreate) if (!pEditEngine) CreateEditEngine(); - xPeer = createTextWindowPeer(*GetEditView()); + xPeer = new TextWindowPeer(*GetEditView()); SetComponentInterface(xPeer); } return xPeer; diff --git a/basctl/source/basicide/textwindowpeer.cxx b/basctl/source/basicide/textwindowpeer.cxx deleted file mode 100644 index 68945f46b630..000000000000 --- a/basctl/source/basicide/textwindowpeer.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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 . - */ - -#include <sal/config.h> - -#include <vcl/accessiblefactory.hxx> - -#include <com/sun/star/accessibility/XAccessibleContext.hpp> -#include <com/sun/star/uno/Reference.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <vcl/texteng.hxx> -#include <vcl/textview.hxx> -#include <vcl/window.hxx> -#include "textwindowpeer.hxx" - -namespace { - -class TextWindowPeer final : public VCLXWindow { -public: - explicit TextWindowPeer(TextView & view); - - TextWindowPeer(const TextWindowPeer&) = delete; - TextWindowPeer& operator=(const TextWindowPeer&) = delete; - -private: - virtual css::uno::Reference<css::accessibility::XAccessibleContext> - CreateAccessibleContext() override; - - TextEngine & m_rEngine; - TextView & m_rView; -}; - -TextWindowPeer::TextWindowPeer(TextView & view): - m_rEngine(*view.GetTextEngine()), m_rView(view) -{ - SetWindow(view.GetWindow()); -} - -css::uno::Reference<css::accessibility::XAccessibleContext> -TextWindowPeer::CreateAccessibleContext() { - return AccessibleFactory::createAccessibleTextWindowContext( - GetWindow(), m_rEngine, m_rView); -} - -} - -css::uno::Reference<css::awt::XVclWindowPeer> basctl::createTextWindowPeer( - TextView & view) -{ - return new TextWindowPeer(view); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/textwindowpeer.hxx b/basctl/source/basicide/textwindowpeer.hxx deleted file mode 100644 index e29c4a412dcb..000000000000 --- a/basctl/source/basicide/textwindowpeer.hxx +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- 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 <sal/config.h> - -#include <com/sun/star/uno/Reference.hxx> - -namespace com::sun::star::awt -{ -class XVclWindowPeer; -} -class TextView; - -namespace basctl -{ -css::uno::Reference<css::awt::XVclWindowPeer> createTextWindowPeer(TextView& view); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 1e4a8301319b..86d3141e4e90 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -91,7 +91,6 @@ basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.hxx basctl/source/basicide/sbxitem.cxx basctl/source/basicide/scriptdocument.cxx -basctl/source/basicide/textwindowpeer.cxx basctl/source/basicide/unomodel.cxx basctl/source/basicide/unomodel.hxx basctl/source/dlged/dlged.cxx