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

Generated by: LCOV version 1.11