diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-18 12:11:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-08-18 12:11:03 +0200 |
commit | 13c00ce322e78eb4e0f50ab84ded19cd6aae1ded (patch) | |
tree | d3a94253fc7d6e32070af8fc07b92cc4f4683db0 /writerfilter | |
parent | Tokenize text::HoriOrientation (diff) | |
download | core-13c00ce322e78eb4e0f50ab84ded19cd6aae1ded.tar.gz core-13c00ce322e78eb4e0f50ab84ded19cd6aae1ded.zip |
Enable the writerfilter-based RTF import in non-experimental mode
Disable the unit tests in sw, as that would duplicate the unit test in
writerfilter now.
Do not remove the old filter yet, so this commit can be reverted later
if needed.
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/Library_writerfilter.mk | 1 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.cxx | 63 |
2 files changed, 23 insertions, 41 deletions
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 69ca17242a55..087ef262428d 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -60,7 +60,6 @@ $(eval $(call gb_Library_add_linked_libs,writerfilter,\ rtftok \ sal \ sot \ - svt \ tl \ utl \ $(gb_STDLIBS) \ diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index af4589692436..764c8bbff111 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -36,7 +36,6 @@ #include <dmapper/DomainMapper.hxx> #include <rtftok/RTFDocument.hxx> #include <com/sun/star/frame/XFrame.hpp> -#include <svtools/miscopt.hxx> using namespace ::rtl; using namespace ::cppu; @@ -70,56 +69,40 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri return xFltr->filter(aDescriptor); } - SvtMiscOptions aMiscOptions; - if (aMiscOptions.IsExperimentalMode() || !m_xDstDoc.is() ) + try { - try - { - MediaDescriptor aMediaDesc( aDescriptor ); + MediaDescriptor aMediaDesc( aDescriptor ); #ifdef DEBUG_IMPORT - OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() ); - ::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr(); + OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() ); + ::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr(); - writerfilter::TagLogger::Pointer_t dmapperLogger - (writerfilter::TagLogger::getInstance("DOMAINMAPPER")); - dmapperLogger->setFileName(sURLc); - dmapperLogger->startDocument(); + writerfilter::TagLogger::Pointer_t dmapperLogger + (writerfilter::TagLogger::getInstance("DOMAINMAPPER")); + dmapperLogger->setFileName(sURLc); + dmapperLogger->startDocument(); #endif - uno::Reference< io::XInputStream > xInputStream; + uno::Reference< io::XInputStream > xInputStream; - aMediaDesc.addInputStream(); - aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream; + aMediaDesc.addInputStream(); + aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream; - uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(), - uno::Reference<frame::XFrame>()); + uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(), + uno::Reference<frame::XFrame>()); - writerfilter::Stream::Pointer_t pStream( - new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, writerfilter::dmapper::DOCUMENT_RTF)); - writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( - writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame)); - pDocument->resolve(*pStream); + writerfilter::Stream::Pointer_t pStream( + new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, writerfilter::dmapper::DOCUMENT_RTF)); + writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( + writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame)); + pDocument->resolve(*pStream); #ifdef DEBUG_IMPORT - dmapperLogger->endDocument(); + dmapperLogger->endDocument(); #endif - return sal_True; - } - catch( const uno::Exception& rEx) - { - return sal_False; - } + return sal_True; } - - // if not, then use the old importer - uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW); - if (!xIfc.is()) - return sal_False; - uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW); - uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); - if (!xImprtr.is() || !xFltr.is()) + catch( const uno::Exception& rEx) + { return sal_False; - xImprtr->setTargetDocument(m_xDstDoc); - return xFltr->filter(aDescriptor); + } } void RtfFilter::cancel( ) throw (uno::RuntimeException) |