[Libreoffice-commits] .: sw/Library_msword.mk sw/source sw/util writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Dec 1 02:02:05 PST 2012


 sw/Library_msword.mk                      |    1 
 sw/source/filter/ww8/docxexportfilter.cxx |    6 -
 sw/source/filter/ww8/rtfimportfilter.cxx  |  120 ------------------------------
 sw/source/filter/ww8/rtfimportfilter.hxx  |   65 ----------------
 sw/util/msword.component                  |    3 
 writerfilter/source/filter/RtfFilter.cxx  |   13 ---
 6 files changed, 208 deletions(-)

New commits:
commit 08162021840608c05eec552a4fda461d2ec6d2ac
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Dec 1 10:59:18 2012 +0100

    sw: remove unused UNO wrapper around old internal RTF import
    
    Change-Id: I460f75d03a0af53da7523e290136126e95e01192

diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk
index b5f0b20..5ce6617 100644
--- a/sw/Library_msword.mk
+++ b/sw/Library_msword.mk
@@ -78,7 +78,6 @@ $(eval $(call gb_Library_add_exception_objects,msword,\
     sw/source/filter/ww8/rtfattributeoutput \
     sw/source/filter/ww8/rtfexport \
     sw/source/filter/ww8/rtfexportfilter \
-    sw/source/filter/ww8/rtfimportfilter \
     sw/source/filter/ww8/rtfsdrexport \
     sw/source/filter/ww8/rtfstringbuffer \
     sw/source/filter/ww8/WW8FFData \
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx
index c04e329..8149b36 100644
--- a/sw/source/filter/ww8/docxexportfilter.cxx
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -19,7 +19,6 @@
 
 #include "docxexportfilter.hxx"
 #include "rtfexportfilter.hxx"
-#include "rtfimportfilter.hxx"
 #include "docxexport.hxx"
 
 #include <docsh.hxx>
@@ -130,11 +129,6 @@ extern "C"
         RtfExport_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
         0, 0
     },
-    {
-        RtfImport_createInstance, RtfImport_getImplementationName,
-        RtfImport_getSupportedServiceNames, ::cppu::createSingleComponentFactory,
-        0, 0
-    },
     { 0, 0, 0, 0, 0, 0 }
 };
 
