LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - fontcfg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 23 4.3 %
Date: 2012-12-27 Functions: 1 13 7.7 %
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             : #ifndef _FONTCFG_HXX
      20             : #define _FONTCFG_HXX
      21             : 
      22             : #include <unotools/configitem.hxx>
      23             : #include <tools/string.hxx>
      24             : #include <i18npool/lang.h>
      25             : #include <osl/diagnose.h>
      26             : #include "swdllapi.h"
      27             : 
      28             : #define FONT_STANDARD       0
      29             : #define FONT_OUTLINE        1
      30             : #define FONT_LIST           2
      31             : #define FONT_CAPTION        3
      32             : #define FONT_INDEX          4
      33             : #define FONT_STANDARD_CJK   5
      34             : #define FONT_OUTLINE_CJK    6
      35             : #define FONT_LIST_CJK       7
      36             : #define FONT_CAPTION_CJK    8
      37             : #define FONT_INDEX_CJK      9
      38             : #define FONT_STANDARD_CTL   10
      39             : #define FONT_OUTLINE_CTL    11
      40             : #define FONT_LIST_CTL       12
      41             : #define FONT_CAPTION_CTL    13
      42             : #define FONT_INDEX_CTL      14
      43             : #define DEF_FONT_COUNT      15
      44             : 
      45             : #define FONT_PER_GROUP      5
      46             : 
      47             : #define FONT_GROUP_DEFAULT  0
      48             : #define FONT_GROUP_CJK      1
      49             : #define FONT_GROUP_CTL      2
      50             : 
      51             : //pt-size of fonts
      52             : #define FONTSIZE_DEFAULT            240
      53             : #define FONTSIZE_CJK_DEFAULT        210
      54             : #define FONTSIZE_OUTLINE            280
      55             : 
      56             : 
      57             : class SW_DLLPUBLIC SwStdFontConfig : public utl::ConfigItem
      58             : {
      59             :     String      sDefaultFonts[DEF_FONT_COUNT];
      60             :     sal_Int32   nDefaultFontHeight[DEF_FONT_COUNT];
      61             : 
      62             :     SW_DLLPRIVATE com::sun::star::uno::Sequence<rtl::OUString>    GetPropertyNames();
      63             : 
      64           0 :     void ChangeString(sal_uInt16 nFontType, const String& rSet)
      65             :         {
      66           0 :             if(sDefaultFonts[nFontType] != rSet)
      67             :             {
      68           0 :                 SetModified();
      69           0 :                 sDefaultFonts[nFontType] = rSet;
      70             :             }
      71           0 :         }
      72             : 
      73             :     void ChangeInt( sal_uInt16 nFontType, sal_Int32 nHeight );
      74             : 
      75             : public:
      76             :     SwStdFontConfig();
      77             :     ~SwStdFontConfig();
      78             : 
      79             :     virtual void    Commit();
      80             :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
      81             : 
      82           0 :     const String&   GetFontStandard(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];}
      83           0 :     const String&   GetFontOutline(sal_uInt8 nFontGroup)  const {return sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];}
      84           0 :     const String&   GetFontList   (sal_uInt8 nFontGroup)  const {return sDefaultFonts[FONT_LIST + FONT_PER_GROUP * nFontGroup];}
      85           0 :     const String&   GetFontCaption(sal_uInt8 nFontGroup)  const {return sDefaultFonts[FONT_CAPTION + FONT_PER_GROUP * nFontGroup];}
      86           0 :     const String&   GetFontIndex  (sal_uInt8 nFontGroup)  const {return sDefaultFonts[FONT_INDEX + FONT_PER_GROUP * nFontGroup];}
      87             : 
      88        3855 :     const String&   GetFontFor(sal_uInt16 nFontType)  const {return sDefaultFonts[nFontType];}
      89             :     sal_Bool            IsFontDefault(sal_uInt16 nFontType) const;
      90             : 
      91           0 :     void     SetFontStandard(const String& rSet, sal_uInt8 nFontGroup)
      92           0 :                     {ChangeString(FONT_STANDARD + FONT_PER_GROUP * nFontGroup, rSet);}
      93             : 
      94           0 :     void     SetFontOutline(const String& rSet, sal_uInt8 nFontGroup)
      95           0 :                     {    ChangeString(FONT_OUTLINE + FONT_PER_GROUP * nFontGroup, rSet);}
      96           0 :     void     SetFontList   (const String& rSet, sal_uInt8 nFontGroup)
      97           0 :                     {    ChangeString(FONT_LIST + FONT_PER_GROUP * nFontGroup, rSet);}
      98           0 :     void     SetFontCaption(const String& rSet, sal_uInt8 nFontGroup)
      99           0 :                     {    ChangeString(FONT_CAPTION + FONT_PER_GROUP * nFontGroup, rSet);}
     100           0 :     void     SetFontIndex  (const String& rSet, sal_uInt8 nFontGroup)
     101           0 :                     {    ChangeString(FONT_INDEX + FONT_PER_GROUP * nFontGroup, rSet);}
     102             : 
     103           0 :     void     SetFontHeight( sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType )
     104           0 :                     {    ChangeInt(nFont + FONT_PER_GROUP * nScriptType, nHeight);}
     105             : 
     106             :     sal_Int32 GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang );
     107             : 
     108             :     static String    GetDefaultFor(sal_uInt16 nFontType, LanguageType eLang);
     109             :     static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang);
     110             : };
     111             : #endif
     112             : 
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10