summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/guisaveas.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/doc/guisaveas.cxx')
-rw-r--r--sfx2/source/doc/guisaveas.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 6a9012f63c1f..74a753d8da5c 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -724,6 +724,8 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
::comphelper::SequenceAsHashMap aDefFiltPropsHM = GetDocServiceDefaultFilterCheckFlags( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT, SfxFilterFlags::NONE );
SfxFilterFlags nDefFiltFlags = static_cast<SfxFilterFlags>(aDefFiltPropsHM.getUnpackedValueOrDefault("Flags", sal_Int32(0) ));
+ bool bAsk = false;
+
// if the old filter is not acceptable
// and there is no default filter or it is not acceptable for requested parameters then proceed with saveAs
if ( ( aFiltPropsHM.empty() || !( nFiltFlags & SfxFilterFlags::EXPORT ) )
@@ -740,6 +742,38 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
&& !aDefFiltPropsHM.empty()
&& ( nDefFiltFlags & SfxFilterFlags::EXPORT ) && !( nDefFiltFlags & SfxFilterFlags::INTERNAL ))
{
+ bAsk = true;
+ }
+
+ // check if EncryptionData supports this output format
+ {
+ OUString aSupportedFilters;
+ const ::comphelper::SequenceAsHashMap& rDocumentProperties = GetDocProps();
+ const css::uno::Sequence<css::beans::NamedValue> aEncryptionData = rDocumentProperties.getUnpackedValueOrDefault("EncryptionData", css::uno::Sequence<css::beans::NamedValue>());
+ if (aEncryptionData != css::uno::Sequence<css::beans::NamedValue>())
+ {
+ for (const css::beans::NamedValue& aNamedValue : aEncryptionData)
+ {
+ if (aNamedValue.Name == "SupportedFilters")
+ {
+ aNamedValue.Value >>= aSupportedFilters;
+ }
+ }
+ }
+
+ // if 'SupportedFilters' is empty assume that all filters are supported.
+ if (!aSupportedFilters.isEmpty())
+ {
+ const OUString aSelectedFilter = aFiltPropsHM.getUnpackedValueOrDefault("UIName", OUString());
+
+ aSupportedFilters = ";" + aSupportedFilters + ";";
+ const OUString aSearchToken = ";" + aSelectedFilter + ";";
+ bAsk = (aSupportedFilters.indexOf(aSearchToken) < 0);
+ }
+ }
+
+ if (bAsk)
+ {
// the default filter is acceptable and the old filter is alien one
// so ask to make a saveAs operation
const OUString aUIName = aFiltPropsHM.getUnpackedValueOrDefault("UIName", OUString() );