LCOV - code coverage report
Current view: top level - sdext/source/pdfimport/tree - drawtreevisiting.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 12 100.0 %
Date: 2014-11-03 Functions: 9 9 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             : 
      20             : #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_TREE_DRAWTREEVISITING_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_TREE_DRAWTREEVISITING_HXX
      22             : 
      23             : #include "treevisiting.hxx"
      24             : 
      25             : #include "com/sun/star/i18n/XBreakIterator.hpp"
      26             : #include "com/sun/star/i18n/XCharacterClassification.hpp"
      27             : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
      28             : #include "com/sun/star/uno/XComponentContext.hpp"
      29             : 
      30             : namespace pdfi
      31             : {
      32             :     struct DrawElement;
      33             : 
      34           4 :     class DrawXmlOptimizer : public ElementTreeVisitor
      35             :     {
      36             :     private:
      37             :         PDFIProcessor& m_rProcessor;
      38             :         void optimizeTextElements(Element& rParent);
      39             : 
      40             :     public:
      41             :     css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter;
      42             :     const css::uno::Reference< css::i18n::XBreakIterator >& GetBreakIterator();
      43           2 :         explicit DrawXmlOptimizer(PDFIProcessor& rProcessor) :
      44           2 :             m_rProcessor(rProcessor)
      45           2 :         {}
      46             : 
      47             :         virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
      48             :         virtual void visit( TextElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      49             :         virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      50             :         virtual void visit( FrameElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      51             :         virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      52             :         virtual void visit( ImageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      53             :         virtual void visit( PageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      54             :         virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      55             :     };
      56             : 
      57           4 :     class DrawXmlFinalizer : public ElementTreeVisitor
      58             :     {
      59             :     private:
      60             :         StyleContainer& m_rStyleContainer;
      61             :         PDFIProcessor&  m_rProcessor;
      62             : 
      63             :     public:
      64           2 :         explicit DrawXmlFinalizer(StyleContainer& rStyleContainer,
      65             :                                   PDFIProcessor&  rProcessor) :
      66             :             m_rStyleContainer(rStyleContainer),
      67           2 :             m_rProcessor(rProcessor)
      68           2 :         {}
      69             : 
      70             :         virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
      71             :         virtual void visit( TextElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      72             :         virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      73             :         virtual void visit( FrameElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      74             :         virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      75             :         virtual void visit( ImageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      76             :         virtual void visit( PageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      77             :         virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
      78             :     };
      79             : 
      80           4 :     class DrawXmlEmitter : public ElementTreeVisitor
      81             :     {
      82             :     private:
      83             :     css::uno::Reference< css::lang::XMultiServiceFactory > xFactory;
      84             :     css::uno::Reference< css::uno::XComponentContext > xCtx;
      85             :     css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter;
      86             :     css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
      87             : 
      88             :         PDFIProcessor&  m_rProcessor;
      89             : 
      90             :         EmitContext& m_rEmitContext ;
      91             :         /// writes Impress doc when false
      92             :         const bool   m_bWriteDrawDocument;
      93             : 
      94             :         void fillFrameProps( DrawElement&       rElem,
      95             :                              PropertyMap&       rProps,
      96             :                              const EmitContext& rEmitContext,
      97             :                              bool               bWasTransformed = false
      98             :                              );
      99             : 
     100             :     public:
     101             :     const css::uno::Reference< css::i18n::XCharacterClassification >& GetCharacterClassification();
     102             :         enum DocType{ DRAW_DOC, IMPRESS_DOC };
     103           2 :         explicit DrawXmlEmitter(EmitContext& rEmitContext, DocType eDocType, PDFIProcessor& rProc ) :
     104             :             m_rProcessor( rProc ),
     105             :             m_rEmitContext(rEmitContext),
     106           2 :             m_bWriteDrawDocument(eDocType==DRAW_DOC)
     107           2 :         {}
     108             : 
     109             :         virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
     110             :         virtual void visit( TextElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     111             :         virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     112             :         virtual void visit( FrameElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     113             :         virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     114             :         virtual void visit( ImageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     115             :         virtual void visit( PageElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     116             :         virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator&  ) SAL_OVERRIDE;
     117             :     };
     118             : }
     119             : 
     120             : #endif
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10