LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - fontattribute.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 51 64 79.7 %
Date: 2014-11-03 Functions: 29 31 93.5 %
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             : #include <drawinglayer/attribute/fontattribute.hxx>
      21             : #include <rtl/instance.hxx>
      22             : #include <rtl/ustring.hxx>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30       71097 :         class ImpFontAttribute
      31             :         {
      32             :         public:
      33             :             /// core data
      34             :             OUString                                    maFamilyName;       // Font Family Name
      35             :             OUString                                    maStyleName;        // Font Style Name
      36             :             sal_uInt16                                  mnWeight;           // Font weight
      37             : 
      38             :             /// bitfield
      39             :             bool                                        mbSymbol : 1;       // Symbol Font Flag
      40             :             bool                                        mbVertical : 1;     // Vertical Text Flag
      41             :             bool                                        mbItalic : 1;       // Italic Flag
      42             :             bool                                        mbOutline : 1;      // Outline Flag
      43             :             bool                                        mbRTL : 1;          // RTL Flag
      44             :             bool                                        mbBiDiStrong : 1;   // BiDi Flag
      45             :             bool                                        mbMonospaced : 1;
      46             : 
      47       23801 :             ImpFontAttribute(
      48             :                 const OUString& rFamilyName,
      49             :                 const OUString& rStyleName,
      50             :                 sal_uInt16 nWeight,
      51             :                 bool bSymbol,
      52             :                 bool bVertical,
      53             :                 bool bItalic,
      54             :                 bool bMonospaced,
      55             :                 bool bOutline,
      56             :                 bool bRTL,
      57             :                 bool bBiDiStrong)
      58             :             :   maFamilyName(rFamilyName),
      59             :                 maStyleName(rStyleName),
      60             :                 mnWeight(nWeight),
      61             :                 mbSymbol(bSymbol),
      62             :                 mbVertical(bVertical),
      63             :                 mbItalic(bItalic),
      64             :                 mbOutline(bOutline),
      65             :                 mbRTL(bRTL),
      66             :                 mbBiDiStrong(bBiDiStrong),
      67       23801 :                 mbMonospaced(bMonospaced)
      68             :             {
      69       23801 :             }
      70             : 
      71          14 :             ImpFontAttribute()
      72             :             :   maFamilyName(),
      73             :                 maStyleName(),
      74             :                 mnWeight(0),
      75             :                 mbSymbol(false),
      76             :                 mbVertical(false),
      77             :                 mbItalic(false),
      78             :                 mbOutline(false),
      79             :                 mbRTL(false),
      80             :                 mbBiDiStrong(false),
      81          14 :                 mbMonospaced(false)
      82             :             {
      83          14 :             }
      84             : 
      85             :             // data read access
      86       35033 :             const OUString& getFamilyName() const { return maFamilyName; }
      87       35033 :             const OUString& getStyleName() const { return maStyleName; }
      88       35033 :             sal_uInt16 getWeight() const { return mnWeight; }
      89       35033 :             bool getSymbol() const { return mbSymbol; }
      90       35033 :             bool getVertical() const { return mbVertical; }
      91       35033 :             bool getItalic() const { return mbItalic; }
      92       33747 :             bool getOutline() const { return mbOutline; }
      93       20681 :             bool getRTL() const { return mbRTL; }
      94        2213 :             bool getBiDiStrong() const { return mbBiDiStrong; }
      95       35033 :             bool getMonospaced() const { return mbMonospaced; }
      96             : 
      97           0 :             bool operator==(const ImpFontAttribute& rCompare) const
      98             :             {
      99           0 :                 return (getFamilyName() == rCompare.getFamilyName()
     100           0 :                     && getStyleName() == rCompare.getStyleName()
     101           0 :                     && getWeight() == rCompare.getWeight()
     102           0 :                     && getSymbol() == rCompare.getSymbol()
     103           0 :                     && getVertical() == rCompare.getVertical()
     104           0 :                     && getItalic() == rCompare.getItalic()
     105           0 :                     && getOutline() == rCompare.getOutline()
     106           0 :                     && getRTL() == rCompare.getRTL()
     107           0 :                     && getBiDiStrong() == rCompare.getBiDiStrong()
     108           0 :                     && getMonospaced() == rCompare.getMonospaced());
     109             :             }
     110             :         };
     111             : 
     112             :         namespace
     113             :         {
     114             :             struct theGlobalDefault :
     115             :                 public rtl::Static< FontAttribute::ImplType, theGlobalDefault > {};
     116             :         }
     117             : 
     118       23801 :         FontAttribute::FontAttribute(
     119             :             const OUString& rFamilyName,
     120             :             const OUString& rStyleName,
     121             :             sal_uInt16 nWeight,
     122             :             bool bSymbol,
     123             :             bool bVertical,
     124             :             bool bItalic,
     125             :             bool bMonospaced,
     126             :             bool bOutline,
     127             :             bool bRTL,
     128             :             bool bBiDiStrong)
     129             :         :   mpFontAttribute(ImpFontAttribute(
     130       23801 :                 rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bMonospaced, bOutline, bRTL, bBiDiStrong))
     131             :         {
     132       23801 :         }
     133             : 
     134        1258 :         FontAttribute::FontAttribute()
     135        1258 :         :   mpFontAttribute(theGlobalDefault::get())
     136             :         {
     137        1258 :         }
     138             : 
     139       24323 :         FontAttribute::FontAttribute(const FontAttribute& rCandidate)
     140       24323 :         :   mpFontAttribute(rCandidate.mpFontAttribute)
     141             :         {
     142       24323 :         }
     143             : 
     144       49050 :         FontAttribute::~FontAttribute()
     145             :         {
     146       49050 :         }
     147             : 
     148        1258 :         FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate)
     149             :         {
     150        1258 :             mpFontAttribute = rCandidate.mpFontAttribute;
     151        1258 :             return *this;
     152             :         }
     153             : 
     154           0 :         bool FontAttribute::operator==(const FontAttribute& rCandidate) const
     155             :         {
     156           0 :             return rCandidate.mpFontAttribute == mpFontAttribute;
     157             :         }
     158             : 
     159       35033 :         const OUString& FontAttribute::getFamilyName() const
     160             :         {
     161       35033 :             return mpFontAttribute->getFamilyName();
     162             :         }
     163             : 
     164       35033 :         const OUString& FontAttribute::getStyleName() const
     165             :         {
     166       35033 :             return mpFontAttribute->getStyleName();
     167             :         }
     168             : 
     169       35033 :         sal_uInt16 FontAttribute::getWeight() const
     170             :         {
     171       35033 :             return mpFontAttribute->getWeight();
     172             :         }
     173             : 
     174       35033 :         bool FontAttribute::getSymbol() const
     175             :         {
     176       35033 :             return mpFontAttribute->getSymbol();
     177             :         }
     178             : 
     179       35033 :         bool FontAttribute::getVertical() const
     180             :         {
     181       35033 :             return mpFontAttribute->getVertical();
     182             :         }
     183             : 
     184       35033 :         bool FontAttribute::getItalic() const
     185             :         {
     186       35033 :             return mpFontAttribute->getItalic();
     187             :         }
     188             : 
     189       33747 :         bool FontAttribute::getOutline() const
     190             :         {
     191       33747 :             return mpFontAttribute->getOutline();
     192             :         }
     193             : 
     194       20681 :         bool FontAttribute::getRTL() const
     195             :         {
     196       20681 :             return mpFontAttribute->getRTL();
     197             :         }
     198             : 
     199        2213 :         bool FontAttribute::getBiDiStrong() const
     200             :         {
     201        2213 :             return mpFontAttribute->getBiDiStrong();
     202             :         }
     203             : 
     204       35033 :         bool FontAttribute::getMonospaced() const
     205             :         {
     206       35033 :             return mpFontAttribute->getMonospaced();
     207             :         }
     208             : 
     209             : 
     210             :     } // end of namespace attribute
     211             : } // end of namespace drawinglayer
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10