LCOV - code coverage report
Current view: top level - vcl/inc - outdev.h (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 19 73.7 %
Date: 2014-11-03 Functions: 14 25 56.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_OUTDEV_H
      21             : #define INCLUDED_VCL_INC_OUTDEV_H
      22             : 
      23             : #include <list>
      24             : #include <set>
      25             : #include <vector>
      26             : 
      27             : #include <tools/gen.hxx>
      28             : 
      29             : #include "outfont.hxx"
      30             : #include "PhysicalFontFace.hxx"
      31             : 
      32             : class Size;
      33             : namespace vcl { class Font; }
      34             : class VirtualDevice;
      35             : class ImplGetDevFontList;
      36             : class GetDevSizeList;
      37             : class PhysicalFontCollection;
      38             : // an ImplGetDevFontList is created by an PhysicalFontCollection
      39             : // it becomes invalid when original PhysicalFontCollection is modified
      40        7999 : class ImplGetDevFontList
      41             : {
      42             : private:
      43             :     std::vector<PhysicalFontFace*> maDevFontVector;
      44             : 
      45             : public:
      46        8012 :                         ImplGetDevFontList()        { maDevFontVector.reserve(1024); }
      47     1152576 :     void                Add( PhysicalFontFace* pFace )  { maDevFontVector.push_back( pFace ); }
      48     1674144 :     PhysicalFontFace*   Get( int nIndex ) const     { return maDevFontVector[ nIndex ]; }
      49     1686012 :     int                 Count() const               { return maDevFontVector.size(); }
      50             : };
      51             : 
      52        2058 : class ImplGetDevSizeList
      53             : {
      54             : private:
      55             :     OUString            maFontName;
      56             :     std::vector<int>    maSizeList;
      57             : 
      58             : public:
      59        2058 :                         ImplGetDevSizeList( const OUString& rFontName )
      60        2058 :                         : maFontName( rFontName ) { maSizeList.reserve( 32 ); }
      61           0 :     void                Add( int nHeight )      { maSizeList.push_back( nHeight ); }
      62        2058 :     int                 Count() const           { return maSizeList.size(); }
      63           0 :     int                 Get( int nIndex ) const { return maSizeList[ nIndex ]; }
      64             :     const OUString&     GetFontName() const     { return maFontName; }
      65             : };
      66             : 
      67             : // nowadays these substitutions are needed for backward compatibility and tight platform integration:
      68             : // - substitutions from configuration entries (Tools->Options->FontReplacement and/or fontconfig)
      69             : // - device specific substitutions (e.g. for PS printer builtin fonts)
      70             : // - substitutions for missing fonts defined by configuration entries (generic and/or platform dependent fallbacks)
      71             : // - substitutions for missing fonts defined by multi-token fontnames (e.g. fontname="SpecialFont;FallbackA;FallbackB")
      72             : // - substitutions for incomplete fonts (implicit, generic, EUDC and/or platform dependent fallbacks)
      73             : // - substitutions for missing symbol fonts by translating code points into other symbol fonts
      74             : 
      75         306 : class ImplFontSubstitution
      76             : {
      77             :     // TODO: there is more commonality between the different substitutions
      78             : protected:
      79         612 :     virtual ~ImplFontSubstitution() {}
      80             : };
      81             : 
      82             : // ImplDirectFontSubstitution is for Tools->Options->FontReplacement and PsPrinter substitutions
      83             : // The clss is just a simple port of the unmaintainable manual-linked-list based mechanism
      84             : // TODO: get rid of this class when the Tools->Options->FontReplacement tabpage is gone for good
      85             : 
      86           0 : struct ImplFontSubstEntry
      87             : {
      88             :     OUString                  maName;
      89             :     OUString                  maReplaceName;
      90             :     OUString                  maSearchName;
      91             :     OUString                  maSearchReplaceName;
      92             :     sal_uInt16                mnFlags;
      93             : 
      94             :     ImplFontSubstEntry(  const OUString& rFontName, const OUString& rSubstFontName, sal_uInt16 nSubstFlags );
      95             : };
      96             : 
      97           0 : class ImplDirectFontSubstitution
      98             : :   public ImplFontSubstitution
      99             : {
     100             : private:
     101             :     typedef std::list<ImplFontSubstEntry> FontSubstList;
     102             :     FontSubstList maFontSubstList;
     103             : public:
     104             :     void    AddFontSubstitute( const OUString& rFontName, const OUString& rSubstName, sal_uInt16 nFlags );
     105             :     void    RemoveFontSubstitute( int nIndex );
     106           0 :     int     GetFontSubstituteCount() const { return maFontSubstList.size(); };
     107             :     bool    Empty() const { return maFontSubstList.empty(); }
     108             :     void    Clear() { maFontSubstList.clear(); }
     109             : 
     110             :     bool    FindFontSubstitute( OUString& rSubstName, const OUString& rFontName, sal_uInt16 nFlags ) const;
     111             : };
     112             : 
     113             : // PreMatchFontSubstitution
     114             : // abstracts the concept of a configured font substitution
     115             : // before the availability of the originally selected font has been checked
     116         612 : class ImplPreMatchFontSubstitution
     117             : :   public ImplFontSubstitution
     118             : {
     119             : public:
     120             :     virtual bool FindFontSubstitute( FontSelectPattern& ) const = 0;
     121             : };
     122             : 
     123             : // ImplGlyphFallbackFontSubstitution
     124             : // abstracts the concept of finding the best font to support an incomplete font
     125         306 : class ImplGlyphFallbackFontSubstitution
     126             : :   public ImplFontSubstitution
     127             : {
     128             : public:
     129             :     virtual bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingCodes ) const = 0;
     130             : };
     131             : 
     132             : // TODO: closely couple with PhysicalFontCollection
     133             : 
     134             : class ImplFontCache
     135             : {
     136             : private:
     137             :     ImplFontEntry*      mpFirstEntry;
     138             :     int                 mnRef0Count;    // number of unreferenced ImplFontEntries
     139             : 
     140             :     // cache of recently used font instances
     141             :     struct IFSD_Equal { bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; };
     142             :     struct IFSD_Hash { size_t operator()( const FontSelectPattern& ) const; };
     143             :     typedef ::boost::unordered_map<FontSelectPattern,ImplFontEntry*,IFSD_Hash,IFSD_Equal > FontInstanceList;
     144             :     FontInstanceList    maFontInstanceList;
     145             : 
     146             : public:
     147             :                         ImplFontCache();
     148             :                         ~ImplFontCache();
     149             : 
     150             :     ImplFontEntry*      GetFontEntry( PhysicalFontCollection*,
     151             :                              const vcl::Font&, const Size& rPixelSize, float fExactHeight);
     152             :     ImplFontEntry*      GetFontEntry( PhysicalFontCollection*, FontSelectPattern& );
     153             :     ImplFontEntry*      GetGlyphFallbackFont( PhysicalFontCollection*, FontSelectPattern&,
     154             :                             int nFallbackLevel, OUString& rMissingCodes );
     155             :     void                Release( ImplFontEntry* );
     156             :     void                Invalidate();
     157             : };
     158             : 
     159             : namespace vcl { struct ControlLayoutData; }
     160             : // #i75163#
     161             : namespace basegfx { class B2DHomMatrix; }
     162             : 
     163      643783 : struct ImplOutDevData
     164             : {
     165             :     VirtualDevice*              mpRotateDev;
     166             :     vcl::ControlLayoutData*     mpRecordLayout;
     167             :     Rectangle                   maRecordRect;
     168             : 
     169             :     // #i75163#
     170             :     basegfx::B2DHomMatrix*      mpViewTransform;
     171             :     basegfx::B2DHomMatrix*      mpInverseViewTransform;
     172             : };
     173             : 
     174             : void ImplFontSubstitute( OUString& rFontName );
     175             : 
     176             : #endif // INCLUDED_VCL_INC_OUTDEV_H
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10