LCOV - code coverage report
Current view: top level - sdext/source/pdfimport - pdfiadaptor.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 3 33.3 %
Date: 2014-11-03 Functions: 1 5 20.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_PDFIADAPTOR_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_PDFIADAPTOR_HXX
      22             : 
      23             : #include "xmlemitter.hxx"
      24             : #include "treevisitorfactory.hxx"
      25             : 
      26             : #include <com/sun/star/xml/XImportFilter.hpp>
      27             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      28             : #include <com/sun/star/uno/XComponentContext.hpp>
      29             : #include <com/sun/star/task/XStatusIndicator.hpp>
      30             : #include <com/sun/star/document/XFilter.hpp>
      31             : #include <com/sun/star/io/XInputStream.hpp>
      32             : #include <com/sun/star/io/XOutputStream.hpp>
      33             : #include <com/sun/star/document/XImporter.hpp>
      34             : #include <com/sun/star/frame/XModel.hpp>
      35             : 
      36             : #include <cppuhelper/compbase2.hxx>
      37             : #include <cppuhelper/basemutex.hxx>
      38             : 
      39             : 
      40             : namespace pdfi
      41             : {
      42             :     typedef ::cppu::WeakComponentImplHelper2<
      43             :         css::document::XFilter,
      44             :         css::document::XImporter > PDFIHybridAdaptorBase;
      45             : 
      46           0 :     class PDFIHybridAdaptor : private cppu::BaseMutex,
      47             :                               public PDFIHybridAdaptorBase
      48             :     {
      49             :     private:
      50             :         css::uno::Reference<
      51             :             css::uno::XComponentContext >  m_xContext;
      52             :         css::uno::Reference<
      53             :             css::frame::XModel >           m_xModel;
      54             : 
      55             :     public:
      56             :         explicit PDFIHybridAdaptor( const css::uno::Reference<
      57             :                                           css::uno::XComponentContext >& xContext );
      58             : 
      59             :         // XFilter
      60             :         virtual sal_Bool SAL_CALL filter( const css::uno::Sequence<css::beans::PropertyValue>& rFilterData ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      61             :         virtual void SAL_CALL cancel() throw(std::exception) SAL_OVERRIDE;
      62             : 
      63             :         // XImporter
      64             :         virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDocument )
      65             :             throw( css::lang::IllegalArgumentException, std::exception ) SAL_OVERRIDE;
      66             : 
      67             :     };
      68             : 
      69             :     typedef ::cppu::WeakComponentImplHelper2<
      70             :         css::xml::XImportFilter,
      71             :         css::document::XImporter > PDFIAdaptorBase;
      72             : 
      73             :     /** Adapts raw pdf import to XImportFilter interface
      74             :      */
      75           4 :     class PDFIRawAdaptor : private cppu::BaseMutex,
      76             :                            public PDFIAdaptorBase
      77             :     {
      78             :     private:
      79             :         css::uno::Reference<
      80             :             css::uno::XComponentContext >  m_xContext;
      81             :         css::uno::Reference<
      82             :             css::frame::XModel >           m_xModel;
      83             :         TreeVisitorFactorySharedPtr                   m_pVisitorFactory;
      84             :         bool                                          m_bEnableToplevelText;
      85             : 
      86             :         bool parse( const css::uno::Reference<css::io::XInputStream>&       xInput,
      87             :                     const css::uno::Reference<css::task::XInteractionHandler>& xIHdl,
      88             :                     const OUString&                                                          rPwd,
      89             :                     const css::uno::Reference<css::task::XStatusIndicator>& xStatus,
      90             :                     const XmlEmitterSharedPtr&                                                    rEmitter,
      91             :                     const OUString&                                                          rURL );
      92             : 
      93             :     public:
      94             :         explicit PDFIRawAdaptor( const css::uno::Reference<
      95             :                                        css::uno::XComponentContext >& xContext );
      96             : 
      97             :         /** Set factory object used to create the tree visitors
      98             : 
      99             :             Used for customizing the tree to the specific output
     100             :             format (writer, draw, etc)
     101             :          */
     102             :         void setTreeVisitorFactory(const TreeVisitorFactorySharedPtr& rVisitorFactory);
     103             : 
     104             :         /// TEMP - enable writer-like text:p on doc level
     105           0 :         void enableToplevelText() { m_bEnableToplevelText=true; }
     106             : 
     107             :         /** Export pdf document to ODG
     108             : 
     109             :             @param xOutput
     110             :             Stream to write the flat xml file to
     111             : 
     112             :             @param xStatus
     113             :             Optional status indicator
     114             :          */
     115             :         bool odfConvert( const OUString&                                                          rURL,
     116             :                          const css::uno::Reference<css::io::XOutputStream>&      xOutput,
     117             :                          const css::uno::Reference<css::task::XStatusIndicator>& xStatus );
     118             : 
     119             :         // XImportFilter
     120             :         virtual sal_Bool SAL_CALL importer( const css::uno::Sequence< css::beans::PropertyValue >& rSourceData,
     121             :                                             const css::uno::Reference< css::xml::sax::XDocumentHandler >& rHdl,
     122             :                                             const css::uno::Sequence< OUString >& rUserData ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     123             : 
     124             :         // XImporter
     125             :         virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDocument )
     126             :             throw( css::lang::IllegalArgumentException, std::exception ) SAL_OVERRIDE;
     127             :     };
     128             : }
     129             : 
     130             : #endif
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10