LCOV - code coverage report
Current view: top level - writerperfect/source/filter - FontStyle.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 35 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 134 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /* FontStyle: Stores (and writes) font-based information that is needed at
       3                 :            :  * the head of an OO document.
       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                 :            :  * For further information visit http://libwpd.sourceforge.net
      10                 :            :  */
      11                 :            : 
      12                 :            : #include "FilterInternal.hxx"
      13                 :            : 
      14                 :            : #include "FontStyle.hxx"
      15                 :            : 
      16                 :            : #include "DocumentElement.hxx"
      17                 :            : 
      18                 :          0 : FontStyle::FontStyle(const char *psName, const char *psFontFamily) : Style(psName),
      19                 :            :     msFontFamily(psFontFamily, true),
      20 [ #  # ][ #  # ]:          0 :     msFontPitch(IMP_DEFAULT_FONT_PITCH)
         [ #  # ][ #  # ]
                 [ #  # ]
      21                 :            : {
      22                 :          0 : }
      23                 :            : 
      24 [ #  # ][ #  # ]:          0 : FontStyle::~FontStyle()
      25                 :            : {
      26         [ #  # ]:          0 : }
      27                 :            : 
      28                 :          0 : void FontStyle::write(OdfDocumentHandler *pHandler) const
      29                 :            : {
      30 [ #  # ][ #  # ]:          0 :     TagOpenElement styleOpen("style:font-face");
                 [ #  # ]
      31 [ #  # ][ #  # ]:          0 :     styleOpen.addAttribute("style:name", getName());
                 [ #  # ]
      32 [ #  # ][ #  # ]:          0 :     styleOpen.addAttribute("svg:font-family", msFontFamily);
                 [ #  # ]
      33         [ #  # ]:          0 :     styleOpen.write(pHandler);
      34 [ #  # ][ #  # ]:          0 :     TagCloseElement styleClose("style:font-face");
                 [ #  # ]
      35 [ #  # ][ #  # ]:          0 :     styleClose.write(pHandler);
                 [ #  # ]
      36                 :          0 : }
      37                 :            : 
      38                 :          0 : void FontStyleManager::clean()
      39                 :            : {
      40                 :          0 :     mStyleHash.clear();
      41                 :          0 : }
      42                 :            : 
      43                 :          0 : void FontStyleManager::writeFontsDeclaration(OdfDocumentHandler *pHandler) const
      44                 :            : {
      45 [ #  # ][ #  # ]:          0 :     TagOpenElement("office:font-face-decls").write(pHandler);
         [ #  # ][ #  # ]
                 [ #  # ]
      46                 :          0 :     std::map<WPXString, shared_ptr<FontStyle>, ltstr>::const_iterator iter;
      47         [ #  # ]:          0 :     for (iter = mStyleHash.begin(); iter != mStyleHash.end(); ++iter)
      48                 :            :     {
      49         [ #  # ]:          0 :         (iter->second)->write(pHandler);
      50                 :            :     }
      51                 :            : 
      52 [ #  # ][ #  # ]:          0 :     TagOpenElement symbolFontOpen("style:font-face");
                 [ #  # ]
      53 [ #  # ][ #  # ]:          0 :     symbolFontOpen.addAttribute("style:name", "StarSymbol");
         [ #  # ][ #  # ]
                 [ #  # ]
      54 [ #  # ][ #  # ]:          0 :     symbolFontOpen.addAttribute("svg:font-family", "StarSymbol");
         [ #  # ][ #  # ]
                 [ #  # ]
      55 [ #  # ][ #  # ]:          0 :     symbolFontOpen.addAttribute("style:font-charset", "x-symbol");
         [ #  # ][ #  # ]
                 [ #  # ]
      56         [ #  # ]:          0 :     symbolFontOpen.write(pHandler);
      57         [ #  # ]:          0 :     pHandler->endElement("style:font-face");
      58                 :            : 
      59 [ #  # ][ #  # ]:          0 :     pHandler->endElement("office:font-face-decls");
      60                 :          0 : }
      61                 :            : 
      62                 :          0 : WPXString FontStyleManager::findOrAdd(const char *psFontFamily)
      63                 :            : {
      64                 :            :     std::map<WPXString, shared_ptr<FontStyle>, ltstr>::const_iterator iter =
      65 [ #  # ][ #  # ]:          0 :         mStyleHash.find(psFontFamily);
                 [ #  # ]
      66 [ #  # ][ #  # ]:          0 :     if (iter!=mStyleHash.end()) return psFontFamily;
      67                 :            : 
      68                 :            :     // ok create a new font
      69 [ #  # ][ #  # ]:          0 :     shared_ptr<FontStyle> font(new FontStyle(psFontFamily, psFontFamily));
                 [ #  # ]
      70 [ #  # ][ #  # ]:          0 :     mStyleHash[psFontFamily] = font;
         [ #  # ][ #  # ]
      71 [ #  # ][ #  # ]:          0 :     return psFontFamily;
      72                 :            : }
      73                 :            : 
      74                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10