diff options
author | Sven Jacobi <sj@openoffice.org> | 2002-03-07 16:54:56 +0000 |
---|---|---|
committer | Sven Jacobi <sj@openoffice.org> | 2002-03-07 16:54:56 +0000 |
commit | 9dca300a3dfd767575d145a90a1b9dbe301f3ac1 (patch) | |
tree | c31854d27538040692270243de324554b589774b /filter/source/msfilter | |
parent | 5acbb755f3f8dedf51904b711ff78f5e1aa498cf (diff) |
initial version
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r-- | filter/source/msfilter/powerpoint/makefile.mk | 134 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/pptcom.hxx | 144 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/pptimporter.cxx | 201 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/pptimporter.hxx | 129 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/pptimporteruno.cxx | 141 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/ppttoxml.cxx | 126 | ||||
-rw-r--r-- | filter/source/msfilter/powerpoint/ppttoxml.hxx | 87 |
7 files changed, 962 insertions, 0 deletions
diff --git a/filter/source/msfilter/powerpoint/makefile.mk b/filter/source/msfilter/powerpoint/makefile.mk new file mode 100644 index 000000000000..dce115582c79 --- /dev/null +++ b/filter/source/msfilter/powerpoint/makefile.mk @@ -0,0 +1,134 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: sj $ $Date: 2002-03-07 17:54:35 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJNAME=filter +TARGET=PptImporter + +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb +ENABLE_EXCEPTIONS=TRUE +USE_DEFFILE=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Types ------------------------------------- + +UNOTYPES= com.sun.star.uno.XWeak \ + com.sun.star.uno.XNamingService \ + com.sun.star.uno.XComponentContext \ + com.sun.star.uno.XAggregation \ + com.sun.star.lang.XServiceInfo \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleComponentFactory \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.registry.XSimpleRegistry \ + com.sun.star.document.XFilter \ + com.sun.star.document.XImporter \ + com.sun.star.lang.XInitialization \ + com.sun.star.io.XInputStream \ + com.sun.star.xml.sax.XDocumentHandler \ + com.sun.star.xml.sax.InputSource \ + com.sun.star.xml.sax.XParser + +# --- Files ------------------------------------- + +CXXFILES= pptimporter.cxx \ + pptimporteruno.cxx \ + ppttoxml.cxx + + +SLOFILES= $(SLO)$/pptimporter.obj \ + $(SLO)$/pptimporteruno.obj \ + $(SLO)$/ppttoxml.obj + +# --- Library ----------------------------------- + +SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX) +SHL1STDLIBS=$(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(ONELIB) \ + $(TOOLSLIB) \ + $(SOTLIB) \ + $(XMLOFFLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk diff --git a/filter/source/msfilter/powerpoint/pptcom.hxx b/filter/source/msfilter/powerpoint/pptcom.hxx new file mode 100644 index 000000000000..de566c2c35f1 --- /dev/null +++ b/filter/source/msfilter/powerpoint/pptcom.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * $RCSfile: pptcom.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PPTCOM_HXX +#define _PPTCOM_HXX + +#ifndef __RTL_USTRING_ +#include <rtl/ustring> +#endif +#ifndef _DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif +#ifndef _STACK_HXX +#include <tools/stack.hxx> +#endif + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/RuntimeException.hpp> +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif +#ifndef _XMLOFF_XMLEXP_HXX +#include <xmloff/xmlexp.hxx> +#endif +#ifndef _XMLOFF_NMSPMAP_HXX +#include <xmloff/nmspmap.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE4_HXX_ +#include <cppuhelper/implbase4.hxx> +#endif +#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_ +#include <com/sun/star/document/XFilter.hpp> +#endif +#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_ +#include <com/sun/star/document/XImporter.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +// ----------------------------------------------------------------------------- + +#define NMSP_CPPU cppu +#define NMSP_RTL rtl +#define NMSP_UTL utl +#define NMSP_COMPHELPER comphelper +#define NMSP_UNO com::sun::star::uno +#define NMSP_BEANS com::sun::star::beans +#define NMSP_LANG com::sun::star::lang +#define NMSP_IO com::sun::star::io +#define NMSP_SAX com::sun::star::xml::sax +#define NMSP_PRES com::sun::star::presentation +#define NMSP_REGISTRY com::sun::star::registry +#define NMSP_DOCUMENT com::sun::star::document + + +#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj > +#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj > +#define ANY NMSP_UNO::Any +#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar ))) +#define PPT_DTD_STRING B2UCONST( "<!DOCTYPE office:document-styles PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"office.dtd\">" +#endif diff --git a/filter/source/msfilter/powerpoint/pptimporter.cxx b/filter/source/msfilter/powerpoint/pptimporter.cxx new file mode 100644 index 000000000000..265de7183700 --- /dev/null +++ b/filter/source/msfilter/powerpoint/pptimporter.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: pptimporter.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PPTIMPORTER_HXX +#include "pptimporter.hxx" +#endif + +#ifdef DBG_DUMP_PPT_IMPORT +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_ +#include <com/sun/star/io/XActiveDataSource.hpp> +#endif +#ifndef _UTL_STREAM_WRAPPER_HXX_ +#include <unotools/streamwrap.hxx> +#endif +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif +#endif + +#include <uno/mapping.hxx> + +// ----------------- +// - PptImporter - +// ----------------- + +NMSP_RTL::OUString PptImporter_getImplementationName() + throw( NMSP_UNO::RuntimeException ) +{ + return B2UCONST( "com.sun.star.presentation.PptImporter" ); +} +#define SERVICE_NAME "com.sun.star.document.ImportFilter" +sal_Bool SAL_CALL PptImporter_supportsService( const NMSP_RTL::OUString& ServiceName ) + throw( NMSP_UNO::RuntimeException ) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SERVICE_NAME ) ); +} + +SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter_getSupportedServiceNames() + throw( NMSP_UNO::RuntimeException ) +{ + SEQ( NMSP_RTL::OUString ) aRet(1); + NMSP_RTL::OUString* pArray = aRet.getArray(); + pArray[0] = B2UCONST( SERVICE_NAME ); + return aRet; +} +#undef SERVICE_NAME + +// ----------------------------------------------------------------------------- + +PptImporter::PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) : + xFact( rxMgr ) +{ + NMSP_RTL::OUString sService( B2UCONST( "com.sun.star.comp.Impress.XMLImporter" ) ); + try + { + xHdl = REF( NMSP_SAX::XDocumentHandler ) ( xFact->createInstance( sService ), NMSP_UNO::UNO_QUERY ); + xImporter = REF( NMSP_DOCUMENT::XImporter )( xHdl, NMSP_UNO::UNO_QUERY ); + } + catch( NMSP_UNO::Exception & ) + { + } +} + +// ----------------------------------------------------------------------------- + +PptImporter::~PptImporter() +{ +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL PptImporter::acquire() throw() +{ + OWeakObject::acquire(); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL PptImporter::release() throw() +{ + OWeakObject::release(); +} + +// XFilter +sal_Bool SAL_CALL PptImporter::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor ) + throw ( NMSP_UNO::RuntimeException ) +{ + + +#ifdef DBG_DUMP_PPT_IMPORT + + REF( NMSP_LANG::XMultiServiceFactory ) xServiceFactory( NMSP_COMPHELPER::getProcessServiceFactory() ); + REF( NMSP_UNO::XInterface ) xWriter( xServiceFactory->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ) ); + SvFileStream aStrm( B2UCONST( "d:\\test2.xml" ), STREAM_READ | STREAM_WRITE | STREAM_TRUNC ); + REF( NMSP_IO::XOutputStream ) xOutStream( (::cppu::OWeakObject*) new NMSP_UTL::OOutputStreamWrapper( aStrm ), NMSP_UNO::UNO_QUERY ); + REF( NMSP_IO::XActiveDataSource ) xDataSource( xWriter , NMSP_UNO::UNO_QUERY ); + xDataSource->setOutputStream( xOutStream ); + aFilter.filter( aDescriptor, REF( NMSP_SAX::XDocumentHandler )( xWriter, NMSP_UNO::UNO_QUERY ) ); + +// REF( NMSP_BEANS::XPropertySet ) xPropSet( xServiceFactory->createInstance( B2UCONST( "com.sun.star.beans.PropertySet" ) ) ); +// Any aAny; +// aAny <<= (sal_Bool)sal_True; +// xPropSet->setPropertyValue( B2UCONST( "UsePrettyPrinting" ), aAny ); + +#endif + + return aFilter.filter( aDescriptor, xHdl ); +} +void SAL_CALL PptImporter::cancel() + throw ( NMSP_UNO::RuntimeException ) +{ + aFilter.cancel(); +} + +// XImporter +void SAL_CALL PptImporter::setTargetDocument( const REF( NMSP_LANG::XComponent )& xDoc ) + throw ( NMSP_LANG::IllegalArgumentException, NMSP_UNO::RuntimeException) +{ + xImporter->setTargetDocument( xDoc ); +} + +// XInitialization +void SAL_CALL PptImporter::initialize( const SEQ( NMSP_UNO::Any )& aArguments ) + throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException ) +{ +} + +// XServiceInfo +NMSP_RTL::OUString SAL_CALL PptImporter::getImplementationName() + throw( NMSP_UNO::RuntimeException ) +{ + return PptImporter_getImplementationName(); +} +sal_Bool SAL_CALL PptImporter::supportsService( const NMSP_RTL::OUString& rServiceName ) + throw( NMSP_UNO::RuntimeException ) +{ + return PptImporter_supportsService( rServiceName ); +} +SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter::getSupportedServiceNames() + throw ( NMSP_UNO::RuntimeException ) +{ + return PptImporter_getSupportedServiceNames(); +} diff --git a/filter/source/msfilter/powerpoint/pptimporter.hxx b/filter/source/msfilter/powerpoint/pptimporter.hxx new file mode 100644 index 000000000000..7c3cfe451963 --- /dev/null +++ b/filter/source/msfilter/powerpoint/pptimporter.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: pptimporter.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PPTIMPORTER_HXX +#define _PPTIMPORTER_HXX + +#ifndef _PPTCOM_HXX +#include "pptcom.hxx" +#endif +#ifndef _PPTTOXML_HXX +#include "ppttoxml.hxx" +#endif + +// --------------- +// - PptImporter - +// --------------- + +class PptImporter : public NMSP_CPPU::WeakImplHelper4 +< + NMSP_DOCUMENT::XFilter, + NMSP_DOCUMENT::XImporter, + NMSP_LANG::XInitialization, + NMSP_LANG::XServiceInfo +> +{ + PptToXml aFilter; + REF( NMSP_SAX::XDocumentHandler ) xHdl; + REF( NMSP_LANG::XMultiServiceFactory ) xFact; + REF( NMSP_DOCUMENT::XImporter ) xImporter; + +public: + + PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ); + virtual ~PptImporter(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XFilter + virtual sal_Bool SAL_CALL filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor ) + throw ( NMSP_UNO::RuntimeException ); + virtual void SAL_CALL cancel( ) + throw ( NMSP_UNO::RuntimeException ); + + // XImporter + virtual void SAL_CALL setTargetDocument( const REF(NMSP_LANG::XComponent)& xDoc ) + throw ( NMSP_LANG::IllegalArgumentException, NMSP_UNO::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments ) + throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException ); + + // XServiceInfo + virtual NMSP_RTL::OUString SAL_CALL getImplementationName() + throw ( NMSP_UNO::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const NMSP_RTL::OUString& ServiceName ) + throw ( NMSP_UNO::RuntimeException ); + virtual SEQ( NMSP_RTL::OUString ) SAL_CALL getSupportedServiceNames() + throw ( NMSP_UNO::RuntimeException ); + +}; + +NMSP_RTL::OUString PptImporter_getImplementationName() + throw ( NMSP_UNO::RuntimeException ); +sal_Bool SAL_CALL PptImportert_supportsService( const NMSP_RTL::OUString& ServiceName ) + throw( NMSP_UNO::RuntimeException ); +SEQ( NMSP_RTL::OUString ) SAL_CALL PptImporter_getSupportedServiceNames() + throw( NMSP_UNO::RuntimeException ); + +#endif diff --git a/filter/source/msfilter/powerpoint/pptimporteruno.cxx b/filter/source/msfilter/powerpoint/pptimporteruno.cxx new file mode 100644 index 000000000000..b768fff087a6 --- /dev/null +++ b/filter/source/msfilter/powerpoint/pptimporteruno.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * $RCSfile: pptimporteruno.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "pptimporter.hxx" + +#include <cppuhelper/factory.hxx> +#include <uno/mapping.hxx> + +// ------------------- +// - factory methods - +// ------------------- + +static REF( NMSP_UNO::XInterface ) SAL_CALL create_PptImporter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact ) +{ + return REF( NMSP_UNO::XInterface )( *new PptImporter( rxFact ) ); +} + +// ------------------------------------------ +// - component_getImplementationEnvironment - +// ------------------------------------------ + +extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +// ----------------------- +// - component_writeInfo - +// ----------------------- + +extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) +{ + sal_Bool bRet = sal_False; + + if( pRegistryKey ) + { + try + { + NMSP_UNO::Reference< NMSP_REGISTRY::XRegistryKey > xNewKey( + reinterpret_cast< NMSP_REGISTRY::XRegistryKey * >( pRegistryKey )->createKey( + PptImporter_getImplementationName() ) ); + xNewKey = xNewKey->createKey( B2UCONST( "/UNO/SERVICES" ) ); + const SEQ( NMSP_RTL::OUString )& rSNL = PptImporter_getSupportedServiceNames(); + const NMSP_RTL::OUString * pArray = rSNL.getConstArray(); + for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) + xNewKey->createKey( pArray[nPos] ); + bRet = sal_True; + } + catch( NMSP_REGISTRY::InvalidRegistryException& ) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return bRet; +} + +// ------------------------ +// - component_getFactory - +// ------------------------ + +extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey ) +{ + REF( NMSP_LANG::XSingleServiceFactory ) xFactory; + void* pRet = 0; + + if( rtl_str_compare( pImplName, "com.sun.star.presentation.PptImporter" ) == 0 ) + { + const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.presentation.PptImporter" ) ); + + xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory( + reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ), + B2UCONST( "com.sun.star.presentation.PptImporter" ), + create_PptImporter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) ); + } + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} diff --git a/filter/source/msfilter/powerpoint/ppttoxml.cxx b/filter/source/msfilter/powerpoint/ppttoxml.cxx new file mode 100644 index 000000000000..95667664c0c0 --- /dev/null +++ b/filter/source/msfilter/powerpoint/ppttoxml.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: ppttoxml.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "ppttoxml.hxx" + +#ifndef _SOT_STORAGE_HXX +#include <sot/storage.hxx> +#endif + +PptToXml::PptToXml() +{ +} + +PptToXml::~PptToXml() +{ +} + +sal_Bool PptToXml::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor, + REF( NMSP_SAX::XDocumentHandler ) xHandler ) + throw( NMSP_UNO::RuntimeException ) +{ + xHdl = xHandler; + + sal_Bool bStatus = sal_False; + sal_Int32 i; + for( i = 0; i < aDescriptor.getLength(); i++ ) + { + NMSP_RTL::OUString strTemp; + aDescriptor[ i ].Value >>= strTemp; + +/* we will open the document by url, so the stream is not needed + if( aDescriptor[i].Name == B2UCONST( "InputStream" ) ) + { + REF( NMSP_IO::XInputStream ) rInputStream; + aDescriptor[ i].Value >>= rInputStream; + } + else +*/ + if ( aDescriptor[ i ].Name == B2UCONST( "URL" ) ) + { + NMSP_RTL::OUString sURL; + aDescriptor[ i ].Value >>= sURL; + SotStorageRef xStg( new SotStorage( sURL, STREAM_STD_READ, 0 ) ); + if ( xStg.Is() ) + { + SotStorageStreamRef xDocStream( xStg->OpenSotStream( B2UCONST( "PowerPoint Document" ), STREAM_STD_READ ) ); + if( xDocStream.Is() ) + { + xDocStream->SetVersion( xStg->GetVersion() ); + xDocStream->SetKey( xStg->GetKey() ); + +// xHdl->unknown( PPT_DTD_STRING ); + xHdl->startDocument(); + + + xHdl->endDocument(); + bStatus = sal_True; + } + } + } + } + return bStatus; +} + +void PptToXml::cancel() +{ + +} diff --git a/filter/source/msfilter/powerpoint/ppttoxml.hxx b/filter/source/msfilter/powerpoint/ppttoxml.hxx new file mode 100644 index 000000000000..fc595dfff0f9 --- /dev/null +++ b/filter/source/msfilter/powerpoint/ppttoxml.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: ppttoxml.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sj $ $Date: 2002-03-07 17:54:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PPTTOXML_HXX +#define _PPTTOXML_HXX + +#ifndef _PPTCOM_HXX +#include "pptcom.hxx" +#endif + +// ------------ +// - PptToXml - +// ------------ + +class PptToXml +{ + REF( NMSP_SAX::XDocumentHandler ) xHdl; + + public: + + PptToXml(); + ~PptToXml(); + + sal_Bool filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor, + REF(NMSP_SAX::XDocumentHandler) xHandler ); + void cancel(); +}; + +#endif |