LCOV - code coverage report
Current view: top level - writerfilter/source/doctok - WW8StyleSheet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 73 1.4 %
Date: 2012-08-25 Functions: 2 11 18.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 126 1.6 %

           Branch data     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 <doctok/resources.hxx>
      21                 :            : 
      22                 :            : namespace writerfilter {
      23                 :            : namespace doctok {
      24                 :            : 
      25                 :          0 : void WW8StyleSheet::initPayload()
      26                 :            : {
      27         [ #  # ]:          0 :     sal_uInt32 nCount = getEntryCount();
      28                 :            : 
      29         [ #  # ]:          0 :     sal_uInt32 nOffset = get_size() + 2;
      30         [ #  # ]:          0 :     for (sal_uInt32 n = 0; n < nCount; ++n)
      31                 :            :     {
      32         [ #  # ]:          0 :         entryOffsets.push_back(nOffset);
      33                 :            : 
      34         [ #  # ]:          0 :         sal_uInt32 cbStd = getU16(nOffset);
      35                 :          0 :         nOffset += cbStd + 2;
      36                 :            :     }
      37                 :            : 
      38         [ #  # ]:          0 :     entryOffsets.push_back(nOffset);
      39                 :          0 : }
      40                 :            : 
      41                 :          0 : sal_uInt32 WW8StyleSheet::getEntryCount()
      42                 :            : {
      43                 :          0 :     return get_cstd();
      44                 :            : }
      45                 :            : 
      46                 :            : writerfilter::Reference<Properties>::Pointer_t
      47                 :          0 : WW8StyleSheet::getEntry(sal_uInt32 nIndex)
      48                 :            : {
      49                 :          0 :     writerfilter::Reference<Properties>::Pointer_t pResult;
      50                 :            : 
      51 [ #  # ][ #  # ]:          0 :     sal_uInt32 nCount = entryOffsets[nIndex + 1] - entryOffsets[nIndex];
      52                 :            : 
      53 [ #  # ][ #  # ]:          0 :     if (nCount > get_cbSTDBaseInFile() + 2U)
      54                 :            :     {
      55 [ #  # ][ #  # ]:          0 :         WW8Style * pStyle = new WW8Style(this, entryOffsets[nIndex], nCount);
                 [ #  # ]
      56                 :            : 
      57                 :          0 :         pStyle->setIndex(nIndex);
      58                 :            : 
      59 [ #  # ][ #  # ]:          0 :         pResult = writerfilter::Reference<Properties>::Pointer_t(pStyle);
                 [ #  # ]
      60                 :            :     }
      61                 :            : 
      62                 :          0 :     return pResult;
      63                 :            : }
      64                 :            : 
      65                 :          0 : OUString WW8Style::get_xstzName()
      66                 :            : {
      67                 :          0 :     sal_uInt32 nCount = getU8(0xc);
      68                 :            : 
      69         [ #  # ]:          0 :     if (nCount > 0)
      70                 :            :     {
      71         [ #  # ]:          0 :         Sequence aSeq(mSequence, 0xe, nCount * 2);
      72                 :            : 
      73                 :          0 :         rtl_uString * pNew = 0;
      74                 :            :         rtl_uString_newFromStr
      75         [ #  # ]:          0 :             (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
      76                 :            : 
      77         [ #  # ]:          0 :         return OUString(pNew);
      78                 :            : 
      79                 :            :     }
      80                 :            : 
      81                 :          0 :     return get_xstzName1();
      82                 :            : }
      83                 :            : 
      84                 :          0 : OUString WW8Style::get_xstzName1()
      85                 :            : {
      86         [ #  # ]:          0 :     WW8StyleSheet * pParentStyleSheet = dynamic_cast<WW8StyleSheet *>(mpParent);
      87                 :            : 
      88         [ #  # ]:          0 :     if (mpParent != NULL)
      89                 :            :     {
      90                 :          0 :         sal_uInt32 nOffset = pParentStyleSheet->get_cbSTDBaseInFile() + 2;
      91                 :            : 
      92         [ #  # ]:          0 :         if (nOffset < getCount())
      93                 :            :         {
      94                 :          0 :             sal_uInt32 nCount = getU16(nOffset);
      95                 :            : 
      96         [ #  # ]:          0 :             if (nCount > 0)
      97                 :            :             {
      98         [ #  # ]:          0 :                 Sequence aSeq(mSequence, nOffset + 2, nCount * 2);
      99                 :            : 
     100                 :          0 :                 rtl_uString * pNew = 0;
     101                 :            :                 rtl_uString_newFromStr
     102         [ #  # ]:          0 :                     (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
     103                 :            : 
     104         [ #  # ]:          0 :                 return OUString(pNew);
     105                 :            : 
     106                 :            :             }
     107                 :            :         }
     108                 :            :     }
     109                 :            : 
     110                 :          0 :     return OUString();
     111                 :            : }
     112                 :            : 
     113                 :          0 : sal_uInt32 WW8Style::get_upxstart()
     114                 :            : {
     115                 :          0 :     sal_uInt32 nResult = 0;
     116                 :          0 :     sal_uInt32 nCount = getU8(0xc);
     117                 :            : 
     118         [ #  # ]:          0 :     if (nCount > 0)
     119                 :            :     {
     120                 :          0 :         nResult = 0xc + 1 + nCount * 2;
     121                 :            : 
     122                 :          0 :         nResult += nResult % 2;
     123                 :            :     }
     124                 :            :     else
     125                 :            :     {
     126                 :            :         WW8StyleSheet * pParentStyleSheet =
     127         [ #  # ]:          0 :             dynamic_cast<WW8StyleSheet *>(mpParent);
     128                 :            : 
     129                 :          0 :         nResult = pParentStyleSheet->get_cbSTDBaseInFile() + 2;
     130                 :            : 
     131         [ #  # ]:          0 :         if (nResult < getCount())
     132                 :            :         {
     133                 :          0 :             sal_uInt32 nCountTmp = getU16(nResult);
     134                 :            : 
     135                 :          0 :             nResult += 4 + nCountTmp * 2;
     136                 :            :         }
     137                 :            :     }
     138                 :            : 
     139                 :          0 :     return nResult;
     140                 :            : }
     141                 :            : 
     142                 :          0 : sal_uInt32 WW8Style::get_upx_count()
     143                 :            : {
     144                 :          0 :     return get_cupx();
     145                 :            : }
     146                 :            : 
     147                 :          0 : writerfilter::Reference<Properties>::Pointer_t WW8Style::get_upx
     148                 :            : (sal_uInt32 nIndex)
     149                 :            : {
     150         [ #  # ]:          0 :     writerfilter::Reference<Properties>::Pointer_t pResult;
     151                 :            : 
     152         [ #  # ]:          0 :     WW8StructBaseTmpOffset aOffset(this);
     153                 :            : 
     154 [ #  # ][ #  # ]:          0 :     aOffset.set(get_upxstart());
     155                 :            : 
     156 [ #  # ][ #  # ]:          0 :     if (aOffset.get() > 0 )
     157                 :            :     {
     158                 :            :         sal_uInt32 nCount;
     159                 :            : 
     160         [ #  # ]:          0 :         for (sal_uInt32 n = 0; n < nIndex; ++n)
     161                 :            :         {
     162 [ #  # ][ #  # ]:          0 :             nCount = getU16(aOffset);
     163                 :            : 
     164         [ #  # ]:          0 :             aOffset.inc(nCount + 2);
     165 [ #  # ][ #  # ]:          0 :             aOffset.inc(aOffset.get() % 2);
     166                 :            :         }
     167                 :            : 
     168 [ #  # ][ #  # ]:          0 :         nCount = getU16(aOffset);
     169                 :            : 
     170         [ #  # ]:          0 :         if (nCount > 0)
     171                 :            :         {
     172         [ #  # ]:          0 :             aOffset.inc(2);
     173                 :            : 
     174 [ #  # ][ #  # ]:          0 :             bool bIsPap = get_cupx() == 2 && nIndex == 0;
                 [ #  # ]
     175                 :            :             WW8PropertySet::Pointer_t
     176                 :            :                 pProps(new WW8PropertySetImpl(*this, aOffset.get(), nCount,
     177 [ #  # ][ #  # ]:          0 :                                               bIsPap));
         [ #  # ][ #  # ]
     178                 :            : 
     179                 :            :             WW8PropertiesReference * pRef =
     180 [ #  # ][ #  # ]:          0 :                 new WW8PropertiesReference(pProps);
         [ #  # ][ #  # ]
     181                 :            : 
     182 [ #  # ][ #  # ]:          0 :             pResult = writerfilter::Reference<Properties>::Pointer_t(pRef);
         [ #  # ][ #  # ]
     183                 :            :         }
     184                 :            :     }
     185                 :            : 
     186                 :          0 :     return pResult;
     187                 :            : }
     188                 :            : 
     189                 :          0 : void WW8Style::resolveNoAuto(Properties & /*rHandler*/)
     190                 :            : {
     191                 :          0 : }
     192                 :            : 
     193 [ +  - ][ +  - ]:         60 : }}
     194                 :            : 
     195                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10