From 141f3fd15633803afa720837405a0bacbc2726cb Mon Sep 17 00:00:00 2001
From: Mike Kaganski <mike.kaganski@collabora.com>
Date: Thu, 19 Dec 2024 19:22:10 +0500
Subject: Simplify abstract dialog impls using vcl::AbstractDialogImpl* in sc

Change-Id: Iff9ac377a5cfa259c5911632ad16d2b1e3269868
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178986
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
---
 sc/source/ui/attrdlg/scdlgfact.cxx | 1621 +++++++++++++-----------------------
 sc/source/ui/attrdlg/scdlgfact.hxx |  635 --------------
 sc/source/ui/attrdlg/scuiexp.cxx   |    5 +
 3 files changed, 593 insertions(+), 1668 deletions(-)

diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index c088322f01a2..2dc64da32d5f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -29,6 +29,7 @@
 #include <delcldlg.hxx>
 #include <delcodlg.hxx>
 #include <filldlg.hxx>
+#include <gototabdlg.hxx>
 #include <groupdlg.hxx>
 #include <inscldlg.hxx>
 #include <inscodlg.hxx>
@@ -70,1119 +71,422 @@
 #include <sfx2/sfxdlg.hxx>
 #include <conditio.hxx>
 
+#include <vcl/abstdlgimpl.hxx>
 #include <vcl/virdev.hxx>
 
-short AbstractScImportAsciiDlg_Impl::Execute()
+namespace
 {
-    return m_xDlg->run();
-}
-
-bool AbstractScImportAsciiDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScAutoFormatDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScColRowLabelDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScColRowLabelDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
-    return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScCondFormatManagerDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScCondFormatManagerDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDataPilotDatabaseDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDataPilotDatabaseDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDataPilotSourceTypeDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDataPilotSourceTypeDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDataPilotServiceDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDataPilotServiceDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDeleteCellDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDeleteCellDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
-{
-    return ScDeleteCellDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-//for dataform
-short AbstractScDataFormDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-BitmapEx AbstractScDataFormDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScDataFormDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-short AbstractScDeleteContentsDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScFillSeriesDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScGroupDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScInsertCellDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScInsertCellDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
-{
-    return ScInsertCellDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScInsertContentsDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScInsertTableDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScInsertTableDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScSelEntryDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScMetricInputDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScMetricInputDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
-{
-    return ScMetricInputDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScMoveTableDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScMoveTableDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext& rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-BitmapEx AbstractScMoveTableDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScMoveTableDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-short AbstractScNameCreateDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScNamePasteDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScPivotFilterDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScDPFunctionDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDPFunctionDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDPSubtotalDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScDPSubtotalDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScDPNumGroupDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScDPDateGroupDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScDPShowDetailDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScNewScenarioDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScShowTabDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScShowTabDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScGoToTabDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScGoToTabDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScSortWarningDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScTabBgColorDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-bool AbstractScTabBgColorDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-short AbstractScImportOptionsDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-short AbstractScTextImportOptionsDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-AbstractScLinkedAreaDlg_Impl::~AbstractScLinkedAreaDlg_Impl()
-{
-}
-
-short AbstractScLinkedAreaDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
-void AbstractScImportAsciiDlg_Impl::GetOptions( ScAsciiOptions& rOpt )
-{
-    m_xDlg->GetOptions( rOpt );
-}
-
-void AbstractScImportAsciiDlg_Impl::SaveParameters()
-{
-    m_xDlg->SaveParameters();
-}
-
-BitmapEx AbstractScImportAsciiDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScImportAsciiDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-sal_uInt16 AbstractScAutoFormatDlg_Impl::GetIndex() const
-{
-    return m_xDlg->GetIndex();
-}
-
-OUString AbstractScAutoFormatDlg_Impl::GetCurrFormatName()
-{
-    return m_xDlg->GetCurrFormatName();
-}
-
-bool AbstractScColRowLabelDlg_Impl::IsCol()
-{
-    return m_xDlg->IsCol();
-}
-
-bool AbstractScColRowLabelDlg_Impl::IsRow()
-{
-    return m_xDlg->IsRow();
-}
-
-BitmapEx AbstractScColRowLabelDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScColRowLabelDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-void AbstractScDataPilotDatabaseDlg_Impl::GetValues( ScImportSourceDesc& rDesc )
-{
-    m_xDlg->GetValues(rDesc);
-}
-
-BitmapEx AbstractScDataPilotDatabaseDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScDataPilotDatabaseDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-bool AbstractScDataPilotSourceTypeDlg_Impl::IsDatabase() const
-{
-    return m_xDlg->IsDatabase();
-}
-
-bool AbstractScDataPilotSourceTypeDlg_Impl::IsExternal() const
-{
-    return m_xDlg->IsExternal();
-}
-
-bool AbstractScDataPilotSourceTypeDlg_Impl::IsNamedRange() const
-{
-    return m_xDlg->IsNamedRange();
-}
-
-OUString AbstractScDataPilotSourceTypeDlg_Impl::GetSelectedNamedRange() const
-{
-    return m_xDlg->GetSelectedNamedRange();
-}
-
-void AbstractScDataPilotSourceTypeDlg_Impl::AppendNamedRange(const OUString& rName)
-{
-    m_xDlg->AppendNamedRange(rName);
-}
-
-BitmapEx AbstractScDataPilotSourceTypeDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScDataPilotSourceTypeDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-OUString AbstractScDataPilotServiceDlg_Impl::GetServiceName() const
-{
-    return m_xDlg->GetServiceName();
-}
-
-OUString AbstractScDataPilotServiceDlg_Impl::GetParSource() const
-{
-    return m_xDlg->GetParSource();
-}
-
-OUString AbstractScDataPilotServiceDlg_Impl::GetParName() const
-{
-    return m_xDlg->GetParName();
-}
-
-OUString AbstractScDataPilotServiceDlg_Impl::GetParUser() const
+template <class Base, class Dialog, template <class...> class ImplTemplate>
+class ScreenshottedDialog_Impl_BASE : public ImplTemplate<Base, Dialog>
 {
-    return m_xDlg->GetParUser();
-}
-
-OUString AbstractScDataPilotServiceDlg_Impl::GetParPass() const
-{
-    return m_xDlg->GetParPass();
-}
-
-DelCellCmd AbstractScDeleteCellDlg_Impl::GetDelCellCmd() const
-{
-    return m_xDlg->GetDelCellCmd();
-}
-
-BitmapEx AbstractScDeleteCellDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScDeleteCellDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-void AbstractScDeleteContentsDlg_Impl::DisableObjects()
-{
-    m_xDlg->DisableObjects();
-}
-
-InsertDeleteFlags AbstractScDeleteContentsDlg_Impl::GetDelContentsCmdBits() const
-{
-    return m_xDlg->GetDelContentsCmdBits();
-}
+public:
+    using ImplTemplate<Base, Dialog>::ImplTemplate;
 
-BitmapEx AbstractScDeleteContentsDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScDeleteContentsDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-FillDir AbstractScFillSeriesDlg_Impl::GetFillDir() const
-{
-    return m_xDlg->GetFillDir();
-}
-
-FillCmd AbstractScFillSeriesDlg_Impl::GetFillCmd() const
-{
-    return m_xDlg->GetFillCmd();
-}
-
-FillDateCmd AbstractScFillSeriesDlg_Impl::GetFillDateCmd() const
-{
-    return m_xDlg->GetFillDateCmd();
-}
-
-double  AbstractScFillSeriesDlg_Impl::GetStart() const
-{
-    return m_xDlg->GetStart();
-}
-
-double  AbstractScFillSeriesDlg_Impl::GetStep() const
-{
-    return m_xDlg->GetStep();
-}
-
-double  AbstractScFillSeriesDlg_Impl::GetMax() const
-{
-    return m_xDlg->GetMax();
-}
-
-OUString  AbstractScFillSeriesDlg_Impl::GetStartStr() const
-{
-    return m_xDlg->GetStartStr();
-}
-
-void    AbstractScFillSeriesDlg_Impl::SetEdStartValEnabled(bool bFlag)
-{
-    m_xDlg->SetEdStartValEnabled(bFlag);
-}
-
-bool AbstractScGroupDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
-}
-
-bool AbstractScGroupDlg_Impl::GetColsChecked() const
-{
-    return m_xDlg->GetColsChecked();
-}
-
-InsCellCmd  AbstractScInsertCellDlg_Impl::GetInsCellCmd() const
-{
-    return m_xDlg->GetInsCellCmd();
-}
-
-size_t AbstractScInsertCellDlg_Impl::GetCount() const
-{
-    return m_xDlg->GetCount();
-}
-
-InsertDeleteFlags AbstractScInsertContentsDlg_Impl::GetInsContentsCmdBits() const
-{
-    return m_xDlg->GetInsContentsCmdBits();
-}
-
-ScPasteFunc  AbstractScInsertContentsDlg_Impl::GetFormulaCmdBits() const
-{
-    return m_xDlg->GetFormulaCmdBits();
-}
-
-bool    AbstractScInsertContentsDlg_Impl::IsSkipEmptyCells() const
-{
-    return m_xDlg->IsSkipEmptyCells();
-}
-
-bool    AbstractScInsertContentsDlg_Impl::IsLink() const
-{
-    return m_xDlg->IsLink();
-}
-
-void    AbstractScInsertContentsDlg_Impl::SetFillMode( bool bSet )
-{
-    m_xDlg->SetFillMode( bSet );
-}
-
-void    AbstractScInsertContentsDlg_Impl::SetOtherDoc( bool bSet )
-{
-    m_xDlg->SetOtherDoc( bSet );
-}
-
-bool    AbstractScInsertContentsDlg_Impl::IsTranspose() const
-{
-    return m_xDlg->IsTranspose();
-}
-
-void    AbstractScInsertContentsDlg_Impl::SetChangeTrack( bool bSet )
-{
-    m_xDlg->SetChangeTrack( bSet );
-}
-
-void    AbstractScInsertContentsDlg_Impl::SetCellShiftDisabled( CellShiftDisabledFlags nDisable )
-{
-    m_xDlg->SetCellShiftDisabled( nDisable );
-}
-
-InsCellCmd  AbstractScInsertContentsDlg_Impl::GetMoveMode()
-{
-    return m_xDlg->GetMoveMode();
-}
-
-BitmapEx AbstractScInsertContentsDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScInsertContentsDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-bool AbstractScInsertTableDlg_Impl::GetTablesFromFile()
-{
-    return m_xDlg->GetTablesFromFile();
-}
-
-bool AbstractScInsertTableDlg_Impl::GetTablesAsLink()
-{
-    return m_xDlg->GetTablesAsLink();
-}
-
-const OUString*  AbstractScInsertTableDlg_Impl::GetFirstTable( sal_uInt16* pN )
-{
-    return m_xDlg->GetFirstTable( pN );
-}
-
-ScDocShell* AbstractScInsertTableDlg_Impl::GetDocShellTables()
-{
-    return m_xDlg->GetDocShellTables();
-}
-
-bool AbstractScInsertTableDlg_Impl::IsTableBefore()
-{
-    return m_xDlg->IsTableBefore();
-}
-
-sal_uInt16 AbstractScInsertTableDlg_Impl::GetTableCount()
-{
-    return m_xDlg->GetTableCount();
-}
-
-const OUString* AbstractScInsertTableDlg_Impl::GetNextTable( sal_uInt16* pN )
-{
-    return m_xDlg->GetNextTable( pN );
-}
-
-BitmapEx AbstractScInsertTableDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScInsertTableDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-OUString AbstractScSelEntryDlg_Impl::GetSelectedEntry() const
-{
-    return m_xDlg->GetSelectedEntry();
-}
-
-void AbstractScLinkedAreaDlg_Impl::InitFromOldLink( const OUString& rFile, const OUString& rFilter,
-                                        const OUString& rOptions, const OUString& rSource,
-                                        sal_Int32 nRefreshDelaySeconds )
-{
-    m_xDlg->InitFromOldLink( rFile, rFilter, rOptions, rSource, nRefreshDelaySeconds);
-}
-
-OUString  AbstractScLinkedAreaDlg_Impl::GetURL()
-{
-    return m_xDlg->GetURL();
-}
-
-OUString  AbstractScLinkedAreaDlg_Impl::GetFilter()
-{
-    return m_xDlg->GetFilter();
-}
-
-OUString  AbstractScLinkedAreaDlg_Impl::GetOptions()
-{
-    return m_xDlg->GetOptions();
-}
-
-OUString  AbstractScLinkedAreaDlg_Impl::GetSource()
-{
-    return m_xDlg->GetSource();
-}
-
-sal_Int32 AbstractScLinkedAreaDlg_Impl::GetRefreshDelaySeconds()
-{
-    return m_xDlg->GetRefreshDelaySeconds();
-}
-
-std::unique_ptr<ScConditionalFormatList> AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList()
-{
-    return m_xDlg->GetConditionalFormatList();
-}
-
-bool AbstractScCondFormatManagerDlg_Impl::CondFormatsChanged() const
-{
-    return m_xDlg->CondFormatsChanged();
-}
-
-void AbstractScCondFormatManagerDlg_Impl::SetModified()
-{
-    return m_xDlg->SetModified();
-}
-
-ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected()
-{
-    return m_xDlg->GetCondFormatSelected();
-}
-
-int AbstractScMetricInputDlg_Impl::GetInputValue() const
-{
-    return m_xDlg->GetInputValue();
-}
-
-sal_uInt16 AbstractScMoveTableDlg_Impl::GetSelectedDocument() const
-{
-    return m_xDlg->GetSelectedDocument();
-}
-
-sal_uInt16  AbstractScMoveTableDlg_Impl::GetSelectedTable() const
-{
-    return m_xDlg->GetSelectedTable();
-}
-
-bool AbstractScMoveTableDlg_Impl::GetCopyTable() const
-{
-    return m_xDlg->GetCopyTable();
-}
-
-bool AbstractScMoveTableDlg_Impl::GetRenameTable() const
-{
-    return m_xDlg->GetRenameTable();
-}
-
-void AbstractScMoveTableDlg_Impl::GetTabNameString( OUString& rString ) const
-{
-    m_xDlg->GetTabNameString( rString );
-}
-
-void    AbstractScMoveTableDlg_Impl::SetForceCopyTable()
-{
-    return m_xDlg->SetForceCopyTable();
-}
-
-void    AbstractScMoveTableDlg_Impl::EnableRenameTable(bool bFlag)
-{
-    return m_xDlg->EnableRenameTable( bFlag);
-}
-
-CreateNameFlags AbstractScNameCreateDlg_Impl::GetFlags() const
-{
-    return m_xDlg->GetFlags();
-}
-
-BitmapEx AbstractScNameCreateDlg_Impl::createScreenshot() const
-{
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
-}
-
-OUString AbstractScNameCreateDlg_Impl::GetScreenshotId() const
-{
-    return m_xDlg->get_help_id();
-}
-
-std::vector<OUString> AbstractScNamePasteDlg_Impl::GetSelectedNames() const
-{
-    return m_xDlg->GetSelectedNames();
-}
-
-const ScQueryItem& AbstractScPivotFilterDlg_Impl::GetOutputItem()
-{
-    return m_xDlg->GetOutputItem();
-}
-
-PivotFunc AbstractScDPFunctionDlg_Impl::GetFuncMask() const
-{
-     return m_xDlg->GetFuncMask();
-}
-
-void AbstractScDPFunctionDlg_Impl::Response(int nResponse)
-{
-    m_xDlg->response(nResponse);
-}
-
-css::sheet::DataPilotFieldReference AbstractScDPFunctionDlg_Impl::GetFieldRef() const
-{
-    return m_xDlg->GetFieldRef();
-}
-
-PivotFunc AbstractScDPSubtotalDlg_Impl::GetFuncMask() const
-{
-     return m_xDlg->GetFuncMask();
-}
-
-void AbstractScDPSubtotalDlg_Impl::FillLabelData( ScDPLabelData& rLabelData ) const
-{
-    m_xDlg->FillLabelData( rLabelData );
-}
-
-void AbstractScDPSubtotalDlg_Impl::Response(int nResponse)
-{
-    m_xDlg->response(nResponse);
-}
-
-ScDPNumGroupInfo AbstractScDPNumGroupDlg_Impl::GetGroupInfo() const
-{
-    return m_xDlg->GetGroupInfo();
-}
-
-ScDPNumGroupInfo AbstractScDPDateGroupDlg_Impl::GetGroupInfo() const
-{
-    return m_xDlg->GetGroupInfo();
-}
-
-sal_Int32 AbstractScDPDateGroupDlg_Impl::GetDatePart() const
-{
-    return m_xDlg->GetDatePart();
-}
-
-OUString AbstractScDPShowDetailDlg_Impl::GetDimensionName() const
-{
-     return m_xDlg->GetDimensionName();
-}
-
-void AbstractScNewScenarioDlg_Impl::SetScenarioData(
-    const OUString& rName, const OUString& rComment, const Color& rColor, ScScenarioFlags nFlags )
-{
-    m_xDlg->SetScenarioData(rName, rComment, rColor, nFlags);
-}
-
-void AbstractScNewScenarioDlg_Impl::GetScenarioData(
-    OUString& rName, OUString& rComment, Color& rColor, ScScenarioFlags& rFlags ) const
-{
-    m_xDlg->GetScenarioData(rName, rComment, rColor, rFlags);
-}
+    // screenshotting
+    BitmapEx createScreenshot() const override
+    {
+        VclPtr<VirtualDevice> xDialogSurface(this->m_pDlg->getDialog()->screenshot());
+        return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
+    }
+    OUString GetScreenshotId() const override { return this->m_pDlg->get_help_id(); }
+};
 
-void AbstractScShowTabDlg_Impl::Insert( const OUString& rString, bool bSelected )
-{
-    m_xDlg->Insert(rString, bSelected);
-}
+template <class Base, class Dialog>
+using ScreenshottedDialog_Impl_Sync
+    = ScreenshottedDialog_Impl_BASE<Base, Dialog, vcl::AbstractDialogImpl_Sync>;
 
-void    AbstractScShowTabDlg_Impl::SetDescription(
-                const OUString& rTitle, const OUString& rFixedText,
-                const OUString& sDlgHelpId, const OUString& sLbHelpId )
-{
-    m_xDlg->SetDescription( rTitle, rFixedText, sDlgHelpId, sLbHelpId );
+template <class Base, class Dialog>
+using ScreenshottedDialog_Impl_Async
+    = ScreenshottedDialog_Impl_BASE<Base, Dialog, vcl::AbstractDialogImpl_Async>;
 }
 
-std::vector<sal_Int32> AbstractScShowTabDlg_Impl::GetSelectedRows() const
-{
-    return m_xDlg->GetSelectedRows();
-}
+// =========================Factories  for createdialog ===================
 
-OUString AbstractScShowTabDlg_Impl::GetEntry(sal_Int32 nPos) const
+namespace
 {
-    return m_xDlg->GetEntry(nPos);
-}
-
-void AbstractScGoToTabDlg_Impl::Insert( const OUString& rString, bool bSelected )
+class AbstractScImportAsciiDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScImportAsciiDlg, ScImportAsciiDlg>
 {
-    m_xDlg->Insert(rString, bSelected);
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    void GetOptions(ScAsciiOptions& rOpt) override { m_pDlg->GetOptions(rOpt); }
+    void SaveParameters() override { m_pDlg->SaveParameters(); }
+};
 }
 
