LibreOffice Module writerperfect (master) 1
EPUBExportUIComponent.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
11
12#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
15#include <vcl/svapp.hxx>
16
17#include "EPUBExportDialog.hxx"
18
19using namespace com::sun::star;
20
21namespace writerperfect
22{
24 : mxContext(std::move(xContext))
25{
26}
27
29{
32}
33
35 const uno::Sequence<beans::PropertyValue>& rProperties)
36{
38 maMediaDescriptor << rProperties;
39 auto it = maMediaDescriptor.find("FilterData");
40 if (it != maMediaDescriptor.end())
41 {
43 if (it->second >>= aFilterData)
44 {
46 maFilterData << aFilterData;
47 }
48 }
49}
50
52{
53 return "com.sun.star.comp.Writer.EPUBExportUIComponent";
54}
55
57{
58 return cppu::supportsService(this, rServiceName);
59}
60
62{
63 uno::Sequence<OUString> aRet = { OUString("com.sun.star.ui.dialogs.FilterOptionsDialog") };
64 return aRet;
65}
66
67void EPUBExportUIComponent::setTitle(const OUString& /*rTitle*/) {}
68
70{
72 if (aProperties.has("ParentWindow"))
73 aProperties.get("ParentWindow") >>= mxDialogParent;
74}
75
77{
78 SolarMutexGuard aGuard;
79
82 if (aDialog.run() == RET_OK)
83 return ui::dialogs::ExecutableDialogResults::OK;
84 return ui::dialogs::ExecutableDialogResults::CANCEL;
85}
86
88 const css::uno::Reference<css::lang::XComponent>& xDocument)
89{
90 mxSourceDocument = xDocument;
91}
92
93void SAL_CALL EPUBExportUIComponent::setDialogTitle(const OUString& aTitle) { setTitle(aTitle); }
94
96 const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener)
97{
98 SolarMutexGuard aSolarGuard;
99
100 if (!mxAsyncDialog)
101 {
102 if (mxSourceDocument.is())
104 = std::make_shared<EPUBExportDialog>(Application::GetFrameWeld(mxDialogParent),
106
107 if (!mxAsyncDialog)
108 return;
109 }
110
111 weld::DialogController::runAsync(mxAsyncDialog, [xListener](sal_Int32 nResponse) {
112 css::ui::dialogs::DialogClosedEvent aEvent;
113 aEvent.DialogResult = nResponse;
114 xListener->dialogClosed(aEvent);
115 });
116}
117
118extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
120 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
121{
122 return cppu::acquire(new EPUBExportUIComponent(pCtx));
123}
124
125} // namespace writerperfect
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
AnyEventRef aEvent
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
iterator find(const OUString &rKey)
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
virtual short run()
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
EPUB export options dialog.
EPUB export UI component implementation.
void SAL_CALL startExecuteModal(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener > &xListener) override
void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
sal_Int16 SAL_CALL execute() override
comphelper::SequenceAsHashMap maMediaDescriptor
The full set of property values.
css::uno::Reference< css::lang::XComponent > mxSourceDocument
css::uno::Reference< css::uno::XComponentContext > mxContext
UNO context.
css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() override
sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
std::shared_ptr< weld::DialogController > mxAsyncDialog
css::uno::Reference< css::awt::XWindow > mxDialogParent
void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDocument) override
EPUBExportUIComponent(css::uno::Reference< css::uno::XComponentContext > xContext)
comphelper::SequenceAsHashMap maFilterData
The filter data key.
void SAL_CALL setTitle(const OUString &rTitle) override
void SAL_CALL setDialogTitle(const OUString &aTitle) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString SAL_CALL getImplementationName() override
void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &rProperties) override
uno::Reference< uno::XComponentContext > mxContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Writer_EPUBExportUIComponent_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
unsigned char sal_Bool
RET_OK