summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx10
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx10
-rw-r--r--sc/source/ui/view/cellsh1.cxx122
-rw-r--r--vcl/jsdialog/enabled.cxx2
4 files changed, 89 insertions, 55 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 8b59e672ca12..722c3b8c29e4 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -137,6 +137,11 @@ 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()
{
@@ -174,6 +179,11 @@ 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();
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index b1703930c584..35782000b979 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -174,13 +174,14 @@ public:
class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg
{
- std::unique_ptr<ScDeleteCellDlg> m_xDlg;
+ 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 short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
virtual DelCellCmd GetDelCellCmd() const override;
// screenshotting
@@ -255,13 +256,14 @@ public:
class AbstractScInsertCellDlg_Impl : public AbstractScInsertCellDlg
{
- std::unique_ptr<ScInsertCellDlg> m_xDlg;
+ 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 short Execute() override;
+ virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
virtual InsCellCmd GetInsCellCmd() const override ;
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index b3e03a488a6a..88c1470bc8db 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -169,6 +169,60 @@ void SetTabNoAndCursor( const ScViewData& rViewData, std::u16string_view rCellId
pTabViewShell->SetCursor(aFoundPos.Col(), aFoundPos.Row());
}
}
+
+void InsertCells(ScTabViewShell* pTabViewShell, SfxRequest &rReq, InsCellCmd eCmd)
+{
+ if (eCmd!=INS_NONE)
+ {
+ pTabViewShell->InsertCells( eCmd );
+
+ if( ! rReq.IsAPI() )
+ {
+ OUString aParam;
+
+ switch( eCmd )
+ {
+ case INS_CELLSDOWN: aParam = "V"; break;
+ case INS_CELLSRIGHT: aParam = ">"; break;
+ case INS_INSROWS_BEFORE: aParam = "R"; break;
+ case INS_INSCOLS_BEFORE: aParam = "C"; break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) );
+ rReq.Done();
+ }
+ }
+}
+
+void DeleteCells(ScTabViewShell* pTabViewShell, SfxRequest &rReq, DelCellCmd eCmd)
+{
+ if (eCmd != DelCellCmd::NONE )
+ {
+ pTabViewShell->DeleteCells( eCmd );
+
+ if( ! rReq.IsAPI() )
+ {
+ OUString aParam;
+
+ switch( eCmd )
+ {
+ case DelCellCmd::CellsUp: aParam = "U"; break;
+ case DelCellCmd::CellsLeft: aParam = "L"; break;
+ case DelCellCmd::Rows: aParam = "R"; break;
+ case DelCellCmd::Cols: aParam = "C"; break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) );
+ rReq.Done();
+ }
+ }
+}
}
void ScCellShell::ExecuteEdit( SfxRequest& rReq )
@@ -287,35 +341,19 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag));
- if (pDlg->Execute() == RET_OK)
- eCmd = pDlg->GetInsCellCmd();
- }
- }
-
- if (eCmd!=INS_NONE)
- {
- pTabViewShell->InsertCells( eCmd );
-
- if( ! rReq.IsAPI() )
- {
- OUString aParam;
-
- switch( eCmd )
- {
- case INS_CELLSDOWN: aParam = "V"; break;
- case INS_CELLSRIGHT: aParam = ">"; break;
- case INS_INSROWS_BEFORE: aParam = "R"; break;
- case INS_INSCOLS_BEFORE: aParam = "C"; break;
- default:
+ VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag));
+ pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){
+ if (nResult == RET_OK)
{
- // added to avoid warnings
+ SfxRequest aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
+ InsertCells(pTabViewShell, aRequest, pDlg->GetInsCellCmd());
}
- }
- rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) );
- rReq.Done();
+ pDlg->disposeOnce();
+ });
}
}
+
+ InsertCells(pTabViewShell, rReq, eCmd);
}
break;
@@ -356,37 +394,19 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
(rDoc.GetChangeTrack() != nullptr);
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ VclPtr<AbstractScDeleteCellDlg> pDlg(pFact->CreateScDeleteCellDlg( pTabViewShell->GetFrameWeld(), bTheFlag ));
- ScopedVclPtr<AbstractScDeleteCellDlg> pDlg(pFact->CreateScDeleteCellDlg( pTabViewShell->GetFrameWeld(), bTheFlag ));
-
- if (pDlg->Execute() == RET_OK)
- eCmd = pDlg->GetDelCellCmd();
- }
- }
-
- if (eCmd != DelCellCmd::NONE )
- {
- pTabViewShell->DeleteCells( eCmd );
-
- if( ! rReq.IsAPI() )
- {
- OUString aParam;
-
- switch( eCmd )
- {
- case DelCellCmd::CellsUp: aParam = "U"; break;
- case DelCellCmd::CellsLeft: aParam = "L"; break;
- case DelCellCmd::Rows: aParam = "R"; break;
- case DelCellCmd::Cols: aParam = "C"; break;
- default:
+ pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){
+ if (nResult == RET_OK)
{
- // added to avoid warnings
+ SfxRequest aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
+ DeleteCells(pTabViewShell, aRequest, pDlg->GetDelCellCmd());
}
- }
- rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) );
- rReq.Done();
+ pDlg->disposeOnce();
+ });
}
}
+ DeleteCells(pTabViewShell, rReq, eCmd);
}
break;
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index f260691a64d7..b1d222d4b7f3 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -50,6 +50,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
|| rUIFile == u"modules/scalc/ui/datafielddialog.ui"
|| rUIFile == u"modules/scalc/ui/pivotfielddialog.ui"
|| rUIFile == u"modules/scalc/ui/datafieldoptionsdialog.ui"
+ || rUIFile == u"modules/scalc/ui/insertcells.ui"
+ || rUIFile == u"modules/scalc/ui/deletecells.ui"
|| rUIFile == u"svx/ui/fontworkgallerydialog.ui"
|| rUIFile == u"svx/ui/findreplacedialog.ui" || rUIFile == u"svx/ui/findreplacedialog.ui"
|| rUIFile == u"cui/ui/macroselectordialog.ui" || rUIFile == u"uui/ui/macrowarnmedium.ui"