diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-08-14 15:57:38 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-08-14 15:57:38 +0000 |
commit | 738d3d1e98ad1699e75df7792fdf693511200d26 (patch) | |
tree | 40191a251dbb1739e94248f62a4f0730a708c065 | |
parent | 0db1839759bbf5d6bd8cee47297436c711b2da72 (diff) |
INTEGRATION: CWS pdf25 (1.1.2); FILE ADDED
2008/07/24 11:29:03 akhva 1.1.2.1: #90061
-rw-r--r-- | sdext/source/pdfimport/delzip | 1 | ||||
-rw-r--r-- | sdext/source/pdfimport/exports.map | 9 | ||||
-rw-r--r-- | sdext/source/pdfimport/filterdet.hxx | 116 | ||||
-rw-r--r-- | sdext/source/pdfimport/pdfiadaptor.hxx | 140 | ||||
-rw-r--r-- | sdext/source/pdfimport/pdfisettings.pmk | 32 |
5 files changed, 298 insertions, 0 deletions
diff --git a/sdext/source/pdfimport/delzip b/sdext/source/pdfimport/delzip new file mode 100644 index 000000000000..e16c76dff888 --- /dev/null +++ b/sdext/source/pdfimport/delzip @@ -0,0 +1 @@ +"" diff --git a/sdext/source/pdfimport/exports.map b/sdext/source/pdfimport/exports.map new file mode 100644 index 000000000000..c673092ae700 --- /dev/null +++ b/sdext/source/pdfimport/exports.map @@ -0,0 +1,9 @@ +PDFFILTER_1_0 { + global: + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +};
\ No newline at end of file diff --git a/sdext/source/pdfimport/filterdet.hxx b/sdext/source/pdfimport/filterdet.hxx new file mode 100644 index 000000000000..e9604d486634 --- /dev/null +++ b/sdext/source/pdfimport/filterdet.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: filterdet.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_PDFI_FILTERDET_HXX +#define INCLUDED_PDFI_FILTERDET_HXX + +#include <com/sun/star/document/XExtendedFilterDetection.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + + +namespace pdfi +{ + +typedef ::cppu::WeakComponentImplHelper1< + com::sun::star::document::XExtendedFilterDetection > PDFDetectorBase; + +class PDFDetector : private cppu::BaseMutex, + public PDFDetectorBase +{ +private: + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext > m_xContext; + +public: + explicit PDFDetector( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext ); + + // XExtendedFilterDetection + virtual rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue >& io_rDescriptor ) + throw (com::sun::star::uno::RuntimeException); +}; + + +/** Retrieve embedded substream from PDF file + + Useful e.g. for hybrid PDF + + @param rPDFFile + URI of the pdf file + + @param o_rOutMimetype + Output parameter. Receives the mime type of the + substream. Used to distinguish between + draw/impress/writer/calc during import + + @param o_rOutPwd + In/Out parameter. If given password is wrong, user is queried + for another (if bMayUseUI is true) + + @param xContext + Component context + + @param rFilterData + Basically used to pass on XFilter::filter properties (function + uses it to retrieve interaction handler) + + @param bMayUseUI + When false, no dialog is opened to query user for alternate + password + */ +com::sun::star::uno::Reference< com::sun::star::io::XStream > + getAdditionalStream( const rtl::OUString& rPDFFile, + rtl::OUString& o_rOutMimetype, + rtl::OUString& io_rOutPwd, + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext, + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData, + bool bMayUseUI ); + + +bool checkDocChecksum( const rtl::OUString& rInPDFFileURL, + sal_uInt32 nBytes, + const rtl::OUString& rChkSum ); + +bool getPassword( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler, + rtl::OUString& o_rPwd, + bool bFirstTry ); + +} + +#endif + diff --git a/sdext/source/pdfimport/pdfiadaptor.hxx b/sdext/source/pdfimport/pdfiadaptor.hxx new file mode 100644 index 000000000000..37779ab7e3a8 --- /dev/null +++ b/sdext/source/pdfimport/pdfiadaptor.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pdfiadaptor.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_PDFIADAPTOR_HXX +#define INCLUDED_PDFIADAPTOR_HXX + +#include "xmlemitter.hxx" +#include "treevisitorfactory.hxx" + +#include <com/sun/star/xml/XImportFilter.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/basemutex.hxx> + + +namespace pdfi +{ + typedef ::cppu::WeakComponentImplHelper2< + com::sun::star::document::XFilter, + com::sun::star::document::XImporter > PDFIHybridAdaptorBase; + + class PDFIHybridAdaptor : private cppu::BaseMutex, + public PDFIHybridAdaptorBase + { + private: + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext > m_xContext; + com::sun::star::uno::Reference< + com::sun::star::frame::XModel > m_xModel; + + public: + explicit PDFIHybridAdaptor( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext ); + + // XFilter + virtual sal_Bool SAL_CALL filter( const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rFilterData ) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel() throw(); + + // XImporter + virtual void SAL_CALL setTargetDocument( const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xDocument ) + throw( com::sun::star::lang::IllegalArgumentException ); + + }; + + typedef ::cppu::WeakComponentImplHelper2< + com::sun::star::xml::XImportFilter, + com::sun::star::document::XImporter > PDFIAdaptorBase; + + /** Adapts raw pdf import to XImportFilter interface + */ + class PDFIRawAdaptor : private cppu::BaseMutex, + public PDFIAdaptorBase + { + private: + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext > m_xContext; + com::sun::star::uno::Reference< + com::sun::star::frame::XModel > m_xModel; + TreeVisitorFactorySharedPtr m_pVisitorFactory; + bool m_bEnableToplevelText; + + bool parse( const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInput, + const com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>& xStatus, + const XmlEmitterSharedPtr& rEmitter, + const rtl::OUString& rURL ); + + public: + explicit PDFIRawAdaptor( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext ); + + /** Set factory object used to create the tree visitors + + Used for customizing the tree to the specific output + format (writer, draw, etc) + */ + void setTreeVisitorFactory(const TreeVisitorFactorySharedPtr& rVisitorFactory); + + /// TEMP - enable writer-like text:p on doc level + void enableToplevelText() { m_bEnableToplevelText=true; } + + /** Export pdf document to ODG + + @param xOutput + Stream to write the flat xml file to + + @param xStatus + Optional status indicator + */ + bool odfConvert( const rtl::OUString& rURL, + const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOutput, + const com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>& xStatus ); + + // XImportFilter + virtual sal_Bool SAL_CALL importer( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rSourceData, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& rHdl, + const com::sun::star::uno::Sequence< rtl::OUString >& rUserData ) throw( com::sun::star::uno::RuntimeException ); + + // XImporter + virtual void SAL_CALL setTargetDocument( const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xDocument ) + throw( com::sun::star::lang::IllegalArgumentException ); + }; +} + +#endif diff --git a/sdext/source/pdfimport/pdfisettings.pmk b/sdext/source/pdfimport/pdfisettings.pmk new file mode 100644 index 000000000000..8c31d1b93be4 --- /dev/null +++ b/sdext/source/pdfimport/pdfisettings.pmk @@ -0,0 +1,32 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: pdfisettings.pmk,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +IMPLEMENTATION_IDENTIFIER="com.sun.star.PDFImport-$(PLATFORMID)" |