[Libreoffice-commits] core.git: 3 commits - offapi/com offapi/UnoApi_offapi.mk oox/source sc/source sc/util

Stephan Bergmann sbergman at redhat.com
Fri May 31 09:12:00 PDT 2013


 offapi/UnoApi_offapi.mk                       |    1 
 offapi/com/sun/star/oox/ExcelFilterExport.idl |   37 ------------------
 oox/source/export/shapes.cxx                  |   18 ++++-----
 sc/source/filter/excel/xestream.cxx           |   23 -----------
 sc/source/filter/inc/excelfilter.hxx          |   25 +++---------
 sc/source/filter/inc/xestream.hxx             |    7 ---
 sc/source/filter/oox/excelfilter.cxx          |   52 +++++++++++---------------
 sc/source/filter/oox/workbookhelper.cxx       |    8 ++--
 sc/source/filter/services.cxx                 |    4 --
 sc/util/scfilt.component                      |    3 -
 10 files changed, 42 insertions(+), 136 deletions(-)

New commits:
commit 5658600001a41c536cc1497eb7419512cb1353d8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri May 31 18:01:43 2013 +0200

    No need for two Excel filter services
    
    The reason to have both export-only XclExpXmlStream
    ("com.sun.star.comp.oox.ExcelFilterExport") and im-/export oox::xls::ExcelFilter
    ("com.sun.star.comp.oox.xls.ExcelFilter"), where the latter uses the former to
    implement export, appears to be historic.
    
    Get rid of the former service, but keep it as an independent C++ class for now
    (still also deriving from XmlFilterBase)---this can likely be cleaned up by
    somebdoy versed in those XmlFilterBase details.
    
    With the last use (in oox::xls::ExcelFilter, to instantiate XclExpXmlStream) of
    the recently introduced com.sun.star.oox.ExcelFilterExport new-style service
    gone now, remove that service again.
    
    Change-Id: Id3adacd293cbe4390242827615f074d4bbe9d85a

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5b03b76..fc4ba30 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -258,7 +258,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/mozilla,\
 	MozillaBootstrap \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/oox,\
-	ExcelFilterExport \
 	PowerPointExport \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/packages/manifest,\
