diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /sw/source/ui | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'sw/source/ui')
107 files changed, 3441 insertions, 1115 deletions
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index a7616885ad21..d0dea5ffafbc 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -173,6 +173,23 @@ SwBreakDlg::SwBreakDlg( vcl::Window *pParent, SwWrtShell &rS ) m_pPageNumEdit->SetText(OUString()); } +SwBreakDlg::~SwBreakDlg() +{ + disposeOnce(); +} + +void SwBreakDlg::dispose() +{ + m_pLineBtn.clear(); + m_pColumnBtn.clear(); + m_pPageBtn.clear(); + m_pPageCollText.clear(); + m_pPageCollBox.clear(); + m_pPageNumBox.clear(); + m_pPageNumEdit.clear(); + SvxStandardDialog::dispose(); +} + void SwBreakDlg::CheckEnable() { bool bEnable = true; @@ -206,8 +223,4 @@ void SwBreakDlg::CheckEnable() m_pPageNumEdit->Enable(bEnable); } -SwBreakDlg::~SwBreakDlg() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 7ef726f89087..9e461fc14622 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -185,7 +185,23 @@ SwCharURLPage::SwCharURLPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwCharURLPage::~SwCharURLPage() { + disposeOnce(); +} + +void SwCharURLPage::dispose() +{ delete pINetItem; + m_pURLED.clear(); + m_pTextFT.clear(); + m_pTextED.clear(); + m_pNameED.clear(); + m_pTargetFrmLB.clear(); + m_pURLPB.clear(); + m_pEventPB.clear(); + m_pVisitedLB.clear(); + m_pNotVisitedLB.clear(); + m_pCharStyleContainer.clear(); + SfxTabPage::dispose(); } void SwCharURLPage::Reset(const SfxItemSet* rSet) @@ -279,10 +295,10 @@ bool SwCharURLPage::FillItemSet(SfxItemSet* rSet) return bModified; } -SfxTabPage* SwCharURLPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCharURLPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwCharURLPage( pParent, *rAttrSet ) ); + return VclPtr<SwCharURLPage>::Create( pParent, *rAttrSet ); } IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl) diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 20b8e9b3f01b..cd402d033ad0 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -62,7 +62,7 @@ const sal_uInt16 SwDropCapsPage::aPageRg[] = { class SwDropCapsPict : public Control { - SwDropCapsPage* mpPage; + VclPtr<SwDropCapsPage> mpPage; OUString maText; OUString maScriptText; Color maBackColor; @@ -72,7 +72,7 @@ class SwDropCapsPict : public Control long mnLineH; long mnTextH; sal_uInt16 mnDistance; - Printer* mpPrinter; + VclPtr<Printer> mpPrinter; bool mbDelPrinter; /// The _ScriptInfo structure holds information on where we change from one /// script to another. @@ -117,6 +117,7 @@ public: void SetDropCapsPage(SwDropCapsPage* pPage) { mpPage = pPage; } virtual ~SwDropCapsPict(); + virtual void dispose() SAL_OVERRIDE; void UpdatePaintSettings(); // also invalidates control! @@ -202,8 +203,15 @@ static void calcFontHeightAnyAscent( OutputDevice* _pWin, vcl::Font& _rFont, lon SwDropCapsPict::~SwDropCapsPict() { + disposeOnce(); +} + +void SwDropCapsPict::dispose() +{ if( mbDelPrinter ) - delete mpPrinter; + mpPrinter.disposeAndClear(); + mpPage.clear(); + Control::dispose(); } /// Get the details of the first script change. @@ -512,7 +520,7 @@ void SwDropCapsPict::_InitPrinter() SwDropCapsDlg::SwDropCapsDlg(vcl::Window *pParent, const SfxItemSet &rSet ) : SfxSingleTabDialog(pParent, rSet) { - SwDropCapsPage* pNewPage = static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet)); + VclPtr<SwDropCapsPage> pNewPage( static_cast<SwDropCapsPage*>( SwDropCapsPage::Create(get_content_area(), &rSet).get() ) ); pNewPage->SetFormat(false); SetTabPage(pNewPage); } @@ -568,6 +576,25 @@ SwDropCapsPage::SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet) SwDropCapsPage::~SwDropCapsPage() { + disposeOnce(); +} + +void SwDropCapsPage::dispose() +{ + m_pDropCapsBox.clear(); + m_pWholeWordCB.clear(); + m_pSwitchText.clear(); + m_pDropCapsField.clear(); + m_pLinesText.clear(); + m_pLinesField.clear(); + m_pDistanceText.clear(); + m_pDistanceField.clear(); + m_pTextText.clear(); + m_pTextEdit.clear(); + m_pTemplateText.clear(); + m_pTemplateBox.clear(); + m_pPict.clear(); + SfxTabPage::dispose(); } SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) @@ -578,10 +605,10 @@ SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) return LEAVE_PAGE; } -SfxTabPage* SwDropCapsPage::Create(vcl::Window *pParent, - const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwDropCapsPage::Create(vcl::Window *pParent, + const SfxItemSet *rSet) { - return new SwDropCapsPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwDropCapsPage(pParent, *rSet), SAL_NO_ACQUIRE); } bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 29429aa16da0..659ad559640e 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -101,15 +101,36 @@ SwParagraphNumTabPage::SwParagraphNumTabPage(vcl::Window* pParent, const SfxItem SwParagraphNumTabPage::~SwParagraphNumTabPage() { + disposeOnce(); } -SfxTabPage* SwParagraphNumTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rSet ) +void SwParagraphNumTabPage::dispose() { - return new SwParagraphNumTabPage(pParent, *rSet); + m_pOutlineStartBX.clear(); + m_pOutlineLvLB.clear(); + m_pNumberStyleBX.clear(); + m_pNumberStyleLB.clear(); + m_pEditNumStyleBtn.clear(); + m_pNewStartCB.clear(); + m_pNewStartBX.clear(); + m_pNewStartNumberCB.clear(); + m_pNewStartNF.clear(); + m_pCountParaFram.clear(); + m_pCountParaCB.clear(); + m_pRestartParaCountCB.clear(); + m_pRestartBX.clear(); + m_pRestartNF.clear(); + SfxTabPage::dispose(); } -bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet ) +VclPtr<SfxTabPage> SwParagraphNumTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rSet ) +{ + return VclPtr<SfxTabPage>( new SwParagraphNumTabPage(pParent, *rSet), + SAL_NO_ACQUIRE ); +} + +bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet ) { if( m_pOutlineLvLB->IsValueChangedFromSaved()) { diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index b5fb89873386..3757b44f846b 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -124,9 +124,25 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet) SwCondCollPage::~SwCondCollPage() { + disposeOnce(); +} + +void SwCondCollPage::dispose() +{ for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i) delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i)); + m_pConditionCB.clear(); + m_pContextFT.clear(); + m_pUsedFT.clear(); + m_pTbLinks.clear(); + m_pStyleFT.clear(); + m_pStyleLB.clear(); + m_pFilterLB.clear(); + m_pRemovePB.clear(); + m_pAssignPB.clear(); + + SfxTabPage::dispose(); } SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) @@ -137,9 +153,10 @@ SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) return LEAVE_PAGE; } -SfxTabPage* SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwCondCollPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwCondCollPage(pParent, *rSet), + SAL_NO_ACQUIRE); } bool SwCondCollPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 37da1bffff9a..13464804fa21 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -45,16 +45,16 @@ using namespace ::com::sun::star::beans; class SwTestAccountSettingsDialog : public SfxModalDialog { - VclMultiLineEdit* m_pErrorsED; + VclPtr<VclMultiLineEdit> m_pErrorsED; - PushButton* m_pStopPB; + VclPtr<PushButton> m_pStopPB; - FixedText* m_pEstablish; - FixedText* m_pFind; - FixedText* m_pResult1; - FixedText* m_pResult2; - FixedImage* m_pImage1; - FixedImage* m_pImage2; + VclPtr<FixedText> m_pEstablish; + VclPtr<FixedText> m_pFind; + VclPtr<FixedText> m_pResult1; + VclPtr<FixedText> m_pResult2; + VclPtr<FixedImage> m_pImage1; + VclPtr<FixedImage> m_pImage2; Image m_aCompletedImg; Image m_aFailedImg; @@ -62,7 +62,7 @@ class SwTestAccountSettingsDialog : public SfxModalDialog OUString m_sFailed; OUString m_sErrorServer; - SwMailConfigPage* m_pParent; + VclPtr<SwMailConfigPage> m_pParent; bool m_bStop; @@ -71,35 +71,37 @@ class SwTestAccountSettingsDialog : public SfxModalDialog DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*); public: SwTestAccountSettingsDialog(SwMailConfigPage* pParent); + virtual ~SwTestAccountSettingsDialog(); + virtual void dispose() SAL_OVERRIDE; }; class SwAuthenticationSettingsDialog : public SfxModalDialog { - CheckBox* m_pAuthenticationCB; - - RadioButton* m_pSeparateAuthenticationRB; - RadioButton* m_pSMTPAfterPOPRB; - - FixedText* m_pOutgoingServerFT; - FixedText* m_pUserNameFT; - Edit* m_pUserNameED; - FixedText* m_pOutPasswordFT; - Edit* m_pOutPasswordED; - - FixedText* m_pIncomingServerFT; - FixedText* m_pServerFT; - Edit* m_pServerED; - FixedText* m_pPortFT; - NumericField* m_pPortNF; - FixedText* m_pProtocolFT; - RadioButton* m_pPOP3RB; - RadioButton* m_pIMAPRB; - FixedText* m_pInUsernameFT; - Edit* m_pInUsernameED; - FixedText* m_pInPasswordFT; - Edit* m_pInPasswordED; - - OKButton* m_pOKPB; + VclPtr<CheckBox> m_pAuthenticationCB; + + VclPtr<RadioButton> m_pSeparateAuthenticationRB; + VclPtr<RadioButton> m_pSMTPAfterPOPRB; + + VclPtr<FixedText> m_pOutgoingServerFT; + VclPtr<FixedText> m_pUserNameFT; + VclPtr<Edit> m_pUserNameED; + VclPtr<FixedText> m_pOutPasswordFT; + VclPtr<Edit> m_pOutPasswordED; + + VclPtr<FixedText> m_pIncomingServerFT; + VclPtr<FixedText> m_pServerFT; + VclPtr<Edit> m_pServerED; + VclPtr<FixedText> m_pPortFT; + VclPtr<NumericField> m_pPortNF; + VclPtr<FixedText> m_pProtocolFT; + VclPtr<RadioButton> m_pPOP3RB; + VclPtr<RadioButton> m_pIMAPRB; + VclPtr<FixedText> m_pInUsernameFT; + VclPtr<Edit> m_pInUsernameED; + VclPtr<FixedText> m_pInPasswordFT; + VclPtr<Edit> m_pInPasswordED; + + VclPtr<OKButton> m_pOKPB; SwMailMergeConfigItem& rConfigItem; @@ -110,6 +112,7 @@ class SwAuthenticationSettingsDialog : public SfxModalDialog public: SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem); virtual ~SwAuthenticationSettingsDialog(); + virtual void dispose() SAL_OVERRIDE; }; SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ) : @@ -135,12 +138,28 @@ SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet SwMailConfigPage::~SwMailConfigPage() { + disposeOnce(); +} + +void SwMailConfigPage::dispose() +{ delete m_pConfigItem; + m_pDisplayNameED.clear(); + m_pAddressED.clear(); + m_pReplyToCB.clear(); + m_pReplyToFT.clear(); + m_pReplyToED.clear(); + m_pServerED.clear(); + m_pPortNF.clear(); + m_pSecureCB.clear(); + m_pServerAuthenticationPB.clear(); + m_pTestPB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwMailConfigPage(pParent, *rAttrSet); + return VclPtr<SwMailConfigPage>::Create(pParent, *rAttrSet); } bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ ) @@ -198,8 +217,8 @@ IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox) IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl) { - SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem); - aDlg.Execute(); + ScopedVclPtrInstance< SwAuthenticationSettingsDialog > aDlg(this, *m_pConfigItem); + aDlg->Execute(); return 0; } @@ -238,6 +257,25 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this ); } +SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog() +{ + disposeOnce(); +} + +void SwTestAccountSettingsDialog::dispose() +{ + m_pErrorsED.clear(); + m_pStopPB.clear(); + m_pEstablish.clear(); + m_pFind.clear(); + m_pResult1.clear(); + m_pResult2.clear(); + m_pImage1.clear(); + m_pImage2.clear(); + m_pParent.clear(); + SfxModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl) { m_bStop = true; @@ -414,6 +452,33 @@ SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog( SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog() { + disposeOnce(); +} + +void SwAuthenticationSettingsDialog::dispose() +{ + m_pAuthenticationCB.clear(); + m_pSeparateAuthenticationRB.clear(); + m_pSMTPAfterPOPRB.clear(); + m_pOutgoingServerFT.clear(); + m_pUserNameFT.clear(); + m_pUserNameED.clear(); + m_pOutPasswordFT.clear(); + m_pOutPasswordED.clear(); + m_pIncomingServerFT.clear(); + m_pServerFT.clear(); + m_pServerED.clear(); + m_pPortFT.clear(); + m_pPortNF.clear(); + m_pProtocolFT.clear(); + m_pPOP3RB.clear(); + m_pIMAPRB.clear(); + m_pInUsernameFT.clear(); + m_pInUsernameED.clear(); + m_pInPasswordFT.clear(); + m_pInPasswordED.clear(); + m_pOKPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, OKHdl_Impl) diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index daa523e1b87f..f60ab8839d86 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -128,7 +128,17 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt SwCompatibilityOptPage::~SwCompatibilityOptPage() { + disposeOnce(); +} + +void SwCompatibilityOptPage::dispose() +{ delete m_pImpl; + m_pMain.clear(); + m_pFormattingLB.clear(); + m_pOptionsLB.clear(); + m_pDefaultPB.clear(); + SfxTabPage::dispose(); } sal_uLong convertBools2Ulong_Impl @@ -309,9 +319,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl) IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl) { - MessageDialog aQuery(this, "QueryDefaultCompatDialog", - "modules/swriter/ui/querydefaultcompatdialog.ui"); - if (aQuery.Execute() == RET_YES) + ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog", + "modules/swriter/ui/querydefaultcompatdialog.ui"); + if (aQuery->Execute() == RET_YES) { for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin(); pItem != m_pImpl->m_aList.end(); ++pItem ) @@ -400,9 +410,9 @@ void SwCompatibilityOptPage::WriteOptions() pItem->m_bExpandWordSpace ); } -SfxTabPage* SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCompatibilityOptPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return new SwCompatibilityOptPage( pParent, *rAttrSet ); + return VclPtr<SwCompatibilityOptPage>::Create( pParent, *rAttrSet ); } bool SwCompatibilityOptPage::FillItemSet( SfxItemSet* ) diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 05adb529f089..0ce66ad8b874 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -125,10 +125,34 @@ SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet) m_pShowStandardizedPageCount->SetClickHdl(aLink); } -SfxTabPage* SwLoadOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +SwLoadOptPage::~SwLoadOptPage() { - return new SwLoadOptPage(pParent, *rAttrSet ); + disposeOnce(); +} + +void SwLoadOptPage::dispose() +{ + m_pAlwaysRB.clear(); + m_pRequestRB.clear(); + m_pNeverRB.clear(); + m_pAutoUpdateFields.clear(); + m_pAutoUpdateCharts.clear(); + m_pMetricLB.clear(); + m_pTabFT.clear(); + m_pTabMF.clear(); + m_pUseSquaredPageMode.clear(); + m_pUseCharUnit.clear(); + m_pWordCountED.clear(); + m_pShowStandardizedPageCount.clear(); + m_pStandardizedPageSizeNF.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwLoadOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SwLoadOptPage>::Create(pParent, *rAttrSet ); } IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl) @@ -517,17 +541,41 @@ SwCaptionOptPage::SwCaptionOptPage( vcl::Window* pParent, const SfxItemSet& rSet SwCaptionOptPage::~SwCaptionOptPage() { + disposeOnce(); +} + +void SwCaptionOptPage::dispose() +{ DelUserData(); delete pMgr; + m_pCheckLB.clear(); + m_pLbCaptionOrder.clear(); + m_pPreview.clear(); + m_pSettingsGroup.clear(); + m_pCategoryBox.clear(); + m_pFormatText.clear(); + m_pFormatBox.clear(); + m_pNumberingSeparatorFT.clear(); + m_pNumberingSeparatorED.clear(); + m_pTextText.clear(); + m_pTextEdit.clear(); + m_pPosBox.clear(); + m_pNumCapt.clear(); + m_pLbLevel.clear(); + m_pEdDelim.clear(); + m_pCategory.clear(); + m_pCharStyleLB.clear(); + m_pApplyBorderCB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwCaptionOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwCaptionOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return new SwCaptionOptPage(pParent, *rAttrSet ); + return VclPtr<SwCaptionOptPage>::Create( pParent, *rAttrSet ); } -bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) +bool SwCaptionOptPage::FillItemSet( SfxItemSet* ) { bool bRet = false; SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 28533ce50e0f..8a595b87285f 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -156,12 +156,38 @@ SwContentOptPage::SwContentOptPage( vcl::Window* pParent, SwContentOptPage::~SwContentOptPage() { + disposeOnce(); } -SfxTabPage* SwContentOptPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +void SwContentOptPage::dispose() { - return new SwContentOptPage(pParent, *rAttrSet); + m_pCrossCB.clear(); + m_pHScrollBox.clear(); + m_pVScrollBox.clear(); + m_pAnyRulerCB.clear(); + m_pHRulerCBox.clear(); + m_pHMetric.clear(); + m_pVRulerCBox.clear(); + m_pVRulerRightCBox.clear(); + m_pVMetric.clear(); + m_pSmoothCBox.clear(); + m_pGrfCB.clear(); + m_pTblCB.clear(); + m_pDrwCB.clear(); + m_pFldNameCB.clear(); + m_pPostItCB.clear(); + m_pSettingsFrame.clear(); + m_pSettingsLabel.clear(); + m_pMetricLabel.clear(); + m_pMetricLB.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwContentOptPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) +{ + return VclPtr<SwContentOptPage>::Create(pParent, *rAttrSet); } static void lcl_SelectMetricLB(ListBox* rMetric, sal_uInt16 nSID, const SfxItemSet& rSet) @@ -352,6 +378,36 @@ SwAddPrinterTabPage::SwAddPrinterTabPage(vcl::Window* pParent, m_pProspectCB_RTL->Show(aCTLOptions.IsCTLFontEnabled()); } +SwAddPrinterTabPage::~SwAddPrinterTabPage() +{ + disposeOnce(); +} + +void SwAddPrinterTabPage::dispose() +{ + m_pGrfCB.clear(); + m_pCtrlFldCB.clear(); + m_pBackgroundCB.clear(); + m_pBlackFontCB.clear(); + m_pPrintHiddenTextCB.clear(); + m_pPrintTextPlaceholderCB.clear(); + m_pPagesFrame.clear(); + m_pLeftPageCB.clear(); + m_pRightPageCB.clear(); + m_pProspectCB.clear(); + m_pProspectCB_RTL.clear(); + m_pCommentsFrame.clear(); + m_pNoRB.clear(); + m_pOnlyRB.clear(); + m_pEndRB.clear(); + m_pEndPageRB.clear(); + m_pInMarginsRB.clear(); + m_pPrintEmptyPagesCB.clear(); + m_pPaperFromSetupCB.clear(); + m_pFaxLB.clear(); + SfxTabPage::dispose(); +} + void SwAddPrinterTabPage::SetPreview(bool bPrev) { bPreview = bPrev; @@ -359,10 +415,11 @@ void SwAddPrinterTabPage::SetPreview(bool bPrev) m_pPagesFrame->Enable(!bPreview); } -SfxTabPage* SwAddPrinterTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwAddPrinterTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwAddPrinterTabPage( pParent, *rAttrSet ) ); + return VclPtr<SfxTabPage>(new SwAddPrinterTabPage( pParent, *rAttrSet ), + SAL_NO_ACQUIRE); } bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet ) @@ -573,17 +630,35 @@ SwStdFontTabPage::SwStdFontTabPage( vcl::Window* pParent, SwStdFontTabPage::~SwStdFontTabPage() { - delete pFontList; - if (bDeletePrinter) - { - delete pPrt; - } + disposeOnce(); } -SfxTabPage* SwStdFontTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +void SwStdFontTabPage::dispose() { - return new SwStdFontTabPage(pParent, *rAttrSet); + delete pFontList; + if (bDeletePrinter) + pPrt.disposeAndClear(); + pLabelFT.clear(); + pStandardBox.clear(); + pStandardHeightLB.clear(); + pTitleBox.clear(); + pTitleHeightLB.clear(); + pListBox.clear(); + pListHeightLB.clear(); + pLabelBox.clear(); + pLabelHeightLB.clear(); + pIdxBox.clear(); + pIndexHeightLB.clear(); + pDocOnlyCB.clear(); + pStandardPB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwStdFontTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>(new SwStdFontTabPage(pParent, *rAttrSet), + SAL_NO_ACQUIRE); } static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType, @@ -758,7 +833,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) if (bDeletePrinter) { - delete pPrt; + pPrt.disposeAndClear(); } if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem)) @@ -771,7 +846,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - pPrt = new SfxPrinter(pPrinterSet); + pPrt = VclPtr<SfxPrinter>::Create(pPrinterSet); } delete pFontList; pFontList = new FontList( pPrt ); @@ -1082,12 +1157,33 @@ SwTableOptionsTabPage::SwTableOptionsTabPage( vcl::Window* pParent, const SfxIte SwTableOptionsTabPage::~SwTableOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwTableOptionsTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +void SwTableOptionsTabPage::dispose() { - return new SwTableOptionsTabPage(pParent, *rAttrSet ); + pHeaderCB.clear(); + pRepeatHeaderCB.clear(); + pDontSplitCB.clear(); + pBorderCB.clear(); + pNumFormattingCB.clear(); + pNumFmtFormattingCB.clear(); + pNumAlignmentCB.clear(); + pRowMoveMF.clear(); + pColMoveMF.clear(); + pRowInsertMF.clear(); + pColInsertMF.clear(); + pFixRB.clear(); + pFixPropRB.clear(); + pVarRB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTableOptionsTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>( new SwTableOptionsTabPage(pParent, *rAttrSet ), + SAL_NO_ACQUIRE ); } bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -1318,11 +1414,36 @@ SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( vcl::Window* pParent, SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +void SwShdwCrsrOptionsTabPage::dispose() { - return new SwShdwCrsrOptionsTabPage( pParent, *rSet ); + m_pParaCB.clear(); + m_pSHyphCB.clear(); + m_pSpacesCB.clear(); + m_pHSpacesCB.clear(); + m_pTabCB.clear(); + m_pBreakCB.clear(); + m_pCharHiddenCB.clear(); + m_pFldHiddenCB.clear(); + m_pFldHiddenParaCB.clear(); + m_pDirectCursorFrame.clear(); + m_pOnOffCB.clear(); + m_pFillMarginRB.clear(); + m_pFillIndentRB.clear(); + m_pFillTabRB.clear(); + m_pFillSpaceRB.clear(); + m_pCursorProtFrame.clear(); + m_pCrsrInProtCB.clear(); + m_pIgnoreProtCB.clear(); + m_pMathBaselineAlignmentCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) +{ + return VclPtr<SfxTabPage>(new SwShdwCrsrOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwShdwCrsrOptionsTabPage::PageCreated( const SfxAllItemSet& aSet ) @@ -1659,7 +1780,7 @@ namespace } SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, - const SfxItemSet& rSet ) + const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptRedLinePage", "modules/swriter/ui/optredlinepage.ui" , &rSet) , sNone(SW_RESSTR(SW_STR_NONE)) @@ -1731,11 +1852,29 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) +void SwRedlineOptionsTabPage::dispose() { - return new SwRedlineOptionsTabPage( pParent, *rSet ); + pInsertLB.clear(); + pInsertColorLB.clear(); + pInsertedPreviewWN.clear(); + pDeletedLB.clear(); + pDeletedColorLB.clear(); + pDeletedPreviewWN.clear(); + pChangedLB.clear(); + pChangedColorLB.clear(); + pChangedPreviewWN.clear(); + pMarkPosLB.clear(); + pMarkColorLB.clear(); + pMarkPreviewWN.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) +{ + return VclPtr<SfxTabPage>( new SwRedlineOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); } bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2232,11 +2371,24 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage( vcl::Window* pParent, const S SwCompareOptionsTabPage::~SwCompareOptionsTabPage() { + disposeOnce(); } -SfxTabPage* SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +void SwCompareOptionsTabPage::dispose() { - return new SwCompareOptionsTabPage( pParent, *rAttrSet ); + m_pAutoRB.clear(); + m_pWordRB.clear(); + m_pCharRB.clear(); + m_pRsidCB.clear(); + m_pIgnoreCB.clear(); + m_pLenNF.clear(); + m_pStoreRsidCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) +{ + return VclPtr<SfxTabPage>(new SwCompareOptionsTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE); } bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2367,10 +2519,30 @@ SwTestTabPage::SwTestTabPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) } -SfxTabPage* SwTestTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +SwTestTabPage::~SwTestTabPage() +{ + disposeOnce(); +} + +void SwTestTabPage::dispose() +{ + m_pTest1CBox.clear(); + m_pTest2CBox.clear(); + m_pTest3CBox.clear(); + m_pTest4CBox.clear(); + m_pTest5CBox.clear(); + m_pTest6CBox.clear(); + m_pTest7CBox.clear(); + m_pTest8CBox.clear(); + m_pTest9CBox.clear(); + m_pTest10CBox.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTestTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return new SwTestTabPage(pParent, *rAttrSet); + return VclPtr<SwTestTabPage>::Create(pParent, *rAttrSet); } bool SwTestTabPage::FillItemSet( SfxItemSet* rCoreSet ) diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 63bcbca4c579..e69a4ead6fb0 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -199,7 +199,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) Size aSize = pHeaderTreeContainer->LogicToPixel(Size(182 , 102), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pListLB = new SwAddrSourceLB(*pHeaderTreeContainer); + m_pListLB = VclPtr<SwAddrSourceLB>::Create(*pHeaderTreeContainer); m_pListLB->InsertHeaderEntry(m_sName + "\t" + m_sTable); m_pListLB->setColSizes(); @@ -265,6 +265,11 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) SwAddressListDialog::~SwAddressListDialog() { + disposeOnce(); +} + +void SwAddressListDialog::dispose() +{ SvTreeListEntry* pEntry = m_pListLB->First(); while(pEntry) { @@ -272,7 +277,16 @@ SwAddressListDialog::~SwAddressListDialog() delete pUserData; pEntry = m_pListLB->Next( pEntry ); } - delete m_pListLB; + m_pListLB.disposeAndClear(); + m_pAddressPage.clear(); + m_pDescriptionFI.clear(); + m_pLoadListPB.clear(); + m_pCreateListPB.clear(); + m_pFilterPB.clear(); + m_pEditPB.clear(); + m_pTablePB.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) @@ -344,8 +358,9 @@ IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl) IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton) { OUString sInputURL; - boost::scoped_ptr<SwCreateAddressListDialog> pDlg( - new SwCreateAddressListDialog( + VclPtr<SwCreateAddressListDialog> pDlg( + VclPtr<SwCreateAddressListDialog>::Create( + pButton, sInputURL, m_pAddressPage->GetWizard()->GetConfigItem())); @@ -443,8 +458,9 @@ IMPL_LINK(SwAddressListDialog, EditHdl_Impl, PushButton*, pButton) pUserData->xColumnsSupplier.clear(); pUserData->xConnection.clear(); // will automatically close if it was the las reference - boost::scoped_ptr<SwCreateAddressListDialog> pDlg( - new SwCreateAddressListDialog( + VclPtr<SwCreateAddressListDialog> pDlg( + VclPtr<SwCreateAddressListDialog>::Create( + pButton, pUserData->sURL, m_pAddressPage->GetWizard()->GetConfigItem())); @@ -562,7 +578,7 @@ void SwAddressListDialog::DetectTablesAndQueries( if(nTables > 1 && bWidthDialog) { //now call the table select dialog - if more than one table exists - boost::scoped_ptr<SwSelectDBTableDialog> pDlg(new SwSelectDBTableDialog(this, pUserData->xConnection)); + VclPtrInstance<SwSelectDBTableDialog> pDlg(this, pUserData->xConnection); const OUString sTable = SvTabListBox::GetEntryText(pSelect, ITEMID_TABLE - 1); if(!sTable.isEmpty()) pDlg->SetSelectedTable(sTable, pUserData->nCommandType == CommandType::TABLE); diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx index 50812efef486..708876448579 100644 --- a/sw/source/ui/dbui/addresslistdialog.hxx +++ b/sw/source/ui/dbui/addresslistdialog.hxx @@ -46,17 +46,17 @@ class SwAddrSourceLB; class SwAddressListDialog : public SfxModalDialog { - FixedText* m_pDescriptionFI; + VclPtr<FixedText> m_pDescriptionFI; - SwAddrSourceLB* m_pListLB; + VclPtr<SwAddrSourceLB> m_pListLB; - PushButton* m_pLoadListPB; - PushButton* m_pCreateListPB; - PushButton* m_pFilterPB; - PushButton* m_pEditPB; - PushButton* m_pTablePB; + VclPtr<PushButton> m_pLoadListPB; + VclPtr<PushButton> m_pCreateListPB; + VclPtr<PushButton> m_pFilterPB; + VclPtr<PushButton> m_pEditPB; + VclPtr<PushButton> m_pTablePB; - OKButton* m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sName; OUString m_sTable; @@ -66,7 +66,7 @@ class SwAddressListDialog : public SfxModalDialog bool m_bInSelectHdl; - SwMailMergeAddressBlockPage* m_pAddressPage; + VclPtr<SwMailMergeAddressBlockPage> m_pAddressPage; ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext> m_xDBContext; @@ -87,6 +87,7 @@ class SwAddressListDialog : public SfxModalDialog public: SwAddressListDialog(SwMailMergeAddressBlockPage* pParent); virtual ~SwAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> GetSource(); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 347ce0a4a5dc..1d8a63103802 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -46,11 +46,11 @@ using namespace ::com::sun::star::ui::dialogs; class SwAddressControl_Impl : public Control { - ScrollBar *m_pScrollBar; - Window *m_pWindow; + VclPtr<ScrollBar> m_pScrollBar; + VclPtr<Window> m_pWindow; - ::std::vector<FixedText*> m_aFixedTexts; - ::std::vector<Edit*> m_aEdits; + ::std::vector<VclPtr<FixedText> > m_aFixedTexts; + ::std::vector<VclPtr<Edit> > m_aEdits; SwCSVData* m_pData; Size m_aWinOutputSize; @@ -74,6 +74,7 @@ class SwAddressControl_Impl : public Control public: SwAddressControl_Impl(vcl::Window* pParent , WinBits nBits ); virtual ~SwAddressControl_Impl(); + virtual void dispose() SAL_OVERRIDE; void SetData(SwCSVData& rDBData); @@ -85,8 +86,8 @@ public: SwAddressControl_Impl::SwAddressControl_Impl(vcl::Window* pParent, WinBits nBits ) : Control(pParent, nBits), - m_pScrollBar(new ScrollBar(this)), - m_pWindow(new vcl::Window(this, WB_DIALOGCONTROL)), + m_pScrollBar(VclPtr<ScrollBar>::Create(this)), + m_pWindow(VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL)), m_pData(0), m_nLineHeight(0), m_nCurrentDataSet(0), @@ -113,14 +114,20 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAddressControlImpl(v SwAddressControl_Impl::~SwAddressControl_Impl() { - ::std::vector<FixedText*>::iterator aTextIter; - for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) - delete *aTextIter; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) - delete *aEditIter; - delete m_pScrollBar; - delete m_pWindow; + disposeOnce(); +} + +void SwAddressControl_Impl::dispose() +{ + for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) + aTextIter->disposeAndClear(); + m_aFixedTexts.clear(); + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + aEditIter->disposeAndClear(); + m_aEdits.clear(); + m_pScrollBar.clear(); + m_pWindow.clear(); + Control::dispose(); } void SwAddressControl_Impl::SetData(SwCSVData& rDBData) @@ -129,13 +136,11 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) //when the address data is updated then remove the controls an build again if(m_aFixedTexts.size()) { - ::std::vector<FixedText*>::iterator aTextIter; - for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) - delete *aTextIter; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) - delete *aEditIter; + for(auto aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter) + aTextIter->disposeAndClear(); m_aFixedTexts.clear(); + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + aEditIter->disposeAndClear(); m_aEdits.clear(); m_bNoDataSet = true; } @@ -176,8 +181,8 @@ void SwAddressControl_Impl::SetData(SwCSVData& rDBData) aHeaderIter != m_pData->aDBColumnHeaders.end(); ++aHeaderIter, nEDYPos += m_nLineHeight, nFTYPos += m_nLineHeight, nLines++) { - FixedText* pNewFT = new FixedText(m_pWindow, WB_RIGHT); - Edit* pNewED = new Edit(m_pWindow, WB_BORDER); + VclPtr<FixedText> pNewFT = VclPtr<FixedText>::Create(m_pWindow, WB_RIGHT); + VclPtr<Edit> pNewED = VclPtr<Edit>::Create(m_pWindow, WB_BORDER); //set nLines a position identifier - used in the ModifyHdl pNewED->SetData(reinterpret_cast<void*>(nLines)); pNewED->SetGetFocusHdl(aFocusLink); @@ -244,9 +249,8 @@ void SwAddressControl_Impl::SetCurrentDataSet(sal_uInt32 nSet) OSL_ENSURE(m_pData->aDBData.size() > m_nCurrentDataSet, "wrong data set index"); if(m_pData->aDBData.size() > m_nCurrentDataSet) { - ::std::vector<Edit*>::iterator aEditIter; sal_uInt32 nIndex = 0; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex) + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex) { OSL_ENSURE(nIndex < m_pData->aDBData[m_nCurrentDataSet].size(), "number of columns doesn't match number of Edits"); @@ -380,8 +384,7 @@ void SwAddressControl_Impl::Resize() { long nNewEditSize = aSize.Width() - (*m_aEdits.begin())->GetPosPixel().X() - nScrollBarWidth - 6; - ::std::vector<Edit*>::iterator aEditIter; - for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) + for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) { (*aEditIter)->SetSizePixel(Size(nNewEditSize, (*aEditIter)->GetSizePixel().Height())); } @@ -495,8 +498,25 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( SwCreateAddressListDialog::~SwCreateAddressListDialog() { + disposeOnce(); +} + +void SwCreateAddressListDialog::dispose() +{ delete m_pCSVData; - delete m_pFindDlg; + m_pAddressControl.clear(); + m_pNewPB.clear(); + m_pDeletePB.clear(); + m_pFindPB.clear(); + m_pCustomizePB.clear(); + m_pStartPB.clear(); + m_pPrevPB.clear(); + m_pSetNoNF.clear(); + m_pNextPB.clear(); + m_pEndPB.clear(); + m_pOK.clear(); + m_pFindDlg.disposeAndClear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwCreateAddressListDialog, NewHdl_Impl) @@ -541,7 +561,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl) { if(!m_pFindDlg) { - m_pFindDlg = new SwFindEntryDialog(this); + m_pFindDlg = VclPtr<SwFindEntryDialog>::Create(this); ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox(); ::std::vector< OUString >::iterator aHeaderIter; for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin(); @@ -558,7 +578,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl) IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCustomizeAddressListDialog> pDlg(new SwCustomizeAddressListDialog(pButton, *m_pCSVData)); + VclPtrInstance< SwCustomizeAddressListDialog > pDlg(pButton, *m_pCSVData); if(RET_OK == pDlg->Execute()) { delete m_pCSVData; @@ -751,6 +771,23 @@ SwFindEntryDialog::SwFindEntryDialog(SwCreateAddressListDialog* pParent) m_pCancel->SetClickHdl(LINK(this, SwFindEntryDialog, CloseHdl_Impl)); } +SwFindEntryDialog::~SwFindEntryDialog() +{ + disposeOnce(); +} + +void SwFindEntryDialog::dispose() +{ + m_pFindED.clear(); + m_pFindOnlyCB.clear(); + m_pFindOnlyLB.clear(); + m_pFindPB.clear(); + m_pCancel.clear(); + m_pParent.clear(); + ModelessDialog::dispose(); +} + + IMPL_LINK_NOARG(SwFindEntryDialog, FindHdl_Impl) { sal_Int32 nColumn = -1; diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx index 393c5a79b71e..ac6ed41cfab2 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.hxx +++ b/sw/source/ui/dbui/createaddresslistdialog.hxx @@ -40,27 +40,27 @@ struct SwCSVData class SwFindEntryDialog; class SwCreateAddressListDialog : public SfxModalDialog { - SwAddressControl_Impl* m_pAddressControl; + VclPtr<SwAddressControl_Impl> m_pAddressControl; - PushButton *m_pNewPB; - PushButton *m_pDeletePB; - PushButton *m_pFindPB; - PushButton *m_pCustomizePB; + VclPtr<PushButton> m_pNewPB; + VclPtr<PushButton> m_pDeletePB; + VclPtr<PushButton> m_pFindPB; + VclPtr<PushButton> m_pCustomizePB; - PushButton *m_pStartPB; - PushButton *m_pPrevPB; - NumericField *m_pSetNoNF; - PushButton *m_pNextPB; - PushButton *m_pEndPB; + VclPtr<PushButton> m_pStartPB; + VclPtr<PushButton> m_pPrevPB; + VclPtr<NumericField> m_pSetNoNF; + VclPtr<PushButton> m_pNextPB; + VclPtr<PushButton> m_pEndPB; - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sAddressListFilterName; OUString m_sURL; SwCSVData* m_pCSVData; - SwFindEntryDialog* m_pFindDlg; + VclPtr<SwFindEntryDialog> m_pFindDlg; DECL_LINK(NewHdl_Impl, void *); DECL_LINK(DeleteHdl_Impl, void *); @@ -76,6 +76,7 @@ public: SwCreateAddressListDialog( vcl::Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig); virtual ~SwCreateAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; const OUString& GetURL() const { return m_sURL; } void Find( const OUString& rSearch, sal_Int32 nColumn); @@ -83,14 +84,14 @@ public: class SwFindEntryDialog : public ModelessDialog { - Edit* m_pFindED; - CheckBox* m_pFindOnlyCB; - ListBox* m_pFindOnlyLB; + VclPtr<Edit> m_pFindED; + VclPtr<CheckBox> m_pFindOnlyCB; + VclPtr<ListBox> m_pFindOnlyLB; - PushButton* m_pFindPB; - CancelButton* m_pCancel; + VclPtr<PushButton> m_pFindPB; + VclPtr<CancelButton> m_pCancel; - SwCreateAddressListDialog* m_pParent; + VclPtr<SwCreateAddressListDialog> m_pParent; DECL_LINK(FindHdl_Impl, void *); DECL_LINK(FindEnableHdl_Impl, void *); @@ -98,6 +99,8 @@ class SwFindEntryDialog : public ModelessDialog public: SwFindEntryDialog(SwCreateAddressListDialog* pParent); + virtual ~SwFindEntryDialog(); + virtual void dispose() SAL_OVERRIDE; ListBox& GetFieldsListBox() { diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx index c812fcd37a1a..7ade01841ee4 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx @@ -24,7 +24,6 @@ #include <vcl/msgbox.hxx> #include <dbui.hrc> #include <helpid.h> -#include <boost/scoped_ptr.hpp> SwCustomizeAddressListDialog::SwCustomizeAddressListDialog( vcl::Window* pParent, const SwCSVData& rOldData) @@ -61,8 +60,21 @@ SwCustomizeAddressListDialog::SwCustomizeAddressListDialog( SwCustomizeAddressListDialog::~SwCustomizeAddressListDialog() { + disposeOnce(); } +void SwCustomizeAddressListDialog::dispose() +{ + m_pFieldsLB.clear(); + m_pAddPB.clear(); + m_pDeletePB.clear(); + m_pRenamePB.clear(); + m_pUpPB.clear(); + m_pDownPB.clear(); + SfxModalDialog::dispose(); +} + + IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl) { UpdateButtons(); @@ -76,11 +88,11 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) if(nPos == LISTBOX_ENTRY_NOTFOUND) nPos = 0; - boost::scoped_ptr<SwAddRenameEntryDialog> pDlg; + ScopedVclPtr<SwAddRenameEntryDialog> pDlg; if (bRename) - pDlg.reset(new SwRenameEntryDialog(pButton, m_pNewData->aDBColumnHeaders)); + pDlg.reset(VclPtr<SwRenameEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); else - pDlg.reset(new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders)); + pDlg.reset(VclPtr<SwAddEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders)); if(bRename) { OUString aTemp = m_pFieldsLB->GetEntry(nPos); @@ -111,7 +123,6 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) m_pFieldsLB->InsertEntry(sNew, nPos); m_pFieldsLB->SelectEntryPos(nPos); } - pDlg.reset(); UpdateButtons(); return 0; } @@ -184,6 +195,18 @@ SwAddRenameEntryDialog::SwAddRenameEntryDialog( ModifyHdl_Impl(m_pFieldNameED); } +SwAddRenameEntryDialog::~SwAddRenameEntryDialog() +{ + disposeOnce(); +} + +void SwAddRenameEntryDialog::dispose() +{ + m_pFieldNameED.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); +} + IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit*, pEdit) { OUString sEntry = pEdit->GetText(); diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx index e0592085047f..e943f657b3f3 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx @@ -29,14 +29,14 @@ struct SwCSVData; class SwCustomizeAddressListDialog : public SfxModalDialog { - ListBox* m_pFieldsLB; + VclPtr<ListBox> m_pFieldsLB; - PushButton* m_pAddPB; - PushButton* m_pDeletePB; - PushButton* m_pRenamePB; + VclPtr<PushButton> m_pAddPB; + VclPtr<PushButton> m_pDeletePB; + VclPtr<PushButton> m_pRenamePB; - PushButton* m_pUpPB; - PushButton* m_pDownPB; + VclPtr<PushButton> m_pUpPB; + VclPtr<PushButton> m_pDownPB; SwCSVData* m_pNewData; @@ -49,20 +49,24 @@ class SwCustomizeAddressListDialog : public SfxModalDialog public: SwCustomizeAddressListDialog(vcl::Window* pParent, const SwCSVData& rOldData); virtual ~SwCustomizeAddressListDialog(); + virtual void dispose() SAL_OVERRIDE; SwCSVData* GetNewData() { return m_pNewData;} }; class SwAddRenameEntryDialog : public SfxModalDialog { - Edit* m_pFieldNameED; - OKButton* m_pOK; + VclPtr<Edit> m_pFieldNameED; + VclPtr<OKButton> m_pOK; const std::vector< OUString >& m_rCSVHeader; DECL_LINK(ModifyHdl_Impl, Edit*); protected: SwAddRenameEntryDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, const std::vector< OUString >& rCSVHeader); + virtual ~SwAddRenameEntryDialog(); + virtual void dispose() SAL_OVERRIDE; + public: void SetFieldName(const OUString& rName) {m_pFieldNameED->SetText(rName);} OUString GetFieldName() const {return m_pFieldNameED->GetText();}; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 29aa77145fdb..43c1e656c188 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -413,10 +413,41 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot() { + disposeOnce(); +} + +void SwInsertDBColAutoPilot::dispose() +{ delete pTblSet; delete pRep; delete pTAutoFmt; + m_pRbAsTable.clear(); + m_pRbAsField.clear(); + m_pRbAsText.clear(); + m_pHeadFrame.clear(); + m_pLbTblDbColumn.clear(); + m_pLbTxtDbColumn.clear(); + m_pFormatFrame.clear(); + m_pRbDbFmtFromDb.clear(); + m_pRbDbFmtFromUsr.clear(); + m_pLbDbFmtFromUsr.clear(); + m_pIbDbcolToEdit.clear(); + m_pEdDbText.clear(); + m_pFtDbParaColl.clear(); + m_pLbDbParaColl.clear(); + m_pIbDbcolAllTo.clear(); + m_pIbDbcolOneTo.clear(); + m_pIbDbcolOneFrom.clear(); + m_pIbDbcolAllFrom.clear(); + m_pFtTableCol.clear(); + m_pLbTableCol.clear(); + m_pCbTableHeadon.clear(); + m_pRbHeadlColnms.clear(); + m_pRbHeadlEmpty.clear(); + m_pPbTblFormat.clear(); + m_pPbTblAutofmt.clear(); + SfxModalDialog::dispose(); } IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton ) @@ -768,9 +799,9 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) ListBox* pGetBox = pBox == m_pLbDbFmtFromUsr ? ( m_pRbAsTable->IsChecked() ? ( 0 == m_pLbTableCol->GetEntryData( 0 ) - ? m_pLbTblDbColumn - : m_pLbTableCol ) - : m_pLbTxtDbColumn ) + ? m_pLbTblDbColumn.get() + : m_pLbTableCol.get() ) + : m_pLbTxtDbColumn.get() ) : pBox; SwInsDBColumn aSrch( pGetBox->GetSelectEntry(), 0 ); @@ -818,7 +849,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) // to know later on, what ListBox was the "active", a Flag // is remembered in the 1st entry - void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol : 0; + void* pPtr = pBox == m_pLbTableCol ? m_pLbTableCol.get() : 0; m_pLbTableCol->SetEntryData( 0, pPtr ); } return 0; diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx index 4eb019abf21e..fd9e2eb34f5c 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx @@ -81,11 +81,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequen SwDBTablePreviewDialog::~SwDBTablePreviewDialog() { + disposeOnce(); +} + +void SwDBTablePreviewDialog::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); m_xFrame->dispose(); } + m_pDescriptionFI.clear(); + m_pBeamerWIN.clear(); + SfxModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx index e99b7f457525..bae176de7b74 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.hxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx @@ -31,14 +31,15 @@ namespace com{ namespace sun{ namespace star{ class SwDBTablePreviewDialog : public SfxModalDialog { - FixedText* m_pDescriptionFI; - vcl::Window* m_pBeamerWIN; + VclPtr<FixedText> m_pDescriptionFI; + VclPtr<vcl::Window> m_pBeamerWIN; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame; public: SwDBTablePreviewDialog(vcl::Window* pParent, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rValues ); virtual ~SwDBTablePreviewDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index 9a577c41edb1..068b08ffd54f 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -101,19 +101,19 @@ SwMailMergeWizard::~SwMailMergeWizard() { } -OWizardPage* SwMailMergeWizard::createPage(WizardState _nState) +VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState) { - OWizardPage* pRet = 0; + VclPtr<OWizardPage> pRet; switch(_nState) { - case MM_DOCUMENTSELECTPAGE : pRet = new SwMailMergeDocSelectPage(this); break; - case MM_OUTPUTTYPETPAGE : pRet = new SwMailMergeOutputTypePage(this); break; - case MM_ADDRESSBLOCKPAGE : pRet = new SwMailMergeAddressBlockPage(this); break; - case MM_GREETINGSPAGE : pRet = new SwMailMergeGreetingsPage(this); break; - case MM_LAYOUTPAGE : pRet = new SwMailMergeLayoutPage(this); break; - case MM_PREPAREMERGEPAGE : pRet = new SwMailMergePrepareMergePage(this); break; - case MM_MERGEPAGE : pRet = new SwMailMergeMergePage(this); break; - case MM_OUTPUTPAGE : pRet = new SwMailMergeOutputPage(this); break; + case MM_DOCUMENTSELECTPAGE : pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this); break; + case MM_OUTPUTTYPETPAGE : pRet = VclPtr<SwMailMergeOutputTypePage>::Create(this); break; + case MM_ADDRESSBLOCKPAGE : pRet = VclPtr<SwMailMergeAddressBlockPage>::Create(this); break; + case MM_GREETINGSPAGE : pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this); break; + case MM_LAYOUTPAGE : pRet = VclPtr<SwMailMergeLayoutPage>::Create(this); break; + case MM_PREPAREMERGEPAGE : pRet = VclPtr<SwMailMergePrepareMergePage>::Create(this); break; + case MM_MERGEPAGE : pRet = VclPtr<SwMailMergeMergePage>::Create(this); break; + case MM_OUTPUTPAGE : pRet = VclPtr<SwMailMergeOutputPage>::Create(this); break; } OSL_ENSURE(pRet, "no page created in ::createPage"); return pRet; diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 44d7ff52b384..37a06cc86276 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -93,6 +93,32 @@ SwMailMergeAddressBlockPage::SwMailMergeAddressBlockPage( SwMailMergeWizard* _pP m_pNextSetIB->SetClickHdl(aLink); } +SwMailMergeAddressBlockPage::~SwMailMergeAddressBlockPage() +{ + disposeOnce(); +} + +void SwMailMergeAddressBlockPage::dispose() +{ + m_pAddressListPB.clear(); + m_pCurrentAddressFI.clear(); + m_pStep2.clear(); + m_pStep3.clear(); + m_pStep4.clear(); + m_pSettingsFI.clear(); + m_pAddressCB.clear(); + m_pSettingsWIN.clear(); + m_pSettingsPB.clear(); + m_pHideEmptyParagraphsCB.clear(); + m_pAssignPB.clear(); + m_pPreviewWIN.clear(); + m_pDocumentIndexFI.clear(); + m_pPrevSetIB.clear(); + m_pNextSetIB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + bool SwMailMergeAddressBlockPage::canAdvance() const { return m_pWizard->GetConfigItem().GetResultSet().is(); @@ -137,7 +163,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl) { try { - boost::scoped_ptr<SwAddressListDialog> xAddrDialog(new SwAddressListDialog(this)); + VclPtrInstance< SwAddressListDialog > xAddrDialog(this); if(RET_OK == xAddrDialog->Execute()) { SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem(); @@ -163,8 +189,8 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl) IMPL_LINK(SwMailMergeAddressBlockPage, SettingsHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwSelectAddressBlockDialog> pDlg( - new SwSelectAddressBlockDialog(pButton, m_pWizard->GetConfigItem())); + VclPtr<SwSelectAddressBlockDialog> pDlg( + VclPtr<SwSelectAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem())); SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem(); pDlg->SetAddressBlocks(rConfig.GetAddressBlocks(), m_pSettingsWIN->GetSelectedAddress()); pDlg->SetSettings(rConfig.IsIncludeCountry(), rConfig.GetExcludeCountry()); @@ -193,8 +219,8 @@ IMPL_LINK(SwMailMergeAddressBlockPage, AssignHdl_Impl, PushButton*, pButton) SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem(); const sal_uInt16 nSel = m_pSettingsWIN->GetSelectedAddress(); const uno::Sequence< OUString> aBlocks = rConfigItem.GetAddressBlocks(); - boost::scoped_ptr<SwAssignFieldsDialog> pDlg( - new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true)); + VclPtr<SwAssignFieldsDialog> pDlg( + VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true)); if(RET_OK == pDlg->Execute()) { //preview update @@ -330,6 +356,20 @@ SwSelectAddressBlockDialog::SwSelectAddressBlockDialog( SwSelectAddressBlockDialog::~SwSelectAddressBlockDialog() { + disposeOnce(); +} + +void SwSelectAddressBlockDialog::dispose() +{ + m_pPreview.clear(); + m_pNewPB.clear(); + m_pCustomizePB.clear(); + m_pDeletePB.clear(); + m_pNeverRB.clear(); + m_pAlwaysRB.clear(); + m_pDependentRB.clear(); + m_pCountryED.clear(); + SfxModalDialog::dispose(); } void SwSelectAddressBlockDialog::SetAddressBlocks(const uno::Sequence< OUString>& rBlocks, @@ -413,8 +453,8 @@ IMPL_LINK(SwSelectAddressBlockDialog, NewCustomizeHdl_Impl, PushButton*, pButton SwCustomizeAddressBlockDialog::DialogType nType = bCustomize ? SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT : SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW; - boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg( - new SwCustomizeAddressBlockDialog(pButton,m_rConfig,nType)); + VclPtr<SwCustomizeAddressBlockDialog> pDlg( + VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton,m_rConfig,nType)); if(bCustomize) { pDlg->SetAddress(m_aAddressBlocks[m_pPreview->GetSelectedAddress()]); @@ -533,6 +573,26 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( SwCustomizeAddressBlockDialog::~SwCustomizeAddressBlockDialog() { + disposeOnce(); +} + +void SwCustomizeAddressBlockDialog::dispose() +{ + m_pAddressElementsFT.clear(); + m_pAddressElementsLB.clear(); + m_pInsertFieldIB.clear(); + m_pRemoveFieldIB.clear(); + m_pDragFT.clear(); + m_pDragED.clear(); + m_pUpIB.clear(); + m_pLeftIB.clear(); + m_pRightIB.clear(); + m_pDownIB.clear(); + m_pFieldFT.clear(); + m_pFieldCB.clear(); + m_pPreviewWIN.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, OKHdl_Impl) @@ -746,13 +806,13 @@ OUString SwCustomizeAddressBlockDialog::GetAddress() class SwAssignFieldsControl : public Control { friend class SwAssignFieldsDialog; - ScrollBar m_aVScroll; - HeaderBar m_aHeaderHB; - Window m_aWindow; + VclPtr<ScrollBar> m_aVScroll; + VclPtr<HeaderBar> m_aHeaderHB; + VclPtr<Window> m_aWindow; - ::std::vector<FixedText*> m_aFieldNames; - ::std::vector<ListBox*> m_aMatches; - ::std::vector<FixedText*> m_aPreviews; + ::std::vector<VclPtr<FixedText> > m_aFieldNames; + ::std::vector<VclPtr<ListBox> > m_aMatches; + ::std::vector<VclPtr<FixedText> > m_aPreviews; SwMailMergeConfigItem* m_rConfigItem; @@ -773,6 +833,7 @@ class SwAssignFieldsControl : public Control public: SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits); virtual ~SwAssignFieldsControl(); + virtual void dispose() SAL_OVERRIDE; void Init(SwMailMergeConfigItem& rConfigItem); void SetModifyHdl(const Link& rModifyHdl) @@ -791,23 +852,23 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwAssignFieldsControl( SwAssignFieldsControl::SwAssignFieldsControl(vcl::Window* pParent, WinBits nBits) : Control(pParent, nBits | WB_DIALOGCONTROL | WB_TABSTOP | WB_DIALOGCONTROL), - m_aVScroll(this), - m_aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), - m_aWindow(this, WB_BORDER | WB_DIALOGCONTROL), + m_aVScroll(VclPtr<ScrollBar>::Create(this)), + m_aHeaderHB(VclPtr<HeaderBar>::Create(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER)), + m_aWindow(VclPtr<vcl::Window>::Create(this, WB_BORDER | WB_DIALOGCONTROL)), m_rConfigItem(NULL), m_nLBStartTopPos(0), m_nYOffset(0), m_nFirstYPos(0) { - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); Size aOutputSize(GetOutputSize()); - m_aVScroll.Show(); - m_aHeaderHB.SetSizePixel( + m_aVScroll->Show(); + m_aHeaderHB->SetSizePixel( Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.Show(); - m_aWindow.SetPosPixel(Point( 0, nHBHeight) ); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aWindow.Show(); + m_aHeaderHB->Show(); + m_aWindow->SetPosPixel(Point( 0, nHBHeight) ); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->Show(); } Size SwAssignFieldsControl::GetOptimalSize() const @@ -819,7 +880,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) { m_rConfigItem = &rConfigItem; Size aOutputSize(GetOutputSize()); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); //get the name of the default headers const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); @@ -845,9 +906,9 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i) { const OUString rHeader = rHeaders.GetString( i ); - FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER); + VclPtr<FixedText> pNewText = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER); pNewText->SetText("<" + rHeader + ">"); - ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); + VclPtr<ListBox> pNewLB = VclPtr<ListBox>::Create(m_aWindow.get(), WB_DROPDOWN | WB_VCENTER | WB_TABSTOP); pNewText->set_mnemonic_widget(pNewLB); pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE)); pNewLB->SelectEntryPos(0); @@ -861,7 +922,7 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField) pNewLB->InsertEntry(pFields[nField]); - FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER); + VclPtr<FixedText> pNewPreview = VclPtr<FixedText>::Create(m_aWindow.get(), WB_VCENTER); pNewText->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewLB->SetSizePixel(Size(nControlWidth - 6, nControlHeight)); pNewPreview->SetSizePixel(Size(aOutputSize.Width() - 2 * nControlWidth, nControlHeight)); @@ -911,26 +972,38 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem) pNewPreview->Show(); pNewPreview->SetPosPixel(Point(2 * nControlWidth + 6, nMove)); } - m_aVScroll.SetRange(Range(0, rHeaders.Count())); - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.EnableDrag(); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); + m_aVScroll->SetRange(Range(0, rHeaders.Count())); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->EnableDrag(); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); } SwAssignFieldsControl::~SwAssignFieldsControl() { - ::std::vector<FixedText*>::iterator aFIIter; - for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) - delete *aFIIter; - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) - delete *aLBIter; - for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) - delete *aFIIter; + disposeOnce(); +} + +void SwAssignFieldsControl::dispose() +{ + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) + aFIIter->disposeAndClear(); + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) + aLBIter->disposeAndClear(); + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) + aFIIter->disposeAndClear(); + + m_aFieldNames.clear(); + m_aMatches.clear(); + m_aPreviews.clear(); + + m_aVScroll.disposeAndClear(); + m_aHeaderHB.disposeAndClear(); + m_aWindow.disposeAndClear(); + Control::dispose(); } void SwAssignFieldsControl::Resize() @@ -938,22 +1011,22 @@ void SwAssignFieldsControl::Resize() Window::Resize(); Size aOutputSize = GetOutputSize(); - long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height(); + long nHBHeight = m_aHeaderHB->CalcWindowSizePixel().Height(); - m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aWindow->SetSizePixel(Size(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); - m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight)); - m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); + m_aVScroll->SetPosPixel(Point(aOutputSize.Width() - m_aVScroll->GetSizePixel().Width(), nHBHeight)); + m_aVScroll->SetSizePixel(Size(m_aVScroll->GetSizePixel().Width(), aOutputSize.Height() - nHBHeight)); if(m_nYOffset) - m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); - m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize()); - m_aVScroll.DoScroll(0); + m_aVScroll->SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset); + m_aVScroll->SetVisibleSize(m_aVScroll->GetPageSize()); + m_aVScroll->DoScroll(0); sal_Int32 nColWidth = aOutputSize.Width() / 3; - m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); - m_aHeaderHB.SetItemSize(1, nColWidth); - m_aHeaderHB.SetItemSize(2, nColWidth); - m_aHeaderHB.SetItemSize(3, nColWidth); + m_aHeaderHB->SetSizePixel(Size(aOutputSize.Width(), nHBHeight)); + m_aHeaderHB->SetItemSize(1, nColWidth); + m_aHeaderHB->SetItemSize(2, nColWidth); + m_aHeaderHB->SetItemSize(3, nColWidth); if (m_aFieldNames.empty() || m_aMatches.empty()) return; @@ -961,16 +1034,14 @@ void SwAssignFieldsControl::Resize() long nControlHeight = std::max(m_aFieldNames[0]->get_preferred_size().Height(), m_aMatches[0]->get_preferred_size().Height()); - ::std::vector<FixedText*>::iterator aFIIter; - for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) (*aFIIter)->SetSizePixel(Size(nColWidth - 6, nControlHeight)); - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) { long nPosY = (*aLBIter)->GetPosPixel().Y(); (*aLBIter)->SetPosSizePixel(Point(nColWidth, nPosY), Size(nColWidth - 6, nControlHeight)); } - for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) { long nPosY = (*aFIIter)->GetPosPixel().Y(); (*aFIIter)->SetPosSizePixel(Point(2 * nColWidth + 6, nPosY), Size(nColWidth, nControlHeight)); @@ -988,7 +1059,7 @@ void SwAssignFieldsControl::Command( const CommandEvent& rCEvt ) const CommandWheelData* pWheelData = rCEvt.GetWheelData(); if(pWheelData && !pWheelData->IsHorz() && CommandWheelMode::ZOOM != pWheelData->GetMode()) { - HandleScrollCommand( rCEvt, 0, &m_aVScroll ); + HandleScrollCommand( rCEvt, 0, m_aVScroll.get() ); } } break; @@ -1014,15 +1085,15 @@ bool SwAssignFieldsControl::PreNotify( NotifyEvent& rNEvt ) void SwAssignFieldsControl::MakeVisible( sal_Int32 nIndex ) { - long nThumb = m_aVScroll.GetThumbPos(); - long nPage = m_aVScroll.GetPageSize(); + long nThumb = m_aVScroll->GetThumbPos(); + long nPage = m_aVScroll->GetPageSize(); if(nThumb > nIndex) - m_aVScroll.SetThumbPos( nIndex ); + m_aVScroll->SetThumbPos( nIndex ); else if( (nThumb + nPage) < nIndex) - m_aVScroll.SetThumbPos( nIndex - nPage ); + m_aVScroll->SetThumbPos( nIndex - nPage ); else return; - ScrollHdl_Impl( &m_aVScroll ); + ScrollHdl_Impl( m_aVScroll.get() ); } IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll) @@ -1035,14 +1106,11 @@ IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll) long nMove = m_nFirstYPos - (*m_aMatches.begin())->GetPosPixel().Y() - (nThumb * m_nYOffset); SetUpdateMode(false); - long nIndex; - ::std::vector<FixedText*>::iterator aFIIter; - for(nIndex = 0, aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter, ++nIndex) + for(auto aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter) lcl_Move(*aFIIter, nMove); - ::std::vector<ListBox*>::iterator aLBIter; - for(nIndex = 0, aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter) lcl_Move(*aLBIter, nMove); - for(nIndex = 0, aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter, ++nIndex) + for(auto aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter) lcl_Move(*aFIIter, nMove); SetUpdateMode(true); @@ -1071,9 +1139,8 @@ IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox) } } } - ::std::vector<ListBox*>::iterator aLBIter; sal_Int32 nIndex = 0; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) { if(*aLBIter == pBox) { @@ -1090,8 +1157,7 @@ IMPL_LINK(SwAssignFieldsControl, GotFocusHdl_Impl, ListBox*, pBox) if(0 != (GETFOCUS_TAB & pBox->GetGetFocusFlags())) { sal_Int32 nIndex = 0; - ::std::vector<ListBox*>::iterator aLBIter; - for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) + for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) { if(*aLBIter == pBox) { @@ -1132,13 +1198,13 @@ SwAssignFieldsDialog::SwAssignFieldsDialog( sAddressElement = SW_RESSTR(ST_SALUTATIONELEMENT); } - Size aOutputSize(m_pFieldsControl->m_aHeaderHB.GetSizePixel()); + Size aOutputSize(m_pFieldsControl->m_aHeaderHB->GetSizePixel()); sal_Int32 nFirstWidth; sal_Int32 nSecondWidth = nFirstWidth = aOutputSize.Width() / 3; const HeaderBarItemBits nHeadBits = HeaderBarItemBits::VCENTER | HeaderBarItemBits::FIXED| HeaderBarItemBits::FIXEDPOS; - m_pFieldsControl->m_aHeaderHB.InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); - m_pFieldsControl->m_aHeaderHB.InsertItem( 3, sPreview, + m_pFieldsControl->m_aHeaderHB->InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HeaderBarItemBits::LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); + m_pFieldsControl->m_aHeaderHB->InsertItem( 3, sPreview, aOutputSize.Width() - nFirstWidth - nSecondWidth, nHeadBits|HeaderBarItemBits::LEFT); m_pFieldsControl->SetModifyHdl(LINK(this, SwAssignFieldsDialog, AssignmentModifyHdl_Impl )); @@ -1150,6 +1216,17 @@ SwAssignFieldsDialog::SwAssignFieldsDialog( SwAssignFieldsDialog::~SwAssignFieldsDialog() { + disposeOnce(); +} + +void SwAssignFieldsDialog::dispose() +{ + m_pMatchingFI.clear(); + m_pFieldsControl.clear(); + m_pPreviewFI.clear(); + m_pPreviewWIN.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments() @@ -1157,9 +1234,8 @@ uno::Sequence< OUString > SwAssignFieldsDialog::CreateAssignments() uno::Sequence< OUString > aAssignments( m_rConfigItem.GetDefaultAddressHeaders().Count()); OUString* pAssignments = aAssignments.getArray(); - ::std::vector<ListBox*>::iterator aLBIter; sal_Int32 nIndex = 0; - for(aLBIter = m_pFieldsControl->m_aMatches.begin(); + for(auto aLBIter = m_pFieldsControl->m_aMatches.begin(); aLBIter != m_pFieldsControl->m_aMatches.end(); ++aLBIter, ++nIndex) { @@ -1202,6 +1278,18 @@ DDListBox::DDListBox(vcl::Window* pParent, WinBits nStyle) } +DDListBox::~DDListBox() +{ + disposeOnce(); +} + +void DDListBox::dispose() +{ + m_pParentDialog.clear(); + SvTreeListBox::dispose(); +} + + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeDDListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_TABSTOP; @@ -1246,6 +1334,19 @@ AddressMultiLineEdit::AddressMultiLineEdit(vcl::Window* pParent, WinBits nBits) EnableFocusSelectionHide(false); } +AddressMultiLineEdit::~AddressMultiLineEdit() +{ + disposeOnce(); +} + +void AddressMultiLineEdit::dispose() +{ + EndListening(*GetTextEngine()); + m_pParentDialog.clear(); + VclMultiLineEdit::dispose(); +} + + Size AddressMultiLineEdit::GetOptimalSize() const { return LogicToPixel(Size(160, 60), MAP_APPFONT); @@ -1265,11 +1366,6 @@ void AddressMultiLineEdit::SetAddressDialog(SwCustomizeAddressBlockDialog *pPare m_pParentDialog = pParent; } -AddressMultiLineEdit::~AddressMultiLineEdit() -{ - EndListening(*GetTextEngine()); -} - void AddressMultiLineEdit::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { if (m_aSelectionLink.IsSet() && dynamic_cast<const TextHint*>(&rHint)) diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 6824bed6f897..2f93a750f1b1 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -37,31 +37,31 @@ class SwMailMergeConfigItem; class SwMailMergeAddressBlockPage : public svt::OWizardPage { - PushButton* m_pAddressListPB; - FixedText* m_pCurrentAddressFI; + VclPtr<PushButton> m_pAddressListPB; + VclPtr<FixedText> m_pCurrentAddressFI; - VclContainer* m_pStep2; - VclContainer* m_pStep3; - VclContainer* m_pStep4; + VclPtr<VclContainer> m_pStep2; + VclPtr<VclContainer> m_pStep3; + VclPtr<VclContainer> m_pStep4; - FixedText* m_pSettingsFI; - CheckBox* m_pAddressCB; - SwAddressPreview* m_pSettingsWIN; - PushButton* m_pSettingsPB; - CheckBox* m_pHideEmptyParagraphsCB; + VclPtr<FixedText> m_pSettingsFI; + VclPtr<CheckBox> m_pAddressCB; + VclPtr<SwAddressPreview> m_pSettingsWIN; + VclPtr<PushButton> m_pSettingsPB; + VclPtr<CheckBox> m_pHideEmptyParagraphsCB; - PushButton* m_pAssignPB; + VclPtr<PushButton> m_pAssignPB; - SwAddressPreview* m_pPreviewWIN; - FixedText* m_pDocumentIndexFI; - PushButton* m_pPrevSetIB; - PushButton* m_pNextSetIB; + VclPtr<SwAddressPreview> m_pPreviewWIN; + VclPtr<FixedText> m_pDocumentIndexFI; + VclPtr<PushButton> m_pPrevSetIB; + VclPtr<PushButton> m_pNextSetIB; OUString m_sDocument; OUString m_sCurrentAddress; OUString m_sChangeAddress; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(AddressListHdl_Impl, void *); DECL_LINK(SettingsHdl_Impl, PushButton*); @@ -79,20 +79,22 @@ class SwMailMergeAddressBlockPage : public svt::OWizardPage public: SwMailMergeAddressBlockPage(SwMailMergeWizard* _pParent); + virtual ~SwMailMergeAddressBlockPage(); + virtual void dispose() SAL_OVERRIDE; SwMailMergeWizard* GetWizard() { return m_pWizard; } }; class SwSelectAddressBlockDialog : public SfxModalDialog { - SwAddressPreview* m_pPreview; - PushButton* m_pNewPB; - PushButton* m_pCustomizePB; - PushButton* m_pDeletePB; + VclPtr<SwAddressPreview> m_pPreview; + VclPtr<PushButton> m_pNewPB; + VclPtr<PushButton> m_pCustomizePB; + VclPtr<PushButton> m_pDeletePB; - RadioButton* m_pNeverRB; - RadioButton* m_pAlwaysRB; - RadioButton* m_pDependentRB; - Edit* m_pCountryED; + VclPtr<RadioButton> m_pNeverRB; + VclPtr<RadioButton> m_pAlwaysRB; + VclPtr<RadioButton> m_pDependentRB; + VclPtr<Edit> m_pCountryED; com::sun::star::uno::Sequence< OUString> m_aAddressBlocks; SwMailMergeConfigItem& m_rConfig; @@ -106,6 +108,7 @@ class SwSelectAddressBlockDialog : public SfxModalDialog public: SwSelectAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig); virtual ~SwSelectAddressBlockDialog(); + virtual void dispose() SAL_OVERRIDE; void SetAddressBlocks(const com::sun::star::uno::Sequence< OUString>& rBlocks, sal_uInt16 nSelected); @@ -119,9 +122,11 @@ public: class SwCustomizeAddressBlockDialog; class DDListBox : public SvTreeListBox { - SwCustomizeAddressBlockDialog* m_pParentDialog; + VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog; public: DDListBox(vcl::Window* pParent, const WinBits nStyle); + virtual ~DDListBox(); + virtual void dispose() SAL_OVERRIDE; void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); @@ -136,7 +141,7 @@ public: class AddressMultiLineEdit : public VclMultiLineEdit, public SfxListener { Link m_aSelectionLink; - SwCustomizeAddressBlockDialog* m_pParentDialog; + VclPtr<SwCustomizeAddressBlockDialog> m_pParentDialog; using VclMultiLineEdit::Notify; @@ -147,6 +152,7 @@ protected: public: AddressMultiLineEdit(vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER); virtual ~AddressMultiLineEdit(); + virtual void dispose() SAL_OVERRIDE; void SetAddressDialog(SwCustomizeAddressBlockDialog *pParent); @@ -183,26 +189,26 @@ public: GREETING_MALE }; private: - FixedText* m_pAddressElementsFT; - DDListBox* m_pAddressElementsLB; + VclPtr<FixedText> m_pAddressElementsFT; + VclPtr<DDListBox> m_pAddressElementsLB; - PushButton* m_pInsertFieldIB; - PushButton* m_pRemoveFieldIB; + VclPtr<PushButton> m_pInsertFieldIB; + VclPtr<PushButton> m_pRemoveFieldIB; - FixedText* m_pDragFT; - AddressMultiLineEdit* m_pDragED; - PushButton* m_pUpIB; - PushButton* m_pLeftIB; - PushButton* m_pRightIB; - PushButton* m_pDownIB; + VclPtr<FixedText> m_pDragFT; + VclPtr<AddressMultiLineEdit> m_pDragED; + VclPtr<PushButton> m_pUpIB; + VclPtr<PushButton> m_pLeftIB; + VclPtr<PushButton> m_pRightIB; + VclPtr<PushButton> m_pDownIB; - FixedText* m_pFieldFT; - ComboBox* m_pFieldCB; + VclPtr<FixedText> m_pFieldFT; + VclPtr<ComboBox> m_pFieldCB; TextFilter m_aTextFilter; - SwAddressPreview* m_pPreviewWIN; + VclPtr<SwAddressPreview> m_pPreviewWIN; - OKButton* m_pOK; + VclPtr<OKButton> m_pOK; ::std::vector<OUString> m_aSalutations; ::std::vector<OUString> m_aPunctuations; @@ -228,6 +234,7 @@ private: public: SwCustomizeAddressBlockDialog(vcl::Window* pParent, SwMailMergeConfigItem& rConfig, DialogType); virtual ~SwCustomizeAddressBlockDialog(); + virtual void dispose() SAL_OVERRIDE; void SetAddress(const OUString& rAddress); OUString GetAddress(); @@ -236,14 +243,13 @@ public: class SwAssignFieldsControl; class SwAssignFieldsDialog : public SfxModalDialog { - FixedText *m_pMatchingFI; - SwAssignFieldsControl *m_pFieldsControl; + VclPtr<FixedText> m_pMatchingFI; + VclPtr<SwAssignFieldsControl> m_pFieldsControl; - FixedText *m_pPreviewFI; - SwAddressPreview *m_pPreviewWIN; + VclPtr<FixedText> m_pPreviewFI; + VclPtr<SwAddressPreview> m_pPreviewWIN; - - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; OUString m_sNone; OUString m_rPreviewString; @@ -260,6 +266,7 @@ public: const OUString& rPreview, bool bIsAddressBlock); virtual ~SwAssignFieldsDialog(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index 85440c6a4833..50fe45c17446 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -92,6 +92,21 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pParent) SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage() { + disposeOnce(); +} + +void SwMailMergeDocSelectPage::dispose() +{ + m_pCurrentDocRB.clear(); + m_pNewDocRB.clear(); + m_pLoadDocRB.clear(); + m_pLoadTemplateRB.clear(); + m_pRecentDocRB.clear(); + m_pBrowseDocPB.clear(); + m_pBrowseTemplatePB.clear(); + m_pRecentDocLB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton) @@ -111,7 +126,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) if(bTemplate) { m_pLoadTemplateRB->Check(); - boost::scoped_ptr<SfxNewFileDialog> pNewFileDlg(new SfxNewFileDialog(this, 0)); + VclPtrInstance< SfxNewFileDialog > pNewFileDlg(this, 0); sal_uInt16 nRet = pNewFileDlg->Execute(); if(RET_TEMPLATE_LOAD == nRet) bTemplate = false; diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx index b2e241270faf..931fc4dbfce4 100644 --- a/sw/source/ui/dbui/mmdocselectpage.hxx +++ b/sw/source/ui/dbui/mmdocselectpage.hxx @@ -28,21 +28,21 @@ class SwMailMergeWizard; class SwMailMergeDocSelectPage : public svt::OWizardPage { - RadioButton* m_pCurrentDocRB; - RadioButton* m_pNewDocRB; - RadioButton* m_pLoadDocRB; - RadioButton* m_pLoadTemplateRB; - RadioButton* m_pRecentDocRB; + VclPtr<RadioButton> m_pCurrentDocRB; + VclPtr<RadioButton> m_pNewDocRB; + VclPtr<RadioButton> m_pLoadDocRB; + VclPtr<RadioButton> m_pLoadTemplateRB; + VclPtr<RadioButton> m_pRecentDocRB; - PushButton* m_pBrowseDocPB; - PushButton* m_pBrowseTemplatePB; + VclPtr<PushButton> m_pBrowseDocPB; + VclPtr<PushButton> m_pBrowseTemplatePB; - ListBox* m_pRecentDocLB; + VclPtr<ListBox> m_pRecentDocLB; OUString m_sLoadFileName; OUString m_sLoadTemplateName; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(DocSelectHdl, RadioButton*); DECL_LINK(FileSelectHdl, PushButton*); @@ -52,6 +52,7 @@ class SwMailMergeDocSelectPage : public svt::OWizardPage public: SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeDocSelectPage(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx index 7355613e3ad2..717b1e1be2a3 100644 --- a/sw/source/ui/dbui/mmgreetingspage.cxx +++ b/sw/source/ui/dbui/mmgreetingspage.cxx @@ -106,8 +106,8 @@ IMPL_LINK_NOARG(SwGreetingsHandler, IndividualHdl_Impl) IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCustomizeAddressBlockDialog> pDlg( - new SwCustomizeAddressBlockDialog(pButton, m_pWizard->GetConfigItem(), + VclPtr<SwCustomizeAddressBlockDialog> pDlg( + VclPtr<SwCustomizeAddressBlockDialog>::Create(pButton, m_pWizard->GetConfigItem(), pButton == m_pMalePB ? SwCustomizeAddressBlockDialog::GREETING_MALE : SwCustomizeAddressBlockDialog::GREETING_FEMALE )); @@ -133,8 +133,8 @@ void SwGreetingsHandler::UpdatePreview() IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, PushButton*, pButton) { const OUString sPreview(m_pFemaleLB->GetSelectEntry() + "\n" + m_pMaleLB->GetSelectEntry()); - boost::scoped_ptr<SwAssignFieldsDialog> pDlg( - new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), sPreview, false)); + VclPtr<SwAssignFieldsDialog> pDlg( + VclPtr<SwAssignFieldsDialog>::Create(pButton, m_pWizard->GetConfigItem(), sPreview, false)); if(RET_OK == pDlg->Execute()) { UpdatePreview(); @@ -292,6 +292,18 @@ SwMailMergeGreetingsPage::SwMailMergeGreetingsPage(SwMailMergeWizard* _pParent) SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage() { + disposeOnce(); +} + +void SwMailMergeGreetingsPage::dispose() +{ + m_pPreviewFI.clear(); + m_pPreviewWIN.clear(); + m_pAssignPB.clear(); + m_pDocumentIndexFI.clear(); + m_pPrevSetIB.clear(); + m_pNextSetIB.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeGreetingsPage::ActivatePage() @@ -472,6 +484,15 @@ SwMailBodyDialog::SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* _pWi SwMailBodyDialog::~SwMailBodyDialog() { + disposeOnce(); +} + +void SwMailBodyDialog::dispose() +{ + m_pBodyFT.clear(); + m_pBodyMLE.clear(); + m_pOK.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, CheckBox*, pBox) diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx index d74b54224df9..d351191b6121 100644 --- a/sw/source/ui/dbui/mmgreetingspage.hxx +++ b/sw/source/ui/dbui/mmgreetingspage.hxx @@ -33,30 +33,30 @@ class SwMailMergeWizard; class SwGreetingsHandler { protected: - CheckBox* m_pGreetingLineCB; + VclPtr<CheckBox> m_pGreetingLineCB; - CheckBox* m_pPersonalizedCB; + VclPtr<CheckBox> m_pPersonalizedCB; - FixedText* m_pFemaleFT; - ListBox* m_pFemaleLB; - PushButton* m_pFemalePB; + VclPtr<FixedText> m_pFemaleFT; + VclPtr<ListBox> m_pFemaleLB; + VclPtr<PushButton> m_pFemalePB; - FixedText* m_pMaleFT; - ListBox* m_pMaleLB; - PushButton* m_pMalePB; + VclPtr<FixedText> m_pMaleFT; + VclPtr<ListBox> m_pMaleLB; + VclPtr<PushButton> m_pMalePB; - FixedText* m_pFemaleFI; - FixedText* m_pFemaleColumnFT; - ListBox* m_pFemaleColumnLB; - FixedText* m_pFemaleFieldFT; - ComboBox* m_pFemaleFieldCB; + VclPtr<FixedText> m_pFemaleFI; + VclPtr<FixedText> m_pFemaleColumnFT; + VclPtr<ListBox> m_pFemaleColumnLB; + VclPtr<FixedText> m_pFemaleFieldFT; + VclPtr<ComboBox> m_pFemaleFieldCB; - FixedText* m_pNeutralFT; - ComboBox* m_pNeutralCB; + VclPtr<FixedText> m_pNeutralFT; + VclPtr<ComboBox> m_pNeutralCB; bool m_bIsTabPage; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; ~SwGreetingsHandler() {} @@ -70,12 +70,12 @@ protected: class SwMailMergeGreetingsPage : public svt::OWizardPage, public SwGreetingsHandler { - FixedText* m_pPreviewFI; - SwAddressPreview* m_pPreviewWIN; - PushButton* m_pAssignPB; - FixedText* m_pDocumentIndexFI; - PushButton* m_pPrevSetIB; - PushButton* m_pNextSetIB; + VclPtr<FixedText> m_pPreviewFI; + VclPtr<SwAddressPreview> m_pPreviewWIN; + VclPtr<PushButton> m_pAssignPB; + VclPtr<FixedText> m_pDocumentIndexFI; + VclPtr<PushButton> m_pPrevSetIB; + VclPtr<PushButton> m_pNextSetIB; OUString m_sDocument; @@ -90,21 +90,23 @@ class SwMailMergeGreetingsPage : public svt::OWizardPage, public: SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeGreetingsPage(); + virtual void dispose() SAL_OVERRIDE; }; class SwMailBodyDialog : public SfxModalDialog, public SwGreetingsHandler { - FixedText *m_pBodyFT; - VclMultiLineEdit *m_pBodyMLE; + VclPtr<FixedText> m_pBodyFT; + VclPtr<VclMultiLineEdit> m_pBodyMLE; - OKButton *m_pOK; + VclPtr<OKButton> m_pOK; DECL_LINK(ContainsHdl_Impl, CheckBox*); DECL_LINK(OKHdl, void *); public: SwMailBodyDialog(vcl::Window* pParent, SwMailMergeWizard* pWizard); virtual ~SwMailBodyDialog(); + virtual void dispose() SAL_OVERRIDE; void SetBody(const OUString& rBody ) {m_pBodyMLE->SetText(rBody);} OUString GetBody() const {return m_pBodyMLE->GetText();} diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index a89ed65b32c5..e00f986e5ef0 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -155,9 +155,25 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : SwMailMergeLayoutPage::~SwMailMergeLayoutPage() { + disposeOnce(); +} + +void SwMailMergeLayoutPage::dispose() +{ delete m_pExampleFrame; File::remove( m_sExampleURL ); - + m_pPosition.clear(); + m_pAlignToBodyCB.clear(); + m_pLeftFT.clear(); + m_pLeftMF.clear(); + m_pTopMF.clear(); + m_pGreetingLine.clear(); + m_pUpPB.clear(); + m_pDownPB.clear(); + m_pExampleContainerWIN.clear(); + m_pZoomLB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeLayoutPage::ActivatePage() diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx index c770705dccc5..5b9f9a8c3cc1 100644 --- a/sw/source/ui/dbui/mmlayoutpage.hxx +++ b/sw/source/ui/dbui/mmlayoutpage.hxx @@ -38,20 +38,20 @@ namespace com{ namespace sun{ namespace star{ namespace beans{ class XPropertySe class SwMailMergeLayoutPage : public svt::OWizardPage { - VclContainer* m_pPosition; + VclPtr<VclContainer> m_pPosition; - CheckBox* m_pAlignToBodyCB; - FixedText* m_pLeftFT; - MetricField* m_pLeftMF; - MetricField* m_pTopMF; + VclPtr<CheckBox> m_pAlignToBodyCB; + VclPtr<FixedText> m_pLeftFT; + VclPtr<MetricField> m_pLeftMF; + VclPtr<MetricField> m_pTopMF; - VclContainer* m_pGreetingLine; - PushButton* m_pUpPB; - PushButton* m_pDownPB; + VclPtr<VclContainer> m_pGreetingLine; + VclPtr<PushButton> m_pUpPB; + VclPtr<PushButton> m_pDownPB; - vcl::Window* m_pExampleContainerWIN; + VclPtr<vcl::Window> m_pExampleContainerWIN; - ListBox* m_pZoomLB; + VclPtr<ListBox> m_pZoomLB; SwOneExampleFrame* m_pExampleFrame; SwWrtShell* m_pExampleWrtShell; @@ -61,7 +61,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage bool m_bIsGreetingInserted; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xViewProperties; @@ -84,6 +84,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage public: SwMailMergeLayoutPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeLayoutPage(); + virtual void dispose() SAL_OVERRIDE; static SwFrmFmt* InsertAddressAndGreeting(SwView* pView, SwMailMergeConfigItem& rConfigItem, diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx index f0fbebcaf046..98233636a574 100644 --- a/sw/source/ui/dbui/mmmergepage.cxx +++ b/sw/source/ui/dbui/mmmergepage.cxx @@ -50,6 +50,25 @@ SwMailMergeMergePage::SwMailMergeMergePage(SwMailMergeWizard* _pParent) } +SwMailMergeMergePage::~SwMailMergeMergePage() +{ + disposeOnce(); +} + +void SwMailMergeMergePage::dispose() +{ + m_pEditFI.clear(); + m_pEditPB.clear(); + m_pFindED.clear(); + m_pFindPB.clear(); + m_pWholeWordsCB.clear(); + m_pBackwardsCB.clear(); + m_pMatchCaseCB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + + IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl) { m_pWizard->SetRestartPage(MM_MERGEPAGE); diff --git a/sw/source/ui/dbui/mmmergepage.hxx b/sw/source/ui/dbui/mmmergepage.hxx index b415586acc7d..2ff8187eff10 100644 --- a/sw/source/ui/dbui/mmmergepage.hxx +++ b/sw/source/ui/dbui/mmmergepage.hxx @@ -29,17 +29,17 @@ class SwMailMergeWizard; class SwMailMergeMergePage : public svt::OWizardPage { - FixedText* m_pEditFI; - PushButton* m_pEditPB; + VclPtr<FixedText> m_pEditFI; + VclPtr<PushButton> m_pEditPB; - ReturnActionEdit* m_pFindED; - PushButton* m_pFindPB; + VclPtr<ReturnActionEdit> m_pFindED; + VclPtr<PushButton> m_pFindPB; - CheckBox* m_pWholeWordsCB; - CheckBox* m_pBackwardsCB; - CheckBox* m_pMatchCaseCB; + VclPtr<CheckBox> m_pWholeWordsCB; + VclPtr<CheckBox> m_pBackwardsCB; + VclPtr<CheckBox> m_pMatchCaseCB; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(EditDocumentHdl_Impl, void *); DECL_LINK(FindHdl_Impl, void *); @@ -47,6 +47,8 @@ class SwMailMergeMergePage : public svt::OWizardPage public: SwMailMergeMergePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergeMergePage(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 586303caa0e1..6c92c26f8b8c 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -194,8 +194,8 @@ IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit*, pEdit) class SwCopyToDialog : public SfxModalDialog { - Edit* m_pCCED; - Edit* m_pBCCED; + VclPtr<Edit> m_pCCED; + VclPtr<Edit> m_pBCCED; public: SwCopyToDialog(vcl::Window* pParent) @@ -205,6 +205,13 @@ public: get(m_pCCED, "cc"); get(m_pBCCED, "bcc"); } + virtual ~SwCopyToDialog() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pCCED.clear(); + m_pBCCED.clear(); + SfxModalDialog::dispose(); + } OUString GetCC() {return m_pCCED->GetText();} void SetCC(const OUString& rSet) {m_pCCED->SetText(rSet);} @@ -300,7 +307,44 @@ SwMailMergeOutputPage::SwMailMergeOutputPage(SwMailMergeWizard* _pParent) SwMailMergeOutputPage::~SwMailMergeOutputPage() { - delete m_pTempPrinter; + disposeOnce(); +} + +void SwMailMergeOutputPage::dispose() +{ + m_pTempPrinter.disposeAndClear(); + m_pSaveStartDocRB.clear(); + m_pSaveMergedDocRB.clear(); + m_pPrintRB.clear(); + m_pSendMailRB.clear(); + m_pSeparator.clear(); + m_pSaveStartDocPB.clear(); + m_pSaveAsOneRB.clear(); + m_pSaveIndividualRB.clear(); + m_pPrintAllRB.clear(); + m_pSendAllRB.clear(); + m_pFromRB.clear(); + m_pFromNF.clear(); + m_pToFT.clear(); + m_pToNF.clear(); + m_pSaveNowPB.clear(); + m_pPrinterFT.clear(); + m_pPrinterLB.clear(); + m_pPrinterSettingsPB.clear(); + m_pPrintNowPB.clear(); + m_pMailToFT.clear(); + m_pMailToLB.clear(); + m_pCopyToPB.clear(); + m_pSubjectFT.clear(); + m_pSubjectED.clear(); + m_pSendAsFT.clear(); + m_pSendAsLB.clear(); + m_pAttachmentGroup.clear(); + m_pAttachmentED.clear(); + m_pSendAsPB.clear(); + m_pSendDocumentsPB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); } void SwMailMergeOutputPage::ActivatePage() @@ -479,7 +523,7 @@ IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton) SendTypeHdl_Impl(m_pSendAsLB); } } - m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB : 0); + m_pFromRB->GetClickHdl().Call(m_pFromRB->IsChecked() ? m_pFromRB.get() : 0); SetUpdateMode(false); return 0; @@ -496,7 +540,7 @@ IMPL_LINK(SwMailMergeOutputPage, DocumentSelectionHdl_Impl, RadioButton*, pButto IMPL_LINK(SwMailMergeOutputPage, CopyToHdl_Impl, PushButton*, pButton) { - boost::scoped_ptr<SwCopyToDialog> pDlg(new SwCopyToDialog(pButton)); + ScopedVclPtrInstance< SwCopyToDialog > pDlg(pButton); pDlg->SetCC(m_sCC ); pDlg->SetBCC(m_sBCC); if(RET_OK == pDlg->Execute()) @@ -689,12 +733,12 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) } SwView* pSourceView = rConfigItem.GetSourceView(); - PrintMonitor aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); - aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); - aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); - aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); + ScopedVclPtrInstance< PrintMonitor > aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); + aSaveMonitor->m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); + aSaveMonitor->SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); + aSaveMonitor->m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); m_bCancelSaving = false; - aSaveMonitor.Show(); + aSaveMonitor->Show(); m_pWizard->enableButtons(WZB_CANCEL, false); for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc) @@ -707,7 +751,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) sPath += "." + sExtension; } OUString sStat = OUString(SW_RES(STR_STATSTR_LETTER)) + " " + OUString::number( nDoc ); - aSaveMonitor.m_pPrintInfo->SetText(sStat); + aSaveMonitor->m_pPrintInfo->SetText(sStat); //now extract a document from the target document // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here @@ -755,9 +799,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) if(bFailed) { - SwSaveWarningBox_Impl aWarning( pButton, sOutPath ); - if(RET_OK == aWarning.Execute()) - sOutPath = aWarning.GetFileName(); + ScopedVclPtrInstance< SwSaveWarningBox_Impl > aWarning( pButton, sOutPath ); + if(RET_OK == aWarning->Execute()) + sOutPath = aWarning->GetFileName(); else { xTempDocShell->DoClose(); @@ -794,23 +838,23 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) if ((pDocumentPrinter->GetName() == pInfo->GetPrinterName()) && (pDocumentPrinter->GetDriverName() == pInfo->GetDriver())) { - m_pTempPrinter = new Printer(pDocumentPrinter->GetJobSetup()); + m_pTempPrinter = VclPtr<Printer>::Create(pDocumentPrinter->GetJobSetup()); } else - m_pTempPrinter = new Printer( *pInfo ); + m_pTempPrinter = VclPtr<Printer>::Create( *pInfo ); } else { if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) || (m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) ) { - delete m_pTempPrinter; - m_pTempPrinter = new Printer( *pInfo ); + m_pTempPrinter.disposeAndClear(); + m_pTempPrinter = VclPtr<Printer>::Create( *pInfo ); } } } else if( ! m_pTempPrinter ) - m_pTempPrinter = new Printer(); + m_pTempPrinter = VclPtr<Printer>::Create(); m_pPrinterSettingsPB->Enable( m_pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); } @@ -916,7 +960,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox) IMPL_LINK(SwMailMergeOutputPage, SendAsHdl_Impl, PushButton*, pButton) { - SwMailBodyDialog* pDlg = new SwMailBodyDialog(pButton, m_pWizard); + VclPtr<SwMailBodyDialog> pDlg = VclPtr<SwMailBodyDialog>::Create(pButton, m_pWizard); pDlg->SetBody(m_sBody); if(RET_OK == pDlg->Execute()) { @@ -939,12 +983,12 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(rConfigItem.GetMailServer().isEmpty() || !SwMailMergeHelper::CheckMailAddress(rConfigItem.GetMailAddress()) ) { - QueryBox aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail); - sal_uInt16 nRet = aQuery.Execute(); + ScopedVclPtrInstance< QueryBox > aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail); + sal_uInt16 nRet = aQuery->Execute(); if(RET_YES == nRet ) { SfxAllItemSet aSet(pTargetView->GetPool()); - boost::scoped_ptr<SwMailConfigDlg> pDlg(new SwMailConfigDlg(pButton, aSet)); + ScopedVclPtrInstance< SwMailConfigDlg > pDlg(pButton, aSet); nRet = pDlg->Execute(); } @@ -1033,26 +1077,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(m_pSubjectED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "SubjectDialog", - "modules/swriter/ui/subjectdialog.ui"); - aQuery.SetIsEmptyTextAllowed(true); - aQuery.SetValue(m_sNoSubjectST); - if(RET_OK == aQuery.Execute()) + ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "SubjectDialog", + "modules/swriter/ui/subjectdialog.ui"); + aQuery->SetIsEmptyTextAllowed(true); + aQuery->SetValue(m_sNoSubjectST); + if(RET_OK == aQuery->Execute()) { - if(aQuery.GetValue() != m_sNoSubjectST) - m_pSubjectED->SetText(aQuery.GetValue()); + if(aQuery->GetValue() != m_sNoSubjectST) + m_pSubjectED->SetText(aQuery->GetValue()); } else return 0; } if(!bAsBody && m_pAttachmentED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "AttachNameDialog", - "modules/swriter/ui/attachnamedialog.ui"); - aQuery.SetIsEmptyTextAllowed(false); - if(RET_OK == aQuery.Execute()) + ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "AttachNameDialog", + "modules/swriter/ui/attachnamedialog.ui"); + aQuery->SetIsEmptyTextAllowed(false); + if(RET_OK == aQuery->Execute()) { - OUString sAttach(aQuery.GetValue()); + OUString sAttach(aQuery->GetValue()); sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if (2 > nTokenCount) { @@ -1101,7 +1145,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) xStore->storeToURL( sTargetTempURL, aValues ); //create the send dialog - SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); + VclPtr<SwSendMailDialog> pDlg = VclPtr<SwSendMailDialog>::Create( pButton, rConfigItem ); pDlg->SetDocumentCount( nEnd ); pDlg->ShowDialog(); //help to force painting the dialog diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx index a31ddeaa3564..470a72e04689 100644 --- a/sw/source/ui/dbui/mmoutputpage.hxx +++ b/sw/source/ui/dbui/mmoutputpage.hxx @@ -45,42 +45,42 @@ namespace com{ namespace sun{ namespace star{ class SwMailMergeOutputPage : public svt::OWizardPage { - RadioButton* m_pSaveStartDocRB; - RadioButton* m_pSaveMergedDocRB; - RadioButton* m_pPrintRB; - RadioButton* m_pSendMailRB; + VclPtr<RadioButton> m_pSaveStartDocRB; + VclPtr<RadioButton> m_pSaveMergedDocRB; + VclPtr<RadioButton> m_pPrintRB; + VclPtr<RadioButton> m_pSendMailRB; - VclFrame* m_pSeparator; + VclPtr<VclFrame> m_pSeparator; - PushButton* m_pSaveStartDocPB; + VclPtr<PushButton> m_pSaveStartDocPB; - RadioButton* m_pSaveAsOneRB; - RadioButton* m_pSaveIndividualRB; - RadioButton* m_pPrintAllRB; //has to be here for tab control reasons - RadioButton* m_pSendAllRB; //has to be here for tab control reasons + VclPtr<RadioButton> m_pSaveAsOneRB; + VclPtr<RadioButton> m_pSaveIndividualRB; + VclPtr<RadioButton> m_pPrintAllRB; //has to be here for tab control reasons + VclPtr<RadioButton> m_pSendAllRB; //has to be here for tab control reasons //this group is used in save and print - RadioButton* m_pFromRB; - NumericField* m_pFromNF; - FixedText* m_pToFT; - NumericField* m_pToNF; - PushButton* m_pSaveNowPB; - - FixedText* m_pPrinterFT; - ListBox* m_pPrinterLB; - PushButton* m_pPrinterSettingsPB; - PushButton* m_pPrintNowPB; - - FixedText* m_pMailToFT; - ListBox* m_pMailToLB; - PushButton* m_pCopyToPB; - FixedText* m_pSubjectFT; - Edit* m_pSubjectED; - FixedText* m_pSendAsFT; - ListBox* m_pSendAsLB; - VclContainer* m_pAttachmentGroup; - Edit* m_pAttachmentED; - PushButton* m_pSendAsPB; - PushButton* m_pSendDocumentsPB; + VclPtr<RadioButton> m_pFromRB; + VclPtr<NumericField> m_pFromNF; + VclPtr<FixedText> m_pToFT; + VclPtr<NumericField> m_pToNF; + VclPtr<PushButton> m_pSaveNowPB; + + VclPtr<FixedText> m_pPrinterFT; + VclPtr<ListBox> m_pPrinterLB; + VclPtr<PushButton> m_pPrinterSettingsPB; + VclPtr<PushButton> m_pPrintNowPB; + + VclPtr<FixedText> m_pMailToFT; + VclPtr<ListBox> m_pMailToLB; + VclPtr<PushButton> m_pCopyToPB; + VclPtr<FixedText> m_pSubjectFT; + VclPtr<Edit> m_pSubjectED; + VclPtr<FixedText> m_pSendAsFT; + VclPtr<ListBox> m_pSendAsLB; + VclPtr<VclContainer> m_pAttachmentGroup; + VclPtr<Edit> m_pAttachmentED; + VclPtr<PushButton> m_pSendAsPB; + VclPtr<PushButton> m_pSendDocumentsPB; //some FixedLine labels OUString m_sSaveStartST; @@ -97,10 +97,10 @@ class SwMailMergeOutputPage : public svt::OWizardPage bool m_bCancelSaving; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; //some dialog data - Printer* m_pTempPrinter; + VclPtr<Printer> m_pTempPrinter; OUString m_sCC; OUString m_sBCC; @@ -126,6 +126,7 @@ protected: public: SwMailMergeOutputPage( SwMailMergeWizard* _pParent); virtual ~SwMailMergeOutputPage(); + virtual void dispose() SAL_OVERRIDE; }; @@ -146,17 +147,17 @@ struct SwSendMailDialog_Impl; class SwMailMergeConfigItem; class SwSendMailDialog : public ModelessDialog //SfxModalDialog { - FixedText *m_pTransferStatus; - FixedText *m_pPaused; - ProgressBar *m_pProgressBar; - FixedText *m_pErrorStatus; + VclPtr<FixedText> m_pTransferStatus; + VclPtr<FixedText> m_pPaused; + VclPtr<ProgressBar> m_pProgressBar; + VclPtr<FixedText> m_pErrorStatus; - SvSimpleTableContainer *m_pContainer; - HeaderBar *m_pStatusHB; - SvSimpleTable *m_pStatus; + VclPtr<SvSimpleTableContainer> m_pContainer; + VclPtr<HeaderBar> m_pStatusHB; + VclPtr<SvSimpleTable> m_pStatus; - PushButton *m_pStop; - PushButton *m_pClose; + VclPtr<PushButton> m_pStop; + VclPtr<PushButton> m_pClose; OUString m_sContinue; OUString m_sStop; @@ -192,6 +193,7 @@ class SwSendMailDialog : public ModelessDialog //SfxModalDialog public: SwSendMailDialog( vcl::Window* pParent, SwMailMergeConfigItem& ); virtual ~SwSendMailDialog(); + virtual void dispose() SAL_OVERRIDE; void AddDocument( SwMailDescriptor& rDesc ); void SetDocumentCount( sal_Int32 nAllDocuments ); diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index a1dc8affad88..e15e757421e7 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -48,6 +48,22 @@ SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard* pParent) } +SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage() +{ + disposeOnce(); +} + +void SwMailMergeOutputTypePage::dispose() +{ + m_pLetterRB.clear(); + m_pMailRB.clear(); + m_pLetterHint.clear(); + m_pMailHint.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + + IMPL_LINK_NOARG(SwMailMergeOutputTypePage, TypeHdl_Impl) { bool bLetter = m_pLetterRB->IsChecked(); @@ -123,7 +139,7 @@ const SwMailDescriptor* SwSendMailDialog_Impl::GetNextDescriptor() using namespace ::com::sun::star; class SwMailDispatcherListener_Impl : public IMailDispatcherListener { - SwSendMailDialog* m_pSendMailDialog; + VclPtr<SwSendMailDialog> m_pSendMailDialog; public: SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg); @@ -208,9 +224,15 @@ void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMa class SwSendWarningBox_Impl : public MessageDialog { - VclMultiLineEdit *m_pDetailED; + VclPtr<VclMultiLineEdit> m_pDetailED; public: SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails); + virtual ~SwSendWarningBox_Impl() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pDetailED.clear(); + MessageDialog::dispose(); + } }; SwSendWarningBox_Impl::SwSendWarningBox_Impl(vcl::Window* pParent, const OUString& rDetails) @@ -253,7 +275,7 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem& Size aSize = m_pContainer->LogicToPixel(Size(226, 80), MAP_APPFONT); m_pContainer->set_width_request(aSize.Width()); m_pContainer->set_height_request(aSize.Height()); - m_pStatus = new SvSimpleTable(*m_pContainer); + m_pStatus = VclPtr<SvSimpleTable>::Create(*m_pContainer); m_pStatusHB = &(m_pStatus->GetTheHeaderBar()); m_nStatusHeight = m_pContainer->get_height_request(); @@ -283,6 +305,11 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, SwMailMergeConfigItem& SwSendMailDialog::~SwSendMailDialog() { + disposeOnce(); +} + +void SwSendMailDialog::dispose() +{ if(m_pImpl->xMailDispatcher.is()) { try @@ -306,8 +333,17 @@ SwSendMailDialog::~SwSendMailDialog() { } } - delete m_pStatus; delete m_pImpl; + m_pStatus.disposeAndClear(); + m_pTransferStatus.clear(); + m_pPaused.clear(); + m_pProgressBar.clear(); + m_pErrorStatus.clear(); + m_pContainer.clear(); + m_pStatusHB.clear(); + m_pStop.clear(); + m_pClose.clear(); + ModelessDialog::dispose(); } void SwSendMailDialog::AddDocument( SwMailDescriptor& rDesc ) @@ -375,7 +411,7 @@ IMPL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer ) (!pThis->m_pImpl->xMailDispatcher.is() || !pThis->m_pImpl->xMailDispatcher->isRunning())) { - delete pThis; + pThis->disposeOnce(); } else { @@ -546,7 +582,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag if (pError) { - boost::scoped_ptr<SwSendWarningBox_Impl> pDlg(new SwSendWarningBox_Impl(0, *pError)); + VclPtrInstance< SwSendWarningBox_Impl > pDlg(nullptr, *pError); pDlg->Execute(); } } diff --git a/sw/source/ui/dbui/mmoutputtypepage.hxx b/sw/source/ui/dbui/mmoutputtypepage.hxx index 81769f2b6863..9c967c05f7fb 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.hxx +++ b/sw/source/ui/dbui/mmoutputtypepage.hxx @@ -27,18 +27,20 @@ class SwMailMergeWizard; class SwMailMergeOutputTypePage : public svt::OWizardPage { - RadioButton* m_pLetterRB; - RadioButton* m_pMailRB; + VclPtr<RadioButton> m_pLetterRB; + VclPtr<RadioButton> m_pMailRB; - FixedText* m_pLetterHint; - FixedText* m_pMailHint; + VclPtr<FixedText> m_pLetterHint; + VclPtr<FixedText> m_pMailHint; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(TypeHdl_Impl, void *); public: SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergeOutputTypePage(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/mmpreparemergepage.cxx b/sw/source/ui/dbui/mmpreparemergepage.cxx index 272ae0f6cb8e..702b26b156b1 100644 --- a/sw/source/ui/dbui/mmpreparemergepage.cxx +++ b/sw/source/ui/dbui/mmpreparemergepage.cxx @@ -58,6 +58,24 @@ SwMailMergePrepareMergePage::SwMailMergePrepareMergePage( SwMailMergeWizard* _pP aMoveLink.Call(m_pRecordED); } +SwMailMergePrepareMergePage::~SwMailMergePrepareMergePage() +{ + disposeOnce(); +} + +void SwMailMergePrepareMergePage::dispose() +{ + m_pFirstPB.clear(); + m_pPrevPB.clear(); + m_pRecordED.clear(); + m_pNextPB.clear(); + m_pLastPB.clear(); + m_pExcludeCB.clear(); + m_pEditPB.clear(); + m_pWizard.clear(); + svt::OWizardPage::dispose(); +} + IMPL_LINK_NOARG(SwMailMergePrepareMergePage, EditDocumentHdl_Impl) { m_pWizard->SetRestartPage(MM_PREPAREMERGEPAGE); diff --git a/sw/source/ui/dbui/mmpreparemergepage.hxx b/sw/source/ui/dbui/mmpreparemergepage.hxx index bdaef54ae3ff..8bfdfbe94158 100644 --- a/sw/source/ui/dbui/mmpreparemergepage.hxx +++ b/sw/source/ui/dbui/mmpreparemergepage.hxx @@ -29,16 +29,16 @@ class SwMailMergeWizard; class SwMailMergePrepareMergePage : public svt::OWizardPage { - PushButton* m_pFirstPB; - PushButton* m_pPrevPB; - NumericField* m_pRecordED; - PushButton* m_pNextPB; - PushButton* m_pLastPB; - CheckBox* m_pExcludeCB; + VclPtr<PushButton> m_pFirstPB; + VclPtr<PushButton> m_pPrevPB; + VclPtr<NumericField> m_pRecordED; + VclPtr<PushButton> m_pNextPB; + VclPtr<PushButton> m_pLastPB; + VclPtr<CheckBox> m_pExcludeCB; - PushButton* m_pEditPB; + VclPtr<PushButton> m_pEditPB; - SwMailMergeWizard* m_pWizard; + VclPtr<SwMailMergeWizard> m_pWizard; DECL_LINK(EditDocumentHdl_Impl, void *); DECL_LINK(ExcludeHdl_Impl, CheckBox*); @@ -49,6 +49,8 @@ class SwMailMergePrepareMergePage : public svt::OWizardPage public: SwMailMergePrepareMergePage( SwMailMergeWizard* _pParent); + virtual ~SwMailMergePrepareMergePage(); + virtual void dispose() SAL_OVERRIDE; }; #endif diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index 1386638a4e20..1db947e9f3d4 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.cxx +++ b/sw/source/ui/dbui/selectdbtabledialog.cxx @@ -105,7 +105,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent, Size aSize = pHeaderTreeContainer->LogicToPixel(Size(238 , 50), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pTable = new SwAddressTable(*pHeaderTreeContainer); + m_pTable = VclPtr<SwAddressTable>::Create(*pHeaderTreeContainer); long aStaticTabs[]= { 2, 0, 0 }; m_pTable->SetTabs( aStaticTabs ); m_pTable->InsertHeaderItem(1, m_sName, HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER); @@ -147,7 +147,14 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(vcl::Window* pParent, SwSelectDBTableDialog::~SwSelectDBTableDialog() { - delete m_pTable; + disposeOnce(); +} + +void SwSelectDBTableDialog::dispose() +{ + m_pTable.disposeAndClear(); + m_pPreviewPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton) @@ -180,7 +187,7 @@ IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton) pProperties[4].Name = "ShowTreeViewButton"; pProperties[4].Value <<= sal_False; - boost::scoped_ptr<SwDBTablePreviewDialog> pDlg(new SwDBTablePreviewDialog(pButton, aProperties)); + VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties); pDlg->Execute(); } diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx index 729675e831b9..b02b74b2cb72 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.hxx +++ b/sw/source/ui/dbui/selectdbtabledialog.hxx @@ -35,8 +35,8 @@ class SwAddressTable; class SwSelectDBTableDialog : public SfxModalDialog { - SwAddressTable* m_pTable; - PushButton* m_pPreviewPB; + VclPtr<SwAddressTable> m_pTable; + VclPtr<PushButton> m_pPreviewPB; OUString m_sName; OUString m_sType; @@ -50,6 +50,7 @@ public: SwSelectDBTableDialog(vcl::Window* pParent, const css::uno::Reference<css::sdbc::XConnection>& xConnection); virtual ~SwSelectDBTableDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetSelectedTable(bool& bIsTable); void SetSelectedTable(const OUString& rTable, bool bIsTable); diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx index f33577268b82..a5de42b69a6c 100644 --- a/sw/source/ui/dialog/abstract.cxx +++ b/sw/source/ui/dialog/abstract.cxx @@ -31,6 +31,18 @@ SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent) get(m_pParaNF, "paras"); } +SwInsertAbstractDlg::~SwInsertAbstractDlg() +{ + disposeOnce(); +} + +void SwInsertAbstractDlg::dispose() +{ + m_pLevelNF.clear(); + m_pParaNF.clear(); + SfxModalDialog::dispose(); +} + sal_uInt8 SwInsertAbstractDlg::GetLevel() const { return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1); diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 93c3c7793e6e..68409fd8e9ec 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -174,14 +174,14 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, { bool bDelPrinter = false; - SfxPrinter* pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0; + VclPtr<SfxPrinter> pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : 0; if( !pPrt ) { SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - pPrt = new SfxPrinter( pSet ); + pPrt = VclPtr<SfxPrinter>::Create( pSet ); bDelPrinter = true; } @@ -211,7 +211,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, m_pFontLB->SelectEntry( aOpt.GetFontName() ); if( bDelPrinter ) - delete pPrt; + pPrt.disposeAndClear(); } } @@ -242,8 +242,23 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, SwAsciiFilterDlg::~SwAsciiFilterDlg() { + disposeOnce(); } +void SwAsciiFilterDlg::dispose() +{ + m_pCharSetLB.clear(); + m_pFontFT.clear(); + m_pFontLB.clear(); + m_pLanguageFT.clear(); + m_pLanguageLB.clear(); + m_pCRLF_RB.clear(); + m_pCR_RB.clear(); + m_pLF_RB.clear(); + SfxModalDialog::dispose(); +} + + void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) { sal_uLong nCCode = m_pCharSetLB->GetSelectTextEncoding(); diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx index 48ae2aa587d1..de1d3d6abcd8 100644 --- a/sw/source/ui/dialog/docstdlg.cxx +++ b/sw/source/ui/dialog/docstdlg.cxx @@ -36,9 +36,9 @@ #include <unotools/localedatawrapper.hxx> #include <vcl/settings.hxx> -SfxTabPage * SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwDocStatPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwDocStatPage(pParent, *rSet); + return VclPtr<SwDocStatPage>::Create(pParent, *rSet); } SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet) @@ -73,8 +73,25 @@ SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet) } - SwDocStatPage::~SwDocStatPage() +SwDocStatPage::~SwDocStatPage() { + disposeOnce(); +} + +void SwDocStatPage::dispose() +{ + m_pPageNo.clear(); + m_pTableNo.clear(); + m_pGrfNo.clear(); + m_pOLENo.clear(); + m_pParaNo.clear(); + m_pWordNo.clear(); + m_pCharNo.clear(); + m_pCharExclSpacesNo.clear(); + m_pLineLbl.clear(); + m_pLineNo.clear(); + m_pUpdatePB.clear(); + SfxTabPage::dispose(); } // Description: fill ItemSet when changed diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index a64cb0820089..ebc76da20d73 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -595,7 +595,7 @@ void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, cons AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl() { - delete pDlg; + pDlg.disposeAndClear(); } void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link& rEndDialogHdl ) @@ -643,7 +643,7 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(vcl::Window* pParent) { - SwInsertAbstractDlg* pDlg = new SwInsertAbstractDlg( pParent); + VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create( pParent); return new AbstractSwInsertAbstractDlg_Impl(pDlg); } @@ -657,16 +657,16 @@ SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* p switch ( nResId ) { case RC_DLG_ADDR : - pDlg = new SwAddrDlg( pParent, rSet ); + pDlg = VclPtr<SwAddrDlg>::Create( pParent, rSet ); break; case DLG_SWDROPCAPS : - pDlg = new SwDropCapsDlg( pParent, rSet ); + pDlg = VclPtr<SwDropCapsDlg>::Create( pParent, rSet ); break; case RC_SWDLG_BACKGROUND : - pDlg = new SwBackgroundDlg( pParent, rSet ); + pDlg = VclPtr<SwBackgroundDlg>::Create( pParent, rSet ); break; case RC_DLG_SWNUMFMTDLG : - pDlg = new SwNumFmtDlg( pParent, rSet ); + pDlg = VclPtr<SwNumFmtDlg>::Create( pParent, rSet ); break; default: break; @@ -681,7 +681,7 @@ AbstractSwAsciiFilterDlg* SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg( SwDocShell& rDocSh, SvStream* pStream ) { - SwAsciiFilterDlg* pDlg = new SwAsciiFilterDlg( pParent, rDocSh, pStream ); + VclPtr<SwAsciiFilterDlg> pDlg = VclPtr<SwAsciiFilterDlg>::Create( pParent, rDocSh, pStream ); return new AbstractSwAsciiFilterDlg_Impl( pDlg ); } @@ -694,7 +694,7 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl: switch ( nResId ) { case DLG_INSERT_BOOKMARK : - pDlg = new SwInsertBookmarkDlg( pParent, rSh, rReq ); + pDlg = VclPtr<SwInsertBookmarkDlg>::Create( pParent, rSh, rReq ); break; default: @@ -709,44 +709,43 @@ VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( vcl: AbstractSwBreakDlg * SwAbstractDialogFactory_Impl::CreateSwBreakDlg(vcl::Window *pParent, SwWrtShell &rSh) { - SwBreakDlg* pDlg = new SwBreakDlg(pParent, rSh); + VclPtr<SwBreakDlg> pDlg = VclPtr<SwBreakDlg>::Create(pParent, rSh); return new AbstractSwBreakDlg_Impl(pDlg); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwView& rVw) { - Dialog* pDlg = new SwChangeDBDlg(rVw); + VclPtr<Dialog> pDlg = VclPtr<SwChangeDBDlg>::Create(rVw); return new VclAbstractDialog_Impl(pDlg); } SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(vcl::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, sal_uInt8 nDialogMode, const OUString* pFmtStr) { - - SfxTabDialog* pDlg = new SwCharDlg(pParent, pVw, rCoreSet, nDialogMode, pFmtStr); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwCharDlg>::Create(pParent, pVw, rCoreSet, nDialogMode, pFmtStr); return new AbstractTabDialog_Impl(pDlg); } AbstractSwConvertTableDlg* SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg(SwView& rView, bool bToTable) { - SwConvertTableDlg* pDlg = new SwConvertTableDlg(rView, bToTable); + VclPtr<SwConvertTableDlg> pDlg = VclPtr<SwConvertTableDlg>::Create(rView, bToTable); return new AbstractSwConvertTableDlg_Impl(pDlg); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV,int nResId) { - Dialog* pDlg=NULL; + VclPtr<Dialog> pDlg; switch ( nResId ) { case DLG_CAPTION : - pDlg = new SwCaptionDialog( pParent, rV ); + pDlg = VclPtr<SwCaptionDialog>::Create( pParent, rV ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new VclAbstractDialog_Impl( pDlg ); return 0; } @@ -756,20 +755,20 @@ AbstractSwInsertDBColAutoPilot* SwAbstractDialogFactory_Impl::CreateSwInsertDBCo uno::Reference<sdbcx::XColumnsSupplier> xColSupp, const SwDBData& rData) { - SwInsertDBColAutoPilot* pDlg = new SwInsertDBColAutoPilot( rView, rxSource, xColSupp, rData ); + VclPtr<SwInsertDBColAutoPilot> pDlg = VclPtr<SwInsertDBColAutoPilot>::Create( rView, rxSource, xColSupp, rData ); return new AbstractSwInsertDBColAutoPilot_Impl( pDlg ); } SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) { - SfxTabDialog* pDlg = new SwFootNoteOptionDlg( pParent, rSh ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwFootNoteOptionDlg>::Create( pParent, rSh ); return new AbstractTabDialog_Impl( pDlg ); } AbstractDropDownFieldDialog * SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton) { - sw::DropDownFieldDialog* pDlg = new sw::DropDownFieldDialog(pParent, rSh, pField, bNextButton); + VclPtr<sw::DropDownFieldDialog> pDlg = VclPtr<sw::DropDownFieldDialog>::Create(pParent, rSh, pField, bNextButton); return new AbstractDropDownFieldDialog_Impl( pDlg ); } @@ -777,14 +776,14 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( vcl::Window SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) { - SfxTabDialog* pDlg = new SwEnvDlg( pParent, rSet, pWrtSh,pPrt, bInsert ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwEnvDlg>::Create( pParent, rSet, pWrtSh,pPrt, bInsert ); return new AbstractTabDialog_Impl( pDlg ); } AbstractSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel) { - SwLabDlg* pDlg = new SwLabDlg(pParent, rSet, pDBManager, bLabel); + VclPtr<SwLabDlg> pDlg = VclPtr<SwLabDlg>::Create(pParent, rSet, pDBManager, bLabel); return new AbstractSwLabDlg_Impl(pDlg); } @@ -800,120 +799,120 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( vcl::Windo bool bDraw , const OString& sDefPage) { - SfxTabDialog* pDlg = new SwParaDlg( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwParaDlg>::Create( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, sDefPage ); return new AbstractTabDialog_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclAbstractDialog ( vcl::Window *pParent, SwWrtShell &rSh, int nResId ) { - Dialog* pDlg=NULL; + VclPtr<Dialog> pDlg; switch ( nResId ) { case DLG_ROW_HEIGHT : - pDlg = new SwTableHeightDlg( pParent, rSh); + pDlg = VclPtr<SwTableHeightDlg>::Create( pParent, rSh); break; case DLG_SORTING : - pDlg = new SwSortDlg( pParent, rSh); + pDlg = VclPtr<SwSortDlg>::Create( pParent, rSh); break; case DLG_COLUMN : - pDlg = new SwColumnDlg( pParent, rSh ); + pDlg = VclPtr<SwColumnDlg>::Create( pParent, rSh ); break; case DLG_EDIT_AUTHMARK : - pDlg = new SwAuthMarkModalDlg( pParent, rSh ); + pDlg = VclPtr<SwAuthMarkModalDlg>::Create( pParent, rSh ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new VclAbstractDialog_Impl( pDlg ); return 0; } AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( vcl::Window *pParent, SwWrtShell &rSh ) { - return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) ); + return new AbstractSplitTableDialog_Impl( VclPtr<SwSplitTblDlg>::Create( pParent, rSh) ); } AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName) { - SwSelGlossaryDlg* pDlg = new SwSelGlossaryDlg(pParent, rShortName); + VclPtr<SwSelGlossaryDlg> pDlg = VclPtr<SwSelGlossaryDlg>::Create(pParent, rShortName); return new AbstractSwSelGlossaryDlg_Impl(pDlg); } AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(vcl::Window* pParent, SwWrtShell* pShell, bool bSetAutoFmt, const SwTableAutoFmt* pSelFmt) { - SwAutoFormatDlg* pDlg = new SwAutoFormatDlg(pParent, pShell, bSetAutoFmt, pSelFmt); + VclPtr<SwAutoFormatDlg> pDlg = VclPtr<SwAutoFormatDlg>::Create(pParent, pShell, bSetAutoFmt, pSelFmt); return new AbstractSwAutoFormatDlg_Impl(pDlg); } SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg(vcl::Window* pParent, SfxItemSet& rSet, sal_uInt16 nType, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWBORDERDLG : - pDlg = new SwBorderDlg( pParent, rSet, nType ); + pDlg = VclPtr<SwBorderDlg>::Create( pParent, rSet, nType ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWWRAPDLG : - pDlg = new SwWrapDlg( pParent, rSet, pSh, bDrawMode ); + pDlg = VclPtr<SwWrapDlg>::Create( pParent, rSet, pSh, bDrawMode ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rFnc) { - Dialog* pDlg = new SwTableWidthDlg(pParent, rFnc); + VclPtr<Dialog> pDlg = VclPtr<SwTableWidthDlg>::Create(pParent, rFnc); return new VclAbstractDialog_Impl( pDlg ); } SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(vcl::Window* pParent, SfxItemPool& Pool, const SfxItemSet* pItemSet, SwWrtShell* pSh) { - SfxTabDialog* pDlg = new SwTableTabDlg(pParent, Pool, pItemSet, pSh); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwTableTabDlg>::Create(pParent, Pool, pItemSet, pSh); return new AbstractTabDialog_Impl(pDlg); } AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent) { - SwFldDlg* pDlg = new SwFldDlg(pB, pCW, pParent); + VclPtr<SwFldDlg> pDlg = VclPtr<SwFldDlg>::Create(pB, pCW, pParent); return new AbstractSwFldDlg_Impl(pDlg); } SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId ) { - SfxModalDialog* pDlg=NULL; + VclPtr<SfxModalDialog> pDlg; switch ( nResId ) { case RC_DLG_SWFLDEDITDLG : - pDlg = new SwFldEditDlg( rVw ); + pDlg = VclPtr<SwFldEditDlg>::Create( rVw ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new SwAbstractSfxDialog_Impl( pDlg ); return 0; } @@ -922,19 +921,19 @@ AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDl ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > & xNamed, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xNameAccess) { - SwRenameXNamedDlg* pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess); + VclPtr<SwRenameXNamedDlg> pDlg = VclPtr<SwRenameXNamedDlg>::Create( pParent,xNamed, xNameAccess); return new AbstractSwRenameXNamedDlg_Impl( pDlg ); } AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(vcl::Window *pParent) { - SwModalRedlineAcceptDlg* pDlg = new SwModalRedlineAcceptDlg( pParent ); + VclPtr<SwModalRedlineAcceptDlg> pDlg = VclPtr<SwModalRedlineAcceptDlg>::Create( pParent ); return new AbstractSwModalRedlineAcceptDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTblMergeDialog(vcl::Window* pParent, bool& rWithPrev) { - Dialog* pDlg = new SwMergeTblDlg( pParent, rWithPrev ); + VclPtr<Dialog> pDlg = VclPtr<SwMergeTblDlg>::Create( pParent, rWithPrev ); return new VclAbstractDialog_Impl( pDlg ); } @@ -946,7 +945,7 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog(const OUS const OString& sDefPage, const OUString* pFmtStr ) { - SfxTabDialog* pDlg = new SwFrmDlg(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwFrmDlg>::Create(pFrame, pParent, rCoreSet, bNewFrm, rDialogType, bFmt, sDefPage, pFmtStr); return new AbstractTabDialog_Impl(pDlg); } @@ -958,7 +957,7 @@ SfxAbstractApplyTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( SwWrtShell* pActShell, bool bNew ) { - SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, sPage, pActShell, bNew ); + VclPtr<SfxTabDialog> pDlg = VclPtr<SwTemplateDlg>::Create( pParent, rBase, nRegion, sPage, pActShell, bNew ); return new AbstractApplyTabDialog_Impl( pDlg ); } @@ -966,46 +965,46 @@ AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFram SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) { - SwGlossaryDlg* pDlg = new SwGlossaryDlg(pViewFrame, pGlosHdl, pWrtShell); + VclPtr<SwGlossaryDlg> pDlg = VclPtr<SwGlossaryDlg>::Create(pViewFrame, pGlosHdl, pWrtShell); return new AbstractGlossaryDlg_Impl( pDlg ); } AbstractFldInputDlg* SwAbstractDialogFactory_Impl::CreateFldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bNextButton) { - SwFldInputDlg* pDlg = new SwFldInputDlg( pParent, rSh, pField, bNextButton ); + VclPtr<SwFldInputDlg> pDlg = VclPtr<SwFldInputDlg>::Create( pParent, rSh, pField, bNextButton ); return new AbstractFldInputDlg_Impl( pDlg ); } AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( vcl::Window * pParent, SwWrtShell &rSh, bool bEd ) { - SwInsFootNoteDlg* pDlg = new SwInsFootNoteDlg(pParent, rSh, bEd); + VclPtr<SwInsFootNoteDlg> pDlg = VclPtr<SwInsFootNoteDlg>::Create(pParent, rSh, bEd); return new AbstractInsFootNoteDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( vcl::Window *pParent ) { - Dialog* pDlg = new SwTitlePageDlg( pParent ); + VclPtr<Dialog> pDlg = VclPtr<SwTitlePageDlg>::Create( pParent ); return new VclAbstractDialog_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog(SwView& rView) { - Dialog* pDlg = new SwLineNumberingDlg( &rView ); + VclPtr<Dialog> pDlg = VclPtr<SwLineNumberingDlg>::Create( &rView ); return new VclAbstractDialog_Impl( pDlg ); } AbstractInsTableDlg * SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView) { - SwInsTableDlg* pDlg = new SwInsTableDlg(rView); + VclPtr<SwInsTableDlg> pDlg = VclPtr<SwInsTableDlg>::Create(rView); return new AbstractInsTableDlg_Impl( pDlg ); } AbstractJavaEditDialog * SwAbstractDialogFactory_Impl::CreateJavaEditDialog( vcl::Window* pParent, SwWrtShell* pWrtSh) { - SwJavaEditDialog* pDlg = new SwJavaEditDialog(pParent, pWrtSh); + VclPtr<SwJavaEditDialog> pDlg = VclPtr<SwJavaEditDialog>::Create(pParent, pWrtSh); return new AbstractJavaEditDialog_Impl( pDlg ); } @@ -1017,35 +1016,35 @@ AbstractMailMergeDlg * SwAbstractDialogFactory_Impl::CreateMailMergeDlg( int nRe const uno::Reference< sdbc::XConnection>& xConnection, uno::Sequence< uno::Any >* pSelection ) { - SwMailMergeDlg* pDlg=NULL; + VclPtr<SwMailMergeDlg> pDlg; switch ( nResId ) { case DLG_MAILMERGE : - pDlg = new SwMailMergeDlg( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection ); + pDlg = VclPtr<SwMailMergeDlg>::Create( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new AbstractMailMergeDlg_Impl( pDlg ); return 0; } AbstractMailMergeCreateFromDlg * SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(vcl::Window* pParent) { - SwMailMergeCreateFromDlg* pDlg = new SwMailMergeCreateFromDlg(pParent); + VclPtr<SwMailMergeCreateFromDlg> pDlg = VclPtr<SwMailMergeCreateFromDlg>::Create(pParent); return new AbstractMailMergeCreateFromDlg_Impl(pDlg); } AbstractMailMergeFieldConnectionsDlg * SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg(vcl::Window* pParent) { - SwMailMergeFieldConnectionsDlg* pDlg = new SwMailMergeFieldConnectionsDlg( pParent ); + VclPtr<SwMailMergeFieldConnectionsDlg> pDlg = VclPtr<SwMailMergeFieldConnectionsDlg>::Create( pParent ); return new AbstractMailMergeFieldConnectionsDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(vcl::Window* pParent, SwTOXMgr &rTOXMgr) { - Dialog* pDlg = new SwMultiTOXMarkDlg(pParent, rTOXMgr); + VclPtr<Dialog> pDlg = VclPtr<SwMultiTOXMarkDlg>::Create(pParent, rTOXMgr); return new VclAbstractDialog_Impl(pDlg); } @@ -1054,20 +1053,20 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTabDialog( int nResI const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh ) { - SfxTabDialog* pDlg=NULL; + VclPtr<SfxTabDialog> pDlg; switch ( nResId ) { case DLG_SVXTEST_NUM_BULLET : - pDlg = new SwSvxNumBulletTabDialog( pParent, pSwItemSet, rWrtSh ); + pDlg = VclPtr<SwSvxNumBulletTabDialog>::Create( pParent, pSwItemSet, rWrtSh ); break; case DLG_TAB_OUTLINE : - pDlg = new SwOutlineTabDialog( pParent, pSwItemSet, rWrtSh ); + pDlg = VclPtr<SwOutlineTabDialog>::Create( pParent, pSwItemSet, rWrtSh ); break; default: break; } - if ( pDlg ) + if ( pDlg.get() ) return new AbstractTabDialog_Impl( pDlg ); return 0; } @@ -1078,20 +1077,20 @@ AbstractMultiTOXTabDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialo SwTOXBase* pCurTOX, sal_uInt16 nToxType, bool bGlobal) { - SwMultiTOXTabDialog* pDlg = new SwMultiTOXTabDialog( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal ); + VclPtr<SwMultiTOXTabDialog> pDlg = VclPtr<SwMultiTOXTabDialog>::Create( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal ); return new AbstractMultiTOXTabDialog_Impl( pDlg ); } AbstractEditRegionDlg * SwAbstractDialogFactory_Impl::CreateEditRegionDlg(vcl::Window* pParent, SwWrtShell& rWrtSh) { - SwEditRegionDlg* pDlg = new SwEditRegionDlg( pParent, rWrtSh ); + VclPtr<SwEditRegionDlg> pDlg = VclPtr<SwEditRegionDlg>::Create( pParent, rWrtSh ); return new AbstractEditRegionDlg_Impl( pDlg ); } AbstractInsertSectionTabDialog * SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) { - SwInsertSectionTabDialog* pDlg = new SwInsertSectionTabDialog(pParent, rSet, rSh); + VclPtr<SwInsertSectionTabDialog> pDlg = VclPtr<SwInsertSectionTabDialog>::Create(pParent, rSet, rSh); return new AbstractInsertSectionTabDialog_Impl(pDlg); } @@ -1102,7 +1101,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg( SfxChildWinInfo* pInfo, bool bNew ) { - SwIndexMarkFloatDlg* pDlg = new SwIndexMarkFloatDlg(pBindings, pChild, pParent, pInfo, bNew); + VclPtr<SwIndexMarkFloatDlg> pDlg = VclPtr<SwIndexMarkFloatDlg>::Create(pBindings, pChild, pParent, pInfo, bNew); return new AbstractIndexMarkFloatDlg_Impl(pDlg); } @@ -1113,7 +1112,7 @@ AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg( SfxChildWinInfo* pInfo, bool bNew) { - SwAuthMarkFloatDlg* pDlg = new SwAuthMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew ); + VclPtr<SwAuthMarkFloatDlg> pDlg = VclPtr<SwAuthMarkFloatDlg>::Create( pBindings, pChild, pParent, pInfo, bNew ); return new AbstractAuthMarkFloatDlg_Impl( pDlg ); } @@ -1123,21 +1122,21 @@ AbstractSwWordCountFloatDlg * SwAbstractDialogFactory_Impl::CreateSwWordCountDia vcl::Window *pParent, SfxChildWinInfo* pInfo) { - SwWordCountFloatDlg* pDlg = new SwWordCountFloatDlg( pBindings, pChild, pParent, pInfo ); + VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo ); return new AbstractSwWordCountFloatDlg_Impl( pDlg ); } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg( vcl::Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) { - Dialog* pDlg = new SwIndexMarkModalDlg( pParent, rSh, pCurTOXMark ); + VclPtr<Dialog> pDlg = VclPtr<SwIndexMarkModalDlg>::Create( pParent, rSh, pCurTOXMark ); return new VclAbstractDialog_Impl( pDlg ); } AbstractMailMergeWizard* SwAbstractDialogFactory_Impl::CreateMailMergeWizard( SwView& rView, SwMailMergeConfigItem& rConfigItem) { - return new AbstractMailMergeWizard_Impl( new SwMailMergeWizard(rView, rConfigItem)); + return new AbstractMailMergeWizard_Impl( VclPtr<SwMailMergeWizard>::Create(rView, rConfigItem)); } GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc() diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 9e6ff470c404..4ec9fa68ad33 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -48,7 +48,7 @@ class DropDownFieldDialog; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ protected: \ - DialogClass* pDlg; \ + ScopedVclPtr<DialogClass> pDlg; \ public: \ Class( DialogClass* p) \ : pDlg(p) \ @@ -59,7 +59,6 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ - delete pDlg; \ } \ short Class::Execute() \ { \ @@ -350,7 +349,7 @@ class AbstractAuthMarkFloatDlg_Impl : public AbstractMarkFloatDlg class SwMailMergeWizard; class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard { - SwMailMergeWizard* pDlg; + VclPtr<SwMailMergeWizard> pDlg; Link aEndDlgHdl; DECL_LINK( EndDialogHdl, SwMailMergeWizard* ); diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx index 2e085f464686..79aba4459af6 100644 --- a/sw/source/ui/dialog/swmessdialog.cxx +++ b/sw/source/ui/dialog/swmessdialog.cxx @@ -30,4 +30,19 @@ SwMessageAndEditDialog::SwMessageAndEditDialog(vcl::Window* pParent, const OUStr get(m_pEdit, "edit"); } +SwMessageAndEditDialog::~SwMessageAndEditDialog() +{ + disposeOnce(); +} + +void SwMessageAndEditDialog::dispose() +{ + m_pOKPB.clear(); + m_pImageIM.clear(); + m_pPrimaryMessage.clear(); + m_pSecondaryMessage.clear(); + m_pEdit.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx index f90812fa4681..dbbac541e03a 100644 --- a/sw/source/ui/dialog/swuiexp.cxx +++ b/sw/source/ui/dialog/swuiexp.cxx @@ -18,7 +18,32 @@ */ #include "swdlgfact.hxx" + +#include "abstract.hxx" +#include "ascfldlg.hxx" +#include "break.hxx" +#include "convert.hxx" #include "dialmgr.hxx" +#include "dbinsdlg.hxx" +#include "DropDownFieldDialog.hxx" +#include "fldtdlg.hxx" +#include "glossary.hxx" +#include "inpdlg.hxx" +#include "insfnote.hxx" +#include "instable.hxx" +#include "javaedit.hxx" +#include "label.hxx" +#include "mailmrge.hxx" +#include "mailmergewizard.hxx" +#include "regionsw.hxx" +#include "selglos.hxx" +#include "splittbl.hxx" +#include "tautofmt.hxx" +#include "swmodalredlineacceptdlg.hxx" +#include "swrenamexnameddlg.hxx" +#include "swuiidxmrk.hxx" +#include "swuicnttab.hxx" +#include "wordcountdialog.hxx" #include <swuiexp.hxx> namespace swui diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index a0b3ac501966..41fbe2b8d3b9 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -404,11 +404,11 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) if (!pRepr->GetTempPasswd().getLength() && pRepr->GetSectionData().GetPassword().getLength()) { - SfxPasswordDialog aPasswdDlg(this); + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); bRet = false; - if (aPasswdDlg.Execute()) + if (aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); ::com::sun::star::uno::Sequence <sal_Int8 > aNewPasswd; SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if (SvPasswordHelper::CompareHashPassword( @@ -516,6 +516,11 @@ sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt ) SwEditRegionDlg::~SwEditRegionDlg( ) { + disposeOnce(); +} + +void SwEditRegionDlg::dispose() +{ SvTreeListEntry* pEntry = m_pTree->First(); while( pEntry ) { @@ -524,6 +529,29 @@ SwEditRegionDlg::~SwEditRegionDlg( ) } delete m_pDocInserter; + m_pCurName.clear(); + m_pTree.clear(); + m_pFileCB.clear(); + m_pDDECB.clear(); + m_pDDEFrame.clear(); + m_pFileNameFT.clear(); + m_pDDECommandFT.clear(); + m_pFileNameED.clear(); + m_pFilePB.clear(); + m_pSubRegionFT.clear(); + m_pSubRegionED.clear(); + m_pProtectCB.clear(); + m_pPasswdCB.clear(); + m_pPasswdPB.clear(); + m_pHideCB.clear(); + m_pConditionFT.clear(); + m_pConditionED.clear(); + m_pEditInReadonlyCB.clear(); + m_pOK.clear(); + m_pOptionsPB.clear(); + m_pDismiss.clear(); + m_pOldDefDlgParent.clear(); + SfxModalDialog::dispose(); } void SwEditRegionDlg::SelectSection(const OUString& rSectionName) @@ -1053,10 +1081,10 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl) aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); - SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh); - if(RET_OK == aTabDlg.Execute()) + ScopedVclPtrInstance< SwSectionPropertyTabDialog > aTabDlg(this, aSet, rSh); + if(RET_OK == aTabDlg->Execute()) { - const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet(); + const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet(); if( pOutSet && pOutSet->Count() ) { const SfxPoolItem *pColItem, *pBrushItem, @@ -1232,12 +1260,12 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) { if(!pRepr->GetTempPasswd().getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); + aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd ); } @@ -1533,7 +1561,30 @@ SwInsertSectionTabPage::SwInsertSectionTabPage( SwInsertSectionTabPage::~SwInsertSectionTabPage() { + disposeOnce(); +} + +void SwInsertSectionTabPage::dispose() +{ delete m_pDocInserter; + m_pCurName.clear(); + m_pFileCB.clear(); + m_pDDECB.clear(); + m_pDDECommandFT.clear(); + m_pFileNameFT.clear(); + m_pFileNameED.clear(); + m_pFilePB.clear(); + m_pSubRegionFT.clear(); + m_pSubRegionED.clear(); + m_pProtectCB.clear(); + m_pPasswdCB.clear(); + m_pPasswdPB.clear(); + m_pHideCB.clear(); + m_pConditionFT.clear(); + m_pConditionED.clear(); + m_pEditInReadonlyCB.clear(); + m_pOldDefDlgParent.clear(); + SfxTabPage::dispose(); } void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) @@ -1635,10 +1686,10 @@ void SwInsertSectionTabPage::Reset( const SfxItemSet* ) { } -SfxTabPage* SwInsertSectionTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwInsertSectionTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwInsertSectionTabPage(pParent, *rAttrSet); + return VclPtr<SwInsertSectionTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox ) @@ -1670,12 +1721,12 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) { if(!m_aNewPasswd.getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(this); + aPasswdDlg->ShowExtras(SfxShowExtras::CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd ); } @@ -1835,6 +1886,32 @@ SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( vcl::Window *pParent, SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage() { + disposeOnce(); +} + +void SwSectionFtnEndTabPage::dispose() +{ + pFtnNtAtTextEndCB.clear(); + pFtnNtNumCB.clear(); + pFtnOffsetLbl.clear(); + pFtnOffsetFld.clear(); + pFtnNtNumFmtCB.clear(); + pFtnPrefixFT.clear(); + pFtnPrefixED.clear(); + pFtnNumViewBox.clear(); + pFtnSuffixFT.clear(); + pFtnSuffixED.clear(); + pEndNtAtTextEndCB.clear(); + pEndNtNumCB.clear(); + pEndOffsetLbl.clear(); + pEndOffsetFld.clear(); + pEndNtNumFmtCB.clear(); + pEndPrefixFT.clear(); + pEndPrefixED.clear(); + pEndNumViewBox.clear(); + pEndSuffixFT.clear(); + pEndSuffixED.clear(); + SfxTabPage::dispose(); } bool SwSectionFtnEndTabPage::FillItemSet( SfxItemSet* rSet ) @@ -1975,10 +2052,10 @@ void SwSectionFtnEndTabPage::Reset( const SfxItemSet* rSet ) RES_END_AT_TXTEND, false ))); } -SfxTabPage* SwSectionFtnEndTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwSectionFtnEndTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwSectionFtnEndTabPage(pParent, *rAttrSet); + return VclPtr<SwSectionFtnEndTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox ) @@ -2096,6 +2173,15 @@ SwSectionIndentTabPage::SwSectionIndentTabPage(vcl::Window *pParent, const SfxIt SwSectionIndentTabPage::~SwSectionIndentTabPage() { + disposeOnce(); +} + +void SwSectionIndentTabPage::dispose() +{ + m_pBeforeMF.clear(); + m_pAfterMF.clear(); + m_pPreviewWin.clear(); + SfxTabPage::dispose(); } bool SwSectionIndentTabPage::FillItemSet( SfxItemSet* rSet) @@ -2137,9 +2223,9 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet* rSet) IndentModifyHdl(0); } -SfxTabPage* SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwSectionIndentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwSectionIndentTabPage(pParent, *rAttrSet); + return VclPtr<SwSectionIndentTabPage>::Create(pParent, *rAttrSet); } void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh) diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 2a7392eee793..471309e2e92b 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -46,7 +46,26 @@ IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl) SwWordCountFloatDlg::~SwWordCountFloatDlg() { + disposeOnce(); +} + +void SwWordCountFloatDlg::dispose() +{ SwViewShell::SetCareWin( 0 ); + m_pCurrentWordFT.clear(); + m_pCurrentCharacterFT.clear(); + m_pCurrentCharacterExcludingSpacesFT.clear(); + m_pCurrentCjkcharsFT.clear(); + m_pCurrentStandardizedPagesFT.clear(); + m_pDocWordFT.clear(); + m_pDocCharacterFT.clear(); + m_pDocCharacterExcludingSpacesFT.clear(); + m_pDocCjkcharsFT.clear(); + m_pDocStandardizedPagesFT.clear(); + m_pCjkcharsLabelFT.clear(); + m_pStandardizedPagesLabelFT.clear(); + m_pClosePB.clear(); + SfxModelessDialog::dispose(); } namespace diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx index 5cdc698f750d..2cde14cea56d 100644 --- a/sw/source/ui/dochdl/selglos.cxx +++ b/sw/source/ui/dochdl/selglos.cxx @@ -35,6 +35,17 @@ SwSelGlossaryDlg::SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShort m_pGlosBox->SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl)); } +SwSelGlossaryDlg::~SwSelGlossaryDlg() +{ + disposeOnce(); +} + +void SwSelGlossaryDlg::dispose() +{ + m_pGlosBox.clear(); + ModalDialog::dispose(); +} + IMPL_LINK(SwSelGlossaryDlg, DoubleClickHdl, ListBox*, /*pBox*/) { EndDialog(RET_OK); diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 2e9ea372b3e7..0fa73fb0171d 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -197,6 +197,27 @@ SwEnvFmtPage::SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet) } +SwEnvFmtPage::~SwEnvFmtPage() +{ + disposeOnce(); +} + +void SwEnvFmtPage::dispose() +{ + m_pAddrLeftField.clear(); + m_pAddrTopField.clear(); + m_pAddrEditButton.clear(); + m_pSendLeftField.clear(); + m_pSendTopField.clear(); + m_pSendEditButton.clear(); + m_pSizeFormatBox.clear(); + m_pSizeWidthField.clear(); + m_pSizeHeightField.clear(); + m_pPreview.clear(); + SfxTabPage::dispose(); +} + + IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit ) { long lWVal = static_cast< long >(GetFldVal(*m_pSizeWidthField )); @@ -298,7 +319,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton ) ::PrepareBoxInfo( aTmpSet, *pSh ); const OUString sFmtStr = pColl->GetName(); - boost::scoped_ptr<SwParaDlg> pDlg(new SwParaDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr)); + VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFmtStr); if ( pDlg->Execute() == RET_OK ) { @@ -440,9 +461,9 @@ void SwEnvFmtPage::SetMinMax() m_pSizeHeightField->Reformat(); } -SfxTabPage* SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvFmtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvFmtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvFmtPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx index 73cb44d3647d..744f576dd9c7 100644 --- a/sw/source/ui/envelp/envfmt.hxx +++ b/sw/source/ui/envelp/envfmt.hxx @@ -30,21 +30,19 @@ class SwTxtFmtColl; class SwEnvFmtPage : public SfxTabPage { - MetricField* m_pAddrLeftField; - MetricField* m_pAddrTopField; - MenuButton* m_pAddrEditButton; - MetricField* m_pSendLeftField; - MetricField* m_pSendTopField; - MenuButton* m_pSendEditButton; - ListBox* m_pSizeFormatBox; - MetricField* m_pSizeWidthField; - MetricField* m_pSizeHeightField; - SwEnvPreview* m_pPreview; + VclPtr<MetricField> m_pAddrLeftField; + VclPtr<MetricField> m_pAddrTopField; + VclPtr<MenuButton> m_pAddrEditButton; + VclPtr<MetricField> m_pSendLeftField; + VclPtr<MetricField> m_pSendTopField; + VclPtr<MenuButton> m_pSendEditButton; + VclPtr<ListBox> m_pSizeFormatBox; + VclPtr<MetricField> m_pSizeWidthField; + VclPtr<MetricField> m_pSizeHeightField; + VclPtr<SwEnvPreview> m_pPreview; std::vector<sal_uInt16> aIDs; - SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); - DECL_LINK( ModifyHdl, Edit * ); DECL_LINK( EditHdl, MenuButton * ); DECL_LINK(FormatHdl, void *); @@ -59,8 +57,11 @@ class SwEnvFmtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwEnvFmtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 575d865fb74f..d0fcedae9073 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -153,8 +153,14 @@ SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwEnvDlg::~SwEnvDlg() { + disposeOnce(); +} + +void SwEnvDlg::dispose() +{ delete pAddresseeSet; delete pSenderSet; + SfxTabDialog::dispose(); } void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) @@ -229,6 +235,20 @@ SwEnvPage::SwEnvPage(vcl::Window* pParent, const SfxItemSet& rSet) SwEnvPage::~SwEnvPage() { + disposeOnce(); +} + +void SwEnvPage::dispose() +{ + m_pAddrEdit.clear(); + m_pDatabaseLB.clear(); + m_pTableLB.clear(); + m_pDBFieldLB.clear(); + m_pInsertBT.clear(); + m_pSenderBox.clear(); + m_pSenderEdit.clear(); + m_pPreview.clear(); + SfxTabPage::dispose(); } IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) @@ -303,9 +323,9 @@ void SwEnvPage::InitDatabaseBox() } } -SfxTabPage* SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx index 309ccc356e27..10b3a0d323de 100644 --- a/sw/source/ui/envelp/envprt.cxx +++ b/sw/source/ui/envelp/envprt.cxx @@ -67,6 +67,23 @@ SwEnvPrtPage::SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet) m_aIds[ENV_VER_RGHT] = m_pAlignBox->GetItemId("vertright"); } +SwEnvPrtPage::~SwEnvPrtPage() +{ + disposeOnce(); +} + +void SwEnvPrtPage::dispose() +{ + m_pAlignBox.clear(); + m_pTopButton.clear(); + m_pBottomButton.clear(); + m_pRightField.clear(); + m_pDownField.clear(); + m_pPrinterInfo.clear(); + m_pPrtSetup.clear(); + SfxTabPage::dispose(); +} + IMPL_LINK_NOARG(SwEnvPrtPage, ClickHdl) { if (m_pBottomButton->IsChecked()) @@ -99,7 +116,7 @@ IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn ) // Call printer setup if (pPrt) { - boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this)); + VclPtrInstance< PrinterSetupDialog > pDlg(this); pDlg->SetPrinter(pPrt); pDlg->Execute(); pDlg.reset(); @@ -127,9 +144,9 @@ IMPL_LINK_NOARG(SwEnvPrtPage, AlignHdl) return 0; } -SfxTabPage* SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwEnvPrtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwEnvPrtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwEnvPrtPage::ActivatePage(const SfxItemSet&) diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx index 2c947d53c3a1..a71c96b3a9e6 100644 --- a/sw/source/ui/envelp/envprt.hxx +++ b/sw/source/ui/envelp/envprt.hxx @@ -35,19 +35,17 @@ class SwEnvDlg; class SwEnvPrtPage : public SfxTabPage { - ToolBox* m_pAlignBox; - RadioButton* m_pTopButton; - RadioButton* m_pBottomButton; - MetricField* m_pRightField; - MetricField* m_pDownField; - FixedText* m_pPrinterInfo; - PushButton* m_pPrtSetup; + VclPtr<ToolBox> m_pAlignBox; + VclPtr<RadioButton> m_pTopButton; + VclPtr<RadioButton> m_pBottomButton; + VclPtr<MetricField> m_pRightField; + VclPtr<MetricField> m_pDownField; + VclPtr<FixedText> m_pPrinterInfo; + VclPtr<PushButton> m_pPrtSetup; sal_uInt16 m_aIds[ENV_VER_RGHT-ENV_HOR_LEFT+1]; - Printer* pPrt; - - SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Printer> pPrt; DECL_LINK(ClickHdl, void *); DECL_LINK(AlignHdl, void *); @@ -59,8 +57,11 @@ class SwEnvPrtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwEnvPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwEnvPrtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 426816ec8e3c..8cf472141a12 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -170,7 +170,14 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwLabDlg::~SwLabDlg() { + disposeOnce(); +} + +void SwLabDlg::dispose() +{ delete pRecs; + pPrtPage.clear(); + SfxTabDialog::dispose(); } void SwLabDlg::GetLabItem(SwLabItem &rItem) @@ -286,6 +293,29 @@ SwLabPage::SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet) m_pMakeBox->GetSelectHdl().Call(m_pMakeBox); } +SwLabPage::~SwLabPage() +{ + disposeOnce(); +} + +void SwLabPage::dispose() +{ + m_pAddressFrame.clear(); + m_pAddrBox.clear(); + m_pWritingEdit.clear(); + m_pDatabaseLB.clear(); + m_pTableLB.clear(); + m_pInsertBT.clear(); + m_pDBFieldLB.clear(); + m_pContButton.clear(); + m_pSheetButton.clear(); + m_pMakeBox.clear(); + m_pTypeBox.clear(); + m_pHiddenSortTypeBox.clear(); + m_pFormatInfo.clear(); + SfxTabPage::dispose(); +} + void SwLabPage::SetToBusinessCard() { SetHelpId(HID_BUSINESS_FMT_PAGE); @@ -406,24 +436,24 @@ IMPL_LINK_NOARG_INLINE_END(SwLabPage, TypeHdl) void SwLabPage::DisplayFormat() { - MetricField aField(this, WinBits(0)); + ScopedVclPtrInstance< MetricField > aField(this, WinBits(0)); FieldUnit aMetric = ::GetDfltMetric(false); - SetMetric(aField, aMetric); - aField.SetDecimalDigits(2); - aField.SetMin (0); - aField.SetMax (LONG_MAX); + SetMetric(*aField.get(), aMetric); + aField->SetDecimalDigits(2); + aField->SetMin (0); + aField->SetMax (LONG_MAX); SwLabRec* pRec = GetSelectedEntryPos(); aItem.aLstType = pRec->aType; - SETFLDVAL(aField, pRec->lWidth); - aField.Reformat(); - const OUString aWString = aField.GetText(); + SETFLDVAL(*aField.get(), pRec->lWidth); + aField->Reformat(); + const OUString aWString = aField->GetText(); - SETFLDVAL(aField, pRec->lHeight); - aField.Reformat(); + SETFLDVAL(*aField.get(), pRec->lHeight); + aField->Reformat(); OUString aText = pRec->aType + ": " + aWString + - " x " + aField.GetText() + + " x " + aField->GetText() + " (" + OUString::number( pRec->nCols ) + " x " + OUString::number( pRec->nRows ) + ")"; m_pFormatInfo->SetText(aText); @@ -458,9 +488,9 @@ void SwLabPage::InitDatabaseBox() } } -SfxTabPage* SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwLabPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwLabPage::ActivatePage(const SfxItemSet& rSet) @@ -586,17 +616,26 @@ SwVisitingCardPage::SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& r SwVisitingCardPage::~SwVisitingCardPage() { + disposeOnce(); +} + +void SwVisitingCardPage::dispose() +{ for(sal_Int32 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); ++i) delete static_cast<OUString*>(m_pAutoTextGroupLB->GetEntryData( i )); m_xAutoText = 0; ClearUserData(); delete pExampleFrame; + m_pAutoTextLB.clear(); + m_pAutoTextGroupLB.clear(); + m_pExampleWIN.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwVisitingCardPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwVisitingCardPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet) @@ -727,9 +766,37 @@ SwPrivateDataPage::SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSe SetExchangeSupport(); } -SfxTabPage* SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +SwPrivateDataPage::~SwPrivateDataPage() { - return new SwPrivateDataPage(pParent, *rSet); + disposeOnce(); +} + +void SwPrivateDataPage::dispose() +{ + m_pFirstNameED.clear(); + m_pNameED.clear(); + m_pShortCutED.clear(); + m_pFirstName2ED.clear(); + m_pName2ED.clear(); + m_pShortCut2ED.clear(); + m_pStreetED.clear(); + m_pZipED.clear(); + m_pCityED.clear(); + m_pCountryED.clear(); + m_pStateED.clear(); + m_pTitleED.clear(); + m_pProfessionED.clear(); + m_pPhoneED.clear(); + m_pMobilePhoneED.clear(); + m_pFaxED.clear(); + m_pHomePageED.clear(); + m_pMailED.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +{ + return VclPtr<SfxTabPage>(new SwPrivateDataPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet) @@ -815,9 +882,34 @@ SwBusinessDataPage::SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& r SetExchangeSupport(); } -SfxTabPage* SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +SwBusinessDataPage::~SwBusinessDataPage() +{ + disposeOnce(); +} + +void SwBusinessDataPage::dispose() +{ + m_pCompanyED.clear(); + m_pCompanyExtED.clear(); + m_pSloganED.clear(); + m_pStreetED.clear(); + m_pZipED.clear(); + m_pCityED.clear(); + m_pCountryED.clear(); + m_pStateED.clear(); + m_pPositionED.clear(); + m_pPhoneED.clear(); + m_pMobilePhoneED.clear(); + m_pFaxED.clear(); + m_pHomePageED.clear(); + m_pMailED.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwBusinessDataPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwBusinessDataPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 9e9a216f5848..646da3d044b4 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -353,8 +353,29 @@ SwLabFmtPage::SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet) SwLabFmtPage::~SwLabFmtPage() { + disposeOnce(); } +void SwLabFmtPage::dispose() +{ + m_pMakeFI.clear(); + m_pTypeFI.clear(); + m_pPreview.clear(); + m_pHDistField.clear(); + m_pVDistField.clear(); + m_pWidthField.clear(); + m_pHeightField.clear(); + m_pLeftField.clear(); + m_pUpperField.clear(); + m_pColsField.clear(); + m_pRowsField.clear(); + m_pPWidthField.clear(); + m_pPHeightField.clear(); + m_pSavePB.clear(); + SfxTabPage::dispose(); +} + + // Modify-handler of MetricFields. start preview timer IMPL_LINK_NOARG_INLINE_START(SwLabFmtPage, ModifyHdl) { @@ -464,9 +485,9 @@ void SwLabFmtPage::ChangeMinMax() m_pPHeightField->Reformat(); } -SfxTabPage* SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabFmtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabFmtPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwLabFmtPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwLabFmtPage::ActivatePage(const SfxItemSet& rSet) @@ -558,7 +579,7 @@ IMPL_LINK_NOARG(SwLabFmtPage, SaveHdl) aRec.lPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField )); aRec.lPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField)); aRec.bCont = aItem.bCont; - boost::scoped_ptr<SwSaveLabelDlg> pSaveDlg(new SwSaveLabelDlg(this, aRec)); + ScopedVclPtrInstance< SwSaveLabelDlg > pSaveDlg(this, aRec); pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType); pSaveDlg->Execute(); if(pSaveDlg->GetLabel(aItem)) @@ -600,6 +621,20 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) } } +SwSaveLabelDlg::~SwSaveLabelDlg() +{ + disposeOnce(); +} + +void SwSaveLabelDlg::dispose() +{ + m_pMakeCB.clear(); + m_pTypeED.clear(); + m_pOKPB.clear(); + pLabPage.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) { SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig(); @@ -614,15 +649,15 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) return 0; } - MessageDialog aQuery(this, "QuerySaveLabelDialog", - "modules/swriter/ui/querysavelabeldialog.ui"); + ScopedVclPtrInstance<MessageDialog> aQuery(this, "QuerySaveLabelDialog", + "modules/swriter/ui/querysavelabeldialog.ui"); - aQuery.set_primary_text(aQuery.get_primary_text(). + aQuery->set_primary_text(aQuery->get_primary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - aQuery.set_secondary_text(aQuery.get_secondary_text(). + aQuery->set_secondary_text(aQuery->get_secondary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - if (RET_YES != aQuery.Execute()) + if (RET_YES != aQuery->Execute()) return 0; } rLabRec.aType = sType; diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx index a50d525ebcce..d35833a7122b 100644 --- a/sw/source/ui/envelp/labfmt.hxx +++ b/sw/source/ui/envelp/labfmt.hxx @@ -69,29 +69,26 @@ public: class SwLabFmtPage : public SfxTabPage { - FixedText* m_pMakeFI; - FixedText* m_pTypeFI; - SwLabPreview* m_pPreview; - MetricField* m_pHDistField; - MetricField* m_pVDistField; - MetricField* m_pWidthField; - MetricField* m_pHeightField; - MetricField* m_pLeftField; - MetricField* m_pUpperField; - NumericField* m_pColsField; - NumericField* m_pRowsField; - MetricField* m_pPWidthField; - MetricField* m_pPHeightField; - PushButton* m_pSavePB; + VclPtr<FixedText> m_pMakeFI; + VclPtr<FixedText> m_pTypeFI; + VclPtr<SwLabPreview> m_pPreview; + VclPtr<MetricField> m_pHDistField; + VclPtr<MetricField> m_pVDistField; + VclPtr<MetricField> m_pWidthField; + VclPtr<MetricField> m_pHeightField; + VclPtr<MetricField> m_pLeftField; + VclPtr<MetricField> m_pUpperField; + VclPtr<NumericField> m_pColsField; + VclPtr<NumericField> m_pRowsField; + VclPtr<MetricField> m_pPWidthField; + VclPtr<MetricField> m_pPHeightField; + VclPtr<PushButton> m_pSavePB; Idle aPreviewIdle; bool bModified; SwLabItem aItem; - SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); - virtual ~SwLabFmtPage(); - DECL_LINK(ModifyHdl, void *); DECL_LINK(PreviewHdl, void *); DECL_LINK( LoseFocusHdl, Control * ); @@ -103,8 +100,11 @@ class SwLabFmtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabFmtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwLabFmtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -117,12 +117,12 @@ public: class SwSaveLabelDlg : public ModalDialog { - ComboBox* m_pMakeCB; - Edit* m_pTypeED; - OKButton* m_pOKPB; + VclPtr<ComboBox> m_pMakeCB; + VclPtr<Edit> m_pTypeED; + VclPtr<OKButton> m_pOKPB; bool bSuccess; - SwLabFmtPage* pLabPage; + VclPtr<SwLabFmtPage> pLabPage; SwLabRec& rLabRec; DECL_LINK(OkHdl, void *); @@ -130,6 +130,8 @@ class SwSaveLabelDlg : public ModalDialog public: SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec); + virtual ~SwSaveLabelDlg(); + virtual void dispose() SAL_OVERRIDE; void SetLabel(const OUString& rMake, const OUString& rType) { diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index 5574fce5de49..9443dfcb9622 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -62,7 +62,22 @@ SwLabPrtPage::SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet) SwLabPrtPage::~SwLabPrtPage() { - delete pPrinter; + disposeOnce(); +} + +void SwLabPrtPage::dispose() +{ + pPrinter.disposeAndClear(); + m_pPageButton.clear(); + m_pSingleButton.clear(); + m_pSingleGrid.clear(); + m_pPrinterFrame.clear(); + m_pColField.clear(); + m_pRowField.clear(); + m_pSynchronCB.clear(); + m_pPrinterInfo.clear(); + m_pPrtSetup.clear(); + SfxTabPage::dispose(); } IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) @@ -73,7 +88,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) if (!pPrinter) pPrinter = new Printer; - boost::scoped_ptr<PrinterSetupDialog> pDlg(new PrinterSetupDialog(this)); + VclPtrInstance< PrinterSetupDialog > pDlg(this); pDlg->SetPrinter(pPrinter); pDlg->Execute(); pDlg.reset(); @@ -93,9 +108,9 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) return 0; } -SfxTabPage* SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) +VclPtr<SfxTabPage> SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return new SwLabPrtPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwLabPrtPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet ) diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx index c011687f6cd7..45b5decffb5e 100644 --- a/sw/source/ui/envelp/labprt.hxx +++ b/sw/source/ui/envelp/labprt.hxx @@ -31,21 +31,18 @@ class SwLabItem; class SwLabPrtPage : public SfxTabPage { - Printer* pPrinter; // for the shaft setting - unfortunately + VclPtr<Printer> pPrinter; // for the shaft setting - unfortunately - RadioButton* m_pPageButton; - RadioButton* m_pSingleButton; - VclContainer* m_pSingleGrid; - VclContainer* m_pPrinterFrame; - NumericField* m_pColField; - NumericField* m_pRowField; - CheckBox* m_pSynchronCB; + VclPtr<RadioButton> m_pPageButton; + VclPtr<RadioButton> m_pSingleButton; + VclPtr<VclContainer> m_pSingleGrid; + VclPtr<VclContainer> m_pPrinterFrame; + VclPtr<NumericField> m_pColField; + VclPtr<NumericField> m_pRowField; + VclPtr<CheckBox> m_pSynchronCB; - FixedText* m_pPrinterInfo; - PushButton* m_pPrtSetup; - - SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); - virtual ~SwLabPrtPage(); + VclPtr<FixedText> m_pPrinterInfo; + VclPtr<PushButton> m_pPrtSetup; DECL_LINK( CountHdl, Button * ); @@ -55,8 +52,11 @@ class SwLabPrtPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwLabPrtPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index dac471ea8bc3..25397c3f66ef 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -389,6 +389,11 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, SwMailMergeDlg::~SwMailMergeDlg() { + disposeOnce(); +} + +void SwMailMergeDlg::dispose() +{ if(m_xFrame.is()) { m_xFrame->setComponent(NULL, NULL); @@ -401,6 +406,39 @@ SwMailMergeDlg::~SwMailMergeDlg() delete pData; } delete pImpl; + m_pBeamerWin.clear(); + m_pAllRB.clear(); + m_pMarkedRB.clear(); + m_pFromRB.clear(); + m_pFromNF.clear(); + m_pToNF.clear(); + m_pPrinterRB.clear(); + m_pMailingRB.clear(); + m_pFileRB.clear(); + m_pSingleJobsCB.clear(); + m_pSaveMergedDocumentFT.clear(); + m_pSaveSingleDocRB.clear(); + m_pSaveIndividualRB.clear(); + m_pGenerateFromDataBaseCB.clear(); + m_pColumnFT.clear(); + m_pColumnLB.clear(); + m_pPathFT.clear(); + m_pPathED.clear(); + m_pPathPB.clear(); + m_pFilterFT.clear(); + m_pFilterLB.clear(); + m_pAddressFldLB.clear(); + m_pSubjectFT.clear(); + m_pSubjectED.clear(); + m_pFormatFT.clear(); + m_pAttachFT.clear(); + m_pAttachED.clear(); + m_pAttachPB.clear(); + m_pFormatHtmlCB.clear(); + m_pFormatRtfCB.clear(); + m_pFormatSwCB.clear(); + m_pOkBTN.clear(); + SvxStandardDialog::dispose(); } void SwMailMergeDlg::Apply() @@ -633,6 +671,17 @@ SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(vcl::Window* pParent) get(m_pThisDocRB, "document"); } +SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg() +{ + disposeOnce(); +} + +void SwMailMergeCreateFromDlg::dispose() +{ + m_pThisDocRB.clear(); + ModalDialog::dispose(); +} + SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pParent) : ModalDialog(pParent, "MergeConnectDialog", "modules/swriter/ui/mergeconnectdialog.ui") @@ -640,4 +689,15 @@ SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(vcl::Window* pPar get(m_pUseExistingRB, "existing"); } +SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg() +{ + disposeOnce(); +} + +void SwMailMergeFieldConnectionsDlg::dispose() +{ + m_pUseExistingRB.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index 0aa045936d7e..d69af8dd5ee1 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -29,26 +29,24 @@ class SwLabPage : public SfxTabPage OUString sActDBName; SwLabItem aItem; - VclContainer* m_pAddressFrame; - - CheckBox* m_pAddrBox; - VclMultiLineEdit* m_pWritingEdit; - ListBox* m_pDatabaseLB; - ListBox* m_pTableLB; - PushButton* m_pInsertBT; - ListBox* m_pDBFieldLB; - - RadioButton* m_pContButton; - RadioButton* m_pSheetButton; - ListBox* m_pMakeBox; - ListBox* m_pTypeBox; - ListBox* m_pHiddenSortTypeBox; - FixedText* m_pFormatInfo; + VclPtr<VclContainer> m_pAddressFrame; + + VclPtr<CheckBox> m_pAddrBox; + VclPtr<VclMultiLineEdit> m_pWritingEdit; + VclPtr<ListBox> m_pDatabaseLB; + VclPtr<ListBox> m_pTableLB; + VclPtr<PushButton> m_pInsertBT; + VclPtr<ListBox> m_pDBFieldLB; + + VclPtr<RadioButton> m_pContButton; + VclPtr<RadioButton> m_pSheetButton; + VclPtr<ListBox> m_pMakeBox; + VclPtr<ListBox> m_pTypeBox; + VclPtr<ListBox> m_pHiddenSortTypeBox; + VclPtr<FixedText> m_pFormatInfo; bool m_bLabel; - SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet); - DECL_LINK(AddrHdl, void *); DECL_LINK( DatabaseHdl, ListBox *pListBox ); DECL_LINK(FieldHdl, void *); @@ -63,8 +61,12 @@ class SwLabPage : public SfxTabPage using TabPage::DeactivatePage; public: + SwLabPage(vcl::Window* pParent, const SfxItemSet& rSet); - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + virtual ~SwLabPage(); + virtual void dispose() SAL_OVERRIDE; + + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -84,9 +86,9 @@ public: class SwOneExampleFrame; class SwVisitingCardPage : public SfxTabPage { - SvTreeListBox* m_pAutoTextLB; - ListBox* m_pAutoTextGroupLB; - vcl::Window* m_pExampleWIN; + VclPtr<SvTreeListBox> m_pAutoTextLB; + VclPtr<ListBox> m_pAutoTextGroupLB; + VclPtr<vcl::Window> m_pExampleWIN; OUString sTempURL; @@ -108,15 +110,16 @@ class SwVisitingCardPage : public SfxTabPage const OUString* pNames, const OUString* pValues ); - SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwVisitingCardPage(); + virtual void dispose() SAL_OVERRIDE; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwVisitingCardPage(vcl::Window* pParent, const SfxItemSet& rSet); - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -126,35 +129,36 @@ public: class SwPrivateDataPage : public SfxTabPage { - Edit* m_pFirstNameED; - Edit* m_pNameED; - Edit* m_pShortCutED; - - Edit* m_pFirstName2ED; - Edit* m_pName2ED; - Edit* m_pShortCut2ED; - - Edit* m_pStreetED; - Edit* m_pZipED; - Edit* m_pCityED; - Edit* m_pCountryED; - Edit* m_pStateED; - Edit* m_pTitleED; - Edit* m_pProfessionED; - Edit* m_pPhoneED; - Edit* m_pMobilePhoneED; - Edit* m_pFaxED; - Edit* m_pHomePageED; - Edit* m_pMailED; - - SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Edit> m_pFirstNameED; + VclPtr<Edit> m_pNameED; + VclPtr<Edit> m_pShortCutED; + + VclPtr<Edit> m_pFirstName2ED; + VclPtr<Edit> m_pName2ED; + VclPtr<Edit> m_pShortCut2ED; + + VclPtr<Edit> m_pStreetED; + VclPtr<Edit> m_pZipED; + VclPtr<Edit> m_pCityED; + VclPtr<Edit> m_pCountryED; + VclPtr<Edit> m_pStateED; + VclPtr<Edit> m_pTitleED; + VclPtr<Edit> m_pProfessionED; + VclPtr<Edit> m_pPhoneED; + VclPtr<Edit> m_pMobilePhoneED; + VclPtr<Edit> m_pFaxED; + VclPtr<Edit> m_pHomePageED; + VclPtr<Edit> m_pMailED; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwPrivateDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwPrivateDataPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; @@ -164,33 +168,34 @@ public: class SwBusinessDataPage : public SfxTabPage { - Edit* m_pCompanyED; - Edit* m_pCompanyExtED; - Edit* m_pSloganED; + VclPtr<Edit> m_pCompanyED; + VclPtr<Edit> m_pCompanyExtED; + VclPtr<Edit> m_pSloganED; - Edit* m_pStreetED; - Edit* m_pZipED; - Edit* m_pCityED; - Edit* m_pCountryED; - Edit* m_pStateED; + VclPtr<Edit> m_pStreetED; + VclPtr<Edit> m_pZipED; + VclPtr<Edit> m_pCityED; + VclPtr<Edit> m_pCountryED; + VclPtr<Edit> m_pStateED; - Edit* m_pPositionED; + VclPtr<Edit> m_pPositionED; - Edit* m_pPhoneED; - Edit* m_pMobilePhoneED; - Edit* m_pFaxED; + VclPtr<Edit> m_pPhoneED; + VclPtr<Edit> m_pMobilePhoneED; + VclPtr<Edit> m_pFaxED; - Edit* m_pHomePageED; - Edit* m_pMailED; - - SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + VclPtr<Edit> m_pHomePageED; + VclPtr<Edit> m_pMailED; using TabPage::ActivatePage; using TabPage::DeactivatePage; public: + SwBusinessDataPage(vcl::Window* pParent, const SfxItemSet& rSet); + virtual ~SwBusinessDataPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rSet); virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE; virtual sfxpg DeactivatePage(SfxItemSet* pSet = 0) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx index fce5029d6e32..12ebb825233a 100644 --- a/sw/source/ui/fldui/DropDownFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx @@ -71,6 +71,20 @@ sw::DropDownFieldDialog::DropDownFieldDialog(vcl::Window *pParent, SwWrtShell &r m_pListItemsLB->GrabFocus(); } +sw::DropDownFieldDialog::~DropDownFieldDialog() +{ + disposeOnce(); +} + +void sw::DropDownFieldDialog::dispose() +{ + m_pListItemsLB.clear(); + m_pOKPB.clear(); + m_pNextPB.clear(); + m_pEditPB.clear(); + SvxStandardDialog::dispose(); +} + void sw::DropDownFieldDialog::Apply() { if(pDropField) diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index d5a171d3b0af..b94c049dd59f 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -164,8 +164,20 @@ SvTreeListEntry* SwChangeDBDlg::Insert(const OUString& rDBName) // destroy dialog SwChangeDBDlg::~SwChangeDBDlg() { + disposeOnce(); +} + +void SwChangeDBDlg::dispose() +{ delete pMgr; + m_pUsedDBTLB.clear(); + m_pAvailDBTLB.clear(); + m_pAddDBPB.clear(); + m_pDocDBNameFT.clear(); + m_pDefineBT.clear(); + SvxStandardDialog::dispose(); } + // close void SwChangeDBDlg::Apply() { diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index a2af66a9d61a..edde37524594 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -74,6 +74,24 @@ SwFldDBPage::SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwFldDBPage::~SwFldDBPage() { + disposeOnce(); +} + +void SwFldDBPage::dispose() +{ + m_pTypeLB.clear(); + m_pDatabaseTLB.clear(); + m_pAddDBPB.clear(); + m_pCondition.clear(); + m_pConditionED.clear(); + m_pValue.clear(); + m_pValueED.clear(); + m_pDBFormatRB.clear(); + m_pNewFormatRB.clear(); + m_pNumFormatLB.clear(); + m_pFormatLB.clear(); + m_pFormat.clear(); + SwFldPage::dispose(); } // initialise TabPage @@ -246,10 +264,10 @@ bool SwFldDBPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDBPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDBPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDBPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDBPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDBPage::GetGroup() diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx index 6163cb9566d3..bb18eb27fe82 100644 --- a/sw/source/ui/fldui/flddb.hxx +++ b/sw/source/ui/fldui/flddb.hxx @@ -32,20 +32,20 @@ class SwFldDBPage : public SwFldPage { - ListBox* m_pTypeLB; - SwDBTreeList* m_pDatabaseTLB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<SwDBTreeList> m_pDatabaseTLB; - PushButton* m_pAddDBPB; + VclPtr<PushButton> m_pAddDBPB; - VclContainer* m_pCondition; - ConditionEdit* m_pConditionED; - VclContainer* m_pValue; - Edit* m_pValueED; - RadioButton* m_pDBFormatRB; - RadioButton* m_pNewFormatRB; - NumFormatListBox* m_pNumFormatLB; - ListBox* m_pFormatLB; - VclContainer* m_pFormat; + VclPtr<VclContainer> m_pCondition; + VclPtr<ConditionEdit> m_pConditionED; + VclPtr<VclContainer> m_pValue; + VclPtr<Edit> m_pValueED; + VclPtr<RadioButton> m_pDBFormatRB; + VclPtr<RadioButton> m_pNewFormatRB; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<ListBox> m_pFormatLB; + VclPtr<VclContainer> m_pFormat; OUString m_sOldDBName; OUString m_sOldTableName; @@ -71,8 +71,9 @@ public: SwFldDBPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldDBPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 1655f570b768..8814ceb3c3f9 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -89,6 +89,18 @@ SwFldDokInfPage::SwFldDokInfPage(vcl::Window* pParent, const SfxItemSet& rCoreSe SwFldDokInfPage::~SwFldDokInfPage() { + disposeOnce(); +} + +void SwFldDokInfPage::dispose() +{ + m_pTypeTLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pFixedCB.clear(); + SwFldPage::dispose(); } void SwFldDokInfPage::Reset(const SfxItemSet* ) @@ -450,10 +462,10 @@ bool SwFldDokInfPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDokInfPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDokInfPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDokInfPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDokInfPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDokInfPage::GetGroup() diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx index 596d3bc2d3b7..fc9452075b4a 100644 --- a/sw/source/ui/fldui/flddinf.hxx +++ b/sw/source/ui/fldui/flddinf.hxx @@ -36,12 +36,12 @@ namespace com{namespace sun{ namespace star{ namespace beans{ class SwFldDokInfPage : public SwFldPage { - SvTreeListBox* m_pTypeTLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; - VclContainer* m_pFormat; - NumFormatListBox* m_pFormatLB; - CheckBox* m_pFixedCB; + VclPtr<SvTreeListBox> m_pTypeTLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<NumFormatListBox> m_pFormatLB; + VclPtr<CheckBox> m_pFixedCB; SvTreeListEntry* pSelEntry; com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet; @@ -62,8 +62,9 @@ public: SwFldDokInfPage(vcl::Window* pWindow, const SfxItemSet& rSet); virtual ~SwFldDokInfPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index ea3ec74a5bb9..f8dc98f74e6a 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -80,8 +80,29 @@ SwFldDokPage::SwFldDokPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldDokPage::~SwFldDokPage() { + disposeOnce(); } +void SwFldDokPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pLevelFT.clear(); + m_pLevelED.clear(); + m_pDateFT.clear(); + m_pTimeFT.clear(); + m_pDateOffsetED.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNumFormatLB.clear(); + m_pFixedCB.clear(); + SwFldPage::dispose(); +} + + void SwFldDokPage::Reset(const SfxItemSet* ) { SavePos(m_pTypeLB); @@ -632,10 +653,10 @@ bool SwFldDokPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldDokPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldDokPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldDokPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldDokPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldDokPage::GetGroup() diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx index 4e8abc27e2b0..3beb6a7c0a1b 100644 --- a/sw/source/ui/fldui/flddok.hxx +++ b/sw/source/ui/fldui/flddok.hxx @@ -32,20 +32,20 @@ class SwFldDokPage : public SwFldPage { - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; - FixedText* m_pValueFT; - Edit* m_pValueED; - FixedText* m_pLevelFT; - NumericField* m_pLevelED; - FixedText* m_pDateFT; - FixedText* m_pTimeFT; - NumericField* m_pDateOffsetED; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - NumFormatListBox* m_pNumFormatLB; - CheckBox* m_pFixedCB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<FixedText> m_pValueFT; + VclPtr<Edit> m_pValueED; + VclPtr<FixedText> m_pLevelFT; + VclPtr<NumericField> m_pLevelED; + VclPtr<FixedText> m_pDateFT; + VclPtr<FixedText> m_pTimeFT; + VclPtr<NumericField> m_pDateOffsetED; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<CheckBox> m_pFixedCB; sal_Int32 nOldSel; sal_uLong nOldFormat; @@ -64,8 +64,9 @@ public: SwFldDokPage(vcl::Window* pWindow, const SfxItemSet& rSet); virtual ~SwFldDokPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 32dd26eebaff..1b7906b02368 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -124,7 +124,7 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw) // initialise controls void SwFldEditDlg::Init() { - SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage()); + VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage()); if( pTabPage ) { @@ -159,10 +159,10 @@ void SwFldEditDlg::Init() !pSh->HasReadonlySel() ); } -SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) +VclPtr<SfxTabPage> SwFldEditDlg::CreatePage(sal_uInt16 nGroup) { // create TabPage - SfxTabPage* pTabPage = 0; + VclPtr<SfxTabPage> pTabPage; switch (nGroup) { @@ -193,7 +193,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) } case GRP_DB: pTabPage = SwFldDBPage::Create(get_content_area(), 0); - static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh); + static_cast<SwFldDBPage*>(pTabPage.get())->SetWrtShell(*pSh); break; case GRP_VAR: pTabPage = SwFldVarPage::Create(get_content_area(), 0); @@ -205,7 +205,7 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) if (pTabPage) { - static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh); + static_cast<SwFldPage*>(pTabPage.get())->SetWrtShell(pSh); SetTabPage(pTabPage); } @@ -214,8 +214,17 @@ SfxTabPage* SwFldEditDlg::CreatePage(sal_uInt16 nGroup) SwFldEditDlg::~SwFldEditDlg() { + disposeOnce(); +} + +void SwFldEditDlg::dispose() +{ SwViewShell::SetCareWin(NULL); pSh->EnterStdMode(); + m_pPrevBT.clear(); + m_pNextBT.clear(); + m_pAddressBT.clear(); + SfxSingleTabDialog::dispose(); } void SwFldEditDlg::EnableInsert(bool bEnable) @@ -235,12 +244,9 @@ IMPL_LINK_NOARG(SwFldEditDlg, OKHdl) { if (GetOKButton()->IsEnabled()) { - SfxTabPage* pTabPage = GetTabPage(); + VclPtr<SfxTabPage> pTabPage = GetTabPage(); if (pTabPage) - { pTabPage->FillItemSet(0); - - } EndDialog( RET_OK ); } @@ -261,7 +267,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) pSh->EnterStdMode(); SwFieldType *pOldTyp = 0; - SwFldPage* pTabPage = static_cast<SwFldPage*>(GetTabPage()); + VclPtr<SwFldPage> pTabPage = static_cast<SwFldPage*>(GetTabPage()); //#112462# FillItemSet may delete the current field //that's why it has to be called before accessing the current field @@ -281,7 +287,7 @@ IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton ) sal_uInt16 nGroup = rMgr.GetGroup(false, pCurFld->GetTypeId(), pCurFld->GetSubType()); if (nGroup != pTabPage->GetGroup()) - pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup)); + pTabPage = static_cast<SwFldPage*>(CreatePage(nGroup).get()); pTabPage->EditNewField(); diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index b190d69c67bd..f079e8787d90 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -91,6 +91,37 @@ SwFldFuncPage::SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) SwFldFuncPage::~SwFldFuncPage() { + disposeOnce(); +} + +void SwFldFuncPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelectionLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueGroup.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pCond1FT.clear(); + m_pCond1ED.clear(); + m_pCond2FT.clear(); + m_pCond2ED.clear(); + m_pMacroBT.clear(); + m_pListGroup.clear(); + m_pListItemFT.clear(); + m_pListItemED.clear(); + m_pListAddPB.clear(); + m_pListItemsFT.clear(); + m_pListItemsLB.clear(); + m_pListRemovePB.clear(); + m_pListUpPB.clear(); + m_pListDownPB.clear(); + m_pListNameFT.clear(); + m_pListNameED.clear(); + SwFldPage::dispose(); } void SwFldFuncPage::Reset(const SfxItemSet* ) @@ -597,10 +628,10 @@ OUString SwFldFuncPage::TurnMacroString(const OUString &rMacro) return rMacro; } -SfxTabPage* SwFldFuncPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldFuncPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldFuncPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldFuncPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldFuncPage::GetGroup() diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx index fb8cfa906969..fefc9db21ac4 100644 --- a/sw/source/ui/fldui/fldfunc.hxx +++ b/sw/source/ui/fldui/fldfunc.hxx @@ -32,33 +32,33 @@ class SwFldFuncPage : public SwFldPage { - ListBox* m_pTypeLB; - ListBox* m_pSelectionLB; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - FixedText* m_pNameFT; - ConditionEdit* m_pNameED; - VclContainer* m_pValueGroup; - FixedText* m_pValueFT; - Edit* m_pValueED; - FixedText* m_pCond1FT; - ConditionEdit* m_pCond1ED; - FixedText* m_pCond2FT; - ConditionEdit* m_pCond2ED; - PushButton* m_pMacroBT; + VclPtr<ListBox> m_pTypeLB; + VclPtr<ListBox> m_pSelectionLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<ConditionEdit> m_pNameED; + VclPtr<VclContainer> m_pValueGroup; + VclPtr<FixedText> m_pValueFT; + VclPtr<Edit> m_pValueED; + VclPtr<FixedText> m_pCond1FT; + VclPtr<ConditionEdit> m_pCond1ED; + VclPtr<FixedText> m_pCond2FT; + VclPtr<ConditionEdit> m_pCond2ED; + VclPtr<PushButton> m_pMacroBT; //controls of "Input list" - VclContainer* m_pListGroup; - FixedText* m_pListItemFT; - ReturnActionEdit* m_pListItemED; - PushButton* m_pListAddPB; - FixedText* m_pListItemsFT; - ListBox* m_pListItemsLB; - PushButton* m_pListRemovePB; - PushButton* m_pListUpPB; - PushButton* m_pListDownPB; - FixedText* m_pListNameFT; - Edit* m_pListNameED; + VclPtr<VclContainer> m_pListGroup; + VclPtr<FixedText> m_pListItemFT; + VclPtr<ReturnActionEdit> m_pListItemED; + VclPtr<PushButton> m_pListAddPB; + VclPtr<FixedText> m_pListItemsFT; + VclPtr<ListBox> m_pListItemsLB; + VclPtr<PushButton> m_pListRemovePB; + VclPtr<PushButton> m_pListUpPB; + VclPtr<PushButton> m_pListDownPB; + VclPtr<FixedText> m_pListNameFT; + VclPtr<Edit> m_pListNameED; OUString m_sOldValueFT; OUString m_sOldNameFT; @@ -86,8 +86,9 @@ public: SwFldFuncPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldFuncPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 247dda169e18..f704afcf1bd3 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -107,6 +107,21 @@ SwFldRefPage::SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldRefPage::~SwFldRefPage() { + disposeOnce(); +} + +void SwFldRefPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pSelectionToolTipLB.clear(); + m_pFormat.clear(); + m_pFormatLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueED.clear(); + SwFldPage::dispose(); } // #i83479# @@ -935,10 +950,10 @@ bool SwFldRefPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldRefPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldRefPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldRefPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldRefPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldRefPage::GetGroup() diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx index 27e5ab4fb22e..24c540f181f7 100644 --- a/sw/source/ui/fldui/fldref.hxx +++ b/sw/source/ui/fldui/fldref.hxx @@ -34,16 +34,16 @@ class SwTxtNode; class SwFldRefPage : public SwFldPage { - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - ListBox* m_pSelectionLB; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<ListBox> m_pSelectionLB; // #i83479# - SwFldRefTreeListBox* m_pSelectionToolTipLB; - VclContainer* m_pFormat; - ListBox* m_pFormatLB; - FixedText* m_pNameFT; - Edit* m_pNameED; - Edit* m_pValueED; + VclPtr<SwFldRefTreeListBox> m_pSelectionToolTipLB; + VclPtr<VclContainer> m_pFormat; + VclPtr<ListBox> m_pFormatLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<Edit> m_pNameED; + VclPtr<Edit> m_pValueED; OUString sBookmarkTxt; OUString sFootnoteTxt; OUString sEndnoteTxt; @@ -77,8 +77,9 @@ public: SwFldRefPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldRefPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index a72e4c99662e..27c60f81e1f9 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -87,6 +87,28 @@ SwFldVarPage::SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rCoreSet ) SwFldVarPage::~SwFldVarPage() { + disposeOnce(); +} + +void SwFldVarPage::dispose() +{ + m_pTypeLB.clear(); + m_pSelection.clear(); + m_pSelectionLB.clear(); + m_pNameFT.clear(); + m_pNameED.clear(); + m_pValueFT.clear(); + m_pValueED.clear(); + m_pFormat.clear(); + m_pNumFormatLB.clear(); + m_pFormatLB.clear(); + m_pChapterFrame.clear(); + m_pChapterLevelLB.clear(); + m_pInvisibleCB.clear(); + m_pSeparatorFT.clear(); + m_pSeparatorED.clear(); + m_pNewDelTBX.clear(); + SwFldPage::dispose(); } void SwFldVarPage::Reset(const SfxItemSet* ) @@ -1225,10 +1247,10 @@ bool SwFldVarPage::FillItemSet(SfxItemSet* ) return false; } -SfxTabPage* SwFldVarPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ) +VclPtr<SfxTabPage> SwFldVarPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet ) { - return ( new SwFldVarPage( pParent, *rAttrSet ) ); + return VclPtr<SwFldVarPage>::Create( pParent, *rAttrSet ); } sal_uInt16 SwFldVarPage::GetGroup() diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx index 9d1a37f0a5a9..a37aa5809fda 100644 --- a/sw/source/ui/fldui/fldvar.hxx +++ b/sw/source/ui/fldui/fldvar.hxx @@ -51,22 +51,22 @@ class SwFldVarPage : public SwFldPage { friend class SelectionListBox; - ListBox* m_pTypeLB; - VclContainer* m_pSelection; - SelectionListBox* m_pSelectionLB; - FixedText* m_pNameFT; - Edit* m_pNameED; - FixedText* m_pValueFT; - ConditionEdit* m_pValueED; - VclContainer* m_pFormat; - NumFormatListBox* m_pNumFormatLB; - ListBox* m_pFormatLB; - VclContainer* m_pChapterFrame; - ListBox* m_pChapterLevelLB; - CheckBox* m_pInvisibleCB; - FixedText* m_pSeparatorFT; - Edit* m_pSeparatorED; - ToolBox* m_pNewDelTBX; + VclPtr<ListBox> m_pTypeLB; + VclPtr<VclContainer> m_pSelection; + VclPtr<SelectionListBox> m_pSelectionLB; + VclPtr<FixedText> m_pNameFT; + VclPtr<Edit> m_pNameED; + VclPtr<FixedText> m_pValueFT; + VclPtr<ConditionEdit> m_pValueED; + VclPtr<VclContainer> m_pFormat; + VclPtr<NumFormatListBox> m_pNumFormatLB; + VclPtr<ListBox> m_pFormatLB; + VclPtr<VclContainer> m_pChapterFrame; + VclPtr<ListBox> m_pChapterLevelLB; + VclPtr<CheckBox> m_pInvisibleCB; + VclPtr<FixedText> m_pSeparatorFT; + VclPtr<Edit> m_pSeparatorED; + VclPtr<ToolBox> m_pNewDelTBX; sal_uInt16 m_nApplyId; sal_uInt16 m_nDeleteId; @@ -93,8 +93,9 @@ public: SwFldVarPage(vcl::Window* pParent, const SfxItemSet& rSet); virtual ~SwFldVarPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); + static VclPtr<SfxTabPage> Create(vcl::Window* pParent, const SfxItemSet* rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 3346d84d9615..1da4ca51f107 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -106,6 +106,20 @@ SwFldInputDlg::SwFldInputDlg( vcl::Window *pParent, SwWrtShell &rS, m_pEditED->SetText(convertLineEnd(aStr, GetSystemLineEnd())); } +SwFldInputDlg::~SwFldInputDlg() +{ + disposeOnce(); +} + +void SwFldInputDlg::dispose() +{ + m_pLabelED.clear(); + m_pEditED.clear(); + m_pOKBT.clear(); + m_pNextBT.clear(); + SvxStandardDialog::dispose(); +} + void SwFldInputDlg::StateChanged( StateChangedType nType ) { if ( nType == StateChangedType::INITSHOW ) diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 8bf330418207..7df369a9526c 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -88,10 +88,26 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) : SwJavaEditDialog::~SwJavaEditDialog() { + disposeOnce(); +} + +void SwJavaEditDialog::dispose() +{ pSh->EnterStdMode(); delete pMgr; delete pFileDlg; Application::SetDefDialogParent( pOldDefDlgParent ); + m_pTypeED.clear(); + m_pUrlRB.clear(); + m_pEditRB.clear(); + m_pUrlPB.clear(); + m_pUrlED.clear(); + m_pEditED.clear(); + m_pOKBtn.clear(); + m_pPrevBtn.clear(); + m_pNextBtn.clear(); + pOldDefDlgParent.clear(); + SvxStandardDialog::dispose(); } IMPL_LINK_NOARG_INLINE_START(SwJavaEditDialog, PrevHdl) diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 0fef7a5499cb..11dccd075cc9 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -540,15 +540,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect character styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + ScopedVclPtrInstance< ListBox > rCharFmtLB(this); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index c34899cb2361..0d645d34da9d 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -161,7 +161,7 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) assert(pColPgSet); // create TabPage - pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet) ); + pTabPage = static_cast<SwColumnPage*>( SwColumnPage::Create(get_content_area(), pColPgSet).get() ); pTabPage->get<vcl::Window>("applytoft")->Show(); pTabPage->get(m_pApplyToLB, "applytolb"); m_pApplyToLB->Show(); @@ -214,10 +214,17 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) SwColumnDlg::~SwColumnDlg() { - delete pTabPage; + disposeOnce(); +} + +void SwColumnDlg::dispose() +{ + pTabPage.disposeAndClear(); delete pPageSet; delete pSectionSet; delete pSelectionSet; + m_pApplyToLB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox) @@ -542,7 +549,36 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet) SwColumnPage::~SwColumnPage() { + disposeOnce(); +} + +void SwColumnPage::dispose() +{ delete pColMgr; + m_pCLNrEdt.clear(); + m_pDefaultVS.clear(); + m_pBalanceColsCB.clear(); + m_pBtnBack.clear(); + m_pLbl1.clear(); + m_pLbl2.clear(); + m_pLbl3.clear(); + m_pBtnNext.clear(); + m_pAutoWidthBox.clear(); + m_pLineTypeLbl.clear(); + m_pLineTypeDLB.clear(); + m_pLineWidthLbl.clear(); + m_pLineWidthEdit.clear(); + m_pLineColorLbl.clear(); + m_pLineColorDLB.clear(); + m_pLineHeightLbl.clear(); + m_pLineHeightEdit.clear(); + m_pLinePosLbl.clear(); + m_pLinePosDLB.clear(); + m_pTextDirectionFT.clear(); + m_pTextDirectionLB.clear(); + m_pPgeExampleWN.clear(); + m_pFrmExampleWN.clear(); + SfxTabPage::dispose(); } void SwColumnPage::SetPageWidth(long nPageWidth) @@ -621,10 +657,11 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) } // create TabPage -SfxTabPage* SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwColumnPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwColumnPage(pParent, *rSet), SAL_NO_ACQUIRE); } + // stuff attributes into the Set when OK bool SwColumnPage::FillItemSet(SfxItemSet *rSet) { diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 81dfcf9c75d1..719af75fdca5 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -51,14 +51,14 @@ using namespace ::com::sun::star; class SwSequenceOptionDialog : public SvxStandardDialog { - ListBox* m_pLbLevel; - Edit* m_pEdDelim; + VclPtr<ListBox> m_pLbLevel; + VclPtr<Edit> m_pEdDelim; - ListBox* m_pLbCharStyle; - CheckBox* m_pApplyBorderAndShadowCB; + VclPtr<ListBox> m_pLbCharStyle; + VclPtr<CheckBox> m_pApplyBorderAndShadowCB; //#i61007# order of captions - ListBox* m_pLbCaptionOrder; + VclPtr<ListBox> m_pLbCaptionOrder; SwView& rView; OUString aFldTypeName; @@ -67,6 +67,7 @@ public: SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV, const OUString& rSeqFldType ); virtual ~SwSequenceOptionDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Apply() SAL_OVERRIDE; bool IsApplyBorderAndShadow() { return m_pApplyBorderAndShadowCB->IsChecked(); } @@ -283,18 +284,18 @@ IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton ) { OUString sFldTypeName = m_pCategoryBox->GetText(); if(sFldTypeName == m_sNone) - sFldTypeName = OUString(); - SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName ); - aDlg.SetApplyBorderAndShadow(bCopyAttributes); - aDlg.SetCharacterStyle( sCharacterStyle ); - aDlg.SetOrderNumberingFirst( bOrderNumberingFirst ); - aDlg.Execute(); - bCopyAttributes = aDlg.IsApplyBorderAndShadow(); - sCharacterStyle = aDlg.GetCharacterStyle(); + sFldTypeName.clear(); + ScopedVclPtrInstance< SwSequenceOptionDialog > aDlg( pButton, rView, sFldTypeName ); + aDlg->SetApplyBorderAndShadow(bCopyAttributes); + aDlg->SetCharacterStyle( sCharacterStyle ); + aDlg->SetOrderNumberingFirst( bOrderNumberingFirst ); + aDlg->Execute(); + bCopyAttributes = aDlg->IsApplyBorderAndShadow(); + sCharacterStyle = aDlg->GetCharacterStyle(); //#i61007# order of captions - if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() ) + if( bOrderNumberingFirst != aDlg->IsOrderNumberingFirst() ) { - bOrderNumberingFirst = aDlg.IsOrderNumberingFirst(); + bOrderNumberingFirst = aDlg->IsOrderNumberingFirst(); SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst); ApplyCaptionOrder(); } @@ -338,8 +339,8 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl) IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl) { SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() ); - SwCaptionOptDlg aDlg( this, aSet ); - aDlg.Execute(); + ScopedVclPtrInstance< SwCaptionOptDlg > aDlg( this, aSet ); + aDlg->Execute(); return 0; } @@ -411,7 +412,27 @@ void SwCaptionDialog::DrawSample() SwCaptionDialog::~SwCaptionDialog() { + disposeOnce(); +} + +void SwCaptionDialog::dispose() +{ delete pMgr; + m_pTextEdit.clear(); + m_pCategoryBox.clear(); + m_pFormatText.clear(); + m_pFormatBox.clear(); + m_pNumberingSeparatorFT.clear(); + m_pNumberingSeparatorED.clear(); + m_pSepText.clear(); + m_pSepEdit.clear(); + m_pPosText.clear(); + m_pPosBox.clear(); + m_pOKButton.clear(); + m_pAutoCaptionButton.clear(); + m_pOptionButton.clear(); + m_pPreview.clear(); + SvxStandardDialog::dispose(); } SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV, @@ -455,8 +476,20 @@ SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV SwSequenceOptionDialog::~SwSequenceOptionDialog() { + disposeOnce(); } +void SwSequenceOptionDialog::dispose() +{ + m_pLbLevel.clear(); + m_pEdDelim.clear(); + m_pLbCharStyle.clear(); + m_pApplyBorderAndShadowCB.clear(); + m_pLbCaptionOrder.clear(); + SvxStandardDialog::dispose(); +} + + void SwSequenceOptionDialog::Apply() { SwWrtShell &rSh = rView.GetWrtShell(); diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 14f03807a490..aa7f9d67f1b7 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -712,6 +712,49 @@ SwFrmPage::SwFrmPage(vcl::Window *pParent, const SfxItemSet &rSet) m_pAutoHeightCB->SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) ); } +SwFrmPage::~SwFrmPage() +{ + disposeOnce(); +} + +void SwFrmPage::dispose() +{ + m_pWidthFT.clear(); + m_pWidthAutoFT.clear(); + m_pRelWidthCB.clear(); + m_pRelWidthRelationLB.clear(); + m_pAutoWidthCB.clear(); + m_pHeightFT.clear(); + m_pHeightAutoFT.clear(); + m_pRelHeightCB.clear(); + m_pRelHeightRelationLB.clear(); + m_pAutoHeightCB.clear(); + m_pFixedRatioCB.clear(); + m_pRealSizeBT.clear(); + m_pAnchorFrame.clear(); + m_pAnchorAtPageRB.clear(); + m_pAnchorAtParaRB.clear(); + m_pAnchorAtCharRB.clear(); + m_pAnchorAsCharRB.clear(); + m_pAnchorAtFrameRB.clear(); + m_pHorizontalFT.clear(); + m_pHorizontalDLB.clear(); + m_pAtHorzPosFT.clear(); + m_pAtHorzPosED.clear(); + m_pHoriRelationFT.clear(); + m_pHoriRelationLB.clear(); + m_pMirrorPagesCB.clear(); + m_pVerticalFT.clear(); + m_pVerticalDLB.clear(); + m_pAtVertPosFT.clear(); + m_pAtVertPosED.clear(); + m_pVertRelationFT.clear(); + m_pVertRelationLB.clear(); + m_pFollowTextFlowCB.clear(); + m_pExampleWN.clear(); + SfxTabPage::dispose(); +} + namespace { struct FrmMaps @@ -815,13 +858,9 @@ void SwFrmPage::setOptimalRelWidth() m_pHoriRelationLB->Clear(); } -SwFrmPage::~SwFrmPage() +VclPtr<SfxTabPage> SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { -} - -SfxTabPage* SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) -{ - return new SwFrmPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFrmPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwFrmPage::EnableGraficMode() @@ -2364,12 +2403,27 @@ SwGrfExtPage::SwGrfExtPage(vcl::Window *pParent, const SfxItemSet &rSet) SwGrfExtPage::~SwGrfExtPage() { + disposeOnce(); +} + +void SwGrfExtPage::dispose() +{ delete pGrfDlg; + m_pMirror.clear(); + m_pMirrorVertBox.clear(); + m_pMirrorHorzBox.clear(); + m_pAllPagesRB.clear(); + m_pLeftPagesRB.clear(); + m_pRightPagesRB.clear(); + m_pBmpWin.clear(); + m_pConnectED.clear(); + m_pBrowseBT.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwGrfExtPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwGrfExtPage( pParent, *rSet ), SAL_NO_ACQUIRE); } void SwGrfExtPage::Reset(const SfxItemSet *rSet) @@ -2702,6 +2756,18 @@ SwFrmURLPage::SwFrmURLPage( vcl::Window *pParent, const SfxItemSet &rSet ) : SwFrmURLPage::~SwFrmURLPage() { + disposeOnce(); +} + +void SwFrmURLPage::dispose() +{ + pURLED.clear(); + pSearchPB.clear(); + pNameED.clear(); + pFrameCB.clear(); + pServerCB.clear(); + pClientCB.clear(); + SfxTabPage::dispose(); } void SwFrmURLPage::Reset( const SfxItemSet *rSet ) @@ -2781,9 +2847,9 @@ bool SwFrmURLPage::FillItemSet(SfxItemSet *rSet) return bModified; } -SfxTabPage* SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +VclPtr<SfxTabPage> SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwFrmURLPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFrmURLPage( pParent, *rSet ), SAL_NO_ACQUIRE); } IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl) @@ -2844,11 +2910,38 @@ SwFrmAddPage::SwFrmAddPage(vcl::Window *pParent, const SfxItemSet &rSet) SwFrmAddPage::~SwFrmAddPage() { + disposeOnce(); } -SfxTabPage* SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwFrmAddPage::dispose() +{ + pNameFrame.clear(); + pNameFT.clear(); + pNameED.clear(); + pAltNameFT.clear(); + pAltNameED.clear(); + pPrevFT.clear(); + pPrevLB.clear(); + pNextFT.clear(); + pNextLB.clear(); + pProtectFrame.clear(); + pProtectContentCB.clear(); + pProtectFrameCB.clear(); + pProtectSizeCB.clear(); + m_pContentAlignFrame.clear(); + m_pVertAlignLB.clear(); + pPropertiesFrame.clear(); + pEditInReadonlyCB.clear(); + pPrintFrameCB.clear(); + pTextFlowFT.clear(); + pTextFlowLB.clear(); + SfxTabPage::dispose(); +} + + +VclPtr<SfxTabPage> SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return new SwFrmAddPage(pParent, *rSet); + return VclPtr<SfxTabPage>(new SwFrmAddPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwFrmAddPage::Reset(const SfxItemSet *rSet ) diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 6987ce803555..49cba0337bcf 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -57,7 +57,7 @@ SwWrapDlg::SwWrapDlg(vcl::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bo { // create TabPage - SwWrapTabPage* pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet) ); + VclPtr<SwWrapTabPage> pNewPage = static_cast<SwWrapTabPage*>( SwWrapTabPage::Create(get_content_area(), &rSet).get() ); pNewPage->SetFormatUsed(false, bDrawMode); pNewPage->SetShell(pWrtShell); SetTabPage(pNewPage); @@ -133,11 +133,31 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet) SwWrapTabPage::~SwWrapTabPage() { + disposeOnce(); } -SfxTabPage* SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwWrapTabPage::dispose() { - return new SwWrapTabPage(pParent, *rSet); + m_pNoWrapRB.clear(); + m_pWrapLeftRB.clear(); + m_pWrapRightRB.clear(); + m_pWrapParallelRB.clear(); + m_pWrapThroughRB.clear(); + m_pIdealWrapRB.clear(); + m_pLeftMarginED.clear(); + m_pRightMarginED.clear(); + m_pTopMarginED.clear(); + m_pBottomMarginED.clear(); + m_pWrapAnchorOnlyCB.clear(); + m_pWrapTransparentCB.clear(); + m_pWrapOutlineCB.clear(); + m_pWrapOutsideCB.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwWrapTabPage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwWrapTabPage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 9b1a47f9a2ed..df015f1749d5 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -140,8 +140,8 @@ typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; class SwEntryBrowseBox : public SwEntryBrowseBox_Base { - Edit aCellEdit; - ::svt::CheckBoxControl aCellCheckBox; + VclPtr<Edit> aCellEdit; + VclPtr<::svt::CheckBoxControl> aCellCheckBox; OUString sSearch; OUString sAlternative; @@ -174,6 +174,8 @@ protected: public: SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pBuilder); + virtual ~SwEntryBrowseBox(); + virtual void dispose() SAL_OVERRIDE; void ReadEntries(SvStream& rInStr); void WriteEntries(SvStream& rOutStr); @@ -186,9 +188,9 @@ public: class SwAutoMarkDlg_Impl : public ModalDialog { - OKButton* m_pOKPB; + VclPtr<OKButton> m_pOKPB; - SwEntryBrowseBox* m_pEntriesBB; + VclPtr<SwEntryBrowseBox> m_pEntriesBB; OUString sAutoMarkURL; @@ -199,6 +201,7 @@ public: SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAutoMarkURL, bool bCreate); virtual ~SwAutoMarkDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; @@ -319,6 +322,11 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(vcl::Window* pParent, const SfxItemSet& SwMultiTOXTabDialog::~SwMultiTOXTabDialog() { + disposeOnce(); +} + +void SwMultiTOXTabDialog::dispose() +{ SW_MOD()->GetModuleConfig()->SetShowIndexPreview(m_pShowExampleCB->IsChecked()); // fdo#38515 Avoid setting focus on deleted controls in the destructors @@ -336,6 +344,9 @@ SwMultiTOXTabDialog::~SwMultiTOXTabDialog() delete[] pDescArr; delete pMgr; delete pExampleFrame; + m_pExampleContainerWIN.clear(); + m_pShowExampleCB.clear(); + SfxTabDialog::dispose(); } void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) @@ -479,8 +490,8 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl ) OUString sInfo(SW_RESSTR(STR_FILE_NOT_FOUND)); sInfo = sInfo.replaceFirst( "%1", sTemplate ); sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() ); - InfoBox aInfo(GetParent(), sInfo); - aInfo.Execute(); + ScopedVclPtrInstance< InfoBox > aInfo(GetParent(), sInfo); + aInfo->Execute(); } else { @@ -500,7 +511,7 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl ) && pExampleFrame && pExampleFrame->IsServiceAvailable(); m_pExampleContainerWIN->Show( bSetViewWindow ); - SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN : 0 ); + SetViewWindow( bSetViewWindow ? m_pExampleContainerWIN.get() : 0 ); setOptimalLayoutSize(); @@ -617,11 +628,11 @@ void SwIndexTreeLB::setColSizes() class SwAddStylesDlg_Impl : public SfxModalDialog { - OKButton* m_pOk; + VclPtr<OKButton> m_pOk; - SwIndexTreeLB* m_pHeaderTree; - PushButton* m_pLeftPB; - PushButton* m_pRightPB; + VclPtr<SwIndexTreeLB> m_pHeaderTree; + VclPtr<PushButton> m_pLeftPB; + VclPtr<PushButton> m_pRightPB; OUString* pStyleArr; @@ -632,6 +643,7 @@ class SwAddStylesDlg_Impl : public SfxModalDialog public: SwAddStylesDlg_Impl(vcl::Window* pParent, SwWrtShell& rWrtSh, OUString rStringArr[]); virtual ~SwAddStylesDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; }; SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, @@ -648,7 +660,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, Size aSize = pHeaderTreeContainer->LogicToPixel(Size(273, 164), MAP_APPFONT); pHeaderTreeContainer->set_width_request(aSize.Width()); pHeaderTreeContainer->set_height_request(aSize.Height()); - m_pHeaderTree = new SwIndexTreeLB(*pHeaderTreeContainer); + m_pHeaderTree = VclPtr<SwIndexTreeLB>::Create(*pHeaderTreeContainer); m_pOk->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl)); m_pLeftPB->SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl)); @@ -706,7 +718,16 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(vcl::Window* pParent, SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl() { - delete m_pHeaderTree; + disposeOnce(); +} + +void SwAddStylesDlg_Impl::dispose() +{ + m_pHeaderTree.disposeAndClear(); + m_pOk.clear(); + m_pLeftPB.clear(); + m_pRightPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwAddStylesDlg_Impl, OkHdl) @@ -881,8 +902,55 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXSelectTabPage::~SwTOXSelectTabPage() { + disposeOnce(); +} + +void SwTOXSelectTabPage::dispose() +{ delete pIndexRes; delete pIndexEntryWrapper; + m_pTitleED.clear(); + m_pTypeFT.clear(); + m_pTypeLB.clear(); + m_pReadOnlyCB.clear(); + m_pAreaFrame.clear(); + m_pAreaLB.clear(); + m_pLevelFT.clear(); + m_pLevelNF.clear(); + m_pCreateFrame.clear(); + m_pFromHeadingsCB.clear(); + m_pAddStylesCB.clear(); + m_pAddStylesPB.clear(); + m_pFromTablesCB.clear(); + m_pFromFramesCB.clear(); + m_pFromGraphicsCB.clear(); + m_pFromOLECB.clear(); + m_pLevelFromChapterCB.clear(); + m_pFromCaptionsRB.clear(); + m_pFromObjectNamesRB.clear(); + m_pCaptionSequenceFT.clear(); + m_pCaptionSequenceLB.clear(); + m_pDisplayTypeFT.clear(); + m_pDisplayTypeLB.clear(); + m_pTOXMarksCB.clear(); + m_pIdxOptionsFrame.clear(); + m_pCollectSameCB.clear(); + m_pUseFFCB.clear(); + m_pUseDashCB.clear(); + m_pCaseSensitiveCB.clear(); + m_pInitialCapsCB.clear(); + m_pKeyAsEntryCB.clear(); + m_pFromFileCB.clear(); + m_pAutoMarkPB.clear(); + m_pFromObjCLB.clear(); + m_pFromObjFrame.clear(); + m_pSequenceCB.clear(); + m_pBracketLB.clear(); + m_pAuthorityFrame.clear(); + m_pSortFrame.clear(); + m_pLanguageLB.clear(); + m_pSortAlgorithmLB.clear(); + SfxTabPage::dispose(); } void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh) @@ -1245,9 +1313,9 @@ SfxTabPage::sfxpg SwTOXSelectTabPage::DeactivatePage( SfxItemSet* _pSet ) return LEAVE_PAGE; } -SfxTabPage* SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXSelectTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwTOXSelectTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXSelectTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox) @@ -1410,11 +1478,11 @@ IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox) IMPL_LINK(SwTOXSelectTabPage, AddStylesHdl, PushButton*, pButton) { - boost::scoped_ptr<SwAddStylesDlg_Impl> pDlg(new SwAddStylesDlg_Impl(pButton, - static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(), - aStyleArr)); + ScopedVclPtrInstance<SwAddStylesDlg_Impl> pDlg( + pButton, static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(), + aStyleArr); pDlg->Execute(); - pDlg.reset(); + pDlg.disposeAndClear(); ModifyHdl(0); return 0; } @@ -1446,8 +1514,8 @@ IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, Menu*, pMenu) return 0; } - boost::scoped_ptr<SwAutoMarkDlg_Impl> pAutoMarkDlg(new SwAutoMarkDlg_Impl( - m_pAutoMarkPB, sAutoMarkURL, bNew )); + VclPtrInstance<SwAutoMarkDlg_Impl> pAutoMarkDlg( + m_pAutoMarkPB, sAutoMarkURL, bNew ); if( RET_OK != pAutoMarkDlg->Execute() && bNew ) sAutoMarkURL = sSaveAutoMarkURL; @@ -1460,7 +1528,7 @@ class SwTOXEdit : public Edit SwFormToken aFormToken; Link aPrevNextControlLink; bool bNextControl; - SwTokenWindow* m_pParent; + VclPtr<SwTokenWindow> m_pParent; public: SwTOXEdit( vcl::Window* pParent, SwTokenWindow* pTokenWin, const SwFormToken& aToken) @@ -1470,6 +1538,8 @@ public: m_pParent( pTokenWin ) { } + virtual ~SwTOXEdit() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); Edit::dispose(); } virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -1545,7 +1615,7 @@ class SwTOXButton : public PushButton SwFormToken aFormToken; Link aPrevNextControlLink; bool bNextControl; - SwTokenWindow* m_pParent; + VclPtr<SwTokenWindow> m_pParent; public: SwTOXButton( vcl::Window* pParent, SwTokenWindow* pTokenWin, const SwFormToken& rToken) @@ -1555,6 +1625,8 @@ public: m_pParent(pTokenWin) { } + virtual ~SwTOXButton() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); } virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -1675,6 +1747,17 @@ SwIdxTreeListBox::SwIdxTreeListBox(vcl::Window* pPar, WinBits nStyle) { } +SwIdxTreeListBox::~SwIdxTreeListBox() +{ + disposeOnce(); +} + +void SwIdxTreeListBox::dispose() +{ + pParent.clear(); + SvTreeListBox::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSwIdxTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap) { WinBits nWinStyle = WB_TABSTOP; @@ -1873,6 +1956,63 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAt m_pSecondKeyLB->SelectEntryPos(0); m_pThirdKeyLB->SelectEntryPos(0); } + +SwTOXEntryTabPage::~SwTOXEntryTabPage() +{ + disposeOnce(); +} + +void SwTOXEntryTabPage::dispose() +{ + m_pLevelFT.clear(); + m_pLevelLB.clear(); + m_pTokenWIN.clear(); + m_pAllLevelsPB.clear(); + m_pEntryNoPB.clear(); + m_pEntryPB.clear(); + m_pTabPB.clear(); + m_pChapterInfoPB.clear(); + m_pPageNoPB.clear(); + m_pHyperLinkPB.clear(); + m_pAuthFieldsLB.clear(); + m_pAuthInsertPB.clear(); + m_pAuthRemovePB.clear(); + m_pCharStyleLB.clear(); + m_pEditStylePB.clear(); + m_pChapterEntryFT.clear(); + m_pChapterEntryLB.clear(); + m_pNumberFormatFT.clear(); + m_pNumberFormatLB.clear(); + m_pEntryOutlineLevelFT.clear(); + m_pEntryOutlineLevelNF.clear(); + m_pFillCharFT.clear(); + m_pFillCharCB.clear(); + m_pTabPosFT.clear(); + m_pTabPosMF.clear(); + m_pAutoRightCB.clear(); + m_pFormatFrame.clear(); + m_pMainEntryStyleFT.clear(); + m_pMainEntryStyleLB.clear(); + m_pAlphaDelimCB.clear(); + m_pCommaSeparatedCB.clear(); + m_pRelToStyleCB.clear(); + m_pSortingFrame.clear(); + m_pSortDocPosRB.clear(); + m_pSortContentRB.clear(); + m_pSortKeyFrame.clear(); + m_pFirstKeyLB.clear(); + m_pFirstSortUpRB.clear(); + m_pFirstSortDownRB.clear(); + m_pSecondKeyLB.clear(); + m_pSecondSortUpRB.clear(); + m_pSecondSortDownRB.clear(); + m_pThirdKeyLB.clear(); + m_pThirdSortUpRB.clear(); + m_pThirdSortDownRB.clear(); + SfxTabPage::dispose(); +} + + // pVoid is used as signal to change all levels of the example IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid) { @@ -1890,10 +2030,6 @@ IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid) return 0; } -SwTOXEntryTabPage::~SwTOXEntryTabPage() -{ -} - bool SwTOXEntryTabPage::FillItemSet( SfxItemSet* ) { // nothing to do @@ -2074,9 +2210,9 @@ SfxTabPage::sfxpg SwTOXEntryTabPage::DeactivatePage( SfxItemSet* /*pSet*/) return LEAVE_PAGE; } -SfxTabPage* SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXEntryTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return new SwTOXEntryTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXEntryTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK(SwTOXEntryTabPage, EditStyleHdl, PushButton*, pBtn) @@ -2624,13 +2760,26 @@ void SwTokenWindow::setAllocation(const Size &rAllocation) SwTokenWindow::~SwTokenWindow() { + disposeOnce(); +} + +void SwTokenWindow::dispose() +{ for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it) { - Control* pControl = (*it); + VclPtr<Control> pControl = (*it); pControl->SetGetFocusHdl( Link() ); pControl->SetLoseFocusHdl( Link() ); - delete pControl; + pControl.disposeAndClear(); } + aControlList.clear(); + disposeBuilder(); + m_pLeftScrollWin.clear(); + m_pCtrlParentWin.clear(); + m_pRightScrollWin.clear(); + pActiveCtrl.clear(); + m_pParent.clear(); + VclHBox::dispose(); } void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) @@ -2640,10 +2789,11 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) if(pForm) { - //apply current level settings to the form for (ctrl_iterator iter = aControlList.begin(); iter != aControlList.end(); ++iter) - delete (*iter); - + iter->disposeAndClear(); + //apply current level settings to the form + for (auto it = aControlList.begin(); it != aControlList.end(); ++it) + it->disposeAndClear(); aControlList.clear(); } @@ -2725,9 +2875,9 @@ void SwTokenWindow::SetActiveControl(Control* pSet) //it must be a SwTOXEdit const SwFormToken* pFToken; if( WINDOW_EDIT == pActiveCtrl->GetType() ) - pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl)->GetFormToken(); + pFToken = &static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetFormToken(); else - pFToken = &static_cast<SwTOXButton*>(pActiveCtrl)->GetFormToken(); + pFToken = &static_cast<SwTOXButton*>(pActiveCtrl.get())->GetFormToken(); SwFormToken aTemp( *pFToken ); aButtonSelectedHdl.Call( &aTemp ); @@ -2752,7 +2902,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& if(TOKEN_TEXT == rToken.eTokenType) { - SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, rToken); + VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, rToken); pEdit->SetPosPixel(aControlPos); aControlList.push_back(pEdit); @@ -2781,7 +2931,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& } else { - SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, rToken); + VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, rToken); pButton->SetPosPixel(aControlPos); aControlList.push_back(pButton); @@ -2948,18 +3098,18 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken& { ++iterActive; - Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl)->GetSelection(); + Selection aSel = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetSelection(); aSel.Justify(); - const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl)->GetText(); + const OUString sEditText = static_cast<SwTOXEdit*>(pActiveCtrl.get())->GetText(); const OUString sLeft = sEditText.copy( 0, aSel.A() ); const OUString sRight = sEditText.copy( aSel.B() ); - static_cast<SwTOXEdit*>(pActiveCtrl)->SetText(sLeft); - static_cast<SwTOXEdit*>(pActiveCtrl)->AdjustSize(); + static_cast<SwTOXEdit*>(pActiveCtrl.get())->SetText(sLeft); + static_cast<SwTOXEdit*>(pActiveCtrl.get())->AdjustSize(); SwFormToken aTmpToken(TOKEN_TEXT); - SwTOXEdit* pEdit = new SwTOXEdit(m_pCtrlParentWin, this, aTmpToken); + VclPtr<SwTOXEdit> pEdit = VclPtr<SwTOXEdit>::Create(m_pCtrlParentWin, this, aTmpToken); iterActive = aControlList.insert(iterActive, pEdit); @@ -2987,11 +3137,11 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken& { iterActive = aControlList.erase(iterActive); pActiveCtrl->Hide(); - delete pActiveCtrl; + pActiveCtrl.disposeAndClear(); } //now the new button - SwTOXButton* pButton = new SwTOXButton(m_pCtrlParentWin, this, aToInsertToken); + VclPtr<SwTOXButton> pButton = VclPtr<SwTOXButton>::Create(m_pCtrlParentWin, this, aToInsertToken); aControlList.insert(iterActive, pButton); @@ -3040,19 +3190,19 @@ void SwTokenWindow::RemoveControl(SwTOXButton* pDel, bool bInternalCall ) ctrl_iterator itLeft = it, itRight = it; --itLeft; ++itRight; - Control *pLeftEdit = *itLeft; - Control *pRightEdit = *itRight; + VclPtr<Control> pLeftEdit = *itLeft; + VclPtr<Control> pRightEdit = *itRight; - static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() + - static_cast<SwTOXEdit*>(pRightEdit)->GetText()); - static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize(); + static_cast<SwTOXEdit*>(pLeftEdit.get())->SetText(static_cast<SwTOXEdit*>(pLeftEdit.get())->GetText() + + static_cast<SwTOXEdit*>(pRightEdit.get())->GetText()); + static_cast<SwTOXEdit*>(pLeftEdit.get())->AdjustSize(); aControlList.erase(itRight); - delete pRightEdit; + pRightEdit.disposeAndClear(); aControlList.erase(it); pActiveCtrl->Hide(); - delete pActiveCtrl; + pActiveCtrl.disposeAndClear(); SetActiveControl(pLeftEdit); AdjustPositions(); @@ -3505,7 +3655,18 @@ SwTOXStylesTabPage::SwTOXStylesTabPage(vcl::Window* pParent, const SfxItemSet& r SwTOXStylesTabPage::~SwTOXStylesTabPage() { + disposeOnce(); +} + +void SwTOXStylesTabPage::dispose() +{ delete m_pCurrentForm; + m_pLevelLB.clear(); + m_pAssignBT.clear(); + m_pParaLayLB.clear(); + m_pStdBT.clear(); + m_pEditStyleBT.clear(); + SfxTabPage::dispose(); } bool SwTOXStylesTabPage::FillItemSet( SfxItemSet* ) @@ -3590,10 +3751,10 @@ SfxTabPage::sfxpg SwTOXStylesTabPage::DeactivatePage( SfxItemSet* /*pSet*/ ) return LEAVE_PAGE; } -SfxTabPage* SwTOXStylesTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTOXStylesTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwTOXStylesTabPage(pParent, *rAttrSet); + return VclPtr<SwTOXStylesTabPage>::Create(pParent, *rAttrSet); } IMPL_LINK( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn ) @@ -3705,8 +3866,8 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB BrowserMode::VLINES | BrowserMode::AUTO_VSCROLL| BrowserMode::HIDECURSOR ) - , aCellEdit(&GetDataWindow(), 0) - , aCellCheckBox(&GetDataWindow()) + , aCellEdit(VclPtr<Edit>::Create(&GetDataWindow(), 0)) + , aCellCheckBox(new ::svt::CheckBoxControl(&GetDataWindow())) , nCurrentRow(0) , bModified(false) { @@ -3720,9 +3881,9 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB sYes = pBuilder->get<vcl::Window>("yes")->GetText(); sNo = pBuilder->get<vcl::Window>("no")->GetText(); - aCellCheckBox.GetBox().EnableTriState(false); - xController = new ::svt::EditCellController(&aCellEdit); - xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox); + aCellCheckBox->GetBox().EnableTriState(false); + xController = new ::svt::EditCellController(aCellEdit.get()); + xCheckController = new ::svt::CheckBoxCellController(aCellCheckBox.get()); // HACK: BrowseBox doesn't invalidate its children, how it should be. // That's why WB_CLIPCHILDREN is reset in order to enforce the @@ -3753,6 +3914,18 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB HeaderBarItemBits::STDSTYLE, HEADERBAR_APPEND ); } +SwEntryBrowseBox::~SwEntryBrowseBox() +{ + disposeOnce(); +} + +void SwEntryBrowseBox::dispose() +{ + aCellEdit.disposeAndClear(); + aCellCheckBox.disposeAndClear(); + SwEntryBrowseBox_Base::dispose(); +} + void SwEntryBrowseBox::Resize() { SwEntryBrowseBox_Base::Resize(); @@ -4018,7 +4191,7 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu , bCreateMode(bCreate) { get(m_pOKPB, "ok"); - m_pEntriesBB = new SwEntryBrowseBox(get<VclContainer>("area"), this); + m_pEntriesBB = VclPtr<SwEntryBrowseBox>::Create(get<VclContainer>("area"), this); m_pEntriesBB->set_expand(true); m_pEntriesBB->Show(); m_pOKPB->SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl)); @@ -4042,7 +4215,14 @@ SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(vcl::Window* pParent, const OUString& rAu SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl() { - delete m_pEntriesBB; + disposeOnce(); +} + +void SwAutoMarkDlg_Impl::dispose() +{ + m_pEntriesBB.disposeAndClear(); + m_pOKPB.clear(); + ModalDialog::dispose(); } IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl) diff --git a/sw/source/ui/index/multmrk.cxx b/sw/source/ui/index/multmrk.cxx index 7fe0e656888e..51cffaccac1b 100644 --- a/sw/source/ui/index/multmrk.cxx +++ b/sw/source/ui/index/multmrk.cxx @@ -61,6 +61,17 @@ void SwMultiTOXMarkDlg::Apply() rMgr.SetCurTOXMark(nPos); } -SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() {} +SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() +{ + disposeOnce(); +} + +void SwMultiTOXMarkDlg::dispose() +{ + m_pTextFT.clear(); + m_pTOXLB.clear(); + SvxStandardDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 526dbb42e606..cb68df271d9b 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -546,8 +546,8 @@ void SwIndexMarkPane::UpdateKeyBoxes() class SwNewUserIdxDlg : public ModalDialog { - OKButton* m_pOKPB; - Edit* m_pNameED; + VclPtr<OKButton> m_pOKPB; + VclPtr<Edit> m_pNameED; SwIndexMarkPane* m_pDlg; @@ -565,6 +565,13 @@ class SwNewUserIdxDlg : public ModalDialog m_pOKPB->Enable(false); m_pNameED->GrabFocus(); } + virtual ~SwNewUserIdxDlg() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE + { + m_pOKPB.clear(); + m_pNameED.clear(); + ModalDialog::dispose(); + } OUString GetName(){return m_pNameED->GetText();} }; @@ -577,7 +584,7 @@ IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit*, pEdit) IMPL_LINK_NOARG(SwIndexMarkPane, NewUserIdxHdl) { - boost::scoped_ptr<SwNewUserIdxDlg> pDlg(new SwNewUserIdxDlg(this)); + ScopedVclPtrInstance< SwNewUserIdxDlg > pDlg(this); if(RET_OK == pDlg->Execute()) { OUString sNewName(pDlg->GetName()); @@ -982,12 +989,12 @@ void SwIndexMarkModalDlg::Apply() class SwCreateAuthEntryDlg_Impl : public ModalDialog { - FixedText* pFixedTexts[AUTH_FIELD_END]; - ListBox* pTypeListBox; - ComboBox* pIdentifierBox; - Edit* pEdits[AUTH_FIELD_END]; + VclPtr<FixedText> pFixedTexts[AUTH_FIELD_END]; + VclPtr<ListBox> pTypeListBox; + VclPtr<ComboBox> pIdentifierBox; + VclPtr<Edit> pEdits[AUTH_FIELD_END]; - OKButton* m_pOKBT; + VclPtr<OKButton> m_pOKBT; Link aShortNameCheckLink; @@ -1007,6 +1014,7 @@ public: bool bNewEntry, bool bCreate); virtual ~SwCreateAuthEntryDlg_Impl(); + virtual void dispose() SAL_OVERRIDE; OUString GetEntryText(ToxAuthorityField eField) const; @@ -1200,8 +1208,8 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl) bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i); if(bDifferent) { - MessageDialog aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if(RET_YES != aQuery.Execute()) + ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if(RET_YES != aQuery->Execute()) return 0; } } @@ -1240,14 +1248,14 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) OUString sOldId = m_sCreatedEntry[0]; for(int i = 0; i < AUTH_FIELD_END; i++) m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i]; - SwCreateAuthEntryDlg_Impl aDlg(pButton, + ScopedVclPtrInstance<SwCreateAuthEntryDlg_Impl> aDlg(pButton, bCreate ? m_sCreatedEntry : m_sFields, *pSh, bNewEntry, bCreate); if(bNewEntry) { - aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); + aDlg->SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); } - if(RET_OK == aDlg.Execute()) + if(RET_OK == aDlg->Execute()) { if(bCreate && !sOldId.isEmpty()) { @@ -1255,7 +1263,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) } for(int i = 0; i < AUTH_FIELD_END; i++) { - m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i); + m_sFields[i] = aDlg->GetEntryText((ToxAuthorityField)i); m_sCreatedEntry[i] = m_sFields[i]; } if(bNewEntry && !m_pFromDocContentRB->IsChecked()) @@ -1438,7 +1446,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, { const TextInfo aCurInfo = aTextInfoArr[nIndex]; - pFixedTexts[nIndex] = new FixedText(bLeft ? pLeft : pRight, WB_VCENTER); + pFixedTexts[nIndex] = VclPtr<FixedText>::Create(bLeft ? pLeft : pRight, WB_VCENTER); pFixedTexts[nIndex]->set_grid_left_attach(0); pFixedTexts[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); @@ -1447,7 +1455,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, pEdits[nIndex] = 0; if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField ) { - pTypeListBox = new ListBox(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER); + pTypeListBox = VclPtr<ListBox>::Create(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER); for(int j = 0; j < AUTH_TYPE_END; j++) pTypeListBox->InsertEntry(SW_RESSTR(STR_AUTH_TYPE_START + j)); if(!pFields[aCurInfo.nToxField].isEmpty()) @@ -1464,7 +1472,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, } else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode) { - pIdentifierBox = new ComboBox(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER); + pIdentifierBox = VclPtr<ComboBox>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER); pIdentifierBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, IdentifierHdl)); @@ -1488,7 +1496,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, } else { - pEdits[nIndex] = new Edit(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER); + pEdits[nIndex] = VclPtr<Edit>::Create(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER); pEdits[nIndex]->SetWidthInChars(14); pEdits[nIndex]->set_grid_left_attach(1); pEdits[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); @@ -1519,13 +1527,20 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl() { + disposeOnce(); +} + +void SwCreateAuthEntryDlg_Impl::dispose() +{ for(int i = 0; i < AUTH_FIELD_END; i++) { - delete pFixedTexts[i]; - delete pEdits[i]; + pFixedTexts[i].disposeAndClear(); + pEdits[i].disposeAndClear(); } - delete pTypeListBox; - delete pIdentifierBox; + pTypeListBox.disposeAndClear(); + pIdentifierBox.disposeAndClear(); + m_pOKBT.clear(); + ModalDialog::dispose(); } OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 59576289d831..5eaf63a98ddb 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -147,6 +147,15 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( vcl::Window *pParent, SwWrtShell &rS, SwInsertBookmarkDlg::~SwInsertBookmarkDlg() { + disposeOnce(); +} + +void SwInsertBookmarkDlg::dispose() +{ + m_pBookmarkBox.clear(); + m_pOkBtn.clear(); + m_pDeleteBtn.clear(); + SvxStandardDialog::dispose(); } BookmarkCombo::BookmarkCombo(vcl::Window* pWin, WinBits nStyle) diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 15cfb9493333..04467a339ca4 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -117,6 +117,33 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(vcl::Window *pParent, bool bEN, get(m_pFtnCharTextTemplBox, "charstylelb"); } +SwEndNoteOptionPage::~SwEndNoteOptionPage() +{ + disposeOnce(); +} + +void SwEndNoteOptionPage::dispose() +{ + m_pNumViewBox.clear(); + m_pOffsetLbl.clear(); + m_pOffsetFld.clear(); + m_pNumCountBox.clear(); + m_pPrefixED.clear(); + m_pSuffixED.clear(); + m_pPosFT.clear(); + m_pPosPageBox.clear(); + m_pPosChapterBox.clear(); + m_pStylesContainer.clear(); + m_pParaTemplBox.clear(); + m_pPageTemplLbl.clear(); + m_pPageTemplBox.clear(); + m_pFtnCharAnchorTemplBox.clear(); + m_pFtnCharTextTemplBox.clear(); + m_pContEdit.clear(); + m_pContFromEdit.clear(); + SfxTabPage::dispose(); +} + void SwEndNoteOptionPage::Reset( const SfxItemSet* ) { boost::scoped_ptr<SwEndNoteInfo> pInf(bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() ) @@ -219,13 +246,9 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* ) m_pPageTemplBox->SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName()); } -SwEndNoteOptionPage::~SwEndNoteOptionPage() -{ -} - -SfxTabPage *SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwEndNoteOptionPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwEndNoteOptionPage( pParent, true, *rSet ); + return VclPtr<SwEndNoteOptionPage>::Create( pParent, true, *rSet ); } // Different kinds of numbering; because the Listbox has varying numbers of @@ -399,9 +422,9 @@ SwFootNoteOptionPage::~SwFootNoteOptionPage() { } -SfxTabPage *SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet ) +VclPtr<SfxTabPage> SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet ) { - return new SwFootNoteOptionPage( pParent, *rSet ); + return VclPtr<SfxTabPage>(new SwFootNoteOptionPage( pParent, *rSet ), SAL_NO_ACQUIRE); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 11a3666236bb..7f86ef083348 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -112,6 +112,18 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(vcl::Window * pParent, SwGlossaryGroupDlg::~SwGlossaryGroupDlg() { + disposeOnce(); +} + +void SwGlossaryGroupDlg::dispose() +{ + m_pNameED.clear(); + m_pPathLB.clear(); + m_pGroupTLB.clear(); + m_pNewPB.clear(); + m_pDelPB.clear(); + m_pRenamePB.clear(); + SvxStandardDialog::dispose(); } void SwGlossaryGroupDlg::Apply() @@ -139,8 +151,8 @@ void SwGlossaryGroupDlg::Apply() const OUString sMsg(SW_RESSTR(STR_QUERY_DELETE_GROUP1) + sTitle + SW_RESSTR(STR_QUERY_DELETE_GROUP2)); - QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); - if(RET_YES == aQuery.Execute()) + ScopedVclPtrInstance< QueryBox > aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); + if(RET_YES == aQuery->Execute()) pGlosHdl->DelGroup( sDelGroup ); } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 858fd69bdd3a..3664343de66a 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -115,12 +115,12 @@ struct GroupUserData // dialog for new block name class SwNewGlosNameDlg : public ModalDialog { - Edit* m_pNewName; - TextFilter m_aNoSpaceFilter; - Edit* m_pNewShort; - OKButton* m_pOk; - Edit* m_pOldName; - Edit* m_pOldShort; + VclPtr<Edit> m_pNewName; + TextFilter m_aNoSpaceFilter; + VclPtr<Edit> m_pNewShort; + VclPtr<OKButton> m_pOk; + VclPtr<Edit> m_pOldName; + VclPtr<Edit> m_pOldShort; protected: DECL_LINK( Modify, Edit * ); @@ -130,6 +130,8 @@ public: SwNewGlosNameDlg( vcl::Window* pParent, const OUString& rOldName, const OUString& rOldShort ); + virtual ~SwNewGlosNameDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetNewName() const { return m_pNewName->GetText(); } OUString GetNewShort() const { return m_pNewShort->GetText(); } @@ -156,6 +158,21 @@ SwNewGlosNameDlg::SwNewGlosNameDlg(vcl::Window* pParent, m_pNewName->GrabFocus(); } +SwNewGlosNameDlg::~SwNewGlosNameDlg() +{ + disposeOnce(); +} + +void SwNewGlosNameDlg::dispose() +{ + m_pNewName.clear(); + m_pNewShort.clear(); + m_pOk.clear(); + m_pOldName.clear(); + m_pOldShort.clear(); + ModalDialog::dispose(); +} + // query / set currently set group OUString SwGlossaryDlg::GetCurrGroup() { @@ -232,8 +249,26 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryDlg::~SwGlossaryDlg() { + disposeOnce(); +} + +void SwGlossaryDlg::dispose() +{ m_pCategoryBox->Clear(); delete pExampleFrame; + m_pInsertTipCB.clear(); + m_pNameED.clear(); + m_pShortNameLbl.clear(); + m_pShortNameEdit.clear(); + m_pCategoryBox.clear(); + m_pFileRelCB.clear(); + m_pNetRelCB.clear(); + m_pExampleWIN.clear(); + m_pInsertBtn.clear(); + m_pEditBtn.clear(); + m_pBibBtn.clear(); + m_pPathBtn.clear(); + SvxStandardDialog::dispose(); } // select new group @@ -468,8 +503,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) else if (sItemIdent == "rename") { m_pShortNameEdit->SetText(pGlossaryHdl->GetGlossaryShortName(m_pNameED->GetText())); - boost::scoped_ptr<SwNewGlosNameDlg> pNewNameDlg(new SwNewGlosNameDlg(this, m_pNameED->GetText(), - m_pShortNameEdit->GetText() )); + ScopedVclPtrInstance<SwNewGlosNameDlg> pNewNameDlg(this, m_pNameED->GetText(), + m_pShortNameEdit->GetText()); if( RET_OK == pNewNameDlg->Execute() && pGlossaryHdl->Rename( m_pShortNameEdit->GetText(), pNewNameDlg->GetNewShort(), @@ -488,8 +523,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) } else if (sItemIdent == "delete") { - MessageDialog aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if (RET_YES == aQuery.Execute()) + ScopedVclPtrInstance< MessageDialog > aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + if (RET_YES == aQuery->Execute()) { const OUString aShortName(m_pShortNameEdit->GetText()); const OUString aTitle(m_pNameED->GetText()); @@ -616,7 +651,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) if(bIsWritable) { - boost::scoped_ptr<SwGlossaryGroupDlg> pDlg(new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl )); + ScopedVclPtrInstance< SwGlossaryGroupDlg > pDlg( this, pGloss->GetPathArray(), pGlossaryHdl ); if ( RET_OK == pDlg->Execute() ) { Init(); @@ -646,9 +681,9 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) } else { - MessageDialog aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance< MessageDialog > aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if(RET_YES == aBox.Execute()) + if(RET_YES == aBox->Execute()) PathHdl(m_pPathBtn); } } diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx index f9808c4dc040..31b5f8a920d0 100644 --- a/sw/source/ui/misc/impfnote.hxx +++ b/sw/source/ui/misc/impfnote.hxx @@ -30,27 +30,27 @@ class SwWrtShell; class SwEndNoteOptionPage : public SfxTabPage { - SwNumberingTypeListBox* m_pNumViewBox; - FixedText* m_pOffsetLbl; - NumericField* m_pOffsetFld; - ListBox* m_pNumCountBox; - Edit* m_pPrefixED; - Edit* m_pSuffixED; - FixedText* m_pPosFT; - RadioButton* m_pPosPageBox; - RadioButton* m_pPosChapterBox; + VclPtr<SwNumberingTypeListBox> m_pNumViewBox; + VclPtr<FixedText> m_pOffsetLbl; + VclPtr<NumericField> m_pOffsetFld; + VclPtr<ListBox> m_pNumCountBox; + VclPtr<Edit> m_pPrefixED; + VclPtr<Edit> m_pSuffixED; + VclPtr<FixedText> m_pPosFT; + VclPtr<RadioButton> m_pPosPageBox; + VclPtr<RadioButton> m_pPosChapterBox; - VclContainer *m_pStylesContainer; + VclPtr<VclContainer> m_pStylesContainer; - ListBox* m_pParaTemplBox; - FixedText* m_pPageTemplLbl; - ListBox* m_pPageTemplBox; + VclPtr<ListBox> m_pParaTemplBox; + VclPtr<FixedText> m_pPageTemplLbl; + VclPtr<ListBox> m_pPageTemplBox; - ListBox* m_pFtnCharAnchorTemplBox; - ListBox* m_pFtnCharTextTemplBox; + VclPtr<ListBox> m_pFtnCharAnchorTemplBox; + VclPtr<ListBox> m_pFtnCharTextTemplBox; - Edit* m_pContEdit; - Edit* m_pContFromEdit; + VclPtr<Edit> m_pContEdit; + VclPtr<Edit> m_pContFromEdit; OUString aNumDoc; OUString aNumPage; @@ -70,8 +70,9 @@ public: SwEndNoteOptionPage( vcl::Window *pParent, bool bEndNote, const SfxItemSet &rSet ); virtual ~SwEndNoteOptionPage(); + virtual void dispose() SAL_OVERRIDE; - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); virtual bool FillItemSet(SfxItemSet *rSet) SAL_OVERRIDE; virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE; @@ -84,7 +85,7 @@ class SwFootNoteOptionPage : public SwEndNoteOptionPage virtual ~SwFootNoteOptionPage(); public: - static SfxTabPage *Create(vcl::Window *pParent, const SfxItemSet *rSet); + static VclPtr<SfxTabPage> Create(vcl::Window *pParent, const SfxItemSet *rSet); }; #endif diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index fb45db53321d..0824f3de8fd3 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -204,10 +204,27 @@ SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, boo SwInsFootNoteDlg::~SwInsFootNoteDlg() { + disposeOnce(); +} + +void SwInsFootNoteDlg::dispose() +{ SwViewShell::SetCareWin(0); if (bEdit) rSh.ResetSelect(0, false); + + m_pNumberFrame.clear(); + m_pNumberAutoBtn.clear(); + m_pNumberCharBtn.clear(); + m_pNumberCharEdit.clear(); + m_pNumberExtChar.clear(); + m_pFtnBtn.clear(); + m_pEndNoteBtn.clear(); + m_pOkBtn.clear(); + m_pPrevBT.clear(); + m_pNextBT.clear(); + SvxStandardDialog::dispose(); } void SwInsFootNoteDlg::Init() diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index db98b1ce87b1..b14903c9e170 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -169,8 +169,30 @@ SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) SwLineNumberingDlg::~SwLineNumberingDlg() { + disposeOnce(); } +void SwLineNumberingDlg::dispose() +{ + m_pBodyContent.clear(); + m_pDivIntervalFT.clear(); + m_pDivIntervalNF.clear(); + m_pDivRowsFT.clear(); + m_pNumIntervalNF.clear(); + m_pCharStyleLB.clear(); + m_pFormatLB.clear(); + m_pPosLB.clear(); + m_pOffsetMF.clear(); + m_pDivisorED.clear(); + m_pCountEmptyLinesCB.clear(); + m_pCountFrameLinesCB.clear(); + m_pRestartEachPageCB.clear(); + m_pNumberingOnCB.clear(); + m_pNumberingOnFooterHeader.clear(); + SfxModalDialog::dispose(); +} + + IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl) { SwLineNumberInfo aInf(pSh->GetLineNumberInfo()); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index cd9c26626de3..50047f254f4f 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -163,7 +163,37 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, SwNumPositionTabPage::~SwNumPositionTabPage() { + disposeOnce(); +} + +void SwNumPositionTabPage::dispose() +{ delete pActNum; + m_pLevelLB.clear(); + m_pPositionFrame.clear(); + m_pDistBorderFT.clear(); + m_pDistBorderMF.clear(); + m_pRelativeCB.clear(); + m_pIndentFT.clear(); + m_pIndentMF.clear(); + m_pDistNumFT.clear(); + m_pDistNumMF.clear(); + m_pAlignFT.clear(); + m_pAlignLB.clear(); + m_pLabelFollowedByFT.clear(); + m_pLabelFollowedByLB.clear(); + m_pListtabFT.clear(); + m_pListtabMF.clear(); + m_pAlign2FT.clear(); + m_pAlign2LB.clear(); + m_pAlignedAtFT.clear(); + m_pAlignedAtMF.clear(); + m_pIndentAtFT.clear(); + m_pIndentAtMF.clear(); + m_pStandardPB.clear(); + m_pPreviewWIN.clear(); + pOutlineDlg.clear(); + SfxTabPage::dispose(); } void SwNumPositionTabPage::InitControls() @@ -175,9 +205,9 @@ void SwNumPositionTabPage::InitControls() USHRT_MAX != nActNumLvl; m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); + ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) ); m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); + ( bSingleSelection || bRelative || pOutlineDlg.get() != 0 ) ); bool bSetDistEmpty = false; bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; @@ -512,10 +542,10 @@ void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive ); } -SfxTabPage* SwNumPositionTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwNumPositionTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwNumPositionTabPage(pParent, *rAttrSet); + return VclPtr<SwNumPositionTabPage>::Create(pParent, *rAttrSet); } void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) @@ -960,15 +990,15 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect char styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + ScopedVclPtrInstance< ListBox > rCharFmtLB(this); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index c9ef5a1d1631..c66b86947e80 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -60,9 +60,9 @@ using namespace ::com::sun::star; class SwNumNamesDlg : public ModalDialog { - Edit* m_pFormEdit; - ListBox* m_pFormBox; - OKButton* m_pOKBtn; + VclPtr<Edit> m_pFormEdit; + VclPtr<ListBox> m_pFormBox; + VclPtr<OKButton> m_pOKBtn; DECL_LINK( ModifyHdl, Edit * ); DECL_LINK( SelectHdl, ListBox * ); @@ -70,11 +70,27 @@ class SwNumNamesDlg : public ModalDialog public: SwNumNamesDlg(vcl::Window *pParent); + virtual ~SwNumNamesDlg(); + virtual void dispose() SAL_OVERRIDE; void SetUserNames(const OUString *pList[]); OUString GetName() const { return m_pFormEdit->GetText(); } sal_Int32 GetCurEntryPos() const { return m_pFormBox->GetSelectEntryPos(); } }; +SwNumNamesDlg::~SwNumNamesDlg() +{ + disposeOnce(); +} + +void SwNumNamesDlg::dispose() +{ + m_pFormEdit.clear(); + m_pFormBox.clear(); + m_pOKBtn.clear(); + ModalDialog::dispose(); +} + + // remember selected entry IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox ) { @@ -193,7 +209,13 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p SwOutlineTabDialog::~SwOutlineTabDialog() { + disposeOnce(); +} + +void SwOutlineTabDialog::dispose() +{ delete pNumRule; + SfxTabDialog::dispose(); } void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) @@ -265,7 +287,7 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu ) nLevelNo = 9; else if (sIdent == "saveas") { - boost::scoped_ptr<SwNumNamesDlg> pDlg(new SwNumNamesDlg(this)); + VclPtrInstance< SwNumNamesDlg > pDlg(this); const OUString *aStrArr[SwChapterNumRules::nMaxRules]; for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) { @@ -740,8 +762,25 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, CharFmtHdl) SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage() { + disposeOnce(); } +void SwOutlineSettingsTabPage::dispose() +{ + m_pLevelLB.clear(); + m_pCollBox.clear(); + m_pNumberBox.clear(); + m_pCharFmtLB.clear(); + m_pAllLevelFT.clear(); + m_pAllLevelNF.clear(); + m_pPrefixED.clear(); + m_pSuffixED.clear(); + m_pStartEdit.clear(); + m_pPreviewWIN.clear(); + SfxTabPage::dispose(); +} + + void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) { pSh = pShell; @@ -826,10 +865,10 @@ void SwOutlineSettingsTabPage::Reset( const SfxItemSet* rSet ) ActivatePage(*rSet); } -SfxTabPage* SwOutlineSettingsTabPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwOutlineSettingsTabPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwOutlineSettingsTabPage(pParent, *rAttrSet); + return VclPtr<SwOutlineSettingsTabPage>::Create(pParent, *rAttrSet); } void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) @@ -892,7 +931,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ ) { const Size aSize(PixelToLogic(GetOutputSizePixel())); - boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this)); + ScopedVclPtrInstance< VirtualDevice > pVDev(*this); pVDev->SetMapMode(GetMapMode()); pVDev->SetOutputSize( aSize ); diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 809b09007fa9..bd8b00829e65 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -135,11 +135,27 @@ SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet) SwFootNotePage::~SwFootNotePage() { + disposeOnce(); } -SfxTabPage* SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwFootNotePage::dispose() { - return new SwFootNotePage(pParent, *rSet); + m_pMaxHeightPageBtn.clear(); + m_pMaxHeightBtn.clear(); + m_pMaxHeightEdit.clear(); + m_pDistEdit.clear(); + m_pLinePosBox.clear(); + m_pLineTypeBox.clear(); + m_pLineWidthEdit.clear(); + m_pLineColorBox.clear(); + m_pLineLengthEdit.clear(); + m_pLineDistEdit.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwFootNotePage(pParent, *rSet), SAL_NO_ACQUIRE); } void SwFootNotePage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index d4908da737a6..100a2c4d8d67 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -151,14 +151,41 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : SwTextGridPage::~SwTextGridPage() { + disposeOnce(); } -SfxTabPage *SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +void SwTextGridPage::dispose() { - return new SwTextGridPage(pParent, *rSet); + m_pNoGridRB.clear(); + m_pLinesGridRB.clear(); + m_pCharsGridRB.clear(); + m_pSnapToCharsCB.clear(); + m_pExampleWN.clear(); + m_pLayoutFL.clear(); + m_pLinesPerPageNF.clear(); + m_pLinesRangeFT.clear(); + m_pTextSizeMF.clear(); + m_pCharsPerLineFT.clear(); + m_pCharsPerLineNF.clear(); + m_pCharsRangeFT.clear(); + m_pCharWidthFT.clear(); + m_pCharWidthMF.clear(); + m_pRubySizeFT.clear(); + m_pRubySizeMF.clear(); + m_pRubyBelowCB.clear(); + m_pDisplayFL.clear(); + m_pDisplayCB.clear(); + m_pPrintCB.clear(); + m_pColorLB.clear(); + SfxTabPage::dispose(); } -bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) +VclPtr<SfxTabPage> SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) +{ + return VclPtr<SfxTabPage>(new SwTextGridPage(pParent, *rSet), SAL_NO_ACQUIRE); +} + +bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) { bool bRet = false; if(m_pNoGridRB->IsValueChangedFromSaved() || @@ -460,7 +487,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton) { - bool bEnable = m_pNoGridRB != pButton; + bool bEnable = m_pNoGridRB.get() != pButton; m_pLayoutFL->Enable(bEnable); m_pDisplayFL->Enable(bEnable); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 3c58114764b1..bb7bcd01222f 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -250,10 +250,41 @@ SwSortDlg::SwSortDlg(vcl::Window* pParent, SwWrtShell &rShell) SwSortDlg::~SwSortDlg() { + disposeOnce(); +} + +void SwSortDlg::dispose() +{ ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB1); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB2); ::lcl_ClearLstBoxAndDelUserData(*m_pTypDLB3); delete pColRes; + m_pColLbl.clear(); + m_pTypLbl.clear(); + m_pKeyCB1.clear(); + m_pColEdt1.clear(); + m_pTypDLB1.clear(); + m_pSortUp1RB.clear(); + m_pSortDn1RB.clear(); + m_pKeyCB2.clear(); + m_pColEdt2.clear(); + m_pTypDLB2.clear(); + m_pSortUp2RB.clear(); + m_pSortDn2RB.clear(); + m_pKeyCB3.clear(); + m_pColEdt3.clear(); + m_pTypDLB3.clear(); + m_pSortUp3RB.clear(); + m_pSortDn3RB.clear(); + m_pColumnRB.clear(); + m_pRowRB.clear(); + m_pDelimTabRB.clear(); + m_pDelimFreeRB.clear(); + m_pDelimEdt.clear(); + m_pDelimPB.clear(); + m_pLangLB.clear(); + m_pCaseCB.clear(); + SvxStandardDialog::dispose(); } sal_Unicode SwSortDlg::GetDelimChar() const @@ -381,7 +412,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl) IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl ) { - if( pControl == m_pRowRB) + if( pControl == m_pRowRB.get()) { m_pColLbl->SetText(aColTxt); m_pColEdt1->SetMax(nY); @@ -392,7 +423,7 @@ IMPL_LINK( SwSortDlg, CheckHdl, void *, pControl ) m_pColEdt2->SetAccessibleName(aColTxt); m_pColEdt3->SetAccessibleName(aColTxt); } - else if( pControl == m_pColumnRB) + else if( pControl == m_pColumnRB.get()) { m_pColLbl->SetText(aRowTxt); m_pColEdt1->SetMax(nX); diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx index 153bbc1a27f7..252e264f4b58 100644 --- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx +++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx @@ -55,10 +55,16 @@ SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(vcl::Window *pParent) SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg() { + disposeOnce(); +} + +void SwModalRedlineAcceptDlg::dispose() +{ AcceptAll(false); // refuse everything remaining pImplDlg->FillInfo(GetExtraData()); delete pImplDlg; + SfxModalDialog::dispose(); } void SwModalRedlineAcceptDlg::Activate() diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 2dbd5ec742c6..5f888f3f7497 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -270,7 +270,25 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl) SwTitlePageDlg::~SwTitlePageDlg() { + disposeOnce(); +} + +void SwTitlePageDlg::dispose() +{ delete mpPageFmtDesc; + m_pUseExistingPagesRB.clear(); + m_pPageCountNF.clear(); + m_pDocumentStartRB.clear(); + m_pPageStartRB.clear(); + m_pPageStartNF.clear(); + m_pRestartNumberingCB.clear(); + m_pRestartNumberingNF.clear(); + m_pSetPageNumberCB.clear(); + m_pSetPageNumberNF.clear(); + m_pPagePropertiesLB.clear(); + m_pPagePropertiesPB.clear(); + m_pOkPB.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl) diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 751b5a4c029d..50ffa471b6f3 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -66,6 +66,18 @@ SwTableWidthDlg::SwTableWidthDlg(vcl::Window *pParent, SwTableFUNC &rTableFnc ) LoseFocusHdl(); } +SwTableWidthDlg::~SwTableWidthDlg() +{ + disposeOnce(); +} + +void SwTableWidthDlg::dispose() +{ + m_pColNF.clear(); + m_pWidthMF.clear(); + SvxStandardDialog::dispose(); +} + void SwTableWidthDlg::Apply() { rFnc.InitTabCols(); diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index cb31042c14de..63fb7aa83277 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -174,7 +174,27 @@ SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable ) SwConvertTableDlg:: ~SwConvertTableDlg() { + disposeOnce(); +} + +void SwConvertTableDlg::dispose() +{ delete pTAutoFmt; + mpTabBtn.clear(); + mpSemiBtn.clear(); + mpParaBtn.clear(); + mpOtherBtn.clear(); + mpOtherEd.clear(); + mpKeepColumn.clear(); + mpOptions.clear(); + mpHeaderCB.clear(); + mpRepeatHeaderCB.clear(); + mpRepeatRows.clear(); + mpRepeatHeaderNF.clear(); + mpDontSplitCB.clear(); + mpBorderCB.clear(); + mpAutoFmtBtn.clear(); + SfxModalDialog::dispose(); } IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton ) diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 56e6c02f36c7..e67319432c11 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -137,7 +137,24 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl) SwInsTableDlg::~SwInsTableDlg() { + disposeOnce(); +} + +void SwInsTableDlg::dispose() +{ delete pTAutoFmt; + m_pNameEdit.clear(); + m_pColNF.clear(); + m_pRowNF.clear(); + m_pHeaderCB.clear(); + m_pRepeatHeaderCB.clear(); + m_pRepeatHeaderNF.clear(); + m_pRepeatGroup.clear(); + m_pDontSplitCB.clear(); + m_pBorderCB.clear(); + m_pInsertBtn.clear(); + m_pAutoFmtBtn.clear(); + SfxModalDialog::dispose(); } IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit ) diff --git a/sw/source/ui/table/mergetbl.cxx b/sw/source/ui/table/mergetbl.cxx index 6c1dd9449336..1206a8b04842 100644 --- a/sw/source/ui/table/mergetbl.cxx +++ b/sw/source/ui/table/mergetbl.cxx @@ -28,6 +28,18 @@ SwMergeTblDlg::SwMergeTblDlg( vcl::Window *pParent, bool& rWithPrev ) m_pMergePrevRB->Check(); } +SwMergeTblDlg::~SwMergeTblDlg() +{ + disposeOnce(); +} + +void SwMergeTblDlg::dispose() +{ + m_pMergePrevRB.clear(); + SvxStandardDialog::dispose(); +} + + void SwMergeTblDlg::Apply() { m_rMergePrev = m_pMergePrevRB->IsChecked(); diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index f745f3f9356d..6c8bdb49b0c0 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -75,4 +75,16 @@ SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS) } } +SwTableHeightDlg::~SwTableHeightDlg() +{ + disposeOnce(); +} + +void SwTableHeightDlg::dispose() +{ + m_pHeightEdit.clear(); + m_pAutoHeightCB.clear(); + SvxStandardDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx index d6d7b62ca16b..c1d00489c519 100644 --- a/sw/source/ui/table/splittbl.cxx +++ b/sw/source/ui/table/splittbl.cxx @@ -33,6 +33,20 @@ SwSplitTblDlg::SwSplitTblDlg( vcl::Window *pParent, SwWrtShell &rSh ) get(mpBorderCopyRB, "noheading"); } +SwSplitTblDlg::~SwSplitTblDlg() +{ + disposeOnce(); +} + +void SwSplitTblDlg::dispose() +{ + mpCntntCopyRB.clear(); + mpBoxAttrCopyWithParaRB.clear(); + mpBoxAttrCopyNoParaRB.clear(); + mpBorderCopyRB.clear(); + SvxStandardDialog::dispose(); +} + void SwSplitTblDlg::Apply() { m_nSplit = HEADLINE_CNTNTCOPY; diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 5e9d71114e67..e6636d1b2c5b 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -105,6 +105,32 @@ SwFormatTablePage::SwFormatTablePage(vcl::Window* pParent, const SfxItemSet& rSe Init(); } +SwFormatTablePage::~SwFormatTablePage() +{ + disposeOnce(); +} + +void SwFormatTablePage::dispose() +{ + m_pNameED.clear(); + m_pWidthFT.clear(); + m_pRelWidthCB.clear(); + m_pFullBtn.clear(); + m_pLeftBtn.clear(); + m_pFromLeftBtn.clear(); + m_pRightBtn.clear(); + m_pCenterBtn.clear(); + m_pFreeBtn.clear(); + m_pLeftFT.clear(); + m_pRightFT.clear(); + m_pTopFT.clear(); + m_pTopMF.clear(); + m_pBottomFT.clear(); + m_pBottomMF.clear(); + m_pTextDirectionLB.clear(); + SfxTabPage::dispose(); +} + void SwFormatTablePage::Init() { m_aLeftMF.SetMetricFieldMin(-999999); @@ -370,10 +396,10 @@ void SwFormatTablePage::ModifyHdl(const Edit * pEdit) bModified = true; } -SfxTabPage* SwFormatTablePage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwFormatTablePage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwFormatTablePage( pParent, *rAttrSet ); + return VclPtr<SwFormatTablePage>::Create( pParent, *rAttrSet ); } bool SwFormatTablePage::FillItemSet( SfxItemSet* rCoreSet ) @@ -749,15 +775,28 @@ SwTableColumnPage::SwTableColumnPage(vcl::Window* pParent, const SfxItemSet& rSe && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON)); } -//Description: Page column configuration - SwTableColumnPage::~SwTableColumnPage() +SwTableColumnPage::~SwTableColumnPage() { + disposeOnce(); } -SfxTabPage* SwTableColumnPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +void SwTableColumnPage::dispose() { - return new SwTableColumnPage( pParent, *rAttrSet ); + m_pModifyTableCB.clear(); + m_pProportionalCB.clear(); + m_pSpaceFT.clear(); + m_pSpaceED.clear(); + m_pUpBtn.clear(); + m_pDownBtn.clear(); + for (auto p : m_pTextArr) + p.clear(); + SfxTabPage::dispose(); +} + +VclPtr<SfxTabPage> SwTableColumnPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) +{ + return VclPtr<SwTableColumnPage>::Create( pParent, *rAttrSet ); } void SwTableColumnPage::Reset( const SfxItemSet* ) @@ -832,7 +871,7 @@ void SwTableColumnPage::Init(bool bWeb) IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl ) { //move display window - if(pControl == m_pDownBtn) + if(pControl == m_pDownBtn.get()) { if(aValueTbl[0] > 0) { @@ -840,7 +879,7 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, void *, pControl ) aValueTbl[i] -= 1; } } - if (pControl == m_pUpBtn) + if (pControl == m_pUpBtn.get()) { if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 ) { @@ -1307,14 +1346,37 @@ SwTextFlowPage::SwTextFlowPage(vcl::Window* pParent, const SfxItemSet& rSet) HeadLineCBClickHdl(); } - SwTextFlowPage::~SwTextFlowPage() +SwTextFlowPage::~SwTextFlowPage() +{ + disposeOnce(); +} + +void SwTextFlowPage::dispose() { + m_pPgBrkCB.clear(); + m_pPgBrkRB.clear(); + m_pColBrkRB.clear(); + m_pPgBrkBeforeRB.clear(); + m_pPgBrkAfterRB.clear(); + m_pPageCollCB.clear(); + m_pPageCollLB.clear(); + m_pPageNoFT.clear(); + m_pPageNoNF.clear(); + m_pSplitCB.clear(); + m_pSplitRowCB.clear(); + m_pKeepCB.clear(); + m_pHeadLineCB.clear(); + m_pRepeatHeaderNF.clear(); + m_pRepeatHeaderCombo.clear(); + m_pTextDirectionLB.clear(); + m_pVertOrientLB.clear(); + SfxTabPage::dispose(); } -SfxTabPage* SwTextFlowPage::Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> SwTextFlowPage::Create( vcl::Window* pParent, + const SfxItemSet* rAttrSet) { - return new SwTextFlowPage(pParent, *rAttrSet); + return VclPtr<SfxTabPage>(new SwTextFlowPage(pParent, *rAttrSet), SAL_NO_ACQUIRE); } bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 8a8c02aa56f0..36a0cccf0061 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -49,6 +49,7 @@ class AutoFmtPreview : public vcl::Window public: AutoFmtPreview(vcl::Window* pParent, WinBits nStyle); virtual ~AutoFmtPreview(); + virtual void dispose() SAL_OVERRIDE; void NotifyChange( const SwTableAutoFmt& rNewData ); @@ -60,7 +61,7 @@ protected: private: SwTableAutoFmt aCurData; - VirtualDevice aVD; + ScopedVclPtr<VirtualDevice> aVD; SvtScriptedTextHelper aScriptedText; svx::frame::Array maArray; /// Implementation to draw the frame borders. bool bFitWidth; @@ -105,11 +106,12 @@ public: const OUString& rEditTitle, const OUString& rDefault ); virtual ~SwStringInputDlg(); + virtual void dispose() SAL_OVERRIDE; OUString GetInputString() const; private: - Edit* m_pEdInput; // Edit obtains the focus. + VclPtr<Edit> m_pEdInput; // Edit obtains the focus. }; SwStringInputDlg::SwStringInputDlg(vcl::Window* pParent, const OUString& rTitle, @@ -130,6 +132,13 @@ OUString SwStringInputDlg::GetInputString() const SwStringInputDlg::~SwStringInputDlg() { + disposeOnce(); +} + +void SwStringInputDlg::dispose() +{ + m_pEdInput.clear(); + ModalDialog::dispose(); } // AutoFormat-Dialogue: @@ -174,9 +183,28 @@ SwAutoFormatDlg::SwAutoFormatDlg( vcl::Window* pParent, SwWrtShell* pWrtShell, SwAutoFormatDlg::~SwAutoFormatDlg() { + disposeOnce(); +} + +void SwAutoFormatDlg::dispose() +{ if (bCoreDataChanged) pTableTbl->Save(); delete pTableTbl; + m_pLbFormat.clear(); + m_pFormatting.clear(); + m_pBtnNumFormat.clear(); + m_pBtnBorder.clear(); + m_pBtnFont.clear(); + m_pBtnPattern.clear(); + m_pBtnAlignment.clear(); + m_pBtnOk.clear(); + m_pBtnCancel.clear(); + m_pBtnAdd.clear(); + m_pBtnRemove.clear(); + m_pBtnRename.clear(); + m_pWndPreview.clear(); + SfxModalDialog::dispose(); } void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) @@ -287,10 +315,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl) bool bOk = false, bFmtInserted = false; while( !bOk ) { - boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this, - aStrTitle, - aStrLabel, - OUString() )); + VclPtrInstance<SwStringInputDlg> pDlg( this, aStrTitle, + aStrLabel, OUString() ); if( RET_OK == pDlg->Execute() ) { const OUString aFormatName( pDlg->GetInputString() ); @@ -349,8 +375,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl) aMessage += m_pLbFormat->GetSelectEntry(); aMessage += "\n"; - boost::scoped_ptr<MessBox> pBox(new MessBox( this, WinBits( WB_OK_CANCEL ), - aStrDelTitle, aMessage)); + VclPtrInstance<MessBox> pBox( this, WinBits( WB_OK_CANCEL ), + aStrDelTitle, aMessage ); if ( pBox->Execute() == RET_OK ) { @@ -384,10 +410,9 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) bool bOk = false; while( !bOk ) { - boost::scoped_ptr<SwStringInputDlg> pDlg(new SwStringInputDlg( this, - aStrRenameTitle, - m_pLbFormat->GetSelectEntry(), - OUString() )); + VclPtrInstance<SwStringInputDlg> pDlg( this, aStrRenameTitle, + m_pLbFormat->GetSelectEntry(), + OUString() ); if( pDlg->Execute() == RET_OK ) { bool bFmtRenamed = false; @@ -489,8 +514,8 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl) AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) : Window ( pParent, nStyle ), aCurData ( OUString() ), - aVD ( *this ), - aScriptedText ( aVD ), + aVD ( VclPtr<VirtualDevice>::Create(*this) ), + aScriptedText ( *aVD.get() ), bFitWidth ( false ), mbRTL ( false ), aStrJan ( SW_RES( STR_JAN ) ), @@ -537,7 +562,13 @@ void AutoFmtPreview::DetectRTL(SwWrtShell* pWrtShell) AutoFmtPreview::~AutoFmtPreview() { + disposeOnce(); +} + +void AutoFmtPreview::dispose() +{ delete pNumFmt; + vcl::Window::dispose(); } static void lcl_SetFontProperties( @@ -762,11 +793,11 @@ void AutoFmtPreview::DrawBackground() { SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() ); - aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - aVD.SetLineColor(); - aVD.SetFillColor( aBrushItem.GetColor() ); - aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) ); - aVD.Pop(); + aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); + aVD->SetLineColor(); + aVD->SetFillColor( aBrushItem.GetColor() ); + aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) ); + aVD->Pop(); } } } @@ -782,7 +813,7 @@ void AutoFmtPreview::PaintCells() // 3) border if ( aCurData.IsFrame() ) - maArray.DrawArray( aVD ); + maArray.DrawArray( *aVD.get() ); } void AutoFmtPreview::Init() @@ -851,9 +882,9 @@ void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData ) void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) { - sal_uInt32 nOldDrawMode = aVD.GetDrawMode(); + sal_uInt32 nOldDrawMode = aVD->GetDrawMode(); if( GetSettings().GetStyleSettings().GetHighContrastMode() ) - aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); + aVD->SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); Bitmap thePreview; Point aCenterPos; @@ -861,36 +892,36 @@ void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) Color oldColor; vcl::Font aFont; - aFont = aVD.GetFont(); + aFont = aVD->GetFont(); aFont.SetTransparent( true ); - aVD.SetFont ( aFont ); - aVD.SetLineColor (); + aVD->SetFont ( aFont ); + aVD->SetLineColor (); const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor(); - aVD.SetBackground ( Wallpaper(rWinColor) ); - aVD.SetFillColor ( rWinColor ); - aVD.SetOutputSizePixel ( aPrvSize ); + aVD->SetBackground ( Wallpaper(rWinColor) ); + aVD->SetFillColor ( rWinColor ); + aVD->SetOutputSizePixel ( aPrvSize ); // Draw cells on virtual device // and save the result PaintCells(); - thePreview = aVD.GetBitmap( Point(0,0), aPrvSize ); + thePreview = aVD->GetBitmap( Point(0,0), aPrvSize ); // Draw the Frame and center the preview: // (virtual Device for window output) - aVD.SetOutputSizePixel( theWndSize ); - oldColor = aVD.GetLineColor(); - aVD.SetLineColor(); - aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) ); + aVD->SetOutputSizePixel( theWndSize ); + oldColor = aVD->GetLineColor(); + aVD->SetLineColor(); + aVD->DrawRect( Rectangle( Point(0,0), theWndSize ) ); SetLineColor( oldColor ); aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2, (theWndSize.Height() - aPrvSize.Height()) / 2 ); - aVD.DrawBitmap( aCenterPos, thePreview ); + aVD->DrawBitmap( aCenterPos, thePreview ); // Output in the preview window: - DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) ); + DrawBitmap( Point(0,0), aVD->GetBitmap( Point(0,0), theWndSize ) ); - aVD.SetDrawMode( nOldDrawMode ); + aVD->SetDrawMode( nOldDrawMode ); } void AutoFmtPreview::Paint( const Rectangle& rRect ) diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 15902b8a076a..f2ebdb3a6df5 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -74,6 +74,18 @@ SwRenameXNamedDlg::SwRenameXNamedDlg( vcl::Window* pWin, m_pOk->Enable(false); } +SwRenameXNamedDlg::~SwRenameXNamedDlg() +{ + disposeOnce(); +} + +void SwRenameXNamedDlg::dispose() +{ + m_pNewNameED.clear(); + m_pOk.clear(); + ModalDialog::dispose(); +} + IMPL_LINK_NOARG(SwRenameXNamedDlg, OkHdl) { try |