include/vcl/embeddedfontshelper.hxx | 2 +- include/vcl/helper.hxx | 9 ++++++--- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- vcl/source/gdi/embeddedfontshelper.cxx | 6 +++--- vcl/unx/generic/fontmanager/fontcache.cxx | 2 +- vcl/unx/generic/fontmanager/helper.cxx | 18 +++++++++--------- xmloff/source/style/XMLFontAutoStylePool.cxx | 2 +- 7 files changed, 22 insertions(+), 19 deletions(-)
New commits: commit dfad705d5f0c05cbebb4155d69212b35c58a22c0 Author: Noel Grandin <[email protected]> Date: Wed Jun 1 11:58:20 2016 +0200 Convert whichOfficePath to scoped enum Change-Id: If31c00ac8820e6dfce5047e997c35f5e1878db6f Reviewed-on: https://gerrit.libreoffice.org/25763 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/helper.hxx b/include/vcl/helper.hxx index 34271ca..dcdcd92 100644 --- a/include/vcl/helper.hxx +++ b/include/vcl/helper.hxx @@ -31,7 +31,9 @@ // forwards namespace osl { class File; } -namespace psp { +namespace psp +{ + typedef int fontID; void VCL_DLLPUBLIC getPrinterPathList( std::list< OUString >& rPathList, const char* pSubDir ); @@ -49,10 +51,11 @@ void VCL_DLLPUBLIC normPath( OString& rPath ); // rOrgPath will be subject to normPath void VCL_DLLPUBLIC splitPath( OString& rOrgPath, OString& rDir, OString& rBase ); -enum whichOfficePath { InstallationRootPath, UserPath, ConfigPath }; +enum class whichOfficePath { InstallationRootPath, UserPath, ConfigPath }; // note: gcc 3.4.1 warns about visibility if we retunr a const OUString& here // seems to be a bug in gcc, now we return an object instead of a reference -OUString VCL_DLLPUBLIC getOfficePath( enum whichOfficePath ePath ); +OUString VCL_DLLPUBLIC getOfficePath( whichOfficePath ePath ); + } // namespace diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index 25526d8..a4a1550 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -50,7 +50,7 @@ using namespace utl; FontCache::FontCache() { m_bDoFlush = false; - m_aCacheFile = getOfficePath( UserPath ); + m_aCacheFile = getOfficePath( whichOfficePath::UserPath ); if( !m_aCacheFile.isEmpty() ) { m_aCacheFile += "/user/psprint/pspfontcache"; diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx index a8c35b8..8b7c2ed 100644 --- a/vcl/unx/generic/fontmanager/helper.cxx +++ b/vcl/unx/generic/fontmanager/helper.cxx @@ -37,7 +37,7 @@ using ::rtl::Bootstrap; namespace psp { -OUString getOfficePath( enum whichOfficePath ePath ) +OUString getOfficePath( whichOfficePath ePath ) { static OUString aInstallationRootPath; static OUString aUserPath; @@ -87,9 +87,9 @@ OUString getOfficePath( enum whichOfficePath ePath ) switch( ePath ) { - case ConfigPath: return aConfigPath; - case InstallationRootPath: return aInstallationRootPath; - case UserPath: return aUserPath; + case whichOfficePath::ConfigPath: return aConfigPath; + case whichOfficePath::InstallationRootPath: return aInstallationRootPath; + case whichOfficePath::UserPath: return aUserPath; } return aEmpty; } @@ -116,7 +116,7 @@ void psp::getPrinterPathList( std::list< OUString >& rPathList, const char* pSub OUStringBuffer aPathBuffer( 256 ); // append net path - aPathBuffer.append( getOfficePath( psp::InstallationRootPath ) ); + aPathBuffer.append( getOfficePath( whichOfficePath::InstallationRootPath ) ); if( !aPathBuffer.isEmpty() ) { aPathBuffer.append( "/" LIBO_SHARE_FOLDER "/psprint" ); @@ -128,7 +128,7 @@ void psp::getPrinterPathList( std::list< OUString >& rPathList, const char* pSub rPathList.push_back( aPathBuffer.makeStringAndClear() ); } // append user path - aPathBuffer.append( getOfficePath( psp::UserPath ) ); + aPathBuffer.append( getOfficePath( whichOfficePath::UserPath ) ); if( !aPathBuffer.isEmpty() ) { aPathBuffer.append( "/user/psprint" ); @@ -193,9 +193,9 @@ OUString psp::getFontPath() { OUStringBuffer aPathBuffer( 512 ); - OUString aConfigPath( getOfficePath( psp::ConfigPath ) ); - OUString aInstallationRootPath( getOfficePath( psp::InstallationRootPath ) ); - OUString aUserPath( getOfficePath( psp::UserPath ) ); + OUString aConfigPath( getOfficePath( whichOfficePath::ConfigPath ) ); + OUString aInstallationRootPath( getOfficePath( whichOfficePath::InstallationRootPath ) ); + OUString aUserPath( getOfficePath( whichOfficePath::UserPath ) ); if( !aConfigPath.isEmpty() ) { // #i53530# Path from CustomDataUrl will completely commit db4e8806aace921ca1348c1bc0949a7e554f34ac Author: Noel Grandin <[email protected]> Date: Tue May 31 13:58:24 2016 +0200 Convert FontRights to scoped enum Change-Id: Ib46fe9dbe4b41bfe2e85e9171e8dcf7a96ccb483 Reviewed-on: https://gerrit.libreoffice.org/25717 Tested-by: Jenkins <[email protected]> Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/embeddedfontshelper.hxx b/include/vcl/embeddedfontshelper.hxx index e986e50..7361195 100644 --- a/include/vcl/embeddedfontshelper.hxx +++ b/include/vcl/embeddedfontshelper.hxx @@ -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) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7e66549..6dc190e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -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 diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index c9f4a5c..b39136d 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -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 ); } diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx index 13bdfe8..6b4b5a4 100644 --- a/xmloff/source/style/XMLFontAutoStylePool.cxx +++ b/xmloff/source/style/XMLFontAutoStylePool.cxx @@ -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 )) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