-void    AbstractScGoToTabDlg_Impl::SetDescription(
-                const OUString& rTitle, const OUString& rEntryLabel, const OUString& rListLabel,
-                const OUString& rDlgHelpId, const OUString& rEnHelpId, const OUString& rLbHelpId )
+VclPtr<AbstractScImportAsciiDlg> ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg(weld::Window* pParent,
+                                                    const OUString& aDatName,
+                                                    SvStream* pInStream, ScImportAsciiCall eCall)
 {
-    m_xDlg->SetDescription( rTitle, rEntryLabel, rListLabel, rDlgHelpId, rEnHelpId, rLbHelpId );
+    return VclPtr<AbstractScImportAsciiDlg_Impl>::Create(pParent, aDatName, pInStream, eCall);
 }
 
-OUString AbstractScGoToTabDlg_Impl::GetSelectedEntry() const
+namespace
 {
-    return m_xDlg->GetSelectedEntry();
-}
-
-short AbstractScStringInputDlg_Impl::Execute()
+class AbstractScTextImportOptionsDlg_Impl
+    : public ScreenshottedDialog_Impl_Sync<AbstractScTextImportOptionsDlg, ScTextImportOptionsDlg>
 {
-    return m_xDlg->run();
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    LanguageType GetLanguageType() const override { return m_pDlg->getLanguageType(); }
+    bool IsDateConversionSet() const override { return m_pDlg->isDateConversionSet(); }
+    bool IsScientificConversionSet() const override { return m_pDlg->isScientificConversionSet(); }
+    bool IsKeepAskingSet() const override { return m_pDlg->isKeepAskingSet(); }
+};
 }
 
-bool AbstractScStringInputDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+VclPtr<AbstractScTextImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(weld::Window* pParent)
 {
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+    return VclPtr<AbstractScTextImportOptionsDlg_Impl>::Create(pParent);
 }
 
