LCOV - code coverage report
Current view: top level - libreoffice/sdext/source/pdfimport/tree - treevisitorfactory.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 30 66.7 %
Date: 2012-12-27 Functions: 14 21 66.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             : 
      21             : #include "treevisitorfactory.hxx"
      22             : #include "writertreevisiting.hxx"
      23             : #include "drawtreevisiting.hxx"
      24             : 
      25             : namespace pdfi
      26             : {
      27           2 :     struct WriterTreeVisitorFactory : public TreeVisitorFactory
      28             :     {
      29           1 :         WriterTreeVisitorFactory() {}
      30             : 
      31           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const
      32             :         {
      33           1 :             return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc));
      34             :         }
      35             : 
      36           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
      37             :             StyleContainer& rStyles,
      38             :             PDFIProcessor&  rProc ) const
      39             :         {
      40           1 :             return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc));
      41             :         }
      42             : 
      43           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor&) const
      44             :         {
      45           1 :             return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext));
      46             :         }
      47             :     };
      48             : 
      49           0 :     struct ImpressTreeVisitorFactory : public TreeVisitorFactory
      50             :     {
      51           0 :         ImpressTreeVisitorFactory() {}
      52             : 
      53           0 :         virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const
      54             :         {
      55           0 :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc));
      56             :         }
      57             : 
      58           0 :         virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
      59             :             StyleContainer& rStyles,
      60             :             PDFIProcessor&  rProc ) const
      61             :         {
      62           0 :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc));
      63             :         }
      64             : 
      65           0 :         virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor& rProc) const
      66             :         {
      67             :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
      68             :                                                                             DrawXmlEmitter::IMPRESS_DOC,
      69             :                                                                             rProc
      70           0 :                                                                             ));
      71             :         }
      72             :     };
      73             : 
      74           2 :     struct DrawTreeVisitorFactory : public TreeVisitorFactory
      75             :     {
      76           1 :         DrawTreeVisitorFactory() {}
      77             : 
      78           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const
      79             :         {
      80           1 :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc));
      81             :         }
      82             : 
      83           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
      84             :             StyleContainer& rStyles,
      85             :             PDFIProcessor&  rProc ) const
      86             :         {
      87           1 :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc));
      88             :         }
      89             : 
      90           1 :         virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor& rProc) const
      91             :         {
      92             :             return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
      93             :                                                                             DrawXmlEmitter::DRAW_DOC,
      94             :                                                                             rProc
      95           1 :                                                                             ));
      96             :         }
      97             :     };
      98             : 
      99           1 :     TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
     100             :     {
     101           1 :         return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory());
     102             :     }
     103           0 :     TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()
     104             :     {
     105           0 :         return TreeVisitorFactorySharedPtr(new ImpressTreeVisitorFactory());
     106             :     }
     107           1 :     TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
     108             :     {
     109           1 :         return TreeVisitorFactorySharedPtr(new DrawTreeVisitorFactory());
     110             :     }
     111             : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10