sw/inc/accmap.hxx | 9 ++++----- sw/inc/viewsh.hxx | 3 +-- sw/source/core/access/accmap.cxx | 9 ++++----- sw/source/core/view/viewsh.cxx | 2 +- sw/source/uibase/uiview/pview.cxx | 12 ++++-------- vcl/source/window/menu.cxx | 3 +-- 6 files changed, 15 insertions(+), 23 deletions(-)
New commits: commit 16e481755e985947109a0dbb30008d4a8c2d3738 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jun 25 16:43:04 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jun 27 09:08:25 2025 +0200 vcl: Drop unnecessary const_cast in MenuBar::GetMenuBarHeight Menu::ImplGetSalMenu is const, so no need to have a non-const Menu(Bar) to call it. Change-Id: I0b6351b0bd26ddbd2c5884e65624093a488c46ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186992 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index e8a778c4844b..9adbf24969a7 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2717,8 +2717,7 @@ bool MenuBar::HandleMenuButtonEvent( sal_uInt16 i_nButtonId ) int MenuBar::GetMenuBarHeight() const { - MenuBar* pMenuBar = const_cast<MenuBar*>(this); - const SalMenu *pNativeMenu = pMenuBar->ImplGetSalMenu(); + const SalMenu *pNativeMenu = ImplGetSalMenu(); int nMenubarHeight; if (pNativeMenu) nMenubarHeight = pNativeMenu->GetMenuBarHeight(); commit 5c7ca72ec07b14daf5dd60ed90d66227f2e8686a Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jun 25 13:28:37 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jun 27 09:08:18 2025 +0200 sw a11y: Don't call GetAccessible in SwPagePreviewWin::CreateAccessible As a vcl::Window::CreateAccessible override, it only gets called from vcl::Window::GetAccessible when no accessible has been set yet, so there's no need to check that inside of the method implementation again. In case of creating a new accessible, return the newly created one right away instead of calling Window::GetAccessible to retrieve it. Also switch local var from XAccessible to more concrete OAccessible to prepare for an upcoming change. Change-Id: Iebda3303afc1eaefc6d05f4faef718810fd8756b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186991 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 37d18f532be1..7f80247d81c5 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1825,18 +1825,14 @@ uno::Reference< css::accessibility::XAccessible > SolarMutexGuard aGuard; // this should have happened already!!! #if !ENABLE_WASM_STRIP_ACCESSIBILITY OSL_ENSURE( GetViewShell() != nullptr, "We need a view shell" ); - css::uno::Reference< css::accessibility::XAccessible > xAcc = GetAccessible( false ); - if (xAcc.is()) - { - return xAcc; - } if (mpViewShell) { - css::uno::Reference< css::accessibility::XAccessible > xAccPreview = mpViewShell->CreateAccessiblePreview(); - SetAccessible(xAccPreview); + rtl::Reference<comphelper::OAccessible> pAccPreview = mpViewShell->CreateAccessiblePreview(); + SetAccessible(pAccPreview); + return pAccPreview; } #endif - return GetAccessible( false ); + return {}; } void SwPagePreview::ShowHScrollbar(bool bShow) commit 10df7ac321d686c893526e79e81be822e14cffae Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jun 25 13:18:28 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jun 27 09:08:11 2025 +0200 sw a11y: Return OAccessible in SwViewShell::CreateAccessiblePreview ... instead of a reference to the abstract XAccessible interface. This will allow to also switch/simplify callers in upcoming commits. Change-Id: I0d33c057c5d92a4a20e621a7d3327c42f1615391 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186990 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index 4ec88ee075e8..810fccd5a550 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -148,11 +148,10 @@ public: rtl::Reference<comphelper::OAccessible> GetDocumentView(); - css::uno::Reference<css::accessibility::XAccessible> GetDocumentPreview( - const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, - const Fraction& _rScale, - const SwPageFrame* _pSelectedPageFrame, - const Size& _rPreviewWinSize ); + rtl::Reference<comphelper::OAccessible> + GetDocumentPreview(const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, + const Fraction& _rScale, const SwPageFrame* _pSelectedPageFrame, + const Size& _rPreviewWinSize); ::rtl::Reference < SwAccessibleContext > GetContextImpl( const SwFrame *pFrame, diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 446684971880..ce9bdd25bae9 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -30,7 +30,6 @@ #include <tools/lazydelete.hxx> #include <vcl/window.hxx> -namespace com::sun::star::accessibility { class XAccessible; } namespace comphelper { class OAccessible; } class SwDoc; class IDocumentSettingAccess; @@ -558,7 +557,7 @@ public: rtl::Reference<comphelper::OAccessible> CreateAccessible(); - css::uno::Reference< css::accessibility::XAccessible > CreateAccessiblePreview(); + rtl::Reference<comphelper::OAccessible> CreateAccessiblePreview(); void ShowPreviewSelection( sal_uInt16 nSelPage ); void InvalidateAccessibleFocus(); diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index fedc79616a6c..33f1e5b31d13 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1646,11 +1646,10 @@ rtl::Reference<comphelper::OAccessible> SwAccessibleMap::GetDocumentView() return GetDocumentView_( false ); } -uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview( - const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, - const Fraction& _rScale, - const SwPageFrame* _pSelectedPageFrame, - const Size& _rPreviewWinSize ) +rtl::Reference<comphelper::OAccessible> +SwAccessibleMap::GetDocumentPreview(const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages, + const Fraction& _rScale, const SwPageFrame* _pSelectedPageFrame, + const Size& _rPreviewWinSize) { // create & update preview data object if( mpPreview == nullptr ) diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 1926f0f437dd..45fcd73f7225 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2716,7 +2716,7 @@ rtl::Reference<comphelper::OAccessible> SwViewShell::CreateAccessible() return pAcc; } -uno::Reference< css::accessibility::XAccessible > SwViewShell::CreateAccessiblePreview() +rtl::Reference<comphelper::OAccessible> SwViewShell::CreateAccessiblePreview() { OSL_ENSURE( IsPreview(), "Can't create accessible preview for non-preview SwViewShell" );