-OUString AbstractScStringInputDlg_Impl::GetInputString() const
+namespace
 {
-    return m_xDlg->GetInputString();
-}
-
-BitmapEx AbstractScStringInputDlg_Impl::createScreenshot() const
+class AbstractScAutoFormatDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScAutoFormatDlg, ScAutoFormatDlg>
 {
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    sal_uInt16 GetIndex() const override { return m_pDlg->GetIndex(); }
+    OUString GetCurrFormatName() override { return m_pDlg->GetCurrFormatName(); }
+};
 }
 
-OUString AbstractScStringInputDlg_Impl::GetScreenshotId() const
+VclPtr<AbstractScAutoFormatDlg> ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg(weld::Window* pParent,
+                                                                ScAutoFormat* pAutoFormat,
+                                                                const ScAutoFormatData* pSelFormatData,
+                                                                ScViewData& rViewData)
 {
-    return m_xDlg->get_help_id();
+    return VclPtr<AbstractScAutoFormatDlg_Impl>::Create(pParent, pAutoFormat, pSelFormatData, rViewData);
 }
 
-void AbstractScTabBgColorDlg_Impl::GetSelectedColor( Color& rColor ) const
+namespace
 {
-    m_xDlg->GetSelectedColor( rColor );
-}
-
-BitmapEx AbstractScTabBgColorDlg_Impl::createScreenshot() const
+class AbstractScColRowLabelDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScColRowLabelDlg, ScColRowLabelDlg>
 {
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    bool IsCol() override { return m_pDlg->IsCol(); }
+    bool IsRow() override { return m_pDlg->IsRow(); }
+};
 }
 
-OUString AbstractScTabBgColorDlg_Impl::GetScreenshotId() const
+VclPtr<AbstractScColRowLabelDlg>  ScAbstractDialogFactory_Impl::CreateScColRowLabelDlg(weld::Window* pParent,
+                                                                bool bCol, bool bRow)
 {
-    return m_xDlg->get_help_id();
+    return VclPtr<AbstractScColRowLabelDlg_Impl>::Create(pParent, bCol, bRow);
 }
 
-void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOptions ) const
+VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText)
 {
-    m_xDlg->GetImportOptions(rOptions);
+    using AbstractScSortWarningDlg_Impl
+        = vcl::AbstractDialogImpl_Sync<AbstractScSortWarningDlg, ScSortWarningDlg>;
+    return VclPtr<AbstractScSortWarningDlg_Impl>::Create(pParent, rExtendText, rCurrentText);
 }
 
-void AbstractScImportOptionsDlg_Impl::SaveImportOptions() const
+namespace
 {
-    m_xDlg->SaveImportOptions();
-}
-
-LanguageType AbstractScTextImportOptionsDlg_Impl::GetLanguageType() const
+class AbstractScCondFormatManagerDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScCondFormatManagerDlg, ScCondFormatManagerDlg>
 {
-    return m_xDlg->getLanguageType();
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() override
+    {
+        return m_pDlg->GetConditionalFormatList();
+    }
+    bool CondFormatsChanged() const override { return m_pDlg->CondFormatsChanged(); }
+    void SetModified() override { return m_pDlg->SetModified(); }
+    ScConditionalFormat* GetCondFormatSelected() override
+    {
+        return m_pDlg->GetCondFormatSelected();
+    }
+};
 }
 
-bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const
+VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList )
 {
-    return m_xDlg->isDateConversionSet();
+    return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(pParent, rDoc, pFormatList);
 }
 
-bool AbstractScTextImportOptionsDlg_Impl::IsScientificConversionSet() const
+namespace
 {
-    return m_xDlg->isScientificConversionSet();
-}
-
-bool AbstractScTextImportOptionsDlg_Impl::IsKeepAskingSet() const
+class AbstractScDataPilotDatabaseDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScDataPilotDatabaseDlg, ScDataPilotDatabaseDlg>
 {
-    return m_xDlg->isKeepAskingSet();
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    void GetValues(ScImportSourceDesc& rDesc) override { m_pDlg->GetValues(rDesc); }
+};
 }
 
-BitmapEx AbstractScTextImportOptionsDlg_Impl::createScreenshot() const
+VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent)
 {
-    VclPtr<VirtualDevice> xDialogSurface(m_xDlg->getDialog()->screenshot());
-    return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel());
+    return VclPtr<AbstractScDataPilotDatabaseDlg_Impl>::Create(pParent);
 }
 
-OUString AbstractScTextImportOptionsDlg_Impl::GetScreenshotId() const
+namespace
 {
-    return m_xDlg->get_help_id();
-}
-
-short ScAbstractTabController_Impl::Execute()
+class AbstractScDataPilotSourceTypeDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScDataPilotSourceTypeDlg,
+                                            ScDataPilotSourceTypeDlg>
 {
-    return m_xDlg->run();
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    bool IsDatabase() const override { return m_pDlg->IsDatabase(); }
+    bool IsExternal() const override { return m_pDlg->IsExternal(); }
+    bool IsNamedRange() const override { return m_pDlg->IsNamedRange(); }
+    OUString GetSelectedNamedRange() const override { return m_pDlg->GetSelectedNamedRange(); }
+    void AppendNamedRange(const OUString& rName) override { m_pDlg->AppendNamedRange(rName); }
+};
 }
 
-bool ScAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx)
+VclPtr<AbstractScDataPilotSourceTypeDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotSourceTypeDlg(
+    weld::Window* pParent, bool bEnableExternal)
 {
-    return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+    return VclPtr<AbstractScDataPilotSourceTypeDlg_Impl>::Create(pParent, bEnableExternal);
 }
 
-void ScAbstractTabController_Impl::SetCurPageId( const OUString &rName )
+namespace
 {
-    m_xDlg->SetCurPageId( rName );
-}
-
-const SfxItemSet* ScAbstractTabController_Impl::GetOutputItemSet() const
+class AbstractScDataPilotServiceDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScDataPilotServiceDlg, ScDataPilotServiceDlg>
 {
-    return m_xDlg->GetOutputItemSet();
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    OUString GetServiceName() const override { return m_pDlg->GetServiceName(); }
+    OUString GetParSource() const override { return m_pDlg->GetParSource(); }
+    OUString GetParName() const override { return m_pDlg->GetParName(); }
+    OUString GetParUser() const override { return m_pDlg->GetParUser(); }
+    OUString GetParPass() const override { return m_pDlg->GetParPass(); }
+};
 }
 
-WhichRangesContainer ScAbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem )
+VclPtr<AbstractScDataPilotServiceDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotServiceDlg(weld::Window* pParent,
+                                                                        const std::vector<OUString>& rServices)
 {
-    return m_xDlg->GetInputRanges( pItem );
+    return VclPtr<AbstractScDataPilotServiceDlg_Impl>::Create(pParent, rServices);
 }
 
-void ScAbstractTabController_Impl::SetInputSet( const SfxItemSet* pInSet )
+namespace
 {
-     m_xDlg->SetInputSet( pInSet );
-}
-
-//From class Window.
-void ScAbstractTabController_Impl::SetText( const OUString& rStr )
+class AbstractScDeleteCellDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScDeleteCellDlg, ScDeleteCellDlg>
 {
-    m_xDlg->set_title(rStr);
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    DelCellCmd GetDelCellCmd() const override { return m_pDlg->GetDelCellCmd(); }
+};
 }
 
-std::vector<OUString> ScAbstractTabController_Impl::getAllPageUIXMLDescriptions() const
+VclPtr<AbstractScDeleteCellDlg> ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(weld::Window* pParent,
+    bool bDisallowCellMove)
 {
-    return m_xDlg->getAllPageUIXMLDescriptions();
+    return VclPtr<AbstractScDeleteCellDlg_Impl>::Create(pParent, bDisallowCellMove);
 }
 
-bool ScAbstractTabController_Impl::selectPageByUIXMLDescription(const OUString& rUIXMLDescription)
+VclPtr<AbstractScDataFormDlg> ScAbstractDialogFactory_Impl::CreateScDataFormDlg(weld::Window* pParent,
+    ScTabViewShell* pTabViewShell)
 {
-    return m_xDlg->selectPageByUIXMLDescription(rUIXMLDescription);
+    // for dataform
+    using AbstractScDataFormDlg_Impl
+        = ScreenshottedDialog_Impl_Sync<AbstractScDataFormDlg, ScDataFormDlg>;
+    return VclPtr<AbstractScDataFormDlg_Impl>::Create(pParent, pTabViewShell);
 }
 
-BitmapEx ScAbstractTabController_Impl::createScreenshot() const
+namespace
 {
-    return m_xDlg->createScreenshot();
-}
-
-OUString ScAbstractTabController_Impl::GetScreenshotId() const
+class AbstractScDeleteContentsDlg_Impl
+    : public ScreenshottedDialog_Impl_Sync<AbstractScDeleteContentsDlg, ScDeleteContentsDlg>
 {
-    return m_xDlg->GetScreenshotId();
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    void DisableObjects() override { m_pDlg->DisableObjects(); }
+    InsertDeleteFlags GetDelContentsCmdBits() const override
+    {
+        return m_pDlg->GetDelContentsCmdBits();
+    }
+};
 }
 
-bool ScAsyncTabController_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+VclPtr<AbstractScDeleteContentsDlg> ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(weld::Window* pParent)
 {
-    return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+    return VclPtr<AbstractScDeleteContentsDlg_Impl>::Create(pParent);
 }
 
-void ScAsyncTabController_Impl::SetCurPageId( const OUString &rName )
+namespace
 {
-    m_xDlg->SetCurPageId( rName );
-}
-
-const SfxItemSet* ScAsyncTabController_Impl::GetOutputItemSet() const
+class AbstractScFillSeriesDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScFillSeriesDlg, ScFillSeriesDlg>
 {
-    return m_xDlg->GetOutputItemSet();
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    FillDir GetFillDir() const override { return m_pDlg->GetFillDir(); }
+    FillCmd GetFillCmd() const override { return m_pDlg->GetFillCmd(); }
+    FillDateCmd GetFillDateCmd() const override { return m_pDlg->GetFillDateCmd(); }
+    double GetStart() const override { return m_pDlg->GetStart(); }
+    double GetStep() const override { return m_pDlg->GetStep(); }
+    double GetMax() const override { return m_pDlg->GetMax(); }
+    OUString GetStartStr() const override { return m_pDlg->GetStartStr(); }
+    void SetEdStartValEnabled(bool bFlag) override { m_pDlg->SetEdStartValEnabled(bFlag); }
+};
 }
 