diff --git a/sw/source/filter/ww8/rtfimportfilter.cxx b/sw/source/filter/ww8/rtfimportfilter.cxx
deleted file mode 100644
index df5fc7c..0000000
--- a/sw/source/filter/ww8/rtfimportfilter.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- 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/.
- *
- * 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 .
- */
-
-#include "rtfimportfilter.hxx"
-#include "../rtf/swparrtf.hxx"
-
-#include <docsh.hxx>
-#include <doc.hxx>
-#include <unotxdoc.hxx>
-
-#include <comphelper/mediadescriptor.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-
-using namespace ::comphelper;
-using namespace ::com::sun::star;
-
-RtfImportFilter::RtfImportFilter( const uno::Reference< uno::XComponentContext > &xCtx ) :
-    m_xCtx( xCtx )
-{
-}
-
-RtfImportFilter::~RtfImportFilter()
-{
-}
-
-sal_Bool RtfImportFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor )
-    throw (uno::RuntimeException)
-{
-    SAL_INFO("sw.rtf", OSL_THIS_FUNC);
-
-    MediaDescriptor aMediaDesc = aDescriptor;
-    ::uno::Reference< io::XInputStream > xInputStream =
-        aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), uno::Reference< io::XInputStream >() );
-    SvStream* pStream = utl::UcbStreamHelper::CreateStream( xInputStream, sal_True );
-    if (!pStream)
-        return sal_False;
-
-    // get SwDoc*
-    uno::Reference< uno::XInterface > xIfc( m_xDstDoc, uno::UNO_QUERY );
-    SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() );
-    if (!pTxtDoc)
-        return sal_False;
-    SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc();
-    if (!pDoc)
-        return sal_False;
-
-    // get SwPaM*
-    // NEEDSWORK should we care about partial imports? For now we just import
-    // the whole document
-    SwPaM aPam( pDoc->GetNodes().GetEndOfContent() );
-    aPam.SetMark();
-    aPam.Move( fnMoveBackward, fnGoDoc );
-    SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() );
-
-    String aURL;
-    OUString sTemp;
-    for ( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ )
-    {
-        if( aDescriptor[i].Name == "URL" )
-        {
-            aDescriptor[i].Value >>= sTemp;
-            aURL = sTemp;
-        }
-    }
-
-    RtfReader aReader;
-    sal_Bool bRet = aReader.Read(pStream, *pDoc, aURL, *pCurPam) == 0;
-    delete pStream;
-    return bRet;
-}
-
-
-void RtfImportFilter::cancel(  ) throw (uno::RuntimeException)
-{
-}
-
-void RtfImportFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
-    throw (lang::IllegalArgumentException, uno::RuntimeException)
-{
-    m_xDstDoc = xDoc;
-}
-
-//////////////////////////////////////////////////////////////////////////
-// UNO helpers
-//////////////////////////////////////////////////////////////////////////
-
-OUString RtfImport_getImplementationName()
-{
-    return OUString( IMPL_NAME_RTFIMPORT );
-}
-
-uno::Sequence< OUString > SAL_CALL RtfImport_getSupportedServiceNames() throw()
-{
-    const OUString aServiceName( "com.sun.star.document.ImportFilter" );
-    const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
-    return aSeq;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL RtfImport_createInstance(const uno::Reference< uno::XComponentContext > & xCtx ) throw( uno::Exception )
-{
-    return (cppu::OWeakObject*) new RtfImportFilter( xCtx );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfimportfilter.hxx b/sw/source/filter/ww8/rtfimportfilter.hxx
deleted file mode 100644
index 8c683bb..0000000
--- a/sw/source/filter/ww8/rtfimportfilter.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- 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/.
- *
- * 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 .
- */
-
-#ifndef _RTFIMPORTFILTER_HXX_
-#define _RTFIMPORTFILTER_HXX_
-
-#include <com/sun/star/document/XFilter.hpp>
-#include <com/sun/star/document/XImporter.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-/// The physical access to the RTF document (for reading).
-class RtfImportFilter : public cppu::WeakImplHelper2
-<
-    com::sun::star::document::XFilter,
-    com::sun::star::document::XImporter
->
-{
-protected:
-    ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xDstDoc;
-public:
-    RtfImportFilter( const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xCtx );
-    virtual ~RtfImportFilter();
-
-    // 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);
-    virtual void SAL_CALL cancel(  )
-        throw (::com::sun::star::uno::RuntimeException);
-
-    // 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);
-};
-
-::rtl::OUString RtfImport_getImplementationName();
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfImport_getSupportedServiceNames()
-    throw();
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfImport_createInstance(
-                                                                        const ::com::sun::star::uno::Reference<
-                                                                        com::sun::star::uno::XComponentContext > &xCtx)
-    throw( ::com::sun::star::uno::Exception );
-
-#define IMPL_NAME_RTFIMPORT "com.sun.star.comp.Writer.RtfImport"
-
-#endif // _RTFIMPORTFILTER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/util/msword.component b/sw/util/msword.component
index f3ee40b..6cb98ae 100644
--- a/sw/util/msword.component
+++ b/sw/util/msword.component
@@ -21,9 +21,6 @@
   <implementation name="com.sun.star.comp.Writer.RtfExport">
     <service name="com.sun.star.comp.Writer.RtfExport"/>
   </implementation>
-  <implementation name="com.sun.star.comp.Writer.RtfImport">
-    <service name="com.sun.star.comp.Writer.RtfImport"/>
-  </implementation>
   <implementation name="com.sun.star.comp.Writer.DocxExport">
     <service name="com.sun.star.comp.Writer.DocxExport"/>
   </implementation>
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index ac84d29..7a0cea1 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -105,18 +105,6 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
         uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(),
                 uno::Reference<frame::XFrame>());
 
-#ifdef DBG_OLDFILTER
-        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())
-            return sal_False;
-        xImprtr->setTargetDocument(m_xDstDoc);
-        bResult = xFltr->filter(aDescriptor);
-#else
         xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_STATUSINDICATOR(),
                 uno::Reference<task::XStatusIndicator>());
 
@@ -129,7 +117,6 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
 #ifdef DEBUG_IMPORT
         dmapperLogger->endDocument();
 #endif
-#endif
         sal_uInt32 nEndTime = osl_getGlobalTimer();
         SAL_INFO("writerfilter.profile", OSL_THIS_FUNC << " finished in " << nEndTime - nStartTime << " ms");
     }


More information about the Libreoffice-commits mailing list