LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww8 - styles.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 16 0.0 %
Date: 2012-12-17 Functions: 0 4 0.0 %
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             : 
      21             : #include "../inc/wwstyles.hxx"
      22             : 
      23             : #include <functional>               //std::unary_function
      24             : #include <algorithm>                //std::find_if
      25             : #include <tools/string.hxx>         //do we have to...
      26             : 
      27             : #include "staticassert.hxx"      //StaticAssert
      28             : 
      29             : namespace
      30             : {
      31             :     class SameName: public std::unary_function<const sal_Char*, bool>
      32             :     {
      33             :     private:
      34             :         const String &mrName;
      35             :     public:
      36             :         explicit SameName(const String &rName) : mrName(rName) {}
      37             :         bool operator() (const sal_Char *pEntry) const
      38             :             { return mrName.EqualsAscii(pEntry); }
      39             :     };
      40             : 
      41           0 :     const sal_Char **GetStiNames() throw()
      42             :     {
      43             :         static const sal_Char *stiName[] =
      44             :         {
      45             :             "Normal",
      46             :             "Heading 1",
      47             :             "Heading 2",
      48             :             "Heading 3",
      49             :             "Heading 4",
      50             :             "Heading 5",
      51             :             "Heading 6",
      52             :             "Heading 7",
      53             :             "Heading 8",
      54             :             "Heading 9",
      55             :             "Index 1",
      56             :             "Index 2",
      57             :             "Index 3",
      58             :             "Index 4",
      59             :             "Index 5",
      60             :             "Index 6",
      61             :             "Index 7",
      62             :             "Index 8",
      63             :             "Index 9",
      64             :             "TOC 1",
      65             :             "TOC 2",
      66             :             "TOC 3",
      67             :             "TOC 4",
      68             :             "TOC 5",
      69             :             "TOC 6",
      70             :             "TOC 7",
      71             :             "TOC 8",
      72             :             "TOC 9",
      73             :             "Normal Indent",
      74             :             "Footnote Text",
      75             :             "Annotation Text",
      76             :             "Header",
      77             :             "Footer",
      78             :             "Index Heading",
      79             :             "Caption",
      80             :             "Table of Figures",
      81             :             "Envelope Address",
      82             :             "Envelope Return",
      83             :             "Footnote Reference",
      84             :             "Annotation Reference",
      85             :             "Line Number",
      86             :             "Page Number",
      87             :             "Endnote Reference",
      88             :             "Endnote Text",
      89             :             "Table of Authorities",
      90             :             "Macro Text",
      91             :             "TOA Heading",
      92             :             "List",
      93             :             "List 2",
      94             :             "List 3",
      95             :             "List 4",
      96             :             "List 5",
      97             :             "List Bullet",
      98             :             "List Bullet 2",
      99             :             "List Bullet 3",
     100             :             "List Bullet 4",
     101             :             "List Bullet 5",
     102             :             "List Number",
     103             :             "List Number 2",
     104             :             "List Number 3",
     105             :             "List Number 4",
     106             :             "List Number 5",
     107             :             "Title",
     108             :             "Closing",
     109             :             "Signature",
     110             :             "Default Paragraph Font",
     111             :             "Body Text",
     112             :             "Body Text Indent",
     113             :             "List Continue",
     114             :             "List Continue 2",
     115             :             "List Continue 3",
     116             :             "List Continue 4",
     117             :             "List Continue 5",
     118             :             "Message Header",
     119             :             "Subtitle",
     120             :             "Salutation",
     121             :             "Date",
     122             :             "Body Text First Indent",
     123             :             "Body Text First Indent 2",
     124             :             "Note Heading",
     125             :             "Body Text 2",
     126             :             "Body Text 3",
     127             :             "Body Text Indent 2",
     128             :             "Body Text Indent 3",
     129             :             "Block Text",
     130             :             "Hyperlink",
     131             :             "Followed Hyperlink",
     132             :             "Strong",
     133             :             "Emphasis",
     134             :             "Document Map",
     135             :             "Plain Text"
     136             :         };
     137             : 
     138             :         OSL_ENSURE( (sizeof (stiName) / sizeof (stiName[0])) == ww::stiMax, "WrongSizeOfArray" );
     139             : 
     140           0 :         return stiName;
     141             :     }
     142             : }
     143             : 
     144             : namespace ww
     145             : {
     146           0 :     const sal_Char* GetEnglishNameFromSti(sti eSti) throw()
     147             :     {
     148           0 :         if (eSti >= stiMax)
     149           0 :             return 0;
     150             :         else
     151           0 :             return GetStiNames()[eSti];
     152             :     }
     153             : 
     154           0 :     bool StandardStiIsCharStyle(sti eSti) throw()
     155             :     {
     156           0 :         switch (eSti)
     157             :         {
     158             :             case stiFtnRef:
     159             :             case stiAtnRef:
     160             :             case stiLnn:
     161             :             case stiPgn:
     162             :             case stiEdnRef:
     163             :             case stiNormalChar:
     164           0 :                 return true;
     165             :             default:
     166           0 :                 return false;
     167             :         }
     168             :     }
     169             : 
     170           0 :     sti GetCanonicalStiFromStc(sal_uInt8 stc) throw()
     171             :     {
     172           0 :         if (stc == 0)
     173           0 :             return stiNormal;
     174           0 :         else if (stc < 222)
     175           0 :             return stiUser;
     176             :         else
     177             :         {
     178             :             static sti aMapping[] =
     179             :             {
     180             :                 stiNil, stiAtnRef, stiAtnText, stiToc8, stiToc7, stiToc6,
     181             :                 stiToc5, stiToc4, stiToc3, stiToc2, stiToc1, stiIndex7,
     182             :                 stiIndex6, stiIndex5, stiIndex4, stiIndex3, stiIndex2,
     183             :                 stiIndex1, stiLnn, stiIndexHeading, stiFooter, stiHeader,
     184             :                 stiFtnRef, stiFtnText, stiLev9, stiLev8, stiLev7, stiLev6,
     185             :                 stiLev5, stiLev4, stiLev3, stiLev2, stiLev1, stiNormIndent
     186             :             };
     187           0 :             return aMapping[stc-222];
     188             :         }
     189             :     }
     190             : }
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10