include/vcl/toolkit/svtabbx.hxx | 2 vcl/inc/accessibility/accessibletablistboxtable.hxx | 13 +---- vcl/source/accessibility/accessibletablistboxtable.cxx | 14 +---- vcl/source/treelist/svtabbx.cxx | 43 ++++++----------- 4 files changed, 24 insertions(+), 48 deletions(-)
New commits: commit 8b9a7146bc6d8ccd19968b89ed97ce59cd466573 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 4 16:26:13 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 5 08:37:03 2025 +0100 vcl: Merge SvHeaderTabListBoxImpl into SvHeaderTabListBox SvHeaderTabListBoxImpl only has a single VclPtr<HeaderBar> member. Move that one directly to SvHeaderTabListBox and drop SvHeaderTabListBoxImpl. Change-Id: Ia79229a1c901f4e7a9f90496caacfb434b582fe7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181136 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index 65e6d106db7d..322925b437bf 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -96,7 +96,7 @@ class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvHeaderTabListBox : public SvTabList { private: bool m_bFirstPaint; - std::unique_ptr<::vcl::SvHeaderTabListBoxImpl> m_pImpl; + VclPtr<HeaderBar> m_xHeaderBar; rtl::Reference<AccessibleTabListBox> m_xAccessible; std::vector<css::uno::Reference<css::accessibility::XAccessible>> m_aAccessibleChildren; diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 04f359d1696e..165643f189ac 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -539,26 +539,15 @@ tools::Long SvTabListBox::GetLogicTab( sal_uInt16 nTab ) return aTabs[ nTab ]->GetPos(); } -namespace vcl -{ - struct SvHeaderTabListBoxImpl - { - VclPtr<HeaderBar> m_pHeaderBar; - - SvHeaderTabListBoxImpl() : m_pHeaderBar( nullptr ) { } - }; -} - SvHeaderTabListBox::SvHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle, HeaderBar* pHeaderBar) : SvTabListBox(pParent, nWinStyle) , m_bFirstPaint(true) - , m_pImpl(new ::vcl::SvHeaderTabListBoxImpl) { assert(pHeaderBar); - m_pImpl->m_pHeaderBar = pHeaderBar; + m_xHeaderBar = pHeaderBar; SetScrolledHdl(LINK(this, SvHeaderTabListBox, ScrollHdl_Impl)); - m_pImpl->m_pHeaderBar->SetCreateAccessibleHdl(LINK(this, SvHeaderTabListBox, CreateAccessibleHdl_Impl)); + m_xHeaderBar->SetCreateAccessibleHdl(LINK(this, SvHeaderTabListBox, CreateAccessibleHdl_Impl)); } SvHeaderTabListBox::~SvHeaderTabListBox() @@ -573,7 +562,7 @@ void SvHeaderTabListBox::dispose() m_aAccessibleChildren.clear(); m_xAccessible.clear(); - m_pImpl.reset(); + m_xHeaderBar.clear(); SvTabListBox::dispose(); } @@ -588,7 +577,7 @@ void SvHeaderTabListBox::Paint( vcl::RenderContext& rRenderContext, const tools: HeaderBar* SvHeaderTabListBox::GetHeaderBar() { - return m_pImpl ? m_pImpl->m_pHeaderBar : nullptr; + return m_xHeaderBar; } bool SvHeaderTabListBox::IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ) @@ -644,12 +633,12 @@ void SvHeaderTabListBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) IMPL_LINK_NOARG(SvHeaderTabListBox, ScrollHdl_Impl, SvTreeListBox*, void) { - m_pImpl->m_pHeaderBar->SetOffset( -GetXOffset() ); + m_xHeaderBar->SetOffset(-GetXOffset()); } IMPL_LINK_NOARG(SvHeaderTabListBox, CreateAccessibleHdl_Impl, HeaderBar*, void) { - vcl::Window* pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow(); + vcl::Window* pParent = m_xHeaderBar->GetAccessibleParentWindow(); DBG_ASSERT( pParent, "SvHeaderTabListBox..CreateAccessibleHdl_Impl - accessible parent not found" ); if ( pParent ) { @@ -658,7 +647,7 @@ IMPL_LINK_NOARG(SvHeaderTabListBox, CreateAccessibleHdl_Impl, HeaderBar*, void) { Reference<XAccessible> xAccessible = AccessibleFactory::createAccessibleBrowseBoxHeaderBar( xAccParent, *this, AccessibleBrowseBoxObjType::ColumnHeaderBar ); - m_pImpl->m_pHeaderBar->SetAccessible( xAccessible ); + m_xHeaderBar->SetAccessible(xAccessible); } } } @@ -708,7 +697,7 @@ sal_Int32 SvHeaderTabListBox::GetRowCount() const sal_uInt16 SvHeaderTabListBox::GetColumnCount() const { - return m_pImpl->m_pHeaderBar->GetItemCount(); + return m_xHeaderBar->GetItemCount(); } sal_Int32 SvHeaderTabListBox::GetCurrRow() const @@ -743,7 +732,7 @@ OUString SvHeaderTabListBox::GetRowDescription( sal_Int32 _nRow ) const OUString SvHeaderTabListBox::GetColumnDescription( sal_uInt16 _nColumn ) const { - return m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) ); + return m_xHeaderBar->GetItemText(m_xHeaderBar->GetItemId(_nColumn )); } bool SvHeaderTabListBox::HasRowHeader() const @@ -833,12 +822,12 @@ tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool _bIsColumnBar, bool _b { vcl::Window* pParent = nullptr; if (_bOnScreen) - aRect = tools::Rectangle(m_pImpl->m_pHeaderBar->GetWindowExtentsAbsolute()); + aRect = tools::Rectangle(m_xHeaderBar->GetWindowExtentsAbsolute()); else { - pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow(); + pParent = m_xHeaderBar->GetAccessibleParentWindow(); assert(pParent); - aRect = m_pImpl->m_pHeaderBar->GetWindowExtentsRelative(*pParent ); + aRect = m_xHeaderBar->GetWindowExtentsRelative(*pParent); } } return aRect; @@ -861,8 +850,8 @@ tools::Rectangle SvHeaderTabListBox::GetFieldRectPixel( sal_Int32 _nRow, sal_uIn { aRect = _bIsHeader ? calcHeaderRect( true, false ) : GetBoundingRect( pEntry ); Point aTopLeft = aRect.TopLeft(); - DBG_ASSERT( m_pImpl->m_pHeaderBar->GetItemCount() > _nColumn, "invalid column" ); - tools::Rectangle aItemRect = m_pImpl->m_pHeaderBar->GetItemRect( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) ); + DBG_ASSERT(m_xHeaderBar->GetItemCount() > _nColumn, "invalid column"); + tools::Rectangle aItemRect = m_xHeaderBar->GetItemRect(m_xHeaderBar->GetItemId(_nColumn)); aTopLeft.setX( aItemRect.Left() ); Size aSize = aItemRect.GetSize(); aRect = tools::Rectangle( aTopLeft, aSize ); @@ -990,7 +979,7 @@ OUString SvHeaderTabListBox::GetAccessibleObjectName( AccessibleBrowseBoxObjType } case AccessibleBrowseBoxObjType::ColumnHeaderCell: { - aRetText = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( static_cast<sal_uInt16>(_nPos) ) ); + aRetText = m_xHeaderBar->GetItemText(m_xHeaderBar->GetItemId(static_cast<sal_uInt16>(_nPos))); break; } @@ -1019,7 +1008,7 @@ OUString SvHeaderTabListBox::GetAccessibleObjectDescription( AccessibleBrowseBox OUString aText( VclResId(STR_SVT_ACC_DESC_TABLISTBOX) ); aText = aText.replaceFirst( "%1", OUString::number( nRow ) ); - OUString sColHeader = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( nColumn ) ); + OUString sColHeader = m_xHeaderBar->GetItemText(m_xHeaderBar->GetItemId(nColumn)); if ( sColHeader.isEmpty() ) sColHeader = OUString::number( nColumn ); aText = aText.replaceFirst( "%2", sColHeader ); commit 8fbae3f72ef305feef3981ce6feb4e9fe92c7abd Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 4 15:34:14 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 5 08:36:51 2025 +0100 a11y: Use ImplInheritanceHelper Change-Id: I040c0c0e0caac924d97d015adf248aba7dce8dc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181135 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/accessibility/accessibletablistboxtable.hxx b/vcl/inc/accessibility/accessibletablistboxtable.hxx index 8fa543e63ea4..40650afe0fec 100644 --- a/vcl/inc/accessibility/accessibletablistboxtable.hxx +++ b/vcl/inc/accessibility/accessibletablistboxtable.hxx @@ -26,10 +26,9 @@ class SvHeaderTabListBox; -typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > - AccessibleTabListBoxTableImplHelper; - -class AccessibleTabListBoxTable final : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper +class AccessibleTabListBoxTable final + : public cppu::ImplInheritanceHelper<AccessibleBrowseBoxTable, + css::accessibility::XAccessibleSelection> { private: VclPtr<SvHeaderTabListBox> m_pTabListBox; @@ -78,12 +77,6 @@ private: virtual ~AccessibleTabListBoxTable() override; public: - // XInterface - DECLARE_XINTERFACE( ) - - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; diff --git a/vcl/source/accessibility/accessibletablistboxtable.cxx b/vcl/source/accessibility/accessibletablistboxtable.cxx index 3d29c8d15e6c..5add9c582ace 100644 --- a/vcl/source/accessibility/accessibletablistboxtable.cxx +++ b/vcl/source/accessibility/accessibletablistboxtable.cxx @@ -35,11 +35,10 @@ using namespace ::com::sun::star; // Ctor() and Dtor() -AccessibleTabListBoxTable::AccessibleTabListBoxTable( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) : - - AccessibleBrowseBoxTable( rxParent, rBox ), - - m_pTabListBox ( &rBox ) +AccessibleTabListBoxTable::AccessibleTabListBoxTable(const Reference<XAccessible>& rxParent, + SvHeaderTabListBox& rBox) + : ImplInheritanceHelper(rxParent, rBox) + , m_pTabListBox(&rBox) { m_pTabListBox->AddEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); @@ -243,11 +242,6 @@ sal_Int32 AccessibleTabListBoxTable::implGetSelRow( sal_Int32 nSelRow ) const return 0; } -// XInterface & XTypeProvider - -IMPLEMENT_FORWARD_XINTERFACE2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) -IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) - // XServiceInfo OUString AccessibleTabListBoxTable::getImplementationName()
