diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-01-25 20:25:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-25 20:21:48 +0100 |
commit | 1aa31294b2d3fb562ba33d5d873da62439944f07 (patch) | |
tree | 79a604d51b0c54768c07ed8c4643cf43b29d8fca | |
parent | 2dbc9266ec2207c2719c0104168cfcad9f6948da (diff) |
avoid some ref-counting
can just return a pointer here, instead of VclPtr.
Change-Id: I9ab8962cbbe84ed4dfcfd658a6d758112914cb89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
40 files changed, 82 insertions, 82 deletions
diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx index e84825ea0b3f..bd70676f58cc 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -38,7 +38,7 @@ using namespace ::comphelper; VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow ) :VCLXAccessibleComponent( pVCLXWindow ) { - m_pStatusBar = static_cast< StatusBar *>( GetWindow().get() ); + m_pStatusBar = GetAs<StatusBar>(); if ( m_pStatusBar ) m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() ); diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx index 26f384fbbbce..20e2ff120cc3 100644 --- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx +++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx @@ -44,7 +44,7 @@ using namespace ::comphelper; VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow ) :VCLXAccessibleComponent( pVCLXWindow ) { - m_pTabControl = static_cast< TabControl* >( GetWindow().get() ); + m_pTabControl = GetAs<TabControl>(); if (!m_pTabControl) return; if (m_pTabControl->isDisposed()) diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx index 30dc29b34213..c8408d24be97 100644 --- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx +++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx @@ -34,7 +34,7 @@ using namespace ::comphelper; VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow ) :VCLXAccessibleComponent( pVCLXWindow ) { - m_pTabPage = static_cast< TabPage* >( GetWindow().get() ); + m_pTabPage = GetAs<TabPage>(); m_pTabControl = nullptr; m_nPageId = 0; if ( !m_pTabPage ) diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index b48eb53a0d1a..949c8fa86c69 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -171,7 +171,7 @@ vcl::Window* AccessibleDialogControlShape::GetWindow() const { Reference< awt::XControl > xControl = m_pDlgEdObj->GetControl(); if ( xControl.is() ) - pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ).get(); + pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); } return pWindow; diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index 8f4d9ade8af2..582573dc7612 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -327,7 +327,7 @@ public: ViewElementListProvider getViewElementListProvider(); DrawModelWrapper* GetDrawModelWrapper(); DrawViewWrapper* GetDrawViewWrapper(); - VclPtr<ChartWindow> GetChartWindow() const; + ChartWindow* GetChartWindow() const; weld::Window* GetChartFrame(); bool isAdditionalShapeSelected() const; void SetAndApplySelection(const css::uno::Reference<css::drawing::XShape>& rxShape); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 219ad91cfa70..be8dffbaee44 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -431,7 +431,7 @@ void SAL_CALL ChartController::attachFrame( if (pParentComponent) pParentComponent->setVisible(true); - pParent = VCLUnoHelper::GetWindow( xContainerWindow ).get(); + pParent = VCLUnoHelper::GetWindow( xContainerWindow ); } { @@ -1514,7 +1514,7 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper() } -VclPtr<ChartWindow> ChartController::GetChartWindow() const +ChartWindow* ChartController::GetChartWindow() const { // clients getting the naked VCL Window from UNO should always have the // solar mutex (and keep it over the lifetime of this ptr), as VCL might @@ -1522,7 +1522,7 @@ VclPtr<ChartWindow> ChartController::GetChartWindow() const DBG_TESTSOLARMUTEX(); if(!m_xViewWindow.is()) return nullptr; - return dynamic_cast<ChartWindow*>(VCLUnoHelper::GetWindow(m_xViewWindow).get()); + return dynamic_cast<ChartWindow*>(VCLUnoHelper::GetWindow(m_xViewWindow)); } weld::Window* ChartController::GetChartFrame() diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 0988fca71feb..6f70d87124e2 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1973,7 +1973,7 @@ void ToolbarSaveInData::SetSystemStyle( if ( xUIElement.is() ) xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY ); - window = VCLUnoHelper::GetWindow( xWindow ).get(); + window = VCLUnoHelper::GetWindow( xWindow ); } if ( window == nullptr || window->GetType() != WindowType::TOOLBOX ) diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx index 258c3966cee9..b0e3e516511c 100644 --- a/dbaccess/source/ui/browser/brwview.cxx +++ b/dbaccess/source/ui/browser/brwview.cxx @@ -261,7 +261,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this); if ( pPeer ) { - m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow().get()); + m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow()); pTHIS->startComponentListening(VCLUnoHelper::GetInterface(m_pVclControl)); } } diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index bdc1876e9607..43ac31842b59 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -245,7 +245,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen xParent = xFrame->getContainerWindow(); VCLXWindow* pParentComponent = comphelper::getUnoTunnelImplementation<VCLXWindow>(xParent); - VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : VclPtr< vcl::Window >(); + VclPtr< vcl::Window > pParentWin = pParentComponent ? pParentComponent->GetWindow() : nullptr; if (!pParentWin) { throw IllegalArgumentException("Parent window is null", *this, 1 ); diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 63e30d06ad3b..c036f8bdee82 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -447,7 +447,7 @@ namespace dbaui Reference< XWindow > xWindow = getTopMostContainerWindow(); vcl::Window* pWin = nullptr; if ( xWindow.is() ) - pWin = VCLUnoHelper::GetWindow(xWindow).get(); + pWin = VCLUnoHelper::GetWindow(xWindow); if ( !pWin ) pWin = getView()->Window::GetParent(); diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx index f2d0642275a9..08e0b25045c3 100644 --- a/dbaccess/source/ui/uno/ColumnControl.cxx +++ b/dbaccess/source/ui/uno/ColumnControl.cxx @@ -70,7 +70,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit { VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer); if (pParent) - pParentWin = pParent->GetWindow().get(); + pParentWin = pParent->GetWindow(); } OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext ); diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx index 0d7792edd1d5..8f1e22b82f12 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.cxx +++ b/extensions/source/propctrlr/defaulthelpprovider.cxx @@ -145,7 +145,7 @@ namespace pcr try { Reference< XWindow > xControlWindow( _rxControl->getControlWindow(), css::uno::UNO_SET_THROW ); - pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ).get(); + pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 4f3365e6b099..6f9ff0e547e6 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -345,7 +345,7 @@ namespace pcr else { VCLXWindow* pContainerWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>(xContainerWindow); - VclPtr<vcl::Window> pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : VclPtr<vcl::Window>(); + VclPtr<vcl::Window> pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : nullptr; if (!pParentWin) throw RuntimeException("The frame is invalid. Unable to extract the container window.",*this); xBuilder.reset(Application::CreateInterimBuilder(pParentWin, sUIFile, true)); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 1514eca99729..88f62848063a 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -179,7 +179,7 @@ namespace frm { VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); if ( pParentXWin ) - pParentWin = pParentXWin->GetWindow().get(); + pParentWin = pParentXWin->GetWindow(); DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not obtain the VCL-level parent window!" ); } diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index ecaa9ba142a4..1f27aebe2564 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -125,7 +125,7 @@ namespace frm { VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); if ( pParentXWin ) - pParentWin = pParentXWin->GetWindow().get(); + pParentWin = pParentXWin->GetWindow(); DBG_ASSERT( pParentWin, "ONavigationBarControl::createPeer: could not obtain the VCL-level parent window!" ); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e080497b066b..d484ca108a95 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -719,7 +719,7 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI // Retrieve output size from container Window SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ).get(); + pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pContainerWindow ) aContainerWinSize = pContainerWindow->GetOutputSizePixel(); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 154374ee0d56..4182dba99590 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -820,7 +820,7 @@ bool ToolbarLayoutManager::dockToolbar( std::u16string_view rResourceURL, ui::Do { SolarMutexGuard aGuard; - pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); + pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX ) { pToolBox = static_cast<ToolBox *>(pWindow); @@ -1026,16 +1026,16 @@ void ToolbarLayoutManager::setParentWindow( if ( xParentWindow.is() ) { SolarMutexGuard aGuard; - VclPtr< ::DockingAreaWindow > pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ).get() ); + VclPtr< ::DockingAreaWindow > pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ) ); if( pWindow ) pWindow->SetAlign( WindowAlign::Top ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ).get() ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ) ); if( pWindow ) pWindow->SetAlign( WindowAlign::Bottom ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ).get() ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ) ); if( pWindow ) pWindow->SetAlign( WindowAlign::Left ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ).get() ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ) ); if( pWindow ) pWindow->SetAlign( WindowAlign::Right ); implts_reparentToolbars(); @@ -1399,7 +1399,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno { SolarMutexGuard aGuard; - pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); + pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) { OUString aText = pWindow->GetText(); @@ -2252,7 +2252,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre ::Size aDockingWinSize; // Retrieve output size from container Window - vcl::Window* pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ).get(); + vcl::Window* pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ); if ( pDockingWindow ) aDockingWinSize = pDockingWindow->GetOutputSizePixel(); aReadLock.clear(); @@ -2601,7 +2601,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { // Retrieve output size from container Window SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get(); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); aContainerWinSize = pContainerWindow->GetOutputSizePixel(); } @@ -2627,7 +2627,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { SolarMutexGuard aGuard; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get(); + pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow ); ToolBox* pToolBox( nullptr ); if ( pDockWindow && pDockWindow->GetType() == WindowType::TOOLBOX ) @@ -3063,7 +3063,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d sal_Int32 nDockPosY( 0 ); { SolarMutexGuard aGuard; - vcl::Window* pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get(); + vcl::Window* pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); } @@ -3608,7 +3608,7 @@ void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& { SolarMutexGuard aGuard; xWindow.set( e.Source, uno::UNO_QUERY ); - pWindow = VCLUnoHelper::GetWindow( xWindow ).get(); + pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX ) pToolBox = static_cast<ToolBox *>(pWindow); diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 36ad65f19cc2..51fcd4f4ee13 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -192,7 +192,7 @@ PopupMenuToolbarController::createPopupWindow() createPopupMenuController(); SolarMutexGuard aSolarLock; - VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); + VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if ( !pToolBox ) return xRet; @@ -744,7 +744,7 @@ sal_uInt16 NewToolbarController::getMenuIdForCommand( std::u16string_view rComma void SAL_CALL NewToolbarController::updateImage() { SolarMutexGuard aSolarLock; - VclPtr< ToolBox> pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); + VclPtr< ToolBox> pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if ( !pToolBox ) return; diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx index b9cf5ec6bacc..bacaa941e96a 100644 --- a/include/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -72,11 +72,11 @@ public: virtual ~VCLXAccessibleComponent() override; VCLXWindow* GetVCLXWindow() const; - VclPtr<vcl::Window> GetWindow() const; - template< class derived_type > VclPtr< derived_type > GetAs() const { - return VclPtr< derived_type >( static_cast< derived_type * >( GetWindow().get() ) ); } - template< class derived_type > VclPtr< derived_type > GetAsDynamic() const { - return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetWindow().get() ) ); } + vcl::Window* GetWindow() const; + template< class derived_type > derived_type* GetAs() const { + return static_cast< derived_type * >( GetWindow() ); } + template< class derived_type > derived_type* GetAsDynamic() const { + return dynamic_cast< derived_type * >( GetWindow() ); } virtual void SAL_CALL disposing() override; diff --git a/include/toolkit/awt/vclxwindow.hxx b/include/toolkit/awt/vclxwindow.hxx index bc93f391f8ce..090a52cde8d4 100644 --- a/include/toolkit/awt/vclxwindow.hxx +++ b/include/toolkit/awt/vclxwindow.hxx @@ -122,11 +122,11 @@ public: virtual ~VCLXWindow() override; virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ); - template< class derived_type > VclPtr< derived_type > GetAs() const { - return VclPtr< derived_type >( static_cast< derived_type * >( GetOutputDevice().get() ) ); } - template< class derived_type > VclPtr< derived_type > GetAsDynamic() const { - return VclPtr< derived_type >( dynamic_cast< derived_type * >( GetOutputDevice().get() ) ); } - VclPtr<vcl::Window> GetWindow() const { return GetAs<vcl::Window>(); } + template< class derived_type > derived_type* GetAs() const { + return static_cast< derived_type * >( GetOutputDevice().get() ); } + template< class derived_type > derived_type* GetAsDynamic() const { + return dynamic_cast< derived_type * >( GetOutputDevice().get() ); } + vcl::Window* GetWindow() const { return GetAs<vcl::Window>(); } void suspendVclEventListening( ); void resumeVclEventListening( ); diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx index 6bdffe9f1fec..75af557dc801 100644 --- a/include/toolkit/helper/vclunohelper.hxx +++ b/include/toolkit/helper/vclunohelper.hxx @@ -79,9 +79,9 @@ public: static css::uno::Reference< css::awt::XBitmap> CreateVCLXBitmap( const BitmapEx& rBitmap ); // Window - static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ); - static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 ); - static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer ); + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ); + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 ); + static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer ); static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow ); // OutputDevice diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx index 0c1313137759..2d7820d2e0e1 100644 --- a/reportdesign/source/ui/misc/statusbarcontroller.cxx +++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx @@ -73,7 +73,7 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen SolarMutexGuard aSolarMutexGuard; ::osl::MutexGuard aGuard(m_aMutex); - VclPtr< StatusBar > pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow).get()); + VclPtr< StatusBar > pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow)); if ( !pStatusBar ) return; diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 13e98c6d0825..7cf3a0d94059 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -146,7 +146,7 @@ Reference<XResource> SAL_CALL BasicViewFactory::createResource ( // Get Window pointer for XWindow of the pane. vcl::Window* pWindow = nullptr; if (xPane.is()) - pWindow = VCLUnoHelper::GetWindow(xPane->getWindow()).get(); + pWindow = VCLUnoHelper::GetWindow(xPane->getWindow()); // Get the view frame. SfxViewFrame* pFrame = nullptr; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 77bab18a6c70..b10d116218c4 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3064,7 +3064,7 @@ void PresentationSettingsEx::SetPropertyValue( std::u16string_view rProperty, co if( rValue >>= xWindow ) { mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) - : VclPtr<vcl::Window>(); + : nullptr; return; } } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index b4f31d914a9c..03afafcd4fa4 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -1173,7 +1173,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if (!xHelp.is()) pHelpWindow = impl_createHelp(xHelp, xHelpContent); else - pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()).get()); + pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow())); if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow) return false; @@ -1328,7 +1328,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt if (!xHelp.is()) pHelpWindow = impl_createHelp(xHelp, xHelpContent); else - pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()).get()); + pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow())); if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow) return false; diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx index 2e9ccb5bd1a2..c748727fb4f4 100644 --- a/sfx2/source/dialog/backingcomp.cxx +++ b/sfx2/source/dialog/backingcomp.cxx @@ -344,7 +344,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f // initialize the component and its parent window css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow(); - VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get()); + VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow)); VclPtr< vcl::Window > pWindow = VCLUnoHelper::GetWindow(m_xWindow); // disable full screen mode of the frame! @@ -537,7 +537,7 @@ void SAL_CALL BackingComp::dispose() if (m_xFrame.is()) { css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow(); - VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get()); + VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow)); if (pParent) { pParent->SetMinOutputSizePixel(m_aInitialWindowMinSize); @@ -706,7 +706,7 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno: // Recalculate minimum width css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow(); - VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get()); + VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow)); if( pParent ) { pParent->SetMinOutputSizePixel( Size( diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index a03816b6052e..a27fc70271bb 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -95,7 +95,7 @@ vcl::Window* LokChartHelper::GetWindow() if (xFrame.is()) { ::css::uno::Reference< ::css::awt::XWindow > xDockerWin = xFrame->getContainerWindow(); - vcl::Window* pParent = VCLUnoHelper::GetWindow( xDockerWin ).get(); + vcl::Window* pParent = VCLUnoHelper::GetWindow( xDockerWin ); if (pParent) { sal_uInt16 nTotChildren = pParent->GetChildCount(); diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 1f86c6ce0f0e..fe7eac4ff847 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -219,7 +219,7 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() return Reference<awt::XWindow>(); } - VclPtr< ToolBox > pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); + VclPtr< ToolBox > pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if( pToolBox ) { vcl::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() ); diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx index 57f0ddc8c26c..28a146d9db84 100644 --- a/svtools/source/uno/statusbarcontroller.cxx +++ b/svtools/source/uno/statusbarcontroller.cxx @@ -492,7 +492,7 @@ void StatusbarController::bindListener() if ( m_xParentWindow.is() ) { - VclPtr< StatusBar > pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ).get() ); + VclPtr< StatusBar > pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ) ); if ( pStatusBar && pStatusBar->GetType() == WindowType::STATUSBAR ) aRect = pStatusBar->GetItemRect( m_nID ); } diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 86476da1903c..f6d8e84d83d5 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -744,7 +744,7 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == nullptr) ) return m_nToolBoxId; - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); + ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox ) { diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index a1d99ca3ec5c..4b660cdb7a8e 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2363,7 +2363,7 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr) return; css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); - VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() ); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) { sal_uInt16 id = pToolBox->GetItemId(i); @@ -2410,7 +2410,7 @@ OUString SvxSearchDialogWrapper::GetSearchLabel() return OUString(); css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); - VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() ); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow) ); for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) { sal_uInt16 id = pToolBox->GetItemId(i); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 164aee16dc24..fc8d52735ea6 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -474,7 +474,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >& { VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer); if (pParent) - pParentWin = pParent->GetWindow().get(); + pParentWin = pParent->GetWindow(); } FmXGridPeer* pPeer = imp_CreatePeer(pParentWin); diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index d996e3baf970..a9ec64108a85 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -479,7 +479,7 @@ namespace svx if ( _rxControl.is() ) xControlPeer = _rxControl->getPeer(); if ( xControlPeer.is() ) - pWindow = VCLUnoHelper::GetWindow( xControlPeer ).get(); + pWindow = VCLUnoHelper::GetWindow( xControlPeer ); } catch( const Exception& ) { diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 7799c76b7860..c05b272b94e8 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -3454,7 +3454,7 @@ vcl::Window* FormController::getDialogParentWindow() { Reference< XControl > xContainerControl( getContainer(), UNO_QUERY_THROW ); Reference< XWindowPeer > xContainerPeer( xContainerControl->getPeer(), UNO_SET_THROW ); - pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer ).get(); + pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer ); } catch( const Exception& ) { diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx index e12a77c5ab3d..6a07e3e89865 100644 --- a/toolkit/inc/controls/accessiblecontrolcontext.hxx +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -95,7 +95,7 @@ namespace toolkit // stops listening at the control model void stopModelListening( ); - VclPtr< vcl::Window > implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const; + vcl::Window* implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const; /// ctor. @see Init OAccessibleControlContext(); diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index e1ba158f6930..9ce8f6a61d7c 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -343,10 +343,10 @@ void VCLXAccessibleComponent::disposing() m_xVCLXWindow.clear(); } -VclPtr<vcl::Window> VCLXAccessibleComponent::GetWindow() const +vcl::Window* VCLXAccessibleComponent::GetWindow() const { return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() - : VclPtr<vcl::Window>(); + : nullptr; } void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index e9fcd2450904..40aab75a480a 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -52,7 +52,7 @@ css::uno::Any VCLXTopWindow::getWindowHandle( const css::uno::Sequence< sal_Int8 // TODO, check the process id css::uno::Any aRet; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) { const SystemEnvData* pSysData = static_cast<SystemWindow *>(pWindow)->GetSystemData(); @@ -106,7 +106,7 @@ void VCLXTopWindow::toFront( ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) static_cast<WorkWindow*>(pWindow)->ToTop( ToTopFlags::RestoreWhenMin ); } @@ -119,7 +119,7 @@ void VCLXTopWindow::setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) { SystemWindow* pSystemWindow = static_cast<SystemWindow*>( pWindow ); @@ -138,7 +138,7 @@ sal_Bool SAL_CALL VCLXTopWindow::getIsMaximized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); + const WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return false; @@ -150,7 +150,7 @@ void SAL_CALL VCLXTopWindow::setIsMaximized( sal_Bool _ismaximized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); + WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return; @@ -162,7 +162,7 @@ sal_Bool SAL_CALL VCLXTopWindow::getIsMinimized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); + const WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return false; @@ -174,7 +174,7 @@ void SAL_CALL VCLXTopWindow::setIsMinimized( sal_Bool _isMinimized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); + WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return; @@ -186,7 +186,7 @@ void SAL_CALL VCLXTopWindow::setIsMinimized( sal_Bool _isMinimized ) { SolarMutexGuard aGuard; - const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( VCLXContainer::GetWindow().get() ); + const SystemWindow* pWindow = VCLXContainer::GetAsDynamic<SystemWindow>(); if ( !pWindow ) return 0; @@ -201,7 +201,7 @@ void SAL_CALL VCLXTopWindow::setDisplay( ::sal_Int32 _display ) if ( ( _display < 0 ) || ( _display >= static_cast<sal_Int32>(Application::GetScreenCount()) ) ) throw IndexOutOfBoundsException(); - SystemWindow* pWindow = dynamic_cast< SystemWindow* >( VCLXContainer::GetWindow().get() ); + SystemWindow* pWindow = VCLXContainer::GetAsDynamic<SystemWindow>(); if ( !pWindow ) return; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index a589db2cd3a1..8b9c247190c3 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -7820,7 +7820,7 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const cs // some properties need to be forwarded to the sub edit, too SolarMutexGuard g; - VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : nullptr; + VclPtr< Edit > pSubEdit = GetWindow() ? GetAs<Edit>()->GetSubEdit() : nullptr; if ( !pSubEdit ) return; diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index 36b6287d65ec..cf4cf7207749 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -218,14 +218,14 @@ namespace toolkit } - VclPtr< vcl::Window > OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const + vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const { Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY ); Reference< awt::XWindow > xWindow; if ( xControl.is() ) xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY); - VclPtr< vcl::Window > pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : VclPtr< vcl::Window >(); + vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : nullptr; if ( _pxUNOWindow ) *_pxUNOWindow = xWindow; diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 20554df69812..62ad182d38af 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -106,22 +106,22 @@ css::uno::Reference< css::awt::XBitmap> VCLUnoHelper::CreateVCLXBitmap( const Bi return css::uno::Reference< css::awt::XBitmap >(new VCLXBitmap(rBitmap)); } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } vcl::Region VCLUnoHelper::GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) |