[Libreoffice-commits] core.git: 2 commits - writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Dec 12 00:05:10 PST 2014
writerfilter/Library_writerfilter.mk | 1
writerfilter/inc/dmapper/DomainMapper.hxx | 7 --
writerfilter/inc/dmapper/DomainMapperFactory.hxx | 48 ++++++++++++++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 14 +++++
writerfilter/source/dmapper/domainmapperfactory.cxx | 31 ++++++++++++
writerfilter/source/filter/ImportFilter.cxx | 6 --
writerfilter/source/filter/RtfFilter.cxx | 5 +-
7 files changed, 98 insertions(+), 14 deletions(-)
New commits:
commit c953690b9adaf632f830dbf67e078ea00747894d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Dec 12 09:04:08 2014 +0100
writerfilter: let ImportFilter only assume that DomainMapper is a Stream
Change-Id: I2e0db194357657df81d8cd94f42cdfbd2c3a2664
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 28f43fb..4e06ded 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -169,6 +169,20 @@ DomainMapper::~DomainMapper()
// Apply the document settings after everything else
m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
+
+ // Grab-bag handling
+ comphelper::SequenceAsHashMap aProperties;
+ // Add the saved w:themeFontLang setting
+ aProperties["ThemeFontLangProps"] = uno::makeAny(GetThemeFontLangProperties());
+ // Add the saved compat settings
+ aProperties["CompatSettings"] = uno::makeAny(GetCompatSettings());
+ uno::Reference<beans::XPropertySet> xDocProps(m_pImpl->GetTextDocument(), uno::UNO_QUERY);
+ if (xDocProps.is())
+ {
+ comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue("InteropGrabBag"));
+ aGrabBag.update(aProperties);
+ xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList()));
+ }
}
catch( const uno::Exception& rEx )
{
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index eb8801f..93ed71f 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -121,9 +121,6 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
aGrabBagProperties["OOXActiveX"] = uno::makeAny( pDocument->getActiveXDomList() );
aGrabBagProperties["OOXActiveXBin"] = uno::makeAny( pDocument->getActiveXBinList() );
- // Adding the saved w:themeFontLang setting
- aGrabBagProperties["ThemeFontLangProps"] = uno::makeAny( aDomainMapper->GetThemeFontLangProperties() );
-
// Adding the saved Glossary Documnet DOM to the document's grab bag
aGrabBagProperties["OOXGlossary"] = uno::makeAny( pDocument->getGlossaryDocDom() );
aGrabBagProperties["OOXGlossaryDom"] = uno::makeAny( pDocument->getGlossaryDomList() );
@@ -131,9 +128,6 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
// Adding the saved embedding document to document's grab bag
aGrabBagProperties["OOXEmbeddings"] = uno::makeAny( pDocument->getEmbeddingsList() );
- // Adding the saved compat settings
- aGrabBagProperties["CompatSettings"] = uno::makeAny( aDomainMapper->GetCompatSettings() );
-
putPropertiesToDocumentGrabBag( aGrabBagProperties );
writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream( pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT ));
commit eb14f3d4e4da72ba19e28eb9ee796c04ab3b8d84
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Dec 12 09:02:19 2014 +0100
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
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index 63d17f0..2c6d01e 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/DomainMapperTableHandler \
writerfilter/source/dmapper/DomainMapperTableManager \
writerfilter/source/dmapper/DomainMapper_Impl \
+ writerfilter/source/dmapper/domainmapperfactory \
writerfilter/source/dmapper/FFDataHandler \
writerfilter/source/dmapper/FontTable \
writerfilter/source/dmapper/FormControlHelper \
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 94f233f..6564e32 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX
#define INCLUDED_WRITERFILTER_INC_DMAPPER_DOMAINMAPPER_HXX
+#include <dmapper/DomainMapperFactory.hxx>
#include <resourcemodel/LoggedResources.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/style/TabAlign.hpp>
@@ -63,12 +64,6 @@ enum SprmType
SPRM_DEFAULT,
SPRM_LIST
};
-enum SourceDocumentType
-{
- DOCUMENT_DOC,
- DOCUMENT_OOXML,
- DOCUMENT_RTF
-};
class DomainMapper : public LoggedProperties, public LoggedTable,
public BinaryObj, public LoggedStream
{
diff --git a/writerfilter/inc/dmapper/DomainMapperFactory.hxx b/writerfilter/inc/dmapper/DomainMapperFactory.hxx
new file mode 100644
index 0000000..28563ac
--- /dev/null
+++ b/writerfilter/inc/dmapper/DomainMapperFactory.hxx
@@ -0,0 +1,48 @@
+/*
+ * 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: */
diff --git a/writerfilter/source/dmapper/domainmapperfactory.cxx b/writerfilter/source/dmapper/domainmapperfactory.cxx
new file mode 100644
index 0000000..e396534
--- /dev/null
+++ b/writerfilter/source/dmapper/domainmapperfactory.cxx
@@ -0,0 +1,31 @@
+/* -*- 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: */
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index 6243818..aaa533c 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -21,7 +21,8 @@
#include <RtfFilter.hxx>
#include <unotools/mediadescriptor.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <dmapper/DomainMapper.hxx>
+#include <dmapper/DomainMapperFactory.hxx>
+#include <resourcemodel/TagLogger.hxx>
#include <rtftok/RTFDocument.hxx>
#include <com/sun/star/io/WrongFormatException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -113,7 +114,7 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescrip
uno::Reference<task::XStatusIndicator>());
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::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator));
pDocument->resolve(*pStream);
More information about the Libreoffice-commits
mailing list