LCOV - code coverage report
Current view: top level - sw/source/core/txtnode - txatbase.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 19 51 37.3 %
Date: 2015-06-13 12:38:46 Functions: 8 10 80.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             : #include <boost/optional.hpp>
      21             : #include <libxml/xmlwriter.h>
      22             : #include <svl/itempool.hxx>
      23             : #include <txatbase.hxx>
      24             : #include <fmtfld.hxx>
      25             : #include <docufld.hxx>
      26             : 
      27      112556 : SwTextAttr::SwTextAttr( SfxPoolItem& rAttr, sal_Int32 nStart )
      28             :     : m_pAttr( &rAttr )
      29             :     , m_nStart( nStart )
      30             :     , m_bDontExpand( false )
      31             :     , m_bLockExpandFlag( false )
      32             :     , m_bDontMoveAttr( false )
      33             :     , m_bCharFormatAttr( false )
      34             :     , m_bOverlapAllowedAttr( false )
      35             :     , m_bPriorityAttr( false )
      36             :     , m_bDontExpandStart( false )
      37             :     , m_bNesting( false )
      38             :     , m_bHasDummyChar( false )
      39             :     , m_bFormatIgnoreStart(false)
      40             :     , m_bFormatIgnoreEnd(false)
      41      112556 :     , m_bHasContent( false )
      42             : {
      43      112556 : }
      44             : 
      45      112537 : SwTextAttr::~SwTextAttr( )
      46             : {
      47      112537 : }
      48             : 
      49     2083940 : sal_Int32* SwTextAttr::GetEnd()
      50             : {
      51     2083940 :     return 0;
      52             : }
      53             : 
      54      112537 : void SwTextAttr::Destroy( SwTextAttr * pToDestroy, SfxItemPool& rPool )
      55             : {
      56      225074 :     if (!pToDestroy) return;
      57      112537 :     SfxPoolItem * const pAttr = pToDestroy->m_pAttr;
      58      112537 :     delete pToDestroy;
      59      112537 :     rPool.Remove( *pAttr );
      60             : }
      61             : 
      62      118671 : bool SwTextAttr::operator==( const SwTextAttr& rAttr ) const
      63             : {
      64      118671 :     return GetAttr() == rAttr.GetAttr();
      65             : }
      66             : 
      67      106748 : SwTextAttrEnd::SwTextAttrEnd( SfxPoolItem& rAttr,
      68             :         sal_Int32 nStart, sal_Int32 nEnd ) :
      69      106748 :     SwTextAttr( rAttr, nStart ), m_nEnd( nEnd )
      70             : {
      71      106748 : }
      72             : 
      73     6650143 : sal_Int32* SwTextAttrEnd::GetEnd()
      74             : {
      75     6650143 :     return & m_nEnd;
      76             : }
      77             : 
      78           0 : void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
      79             : {
      80           0 :     xmlTextWriterStartElement(pWriter, BAD_CAST("swTextAttr"));
      81             : 
      82           0 :     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("start"), BAD_CAST(OString::number(m_nStart).getStr()));
      83           0 :     if (End())
      84           0 :         xmlTextWriterWriteAttribute(pWriter, BAD_CAST("end"), BAD_CAST(OString::number(*End()).getStr()));
      85           0 :     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
      86           0 :     const char* pWhich = 0;
      87           0 :     boost::optional<OString> oValue;
      88           0 :     switch (Which())
      89             :     {
      90             :     case RES_TXTATR_AUTOFMT:
      91           0 :         pWhich = "autofmt";
      92           0 :         break;
      93             :     case RES_TXTATR_ANNOTATION:
      94           0 :         pWhich = "annotation";
      95           0 :         break;
      96             :     case RES_TXTATR_FLYCNT:
      97           0 :         pWhich = "fly content";
      98           0 :         break;
      99             :     case RES_TXTATR_CHARFMT:
     100             :         {
     101           0 :             pWhich = "character format";
     102           0 :             if (SwCharFormat* pCharFormat = GetCharFormat().GetCharFormat())
     103           0 :                 oValue = "name: " + OUStringToOString(pCharFormat->GetName(), RTL_TEXTENCODING_UTF8);
     104           0 :             break;
     105             :         }
     106             :     case RES_TXTATR_INETFMT:
     107             :         {
     108           0 :             pWhich = "inet format";
     109           0 :             const SwFormatINetFormat& rFormat = GetINetFormat();
     110           0 :             oValue = "url: " + rFormat.GetValue().toUtf8();
     111           0 :             break;
     112             :         }
     113             :     default:
     114           0 :         break;
     115             :     }
     116           0 :     if (pWhich)
     117           0 :         xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(pWhich));
     118           0 :     if (oValue)
     119           0 :         xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(oValue->getStr()));
     120           0 :     if (Which() == RES_TXTATR_AUTOFMT)
     121           0 :         GetAutoFormat().dumpAsXml(pWriter);
     122             : 
     123           0 :     xmlTextWriterEndElement(pWriter);
     124           0 : }
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11