summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSkyler Grey <skyler3665@gmail.com>2022-08-03 09:54:45 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2022-11-20 10:40:49 +0100
commitb5d3a3ac031d055e433eb2b79b48f6d00fb0e0d6 (patch)
tree46fe3e67e8aa69a4bd92341844a0684f3eeab869 /sw
parent67160035d65f9b43b8483e5900d2a2812e1bbecc (diff)
Turn the split table dialog into an async JSDialog
- Previously the split table dialog was not an async dialog, and it wasn't a JSDialog either - A non-async dialog has issues when multiple people try to change something using the dialog at the same time. Generally the changes from one person will not be applied until all people who opened the dialog later than them have submitted - This PR makes the dialog async, fixing multi-user issues with it - This PR makes the dialog into a JSDialog, rendering it on the client with native HTML elements Signed-off-by: Skyler Grey <skyler3665@gmail.com> Change-Id: I9254bc1b635531c8b38d1ade76f99ffdda145b35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137741 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142972 Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx7
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx5
-rw-r--r--sw/source/uibase/inc/splittbl.hxx12
-rw-r--r--sw/source/uibase/shells/tabsh.cxx18
4 files changed, 34 insertions, 8 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 6e9ebc873ab7..68135716fcb9 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -120,6 +120,11 @@ short AbstractSplitTableDialog_Impl::Execute()
return m_xDlg->run();
}
+bool AbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+ return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
short AbstractSwTableWidthDlg_Impl::Execute()
{
return m_xDlg->run();
@@ -978,7 +983,7 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwSortingDialog(we
VclPtr<AbstractSplitTableDialog> SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, SwWrtShell &rSh)
{
- return VclPtr<AbstractSplitTableDialog_Impl>::Create(std::make_unique<SwSplitTableDlg>(pParent, rSh));
+ return VclPtr<AbstractSplitTableDialog_Impl>::Create(std::make_shared<SwSplitTableDlg>(pParent, rSh));
}
VclPtr<AbstractSwSelGlossaryDlg> SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index f97ff430c294..c0326249a15b 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -236,13 +236,14 @@ public:
class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for
{
- std::unique_ptr<SwSplitTableDlg> m_xDlg;
+ std::shared_ptr<SwSplitTableDlg> m_xDlg;
public:
- explicit AbstractSplitTableDialog_Impl(std::unique_ptr<SwSplitTableDlg> p)
+ explicit AbstractSplitTableDialog_Impl(std::shared_ptr<SwSplitTableDlg> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
virtual SplitTable_HeadlineOption GetSplitMode() override;
};
diff --git a/sw/source/uibase/inc/splittbl.hxx b/sw/source/uibase/inc/splittbl.hxx
index 8c8891c1df1b..0311f08d4043 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -49,7 +49,17 @@ public:
return nRet;
}
- SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
+ SplitTable_HeadlineOption GetSplitMode() const
+ {
+ auto nSplit = SplitTable_HeadlineOption::ContentCopy;
+ if (m_xBoxAttrCopyWithParaRB->get_active())
+ nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
+ else if (m_xBoxAttrCopyNoParaRB->get_active())
+ nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
+ else if (m_xBorderCopyRB->get_active())
+ nSplit = SplitTable_HeadlineOption::BorderCopy;
+ return nSplit;
+ }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 01bd9389c152..ab93b027e69f 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1082,10 +1082,20 @@ void SwTableShell::Execute(SfxRequest &rReq)
else
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
- pDlg->Execute();
- rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) );
- bCallDone = true;
+ VclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog(GetView().GetFrameWeld(), rSh));
+
+ SwWrtShell* pSh = &rSh;
+
+ pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
+ if (nResult == RET_OK)
+ {
+ const auto aSplitMode = pDlg->GetSplitMode();
+ pSh->SplitTable( aSplitMode );
+ }
+
+ pDlg->disposeOnce();
+ });
+ rReq.Ignore(); // We're already handling the request in our async bit
}
break;
}