From 224160656d549b5b1891edd1b3cee251b754e69b Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 6 Jul 2020 14:57:29 +0200 Subject: lok: set to export PDF bookmarks by default when save-as a PDF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ieb182b9a0d1f18a29a83ce369881578c06e217ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98211 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- desktop/source/lib/init.cxx | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'desktop') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 900e50f75c40..b69986d0ad01 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -2126,6 +2127,15 @@ void setLanguageAndLocale(OUString const & aLangISO) aLocalOptions.Commit(); } +void setFormatSpecificFilterData(OUString const & sFormat, comphelper::SequenceAsHashMap & rFilterDataMap) +{ + if (sFormat == "pdf") + { + // always export bookmarks, which is needed for annotations + rFilterDataMap["ExportBookmarks"] <<= true; + } +} + } // anonymous namespace // Wonder global state ... @@ -2556,25 +2566,19 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha aFilterOptions = comphelper::string::convertCommaSeparated(aFilteredOptionSeq); aSaveMediaDescriptor[MediaDescriptor::PROP_FILTEROPTIONS()] <<= aFilterOptions; - if(!watermarkText.isEmpty() || bFullSheetPreview) - { - uno::Sequence< beans::PropertyValue > aFilterData( static_cast(bFullSheetPreview) + static_cast(!watermarkText.isEmpty()) ); + comphelper::SequenceAsHashMap aFilterDataMap; - if (!watermarkText.isEmpty()) - { - aFilterData[ 0 ].Name = "TiledWatermark"; - aFilterData[ 0 ].Value <<= watermarkText; - } + setFormatSpecificFilterData(sFormat, aFilterDataMap); - if (bFullSheetPreview) - { - int nOptIndex = static_cast(!watermarkText.isEmpty()); + if (!watermarkText.isEmpty()) + aFilterDataMap["TiledWatermark"] <<= watermarkText; - aFilterData[ nOptIndex ].Name = "SinglePageSheets"; - aFilterData[ nOptIndex ].Value <<= true; - } + if (bFullSheetPreview) + aFilterDataMap["SinglePageSheets"] <<= true; - aSaveMediaDescriptor["FilterData"] <<= aFilterData; + if (!aFilterDataMap.empty()) + { + aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } // add interaction handler too -- cgit