diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/module.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 34 | ||||
-rw-r--r-- | sfx2/source/dialog/documentfontsdialog.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/mgetempl.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/dialog/printopt.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/securitypage.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 101 | ||||
-rw-r--r-- | sfx2/source/inc/documentfontsdialog.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/printer.cxx | 19 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 8 |
11 files changed, 84 insertions, 127 deletions
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index cd0070f6cd49..dbdf7b151ab4 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -188,9 +188,9 @@ SfxChildWinFactArr_Impl* SfxModule::GetChildWinFactories_Impl() const return pImpl->pFactArr.get(); } -VclPtr<SfxTabPage> SfxModule::CreateTabPage(sal_uInt16, TabPageParent, const SfxItemSet&) +std::unique_ptr<SfxTabPage> SfxModule::CreateTabPage(sal_uInt16, TabPageParent, const SfxItemSet&) { - return VclPtr<SfxTabPage>(); + return nullptr; } void SfxModule::Invalidate( sal_uInt16 nId ) diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 243da291d1da..139e9eae1a88 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -503,7 +503,6 @@ SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent SfxSingleTabDialogController::~SfxSingleTabDialogController() { - m_xSfxPage.disposeAndClear(); } /* [Description] @@ -512,11 +511,9 @@ SfxSingleTabDialogController::~SfxSingleTabDialogController() The passed on page is initialized with the initially given Itemset through calling Reset(). */ -void SfxSingleTabDialogController::SetTabPage(SfxTabPage* pTabPage) +void SfxSingleTabDialogController::SetTabPage(std::unique_ptr<SfxTabPage> xTabPage) { - m_xSfxPage.disposeAndClear(); - m_xSfxPage = pTabPage; - + m_xSfxPage = std::move(xTabPage); if (!m_xSfxPage) return; @@ -532,7 +529,7 @@ void SfxSingleTabDialogController::SetTabPage(SfxTabPage* pTabPage) m_xHelpBtn->set_visible(Help::IsContextHelpEnabled()); // Set TabPage text in the Dialog if there is any - OUString sTitle(m_xSfxPage->GetText()); + OUString sTitle(m_xSfxPage->GetPageTitle()); if (!sTitle.isEmpty()) m_xDialog->set_title(sTitle); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 782d4faa0b2e..b2beb7a7a679 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -617,9 +617,9 @@ SfxDocumentDescPage::~SfxDocumentDescPage() { } -VclPtr<SfxTabPage> SfxDocumentDescPage::Create(TabPageParent pParent, const SfxItemSet *rItemSet) +std::unique_ptr<SfxTabPage> SfxDocumentDescPage::Create(TabPageParent pParent, const SfxItemSet *rItemSet) { - return VclPtr<SfxDocumentDescPage>::Create(pParent, *rItemSet); + return std::make_unique<SfxDocumentDescPage>(pParent, *rItemSet); } bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet) @@ -743,7 +743,6 @@ SfxDocumentPage::SfxDocumentPage(TabPageParent pParent, const SfxItemSet& rItemS SfxDocumentPage::~SfxDocumentPage() { - disposeOnce(); } IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl, weld::Button&, void) @@ -768,7 +767,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, SignatureHdl, weld::Button&, void) SfxObjectShell* pDoc = SfxObjectShell::Current(); if( pDoc ) { - pDoc->SignDocumentContent(GetFrameWeld()); + pDoc->SignDocumentContent(GetDialogFrameWeld()); ImplUpdateSignatures(); } @@ -788,7 +787,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) if (!pFilter) break; - sfx2::RequestPassword(pFilter, OUString(), pMedSet, VCLUnoHelper::GetInterface(GetParentDialog())); + sfx2::RequestPassword(pFilter, OUString(), pMedSet, GetDialogFrameWeld()->GetXWindow()); pShell->SetModified(); } while (false); @@ -857,9 +856,9 @@ void SfxDocumentPage::ImplCheckPasswordState() m_xChangePassBtn->set_sensitive(false); } -VclPtr<SfxTabPage> SfxDocumentPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) +std::unique_ptr<SfxTabPage> SfxDocumentPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) { - return VclPtr<SfxDocumentPage>::Create( pParent, *rItemSet ); + return std::make_unique<SfxDocumentPage>(pParent, *rItemSet); } void SfxDocumentPage::EnableUseUserData() @@ -1864,13 +1863,7 @@ SfxCustomPropertiesPage::SfxCustomPropertiesPage(TabPageParent pParent, const Sf SfxCustomPropertiesPage::~SfxCustomPropertiesPage() { - disposeOnce(); -} - -void SfxCustomPropertiesPage::dispose() -{ m_xPropertiesCtrl.reset(); - SfxTabPage::dispose(); } IMPL_LINK_NOARG(SfxCustomPropertiesPage, AddHdl, weld::Button&, void) @@ -1953,9 +1946,9 @@ DeactivateRC SfxCustomPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ ) return nRet; } -VclPtr<SfxTabPage> SfxCustomPropertiesPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) +std::unique_ptr<SfxTabPage> SfxCustomPropertiesPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) { - return VclPtr<SfxCustomPropertiesPage>::Create( pParent, *rItemSet ); + return std::make_unique<SfxCustomPropertiesPage>(pParent, *rItemSet); } CmisValue::CmisValue(weld::Widget* pParent, const OUString& aStr) @@ -2253,14 +2246,9 @@ SfxCmisPropertiesPage::SfxCmisPropertiesPage(TabPageParent pParent, const SfxIte } -void SfxCmisPropertiesPage::dispose() -{ - m_xPropertiesCtrl.reset(); - SfxTabPage::dispose(); -} - SfxCmisPropertiesPage::~SfxCmisPropertiesPage() { + m_xPropertiesCtrl.reset(); } bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) @@ -2351,9 +2339,9 @@ DeactivateRC SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ ) return DeactivateRC::LeavePage; } -VclPtr<SfxTabPage> SfxCmisPropertiesPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) +std::unique_ptr<SfxTabPage> SfxCmisPropertiesPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) { - return VclPtr<SfxCmisPropertiesPage>::Create( pParent, *rItemSet ); + return std::make_unique<SfxCmisPropertiesPage>(pParent, *rItemSet); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx index 73e9aad8471d..8f5212579846 100644 --- a/sfx2/source/dialog/documentfontsdialog.cxx +++ b/sfx2/source/dialog/documentfontsdialog.cxx @@ -26,9 +26,9 @@ using namespace ::com::sun::star; -VclPtr<SfxTabPage> SfxDocumentFontsPage::Create(TabPageParent pParent, const SfxItemSet* set) +std::unique_ptr<SfxTabPage> SfxDocumentFontsPage::Create(TabPageParent pParent, const SfxItemSet* set) { - return VclPtr<SfxDocumentFontsPage>::Create(pParent, *set); + return std::make_unique<SfxDocumentFontsPage>(pParent, *set); } SfxDocumentFontsPage::SfxDocumentFontsPage(TabPageParent parent, const SfxItemSet& set) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 1a69d53ce3c3..eb430426b601 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -253,15 +253,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf SfxManageStyleSheetPage::~SfxManageStyleSheetPage() { - disposeOnce(); -} - -void SfxManageStyleSheetPage::dispose() -{ pFamilies.reset(); pItem = nullptr; pStyle = nullptr; - SfxTabPage::dispose(); } void SfxManageStyleSheetPage::UpdateName_Impl( weld::ComboBox* pBox, @@ -532,10 +526,10 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ ) } } -VclPtr<SfxTabPage> SfxManageStyleSheetPage::Create( TabPageParent pParent, +std::unique_ptr<SfxTabPage> SfxManageStyleSheetPage::Create( TabPageParent pParent, const SfxItemSet *rAttrSet ) { - return VclPtr<SfxManageStyleSheetPage>::Create(pParent, *rAttrSet); + return std::make_unique<SfxManageStyleSheetPage>(pParent, *rAttrSet); } void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet) @@ -595,7 +589,7 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) if (!pStyle->SetName(comphelper::string::stripStart(m_xName->get_text(), ' '))) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_TABPAGE_INVALIDNAME))); xBox->run(); @@ -614,7 +608,7 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) { if ( !pStyle->SetFollow( aFollowEntry ) ) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_TABPAGE_INVALIDSTYLE))); xBox->run(); @@ -636,7 +630,7 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet ) { if ( !pStyle->SetParent( aParentEntry ) ) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_TABPAGE_INVALIDPARENT))); xBox->run(); diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 09994c530a43..cbd3d9408bfe 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -86,9 +86,9 @@ SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage() { } -VclPtr<SfxTabPage> SfxCommonPrintOptionsTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) +std::unique_ptr<SfxTabPage> SfxCommonPrintOptionsTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) { - return VclPtr<SfxCommonPrintOptionsTabPage>::Create( pParent, *rAttrSet ); + return std::make_unique<SfxCommonPrintOptionsTabPage>(pParent, *rAttrSet); } bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ ) diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index fcafc1638afc..dfc3ddb8e71c 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -320,7 +320,7 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, RecordChangesCBToggleHdl, weld::ToggleButt bool bAlreadyDone = false; if (!m_bEndRedliningWarningDone) { - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_rMyTabPage.GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_rMyTabPage.GetDialogFrameWeld(), VclMessageType::Warning, VclButtonsType::YesNo, m_aEndRedliningWarning)); xWarn->set_default_response(RET_NO); @@ -337,7 +337,7 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, RecordChangesCBToggleHdl, weld::ToggleButt OUString aPasswordText; // dialog canceled or no password provided - if (!lcl_GetPassword( m_rMyTabPage.GetFrameWeld(), false, aPasswordText )) + if (!lcl_GetPassword( m_rMyTabPage.GetDialogFrameWeld(), false, aPasswordText )) bAlreadyDone = true; // ask for password and if dialog is canceled or no password provided return @@ -375,7 +375,7 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, ChangeProtectionPBHdl, weld::Button&, void if (bNeedPassword) { // ask for password and if dialog is canceled or no password provided return - if (!lcl_GetPassword(m_rMyTabPage.GetFrameWeld(), bNewProtection, aPasswordText)) + if (!lcl_GetPassword(m_rMyTabPage.GetDialogFrameWeld(), bNewProtection, aPasswordText)) return; // provided password still needs to be checked? @@ -400,9 +400,9 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, ChangeProtectionPBHdl, weld::Button&, void m_xProtectPB->set_visible(!bNewProtection); } -VclPtr<SfxTabPage> SfxSecurityPage::Create(TabPageParent pParent, const SfxItemSet * rItemSet) +std::unique_ptr<SfxTabPage> SfxSecurityPage::Create(TabPageParent pParent, const SfxItemSet * rItemSet) { - return VclPtr<SfxSecurityPage>::Create(pParent, *rItemSet); + return std::make_unique<SfxSecurityPage>(pParent, *rItemSet); } SfxSecurityPage::SfxSecurityPage(TabPageParent pParent, const SfxItemSet& rItemSet) diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index b2f7f7754a58..b3299c64ab4e 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -51,11 +51,10 @@ using namespace ::com::sun::star::uno; struct TabPageImpl { bool mbStandard; - weld::DialogController* mpDialogController; SfxOkDialogController* mpSfxDialogController; css::uno::Reference< css::frame::XFrame > mxFrame; - TabPageImpl() : mbStandard(false), mpDialogController(nullptr), mpSfxDialogController(nullptr) {} + TabPageImpl() : mbStandard(false), mpSfxDialogController(nullptr) {} }; struct Data_Impl @@ -63,7 +62,7 @@ struct Data_Impl OString const sId; // The ID CreateTabPage fnCreatePage; // Pointer to Factory GetTabPageRanges fnGetRanges; // Pointer to Ranges-Function - VclPtr<SfxTabPage> pTabPage; // The TabPage itself + std::unique_ptr<SfxTabPage> xTabPage; // The TabPage itself bool bRefresh; // Flag: Page must be re-initialized // Constructor @@ -73,7 +72,6 @@ struct Data_Impl sId ( rId ), fnCreatePage( fnPage ), fnGetRanges ( fnRanges ), - pTabPage ( nullptr ), bRefresh ( false ) { } @@ -140,16 +138,12 @@ css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const } SfxTabPage::SfxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet) - : TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get()) //just drag this along hidden in this scenario + : BuilderPage(pParent.pPage, pParent.pController, rUIXMLDescription, rID) , pSet ( rAttrSet ) , bHasExchangeSupport ( false ) , pImpl ( new TabPageImpl ) - , m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, rUIXMLDescription) - : Application::CreateInterimBuilder(this, rUIXMLDescription)) - , m_xContainer(m_xBuilder->weld_container(rID)) { - pImpl->mpDialogController = pParent.pController; - pImpl->mpSfxDialogController = dynamic_cast<SfxOkDialogController*>(pImpl->mpDialogController); + pImpl->mpSfxDialogController = dynamic_cast<SfxOkDialogController*>(m_pDialogController); } SfxTabPage::~SfxTabPage() @@ -161,14 +155,8 @@ SfxTabPage::~SfxTabPage() xParent->move(m_xContainer.get(), nullptr); } m_xContainer.reset(); - disposeOnce(); -} - -void SfxTabPage::dispose() -{ pImpl.reset(); m_xBuilder.reset(); - TabPage::dispose(); } bool SfxTabPage::FillItemSet( SfxItemSet* ) @@ -286,7 +274,7 @@ void SfxTabPage::ChangesApplied() void SfxTabPage::SetDialogController(SfxOkDialogController* pDialog) { pImpl->mpSfxDialogController = pDialog; - pImpl->mpDialogController = pImpl->mpSfxDialogController; + m_pDialogController = pImpl->mpSfxDialogController; } SfxOkDialogController* SfxTabPage::GetDialogController() const @@ -294,21 +282,18 @@ SfxOkDialogController* SfxTabPage::GetDialogController() const return pImpl->mpSfxDialogController; } -OString SfxTabPage::GetConfigId() const +OString SfxTabPage::GetHelpId() const { if (m_xContainer) return m_xContainer->get_help_id(); - OString sId(GetHelpId()); - if (sId.isEmpty() && isLayoutEnabled(this)) - sId = GetWindow(GetWindowType::FirstChild)->GetHelpId(); - return sId; + return OString(); } weld::Window* SfxTabPage::GetDialogFrameWeld() const { - if (pImpl->mpDialogController) - return pImpl->mpDialogController->getDialog(); - return GetFrameWeld(); + if (m_pDialogController) + return m_pDialogController->getDialog(); + return nullptr; } const SfxItemSet* SfxTabPage::GetDialogExampleSet() const @@ -420,7 +405,7 @@ IMPL_LINK_NOARG(SfxTabDialogController, ResetHdl, weld::Button&, void) Data_Impl* pDataObject = Find(m_pImpl->aData, m_xTabCtrl->get_current_page_ident()); assert(pDataObject && "Id not known"); - pDataObject->pTabPage->Reset(m_pSet.get()); + pDataObject->xTabPage->Reset(m_pSet.get()); // Also reset relevant items of ExampleSet and OutSet to initial state if (!pDataObject->fnGetRanges) return; @@ -519,9 +504,9 @@ IMPL_LINK_NOARG(SfxTabDialogController, BaseFmtHdl, weld::Button&, void) pTmpRanges += 2; } // Set all Items as new -> the call the current Page Reset() - assert(pDataObject->pTabPage && "the Page is gone"); - pDataObject->pTabPage->Reset( &aTmpSet ); - pDataObject->pTabPage->pImpl->mbStandard = true; + assert(pDataObject->xTabPage && "the Page is gone"); + pDataObject->xTabPage->Reset( &aTmpSet ); + pDataObject->xTabPage->pImpl->mbStandard = true; } IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OString&, rPage, void) @@ -542,7 +527,7 @@ IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OString&, rPage, void) return; } - VclPtr<SfxTabPage> pTabPage = pDataObject->pTabPage; + SfxTabPage* pTabPage = pDataObject->xTabPage.get(); if (!pTabPage) return; @@ -579,7 +564,7 @@ IMPL_LINK(SfxTabDialogController, DeactivatePageHdl, const OString&, rPage, bool return false; } - VclPtr<SfxTabPage> pPage = pDataObject->pTabPage; + SfxTabPage* pPage = pDataObject->xTabPage.get(); if (!pPage) return true; @@ -625,7 +610,7 @@ IMPL_LINK(SfxTabDialogController, DeactivatePageHdl, const OString&, rPage, bool for (auto const& elem : m_pImpl->aData) { - elem->bRefresh = ( elem->pTabPage.get() != pPage ); // Do not refresh own Page anymore + elem->bRefresh = ( elem->xTabPage.get() != pPage ); // Do not refresh own Page anymore } } return static_cast<bool>(nRet & DeactivateRC::LeavePage); @@ -636,7 +621,7 @@ bool SfxTabDialogController::PrepareLeaveCurrentPage() const OString sId = m_xTabCtrl->get_current_page_ident(); Data_Impl* pDataObject = Find(m_pImpl->aData, sId); DBG_ASSERT( pDataObject, "Id not known" ); - VclPtr<SfxTabPage> pPage = pDataObject ? pDataObject->pTabPage : nullptr; + SfxTabPage* pPage = pDataObject ? pDataObject->xTabPage.get() : nullptr; bool bEnd = !pPage; @@ -737,21 +722,21 @@ SfxTabDialogController::~SfxTabDialogController() for (auto & elem : m_pImpl->aData) { - if ( elem->pTabPage ) + if ( elem->xTabPage ) { // save settings of all pages (user data) - elem->pTabPage->FillUserData(); - OUString aPageData( elem->pTabPage->GetUserData() ); + elem->xTabPage->FillUserData(); + OUString aPageData( elem->xTabPage->GetUserData() ); if ( !aPageData.isEmpty() ) { // save settings of all pages (user data) - OUString sConfigId = OStringToOUString(elem->pTabPage->GetConfigId(), + OUString sConfigId = OStringToOUString(elem->xTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); aPageOpt.SetUserItem( USERITEM_NAME, makeAny( aPageData ) ); } - elem->pTabPage.disposeAndClear(); + elem->xTabPage.reset(); } delete elem; elem = nullptr; @@ -790,7 +775,7 @@ short SfxTabDialogController::Ok() for (auto const& elem : m_pImpl->aData) { - SfxTabPage* pTabPage = elem->pTabPage; + SfxTabPage* pTabPage = elem->xTabPage.get(); if ( pTabPage ) { @@ -912,28 +897,28 @@ void SfxTabDialogController::CreatePages() { for (auto pDataObject : m_pImpl->aData) { - if (pDataObject->pTabPage) + if (pDataObject->xTabPage) continue; weld::Container* pPage = m_xTabCtrl->get_page(pDataObject->sId); // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent TabPageParent aParent(pPage, this); if (m_pSet) - pDataObject->pTabPage = (pDataObject->fnCreatePage)(aParent, m_pSet.get()); + pDataObject->xTabPage = (pDataObject->fnCreatePage)(aParent, m_pSet.get()); else - pDataObject->pTabPage = (pDataObject->fnCreatePage)(aParent, CreateInputItemSet(pDataObject->sId)); - pDataObject->pTabPage->SetDialogController(this); - OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); + pDataObject->xTabPage = (pDataObject->fnCreatePage)(aParent, CreateInputItemSet(pDataObject->sId)); + pDataObject->xTabPage->SetDialogController(this); + OUString sConfigId = OStringToOUString(pDataObject->xTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); OUString sUserData; Any aUserItem = aPageOpt.GetUserItem(USERITEM_NAME); OUString aTemp; if ( aUserItem >>= aTemp ) sUserData = aTemp; - pDataObject->pTabPage->SetUserData(sUserData); + pDataObject->xTabPage->SetUserData(sUserData); - PageCreated(pDataObject->sId, *pDataObject->pTabPage); - pDataObject->pTabPage->Reset(m_pSet.get()); + PageCreated(pDataObject->sId, *pDataObject->xTabPage); + pDataObject->xTabPage->Reset(m_pSet.get()); } } @@ -946,11 +931,11 @@ void SfxTabDialogController::setPreviewsToSamePlace() std::vector<std::unique_ptr<weld::Widget>> aGrids; for (auto pDataObject : m_pImpl->aData) { - if (!pDataObject->pTabPage) + if (!pDataObject->xTabPage) continue; - if (!pDataObject->pTabPage->m_xBuilder) + if (!pDataObject->xTabPage->m_xBuilder) continue; - std::unique_ptr<weld::Widget> pGrid = pDataObject->pTabPage->m_xBuilder->weld_widget("maingrid"); + std::unique_ptr<weld::Widget> pGrid = pDataObject->xTabPage->m_xBuilder->weld_widget("maingrid"); if (!pGrid) continue; aGrids.emplace_back(std::move(pGrid)); @@ -980,20 +965,20 @@ void SfxTabDialogController::RemoveTabPage(const OString& rId) if ( pDataObject ) { - if ( pDataObject->pTabPage ) + if ( pDataObject->xTabPage ) { - pDataObject->pTabPage->FillUserData(); - OUString aPageData( pDataObject->pTabPage->GetUserData() ); + pDataObject->xTabPage->FillUserData(); + OUString aPageData( pDataObject->xTabPage->GetUserData() ); if ( !aPageData.isEmpty() ) { // save settings of this page (user data) - OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), + OUString sConfigId = OStringToOUString(pDataObject->xTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); aPageOpt.SetUserItem( USERITEM_NAME, makeAny( aPageData ) ); } - pDataObject->pTabPage.disposeAndClear(); + pDataObject->xTabPage.reset(); } delete pDataObject; @@ -1111,7 +1096,7 @@ SfxTabPage* SfxTabDialogController::GetTabPage(const OString& rPageId) const { Data_Impl* pDataObject = Find(m_pImpl->aData, rPageId); if (pDataObject) - return pDataObject->pTabPage; + return pDataObject->xTabPage.get(); return nullptr; } @@ -1132,9 +1117,9 @@ bool SfxTabDialogController::Apply() GetInputSetImpl()->Put(*GetOutputItemSet()); for (auto pDataObject : m_pImpl->aData) { - if (!pDataObject->pTabPage) + if (!pDataObject->xTabPage) continue; - pDataObject->pTabPage->ChangesApplied(); + pDataObject->xTabPage->ChangesApplied(); } } return bApplied; diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx index 32ca1b5160fe..c9de2b74f285 100644 --- a/sfx2/source/inc/documentfontsdialog.hxx +++ b/sfx2/source/inc/documentfontsdialog.hxx @@ -29,7 +29,7 @@ class SfxDocumentFontsPage: public SfxTabPage public: SfxDocumentFontsPage(TabPageParent parent, const SfxItemSet& set); virtual ~SfxDocumentFontsPage() override; - static VclPtr<SfxTabPage> Create(TabPageParent parent, const SfxItemSet* set); + static std::unique_ptr<SfxTabPage> Create(TabPageParent parent, const SfxItemSet* set); protected: virtual bool FillItemSet( SfxItemSet* set ) override; virtual void Reset( const SfxItemSet* set ) override; diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx index f7b23937ce27..802e6f07a799 100644 --- a/sfx2/source/view/printer.cxx +++ b/sfx2/source/view/printer.cxx @@ -171,34 +171,31 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(weld::Window *pParent, , pOptions(pSet->Clone()) , m_xHelpBtn(m_xBuilder->weld_widget("help")) , m_xContainer(m_xDialog->weld_content_area()) + , m_xPage(pViewShell->CreatePrintOptionsPage(TabPageParent(m_xContainer.get(), this), *pOptions)) // Insert TabPage { - // Insert TabPage - pPage.reset(pViewShell->CreatePrintOptionsPage(TabPageParent(m_xContainer.get(), this), *pOptions)); - DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" ); - if( pPage ) + DBG_ASSERT( m_xPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" ); + if (m_xPage) { - pPage->Reset( pOptions.get() ); - m_xDialog->set_help_id(pPage->GetHelpId()); + m_xPage->Reset( pOptions.get() ); + m_xDialog->set_help_id(m_xPage->GetHelpId()); } } - SfxPrintOptionsDialog::~SfxPrintOptionsDialog() { - pPage.disposeAndClear(); } short SfxPrintOptionsDialog::run() { - if (!pPage) + if (!m_xPage) return RET_CANCEL; short nRet = GenericDialogController::run(); if (nRet == RET_OK) - pPage->FillItemSet( pOptions.get() ); + m_xPage->FillItemSet( pOptions.get() ); else - pPage->Reset( pOptions.get() ); + m_xPage->Reset( pOptions.get() ); return nRet; } diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 9be92b23ba15..46a6842b466f 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -900,13 +900,9 @@ sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChan return 0; } -VclPtr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage -( - TabPageParent /*pParent*/, - const SfxItemSet& /*rOptions*/ -) +std::unique_ptr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage(TabPageParent /*pParent*/, const SfxItemSet& /*rOptions*/) { - return VclPtr<SfxTabPage>(); + return nullptr; } bool SfxViewShell::HasPrintOptionsPage() const |