diff --git a/writerperfect/Library_wpftwriter.mk b/writerperfect/Library_wpftwriter.mk index 640af58f4c46..6ade29d59202 100644 --- a/writerperfect/Library_wpftwriter.mk +++ b/writerperfect/Library_wpftwriter.mk @@ -35,6 +35,10 @@ $(eval $(call gb_Library_use_sdk_api,wpftwriter)) $(eval $(call gb_Library_use_common_precompiled_header,wpftwriter)) +$(eval $(call gb_Library_use_custom_headers,wpftwriter,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_use_libraries,wpftwriter,\ comphelper \ cppu \ diff --git a/writerperfect/source/writer/EPUBExportFilter.cxx b/writerperfect/source/writer/EPUBExportFilter.cxx index a2dfadf6e141..bedef1f8dc0c 100644 --- a/writerperfect/source/writer/EPUBExportFilter.cxx +++ b/writerperfect/source/writer/EPUBExportFilter.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -128,7 +129,22 @@ sal_Bool EPUBExportFilter::filter(const uno::Sequence& rDe xExporter->setSourceDocument(mxSourceDocument); uno::Reference xFilter(xInitialization, uno::UNO_QUERY); - return xFilter->filter(rDescriptor); + // tdf#119112: when svg format is used, the image appears twice in the generated epub + // it's because by default LO also insert replacement image since svg is a vector format + // but for epub we shouldn't use this mechanism. + // So retrieve the old value of AddReplacementImages option and set it to false temporarily + bool bOldValue = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get(); + + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(false, xChanges); + xChanges->commit(); + + bool bReturn = xFilter->filter(rDescriptor); + + officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(bOldValue, xChanges); + xChanges->commit(); + + return bReturn; } void EPUBExportFilter::CreateMetafiles(std::vector& rPageMetafiles)