summaryrefslogtreecommitdiff
path: root/writerperfect/source
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-12-09 13:53:47 +0100
committerAndras Timar <andras.timar@collabora.com>2022-12-20 03:10:59 +0000
commit34709aa3f4f166879004670e60ff3b37ad3eacd5 (patch)
tree802839194ec41859c2350a267e985391ef455475 /writerperfect/source
parent70d9e7eadb1069b5e7a1909c671b9348b740cca1 (diff)
Make EPUB Export dialog async
(cherry picked from commit 9461b0e1385b87d2490bf9402729fb9e912395e9) Change-Id: Iead5b4ff6064395fd5abbcdea73db38415dbb37c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144514 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'writerperfect/source')
-rw-r--r--writerperfect/source/writer/EPUBExportUIComponent.cxx25
-rw-r--r--writerperfect/source/writer/EPUBExportUIComponent.hxx14
2 files changed, 39 insertions, 0 deletions
diff --git a/writerperfect/source/writer/EPUBExportUIComponent.cxx b/writerperfect/source/writer/EPUBExportUIComponent.cxx
index e8d618b99cf6..0e392ffe00ec 100644
--- a/writerperfect/source/writer/EPUBExportUIComponent.cxx
+++ b/writerperfect/source/writer/EPUBExportUIComponent.cxx
@@ -90,6 +90,31 @@ void SAL_CALL EPUBExportUIComponent::setSourceDocument(
mxSourceDocument = xDocument;
}
+void SAL_CALL EPUBExportUIComponent::setDialogTitle(const OUString& aTitle) { setTitle(aTitle); }
+
+void SAL_CALL EPUBExportUIComponent::startExecuteModal(
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
+{
+ SolarMutexGuard aSolarGuard;
+
+ if (!mxAsyncDialog)
+ {
+ if (mxSourceDocument.is())
+ mxAsyncDialog
+ = std::make_shared<EPUBExportDialog>(Application::GetFrameWeld(mxDialogParent),
+ maFilterData, mxContext, mxSourceDocument);
+
+ if (!mxAsyncDialog)
+ return;
+ }
+
+ weld::DialogController::runAsync(mxAsyncDialog, [xListener](sal_Int32 nResponse) {
+ css::ui::dialogs::DialogClosedEvent aEvent;
+ aEvent.DialogResult = nResponse;
+ xListener->dialogClosed(aEvent);
+ });
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
com_sun_star_comp_Writer_EPUBExportUIComponent_get_implementation(
uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
diff --git a/writerperfect/source/writer/EPUBExportUIComponent.hxx b/writerperfect/source/writer/EPUBExportUIComponent.hxx
index 71fcc0ace168..b453a4e88096 100644
--- a/writerperfect/source/writer/EPUBExportUIComponent.hxx
+++ b/writerperfect/source/writer/EPUBExportUIComponent.hxx
@@ -12,6 +12,7 @@
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/awt/XWindow.hpp>
@@ -19,6 +20,11 @@
#include <comphelper/sequenceashashmap.hxx>
#include <cppuhelper/implbase.hxx>
+namespace weld
+{
+class DialogController;
+}
+
namespace com::sun::star::uno
{
class XComponentContext;
@@ -30,6 +36,7 @@ namespace writerperfect
class EPUBExportUIComponent
: public cppu::WeakImplHelper<css::beans::XPropertyAccess, css::lang::XInitialization,
css::lang::XServiceInfo, css::ui::dialogs::XExecutableDialog,
+ css::ui::dialogs::XAsynchronousExecutableDialog,
css::document::XExporter>
{
public:
@@ -49,6 +56,12 @@ public:
void SAL_CALL setTitle(const OUString& rTitle) override;
sal_Int16 SAL_CALL execute() override;
+ // XAsynchronousExecutableDialog
+ void SAL_CALL setDialogTitle(const OUString& aTitle) override;
+
+ void SAL_CALL startExecuteModal(
+ const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener) override;
+
// XExporter
void SAL_CALL
setSourceDocument(const css::uno::Reference<css::lang::XComponent>& xDocument) override;
@@ -65,6 +78,7 @@ private:
css::uno::Reference<css::uno::XComponentContext> mxContext;
css::uno::Reference<css::lang::XComponent> mxSourceDocument;
css::uno::Reference<css::awt::XWindow> mxDialogParent;
+ std::shared_ptr<weld::DialogController> mxAsyncDialog;
};
} // namespace writerperfect