diff options
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/SvxColorChildWindow.cxx | 3 | ||||
-rw-r--r-- | svx/source/tbxctrls/bulletsnumbering.cxx | 23 | ||||
-rw-r--r-- | svx/source/tbxctrls/colorwindow.hxx | 15 | ||||
-rw-r--r-- | svx/source/tbxctrls/colrctrl.cxx | 71 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.cxx | 49 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.hxx | 16 | ||||
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 22 | ||||
-rw-r--r-- | svx/source/tbxctrls/fontworkgallery.cxx | 48 | ||||
-rw-r--r-- | svx/source/tbxctrls/grafctrl.cxx | 73 | ||||
-rw-r--r-- | svx/source/tbxctrls/itemwin.cxx | 24 | ||||
-rw-r--r-- | svx/source/tbxctrls/layctrl.cxx | 44 | ||||
-rw-r--r-- | svx/source/tbxctrls/lboxctrl.cxx | 35 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 85 | ||||
-rw-r--r-- | svx/source/tbxctrls/subtoolboxcontrol.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 223 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunocontroller.cxx | 8 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 16 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbxalign.cxx | 2 |
18 files changed, 433 insertions, 326 deletions
diff --git a/svx/source/tbxctrls/SvxColorChildWindow.cxx b/svx/source/tbxctrls/SvxColorChildWindow.cxx index a541eb2bdf83..a4ad23f3fedc 100644 --- a/svx/source/tbxctrls/SvxColorChildWindow.cxx +++ b/svx/source/tbxctrls/SvxColorChildWindow.cxx @@ -33,8 +33,9 @@ SvxColorChildWindow::SvxColorChildWindow( vcl::Window* _pParent, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - SvxColorDockingWindow* pWin = new SvxColorDockingWindow( pBindings, this, + VclPtr<SvxColorDockingWindow> pWin = VclPtr<SvxColorDockingWindow>::Create( pBindings, this, _pParent ); + pWindow = pWin; eChildAlignment = SfxChildAlignment::BOTTOM; diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index bc47a66ec219..68ab4fe1c114 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -40,13 +40,15 @@ class NumberingPopup : public svtools::ToolbarMenu { bool mbBulletItem; NumberingToolBoxControl& mrController; - SvxNumValueSet* mpValueSet; + VclPtr<SvxNumValueSet> mpValueSet; DECL_LINK( VSSelectHdl, void * ); public: NumberingPopup( NumberingToolBoxControl& rController, const css::uno::Reference< css::frame::XFrame >& rFrame, vcl::Window* pParent, bool bBulletItem ); + virtual ~NumberingPopup(); + virtual void dispose() SAL_OVERRIDE; virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) SAL_OVERRIDE; @@ -58,7 +60,7 @@ class NumberingToolBoxControl : public svt::PopupWindowController public: NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; bool IsInImpressDraw(); // XStatusListener @@ -87,7 +89,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, mrController( rController ) { WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT; - mpValueSet = new SvxNumValueSet( this, nBits ); + mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits ); mpValueSet->init( mbBulletItem ? NUM_PAGETYPE_BULLET : NUM_PAGETYPE_SINGLENUM ); if ( !mbBulletItem ) @@ -133,6 +135,17 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, AddStatusListener( ".uno:CurrentNumListType" ); } +NumberingPopup::~NumberingPopup() +{ + disposeOnce(); +} + +void NumberingPopup::dispose() +{ + mpValueSet.clear(); + ToolbarMenu::dispose(); +} + void NumberingPopup::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) { @@ -191,9 +204,9 @@ NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css { } -vcl::Window* NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent ) { - return new NumberingPopup( *this, m_xFrame, pParent, mbBulletItem ); + return VclPtr<NumberingPopup>::Create( *this, m_xFrame, pParent, mbBulletItem ); } bool NumberingToolBoxControl::IsInImpressDraw() diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 6cfecdfc246f..5cdf8b7a10fe 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -37,13 +37,13 @@ class SvxColorWindow_Impl : public SfxPopupWindow private: const sal_uInt16 theSlotId; - SvxColorValueSet* mpColorSet; - SvxColorValueSet* mpRecentColorSet; + VclPtr<SvxColorValueSet> mpColorSet; + VclPtr<SvxColorValueSet> mpRecentColorSet; - ListBox* mpPaletteListBox; - PushButton* mpButtonAutoColor; - PushButton* mpButtonPicker; - FixedLine* mpAutomaticSeparator; + VclPtr<ListBox> mpPaletteListBox; + VclPtr<PushButton> mpButtonAutoColor; + VclPtr<PushButton> mpButtonPicker; + VclPtr<FixedLine> mpAutomaticSeparator; OUString maCommand; Link maSelectedLink; @@ -68,12 +68,13 @@ public: const OUString& rWndTitle, vcl::Window* pParentWindow); virtual ~SvxColorWindow_Impl(); + virtual void dispose() SAL_OVERRIDE; void StartSelection(); virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; void SetSelectedHdl( const Link& rLink ) { maSelectedLink = rLink; } }; diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 8febde00992b..23c743ca9d4e 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -186,7 +186,7 @@ SvxColorDockingWindow::SvxColorDockingWindow SfxDockingWindow( _pBindings, pCW, _pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE ), pColorList (), - aColorSet ( this ), + aColorSet ( VclPtr<SvxColorValueSet_docking>::Create(this) ), nLeftSlot ( SID_ATTR_FILL_COLOR ), nRightSlot ( SID_ATTR_LINE_COLOR ), nCols ( 20 ), @@ -197,9 +197,9 @@ SvxColorDockingWindow::SvxColorDockingWindow SetSizePixel(LogicToPixel(Size(150, 22), MapMode(MAP_APPFONT))); SetHelpId(HID_CTRL_COLOR); - aColorSet.SetSelectHdl( LINK( this, SvxColorDockingWindow, SelectHdl ) ); - aColorSet.SetHelpId(HID_COLOR_CTL_COLORS); - aColorSet.SetPosSizePixel(LogicToPixel(Point(2, 2), MapMode(MAP_APPFONT)), + aColorSet->SetSelectHdl( LINK( this, SvxColorDockingWindow, SelectHdl ) ); + aColorSet->SetHelpId(HID_COLOR_CTL_COLORS); + aColorSet->SetPosSizePixel(LogicToPixel(Point(2, 2), MapMode(MAP_APPFONT)), LogicToPixel(Size(146, 18), MapMode(MAP_APPFONT))); // Get the model from the view shell. Using SfxObjectShell::Current() @@ -230,21 +230,28 @@ SvxColorDockingWindow::SvxColorDockingWindow } } - aItemSize = aColorSet.CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength())); + aItemSize = aColorSet->CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength())); aItemSize.Width() = aItemSize.Width() + SvxColorValueSet::getEntryEdgeLength(); aItemSize.Width() /= 2; aItemSize.Height() = aItemSize.Height() + SvxColorValueSet::getEntryEdgeLength(); aItemSize.Height() /= 2; SetSize(); - aColorSet.Show(); + aColorSet->Show(); if (_pBindings != NULL) StartListening( *_pBindings, true ); } SvxColorDockingWindow::~SvxColorDockingWindow() { + disposeOnce(); +} + +void SvxColorDockingWindow::dispose() +{ EndListening( GetBindings() ); + aColorSet.disposeAndClear(); + SfxDockingWindow::dispose(); } void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint ) @@ -264,25 +271,25 @@ void SvxColorDockingWindow::FillValueSet() if( pColorList.is() ) { nCount = pColorList->Count(); - aColorSet.Clear(); + aColorSet->Clear(); // create the first entry for 'invisible/none' const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength()); long nPtX = aColorSize.Width() - 1; long nPtY = aColorSize.Height() - 1; - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; - aVD.SetOutputSizePixel( aColorSize ); - aVD.SetLineColor( Color( COL_BLACK ) ); - aVD.SetBackground( Wallpaper( Color( COL_WHITE ) ) ); - aVD.DrawLine( Point(), Point( nPtX, nPtY ) ); - aVD.DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) ); + pVD->SetOutputSizePixel( aColorSize ); + pVD->SetLineColor( Color( COL_BLACK ) ); + pVD->SetBackground( Wallpaper( Color( COL_WHITE ) ) ); + pVD->DrawLine( Point(), Point( nPtX, nPtY ) ); + pVD->DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) ); - Bitmap aBmp( aVD.GetBitmap( Point(), aColorSize ) ); + Bitmap aBmp( pVD->GetBitmap( Point(), aColorSize ) ); - aColorSet.InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) ); + aColorSet->InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) ); - aColorSet.addEntriesForXColorList(*pColorList, 2); + aColorSet->addEntriesForXColorList(*pColorList, 2); } } @@ -300,31 +307,31 @@ void SvxColorDockingWindow::SetSize() nLines++; // Scrollbar setzen/entfernen - WinBits nBits = aColorSet.GetStyle(); + WinBits nBits = aColorSet->GetStyle(); if ( static_cast<long>(nLines) * nCols >= nCount ) nBits &= ~WB_VSCROLL; else nBits |= WB_VSCROLL; - aColorSet.SetStyle( nBits ); + aColorSet->SetStyle( nBits ); // ScrollBar ? - long nScrollWidth = aColorSet.GetScrollWidth(); + long nScrollWidth = aColorSet->GetScrollWidth(); if( nScrollWidth > 0 ) { // Spalten mit ScrollBar berechnen nCols = (sal_uInt16) ( ( aSize.Width() - nScrollWidth ) / aItemSize.Width() ); } - aColorSet.SetColCount( nCols ); + aColorSet->SetColCount( nCols ); if( IsFloatingMode() ) - aColorSet.SetLineCount( nLines ); + aColorSet->SetLineCount( nLines ); else { - aColorSet.SetLineCount( 0 ); // sonst wird LineHeight ignoriert - aColorSet.SetItemHeight( aItemSize.Height() ); + aColorSet->SetLineCount( 0 ); // sonst wird LineHeight ignoriert + aColorSet->SetItemHeight( aItemSize.Height() ); } - aColorSet.SetPosSizePixel( Point( 2, 2 ), aSize ); + aColorSet->SetPosSizePixel( Point( 2, 2 ), aSize ); } bool SvxColorDockingWindow::Close() @@ -339,11 +346,11 @@ bool SvxColorDockingWindow::Close() IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl) { SfxDispatcher* pDispatcher = GetBindings().GetDispatcher(); - sal_uInt16 nPos = aColorSet.GetSelectItemId(); - Color aColor( aColorSet.GetItemColor( nPos ) ); - OUString aStr( aColorSet.GetItemText( nPos ) ); + sal_uInt16 nPos = aColorSet->GetSelectItemId(); + Color aColor( aColorSet->GetItemColor( nPos ) ); + OUString aStr( aColorSet->GetItemText( nPos ) ); - if (aColorSet.IsLeftButton()) + if (aColorSet->IsLeftButton()) { if ( nLeftSlot == SID_ATTR_FILL_COLOR ) { @@ -444,15 +451,15 @@ void SvxColorDockingWindow::Resizing( Size& rNewSize ) nLines = 1; // Scrollbar setzen/entfernen - WinBits nBits = aColorSet.GetStyle(); + WinBits nBits = aColorSet->GetStyle(); if ( static_cast<long>(nLines) * nCols >= nCount ) nBits &= ~WB_VSCROLL; else nBits |= WB_VSCROLL; - aColorSet.SetStyle( nBits ); + aColorSet->SetStyle( nBits ); // ScrollBar ? - long nScrollWidth = aColorSet.GetScrollWidth(); + long nScrollWidth = aColorSet->GetScrollWidth(); if( nScrollWidth > 0 ) { // Spalten mit ScrollBar berechnen @@ -489,7 +496,7 @@ void SvxColorDockingWindow::GetFocus() SfxDockingWindow::GetFocus(); // Grab the focus to the color value set so that it can be controlled // with the keyboard. - aColorSet.GrabFocus(); + aColorSet->GrabFocus(); } bool SvxColorDockingWindow::Notify( NotifyEvent& rNEvt ) diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index cafd700302df..b9d988ae37b1 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -104,6 +104,17 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( AddStatusListener( msExtrusionProjection ); } +ExtrusionDirectionWindow::~ExtrusionDirectionWindow() +{ + disposeOnce(); +} + +void ExtrusionDirectionWindow::dispose() +{ + mpDirectionSet.clear(); + ToolbarMenu::dispose(); +} + void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { ToolbarMenu::DataChanged( rDCEvt ); @@ -233,9 +244,9 @@ ExtrusionDirectionControl::ExtrusionDirectionControl( -vcl::Window* ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent ) { - return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); + return VclPtr<ExtrusionDirectionWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization @@ -298,6 +309,17 @@ ExtrusionDepthDialog::ExtrusionDepthDialog( vcl::Window* pParent, double fDepth, m_pMtrDepth->SetValue( (int) fDepth * 100, FUNIT_100TH_MM ); } +ExtrusionDepthDialog::~ExtrusionDepthDialog() +{ + disposeOnce(); +} + +void ExtrusionDepthDialog::dispose() +{ + m_pMtrDepth.clear(); + ModalDialog::dispose(); +} + double ExtrusionDepthDialog::getDepth() const { return (double)( m_pMtrDepth->GetValue( FUNIT_100TH_MM ) ) / 100.0; @@ -468,9 +490,9 @@ ExtrusionDepthController::ExtrusionDepthController( -vcl::Window* ExtrusionDepthController::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> ExtrusionDepthController::createPopupWindow( vcl::Window* pParent ) { - return new ExtrusionDepthWindow( *this, m_xFrame, pParent ); + return VclPtr<ExtrusionDepthWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization @@ -578,6 +600,17 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::ToolboxController& rContro AddStatusListener( msExtrusionLightingIntensity ); } +ExtrusionLightingWindow::~ExtrusionLightingWindow() +{ + disposeOnce(); +} + +void ExtrusionLightingWindow::dispose() +{ + mpLightingSet.clear(); + ToolbarMenu::dispose(); +} + void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) { mnLevel = nLevel; @@ -724,9 +757,9 @@ ExtrusionLightingControl::ExtrusionLightingControl( -vcl::Window* ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent ) { - return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); + return VclPtr<ExtrusionLightingWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization @@ -870,9 +903,9 @@ ExtrusionSurfaceControl::ExtrusionSurfaceControl( -vcl::Window* ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent ) { - return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent ); + return VclPtr<ExtrusionSurfaceWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 4371153b00ea..d94de5301b87 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -41,13 +41,15 @@ class ExtrusionDirectionWindow : public svtools::ToolbarMenu { public: ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window* pParentWindow ); + virtual ~ExtrusionDirectionWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; private: svt::ToolboxController& mrController; - ValueSet* mpDirectionSet; + VclPtr<ValueSet> mpDirectionSet; Image maImgDirection[9]; Image maImgPerspective; @@ -71,7 +73,7 @@ class ExtrusionDirectionControl : public svt::PopupWindowController public: ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -118,7 +120,7 @@ class ExtrusionDepthController : public svt::PopupWindowController public: ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -137,7 +139,7 @@ class ExtrusionLightingWindow : public svtools::ToolbarMenu { private: svt::ToolboxController& mrController; - ValueSet* mpLightingSet; + VclPtr<ValueSet> mpLightingSet; Image maImgLightingOff[9]; Image maImgLightingOn[9]; @@ -161,6 +163,8 @@ private: DECL_LINK( SelectHdl, void * ); public: ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, vcl::Window* pParentWindow ); + virtual ~ExtrusionLightingWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; @@ -173,7 +177,7 @@ class ExtrusionLightingControl : public svt::PopupWindowController public: ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -217,7 +221,7 @@ class ExtrusionSurfaceControl : public svt::PopupWindowController public: ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index c889e98f6fbf..4386b780ae4e 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -502,11 +502,11 @@ void SvxFillToolBoxControl::Update(const SfxPoolItem* pState) } } -vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) +VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) { if(GetSlotId() == SID_ATTR_FILL_STYLE) { - mpFillControl = new FillControl(pParent); + mpFillControl.reset(VclPtr<FillControl>::Create(pParent)); // Thus the FillControl is known by SvxFillToolBoxControl // (and in order to remain compatible) mpFillControl->SetData(this); @@ -528,15 +528,15 @@ vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID); } - return mpFillControl; + return mpFillControl.get(); } - return NULL; + return VclPtr<vcl::Window>(); } FillControl::FillControl(vcl::Window* pParent,WinBits nStyle) : Window(pParent,nStyle | WB_DIALOGCONTROL), - mpLbFillType(new SvxFillTypeBox(this)), - mpLbFillAttr(new SvxFillAttrBox(this)), + mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this)), + mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this)), maLogicalFillSize(40,80), maLogicalAttrSize(50,80), mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()), @@ -562,8 +562,14 @@ FillControl::FillControl(vcl::Window* pParent,WinBits nStyle) FillControl::~FillControl() { - delete mpLbFillType; - delete mpLbFillAttr; + disposeOnce(); +} + +void FillControl::dispose() +{ + mpLbFillType.disposeAndClear(); + mpLbFillAttr.disposeAndClear(); + vcl::Window::dispose(); } void FillControl::InitializeFillStyleAccordingToGivenFillType(drawing::FillStyle aFillStyle) diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index c4df8a50e66a..2cd3fa3ed24e 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -94,12 +94,17 @@ FontWorkGalleryDialog::FontWorkGalleryDialog( SdrView* pSdrView, vcl::Window* pP fillFavorites( GALLERY_THEME_FONTWORK ); } - FontWorkGalleryDialog::~FontWorkGalleryDialog() { + disposeOnce(); } - +void FontWorkGalleryDialog::dispose() +{ + mpCtlFavorites.clear(); + mpOKButton.clear(); + ModalDialog::dispose(); +} void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) { @@ -119,7 +124,7 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) if (GalleryExplorer::GetSdrObj(nThemeId, nModelPos, pModel, &aThumb) && !!aThumb) { - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > pVDev; const Point aNull(0, 0); if (GetDPIScaleFactor() > 1) @@ -127,7 +132,7 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) const Size aSize(aThumb.GetSizePixel()); - aVDev.SetOutputSizePixel(aSize); + pVDev->SetOutputSizePixel(aSize); if(rStyleSettings.GetPreviewUsesCheckeredBackground()) { @@ -135,16 +140,16 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) static const Color aW(COL_WHITE); static const Color aG(0xef, 0xef, 0xef); - aVDev.DrawCheckered(aNull, aSize, nLen, aW, aG); + pVDev->DrawCheckered(aNull, aSize, nLen, aW, aG); } else { - aVDev.SetBackground(rStyleSettings.GetFieldColor()); - aVDev.Erase(); + pVDev->SetBackground(rStyleSettings.GetFieldColor()); + pVDev->Erase(); } - aVDev.DrawBitmapEx(aNull, aThumb); - maFavoritesHorizontal.push_back(aVDev.GetBitmap(aNull, aSize)); + pVDev->DrawBitmapEx(aNull, aThumb); + maFavoritesHorizontal.push_back(pVDev->GetBitmap(aNull, aSize)); } } @@ -278,7 +283,7 @@ SfxPopupWindowType FontWorkShapeTypeControl::GetPopupWindowType() const -SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> FontWorkShapeTypeControl::CreatePopupWindow() { OUString aSubTbxResName( "private:resource/toolbar/fontworkshapetype" ); createAndPositionSubToolBar( aSubTbxResName ); @@ -391,7 +396,7 @@ class FontworkAlignmentControl : public svt::PopupWindowController public: FontworkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -414,9 +419,9 @@ FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentC -vcl::Window* FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent ) { - return new FontworkAlignmentWindow( *this, m_xFrame, pParent ); + return VclPtr<FontworkAlignmentWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization @@ -631,7 +636,7 @@ class FontworkCharacterSpacingControl : public svt::PopupWindowController public: FontworkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE; // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) @@ -652,9 +657,9 @@ FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Referenc -vcl::Window* FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent ) { - return new FontworkCharacterSpacingWindow( *this, m_xFrame, pParent ); + return VclPtr<FontworkCharacterSpacingWindow>::Create( *this, m_xFrame, pParent ); } // XInitialization @@ -714,6 +719,17 @@ FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( vcl::Window* pPa m_pMtrScale->SetValue( nScale ); } +FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog() +{ + disposeOnce(); +} + +void FontworkCharacterSpacingDialog::dispose() +{ + m_pMtrScale.clear(); + ModalDialog::dispose(); +} + sal_Int32 FontworkCharacterSpacingDialog::getScale() const { return (sal_Int32)m_pMtrScale->GetValue(); diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index b6aa20047168..5cc2a78736a2 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -98,9 +98,7 @@ protected: virtual void Modify() SAL_OVERRIDE; public: - ImplGrafMetricField( vcl::Window* pParent, const OUString& aCmd, const Reference< XFrame >& rFrame ); - virtual ~ImplGrafMetricField(); void Update( const SfxPoolItem* pItem ); }; @@ -143,10 +141,6 @@ ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString& maIdle.SetIdleHdl( LINK( this, ImplGrafMetricField, ImplModifyHdl ) ); } -ImplGrafMetricField::~ImplGrafMetricField() -{ -} - void ImplGrafMetricField::Modify() { maIdle.Start(); @@ -243,8 +237,8 @@ class ImplGrafControl : public Control { using Window::Update; private: - FixedImage maImage; - ImplGrafMetricField maField; + VclPtr<FixedImage> maImage; + VclPtr<ImplGrafMetricField> maField; protected: @@ -254,9 +248,10 @@ public: ImplGrafControl( vcl::Window* pParent, const OUString& rCmd, const Reference< XFrame >& rFrame ); virtual ~ImplGrafControl(); + virtual void dispose() SAL_OVERRIDE; - void Update( const SfxPoolItem* pItem ) { maField.Update( pItem ); } - void SetText( const OUString& rStr ) SAL_OVERRIDE { maField.SetText( rStr ); } + void Update( const SfxPoolItem* pItem ) { maField->Update( pItem ); } + void SetText( const OUString& rStr ) SAL_OVERRIDE { maField->SetText( rStr ); } }; ImplGrafControl::ImplGrafControl( @@ -264,20 +259,20 @@ ImplGrafControl::ImplGrafControl( const OUString& rCmd, const Reference< XFrame >& rFrame ) : Control( pParent, WB_TABSTOP ) - , maImage( this ) - , maField( this, rCmd, rFrame ) + , maImage( VclPtr<FixedImage>::Create(this) ) + , maField( VclPtr<ImplGrafMetricField>::Create(this, rCmd, rFrame) ) { ResId aResId( ImplGetRID( rCmd ), DIALOG_MGR() ) ; Image aImage( aResId ); Size aImgSize( aImage.GetSizePixel() ); - Size aFldSize( maField.GetSizePixel() ); + Size aFldSize( maField->GetSizePixel() ); long nFldY, nImgY; - maImage.SetImage( aImage ); - maImage.SetSizePixel( aImgSize ); + maImage->SetImage( aImage ); + maImage->SetSizePixel( aImgSize ); // we want to see the backbround of the toolbox, not of the FixedImage or Control - maImage.SetBackground( Wallpaper( COL_TRANSPARENT ) ); + maImage->SetBackground( Wallpaper( COL_TRANSPARENT ) ); SetBackground( Wallpaper( COL_TRANSPARENT ) ); if( aImgSize.Height() > aFldSize.Height() ) @@ -286,26 +281,34 @@ ImplGrafControl::ImplGrafControl( nFldY = 0, nImgY = ( aFldSize.Height() - aImgSize.Height() ) >> 1; long nOffset = SYMBOL_TO_FIELD_OFFSET / 2; - maImage.SetPosPixel( Point( nOffset, nImgY ) ); - maField.SetPosPixel( Point( aImgSize.Width() + SYMBOL_TO_FIELD_OFFSET, nFldY ) ); + maImage->SetPosPixel( Point( nOffset, nImgY ) ); + maField->SetPosPixel( Point( aImgSize.Width() + SYMBOL_TO_FIELD_OFFSET, nFldY ) ); SetSizePixel( Size( aImgSize.Width() + aFldSize.Width() + SYMBOL_TO_FIELD_OFFSET + nOffset, std::max( aImgSize.Height(), aFldSize.Height() ) ) ); SetBackground( Wallpaper() ); // transparent background - maImage.Show(); + maImage->Show(); - maField.SetHelpId( OUStringToOString( rCmd, RTL_TEXTENCODING_UTF8 ) ); - maField.Show(); + maField->SetHelpId( OUStringToOString( rCmd, RTL_TEXTENCODING_UTF8 ) ); + maField->Show(); } ImplGrafControl::~ImplGrafControl() { + disposeOnce(); +} + +void ImplGrafControl::dispose() +{ + maImage.disposeAndClear(); + maField.disposeAndClear(); + Control::dispose(); } void ImplGrafControl::GetFocus() { - maField.GrabFocus(); + maField->GrabFocus(); } class ImplGrafModeControl : public ListBox @@ -321,9 +324,7 @@ private: static void ImplReleaseFocus(); public: - ImplGrafModeControl( vcl::Window* pParent, const Reference< XFrame >& rFrame ); - virtual ~ImplGrafModeControl(); void Update( const SfxPoolItem* pItem ); }; @@ -343,10 +344,6 @@ ImplGrafModeControl::ImplGrafModeControl( vcl::Window* pParent, const Reference< Show(); } -ImplGrafModeControl::~ImplGrafModeControl() -{ -} - void ImplGrafModeControl::Select() { if ( !IsTravelSelect() ) @@ -449,7 +446,7 @@ SfxPopupWindowType SvxGrafFilterToolBoxControl::GetPopupWindowType() const return SfxPopupWindowType::ONCLICK; } -SfxPopupWindow* SvxGrafFilterToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxGrafFilterToolBoxControl::CreatePopupWindow() { OUString aSubTbxResName( "private:resource/toolbar/graffilterbar" ); createAndPositionSubToolBar( aSubTbxResName ); @@ -490,9 +487,9 @@ void SvxGrafToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const } } -vcl::Window* SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new ImplGrafControl( pParent, m_aCommandURL, m_xFrame ) ); + return VclPtr<ImplGrafControl>::Create( pParent, m_aCommandURL, m_xFrame ).get(); } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item ); @@ -577,9 +574,9 @@ void SvxGrafModeToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, c } } -vcl::Window* SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new ImplGrafModeControl( pParent, m_xFrame ) ); + return VclPtr<ImplGrafModeControl>::Create( pParent, m_xFrame ).get(); } void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) @@ -735,7 +732,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) aCropDlgAttr.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(), aRBSize.Width(), aRBSize.Height() ) ); - SfxSingleTabDialog aCropDialog( + ScopedVclPtrInstance<SfxSingleTabDialog> aCropDialog( SfxViewShell::Current() ? SfxViewShell::Current()->GetWindow() : NULL, aCropDlgAttr); const OUString aCropStr(SVX_RESSTR(RID_SVXSTR_GRAFCROP)); @@ -744,14 +741,14 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) assert(pFact && "Dialog creation failed!"); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_GRFCROP ); assert(fnCreatePage && "Dialog creation failed!"); - SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog.get_content_area(), &aCropDlgAttr ); + SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog->get_content_area(), &aCropDlgAttr ); pTabPage->SetText( aCropStr ); - aCropDialog.SetTabPage( pTabPage ); + aCropDialog->SetTabPage( pTabPage ); - if( aCropDialog.Execute() == RET_OK ) + if( aCropDialog->Execute() == RET_OK ) { - const SfxItemSet* pOutAttr = aCropDialog.GetOutputItemSet(); + const SfxItemSet* pOutAttr = aCropDialog->GetOutputItemSet(); if( pOutAttr ) { diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 449cb7f951dc..09008172a790 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -69,12 +69,6 @@ SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame, -SvxLineBox::~SvxLineBox() -{ -} - - - IMPL_LINK_NOARG(SvxLineBox, DelayHdl_Impl) { if ( GetEntryCount() == 0 ) @@ -278,12 +272,6 @@ SvxMetricField::SvxMetricField( -SvxMetricField::~SvxMetricField() -{ -} - - - void SvxMetricField::Update( const XLineWidthItem* pItem ) { if ( pItem ) @@ -432,12 +420,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFillTypeBox(vcl::Wi -SvxFillTypeBox::~SvxFillTypeBox() -{ -} - - - bool SvxFillTypeBox::PreNotify( NotifyEvent& rNEvt ) { MouseNotifyEvent nType = rNEvt.GetType(); @@ -519,12 +501,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxFillAttrBox(vcl::Wi -SvxFillAttrBox::~SvxFillAttrBox() -{ -} - - - bool SvxFillAttrBox::PreNotify( NotifyEvent& rNEvt ) { MouseNotifyEvent nType = rNEvt.GetType(); diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index c9c98d285986..a5ec5ebd8159 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -45,7 +45,7 @@ SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item); class TableWindow : public SfxPopupWindow { private: - PushButton aTableButton; + VclPtr<PushButton> aTableButton; ::Color aLineColor; ::Color aFillColor; ::Color aHighlightFillColor; @@ -79,13 +79,14 @@ public: ToolBox& rParentTbx, const Reference< XFrame >& rFrame ); virtual ~TableWindow(); + virtual void dispose() SAL_OVERRIDE; void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Paint( const Rectangle& ) SAL_OVERRIDE; virtual void PopupModeEnd() SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; private: void Update( long nNewCol, long nNewLine ); @@ -109,7 +110,7 @@ IMPL_LINK_NOARG(TableWindow, SelectHdl) TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUString& rText, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) : SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP ) ) - , aTableButton( this ) + , aTableButton( VclPtr<PushButton>::Create(this) ) , nCol( 0 ) , nLine( 0 ) , bInitialKeyInput(false) @@ -143,11 +144,11 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri SetText( rText ); - aTableButton.SetPosSizePixel( Point( mnTablePosX, mnTableHeight + 5 ), + aTableButton->SetPosSizePixel( Point( mnTablePosX, mnTableHeight + 5 ), Size( mnTableWidth - mnTablePosX, 24 ) ); - aTableButton.SetText( SVX_RESSTR( RID_SVXSTR_MORE ) ); - aTableButton.SetClickHdl( LINK( this, TableWindow, SelectHdl ) ); - aTableButton.Show(); + aTableButton->SetText( SVX_RESSTR( RID_SVXSTR_MORE ) ); + aTableButton->SetClickHdl( LINK( this, TableWindow, SelectHdl ) ); + aTableButton->Show(); SetOutputSizePixel( Size( mnTableWidth + 3, mnTableHeight + 33 ) ); } @@ -156,13 +157,18 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri TableWindow::~TableWindow() { + disposeOnce(); } +void TableWindow::dispose() +{ + aTableButton.disposeAndClear(); + SfxPopupWindow::dispose(); +} - -SfxPopupWindow* TableWindow::Clone() const +VclPtr<SfxPopupWindow> TableWindow::Clone() const { - return new TableWindow( GetId(), maCommand, GetText(), rTbx, mxFrame ); + return VclPtr<TableWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame ); } @@ -424,7 +430,7 @@ public: virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Paint( const Rectangle& ) SAL_OVERRIDE; virtual void PopupModeEnd() SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; }; @@ -466,9 +472,9 @@ ColumnsWindow::ColumnsWindow( sal_uInt16 nId, const OUString& rCmd, const OUStri -SfxPopupWindow* ColumnsWindow::Clone() const +VclPtr<SfxPopupWindow> ColumnsWindow::Clone() const { - return new ColumnsWindow( GetId(), maCommand, GetText(), rTbx, mxFrame ); + return VclPtr<ColumnsWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame ); } @@ -722,12 +728,12 @@ SfxPopupWindowType SvxTableToolBoxControl::GetPopupWindowType() const -SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxTableToolBoxControl::CreatePopupWindow() { if ( bEnabled ) { ToolBox& rTbx = GetToolBox(); - TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame ); + VclPtr<TableWindow> pWin = VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame ); pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE ); SetPopupWindow( pWin ); return pWin; @@ -740,7 +746,7 @@ SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow() SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindowCascading() { if ( bEnabled ) - return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); + return VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); return 0; } @@ -787,12 +793,12 @@ SfxPopupWindowType SvxColumnsToolBoxControl::GetPopupWindowType() const -SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxColumnsToolBoxControl::CreatePopupWindow() { ColumnsWindow* pWin = 0; if(bEnabled) { - pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); + pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE ); SetPopupWindow( pWin ); @@ -807,7 +813,7 @@ SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindowCascading() ColumnsWindow* pWin = 0; if(bEnabled) { - pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); + pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); } return pWin; } diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index f65d68ff4daf..a517946bff0e 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -54,17 +54,19 @@ class SvxPopupWindowListBox: public SfxPopupWindow { using FloatingWindow::StateChanged; - ListBox * m_pListBox; + VclPtr<ListBox> m_pListBox; ToolBox & rToolBox; bool bUserSel; - sal_uInt16 nTbxId; - OUString maCommandURL; + sal_uInt16 nTbxId; + OUString maCommandURL; public: SvxPopupWindowListBox( sal_uInt16 nSlotId, const OUString& rCommandURL, sal_uInt16 nTbxId, ToolBox& rTbx ); + virtual ~SvxPopupWindowListBox(); + virtual void dispose() SAL_OVERRIDE; // SfxPopupWindow - virtual SfxPopupWindow * Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; virtual void PopupModeEnd() SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -96,9 +98,20 @@ SvxPopupWindowListBox::SvxPopupWindowListBox(sal_uInt16 nSlotId, const OUString& AddStatusListener( rCommandURL ); } -SfxPopupWindow* SvxPopupWindowListBox::Clone() const +SvxPopupWindowListBox::~SvxPopupWindowListBox() { - return new SvxPopupWindowListBox( GetId(), maCommandURL, nTbxId, rToolBox ); + disposeOnce(); +} + +void SvxPopupWindowListBox::dispose() +{ + m_pListBox.clear(); + SfxPopupWindow::dispose(); +} + +VclPtr<SfxPopupWindow> SvxPopupWindowListBox::Clone() const +{ + return VclPtr<SvxPopupWindowListBox>::Create( GetId(), maCommandURL, nTbxId, rToolBox ); } void SvxPopupWindowListBox::PopupModeEnd() @@ -140,11 +153,9 @@ SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBo SvxListBoxControl::~SvxListBoxControl() -{ -} - +{} -SfxPopupWindow* SvxListBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxListBoxControl::CreatePopupWindow() { OSL_FAIL( "not implemented" ); return 0; @@ -270,7 +281,7 @@ void SvxUndoRedoControl::StateChanged( } } -SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxUndoRedoControl::CreatePopupWindow() { DBG_ASSERT(( SID_UNDO == GetSlotId() || SID_REDO == GetSlotId() ), "mismatching ids" ); @@ -281,7 +292,7 @@ SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow() ToolBox& rBox = GetToolBox(); - pPopupWin = new SvxPopupWindowListBox( GetSlotId(), m_aCommandURL, GetId(), rBox ); + pPopupWin = VclPtr<SvxPopupWindowListBox>::Create( GetSlotId(), m_aCommandURL, GetId(), rBox ); pPopupWin->SetPopupModeEndHdl( LINK( this, SvxUndoRedoControl, PopupModeEndHdl ) ); ListBox &rListBox = pPopupWin->GetListBox(); diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 836fad360479..5f303bc76b98 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -183,9 +183,9 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState ) -vcl::Window* SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return new SvxLineBox( pParent, m_xFrame ); + return VclPtr<SvxLineBox>::Create( pParent, m_xFrame ).get(); } SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl( @@ -244,9 +244,9 @@ void SvxLineWidthToolBoxControl::StateChanged( -vcl::Window* SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new SvxMetricField( pParent, m_xFrame ) ); + return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get(); } SvxLineEndWindow::SvxLineEndWindow( @@ -256,7 +256,7 @@ SvxLineEndWindow::SvxLineEndWindow( SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ), - aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ), + aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ), nCols ( 2 ), nLines ( 12 ), nLineEndWidth ( 400 ), @@ -277,7 +277,7 @@ SvxLineEndWindow::SvxLineEndWindow( rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ), - aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ), + aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )), nCols ( 2 ), nLines ( 12 ), nLineEndWidth ( 400 ), @@ -294,7 +294,7 @@ void SvxLineEndWindow::implInit() SfxObjectShell* pDocSh = SfxObjectShell::Current(); SetHelpId( HID_POPUP_LINEEND ); - aLineEndSet.SetHelpId( HID_POPUP_LINEEND_CTRL ); + aLineEndSet->SetHelpId( HID_POPUP_LINEEND_CTRL ); if ( pDocSh ) { @@ -308,8 +308,8 @@ void SvxLineEndWindow::implInit() } DBG_ASSERT( pLineEndList.is(), "LineEndList not found" ); - aLineEndSet.SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) ); - aLineEndSet.SetColCount( nCols ); + aLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) ); + aLineEndSet->SetColCount( nCols ); // ValueSet fill with entries of LineEndList FillValueSet(); @@ -317,27 +317,32 @@ void SvxLineEndWindow::implInit() AddStatusListener( OUString( ".uno:LineEndListState" )); //ChangeHelpId( HID_POPUP_LINEENDSTYLE ); - aLineEndSet.Show(); + aLineEndSet->Show(); } -SfxPopupWindow* SvxLineEndWindow::Clone() const +VclPtr<SfxPopupWindow> SvxLineEndWindow::Clone() const { - return new SvxLineEndWindow( GetId(), mxFrame, GetText() ); + return VclPtr<SvxLineEndWindow>::Create( GetId(), mxFrame, GetText() ); } SvxLineEndWindow::~SvxLineEndWindow() { + disposeOnce(); } - +void SvxLineEndWindow::dispose() +{ + aLineEndSet.disposeAndClear(); + SfxPopupWindow::dispose(); +} IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl) { boost::scoped_ptr<XLineEndItem> pLineEndItem; boost::scoped_ptr<XLineStartItem> pLineStartItem; - sal_uInt16 nId = aLineEndSet.GetSelectItemId(); + sal_uInt16 nId = aLineEndSet->GetSelectItemId(); if( nId == 1 ) { @@ -380,7 +385,7 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl) /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ - aLineEndSet.SetNoSelection(); + aLineEndSet->SetNoSelection(); SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), OUString( ".uno:LineEndStyle" ), @@ -396,7 +401,7 @@ void SvxLineEndWindow::FillValueSet() if( pLineEndList.is() ) { XLineEndEntry* pEntry = NULL; - VirtualDevice aVD; + ScopedVclPtrInstance< VirtualDevice > pVD; long nCount = pLineEndList->Count(); @@ -409,14 +414,14 @@ void SvxLineEndWindow::FillValueSet() OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" ); aBmpSize = aBmp.GetSizePixel(); - aVD.SetOutputSizePixel( aBmpSize, false ); + pVD->SetOutputSizePixel( aBmpSize, false ); aBmpSize.Width() = aBmpSize.Width() / 2; Point aPt0( 0, 0 ); Point aPt1( aBmpSize.Width(), 0 ); - aVD.DrawBitmap( Point(), aBmp ); - aLineEndSet.InsertItem(1, Image(aVD.GetBitmap(aPt0, aBmpSize)), pEntry->GetName()); - aLineEndSet.InsertItem(2, Image(aVD.GetBitmap(aPt1, aBmpSize)), pEntry->GetName()); + pVD->DrawBitmap( Point(), aBmp ); + aLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName()); + aLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName()); delete pLineEndList->Remove( nCount ); @@ -427,14 +432,14 @@ void SvxLineEndWindow::FillValueSet() aBmp = pLineEndList->GetUiBitmap( i ); OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" ); - aVD.DrawBitmap( aPt0, aBmp ); - aLineEndSet.InsertItem((sal_uInt16)((i+1L)*2L+1L), - Image(aVD.GetBitmap(aPt0, aBmpSize)), pEntry->GetName()); - aLineEndSet.InsertItem((sal_uInt16)((i+2L)*2L), - Image(aVD.GetBitmap(aPt1, aBmpSize)), pEntry->GetName()); + pVD->DrawBitmap( aPt0, aBmp ); + aLineEndSet->InsertItem((sal_uInt16)((i+1L)*2L+1L), + Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName()); + aLineEndSet->InsertItem((sal_uInt16)((i+2L)*2L), + Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName()); } nLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES ); - aLineEndSet.SetLineCount( nLines ); + aLineEndSet->SetLineCount( nLines ); SetSize(); } @@ -451,15 +456,15 @@ void SvxLineEndWindow::Resize() mbInResize = true; if ( !IsRollUp() ) { - aLineEndSet.SetColCount( nCols ); - aLineEndSet.SetLineCount( nLines ); + aLineEndSet->SetColCount( nCols ); + aLineEndSet->SetLineCount( nLines ); SetSize(); Size aSize = GetOutputSizePixel(); aSize.Width() -= 4; aSize.Height() -= 4; - aLineEndSet.SetPosSizePixel( Point( 2, 2 ), aSize ); + aLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize ); } //SfxPopupWindow::Resize(); mbInResize = false; @@ -474,10 +479,10 @@ void SvxLineEndWindow::Resizing( Size& rNewSize ) aBitmapSize.Width() += 6; aBitmapSize.Height() += 6; - Size aItemSize = aLineEndSet.CalcItemSizePixel( aBitmapSize ); // -> Member + Size aItemSize = aLineEndSet->CalcItemSizePixel( aBitmapSize ); // -> Member //Size aOldSize = GetOutputSizePixel(); // for width - sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member + sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member // identify columns long nItemW = aItemSize.Width(); @@ -517,7 +522,7 @@ void SvxLineEndWindow::Resizing( Size& rNewSize ) void SvxLineEndWindow::StartSelection() { - aLineEndSet.StartSelection(); + aLineEndSet->StartSelection(); } @@ -540,7 +545,7 @@ void SvxLineEndWindow::StateChanged( pLineEndList = static_cast<const SvxLineEndListItem*>(pState)->GetLineEndList(); DBG_ASSERT( pLineEndList.is(), "LineEndList not found" ); - aLineEndSet.Clear(); + aLineEndSet->Clear(); FillValueSet(); Size aSize = GetOutputSizePixel(); @@ -569,23 +574,23 @@ void SvxLineEndWindow::SetSize() //if( !bPopupMode ) if( !IsInPopupMode() ) { - sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member + sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member sal_uInt16 nMaxLines = nItemCount / nCols; // -> Member ? if( nItemCount % nCols ) nMaxLines++; - WinBits nBits = aLineEndSet.GetStyle(); + WinBits nBits = aLineEndSet->GetStyle(); if ( nLines == nMaxLines ) nBits &= ~WB_VSCROLL; else nBits |= WB_VSCROLL; - aLineEndSet.SetStyle( nBits ); + aLineEndSet->SetStyle( nBits ); } Size aSize( aBmpSize ); aSize.Width() += 6; aSize.Height() += 6; - aSize = aLineEndSet.CalcWindowSizePixel( aSize ); + aSize = aLineEndSet->CalcWindowSizePixel( aSize ); aSize.Width() += 4; aSize.Height() += 4; SetOutputSizePixel( aSize ); @@ -599,7 +604,7 @@ void SvxLineEndWindow::GetFocus() SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - aLineEndSet.GrabFocus(); + aLineEndSet->GrabFocus(); } SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) : @@ -624,10 +629,10 @@ SfxPopupWindowType SvxLineEndToolBoxControl::GetPopupWindowType() const -SfxPopupWindow* SvxLineEndToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow() { SvxLineEndWindow* pLineEndWin = - new SvxLineEndWindow( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) ); + VclPtr<SvxLineEndWindow>::Create( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) ); pLineEndWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS | FLOATWIN_POPUPMODE_ALLOWTEAROFF | diff --git a/svx/source/tbxctrls/subtoolboxcontrol.cxx b/svx/source/tbxctrls/subtoolboxcontrol.cxx index c04c79b0de14..606debaaa292 100644 --- a/svx/source/tbxctrls/subtoolboxcontrol.cxx +++ b/svx/source/tbxctrls/subtoolboxcontrol.cxx @@ -37,7 +37,7 @@ SvxSubToolBoxControl::~SvxSubToolBoxControl() { } -SfxPopupWindow* SvxSubToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxSubToolBoxControl::CreatePopupWindow() { const sal_Char* pResource = 0; switch( GetSlotId() ) diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 35ef96793827..94dd822d5b1c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -120,6 +120,7 @@ public: SvxStyleBox_Impl( vcl::Window* pParent, const OUString& rCommand, SfxStyleFamily eFamily, const Reference< XDispatchProvider >& rDispatchProvider, const Reference< XFrame >& _xFrame,const OUString& rClearFormatKey, const OUString& rMoreKey, bool bInSpecialMode ); virtual ~SvxStyleBox_Impl(); + virtual void dispose() SAL_OVERRIDE; void SetFamily( SfxStyleFamily eNewFamily ); bool IsVisible() const { return bVisible; } @@ -154,7 +155,7 @@ private: OUString aMoreKey; OUString sDefaultStyle; bool bInSpecialMode; - MenuButton* m_pButtons[MAX_STYLES_ENTRIES]; + VclPtr<MenuButton> m_pButtons[MAX_STYLES_ENTRIES]; PopupMenu m_aMenu; void ReleaseFocus(); @@ -203,6 +204,7 @@ public: , WinBits nStyle = WB_SORT ); virtual ~SvxFontNameBox_Impl(); + virtual void dispose() SAL_OVERRIDE; void FillList(); void Update( const SvxFontItem* pFontItem ); @@ -241,9 +243,9 @@ class SvxFrameWindow_Impl : public SfxPopupWindow using FloatingWindow::StateChanged; private: - SvxFrmValueSet_Impl aFrameSet; - ImageList aImgList; - bool bParagraphMode; + VclPtr<SvxFrmValueSet_Impl> aFrameSet; + ImageList aImgList; + bool bParagraphMode; DECL_LINK( SelectHdl, void * ); @@ -256,18 +258,20 @@ protected: public: SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ); virtual ~SvxFrameWindow_Impl(); + virtual void dispose() SAL_OVERRIDE; + void StartSelection(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; }; class SvxLineWindow_Impl : public SfxPopupWindow { private: - LineListBox m_aLineStyleLb; + VclPtr<LineListBox> m_aLineStyleLb; bool m_bIsWriter; DECL_LINK( SelectHdl, void * ); @@ -280,8 +284,9 @@ protected: virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; public: SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ); - - virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + virtual ~SvxLineWindow_Impl() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_aLineStyleLb.disposeAndClear(); SfxPopupWindow::dispose(); } + virtual VclPtr<SfxPopupWindow> Clone() const SAL_OVERRIDE; }; class SvxStyleToolBoxControl; @@ -336,8 +341,16 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent, SvxStyleBox_Impl::~SvxStyleBox_Impl() { + disposeOnce(); +} + +void SvxStyleBox_Impl::dispose() +{ for(int i = 0; i < MAX_STYLES_ENTRIES; i++) - delete m_pButtons[i]; + { + m_pButtons[i].disposeAndClear(); + } + ComboBox::dispose(); } void SvxStyleBox_Impl::ReleaseFocus() @@ -731,9 +744,9 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp unsigned int nId = (rRect.getY() / rRect.GetSize().Height()); if(nId < MAX_STYLES_ENTRIES) { - if(m_pButtons[nId] == NULL) + if(m_pButtons[nId] == nullptr) { - m_pButtons[nId] = new MenuButton(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS); + m_pButtons[nId] = VclPtr<MenuButton>::Create(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS); m_pButtons[nId]->SetSizePixel(Size(BUTTON_WIDTH, rRect.GetSize().Height())); m_pButtons[nId]->SetPopupMenu(&m_aMenu); } @@ -918,7 +931,13 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference< SvxFontNameBox_Impl::~SvxFontNameBox_Impl() { + disposeOnce(); +} + +void SvxFontNameBox_Impl::dispose() +{ GetSubEdit()->RemoveEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont )); + FontNameBox::dispose(); } void SvxFontNameBox_Impl::FillList() @@ -1287,6 +1306,18 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, SvxColorWindow_Impl::~SvxColorWindow_Impl() { + disposeOnce(); +} + +void SvxColorWindow_Impl::dispose() +{ + mpColorSet.clear(); + mpRecentColorSet.clear(); + mpPaletteListBox.clear(); + mpButtonAutoColor.clear(); + mpButtonPicker.clear(); + mpAutomaticSeparator.clear(); + SfxPopupWindow::dispose(); } void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt ) @@ -1294,9 +1325,9 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt ) mpColorSet->KeyInput(rKEvt); } -SfxPopupWindow* SvxColorWindow_Impl::Clone() const +VclPtr<SfxPopupWindow> SvxColorWindow_Impl::Clone() const { - return new SvxColorWindow_Impl( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() ); + return VclPtr<SvxColorWindow_Impl>::Create( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() ); } IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet) @@ -1506,7 +1537,7 @@ Color BorderColorStatus::GetColor() SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) : SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ), - aFrameSet ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ), + aFrameSet ( VclPtr<SvxFrmValueSet_Impl>::Create(this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ), bParagraphMode(false) { BindListener(); @@ -1536,43 +1567,50 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram sal_uInt16 i = 0; for ( i=1; i<9; i++ ) - aFrameSet.InsertItem( i, aImgList.GetImage(i) ); + aFrameSet->InsertItem( i, aImgList.GetImage(i) ); //bParagraphMode should have been set in StateChanged if ( !bParagraphMode ) for ( i = 9; i < 13; i++ ) - aFrameSet.InsertItem( i, aImgList.GetImage(i) ); + aFrameSet->InsertItem( i, aImgList.GetImage(i) ); - aFrameSet.SetColCount( 4 ); - aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) ); + aFrameSet->SetColCount( 4 ); + aFrameSet->SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) ); - lcl_CalcSizeValueSet( *this, aFrameSet, Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() )); + lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() )); SetHelpId( HID_POPUP_FRAME ); SetText( SVX_RESSTR(RID_SVXSTR_FRAME) ); - aFrameSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) ); - aFrameSet.Show(); + aFrameSet->SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) ); + aFrameSet->Show(); } SvxFrameWindow_Impl::~SvxFrameWindow_Impl() { + disposeOnce(); +} + +void SvxFrameWindow_Impl::dispose() +{ UnbindListener(); + aFrameSet.disposeAndClear(); + SfxPopupWindow::dispose(); } -SfxPopupWindow* SvxFrameWindow_Impl::Clone() const +VclPtr<SfxPopupWindow> SvxFrameWindow_Impl::Clone() const { //! HACK: How do I get the Paragraph mode? - return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() ); + return VclPtr<SvxFrameWindow_Impl>::Create( GetId(), GetFrame(), GetParent() ); } vcl::Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow() { - return &aFrameSet; + return aFrameSet.get(); } void SvxFrameWindow_Impl::GetFocus() { - aFrameSet.GrabFocus(); + aFrameSet->GrabFocus(); } void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) @@ -1583,10 +1621,10 @@ void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) { aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) ); - sal_uInt16 nNumOfItems = aFrameSet.GetItemCount(); + sal_uInt16 nNumOfItems = aFrameSet->GetItemCount(); for( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i ) - aFrameSet.SetItemImage( i, aImgList.GetImage( i ) ); + aFrameSet->SetItemImage( i, aImgList.GetImage( i ) ); } } @@ -1611,8 +1649,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) *pRight = 0, *pTop = 0, *pBottom = 0; - sal_uInt16 nSel = aFrameSet.GetSelectItemId(); - sal_uInt16 nModifier = aFrameSet.GetModifier(); + sal_uInt16 nSel = aFrameSet->GetSelectItemId(); + sal_uInt16 nModifier = aFrameSet->GetModifier(); sal_uInt8 nValidFlags = 0; theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(), @@ -1706,7 +1744,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ - aFrameSet.SetNoSelection(); + aFrameSet->SetNoSelection(); SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), OUString( ".uno:SetBorderStyle" ), @@ -1717,7 +1755,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) void SvxFrameWindow_Impl::Resize() { const Size aSize(this->GetOutputSizePixel()); - aFrameSet.SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4)); + aFrameSet->SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4)); } void SvxFrameWindow_Impl::StateChanged( @@ -1731,27 +1769,27 @@ void SvxFrameWindow_Impl::StateChanged( { bParagraphMode = pItem->GetValue(); //initial calls mustn't insert or remove elements - if(aFrameSet.GetItemCount()) + if(aFrameSet->GetItemCount()) { - bool bTableMode = ( aFrameSet.GetItemCount() == 12 ); + bool bTableMode = ( aFrameSet->GetItemCount() == 12 ); bool bResize = false; if ( bTableMode && bParagraphMode ) { for ( sal_uInt16 i = 9; i < 13; i++ ) - aFrameSet.RemoveItem(i); + aFrameSet->RemoveItem(i); bResize = true; } else if ( !bTableMode && !bParagraphMode ) { for ( sal_uInt16 i = 9; i < 13; i++ ) - aFrameSet.InsertItem( i, aImgList.GetImage(i) ); + aFrameSet->InsertItem( i, aImgList.GetImage(i) ); bResize = true; } if ( bResize ) { - lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 )); + lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20, 20 )); } } } @@ -1761,7 +1799,7 @@ void SvxFrameWindow_Impl::StateChanged( void SvxFrameWindow_Impl::StartSelection() { - aFrameSet.StartSelection(); + aFrameSet->StartSelection(); } bool SvxFrameWindow_Impl::Close() @@ -1777,7 +1815,7 @@ static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ ) SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) : SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_AUTOSIZE ) ), - m_aLineStyleLb( this ) + m_aLineStyleLb( VclPtr<LineListBox>::Create(this) ) { try { @@ -1788,59 +1826,59 @@ SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame { } - m_aLineStyleLb.setPosSizePixel( 2, 2, 110, 140 ); + m_aLineStyleLb->setPosSizePixel( 2, 2, 110, 140 ); SetOutputSizePixel( Size( 114, 144 ) ); - m_aLineStyleLb.SetSourceUnit( FUNIT_TWIP ); - m_aLineStyleLb.SetNone( SVX_RESSTR(RID_SVXSTR_NONE) ); + m_aLineStyleLb->SetSourceUnit( FUNIT_TWIP ); + m_aLineStyleLb->SetNone( SVX_RESSTR(RID_SVXSTR_NONE) ); using namespace table::BorderLineStyle; - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED ); // Double lines - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP ); + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP ); // Engraved / Embossed - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15, + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15, &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor, &lcl_mediumColor ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15, + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15, &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor, &lcl_mediumColor ); // Inset / Outset - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10, + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10, &SvxBorderLine::lightColor, &SvxBorderLine::darkColor ); - m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10, + m_aLineStyleLb->InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10, &SvxBorderLine::darkColor, &SvxBorderLine::lightColor ); - m_aLineStyleLb.SetWidth( 20 ); // 1pt by default + m_aLineStyleLb->SetWidth( 20 ); // 1pt by default - m_aLineStyleLb.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) ); + m_aLineStyleLb->SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) ); SetHelpId( HID_POPUP_LINE ); SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) ); - m_aLineStyleLb.Show(); + m_aLineStyleLb->Show(); } -SfxPopupWindow* SvxLineWindow_Impl::Clone() const +VclPtr<SfxPopupWindow> SvxLineWindow_Impl::Clone() const { - return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() ); + return VclPtr<SvxLineWindow_Impl>::Create( GetId(), GetFrame(), GetParent() ); } IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl) { SvxLineItem aLineItem( SID_FRAME_LINESTYLE ); - SvxBorderStyle nStyle = SvxBorderStyle( m_aLineStyleLb.GetSelectEntryStyle() ); + SvxBorderStyle nStyle = SvxBorderStyle( m_aLineStyleLb->GetSelectEntryStyle() ); - if ( m_aLineStyleLb.GetSelectEntryPos( ) > 0 ) + if ( m_aLineStyleLb->GetSelectEntryPos( ) > 0 ) { SvxBorderLine aTmp; aTmp.SetBorderLineStyle( nStyle ); @@ -1867,7 +1905,7 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl) void SvxLineWindow_Impl::Resize() { - m_aLineStyleLb.Resize(); + m_aLineStyleLb->Resize(); } bool SvxLineWindow_Impl::Close() @@ -1877,12 +1915,12 @@ bool SvxLineWindow_Impl::Close() vcl::Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow() { - return &m_aLineStyleLb; + return m_aLineStyleLb.get(); } void SvxLineWindow_Impl::GetFocus() { - m_aLineStyleLb.GrabFocus(); + m_aLineStyleLb->GrabFocus(); } void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) @@ -2342,21 +2380,19 @@ void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx, IMPL_LINK_NOARG(SvxStyleToolBoxControl, VisibilityNotification) { - - sal_uInt16 i; - // Call ReBind() && UnBind() according to visibility SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>( GetToolBox().GetItemWindow( GetId() )); - if ( pBox->IsVisible() && !isBound() ) + + if ( pBox && pBox->IsVisible() && !isBound() ) { - for ( i=0; i<MAX_FAMILIES; i++ ) + for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) pBoundItems [i]->ReBind(); bindListener(); } - else if ( !pBox->IsVisible() && isBound() ) + else if ( (!pBox || !pBox->IsVisible()) && isBound() ) { - for ( i=0; i<MAX_FAMILIES; i++ ) + for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ ) pBoundItems[i]->UnBind(); unbindListener(); } @@ -2403,22 +2439,22 @@ void SvxStyleToolBoxControl::StateChanged( Update(); } -vcl::Window* SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent, - OUString( ".uno:StyleApply" ), - SFX_STYLE_FAMILY_PARA, - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame, - pImpl->aClearForm, - pImpl->aMore, - pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); + VclPtrInstance<SvxStyleBox_Impl> pBox( pParent, + OUString( ".uno:StyleApply" ), + SFX_STYLE_FAMILY_PARA, + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame, + pImpl->aClearForm, + pImpl->aMore, + pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); if( !pImpl->aDefaultStyles.empty()) pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] ); // Set visibility listener to bind/unbind controller pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification )); - return pBox; + return pBox.get(); } SvxFontNameToolBoxControl::SvxFontNameToolBoxControl( @@ -2463,12 +2499,12 @@ void SvxFontNameToolBoxControl::StateChanged( rTbx.EnableItem( nId, SfxItemState::DISABLED != eState ); } -vcl::Window* SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent, - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame,0); - return pBox; + VclPtrInstance<SvxFontNameBox_Impl> pBox( pParent, + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame,0); + return pBox.get(); } /* Note: @@ -2557,10 +2593,11 @@ SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const return SfxPopupWindowType::ONTIMEOUT; } -SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() { SvxColorWindow_Impl* pColorWin = - new SvxColorWindow_Impl( + VclPtr<SvxColorWindow_Impl>::Create( + m_aCommandURL, mPaletteManager, maBorderColorStatus, @@ -2735,9 +2772,9 @@ SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const return SfxPopupWindowType::ONCLICK; } -SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxFrameToolBoxControl::CreatePopupWindow() { - SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl( + VclPtr<SvxFrameWindow_Impl> pFrameWin = VclPtr<SvxFrameWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() ); pFrameWin->StartPopupMode( &GetToolBox(), @@ -2777,9 +2814,9 @@ SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const return SfxPopupWindowType::ONCLICK; } -SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxFrameLineStyleToolBoxControl::CreatePopupWindow() { - SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() ); + VclPtr<SvxLineWindow_Impl> pLineWin = VclPtr<SvxLineWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() ); pLineWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS | FLOATWIN_POPUPMODE_ALLOWTEAROFF | diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 0344ed8f9837..eb25ce945b3f 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -78,7 +78,7 @@ class FontHeightToolBoxControl : public svt::ToolboxController, using svt::ToolboxController::dispatchCommand; private: - SvxFontSizeBox_Impl* m_pBox; + VclPtr<SvxFontSizeBox_Impl> m_pBox; ::com::sun::star::awt::FontDescriptor m_aCurrentFont; }; @@ -334,8 +334,7 @@ throw (uno::RuntimeException, std::exception) svt::ToolboxController::dispose(); SolarMutexGuard aSolarMutexGuard; - delete m_pBox; - m_pBox = 0; + m_pBox.disposeAndClear(); } // XStatusListener @@ -401,7 +400,8 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind if ( pParent ) { SolarMutexGuard aSolarMutexGuard; - m_pBox = new SvxFontSizeBox_Impl( + m_pBox = VclPtr<SvxFontSizeBox_Impl>::Create( + pParent, uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ), m_xFrame, diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 618469133efc..a5f8b17e8352 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -139,10 +139,6 @@ FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, WinBits nStyle EnableAutocomplete(true, true); } -FindTextFieldControl::~FindTextFieldControl() -{ -} - void FindTextFieldControl::Remember_Impl(const OUString& rStr) { sal_uInt16 nCount = GetEntryCount(); @@ -419,8 +415,7 @@ void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeExce if (m_pFindTextFieldControl != nullptr) { SearchToolbarControllersManager::createControllersManager() .saveSearchHistory(m_pFindTextFieldControl); - delete m_pFindTextFieldControl; - m_pFindTextFieldControl = 0; + m_pFindTextFieldControl.disposeAndClear(); } } @@ -462,7 +457,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre if ( pParent ) { ToolBox* pToolbar = static_cast<ToolBox*>(pParent); - m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext ); + m_pFindTextFieldControl = VclPtr<FindTextFieldControl>::Create( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext ); Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200); m_pFindTextFieldControl->SetSizePixel( aSize ); @@ -665,8 +660,7 @@ void SAL_CALL MatchCaseToolboxController::dispose() throw ( css::uno::RuntimeExc svt::ToolboxController::dispose(); - delete m_pMatchCaseControl; - m_pMatchCaseControl = 0; + m_pMatchCaseControl.disposeAndClear(); } // XInitialization @@ -686,7 +680,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr if ( pParent ) { ToolBox* pToolbar = static_cast<ToolBox*>(pParent); - m_pMatchCaseControl = new CheckBox( pToolbar, 0 ); + m_pMatchCaseControl = VclPtr<CheckBox>::Create( pToolbar, 0 ); m_pMatchCaseControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_MATCHCASE ) ); Size aSize( m_pMatchCaseControl->GetOptimalSize() ); m_pMatchCaseControl->SetSizePixel( aSize ); @@ -954,7 +948,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception ) { - vcl::Window *pSL= new FixedText(VCLUnoHelper::GetWindow( Parent )); + VclPtr<vcl::Window> pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent )); pSL->SetSizePixel(Size(250, 25)); return VCLUnoHelper::GetInterface(pSL); } diff --git a/svx/source/tbxctrls/tbxalign.cxx b/svx/source/tbxctrls/tbxalign.cxx index 41571ee9699a..a4fdb266a15f 100644 --- a/svx/source/tbxctrls/tbxalign.cxx +++ b/svx/source/tbxctrls/tbxalign.cxx @@ -61,7 +61,7 @@ SfxPopupWindowType SvxTbxCtlAlign::GetPopupWindowType() const * rItemRect sind die Screen-Koordinaten */ -SfxPopupWindow* SvxTbxCtlAlign::CreatePopupWindow() +VclPtr<SfxPopupWindow> SvxTbxCtlAlign::CreatePopupWindow() { SolarMutexGuard aGuard; if ( GetSlotId() == SID_OBJECT_ALIGN ) |