LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFastHelper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 11 100.0 %
Date: 2015-06-13 12:38:46 Functions: 12 12 100.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             : #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTHELPER_HXX
      20             : #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTHELPER_HXX
      21             : 
      22             : #include <iostream>
      23             : #include <ooxml/QNameToString.hxx>
      24             : #include "OOXMLFastContextHandler.hxx"
      25             : 
      26             : namespace writerfilter {
      27             : 
      28             : namespace ooxml
      29             : {
      30             : 
      31             : template <class T>
      32             : class OOXMLFastHelper
      33             : {
      34             : public:
      35             :     static css::uno::Reference<css::xml::sax::XFastContextHandler> createAndSetParentAndDefine
      36             :     (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine);
      37             : 
      38             :     static void newProperty(OOXMLFastContextHandler * pHandler,
      39             :                             Id nId,
      40             :                             const OUString & rValue);
      41             : 
      42             :     static void newProperty(OOXMLFastContextHandler * pHandler,
      43             :                             Id nId, sal_Int32 nValue);
      44             : 
      45             :     static void attributes
      46             :     (OOXMLFastContextHandler * pContext,
      47             :      const css::uno::Reference < css::xml::sax::XFastAttributeList > & Attribs);
      48             : };
      49             : 
      50             : template <class T>
      51     1964475 : css::uno::Reference<css::xml::sax::XFastContextHandler> OOXMLFastHelper<T>::createAndSetParentAndDefine (OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine)
      52             : {
      53     1964475 :     OOXMLFastContextHandler * pTmp = new T(pHandler);
      54             : 
      55     1964475 :     pTmp->setToken(nToken);
      56     1964475 :     pTmp->setId(nId);
      57     1964475 :     pTmp->setDefine(nDefine);
      58             : 
      59     1964475 :     css::uno::Reference<css::xml::sax::XFastContextHandler> aResult(pTmp);
      60             : 
      61     1964475 :     return aResult;
      62             : }
      63             : 
      64             : template <class T>
      65             : void OOXMLFastHelper<T>::newProperty(OOXMLFastContextHandler * pHandler,
      66             :                                      Id nId,
      67             :                                      const OUString & rValue)
      68             : {
      69             :     OOXMLValue::Pointer_t pVal(new T(rValue));
      70             : 
      71             :     pHandler->newProperty(nId, pVal);
      72             : }
      73             : 
      74             : template <class T>
      75         552 : void OOXMLFastHelper<T>::newProperty(OOXMLFastContextHandler * pHandler,
      76             :                                      Id nId,
      77             :                                      sal_Int32 nVal)
      78             : {
      79         552 :     OOXMLValue::Pointer_t pVal(T::Create(nVal));
      80             : 
      81         552 :     pHandler->newProperty(nId, pVal);
      82         552 : }
      83             : 
      84             : }}
      85             : #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLFASTHELPER_HXX
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11