From 6a6519c27a5a7ea07e6a19fcd43e76ca616dce4d Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 25 Mar 2013 23:26:36 +0100 Subject: Export current Writer page as jpg/png This is first step to rework of graphic exporting. The idea is to replace the exporter that works only for Draw/Impress and replace it with a general exporter for any object. With this it will be far easier to export objects as charts. Currently only Writer is supported and only jpg/png. Additionally, this commit introduces a new Export dialog which supports setting the pixel width, height and DPI. Change-Id: I7302b26bd432840d7ef0c3d2d2e13ff150cd2a07 --- filter/Configuration_filter.mk | 11 ++ filter/Library_graphicfilter.mk | 56 ++++++++ filter/Module_filter.mk | 1 + .../config/fragments/filters/writer_jpg_Export.xcu | 30 ++++ .../config/fragments/filters/writer_png_Export.xcu | 30 ++++ filter/source/graphic/GraphicExportDialog.cxx | 160 +++++++++++++++++++++ filter/source/graphic/GraphicExportDialog.hxx | 80 +++++++++++ filter/source/graphic/GraphicExportFilter.cxx | 153 ++++++++++++++++++++ filter/source/graphic/GraphicExportFilter.hxx | 76 ++++++++++ filter/source/graphic/Services.cxx | 56 ++++++++ filter/source/graphic/graphicfilter.component | 28 ++++ 11 files changed, 681 insertions(+) create mode 100644 filter/Library_graphicfilter.mk create mode 100644 filter/source/config/fragments/filters/writer_jpg_Export.xcu create mode 100644 filter/source/config/fragments/filters/writer_png_Export.xcu create mode 100644 filter/source/graphic/GraphicExportDialog.cxx create mode 100644 filter/source/graphic/GraphicExportDialog.hxx create mode 100644 filter/source/graphic/GraphicExportFilter.cxx create mode 100644 filter/source/graphic/GraphicExportFilter.hxx create mode 100644 filter/source/graphic/Services.cxx create mode 100644 filter/source/graphic/graphicfilter.component (limited to 'filter') diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index 483da495946e..7ca392c81749 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -829,6 +829,17 @@ $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fr impress_html_Export_ui \ ) +# fcfg_writergraphics +$(call filter_Configuration_add_types,fcfg_langpack,fcfg_writergraphics_types.xcu,filter/source/config/fragments/types,\ + jpg_JPEG \ + png_Portable_Network_Graphic \ +) + +$(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics_filters.xcu,filter/source/config/fragments/filters,\ + writer_jpg_Export \ + writer_png_Export \ +) + # fcfg_internalgraphics $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\ bmp_MS_Windows \ diff --git a/filter/Library_graphicfilter.mk b/filter/Library_graphicfilter.mk new file mode 100644 index 000000000000..223121e48844 --- /dev/null +++ b/filter/Library_graphicfilter.mk @@ -0,0 +1,56 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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 . +# + +$(eval $(call gb_Library_Library,graphicfilter)) + +$(eval $(call gb_Library_set_componentfile,graphicfilter,filter/source/graphic/graphicfilter)) + +$(eval $(call gb_Library_use_external,graphicfilter,boost_headers)) + +$(eval $(call gb_Library_use_sdk_api,graphicfilter)) + +$(eval $(call gb_Library_set_include,graphicfilter,\ + -I$(SRCDIR)/filter/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_use_libraries,graphicfilter,\ + svt \ + sfx \ + tk \ + vcl \ + utl \ + tl \ + svl \ + i18nisolang1 \ + comphelper \ + basegfx \ + cppuhelper \ + cppu \ + sal \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_Library_add_exception_objects,graphicfilter,\ + filter/source/graphic/GraphicExportFilter \ + filter/source/graphic/GraphicExportDialog \ + filter/source/graphic/Services \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk index 170e8768558f..b13407c67917 100644 --- a/filter/Module_filter.mk +++ b/filter/Module_filter.mk @@ -56,6 +56,7 @@ $(eval $(call gb_Module_add_targets,filter,\ Library_pdffilter \ Library_placeware \ Library_svgfilter \ + Library_graphicfilter \ Library_t602filter \ Library_textfd \ Library_xmlfa \ diff --git a/filter/source/config/fragments/filters/writer_jpg_Export.xcu b/filter/source/config/fragments/filters/writer_jpg_Export.xcu new file mode 100644 index 000000000000..4382761ddfde --- /dev/null +++ b/filter/source/config/fragments/filters/writer_jpg_Export.xcu @@ -0,0 +1,30 @@ + + + EXPORT ALIEN 3RDPARTYFILTER + com.sun.star.comp.GraphicExportDialog + com.sun.star.comp.GraphicExportFilter + + + JPEG - Joint Photographic Experts Group + + 0 + jpg_JPEG + + com.sun.star.text.TextDocument + diff --git a/filter/source/config/fragments/filters/writer_png_Export.xcu b/filter/source/config/fragments/filters/writer_png_Export.xcu new file mode 100644 index 000000000000..85438356d50b --- /dev/null +++ b/filter/source/config/fragments/filters/writer_png_Export.xcu @@ -0,0 +1,30 @@ + + + EXPORT ALIEN 3RDPARTYFILTER + com.sun.star.comp.GraphicExportDialog + com.sun.star.comp.GraphicExportFilter + + + PNG - Portable Network Graphic + + 0 + png_Portable_Network_Graphic + + com.sun.star.text.TextDocument + diff --git a/filter/source/graphic/GraphicExportDialog.cxx b/filter/source/graphic/GraphicExportDialog.cxx new file mode 100644 index 000000000000..23a5e2057e20 --- /dev/null +++ b/filter/source/graphic/GraphicExportDialog.cxx @@ -0,0 +1,160 @@ +/* -*- 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 "GraphicExportDialog.hxx" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +using namespace css; +using namespace css::uno; +using namespace css::beans; +using namespace css::lang; + +GraphicExportDialog::GraphicExportDialog( const Reference< XComponentContext >& rxContext ) : + mxContext ( rxContext ), + mbExportSelection ( sal_False ) +{ +} + +GraphicExportDialog::~GraphicExportDialog() +{ +} + +// XInitialization +void SAL_CALL GraphicExportDialog::initialize( const Sequence& ) throw ( Exception, RuntimeException ) +{} + +// XPropertyAccess +Sequence GraphicExportDialog::getPropertyValues() throw ( RuntimeException ) +{ + sal_Int32 i; + sal_Int32 nCount = maMediaDescriptor.getLength(); + + for ( i = 0; i < nCount; i++ ) + { + if ( maMediaDescriptor[ i ].Name == "FilterData" ) + { + break; + } + } + + if ( i >= nCount ) + { + nCount++; + maMediaDescriptor.realloc( nCount ); + } + + maMediaDescriptor[ i ].Name = OUString( "FilterData" ); + maMediaDescriptor[ i ].Value <<= maFilterDataSequence; + return maMediaDescriptor; +} + +void GraphicExportDialog::setPropertyValues( const Sequence& aProps ) + throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, + WrappedTargetException, RuntimeException ) +{ + maMediaDescriptor = aProps; + + sal_Int32 i, nCount; + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) + { + if ( maMediaDescriptor[ i ].Name == "FilterData" ) + { + maMediaDescriptor[ i ].Value >>= maFilterDataSequence; + } + else if ( maMediaDescriptor[ i ].Name == "SelectionOnly" ) + { + maMediaDescriptor[ i ].Value >>= mbExportSelection; + } + } +} + +// XExecutableDialog +void GraphicExportDialog::setTitle( const OUString& aTitle ) + throw ( uno::RuntimeException ) +{ + maDialogTitle = aTitle; +} + +sal_Int16 GraphicExportDialog::execute() throw ( RuntimeException ) +{ + sal_Int16 nReturn = ui::dialogs::ExecutableDialogResults::CANCEL; + GraphicExportOptionsDialog graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument ); + if (graphicExportOptionsDialog.Execute() == RET_OK ) + { + maFilterDataSequence = graphicExportOptionsDialog.getFilterData(); + nReturn = ui::dialogs::ExecutableDialogResults::OK; + } + return nReturn; +} + +// XEmporter +void GraphicExportDialog::setSourceDocument( const Reference& xDocument ) + throw ( IllegalArgumentException, RuntimeException ) +{ + mxSourceDocument = xDocument; + + // try to set the corresponding metric unit + OUString aConfigPath; + Reference< XServiceInfo > xServiceInfo ( xDocument, UNO_QUERY ); + + if ( xServiceInfo.is() ) + { + if ( xServiceInfo->supportsService( OUString( "com.sun.star.presentation.PresentationDocument" ) ) ) + { + aConfigPath = OUString( "Office.Impress/Layout/Other/MeasureUnit" ); + } + else if ( xServiceInfo->supportsService( OUString( "com.sun.star.drawing.DrawingDocument" ) ) ) + { + aConfigPath = OUString( "Office.Draw/Layout/Other/MeasureUnit" ); + } + else if ( xServiceInfo->supportsService( OUString( "com.sun.star.text.TextDocument" ) ) ) + { + aConfigPath = OUString( "Office.Writer/Layout/Other/MeasureUnit" ); + } + if ( !aConfigPath.isEmpty() ) + { + FilterConfigItem aConfigItem( aConfigPath ); + String aPropertyName; + SvtSysLocale aSysLocale; + + if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MEASURE_METRIC ) + { + aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + else + { + aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "NonMetric" ) ); + } + meFieldUnit = (FieldUnit) aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphic/GraphicExportDialog.hxx b/filter/source/graphic/GraphicExportDialog.hxx new file mode 100644 index 000000000000..7a32708d7089 --- /dev/null +++ b/filter/source/graphic/GraphicExportDialog.hxx @@ -0,0 +1,80 @@ +/* -*- 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 _GRAPHICEXPORTDIALOG_HXX_ +#define _GRAPHICEXPORTDIALOG_HXX_ + +#include +#include +#include + +#include +#include +#include +#include + +using namespace css; +using namespace css::uno; +using namespace css::beans; +using namespace css::lang; + +class GraphicExportDialog : public cppu::WeakImplHelper4 +< + document::XExporter, + ui::dialogs::XExecutableDialog, + beans::XPropertyAccess, + lang::XInitialization +> +{ + Sequence maMediaDescriptor; + Sequence maFilterDataSequence; + Reference mxSourceDocument; + Reference mxContext; + + OUString maDialogTitle; + FieldUnit meFieldUnit; + bool mbExportSelection; + +public: + + explicit GraphicExportDialog( const Reference& rxContext ); + virtual ~GraphicExportDialog(); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence& aArguments ) throw (Exception, RuntimeException ); + + // XPropertyAccess + virtual Sequence SAL_CALL getPropertyValues() throw ( RuntimeException ); + virtual void SAL_CALL setPropertyValues( const Sequence& aProps ) + throw ( UnknownPropertyException, PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + RuntimeException ); + + // XExecuteDialog + virtual sal_Int16 SAL_CALL execute() throw ( RuntimeException ); + virtual void SAL_CALL setTitle( const OUString& aTitle ) throw ( RuntimeException ); + + // XExporter + virtual void SAL_CALL setSourceDocument( const Reference& xDocument ) throw ( lang::IllegalArgumentException, RuntimeException ); +}; + + +#endif // _GRAPHICEXPORTDIALOGUNO_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx new file mode 100644 index 000000000000..46a5b7f43ef3 --- /dev/null +++ b/filter/source/graphic/GraphicExportFilter.cxx @@ -0,0 +1,153 @@ +/* -*- 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 "GraphicExportFilter.hxx" + +#include +#include +#include + +GraphicExportFilter::GraphicExportFilter( const Reference& rxContext ) : + mxContext( rxContext ) +{} + +GraphicExportFilter::~GraphicExportFilter() +{} + +void GraphicExportFilter::gatherProperties( const Sequence& rProperties ) +{ + OUString aInternalFilterName; + + for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ ) + { + PropertyValue aProperty = rProperties[i]; + + if ( aProperty.Name == "FilterName" ) + { + aProperty.Value >>= aInternalFilterName; + aInternalFilterName = aInternalFilterName.replaceFirst( OUString( "draw_" ), OUString() ); + aInternalFilterName = aInternalFilterName.replaceFirst( OUString( "impress_" ), OUString() ); + aInternalFilterName = aInternalFilterName.replaceFirst( OUString( "calc_" ), OUString() ); + aInternalFilterName = aInternalFilterName.replaceFirst( OUString( "writer_" ), OUString() ); + } + else if ( aProperty.Name == "FilterData" ) + { + aProperty.Value >>= mFilterDataSequence; + } + else if ( aProperty.Name == "SelectionOnly" ) + { + aProperty.Value >>= mExportSelection; + } + else if ( aProperty.Name == "URL" ) + { + if( !( aProperty.Value >>= mTargetUrl ) ) + { + aProperty.Value >>= mTargetUrl.Complete; + } + } + else if ( aProperty.Name == "OutputStream" ) + { + aProperty.Value >>= mxOutputStream; + } + } + + for ( sal_Int32 i = 0; i < mFilterDataSequence.getLength(); i++ ) + { + if ( mFilterDataSequence[i].Name == "PixelWidth" ) + { + mFilterDataSequence[i].Value >>= mTargetWidth; + } + else if ( mFilterDataSequence[i].Name == "PixelHeight" ) + { + mFilterDataSequence[i].Value >>= mTargetHeight; + } + } + + if ( !aInternalFilterName.isEmpty() ) + { + GraphicFilter aGraphicFilter( sal_True ); + + sal_uInt16 nFilterCount = aGraphicFilter.GetExportFormatCount(); + sal_uInt16 nFormat; + + for ( nFormat = 0; nFormat < nFilterCount; nFormat++ ) + { + if ( aGraphicFilter.GetExportInternalFilterName( nFormat ) == aInternalFilterName ) + break; + } + if ( nFormat < nFilterCount ) + { + mFilterExtension = aGraphicFilter.GetExportFormatShortName( nFormat ); + } + } +} + +sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence& rDescriptor ) + throw (RuntimeException) +{ + gatherProperties(rDescriptor); + + DocumentToGraphicRenderer aRenderer( mxDocument ); + sal_Int32 aCurrentPage = aRenderer.getCurrentPageWriter(); + Size aDocumentSizePixel = aRenderer.getDocumentSizeInPixels(aCurrentPage); + + Size aTargetSizePixel(mTargetWidth, mTargetHeight); + + Graphic aGraphic = aRenderer.renderToGraphic( aCurrentPage, aDocumentSizePixel, aTargetSizePixel ); + + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); + + Sequence< PropertyValue > aFilterData( 3 ); + aFilterData[ 0 ].Name = "Interlaced"; + aFilterData[ 0 ].Value <<= (sal_Int32) 0; + aFilterData[ 1 ].Name = "Compression"; + aFilterData[ 1 ].Value <<= (sal_Int32) 9; + aFilterData[ 2 ].Name = "Quality"; + aFilterData[ 2 ].Value <<= (sal_Int32) 99; + + sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( mFilterExtension ); + + SvMemoryStream aMemStream; + const GraphicConversionParameters aParameters(aTargetSizePixel, true, true); + + sal_uInt16 aResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), String(), aMemStream, nFilterFormat, &aFilterData ); + + SvOutputStream aOutputStream( mxOutputStream ); + aMemStream.Seek(0); + aOutputStream << aMemStream; + + return true; +} + +void SAL_CALL GraphicExportFilter::cancel( ) throw (RuntimeException) +{ +} + +void SAL_CALL GraphicExportFilter::setSourceDocument( const Reference& xDocument ) + throw (IllegalArgumentException, RuntimeException) +{ + mxDocument = xDocument; +} + +void SAL_CALL GraphicExportFilter::initialize( const Sequence& ) + throw (Exception, RuntimeException) +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphic/GraphicExportFilter.hxx b/filter/source/graphic/GraphicExportFilter.hxx new file mode 100644 index 000000000000..13e9b39b317a --- /dev/null +++ b/filter/source/graphic/GraphicExportFilter.hxx @@ -0,0 +1,76 @@ +/* -*- 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 _GRAPHICEXPORTFILTER_HXX_ +#define _GRAPHICEXPORTFILTER_HXX_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace css; +using namespace css::uno; +using namespace css::lang; +using namespace css::beans; +using namespace css::document; + +class GraphicExportFilter : + public cppu::WeakImplHelper3 < XFilter, XExporter, XInitialization > +{ + Reference mxDocument; + Reference mxContext; + Reference mxStatusIndicator; + Reference mxOutputStream; + + void gatherProperties( const Sequence& rDescriptor ); + + bool mExportSelection; + OUString mFilterExtension; + util::URL mTargetUrl; + + Sequence mFilterDataSequence; + + sal_Int32 mTargetWidth; + sal_Int32 mTargetHeight; + +public: + explicit GraphicExportFilter( const Reference& rxContext ); + virtual ~GraphicExportFilter(); + + // XFilter + virtual sal_Bool SAL_CALL filter( const Sequence& rDescriptor ) throw(RuntimeException); + virtual void SAL_CALL cancel( ) throw (RuntimeException); + + // XExporter + virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDocument ) throw(IllegalArgumentException, RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence& aArguments ) throw(Exception, RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphic/Services.cxx b/filter/source/graphic/Services.cxx new file mode 100644 index 000000000000..35cf5d75bb48 --- /dev/null +++ b/filter/source/graphic/Services.cxx @@ -0,0 +1,56 @@ +/* -*- 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 "GraphicExportDialog.hxx" +#include "GraphicExportFilter.hxx" +#include + +#define GRAPHIC_EXPORT_FILTER_SERVICE "com.sun.star.comp.GraphicExportFilter" +#define GRAPHIC_EXPORT_DIALOG_SERVICE "com.sun.star.comp.GraphicExportDialog" + +comphelper::service_decl::class_ serviceGraphicExportFilter; +const comphelper::service_decl::ServiceDecl graphicExportFilter( + serviceGraphicExportFilter, + GRAPHIC_EXPORT_FILTER_SERVICE, + "com.sun.star.document.ExportFilter" ); + +comphelper::service_decl::class_ serviceGraphicExportDialog; +const comphelper::service_decl::ServiceDecl graphicExportDialog( + serviceGraphicExportDialog, + GRAPHIC_EXPORT_DIALOG_SERVICE, + "com.sun.star.ui.dialog.FilterOptionsDialog" ); + + +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL graphicfilter_component_getFactory( + sal_Char const* pImplementationName, + ::com::sun::star::lang::XMultiServiceFactory* pServiceManager, + ::com::sun::star::registry::XRegistryKey* pRegistryKey ) +{ + if ( rtl_str_compare (pImplementationName, GRAPHIC_EXPORT_FILTER_SERVICE) == 0 ) + { + return component_getFactoryHelper( pImplementationName, pServiceManager, pRegistryKey, graphicExportFilter ); + } + else if ( rtl_str_compare (pImplementationName, GRAPHIC_EXPORT_DIALOG_SERVICE) == 0 ) + { + return component_getFactoryHelper( pImplementationName, pServiceManager, pRegistryKey, graphicExportDialog ); + } + return NULL; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphic/graphicfilter.component b/filter/source/graphic/graphicfilter.component new file mode 100644 index 000000000000..3082473284a5 --- /dev/null +++ b/filter/source/graphic/graphicfilter.component @@ -0,0 +1,28 @@ + + + + + + + + + + + -- cgit