diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-12 14:07:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-09-12 17:16:44 +0200 |
commit | e6746a005419235d20074d696a1f8fadbda0a003 (patch) | |
tree | b542e17d38900431835e06b358f59fc7775754b7 /writerperfect | |
parent | eed72e853d8800917ffd5cdc151e7103c49c9dac (diff) |
EPUB export: initial UI component
EPUBExportUIComponent::execute() still needs to launch an actual dialog,
but otherwise it has enough functionality that only tweaking
maFilterData is necessary in the UNO component to pass custom filter
options to the exporter.
Change-Id: I95af024f5babd66a5aa0b446550f4f0fec45ef43
Reviewed-on: https://gerrit.libreoffice.org/42204
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/Library_wpftwriter.mk | 1 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportUIComponent.cxx | 83 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportUIComponent.hxx | 61 | ||||
-rw-r--r-- | writerperfect/source/writer/wpftwriter.component | 4 |
4 files changed, 149 insertions, 0 deletions
diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 826ffe600e12..94ad9a868796 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -69,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\ writerperfect/source/writer/AbiWordImportFilter \ writerperfect/source/writer/EBookImportFilter \ writerperfect/source/writer/EPUBExportFilter \ + writerperfect/source/writer/EPUBExportUIComponent \ writerperfect/source/writer/EPUBPackage \ writerperfect/source/writer/MSWorksImportFilter \ writerperfect/source/writer/MWAWImportFilter \ diff --git a/writerperfect/source/writer/EPUBExportUIComponent.cxx b/writerperfect/source/writer/EPUBExportUIComponent.cxx new file mode 100644 index 000000000000..40ecea56262d --- /dev/null +++ b/writerperfect/source/writer/EPUBExportUIComponent.cxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "EPUBExportUIComponent.hxx" + +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> + +#include <comphelper/sequence.hxx> +#include <cppuhelper/supportsservice.hxx> + +using namespace com::sun::star; + +namespace writerperfect +{ + +EPUBExportUIComponent::EPUBExportUIComponent(const uno::Reference<uno::XComponentContext> &/*xContext*/) +{ +} + +uno::Sequence<beans::PropertyValue> EPUBExportUIComponent::getPropertyValues() +{ + maMediaDescriptor["FilterData"] <<= maFilterData.getAsConstPropertyValueList(); + return maMediaDescriptor.getAsConstPropertyValueList(); +} + +void EPUBExportUIComponent::setPropertyValues(const uno::Sequence<beans::PropertyValue> &rProperties) +{ + maMediaDescriptor.clear(); + maMediaDescriptor << rProperties; + auto it = maMediaDescriptor.find("FilterData"); + if (it != maMediaDescriptor.end()) + { + uno::Sequence<beans::PropertyValue> aFilterData; + if (it->second >>= aFilterData) + { + maFilterData.clear(); + maFilterData << aFilterData; + } + } +} + +OUString EPUBExportUIComponent::getImplementationName() +{ + return OUString("com.sun.star.comp.Writer.EPUBExportUIComponent"); +} + +sal_Bool EPUBExportUIComponent::supportsService(const OUString &rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence<OUString> EPUBExportUIComponent::getSupportedServiceNames() +{ + uno::Sequence<OUString> aRet = + { + OUString("com.sun.star.ui.dialogs.FilterOptionsDialog") + }; + return aRet; +} + +void EPUBExportUIComponent::setTitle(const OUString &/*rTitle*/) +{ +} + +sal_Int16 EPUBExportUIComponent::execute() +{ + return ui::dialogs::ExecutableDialogResults::OK; +} + +extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface *SAL_CALL com_sun_star_comp_Writer_EPUBExportUIComponent_get_implementation(uno::XComponentContext *pCtx, uno::Sequence<uno::Any> const &) +{ + return cppu::acquire(new EPUBExportUIComponent(pCtx)); +} + +} // namespace writerperfect + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/EPUBExportUIComponent.hxx b/writerperfect/source/writer/EPUBExportUIComponent.hxx new file mode 100644 index 000000000000..f20adfd2d997 --- /dev/null +++ b/writerperfect/source/writer/EPUBExportUIComponent.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTUICOMPONENT_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTUICOMPONENT_HXX + +#include <vector> + +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <comphelper/sequenceashashmap.hxx> +#include <cppuhelper/implbase.hxx> + +namespace writerperfect +{ + +/// EPUB export UI component implementation. +class EPUBExportUIComponent : public cppu::WeakImplHelper + < + css::beans::XPropertyAccess, + css::lang::XServiceInfo, + css::ui::dialogs::XExecutableDialog + > +{ +public: + EPUBExportUIComponent(const css::uno::Reference<css::uno::XComponentContext> &xContext); + + // XPropertyAccess + css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getPropertyValues() override; + void SAL_CALL setPropertyValues(const css::uno::Sequence<css::beans::PropertyValue> &rProperties) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override; + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XExecutableDialog + void SAL_CALL setTitle(const OUString &rTitle) override; + sal_Int16 SAL_CALL execute() override; + +private: + /// The full set of property values. + comphelper::SequenceAsHashMap maMediaDescriptor; + /// The filter data key. + comphelper::SequenceAsHashMap maFilterData; +}; + +} // namespace writerperfect + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/writer/wpftwriter.component b/writerperfect/source/writer/wpftwriter.component index 5e68de56cfd2..8ab436634052 100644 --- a/writerperfect/source/writer/wpftwriter.component +++ b/writerperfect/source/writer/wpftwriter.component @@ -57,4 +57,8 @@ constructor="com_sun_star_comp_Writer_EPUBExportFilter_get_implementation"> <service name="com.sun.star.document.ExportFilter"/> </implementation> + <implementation name="com.sun.star.comp.Writer.EPUBExportUIComponent" + constructor="com_sun_star_comp_Writer_EPUBExportUIComponent_get_implementation"> + <service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/> + </implementation> </component> |