diff options
Diffstat (limited to 'svtools/source/toolpanel')
-rw-r--r-- | svtools/source/toolpanel/drawerlayouter.cxx | 14 | ||||
-rw-r--r-- | svtools/source/toolpanel/paneltabbar.cxx | 84 | ||||
-rw-r--r-- | svtools/source/toolpanel/paneltabbarpeer.cxx | 4 | ||||
-rw-r--r-- | svtools/source/toolpanel/paneltabbarpeer.hxx | 2 | ||||
-rw-r--r-- | svtools/source/toolpanel/tablayouter.cxx | 4 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldeck.cxx | 27 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldeckpeer.cxx | 4 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldeckpeer.hxx | 2 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldrawer.cxx | 26 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldrawer.hxx | 7 | ||||
-rw-r--r-- | svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 2 |
11 files changed, 92 insertions, 84 deletions
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index b2e692c1bd55..c044105d38e1 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -132,7 +132,7 @@ namespace svt { ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL ); - const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] ); + VclPtr<ToolPanelDrawer> pDrawer( m_aDrawers[ i_nChildIndex ] ); Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( false ); if ( !xItemAccessible.is() ) @@ -151,7 +151,7 @@ namespace svt { OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); - PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) ); + VclPtrInstance<ToolPanelDrawer> pDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ); pDrawer->SetHelpId( i_pPanel->GetHelpID() ); // proper Z-Order if ( i_nPosition == 0 ) @@ -160,8 +160,8 @@ namespace svt } else { - const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] ); - pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND ); + ToolPanelDrawer* pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] ); + pDrawer->SetZOrder( pFirstDrawer, WINDOW_ZORDER_BEHIND ); } pDrawer->Show(); @@ -213,10 +213,7 @@ namespace svt size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const { - for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin(); - drawerPos != m_aDrawers.end(); - ++drawerPos - ) + for ( auto drawerPos = m_aDrawers.begin(); drawerPos != m_aDrawers.end(); ++drawerPos ) { if ( drawerPos->get() == i_pDrawerWindow ) return drawerPos - m_aDrawers.begin(); @@ -229,7 +226,6 @@ namespace svt { OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" ); m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); - OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" ); m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); } diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index ef19414cc407..58b59e903cfa 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -378,8 +378,8 @@ namespace svt void UpdateScrollButtons() { - m_aScrollBack.Enable( m_nScrollPosition > 0 ); - m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 ); + m_aScrollBack->Enable( m_nScrollPosition > 0 ); + m_aScrollForward->Enable( m_nScrollPosition < m_aItems.size() - 1 ); } void Relayout(); @@ -415,7 +415,7 @@ namespace svt TabAlignment m_eTabAlignment; IToolPanelDeck& m_rPanelDeck; - VirtualDevice m_aRenderDevice; + ScopedVclPtr<VirtualDevice> m_aRenderDevice; PTabBarRenderer m_pRenderer; ::boost::optional< size_t > m_aHoveredItem; @@ -425,8 +425,8 @@ namespace svt ItemDescriptors m_aItems; bool m_bItemsDirty; - PushButton m_aScrollBack; - PushButton m_aScrollForward; + VclPtr<PushButton> m_aScrollBack; + VclPtr<PushButton> m_aScrollForward; size_t m_nScrollPosition; }; @@ -499,45 +499,45 @@ namespace svt ,m_aNormalizer() ,m_eTabAlignment( i_eAlignment ) ,m_rPanelDeck( i_rPanelDeck ) - ,m_aRenderDevice( i_rTabBar ) + ,m_aRenderDevice( VclPtr<VirtualDevice>::Create(i_rTabBar) ) ,m_pRenderer() ,m_aHoveredItem() ,m_aFocusedItem() ,m_bMouseButtonDown( false ) ,m_aItems() ,m_bItemsDirty( true ) - ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) - ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) + ,m_aScrollBack( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) ) + ,m_aScrollForward( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) ) ,m_nScrollPosition( 0 ) { #ifdef WNT - if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) + if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) // this mode requires the NWF framework to be able to render those items onto a virtual // device. For some frameworks (some GTK themes, in particular), this is known to fail. // So, be on the safe side for the moment. - m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) ); + m_pRenderer.reset( new NWFTabItemRenderer( *m_aRenderDevice.get() ) ); else #endif - if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) - m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) ); + if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + m_pRenderer.reset( new NWFToolboxItemRenderer( *m_aRenderDevice.get() ) ); else - m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) ); + m_pRenderer.reset( new VCLItemRenderer( *m_aRenderDevice.get() ) ); - m_aRenderDevice.SetLineColor(); + m_aRenderDevice->SetLineColor(); m_rPanelDeck.AddListener( *this ); - m_aScrollBack.SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT ); - m_aScrollBack.Show(); - m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollBack.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() ); - m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() ); - - m_aScrollForward.SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT ); - m_aScrollForward.Show(); - m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollForward.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() ); - m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() ); + m_aScrollBack->SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT ); + m_aScrollBack->Show(); + m_aScrollBack->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollBack->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() ); + m_aScrollBack->SetAccessibleName( m_aScrollBack->GetAccessibleDescription() ); + + m_aScrollForward->SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT ); + m_aScrollForward->Show(); + m_aScrollForward->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollForward->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() ); + m_aScrollForward->SetAccessibleName( m_aScrollForward->GetAccessibleDescription() ); } @@ -710,7 +710,7 @@ namespace svt void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const { - BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx( + BitmapEx aBitmap( m_aRenderDevice->GetBitmapEx( i_rLogicalRect.TopLeft(), Size( i_rLogicalRect.GetSize().Width(), @@ -833,31 +833,31 @@ namespace svt const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() ); // forward actual output size to our render device - m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize ); + m_aRenderDevice->SetOutputSizePixel( aLogicalOutputSize ); // re-calculate the size of the scroll buttons and of the items m_aGeometry.relayout( aLogicalOutputSize, m_aItems ); if ( m_aGeometry.getButtonBackRect().IsEmpty() ) { - m_aScrollBack.Hide(); + m_aScrollBack->Hide(); } else { const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) ); - m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); - m_aScrollBack.Show(); + m_aScrollBack->SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); + m_aScrollBack->Show(); } if ( m_aGeometry.getButtonForwardRect().IsEmpty() ) { - m_aScrollForward.Hide(); + m_aScrollForward->Hide(); } else { const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); - m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); - m_aScrollForward.Show(); + m_aScrollForward->SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); + m_aScrollForward->Show(); } UpdateScrollButtons(); @@ -921,13 +921,13 @@ namespace svt IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) { - if ( i_pButton == &m_aScrollBack ) + if ( i_pButton == m_aScrollBack.get() ) { OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" ); --m_nScrollPosition; m_rTabBar.Invalidate(); } - else if ( i_pButton == &m_aScrollForward ) + else if ( i_pButton == m_aScrollForward.get() ) { OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); ++m_nScrollPosition; @@ -996,11 +996,15 @@ namespace svt DBG_CHECK( *m_pImpl ); } - PanelTabBar::~PanelTabBar() { + disposeOnce(); } + void PanelTabBar::dispose() + { + Control::dispose(); + } TabItemContent PanelTabBar::GetTabItemContent() const { @@ -1046,10 +1050,10 @@ namespace svt // background const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); - m_pImpl->m_aRenderDevice.Push( PushFlags::CLIPREGION ); - m_pImpl->m_aRenderDevice.SetClipRegion(vcl::Region(aNormalizedPaintArea)); + m_pImpl->m_aRenderDevice->Push( PushFlags::CLIPREGION ); + m_pImpl->m_aRenderDevice->SetClipRegion(vcl::Region(aNormalizedPaintArea)); m_pImpl->m_pRenderer->renderBackground(); - m_pImpl->m_aRenderDevice.Pop(); + m_pImpl->m_aRenderDevice->Pop(); m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea ); // ensure the items really paint into their own playground only @@ -1314,7 +1318,7 @@ namespace svt PushButton& PanelTabBar::GetScrollButton( const bool i_bForward ) { - return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack; + return i_bForward ? *m_pImpl->m_aScrollForward.get() : *m_pImpl->m_aScrollBack.get(); } diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx index 3a0c473732b1..4fd01f993999 100644 --- a/svtools/source/toolpanel/paneltabbarpeer.cxx +++ b/svtools/source/toolpanel/paneltabbarpeer.cxx @@ -64,7 +64,7 @@ namespace svt Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext() { SolarMutexGuard aSolarGuard; - if ( m_pTabBar == NULL ) + if ( m_pTabBar == nullptr ) throw DisposedException( OUString(), *this ); @@ -80,7 +80,7 @@ namespace svt { { SolarMutexGuard aSolarGuard; - m_pTabBar = NULL; + m_pTabBar.clear(); } VCLXWindow::dispose(); } diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx index 2c9601010208..9e0bc6709524 100644 --- a/svtools/source/toolpanel/paneltabbarpeer.hxx +++ b/svtools/source/toolpanel/paneltabbarpeer.hxx @@ -49,7 +49,7 @@ namespace svt private: AccessibleFactoryAccess m_aAccessibleFactory; - PanelTabBar* m_pTabBar; + VclPtr<PanelTabBar> m_pTabBar; }; diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 39a0874d824a..5c83f285bc99 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -41,14 +41,14 @@ namespace svt { TabAlignment eAlignment; IToolPanelDeck& rPanels; - ::std::unique_ptr< PanelTabBar > pTabBar; + VclPtr< PanelTabBar > pTabBar; AccessibleFactoryAccess aAccessibleFactory; TabDeckLayouter_Data( vcl::Window& i_rParent, IToolPanelDeck& i_rPanels, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :eAlignment( i_eAlignment ) ,rPanels( i_rPanels ) - ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) + ,pTabBar( VclPtr<PanelTabBar>::Create( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) { pTabBar->Show(); } diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index af00abb8c204..8544ab104b0c 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <tools/diagnose_ex.h> +#include <vcl/vclptr.hxx> #include <boost/optional.hpp> @@ -68,15 +69,15 @@ namespace svt public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) - ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL ) + ,m_aPanelAnchor( VclPtr<vcl::Window>::Create(&i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL) ) ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() ,m_bInDtor( false ) { m_aPanels.AddListener( *this ); - m_aPanelAnchor.Show(); - m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL ); + m_aPanelAnchor->Show(); + m_aPanelAnchor->SetAccessibleRole( AccessibleRole::PANEL ); } virtual ~ToolPanelDeck_Impl() @@ -87,7 +88,7 @@ namespace svt PDeckLayouter GetLayouter() const { return m_pLayouter; } void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - vcl::Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + vcl::Window& GetPanelWindowAnchor() { return *m_aPanelAnchor.get(); } bool IsDead() const { return m_bInDtor; } @@ -130,7 +131,7 @@ namespace svt private: ToolPanelDeck& m_rDeck; - vcl::Window m_aPanelAnchor; + VclPtr<vcl::Window> m_aPanelAnchor; ToolPanelCollection m_aPanels; PToolPanel m_pDummyPanel; PanelDeckListeners m_aListeners; @@ -210,11 +211,11 @@ namespace svt { aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground ); } - m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); + m_aPanelAnchor->SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); // position the active panel const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); - pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); + pActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); } @@ -261,7 +262,7 @@ namespace svt case ACTION_TOGGLE_FOCUS: { PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); - if ( !m_aPanelAnchor.HasChildPathFocus() ) + if ( !m_aPanelAnchor->HasChildPathFocus() ) pActivePanel->GrabFocus(); else GetLayouter()->SetFocusToPanelSelector(); @@ -313,11 +314,11 @@ namespace svt // position and show the new panel const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) ); - pNewActive->Activate( m_aPanelAnchor ); + pNewActive->Activate( *m_aPanelAnchor.get() ); pNewActive->GrabFocus(); // resize the panel (cannot guarantee it has ever been resized before - pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); + pNewActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); // multiplex to our own listeners m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); @@ -353,6 +354,11 @@ namespace svt ToolPanelDeck::~ToolPanelDeck() { + disposeOnce(); + } + + void ToolPanelDeck::dispose() + { m_pImpl->NotifyDying(); GetLayouter()->Destroy(); @@ -362,6 +368,7 @@ namespace svt PToolPanel pPanel( GetPanel( i ) ); pPanel->Dispose(); } + Control::dispose(); } diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx index 333fa43c10d0..76f15af12ca3 100644 --- a/svtools/source/toolpanel/toolpaneldeckpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx @@ -64,7 +64,7 @@ namespace svt Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext() { SolarMutexGuard aSolarGuard; - if ( m_pDeck == NULL ) + if ( m_pDeck == nullptr ) throw DisposedException( OUString(), *this ); vcl::Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() ); @@ -78,7 +78,7 @@ namespace svt { { SolarMutexGuard aSolarGuard; - m_pDeck = NULL; + m_pDeck.clear(); } VCLXWindow::dispose(); } diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx index daa177000128..2ced30f50c4b 100644 --- a/svtools/source/toolpanel/toolpaneldeckpeer.hxx +++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx @@ -49,7 +49,7 @@ namespace svt private: AccessibleFactoryAccess m_aAccessibleFactory; - ToolPanelDeck* m_pDeck; + VclPtr<ToolPanelDeck> m_pDeck; }; diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index d74545593d1c..60b9d06cd2c0 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -56,11 +56,6 @@ namespace svt } - DrawerVisualization::~DrawerVisualization() - { - } - - void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox ) { Window::Paint( i_rBoundingBox ); @@ -73,8 +68,8 @@ namespace svt ToolPanelDrawer::ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ) :Window( &i_rParent, WB_TABSTOP ) - ,m_pPaintDevice( new VirtualDevice( *this ) ) - ,m_aVisualization( *this ) + ,m_pPaintDevice( VclPtr<VirtualDevice>::Create( *this ) ) + ,m_aVisualization( VclPtr<DrawerVisualization>::Create(*this) ) ,m_bFocused( false ) ,m_bExpanded( false ) { @@ -88,15 +83,20 @@ namespace svt SetAccessibleName( i_rTitle ); SetAccessibleDescription( i_rTitle ); - m_aVisualization.SetAccessibleName( i_rTitle ); - m_aVisualization.SetAccessibleDescription( i_rTitle ); + m_aVisualization->SetAccessibleName( i_rTitle ); + m_aVisualization->SetAccessibleDescription( i_rTitle ); } - ToolPanelDrawer::~ToolPanelDrawer() { + disposeOnce(); } + void ToolPanelDrawer::dispose() + { + m_aVisualization.disposeAndClear(); + vcl::Window::dispose(); + } long ToolPanelDrawer::GetPreferredHeightPixel() const { @@ -123,7 +123,7 @@ namespace svt aFocusBox.Left() += 2; impl_paintFocusIndicator( aFocusBox ); - m_aVisualization.DrawOutDev( + m_aVisualization->DrawOutDev( Point(), GetOutputSizePixel(), Point(), GetOutputSizePixel(), *m_pPaintDevice @@ -239,7 +239,7 @@ namespace svt void ToolPanelDrawer::Resize() { Window::Resize(); - m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() ); + m_aVisualization->SetPosSizePixel( Point(), GetOutputSizePixel() ); } @@ -261,7 +261,7 @@ namespace svt if ( !( i_rEvent.GetFlags() & AllSettingsFlags::STYLE ) ) break; SetSettings( Application::GetSettings() ); - m_pPaintDevice.reset( new VirtualDevice( *this ) ); + m_pPaintDevice.reset( VclPtr<VirtualDevice>::Create( *this ) ); // fall through. diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index 3a815345e2b6..b13a12e34629 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -22,6 +22,7 @@ #include <vcl/window.hxx> #include <vcl/virdev.hxx> +#include <vcl/vclptr.hxx> namespace svt @@ -45,7 +46,6 @@ namespace svt { public: DrawerVisualization( ToolPanelDrawer& i_rParent ); - virtual ~DrawerVisualization(); protected: // Window overridables @@ -64,6 +64,7 @@ namespace svt public: ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ); virtual ~ToolPanelDrawer(); + virtual void dispose() SAL_OVERRIDE; long GetPreferredHeightPixel() const; void SetExpanded( const bool i_bExpanded ); @@ -96,8 +97,8 @@ namespace svt using Window::Paint; private: - ::std::unique_ptr< VirtualDevice > m_pPaintDevice; - DrawerVisualization m_aVisualization; + ScopedVclPtr< VirtualDevice > m_pPaintDevice; + VclPtr<DrawerVisualization> m_aVisualization; bool m_bFocused; bool m_bExpanded; }; diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx index 5f7af7987e0f..8e83866a6b9a 100644 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx @@ -97,7 +97,7 @@ namespace svt i_rStateSet.AddState( AccessibleStateType::EXPANDABLE ); i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) ); + VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > (); ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" ); if ( pDrawer->IsExpanded() ) i_rStateSet.AddState( AccessibleStateType::EXPANDED ); |