LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/writerperfect/source/common - DocumentHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 25 0.0 %
Date: 2013-07-09 Functions: 0 6 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 Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       6             :  *
       7             :  * For further information visit http://libwpd.sourceforge.net
       8             :  */
       9             : #include "DocumentHandler.hxx"
      10             : 
      11             : #include <string.h>
      12             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      13             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      14             : 
      15             : #include <xmloff/attrlist.hxx>
      16             : 
      17             : using com::sun::star::xml::sax::XAttributeList;
      18             : 
      19           0 : DocumentHandler::DocumentHandler(Reference < XDocumentHandler > &xHandler) :
      20           0 :     mxHandler(xHandler)
      21             : {
      22           0 : }
      23             : 
      24           0 : void DocumentHandler::startDocument()
      25             : {
      26           0 :     mxHandler->startDocument();
      27           0 : }
      28             : 
      29           0 : void DocumentHandler::endDocument()
      30             : {
      31           0 :     mxHandler->endDocument();
      32           0 : }
      33             : 
      34           0 : void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
      35             : {
      36           0 :     SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
      37           0 :     Reference < XAttributeList > xAttrList(pAttrList);
      38           0 :     WPXPropertyList::Iter i(xPropList);
      39           0 :     for (i.rewind(); i.next(); )
      40             :     {
      41             :         // filter out libwpd elements
      42           0 :         if (strncmp(i.key(), "libwpd", 6) != 0)
      43             :         {
      44             :             pAttrList->AddAttribute(OUString::createFromAscii(i.key()),
      45           0 :                                     OUString::createFromAscii(i()->getStr().cstr()));
      46             :         }
      47             :     }
      48             : 
      49           0 :     mxHandler->startElement(OUString::createFromAscii(psName), xAttrList);
      50           0 : }
      51             : 
      52           0 : void DocumentHandler::endElement(const char *psName)
      53             : {
      54           0 :     mxHandler->endElement(OUString::createFromAscii(psName));
      55           0 : }
      56             : 
      57           0 : void DocumentHandler::characters(const WPXString &sCharacters)
      58             : {
      59           0 :     OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8);
      60           0 :     mxHandler->characters(sCharU16);
      61           0 : }
      62             : 
      63             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10