diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-07-06 14:57:29 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-07-08 20:55:15 +0200 |
commit | 224160656d549b5b1891edd1b3cee251b754e69b (patch) | |
tree | 056dcb5709ef1651fd20ebca792579a36f19e9b1 | |
parent | bc8016b81c2c609711c26af1f85da327cf30a4ff (diff) |
lok: set to export PDF bookmarks by default when save-as a PDF
Change-Id: Ieb182b9a0d1f18a29a83ce369881578c06e217ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98211
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | desktop/source/lib/init.cxx | 34 |
1 files changed, 19 insertions, 15 deletions
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 <comphelper/propertysequence.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/threadpool.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -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<int>(bFullSheetPreview) + static_cast<int>(!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<int>(!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 |