crashtesting: assert on reimport of docx export of ooo102874-2.doc
[LibreOffice.git] / sdext / source / pdfimport / pdfiadaptor.hxx
blob8cf225b74332334e9eb23054bbb9ed127c31818c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_PDFIADAPTOR_HXX
21 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_PDFIADAPTOR_HXX
23 #include <xmlemitter.hxx>
24 #include <treevisitorfactory.hxx>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/xml/XImportFilter.hpp>
28 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/task/XStatusIndicator.hpp>
31 #include <com/sun/star/document/XFilter.hpp>
32 #include <com/sun/star/io/XInputStream.hpp>
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/document/XImporter.hpp>
35 #include <com/sun/star/frame/XModel.hpp>
37 #include <comphelper/compbase.hxx>
40 namespace pdfi
42 typedef ::comphelper::WeakComponentImplHelper<
43 css::document::XFilter,
44 css::document::XImporter,
45 css::lang::XServiceInfo> PDFIHybridAdaptorBase;
47 class PDFIHybridAdaptor : public PDFIHybridAdaptorBase
49 private:
50 css::uno::Reference<
51 css::uno::XComponentContext > m_xContext;
52 css::uno::Reference<
53 css::frame::XModel > m_xModel;
55 public:
56 explicit PDFIHybridAdaptor( const css::uno::Reference<
57 css::uno::XComponentContext >& xContext );
59 // XFilter
60 virtual sal_Bool SAL_CALL filter( const css::uno::Sequence<css::beans::PropertyValue>& rFilterData ) override;
61 virtual void SAL_CALL cancel() override;
63 // XImporter
64 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDocument ) override;
66 OUString SAL_CALL getImplementationName() override;
68 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
70 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
73 typedef ::comphelper::WeakComponentImplHelper<
74 css::xml::XImportFilter,
75 css::document::XImporter,
76 css::lang::XServiceInfo> PDFIAdaptorBase;
78 /** Adapts raw pdf import to XImportFilter interface
80 class PDFIRawAdaptor : public PDFIAdaptorBase
82 private:
83 OUString const m_implementationName;
84 css::uno::Reference<
85 css::uno::XComponentContext > m_xContext;
86 css::uno::Reference<
87 css::frame::XModel > m_xModel;
88 TreeVisitorFactorySharedPtr m_pVisitorFactory;
90 bool parse( const css::uno::Reference<css::io::XInputStream>& xInput,
91 const css::uno::Reference<css::task::XInteractionHandler>& xIHdl,
92 const OUString& rPwd,
93 const css::uno::Reference<css::task::XStatusIndicator>& xStatus,
94 const XmlEmitterSharedPtr& rEmitter,
95 const OUString& rURL,
96 const OUString& rFilterOptions);
98 public:
99 explicit PDFIRawAdaptor( OUString const & implementationName,
100 const css::uno::Reference<
101 css::uno::XComponentContext >& xContext );
103 /** Set factory object used to create the tree visitors
105 Used for customizing the tree to the specific output
106 format (writer, draw, etc)
108 void setTreeVisitorFactory(const TreeVisitorFactorySharedPtr& rVisitorFactory);
110 /** Export pdf document to ODG
112 @param xOutput
113 Stream to write the flat xml file to
115 @param xStatus
116 Optional status indicator
118 bool odfConvert( const OUString& rURL,
119 const css::uno::Reference<css::io::XOutputStream>& xOutput,
120 const css::uno::Reference<css::task::XStatusIndicator>& xStatus );
122 // XImportFilter
123 virtual sal_Bool SAL_CALL importer( const css::uno::Sequence< css::beans::PropertyValue >& rSourceData,
124 const css::uno::Reference< css::xml::sax::XDocumentHandler >& rHdl,
125 const css::uno::Sequence< OUString >& rUserData ) override;
127 // XImporter
128 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDocument ) override;
130 OUString SAL_CALL getImplementationName() override;
132 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
134 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
138 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */