LCOV - code coverage report
Current view: top level - sw/source/core/inc - fntcache.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 15 93.3 %
Date: 2014-11-03 Functions: 14 15 93.3 %
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_SW_SOURCE_CORE_INC_FNTCACHE_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX
      22             : 
      23             : #include <vcl/font.hxx>
      24             : #include <tools/mempool.hxx>
      25             : #include "swtypes.hxx"
      26             : #include "swcache.hxx"
      27             : 
      28             : class OutputDevice;
      29             : class FontMetric;
      30             : class SwFntObj;
      31             : class SwDrawTextInfo;
      32             : class SwViewShell;
      33             : class SwSubFont;
      34             : class MapMode;
      35             : class Point;
      36             : 
      37          90 : class SwFntCache : public SwCache
      38             : {
      39             : public:
      40          90 :     inline SwFntCache() : SwCache(50
      41             : #ifdef DBG_UTIL
      42             :     , OString(RTL_CONSTASCII_STRINGPARAM("Global Font-Cache pFntCache"))
      43             : #endif
      44          90 :     ) {}
      45             : 
      46      287956 :     inline SwFntObj *First( ) { return (SwFntObj *)SwCache::First(); }
      47      288343 :     inline SwFntObj *Next( SwFntObj *pFntObj)
      48      288343 :         { return (SwFntObj *)SwCache::Next( (SwCacheObj *)pFntObj ); }
      49             :     void Flush();
      50             : };
      51             : 
      52             : // Font cache, global variable, created/destroyed in txtinit.cxx
      53             : extern SwFntCache *pFntCache;
      54             : extern SwFntObj *pLastFont;
      55             : extern sal_uInt8 *pMagicNo;
      56             : extern Color *pWaveCol;
      57             : 
      58             : class SwFntObj : public SwCacheObj
      59             : {
      60             :     friend class SwFntAccess;
      61             :     friend void _InitCore();
      62             :     friend void _FinitCore();
      63             : 
      64             :     vcl::Font aFont;
      65             :     vcl::Font *pScrFont;
      66             :     vcl::Font *pPrtFont;
      67             :     OutputDevice* pPrinter;
      68             :     sal_uInt16 nGuessedLeading;
      69             :     sal_uInt16 nExtLeading;
      70             :     sal_uInt16 nScrAscent;
      71             :     sal_uInt16 nPrtAscent;
      72             :     sal_uInt16 nScrHeight;
      73             :     sal_uInt16 nPrtHeight;
      74             :     sal_uInt16 nPropWidth;
      75             :     sal_uInt16 nZoom;
      76             :     bool bSymbol : 1;
      77             :     bool bPaintBlank : 1;
      78             : 
      79             :     static long nPixWidth;
      80             :     static MapMode *pPixMap;
      81             :     static OutputDevice *pPixOut;
      82             : 
      83             :     void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, sal_Int32 nStart,
      84             :        sal_Int32 nWrLen, sal_Int32 nCnt, const bool bSwitchH2V, const bool bSwitchL2R,
      85             :        long nHalfSpace, long* pKernArray, const bool bBidiPor);
      86             : 
      87             : public:
      88       27204 :     DECL_FIXEDMEMPOOL_NEWDEL(SwFntObj)
      89             : 
      90             :     SwFntObj( const SwSubFont &rFont, const void* pOwner,
      91             :               SwViewShell const *pSh );
      92             : 
      93             :     virtual ~SwFntObj();
      94             : 
      95       60089 :     inline       vcl::Font *GetScrFont()     { return pScrFont; }
      96        8852 :     inline       vcl::Font& GetFont()        { return aFont; }
      97             :     inline const vcl::Font& GetFont() const  { return aFont; }
      98             : 
      99             :     inline sal_uInt16 GetGuessedLeading() const  { return nGuessedLeading; }
     100             :     inline sal_uInt16 GetExtLeading() const  { return nExtLeading; }
     101             : 
     102             :     sal_uInt16 GetFontAscent( const SwViewShell *pSh, const OutputDevice& rOut );
     103             :     sal_uInt16 GetFontHeight( const SwViewShell *pSh, const OutputDevice& rOut );
     104             :     sal_uInt16 GetFontLeading( const SwViewShell *pSh, const OutputDevice& rOut );
     105             : 
     106             :     void GuessLeading( const SwViewShell& rSh, const FontMetric& rMet );
     107             : 
     108             :     void SetDevFont( const SwViewShell *pSh, OutputDevice& rOut );
     109         440 :     inline OutputDevice* GetPrt() const { return pPrinter; }
     110     1023008 :     inline sal_uInt16   GetZoom() const { return nZoom; }
     111      980761 :     inline sal_uInt16   GetPropWidth() const { return nPropWidth; }
     112           0 :     inline bool     IsSymbol() const { return bSymbol; }
     113             : 
     114             :     void   DrawText( SwDrawTextInfo &rInf );
     115             :     /// determine the TextSize (of the printer)
     116             :     Size  GetTextSize( SwDrawTextInfo &rInf );
     117             :     sal_Int32 GetCrsrOfst( SwDrawTextInfo &rInf );
     118             : 
     119             :     void CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut );
     120             :     void CreatePrtFont( const OutputDevice& rOut );
     121             : };
     122             : 
     123     1903467 : class SwFntAccess : public SwCacheAccess
     124             : {
     125             :     SwViewShell const *pShell;
     126             : protected:
     127             :     virtual SwCacheObj *NewObj( ) SAL_OVERRIDE;
     128             : 
     129             : public:
     130             :     SwFntAccess( const void * &rMagic, sal_uInt16 &rIndex, const void *pOwner,
     131             :                  SwViewShell const *pShell,
     132             :                  bool bCheck = false  );
     133     2598583 :     inline SwFntObj* Get() { return (SwFntObj*) SwCacheAccess::Get(); };
     134             : };
     135             : 
     136             : #endif
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10