diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-25 10:29:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-26 08:32:42 +0000 |
commit | 6b1f83880372868fb61c84dbe3230910cdbb386f (patch) | |
tree | 8f1d4d7e4937d1ccdaee831dd67494d46681bd62 | |
parent | 263c15ee238e04c7b25d36cdbb9ab21c0bdf518d (diff) |
use more concrete types in sd
Change-Id: I545858fe18e8a436fd2dda7402c825eac28fb2fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sd/source/ui/inc/ViewTabBar.hxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/ViewTabBar.cxx | 35 |
2 files changed, 14 insertions, 28 deletions
diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx index 61670cc1432b..36c2aa6f84a7 100644 --- a/sd/source/ui/inc/ViewTabBar.hxx +++ b/sd/source/ui/inc/ViewTabBar.hxx @@ -35,6 +35,7 @@ namespace com::sun::star::frame { class XController; } namespace vcl { class Window; } namespace sd { + class DrawController; class ViewShellBase; class ViewTabBar; } @@ -72,7 +73,7 @@ class ViewTabBar final public: ViewTabBar ( const css::uno::Reference< css::drawing::framework::XResourceId>& rxViewTabBarId, - const css::uno::Reference< css::frame::XController>& rxController); + const rtl::Reference< ::sd::DrawController>& rxController); virtual ~ViewTabBar() override; virtual void disposing(std::unique_lock<std::mutex>&) override; @@ -148,7 +149,7 @@ public: private: VclPtr<TabBarControl> mpTabControl; - css::uno::Reference<css::frame::XController> mxController; + rtl::Reference<::sd::DrawController> mxController; css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; typedef ::std::vector<css::drawing::framework::TabBarButton> TabBarButtonList; TabBarButtonList maTabBarButtons; @@ -168,7 +169,7 @@ private: */ static vcl::Window* GetAnchorWindow( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewTabBarId, - const css::uno::Reference<css::frame::XController>& rxController); + const rtl::Reference<::sd::DrawController>& rxController); }; } // end of namespace sd diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 09925e32d37b..81f71b12638e 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -59,7 +59,7 @@ bool IsEqual (const TabBarButton& rButton1, const TabBarButton& rButton2) ViewTabBar::ViewTabBar ( const Reference<XResourceId>& rxViewTabBarId, - const Reference<frame::XController>& rxController) + const rtl::Reference<::sd::DrawController>& rxController) : mpTabControl(VclPtr<TabBarControl>::Create(GetAnchorWindow(rxViewTabBarId,rxController), this)), mxController(rxController), mxViewTabBarId(rxViewTabBarId), @@ -68,20 +68,13 @@ ViewTabBar::ViewTabBar ( { // Tunnel through the controller and use the ViewShellBase to obtain the // view frame. - try - { - if (auto pController = dynamic_cast<DrawController*>(mxController.get())) - mpViewShellBase = pController->GetViewShellBase(); - } - catch (const RuntimeException&) - { - } + if (mxController) + mpViewShellBase = mxController->GetViewShellBase(); // Register as listener at XConfigurationController. - Reference<XControllerManager> xControllerManager (mxController, UNO_QUERY); - if (xControllerManager.is()) + if (mxController.is()) { - mxConfigurationController = xControllerManager->getConfigurationController(); + mxConfigurationController = mxController->getConfigurationController(); if (mxConfigurationController.is()) { mxConfigurationController->addConfigurationChangeListener( @@ -139,21 +132,15 @@ void ViewTabBar::disposing(std::unique_lock<std::mutex>&) vcl::Window* ViewTabBar::GetAnchorWindow( const Reference<XResourceId>& rxViewTabBarId, - const Reference<frame::XController>& rxController) + const rtl::Reference<::sd::DrawController>& rxController) { vcl::Window* pWindow = nullptr; ViewShellBase* pBase = nullptr; // Tunnel through the controller and use the ViewShellBase to obtain the // view frame. - try - { - if (auto pController = dynamic_cast<DrawController*>(rxController.get())) - pBase = pController->GetViewShellBase(); - } - catch (const RuntimeException&) - { - } + if (rxController) + pBase = rxController->GetViewShellBase(); // The ViewTabBar supports at the moment only the center pane. if (rxViewTabBarId.is() @@ -170,9 +157,8 @@ vcl::Window* ViewTabBar::GetAnchorWindow( Reference<XPane> xPane; try { - Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY_THROW); Reference<XConfigurationController> xCC ( - xControllerManager->getConfigurationController()); + rxController->getConfigurationController()); if (xCC.is()) xPane.set(xCC->getResource(rxViewTabBarId->getAnchor()), UNO_QUERY); } @@ -269,9 +255,8 @@ bool ViewTabBar::ActivatePage(size_t nIndex) { try { - Reference<XControllerManager> xControllerManager (mxController,UNO_QUERY_THROW); Reference<XConfigurationController> xConfigurationController ( - xControllerManager->getConfigurationController()); + mxController->getConfigurationController()); if ( ! xConfigurationController.is()) throw RuntimeException(); Reference<XView> xView; |