Kaydet (Commit) db4e8806 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

Convert FontRights to scoped enum

Change-Id: Ib46fe9dbe4b41bfe2e85e9171e8dcf7a96ccb483
Reviewed-on: https://gerrit.libreoffice.org/25717Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst e88107c0
......@@ -26,7 +26,7 @@ class VCL_DLLPUBLIC EmbeddedFontsHelper
{
public:
/// Specification of what kind of operation is allowed when embedding a font
enum FontRights
enum class FontRights
{
ViewingAllowed, ///< Font may be embedded for viewing the document (but not editing)
EditingAllowed ///< Font may be embedded for editing document (implies viewing)
......
......@@ -5865,7 +5865,7 @@ void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, FontFam
// Embed font if at least viewing is allowed (in which case the opening app must check
// the font license rights too and open either read-only or not use the font for editing).
OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, encoding,
EmbeddedFontsHelper::ViewingAllowed );
EmbeddedFontsHelper::FontRights::ViewingAllowed );
if( fontUrl.isEmpty())
return;
// TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS
......
......@@ -143,7 +143,7 @@ bool EmbeddedFontsHelper::addEmbeddedFont( const uno::Reference< io::XInputStrea
}
if( !eot )
{
sufficientFontRights = sufficientTTFRights( &fontData.front(), fontData.size(), EditingAllowed );
sufficientFontRights = sufficientTTFRights( &fontData.front(), fontData.size(), FontRights::EditingAllowed );
}
if( !sufficientFontRights )
{
......@@ -197,10 +197,10 @@ bool EmbeddedFontsHelper::sufficientTTFRights( const void* data, long size, Font
int copyright = info.typeFlags & TYPEFLAG_COPYRIGHT_MASK;
switch( rights )
{
case ViewingAllowed:
case FontRights::ViewingAllowed:
// Embedding not restricted completely.
return ( copyright & 0x02 ) != 0x02;
case EditingAllowed:
case FontRights::EditingAllowed:
// Font is installable or editable.
return copyright == 0 || ( copyright & 0x08 );
}
......
......@@ -306,7 +306,7 @@ void XMLFontAutoStylePool::exportXML()
// the font license rights too and open either read-only or not use the font for editing).
OUString fileUrl = EmbeddedFontsHelper::fontFileUrl( pEntry->GetFamilyName(), pEntry->GetFamily(),
italic[ j ], weight[ j ], pEntry->GetPitch(), pEntry->GetEncoding(),
EmbeddedFontsHelper::ViewingAllowed );
EmbeddedFontsHelper::FontRights::ViewingAllowed );
if( fileUrl.isEmpty())
continue;
if( !fontFilesMap.count( fileUrl ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment