include/sfx2/thumbnailview.hxx        |   10 ++++++----
 sfx2/source/control/thumbnailview.cxx |   27 ++++++++++-----------------
 2 files changed, 16 insertions(+), 21 deletions(-)

New commits:
commit eecf74196b852cddaaffbf7e0442fd2abbc36a5d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Aug 30 13:46:34 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 31 08:34:42 2023 +0200

    use concrete type for ThumbnailView::mxAccessible
    
    avoid some unnecessary casting
    
    Change-Id: Id3c4d8b91ec04beb1fed61050066e2b79d01d2df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156288
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 3da4af181ff5..a51db9df048b 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -25,8 +25,7 @@ class DataChangedEvent;
 class ScrollBar;
 class ThumbnailViewItem;
 typedef ::std::vector< ThumbnailViewItem* > ThumbnailValueItemList;
-
-
+class ThumbnailViewAcc;
 struct ThumbnailItemAttributes;
 
 /*************************************************************************
@@ -169,6 +168,9 @@ public:
 
     virtual ~ThumbnailView() override;
 
+    ThumbnailView& operator=( ThumbnailView const & ) = delete; // MSVC 
workaround
+    ThumbnailView( ThumbnailView const & ) = delete; // MSVC workaround
+
     virtual bool MouseMove(const MouseEvent& rMEvt) override;
 
     /// Updates information in the view; used only in RecentDocsView ATM.
@@ -252,7 +254,7 @@ protected:
 
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
 
-    const css::uno::Reference<css::accessibility::XAccessible> & 
getAccessible() const;
+    const rtl::Reference<ThumbnailViewAcc> & getAccessible() const;
 
 protected:
 
@@ -287,7 +289,7 @@ protected:
 protected:
 
     std::vector< std::unique_ptr<ThumbnailViewItem> > mItemList;
-    css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
+    rtl::Reference<ThumbnailViewAcc> mxAccessible;
     ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered 
items
     ThumbnailValueItemList::iterator mpStartSelRange;
     tools::Long mnItemWidth;
diff --git a/sfx2/source/control/thumbnailview.cxx 
b/sfx2/source/control/thumbnailview.cxx
index 12bfcb327143..b0cc1efefb27 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -160,10 +160,8 @@ 
ThumbnailView::ThumbnailView(std::unique_ptr<weld::ScrolledWindow> xWindow, std:
 
 ThumbnailView::~ThumbnailView()
 {
-    css::uno::Reference< css::lang::XComponent> xComponent(mxAccessible, 
css::uno::UNO_QUERY);
-
-    if (xComponent.is())
-        xComponent->dispose();
+    if (mxAccessible.is())
+        mxAccessible->dispose();
 
     mpItemAttrs.reset();
 
@@ -328,7 +326,7 @@ css::uno::Reference< css::accessibility::XAccessible > 
ThumbnailView::CreateAcce
     return mxAccessible;
 }
 
-const css::uno::Reference< css::accessibility::XAccessible > & 
ThumbnailView::getAccessible() const
+const rtl::Reference< ThumbnailViewAcc > & ThumbnailView::getAccessible() const
 {
     return mxAccessible;
 }
@@ -550,16 +548,13 @@ ThumbnailViewItem* ThumbnailView::ImplGetVisibleItem( 
sal_uInt16 nVisiblePos )
 
 void ThumbnailView::ImplFireAccessibleEvent( short nEventId, const 
css::uno::Any& rOldValue, const css::uno::Any& rNewValue )
 {
-    ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation(mxAccessible);
-
-    if( pAcc )
-        pAcc->FireAccessibleEvent( nEventId, rOldValue, rNewValue );
+    if( mxAccessible )
+        mxAccessible->FireAccessibleEvent( nEventId, rOldValue, rNewValue );
 }
 
 bool ThumbnailView::ImplHasAccessibleListeners() const
 {
-    ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation(mxAccessible);
-    return( pAcc && pAcc->HasAccessibleListeners() );
+    return mxAccessible && mxAccessible->HasAccessibleListeners();
 }
 
 IMPL_LINK_NOARG(ThumbnailView, ImplScrollHdl, weld::ScrolledWindow&, void)
@@ -950,9 +945,8 @@ void ThumbnailView::GetFocus()
     }
 
     // Tell the accessible object that we got the focus.
-    ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation(mxAccessible);
-    if( pAcc )
-        pAcc->GetFocus();
+    if( mxAccessible )
+        mxAccessible->GetFocus();
 
     CustomWidgetController::GetFocus();
 }
@@ -962,9 +956,8 @@ void ThumbnailView::LoseFocus()
     CustomWidgetController::LoseFocus();
 
     // Tell the accessible object that we lost the focus.
-    ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation(mxAccessible);
-    if( pAcc )
-        pAcc->LoseFocus();
+    if( mxAccessible )
+        mxAccessible->LoseFocus();
 }
 
 void ThumbnailView::Resize()

Reply via email to