summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-07-06 14:57:29 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-08-01 08:30:39 +0200
commit32609b2a79790a7029bdc646f65b84a740afaba2 (patch)
tree5a80ae7f57ff9d260ddbfe6eacc7451e946df08e /desktop
parent7cbb10598d6b1a0f5e0d612eb6ffc1df28d086e4 (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> (cherry picked from commit 224160656d549b5b1891edd1b3cee251b754e69b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99880 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx34
1 files changed, 19 insertions, 15 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c010fcbfb2c7..eb9c42bf816d 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>
@@ -2136,6 +2137,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 ...
@@ -2567,25 +2577,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