-bool AbstractScSelEntryDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+VclPtr<AbstractScFillSeriesDlg> ScAbstractDialogFactory_Impl::CreateScFillSeriesDlg(weld::Window*       pParent,
+                                                            ScDocument&     rDocument,
+                                                            FillDir         eFillDir,
+                                                            FillCmd         eFillCmd,
+                                                            FillDateCmd     eFillDateCmd,
+                                                            const OUString& aStartStr,
+                                                            double          fStep,
+                                                            double          fMax,
+                                                            const SCSIZE    nSelectHeight,
+                                                            const SCSIZE    nSelectWidth,
+                                                            sal_uInt16      nPossDir)
 {
-    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+    return VclPtr<AbstractScFillSeriesDlg_Impl>::Create(pParent, rDocument,eFillDir, eFillCmd,eFillDateCmd, aStartStr,fStep,fMax,nSelectHeight,nSelectWidth,nPossDir);
 }
 
-// =========================Factories  for createdialog ===================
-VclPtr<AbstractScImportAsciiDlg> ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg(weld::Window* pParent,
-                                                    const OUString& aDatName,
-                                                    SvStream* pInStream, ScImportAsciiCall eCall)
+namespace
 {
-    return VclPtr<AbstractScImportAsciiDlg_Impl>::Create(std::make_shared<ScImportAsciiDlg>(pParent, aDatName,pInStream, eCall));
-}
-
-VclPtr<AbstractScTextImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(weld::Window* pParent)
+class AbstractScGroupDlg_Impl : public vcl::AbstractDialogImpl_Async<AbstractScGroupDlg, ScGroupDlg>
 {
-    return VclPtr<AbstractScTextImportOptionsDlg_Impl>::Create(std::make_unique<ScTextImportOptionsDlg>(pParent));
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    bool GetColsChecked() const override { return m_pDlg->GetColsChecked(); }
+};
 }
 
-VclPtr<AbstractScAutoFormatDlg> ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg(weld::Window* pParent,
-                                                                ScAutoFormat* pAutoFormat,
-                                                                const ScAutoFormatData* pSelFormatData,
-                                                                ScViewData& rViewData)
+VclPtr<AbstractScGroupDlg> ScAbstractDialogFactory_Impl::CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup)
 {
-    return VclPtr<AbstractScAutoFormatDlg_Impl>::Create(std::make_unique<ScAutoFormatDlg>(pParent, pAutoFormat, pSelFormatData, rViewData));
+    return VclPtr<AbstractScGroupDlg_Impl>::Create(pParent, bUnGroup, true);
 }
 
-VclPtr<AbstractScColRowLabelDlg>  ScAbstractDialogFactory_Impl::CreateScColRowLabelDlg(weld::Window* pParent,
-                                                                bool bCol, bool bRow)
+namespace
 {
-    return VclPtr<AbstractScColRowLabelDlg_Impl>::Create(std::make_unique<ScColRowLabelDlg>(pParent, bCol, bRow));
-}
-
-VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText)
+class AbstractScInsertCellDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScInsertCellDlg, ScInsertCellDlg>
 {
-    return VclPtr<AbstractScSortWarningDlg_Impl>::Create(std::make_unique<ScSortWarningDlg>(pParent, rExtendText, rCurrentText));
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    InsCellCmd GetInsCellCmd() const override { return m_pDlg->GetInsCellCmd(); }
+    size_t GetCount() const override { return m_pDlg->GetCount(); }
+};
 }
 
-VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList )
+VclPtr<AbstractScInsertCellDlg> ScAbstractDialogFactory_Impl::CreateScInsertCellDlg(weld::Window* pParent,
+                                                                bool bDisallowCellMove)
 {
-    return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(std::make_shared<ScCondFormatManagerDlg>(pParent, rDoc, pFormatList));
+    return VclPtr<AbstractScInsertCellDlg_Impl>::Create(pParent, bDisallowCellMove);
 }
 
-VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent)
+namespace
 {
-    return VclPtr<AbstractScDataPilotDatabaseDlg_Impl>::Create(std::make_shared<ScDataPilotDatabaseDlg>(pParent));
-}
-
-VclPtr<AbstractScDataPilotSourceTypeDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotSourceTypeDlg(
-    weld::Window* pParent, bool bEnableExternal)
+class AbstractScInsertContentsDlg_Impl
+    : public ScreenshottedDialog_Impl_Sync<AbstractScInsertContentsDlg, ScInsertContentsDlg>
 {
-    return VclPtr<AbstractScDataPilotSourceTypeDlg_Impl>::Create(std::make_shared<ScDataPilotSourceTypeDlg>(pParent, bEnableExternal));
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    InsertDeleteFlags GetInsContentsCmdBits() const override
+    {
+        return m_pDlg->GetInsContentsCmdBits();
+    }
+    ScPasteFunc GetFormulaCmdBits() const override { return m_pDlg->GetFormulaCmdBits(); }
+    bool IsSkipEmptyCells() const override { return m_pDlg->IsSkipEmptyCells(); }
+    bool IsLink() const override { return m_pDlg->IsLink(); }
+    void SetFillMode(bool bSet) override { m_pDlg->SetFillMode(bSet); }
+    void SetOtherDoc(bool bSet) override { m_pDlg->SetOtherDoc(bSet); }
+    bool IsTranspose() const override { return m_pDlg->IsTranspose(); }
+    void SetChangeTrack(bool bSet) override { m_pDlg->SetChangeTrack(bSet); }
+    void SetCellShiftDisabled(CellShiftDisabledFlags nDisable) override
+    {
+        m_pDlg->SetCellShiftDisabled(nDisable);
+    }
+    InsCellCmd GetMoveMode() override { return m_pDlg->GetMoveMode(); }
+};
 }
 
-VclPtr<AbstractScDataPilotServiceDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotServiceDlg(weld::Window* pParent,
-                                                                        const std::vector<OUString>& rServices)
+VclPtr<AbstractScInsertContentsDlg> ScAbstractDialogFactory_Impl::CreateScInsertContentsDlg(weld::Window* pParent,
+                                                                                            const OUString* pStrTitle)
 {
-    return VclPtr<AbstractScDataPilotServiceDlg_Impl>::Create(std::make_shared<ScDataPilotServiceDlg>(pParent, rServices));
+    return VclPtr<AbstractScInsertContentsDlg_Impl>::Create(pParent, pStrTitle);
 }
 
-VclPtr<AbstractScDeleteCellDlg> ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(weld::Window* pParent,
-    bool bDisallowCellMove)
+namespace
 {
-    return VclPtr<AbstractScDeleteCellDlg_Impl>::Create(std::make_unique<ScDeleteCellDlg>(pParent, bDisallowCellMove));
-}
-
-VclPtr<AbstractScDataFormDlg> ScAbstractDialogFactory_Impl::CreateScDataFormDlg(weld::Window* pParent,
-    ScTabViewShell* pTabViewShell)
+class AbstractScInsertTableDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScInsertTableDlg, ScInsertTableDlg>
 {
-    return VclPtr<AbstractScDataFormDlg_Impl>::Create(std::make_unique<ScDataFormDlg>(pParent, pTabViewShell));
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    bool GetTablesFromFile() override { return m_pDlg->GetTablesFromFile(); }
+    bool GetTablesAsLink() override { return m_pDlg->GetTablesAsLink(); }
+    const OUString* GetFirstTable(sal_uInt16* pN) override { return m_pDlg->GetFirstTable(pN); }
+    ScDocShell* GetDocShellTables() override { return m_pDlg->GetDocShellTables(); }
+    bool IsTableBefore() override { return m_pDlg->IsTableBefore(); }
+    sal_uInt16 GetTableCount() override { return m_pDlg->GetTableCount(); }
+    const OUString* GetNextTable(sal_uInt16* pN) override { return m_pDlg->GetNextTable(pN); }
+};
 }
 
-VclPtr<AbstractScDeleteContentsDlg> ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(weld::Window* pParent)
+VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
+    SCTAB nTabCount, bool bFromFile)
 {
-    return VclPtr<AbstractScDeleteContentsDlg_Impl>::Create(std::make_unique<ScDeleteContentsDlg>(pParent));
+    return VclPtr<AbstractScInsertTableDlg_Impl>::Create(pParent, rViewData,nTabCount, bFromFile);
 }
 
-VclPtr<AbstractScFillSeriesDlg> ScAbstractDialogFactory_Impl::CreateScFillSeriesDlg(weld::Window*       pParent,
-                                                            ScDocument&     rDocument,
-                                                            FillDir         eFillDir,
-                                                            FillCmd         eFillCmd,
-                                                            FillDateCmd     eFillDateCmd,
-                                                            const OUString& aStartStr,
-                                                            double          fStep,
-                                                            double          fMax,
-                                                            const SCSIZE    nSelectHeight,
-                                                            const SCSIZE    nSelectWidth,
-                                                            sal_uInt16      nPossDir)
+namespace
 {
-    return VclPtr<AbstractScFillSeriesDlg_Impl>::Create(std::make_unique<ScFillSeriesDlg>(pParent, rDocument,eFillDir, eFillCmd,eFillDateCmd, aStartStr,fStep,fMax,nSelectHeight,nSelectWidth,nPossDir));
-}
-
-VclPtr<AbstractScGroupDlg> ScAbstractDialogFactory_Impl::CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup)
+class AbstractScSelEntryDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScSelEntryDlg, ScSelEntryDlg>
 {
-    return VclPtr<AbstractScGroupDlg_Impl>::Create(std::make_shared<ScGroupDlg>(pParent, bUnGroup, true/*bRows*/));
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    OUString GetSelectedEntry() const override { return m_pDlg->GetSelectedEntry(); }
+};
 }
 
-VclPtr<AbstractScInsertCellDlg> ScAbstractDialogFactory_Impl::CreateScInsertCellDlg(weld::Window* pParent,
-                                                                bool bDisallowCellMove)
+VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg(weld::Window* pParent,
+                                                                                const std::vector<OUString> &rEntryList)
 {
-    return VclPtr<AbstractScInsertCellDlg_Impl>::Create(std::make_unique<ScInsertCellDlg>(pParent, bDisallowCellMove));
+    return VclPtr<AbstractScSelEntryDlg_Impl>::Create(pParent, rEntryList);
 }
 
-VclPtr<AbstractScInsertContentsDlg> ScAbstractDialogFactory_Impl::CreateScInsertContentsDlg(weld::Window* pParent,
-                                                                                            const OUString* pStrTitle)
+namespace
 {
-    return VclPtr<AbstractScInsertContentsDlg_Impl>::Create(std::make_unique<ScInsertContentsDlg>(pParent, pStrTitle));
-}
-
-VclPtr<AbstractScInsertTableDlg> ScAbstractDialogFactory_Impl::CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
-    SCTAB nTabCount, bool bFromFile)
+class AbstractScLinkedAreaDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScLinkedAreaDlg, ScLinkedAreaDlg>
 {
-    return VclPtr<AbstractScInsertTableDlg_Impl>::Create(std::make_unique<ScInsertTableDlg>(pParent, rViewData,nTabCount, bFromFile));
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    void InitFromOldLink(const OUString& rFile, const OUString& rFilter, const OUString& rOptions,
+                         const OUString& rSource, sal_Int32 nRefreshDelaySeconds) override
+    {
+        m_pDlg->InitFromOldLink(rFile, rFilter, rOptions, rSource, nRefreshDelaySeconds);
+    }
+    OUString GetURL() override { return m_pDlg->GetURL(); }
+    OUString GetFilter() override { return m_pDlg->GetFilter(); }
+    OUString GetOptions() override { return m_pDlg->GetOptions(); }
+    OUString GetSource() override { return m_pDlg->GetSource(); }
+    sal_Int32 GetRefreshDelaySeconds() override { return m_pDlg->GetRefreshDelaySeconds(); }
+};
 }
 
-VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg(weld::Window* pParent,
-                                                                                const std::vector<OUString> &rEntryList)
+VclPtr<AbstractScLinkedAreaDlg> ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(weld::Widget* pParent)
 {
-    return VclPtr<AbstractScSelEntryDlg_Impl>::Create(std::make_unique<ScSelEntryDlg>(pParent, rEntryList));
+    return VclPtr<AbstractScLinkedAreaDlg_Impl>::Create(pParent);
 }
 
-VclPtr<AbstractScLinkedAreaDlg> ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(weld::Widget* pParent)
+namespace
+{
+class AbstractScMetricInputDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScMetricInputDlg, ScMetricInputDlg>
 {
-    return VclPtr<AbstractScLinkedAreaDlg_Impl>::Create(std::make_unique<ScLinkedAreaDlg>(pParent));
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    int GetInputValue() const override { return m_pDlg->GetInputValue(); }
+};
 }
 
 VclPtr<AbstractScMetricInputDlg> ScAbstractDialogFactory_Impl::CreateScMetricInputDlg(weld::Window* pParent,
@@ -1194,30 +498,96 @@ VclPtr<AbstractScMetricInputDlg> ScAbstractDialogFactory_Impl::CreateScMetricInp
                                                                 tools::Long            nMaximum ,
                                                                 tools::Long            nMinimum )
 {
-    return VclPtr<AbstractScMetricInputDlg_Impl>::Create(std::make_shared<ScMetricInputDlg>(pParent, sDialogName, nCurrent ,nDefault, eFUnit,
-        nDecimals, nMaximum , nMinimum));
+    return VclPtr<AbstractScMetricInputDlg_Impl>::Create(pParent, sDialogName, nCurrent, nDefault,
+                                                      eFUnit, nDecimals, nMaximum, nMinimum);
+}
+
+namespace
+{
+class AbstractScMoveTableDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScMoveTableDlg, ScMoveTableDlg>
+{
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    sal_uInt16 GetSelectedDocument() const override { return m_pDlg->GetSelectedDocument(); }
+    sal_uInt16 GetSelectedTable() const override { return m_pDlg->GetSelectedTable(); }
+    bool GetCopyTable() const override { return m_pDlg->GetCopyTable(); }
+    bool GetRenameTable() const override { return m_pDlg->GetRenameTable(); }
+    void GetTabNameString(OUString& rString) const override { m_pDlg->GetTabNameString(rString); }
+    void SetForceCopyTable() override { return m_pDlg->SetForceCopyTable(); }
+    void EnableRenameTable(bool bFlag) override { return m_pDlg->EnableRenameTable(bFlag); }
+};
 }
 
 VclPtr<AbstractScMoveTableDlg> ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(weld::Window* pParent,
     const OUString& rDefault)
 {
-    return VclPtr<AbstractScMoveTableDlg_Impl>::Create(std::make_shared<ScMoveTableDlg>(pParent, rDefault));
+    return VclPtr<AbstractScMoveTableDlg_Impl>::Create(pParent, rDefault);
+}
+
+namespace
+{
+class AbstractScNameCreateDlg_Impl
+    : public ScreenshottedDialog_Impl_Sync<AbstractScNameCreateDlg, ScNameCreateDlg>
+{
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    CreateNameFlags GetFlags() const override { return m_pDlg->GetFlags(); }
+};
 }
 
 VclPtr<AbstractScNameCreateDlg> ScAbstractDialogFactory_Impl::CreateScNameCreateDlg(weld::Window * pParent, CreateNameFlags nFlags)
 {
-    return VclPtr<AbstractScNameCreateDlg_Impl>::Create(std::make_unique<ScNameCreateDlg>(pParent, nFlags));
+    return VclPtr<AbstractScNameCreateDlg_Impl>::Create(pParent, nFlags);
+}
+
+namespace
+{
+class AbstractScNamePasteDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScNamePasteDlg, ScNamePasteDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    std::vector<OUString> GetSelectedNames() const override { return m_pDlg->GetSelectedNames(); }
+};
 }
 
 VclPtr<AbstractScNamePasteDlg> ScAbstractDialogFactory_Impl::CreateScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell)
 {
-    return VclPtr<AbstractScNamePasteDlg_Impl>::Create(std::make_unique<ScNamePasteDlg>(pParent, pShell));
+    return VclPtr<AbstractScNamePasteDlg_Impl>::Create(pParent, pShell);
+}
+
+namespace
+{
+class AbstractScPivotFilterDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScPivotFilterDlg, ScPivotFilterDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    const ScQueryItem& GetOutputItem() override { return m_pDlg->GetOutputItem(); }
+};
 }
 
 VclPtr<AbstractScPivotFilterDlg> ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg(weld::Window* pParent,
     const SfxItemSet& rArgSet, sal_uInt16 nSourceTab)
 {
-    return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(std::make_unique<ScPivotFilterDlg>(pParent, rArgSet, nSourceTab));
+    return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(pParent, rArgSet, nSourceTab);
+}
+
+namespace
+{
+class AbstractScDPFunctionDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScDPFunctionDlg, ScDPFunctionDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    PivotFunc GetFuncMask() const override { return m_pDlg->GetFuncMask(); }
+    css::sheet::DataPilotFieldReference GetFieldRef() const override
+    {
+        return m_pDlg->GetFieldRef();
+    }
+    void Response(int nResponse) override { m_pDlg->response(nResponse); }
+};
 }
 
 VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Widget* pParent,
