filter/source/pdf/impdialog.cxx | 48 ++++++++++++++----------- filter/source/pdf/impdialog.hxx | 5 ++ include/svx/AccessibilityCheckDialog.hxx | 1 svx/source/dialog/AccessibilityCheckDialog.cxx | 9 +--- sw/source/uibase/shells/basesh.cxx | 4 +- 5 files changed, 36 insertions(+), 31 deletions(-)
New commits: commit 1c11ca079e8668bb461112f52304fc4eb786afda Author: NickWingate <nick.wing...@collabora.com> AuthorDate: Wed Feb 23 14:11:49 2022 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Mar 30 15:29:52 2022 +0200 Make accessibility check dialog async Signed-off-by: NickWingate <nick.wing...@collabora.com> Change-Id: I88913b3d7e580a1d8c69a39454f2598e11ba43ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130438 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> Reviewed-by: Mert Tumer <mert.tu...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> (cherry picked from commit 61fed0c4fe53738254d116543417f1c7028a0f39) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132185 Reviewed-by: Andras Timar <andras.ti...@collabora.com> 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 @@ -40,12 +40,6 @@ AccessibilityCheckDialog::AccessibilityCheckDialog( "AccessibilityCheckDialog") , m_aIssueCollection(rIssueCollection) , m_xAccessibilityCheckBox(m_xBuilder->weld_box("accessibilityCheckBox")) -{ -} - -AccessibilityCheckDialog::~AccessibilityCheckDialog() {} - -short AccessibilityCheckDialog::run() { sal_Int32 i = 0; @@ -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 418c77d36403..810f26b873fb 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2788,8 +2788,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;