LCOV - code coverage report
Current view: top level - vcl/inc - fontcache.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 3 100.0 %
Date: 2014-11-03 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_FONTCACHE_HXX
      21             : #define INCLUDED_VCL_INC_FONTCACHE_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <vcl/dllapi.h>
      25             : #include <boost/unordered_map.hpp>
      26             : 
      27             : #include "fontmanager.hxx"
      28             : 
      29             : namespace psp
      30             : {
      31             : 
      32             : class VCL_PLUGIN_PUBLIC FontCache
      33             : {
      34             :     struct FontDir;
      35             :     friend struct FontDir;
      36             :     struct FontFile;
      37             :     friend struct FontFile;
      38             : 
      39             :     typedef std::list< PrintFontManager::PrintFont* > FontCacheEntry;
      40       93024 :     struct FontFile
      41             :     {
      42             :         FontCacheEntry      m_aEntry;
      43             :     };
      44             : 
      45             :     typedef boost::unordered_map< OString, FontFile, OStringHash > FontDirMap;
      46        1530 :     struct FontDir
      47             :     {
      48             :         sal_Int64   m_nTimestamp;
      49             :         bool        m_bNoFiles;
      50             :         bool        m_bUserOverrideOnly;
      51             :         FontDirMap  m_aEntries;
      52             : 
      53        1530 :         FontDir() : m_nTimestamp(0), m_bNoFiles(false), m_bUserOverrideOnly( false ) {}
      54             :     };
      55             : 
      56             :     typedef boost::unordered_map< int, FontDir > FontCacheData;
      57             :     FontCacheData   m_aCache;
      58             :     OUString        m_aCacheFile;
      59             :     bool            m_bDoFlush;
      60             : 
      61             :     void read();
      62             :     void clearCache();
      63             : 
      64             :     void copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFontManager::PrintFont* pTo ) const;
      65             :     bool equalsPrintFont( const PrintFontManager::PrintFont* pLeft, PrintFontManager::PrintFont* pRight ) const;
      66             :     PrintFontManager::PrintFont* clonePrintFont( const PrintFontManager::PrintFont* pFont ) const;
      67             : 
      68             :     void createCacheDir( int nDirID );
      69             : public:
      70             :     FontCache();
      71             :     ~FontCache();
      72             : 
      73             :     bool getFontCacheFile( int nDirID, const OString& rFile, std::list< PrintFontManager::PrintFont* >& rNewFonts ) const;
      74             :     void updateFontCacheEntry( const PrintFontManager::PrintFont*, bool bFlush );
      75             : 
      76             :     // returns false for non cached directory
      77             :     // a cached but empty directory will return true but not append anything
      78             :     bool listDirectory( const OString& rDir, std::list< PrintFontManager::PrintFont* >& rNewFonts ) const;
      79             :     // returns true for directoris that contain only user overridden fonts
      80             :     bool scanAdditionalFiles( const OString& rDir );
      81             : 
      82             :     void flush();
      83             : };
      84             : 
      85             : } // namespace psp
      86             : 
      87             : #endif // INCLUDED_VCL_INC_FONTCACHE_HXX
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10