comphelper: initial SfxFilterFlags::SUPPORTSSIGNING

Currently digital signatures can be made only on OWN formats. Add a new
flag that can be used to mark filters (only DOCX as a start) which could
also support signing and fix the first place that assumes that only OWN
formats support signing.

Change-Id: If9fbf956b765d75838986762e4d4063a9e8c0b5e
This commit is contained in:
Miklos Vajna
2016-01-12 10:34:46 +01:00
parent 7a6ce0d408
commit dd615af367
6 changed files with 13 additions and 3 deletions

View File

@ -120,6 +120,7 @@
#define FLAGNAME_TEMPLATE "TEMPLATE"
#define FLAGNAME_TEMPLATEPATH "TEMPLATEPATH"
#define FLAGNAME_COMBINED "COMBINED"
#define FLAGNAME_SUPPORTSSIGNING "SUPPORTSSIGNING"
/** @short some uno service names.
*/

View File

@ -1935,6 +1935,7 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(SfxF
if (nFlags & SfxFilterFlags::TEMPLATE ) lFlagNames.push_back(FLAGNAME_TEMPLATE );
if (nFlags & SfxFilterFlags::TEMPLATEPATH ) lFlagNames.push_back(FLAGNAME_TEMPLATEPATH );
if (nFlags & SfxFilterFlags::COMBINED ) lFlagNames.push_back(FLAGNAME_COMBINED );
if (nFlags & SfxFilterFlags::SUPPORTSSIGNING) lFlagNames.push_back(FLAGNAME_SUPPORTSSIGNING);
return comphelper::containerToSequence(lFlagNames);
}
@ -2025,6 +2026,11 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ
nField |= SfxFilterFlags::STARTPRESENTATION;
continue;
}
if (pNames[i] == FLAGNAME_SUPPORTSSIGNING)
{
nField |= SfxFilterFlags::SUPPORTSSIGNING;
continue;
}
if (pNames[i] == FLAGNAME_READONLY)
{
nField |= SfxFilterFlags::OPENREADONLY;

View File

@ -16,7 +16,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<node oor:name="MS Word 2007 XML" oor:op="replace">
<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY</value></prop>
<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value>OXML</value></prop>

View File

@ -112,10 +112,11 @@ enum class SfxFilterFlags
PASSWORDTOMODIFY = 0x02000000L,
PREFERED = 0x10000000L,
STARTPRESENTATION = 0x20000000L,
SUPPORTSSIGNING = 0x40000000L,
};
namespace o3tl
{
template<> struct typed_flags<SfxFilterFlags> : is_typed_flags<SfxFilterFlags, 0x339f157fL> {};
template<> struct typed_flags<SfxFilterFlags> : is_typed_flags<SfxFilterFlags, 0x739f157fL> {};
}
#define SFX_FILTER_NOTINSTALLED (SfxFilterFlags::MUSTINSTALL | SfxFilterFlags::CONSULTSERVICE)

View File

@ -76,6 +76,8 @@ public:
bool IsAllowedAsTemplate() const { return bool(nFormatType & SfxFilterFlags::TEMPLATE); }
bool IsOwnFormat() const { return bool(nFormatType & SfxFilterFlags::OWN); }
/// If the filter supports digital signatures.
bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); }
bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); }
bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); }
bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); }

View File

@ -1379,7 +1379,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
if ( GetMedium()
&& GetMedium()->GetFilter()
&& !GetMedium()->GetName().isEmpty()
&& ( !GetMedium()->GetFilter()->IsOwnFormat()
&& ( (!GetMedium()->GetFilter()->IsOwnFormat() && !GetMedium()->GetFilter()->GetSupportsSigning())
|| !GetMedium()->HasStorage_Impl()
)
)