LCOV - code coverage report
Current view: top level - writerfilter/source/resourcemodel - LoggedResources.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 70 70 100.0 %
Date: 2014-11-03 Functions: 26 29 89.7 %
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 <rtl/ustrbuf.hxx>
      21             : #include <resourcemodel/LoggedResources.hxx>
      22             : #include <resourcemodel/QNameToString.hxx>
      23             : 
      24             : using namespace ::com::sun::star;
      25             : 
      26             : namespace writerfilter
      27             : {
      28             : 
      29             : #ifdef DEBUG_WRITERFILTER
      30             : // class: LoggedResourcesHelper
      31             : 
      32             : LoggedResourcesHelper::LoggedResourcesHelper(TagLogger::Pointer_t pLogger, const std::string & sPrefix)
      33             : : mpLogger(pLogger), msPrefix(sPrefix)
      34             : {
      35             : }
      36             : 
      37             : LoggedResourcesHelper::~LoggedResourcesHelper()
      38             : {
      39             : }
      40             : 
      41             : void LoggedResourcesHelper::startElement(const std::string & sElement)
      42             : {
      43             :     mpLogger->startElement(msPrefix + "." + sElement);
      44             : }
      45             : 
      46             : void LoggedResourcesHelper::endElement(const std::string & /*sElement*/)
      47             : {
      48             :     mpLogger->endElement();
      49             : }
      50             : 
      51             : void LoggedResourcesHelper::chars(const OUString & rChars)
      52             : {
      53             :     mpLogger->chars(rChars);
      54             : }
      55             : 
      56             : void LoggedResourcesHelper::chars(const std::string & rChars)
      57             : {
      58             :     mpLogger->chars(rChars);
      59             : }
      60             : 
      61             : void LoggedResourcesHelper::attribute(const std::string & rName, const std::string & rValue)
      62             : {
      63             :     mpLogger->attribute(rName, rValue);
      64             : }
      65             : 
      66             : void LoggedResourcesHelper::attribute(const std::string & rName, sal_uInt32 nValue)
      67             : {
      68             :     mpLogger->attribute(rName, nValue);
      69             : }
      70             : 
      71             : #endif
      72             : 
      73             : // class: LoggedStream
      74             : 
      75        9190 : LoggedStream::LoggedStream(
      76             : #ifdef DEBUG_WRITERFILTER
      77             :     TagLogger::Pointer_t pLogger,
      78             :     const std::string & sPrefix
      79             : ) : mHelper(pLogger, sPrefix)
      80             : #else
      81             :     TagLogger::Pointer_t,
      82             :     const std::string&
      83        9190 : )
      84             : #endif
      85             : {
      86        9190 : }
      87             : 
      88        9190 : LoggedStream::~LoggedStream()
      89             : {
      90        9190 : }
      91             : 
      92        4050 : void LoggedStream::startSectionGroup()
      93             : {
      94             : #ifdef DEBUG_WRITERFILTER
      95             :     mHelper.startElement("section");
      96             : #endif
      97             : 
      98        4050 :     lcl_startSectionGroup();
      99        4050 : }
     100             : 
     101        4038 : void LoggedStream::endSectionGroup()
     102             : {
     103        4038 :     lcl_endSectionGroup();
     104             : 
     105             : #ifdef DEBUG_WRITERFILTER
     106             :     mHelper.endElement("section");
     107             : #endif
     108        4024 : }
     109             : 
     110       54512 : void LoggedStream::startParagraphGroup()
     111             : {
     112             : #ifdef DEBUG_WRITERFILTER
     113             :     mHelper.startElement("paragraph");
     114             : #endif
     115             : 
     116       54512 :     lcl_startParagraphGroup();
     117       54512 : }
     118             : 
     119       54498 : void LoggedStream::endParagraphGroup()
     120             : {
     121       54498 :     lcl_endParagraphGroup();
     122             : 
     123             : #ifdef DEBUG_WRITERFILTER
     124             :     mHelper.endElement("paragraph");
     125             : #endif
     126       54498 : }
     127             : 
     128             : 
     129      140584 : void LoggedStream::startCharacterGroup()
     130             : {
     131             : #ifdef DEBUG_WRITERFILTER
     132             :     mHelper.startElement("charactergroup");
     133             : #endif
     134             : 
     135      140584 :     lcl_startCharacterGroup();
     136      140584 : }
     137             : 
     138      140578 : void LoggedStream::endCharacterGroup()
     139             : {
     140      140578 :     lcl_endCharacterGroup();
     141             : 
     142             : #ifdef DEBUG_WRITERFILTER
     143             :     mHelper.endElement("charactergroup");
     144             : #endif
     145      140578 : }
     146             : 
     147        2926 : void LoggedStream::startShape(uno::Reference<drawing::XShape> const& xShape)
     148             : {
     149             : #ifdef DEBUG_WRITERFILTER
     150             :     mHelper.startElement("shape");
     151             : #endif
     152             : 
     153        2926 :     lcl_startShape(xShape);
     154        2926 : }
     155             : 
     156        2926 : void LoggedStream::endShape()
     157             : {
     158        2926 :     lcl_endShape();
     159             : 
     160             : #ifdef DEBUG_WRITERFILTER
     161             :     mHelper.endElement("shape");
     162             : #endif
     163        2926 : }
     164             : 
     165       15214 : void LoggedStream::text(const sal_uInt8 * data, size_t len)
     166             : {
     167             : #ifdef DEBUG_WRITERFILTER
     168             :     mHelper.startElement("text");
     169             : 
     170             :     OUString sText( (const sal_Char*) data, len, RTL_TEXTENCODING_MS_1252 );
     171             : 
     172             :     mHelper.startElement("data");
     173             :     mHelper.chars(sText);
     174             :     mHelper.endElement("data");
     175             : #endif
     176             : 
     177       15214 :     lcl_text(data, len);
     178             : 
     179             : #ifdef DEBUG_WRITERFILTER
     180             :     mHelper.endElement("text");
     181             : #endif
     182       15214 : }
     183             : 
     184      152622 : void LoggedStream::utext(const sal_uInt8 * data, size_t len)
     185             : {
     186             : #ifdef DEBUG_WRITERFILTER
     187             :     mHelper.startElement("utext");
     188             :     mHelper.startElement("data");
     189             : 
     190             :     OUString sText;
     191             :     OUStringBuffer aBuffer = OUStringBuffer(len);
     192             :     aBuffer.append( (const sal_Unicode *) data, len);
     193             :     sText = aBuffer.makeStringAndClear();
     194             : 
     195             :     mHelper.chars(sText);
     196             : 
     197             :     mHelper.endElement("data");
     198             : #endif
     199             : 
     200      152622 :     lcl_utext(data, len);
     201             : 
     202             : #ifdef DEBUG_WRITERFILTER
     203             :     mHelper.endElement("utext");
     204             : #endif
     205      152622 : }
     206             : 
     207        1642 : void LoggedStream::positivePercentage(const OUString& rText)
     208             : {
     209             : #ifdef DEBUG_WRITERFILTER
     210             :     mHelper.startElement("positivePercentage");
     211             :     mHelper.chars(rText);
     212             : #endif
     213             : 
     214        1642 :     lcl_positivePercentage(rText);
     215             : 
     216             : #ifdef DEBUG_WRITERFILTER
     217             :     mHelper.endElement("positivePercentage");
     218             : #endif
     219        1642 : }
     220             : 
     221      270208 : void LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
     222             : {
     223             : #ifdef DEBUG_WRITERFILTER
     224             :     mHelper.startElement("props");
     225             : #endif
     226             : 
     227      270208 :     lcl_props(ref);
     228             : 
     229             : #ifdef DEBUG_WRITERFILTER
     230             :     mHelper.endElement("props");
     231             : #endif
     232      270208 : }
     233             : 
     234       12788 : void LoggedStream::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
     235             : {
     236             : #ifdef DEBUG_WRITERFILTER
     237             :     mHelper.startElement("table");
     238             :     mHelper.attribute("name", (*QNameToString::Instance())(name));
     239             : #endif
     240             : 
     241       12788 :     lcl_table(name, ref);
     242             : 
     243             : #ifdef DEBUG_WRITERFILTER
     244             :     mHelper.endElement("table");
     245             : #endif
     246       12788 : }
     247             : 
     248        2766 : void LoggedStream::substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref)
     249             : {
     250             : #ifdef DEBUG_WRITERFILTER
     251             :     mHelper.startElement("substream");
     252             :     mHelper.attribute("name", (*QNameToString::Instance())(name));
     253             : #endif
     254             : 
     255        2766 :     lcl_substream(name, ref);
     256             : 
     257             : #ifdef DEBUG_WRITERFILTER
     258             :     mHelper.endElement("substream");
     259             : #endif
     260        2766 : }
     261             : 
     262       48496 : void LoggedStream::info(const std::string & _info)
     263             : {
     264             : #ifdef DEBUG_WRITERFILTER
     265             :     mHelper.startElement("info");
     266             :     mHelper.attribute("text", _info);
     267             : #endif
     268             : 
     269       48496 :     lcl_info(_info);
     270             : 
     271             : #ifdef DEBUG_WRITERFILTER
     272             :     mHelper.endElement("info");
     273             : #endif
     274       48496 : }
     275             : 
     276             : // class LoggedProperties
     277      543562 : LoggedProperties::LoggedProperties(
     278             : #ifdef DEBUG_WRITERFILTER
     279             :     TagLogger::Pointer_t pLogger,
     280             :     const std::string & sPrefix
     281             : ) : mHelper(pLogger, sPrefix)
     282             : #else
     283             :     TagLogger::Pointer_t,
     284             :     const std::string&
     285      543562 : )
     286             : #endif
     287             : {
     288      543562 : }
     289             : 
     290      543562 : LoggedProperties::~LoggedProperties()
     291             : {
     292      543562 : }
     293             : 
     294     3688670 : void LoggedProperties::attribute(Id name, Value & val)
     295             : {
     296             : #ifdef DEBUG_WRITERFILTER
     297             :     mHelper.startElement("attribute");
     298             :     mHelper.attribute("name", (*QNameToString::Instance())(name));
     299             :     mHelper.attribute("value", val.toString());
     300             :     mHelper.endElement("attribute");
     301             : #endif
     302             : 
     303     3688670 :     lcl_attribute(name, val);
     304     3688670 : }
     305             : 
     306     2904906 : void LoggedProperties::sprm(Sprm & rSprm)
     307             : {
     308             : #ifdef DEBUG_WRITERFILTER
     309             :     mHelper.startElement("sprm");
     310             :     mHelper.attribute("name", (*QNameToString::Instance())(rSprm.getId()));
     311             :     mHelper.chars(rSprm.toString());
     312             : #endif
     313             : 
     314     2904906 :     lcl_sprm(rSprm);
     315             : 
     316             : #ifdef DEBUG_WRITERFILTER
     317             :     mHelper.endElement("sprm");
     318             : #endif
     319     2904906 : }
     320             : 
     321       19618 : LoggedTable::LoggedTable(
     322             : #ifdef DEBUG_WRITERFILTER
     323             :     TagLogger::Pointer_t pLogger,
     324             :     const std::string & sPrefix
     325             : ) : mHelper(pLogger, sPrefix)
     326             : #else
     327             :     TagLogger::Pointer_t,
     328             :     const std::string&
     329       19618 : )
     330             : #endif
     331             : {
     332       19618 : }
     333             : 
     334       19618 : LoggedTable::~LoggedTable()
     335             : {
     336       19618 : }
     337             : 
     338      116718 : void LoggedTable::entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref)
     339             : {
     340             : #ifdef DEBUG_WRITERFILTER
     341             :     mHelper.startElement("entry");
     342             :     mHelper.attribute("pos", pos);
     343             : #endif
     344             : 
     345      116718 :     lcl_entry(pos, ref);
     346             : 
     347             : #ifdef DEBUG_WRITERFILTER
     348             :     mHelper.endElement("entry");
     349             : #endif
     350      116718 : }
     351             : 
     352         114 : }
     353             : 
     354             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10