@@ -1225,7 +595,23 @@ VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunction
                                                                                     const ScDPLabelData& rLabelData,
                                                                                     const ScPivotFuncData& rFuncData)
 {
-    return VclPtr<AbstractScDPFunctionDlg_Impl>::Create(std::make_shared<ScDPFunctionDlg>(pParent, rLabelVec, rLabelData, rFuncData));
+    return VclPtr<AbstractScDPFunctionDlg_Impl>::Create(pParent, rLabelVec, rLabelData, rFuncData);
+}
+
+namespace
+{
+class AbstractScDPSubtotalDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScDPSubtotalDlg, ScDPSubtotalDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    PivotFunc GetFuncMask() const override { return m_pDlg->GetFuncMask(); }
+    void FillLabelData(ScDPLabelData& rLabelData) const override
+    {
+        m_pDlg->FillLabelData(rLabelData);
+    }
+    void Response(int nResponse) override { m_pDlg->response(nResponse); }
+};
 }
 
 VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg(weld::Widget* pParent,
@@ -1234,48 +620,168 @@ VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotal
                                                                                     const ScPivotFuncData& rFuncData,
                                                                                     const ScDPNameVec& rDataFields)
 {
-    return VclPtr<AbstractScDPSubtotalDlg_Impl>::Create(std::make_shared<ScDPSubtotalDlg>(pParent, rDPObj, rLabelData, rFuncData, rDataFields, true/*bEnableLayout*/));
+    return VclPtr<AbstractScDPSubtotalDlg_Impl>::Create(pParent, rDPObj, rLabelData, rFuncData, rDataFields, true/*bEnableLayout*/);
+}
+
+namespace
+{
+class AbstractScDPNumGroupDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScDPNumGroupDlg, ScDPNumGroupDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    ScDPNumGroupInfo GetGroupInfo() const override { return m_pDlg->GetGroupInfo(); }
+};
 }
 
 VclPtr<AbstractScDPNumGroupDlg> ScAbstractDialogFactory_Impl::CreateScDPNumGroupDlg(weld::Window* pParent, const ScDPNumGroupInfo& rInfo)
 {
-    return VclPtr<AbstractScDPNumGroupDlg_Impl>::Create(std::make_unique<ScDPNumGroupDlg>(pParent, rInfo));
+    return VclPtr<AbstractScDPNumGroupDlg_Impl>::Create(pParent, rInfo);
+}
+
+namespace
+{
+class AbstractScDPDateGroupDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScDPDateGroupDlg, ScDPDateGroupDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    ScDPNumGroupInfo GetGroupInfo() const override { return m_pDlg->GetGroupInfo(); }
+    sal_Int32 GetDatePart() const override { return m_pDlg->GetDatePart(); }
+};
 }
 
 VclPtr<AbstractScDPDateGroupDlg> ScAbstractDialogFactory_Impl::CreateScDPDateGroupDlg(
         weld::Window* pParent, const ScDPNumGroupInfo& rInfo, sal_Int32 nDatePart, const Date& rNullDate)
 {
-    return VclPtr<AbstractScDPDateGroupDlg_Impl>::Create(std::make_unique<ScDPDateGroupDlg>(pParent, rInfo, nDatePart, rNullDate));
+    return VclPtr<AbstractScDPDateGroupDlg_Impl>::Create(pParent, rInfo, nDatePart, rNullDate);
+}
+
+namespace
+{
+class AbstractScDPShowDetailDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScDPShowDetailDlg, ScDPShowDetailDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    OUString GetDimensionName() const override { return m_pDlg->GetDimensionName(); }
+};
 }
 
 VclPtr<AbstractScDPShowDetailDlg> ScAbstractDialogFactory_Impl::CreateScDPShowDetailDlg (
         weld::Window* pParent, ScDPObject& rDPObj, css::sheet::DataPilotFieldOrientation nOrient )
 {
-    return VclPtr<AbstractScDPShowDetailDlg_Impl>::Create(std::make_unique<ScDPShowDetailDlg>(pParent, rDPObj, nOrient));
+    return VclPtr<AbstractScDPShowDetailDlg_Impl>::Create(pParent, rDPObj, nOrient);
+}
+
+namespace
+{
+class AbstractScNewScenarioDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScNewScenarioDlg, ScNewScenarioDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+
+    void SetScenarioData(const OUString& rName, const OUString& rComment, const Color& rColor,
+                         ScScenarioFlags nFlags) override
+    {
+        m_pDlg->SetScenarioData(rName, rComment, rColor, nFlags);
+    }
+
+    void GetScenarioData(OUString& rName, OUString& rComment, Color& rColor,
+                         ScScenarioFlags& rFlags) const override
+    {
+        m_pDlg->GetScenarioData(rName, rComment, rColor, rFlags);
+    }
+};
 }
 
 VclPtr<AbstractScNewScenarioDlg> ScAbstractDialogFactory_Impl::CreateScNewScenarioDlg(weld::Window* pParent, const OUString& rName,
     bool bEdit, bool bSheetProtected)
 {
-    return VclPtr<AbstractScNewScenarioDlg_Impl>::Create(std::make_unique<ScNewScenarioDlg>(pParent, rName, bEdit, bSheetProtected));
+    return VclPtr<AbstractScNewScenarioDlg_Impl>::Create(pParent, rName, bEdit, bSheetProtected);
+}
+
+namespace
+{
+class AbstractScShowTabDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScShowTabDlg, ScShowTabDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    void Insert(const OUString& rString, bool bSelected) override
+    {
+        m_pDlg->Insert(rString, bSelected);
+    }
+    void SetDescription(const OUString& rTitle, const OUString& rFixedText,
+                        const OUString& sDlgHelpId, const OUString& sLbHelpId) override
+    {
+        m_pDlg->SetDescription(rTitle, rFixedText, sDlgHelpId, sLbHelpId);
+    }
+    OUString GetEntry(sal_Int32 nPos) const override { return m_pDlg->GetEntry(nPos); }
+    std::vector<sal_Int32> GetSelectedRows() const override { return m_pDlg->GetSelectedRows(); }
+};
 }
 
 VclPtr<AbstractScShowTabDlg> ScAbstractDialogFactory_Impl::CreateScShowTabDlg(weld::Window* pParent)
 {
-    return VclPtr<AbstractScShowTabDlg_Impl>::Create(std::make_shared<ScShowTabDlg>(pParent));
+    return VclPtr<AbstractScShowTabDlg_Impl>::Create(pParent);
+}
+
+namespace
+{
+class AbstractScGoToTabDlg_Impl
+    : public vcl::AbstractDialogImpl_Async<AbstractScGoToTabDlg, ScGoToTabDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    void Insert(const OUString& rString, bool bSelected) override
+    {
+        m_pDlg->Insert(rString, bSelected);
+    }
+    void SetDescription(const OUString& rTitle, const OUString& rEntryLabel,
+                        const OUString& rListLabel, const OUString& rDlgHelpId,
+                        const OUString& rEnHelpId, const OUString& rLbHelpId) override
+    {
+        m_pDlg->SetDescription(rTitle, rEntryLabel, rListLabel, rDlgHelpId, rEnHelpId, rLbHelpId);
+    }
+    OUString GetSelectedEntry() const override { return m_pDlg->GetSelectedEntry(); }
+};
 }
 
 VclPtr<AbstractScGoToTabDlg> ScAbstractDialogFactory_Impl::CreateScGoToTabDlg(weld::Window* pParent)
 {
-    return VclPtr<AbstractScGoToTabDlg_Impl>::Create(std::make_shared<ScGoToTabDlg>(pParent));
+    return VclPtr<AbstractScGoToTabDlg_Impl>::Create(pParent);
+}
+
+namespace
+{
+class AbstractScStringInputDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScStringInputDlg, ScStringInputDlg>
+{
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    OUString GetInputString() const override { return m_pDlg->GetInputString(); }
+};
 }
 
 VclPtr<AbstractScStringInputDlg> ScAbstractDialogFactory_Impl::CreateScStringInputDlg(weld::Window* pParent,
         const OUString& rTitle, const OUString& rEditTitle, const OUString& rDefault, const OUString& rHelpId,
         const OUString& rEditHelpId)
 {
-    return VclPtr<AbstractScStringInputDlg_Impl>::Create(std::make_unique<ScStringInputDlg>(pParent, rTitle, rEditTitle,
-                rDefault, rHelpId, rEditHelpId));
+    return VclPtr<AbstractScStringInputDlg_Impl>::Create(pParent, rTitle, rEditTitle, rDefault,
+                                                      rHelpId, rEditHelpId);
+}
+
+namespace
+{
+class AbstractScTabBgColorDlg_Impl
+    : public ScreenshottedDialog_Impl_Async<AbstractScTabBgColorDlg, ScTabBgColorDlg>
+{
+public:
+    using ScreenshottedDialog_Impl_BASE::ScreenshottedDialog_Impl_BASE;
+    void GetSelectedColor(Color& rColor) const override { m_pDlg->GetSelectedColor(rColor); }
+};
 }
 
 VclPtr<AbstractScTabBgColorDlg> ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg(
@@ -1284,7 +790,22 @@ VclPtr<AbstractScTabBgColorDlg> ScAbstractDialogFactory_Impl::CreateScTabBgColor
                                                             const OUString& rTabBgColorNoColorText,
                                                             const Color& rDefaultColor)
 {
-    return VclPtr<AbstractScTabBgColorDlg_Impl>::Create(std::make_unique<ScTabBgColorDlg>(pParent, rTitle, rTabBgColorNoColorText, rDefaultColor));
+    return VclPtr<AbstractScTabBgColorDlg_Impl>::Create(pParent, rTitle, rTabBgColorNoColorText, rDefaultColor);
+}
+
+namespace
+{
+class AbstractScImportOptionsDlg_Impl
+    : public vcl::AbstractDialogImpl_Sync<AbstractScImportOptionsDlg, ScImportOptionsDlg>
+{
+public:
+    using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+    void GetImportOptions(ScImportOptions& rOptions) const override
+    {
+        m_pDlg->GetImportOptions(rOptions);
+    }
+    void SaveImportOptions() const override { m_pDlg->SaveImportOptions(); }
+};
 }
 
 VclPtr<AbstractScImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScImportOptionsDlg(weld::Window* pParent,
@@ -1294,12 +815,44 @@ VclPtr<AbstractScImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScImportO
                                                                                           bool bOnlyDbtoolsEncodings,
                                                                                           bool bImport)
 {
-    return VclPtr<AbstractScImportOptionsDlg_Impl>::Create(std::make_unique<ScImportOptionsDlg>(pParent, bAscii, pOptions, pStrTitle, true/*bMultiByte*/, bOnlyDbtoolsEncodings, bImport));
+    return VclPtr<AbstractScImportOptionsDlg_Impl>::Create(pParent, bAscii, pOptions, pStrTitle, true/*bMultiByte*/, bOnlyDbtoolsEncodings, bImport);
+}
+
+namespace
+{
+template<class Dialog>
+class ScAbstractTabController_Impl
+    : public vcl::AbstractDialogImpl_Async<SfxAbstractTabDialog, Dialog>
+{
+public:
+    using vcl::AbstractDialogImpl_Async<SfxAbstractTabDialog, Dialog>::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); }
+
+    // screenshotting
+    std::vector<OUString> getAllPageUIXMLDescriptions() const override
+    {
+        return this->m_pDlg->getAllPageUIXMLDescriptions();
+    }
+    bool selectPageByUIXMLDescription(const OUString& rUIXMLDescription) override
+    {
+        return this->m_pDlg->selectPageByUIXMLDescription(rUIXMLDescription);
+    }
+    BitmapEx createScreenshot() const override { return this->m_pDlg->createScreenshot(); }
+    OUString GetScreenshotId() const override { return this->m_pDlg->GetScreenshotId(); }
+};
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScAttrDlg>(pParent, pCellAttrs));
+    return VclPtr<ScAbstractTabController_Impl<ScAttrDlg>>::Create(pParent, pCellAttrs);
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScHFEditDlg( weld::Window*         pParent,
@@ -1307,89 +860,91 @@ VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScHFEditDlg( we
                                                                         const OUString&     rPageStyle,
                                                                         sal_uInt16          nResId )
 {
-    std::shared_ptr<SfxTabDialogController> xDlg;
-
     switch (nResId)
     {
         case RID_SCDLG_HFED_HEADER:
         case RID_SCDLG_HFEDIT_HEADER:
-            xDlg = std::make_shared<ScHFEditHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFED_FOOTER:
         case RID_SCDLG_HFEDIT_FOOTER:
-            xDlg = std::make_shared<ScHFEditFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SHAREDFIRSTHEADER:
-            xDlg = std::make_shared<ScHFEditSharedFirstHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedFirstHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SHAREDLEFTHEADER:
-            xDlg = std::make_shared<ScHFEditSharedLeftHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedLeftHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SHAREDFIRSTFOOTER:
-            xDlg = std::make_shared<ScHFEditSharedFirstFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedFirstFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SHAREDLEFTFOOTER:
-            xDlg = std::make_shared<ScHFEditSharedLeftFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedLeftFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_LEFTHEADER:
-            xDlg = std::make_shared<ScHFEditLeftHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditLeftHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_RIGHTHEADER:
-            xDlg = std::make_shared<ScHFEditRightHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditRightHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_LEFTFOOTER:
-            xDlg = std::make_shared<ScHFEditLeftFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditLeftFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_RIGHTFOOTER:
-            xDlg = std::make_shared<ScHFEditRightFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditRightFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SHDR:
-            xDlg = std::make_shared<ScHFEditSharedHeaderDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedHeaderDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_SFTR:
-            xDlg = std::make_shared<ScHFEditSharedFooterDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditSharedFooterDlg>>::Create(pParent, rCoreSet, rPageStyle);
         case RID_SCDLG_HFEDIT_ALL:
-            xDlg = std::make_shared<ScHFEditAllDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditAllDlg>>::Create(pParent, rCoreSet, rPageStyle);
         default:
         case RID_SCDLG_HFEDIT:
-            xDlg = std::make_shared<ScHFEditActiveDlg>(pParent, rCoreSet, rPageStyle);
-            break;
+            return VclPtr<ScAbstractTabController_Impl<ScHFEditActiveDlg>>::Create(pParent, rCoreSet, rPageStyle);
     }
-
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::move(xDlg));
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScStyleDlg(weld::Window* pParent,
                                                                             SfxStyleSheetBase& rStyleBase,
                                                                             bool bPage)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScStyleDlg>(pParent, rStyleBase, bPage));
+    return VclPtr<ScAbstractTabController_Impl<ScStyleDlg>>::Create(pParent, rStyleBase, bPage);
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScDrawStyleDlg(weld::Window* pParent,
                                                                                 SfxStyleSheetBase& rStyleBase,
                                                                                 SdrView* pView)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScDrawStyleDlg>(pParent, rStyleBase, pView));
+    return VclPtr<ScAbstractTabController_Impl<ScDrawStyleDlg>>::Create(pParent, rStyleBase, pView);
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScSubTotalDlg(weld::Window* pParent, const SfxItemSet& rArgSet)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScSubTotalDlg>(pParent, rArgSet));
+    return VclPtr<ScAbstractTabController_Impl<ScSubTotalDlg>>::Create(pParent, rArgSet);
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScCharDlg(
     weld::Window* pParent, const SfxItemSet* pAttr, const SfxObjectShell* pDocShell, bool bDrawText)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScCharDlg>(pParent, pAttr, pDocShell, bDrawText));
