diff options
author | NickWingate <nick.wingate@collabora.com> | 2022-02-23 14:11:49 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-14 08:53:39 +0200 |
commit | a1f9fea520f5b3f5d54a284886aa531693f32e7a (patch) | |
tree | 7e4e45ce0db6a80a0c0be2b8ab4214155f5c2ff9 | |
parent | 6c8dffc19e2a570d5665344dcba6afedd3dc2e15 (diff) |
Make accessibility check dialog async
Signed-off-by: NickWingate <nick.wingate@collabora.com>
Change-Id: I88913b3d7e580a1d8c69a39454f2598e11ba43ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130438
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 61fed0c4fe53738254d116543417f1c7028a0f39)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130451
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 48 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 5 | ||||
-rw-r--r-- | include/svx/AccessibilityCheckDialog.hxx | 1 | ||||
-rw-r--r-- | svx/source/dialog/AccessibilityCheckDialog.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 4 |
5 files changed, 36 insertions, 31 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index c1a3c94d5a85..d35396b40e14 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -271,6 +271,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property GetOKButton().set_label(sOkButtonText); GetCancelButton().connect_clicked(LINK(this, ImpPDFTabDialog, CancelHdl)); + GetOKButton().connect_clicked(LINK(this, ImpPDFTabDialog, OkHdl)); // remove the reset button, not needed in this tabbed dialog RemoveResetButton(); @@ -313,10 +314,37 @@ IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl, weld::Button&, void) m_xDialog->response(RET_CANCEL); } +IMPL_LINK_NOARG(ImpPDFTabDialog, OkHdl, weld::Button&, void) +{ + if (getGeneralPage()->IsPdfUaSelected()) + { + SfxObjectShell* pShell = SfxObjectShell::GetShellFromComponent(mrDoc); + if (pShell) + { + sfx::AccessibilityIssueCollection aCollection = pShell->runAccessibilityCheck(); + if (!aCollection.getIssues().empty()) + { + mpAccessibilityCheckDialog = std::make_shared<svx::AccessibilityCheckDialog>(mpParent, aCollection); + weld::DialogController::runAsync(mpAccessibilityCheckDialog, [this](sal_Int32 retValue){ + m_xDialog->response(retValue); + }); + } + } + } + else + { + m_xDialog->response(RET_OK); + } +} + ImpPDFTabDialog::~ImpPDFTabDialog() { maConfigItem.WriteModifiedConfig(); maConfigI18N.WriteModifiedConfig(); + if (mpAccessibilityCheckDialog) + { + mpAccessibilityCheckDialog->response(RET_CANCEL); + } } void ImpPDFTabDialog::PageCreated(const OString& rId, SfxTabPage& rPage) @@ -345,26 +373,6 @@ void ImpPDFTabDialog::PageCreated(const OString& rId, SfxTabPage& rPage) } } -short ImpPDFTabDialog::Ok( ) -{ - // here the whole mechanism of the base class is not used - // when Ok is hit, the user means 'convert to PDF', so simply close with ok - - if (getGeneralPage()->IsPdfUaSelected()) - { - SfxObjectShell* pShell = SfxObjectShell::GetShellFromComponent(mrDoc); - if (pShell) - { - sfx::AccessibilityIssueCollection aCollection = pShell->runAccessibilityCheck(); - if (!aCollection.getIssues().empty()) - { - svx::AccessibilityCheckDialog aDialog(mpParent, aCollection); - return aDialog.run(); - } - } - } - return RET_OK; -} Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() { diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 9682adbc111d..219d47e6d613 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -20,6 +20,7 @@ #pragma once #include <sfx2/tabdlg.hxx> +#include <svx/AccessibilityCheckDialog.hxx> #include <vcl/pdfwriter.hxx> #include <vcl/FilterConfigItem.hxx> @@ -66,6 +67,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController Any maSelection; DECL_LINK(CancelHdl, weld::Button&, void); + DECL_LINK(OkHdl, weld::Button&, void); // the following data are the configuration used throughout the dialog and pages bool mbIsPresentation; @@ -123,6 +125,8 @@ class ImpPDFTabDialog final : public SfxTabDialogController bool mbCanExtractForAccessibility; css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords; + std::shared_ptr< svx::AccessibilityCheckDialog > mpAccessibilityCheckDialog; + bool mbIsRangeChecked; OUString msPageRange; bool mbSelectionIsChecked; @@ -163,7 +167,6 @@ public: private: virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; - virtual short Ok() override; }; diff --git a/include/svx/AccessibilityCheckDialog.hxx b/include/svx/AccessibilityCheckDialog.hxx index 5227cbee2699..e3e1e201f227 100644 --- a/include/svx/AccessibilityCheckDialog.hxx +++ b/include/svx/AccessibilityCheckDialog.hxx @@ -50,7 +50,6 @@ public: AccessibilityCheckDialog(weld::Window* pParent, sfx::AccessibilityIssueCollection const& rIssueCollection); virtual ~AccessibilityCheckDialog() override; - virtual short run() override; }; } // end svx namespace diff --git a/svx/source/dialog/AccessibilityCheckDialog.cxx b/svx/source/dialog/AccessibilityCheckDialog.cxx index 4032e62f89f0..8fb0c43cee62 100644 --- a/svx/source/dialog/AccessibilityCheckDialog.cxx +++ b/svx/source/dialog/AccessibilityCheckDialog.cxx @@ -41,12 +41,6 @@ AccessibilityCheckDialog::AccessibilityCheckDialog( , m_aIssueCollection(rIssueCollection) , m_xAccessibilityCheckBox(m_xBuilder->weld_box("accessibilityCheckBox")) { -} - -AccessibilityCheckDialog::~AccessibilityCheckDialog() {} - -short AccessibilityCheckDialog::run() -{ sal_Int32 i = 0; for (std::shared_ptr<sfx::AccessibilityIssue> const& pIssue : m_aIssueCollection.getIssues()) @@ -56,9 +50,10 @@ short AccessibilityCheckDialog::run() m_xAccessibilityCheckBox->reorder_child(xEntry->get_widget(), i++); m_aAccessibilityCheckEntries.push_back(std::move(xEntry)); } - return GenericDialogController::run(); } +AccessibilityCheckDialog::~AccessibilityCheckDialog() {} + } // end svx namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index aee2526f8029..c5b46d42d90d 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2798,8 +2798,8 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) { sw::AccessibilityCheck aCheck(rSh.GetDoc()); aCheck.check(); - svx::AccessibilityCheckDialog aDialog(pMDI, aCheck.getIssueCollection()); - aDialog.run(); + std::shared_ptr<svx::AccessibilityCheckDialog> aDialog = std::make_shared<svx::AccessibilityCheckDialog>(pMDI, aCheck.getIssueCollection()); + weld::DialogController::runAsync(aDialog, [](int){}); } break; |