Kaydet (Commit) e6746a00 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/42204Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst eed72e85
......@@ -17,7 +17,7 @@
-->
<node oor:name="EPUB" oor:op="replace">
<prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="UIComponent"><value>com.sun.star.comp.Writer.EPUBExportUIComponent</value></prop>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.EPUBExportFilter</value></prop>
<prop oor:name="UserData"><value>EPUB</value></prop>
<prop oor:name="UIName">
......
......@@ -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 \
......
/* -*- 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: */
/* -*- 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: */
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment