Add a filter for AppleWork's presentation file...
Change-Id: I9f03ecc6d67ad77ccb0d5240fe0b5968c8063bd3
This commit is contained in:
parent
9df18fd92c
commit
3a6e9fb873
@ -687,6 +687,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impress_types.xcu,filte
|
||||
impress_OOXML_Presentation \
|
||||
impress_OOXML_Presentation_Template \
|
||||
impress_OOXML_Presentation_AutoPlay \
|
||||
impress_ClarisWorks \
|
||||
)
|
||||
|
||||
$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filters.xcu,filter/source/config/fragments/filters,\
|
||||
@ -709,6 +710,7 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filters.xcu,f
|
||||
impress_OOXML \
|
||||
impress_OOXML_Template \
|
||||
impress_OOXML_AutoPlay \
|
||||
ClarisWorks_Impress \
|
||||
)
|
||||
|
||||
$(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
|
||||
|
@ -0,0 +1,30 @@
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<node oor:name="ClarisWorks_Impress" oor:op="replace">
|
||||
<prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
|
||||
<prop oor:name="UIComponent"/>
|
||||
<prop oor:name="FilterService"><value>com.sun.star.comp.Impress.MWAWPresentationImportFilter</value></prop>
|
||||
<prop oor:name="UserData"><value></value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value xml:lang="en-US">ClarisWorks/AppleWorks Presentation</value>
|
||||
</prop>
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>impress_ClarisWorks</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
|
||||
</node>
|
29
filter/source/config/fragments/types/impress_ClarisWorks.xcu
Normal file
29
filter/source/config/fragments/types/impress_ClarisWorks.xcu
Normal file
@ -0,0 +1,29 @@
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<node oor:name="impress_ClarisWorks" oor:op="replace" >
|
||||
<prop oor:name="DetectService"><value>com.sun.star.comp.Impress.MWAWPresentationImportFilter</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>cwk</value></prop>
|
||||
<prop oor:name="MediaType"><value>application/clarisworks</value></prop>
|
||||
<prop oor:name="Preferred"><value>true</value></prop>
|
||||
<prop oor:name="PreferredFilter"><value>ClarisWorks_Impress</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>ClarisWorks/AppleWorks Presentation</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
@ -40,6 +40,7 @@ $(eval $(call gb_Library_use_libraries,wpftimpress,\
|
||||
$(eval $(call gb_Library_use_externals,wpftimpress,\
|
||||
boost_headers \
|
||||
etonyek \
|
||||
mwaw \
|
||||
odfgen \
|
||||
revenge \
|
||||
zlib \
|
||||
@ -47,7 +48,9 @@ $(eval $(call gb_Library_use_externals,wpftimpress,\
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,wpftimpress,\
|
||||
writerperfect/source/impress/ImportFilterBase \
|
||||
writerperfect/source/impress/KeynoteImportFilter \
|
||||
writerperfect/source/impress/MWAWPresentationImportFilter \
|
||||
writerperfect/source/impress/wpftimpress_genericfilter \
|
||||
))
|
||||
|
||||
|
248
writerperfect/source/impress/ImportFilterBase.cxx
Normal file
248
writerperfect/source/impress/ImportFilterBase.cxx
Normal file
@ -0,0 +1,248 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/io/XSeekable.hpp>
|
||||
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
||||
#include <com/sun/star/ucb/XContent.hpp>
|
||||
#include <com/sun/star/uno/Reference.h>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||
#include <com/sun/star/xml/sax/InputSource.hpp>
|
||||
#include <com/sun/star/xml/sax/XParser.hpp>
|
||||
|
||||
#include <writerperfect/DirectoryStream.hxx>
|
||||
#include <writerperfect/DocumentHandler.hxx>
|
||||
#include <writerperfect/WPXSvInputStream.hxx>
|
||||
|
||||
#include <xmloff/attrlist.hxx>
|
||||
|
||||
#include <libodfgen/libodfgen.hxx>
|
||||
|
||||
#include "ImportFilterBase.hxx"
|
||||
|
||||
using boost::shared_ptr;
|
||||
|
||||
namespace writerperfect
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::io::XInputStream;
|
||||
using com::sun::star::io::XSeekable;
|
||||
using com::sun::star::uno::Sequence;
|
||||
using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::UNO_QUERY;
|
||||
using com::sun::star::uno::XInterface;
|
||||
using com::sun::star::uno::Exception;
|
||||
using com::sun::star::uno::RuntimeException;
|
||||
using com::sun::star::beans::PropertyValue;
|
||||
using com::sun::star::document::XFilter;
|
||||
using com::sun::star::document::XExtendedFilterDetection;
|
||||
using com::sun::star::document::XImporter;
|
||||
using com::sun::star::xml::sax::InputSource;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XDocumentHandler;
|
||||
using com::sun::star::xml::sax::XParser;
|
||||
|
||||
using writerperfect::DocumentHandler;
|
||||
using writerperfect::WPXSvInputStream;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template<class T>
|
||||
bool lcl_queryIsPackage(const Sequence<T> &lComponentData)
|
||||
{
|
||||
bool bIsPackage = false;
|
||||
|
||||
const sal_Int32 nLength = lComponentData.getLength();
|
||||
const T *pValue = lComponentData.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nLength; ++i)
|
||||
{
|
||||
if (pValue[i].Name == "IsPackage")
|
||||
{
|
||||
pValue[i].Value >>= bIsPackage;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return bIsPackage;
|
||||
}
|
||||
|
||||
bool lcl_isPackage(const Any &rComponentData)
|
||||
{
|
||||
Sequence < ::com::sun::star::beans::NamedValue > lComponentDataNV;
|
||||
Sequence < ::com::sun::star::beans::PropertyValue > lComponentDataPV;
|
||||
|
||||
if (rComponentData >>= lComponentDataNV)
|
||||
return lcl_queryIsPackage(lComponentDataNV);
|
||||
else if (rComponentData >>= lComponentDataPV)
|
||||
return lcl_queryIsPackage(lComponentDataPV);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ImportFilterImpl::ImportFilterImpl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
|
||||
: mxContext(rxContext)
|
||||
{
|
||||
}
|
||||
|
||||
ImportFilterImpl::~ImportFilterImpl()
|
||||
{
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL ImportFilterImpl::filter(const Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
sal_Int32 nLength = aDescriptor.getLength();
|
||||
const PropertyValue *pValue = aDescriptor.getConstArray();
|
||||
Reference < XInputStream > xInputStream;
|
||||
Reference < ::com::sun::star::ucb::XContent > xContent;
|
||||
bool bIsPackage = false;
|
||||
for (sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if (pValue[i].Name == "ComponentData")
|
||||
bIsPackage = lcl_isPackage(pValue[i].Value);
|
||||
else if (pValue[i].Name == "InputStream")
|
||||
pValue[i].Value >>= xInputStream;
|
||||
else if (pValue[i].Name == "UCBContent")
|
||||
pValue[i].Value >>= xContent;
|
||||
}
|
||||
|
||||
if (!xInputStream.is())
|
||||
{
|
||||
OSL_ASSERT(false);
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
if (bIsPackage && !xContent.is())
|
||||
{
|
||||
SAL_WARN("writerperfect", "presentation::ImportFilterImpl::filter: the input claims to be a package, but does not have UCBContent");
|
||||
bIsPackage = false;
|
||||
}
|
||||
|
||||
// An XML import service: what we push sax messages to..
|
||||
Reference < XDocumentHandler > xInternalHandler(
|
||||
mxContext->getServiceManager()->createInstanceWithContext(
|
||||
"com.sun.star.comp.Impress.XMLOasisImporter", mxContext),
|
||||
css::uno::UNO_QUERY_THROW);
|
||||
|
||||
// The XImporter sets up an empty target document for XDocumentHandler to write to..
|
||||
Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
|
||||
xImporter->setTargetDocument(mxDoc);
|
||||
|
||||
// OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
|
||||
// writes to in-memory target doc
|
||||
DocumentHandler xHandler(xInternalHandler);
|
||||
|
||||
shared_ptr< librevenge::RVNGInputStream > input;
|
||||
if (bIsPackage)
|
||||
input.reset(new writerperfect::DirectoryStream(xContent));
|
||||
else
|
||||
input.reset(new WPXSvInputStream(xInputStream));
|
||||
|
||||
OdpGenerator exporter;
|
||||
exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML);
|
||||
|
||||
doRegisterHandlers(exporter);
|
||||
|
||||
bool result=doImportDocument(*input, exporter);
|
||||
return result;
|
||||
}
|
||||
|
||||
void SAL_CALL ImportFilterImpl::cancel()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
}
|
||||
|
||||
// XImporter
|
||||
void SAL_CALL ImportFilterImpl::setTargetDocument(const Reference< ::com::sun::star::lang::XComponent > &xDoc)
|
||||
throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std::exception)
|
||||
{
|
||||
mxDoc = xDoc;
|
||||
}
|
||||
|
||||
// XExtendedFilterDetection
|
||||
OUString SAL_CALL ImportFilterImpl::detect(com::sun::star::uno::Sequence< PropertyValue > &Descriptor)
|
||||
throw(com::sun::star::uno::RuntimeException, std::exception)
|
||||
{
|
||||
OUString sTypeName;
|
||||
sal_Int32 nLength = Descriptor.getLength();
|
||||
sal_Int32 location = nLength;
|
||||
const PropertyValue *pValue = Descriptor.getConstArray();
|
||||
Reference < XInputStream > xInputStream;
|
||||
for (sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if (pValue[i].Name == "TypeName")
|
||||
location=i;
|
||||
else if (pValue[i].Name == "InputStream")
|
||||
pValue[i].Value >>= xInputStream;
|
||||
}
|
||||
|
||||
if (!xInputStream.is())
|
||||
return OUString();
|
||||
|
||||
WPXSvInputStream input(xInputStream);
|
||||
|
||||
if (doDetectFormat(input, sTypeName))
|
||||
{
|
||||
assert(!sTypeName.isEmpty());
|
||||
|
||||
if (location == nLength)
|
||||
{
|
||||
Descriptor.realloc(nLength+1);
|
||||
Descriptor[location].Name = "TypeName";
|
||||
}
|
||||
|
||||
Descriptor[location].Value <<=sTypeName;
|
||||
}
|
||||
return sTypeName;
|
||||
}
|
||||
|
||||
|
||||
// XInitialization
|
||||
void SAL_CALL ImportFilterImpl::initialize(const Sequence< Any > &aArguments)
|
||||
throw (Exception, RuntimeException, std::exception)
|
||||
{
|
||||
Sequence < PropertyValue > aAnySeq;
|
||||
sal_Int32 nLength = aArguments.getLength();
|
||||
if (nLength && (aArguments[0] >>= aAnySeq))
|
||||
{
|
||||
const PropertyValue *pValue = aAnySeq.getConstArray();
|
||||
nLength = aAnySeq.getLength();
|
||||
for (sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if (pValue[i].Name == "Type")
|
||||
{
|
||||
pValue[i].Value >>= msFilterName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ImportFilterImpl::doDetectFormat(librevenge::RVNGInputStream &, OUString &)
|
||||
{
|
||||
SAL_WARN("writerperfect", "presentation::ImportFilterImpl::doDetectFormat must not be called");
|
||||
return false;
|
||||
}
|
||||
void ImportFilterImpl::doRegisterHandlers(OdpGenerator &)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
113
writerperfect/source/impress/ImportFilterBase.hxx
Normal file
113
writerperfect/source/impress/ImportFilterBase.hxx
Normal file
@ -0,0 +1,113 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_IMPORTFILTERBASE_HXX
|
||||
#define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_IMPORTFILTERBASE_HXX
|
||||
|
||||
#include <librevenge/librevenge.h>
|
||||
|
||||
#include <librevenge-stream/librevenge-stream.h>
|
||||
|
||||
#include <com/sun/star/document/XFilter.hpp>
|
||||
#include <com/sun/star/document/XImporter.hpp>
|
||||
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include <cppuhelper/implbase4.hxx>
|
||||
|
||||
namespace com
|
||||
{
|
||||
namespace sun
|
||||
{
|
||||
namespace star
|
||||
{
|
||||
namespace beans
|
||||
{
|
||||
struct PropertyValue;
|
||||
}
|
||||
namespace lang
|
||||
{
|
||||
class XComponent;
|
||||
}
|
||||
namespace uno
|
||||
{
|
||||
class XComponentContext;
|
||||
}
|
||||
namespace xml
|
||||
{
|
||||
namespace sax
|
||||
{
|
||||
class XDocumentHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OdpGenerator;
|
||||
|
||||
namespace writerperfect
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
|
||||
/* This component will be instantiated for both import or export. Whether it calls
|
||||
* setSourceDocument or setTargetDocument determines which Impl function the filter
|
||||
* member calls */
|
||||
class ImportFilterImpl : public cppu::WeakImplHelper4
|
||||
<
|
||||
com::sun::star::document::XFilter,
|
||||
com::sun::star::document::XImporter,
|
||||
com::sun::star::document::XExtendedFilterDetection,
|
||||
com::sun::star::lang::XInitialization
|
||||
>
|
||||
{
|
||||
public:
|
||||
ImportFilterImpl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext);
|
||||
virtual ~ImportFilterImpl();
|
||||
|
||||
// XFilter
|
||||
virtual sal_Bool SAL_CALL filter(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
virtual void SAL_CALL cancel()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
// XImporter
|
||||
virtual void SAL_CALL setTargetDocument(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xDoc)
|
||||
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
//XExtendedFilterDetection
|
||||
virtual OUString SAL_CALL detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
|
||||
throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &aArguments)
|
||||
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
private:
|
||||
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName);
|
||||
virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) = 0;
|
||||
virtual void doRegisterHandlers(OdpGenerator &rGenerator);
|
||||
|
||||
private:
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
|
||||
OUString msFilterName;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
|
||||
};
|
||||
|
||||
/** A base class for import filters.
|
||||
*/
|
||||
typedef cppu::ImplInheritanceHelper1<ImportFilterImpl, com::sun::star::lang::XServiceInfo> ImportFilterBase;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // INCLUDED_WRITERPERFECT_SOURCE_DRAW_IMPORTFILTERBASE_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -9,19 +9,15 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/container/XChild.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
||||
#include <com/sun/star/ucb/XContent.hpp>
|
||||
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||
#include <com/sun/star/xml/sax/InputSource.hpp>
|
||||
#include <com/sun/star/xml/sax/XParser.hpp>
|
||||
#include <com/sun/star/io/XSeekable.hpp>
|
||||
#include <com/sun/star/uno/Reference.h>
|
||||
#include <com/sun/star/ucb/XContent.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/types.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include <iostream>
|
||||
#include <libetonyek/libetonyek.h>
|
||||
#include <libodfgen/libodfgen.hxx>
|
||||
@ -39,24 +35,15 @@
|
||||
|
||||
using boost::shared_ptr;
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::io::XInputStream;
|
||||
using com::sun::star::io::XSeekable;
|
||||
using com::sun::star::uno::Sequence;
|
||||
using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::UNO_QUERY;
|
||||
using com::sun::star::uno::XInterface;
|
||||
using com::sun::star::uno::Exception;
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::uno::RuntimeException;
|
||||
using com::sun::star::beans::PropertyValue;
|
||||
using com::sun::star::document::XFilter;
|
||||
using com::sun::star::document::XExtendedFilterDetection;
|
||||
using com::sun::star::document::XImporter;
|
||||
using com::sun::star::xml::sax::InputSource;
|
||||
using com::sun::star::xml::sax::XAttributeList;
|
||||
using com::sun::star::xml::sax::XDocumentHandler;
|
||||
using com::sun::star::xml::sax::XParser;
|
||||
using com::sun::star::uno::Sequence;
|
||||
using com::sun::star::uno::UNO_QUERY;
|
||||
using com::sun::star::uno::XComponentContext;
|
||||
using com::sun::star::uno::XInterface;
|
||||
|
||||
using writerperfect::DocumentHandler;
|
||||
using writerperfect::WPXSvInputStream;
|
||||
@ -65,111 +52,13 @@ namespace beans = com::sun::star::beans;
|
||||
namespace container = com::sun::star::container;
|
||||
namespace ucb = com::sun::star::ucb;
|
||||
|
||||
namespace
|
||||
bool KeynoteImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator)
|
||||
{
|
||||
|
||||
template<class T>
|
||||
bool lcl_queryIsPackage(const Sequence<T> &lComponentData)
|
||||
{
|
||||
bool bIsPackage = false;
|
||||
|
||||
const sal_Int32 nLength = lComponentData.getLength();
|
||||
const T *pValue = lComponentData.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nLength; ++i)
|
||||
{
|
||||
if (pValue[i].Name == "IsPackage")
|
||||
{
|
||||
pValue[i].Value >>= bIsPackage;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return bIsPackage;
|
||||
}
|
||||
|
||||
bool lcl_isPackage(const Any &rComponentData)
|
||||
{
|
||||
Sequence < beans::NamedValue > lComponentDataNV;
|
||||
Sequence < beans::PropertyValue > lComponentDataPV;
|
||||
|
||||
if (rComponentData >>= lComponentDataNV)
|
||||
return lcl_queryIsPackage(lComponentDataNV);
|
||||
else if (rComponentData >>= lComponentDataPV)
|
||||
return lcl_queryIsPackage(lComponentDataPV);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL KeynoteImportFilter::filter(const Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
sal_Int32 nLength = aDescriptor.getLength();
|
||||
const PropertyValue *pValue = aDescriptor.getConstArray();
|
||||
Reference < XInputStream > xInputStream;
|
||||
Reference < ucb::XContent > xContent;
|
||||
bool bIsPackage = false;
|
||||
for (sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if (pValue[i].Name == "ComponentData")
|
||||
bIsPackage = lcl_isPackage(pValue[i].Value);
|
||||
else if (pValue[i].Name == "InputStream")
|
||||
pValue[i].Value >>= xInputStream;
|
||||
else if (pValue[i].Name == "UCBContent")
|
||||
pValue[i].Value >>= xContent;
|
||||
}
|
||||
if (!xInputStream.is())
|
||||
{
|
||||
OSL_ASSERT(false);
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
if (bIsPackage && !xContent.is())
|
||||
{
|
||||
SAL_WARN("writerperfect", "the input claims to be a package, but does not have UCBContent");
|
||||
bIsPackage = false;
|
||||
}
|
||||
|
||||
// An XML import service: what we push sax messages to..
|
||||
Reference < XDocumentHandler > xInternalHandler(
|
||||
mxContext->getServiceManager()->createInstanceWithContext(
|
||||
"com.sun.star.comp.Impress.XMLOasisImporter", mxContext),
|
||||
css::uno::UNO_QUERY_THROW);
|
||||
|
||||
// The XImporter sets up an empty target document for XDocumentHandler to write to..
|
||||
Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
|
||||
xImporter->setTargetDocument(mxDoc);
|
||||
|
||||
// OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
|
||||
// writes to in-memory target doc
|
||||
DocumentHandler xHandler(xInternalHandler);
|
||||
|
||||
shared_ptr< librevenge::RVNGInputStream > input;
|
||||
if (bIsPackage)
|
||||
input.reset(new writerperfect::DirectoryStream(xContent));
|
||||
else
|
||||
input.reset(new WPXSvInputStream(xInputStream));
|
||||
|
||||
OdpGenerator exporter;
|
||||
exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML);
|
||||
bool tmpParseResult = libetonyek::EtonyekDocument::parse(input.get(), &exporter);
|
||||
return tmpParseResult;
|
||||
}
|
||||
|
||||
void SAL_CALL KeynoteImportFilter::cancel()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
}
|
||||
|
||||
// XImporter
|
||||
void SAL_CALL KeynoteImportFilter::setTargetDocument(const Reference< ::com::sun::star::lang::XComponent > &xDoc)
|
||||
throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std::exception)
|
||||
{
|
||||
mxDoc = xDoc;
|
||||
return libetonyek::EtonyekDocument::parse(&rInput, &rGenerator);
|
||||
}
|
||||
|
||||
// XExtendedFilterDetection
|
||||
OUString SAL_CALL KeynoteImportFilter::detect(com::sun::star::uno::Sequence< PropertyValue > &Descriptor)
|
||||
OUString SAL_CALL KeynoteImportFilter::detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
|
||||
throw(com::sun::star::uno::RuntimeException, std::exception)
|
||||
{
|
||||
sal_Int32 nLength = Descriptor.getLength();
|
||||
@ -179,7 +68,7 @@ throw(com::sun::star::uno::RuntimeException, std::exception)
|
||||
sal_Int32 nUCBContentLocation = -1;
|
||||
bool bIsPackage = false;
|
||||
bool bUCBContentChanged = false;
|
||||
const PropertyValue *pValue = Descriptor.getConstArray();
|
||||
const beans::PropertyValue *pValue = Descriptor.getConstArray();
|
||||
Reference < XInputStream > xInputStream;
|
||||
Reference < ucb::XContent > xContent;
|
||||
Sequence < beans::NamedValue > lComponentDataNV;
|
||||
@ -338,27 +227,6 @@ throw(com::sun::star::uno::RuntimeException, std::exception)
|
||||
return sTypeName;
|
||||
}
|
||||
|
||||
// XInitialization
|
||||
void SAL_CALL KeynoteImportFilter::initialize(const Sequence< Any > &aArguments)
|
||||
throw (Exception, RuntimeException, std::exception)
|
||||
{
|
||||
Sequence < PropertyValue > aAnySeq;
|
||||
sal_Int32 nLength = aArguments.getLength();
|
||||
if (nLength && (aArguments[0] >>= aAnySeq))
|
||||
{
|
||||
const PropertyValue *pValue = aAnySeq.getConstArray();
|
||||
nLength = aAnySeq.getLength();
|
||||
for (sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if (pValue[i].Name == "Type")
|
||||
{
|
||||
pValue[i].Value >>= msFilterName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OUString KeynoteImportFilter_getImplementationName()
|
||||
throw (RuntimeException)
|
||||
{
|
||||
|
@ -8,59 +8,26 @@
|
||||
#ifndef INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_KEYNOTEIMPORTFILTER_HXX
|
||||
#define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_KEYNOTEIMPORTFILTER_HXX
|
||||
|
||||
#include <com/sun/star/document/XFilter.hpp>
|
||||
#include <com/sun/star/document/XImporter.hpp>
|
||||
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
||||
#include <cppuhelper/implbase5.hxx>
|
||||
|
||||
#include "ImportFilterBase.hxx"
|
||||
#include <stdio.h>
|
||||
|
||||
/* This component will be instantiated for both import or export. Whether it calls
|
||||
* setSourceDocument or setTargetDocument determines which Impl function the filter
|
||||
* member calls */
|
||||
class KeynoteImportFilter : public cppu::WeakImplHelper5
|
||||
<
|
||||
com::sun::star::document::XFilter,
|
||||
com::sun::star::document::XImporter,
|
||||
com::sun::star::document::XExtendedFilterDetection,
|
||||
com::sun::star::lang::XInitialization,
|
||||
com::sun::star::lang::XServiceInfo
|
||||
>
|
||||
class KeynoteImportFilter : public writerperfect::presentation::ImportFilterBase
|
||||
{
|
||||
protected:
|
||||
// oo.org declares
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
|
||||
OUString msFilterName;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
|
||||
|
||||
public:
|
||||
KeynoteImportFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
|
||||
: mxContext(rxContext) {}
|
||||
: writerperfect::presentation::ImportFilterBase(rxContext) {}
|
||||
virtual ~KeynoteImportFilter() {}
|
||||
|
||||
// XFilter
|
||||
virtual sal_Bool SAL_CALL filter(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
virtual void SAL_CALL cancel()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
// XImporter
|
||||
virtual void SAL_CALL setTargetDocument(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xDoc)
|
||||
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
//XExtendedFilterDetection
|
||||
virtual OUString SAL_CALL detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
|
||||
throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &aArguments)
|
||||
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
@ -69,6 +36,8 @@ public:
|
||||
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
private:
|
||||
virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) SAL_OVERRIDE;
|
||||
};
|
||||
|
||||
OUString KeynoteImportFilter_getImplementationName()
|
||||
|
181
writerperfect/source/impress/MWAWPresentationImportFilter.cxx
Normal file
181
writerperfect/source/impress/MWAWPresentationImportFilter.cxx
Normal file
@ -0,0 +1,181 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* MWAWPresentationImportFilter: Sets up the filter, and calls DocumentCollector
|
||||
* to do the actual filtering
|
||||
*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <com/sun/star/uno/Reference.h>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include <libmwaw/libmwaw.hxx>
|
||||
#include <libodfgen/libodfgen.hxx>
|
||||
|
||||
#include "MWAWPresentationImportFilter.hxx"
|
||||
|
||||
using com::sun::star::uno::Sequence;
|
||||
using com::sun::star::uno::Reference;
|
||||
using com::sun::star::uno::Any;
|
||||
using com::sun::star::uno::XInterface;
|
||||
using com::sun::star::uno::Exception;
|
||||
using com::sun::star::uno::RuntimeException;
|
||||
using com::sun::star::uno::XComponentContext;
|
||||
|
||||
static bool handleEmbeddedMWAWGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
|
||||
{
|
||||
OdgGenerator exporter;
|
||||
exporter.addDocumentHandler(pHandler, streamType);
|
||||
return MWAWDocument::decodeGraphic(data, &exporter);
|
||||
}
|
||||
|
||||
static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
|
||||
{
|
||||
OdsGenerator exporter;
|
||||
exporter.addDocumentHandler(pHandler, streamType);
|
||||
return MWAWDocument::decodeSpreadsheet(data, &exporter);
|
||||
}
|
||||
|
||||
bool MWAWPresentationImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator)
|
||||
{
|
||||
return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
|
||||
}
|
||||
|
||||
bool MWAWPresentationImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
|
||||
{
|
||||
rTypeName = "";
|
||||
|
||||
MWAWDocument::Type docType = MWAWDocument::MWAW_T_UNKNOWN;
|
||||
MWAWDocument::Kind docKind = MWAWDocument::MWAW_K_UNKNOWN;
|
||||
const MWAWDocument::Confidence confidence = MWAWDocument::isFileFormatSupported(&rInput, docType, docKind);
|
||||
|
||||
if (confidence == MWAWDocument::MWAW_C_EXCELLENT)
|
||||
{
|
||||
if (docKind == MWAWDocument::MWAW_K_PRESENTATION)
|
||||
{
|
||||
switch (docType)
|
||||
{
|
||||
case MWAWDocument::MWAW_T_CLARISWORKS:
|
||||
rTypeName = "impress_ClarisWorks";
|
||||
break;
|
||||
|
||||
case MWAWDocument::MWAW_T_ACTA:
|
||||
case MWAWDocument::MWAW_T_BEAGLEWORKS:
|
||||
case MWAWDocument::MWAW_T_ADOBEILLUSTRATOR:
|
||||
case MWAWDocument::MWAW_T_CLARISRESOLVE:
|
||||
case MWAWDocument::MWAW_T_DBASE:
|
||||
case MWAWDocument::MWAW_T_DOCMAKER:
|
||||
case MWAWDocument::MWAW_T_EDOC:
|
||||
case MWAWDocument::MWAW_T_FAMILYTREEMAKER:
|
||||
case MWAWDocument::MWAW_T_FILEMAKER:
|
||||
case MWAWDocument::MWAW_T_FOXBASE:
|
||||
case MWAWDocument::MWAW_T_FRAMEMAKER:
|
||||
case MWAWDocument::MWAW_T_FULLIMPACT:
|
||||
case MWAWDocument::MWAW_T_FULLPAINT:
|
||||
case MWAWDocument::MWAW_T_FULLWRITE:
|
||||
case MWAWDocument::MWAW_T_GREATWORKS:
|
||||
case MWAWDocument::MWAW_T_INFOGENIE:
|
||||
case MWAWDocument::MWAW_T_KALEIDAGRAPH:
|
||||
case MWAWDocument::MWAW_T_HANMACWORDJ:
|
||||
case MWAWDocument::MWAW_T_HANMACWORDK:
|
||||
case MWAWDocument::MWAW_T_LIGHTWAYTEXT:
|
||||
case MWAWDocument::MWAW_T_MACDOC:
|
||||
case MWAWDocument::MWAW_T_MACDRAFT:
|
||||
case MWAWDocument::MWAW_T_MACDRAW:
|
||||
case MWAWDocument::MWAW_T_MACDRAWPRO:
|
||||
case MWAWDocument::MWAW_T_MACPAINT:
|
||||
case MWAWDocument::MWAW_T_MACWRITE:
|
||||
case MWAWDocument::MWAW_T_MACWRITEPRO:
|
||||
case MWAWDocument::MWAW_T_MARINERWRITE:
|
||||
case MWAWDocument::MWAW_T_MINDWRITE:
|
||||
case MWAWDocument::MWAW_T_MICROSOFTFILE:
|
||||
case MWAWDocument::MWAW_T_MICROSOFTMULTIPLAN:
|
||||
case MWAWDocument::MWAW_T_MICROSOFTWORD:
|
||||
case MWAWDocument::MWAW_T_MICROSOFTWORKS:
|
||||
case MWAWDocument::MWAW_T_MORE:
|
||||
case MWAWDocument::MWAW_T_NISUSWRITER:
|
||||
case MWAWDocument::MWAW_T_OVERVUE:
|
||||
case MWAWDocument::MWAW_T_PAGEMAKER:
|
||||
case MWAWDocument::MWAW_T_PIXELPAINT:
|
||||
case MWAWDocument::MWAW_T_RAGTIME:
|
||||
case MWAWDocument::MWAW_T_READYSETGO:
|
||||
case MWAWDocument::MWAW_T_SUPERPAINT:
|
||||
case MWAWDocument::MWAW_T_SYMPOSIUM:
|
||||
case MWAWDocument::MWAW_T_TEACHTEXT:
|
||||
case MWAWDocument::MWAW_T_TEXEDIT:
|
||||
case MWAWDocument::MWAW_T_TRAPEZE:
|
||||
case MWAWDocument::MWAW_T_WINGZ:
|
||||
case MWAWDocument::MWAW_T_WRITENOW:
|
||||
case MWAWDocument::MWAW_T_WRITERPLUS:
|
||||
case MWAWDocument::MWAW_T_XPRESS:
|
||||
case MWAWDocument::MWAW_T_ZWRITE:
|
||||
case MWAWDocument::MWAW_T_4DIMENSION:
|
||||
|
||||
case MWAWDocument::MWAW_T_RESERVED1:
|
||||
case MWAWDocument::MWAW_T_RESERVED2:
|
||||
case MWAWDocument::MWAW_T_RESERVED3:
|
||||
case MWAWDocument::MWAW_T_RESERVED4:
|
||||
case MWAWDocument::MWAW_T_RESERVED5:
|
||||
case MWAWDocument::MWAW_T_RESERVED6:
|
||||
case MWAWDocument::MWAW_T_RESERVED7:
|
||||
case MWAWDocument::MWAW_T_RESERVED8:
|
||||
case MWAWDocument::MWAW_T_RESERVED9:
|
||||
case MWAWDocument::MWAW_T_UNKNOWN:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !rTypeName.isEmpty();
|
||||
}
|
||||
|
||||
void MWAWPresentationImportFilter::doRegisterHandlers(OdpGenerator &rGenerator)
|
||||
{
|
||||
rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject);
|
||||
rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", &handleEmbeddedMWAWSpreadsheetObject);
|
||||
}
|
||||
|
||||
OUString MWAWPresentationImportFilter_getImplementationName()
|
||||
throw (RuntimeException)
|
||||
{
|
||||
return OUString("com.sun.star.comp.Impress.MWAWPresentationImportFilter");
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames()
|
||||
throw (RuntimeException)
|
||||
{
|
||||
Sequence < OUString > aRet(2);
|
||||
OUString *pArray = aRet.getArray();
|
||||
pArray[0] = "com.sun.star.document.ImportFilter";
|
||||
pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
|
||||
return aRet;
|
||||
}
|
||||
|
||||
Reference< XInterface > SAL_CALL MWAWPresentationImportFilter_createInstance(const Reference< XComponentContext > &rContext)
|
||||
throw(Exception)
|
||||
{
|
||||
return (cppu::OWeakObject *) new MWAWPresentationImportFilter(rContext);
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
OUString SAL_CALL MWAWPresentationImportFilter::getImplementationName()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return MWAWPresentationImportFilter_getImplementationName();
|
||||
}
|
||||
sal_Bool SAL_CALL MWAWPresentationImportFilter::supportsService(const OUString &rServiceName)
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return cppu::supportsService(this, rServiceName);
|
||||
}
|
||||
Sequence< OUString > SAL_CALL MWAWPresentationImportFilter::getSupportedServiceNames()
|
||||
throw (RuntimeException, std::exception)
|
||||
{
|
||||
return MWAWPresentationImportFilter_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef _MWAWPRESENTATIONIMPORTFILTER_HXX
|
||||
#define _MWAWPRESENTATIONIMPORTFILTER_HXX
|
||||
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include "ImportFilterBase.hxx"
|
||||
|
||||
/* This component will be instantiated for both import or export. Whether it calls
|
||||
* setSourceDocument or setTargetDocument determines which Impl function the filter
|
||||
* member calls */
|
||||
class MWAWPresentationImportFilter : public writerperfect::presentation::ImportFilterBase
|
||||
{
|
||||
public:
|
||||
MWAWPresentationImportFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
|
||||
: writerperfect::presentation::ImportFilterBase(rxContext) {}
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
|
||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||
|
||||
private:
|
||||
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) SAL_OVERRIDE;
|
||||
virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) SAL_OVERRIDE;
|
||||
virtual void doRegisterHandlers(OdpGenerator &rGenerator) SAL_OVERRIDE;
|
||||
};
|
||||
|
||||
OUString MWAWPresentationImportFilter_getImplementationName()
|
||||
throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
::com::sun::star::uno::Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames()
|
||||
throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
|
||||
SAL_CALL MWAWPresentationImportFilter_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext)
|
||||
throw (::com::sun::star::uno::Exception);
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -13,4 +13,8 @@
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Impress.MWAWPresentationImportFilter">
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "sal/types.h"
|
||||
|
||||
#include "KeynoteImportFilter.hxx"
|
||||
#include "MWAWPresentationImportFilter.hxx"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -37,6 +38,12 @@ static cppu::ImplementationEntry const services[] =
|
||||
&KeynoteImportFilter_getSupportedServiceNames,
|
||||
&cppu::createSingleComponentFactory, 0, 0
|
||||
},
|
||||
{
|
||||
&MWAWPresentationImportFilter_createInstance,
|
||||
&MWAWPresentationImportFilter_getImplementationName,
|
||||
&MWAWPresentationImportFilter_getSupportedServiceNames,
|
||||
&cppu::createSingleComponentFactory, 0, 0
|
||||
},
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user