diff options
Diffstat (limited to 'sfx2/source/sidebar/TitleBar.cxx')
-rw-r--r-- | sfx2/source/sidebar/TitleBar.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx index ff5687336811..f2647b386d6b 100644 --- a/sfx2/source/sidebar/TitleBar.cxx +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -41,17 +41,24 @@ TitleBar::TitleBar ( vcl::Window* pParentWindow, const sidebar::Paint& rInitialBackgroundPaint) : Window(pParentWindow), - maToolBox(this), + maToolBox(VclPtr<SidebarToolBox>::Create(this)), msTitle(rsTitle), maIcon() { SetBackground(rInitialBackgroundPaint.GetWallpaper()); - maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler)); + maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler)); } TitleBar::~TitleBar() { + disposeOnce(); +} + +void TitleBar::dispose() +{ + maToolBox.disposeAndClear(); + vcl::Window::dispose(); } void TitleBar::SetTitle (const ::rtl::OUString& rsTitle) @@ -102,9 +109,9 @@ void TitleBar::setPosSizePixel ( Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags); // Place the toolbox. - const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth()); - maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE); - maToolBox.Show(); + const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth()); + maToolBox->setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE); + maToolBox->Show(); } void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) @@ -181,8 +188,8 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox) IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox) { (void)pToolBox; - OSL_ASSERT(&maToolBox==pToolBox); - const sal_uInt16 nItemId (maToolBox.GetHighlightItemId()); + OSL_ASSERT(maToolBox.get()==pToolBox); + const sal_uInt16 nItemId (maToolBox->GetHighlightItemId()); HandleToolBoxItemClick(nItemId); |