diff --git a/offapi/com/sun/star/oox/ExcelFilterExport.idl b/offapi/com/sun/star/oox/ExcelFilterExport.idl
deleted file mode 100644
index cb74aa8..0000000
--- a/offapi/com/sun/star/oox/ExcelFilterExport.idl
+++ /dev/null
@@ -1,37 +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 __com_sun_star_oox_ExcelFilterExport_idl__
-#define __com_sun_star_oox_ExcelFilterExport_idl__
-
-#include <com/sun/star/document/XExporter.idl>
-
-
-module com { module sun { module star { module oox {
-
-/**
-   @since LibreOffice 4.2
-*/
-service ExcelFilterExport : com::sun::star::document::XExporter;
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 178da4e..550753a 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1141,15 +1141,6 @@ bool XclExpXmlStream::exportDocument() throw()
     return true;
 }
 
-//////////////////////////////////////////////////////////////////////////
-// UNO stuff so that the filter is registered
-//////////////////////////////////////////////////////////////////////////
-
-OUString XlsxExport_getImplementationName()
-{
-    return OUString( "com.sun.star.comp.oox.ExcelFilterExport" );
-}
-
 ::oox::ole::VbaProject* XclExpXmlStream::implCreateVbaProject() const
 {
     return new ::oox::xls::ExcelVbaProject( getComponentContext(), Reference< XSpreadsheetDocument >( getModel(), UNO_QUERY ) );
@@ -1160,18 +1151,4 @@ OUString XclExpXmlStream::implGetImplementationName() const
     return OUString( "TODO" );
 }
 
-
-Sequence< OUString > XlsxExport_getSupportedServiceNames()
-{
-    Sequence< OUString > aSeq( 2 );
-    aSeq[0] = "com.sun.star.document.ExportFilter";
-    aSeq[1] = "com.sun.star.oox.ExcelFilterExport";
-    return aSeq;
-}
-
-Reference< XInterface > SAL_CALL XlsxExport_create(const Reference< XComponentContext > & rCC )
-{
-    return (cppu::OWeakObject*) new XclExpXmlStream( rCC );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index aed9dde..0ac31d4 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -381,13 +381,6 @@ private:
     XclExpXmlPathToStateMap                     maOpenedStreamMap;
 };
 
-css::uno::Reference< css::uno::XInterface > SAL_CALL XlsxExport_create(
-    css::uno::Reference< css::uno::XComponentContext > const & context);
-
-OUString SAL_CALL XlsxExport_getImplementationName();
-
-css::uno::Sequence< OUString > SAL_CALL XlsxExport_getSupportedServiceNames();
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index 81ec414..9980b2b 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -29,6 +29,7 @@
 #include "stylesbuffer.hxx"
 #include "themebuffer.hxx"
 #include "workbookfragment.hxx"
+#include "xestream.hxx"
 
 namespace oox {
 namespace xls {
@@ -167,7 +168,8 @@ sal_Bool SAL_CALL ExcelFilter::filter( const ::com::sun::star::uno::Sequence< ::
 
     if ( isExportFilter() )
     {
-        Reference< XExporter > xExporter = css::oox::ExcelFilterExport::create( getComponentContext() );
+        Reference< XExporter > xExporter(
+            new XclExpXmlStream( getComponentContext() ) );
 
         Reference< XComponent > xDocument( getModel(), UNO_QUERY );
         Reference< XFilter > xFilter( xExporter, UNO_QUERY );
diff --git a/sc/source/filter/services.cxx b/sc/source/filter/services.cxx
index 33a0184..2b35042 100644
--- a/sc/source/filter/services.cxx
+++ b/sc/source/filter/services.cxx
@@ -24,15 +24,11 @@
 #include "sal/types.h"
 
 #include "excelfilter.hxx"
-#include "xestream.hxx"
 
 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL scfilt_component_getFactory(
     char const * pImplName, void * pServiceManager, void * pRegistryKey)
 {
     static cppu::ImplementationEntry const services[] = {
-        { XlsxExport_create, XlsxExport_getImplementationName,
-          XlsxExport_getSupportedServiceNames,
-          cppu::createSingleComponentFactory, 0, 0 },
         { oox::xls::ExcelFilter_create,
           oox::xls::ExcelFilter_getImplementationName,
           oox::xls::ExcelFilter_getSupportedServiceNames,
diff --git a/sc/util/scfilt.component b/sc/util/scfilt.component
index 6834ce1..c4b3728 100644
--- a/sc/util/scfilt.component
+++ b/sc/util/scfilt.component
@@ -19,9 +19,6 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" prefix="scfilt"
     xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.oox.ExcelFilterExport">
-    <service name="com.sun.star.oox.ExcelFilterExport"/>
-  </implementation>
   <implementation name="com.sun.star.comp.oox.xls.ExcelFilter">
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExportFilter"/>
commit 779831307fe3da5f2226925972452c9aedeb67a8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri May 31 16:33:40 2013 +0200

    Trivially merge ExcelFilterBase into ExcelFilter
    
    Change-Id: I4c5080dd05ea7e00c56a820c8ce226c78d0a46b7

diff --git a/sc/source/filter/inc/excelfilter.hxx b/sc/source/filter/inc/excelfilter.hxx
index 6423996..5aa3310 100644
--- a/sc/source/filter/inc/excelfilter.hxx
+++ b/sc/source/filter/inc/excelfilter.hxx
@@ -29,24 +29,7 @@ class WorkbookGlobals;
 
 // ============================================================================
 
-class ExcelFilterBase
-{
-public:
-    void                registerWorkbookGlobals( WorkbookGlobals& rBookGlob );
-    WorkbookGlobals&    getWorkbookGlobals() const;
-    void                unregisterWorkbookGlobals();
-
-protected:
-    explicit            ExcelFilterBase();
-    virtual             ~ExcelFilterBase();
-
-private:
-    WorkbookGlobals*    mpBookGlob;
-};
-
-// ============================================================================
-
-class ExcelFilter : public ::oox::core::XmlFilterBase, public ExcelFilterBase
+class ExcelFilter : public ::oox::core::XmlFilterBase
 {
 public:
     explicit            ExcelFilter(
@@ -54,6 +37,10 @@ public:
                             throw( ::com::sun::star::uno::RuntimeException );
     virtual             ~ExcelFilter();
 
+    void                registerWorkbookGlobals( WorkbookGlobals& rBookGlob );
+    WorkbookGlobals&    getWorkbookGlobals() const;
+    void                unregisterWorkbookGlobals();
+
     virtual bool        importDocument() throw();
     virtual bool        exportDocument() throw();
 
@@ -68,6 +55,8 @@ private:
     virtual GraphicHelper* implCreateGraphicHelper() const;
     virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
     virtual OUString implGetImplementationName() const;
+
+    WorkbookGlobals*    mpBookGlob;
 };
 
 css::uno::Reference< css::uno::XInterface > SAL_CALL ExcelFilter_create(
diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index 630e9d2..81ec414 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -45,34 +45,6 @@ using ::oox::drawingml::table::TableStyleListPtr;
 
 // ============================================================================
 
-ExcelFilterBase::ExcelFilterBase() :
-    mpBookGlob( 0 )
-{
-}
-
-ExcelFilterBase::~ExcelFilterBase()
-{
-    OSL_ENSURE( !mpBookGlob, "ExcelFilterBase::~ExcelFilterBase - workbook data not cleared" );
-}
-
-void ExcelFilterBase::registerWorkbookGlobals( WorkbookGlobals& rBookGlob )
-{
-    mpBookGlob = &rBookGlob;
-}
-
-WorkbookGlobals& ExcelFilterBase::getWorkbookGlobals() const
-{
-    OSL_ENSURE( mpBookGlob, "ExcelFilterBase::getWorkbookGlobals - missing workbook data" );
-    return *mpBookGlob;
-}
-
-void ExcelFilterBase::unregisterWorkbookGlobals()
-{
-    mpBookGlob = 0;
-}
-
-// ============================================================================
-
 OUString ExcelFilter_getImplementationName()
 {
     return OUString( "com.sun.star.comp.oox.xls.ExcelFilter" );
@@ -95,12 +67,30 @@ Reference< XInterface > ExcelFilter_create(
 // ----------------------------------------------------------------------------
 
 ExcelFilter::ExcelFilter( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
-    XmlFilterBase( rxContext )
+    XmlFilterBase( rxContext ),
+    mpBookGlob( 0 )
 {
 }
 
 ExcelFilter::~ExcelFilter()
 {
+    OSL_ENSURE( !mpBookGlob, "ExcelFilter::~ExcelFilter - workbook data not cleared" );
+}
+
+void ExcelFilter::registerWorkbookGlobals( WorkbookGlobals& rBookGlob )
+{
+    mpBookGlob = &rBookGlob;
+}
+
+WorkbookGlobals& ExcelFilter::getWorkbookGlobals() const
+{
+    OSL_ENSURE( mpBookGlob, "ExcelFilter::getWorkbookGlobals - missing workbook data" );
+    return *mpBookGlob;
+}
+
+void ExcelFilter::unregisterWorkbookGlobals()
+{
+    mpBookGlob = 0;
 }
 
 bool ExcelFilter::importDocument() throw()
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 6ab4eca..51fd426 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -272,7 +272,7 @@ private:
     OUString            maPageStyleServ;        /// Service name for a page style.
     Reference< XSpreadsheetDocument > mxDoc;    /// Document model.
     FilterBase&         mrBaseFilter;           /// Base filter object.
-    ExcelFilterBase&    mrExcelBase;            /// Base object for registration of this structure.
+    ExcelFilter&        mrExcelFilter;          /// Base object for registration of this structure.
     FilterType          meFilterType;           /// File type of the filter.
     ProgressBarPtr      mxProgressBar;          /// The progress bar.
     StorageRef          mxVbaPrjStrg;           /// Storage containing the VBA project.
@@ -319,21 +319,21 @@ private:
 
 WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) :
     mrBaseFilter( rFilter ),
-    mrExcelBase( rFilter ),
+    mrExcelFilter( rFilter ),
     meFilterType( FILTER_OOXML ),
     mpOoxFilter( &rFilter ),
     meBiff( BIFF_UNKNOWN ),
     mpDoc( NULL )
 {
     // register at the filter, needed for virtual callbacks (even during construction)
-    mrExcelBase.registerWorkbookGlobals( *this );
+    mrExcelFilter.registerWorkbookGlobals( *this );
     initialize( true );
 }
 
 WorkbookGlobals::~WorkbookGlobals()
 {
     finalize();
-    mrExcelBase.unregisterWorkbookGlobals();
+    mrExcelFilter.unregisterWorkbookGlobals();
 }
 
 // document model -------------------------------------------------------------
commit 4e5e40e4c627775caf039870bcc28269a0d05937
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri May 31 16:00:42 2013 +0200

    In ShapeExport, use general com.sun.star.comp.oox.xls.ExcelFilter
    
    ...instead of its export-only part com.sun.star.comp.oox.ExcelFilterExport (for
    which even a new-style service com.sun.star.oox.ExcelFilterExport has been
    introduced recently, but all of this should probably go away again; that this
    filter is used explicitly is probably a rare enough scenario to not warrant a
    dedicated new-style service).
    
    The modified code in ShapeExport::WriteOLE2Shape is triggered e.g. with a
    Presetation, insert a Spreadsheet as an OLE Object, and save as "Office Open XML
    Presentation (.pptx)."
    
    Change-Id: Id2645972caaec5265eed645c9c6e2c308a4d079d

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d4b65ff..74fa5b9 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -46,7 +46,6 @@
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/oox/ExcelFilterExport.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/text/XSimpleText.hpp>
@@ -1311,7 +1310,6 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
                 if( xSheetDoc.is() && mpFB)
                 {
                     Reference< XComponent > xDocument( mAny, UNO_QUERY );
-                    Reference< XExporter > xExporter = css::oox::ExcelFilterExport::create( mpFB->getComponentContext() );
                     if( xDocument.is() )
                     {
                         Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer()
@@ -1327,13 +1325,15 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
                         rMedia[0].Name = MediaDescriptor::PROP_STREAMFOROUTPUT();
                         rMedia[0].Value <<= xOutStream;
 
-                        Reference< XFilter > xFilter( xExporter, UNO_QUERY );
-
-                        if( xFilter.is() )
-                        {
-                            xExporter->setSourceDocument( xDocument );
-                            xFilter->filter( rMedia );
-                        }
+                        Reference< XExporter > xExporter(
+                            mpFB->getComponentContext()->getServiceManager()->
+                                createInstanceWithContext(
+                                    "com.sun.star.comp.oox.xls.ExcelFilter",
+                                    mpFB->getComponentContext() ),
+                            UNO_QUERY_THROW );
+                        xExporter->setSourceDocument( xDocument );
+                        Reference< XFilter >( xExporter, UNO_QUERY_THROW )->
+                            filter( rMedia );
 
                         xOutStream->closeOutput();
 


More information about the Libreoffice-commits mailing list