Kaydet (Commit) eb14f3d4 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: add a factory for DomainMapper

Ideally the XFilter implementations should only know that DomainMapper
implements Stream, nothing more. Add a factory and use it in RtfFilter.
When ImportFilter will do the same, then the DomainMapper class
definition can be an implementation detail.

Change-Id: If19cf23e61c2f78189d834261d57c569b9173b12
üst 170616e9
...@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\ ...@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/DomainMapperTableHandler \ writerfilter/source/dmapper/DomainMapperTableHandler \
writerfilter/source/dmapper/DomainMapperTableManager \ writerfilter/source/dmapper/DomainMapperTableManager \
writerfilter/source/dmapper/DomainMapper_Impl \ writerfilter/source/dmapper/DomainMapper_Impl \
writerfilter/source/dmapper/domainmapperfactory \
writerfilter/source/dmapper/FFDataHandler \ writerfilter/source/dmapper/FFDataHandler \
writerfilter/source/dmapper/FontTable \ writerfilter/source/dmapper/FontTable \
writerfilter/source/dmapper/FormControlHelper \ writerfilter/source/dmapper/FormControlHelper \
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#ifndef INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX #ifndef INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX
#define INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX #define INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX
#include <dmapper/DomainMapperFactory.hxx>
#include <resourcemodel/LoggedResources.hxx> #include <resourcemodel/LoggedResources.hxx>
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/style/TabAlign.hpp> #include <com/sun/star/style/TabAlign.hpp>
...@@ -63,12 +64,6 @@ enum SprmType ...@@ -63,12 +64,6 @@ enum SprmType
SPRM_DEFAULT, SPRM_DEFAULT,
SPRM_LIST SPRM_LIST
}; };
enum SourceDocumentType
{
DOCUMENT_DOC,
DOCUMENT_OOXML,
DOCUMENT_RTF
};
class DomainMapper : public LoggedProperties, public LoggedTable, class DomainMapper : public LoggedProperties, public LoggedTable,
public BinaryObj, public LoggedStream public BinaryObj, public LoggedStream
{ {
......
/*
* 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 INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPERFACTORY_HXX
#define INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPERFACTORY_HXX
#include <resourcemodel/WW8ResourceModel.hxx>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
namespace writerfilter
{
namespace dmapper
{
enum SourceDocumentType
{
DOCUMENT_DOC,
DOCUMENT_OOXML,
DOCUMENT_RTF
};
/// Interface to create a DomainMapper instance.
class DomainMapperFactory
{
public:
static Stream::Pointer_t
createMapper(css::uno::Reference<css::uno::XComponentContext> const& xContext,
css::uno::Reference<css::io::XInputStream> const& xInputStream,
css::uno::Reference<css::lang::XComponent> const& xModel,
bool bRepairStorage,
SourceDocumentType eDocumentType,
css::uno::Reference<css::text::XTextRange> const& xInsertTextRange,
bool bIsNewDoc = true);
};
} // namespace dmapper
} // namespace writerfilter
#endif // INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPERFACTORY_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*/
#include <dmapper/DomainMapper.hxx>
namespace writerfilter
{
namespace dmapper
{
Stream::Pointer_t DomainMapperFactory::createMapper(css::uno::Reference<css::uno::XComponentContext> const& xContext,
css::uno::Reference<css::io::XInputStream> const& xInputStream,
css::uno::Reference<css::lang::XComponent> const& xModel,
bool bRepairStorage,
SourceDocumentType eDocumentType,
css::uno::Reference<css::text::XTextRange> const& xInsertTextRange,
bool bIsNewDoc)
{
return Stream::Pointer_t(new DomainMapper(xContext, xInputStream, xModel, bRepairStorage, eDocumentType, xInsertTextRange, bIsNewDoc));
}
} // namespace dmapper
} // namespace writerfilter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#include <RtfFilter.hxx> #include <RtfFilter.hxx>
#include <unotools/mediadescriptor.hxx> #include <unotools/mediadescriptor.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <dmapper/DomainMapper.hxx> #include <dmapper/DomainMapperFactory.hxx>
#include <resourcemodel/TagLogger.hxx>
#include <rtftok/RTFDocument.hxx> #include <rtftok/RTFDocument.hxx>
#include <com/sun/star/io/WrongFormatException.hpp> #include <com/sun/star/io/WrongFormatException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
...@@ -113,7 +114,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip ...@@ -113,7 +114,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip
uno::Reference<task::XStatusIndicator>()); uno::Reference<task::XStatusIndicator>());
writerfilter::Stream::Pointer_t pStream( writerfilter::Stream::Pointer_t pStream(
new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF, xInsertTextRange, bIsNewDoc)); writerfilter::dmapper::DomainMapperFactory::createMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF, xInsertTextRange, bIsNewDoc));
writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( writerfilter::rtftok::RTFDocument::Pointer_t const pDocument(
writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator)); writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator));
pDocument->resolve(*pStream); pDocument->resolve(*pStream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment