summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-21 13:08:34 +0200
committerNoel Grandin <noel@peralex.com>2013-05-21 13:53:20 +0200
commita986eddb9b9d1de71ae1c6f73246e493cc449c21 (patch)
treead9221c84bcc6d1c49b2cb8328b42d7c20226522
parentd4d16d8a27517930bdc9e9a308da287d367dd622 (diff)
fdo#46808, Convert oox.ExcelFilterExport service to new style
Service already existed, just needed an IDL file Change-Id: I397296e5ad7b32febb63e74f8ee9a0db53ba5a81
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/oox/ExcelFilterExport.idl37
-rw-r--r--oox/source/export/shapes.cxx5
-rw-r--r--sc/source/filter/excel/xestream.cxx9
-rw-r--r--sc/source/filter/oox/excelfilter.cxx21
-rw-r--r--sc/util/scfilt.component2
6 files changed, 58 insertions, 19 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 1b70c75afbea..79f76c814d56 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -260,6 +260,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/media,\
$(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 \
+))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/packages/manifest,\
ManifestReader \
ManifestWriter \
diff --git a/offapi/com/sun/star/oox/ExcelFilterExport.idl b/offapi/com/sun/star/oox/ExcelFilterExport.idl
new file mode 100644
index 000000000000..cb74aa80c070
--- /dev/null
+++ b/offapi/com/sun/star/oox/ExcelFilterExport.idl
@@ -0,0 +1,37 @@
+/* -*- 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/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 2fc1133d7033..75a5b596ea91 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -46,6 +46,7 @@
#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>
@@ -1312,8 +1313,8 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< XShape > xShape )
if( xSheetDoc.is() && mpFB)
{
Reference< XComponent > xDocument( mAny, UNO_QUERY );
- Reference< XExporter > xExporter( Reference<css::lang::XMultiServiceFactory>(mpFB->getComponentContext()->getServiceManager(), UNO_QUERY_THROW)->createInstance( "com.sun.star.comp.oox.ExcelFilterExport" ), UNO_QUERY );;
- if( xDocument.is() && xExporter.is())
+ Reference< XExporter > xExporter = css::oox::ExcelFilterExport::create( mpFB->getComponentContext() );
+ if( xDocument.is() )
{
Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer()
.appendAscii( GetComponentDir() )
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index dacbb1dfd8f6..cc4678f3eabf 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1146,11 +1146,9 @@ bool XclExpXmlStream::exportDocument() throw()
// UNO stuff so that the filter is registered
//////////////////////////////////////////////////////////////////////////
-#define IMPL_NAME "com.sun.star.comp.oox.ExcelFilterExport"
-
OUString XlsxExport_getImplementationName()
{
- return OUString( IMPL_NAME );
+ return OUString( "com.sun.star.comp.oox.ExcelFilterExport" );
}
::oox::ole::VbaProject* XclExpXmlStream::implCreateVbaProject() const
@@ -1166,8 +1164,9 @@ OUString XclExpXmlStream::implGetImplementationName() const
Sequence< OUString > SAL_CALL XlsxExport_getSupportedServiceNames() throw()
{
- const OUString aServiceName( "com.sun.star.document.ExportFilter" );
- const Sequence< OUString > aSeq( &aServiceName, 1 );
+ Sequence< OUString > aSeq( 2 );
+ aSeq[0] = "com.sun.star.document.ExportFilter";
+ aSeq[1] = "com.sun.star.oox.ExcelFilterExport";
return aSeq;
}
diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index 379b323d9e2a..e8414cb15584 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -20,6 +20,8 @@
#include "excelfilter.hxx"
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/oox/ExcelFilterExport.hpp>
+
#include "oox/helper/binaryinputstream.hxx"
#include "biffinputstream.hxx"
#include "excelchartconverter.hxx"
@@ -175,19 +177,16 @@ sal_Bool SAL_CALL ExcelFilter::filter( const ::com::sun::star::uno::Sequence< ::
if ( isExportFilter() )
{
- Reference< XExporter > xExporter( Reference<XMultiServiceFactory>(getComponentContext()->getServiceManager(), UNO_QUERY_THROW)->createInstance( "com.sun.star.comp.oox.ExcelFilterExport" ), UNO_QUERY );;
+ Reference< XExporter > xExporter = css::oox::ExcelFilterExport::create( getComponentContext() );
+
+ Reference< XComponent > xDocument( getModel(), UNO_QUERY );
+ Reference< XFilter > xFilter( xExporter, UNO_QUERY );
- if ( xExporter.is() )
+ if ( xFilter.is() )
{
- Reference< XComponent > xDocument( getModel(), UNO_QUERY );
- Reference< XFilter > xFilter( xExporter, UNO_QUERY );
-
- if ( xFilter.is() )
- {
- xExporter->setSourceDocument( xDocument );
- if ( xFilter->filter( rDescriptor ) )
- return true;
- }
+ xExporter->setSourceDocument( xDocument );
+ if ( xFilter->filter( rDescriptor ) )
+ return true;
}
}
diff --git a/sc/util/scfilt.component b/sc/util/scfilt.component
index 292fbd49cd33..6834ce1578ec 100644
--- a/sc/util/scfilt.component
+++ b/sc/util/scfilt.component
@@ -20,7 +20,7 @@
<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.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"/>