LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - fntcache.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 15 80.0 %
Date: 2012-12-27 Functions: 11 15 73.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 _FNTCACHE_HXX
      21             : #define _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 ViewShell;
      33             : class SwSubFont;
      34             : class MapMode;
      35             : 
      36          10 : class SwFntCache : public SwCache
      37             : {
      38             : public:
      39          10 :     inline SwFntCache() : SwCache(50
      40             : #ifdef DBG_UTIL
      41             :     , rtl::OString(RTL_CONSTASCII_STRINGPARAM("Global Font-Cache pFntCache"))
      42             : #endif
      43          10 :     ) {}
      44             : 
      45        2053 :     inline SwFntObj *First( ) { return (SwFntObj *)SwCache::First(); }
      46        1777 :     inline SwFntObj *Next( SwFntObj *pFntObj)
      47        1777 :         { return (SwFntObj *)SwCache::Next( (SwCacheObj *)pFntObj ); }
      48             :     void Flush();
      49             : };
      50             : 
      51             : // Font cache, global variable, created/destroyed in txtinit.cxx
      52             : extern SwFntCache *pFntCache;
      53             : extern SwFntObj *pLastFont;
      54             : extern sal_uInt8 *pMagicNo;
      55             : extern Color *pWaveCol;
      56             : 
      57             : class SwFntObj : public SwCacheObj
      58             : {
      59             :     friend class SwFntAccess;
      60             :     friend void _InitCore();
      61             :     friend void _FinitCore();
      62             : 
      63             :     Font aFont;
      64             :     Font *pScrFont;
      65             :     Font *pPrtFont;
      66             :     OutputDevice* pPrinter;
      67             :     sal_uInt16 nGuessedLeading;
      68             :     sal_uInt16 nExtLeading;
      69             :     sal_uInt16 nScrAscent;
      70             :     sal_uInt16 nPrtAscent;
      71             :     sal_uInt16 nScrHeight;
      72             :     sal_uInt16 nPrtHeight;
      73             :     sal_uInt16 nPropWidth;
      74             :     sal_uInt16 nZoom;
      75             :     sal_Bool bSymbol : 1;
      76             :     sal_Bool bPaintBlank : 1;
      77             : 
      78             :     static long nPixWidth;
      79             :     static MapMode *pPixMap;
      80             :     static OutputDevice *pPixOut;
      81             : 
      82             :     // SMARTTAGS
      83             :     void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, xub_StrLen nStart,
      84             :        xub_StrLen nWrLen, xub_StrLen nCnt, const sal_Bool bSwitchH2V, const sal_Bool bSwitchL2R,
      85             :        long nHalfSpace, long* pKernArray, const sal_Bool bBidiPor);
      86             : 
      87             : public:
      88         728 :     DECL_FIXEDMEMPOOL_NEWDEL(SwFntObj)
      89             : 
      90             :     SwFntObj( const SwSubFont &rFont, const void* pOwner,
      91             :               ViewShell *pSh );
      92             : 
      93             :     virtual ~SwFntObj();
      94             : 
      95         817 :     inline       Font *GetScrFont()     { return pScrFont; }
      96           0 :     inline       Font *GetFont()        { return &aFont; }
      97             :     inline const 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 ViewShell *pSh, const OutputDevice& rOut );
     103             :     sal_uInt16 GetFontHeight( const ViewShell *pSh, const OutputDevice& rOut );
     104             :     sal_uInt16 GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut );
     105             : 
     106             :     void GuessLeading( const ViewShell& rSh, const FontMetric& rMet );
     107             : 
     108             :     void SetDevFont( const ViewShell *pSh, OutputDevice& rOut );
     109           0 :     inline OutputDevice* GetPrt() const { return pPrinter; }
     110        6658 :     inline sal_uInt16   GetZoom() const { return nZoom; }
     111        5403 :     inline sal_uInt16   GetPropWidth() const { return nPropWidth; }
     112           0 :     inline sal_Bool     IsSymbol() const { return bSymbol; }
     113             : 
     114             :     void   DrawText( SwDrawTextInfo &rInf );
     115             :     Size  GetTextSize( SwDrawTextInfo &rInf );
     116             :     xub_StrLen GetCrsrOfst( SwDrawTextInfo &rInf );
     117             : 
     118             :     void CreateScrFont( const ViewShell& rSh, const OutputDevice& rOut );
     119             :     void CreatePrtFont( const OutputDevice& rOut );
     120             : };
     121             : 
     122       10361 : class SwFntAccess : public SwCacheAccess
     123             : {
     124             :     ViewShell *pShell;
     125             : protected:
     126             :     virtual SwCacheObj *NewObj( );
     127             : 
     128             : public:
     129             :     SwFntAccess( const void * &rMagic, sal_uInt16 &rIndex, const void *pOwner,
     130             :                  ViewShell *pShell,
     131             :                  sal_Bool bCheck = sal_False  );
     132       14492 :     inline SwFntObj* Get() { return (SwFntObj*) SwCacheAccess::Get(); };
     133             : };
     134             : 
     135             : #endif
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10