+    return VclPtr<ScAbstractTabController_Impl<ScCharDlg>>::Create(pParent, pAttr, pDocShell, bDrawText);
 }
 
 VclPtr<SfxAbstractTabDialog> ScAbstractDialogFactory_Impl::CreateScParagraphDlg(
     weld::Window* pParent, const SfxItemSet* pAttr)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(std::make_shared<ScParagraphDlg>(pParent, pAttr));
+    return VclPtr<ScAbstractTabController_Impl<ScParagraphDlg>>::Create(pParent, pAttr);
+}
+
+namespace
+{
+class ScAsyncTabController_Impl : public ScAsyncTabController
+{
+    std::shared_ptr<SfxTabDialogController> m_pDlg;
+
+public:
+    explicit ScAsyncTabController_Impl(std::shared_ptr<SfxTabDialogController> p)
+        : m_pDlg(std::move(p))
+    {
+    }
+    bool StartExecuteAsync(VclAbstractDialog::AsyncContext& rCtx) override
+    {
+        return SfxTabDialogController::runAsync(m_pDlg, rCtx.maEndDialogFn);
+    }
+    const SfxItemSet* GetOutputItemSet() const override { return m_pDlg->GetOutputItemSet(); }
+    void SetCurPageId(const OUString& rName) override { m_pDlg->SetCurPageId(rName); }
+};
 }
 
 std::shared_ptr<ScAsyncTabController> ScAbstractDialogFactory_Impl::CreateScSortDlg(weld::Window* pParent, const SfxItemSet* pArgSet)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index fe60d59bc8e6..adb4293df269 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -19,641 +19,6 @@
 #pragma once
 
 #include <scabstdlg.hxx>
