diff options
author | NickWingate <nick.wingate@collabora.com> | 2022-09-22 09:02:42 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-12-20 03:11:16 +0000 |
commit | 89f5912ad2eee786508414791653a017206a7c04 (patch) | |
tree | 72a2390a1d655e87a36d8982ff2b6e7031a2cb41 /filter | |
parent | 34709aa3f4f166879004670e60ff3b37ad3eacd5 (diff) |
Async PDFExport dialog and parent methods
Filter dialogs are all called generically from
guisaveas.cxx in GUIStoreModel()
Signed-off-by: NickWingate <nick.wingate@collabora.com>
Change-Id: Idfbe85c09f84d4a7cf3f00b9704d5af94868a051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140403
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144511
Tested-by: Jenkins
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 7 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 2 | ||||
-rw-r--r-- | filter/source/pdf/pdfdialog.cxx | 24 | ||||
-rw-r--r-- | filter/source/pdf/pdfdialog.hxx | 13 |
4 files changed, 41 insertions, 5 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index fd68322f1a23..a02412ac6caa 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -541,6 +541,8 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogC ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage() { + if (mxPasswordUnusedWarnDialog) + mxPasswordUnusedWarnDialog->response(RET_CANCEL); } void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) @@ -871,10 +873,11 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa // if a password was set, inform the user that this will not be used if (pSecPage && pSecPage->hasPassword()) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(), + mxPasswordUnusedWarnDialog = + std::shared_ptr<weld::MessageDialog>(Application::CreateMessageDialog(m_xContainer.get(), VclMessageType::Warning, VclButtonsType::Ok, FilterResId(STR_WARN_PASSWORD_PDFA))); - xBox->run(); + mxPasswordUnusedWarnDialog->runAsync(mxPasswordUnusedWarnDialog, [] (sal_uInt32){ }); } } else diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 828422bdc63e..d0d63bccc86b 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -232,6 +232,8 @@ class ImpPDFTabGeneralPage : public SfxTabPage DECL_LINK(TogglePDFVersionOrUniversalAccessibilityHandle, weld::Toggleable&, void); + std::shared_ptr<weld::MessageDialog> mxPasswordUnusedWarnDialog; + public: ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index 7c3e5dda1956..c036fc747b2a 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -62,6 +62,13 @@ std::unique_ptr<weld::DialogController> PDFDialog::createDialog(const css::uno:: return nullptr; } +std::shared_ptr<SfxTabDialogController> PDFDialog::createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& rParent) +{ + if( mxSrcDoc.is() ) + return std::make_shared<ImpPDFTabDialog>(Application::GetFrameWeld(rParent), maFilterData, mxSrcDoc); + return nullptr; +} + void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) { if (nExecutionResult && m_xDialog) @@ -69,6 +76,23 @@ void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) destroyDialog(); } +void PDFDialog::runAsync(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener) +{ + SfxTabDialogController::runAsync(m_xAsyncDialog, [this, xListener](sal_Int32 nResponse) { + executedAsyncDialog( m_xAsyncDialog, nResponse ); + css::ui::dialogs::DialogClosedEvent aEvent; + aEvent.DialogResult = nResponse; + xListener->dialogClosed( aEvent ); + destroyAsyncDialog(); + }); +} + +void PDFDialog::executedAsyncDialog( std::shared_ptr<SfxTabDialogController> xAsyncDialog, sal_Int32 nExecutionResult ) +{ + if (nExecutionResult && xAsyncDialog) + maFilterData = static_cast<ImpPDFTabDialog*>(xAsyncDialog.get())->GetFilterData(); +} + Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo() { Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx index fcfd1d0976bd..2410192a2617 100644 --- a/filter/source/pdf/pdfdialog.hxx +++ b/filter/source/pdf/pdfdialog.hxx @@ -19,8 +19,6 @@ #pragma once -#include <svtools/genericunodialog.hxx> - #include <comphelper/proparrhlp.hxx> #include <cppuhelper/implbase.hxx> @@ -28,12 +26,16 @@ #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <sfx2/tabdlg.hxx> +#include <svtools/genericasyncunodialog.hxx> + using namespace ::com::sun::star::beans; using namespace ::com::sun::star::document; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; -typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoDialog, XPropertyAccess, XExporter > PDFDialog_Base; +typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoAsyncDialog<SfxTabDialogController>, + XPropertyAccess, XExporter > PDFDialog_Base; class PDFDialog final: public PDFDialog_Base, @@ -54,6 +56,11 @@ private: virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + // OGenericUnoAsyncDialog + virtual std::shared_ptr<SfxTabDialogController> createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override; + virtual void runAsync(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener) override; + virtual void executedAsyncDialog(std::shared_ptr<SfxTabDialogController> xAsyncDialog, sal_Int32 nExecutionResult) override; + // XPropertyAccess using OPropertySetHelper::getPropertyValues; virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) override; |