include/svx/AccessibleTextHelper.hxx | 8 offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/sheet/AccessibleCsvRuler.idl | 51 ------ offapi/com/sun/star/sheet/AccessibleCsvTable.idl | 1 svx/source/accessibility/AccessibleTextHelper.cxx | 85 ++++------ toolkit/inc/controls/table/AccessibleGridControlBase.hxx | 5 toolkit/inc/controls/table/AccessibleGridControlHeader.hxx | 3 toolkit/source/controls/table/AccessibleGridControlBase.cxx | 7 toolkit/source/controls/table/AccessibleGridControlHeader.cxx | 5 9 files changed, 47 insertions(+), 119 deletions(-)
New commits: commit 37234843dc22803303d5029b3edbfbeae312d112 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Jun 24 15:58:27 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:41:33 2025 +0200 [API CHANGE]: a11y: Drop css::sheet::AccessibleCsvRuler Drop the unpublished service com::sun::star::sheet::AccessibleCsvRuler. It's not implemented or used anywhere. ScAccessibleCsvRuler is the class that implements the functionality mentioned in the IDL file ("The accessible object of the ruler in the CSV import dialog.") but it doesn't actually implement that service. A search in Google and on Ask [1] didn't give any results that would suggest this unpublished service would be relevant for third party code. [1] https://ask.libreoffice.org/ Change-Id: I80da59a92ce2e5a38db5230d2af0f6fb4e69d5a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186909 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index cba7d7cac539..07b9f2e0e36f 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -1145,7 +1145,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/sdbcx,\ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/sheet,\ AccessibleCsvCell \ - AccessibleCsvRuler \ AccessibleCsvTable \ AddIn \ CellAnnotation \ diff --git a/offapi/com/sun/star/sheet/AccessibleCsvRuler.idl b/offapi/com/sun/star/sheet/AccessibleCsvRuler.idl deleted file mode 100644 index 12cdc3757e6e..000000000000 --- a/offapi/com/sun/star/sheet/AccessibleCsvRuler.idl +++ /dev/null @@ -1,51 +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 . - */ - - - -module com { module sun { module star { module sheet { - - -/** The accessible object of the ruler in the CSV import dialog. - @see ::com::sun::star::sheet::AccessibleCsvTable - - @since OOo 1.1.2 - */ -service AccessibleCsvRuler -{ - - /** This interface gives access to the whole content of the ruler. - */ - interface ::com::sun::star::accessibility::XAccessibleContext; - - - /** This interface gives access to the visibility of the ruler. - */ - interface ::com::sun::star::accessibility::XAccessibleComponent; - - - /** This interface gives access to the text representation of the ruler. - */ - interface ::com::sun::star::accessibility::XAccessibleText; -}; - - -}; }; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sheet/AccessibleCsvTable.idl b/offapi/com/sun/star/sheet/AccessibleCsvTable.idl index 528fc205acc7..13b0e3aae14d 100644 --- a/offapi/com/sun/star/sheet/AccessibleCsvTable.idl +++ b/offapi/com/sun/star/sheet/AccessibleCsvTable.idl @@ -23,7 +23,6 @@ module com { module sun { module star { module sheet { /** The accessible object of the data table in the CSV import dialog. - @see ::com::sun::star::sheet::AccessibleCsvRuler @see ::com::sun::star::sheet::AccessibleCsvCell @since OOo 1.1.2 commit 6ddade76893c9e1da69df9024fffb922c787a304 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Jun 24 15:48:16 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:41:26 2025 +0200 toolkit a11y: Drop XTypeProvider::getImplementationId overrides Those are already implemented in the base classes the same way. Change-Id: Idb79a12a58c7bcf2bd7b40786767a55c7716f71a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186908 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx index f4bfd86c47b0..9c7c33f8b6ee 100644 --- a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx +++ b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx @@ -116,11 +116,6 @@ public: virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override; - // XTypeProvider - - /** @return a unique implementation ID. */ - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // XServiceInfo /** @return Whether the specified service is supported by this class. */ diff --git a/toolkit/inc/controls/table/AccessibleGridControlHeader.hxx b/toolkit/inc/controls/table/AccessibleGridControlHeader.hxx index f4fa9c20fe37..fe0d7cd1bd52 100644 --- a/toolkit/inc/controls/table/AccessibleGridControlHeader.hxx +++ b/toolkit/inc/controls/table/AccessibleGridControlHeader.hxx @@ -111,9 +111,6 @@ public: /** @return The name of this class. */ virtual OUString SAL_CALL getImplementationName() override; - /** @return a unique implementation ID. */ - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - private: /** Returns the specified row or column. Uses one of the parameters, depending on object type. diff --git a/toolkit/source/controls/table/AccessibleGridControlBase.cxx b/toolkit/source/controls/table/AccessibleGridControlBase.cxx index c22df05d7a26..eda130f6daf3 100644 --- a/toolkit/source/controls/table/AccessibleGridControlBase.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlBase.cxx @@ -124,13 +124,6 @@ lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() throw IllegalAccessibleComponentStateException(); } -// XTypeProvider - -Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XServiceInfo sal_Bool SAL_CALL AccessibleGridControlBase::supportsService( diff --git a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx index bf96d2af9064..cfc77929d4d5 100644 --- a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx @@ -172,11 +172,6 @@ OUString SAL_CALL AccessibleGridControlHeader::getImplementationName() return u"com.sun.star.accessibility.AccessibleGridControlHeader"_ustr; } -Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // internal virtual methods --------------------------------------------------- AbsoluteScreenPixelRectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() commit c8c9116b099c3e9b9f1c9097a7dfb6b1d05ae990 Author: Michael Weghorn <[email protected]> AuthorDate: Mon May 26 16:56:14 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Jun 25 07:41:20 2025 +0200 svx a11y: Use OAccessibleComponentHelper in AccessibleTextHelper By now, all callers of AccessibleTextHelper::SetEventSource pass an OAccessibleComponentHelper (subclass) param, so switch AccessibleTextHelper_Impl::mxFrontEnd from the abstract UNO interface XAccessible to the more concrete OAccessibleComponentHelper and drop a few method calls and UNO_QUERYs to get the XAccessibleContext and XAccessibleComponent, as OAccessibleComponentHelper implements these interfaces in addition to the XAccessible one. Change-Id: I56a7c4ac96f92ae641b3a4b5f0384cbb8f9aefdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185857 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/svx/AccessibleTextHelper.hxx b/include/svx/AccessibleTextHelper.hxx index 9979b5c71ce0..4bf5d8c1cce0 100644 --- a/include/svx/AccessibleTextHelper.hxx +++ b/include/svx/AccessibleTextHelper.hxx @@ -24,6 +24,8 @@ #include <vector> #include <com/sun/star/uno/Reference.hxx> +#include <comphelper/accessiblecomponenthelper.hxx> +#include <rtl/ref.hxx> #include <sal/types.h> #include <svx/svxdllapi.h> @@ -200,11 +202,11 @@ public: Dispose() when you as the owner are disposing, since until then this object will hold that reference - @param rInterface - The interface that should be set as the source for + @param rEventSource + The accessible that should be set as the source for accessibility events sent by this object. */ - void SetEventSource(const css::uno::Reference<css::accessibility::XAccessible>& rInterface); + void SetEventSource(const rtl::Reference<comphelper::OAccessibleComponentHelper>& rEventSource); /** Set offset of EditEngine/Outliner from parent diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 44488bfbf6cb..e77041cf62f7 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -98,9 +98,9 @@ public: void SetEditSource( ::std::unique_ptr< SvxEditSource > && pEditSource ); - void SetEventSource( const uno::Reference< XAccessible >& rInterface ) + void SetEventSource(const rtl::Reference<comphelper::OAccessibleComponentHelper>& rEventSource) { - mxFrontEnd = rInterface; + mpFrontEnd = rEventSource; } void SetOffset( const Point& ); @@ -176,7 +176,7 @@ private: // our frontend class (the one implementing the actual // interface). That's not necessarily the one containing the impl // pointer! - uno::Reference< XAccessible > mxFrontEnd; + rtl::Reference<comphelper::OAccessibleComponentHelper> mpFrontEnd; // a wrapper for the text forwarders (guarded by solar mutex) mutable SvxEditSourceAdapter maEditSource; @@ -251,15 +251,15 @@ AccessibleTextHelper_Impl::~AccessibleTextHelper_Impl() SvxTextForwarder& AccessibleTextHelper_Impl::GetTextForwarder() const { if( !maEditSource.IsValid() ) - throw uno::RuntimeException(u"Unknown edit source"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Unknown edit source"_ustr); SvxTextForwarder* pTextForwarder = maEditSource.GetTextForwarder(); if( !pTextForwarder ) - throw uno::RuntimeException(u"Unable to fetch text forwarder, model might be dead"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Unable to fetch text forwarder, model might be dead"_ustr); if( !pTextForwarder->IsValid() ) - throw uno::RuntimeException(u"Text forwarder is invalid, model might be dead"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Text forwarder is invalid, model might be dead"_ustr); return *pTextForwarder; } @@ -267,15 +267,15 @@ SvxTextForwarder& AccessibleTextHelper_Impl::GetTextForwarder() const SvxViewForwarder& AccessibleTextHelper_Impl::GetViewForwarder() const { if( !maEditSource.IsValid() ) - throw uno::RuntimeException(u"Unknown edit source"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Unknown edit source"_ustr); SvxViewForwarder* pViewForwarder = maEditSource.GetViewForwarder(); if( !pViewForwarder ) - throw uno::RuntimeException(u"Unable to fetch view forwarder, model might be dead"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Unable to fetch view forwarder, model might be dead"_ustr); if( !pViewForwarder->IsValid() ) - throw uno::RuntimeException(u"View forwarder is invalid, model might be dead"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"View forwarder is invalid, model might be dead"_ustr); return *pViewForwarder; } @@ -283,18 +283,18 @@ SvxViewForwarder& AccessibleTextHelper_Impl::GetViewForwarder() const SvxEditViewForwarder& AccessibleTextHelper_Impl::GetEditViewForwarder() const { if( !maEditSource.IsValid() ) - throw uno::RuntimeException(u"Unknown edit source"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"Unknown edit source"_ustr); SvxEditViewForwarder* pViewForwarder = maEditSource.GetEditViewForwarder(); if( !pViewForwarder ) { - throw uno::RuntimeException(u"No edit view forwarder, object not in edit mode"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"No edit view forwarder, object not in edit mode"_ustr); } if( !pViewForwarder->IsValid() ) { - throw uno::RuntimeException(u"View forwarder is invalid, object not in edit mode"_ustr, mxFrontEnd); + throw uno::RuntimeException(u"View forwarder is invalid, object not in edit mode"_ustr); } return *pViewForwarder; @@ -303,7 +303,8 @@ SvxEditViewForwarder& AccessibleTextHelper_Impl::GetEditViewForwarder() const SvxEditSourceAdapter& AccessibleTextHelper_Impl::GetEditSource() const { if( !maEditSource.IsValid() ) - throw uno::RuntimeException(u"AccessibleTextHelper_Impl::GetEditSource: no edit source"_ustr, mxFrontEnd ); + throw uno::RuntimeException( + u"AccessibleTextHelper_Impl::GetEditSource: no edit source"_ustr); return maEditSource; } @@ -393,9 +394,9 @@ void AccessibleTextHelper_Impl::SetShapeFocus( bool bHaveFocus ) if( bHaveFocus ) { - if( mxFrontEnd.is() ) + if (mpFrontEnd.is()) { - AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + AccessibleCell* pAccessibleCell = dynamic_cast<AccessibleCell*>(mpFrontEnd.get()); if ( !pAccessibleCell ) FireEvent(AccessibleEventId::STATE_CHANGED, uno::Any(AccessibleStateType::FOCUSED)); else // the focus event on cell should be fired on table directly @@ -411,9 +412,9 @@ void AccessibleTextHelper_Impl::SetShapeFocus( bool bHaveFocus ) { // The focus state should be reset directly on table. //LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); - if( mxFrontEnd.is() ) + if (mpFrontEnd.is()) { - AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + AccessibleCell* pAccessibleCell = dynamic_cast<AccessibleCell*>(mpFrontEnd.get()); if ( !pAccessibleCell ) FireEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), uno::Any(AccessibleStateType::FOCUSED) ); else @@ -462,9 +463,9 @@ bool AccessibleTextHelper_Impl::IsActive() const if( !pViewForwarder ) return false; - if( mxFrontEnd.is() ) + if (mpFrontEnd.is()) { - AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + AccessibleCell* pAccessibleCell = dynamic_cast<AccessibleCell*>(mpFrontEnd.get()); if ( pAccessibleCell ) { sdr::table::CellRef xCell = pAccessibleCell->getCellRef(); @@ -693,7 +694,7 @@ void AccessibleTextHelper_Impl::ShutdownEditSource() maParaManager.SetNum(0); // lost all children - if( mxFrontEnd.is() ) + if (mpFrontEnd.is()) FireEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN); // quit listen on stale edit source @@ -759,13 +760,15 @@ void AccessibleTextHelper_Impl::UpdateVisibleChildren( bool bBroadcastEvents ) if (nCurrPara == 0) mnFirstVisibleChild = nCurrPara; mnLastVisibleChild = nCurrPara; - if (mxFrontEnd.is() && bBroadcastEvents) + if (mpFrontEnd.is() && bBroadcastEvents) { // child not yet created? if (!maParaManager.HasCreatedChild(nCurrPara)) { - FireEvent(AccessibleEventId::CHILD, uno::Any(maParaManager.CreateChild(nCurrPara - mnFirstVisibleChild, - mxFrontEnd, GetEditSource(), nCurrPara))); + FireEvent(AccessibleEventId::CHILD, + uno::Any(maParaManager.CreateChild(nCurrPara - mnFirstVisibleChild, + mpFrontEnd, GetEditSource(), + nCurrPara))); } } } @@ -1380,7 +1383,7 @@ void AccessibleTextHelper_Impl::Dispose() // clear references maEditSource.SetEditSource( ::std::unique_ptr< SvxEditSource >() ); - mxFrontEnd = nullptr; + mpFrontEnd = nullptr; } void AccessibleTextHelper_Impl::FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const @@ -1390,11 +1393,11 @@ void AccessibleTextHelper_Impl::FireEvent( const sal_Int16 nEventId, const uno:: { std::scoped_lock aGuard(maMutex); - DBG_ASSERT(mxFrontEnd.is(), "AccessibleTextHelper::FireEvent: no event source set"); + DBG_ASSERT(mpFrontEnd.is(), "AccessibleTextHelper::FireEvent: no event source set"); - if (mxFrontEnd.is()) - aEvent = AccessibleEventObject(mxFrontEnd->getAccessibleContext(), nEventId, - rNewValue, rOldValue, -1); + if (mpFrontEnd.is()) + aEvent = AccessibleEventObject(mpFrontEnd->getAccessibleContext(), nEventId, rNewValue, + rOldValue, -1); else aEvent = AccessibleEventObject(uno::Reference<uno::XInterface>(), nEventId, rNewValue, rOldValue, -1); @@ -1423,13 +1426,14 @@ uno::Reference< XAccessible > AccessibleTextHelper_Impl::getAccessibleChild( sal if( 0 > i || i >= getAccessibleChildCount() || GetTextForwarder().GetParagraphCount() <= i ) { - throw lang::IndexOutOfBoundsException(u"Invalid child index"_ustr, mxFrontEnd); + throw lang::IndexOutOfBoundsException(u"Invalid child index"_ustr); } - DBG_ASSERT(mxFrontEnd.is(), "AccessibleTextHelper_Impl::UpdateVisibleChildren: no frontend set"); + DBG_ASSERT(mpFrontEnd.is(), + "AccessibleTextHelper_Impl::UpdateVisibleChildren: no frontend set"); - if( mxFrontEnd.is() ) - return maParaManager.CreateChild(i, mxFrontEnd, GetEditSource(), mnFirstVisibleChild + i); + if (mpFrontEnd.is()) + return maParaManager.CreateChild(i, mpFrontEnd, GetEditSource(), mnFirstVisibleChild + i); else return nullptr; } @@ -1462,15 +1466,9 @@ void AccessibleTextHelper_Impl::removeAccessibleEventListener( const uno::Refere uno::Reference< XAccessible > AccessibleTextHelper_Impl::getAccessibleAtPoint( const awt::Point& _aPoint ) { // make given position relative - if( !mxFrontEnd.is() ) - throw uno::RuntimeException(u"AccessibleTextHelper_Impl::getAccessibleAt: frontend invalid"_ustr, mxFrontEnd ); - - uno::Reference< XAccessibleContext > xFrontEndContext = mxFrontEnd->getAccessibleContext(); - - if( !xFrontEndContext.is() ) - throw uno::RuntimeException(u"AccessibleTextHelper_Impl::getAccessibleAt: frontend invalid"_ustr, mxFrontEnd ); - - uno::Reference< XAccessibleComponent > xFrontEndComponent( xFrontEndContext, uno::UNO_QUERY_THROW ); + if (!mpFrontEnd.is()) + throw uno::RuntimeException( + u"AccessibleTextHelper_Impl::getAccessibleAt: frontend invalid"_ustr); // #103862# No longer need to make given position relative Point aPoint( _aPoint.X, _aPoint.Y ); @@ -1545,13 +1543,14 @@ void AccessibleTextHelper::SetEditSource( ::std::unique_ptr< SvxEditSource > && #endif } -void AccessibleTextHelper::SetEventSource( const uno::Reference< XAccessible >& rInterface ) +void AccessibleTextHelper::SetEventSource( + const rtl::Reference<comphelper::OAccessibleComponentHelper>& rEventSource) { #ifdef DBG_UTIL mpImpl->CheckInvariants(); #endif - mpImpl->SetEventSource( rInterface ); + mpImpl->SetEventSource(rEventSource); #ifdef DBG_UTIL mpImpl->CheckInvariants();
