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 /filter | |
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>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 48 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 5 |
2 files changed, 32 insertions, 21 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; }; |