-#include <sfx2/sfxdlg.hxx>
-
-#include <corodlg.hxx>
-#include <condformatmgr.hxx>
-#include <dapitype.hxx>
-#include <dapidata.hxx>
-#include <datafdlg.hxx>
-#include <delcodlg.hxx>
-#include <delcldlg.hxx>
-#include <dpgroupdlg.hxx>
-#include <filldlg.hxx>
-#include <gototabdlg.hxx>
-#include <groupdlg.hxx>
-#include <linkarea.hxx>
-#include <lbseldlg.hxx>
-#include <inscldlg.hxx>
-#include <instbdlg.hxx>
-#include <inscodlg.hxx>
-#include <mtrindlg.hxx>
-#include <mvtabdlg.hxx>
-#include <namecrea.hxx>
-#include <namepast.hxx>
-#include <pfiltdlg.hxx>
-#include <pvfundlg.hxx>
-#include <shtabdlg.hxx>
-#include <scendlg.hxx>
-#include <scuiasciiopt.hxx>
-#include <scuiautofmt.hxx>
-#include <scuiimoptdlg.hxx>
-#include <sortdlg.hxx>
-#include <strindlg.hxx>
-#include <tabbgcolordlg.hxx>
-#include <textimportoptions.hxx>
-
-class AbstractScImportAsciiDlg_Impl : public AbstractScImportAsciiDlg
-{
-    std::shared_ptr<ScImportAsciiDlg> m_xDlg;
-public:
-    explicit AbstractScImportAsciiDlg_Impl(std::shared_ptr<ScImportAsciiDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual void                        GetOptions( ScAsciiOptions& rOpt ) override;
-    virtual void                        SaveParameters() override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScAutoFormatDlg_Impl : public AbstractScAutoFormatDlg
-{
-    std::unique_ptr<ScAutoFormatDlg> m_xDlg;
-public:
-    explicit AbstractScAutoFormatDlg_Impl(std::unique_ptr<ScAutoFormatDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual sal_uInt16 GetIndex() const override;
-    virtual OUString GetCurrFormatName() override;
-};
-
-class AbstractScColRowLabelDlg_Impl : public AbstractScColRowLabelDlg
-{
-    std::shared_ptr<ScColRowLabelDlg> m_xDlg;
-public:
-    explicit AbstractScColRowLabelDlg_Impl(std::shared_ptr<ScColRowLabelDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual bool IsCol() override;
-    virtual bool IsRow() override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg
-{
-    std::shared_ptr<ScCondFormatManagerDlg> m_xDlg;
-public:
-    explicit AbstractScCondFormatManagerDlg_Impl(std::shared_ptr<ScCondFormatManagerDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() override;
-    virtual bool CondFormatsChanged() const override;
-    virtual void SetModified() override;
-    virtual ScConditionalFormat* GetCondFormatSelected() override;
-};
-
-class AbstractScDataPilotDatabaseDlg_Impl  :public AbstractScDataPilotDatabaseDlg
-{
-    std::shared_ptr<ScDataPilotDatabaseDlg> m_xDlg;
-public:
-    explicit AbstractScDataPilotDatabaseDlg_Impl(std::shared_ptr<ScDataPilotDatabaseDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext &) override;
-    virtual void GetValues( ScImportSourceDesc& rDesc ) override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScDataPilotSourceTypeDlg_Impl  :public AbstractScDataPilotSourceTypeDlg
-{
-    std::shared_ptr<ScDataPilotSourceTypeDlg> m_xDlg;
-public:
-    explicit AbstractScDataPilotSourceTypeDlg_Impl(std::shared_ptr<ScDataPilotSourceTypeDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext &) override;
-    virtual bool IsDatabase() const override;
-    virtual bool IsExternal() const override;
-    virtual bool IsNamedRange() const override;
-    virtual OUString GetSelectedNamedRange() const override;
-    virtual void AppendNamedRange(const OUString& rName) override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScDataPilotServiceDlg_Impl : public AbstractScDataPilotServiceDlg
-{
-    std::shared_ptr<ScDataPilotServiceDlg> m_xDlg;
-public:
-    explicit AbstractScDataPilotServiceDlg_Impl(std::shared_ptr<ScDataPilotServiceDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short     Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext &) override;
-    virtual OUString  GetServiceName() const override;
-    virtual OUString  GetParSource() const override;
-    virtual OUString  GetParName() const override;
-    virtual OUString  GetParUser() const override;
-    virtual OUString  GetParPass() const override;
-};
-
-class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg
-{
-    std::shared_ptr<ScDeleteCellDlg> m_xDlg;
-public:
-    explicit AbstractScDeleteCellDlg_Impl(std::unique_ptr<ScDeleteCellDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool  StartExecuteAsync(AsyncContext& rCtx) override;
-    virtual DelCellCmd GetDelCellCmd() const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-//for dataform
-class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg
-{
-    std::unique_ptr<ScDataFormDlg> m_xDlg;
-public:
-    explicit AbstractScDataFormDlg_Impl(std::unique_ptr<ScDataFormDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScDeleteContentsDlg_Impl : public AbstractScDeleteContentsDlg
-{
-    std::unique_ptr<ScDeleteContentsDlg> m_xDlg;
-public:
-    explicit AbstractScDeleteContentsDlg_Impl(std::unique_ptr<ScDeleteContentsDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short   Execute() override;
-    virtual void    DisableObjects() override;
-    virtual InsertDeleteFlags GetDelContentsCmdBits() const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScFillSeriesDlg_Impl:public AbstractScFillSeriesDlg
-{
-    std::unique_ptr<ScFillSeriesDlg> m_xDlg;
-public:
-    explicit AbstractScFillSeriesDlg_Impl(std::unique_ptr<ScFillSeriesDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short       Execute() override;
-    virtual FillDir     GetFillDir() const override;
-    virtual FillCmd     GetFillCmd() const override;
-    virtual FillDateCmd GetFillDateCmd() const override;
-    virtual double      GetStart() const override;
-    virtual double      GetStep() const override;
-    virtual double      GetMax() const override;
-    virtual OUString    GetStartStr() const override;
-    virtual void        SetEdStartValEnabled(bool bFlag) override;
-};
-
-class AbstractScGroupDlg_Impl :  public AbstractScGroupDlg
-{
-    std::shared_ptr<ScGroupDlg> m_xDlg;
-public:
-    explicit AbstractScGroupDlg_Impl(std::shared_ptr<ScGroupDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual bool GetColsChecked() const override;
-};
-
-class AbstractScInsertCellDlg_Impl : public AbstractScInsertCellDlg
-{
-    std::shared_ptr<ScInsertCellDlg> m_xDlg;
-public:
-    explicit AbstractScInsertCellDlg_Impl(std::unique_ptr<ScInsertCellDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual InsCellCmd GetInsCellCmd() const override ;
-    virtual size_t GetCount() const override ;
-};
-
-class AbstractScInsertContentsDlg_Impl : public AbstractScInsertContentsDlg
-{
-    std::unique_ptr<ScInsertContentsDlg> m_xDlg;
-public:
-    explicit AbstractScInsertContentsDlg_Impl(std::unique_ptr<ScInsertContentsDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual InsertDeleteFlags GetInsContentsCmdBits() const override;
-    virtual ScPasteFunc   GetFormulaCmdBits() const override;
-    virtual bool        IsSkipEmptyCells() const override;
-    virtual bool        IsLink() const override;
-    virtual void        SetFillMode( bool bSet ) override;
-    virtual void        SetOtherDoc( bool bSet ) override;
-    virtual bool        IsTranspose() const override;
-    virtual void        SetChangeTrack( bool bSet ) override;
-    virtual void        SetCellShiftDisabled( CellShiftDisabledFlags nDisable ) override;
-    virtual InsCellCmd  GetMoveMode() override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScInsertTableDlg_Impl : public AbstractScInsertTableDlg
-{
-    std::shared_ptr<ScInsertTableDlg> m_xDlg;
-public:
-    explicit AbstractScInsertTableDlg_Impl(std::shared_ptr<ScInsertTableDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual bool            StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual bool            GetTablesFromFile() override;
-    virtual bool            GetTablesAsLink() override;
-    virtual const OUString* GetFirstTable( sal_uInt16* pN = nullptr ) override;
-    virtual ScDocShell*     GetDocShellTables() override;
-    virtual bool            IsTableBefore() override;
-    virtual sal_uInt16      GetTableCount() override;
-    virtual const OUString* GetNextTable( sal_uInt16* pN ) override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScSelEntryDlg_Impl : public AbstractScSelEntryDlg
-{
-    std::shared_ptr<ScSelEntryDlg> m_xDlg;
-public:
-    explicit AbstractScSelEntryDlg_Impl(std::unique_ptr<ScSelEntryDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short    Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
-    virtual OUString GetSelectedEntry() const override;
-};
-
-class AbstractScLinkedAreaDlg_Impl : public AbstractScLinkedAreaDlg
-{
-    std::unique_ptr<ScLinkedAreaDlg> m_xDlg;
-public:
-    explicit AbstractScLinkedAreaDlg_Impl(std::unique_ptr<ScLinkedAreaDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual                 ~AbstractScLinkedAreaDlg_Impl() override;
-    virtual short           Execute() override;
-    virtual void            InitFromOldLink( const OUString& rFile, const OUString& rFilter,
-                                        const OUString& rOptions, const OUString& rSource,
-                                        sal_Int32 nRefreshDelaySeconds ) override;
-    virtual OUString        GetURL() override;
-    virtual OUString        GetFilter() override;        // may be empty
-    virtual OUString        GetOptions() override;       // filter options
-    virtual OUString        GetSource() override;        // separated by ";"
-    virtual sal_Int32       GetRefreshDelaySeconds() override;       // 0 if disabled
-};
-
-class AbstractScMetricInputDlg_Impl : public AbstractScMetricInputDlg
-{
-    std::shared_ptr<ScMetricInputDlg> m_xDlg;
-public:
-    explicit AbstractScMetricInputDlg_Impl(std::shared_ptr<ScMetricInputDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
-    virtual int GetInputValue() const override;
-};
-
-class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg
-{
-    std::shared_ptr<ScMoveTableDlg> m_xDlg;
-public:
-    explicit AbstractScMoveTableDlg_Impl(std::shared_ptr<ScMoveTableDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext& rCtx) override;
-    virtual sal_uInt16  GetSelectedDocument     () const override;
-    virtual sal_uInt16  GetSelectedTable        () const override;
-    virtual bool    GetCopyTable            () const override;
-    virtual bool    GetRenameTable          () const override;
-    virtual void    GetTabNameString( OUString& rString ) const override;
-    virtual void    SetForceCopyTable       () override;
-    virtual void    EnableRenameTable       (bool bFlag) override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScNameCreateDlg_Impl : public AbstractScNameCreateDlg
-{
-    std::unique_ptr<ScNameCreateDlg> m_xDlg;
-public:
-    explicit AbstractScNameCreateDlg_Impl(std::unique_ptr<ScNameCreateDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual CreateNameFlags GetFlags() const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScNamePasteDlg_Impl : public AbstractScNamePasteDlg
-{
-    std::unique_ptr<ScNamePasteDlg> m_xDlg;
-public:
-    explicit AbstractScNamePasteDlg_Impl(std::unique_ptr<ScNamePasteDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual std::vector<OUString>          GetSelectedNames() const override;
-};
-
-class AbstractScPivotFilterDlg_Impl : public AbstractScPivotFilterDlg
-{
-    std::unique_ptr<ScPivotFilterDlg> m_xDlg;
-public:
-    explicit AbstractScPivotFilterDlg_Impl(std::unique_ptr<ScPivotFilterDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual const ScQueryItem&  GetOutputItem() override;
-};
-
-class AbstractScDPFunctionDlg_Impl : public AbstractScDPFunctionDlg
-{
-    std::shared_ptr<ScDPFunctionDlg> m_xDlg;
-public:
-    explicit AbstractScDPFunctionDlg_Impl(std::shared_ptr<ScDPFunctionDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual PivotFunc GetFuncMask() const override;
-    virtual css::sheet::DataPilotFieldReference GetFieldRef() const override;
-    virtual void Response(int nResponse) override;
-};
-
-class AbstractScDPSubtotalDlg_Impl : public AbstractScDPSubtotalDlg
-{
-    std::shared_ptr<ScDPSubtotalDlg> m_xDlg;
-public:
-    explicit AbstractScDPSubtotalDlg_Impl(std::shared_ptr<ScDPSubtotalDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual PivotFunc GetFuncMask() const override;
-    virtual void FillLabelData( ScDPLabelData& rLabelData ) const override;
-    virtual void Response(int nResponse) override;
-};
-
-class AbstractScDPNumGroupDlg_Impl : public AbstractScDPNumGroupDlg
-{
-    std::unique_ptr<ScDPNumGroupDlg> m_xDlg;
-public:
-    explicit AbstractScDPNumGroupDlg_Impl(std::unique_ptr<ScDPNumGroupDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual ScDPNumGroupInfo GetGroupInfo() const override;
-};
-
-class AbstractScDPDateGroupDlg_Impl : public AbstractScDPDateGroupDlg
-{
-    std::unique_ptr<ScDPDateGroupDlg> m_xDlg;
-public:
-    explicit AbstractScDPDateGroupDlg_Impl(std::unique_ptr<ScDPDateGroupDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual ScDPNumGroupInfo GetGroupInfo() const override;
-    virtual sal_Int32 GetDatePart() const override;
-};
-
-class AbstractScDPShowDetailDlg_Impl : public AbstractScDPShowDetailDlg
-{
-    std::unique_ptr<ScDPShowDetailDlg> m_xDlg;
-public:
-    explicit AbstractScDPShowDetailDlg_Impl(std::unique_ptr<ScDPShowDetailDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual OUString GetDimensionName() const override;
-};
-
-class AbstractScNewScenarioDlg_Impl : public AbstractScNewScenarioDlg
-{
-    std::unique_ptr<ScNewScenarioDlg> m_xDlg;
-public:
-    explicit AbstractScNewScenarioDlg_Impl(std::unique_ptr<ScNewScenarioDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short           Execute() override;
-
-    virtual void SetScenarioData( const OUString& rName, const OUString& rComment,
-                            const Color& rColor, ScScenarioFlags nFlags ) override;
-
-    virtual void GetScenarioData( OUString& rName, OUString& rComment,
-                            Color& rColor, ScScenarioFlags& rFlags ) const override;
-};
-
-class AbstractScShowTabDlg_Impl : public AbstractScShowTabDlg
-{
-    std::shared_ptr<ScShowTabDlg> m_xDlg;
-public:
-    explicit AbstractScShowTabDlg_Impl(std::shared_ptr<ScShowTabDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual void Insert( const OUString& rString, bool bSelected ) override;
-    virtual void SetDescription(const OUString& rTitle, const OUString& rFixedText, const OUString& sDlgHelpId, const OUString& sLbHelpId) override;
-    virtual OUString GetEntry(sal_Int32 nPos) const override;
-    virtual std::vector<sal_Int32> GetSelectedRows() const override;
-};
-
-class AbstractScGoToTabDlg_Impl : public AbstractScGoToTabDlg
-{
-    std::shared_ptr<ScGoToTabDlg> m_xDlg;
-public:
-    explicit AbstractScGoToTabDlg_Impl(std::shared_ptr<ScGoToTabDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual void Insert( const OUString& rString, bool bSelected ) override;
-    virtual void SetDescription(const OUString& rTitle, const OUString& rEntryLabel, const OUString& rListLabel,
-                                const OUString& rDlgHelpId, const OUString& rEnHelpId, const OUString& rLbHelpId) override;
-    virtual OUString GetSelectedEntry() const override;
-};
-
-class AbstractScSortWarningDlg_Impl : public AbstractScSortWarningDlg
-{
-    std::unique_ptr<ScSortWarningDlg> m_xDlg;
-public:
-    explicit AbstractScSortWarningDlg_Impl(std::unique_ptr<ScSortWarningDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-};
-
-class AbstractScStringInputDlg_Impl :  public AbstractScStringInputDlg
-{
-    std::shared_ptr<ScStringInputDlg> m_xDlg;
-public:
-    explicit AbstractScStringInputDlg_Impl(std::shared_ptr<ScStringInputDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
-    virtual OUString GetInputString() const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScTabBgColorDlg_Impl :  public AbstractScTabBgColorDlg
-{
-    std::shared_ptr<ScTabBgColorDlg> m_xDlg;
-public:
-    explicit AbstractScTabBgColorDlg_Impl(std::shared_ptr<ScTabBgColorDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual void GetSelectedColor( Color& rColor ) const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg
-{
-    std::unique_ptr<ScImportOptionsDlg> m_xDlg;
-public:
-    explicit AbstractScImportOptionsDlg_Impl(std::unique_ptr<ScImportOptionsDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual void GetImportOptions( ScImportOptions& rOptions ) const override;
-    virtual void SaveImportOptions() const override;
-};
-
-class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDlg
-{
-    std::unique_ptr<ScTextImportOptionsDlg> m_xDlg;
-public:
-    explicit AbstractScTextImportOptionsDlg_Impl(std::unique_ptr<ScTextImportOptionsDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual LanguageType GetLanguageType() const override;
-    virtual bool IsDateConversionSet() const override;
-    virtual bool IsScientificConversionSet() const override;
-    virtual bool IsKeepAskingSet() const override;
-
-    // screenshotting
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class ScAbstractTabController_Impl : public SfxAbstractTabDialog
-{
-    std::shared_ptr<SfxTabDialogController> m_xDlg;
-public:
-    explicit ScAbstractTabController_Impl(std::shared_ptr<SfxTabDialogController> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual bool  StartExecuteAsync(AsyncContext &rCtx) override;
-    virtual void                SetCurPageId( const OUString &rName ) override;
-    virtual const SfxItemSet*   GetOutputItemSet() const override;
-    virtual WhichRangesContainer GetInputRanges( const SfxItemPool& pItem ) override;
-    virtual void                SetInputSet( const SfxItemSet* pInSet ) override;
-    virtual void        SetText( const OUString& rStr ) override;
-
-    // screenshotting
-    virtual std::vector<OUString> getAllPageUIXMLDescriptions() const override;
-    virtual bool selectPageByUIXMLDescription(const OUString& rUIXMLDescription) override;
-    virtual BitmapEx createScreenshot() const override;
-    virtual OUString GetScreenshotId() const override;
-};
-
-class ScAsyncTabController_Impl : public ScAsyncTabController
-{
-    std::shared_ptr<SfxTabDialogController> m_xDlg;
-public:
-    explicit ScAsyncTabController_Impl(std::shared_ptr<SfxTabDialogController> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual bool  StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    virtual const SfxItemSet*   GetOutputItemSet() const override;
-    virtual void                SetCurPageId( const OUString &rName ) override;
-};
 
 //AbstractDialogFactory_Impl implementations
 class ScAbstractDialogFactory_Impl : public ScAbstractDialogFactory
diff --git a/sc/source/ui/attrdlg/scuiexp.cxx b/sc/source/ui/attrdlg/scuiexp.cxx
index 3da9d2ed7b42..97cd5299aedc 100644
--- a/sc/source/ui/attrdlg/scuiexp.cxx
+++ b/sc/source/ui/attrdlg/scuiexp.cxx
@@ -21,8 +21,13 @@
 
 #include "scdlgfact.hxx"
 #include <sal/types.h>
+#include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
 /// anonymous implementation namespace
 namespace
 {
-- 
cgit