/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include "swdlgfact.hxx" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace css::frame; using namespace css::uno; namespace { // This base disallows synchronous execution template class AbstractDialogImpl_NoSync : public vcl::AbstractDialogImpl_Async { public: using vcl::AbstractDialogImpl_Async::AbstractDialogImpl_Async; short Execute() override { assert(false); return -1; } }; class AbstractSwBreakDlg_Impl : public AbstractSwBreakDlg { std::shared_ptr m_xDlg; public: explicit AbstractSwBreakDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } OUString GetTemplateName() override; sal_uInt16 GetKind() override; std::optional GetPageNumber() override; std::optional GetClear() override; std::shared_ptr getDialogController() override { return m_xDlg; } }; class AbstractSwTranslateLangSelectDlg_Impl : public AbstractSwTranslateLangSelectDlg { std::shared_ptr m_xDlg; public: explicit AbstractSwTranslateLangSelectDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } std::shared_ptr getDialogController() override { return m_xDlg; } std::optional GetSelectedLanguage() override; }; class AbstractInsTableDlg_Impl : public AbstractInsTableDlg { std::shared_ptr m_xDlg; public: explicit AbstractInsTableDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } void GetValues(OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName, std::unique_ptr& prTAFormat) override; std::shared_ptr getDialogController() override { return m_xDlg; } }; } OUString AbstractSwBreakDlg_Impl::GetTemplateName() { SwBreakDlg* pDlg = dynamic_cast(m_xDlg.get()); if (pDlg) return pDlg->GetTemplateName(); return u""_ustr; } sal_uInt16 AbstractSwBreakDlg_Impl:: GetKind() { SwBreakDlg* pDlg = dynamic_cast(m_xDlg.get()); if (pDlg) return pDlg->GetKind(); return 0; } ::std::optional AbstractSwBreakDlg_Impl:: GetPageNumber() { SwBreakDlg* pDlg = dynamic_cast(m_xDlg.get()); if (pDlg) return pDlg->GetPageNumber(); return 0; } std::optional AbstractSwBreakDlg_Impl::GetClear() { SwBreakDlg* pDlg = dynamic_cast(m_xDlg.get()); if (pDlg) return pDlg->GetClear(); return SwLineBreakClear::NONE; } void AbstractInsTableDlg_Impl::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName, std::unique_ptr& prTAFormat ) { SwInsTableDlg* pDlg = dynamic_cast(m_xDlg.get()); if (pDlg) pDlg->GetValues(rName, rRow, rCol, rInsTableFlags, rTableAutoFormatName, prTAFormat); } std::optional AbstractSwTranslateLangSelectDlg_Impl::GetSelectedLanguage() { #if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA return SwTranslateLangSelectDlg::GetSelectedLanguage(); #else return {}; #endif } namespace { class AbstractSwInsertAbstractDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; sal_uInt8 GetLevel() const override { return m_pDlg->GetLevel(); } sal_uInt8 GetPara() const override { return m_pDlg->GetPara(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(weld::Window* pParent) { return VclPtr::Create(pParent); } namespace { template class SwAbstractSfxController_Impl : public vcl::AbstractDialogImpl_Async { public: using vcl::AbstractDialogImpl_Async::AbstractDialogImpl_Async; const SfxItemSet* GetOutputItemSet() const override { return this->m_pDlg->GetOutputItemSet(); } void SetText(const OUString& rStr) override { this->m_pDlg->set_title(rStr); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwAddressAbstractDlg(weld::Window* pParent, const SfxItemSet& rSet) { return VclPtr>::Create(pParent, rSet); } VclPtr SwAbstractDialogFactory_Impl::CreateSwDropCapsDialog(weld::Window* pParent, const SfxItemSet& rSet) { return VclPtr>::Create(pParent, rSet); } VclPtr SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) { return VclPtr>::Create(pParent, rSet); } namespace { class AbstractNumFormatDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); } void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, const SfxItemSet& rSet) { return VclPtr::Create(pParent, rSet); } namespace { class AbstractSwAsciiFilterDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void FillOptions(SwAsciiOptions& rOptions) override { m_pDlg->FillOptions(rOptions); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, SvStream* pStream) { return VclPtr::Create(pParent, rDocSh, pStream); } namespace { template using AbstractGenericDialog_Impl = vcl::AbstractDialogImpl_Async; } VclPtr SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh, OUString const*const pSelected) { return VclPtr>::Create(pParent, rSh, pSelected); } VclPtr SwAbstractDialogFactory_Impl::CreateSwContentControlDlg(weld::Window* pParent, SwWrtShell &rSh) { return VclPtr>::Create(pParent, rSh); } VclPtr SwAbstractDialogFactory_Impl::CreateSwContentControlListItemDlg(weld::Window* pParent, SwContentControlListItem& rItem) { using AbstractSwContentControlListItemDlg_Impl = vcl::AbstractDialogImpl_Async; return VclPtr::Create(pParent, rItem); } std::shared_ptr SwAbstractDialogFactory_Impl::CreateSwBreakDlg(weld::Window* pParent, SwWrtShell &rSh) { return std::make_shared(std::make_unique(pParent, rSh)); } std::shared_ptr SwAbstractDialogFactory_Impl::CreateSwTranslateLangSelectDlg(weld::Window* pParent, SwWrtShell &rSh) { #if HAVE_FEATURE_CURL && !ENABLE_WASM_STRIP_EXTRA return std::make_shared(std::make_unique(pParent, rSh)); #else (void) pParent; (void) rSh; return nullptr; #endif } namespace { class AbstractChangeDbDialog_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; virtual void UpdateFields() override { m_pDlg->UpdateFields(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg(SwView& rVw) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS return VclPtr::Create(rVw); #else (void) rVw; return nullptr; #endif } namespace { template class AbstractTabController_Impl_BASE : public vcl::AbstractDialogImpl_Async { public: using vcl::AbstractDialogImpl_Async::AbstractDialogImpl_Async; void SetCurPageId(const OUString& rName) override { this->m_pDlg->SetCurPageId(rName); } const SfxItemSet* GetOutputItemSet() const override { return this->m_pDlg->GetOutputItemSet(); } WhichRangesContainer GetInputRanges(const SfxItemPool& pItem) override { return this->m_pDlg->GetInputRanges(pItem); } void SetInputSet(const SfxItemSet* pInSet) override { this->m_pDlg->SetInputSet(pInSet); } // From class Window. void SetText(const OUString& rStr) override { this->m_pDlg->set_title(rStr); } }; template using AbstractTabController_Impl = AbstractTabController_Impl_BASE; } VclPtr SwAbstractDialogFactory_Impl::CreateSwCharDlg(weld::Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, SwCharDlgMode nDialogMode, const OUString* pFormatStr) { return VclPtr>::Create(pParent, pVw, rCoreSet, nDialogMode, pFormatStr); } namespace { class AbstractSwConvertTableDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void GetValues(sal_Unicode& rDelim, SwInsertTableOptions& rInsTableFlags, SwTableAutoFormat const*& prTAFormat) override { m_pDlg->GetValues(rDelim, rInsTableFlags, prTAFormat); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg(SwView& rView, bool bToTable) { return VclPtr::Create(rView, bToTable); } VclPtr SwAbstractDialogFactory_Impl::CreateSwCaptionDialog(weld::Window *pParent, SwView &rV) { return VclPtr>::Create(pParent, rV); } #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS namespace { class AbstractSwInsertDBColAutoPilot_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void DataToDoc(const css::uno::Sequence& rSelection, css::uno::Reference rxSource, css::uno::Reference xConnection, css::uno::Reference xResultSet) override { m_pDlg->DataToDoc(rSelection, rxSource, xConnection, xResultSet); } }; } #endif VclPtr SwAbstractDialogFactory_Impl::CreateSwInsertDBColAutoPilot( SwView& rView, uno::Reference< sdbc::XDataSource> rxSource, uno::Reference xColSupp, const SwDBData& rData) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS return VclPtr::Create(rView, rxSource, xColSupp, rData); #else (void) rView; (void) rxSource; (void) xColSupp; (void) rData; return nullptr; #endif } VclPtr SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr>::Create(pParent, rSh); } namespace { class AbstractDropDownFieldDialog_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; bool PrevButtonPressed() const override { return m_pDlg->PrevButtonPressed(); } bool NextButtonPressed() const override { return m_pDlg->NextButtonPressed(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) { return VclPtr::Create(pParent, rSh, pField, bPrevButton, bNextButton); } namespace { class AbstractDropDownFormFieldDialog_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateDropDownFormFieldDialog(weld::Widget *pParent, sw::mark::Fieldmark* pDropDownField) { return VclPtr::Create(pParent, pDropDownField); } namespace { class AbstractDateFormFieldDialog_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(weld::Widget *pParent, sw::mark::DateFieldmark* pDateField, SwDoc& rDoc) { return VclPtr::Create(pParent, pDateField, rDoc); } VclPtr SwAbstractDialogFactory_Impl::CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) { return VclPtr>::Create(pParent, rSet, pWrtSh,pPrt, bInsert); } namespace { class AbstractSwLabDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void SetCurPageId(const OUString& rName) override { m_pDlg->SetCurPageId(rName); } const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); } WhichRangesContainer GetInputRanges(const SfxItemPool& pItem) override { return m_pDlg->GetInputRanges(pItem); } void SetInputSet(const SfxItemSet* pInSet) override { m_pDlg->SetInputSet(pInSet); } // From class Window. void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } const OUString& GetBusinessCardStr() const override { return m_pDlg->GetBusinessCardStr(); } Printer* GetPrt() override { return m_pDlg->GetPrt(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet, SwDBManager* pDBManager, bool bLabel) { return VclPtr::Create(pParent, rSet, pDBManager, bLabel); } SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod () { return SwLabDlg::UpdateFieldInformation; } VclPtr SwAbstractDialogFactory_Impl::CreateSwParaDlg(weld::Window *pParent, SwView& rVw, const SfxItemSet& rCoreSet, bool bDraw , const OUString& sDefPage) { return VclPtr>::Create(pParent, rVw, rCoreSet, DLG_STD, nullptr, bDraw, sDefPage); } VclPtr SwAbstractDialogFactory_Impl::CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr>::Create(pParent, rSh); } VclPtr SwAbstractDialogFactory_Impl::CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr>::Create(pParent, rSh); } namespace { class AbstractSwTableHeightDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr::Create(pParent, rSh); } namespace { class AbstractSwSortDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr::Create(pParent, rSh); } namespace { class AbstractSplitTableDialog_Impl : public vcl::AbstractDialogImpl_Async // add for { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; SplitTable_HeadlineOption GetSplitMode() override { return m_pDlg->GetSplitMode(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr::Create(pParent, rSh); } namespace { class AbstractSwSelGlossaryDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void InsertGlos(const OUString& rRegion, const OUString& rGlosName) override { m_pDlg->InsertGlos(rRegion, rGlosName); } sal_Int32 GetSelectedIdx() const override { return m_pDlg->GetSelectedIdx(); } void SelectEntryPos(sal_Int32 nIdx) override { m_pDlg->SelectEntryPos(nIdx); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) { return VclPtr::Create(pParent, rShortName); } namespace { class AbstractSwAutoFormatDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; std::unique_ptr FillAutoFormatOfIndex() const override { return m_pDlg->FillAutoFormatOfIndex(); } void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, bool bSetAutoFormat, const SwTableAutoFormat* pSelFormat) { return VclPtr::Create(pParent, pShell, bSetAutoFormat, pSelFormat); } VclPtr SwAbstractDialogFactory_Impl::CreateSwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType ) { return VclPtr>::Create(pParent, rSet, nType); } VclPtr SwAbstractDialogFactory_Impl::CreateSwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pSh) { return VclPtr>::Create(pParent, rSet, pSh, true/*bDrawMode*/); } namespace { class AbstractSwTableWidthDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(weld::Window *pParent, SwWrtShell *pShell) { return VclPtr::Create(pParent, pShell); } VclPtr SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(weld::Window* pParent, const SfxItemSet* pItemSet, SwWrtShell* pSh) { return VclPtr>::Create(pParent, pItemSet, pSh); } namespace { class AbstractSwFieldDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; bool StartExecuteAsync(AsyncContext& rCtx) override; void SetCurPageId(const OUString& rName) override { m_pDlg->SetCurPageId(rName); } const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); } WhichRangesContainer GetInputRanges(const SfxItemPool& pItem) override { return m_pDlg->GetInputRanges(pItem); } void SetInputSet(const SfxItemSet* pInSet) override { m_pDlg->SetInputSet(pInSet); } // From class Window. void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } void ShowReferencePage() override { m_pDlg->ShowReferencePage(); } void Initialize(SfxChildWinInfo* pInfo) override { m_pDlg->Initialize(pInfo); } void ReInitDlg() override { m_pDlg->ReInitDlg(); } void ActivateDatabasePage() override { m_pDlg->ActivateDatabasePage(); } std::shared_ptr GetController() override { return m_pDlg; } }; bool AbstractSwFieldDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) { return SfxTabDialogController::runAsync(m_pDlg, [rCtx, pDlg = m_pDlg](sal_Int32 nResult) { pDlg->Close(); if (rCtx.isSet()) rCtx.maEndDialogFn(nResult); }); } } VclPtr SwAbstractDialogFactory_Impl::CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent) { return VclPtr::Create(pB, pCW, pParent); } VclPtr SwAbstractDialogFactory_Impl::CreateSwFieldEditDlg(SwView& rVw) { auto xDlg = std::make_shared(rVw); // without TabPage no dialog if (!xDlg->GetTabPage()) return nullptr; return VclPtr>::Create(std::move(xDlg)); } namespace { class AbstractSwRenameXNamedDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void SetForbiddenChars(const OUString& rSet) override { m_pDlg->SetForbiddenChars(rSet); } void SetAlternativeAccess(css::uno::Reference& xSecond, css::uno::Reference& xThird) override { m_pDlg->SetAlternativeAccess(xSecond, xThird); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg(weld::Widget* pParent, css::uno::Reference< css::container::XNamed > & xNamed, css::uno::Reference< css::container::XNameAccess > & xNameAccess) { return VclPtr::Create(pParent,xNamed, xNameAccess); } VclPtr SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg(weld::Window *pParent) { using AbstractSwModalRedlineAcceptDlg_Impl = AbstractDialogImpl_NoSync; return VclPtr::Create(pParent); } namespace { class AbstractCopyFieldDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; }; } VclPtr SwAbstractDialogFactory_Impl::CreateCopyFieldDlg(weld::Widget* pParent, const rtl::OUString& rFieldValue) { return VclPtr::Create(pParent, rFieldValue); } namespace { /// Interface implementation for the insert -> fields -> page number wizard dialog class AbstractSwPageNumberDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; int GetPageNumberPosition() const override { return m_pDlg->GetPageNumberPosition(); }; int GetPageNumberAlignment() const override { return m_pDlg->GetPageNumberAlignment(); } bool GetMirrorOnEvenPages() const override { return m_pDlg->GetMirrorOnEvenPages(); } bool GetIncludePageTotal() const override { return m_pDlg->GetIncludePageTotal(); } bool GetIncludePageRangeTotal() const override { return m_pDlg->GetIncludePageRangeTotal(); } bool GetFitIntoExistingMargins() const override { return m_pDlg->GetFitIntoExistingMargins(); } SvxNumType GetPageNumberType() const override { return m_pDlg->GetPageNumberType(); } void SetPageNumberType(SvxNumType nSet) override { m_pDlg->SetPageNumberType(nSet); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwPageNumberDlg(weld::Window *pParent) { return VclPtr::Create(pParent); } VclPtr SwAbstractDialogFactory_Impl::CreateTableMergeDialog(weld::Window* pParent, bool& rWithPrev) { using AbstractSwMergeTableDlg_Impl = vcl::AbstractDialogImpl_Sync; return VclPtr::Create(pParent, rWithPrev); } VclPtr SwAbstractDialogFactory_Impl::CreateFrameTabDialog(const OUString &rDialogType, SfxViewFrame& rFrame, weld::Window *pParent, const SfxItemSet& rCoreSet, bool bNewFrame, const OUString& sDefPage ) { return VclPtr>::Create(rFrame, pParent, rCoreSet, bNewFrame, rDialogType, false/*bFormat*/, sDefPage, nullptr); } namespace { class AbstractApplyTabController_Impl : public AbstractTabController_Impl_BASE { public: using AbstractTabController_Impl_BASE::AbstractTabController_Impl_BASE; DECL_LINK(ApplyHdl, weld::Button&, void); private: Link m_aHandler; void SetApplyHdl(const Link& rLink) override; }; IMPL_LINK_NOARG(AbstractApplyTabController_Impl, ApplyHdl, weld::Button&, void) { if (m_pDlg->Apply()) { m_aHandler.Call(nullptr); m_pDlg->Applied(); } } void AbstractApplyTabController_Impl::SetApplyHdl(const Link& rLink) { m_aHandler = rLink; m_pDlg->SetApplyHandler(LINK(this, AbstractApplyTabController_Impl, ApplyHdl)); } } VclPtr SwAbstractDialogFactory_Impl::CreateTemplateDialog( weld::Window *pParent, SfxStyleSheetBase& rBase, SfxStyleFamily nRegion, const OUString& sPage, SwWrtShell* pActShell, bool bNew ) { return VclPtr::Create(pParent, rBase, nRegion, sPage, pActShell, bNew); } namespace { class AbstractGlossaryDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } OUString GetCurrGrpName() const override { return m_pDlg->GetCurrGrpName(); } OUString GetCurrShortName() const override { return m_pDlg->GetCurrShortName(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxViewFrame& rViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) { return VclPtr::Create(rViewFrame, pGlosHdl, pWrtShell); } namespace { class AbstractFieldInputDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void EndDialog(sal_Int32 n) override { m_pDlg->response(n); } bool PrevButtonPressed() const override { return m_pDlg->PrevButtonPressed(); } bool NextButtonPressed() const override { return m_pDlg->NextButtonPressed(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) { return VclPtr::Create(pParent, rSh, pField, bPrevButton, bNextButton); } namespace { class AbstractInsFootNoteDlg_Impl : public AbstractDialogImpl_NoSync { public: using AbstractDialogImpl_NoSync::AbstractDialogImpl_NoSync; void Apply() override { m_pDlg->Apply(); } OUString GetFontName() override { return m_pDlg->GetFontName(); } bool IsEndNote() override { return m_pDlg->IsEndNote(); } OUString GetStr() override { return m_pDlg->GetStr(); } // from class Window void SetHelpId(const OUString& sHelpId) override { m_pDlg->set_help_id(sHelpId); } void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( weld::Window * pParent, SwWrtShell &rSh, bool bEd ) { return VclPtr::Create(pParent, rSh, bEd); } VclPtr SwAbstractDialogFactory_Impl::CreateTitlePageDlg(weld::Window *pParent) { return VclPtr>::Create(pParent); } VclPtr SwAbstractDialogFactory_Impl::CreateVclSwViewDialog(SwView& rView) { return VclPtr>::Create(rView); } std::shared_ptr SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView) { return std::make_shared(std::make_shared(rView)); } namespace { class AbstractJavaEditDialog_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; OUString GetScriptText() const override { return m_pDlg->GetScriptText(); } OUString GetScriptType() const override { return m_pDlg->GetScriptType(); } bool IsUrl() const override { return m_pDlg->IsUrl(); } bool IsNew() const override { return m_pDlg->IsNew(); } bool IsUpdate() const override { return m_pDlg->IsUpdate(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateJavaEditDialog( weld::Window* pParent, SwWrtShell* pWrtSh) { return VclPtr::Create(pParent, pWrtSh); } namespace { class AbstractMailMergeDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; DBManagerOptions GetMergeType() override { return m_pDlg->GetMergeType(); } const OUString& GetSaveFilter() const override { return m_pDlg->GetSaveFilter(); } css::uno::Sequence GetSelection() const override { return m_pDlg->GetSelection(); } css::uno::Reference GetResultSet() const override { return m_pDlg->GetResultSet(); } bool IsSaveSingleDoc() const override { return m_pDlg->IsSaveSingleDoc(); } bool IsGenerateFromDataBase() const override { return m_pDlg->IsGenerateFromDataBase(); } bool IsFileEncryptedFromDataBase() const override { return m_pDlg->IsFileEncryptedFromDataBase(); } OUString GetColumnName() const override { return m_pDlg->GetColumnName(); } OUString GetPasswordColumnName() const override { return m_pDlg->GetPasswordColumnName(); } OUString GetTargetURL() const override { return m_pDlg->GetTargetURL(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateMailMergeDlg( weld::Window* pParent, SwWrtShell& rSh, const OUString& rSourceName, const OUString& rTableName, sal_Int32 nCommandType, const uno::Reference< sdbc::XConnection>& xConnection ) { return VclPtr::Create(pParent, rSh, rSourceName, rTableName, nCommandType, xConnection, nullptr); } namespace { class AbstractMailMergeCreateFromDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; bool IsThisDocument() const override { return m_pDlg->IsThisDocument(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(weld::Window* pParent) { return VclPtr::Create(pParent); } namespace { class AbstractMailMergeFieldConnectionsDlg_Impl : public vcl::AbstractDialogImpl_Sync { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; bool IsUseExistingConnections() const override { return m_pDlg->IsUseExistingConnections(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg(weld::Window* pParent) { return VclPtr::Create(pParent); } VclPtr SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg(weld::Window* pParent, SwTOXMgr &rTOXMgr) { using AbstractMultiTOXMarkDlg_Impl = vcl::AbstractDialogImpl_Sync; return VclPtr::Create(pParent, rTOXMgr); } namespace { class AbstractNumBulletDialog_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void SetCurPageId(const OUString& rName) override { m_pDlg->SetCurPageId(rName); } const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); } const SfxItemSet* GetInputItemSet() const override { return m_pDlg->GetInputItemSet(); } WhichRangesContainer GetInputRanges(const SfxItemPool& pItem) override { return m_pDlg->GetInputRanges(pItem); } void SetInputSet(const SfxItemSet* pInSet) override { m_pDlg->SetInputSet(pInSet); } // From class Window. void SetText(const OUString& rStr) override { m_pDlg->set_title(rStr); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSvxNumBulletTabDialog(weld::Window* pParent, const SfxItemSet& rSwItemSet, SwWrtShell & rWrtSh) { return VclPtr::Create(pParent, rSwItemSet, rWrtSh); } VclPtr SwAbstractDialogFactory_Impl::CreateOutlineTabDialog(weld::Window* pParent, const SfxItemSet* pSwItemSet, SwWrtShell & rWrtSh ) { return VclPtr>::Create(pParent, pSwItemSet, rWrtSh); } namespace { class AbstractMultiTOXTabDialog_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; CurTOXType GetCurrentTOXType() const override { return m_pDlg->GetCurrentTOXType(); } SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes) override { return m_pDlg->GetTOXDescription(eTOXTypes); } // from SfxTabDialog const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialog(weld::Widget* pParent, const SfxItemSet& rSet, SwWrtShell &rShell, SwTOXBase* pCurTOX, bool bGlobal) { return VclPtr::Create(pParent, rSet, rShell, pCurTOX, USHRT_MAX, bGlobal); } namespace { class AbstractEditRegionDlg_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void SelectSection(const OUString& rSectionName) override { m_pDlg->SelectSection(rSectionName); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateEditRegionDlg(weld::Window* pParent, SwWrtShell& rWrtSh) { return VclPtr::Create(pParent, rWrtSh); } namespace { class AbstractInsertSectionTabDialog_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void SetSectionData(SwSectionData const& rSect) override { m_pDlg->SetSectionData(rSect); } }; } VclPtr SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) { return VclPtr::Create(pParent, rSet, rSh); } namespace { class AbstractIndexMarkFloatDlg_Impl : public vcl::AbstractDialogImpl_Sync_Shared { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void ReInitDlg(SwWrtShell& rWrtShell) override { m_pDlg->ReInitDlg(rWrtShell); } std::shared_ptr GetController() override { return m_pDlg; } }; } VclPtr SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg( SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo ) { return VclPtr::Create(pBindings, pChild, pParent, pInfo, true/*bNew*/); } namespace { class AbstractAuthMarkFloatDlg_Impl : public vcl::AbstractDialogImpl_Sync_Shared { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void ReInitDlg(SwWrtShell& rWrtShell) override { m_pDlg->ReInitDlg(rWrtShell); } std::shared_ptr GetController() override { return m_pDlg; } }; } VclPtr SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg( SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) { return VclPtr::Create(pBindings, pChild, pParent, pInfo, true/*bNew*/); } namespace { class AbstractSwWordCountFloatDlg_Impl : public vcl::AbstractDialogImpl_Sync_Shared { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; void UpdateCounts() override { m_pDlg->UpdateCounts(); } void SetCounts(const SwDocStat& rCurrCnt, const SwDocStat& rDocStat) override { m_pDlg->SetCounts(rCurrCnt, rDocStat); } std::shared_ptr GetController() override { return m_pDlg; } }; } VclPtr SwAbstractDialogFactory_Impl::CreateSwWordCountDialog( SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) { return VclPtr::Create(pBindings, pChild, pParent, pInfo); } VclPtr SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg(weld::Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) { return VclPtr>::Create(pParent, rSh, pCurTOXMark); } namespace { class AbstractMailMergeWizard_Impl : public vcl::AbstractDialogImpl_Async { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; bool StartExecuteAsync(VclAbstractDialog::AsyncContext& rCtx) override; OUString GetReloadDocument() const override { return m_pDlg->GetReloadDocument(); } void ShowPage(sal_uInt16 nLevel) override { m_pDlg->skipUntil(nLevel); } sal_uInt16 GetRestartPage() const override { return m_pDlg->GetRestartPage(); } }; bool AbstractMailMergeWizard_Impl::StartExecuteAsync(AsyncContext& rCtx) { // SwMailMergeWizardExecutor wants to run the lifecycle of this dialog // so clear mxOwner here and leave it up to SwMailMergeWizardExecutor rCtx.mxOwner.clear(); return AbstractDialogImpl_BASE::StartExecuteAsync(rCtx); } } VclPtr SwAbstractDialogFactory_Impl::CreateMailMergeWizard( SwView& rView, std::shared_ptr& rConfigItem) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS return VclPtr::Create(rView, rConfigItem); #else (void) rView; (void) rConfigItem; return nullptr; #endif } GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc() { return SwGlossaryDlg::GetCurrGroup; } GlossarySetActGroup SwAbstractDialogFactory_Impl::SetGlossaryActGroupFunc() { return SwGlossaryDlg::SetActGroup; } // Factories for TabPages CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nId ) { CreateTabPage pRet = nullptr; switch ( nId ) { case RID_SW_TP_OPTCOMPATIBILITY_PAGE : pRet = SwCompatibilityOptPage::Create; break; case RID_SW_TP_OPTLOAD_PAGE : pRet = SwLoadOptPage::Create; break; case RID_SW_TP_OPTCAPTION_PAGE: return SwCaptionOptPage::Create; case RID_SW_TP_CONTENT_OPT: case RID_SW_TP_HTML_CONTENT_OPT: pRet = SwContentOptPage::Create; break; case RID_SW_TP_OPTSHDWCRSR: case RID_SW_TP_HTML_OPTSHDWCRSR: pRet = SwShdwCursorOptionsTabPage::Create; break; case RID_SW_TP_REDLINE_OPT : pRet = SwRedlineOptionsTabPage::Create; break; case RID_SW_TP_OPTTEST_PAGE : #ifdef DBG_UTIL pRet = SwTestTabPage::Create; #endif break; case TP_OPTPRINT_PAGE : case RID_SW_TP_HTML_OPTPRINT_PAGE: case RID_SW_TP_OPTPRINT_PAGE: pRet = SwAddPrinterTabPage::Create; break; case RID_SW_TP_STD_FONT: case RID_SW_TP_STD_FONT_CJK: case RID_SW_TP_STD_FONT_CTL: pRet = SwStdFontTabPage::Create; break; case RID_SW_TP_HTML_OPTTABLE_PAGE: case RID_SW_TP_OPTTABLE_PAGE: pRet = SwTableOptionsTabPage::Create; break; case RID_SW_TP_DOC_STAT : pRet = SwDocStatPage::Create; break; case RID_SW_TP_MAILCONFIG: pRet = SwMailConfigPage::Create; break; case RID_SW_TP_COMPARISON_OPT : pRet = SwCompareOptionsTabPage::Create; break; } return pRet; } void SwAbstractDialogFactory_Impl::ExecuteMMResultSaveDialog(weld::Window* pParent) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS SwMMResultSaveDialog aDialog(pParent); aDialog.run(); #else (void) pParent; #endif } void SwAbstractDialogFactory_Impl::ExecuteMMResultPrintDialog(weld::Window* pParent) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS SwMMResultPrintDialog aDialog(pParent); aDialog.run(); #else (void) pParent; #endif } void SwAbstractDialogFactory_Impl::ExecuteMMResultEmailDialog(weld::Window* pParent) { #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS SwMMResultEmailDialog aDialog(pParent); aDialog.run(); #else (void) pParent; #endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */