summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Ahrens <ka@openoffice.org>2002-08-13 10:55:25 +0000
committerKai Ahrens <ka@openoffice.org>2002-08-13 10:55:25 +0000
commit4111b430a0a7954416ff95794a8ffb8fbc4472e3 (patch)
treeed38c0543b59cfaef6bc572190ef56105174777a
parentc97f6e9831fdedbe455d7beaa00bd2e27627aa14 (diff)
#101570#: added pdf filter
-rw-r--r--filter/source/pdf/makefile.mk109
-rw-r--r--filter/source/pdf/pdfexport.cxx679
-rw-r--r--filter/source/pdf/pdfexport.hxx100
-rw-r--r--filter/source/pdf/pdffilter.cxx220
-rw-r--r--filter/source/pdf/pdffilter.hxx167
-rw-r--r--filter/source/pdf/pdfuno.cxx137
6 files changed, 1412 insertions, 0 deletions
diff --git a/filter/source/pdf/makefile.mk b/filter/source/pdf/makefile.mk
new file mode 100644
index 000000000000..044c0ac17527
--- /dev/null
+++ b/filter/source/pdf/makefile.mk
@@ -0,0 +1,109 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: ka $ $Date: 2002-08-13 11:55:23 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (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.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=pdf
+TARGET=pdffilter
+
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/pdfuno.obj \
+ $(SLO)$/pdffilter.obj \
+ $(SLO)$/pdfexport.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
+
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(SVLLIB) \
+ $(TKLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
new file mode 100644
index 000000000000..3ff910be2a0c
--- /dev/null
+++ b/filter/source/pdf/pdfexport.cxx
@@ -0,0 +1,679 @@
+/*************************************************************************
+ *
+ * $RCSfile: pdfexport.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: ka $ $Date: 2002-08-13 11:55:24 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "pdfexport.hxx"
+#include <tools/urlobj.hxx>
+#include <tools/fract.hxx>
+#include <vcl/pdfwriter.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/jobset.hxx>
+#include <vcl/poly.hxx>
+#include <so3/embobj.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <unotools/localfilehelper.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
+#include <com/sun/star/awt/Rectangle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_
+#include <com/sun/star/awt/XDevice.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_MEASUREUNIT_HPP_
+#include <com/sun/star/util/MeasureUnit.hpp>
+#endif
+#ifndef _COM_SUN_STAR_VIEW_XRENDERABLE_HPP_
+#include <com/sun/star/view/XRenderable.hpp>
+#endif
+
+using namespace ::rtl;
+using namespace ::vcl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::view;
+
+// -------------
+// - PDFExport -
+// -------------
+
+PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc ) :
+ mxSrcDoc( rxSrcDoc )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PDFExport::~PDFExport()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::Export( const OUString& rFile )
+{
+ INetURLObject aURL( rFile );
+ OUString aFile;
+ sal_Bool bRet = sal_False;
+
+ if( aURL.GetProtocol() != INET_PROT_FILE )
+ {
+ String aTmp;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFile, aTmp ) )
+ aURL = aTmp;
+ }
+
+ if( aURL.GetProtocol() == INET_PROT_FILE )
+ {
+ PDFWriter aWriter( aURL.GetMainURL() );
+ OutputDevice* pOut = aWriter.GetReferenceDevice();
+
+ if( pOut )
+ {
+ Reference< XRenderable > xRenderable( mxSrcDoc, UNO_QUERY );
+
+ if( xRenderable.is() )
+ {
+ Any aAny;
+
+ try
+ {
+ Sequence< PropertyValue > aRenderer( xRenderable->getRenderer() );
+ awt::Size aPageSize;
+ MapUnit eMapUnit = MAP_RELATIVE;
+ sal_Int32 nPageCount, nNextPage = 0;
+ sal_Int16 nMapUnit = -1;
+ sal_Bool bNextPage = sal_True;
+
+ for( sal_Int32 nProperty = 0, nPropertyCount = aRenderer.getLength(); nProperty < nPropertyCount; ++nProperty )
+ {
+ if( aRenderer[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) )
+ aRenderer[ nProperty].Value >>= aPageSize;
+ else if( aRenderer[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSizeMeasureUnit" ) ) )
+ aRenderer[ nProperty ].Value >>= nMapUnit;
+ else if( aRenderer[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageCount" ) ) )
+ aRenderer[ nProperty ].Value >>= nPageCount;
+ }
+
+ switch( nMapUnit )
+ {
+ case util::MeasureUnit::MM_100TH: eMapUnit = MAP_100TH_MM; break;
+ case util::MeasureUnit::MM_10TH: eMapUnit = MAP_10TH_MM; break;
+ case util::MeasureUnit::MM: eMapUnit = MAP_MM; break;
+ case util::MeasureUnit::CM: eMapUnit = MAP_CM; break;
+ case util::MeasureUnit::INCH_1000TH: eMapUnit = MAP_1000TH_INCH; break;
+ case util::MeasureUnit::INCH_100TH: eMapUnit = MAP_100TH_INCH; break;
+ case util::MeasureUnit::INCH_10TH: eMapUnit = MAP_10TH_INCH; break;
+ case util::MeasureUnit::INCH: eMapUnit = MAP_INCH; break;
+ case util::MeasureUnit::POINT: eMapUnit = MAP_POINT; break;
+ case util::MeasureUnit::TWIP: eMapUnit = MAP_TWIP; break;
+ case util::MeasureUnit::PERCENT: eMapUnit = MAP_RELATIVE; break;
+
+ default:
+ DBG_ERROR( "unknown MeasureUnit" );
+ break;
+ }
+
+ if( ( MAP_RELATIVE != eMapUnit ) && ( aPageSize.Width > 0 ) &&( aPageSize.Height > 0 ) )
+ {
+ for( sal_Int32 i = 0; i < nPageCount; ++i )
+ {
+ GDIMetaFile aMtf;
+ const MapMode aMapMode( eMapUnit );
+ const Size aMtfSize( aPageSize.Width, aPageSize.Width );
+ VCLXDevice* pXDevice = new VCLXDevice;
+ Sequence< PropertyValue > aRenderOptions( 2 );
+
+ pOut->EnableOutput( FALSE );
+ pOut->SetMapMode( aMapMode );
+ pXDevice->SetOutputDevice( pOut );
+
+ aMtf.SetPrefSize( aMtfSize );
+ aMtf.SetPrefMapMode( aMapMode );
+ aMtf.Record( pOut );
+
+ aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
+ aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice );
+
+ aRenderOptions[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageNumber" ) );
+ aRenderOptions[ 1 ].Value <<= static_cast< sal_Int32 >( i + 1 );
+
+ xRenderable->render( aRenderOptions );
+
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ if( aMtf.GetActionCount() )
+ bRet = ImplExportPage( aWriter, aMtf ) || bRet;
+ }
+ }
+ }
+ catch( UnknownPropertyException )
+ {
+ }
+
+ aWriter.Emit();
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, const GDIMetaFile& rMtf )
+{
+ VirtualDevice aDummyVDev;
+ const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) );
+ Point aOrigin;
+ Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() );
+ sal_Bool bRet = sal_False;
+
+ aDummyVDev.EnableOutput( sal_False );
+ aDummyVDev.SetMapMode( rMtf.GetPrefMapMode() );
+
+ rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() );
+ rWriter.SetMapMode( rMtf.GetPrefMapMode() );
+
+ rWriter.SetClipRegion( aPageRect );
+ bRet = ImplWriteActions( rWriter, rMtf, aDummyVDev );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, const GDIMetaFile& rMtf, VirtualDevice& rDummyVDev )
+{
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+ rWriter.DrawPixel( pA->GetPoint(), pA->GetColor() );
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+ rWriter.DrawPixel( pA->GetPoint() );
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+ rWriter.DrawLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pAction;
+ rWriter.DrawRect( pA->GetRect() );
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+ rWriter.DrawRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ rWriter.DrawEllipse( pA->GetRect() );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ rWriter.DrawArc( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ rWriter.DrawPie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ rWriter.DrawChord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pAction;
+ rWriter.DrawPolygon( pA->GetPolygon() );
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ rWriter.DrawPolyLine( pA->GetPolygon() );
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ rWriter.DrawPolyPolygon( pA->GetPolyPolygon() );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ const PolyPolygon aPolyPoly( pA->GetRect() );
+
+ ImplWriteGradient( rWriter, aPolyPoly, pA->GetGradient(), rDummyVDev );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ ImplWriteGradient( rWriter, pA->GetPolyPolygon(), pA->GetGradient(), rDummyVDev );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ rWriter.DrawHatch( pA->GetPolyPolygon(), pA->GetHatch() );
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
+ rWriter.DrawTransparent( pA->GetPolyPolygon(), pA->GetTransparence() );
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+ DBG_ERROR( "MetaFloatTransparentAction not supported yet" );
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+
+ rWriter.Push();
+ ImplWriteActions( rWriter, pA->GetSubstitute(), rDummyVDev );
+ rWriter.Pop();
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ String aSkipComment;
+
+ if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ ImplWriteGradient( rWriter, pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), rDummyVDev );
+ }
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+ rWriter.DrawBitmap( pA->GetPoint(), pA->GetBitmap() );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+ rWriter.DrawBitmap( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+ rWriter.DrawBitmap( pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+ rWriter.DrawBitmapEx( pA->GetPoint(), pA->GetBitmapEx() );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+ rWriter.DrawBitmapEx( pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx() );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+ rWriter.DrawBitmapEx( pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pA->GetBitmapEx() );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ DBG_ERROR( "MetaMask...Action not supported yet" );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ rWriter.DrawText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ) );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ DBG_ERROR( "MetaTextRectAction not supported yet" );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ rWriter.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ rWriter.DrawStretchText( pA->GetPoint(), pA->GetWidth(), pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+
+ case( META_TEXTLINE_ACTION ):
+ {
+ const MetaTextLineAction* pA = (const MetaTextLineAction*) pAction;
+ rWriter.DrawTextLine( pA->GetStartPoint(), pA->GetWidth(), pA->GetStrikeout(), pA->GetUnderline() );
+
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ {
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction;
+
+ if( pA->IsClipping() )
+ rWriter.SetClipRegion( pA->GetRegion() );
+ else
+ rWriter.SetClipRegion();
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
+ rWriter.IntersectClipRegion( pA->GetRect() );
+ }
+ break;
+
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ {
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction;
+ rWriter.IntersectClipRegion( pA->GetRegion() );
+ }
+ break;
+
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pAction;
+ rWriter.MoveClipRegion( pA->GetHorzMove(), pA->GetVertMove() );
+ }
+ break;
+
+ case( META_MAPMODE_ACTION ):
+ {
+ const MetaMapModeAction* pA = (const MetaMapModeAction*) pAction;
+
+ const_cast< MetaAction* >( pAction )->Execute( &rDummyVDev );
+ rWriter.SetMapMode( rDummyVDev.GetMapMode() );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetLineColor( pA->GetColor() );
+ else
+ rWriter.SetLineColor();
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetFillColor( pA->GetColor() );
+ else
+ rWriter.SetFillColor();
+ }
+ break;
+
+ case( META_TEXTLINECOLOR_ACTION ):
+ {
+ const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetTextLineColor( pA->GetColor() );
+ else
+ rWriter.SetTextLineColor();
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ rWriter.SetTextFillColor( pA->GetColor() );
+ else
+ rWriter.SetTextFillColor();
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pAction;
+ rWriter.SetTextColor( pA->GetColor() );
+ }
+ break;
+
+ case( META_TEXTALIGN_ACTION ):
+ {
+ const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pAction;
+ rWriter.SetTextAlign( pA->GetTextAlign() );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pAction;
+ rWriter.SetFont( pA->GetFont() );
+ }
+ break;
+
+ case( META_PUSH_ACTION ):
+ {
+ const MetaPushAction* pA = (const MetaPushAction*) pAction;
+
+ const_cast< MetaAction* >( pAction )->Execute( &rDummyVDev );
+ rWriter.Push();
+ }
+ break;
+
+ case( META_POP_ACTION ):
+ {
+ const_cast< MetaAction* >( pAction )->Execute( &rDummyVDev );
+ rWriter.Pop();
+ }
+ break;
+
+ case( META_LAYOUTMODE_ACTION ):
+ {
+ const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*) pAction;
+ rWriter.SetLayoutMode( pA->GetLayoutMode() );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pAction;
+ rWriter.DrawWallpaper( pA->GetRect(), pA->GetWallpaper() );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ default:
+ DBG_ERROR( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" );
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFExport::ImplWriteGradient( PDFWriter& rWriter, const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rDummyVDev )
+{
+ GDIMetaFile aTmpMtf;
+
+ rDummyVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+
+ rWriter.Push();
+ rWriter.IntersectClipRegion( rPolyPoly );
+ ImplWriteActions( rWriter, aTmpMtf, rDummyVDev );
+ rWriter.Pop();
+}
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
new file mode 100644
index 000000000000..1351a7ae6879
--- /dev/null
+++ b/filter/source/pdf/pdfexport.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: pdfexport.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: ka $ $Date: 2002-08-13 11:55:24 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef PDFEXPORT_HXX
+#define PDFEXPORT_HXX
+
+#include <rtl/ustring.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+
+class SvEmbeddedObject;
+class GDIMetaFile;
+class VirtualDevice;
+class PolyPolygon;
+class Gradient;
+namespace vcl { class PDFWriter; }
+
+// -------------
+// - PDFExport -
+// -------------
+
+class PDFExport
+{
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxSrcDoc;
+
+ sal_Bool ImplExportPage( ::vcl::PDFWriter& rWriter, const GDIMetaFile& rMtf );
+ sal_Bool ImplWriteActions( ::vcl::PDFWriter& rWriter, const GDIMetaFile& rMtf, VirtualDevice& rDummyVDev );
+ void ImplWriteGradient( ::vcl::PDFWriter& rWriter, const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rDummyVDev );
+
+public:
+
+ PDFExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSrcDoc );
+ ~PDFExport();
+
+ sal_Bool Export( const ::rtl::OUString& rFile );
+};
+
+#endif
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
new file mode 100644
index 000000000000..08d6eabb601b
--- /dev/null
+++ b/filter/source/pdf/pdffilter.cxx
@@ -0,0 +1,220 @@
+ /*************************************************************************
+ *
+ * $RCSfile: pdffilter.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: ka $ $Date: 2002-08-13 11:55:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "pdffilter.hxx"
+#include "pdfexport.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <svtools/outstrm.hxx>
+
+// -------------
+// - PDFFilter -
+// -------------
+
+PDFFilter::PDFFilter( const Reference< XMultiServiceFactory > &rxMSF ) :
+ mxMSF( rxMSF )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+PDFFilter::~PDFFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
+{
+ Reference< XOutputStream > xOStm;
+ sal_Int32 nLength = rDescriptor.getLength();
+ const PropertyValue* pValue = rDescriptor.getConstArray();
+ sal_Bool bRet = sal_False;
+
+ for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i)
+ if( pValue[ i ].Name.equalsAscii( "OutputStream" ) )
+ pValue[ i ].Value >>= xOStm;
+
+ if( mxSrcDoc.is() && xOStm.is() )
+ {
+ PDFExport aExport( mxSrcDoc );
+ ::utl::TempFile aTempFile;
+
+ aTempFile.EnableKillingFile();
+ bRet = aExport.Export( aTempFile.GetURL() );
+
+ if( bRet )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), STREAM_READ );
+
+ if( pIStm )
+ {
+ SvOutputStream aOStm( xOStm );
+
+ aOStm << *pIStm;
+ bRet = ( aOStm.Tell() && ( aOStm.GetError() == ERRCODE_NONE ) );
+
+ delete pIStm;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescriptor )
+ throw (RuntimeException)
+{
+ Window* pFocusWindow = Application::GetFocusWindow();
+
+ if( pFocusWindow )
+ pFocusWindow->EnterWait();
+
+ const sal_Bool bRet = implExport( rDescriptor );
+
+ if( pFocusWindow )
+ pFocusWindow->LeaveWait();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::cancel( ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::setSourceDocument( const Reference< XComponent >& xDoc )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ mxSrcDoc = xDoc;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL PDFFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OUString PDFFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFFilter" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#define SERVICE_NAME "com.sun.star.document.PDFFilter"
+
+sal_Bool SAL_CALL PDFFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( ) throw (RuntimeException)
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ return aRet;
+}
+
+#undef SERVICE_NAME
+
+// -----------------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
+{
+ return (cppu::OWeakObject*) new PDFFilter( rSMgr );
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL PDFFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+ return PDFFilter_getImplementationName();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PDFFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return PDFFilter_supportsService( rServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFFilter::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return PDFFilter_getSupportedServiceNames();
+}
diff --git a/filter/source/pdf/pdffilter.hxx b/filter/source/pdf/pdffilter.hxx
new file mode 100644
index 000000000000..62a1b6cf5239
--- /dev/null
+++ b/filter/source/pdf/pdffilter.hxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: pdffilter.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: ka $ $Date: 2002-08-13 11:55:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef PDFFILTER_HXX
+#define PDFFILTER_HXX
+
+#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_
+#include <com/sun/star/document/XFilter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XEXPORTER_HPP_
+#include <com/sun/star/document/XExporter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#include <osl/diagnose.h>
+#include <rtl/process.h>
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/streamwrap.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::io;
+using namespace ::std;
+
+// -------------
+// - PDFFilter -
+// -------------
+
+class PDFFilter : public cppu::WeakImplHelper4 < XFilter,
+ XExporter,
+ XInitialization,
+ XServiceInfo >
+{
+private:
+
+ Reference< XMultiServiceFactory > mxMSF;
+ Reference< XComponent > mxSrcDoc;
+
+ sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor );
+
+protected:
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
+ virtual void SAL_CALL cancel( ) throw (RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+public:
+
+ PDFFilter( const Reference< XMultiServiceFactory >& rxMSF );
+ virtual ~PDFFilter();
+};
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString PDFFilter_getImplementationName ()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL PDFFilter_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PDFFilter_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL PDFFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif // PDFFILTER_HXX
diff --git a/filter/source/pdf/pdfuno.cxx b/filter/source/pdf/pdfuno.cxx
new file mode 100644
index 000000000000..377eba98653e
--- /dev/null
+++ b/filter/source/pdf/pdfuno.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: pdfuno.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: ka $ $Date: 2002-08-13 11:55:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#include <pdffilter.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+extern "C"
+{
+ void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ // -------------------------------------------------------------------------
+
+ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
+ {
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFFilter_getImplementationName() ) );
+ xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
+
+ const Sequence< OUString > & rSNL = PDFFilter_getSupportedServiceNames();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+ }
+
+ // -------------------------------------------------------------------------
+
+ void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+ {
+ OUString implName = OUString::createFromAscii( pImplName );
+ void* pRet = 0;
+
+ if( pServiceManager && implName.equals(PDFFilter_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ PDFFilter_createInstance, PDFFilter_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+ }
+}