diff options
Diffstat (limited to 'sfx2/source/doc/templatedlg.cxx')
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 84 |
1 files changed, 50 insertions, 34 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index fee3db0670df..3997e4f5f0e9 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -296,7 +296,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) mpLocalView->Show(); } -SfxTemplateManagerDlg::~SfxTemplateManagerDlg () +SfxTemplateManagerDlg::~SfxTemplateManagerDlg() +{ + disposeOnce(); +} + +void SfxTemplateManagerDlg::dispose() { writeSettings(); @@ -316,6 +321,17 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () mpSearchView->setItemStateHdl(Link()); mpSearchView->setOpenTemplateHdl(Link()); + + mpTabControl.clear(); + mpSearchEdit.clear(); + mpViewBar.clear(); + mpActionBar.clear(); + mpTemplateBar.clear(); + mpSearchView.clear(); + mpCurView.clear(); + mpLocalView.clear(); + mpRemoteView.clear(); + ModalDialog::dispose(); } void SfxTemplateManagerDlg::setSaveMode() @@ -608,11 +624,11 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu) } else if (nMenuId == MNI_REPOSITORY_NEW) { - PlaceEditDialog dlg(this); + ScopedVclPtrInstance< PlaceEditDialog > dlg(this); - if (dlg.Execute()) + if (dlg->Execute()) { - std::shared_ptr<Place> xPlace = dlg.GetPlace(); + std::shared_ptr<Place> xPlace = dlg->GetPlace(); if (insertRepository(xPlace->GetName(), xPlace->GetUrl())) { @@ -623,7 +639,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu) { OUString aMsg(SfxResId(STR_MSG_ERROR_REPOSITORY_NAME).toString()); aMsg = aMsg.replaceFirst("$1", xPlace->GetName()); - MessageDialog(this, aMsg).Execute(); + ScopedVclPtrInstance<MessageDialog>(this, aMsg)->Execute(); } } } @@ -1152,16 +1168,16 @@ void SfxTemplateManagerDlg::OnTemplateProperties () { const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*maSelTemplates.begin()); - SfxTemplateInfoDlg aDlg; - aDlg.loadDocument(pItem->getPath()); - aDlg.Execute(); + ScopedVclPtrInstance< SfxTemplateInfoDlg > aDlg; + aDlg->loadDocument(pItem->getPath()); + aDlg->Execute(); } void SfxTemplateManagerDlg::OnTemplateDelete () { - MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if ( aQueryDlg.Execute() != RET_YES ) + if ( aQueryDlg->Execute() != RET_YES ) return; OUString aTemplateList; @@ -1230,13 +1246,13 @@ void SfxTemplateManagerDlg::OnTemplateAsDefault () void SfxTemplateManagerDlg::OnFolderNew() { - InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this); - int ret = dlg.Execute(); + int ret = dlg->Execute(); if (ret) { - OUString aName = dlg.getEntryText(); + OUString aName = dlg->getEntryText(); mpCurView->createRegion(aName); } @@ -1244,9 +1260,9 @@ void SfxTemplateManagerDlg::OnFolderNew() void SfxTemplateManagerDlg::OnFolderDelete() { - MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if ( aQueryDlg.Execute() != RET_YES ) + if ( aQueryDlg->Execute() != RET_YES ) return; OUString aFolderList; @@ -1297,17 +1313,17 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() return; } - InputDialog aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this); + ScopedVclPtrInstance< InputDialog > aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this); - if (aDlg.Execute()) + if (aDlg->Execute()) { - OUString aName = aDlg.getEntryText(); + OUString aName = aDlg->getEntryText(); if (!aName.isEmpty()) { OUString aFolderList; OUString aQMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE).toString()); - MessageDialog aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); if (mpLocalView->isNonRootRegionVisible()) { @@ -1316,9 +1332,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (!mpLocalView->isTemplateNameUnique(nRegionItemId,aName)) { aQMsg = aQMsg.replaceFirst("$1",aName); - aQueryDlg.set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName())); + aQueryDlg->set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName())); - if (aQueryDlg.Execute() == RET_NO) + if (aQueryDlg->Execute() == RET_NO) return; } @@ -1335,9 +1351,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (!mpLocalView->isTemplateNameUnique(pItem->mnId,aName)) { OUString aDQMsg = aQMsg.replaceFirst("$1",aName); - aQueryDlg.set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle)); + aQueryDlg->set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle)); - if (aQueryDlg.Execute() == RET_NO) + if (aQueryDlg->Execute() == RET_NO) continue; } @@ -1403,7 +1419,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal) { if (bDisplayLocal) { - mpCurView = mpLocalView; + mpCurView = mpLocalView.get(); mpViewBar->HideItem(VIEWBAR_DELETE); @@ -1416,7 +1432,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal) } else { - mpCurView = mpRemoteView; + mpCurView = mpRemoteView.get(); mpViewBar->ShowItem(VIEWBAR_DELETE); @@ -1435,13 +1451,13 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) if (nMenuId == MNI_MOVE_NEW) { - InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this); - int ret = dlg.Execute(); + int ret = dlg->Execute(); if (ret) { - OUString aName = dlg.getEntryText(); + OUString aName = dlg->getEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); @@ -1483,13 +1499,13 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId) if (nMenuId == MNI_MOVE_NEW) { - InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this); - int ret = dlg.Execute(); + int ret = dlg->Execute(); if (ret) { - OUString aName = dlg.getEntryText(); + OUString aName = dlg->getEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); @@ -1537,13 +1553,13 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) if (nMenuId == MNI_MOVE_NEW) { - InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this); + ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this); - int ret = dlg.Execute(); + int ret = dlg->Execute(); if (ret) { - OUString aName = dlg.getEntryText(); + OUString aName = dlg->getEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); |