diff options
Diffstat (limited to 'filter')
408 files changed, 43918 insertions, 5225 deletions
diff --git a/filter/inc/filter.hrc b/filter/inc/filter.hrc index 60d626379b1b..4bea3330f617 100644 --- a/filter/inc/filter.hrc +++ b/filter/inc/filter.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filter.hrc,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,10 +30,7 @@ // include --------------------------------------------------------------- - -#ifndef _SOLAR_HRC #include <svl/solar.hrc> -#endif // Help-Ids -------------------------------------------------------------- @@ -46,8 +40,20 @@ #define RID_XSLT_DIALOG_END (RID_FILTER_START + 69) #define RID_PDF_OLD_EXPORT_DLG (RID_FILTER_START + 70) -// warning, next range is RID_FILTER_START + 100 ! +#define DLG_EXPORT_EPCT (RID_GOODIES_START+ 0) +#define DLG_EXPORT_GIF (RID_GOODIES_START+ 1) +#define DLG_EXPORT_EMET (RID_GOODIES_START+ 2) +#define DLG_EXPORT_JPG (RID_GOODIES_START+ 3) +#define DLG_IMPORT_PCD (RID_GOODIES_START+ 4) +#define DLG_EXPORT_EPNG (RID_GOODIES_START+ 5) +#define DLG_EXPORT_EPS (RID_GOODIES_START+ 8) +#define DLG_EXPORT_EPBM (RID_GOODIES_START+ 9) +#define DLG_EXPORT_EPGM (RID_GOODIES_START+ 10) +#define DLG_EXPORT_EPPM (RID_GOODIES_START+ 11) +#define DLG_SSL_NEWCERT (RID_GOODIES_START+ 12) +#define DLG_SSL_INFCERT (RID_GOODIES_START+ 13) +// warning, next range is RID_FILTER_START + 100 ! #define HID_FILTER_XSLT_START (HID_FILTER_START + 0) // see source/xsltdialog/xmlfilterhelpids.hrc for range #define HID_FILTER_XSLT_END (HID_FILTER_START + 99) diff --git a/filter/inc/filter/msfilter/countryid.hxx b/filter/inc/filter/msfilter/countryid.hxx index 0c66f1bf546c..f33b2fe6b5ac 100644 --- a/filter/inc/filter/msfilter/countryid.hxx +++ b/filter/inc/filter/msfilter/countryid.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: countryid.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx index fc36208d1207..b98f5dc85147 100644 --- a/filter/inc/filter/msfilter/escherex.hxx +++ b/filter/inc/filter/msfilter/escherex.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: escherex.hxx,v $ - * $Revision: 1.6.146.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,13 +28,15 @@ #ifndef _SVX_ESCHEREX_HXX #define _SVX_ESCHEREX_HXX +#include <memory> #include <vector> +#include <boost/shared_ptr.hpp> #include <tools/solar.h> #include <tools/gen.hxx> #include <tools/list.hxx> #include <tools/stream.hxx> #include <com/sun/star/uno/Reference.h> -#include <goodies/grfmgr.hxx> +#include <svtools/grfmgr.hxx> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Rectangle.hpp> @@ -948,13 +947,13 @@ enum ESCHER_LineCap #define ESCHER_Persist_PrivateEntry 0x80000000 #define ESCHER_Persist_Dgg 0x00010000 -#define ESCHER_Persist_Dgg_FIDCL 0x00010001 #define ESCHER_Persist_Dg 0x00020000 -#define ESCHER_Persist_BlibStoreContainer 0x00030000 #define ESCHER_Persist_CurrentPosition 0x00040000 #define ESCHER_Persist_Grouping_Snap 0x00050000 #define ESCHER_Persist_Grouping_Logic 0x00060000 +const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom. + // --------------------------------------------------------------------------------------------- namespace com { namespace sun { namespace star { @@ -964,6 +963,7 @@ namespace com { namespace sun { namespace star { namespace drawing { struct EnhancedCustomShapeAdjustmentValue; class XShape; + class XShapes; } }}} @@ -1033,13 +1033,11 @@ struct EscherPersistEntry // --------------------------------------------------------------------------------------------- -class SvMemoryStream; class EscherBlibEntry { friend class EscherGraphicProvider; friend class EscherEx; - friend class _EscherEx; protected: @@ -1347,52 +1345,137 @@ public: }; +// ============================================================================ + +/** Instance for global DFF data, shared through various instances of EscherEx. */ +class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider +{ +public: + explicit EscherExGlobal( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); + virtual ~EscherExGlobal(); + + /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */ + sal_uInt32 GenerateDrawingId(); + /** Creates and returns a new shape identifier, updates the internal shape + counters and registers the identifier in the DGG cluster table. + @param nDrawingId Drawing identifier has to be passed to be able to + generate shape identifiers for multiple drawings simultaniously. */ + sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr ); + /** Returns the number of shapes in the current drawing, based on number of + calls to the GenerateShapeId() function. */ + sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const; + /** Returns the last shape identifier generated by the GenerateShapeId() + function. */ + sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const; + + /** Sets the flag indicating that the DGGCONTAINER exists. */ + inline void SetDggContainer() { mbHasDggCont = true; } + /** Sets the flag indicating that the DGGCONTAINER exists. */ + inline bool HasDggContainer() const { return mbHasDggCont; } + /** Returns the total size of the DGG atom (including header). */ + sal_uInt32 GetDggAtomSize() const; + /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */ + void WriteDggAtom( SvStream& rStrm ) const; + + /** Called if a picture shall be written and no picture stream is set at + class ImplEscherExSdr. + + On first invokation, this function calls the virtual member function + ImplQueryPictureStream(). The return value will be cached internally + for subsequent calls and for the GetPictureStream() function. + */ + SvStream* QueryPictureStream(); + + /** Returns the picture stream if existing (queried), otherwise null. */ + inline SvStream* GetPictureStream() { return mpPicStrm; } + +private: + /** Derived classes may implement to create a new stream used to store the + picture data. + + The implementation has to take care about lifetime of the returned + stream (it will not be destructed automatically). This function is + called exactly once. The return value will be cached internally for + repeated calls of the public QueryPictureStream() function. + */ + virtual SvStream* ImplQueryPictureStream(); + +private: + struct ClusterEntry + { + sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos). + sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster. + inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {} + }; + typedef ::std::vector< ClusterEntry > ClusterTable; + + struct DrawingInfo + { + sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable). + sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing. + sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing. + inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {} + }; + typedef ::std::vector< DrawingInfo > DrawingInfoVector; + + ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings). + DrawingInfoVector maDrawingInfos; /// Data about all used drawings. + SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream(). + bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized. + bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called. +}; + +typedef ::boost::shared_ptr< EscherExGlobal > EscherExGlobalRef; + // --------------------------------------------------------------------------------------------- class SdrObject; class SdrPage; class ImplEscherExSdr; -class Color; - -class Graphic; -class SvMemoryStream; -class SvStream; -class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGraphicProvider +class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable { - protected : + protected: + typedef ::std::auto_ptr< ImplEscherExSdr > ImplEscherExSdrPtr; + EscherExGlobalRef mxGlobal; + ImplEscherExSdrPtr mpImplEscherExSdr; SvStream* mpOutStrm; - ImplEscherExSdr* mpImplEscherExSdr; UINT32 mnStrmStartOfs; std::vector< sal_uInt32 > mOffsets; std::vector< sal_uInt16 > mRecTypes; - UINT32 mnDrawings; - UINT32 mnFIDCLs; // anzahl der cluster ID's - UINT32 mnCurrentDg; - UINT32 mnCurrentShapeID; // die naechste freie ID - UINT32 mnCurrentShapeMaximumID; // die hoechste und auch benutzte ID - UINT32 mnTotalShapesDg; // anzahl der shapes im Dg - UINT32 mnTotalShapeIdUsedDg; // anzahl der benutzten shape Id's im Dg - UINT32 mnTotalShapesDgg; // anzahl der shapes im Dgg UINT32 mnCountOfs; UINT32 mnGroupLevel; UINT16 mnHellLayerId; BOOL mbEscherSpgr; - BOOL mbEscherDgg; BOOL mbEscherDg; BOOL mbOleEmf; // OLE is EMF instead of WMF virtual BOOL DoSeek( UINT32 nKey ); - public: +public: + explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ); + virtual ~EscherEx(); + + /** Creates and returns a new shape identifier, updates the internal shape + counters and registers the identifier in the DGG cluster table. */ + inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); } + + /** Returns the graphic provider from the global object that has been + passed to the constructor. + */ + inline EscherGraphicProvider& + GetGraphicProvider() { return *mxGlobal; } - EscherEx( SvStream& rOut, UINT32 nDrawings ); + /** Called if a picture shall be written and no picture stream is set at + class ImplEscherExSdr. + */ + inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); } /// Fuegt in den EscherStream interne Daten ein, dieser Vorgang /// darf und muss nur einmal ausgefuehrt werden. @@ -1401,14 +1484,29 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGrap /// gemerged, wie es fuer Excel (und Word?) benoetigt wird. virtual void Flush( SvStream* pPicStreamMergeBSE = NULL ); - virtual ~EscherEx(); + /** Inserts the passed number of bytes at the current position of the + output stream. - // Application may overload this function to maintain an offset - // table for specific regions but MUST call this function too. - virtual void InsertAtCurrentPos( UINT32 nBytes, BOOL bCont = FALSE );// es werden nBytes an der aktuellen Stream Position eingefuegt, - // die PersistantTable und interne Zeiger angepasst + Inserts dummy bytes and moves all following stream data, and updates + all internal stream offsets stored in the PersistTable and the affected + container sizes, which makes this operation very expensive. (!) + + @param nBytes The number of bytes to be inserted into the stream. + + @param bExpandEndOfAtom If set to true, an atom that currently ends + exactly at the current stream position will be expanded to include + the inserted data. If set to false, an atom that currently ends + exactly at the current stream position will not be expanded to + include the inserted data (used to insert e.g. a new atom after an + existing atom). Note that containers that end exactly at the + current stream position are always expanded to include the inserted + data. + */ + void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom ); void InsertPersistOffset( UINT32 nKey, UINT32 nOffset ); // Es wird nicht geprueft, ob sich jener schluessel schon in der PersistantTable befindet + void ReplacePersistOffset( UINT32 nKey, UINT32 nOffset ); + UINT32 GetPersistOffset( UINT32 nKey ); BOOL SeekToPersistOffset( UINT32 nKey ); virtual BOOL InsertAtPersistOffset( UINT32 nKey, UINT32 nValue );// nValue wird im Stream an entrsprechender Stelle eingefuegt(overwrite modus), ohne dass sich die // aktuelle StreamPosition aendert @@ -1443,21 +1541,16 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGrap // ein ESCHER_Sp wird geschrieben ( Ein ESCHER_DgContainer muss dazu geoeffnet sein !!) virtual void AddShape( UINT32 nShpInstance, UINT32 nFlagIds, UINT32 nShapeID = 0 ); - // reserviert eine ShapeId - UINT32 GetShapeID(); virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); UINT32 GetColor( const UINT32 nColor, BOOL bSwap = TRUE ); UINT32 GetColor( const Color& rColor, BOOL bSwap = TRUE ); - // OLE is written as EMF instead of WMF (default WMF) - void SetOleEmf( BOOL bVal ) { mbOleEmf = bVal; } - BOOL IsOleEmf() const { return mbOleEmf; } - // ...Sdr... implemented in eschesdo.cxx void AddSdrPage( const SdrPage& rPage ); + void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); /// returns the ShapeID UINT32 AddSdrObject( const SdrObject& rObj ); @@ -1470,7 +1563,9 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGrap /// Called before a shape is written, application supplies /// ClientRecords. May set AppData::bDontWriteShape so the /// shape is ignored. - virtual EscherExHostAppData* StartShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape ); + virtual EscherExHostAppData* StartShape( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape, + const Rectangle* pChildAnchor ); /// Called after a shape is written to inform the application /// of the resulted shape type and ID. @@ -1494,10 +1589,6 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGrap /// the same functionality as an ordinary recursive group. virtual EscherExHostAppData* EnterAdditionalTextGroup(); - /// Called if a picture shall be written and no PicStream is - /// set at ImplEscherExSdr - virtual SvStream* QueryPicStream(); - /// Called if an ESCHER_Prop_lTxid shall be written virtual UINT32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, UINT32 nShapeId ); // add an dummy rectangle shape into the escher stream @@ -1507,6 +1598,14 @@ class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable, public EscherGrap void SetHellLayerId( UINT16 nId ) { mnHellLayerId = nId; } UINT16 GetHellLayerId() const { return mnHellLayerId; } + +private: + EscherEx( const EscherEx& ); + EscherEx& operator=( const EscherEx& ); + + // prevent C-style cast to former base class EscherGraphicProvider + operator EscherGraphicProvider&(); + operator EscherGraphicProvider const&(); }; diff --git a/filter/inc/filter/msfilter/mscodec.hxx b/filter/inc/filter/msfilter/mscodec.hxx index a42e360d0f96..7bad8af6b788 100644 --- a/filter/inc/filter/msfilter/mscodec.hxx +++ b/filter/inc/filter/msfilter/mscodec.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mscodec.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx index eadb6328b1de..4f11a4c2fab9 100644 --- a/filter/inc/filter/msfilter/msdffimp.hxx +++ b/filter/inc/filter/msfilter/msdffimp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msdffimp.hxx,v $ - * $Revision: 1.4.214.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msfilterdllapi.h b/filter/inc/filter/msfilter/msfilterdllapi.h index ada4c8e853a9..28985f0c500f 100644 --- a/filter/inc/filter/msfilter/msfilterdllapi.h +++ b/filter/inc/filter/msfilter/msfilterdllapi.h @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dllapi.h,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msfiltertracer.hxx b/filter/inc/filter/msfilter/msfiltertracer.hxx index 13417175dc52..3b103e5be422 100644 --- a/filter/inc/filter/msfilter/msfiltertracer.hxx +++ b/filter/inc/filter/msfilter/msfiltertracer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msfiltertracer.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msocximex.hxx b/filter/inc/filter/msfilter/msocximex.hxx index cf06e8378541..173835495b12 100644 --- a/filter/inc/filter/msfilter/msocximex.hxx +++ b/filter/inc/filter/msfilter/msocximex.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msocximex.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msoleexp.hxx b/filter/inc/filter/msfilter/msoleexp.hxx index 8053928780f4..3cdbab6a9235 100644 --- a/filter/inc/filter/msfilter/msoleexp.hxx +++ b/filter/inc/filter/msfilter/msoleexp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msoleexp.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx deleted file mode 100644 index 93f2de413291..000000000000 --- a/filter/inc/filter/msfilter/msvbahelper.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: - * $Revision: - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MSVBAHELPER_HXX -#define _MSVBAHELPER_HXX - -#include <sfx2/objsh.hxx> -#include "filter/msfilter/msfilterdllapi.h" - -namespace ooo { namespace vba -{ - class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo - { - SfxObjectShell* mpDocContext; - bool mbFound; - String msResolvedMacro; - public: - VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){} - void SetResolved( bool bRes ) { mbFound = bRes; } - bool IsResolved() { return mbFound; } - void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; } - SfxObjectShell* MacroDocContext() { return mpDocContext; } - String ResolvedMacro() { return msResolvedMacro; } - void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; } - }; - - MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName ); - MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); - MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); -} } - -#endif diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx index 8d9b85c7301f..796ecc18cd3a 100644 --- a/filter/inc/filter/msfilter/svdfppt.hxx +++ b/filter/inc/filter/msfilter/svdfppt.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svdfppt.hxx,v $ - * $Revision: 1.7.6.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,14 +36,14 @@ #include <tools/gen.hxx> #include <tools/color.hxx> #include <svx/svdobj.hxx> -#include <svx/numitem.hxx> -#include <svx/editdata.hxx> +#include <editeng/numitem.hxx> +#include <editeng/editdata.hxx> #include <filter/msfilter/msdffimp.hxx> // Escher-Grafikimport #include <filter/msfilter/msocximex.hxx> #include <filter/msfilter/msfiltertracer.hxx> -#include <svx/eeitem.hxx> +#include <editeng/eeitem.hxx> #define ITEMID_FIELD EE_FEATURE_FIELD -#include <svx/flditem.hxx> +#include <editeng/flditem.hxx> #undef ITEMID_FIELD #include "filter/msfilter/msfilterdllapi.h" #include <vcl/font.hxx> diff --git a/filter/inc/filter/msfilter/svxmsbas.hxx b/filter/inc/filter/msfilter/svxmsbas.hxx index 641d71e3ac2d..f488017e4804 100644 --- a/filter/inc/filter/msfilter/svxmsbas.hxx +++ b/filter/inc/filter/msfilter/svxmsbas.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svxmsbas.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/makefile.mk b/filter/inc/makefile.mk index ccb616d8e94c..ae44f91ba667 100644 --- a/filter/inc/makefile.mk +++ b/filter/inc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/pch/precompiled_filter.cxx b/filter/inc/pch/precompiled_filter.cxx index a118d543d0bb..c2c7f32127b9 100644 --- a/filter/inc/pch/precompiled_filter.cxx +++ b/filter/inc/pch/precompiled_filter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_filter.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/inc/pch/precompiled_filter.hxx b/filter/inc/pch/precompiled_filter.hxx index c68e8c3a32e5..3220aa3f6e4c 100644 --- a/filter/inc/pch/precompiled_filter.hxx +++ b/filter/inc/pch/precompiled_filter.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_filter.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/prj/build.lst b/filter/prj/build.lst index a497bf4c3715..b4be1c83e63e 100644 --- a/filter/prj/build.lst +++ b/filter/prj/build.lst @@ -1,4 +1,4 @@ -fl filter : l10n svtools unotools goodies xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL +fl filter : vbahelper l10n svtools unotools xmloff cppu tools cppuhelper sal svx javaunohelper XPDF:xpdf jvmaccess canvas SAXON:saxon LIBXSLT:libxslt NULL fl filter usr1 - all fl_mkout NULL fl filter\prj get - all fl_prj NULL fl filter\inc nmake - all fl_inc NULL @@ -16,6 +16,28 @@ fl filter\source\xsltvalidate nmake - all fl_xsltvalidate fl_xsltfilter fl_in fl filter\source\xsltdialog nmake - all fl_xsltdialog fl_flash fl_inc NULL fl filter\source\docbook nmake - all fl_docbook fl_inc NULL fl filter\source\t602 nmake - all fl_t602 fl_inc NULL +fl filter\source\graphicfilter\eos2met nmake - all g_vfeom fl_inc NULL +fl filter\source\graphicfilter\ios2met nmake - all g_vfiom fl_inc NULL +fl filter\source\graphicfilter\epict nmake - all g_vfept fl_inc NULL +fl filter\source\graphicfilter\egif nmake - all g_vfegf fl_inc NULL +fl filter\source\graphicfilter\ipcd nmake - all g_vfipc fl_inc NULL +fl filter\source\graphicfilter\ipcx nmake - all g_vfipx fl_inc NULL +fl filter\source\graphicfilter\ipict nmake - all g_vfipt fl_inc NULL +fl filter\source\graphicfilter\idxf nmake - all g_vfidx fl_inc NULL +fl filter\source\graphicfilter\itiff nmake - all g_vfitf fl_inc NULL +fl filter\source\graphicfilter\ipbm nmake - all g_vfpbm fl_inc NULL +fl filter\source\graphicfilter\epbm nmake - all g_epbm fl_inc NULL +fl filter\source\graphicfilter\epgm nmake - all g_epgm fl_inc NULL +fl filter\source\graphicfilter\eppm nmake - all g_eppm fl_inc NULL +fl filter\source\graphicfilter\iras nmake - all g_iras fl_inc NULL +fl filter\source\graphicfilter\expm nmake - all g_expm fl_inc NULL +fl filter\source\graphicfilter\eras nmake - all g_eras fl_inc NULL +fl filter\source\graphicfilter\etiff nmake - all g_etiff fl_inc NULL +fl filter\source\graphicfilter\eps nmake - all g_eps fl_inc NULL +fl filter\source\graphicfilter\itga nmake - all g_itga fl_inc NULL +fl filter\source\graphicfilter\ipsd nmake - all g_ipsd fl_inc NULL +fl filter\source\graphicfilter\ieps nmake - all g_ieps fl_inc NULL +fl filter\source\graphicfilter\icgm nmake - all g_icgm fl_inc NULL fl filter\source\config\cache nmake - all fl_config fl_inc NULL fl filter\source\config\fragments\types nmake - all fl_fcfg_fragments_types fl_inc NULL fl filter\source\config\fragments\filters nmake - all fl_fcfg_fragments_filters fl_inc NULL diff --git a/filter/qa/complex/filter/detection/typeDetection/Helper.java b/filter/qa/complex/filter/detection/typeDetection/Helper.java index 713d0befe98c..4c282f55182e 100644 --- a/filter/qa/complex/filter/detection/typeDetection/Helper.java +++ b/filter/qa/complex/filter/detection/typeDetection/Helper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: Helper.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java index 423d6fe166d1..f706c4136118 100644 --- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java +++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TypeDetection.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/qa/complex/filter/detection/typeDetection/makefile.mk b/filter/qa/complex/filter/detection/typeDetection/makefile.mk index dea5044fb60c..bbc25efa3c29 100644 --- a/filter/qa/complex/filter/detection/typeDetection/makefile.mk +++ b/filter/qa/complex/filter/detection/typeDetection/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.9.102.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java index 9c2384887a80..e32b81caa85b 100644 --- a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java +++ b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FinalizedMandatoryTest.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/qa/complex/filter/misc/makefile.mk b/filter/qa/complex/filter/misc/makefile.mk index 0dd1c433b28c..2792b2438b6e 100755 --- a/filter/qa/complex/filter/misc/makefile.mk +++ b/filter/qa/complex/filter/misc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7.102.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index c1f61eb6948b..800876ce1abd 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basecontainer.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx index 66d2ba4873ff..e3730ce662e4 100644 --- a/filter/source/config/cache/basecontainer.hxx +++ b/filter/source/config/cache/basecontainer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basecontainer.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index c06bb3c53cc1..c752516df10f 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheitem.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index 3a24fcfa02ce..793a5f370cf9 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheitem.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index fe262661912c..90bd89c9d864 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheupdatelistener.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx index 8cec199718e9..8e75e4304bf2 100644 --- a/filter/source/config/cache/cacheupdatelistener.hxx +++ b/filter/source/config/cache/cacheupdatelistener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheupdatelistener.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index 6efc0912386f..e97df2a7f40d 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: configflush.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx index b8cc0f7ae07c..477d7017ca35 100644 --- a/filter/source/config/cache/configflush.hxx +++ b/filter/source/config/cache/configflush.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: configflush.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index 719cc620a579..827682e09cd9 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: constant.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index 32152a5d311d..3863658d9abb 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contenthandlerfactory.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/contenthandlerfactory.hxx b/filter/source/config/cache/contenthandlerfactory.hxx index 8b91f9892bf8..a50f91c0b61e 100644 --- a/filter/source/config/cache/contenthandlerfactory.hxx +++ b/filter/source/config/cache/contenthandlerfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contenthandlerfactory.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 61790685a14b..43886258abcd 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtercache.cxx,v $ - * $Revision: 1.26 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -2456,6 +2453,7 @@ OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , return lData; } +#if OSL_DEBUG_LEVEL > 0 /*-----------------------------------------------*/ ::rtl::OUString FilterCache::impl_searchFrameLoaderForType(const ::rtl::OUString& sType) const { @@ -2493,6 +2491,7 @@ OUStringList FilterCache::impl_tokenizeString(const ::rtl::OUString& sData , return ::rtl::OUString(); } +#endif /*-----------------------------------------------*/ sal_Bool FilterCache::impl_isModuleInstalled(const ::rtl::OUString& sModule) diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index 90973c13a31b..0c0e34b2783b 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtercache.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1022,9 +1019,11 @@ class FilterCache : public BaseLock //--------------------------------------- +#if OSL_DEBUG_LEVEL > 0 /** TODO */ ::rtl::OUString impl_searchFrameLoaderForType(const ::rtl::OUString& sType) const; ::rtl::OUString impl_searchContentHandlerForType(const ::rtl::OUString& sType) const; +#endif //--------------------------------------- /** @short check if the specified OOo module is installed. diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 9d98a8078b04..dc7869be27ca 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filterfactory.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx index 5f553f8b40d7..2f0ba31f942b 100644 --- a/filter/source/config/cache/filterfactory.hxx +++ b/filter/source/config/cache/filterfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filterfactory.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index f178264da65b..3c9163899a97 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frameloaderfactory.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/frameloaderfactory.hxx b/filter/source/config/cache/frameloaderfactory.hxx index e5ef80bfceaa..7741f0011f38 100644 --- a/filter/source/config/cache/frameloaderfactory.hxx +++ b/filter/source/config/cache/frameloaderfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frameloaderfactory.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx index c1999cb4a72e..feaf7f645efc 100644 --- a/filter/source/config/cache/lateinitlistener.cxx +++ b/filter/source/config/cache/lateinitlistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lateinitlistener.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/lateinitlistener.hxx b/filter/source/config/cache/lateinitlistener.hxx index 889f6146ca6a..0ed1abf1e679 100644 --- a/filter/source/config/cache/lateinitlistener.hxx +++ b/filter/source/config/cache/lateinitlistener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lateinitlistener.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/lateinitthread.cxx b/filter/source/config/cache/lateinitthread.cxx index e7bee1882487..13432c30ad0f 100644 --- a/filter/source/config/cache/lateinitthread.cxx +++ b/filter/source/config/cache/lateinitthread.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lateinitthread.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/lateinitthread.hxx b/filter/source/config/cache/lateinitthread.hxx index 43f4f18d5c9f..c330394d434d 100644 --- a/filter/source/config/cache/lateinitthread.hxx +++ b/filter/source/config/cache/lateinitthread.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lateinitthread.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/macros.hxx b/filter/source/config/cache/macros.hxx index d78969b0fbde..485029ead5a8 100644 --- a/filter/source/config/cache/macros.hxx +++ b/filter/source/config/cache/macros.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: macros.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/makefile.mk b/filter/source/config/cache/makefile.mk index 50ef0c73a03a..62eb4353fcf3 100644 --- a/filter/source/config/cache/makefile.mk +++ b/filter/source/config/cache/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx index dfbad37ba3a0..a07a95e37d23 100644 --- a/filter/source/config/cache/querytokenizer.cxx +++ b/filter/source/config/cache/querytokenizer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: querytokenizer.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx index 01c8d9a2657d..0823e49f5616 100644 --- a/filter/source/config/cache/querytokenizer.hxx +++ b/filter/source/config/cache/querytokenizer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: querytokenizer.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx index 31aa67abfc4a..a65f5c42fea8 100644 --- a/filter/source/config/cache/registration.cxx +++ b/filter/source/config/cache/registration.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registration.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/registration.hxx b/filter/source/config/cache/registration.hxx index 9a925727fa5d..38e5980c967a 100644 --- a/filter/source/config/cache/registration.hxx +++ b/filter/source/config/cache/registration.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: registration.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 0f094634766c..4fe9a1df64e6 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: typedetection.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx index 381f3cf4802a..4dbf6f07d33e 100644 --- a/filter/source/config/cache/typedetection.hxx +++ b/filter/source/config/cache/typedetection.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: typedetection.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/cache/versions.hxx b/filter/source/config/cache/versions.hxx index fcf6fd079ed0..fbd92604170f 100644 --- a/filter/source/config/cache/versions.hxx +++ b/filter/source/config/cache/versions.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: versions.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu index f691055e00cf..01d88c818c09 100644 --- a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu +++ b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu @@ -1,6 +1,6 @@ <node oor:name="HTML (StarCalc)" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop> - <prop oor:name="UIComponent"/> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN USEOPTIONS</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop> <prop oor:name="FilterService"/> <prop oor:name="UserData"><value></value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> diff --git a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu index 1a3aa01e5717..8808adc140a1 100644 --- a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu +++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu @@ -1,6 +1,6 @@ <node oor:name="calc_HTML_WebQuery" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> - <prop oor:name="UIComponent"/> + <prop oor:name="Flags"><value>IMPORT ALIEN USEOPTIONS</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.comp.Calc.FilterOptionsDialog</value></prop> <prop oor:name="FilterService"/> <prop oor:name="UserData"><value></value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> diff --git a/filter/source/config/fragments/filters/makefile.mk b/filter/source/config/fragments/filters/makefile.mk index e3696c0d9d24..2c557906df29 100644 --- a/filter/source/config/fragments/filters/makefile.mk +++ b/filter/source/config/fragments/filters/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/fragments/makefile.mk b/filter/source/config/fragments/makefile.mk index 6503062bc654..71bd6ca2b6e6 100644 --- a/filter/source/config/fragments/makefile.mk +++ b/filter/source/config/fragments/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.22 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/fragments/packagedef.mk b/filter/source/config/fragments/packagedef.mk index 75600489d4da..fda7b4a6cc60 100644 --- a/filter/source/config/fragments/packagedef.mk +++ b/filter/source/config/fragments/packagedef.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: packagedef.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/fragments/types/makefile.mk b/filter/source/config/fragments/types/makefile.mk index 371a777537b8..67ad14b038a2 100644 --- a/filter/source/config/fragments/types/makefile.mk +++ b/filter/source/config/fragments/types/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu index dba3845285d7..2888c0f0ba46 100644 --- a/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu +++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>pcd</value></prop> - <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>> + <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base</value></prop> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu index bb0a97823c32..e7bcee7e4c4c 100644 --- a/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu +++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base16.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>pcd</value></prop> - <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>> + <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base16</value></prop> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu b/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu index 72ca4d282717..966a77a47c73 100644 --- a/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu +++ b/filter/source/config/fragments/types/pcd_Photo_CD_Base4.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>pcd</value></prop> - <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop>> + <prop oor:name="MediaType"><value>image/x-photo-cd</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>draw_PCD_Photo_CD_Base4</value></prop> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/types/svm_StarView_Metafile.xcu b/filter/source/config/fragments/types/svm_StarView_Metafile.xcu index ac5e04e18a55..d7e52dbbb11a 100644 --- a/filter/source/config/fragments/types/svm_StarView_Metafile.xcu +++ b/filter/source/config/fragments/types/svm_StarView_Metafile.xcu @@ -2,7 +2,7 @@ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>svm</value></prop> - <prop oor:name="MediaType"><value>image/x-svm</value></prop>> + <prop oor:name="MediaType"><value>image/x-svm</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>SVM - StarView Metafile</value></prop> <prop oor:name="UIName"> diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge index 17fe16fb3445..faf9b9c34cb7 100755 --- a/filter/source/config/tools/merge/pyAltFCFGMerge +++ b/filter/source/config/tools/merge/pyAltFCFGMerge @@ -438,7 +438,6 @@ def generateHeader(sVersion, sEncoding, sPath, sPackage, bLanguagePack): sHeader += " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"" sHeader += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" else: - sHeader += "<!DOCTYPE oor:component-data SYSTEM \"../../../../component-update.dtd\">\n" sHeader += "<oor:component-data xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" oor:package=\"" sHeader += sPath sHeader += "\" oor:name=\"" diff --git a/filter/source/config/tools/split/FCFGSplit.java b/filter/source/config/tools/split/FCFGSplit.java index 464abf09a92c..4693db4cdf83 100644 --- a/filter/source/config/tools/split/FCFGSplit.java +++ b/filter/source/config/tools/split/FCFGSplit.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FCFGSplit.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/tools/split/Splitter.java b/filter/source/config/tools/split/Splitter.java index 36cf826fc3e1..d9c171382596 100644 --- a/filter/source/config/tools/split/Splitter.java +++ b/filter/source/config/tools/split/Splitter.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: Splitter.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/tools/split/SplitterData.java b/filter/source/config/tools/split/SplitterData.java index 4d899d2477a4..daa09797da68 100644 --- a/filter/source/config/tools/split/SplitterData.java +++ b/filter/source/config/tools/split/SplitterData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SplitterData.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/config/tools/split/makefile.mk b/filter/source/config/tools/split/makefile.mk index 7666515e91e0..a6942bfa6d5f 100644 --- a/filter/source/config/tools/split/makefile.mk +++ b/filter/source/config/tools/split/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7.102.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/docbook/docbooktosoffheadings.xsl b/filter/source/docbook/docbooktosoffheadings.xsl index d8d7feb4768c..0b583a9d1452 100644 --- a/filter/source/docbook/docbooktosoffheadings.xsl +++ b/filter/source/docbook/docbooktosoffheadings.xsl @@ -2,14 +2,10 @@ <!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - Copyright 2008 by Sun Microsystems, Inc. + Copyright 2000, 2010 Oracle and/or its affiliates. OpenOffice.org - a multi-platform office productivity suite - $RCSfile: docbooktosoffheadings.xsl,v $ - - $Revision: 1.10 $ - This file is part of OpenOffice.org. OpenOffice.org is free software: you can redistribute it and/or modify @@ -26,7 +22,7 @@ version 3 along with OpenOffice.org. If not, see <http://www.openoffice.org/license.html> for a copy of the LGPLv3 License. - + --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" office:version="1.0"> <xsl:decimal-format name="staff" digit="D"/> diff --git a/filter/source/docbook/makefile.mk b/filter/source/docbook/makefile.mk index 319a6d97d951..b3b43d5cbd02 100644 --- a/filter/source/docbook/makefile.mk +++ b/filter/source/docbook/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/docbook/sofftodocbookheadings.xsl b/filter/source/docbook/sofftodocbookheadings.xsl index b91a7d3e3011..bc9b67a9a340 100644 --- a/filter/source/docbook/sofftodocbookheadings.xsl +++ b/filter/source/docbook/sofftodocbookheadings.xsl @@ -3,14 +3,10 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - Copyright 2008 by Sun Microsystems, Inc. + Copyright 2000, 2010 Oracle and/or its affiliates. OpenOffice.org - a multi-platform office productivity suite - $RCSfile: sofftodocbookheadings.xsl,v $ - - $Revision: 1.11 $ - This file is part of OpenOffice.org. OpenOffice.org is free software: you can redistribute it and/or modify @@ -27,7 +23,7 @@ version 3 along with OpenOffice.org. If not, see <http://www.openoffice.org/license.html> for a copy of the LGPLv3 License. - + --> <xsl:stylesheet version="1.0" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form config text style"> <xsl:output method="xml" indent="yes" omit-xml-declaration="no" version="1.0" encoding="UTF-8" doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN" doctype-system="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/> diff --git a/filter/source/filtertracer/filtertracer.cxx b/filter/source/filtertracer/filtertracer.cxx index b8f7de0b3096..328917c24036 100644 --- a/filter/source/filtertracer/filtertracer.cxx +++ b/filter/source/filtertracer/filtertracer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtertracer.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/filtertracer/filtertracer.hxx b/filter/source/filtertracer/filtertracer.hxx index 3ba5b4dbfda5..65e5677f2478 100644 --- a/filter/source/filtertracer/filtertracer.hxx +++ b/filter/source/filtertracer/filtertracer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtertracer.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/filtertracer/filtertraceruno.cxx b/filter/source/filtertracer/filtertraceruno.cxx index 1a4f51216004..f2254c8256f9 100644 --- a/filter/source/filtertracer/filtertraceruno.cxx +++ b/filter/source/filtertracer/filtertraceruno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtertraceruno.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/filtertracer/makefile.mk b/filter/source/filtertracer/makefile.mk index 6643171b5722..4a4c143c4a4a 100644 --- a/filter/source/filtertracer/makefile.mk +++ b/filter/source/filtertracer/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index 196b866f427e..0efde8182448 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impswfdialog.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/impswfdialog.hrc b/filter/source/flash/impswfdialog.hrc index 1fc0dff0a6f9..7683af33a4c4 100644 --- a/filter/source/flash/impswfdialog.hrc +++ b/filter/source/flash/impswfdialog.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impswfdialog.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/impswfdialog.hxx b/filter/source/flash/impswfdialog.hxx index bb857c18b906..2b32bb935863 100644 --- a/filter/source/flash/impswfdialog.hxx +++ b/filter/source/flash/impswfdialog.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impswfdialog.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/impswfdialog.src b/filter/source/flash/impswfdialog.src index 0be7fb594bae..3e38dde68441 100644 --- a/filter/source/flash/impswfdialog.src +++ b/filter/source/flash/impswfdialog.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impswfdialog.src,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/makefile.mk b/filter/source/flash/makefile.mk index d544921f40cd..171f7901cbaa 100644 --- a/filter/source/flash/makefile.mk +++ b/filter/source/flash/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.16 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index 5e036df696e6..20a541564445 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfdialog.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx index 88136001b94e..fd0ead0a58c2 100644 --- a/filter/source/flash/swfdialog.hxx +++ b/filter/source/flash/swfdialog.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfdialog.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfexporter.cxx b/filter/source/flash/swfexporter.cxx index e597f4a2fdf8..7157a9c85c06 100644 --- a/filter/source/flash/swfexporter.cxx +++ b/filter/source/flash/swfexporter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfexporter.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -94,13 +91,14 @@ PageInfo::~PageInfo() } } +#ifdef THEFUTURE // ----------------------------------------------------------------------------- void PageInfo::addShape( ShapeInfo* pShapeInfo ) { maShapesVector.push_back( pShapeInfo ); } - +#endif // ----------------------------------------------------------------------------- diff --git a/filter/source/flash/swfexporter.hxx b/filter/source/flash/swfexporter.hxx index f2be52a3133b..356eaa1954e1 100644 --- a/filter/source/flash/swfexporter.hxx +++ b/filter/source/flash/swfexporter.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfexporter.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -147,7 +144,9 @@ struct PageInfo PageInfo(); ~PageInfo(); +#ifdef THEFUTURE void addShape( ShapeInfo* pShapeInfo ); +#endif }; diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx index c13aef97a560..03d9d003c30d 100644 --- a/filter/source/flash/swffilter.cxx +++ b/filter/source/flash/swffilter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swffilter.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfuno.cxx b/filter/source/flash/swfuno.cxx index 9771c7daeb3c..d4a11ebb921b 100644 --- a/filter/source/flash/swfuno.cxx +++ b/filter/source/flash/swfuno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfuno.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 968c7b513ea5..dcb6ff76721d 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfwriter.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -264,6 +261,7 @@ void Writer::placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int endTag(); } +#ifdef THEFUTURE // ----------------------------------------------------------------------------- void Writer::moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y ) @@ -291,6 +289,7 @@ void Writer::moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y ) endTag(); } +#endif // ----------------------------------------------------------------------------- diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index e8c75b8095b6..b3a5621b54e2 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfwriter.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -321,8 +318,10 @@ public: /** inserts a place shape tag into the movie stream or the current sprite */ void placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y, sal_uInt16 nClipDepth = 0, const char* pName = NULL ); +#ifdef THEFUTURE /** inserts a move shape tag into the movie stream or the current sprite */ void moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y ); +#endif /** inserts a remove shape tag into the movie stream or the current sprite */ void removeShape( sal_uInt16 nDepth ); diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index ffe26c35699b..cce0314436f8 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfwriter1.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index 891439668c91..a2638b13e629 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: swfwriter2.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/filter/source/graphicfilter/egif/dlgegif.cxx b/filter/source/graphicfilter/egif/dlgegif.cxx new file mode 100644 index 000000000000..a9f1e60708b2 --- /dev/null +++ b/filter/source/graphicfilter/egif/dlgegif.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif +#include <tools/ref.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <vcl/msgbox.hxx> +#include "dlgegif.hxx" +#include "dlgegif.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEGIF::DlgExportEGIF( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_GIF, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ), + aCbxTranslucent ( this, ResId( CBX_TRANSLUCENT, *rPara.pResMgr ) ), + aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), + aGrpDraw ( this, ResId( GRP_DRAW, *rPara.pResMgr ) ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/GIF" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + String aInterlaceStr( ResId( KEY_INTER, *pMgr ) ); + String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) ); + // Config-Parameter lesen + sal_Bool bInterlaced = pConfigItem->ReadInt32( aInterlaceStr, 1 ) != 0; + sal_Bool bTranslucent = pConfigItem->ReadInt32( aTranslucentStr, 1 ) != 0; + + aCbxInterlaced.Check( bInterlaced ); + aCbxTranslucent.Check( bTranslucent ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEGIF, OK ) ); +} + +DlgExportEGIF::~DlgExportEGIF() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEGIF, OK, void *, EMPTYARG ) +{ + + // Config-Parameter schreiben + String aInterlaceStr( ResId( KEY_INTER, *pMgr ) ); + String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) ); + + sal_Int32 nValue = 0; + if ( aCbxInterlaced.IsChecked() ) + nValue++; + pConfigItem->WriteInt32( aInterlaceStr, nValue ); + + nValue = 0; + if ( aCbxTranslucent.IsChecked() ) + nValue++; + pConfigItem->WriteInt32( aTranslucentStr, nValue ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} + + + diff --git a/filter/source/graphicfilter/egif/dlgegif.hrc b/filter/source/graphicfilter/egif/dlgegif.hrc new file mode 100644 index 000000000000..a2f9f4feb488 --- /dev/null +++ b/filter/source/graphicfilter/egif/dlgegif.hrc @@ -0,0 +1,36 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define FI_DESCR 1 +#define GRP_MODE 1 +#define GRP_DRAW 2 +#define CBX_INTERLACED 1 +#define CBX_TRANSLUCENT 2 diff --git a/filter/source/graphicfilter/egif/dlgegif.hxx b/filter/source/graphicfilter/egif/dlgegif.hxx new file mode 100644 index 000000000000..0dbe48a065a3 --- /dev/null +++ b/filter/source/graphicfilter/egif/dlgegif.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEGIF_HXX_ +#define _DLGEGIF_HXX_ + +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEGIF : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + CheckBox aCbxInterlaced; + CheckBox aCbxTranslucent; + FixedLine aGrpMode; + FixedLine aGrpDraw; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + +public: + DlgExportEGIF( FltCallDialogParameter& rPara ); + ~DlgExportEGIF(); +}; + +#endif // _DLGEGIF_HXX_ + diff --git a/filter/source/graphicfilter/egif/dlgegif.src b/filter/source/graphicfilter/egif/dlgegif.src new file mode 100644 index 000000000000..39f96bb7ac7a --- /dev/null +++ b/filter/source/graphicfilter/egif/dlgegif.src @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgegif.hrc" +ModalDialog DLG_EXPORT_GIF +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 169 , 70 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "GIF Options" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 113 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 113 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 113 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine GRP_MODE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; + CheckBox CBX_INTERLACED + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 86 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Interlaced" ; + }; + FixedLine GRP_DRAW + { + Pos = MAP_APPFONT ( 6 , 32 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Drawing objects" ; + }; + CheckBox CBX_TRANSLUCENT + { + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 86 , 12 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Save ~transparency" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx new file mode 100644 index 000000000000..93f9f5ec0b15 --- /dev/null +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -0,0 +1,629 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/graph.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/window.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "giflzwc.hxx" +#include "strings.hrc" +#include "dlgegif.hrc" +#include "dlgegif.hxx" + +// ------------- +// - GIFWriter - +// ------------- + +class GIFWriter +{ + Bitmap aAccBmp; + BitmapReadAccess* pAcc; + SvStream* pGIF; + ULONG nMinPercent; + ULONG nMaxPercent; + ULONG nLastPercent; + long nActX; + long nActY; + sal_Int32 nInterlaced; + BOOL bStatus; + BOOL bTransparent; + + void MayCallback( ULONG nPercent ); + void WriteSignature( BOOL bGIF89a ); + void WriteGlobalHeader( const Size& rSize ); + void WriteLoopExtension( const Animation& rAnimation ); + void WriteLogSizeExtension( const Size& rSize100 ); + void WriteImageExtension( long nTimer, Disposal eDisposal ); + void WriteLocalHeader(); + void WritePalette(); + void WriteAccess(); + void WriteTerminator(); + + BOOL CreateAccess( const BitmapEx& rBmpEx ); + void DestroyAccess(); + + void WriteAnimation( const Animation& rAnimation ); + void WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, BOOL bExtended, + long nTimer = 0, Disposal eDisposal = DISPOSE_NOT ); + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + +public: + + GIFWriter() {} + ~GIFWriter() {} + + BOOL WriteGIF( const Graphic& rGraphic, SvStream& rGIF, + FilterConfigItem* pConfigItem ); +}; + +// ------------------------------------------------------------------------ + +BOOL GIFWriter::WriteGIF( const Graphic& rGraphic, SvStream& rGIF, + FilterConfigItem* pFilterConfigItem ) +{ + if ( pFilterConfigItem ) + { + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + Size aSize100; + const MapMode aMap( rGraphic.GetPrefMapMode() ); + BOOL bLogSize = ( aMap.GetMapUnit() != MAP_PIXEL ); + + if( bLogSize ) + aSize100 = Application::GetDefaultDevice()->LogicToLogic( rGraphic.GetPrefSize(), aMap, MAP_100TH_MM ); + + pGIF = &rGIF; + bStatus = TRUE; + nLastPercent = 0; + nInterlaced = 0; + pAcc = NULL; + + if ( pFilterConfigItem ) + nInterlaced = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ); + + pGIF->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); + + if( rGraphic.IsAnimated() ) + { + const Animation& rAnimation = rGraphic.GetAnimation(); + + WriteSignature( TRUE ); + + if ( bStatus ) + { + WriteGlobalHeader( rAnimation.GetDisplaySizePixel() ); + + if( bStatus ) + { + WriteLoopExtension( rAnimation ); + + if( bStatus ) + WriteAnimation( rAnimation ); + } + } + } + else + { + const BOOL bGrafTrans = rGraphic.IsTransparent(); + + BitmapEx aBmpEx; + + if( bGrafTrans ) + aBmpEx = rGraphic.GetBitmapEx(); + else + aBmpEx = BitmapEx( rGraphic.GetBitmap() ); + + nMinPercent = 0; + nMaxPercent = 100; + + WriteSignature( bGrafTrans || bLogSize ); + + if( bStatus ) + { + WriteGlobalHeader( aBmpEx.GetSizePixel() ); + + if( bStatus ) + WriteBitmapEx( aBmpEx, Point(), bGrafTrans ); + } + } + + if( bStatus ) + { + if( bLogSize ) + WriteLogSizeExtension( aSize100 ); + + WriteTerminator(); + } + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return bStatus; +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, + BOOL bExtended, long nTimer, Disposal eDisposal ) +{ + if( CreateAccess( rBmpEx ) ) + { + nActX = rPoint.X(); + nActY = rPoint.Y(); + + if( bExtended ) + WriteImageExtension( nTimer, eDisposal ); + + if( bStatus ) + { + WriteLocalHeader(); + + if( bStatus ) + { + WritePalette(); + + if( bStatus ) + WriteAccess(); + } + } + + DestroyAccess(); + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteAnimation( const Animation& rAnimation ) +{ + const USHORT nCount = rAnimation.Count(); + + if( nCount ) + { + const double fStep = 100. / nCount; + + nMinPercent = 0L; + nMaxPercent = (ULONG) fStep; + + for( USHORT i = 0; i < nCount; i++ ) + { + const AnimationBitmap& rAnimBmp = rAnimation.Get( i ); + + WriteBitmapEx( rAnimBmp.aBmpEx, rAnimBmp.aPosPix, TRUE, + rAnimBmp.nWait, rAnimBmp.eDisposal ); + nMinPercent = nMaxPercent; + nMaxPercent = (ULONG) ( nMaxPercent + fStep ); + } + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::MayCallback( ULONG nPercent ) +{ + if ( xStatusIndicator.is() ) + { + if( nPercent >= nLastPercent + 3 ) + { + nLastPercent = nPercent; + if ( nPercent <= 100 ) + xStatusIndicator->setValue( nPercent ); + } + } +} + +// ------------------------------------------------------------------------ + +BOOL GIFWriter::CreateAccess( const BitmapEx& rBmpEx ) +{ + if( bStatus ) + { + Bitmap aMask( rBmpEx.GetMask() ); + + aAccBmp = rBmpEx.GetBitmap(); + bTransparent = FALSE; + + if( !!aMask ) + { + if( aAccBmp.Convert( BMP_CONVERSION_8BIT_TRANS ) ) + { + aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); + aAccBmp.Replace( aMask, BMP_COL_TRANS ); + bTransparent = TRUE; + } + else + aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS ); + } + else + aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS ); + + pAcc = aAccBmp.AcquireReadAccess(); + + if( !pAcc ) + bStatus = FALSE; + } + + return bStatus; +} + +// ------------------------------------------------------------------------ + +void GIFWriter::DestroyAccess() +{ + aAccBmp.ReleaseAccess( pAcc ); + pAcc = NULL; +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteSignature( BOOL bGIF89a ) +{ + if( bStatus ) + { + pGIF->Write( bGIF89a ? "GIF89a" : "GIF87a" , 6 ); + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteGlobalHeader( const Size& rSize ) +{ + if( bStatus ) + { + // 256 Farben + const UINT16 nWidth = (UINT16) rSize.Width(); + const UINT16 nHeight = (UINT16) rSize.Height(); + const BYTE cFlags = 128 | ( 7 << 4 ); + + // Werte rausschreiben + *pGIF << nWidth; + *pGIF << nHeight; + *pGIF << cFlags; + *pGIF << (BYTE) 0x00; + *pGIF << (BYTE) 0x00; + + // Dummy-Palette mit zwei Eintraegen (Schwarz/Weiss) schreiben; + // dieses nur wegen Photoshop-Bug, da die keine Bilder ohne + // globale Farbpalette lesen koennen + *pGIF << (UINT16) 0; + *pGIF << (UINT16) 255; + *pGIF << (UINT16) 65535; + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) +{ + DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" ); + + USHORT nLoopCount = (USHORT) rAnimation.GetLoopCount(); + + // falls nur ein Durchlauf stattfinden soll, + // wird keine LoopExtension geschrieben; + // Default ist dann immer ein Durchlauf + if( nLoopCount != 1 ) + { + // Netscape interpretiert den LoopCount + // als reine Anzahl der _Wiederholungen_ + if( nLoopCount ) + nLoopCount--; + + const BYTE cLoByte = (const BYTE) nLoopCount; + const BYTE cHiByte = (const BYTE) ( nLoopCount >> 8 ); + + *pGIF << (BYTE) 0x21; + *pGIF << (BYTE) 0xff; + *pGIF << (BYTE) 0x0b; + pGIF->Write( "NETSCAPE2.0", 11 ); + *pGIF << (BYTE) 0x03; + *pGIF << (BYTE) 0x01; + *pGIF << cLoByte; + *pGIF << cHiByte; + *pGIF << (BYTE) 0x00; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteLogSizeExtension( const Size& rSize100 ) +{ + // PrefSize in 100th-mm als ApplicationExtension schreiben + if( rSize100.Width() && rSize100.Height() ) + { + *pGIF << (BYTE) 0x21; + *pGIF << (BYTE) 0xff; + *pGIF << (BYTE) 0x0b; + pGIF->Write( "STARDIV 5.0", 11 ); + *pGIF << (BYTE) 0x09; + *pGIF << (BYTE) 0x01; + *pGIF << (UINT32) rSize100.Width(); + *pGIF << (UINT32) rSize100.Height(); + *pGIF << (BYTE) 0x00; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal ) +{ + if( bStatus ) + { + const UINT16 nDelay = (UINT16) nTimer; + BYTE cFlags = 0; + + // Transparent-Flag setzen + if( bTransparent ) + cFlags |= 1; + + // Disposal-Wert setzen + if( eDisposal == DISPOSE_BACK ) + cFlags |= ( 2 << 2 ); + else if( eDisposal == DISPOSE_PREVIOUS ) + cFlags |= ( 3 << 2 ); + + *pGIF << (BYTE) 0x21; + *pGIF << (BYTE) 0xf9; + *pGIF << (BYTE) 0x04; + *pGIF << cFlags; + *pGIF << nDelay; + *pGIF << (BYTE) pAcc->GetBestPaletteIndex( BMP_COL_TRANS ); + *pGIF << (BYTE) 0x00; + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteLocalHeader() +{ + if( bStatus ) + { + const UINT16 nPosX = (UINT16) nActX; + const UINT16 nPosY = (UINT16) nActY; + const UINT16 nWidth = (UINT16) pAcc->Width(); + const UINT16 nHeight = (UINT16) pAcc->Height(); + BYTE cFlags = (BYTE) ( pAcc->GetBitCount() - 1 ); + + // Interlaced-Flag setzen + if( nInterlaced ) + cFlags |= 0x40; + + // Flag fuer lokale Farbpalette setzen + cFlags |= 0x80; + + // alles rausschreiben + *pGIF << (BYTE) 0x2c; + *pGIF << nPosX; + *pGIF << nPosY; + *pGIF << nWidth; + *pGIF << nHeight; + *pGIF << cFlags; + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WritePalette() +{ + if( bStatus && pAcc->HasPalette() ) + { + const USHORT nCount = pAcc->GetPaletteEntryCount(); + const USHORT nMaxCount = ( 1 << pAcc->GetBitCount() ); + + for ( USHORT i = 0; i < nCount; i++ ) + { + const BitmapColor& rColor = pAcc->GetPaletteColor( i ); + + *pGIF << rColor.GetRed(); + *pGIF << rColor.GetGreen(); + *pGIF << rColor.GetBlue(); + } + + // Rest mit 0 auffuellen + if( nCount < nMaxCount ) + pGIF->SeekRel( ( nMaxCount - nCount ) * 3 ); + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteAccess() +{ + GIFLZWCompressor aCompressor; + const long nWidth = pAcc->Width(); + const long nHeight = pAcc->Height(); + BYTE* pBuffer = NULL; + const ULONG nFormat = pAcc->GetScanlineFormat(); + long nY; + long nT; + long i; + BOOL bNative = ( BMP_FORMAT_8BIT_PAL == nFormat ); + + if( !bNative ) + pBuffer = new BYTE[ nWidth ]; + + if( bStatus && ( 8 == pAcc->GetBitCount() ) && pAcc->HasPalette() ) + { + aCompressor.StartCompression( *pGIF, pAcc->GetBitCount() ); + + for( i = 0; i < nHeight; i++ ) + { + if( nInterlaced ) + { + nY = i << 3; + + if( nY >= nHeight ) + { + nT = i - ( ( nHeight + 7 ) >> 3 ); + nY= ( nT << 3 ) + 4; + + if( nY >= nHeight ) + { + nT -= ( nHeight + 3 ) >> 3; + nY = ( nT << 2 ) + 2; + + if ( nY >= nHeight ) + { + nT -= ( ( nHeight + 1 ) >> 2 ); + nY = ( nT << 1 ) + 1; + } + } + } + } + else + nY = i; + + if( bNative ) + aCompressor.Compress( pAcc->GetScanline( nY ), nWidth ); + else + { + for( long nX = 0L; nX < nWidth; nX++ ) + pBuffer[ nX ] = (BYTE) pAcc->GetPixel( nY, nX ); + + aCompressor.Compress( pBuffer, nWidth ); + } + + if ( pGIF->GetError() ) + bStatus = FALSE; + + MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * i / nHeight ); + + if( !bStatus ) + break; + } + + aCompressor.EndCompression(); + + if ( pGIF->GetError() ) + bStatus = FALSE; + } + + delete[] pBuffer; +} + +// ------------------------------------------------------------------------ + +void GIFWriter::WriteTerminator() +{ + if( bStatus ) + { + *pGIF << (BYTE) 0x3b; + + if( pGIF->GetError() ) + bStatus = FALSE; + } +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, + FilterConfigItem* pConfigItem, BOOL ) +{ + return GIFWriter().WriteGIF( rGraphic, rStream, pConfigItem ); +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "egi" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEGIF( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +// ------------------------------------------------------------------------ +#ifndef GCC +#endif + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +// ------------------------------------------------------------------------ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/filter/source/graphicfilter/egif/egifstr.src b/filter/source/graphicfilter/egif/egifstr.src new file mode 100644 index 000000000000..ea258019d543 --- /dev/null +++ b/filter/source/graphicfilter/egif/egifstr.src @@ -0,0 +1,39 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "strings.hrc" + +// Key fuer den Dialog +String KEY_INTER +{ + Text = "Interlaced"; +}; +String KEY_TRANS +{ + Text = "Translucent"; +}; diff --git a/filter/source/graphicfilter/egif/exports.map b/filter/source/graphicfilter/egif/exports.map new file mode 100644 index 000000000000..10820132c0ce --- /dev/null +++ b/filter/source/graphicfilter/egif/exports.map @@ -0,0 +1,8 @@ +GIFEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx new file mode 100644 index 000000000000..5438aa46017b --- /dev/null +++ b/filter/source/graphicfilter/egif/giflzwc.cxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <tools/stream.hxx> +#include "giflzwc.hxx" + +// ---------------------------- +// - GIFImageDataOutputStream - +// ---------------------------- + +class GIFImageDataOutputStream +{ +private: + + void FlushBlockBuf(); + inline void FlushBitsBufsFullBytes(); + + SvStream& rStream; + BYTE* pBlockBuf; + BYTE nBlockBufSize; + ULONG nBitsBuf; + USHORT nBitsBufSize; + +public: + + GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize ); + ~GIFImageDataOutputStream(); + + inline void WriteBits( USHORT nCode, USHORT nCodeLen ); +}; + +// ------------------------------------------------------------------------ + +inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes() +{ + while (nBitsBufSize>=8) + { + if( nBlockBufSize==255 ) + FlushBlockBuf(); + + pBlockBuf[nBlockBufSize++] = (BYTE) nBitsBuf; + nBitsBuf >>= 8; + nBitsBufSize -= 8; + } +} + +// ------------------------------------------------------------------------ + +inline void GIFImageDataOutputStream::WriteBits( USHORT nCode, USHORT nCodeLen ) +{ + if( nBitsBufSize+nCodeLen>32 ) + FlushBitsBufsFullBytes(); + + nBitsBuf |= (ULONG) nCode << nBitsBufSize; + nBitsBufSize = nBitsBufSize + nCodeLen; +} + +// ------------------------------------------------------------------------ + +GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize ) : + rStream(rGIF) +{ + pBlockBuf = new BYTE[ 255 ]; + nBlockBufSize = 0; + nBitsBufSize = 0; + nBitsBuf = 0; + rStream << nLZWDataSize; +} + +// ------------------------------------------------------------------------ + + +GIFImageDataOutputStream::~GIFImageDataOutputStream() +{ + WriteBits(0,7); + FlushBitsBufsFullBytes(); + FlushBlockBuf(); + rStream << (BYTE)0; + delete[] pBlockBuf; +} + +// ------------------------------------------------------------------------ + +void GIFImageDataOutputStream::FlushBlockBuf() +{ + if( nBlockBufSize ) + { + rStream << (BYTE) nBlockBufSize; + rStream.Write( pBlockBuf,nBlockBufSize ); + nBlockBufSize = 0; + } +} + +// ------------------- +// - GIFLZWCTreeNode - +// ------------------- + +struct GIFLZWCTreeNode +{ + + GIFLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat + GIFLZWCTreeNode* pFirstChild; // erster Sohn + USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn + USHORT nValue; // Der Pixelwert +}; + +// -------------------- +// - GIFLZWCompressor - +// -------------------- + +GIFLZWCompressor::GIFLZWCompressor() +{ + pIDOS=NULL; +} + +// ------------------------------------------------------------------------ + +GIFLZWCompressor::~GIFLZWCompressor() +{ + if (pIDOS!=NULL) EndCompression(); +} + +// ------------------------------------------------------------------------ + +void GIFLZWCompressor::StartCompression( SvStream& rGIF, USHORT nPixelSize ) +{ + if( !pIDOS ) + { + USHORT i; + + nDataSize = nPixelSize; + + if( nDataSize < 2 ) + nDataSize=2; + + nClearCode=1<<nDataSize; + nEOICode=nClearCode+1; + nTableSize=nEOICode+1; + nCodeSize=nDataSize+1; + + pIDOS=new GIFImageDataOutputStream(rGIF,(BYTE)nDataSize); + pTable=new GIFLZWCTreeNode[4096]; + + for (i=0; i<4096; i++) + { + pTable[i].pBrother = pTable[i].pFirstChild = NULL; + pTable[i].nValue = (BYTE) ( pTable[i].nCode = i ); + } + + pPrefix = NULL; + pIDOS->WriteBits( nClearCode,nCodeSize ); + } +} + +// ------------------------------------------------------------------------ + +void GIFLZWCompressor::Compress( HPBYTE pSrc, ULONG nSize ) +{ + if( pIDOS ) + { + GIFLZWCTreeNode* p; + USHORT i; + BYTE nV; + + if( !pPrefix && nSize ) + { + pPrefix=pTable+(*pSrc++); + nSize--; + } + + while( nSize ) + { + nSize--; + nV=*pSrc++; + for( p=pPrefix->pFirstChild; p!=NULL; p=p->pBrother ) + { + if (p->nValue==nV) + break; + } + + if( p) + pPrefix=p; + else + { + pIDOS->WriteBits(pPrefix->nCode,nCodeSize); + + if (nTableSize==4096) + { + pIDOS->WriteBits(nClearCode,nCodeSize); + + for (i=0; i<nClearCode; i++) + pTable[i].pFirstChild=NULL; + + nCodeSize=nDataSize+1; + nTableSize=nEOICode+1; + } + else + { + if(nTableSize==(USHORT)(1<<nCodeSize)) + nCodeSize++; + + p=pTable+(nTableSize++); + p->pBrother=pPrefix->pFirstChild; + pPrefix->pFirstChild=p; + p->nValue=nV; + p->pFirstChild=NULL; + } + + pPrefix=pTable+nV; + } + } + } +} + +// ------------------------------------------------------------------------ + +void GIFLZWCompressor::EndCompression() +{ + if( pIDOS ) + { + if( pPrefix ) + pIDOS->WriteBits(pPrefix->nCode,nCodeSize); + + pIDOS->WriteBits( nEOICode,nCodeSize ); + delete[] pTable; + delete pIDOS; + pIDOS=NULL; + } +} diff --git a/filter/source/graphicfilter/egif/giflzwc.hxx b/filter/source/graphicfilter/egif/giflzwc.hxx new file mode 100644 index 000000000000..75048b0f8ff5 --- /dev/null +++ b/filter/source/graphicfilter/egif/giflzwc.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GIFLZWC_HXX +#define _GIFLZWC_HXX + +#ifndef _BMPACC_HXX +#include <vcl/bmpacc.hxx> +#endif + +// -------------------- +// - GIFLZWCompressor - +// -------------------- + +class GIFImageDataOutputStream; +struct GIFLZWCTreeNode; + +class GIFLZWCompressor +{ +private: + + GIFImageDataOutputStream* pIDOS; + GIFLZWCTreeNode* pTable; + GIFLZWCTreeNode* pPrefix; + USHORT nDataSize; + USHORT nClearCode; + USHORT nEOICode; + USHORT nTableSize; + USHORT nCodeSize; + +public: + + GIFLZWCompressor(); + ~GIFLZWCompressor(); + + void StartCompression( SvStream& rGIF, USHORT nPixelSize ); + void Compress( HPBYTE pSrc, ULONG nSize ); + void EndCompression(); +}; + +#endif // _GIFLZWC_HXX diff --git a/filter/source/graphicfilter/egif/makefile.mk b/filter/source/graphicfilter/egif/makefile.mk new file mode 100644 index 000000000000..27dae4906046 --- /dev/null +++ b/filter/source/graphicfilter/egif/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=egif +TARGET2=egi +DEPTARGET=vegif + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES = dlgegif.src \ + egifstr.src +.IF "$(L10N_framework)"=="" +SLOFILES= $(SLO)$/egif.obj \ + $(SLO)$/dlgegif.obj \ + $(SLO)$/giflzwc.obj +.ENDIF + +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs + +.IF "$(L10N_framework)"=="" +SHL1TARGET= egi$(DLLPOSTFIX) +SHL1IMPLIB= egif +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) + +SHL1LIBS= $(SLB)$/egif.lib + +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/egif.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/egif/strings.hrc b/filter/source/graphicfilter/egif/strings.hrc new file mode 100644 index 000000000000..1566c0dfee81 --- /dev/null +++ b/filter/source/graphicfilter/egif/strings.hrc @@ -0,0 +1,28 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_INTER 256 +#define KEY_TRANS 257 diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.cxx b/filter/source/graphicfilter/eos2met/dlgeos2.cxx new file mode 100644 index 000000000000..4c5bf1b0a429 --- /dev/null +++ b/filter/source/graphicfilter/eos2met/dlgeos2.cxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif +#include <com/sun/star/awt/Size.hpp> +#include <vcl/msgbox.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "dlgeos2.hxx" +#include "dlgeos2.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEMET::DlgExportEMET( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EMET, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ), + aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ), + aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), + aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), + aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ), + aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), + aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ), + aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/MET" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEMET, OK ) ); + aRbOriginal.SetClickHdl( LINK( this, DlgExportEMET, ClickRbOriginal ) ); + aRbSize.SetClickHdl( LINK( this, DlgExportEMET, ClickRbSize ) ); + + // Config-Parameter lesen + sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); + ::com::sun::star::awt::Size aDefault( 10000, 10000 ); + ::com::sun::star::awt::Size aSize; + aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); + + aMtfSizeX.SetDefaultUnit( FUNIT_MM ); + aMtfSizeY.SetDefaultUnit( FUNIT_MM ); + + aMtfSizeX.SetValue( aSize.Width ); + aMtfSizeY.SetValue( aSize.Height ); + + switch ( rPara.eFieldUnit ) + { +// case FUNIT_NONE : +// case FUNIT_KM : +// case FUNIT_PERCENT : +// case FUNIT_CUSTOM : +// case FUNIT_MILE : +// case FUNIT_FOOT : +// case FUNIT_M : + case FUNIT_MM : + case FUNIT_CM : + case FUNIT_TWIP : + case FUNIT_POINT : + case FUNIT_PICA : + case FUNIT_INCH : + case FUNIT_100TH_MM : + { + aMtfSizeX.SetUnit( rPara.eFieldUnit ); + aMtfSizeY.SetUnit( rPara.eFieldUnit ); + } + break; + default: + break; // multiple other value not handled -Wall + } + if ( nMode == 1 ) + { + aRbSize.Check( TRUE ); + ClickRbSize( NULL ); + } + else + { + aRbOriginal.Check( TRUE ); + ClickRbOriginal( NULL ); + } +} + +DlgExportEMET::~DlgExportEMET() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEMET, OK, void *, EMPTYARG ) +{ + // Config-Parameter schreiben + ::com::sun::star::awt::Size aSize( + (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ), + (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) ); + sal_Int32 nStrMode = ( aRbSize.IsChecked() ) ? 1 : 0; + + pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode ); + pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} + +/************************************************************************* +|* +|* Enabled/Disabled Controls +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEMET, ClickRbOriginal, void*, EMPTYARG ) +{ + aGrpSize.Disable(); + aFtSizeX.Disable(); + aMtfSizeX.Disable(); + aFtSizeY.Disable(); + aMtfSizeY.Disable(); + + return 0; +} + + +/************************************************************************* +|* +|* Enabled/Disabled Controls +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEMET, ClickRbSize, void*, EMPTYARG ) +{ + aGrpSize.Enable(); + aFtSizeX.Enable(); + aMtfSizeX.Enable(); + aFtSizeY.Enable(); + aMtfSizeY.Enable(); + + return 0; +} + diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hrc b/filter/source/graphicfilter/eos2met/dlgeos2.hrc new file mode 100644 index 000000000000..5e4ec5b160fc --- /dev/null +++ b/filter/source/graphicfilter/eos2met/dlgeos2.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define CBX_SIZE 2 +#define MTF_SIZEX 1 +#define MTF_SIZEY 2 +#define FT_SIZEX 1 +#define FT_SIZEY 2 +#define GRP_SIZE 1 +#define GRP_MODE 2 +#define RB_ORIGINAL 1 +#define RB_SIZE 2 + diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hxx b/filter/source/graphicfilter/eos2met/dlgeos2.hxx new file mode 100644 index 000000000000..6387be453494 --- /dev/null +++ b/filter/source/graphicfilter/eos2met/dlgeos2.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEOS2_HXX_ +#define _DLGEOS2_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEMET : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + RadioButton aRbOriginal; + RadioButton aRbSize; + FixedLine aGrpMode; + + FixedText aFtSizeX; + MetricField aMtfSizeX; + FixedText aFtSizeY; + MetricField aMtfSizeY; + FixedLine aGrpSize; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void* p ); + DECL_LINK( ClickRbOriginal,void* p ); + DECL_LINK( ClickRbSize,void* p ); + +public: + DlgExportEMET( FltCallDialogParameter& rPara ); + ~DlgExportEMET(); +}; + + +#endif // _DLGEMET_HXX_ + diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.src b/filter/source/graphicfilter/eos2met/dlgeos2.src new file mode 100644 index 000000000000..6c9e474e25db --- /dev/null +++ b/filter/source/graphicfilter/eos2met/dlgeos2.src @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "dlgeos2.hrc" + +ModalDialog DLG_EXPORT_EMET +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 178 , 89 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "MET Options" ; + MetricField MTF_SIZEX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 55 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 100 ; + Maximum = 99999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 100 ; + Last = 99999 ; + SpinSize = 100 ; + }; + MetricField MTF_SIZEY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 71 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 100 ; + Maximum = 99999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 100 ; + Last = 99999 ; + SpinSize = 100 ; + }; + FixedLine GRP_SIZE + { + Pos = MAP_APPFONT ( 6 , 44 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_SIZEX + { + Pos = MAP_APPFONT ( 12 , 56 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "Width" ; + }; + FixedText FT_SIZEY + { + Pos = MAP_APPFONT ( 12 , 72 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text [ en-US ] = "Height" ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 122 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 122 , 24 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 122 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + RadioButton RB_ORIGINAL + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 98 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Original" ; + }; + RadioButton RB_SIZE + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 98 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Size" ; + }; + FixedLine GRP_MODE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx new file mode 100644 index 000000000000..5ef86b9c1b98 --- /dev/null +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -0,0 +1,2648 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <svtools/fltcall.hxx> + +#include <math.h> +#include <tools/stream.hxx> +#include <tools/bigint.hxx> +#include <vcl/metaact.hxx> +#include <vcl/salbtype.hxx> +#include <tools/poly.hxx> +#include <vcl/graph.hxx> +#include <vcl/gradient.hxx> +#include <vcl/hatch.hxx> +#include <vcl/metric.hxx> +#include <vcl/font.hxx> +#include <vcl/virdev.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> +#include <svl/solar.hrc> +#include "strings.hrc" +#include "dlgeos2.hxx" + +// -----------------------------Feld-Typen------------------------------- + +#define BegDocumnMagic 0xA8A8 /* Begin Document */ +#define EndDocumnMagic 0xA8A9 /* End Document */ + +#define BegResGrpMagic 0xC6A8 /* Begin Resource Group */ +#define EndResGrpMagic 0xC6A9 /* End Resource Group */ + +#define BegColAtrMagic 0x77A8 /* Begin Color Attribute Table */ +#define EndColAtrMagic 0x77A9 /* End Color Attribute Table */ +#define BlkColAtrMagic 0x77B0 /* Color Attribute Table */ +#define MapColAtrMagic 0x77AB /* Map Color Attribute Table */ + +#define BegImgObjMagic 0xFBA8 /* Begin Image Object */ +#define EndImgObjMagic 0xFBA9 /* End Image Object */ +#define DscImgObjMagic 0xFBA6 /* Image Data Descriptor */ +#define DatImgObjMagic 0xFBEE /* Image Picture Data */ + +#define BegObjEnvMagic 0xC7A8 /* Begin Object Environment Group */ +#define EndObjEnvMagic 0xC7A9 /* End Object Environment Group */ + +#define BegGrfObjMagic 0xBBA8 /* Begin Graphics Object */ +#define EndGrfObjMagic 0xBBA9 /* End Graphics Object */ +#define DscGrfObjMagic 0xBBA6 /* Graphics Data Descritor */ +#define DatGrfObjMagic 0xBBEE /* Graphics Data */ + +#define MapCodFntMagic 0x8AAB /* Map Coded Font */ +#define MapDatResMagic 0xC3AB /* Map Data Resource */ + +// Struktur des Metafiles +// BegDocumn +// BegResGrp +// BegColAtr +// BlkColAtr +// EndColAtr +// BegImgObj[0..n] +// BegResGrp[] +// BegColAtr[] +// BlkColAtr +// EndColAtr +// EndResGrp +// BegObjEnv[] +// MapColAtr +// EndObjEnv +// DscImgObj +// DatImgOb1 +// DatImgOb2[1..n] +// EndImgObj +// BegGrfObj +// BegObjEnv[] +// MapColAtr +// MapCodFnt1 +// MapCodFnt2[0..n] +// MapDatRes[0..n] +// EndObjEnv +// DscGrfObj +// DatGrfObj[0..n] +// EndGrfObj +// EndResGrp +// EndDocumn + +//============================== METWriter =================================== + +struct METChrSet +{ + struct METChrSet * pSucc; + BYTE nSet; + String aName; + FontWeight eWeight; +}; + +struct METGDIStackMember +{ + struct METGDIStackMember * pSucc; + Color aLineColor; + Color aFillColor; + RasterOp eRasterOp; + Font aFont; + MapMode aMapMode; + Rectangle aClipRect; +}; + +class METWriter +{ +private: + + BOOL bStatus; + ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde. + SvStream* pMET; + Rectangle aPictureRect; + MapMode aPictureMapMode; + MapMode aTargetMapMode; + ULONG nActualFieldStartPos; // Anfangs-Position des aktuellen 'Field' + ULONG nNumberOfDataFields; // Anzahl der angefangenen 'Graphcis Data Fields' + Color aGDILineColor; + Color aGDIFillColor; + RasterOp eGDIRasterOp; + Font aGDIFont; + MapMode aGDIMapMode; // derzeit unbenutzt! + Rectangle aGDIClipRect; // derzeit unbenutzt! + METGDIStackMember* pGDIStack; + Color aMETColor; + Color aMETBackgroundColor; + Color aMETPatternSymbol; + RasterOp eMETMix ; + long nMETStrokeLineWidth; + Size aMETChrCellSize; + short nMETChrAngle; + BYTE nMETChrSet; + METChrSet* pChrSetList; // Liste der Character-Sets + BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id + ULONG nActBitmapId; // Field-Id der naechsten Bitmap + ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile + ULONG nNumberOfBitmaps; // Anzahl der Bitmaps + ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders + ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps + ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist. + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + + void MayCallback(); + // Berechnet anhand der obigen 5 Parameter eine Prozentzahl + // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen + // moechte. + + void CountActionsAndBitmaps(const GDIMetaFile * pMTF); + // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen + // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist) + + void WriteBigEndianShort(USHORT nWord); + void WriteBigEndianLong(ULONG nLong); + + void WritePoint(Point aPt); + void WriteClipRect( const Rectangle& rRect ); + void WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType, + BYTE nFlags, USHORT nSegSeqNum); + void UpdateFieldSize(); + + void WriteFieldId(ULONG nId); + + void CreateChrSets(const GDIMetaFile * pMTF); + void CreateChrSet(const Font & rFont); + void WriteChrSets(); + BYTE FindChrSet(const Font & rFont); + + void WriteColorAttributeTable(ULONG nFieldId=4, BitmapPalette* pPalette=NULL, + BYTE nBasePartFlags=0x40, BYTE nBasePartLCTID=0); + + void WriteImageObject(const Bitmap & rBitmap); + void WriteImageObjects(const GDIMetaFile * pMTF); + + void WriteDataDescriptor(const GDIMetaFile * pMTF); + + void WillWriteOrder(ULONG nNextOrderMaximumLength); + + void METSetAndPushLineInfo( const LineInfo& rLineInfo ); + void METPopLineInfo( const LineInfo& rLineInfo ); + void METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap); + void METBeginArea(BOOL bBoundaryLine); + void METEndArea(); + void METBeginPath(sal_uInt32 nPathId); + void METEndPath(); + void METFillPath(sal_uInt32 nPathId); + void METOutlinePath(sal_uInt32 nPathId); + void METCloseFigure(); + void METMove(Point aPt); + void METLine(Point aPt1, Point aPt2); + void METLine(const Polygon & rPolygon); + void METLine(const PolyPolygon & rPolyPolygon); + void METLineAtCurPos(Point aPt); + void METBox(BOOL bFill, BOOL bBoundary, + Rectangle aRect, sal_uInt32 nHAxis, sal_uInt32 nVAxis); + void METFullArc(Point aCenter, double fMultiplier); + void METPartialArcAtCurPos(Point aCenter, double fMultiplier, + double fStartAngle, double fSweepAngle); + void METChrStr(Point aPt, String aStr); + void METSetArcParams(long nP, long nQ, long nR, long nS); + void METSetColor(Color aColor); + void METSetBackgroundColor(Color aColor); + void METSetMix(RasterOp eROP); + void METSetChrCellSize(Size aSize); + void METSetChrAngle(short nAngle); + void METSetChrSet(BYTE nSet); + + void WriteOrders(const GDIMetaFile * pMTF); + + void WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF); + + void WriteGraphicsObject(const GDIMetaFile * pMTF); + + void WriteResourceGroup(const GDIMetaFile * pMTF); + + void WriteDocument(const GDIMetaFile * pMTF); + +public: + + METWriter() {} + + BOOL WriteMET( const GDIMetaFile & rMTF, SvStream & rTargetStream, + FilterConfigItem* pConfigItem ); +}; + + +//========================== Methoden von METWriter ========================== + +void METWriter::MayCallback() +{ + if ( xStatusIndicator.is() ) + { + ULONG nPercent; + nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions) + *100/((nNumberOfBitmaps<<14)+nNumberOfActions); + + if (nPercent>=nLastPercent+3) + { + nLastPercent = nPercent; + if ( nPercent <= 100 ) + xStatusIndicator->setValue( nPercent ); + } + } +} + +void METWriter::WriteClipRect( const Rectangle& rRect ) +{ + aGDIClipRect = rRect; + sal_uInt32 nPathId = ( rRect.IsEmpty() ) ? 0 : 1; + if ( nPathId ) + { + Polygon aPoly( rRect ); + METBeginPath( nPathId ); + METLine( aPoly ); + METEndPath(); + } + WillWriteOrder(8); + *pMET << (BYTE)0xb4 << (BYTE)6 + << (BYTE)0x00 << (BYTE)0 << nPathId; +} + +void METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF) +{ + const MetaAction* pMA; + + for( ULONG nAction = 0, nActionCount=pMTF->GetActionCount(); nAction < nActionCount; nAction++ ) + { + pMA = pMTF->GetAction(nAction); + + switch (pMA->GetType()) + { + case META_EPS_ACTION : + { + const GDIMetaFile aGDIMetaFile( ((const MetaEPSAction*)pMA)->GetSubstitute() ); + INT32 nCount = aGDIMetaFile.GetActionCount(); + INT32 i; + for ( i = 0; i < nCount; i++ ) + if ( ((const MetaAction*)aGDIMetaFile.GetAction( i ))->GetType() == META_BMPSCALE_ACTION ) + break; + if ( i == nCount) + break; + } + case META_BMP_ACTION: + case META_BMPSCALE_ACTION: + case META_BMPSCALEPART_ACTION: + case META_BMPEX_ACTION: + case META_BMPEXSCALE_ACTION: + case META_BMPEXSCALEPART_ACTION: + nNumberOfBitmaps++; + break; + } + nNumberOfActions++; + } +} + + +void METWriter::WriteBigEndianShort(USHORT nWord) +{ + *pMET << ((BYTE)(nWord>>8)) << ((BYTE)(nWord&0x00ff)); +} + + +void METWriter::WriteBigEndianLong(ULONG nLong) +{ + WriteBigEndianShort((USHORT)(nLong>>16)); + WriteBigEndianShort((USHORT)(nLong&0x0000ffff)); +} + + +void METWriter::WritePoint(Point aPt) +{ + Point aNewPt = OutputDevice::LogicToLogic( aPt, aPictureMapMode, aTargetMapMode ); + + *pMET << (long) ( aNewPt.X() - aPictureRect.Left() ) + << (long) ( aPictureRect.Bottom() - aNewPt.Y() ); +} + + +void METWriter::WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType, + BYTE nFlags, USHORT nSegSeqNum) +{ + nActualFieldStartPos=pMET->Tell(); + WriteBigEndianShort(nFieldSize); + *pMET << (BYTE)0xd3 << nFieldType << nFlags << nSegSeqNum; +} + + +void METWriter::UpdateFieldSize() +{ + ULONG nPos; + + nPos=pMET->Tell(); + pMET->Seek(nActualFieldStartPos); + WriteBigEndianShort((USHORT)(nPos-nActualFieldStartPos)); + pMET->Seek(nPos); +} + + +void METWriter::WriteFieldId(ULONG nId) +{ + BYTE nbyte; + short i; + + for (i=1; i<=8; i++) { + nbyte= '0' + (BYTE)((nId >> (32-i*4)) & 0x0f); + *pMET << nbyte; + } +} + + +void METWriter::CreateChrSets(const GDIMetaFile * pMTF) +{ + ULONG nAction, nActionCount; + const MetaAction * pMA; + + if (bStatus==FALSE) + return; + + nActionCount=pMTF->GetActionCount(); + + for (nAction=0; nAction<nActionCount; nAction++) + { + pMA = pMTF->GetAction(nAction); + + switch (pMA->GetType()) + { + case META_FONT_ACTION: + { + const MetaFontAction* pA = (const MetaFontAction*) pMA; + CreateChrSet( pA->GetFont() ); + } + break; + } + } +} + + +void METWriter::CreateChrSet(const Font & rFont) +{ + METChrSet * pCS; + + if ( FindChrSet( rFont ) == 0 ) + { + pCS = new METChrSet; + pCS->pSucc = pChrSetList; pChrSetList=pCS; + pCS->nSet = nNextChrSetId++; + pCS->aName = rFont.GetName(); + pCS->eWeight = rFont.GetWeight(); + } +} + + +BYTE METWriter::FindChrSet(const Font & rFont) +{ + METChrSet* pCS; + + for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc) + { + if (pCS->aName==rFont.GetName() && pCS->eWeight==rFont.GetWeight() ) + return pCS->nSet; + } + + return 0; +} + + +void METWriter::WriteChrSets() +{ + USHORT i; + char c = 0; + METChrSet * pCS; + BYTE nbyte; + + for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc) + { + + WriteFieldIntroducer(0x58,MapCodFntMagic,0,0); + + WriteBigEndianShort(0x0050); + + *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00; + *pMET << (BYTE)0xa4 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x01; + *pMET << (BYTE)0x01 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + + *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)pCS->nSet; + + *pMET << (BYTE)0x14 << (BYTE)0x1f; + switch (pCS->eWeight) + { + case WEIGHT_THIN: nbyte=1; break; + case WEIGHT_ULTRALIGHT: nbyte=2; break; + case WEIGHT_LIGHT: nbyte=3; break; + case WEIGHT_SEMILIGHT: nbyte=4; break; + case WEIGHT_NORMAL: nbyte=5; break; + case WEIGHT_SEMIBOLD: nbyte=6; break; + case WEIGHT_BOLD: nbyte=7; break; + case WEIGHT_ULTRABOLD: nbyte=8; break; + case WEIGHT_BLACK: nbyte=9; break; + default: nbyte=5; + } + *pMET << nbyte; + *pMET << (BYTE)0x05; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x0c; + + *pMET << (BYTE)0x06 << (BYTE)0x20 << (BYTE)0x03 << (BYTE)0xd4; + *pMET << (BYTE)0x03 << (BYTE)0x52; + + *pMET << (BYTE)0x24 << (BYTE)0x02 << (BYTE)0x08 << (BYTE)0x00; + ByteString n(pCS->aName, gsl_getSystemTextEncoding()); + for (i=0; i<32; i++) + { + if ( i == 0 || c != 0 ) + c = n.GetChar( i ); + *pMET << c; + } + } +} + + +void METWriter::WriteColorAttributeTable(ULONG nFieldId, BitmapPalette* pPalette, BYTE nBasePartFlags, BYTE nBasePartLCTID) +{ + USHORT nIndex,nNumI,i; + + if (bStatus==FALSE) return; + + //--- Das Feld 'Begin Color Attribute Table': + WriteFieldIntroducer(16,BegColAtrMagic,0,0); + WriteFieldId(nFieldId); + + //--- Das Feld 'Color Attribute Table': + WriteFieldIntroducer(0,BlkColAtrMagic,0,0); + *pMET << nBasePartFlags << (BYTE)0x00 << nBasePartLCTID; // 'Base Part' + if (pPalette!=NULL) + { + nIndex=0; + while (nIndex<pPalette->GetEntryCount()) + { + nNumI=pPalette->GetEntryCount()-nIndex; + if (nNumI>81) nNumI=81; + *pMET << (BYTE)(11+nNumI*3); // Laenge des Parameters + *pMET << (BYTE)1 << (BYTE)0 << (BYTE)1; // typ: element list, Reserved, Format: RGB + *pMET << (BYTE)0; WriteBigEndianShort(nIndex); // Start-Index (3 Bytes) + *pMET << (BYTE)8 << (BYTE)8 << (BYTE)8; // Bits je Komponente R,G,B + *pMET << (BYTE)3; // Anzahl Bytes je Eintrag + for (i=0; i<nNumI; i++) + { + const BitmapColor& rCol = (*pPalette)[ nIndex ]; + + *pMET << (BYTE) rCol.GetRed(); + *pMET << (BYTE) rCol.GetGreen(); + *pMET << (BYTE) rCol.GetBlue(); + nIndex++; + } + } + } + else + { + // 'Trible Generating' + *pMET << (BYTE)0x0a << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x01 << (BYTE)0x00; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x08 << (BYTE)0x08 << (BYTE)0x08; + } + UpdateFieldSize(); + + //--- Das Feld 'End Color Attribute Table': + WriteFieldIntroducer(16,EndColAtrMagic,0,0); + WriteFieldId(nFieldId); + + if (pMET->GetError()) + bStatus=FALSE; +} + + +void METWriter::WriteImageObject(const Bitmap & rBitmap) +{ + SvMemoryStream aTemp(0x00010000,0x00010000); + sal_uInt32 nWidth,nHeight,nResX,nResY; + ULONG nBytesPerLine,i,j,nNumColors,ny,nLines; + ULONG nActColMapId; + USHORT nBitsPerPixel; + BYTE nbyte, * pBuf; + + if (bStatus==FALSE) + return; + + nActColMapId=((nActBitmapId>>24)&0x000000ff) | ((nActBitmapId>> 8)&0x0000ff00) | + ((nActBitmapId<< 8)&0x00ff0000) | ((nActBitmapId<<24)&0xff000000); + + //--- Das Feld 'Begin Image Object': + WriteFieldIntroducer(16,BegImgObjMagic,0,0); + WriteFieldId(nActBitmapId); + + // Windows-BMP-Datei erzeugen: + aTemp << rBitmap; + + // Header der Windows-BMP-Datei einlesen: + aTemp.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + aTemp.Seek(18); + aTemp >> nWidth >> nHeight; + aTemp.SeekRel(2); + aTemp >> nBitsPerPixel; + aTemp.SeekRel(8); + aTemp >> nResX >> nResY; + aTemp.SeekRel(8); + + nNumColors=1<<nBitsPerPixel; + nBytesPerLine=((nWidth*nBitsPerPixel+0x0000001f) & 0xffffffe0 ) >> 3; + + // ggf. Farbpalette einlesen und in die MET-Datei schreiben: + if (nBitsPerPixel<=8) + { + BitmapPalette aPal( (USHORT) nNumColors ); + BYTE nr,ng,nb; + + for (i=0; i<nNumColors; i++) + { + aTemp >> nb >> ng >> nr; aTemp.SeekRel(1); + aPal[ (USHORT) i ] = BitmapColor( nr, ng, nb ); + } + + //--- Das Feld 'Begin Resource Group': + WriteFieldIntroducer(16,BegResGrpMagic,0,0); + WriteFieldId(nActColMapId); + + //--- Farbtabelle schreiben: + WriteColorAttributeTable(nActColMapId,&aPal,0,1); + + //--- Das Feld 'End Resource Group': + WriteFieldIntroducer(16,EndResGrpMagic,0,0); + WriteFieldId(nActColMapId); + + //--- Das Feld 'Begin Object Environment Group': + WriteFieldIntroducer(16,BegObjEnvMagic,0,0); + WriteFieldId(nActBitmapId); + + //--- Das Feld 'Map Color Attribute Table': + WriteFieldIntroducer(26,MapColAtrMagic,0,0); + WriteBigEndianShort(0x0012); + *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00; + WriteFieldId(nActColMapId); + *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x07 << (BYTE)0x01; + + //--- Das Feld 'End Object Environment Group': + WriteFieldIntroducer(16,EndObjEnvMagic,0,0); + WriteFieldId(nActBitmapId); + } + + //--- Das Feld 'Image Data Descriptor': + WriteFieldIntroducer(17,DscImgObjMagic,0,0); + *pMET << (BYTE)0x01; // Unit of measure: tens of centimeters + WriteBigEndianShort((USHORT)nResX); + WriteBigEndianShort((USHORT)nResY); + WriteBigEndianShort((USHORT)nWidth); + WriteBigEndianShort((USHORT)nHeight); + + //--- Das erste Feld 'Image Picture Data': + WriteFieldIntroducer(0,DatImgObjMagic,0,0); + + // Begin Segment: + *pMET << (BYTE)0x70 << (BYTE)0x00; + + // Begin Image Content: + *pMET << (BYTE)0x91 << (BYTE)0x01 << (BYTE)0xff; + + // Image Size: + *pMET << (BYTE)0x94 << (BYTE)0x09 << (BYTE)0x02; + *pMET << (USHORT) 0 << (USHORT) 0; + WriteBigEndianShort((USHORT)nHeight); + WriteBigEndianShort((USHORT)nWidth); + + // Image Encoding: + *pMET << (BYTE)0x95 << (BYTE)0x02 << (BYTE)0x03 << (BYTE)0x03; + + // Image IDE-Size: + *pMET << (BYTE)0x96 << (BYTE)0x01 << (BYTE)nBitsPerPixel; + + if (nBitsPerPixel<=8) { + // Image LUT-ID + *pMET << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0x01; + } + else { + // IDE Structure + *pMET << (BYTE)0x9b << (BYTE)0x08 << (BYTE)0x00 << (BYTE)0x01; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x08; + *pMET << (BYTE)0x08 << (BYTE)0x08; + } + + pBuf=new BYTE[nBytesPerLine]; + ny=0; + while (ny<nHeight) { + + // Abschliessen des vorherigen Feldes 'Image Picture Data': + UpdateFieldSize(); + + // Und ein neues Feld 'Image Picture Data' anfangen: + WriteFieldIntroducer(0,DatImgObjMagic,0,0); + + // Einige Scanlines lesen und schreiben: + nLines=nHeight-ny; + if (nLines*nBytesPerLine>30000) nLines=30000/nBytesPerLine; + if (nLines<1) nLines=1; + WriteBigEndianShort(0xfe92); + WriteBigEndianShort((USHORT)(nLines*nBytesPerLine)); + for (i=0; i<nLines; i++) { + aTemp.Read(pBuf,nBytesPerLine); + if (nBitsPerPixel==24) { + for (j=2; j<nBytesPerLine; j+=3) { + nbyte=pBuf[j]; pBuf[j]=pBuf[j-2]; pBuf[j-2]=nbyte; + } + } + pMET->Write(pBuf,nBytesPerLine); + ny++; + } + if (aTemp.GetError() || pMET->GetError()) bStatus=FALSE; + nActBitmapPercent=(ny+1)*100/nHeight; + MayCallback(); + if (bStatus==FALSE) { delete[] pBuf; return; } + } + delete[] pBuf; + + // End Image Content: + *pMET << (BYTE)0x93 << (BYTE)0x00; + + // End Segment: + *pMET << (BYTE)0x71 << (BYTE)0x00; + + // Abschliessen des letzten Feldes 'Image Picture Data': + UpdateFieldSize(); + + //--- Das Feld 'End Image Object': + WriteFieldIntroducer(16,EndImgObjMagic,0,0); + WriteFieldId(nActBitmapId); + + // Ids erhoehen: + nActBitmapId++; + + // Bitmaps zaehlen: + nWrittenBitmaps++; + nActBitmapPercent=0; + + if (pMET->GetError()) bStatus=FALSE; +} + + +void METWriter::WriteImageObjects(const GDIMetaFile * pMTF) +{ + const MetaAction* pMA; + + if (bStatus==FALSE) + return; + + for ( ULONG nAction = 0, nActionCount = pMTF->GetActionCount(); nAction < nActionCount; nAction++) + { + pMA = pMTF->GetAction(nAction); + + switch (pMA->GetType()) + { + case META_BMP_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( ( (MetaBmpAction*) pMA )->GetBitmap() ); + } + break; + + case META_BMPSCALE_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( ( (MetaBmpScaleAction*) pMA )->GetBitmap() ); + } + break; + + case META_BMPSCALEPART_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( ( (MetaBmpScalePartAction*) pMA )->GetBitmap() ); + } + break; + + case META_BMPEX_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( Graphic( ( (MetaBmpExAction*) pMA )->GetBitmapEx() ).GetBitmap() ); + } + break; + + case META_BMPEXSCALE_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( Graphic( ( (MetaBmpExScaleAction*) pMA )->GetBitmapEx() ).GetBitmap() ); + } + break; + + case META_BMPEXSCALEPART_ACTION: + { + METSetMix( eGDIRasterOp ); + WriteImageObject( Graphic( ( (MetaBmpExScalePartAction*) pMA )->GetBitmapEx() ).GetBitmap() ); + } + break; + + case META_EPS_ACTION : + { + const MetaEPSAction* pA = (const MetaEPSAction*)pMA; + const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); + + INT32 nCount = aGDIMetaFile.GetActionCount(); + for ( INT32 i = 0; i < nCount; i++ ) + { + const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); + if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) + { + const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct; + METSetMix( eGDIRasterOp ); + WriteImageObject( pBmpScaleAction->GetBitmap() ); + break; + } + } + } + break; + } + + if (bStatus==FALSE) + break; + } + + if (pMET->GetError()) + bStatus=FALSE; +} + +void METWriter::WriteDataDescriptor(const GDIMetaFile *) +{ + if (bStatus==FALSE) + return; + + WriteFieldIntroducer(0,DscGrfObjMagic,0,0); + + //------------------------------------------------------------------------------ + // Im Folgenden die OS2-Orginal-Dokumentation und die Implementation dazu (uff) + //------------------------------------------------------------------------------ + + // Parameters (all required and in this order) + + // 0 0xF7 Specify GVM Subset + // 1 Length of following data 0x07 + // 2 0xB0 drawing order subset + // 3-4 0x0000 + // 5 0x23 Level 3.2 + // 6 0x01 Version 1 + // 7 Length of following field 0x01 + // 8 Coordinate types in data + // 0x04Intel16 + // 0x05Intel32 + *pMET << (BYTE)0xf7 << (BYTE)0x07 << (BYTE)0xb0 << (BYTE)0x00 + << (BYTE)0x00 << (BYTE)0x23 << (BYTE)0x01 << (BYTE)0x01 + << (BYTE)0x05; + + // 0 0xF6 Set Picture Descriptor + // 1 Length of following data + // 2 Flags + // 0 B'0' Picture in 2D + // 1 Picture Dimensions + // B'0' Not absolute (PU_ARBITRARY PS) + // B'1' Absolute (example: PU_TWIPS PS) + // 2 Picture Elements + // B'0' Not pels + // B'1' Pels (PU_PELS PS) + // (Bit 1 must also be set) + // 3-7 B'00000' + // 3 0x00 Reserved + // 4 Picture frame size coordinate type + // 0x04 Intel16 + // 0x05 Intel32 + // 5 UnitsOfMeasure + // 0x00 Ten inches + // 0x01 Decimeter + // 6-11 or 6-17(2 or 4 bytes) Resolution. + // GPS Units / UOM on x axis + // GPS Units / UOM on y axis + // GPS Units / UOM on z axis + // 12-23 or 18-41(2 or 4 bytes) Window Size. + // GPS X left, X right + // GPS Y bottom, Y top + // GPS Z near, Z far + Size aUnitsPerDecimeter=OutputDevice::LogicToLogic(Size(10,10),MapMode(MAP_CM),aPictureMapMode); + *pMET << (BYTE)0xf6 << (BYTE)0x28 << (BYTE)0x40 << (BYTE)0x00 + << (BYTE)0x05 << (BYTE)0x01 + << (sal_uInt32)(aUnitsPerDecimeter.Width()) + << (sal_uInt32)(aUnitsPerDecimeter.Height()) + << (sal_uInt32)0 + << (sal_uInt32)0 << (sal_uInt32)aPictureRect.GetWidth() + << (sal_uInt32)0 << (sal_uInt32)aPictureRect.GetHeight() + << (sal_uInt32)0 << (sal_uInt32)0; + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Parameter Format 0x08 + // 3-4 Mask 0xE000 + // 5 Names 0x8F + // 6 Coordinates + // 0x00 Picture in 2D + // 7 Transforms + // 0x04 Intel16 + // 0x05 Intel32 + // 8 Geometrics + // 0x04 Intel16 + // 0x05 Intel32 + *pMET << (BYTE)0x21 << (BYTE)0x07 << (BYTE)0x08 << (BYTE)0xe0 + << (BYTE)0x00 << (BYTE)0x8f << (BYTE)0x00 << (BYTE)0x05 + << (BYTE)0x05; + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set default viewing transform 0x07 + // 3-4 Mask 0xCC0C + // 5 Names 0x8F + // 6-n M11, M12, M21, M22, M41, M42 Matrix elements + *pMET << (BYTE)0x21 << (BYTE)0x1c << (BYTE)0x07 << (BYTE)0xcc + << (BYTE)0x0c << (BYTE)0x8f + << (sal_uInt32)0x00010000 << (sal_uInt32)0x00000000 << (sal_uInt32)0x00000000 + << (sal_uInt32)0x00010000 << (sal_uInt32)0x00000000 << (sal_uInt32)0x00000000; + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set default line attributes 0x01 + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x8000 Line type + // 0x4000 Line width + // 0x2000 Line end + // 0x1000 Line join + // 0x0800 Stroke width + // 0x0008 Line color + // 0x0002 Line mix + // 5 Flags + // + // 0x0F Set indicated default attributes to initial values. (Data field is not present in this + // instance). + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in the following order if present. + // No space is reserved for attributes for which the corresponding mask flag was not + // set. + // + // (1 byte) - Line type + // (1 byte) - Line width + // (1 byte) - Line end + // (1 byte) - Line join + // (G bytes) - Stroke width + // (4 bytes) - Line color + // (1 byte) - Line mix (G=2 or 4 depending on the Geometrics parameter of Set Default + // Parameter Format) + // Nanu! witziger-weise fehlt obiger Abschnitt in den Metadateien. Also lassen wir ihn auch weg + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Character Attributes 0x02 + // 3-4 Mask - OR of as many of the following bits as are required: + // + // 0x8000 Character angle + // 0x4000 Character box + // 0x2000 Character direction + // 0x1000 Character precision + // 0x0800 Character set + // 0x0400 Character shear + // 0x0040 Character break extra + // 0x0020 Character extra + // 0x0008 Character color + // 0x0004 Character background color + // 0x0002 Character mix + // 0x0001 Character background mix + // 5 Flags + // 0x0FSet indicated default attributes to initial values. (Data field is not present in this + // case). + // 0x8FSet indicated default attributes to specified values. + // 6-n Data - data values as required, in the following order if present. + // No space is reserved for attributes for which the corresponding Mask flag was not + // set. + // (2*G bytes) - Character angle + // (2*G + 4 bytes)- Character box + // (1 byte) - Character direction + // (1 byte) - Character precision + // (1 byte) - Character set + // (2*G bytes) - Character shear + // (4 bytes) - Character break extra + // (4 bytes) - Character extra + // (4 bytes) - Character color + // (4 bytes) - Character background color + // (1 byte) - Character mix + // (1 byte) - Character background mix (G=2 or 4 depending on the Geometrics + // parameter of Set Default Parameter Format) + *pMET << (BYTE)0x21 << (BYTE)0x10 << (BYTE)0x02 << (BYTE)0x40 + << (BYTE)0x00 << (BYTE)0x8f + << (BYTE)0xaa << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00 + << (BYTE)0x44 << (BYTE)0x04 << (BYTE)0x00 << (BYTE)0x00 + << (BYTE)0xa8 << (BYTE)0xaa << (BYTE)0x40 << (BYTE)0x44; + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Marker Attributes 0x03 + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x4000 Marker box + // 0x1000 Marker precision + // 0x0800 Marker set + // 0x0100 Marker symbol + // 0x0008 Marker color + // 0x0004 Marker background color + // 0x0002 Marker mix + // 0x0001 Marker background mix + // 5 Flags + // 0x0F Set indicated default attributes to initial values. + // (Data field is not present in this instance) + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in this order if present. + // No space is reserved for attributes for which the corresponding Mask flag was not + // set. + // (2*G bytes) - Marker box + // (1 byte) - Marker precision + // (1 byte) - Marker set + // (1 byte) - Marker symbol + // (4 bytes) - Marker color + // (4 bytes) - Marker background color + // (1 byte) - Marker mix + // (1 byte) - Marker background mix (G=2 or 4 depending on the Geometrics + // parameter of Set Default Parameter Format) + *pMET << (BYTE)0x21 << (BYTE)0x0c << (BYTE)0x03 << (BYTE)0x40 + << (BYTE)0x00 << (BYTE)0x8f + << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00 + << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00; + + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Pattern Attributes 0x04 + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x0800 Pattern set + // 0x0100 Pattern symbol + // 0x0080 Pattern reference point + // 0x0008 Pattern color + // 0x0004 Pattern background color + // 0x0002 Pattern mix + // 0x0001 Pattern background mix + // 5 Flags + // + // 0x0F Set indicated default attributes to initial values. + // (Data field is not present in this instance) + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in this order if present. + // No space is reserved for attributes for which the corresponding Mask flag was + // not set. + // + // (1 byte) - Pattern set + // (1 byte) - Pattern symbol + // (2*G bytes) - Pattern reference point + // (4 bytes) - Pattern color + // (4 bytes) - Pattern background color + // (1 byte) - Pattern mix + // (1 byte) - Pattern background mix (G=2 or 4 depending on the Geometrics + // parameter of Set Default Parameter Format) + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Image Attributes 0x06 + // 3-4 Mask - OR of as many of these bits as are required: + // 0x0008 Image color + // 0x0004 Image background color + // 0x0002 Image mix + // 0x0001 Image background mix + // 5 Flags + // 0x0F Set indicated default attributes to initial values. (Data field is not present in + // this instance) + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in this order if present. + // No space is reserved for attributes for which the corresponding Mask flag was + // not set. + // (4 bytes) - Image color + // (4 bytes) - Image background color + // (1 byte) - Image mix + // (1 byte) - Image background mix + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Viewing Window 0x05 + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x8000 x left limit + // 0x4000 x right limit + // 0x2000 y bottom limit + // 0x1000 y top limit + // 5 Flags + // 0x0F Set indicated default attributes to initial values. + // (Data field is not present in this case). + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in the following order if present. + // No space is reserved for attributes for which the corresponding Mask flag was + // not set. + // (2*G bytes) - x left limit + // (2*G bytes) - x right limit + // (2*G bytes) - y bottom limit + // (2*G bytes) - y top limit (G=2 or 4 depending on the Geometrics parameter of Set + // Default Parameter Format) + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Arc Parameters 0x0B + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x8000 P value + // 0x4000 Q value + // 0x2000 R value + // 0x1000 S value + // 5 Flags + // 0x0F Set indicated default attributes to initial values. + // (Data field is not present in this case). + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in the following order if present. + // No space is reserved for attributes for which the corresponding Mask flag was + // not set. + // (G bytes) - P value + // (G bytes) - Q value + // (G bytes) - R value + // (G bytes) - S value (G=2 or 4 depending on the Geometrics parameter of Set + // Default Parameter Format) + // 0 0x21 Set Current Defaults + // 1 Length of following data + // 2 Set Default Pick Identifier 0x0C + // 3-4 Mask - OR of as many of the following bits as are required: + // 0x8000 Pick identifier + // 5 Flags + // 0x0F Set indicated default attributes to initial values. + // (Data field is not present in this case). + // 0x8F Set indicated default attributes to specified values. + // 6-n Data - data values as required, in the following order if present. + // No space is reserved for attributes for which the corresponding Mask flag was + // not set. + // (4 bytes) - Pick identifier + + // 0 0xE7 Set Bit-map Identifier + // 1 Length of following data 0x07 + // 2-3 Usage Flags 0x8000 + // 4-7 Bit-map handle + // 8 Lcid + if (nNumberOfBitmaps>0) { + *pMET << (BYTE)0xe7 << (BYTE)0x07 << (BYTE)0x80 << (BYTE)0x00; + WriteBigEndianLong(nActBitmapId); + *pMET << (BYTE)0xfe; + } + + UpdateFieldSize(); + + if (pMET->GetError()) bStatus=FALSE; +} + + +void METWriter::WillWriteOrder(ULONG nNextOrderMaximumLength) +{ + // Die Parameter eines 'Graphics Data Fields' duerfen (laut OS2-Doku) + // hoechstens 32759 Bytes umfassen. Gemeint ist die Laenge des Feldes minus + // dem 'Structured Field Introducer' (groesse: 8). Also darf die Groesse + // des ganzen Fields hoechstens 8+32759=32767=0x7fff sein. + // Zur Sicherheit nehmen wir lieber 30000 als Grenze. + + if (pMET->Tell()-nActualFieldStartPos+nNextOrderMaximumLength>30000) + { + UpdateFieldSize(); + WriteFieldIntroducer(0,DatGrfObjMagic,0,0); + nNumberOfDataFields++; + } +} + + + +void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap) +{ + WillWriteOrder(46); + *pMET << (BYTE)0xd6 << (BYTE)44 << (USHORT)0 << (USHORT) 0x00cc; + WriteBigEndianLong(nActBitmapId++); + *pMET << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + WritePoint(Point(aPt.X(),aPt.Y()+aSize.Height())); + WritePoint(Point(aPt.X()+aSize.Width(),aPt.Y())); + *pMET << (sal_uInt32)0 << (sal_uInt32)0 + << (sal_uInt32)(rBitmap.GetSizePixel().Width()) + << (sal_uInt32)(rBitmap.GetSizePixel().Height()); +} + +void METWriter::METSetAndPushLineInfo( const LineInfo& rLineInfo ) +{ + INT32 nWidth = OutputDevice::LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width(); + + WillWriteOrder( 8 ); // set stroke linewidth + *pMET << (BYTE)0x15 + << (BYTE)6 + << (BYTE)0 // Flags + << (BYTE)0 + << nWidth; + + if ( rLineInfo.GetStyle() != LINE_SOLID ) + { + BYTE nStyle = 0; // LineDefault; + + switch ( rLineInfo.GetStyle() ) + { + case LINE_NONE : + nStyle = 8; + break; + + case LINE_DASH : + { + if ( rLineInfo.GetDotCount() ) + { + if ( !rLineInfo.GetDashCount() ) + nStyle = 1; // LINE_DOT + else + nStyle = 3; // LINE_DASH_DOT + } + else + nStyle = 2; // LINE_DASH + } + break; + case LineStyle_SOLID: + case LineStyle_FORCE_EQUAL_SIZE: + break; // not handled -Wall + } + WillWriteOrder( 2 ); + *pMET << (BYTE)0x18 << nStyle; // set LineType + } +} + +void METWriter::METPopLineInfo( const LineInfo& rLineInfo ) +{ + WillWriteOrder( 8 ); // set stroke linewidth + *pMET << (BYTE)0x15 + << (BYTE)6 + << (BYTE)0 // Flags + << (BYTE)0 + << (UINT32)1; + + if ( rLineInfo.GetStyle() != LINE_SOLID ) + { + WillWriteOrder( 2 ); + *pMET << (BYTE)0x18 << (BYTE)0; // set LineType + } +} + +void METWriter::METBeginArea(BOOL bBoundaryLine) +{ + WillWriteOrder(2); + *pMET << (BYTE)0x68; + if (bBoundaryLine) *pMET << (BYTE)0xc0; + else *pMET << (BYTE)0x80; +} + + +void METWriter::METEndArea() +{ + WillWriteOrder(2); + *pMET << (BYTE)0x60 << (BYTE)0; +} + + +void METWriter::METBeginPath(sal_uInt32 nPathId) +{ + WillWriteOrder(8); + *pMET << (BYTE)0xd0 << (BYTE)6 << (USHORT) 0 << nPathId; +} + + +void METWriter::METEndPath() +{ + WillWriteOrder(2); + *pMET << (BYTE)0x7f << (BYTE)0; +} + + +void METWriter::METFillPath(sal_uInt32 nPathId) +{ + WillWriteOrder(8); + *pMET << (BYTE)0xd7 << (BYTE)6 + << (BYTE)0x00 << (BYTE)0 << nPathId; +} + + +void METWriter::METOutlinePath(sal_uInt32 nPathId) +{ + WillWriteOrder(8); + *pMET << (BYTE)0xd4 << (BYTE)6 + << (BYTE)0 << (BYTE)0 << nPathId; +} + + +void METWriter::METCloseFigure() +{ + WillWriteOrder(2); + *pMET << (BYTE)0x7d << (BYTE)0; +} + + +void METWriter::METMove(Point aPt) +{ + WillWriteOrder(10); + *pMET << (BYTE)0x21 << (BYTE)8; + WritePoint(aPt); +} + + +void METWriter::METLine(Point aPt1, Point aPt2) +{ + WillWriteOrder(18); + *pMET << (BYTE)0xc1 << (BYTE)16; + WritePoint(aPt1); WritePoint(aPt2); +} + + +void METWriter::METLine(const Polygon & rPolygon) +{ + USHORT nNumPoints,i,j,nOrderPoints; + BOOL bFirstOrder; + + bFirstOrder=TRUE; + i=0; nNumPoints=rPolygon.GetSize(); + while (i<nNumPoints) { + nOrderPoints=nNumPoints-i; + if (nOrderPoints>30) nOrderPoints=30; + WillWriteOrder(nOrderPoints*8+2); + if (bFirstOrder==TRUE) { + *pMET << (BYTE)0xc1; // Line at given pos + bFirstOrder=FALSE; + } + else { + *pMET << (BYTE)0x81; // Line at current pos + } + *pMET << (BYTE)(nOrderPoints*8); + for (j=0; j<nOrderPoints; j++) WritePoint(rPolygon.GetPoint(i++)); + } +} + + +void METWriter::METLine(const PolyPolygon & rPolyPolygon) +{ + USHORT i,nCount; + nCount=rPolyPolygon.Count(); + for (i=0; i<nCount; i++) { + METLine(rPolyPolygon.GetObject(i)); + METCloseFigure(); + } +} + + +void METWriter::METLineAtCurPos(Point aPt) +{ + WillWriteOrder(10); + *pMET << (BYTE)0x81 << (BYTE)8; + WritePoint(aPt); +} + + +void METWriter::METBox(BOOL bFill, BOOL bBoundary, + Rectangle aRect, sal_uInt32 nHAxis, sal_uInt32 nVAxis) +{ + BYTE nFlags=0; + if (bFill) nFlags|=0x40; + if (bBoundary) nFlags|=0x20; + + WillWriteOrder(28); + *pMET << (BYTE)0xc0 << (BYTE)26 << nFlags << (BYTE)0; + WritePoint(aRect.BottomLeft()); + WritePoint(aRect.TopRight()); + *pMET << nHAxis << nVAxis; +} + + +void METWriter::METFullArc(Point aCenter, double fMultiplier) +{ + WillWriteOrder(14); + *pMET << (BYTE)0xc7 << (BYTE)12; + WritePoint(aCenter); + *pMET << (long)(fMultiplier*65536.0+0.5); +} + + +void METWriter::METPartialArcAtCurPos(Point aCenter, double fMultiplier, + double fStartAngle, double fSweepAngle) +{ + fStartAngle*=180.0/3.14159265359; + while (fStartAngle>360.0) fStartAngle-=360.0; + while (fStartAngle<0.0) fStartAngle+=360.0; + fSweepAngle*=180.0/3.14159265359; + while (fSweepAngle>360.0) fSweepAngle-=360.0; + while (fSweepAngle<.00) fSweepAngle+=360.0; + WillWriteOrder(22); + *pMET << (BYTE)0xa3 << (BYTE)20; + WritePoint(aCenter); + *pMET << (long)(fMultiplier*65536.0+0.5); + *pMET << (long)(fStartAngle*65536.0+0.5); + *pMET << (long)(fSweepAngle*65536.0+0.5); +} + + +void METWriter::METChrStr( Point aPt, String aUniStr ) +{ + USHORT nLen,i; + ByteString aStr( aUniStr, gsl_getSystemTextEncoding() ); + nLen = aStr.Len(); + WillWriteOrder( 11 + nLen ); + *pMET << (BYTE)0xc3 << (BYTE)( 9 + nLen ); + WritePoint(aPt); + for ( i = 0; i < nLen; i++ ) + *pMET << aStr.GetChar( i ); + *pMET << (BYTE)0; +} + + +void METWriter::METSetArcParams(long nP, long nQ, long nR, long nS) +{ + WillWriteOrder(18); + *pMET << (BYTE)0x22 << (BYTE)16 << nP << nQ << nR << nS; +} + + +void METWriter::METSetColor(Color aColor) +{ + if (aColor==aMETColor) return; + aMETColor=aColor; + + WillWriteOrder(6); + *pMET << (BYTE)0xa6 << (BYTE)4 << (BYTE)0 + << (BYTE)(aColor.GetBlue()) + << (BYTE)(aColor.GetGreen()) + << (BYTE)(aColor.GetRed()); +} + + +void METWriter::METSetBackgroundColor(Color aColor) +{ + if (aColor==aMETBackgroundColor) return; + aMETBackgroundColor=aColor; + + WillWriteOrder(6); + *pMET << (BYTE)0xa7 << (BYTE)4 << (BYTE)0 + << (BYTE)(aColor.GetBlue()) + << (BYTE)(aColor.GetGreen()) + << (BYTE)(aColor.GetRed()); +} + +void METWriter::METSetMix(RasterOp eROP) +{ + BYTE nMix; + + if (eMETMix==eROP) + return; + + eMETMix=eROP; + + switch (eROP) + { + case ROP_INVERT: nMix=0x0c; break; + case ROP_XOR: nMix=0x04; break; + default: nMix=0x02; + } + + WillWriteOrder(2); + *pMET << (BYTE)0x0c << nMix; +} + + +void METWriter::METSetChrCellSize(Size aSize) +{ + if (aMETChrCellSize==aSize) + return; + + aMETChrCellSize=aSize; + WillWriteOrder(10); + if (aSize.Width()==0) aSize.Width()=aSize.Height(); + *pMET << (BYTE)0x33 << (BYTE)8 << (long)aSize.Width() << (long)aSize.Height(); +} + + +void METWriter::METSetChrAngle(short nAngle) +{ + double fa; + long nax,nay; + + if (nMETChrAngle==nAngle) return; + nMETChrAngle=nAngle; + + if (nAngle==0) + { + nax=256; + nay=0; + } + else + { + fa=((double)nAngle)/1800.0*3.14159265359; + nax=(long)(256.0*cos(fa)+0.5); + nay=(long)(256.0*sin(fa)+0.5); + } + + WillWriteOrder(10); + *pMET << (BYTE)0x34 << (BYTE)8 << nax << nay; +} + + +void METWriter::METSetChrSet(BYTE nSet) +{ + if (nMETChrSet==nSet) + return; + + nMETChrSet=nSet; + WillWriteOrder(2); + *pMET << (BYTE)0x38 << nSet; +} + + +void METWriter::WriteOrders( const GDIMetaFile* pMTF ) +{ + if(bStatus==FALSE) + return; + + for( ULONG nA = 0, nACount = pMTF->GetActionCount(); nA < nACount; nA++ ) + { + const MetaAction* pMA = pMTF->GetAction( nA ); + + switch (pMA->GetType()) + { + case META_PIXEL_ACTION: + { + const MetaPixelAction* pA = (const MetaPixelAction*) pMA; + METSetMix( eGDIRasterOp ); + METSetColor( pA->GetColor() ); + METLine( pA->GetPoint(),pA->GetPoint() ); + } + break; + + case META_POINT_ACTION: + { + const MetaPointAction* pA = (const MetaPointAction*) pMA; + + METSetArcParams(1,1,0,0); + METSetMix(eGDIRasterOp); + METSetColor(aGDILineColor); + METBeginArea(FALSE); + METFullArc(pA->GetPoint(),0.5); + METEndArea(); + } + break; + + case META_LINE_ACTION: + { + const MetaLineAction* pA = (const MetaLineAction*) pMA; + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + LineInfo aLineInfo( pA->GetLineInfo() ); + if ( ! ( aLineInfo.IsDefault() ) ) + METSetAndPushLineInfo( aLineInfo ); + + METSetMix( eGDIRasterOp ); + METSetColor(aGDILineColor); + METBeginPath( 1 ); + METLine( pA->GetStartPoint(), pA->GetEndPoint() ); + METEndPath(); + METOutlinePath( 1 ); + + if ( ! ( aLineInfo.IsDefault() ) ) + METPopLineInfo( aLineInfo ); + } + } + break; + + case META_RECT_ACTION: + { + const MetaRectAction* pA = (const MetaRectAction*) pMA; + + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDIFillColor ); + METSetBackgroundColor( aGDIFillColor ); + METBox( TRUE, FALSE, pA->GetRect(), 0, 0 ); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METBox( FALSE, TRUE, pA->GetRect(), 0, 0 ); + } + } + break; + + case META_ROUNDRECT_ACTION: + { + const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA; + + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDIFillColor ); + METSetBackgroundColor( aGDIFillColor ); + METBox( TRUE, FALSE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() ); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METBox( FALSE, TRUE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() ); + } + } + break; + + case META_ELLIPSE_ACTION: + { + const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA; + Point aCenter; + + aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2; + aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2; + + METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0); + + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDIFillColor ); + METSetBackgroundColor( aGDIFillColor ); + METBeginArea(FALSE); + METFullArc(aCenter,0.5); + METEndArea(); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METFullArc( aCenter,0.5 ); + } + } + break; + + case META_ARC_ACTION: + { + const MetaArcAction* pA = (const MetaArcAction*) pMA; + Point aStartPos,aCenter; + double fdx,fdy,fa1,fa2; + + aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2; + aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2; + fdx=(double)(pA->GetStartPoint().X()-aCenter.X()); + fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa1=atan2(-fdy,fdx); + fdx=(double)(pA->GetEndPoint().X()-aCenter.X()); + fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa2=atan2(-fdy,fdx); + aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5); + aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5); + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0); + METBeginPath(1); + METMove(aStartPos); + METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_PIE_ACTION: + { + const MetaPieAction* pA = (const MetaPieAction*) pMA; + Point aCenter; + double fdx,fdy,fa1,fa2; + + aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2; + aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2; + fdx=(double)(pA->GetStartPoint().X()-aCenter.X()); + fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa1=atan2(-fdy,fdx); + fdx=(double)(pA->GetEndPoint().X()-aCenter.X()); + fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa2=atan2(-fdy,fdx); + + METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0); + + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDIFillColor ); + METSetBackgroundColor( aGDIFillColor ); + METBeginPath(1); + METMove(aCenter); + METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1); + METLineAtCurPos(aCenter); + METEndPath(); + METFillPath(1); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METBeginPath(1); + METMove(aCenter); + METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1); + METLineAtCurPos(aCenter); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_CHORD_ACTION: + { + const MetaChordAction* pA = (const MetaChordAction*) pMA; + Point aStartPos,aCenter; + double fdx,fdy,fa1,fa2; + + aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2; + aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2; + fdx=(double)(pA->GetStartPoint().X()-aCenter.X()); + fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa1=atan2(-fdy,fdx); + fdx=(double)(pA->GetEndPoint().X()-aCenter.X()); + fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y()); + fdx*=(double)pA->GetRect().GetHeight(); + fdy*=(double)pA->GetRect().GetWidth(); + if (fdx==0.0 && fdy==0.0) fdx=1.0; + fa2=atan2(-fdy,fdx); + aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5); + aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5); + + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDIFillColor ); + METSetBackgroundColor( aGDIFillColor ); + METBeginPath(1); + METMove(aStartPos); + METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1); + METLineAtCurPos(aStartPos); + METEndPath(); + METFillPath(1); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix( eGDIRasterOp ); + METSetColor( aGDILineColor ); + METBeginPath(1); + METMove(aStartPos); + METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1); + METLineAtCurPos(aStartPos); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_POLYLINE_ACTION: + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA; + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + LineInfo aLineInfo( pA->GetLineInfo() ); + if ( ! ( aLineInfo.IsDefault() ) ) + METSetAndPushLineInfo( aLineInfo ); + + METSetMix(eGDIRasterOp); + METSetColor(aGDILineColor); + METBeginPath(1); + Polygon aSimplePoly; + const Polygon& rPoly = pA->GetPolygon(); + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; + METLine( aSimplePoly ); + METEndPath(); + METOutlinePath(1); + + if ( ! ( aLineInfo.IsDefault() ) ) + METPopLineInfo( aLineInfo ); + } + } + break; + + case META_POLYGON_ACTION: + { + const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA; + Polygon aSimplePoly; + const Polygon& rPoly = pA->GetPolygon(); + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDIFillColor ); + METSetBackgroundColor(aGDIFillColor ); + METBeginPath(1); + METLine( aSimplePoly ); + METEndPath(); + METFillPath(1); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDILineColor ); + METBeginPath(1); + METLine( aSimplePoly ); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_POLYPOLYGON_ACTION: + { + const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA; + + PolyPolygon aSimplePolyPoly( pA->GetPolyPolygon() ); + sal_uInt16 i, nCount = aSimplePolyPoly.Count(); + for ( i = 0; i < nCount; i++ ) + { + if ( aSimplePolyPoly[ i ].HasFlags() ) + { + Polygon aSimplePoly; + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); + aSimplePolyPoly[ i ] = aSimplePoly; + } + } + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDIFillColor); + METSetBackgroundColor(aGDIFillColor); + METBeginPath(1); + METLine( aSimplePolyPoly ); + METEndPath(); + METFillPath(1); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDILineColor); + METBeginPath(1); + METLine( aSimplePolyPoly ); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_TEXT_ACTION: + { + const MetaTextAction* pA = (const MetaTextAction*) pMA; + Point aPt( pA->GetPoint() ); + + if( aGDIFont.GetAlign() != ALIGN_BASELINE) + { + VirtualDevice aVDev; + + if( aGDIFont.GetAlign()==ALIGN_TOP ) + aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent(); + else + aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent(); + } + + METSetMix(eGDIRasterOp); + METSetColor(aGDIFont.GetColor()); + METSetBackgroundColor(aGDIFont.GetFillColor()); + METSetChrCellSize(aGDIFont.GetSize()); + METSetChrAngle(aGDIFont.GetOrientation()); + METSetChrSet(FindChrSet(aGDIFont)); + METChrStr(aPt, String(pA->GetText(),pA->GetIndex(),pA->GetLen())); + } + break; + + case META_TEXTARRAY_ACTION: + { + const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA; + USHORT i; + String aStr; + Polygon aPolyDummy(1); + short nOrientation; + Point aPt( pA->GetPoint() ); + + if( aGDIFont.GetAlign() != ALIGN_BASELINE ) + { + VirtualDevice aVDev; + if( aGDIFont.GetAlign() == ALIGN_TOP ) + aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent(); + else + aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent(); + } + + METSetMix(eGDIRasterOp); + METSetColor(aGDIFont.GetColor()); + METSetBackgroundColor(aGDIFont.GetFillColor()); + METSetChrCellSize(aGDIFont.GetSize()); + METSetChrAngle( nOrientation = aGDIFont.GetOrientation() ); + METSetChrSet(FindChrSet(aGDIFont)); + aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen()); + + if( pA->GetDXArray()!=NULL ) + { + Point aPt2; + + for( i=0; i < aStr.Len(); i++ ) + { + aPt2 = aPt; + if ( i > 0 ) + { + aPt2.X() += pA->GetDXArray()[i-1]; + if ( nOrientation ) + { + aPolyDummy.SetPoint( aPt2, 0 ); + aPolyDummy.Rotate( aPt, nOrientation ); + aPt2 = aPolyDummy.GetPoint( 0 ); + } + } + METChrStr( aPt2, String( aStr.GetChar( i ) ) ); + } + } + else + METChrStr( aPt, aStr ); + } + break; + + case META_STRETCHTEXT_ACTION: + { + const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA; + VirtualDevice aVDev; + USHORT i; + sal_Int32* pDXAry; + sal_Int32 nNormSize; + String aStr; + Polygon aPolyDummy(1); + short nOrientation; + Point aPt( pA->GetPoint() ); + Point aPt2; + + aVDev.SetFont( aGDIFont ); + + if( aGDIFont.GetAlign() != ALIGN_BASELINE) + { + if( aGDIFont.GetAlign() == ALIGN_TOP ) + aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent(); + else + aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent(); + } + + METSetMix(eGDIRasterOp); + METSetColor(aGDIFont.GetColor()); + METSetBackgroundColor(aGDIFont.GetFillColor()); + METSetChrCellSize(aGDIFont.GetSize()); + METSetChrAngle( nOrientation = aGDIFont.GetOrientation() ); + METSetChrSet(FindChrSet(aGDIFont)); + aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen()); + pDXAry=new sal_Int32[aStr.Len()]; + nNormSize = aVDev.GetTextArray( aStr, pDXAry ); + + for ( i = 0; i < aStr.Len(); i++ ) + { + aPt2 = aPt; + if ( i > 0 ) + { + aPt2.X() += pDXAry[i-1]*((long)pA->GetWidth())/ nNormSize; + if ( nOrientation ) + { + aPolyDummy.SetPoint( aPt2, 0 ); + aPolyDummy.Rotate( aPt, nOrientation ); + aPt2 = aPolyDummy.GetPoint( 0 ); + } + } + METChrStr( aPt2, String( aStr.GetChar( i ) ) ); + } + + delete[] pDXAry; + } + break; + + case META_TEXTRECT_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_TEXTRECT_ACTION!" ); + } + break; + + case META_BMP_ACTION: + { + const MetaBmpAction* pA = (const MetaBmpAction*) pMA; + + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() ); + } + break; + + case META_BMPSCALE_ACTION: + { + const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA; + + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() ); + } + break; + + case META_BMPSCALEPART_ACTION: + { + const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA; + Bitmap aTmp( pA->GetBitmap() ); + + aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + METSetMix( eGDIRasterOp ); + METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp ); + } + break; + + case META_BMPEX_ACTION: + { + const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA; + Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetPoint(), aTmp.GetSizePixel(), aTmp ); + } + break; + + case META_BMPEXSCALE_ACTION: + { + const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA; + Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetPoint(), pA->GetSize(), aTmp ); + } + break; + + case META_BMPEXSCALEPART_ACTION: + { + const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA; + Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp ); + } + break; + + case META_EPS_ACTION : + { + const MetaEPSAction* pA = (const MetaEPSAction*)pMA; + const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); + + INT32 nCount = aGDIMetaFile.GetActionCount(); + for ( INT32 i = 0; i < nCount; i++ ) + { + const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); + if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) + { + const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct; + METSetMix(eGDIRasterOp); + METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() ); + break; + } + } + } + break; + + case META_MASK_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_MASK_ACTION!" ); + } + break; + + case META_MASKSCALE_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALE_ACTION!" ); + } + break; + + case META_MASKSCALEPART_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALEPART_ACTION!" ); + } + break; + + case META_GRADIENT_ACTION: + { + VirtualDevice aVDev; + GDIMetaFile aTmpMtf; + const MetaGradientAction* pA = (const MetaGradientAction*) pMA; + + aVDev.SetMapMode( aTargetMapMode ); + aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); + WriteOrders( &aTmpMtf ); + } + break; + + case META_HATCH_ACTION: + { + VirtualDevice aVDev; + GDIMetaFile aTmpMtf; + const MetaHatchAction* pA = (const MetaHatchAction*) pMA; + + aVDev.SetMapMode( aTargetMapMode ); + aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); + WriteOrders( &aTmpMtf ); + } + break; + + case META_WALLPAPER_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_WALLPAPER_ACTION!" ); + } + break; + + case META_CLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_CLIPREGION_ACTION!" ); + } + break; + + case META_ISECTRECTCLIPREGION_ACTION: + { + const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA; + WriteClipRect( pA->GetRect() ); + } + break; + + case META_ISECTREGIONCLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_ISECTREGIONCLIPREGION_ACTION!" ); + } + break; + + case META_MOVECLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_MOVECLIPREGION_ACTION!" ); + } + break; + + case META_LINECOLOR_ACTION: + { + const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA; + + if( pA->IsSetting() ) + aGDILineColor = pA->GetColor(); + else + aGDILineColor = Color( COL_TRANSPARENT ); + } + break; + + case META_FILLCOLOR_ACTION: + { + const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA; + + if( pA->IsSetting() ) + aGDIFillColor = pA->GetColor(); + else + aGDIFillColor = Color( COL_TRANSPARENT ); + } + break; + + case META_TEXTCOLOR_ACTION: + { + const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA; + aGDIFont.SetColor( pA->GetColor() ); + } + break; + + case META_TEXTFILLCOLOR_ACTION: + { + const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA; + + if( pA->IsSetting() ) + aGDIFont.SetFillColor( pA->GetColor() ); + else + aGDIFont.SetFillColor( Color( COL_TRANSPARENT ) ); + } + break; + + case META_TEXTALIGN_ACTION: + { +// DBG_ERROR( "Unsupported MET-Action: META_TEXTALIGN_ACTION!" ); + } + break; + + case META_MAPMODE_ACTION: + { + const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA; + + if( aPictureMapMode != pA->GetMapMode() ) + { + if ( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE ) + { + MapMode aMM = pA->GetMapMode(); + Fraction aScaleX = aMM.GetScaleX(); + Fraction aScaleY = aMM.GetScaleY(); + + Point aOrigin = aPictureMapMode.GetOrigin(); + BigInt aX( aOrigin.X() ); + aX *= BigInt( aScaleX.GetDenominator() ); + + if( aOrigin.X() >= 0 ) + { + if( aScaleX.GetNumerator() >= 0 ) + aX += BigInt( aScaleX.GetNumerator()/2 ); + else + aX -= BigInt( (aScaleX.GetNumerator()+1)/2 ); + } + else + { + if( aScaleX.GetNumerator() >= 0 ) + aX -= BigInt( (aScaleX.GetNumerator()-1)/2 ); + else + aX += BigInt( aScaleX.GetNumerator()/2 ); + } + + aX /= BigInt( aScaleX.GetNumerator() ); + aOrigin.X() = (long) aX + aMM.GetOrigin().X(); + + BigInt aY( aOrigin.Y() ); + aY *= BigInt( aScaleY.GetDenominator() ); + + if( aOrigin.Y() >= 0 ) + { + if( aScaleY.GetNumerator() >= 0 ) + aY += BigInt( aScaleY.GetNumerator()/2 ); + else + aY -= BigInt( (aScaleY.GetNumerator()+1)/2 ); + } + else + { + if( aScaleY.GetNumerator() >= 0 ) + aY -= BigInt( (aScaleY.GetNumerator()-1)/2 ); + else + aY += BigInt( aScaleY.GetNumerator()/2 ); + } + + aY /= BigInt( aScaleY.GetNumerator() ); + aOrigin.Y() = (long)aY + aMM.GetOrigin().Y(); + aPictureMapMode.SetOrigin( aOrigin ); + + aScaleX *= aPictureMapMode.GetScaleX(); + aScaleY *= aPictureMapMode.GetScaleY(); + aPictureMapMode.SetScaleX( aScaleX ); + aPictureMapMode.SetScaleY( aScaleY ); + } + else + aPictureMapMode=pA->GetMapMode(); + } + } + break; + + case META_FONT_ACTION: + { + aGDIFont = ( (const MetaFontAction*) pMA )->GetFont(); + } + break; + + case META_PUSH_ACTION: + { + METGDIStackMember* pGS = new METGDIStackMember; + + pGS->pSucc=pGDIStack; pGDIStack=pGS; + pGS->aLineColor=aGDILineColor; + pGS->aFillColor=aGDIFillColor; + pGS->eRasterOp=eGDIRasterOp; + pGS->aFont=aGDIFont; + pGS->aMapMode=aPictureMapMode; + pGS->aClipRect=aGDIClipRect; + } + break; + + case META_POP_ACTION: + { + METGDIStackMember* pGS; + + if( pGDIStack ) + { + pGS=pGDIStack; pGDIStack=pGS->pSucc; + aGDILineColor=pGS->aLineColor; + aGDIFillColor=pGS->aFillColor; + eGDIRasterOp=pGS->eRasterOp; + aGDIFont=pGS->aFont; + if ( pGS->aClipRect != aGDIClipRect ) + WriteClipRect( pGS->aClipRect ); + aPictureMapMode=pGS->aMapMode; + delete pGS; + } + } + break; + + case META_RASTEROP_ACTION: + { + eGDIRasterOp = ( (const MetaRasterOpAction*) pMA )->GetRasterOp(); + } + break; + + case META_TRANSPARENT_ACTION: + { + if( aGDIFillColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDIFillColor); + METSetBackgroundColor(aGDIFillColor); + METBeginPath(1); + METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon()); + METEndPath(); + METFillPath(1); + } + + if( aGDILineColor != Color( COL_TRANSPARENT ) ) + { + METSetMix(eGDIRasterOp); + METSetColor(aGDILineColor); + METBeginPath(1); + METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon()); + METEndPath(); + METOutlinePath(1); + } + } + break; + + case META_FLOATTRANSPARENT_ACTION: + { + const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA; + + GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() ); + Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() ); + const Size aSrcSize( aTmpMtf.GetPrefSize() ); + const Point aDestPt( pA->GetPoint() ); + const Size aDestSize( pA->GetSize() ); + const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0; + long nMoveX, nMoveY; + + if( fScaleX != 1.0 || fScaleY != 1.0 ) + { + aTmpMtf.Scale( fScaleX, fScaleY ); + aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY ); + } + + nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y(); + + if( nMoveX || nMoveY ) + aTmpMtf.Move( nMoveX, nMoveY ); + + WriteOrders( &aTmpMtf ); + } + break; + } + + nWrittenActions++; + MayCallback(); + + if( pMET->GetError() ) + bStatus=FALSE; + + if( bStatus == FALSE ) + break; + } +} + +void METWriter::WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF) +{ + ULONG i, nId; + + //--- Das Feld 'Begin Object Environment Group': + WriteFieldIntroducer(16,BegObjEnvMagic,0,0); + WriteFieldId(7); + + //--- Das Feld 'Map Color Attribute Table': + WriteFieldIntroducer(22,MapColAtrMagic,0,0); + WriteBigEndianShort(0x000e); + *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00; + WriteFieldId(4); + + //--- Das erste Feld 'Map Coded Font': + WriteFieldIntroducer(32,MapCodFntMagic,0,0); + WriteBigEndianShort(0x0018); + *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00; + *pMET << (BYTE)0xff << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)0x00; + *pMET << (BYTE)0x06 << (BYTE)0x20; + *pMET << (BYTE)0x03 << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0xb5; + + //--- Die weiteren Felder 'Map Coded Font': + CreateChrSets(pMTF); + WriteChrSets(); + + //--- Die Felder 'Map Data Resource': + nId=nActBitmapId; + for (i=0; i<nNumberOfBitmaps; i++) + { + WriteFieldIntroducer(29,MapDatResMagic,0,0); + WriteBigEndianShort(0x0015); + *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00; + WriteFieldId(nId); + *pMET << (BYTE)0x07 << (BYTE)0x22 << (BYTE)0x10; + *pMET << (sal_uInt32)nId; + nId++; + } + + //--- Das Feld 'End Object Environment Group': + WriteFieldIntroducer(16,EndObjEnvMagic,0,0); + WriteFieldId(7); +} + + +void METWriter::WriteGraphicsObject(const GDIMetaFile * pMTF) +{ + ULONG nSegmentSize,nPos,nDataFieldsStartPos; + + if( bStatus==FALSE ) + return; + + //--- Das Feld 'Begin Graphics Object': + WriteFieldIntroducer(16,BegGrfObjMagic,0,0); + WriteFieldId(7); + + // Map Color Attribute Table, Fonts und anderes: + WriteObjectEnvironmentGroup(pMTF); + + //--- Das Feld 'Graphics Data Descriptor': + WriteDataDescriptor(pMTF); + + // Zaehler fuer Data Fields initialisieren: + nNumberOfDataFields=0; + + // Und Position des ersten Data Fields merken: + nDataFieldsStartPos=pMET->Tell(); + + //--- Anfang des ersten Feldes 'Graphics Data' + WriteFieldIntroducer(0,DatGrfObjMagic,0,0); + nNumberOfDataFields++; + + // Nun schreiben wir zunaechst den Kopf des Segments: + *pMET << (BYTE)0x70 << (BYTE)0x0e << (sal_uInt32)0; + *pMET << (BYTE)0x70 << (BYTE)0x10; // Flags + *pMET << (USHORT)0; // Lo-Wort der Laenge der Segementdaten (Big Endian) + *pMET << (sal_uInt32)0; // Reserved + *pMET << (USHORT)0; // Hi-Wort der Laenge der Segementdaten (Big Endian) (Ohh Ohh OS2) + // Anmerkung: die richtige Daten-Laenge schreiben wir weiter unten nochmal + + // Jetzt werden alle Orders rausgeschrieben: + // (wobei die Sache ggf. in mehrere 'Graphics Data Fields' aufgeteilt + // wird, per Methode WillWriteOrder(..)) + WriteOrders(pMTF); + + //--- Das letzte Feld 'Graphic Data' beenden: + UpdateFieldSize(); + + //--- Und schliesslich die Segmentgroesse richtigstellen: + nPos=pMET->Tell(); + nSegmentSize=nPos-nDataFieldsStartPos; + nSegmentSize-=nNumberOfDataFields*8; // Structured Field Introducers zaehlen nicht mit + pMET->Seek(nDataFieldsStartPos+16); // Zum Lo-Wort der Segmentgroesse seeken + WriteBigEndianShort((USHORT)(nSegmentSize&0x0000ffff)); // Und schreiben + pMET->Seek(nDataFieldsStartPos+22); // Zum Hi-Wort der Segmentgroesse seeken + WriteBigEndianShort((USHORT)(nSegmentSize>>16)); // Und schreiben + pMET->Seek(nPos); // Zurueck zur Tagesordnung + + //--- Das Feld 'End Graphic Objects': + WriteFieldIntroducer(16,EndGrfObjMagic,0,0); + WriteFieldId(7); + + if( pMET->GetError() ) + bStatus=FALSE; +} + + +void METWriter::WriteResourceGroup(const GDIMetaFile * pMTF) +{ + if( bStatus==FALSE ) + return; + + //--- Das Feld 'Begin Resource Group': + WriteFieldIntroducer(16,BegResGrpMagic,0,0); + WriteFieldId(2); + + //--- Der Inhalt: + WriteColorAttributeTable(); + nActBitmapId=0x77777700; + WriteImageObjects(pMTF); + nActBitmapId=0x77777700; + WriteGraphicsObject(pMTF); + + //--- Das Feld 'End Resource Group': + WriteFieldIntroducer(16,EndResGrpMagic,0,0); + WriteFieldId(2); + + if( pMET->GetError() ) + bStatus=FALSE; +} + + +void METWriter::WriteDocument(const GDIMetaFile * pMTF) +{ + if( bStatus==FALSE ) + return; + + //--- Das Feld 'Begin Document': + WriteFieldIntroducer(0,BegDocumnMagic,0,0); + WriteFieldId(1); + *pMET << (BYTE)0x00 << (BYTE)0x00; + *pMET << (BYTE)0x05 << (BYTE)0x18 << (BYTE)0x03 << (BYTE)0x0c << (BYTE)0x00; + *pMET << (BYTE)0x06 << (BYTE)0x01 << (BYTE)0x03 << (BYTE)0xd4 << (BYTE)0x03 << (BYTE)0x52; + *pMET << (BYTE)0x03 << (BYTE)0x65 << (BYTE)0x00; + UpdateFieldSize(); + + //--- Der Inhalt: + WriteResourceGroup(pMTF); + + //--- Das Feld 'End Document': + WriteFieldIntroducer(16,EndDocumnMagic,0,0); + WriteFieldId(1); + + if( pMET->GetError() ) + bStatus=FALSE; +} + +BOOL METWriter::WriteMET( const GDIMetaFile& rMTF, SvStream& rTargetStream, FilterConfigItem* pFilterConfigItem ) +{ + if ( pFilterConfigItem ) + { + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + METChrSet* pCS; + METGDIStackMember* pGS; + + bStatus=TRUE; + nLastPercent=0; + + pMET=&rTargetStream; + pMET->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + + aPictureRect = Rectangle( Point(), rMTF.GetPrefSize() ); + aTargetMapMode = aPictureMapMode = rMTF.GetPrefMapMode(); + + aGDILineColor=Color( COL_BLACK ); + aGDIFillColor=Color( COL_WHITE ); + eGDIRasterOp=ROP_OVERPAINT; + aGDIFont=Font(); + aGDIMapMode=MapMode(); + aGDIClipRect=Rectangle(); + pGDIStack=NULL; + aMETColor=Color(COL_BLACK); + aMETBackgroundColor=Color(COL_WHITE); + eMETMix=ROP_OVERPAINT; + nMETStrokeLineWidth=1; + aMETChrCellSize=Size(0,0); + nMETChrAngle=0; + nMETChrSet=0x00; + pChrSetList=NULL; + nNextChrSetId=1; + nNumberOfActions=0; + nNumberOfBitmaps=0; + nWrittenActions=0; + nWrittenBitmaps=0; + nActBitmapPercent=0; + + CountActionsAndBitmaps(&rMTF); + + WriteDocument(&rMTF); + + while( pChrSetList ) + { + pCS=pChrSetList; + pChrSetList=pCS->pSucc; + delete pCS; + } + + while( pGDIStack ) + { + pGS=pGDIStack; + pGDIStack=pGS->pSucc; + delete pGS; + } + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return bStatus; +} + +//================== GraphicExport - die exportierte Funktion ================ + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL ) +{ METWriter aMETWriter; + + if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) + return aMETWriter.WriteMET( rGraphic.GetGDIMetaFile(), rStream, pFilterConfigItem ); + else + { + Bitmap aBmp=rGraphic.GetBitmap(); + GDIMetaFile aMTF; + VirtualDevice aVirDev; + + aMTF.Record(&aVirDev); + aVirDev.DrawBitmap(Point(),aBmp); + aMTF.Stop(); + aMTF.SetPrefSize(aBmp.GetSizePixel()); + return aMETWriter.WriteMET( aMTF, rStream, pFilterConfigItem ); + } +} + +//================== GraphicDialog - die exportierte Funktion ================ + +extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "eme" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEMET( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +//================== ein bischen Muell fuer Windows ========================== +#ifndef GCC +#endif + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; // HANDLE der DLL + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/filter/source/graphicfilter/eos2met/eos2mstr.src b/filter/source/graphicfilter/eos2met/eos2mstr.src new file mode 100644 index 000000000000..8afebcb7564c --- /dev/null +++ b/filter/source/graphicfilter/eos2met/eos2mstr.src @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "strings.hrc" + +String KEY_MODE +{ + Text = "ExportMode"; +}; + +String KEY_SIZE +{ + Text = "Size"; +}; diff --git a/filter/source/graphicfilter/eos2met/exports.map b/filter/source/graphicfilter/eos2met/exports.map new file mode 100644 index 000000000000..ce76d3850094 --- /dev/null +++ b/filter/source/graphicfilter/eos2met/exports.map @@ -0,0 +1,8 @@ +METEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/eos2met/makefile.mk b/filter/source/graphicfilter/eos2met/makefile.mk new file mode 100644 index 000000000000..9f8deb74c7ca --- /dev/null +++ b/filter/source/graphicfilter/eos2met/makefile.mk @@ -0,0 +1,74 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=eos2met +TARGET2=eme +DEPTARGET=veos2met + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES= dlgeos2.src \ + eos2mstr.src +.IF "$(L10N_framework)"=="" +SLOFILES = $(SLO)$/eos2met.obj \ + $(SLO)$/dlgeos2.obj +.ENDIF +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" +SHL1TARGET= eme$(DLLPOSTFIX) +SHL1IMPLIB= eos2met +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) + +SHL1LIBS= $(SLB)$/eos2met.lib +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/eos2met.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/eos2met/strings.hrc b/filter/source/graphicfilter/eos2met/strings.hrc new file mode 100644 index 000000000000..7834e3ea2bc0 --- /dev/null +++ b/filter/source/graphicfilter/eos2met/strings.hrc @@ -0,0 +1,29 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_MODE 260 +#define KEY_SIZE 261 + diff --git a/filter/source/graphicfilter/epbm/dlgepbm.cxx b/filter/source/graphicfilter/epbm/dlgepbm.cxx new file mode 100644 index 000000000000..932fb7ff5bb9 --- /dev/null +++ b/filter/source/graphicfilter/epbm/dlgepbm.cxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif + +#include <tools/ref.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <vcl/msgbox.hxx> +#include "dlgepbm.hxx" +#include "dlgepbm.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEPBM::DlgExportEPBM( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPBM, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), + aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), + aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + // Config-Parameter lesen + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PBM" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 1 ); + + BOOL bCheck = FALSE; + if ( !nFormat ) + bCheck ^= TRUE; + + aRBRaw.Check( bCheck ); + bCheck ^= TRUE; + aRBASCII.Check( bCheck ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPBM, OK ) ); +} + +DlgExportEPBM::~DlgExportEPBM() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPBM, OK, void *, EMPTYARG ) +{ + + // Config-Parameter schreiben + sal_Int32 nFormat = 0; + if ( aRBASCII.IsChecked() ) + nFormat++; + pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hrc b/filter/source/graphicfilter/epbm/dlgepbm.hrc new file mode 100644 index 000000000000..876dfa840997 --- /dev/null +++ b/filter/source/graphicfilter/epbm/dlgepbm.hrc @@ -0,0 +1,34 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define GRP_FORMAT 1 +#define RB_RAW 1 +#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hxx b/filter/source/graphicfilter/epbm/dlgepbm.hxx new file mode 100644 index 000000000000..780eac366020 --- /dev/null +++ b/filter/source/graphicfilter/epbm/dlgepbm.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEPBM_HXX_ +#define _DLGEPBM_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> + + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class ResMgr; + +class FilterConfigItem; +class DlgExportEPBM : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + FixedLine aGrpFormat; + RadioButton aRBRaw; + RadioButton aRBASCII; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + +public: + DlgExportEPBM( FltCallDialogParameter& rPara ); + ~DlgExportEPBM(); +}; + +#endif // _DLGEPBM_HXX_ diff --git a/filter/source/graphicfilter/epbm/dlgepbm.src b/filter/source/graphicfilter/epbm/dlgepbm.src new file mode 100644 index 000000000000..b4e6eb2decf2 --- /dev/null +++ b/filter/source/graphicfilter/epbm/dlgepbm.src @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgepbm.hrc" +ModalDialog DLG_EXPORT_EPBM +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 133 , 63 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "PBM Options" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 73 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 73 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 73 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine GRP_FORMAT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "File format"; + }; + RadioButton RB_RAW + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Binary"; + }; + RadioButton RB_ASCII + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Text"; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx new file mode 100644 index 000000000000..fe8dc77fc704 --- /dev/null +++ b/filter/source/graphicfilter/epbm/epbm.cxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/svapp.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/msgbox.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "strings.hrc" +#include "dlgepbm.hrc" +#include "dlgepbm.hxx" + +//============================ PBMWriter ================================== + +class PBMWriter { + +private: + + SvStream* mpOStm; // Die auszugebende PBM-Datei + USHORT mpOStmOldModus; + + BOOL mbStatus; + sal_Int32 mnMode; // 0 -> raw, 1-> ascii + BitmapReadAccess* mpAcc; + ULONG mnWidth, mnHeight; // Bildausmass in Pixeln + + BOOL ImplWriteHeader(); + void ImplWriteBody(); + void ImplWriteNumber( sal_Int32 ); + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + +public: + PBMWriter(); + ~PBMWriter(); + + BOOL WritePBM( const Graphic& rGraphic, SvStream& rPBM, FilterConfigItem* pFilterConfigItem ); +}; + +//=================== Methoden von PBMWriter ============================== + +PBMWriter::PBMWriter() : + mbStatus ( TRUE ), + mpAcc ( NULL ) +{ +} + +// ------------------------------------------------------------------------ + +PBMWriter::~PBMWriter() +{ +} + +// ------------------------------------------------------------------------ + +BOOL PBMWriter::WritePBM( const Graphic& rGraphic, SvStream& rPBM, FilterConfigItem* pFilterConfigItem ) +{ + + mpOStm = &rPBM; + + if ( pFilterConfigItem ) + { + mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 ); + + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + Bitmap aBmp = aBmpEx.GetBitmap(); + aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); + + mpOStmOldModus = mpOStm->GetNumberFormatInt(); + mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); + + mpAcc = aBmp.AcquireReadAccess(); + if( mpAcc ) + { + if ( ImplWriteHeader() ) + ImplWriteBody(); + + aBmp.ReleaseAccess( mpAcc ); + } + else + mbStatus = FALSE; + + mpOStm->SetNumberFormatInt( mpOStmOldModus ); + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return mbStatus; +} + +// ------------------------------------------------------------------------ + +BOOL PBMWriter::ImplWriteHeader() +{ + mnWidth = mpAcc->Width(); + mnHeight = mpAcc->Height(); + if ( mnWidth && mnHeight ) + { + if ( mnMode == 0 ) + *mpOStm << "P4\x0a"; + else + *mpOStm << "P1\x0a"; + + ImplWriteNumber( mnWidth ); + *mpOStm << (BYTE)32; + ImplWriteNumber( mnHeight ); + *mpOStm << (BYTE)10; + } + else mbStatus = FALSE; + return mbStatus; +} + +// ------------------------------------------------------------------------ + +void PBMWriter::ImplWriteBody() +{ + if ( mnMode == 0 ) + { + BYTE nBYTE = 0; + for ( ULONG y = 0; y < mnHeight; y++ ) + { + ULONG x; + for ( x = 0; x < mnWidth; x++ ) + { + nBYTE <<= 1; + if (!(mpAcc->GetPixel( y, x ) & 1 ) ) + nBYTE++; + if ( ( x & 7 ) == 7 ) + *mpOStm << nBYTE; + } + if ( ( x & 7 ) != 0 ) + *mpOStm << (BYTE)( nBYTE << ( ( x ^ 7 ) + 1 ) ); + } + } + else + { + int nxCount; + for ( ULONG y = 0; y < mnHeight; y++ ) + { + nxCount = 70; + for ( ULONG x = 0; x < mnWidth; x++ ) + { + if (!( --nxCount ) ) + { + nxCount = 69; + *mpOStm << (BYTE)10; + } + *mpOStm << (BYTE)( ( mpAcc->GetPixel( y, x ) ^ 1 ) + '0' ) ; + } + *mpOStm << (BYTE)10; + } + } +} + +// ------------------------------------------------------------------------ +// eine Dezimalzahl im ASCII format wird in den Stream geschrieben + +void PBMWriter::ImplWriteNumber( sal_Int32 nNumber ) +{ + const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); + + for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ ) + *mpOStm << aNum.GetChar( n ); + +} + +// ------------------------------------------------------------------------ + +// --------------------- +// - exported function - +// --------------------- + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL ) +{ + PBMWriter aPBMWriter; + + return aPBMWriter.WritePBM( rGraphic, rStream, pFilterConfigItem ); +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "epb" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEPBM( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +// ------------------------------------------------------------------------ +#ifndef GCC +#endif + +// --------------- +// - Win16 trash - +// --------------- + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ + if ( nHeap ) + UnlockData( 0 ); + + hDLLInst = hDLL; + + return TRUE; +} + +// ------------------------------------------------------------------------ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/filter/source/graphicfilter/epbm/epbmstr.src b/filter/source/graphicfilter/epbm/epbmstr.src new file mode 100644 index 000000000000..8424505dbcd1 --- /dev/null +++ b/filter/source/graphicfilter/epbm/epbmstr.src @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "strings.hrc" + +// Key fuer den Dialog +String KEY_FORMAT +{ + Text = "FileFormat"; +}; diff --git a/filter/source/graphicfilter/epbm/exports.map b/filter/source/graphicfilter/epbm/exports.map new file mode 100644 index 000000000000..2d09b0bdb752 --- /dev/null +++ b/filter/source/graphicfilter/epbm/exports.map @@ -0,0 +1,8 @@ +PBMEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/epbm/makefile.mk b/filter/source/graphicfilter/epbm/makefile.mk new file mode 100644 index 000000000000..3b248222cda1 --- /dev/null +++ b/filter/source/graphicfilter/epbm/makefile.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=epbm +TARGET2=epb +DEPTARGET=vepbm + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES= dlgepbm.src \ + epbmstr.src +.IF "$(L10N_framework)"=="" +SLOFILES = $(SLO)$/epbm.obj \ + $(SLO)$/dlgepbm.obj +.ENDIF +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" +SHL1TARGET= epb$(DLLPOSTFIX) +SHL1IMPLIB= epbm +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) + +SHL1LIBS= $(SLB)$/epbm.lib + +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/epbm.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/epbm/strings.hrc b/filter/source/graphicfilter/epbm/strings.hrc new file mode 100644 index 000000000000..122719e87d4b --- /dev/null +++ b/filter/source/graphicfilter/epbm/strings.hrc @@ -0,0 +1,27 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/epgm/dlgepgm.cxx b/filter/source/graphicfilter/epgm/dlgepgm.cxx new file mode 100644 index 000000000000..3aa960b25a26 --- /dev/null +++ b/filter/source/graphicfilter/epgm/dlgepgm.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif + +#include <tools/ref.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <vcl/msgbox.hxx> +#include "dlgepgm.hxx" +#include "dlgepgm.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEPGM::DlgExportEPGM( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPGM, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), + aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), + aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + // Config-Parameter lesen + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PGM" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 ); + + BOOL bCheck = FALSE; + if ( !nFormat ) + bCheck ^= TRUE; + aRBRaw.Check( bCheck ); + bCheck ^= TRUE; + aRBASCII.Check( bCheck ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPGM, OK ) ); +} + +DlgExportEPGM::~DlgExportEPGM() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPGM, OK, void *, EMPTYARG ) +{ + // Config-Parameter schreiben + sal_Int32 nFormat = 0; + if ( aRBASCII.IsChecked() ) + nFormat++; + pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hrc b/filter/source/graphicfilter/epgm/dlgepgm.hrc new file mode 100644 index 000000000000..876dfa840997 --- /dev/null +++ b/filter/source/graphicfilter/epgm/dlgepgm.hrc @@ -0,0 +1,34 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define GRP_FORMAT 1 +#define RB_RAW 1 +#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hxx b/filter/source/graphicfilter/epgm/dlgepgm.hxx new file mode 100644 index 000000000000..3eb91bdb5fc6 --- /dev/null +++ b/filter/source/graphicfilter/epgm/dlgepgm.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEPGM_HXX_ +#define _DLGEPGM_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> + + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEPGM : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + FixedLine aGrpFormat; + RadioButton aRBRaw; + RadioButton aRBASCII; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + +public: + DlgExportEPGM( FltCallDialogParameter& rPara ); + ~DlgExportEPGM(); +}; + +#endif // _DLGEPGM_HXX_ diff --git a/filter/source/graphicfilter/epgm/dlgepgm.src b/filter/source/graphicfilter/epgm/dlgepgm.src new file mode 100644 index 000000000000..39e91d29fdf5 --- /dev/null +++ b/filter/source/graphicfilter/epgm/dlgepgm.src @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgepgm.hrc" +ModalDialog DLG_EXPORT_EPGM +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 133 , 63 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "PGM Options" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 73 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 73 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 73 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine GRP_FORMAT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "File format"; + }; + RadioButton RB_RAW + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Binary"; + }; + RadioButton RB_ASCII + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Text"; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx new file mode 100644 index 000000000000..89fbc9929ab0 --- /dev/null +++ b/filter/source/graphicfilter/epgm/epgm.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/svapp.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/msgbox.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "strings.hrc" +#include "dlgepgm.hrc" +#include "dlgepgm.hxx" + +//============================ PGMWriter ================================== + +class PGMWriter { + +private: + + SvStream* mpOStm; // Die auszugebende PGM-Datei + USHORT mpOStmOldModus; + + BOOL mbStatus; + UINT32 mnMode; + BitmapReadAccess* mpAcc; + ULONG mnWidth, mnHeight; // Bildausmass in Pixeln + + BOOL ImplWriteHeader(); + void ImplWriteBody(); + void ImplWriteNumber( sal_Int32 ); + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + +public: + PGMWriter(); + ~PGMWriter(); + + BOOL WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem ); +}; + +//=================== Methoden von PGMWriter ============================== + +PGMWriter::PGMWriter() : + mbStatus ( TRUE ), + mpAcc ( NULL ) +{ +} + +// ------------------------------------------------------------------------ + +PGMWriter::~PGMWriter() +{ +} + +// ------------------------------------------------------------------------ + +BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, FilterConfigItem* pFilterConfigItem ) +{ + + mpOStm = &rPGM; + + if ( pFilterConfigItem ) + { + mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 ); + + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + Bitmap aBmp = aBmpEx.GetBitmap(); + aBmp.Convert( BMP_CONVERSION_8BIT_GREYS ); + + mpOStmOldModus = mpOStm->GetNumberFormatInt(); + mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); + + mpAcc = aBmp.AcquireReadAccess(); + if( mpAcc ) + { + if ( ImplWriteHeader() ) + { + ImplWriteBody(); + } + aBmp.ReleaseAccess( mpAcc ); + } + else + mbStatus = FALSE; + + mpOStm->SetNumberFormatInt( mpOStmOldModus ); + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return mbStatus; +} + +// ------------------------------------------------------------------------ + +BOOL PGMWriter::ImplWriteHeader() +{ + mnWidth = mpAcc->Width(); + mnHeight = mpAcc->Height(); + if ( mnWidth && mnHeight ) + { + if ( mnMode == 0 ) + *mpOStm << "P5\x0a"; + else + *mpOStm << "P2\x0a"; + + ImplWriteNumber( mnWidth ); + *mpOStm << (BYTE)32; + ImplWriteNumber( mnHeight ); + *mpOStm << (BYTE)32; + ImplWriteNumber( 255 ); // max. gray value + *mpOStm << (BYTE)10; + } + else + mbStatus = FALSE; + + return mbStatus; +} + +// ------------------------------------------------------------------------ + +void PGMWriter::ImplWriteBody() +{ + if ( mnMode == 0 ) + { + for ( ULONG y = 0; y < mnHeight; y++ ) + { + for ( ULONG x = 0; x < mnWidth; x++ ) + { + *mpOStm << (BYTE)( mpAcc->GetPixel( y, x ) ); + } + } + } + else + { + for ( ULONG y = 0; y < mnHeight; y++ ) + { + int nCount = 70; + for ( ULONG x = 0; x < mnWidth; x++ ) + { + BYTE nDat, nNumb; + if ( nCount < 0 ) + { + nCount = 69; + *mpOStm << (BYTE)10; + } + nDat = (BYTE)mpAcc->GetPixel( y, x ); + nNumb = nDat / 100; + if ( nNumb ) + { + *mpOStm << (BYTE)( nNumb + '0' ); + nDat -= ( nNumb * 100 ); + nNumb = nDat / 10; + *mpOStm << (BYTE)( nNumb + '0' ); + nDat -= ( nNumb * 10 ); + *mpOStm << (BYTE)( nDat + '0' ); + nCount -= 4; + } + else + { + nNumb = nDat / 10; + if ( nNumb ) + { + *mpOStm << (BYTE)( nNumb + '0' ); + nDat -= ( nNumb * 10 ); + *mpOStm << (BYTE)( nDat + '0' ); + nCount -= 3; + } + else + { + *mpOStm << (BYTE)( nDat + '0' ); + nCount -= 2; + } + } + *mpOStm << (BYTE)' '; + } + *mpOStm << (BYTE)10; + } + } +} + +// ------------------------------------------------------------------------ +// eine Dezimalzahl im ASCII format wird in den Stream geschrieben + +void PGMWriter::ImplWriteNumber( sal_Int32 nNumber ) +{ + const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); + + for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; n++ ) + *mpOStm << aNum.GetChar( n ); + +} + +// ------------------------------------------------------------------------ + +// --------------------- +// - exported function - +// --------------------- + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL ) +{ + PGMWriter aPGMWriter; + + return aPGMWriter.WritePGM( rGraphic, rStream, pFilterConfigItem ); +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "epg" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEPGM( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +// ------------------------------------------------------------------------ +#ifndef GCC +#endif + +// --------------- +// - Win16 trash - +// --------------- + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ + if ( nHeap ) + UnlockData( 0 ); + + hDLLInst = hDLL; + + return TRUE; +} + +// ------------------------------------------------------------------------ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/filter/source/graphicfilter/epgm/epgmstr.src b/filter/source/graphicfilter/epgm/epgmstr.src new file mode 100644 index 000000000000..8424505dbcd1 --- /dev/null +++ b/filter/source/graphicfilter/epgm/epgmstr.src @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "strings.hrc" + +// Key fuer den Dialog +String KEY_FORMAT +{ + Text = "FileFormat"; +}; diff --git a/filter/source/graphicfilter/epgm/exports.map b/filter/source/graphicfilter/epgm/exports.map new file mode 100644 index 000000000000..3967c4684f05 --- /dev/null +++ b/filter/source/graphicfilter/epgm/exports.map @@ -0,0 +1,8 @@ +PGMEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/epgm/makefile.mk b/filter/source/graphicfilter/epgm/makefile.mk new file mode 100644 index 000000000000..70ab5ec93c68 --- /dev/null +++ b/filter/source/graphicfilter/epgm/makefile.mk @@ -0,0 +1,76 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=epgm +TARGET2=epg +DEPTARGET=vepgm + + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES= dlgepgm.src \ + epgmstr.src +.IF "$(L10N_framework)"=="" +SLOFILES = $(SLO)$/epgm.obj \ + $(SLO)$/dlgepgm.obj +.ENDIF +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" +SHL1TARGET= epg$(DLLPOSTFIX) +SHL1IMPLIB= epgm +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) + +SHL1LIBS= $(SLB)$/epgm.lib + +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/epgm.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/epgm/strings.hrc b/filter/source/graphicfilter/epgm/strings.hrc new file mode 100644 index 000000000000..122719e87d4b --- /dev/null +++ b/filter/source/graphicfilter/epgm/strings.hrc @@ -0,0 +1,27 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/epict/dlgepct.cxx b/filter/source/graphicfilter/epict/dlgepct.cxx new file mode 100644 index 000000000000..c274dc873560 --- /dev/null +++ b/filter/source/graphicfilter/epict/dlgepct.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif + +#include <vcl/msgbox.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <com/sun/star/awt/Size.hpp> +#include "dlgepct.hxx" +#include "dlgepct.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEPCT::DlgExportEPCT( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPCT, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ), + aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ), + aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), + aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), + aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ), + aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), + aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ), + aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PCT" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPCT, OK ) ); + aRbOriginal.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbOriginal ) ); + aRbSize.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbSize ) ); + + // Config-Parameter lesen + sal_Int32 nStrMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); + ::com::sun::star::awt::Size aDefault( 10000, 10000 ); + ::com::sun::star::awt::Size aSize; + aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); + + aMtfSizeX.SetDefaultUnit( FUNIT_MM ); + aMtfSizeY.SetDefaultUnit( FUNIT_MM ); + aMtfSizeX.SetValue( aSize.Width ); + aMtfSizeY.SetValue( aSize.Height ); + + switch ( rPara.eFieldUnit ) + { + case FUNIT_NONE : + case FUNIT_KM : + case FUNIT_PERCENT : + case FUNIT_CUSTOM : + case FUNIT_MILE : + case FUNIT_FOOT : + case FUNIT_M : + break; // -Wall not handled. + case FUNIT_MM : + case FUNIT_CM : + case FUNIT_TWIP : + case FUNIT_POINT : + case FUNIT_PICA : + case FUNIT_INCH : + case FUNIT_100TH_MM : + { + aMtfSizeX.SetUnit( rPara.eFieldUnit ); + aMtfSizeY.SetUnit( rPara.eFieldUnit ); + } + break; + } + if ( nStrMode == 1 ) + { + aRbSize.Check( TRUE ); + ClickRbSize( NULL ); + } + else + { + aRbOriginal.Check( TRUE ); + ClickRbOriginal( NULL ); + } +} + +DlgExportEPCT::~DlgExportEPCT() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\**************************************** ********************************/ + +IMPL_LINK( DlgExportEPCT, OK, void *, EMPTYARG ) +{ + // Config-Parameter schreiben + ::com::sun::star::awt::Size aSize( + (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ), + (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) ); + + sal_Int32 nStrMode = 0; + if ( aRbSize.IsChecked() ) + nStrMode++; + + pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode ); + pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} + +/************************************************************************* +|* +|* Enabled/Disabled Controls +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPCT, ClickRbOriginal, void*, EMPTYARG ) +{ + aGrpSize.Disable(); + aFtSizeX.Disable(); + aMtfSizeX.Disable(); + aFtSizeY.Disable(); + aMtfSizeY.Disable(); + + return 0; +} + + +/************************************************************************* +|* +|* Enabled/Disabled Controls +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPCT, ClickRbSize, void*, EMPTYARG ) +{ + aGrpSize.Enable(); + aFtSizeX.Enable(); + aMtfSizeX.Enable(); + aFtSizeY.Enable(); + aMtfSizeY.Enable(); + + return 0; +} + + + diff --git a/filter/source/graphicfilter/epict/dlgepct.hrc b/filter/source/graphicfilter/epict/dlgepct.hrc new file mode 100644 index 000000000000..0f92aa9bda3c --- /dev/null +++ b/filter/source/graphicfilter/epict/dlgepct.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <filter.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define CBX_SIZE 2 +#define MTF_SIZEX 1 +#define MTF_SIZEY 2 +#define FT_SIZEX 1 +#define FT_SIZEY 2 +#define GRP_SIZE 1 +#define GRP_MODE 2 +#define RB_ORIGINAL 1 +#define RB_SIZE 2 + diff --git a/filter/source/graphicfilter/epict/dlgepct.hxx b/filter/source/graphicfilter/epict/dlgepct.hxx new file mode 100644 index 000000000000..e879822ab1f5 --- /dev/null +++ b/filter/source/graphicfilter/epict/dlgepct.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEPCT_HXX_ +#define _DLGEPCT_HXX_ + +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/fltcall.hxx> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEPCT : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + RadioButton aRbOriginal; + RadioButton aRbSize; + FixedLine aGrpMode; + + FixedText aFtSizeX; + MetricField aMtfSizeX; + FixedText aFtSizeY; + MetricField aMtfSizeY; + FixedLine aGrpSize; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void* p ); + DECL_LINK( ClickRbOriginal,void* p ); + DECL_LINK( ClickRbSize,void* p ); + +public: + DlgExportEPCT( FltCallDialogParameter& rPara ); + ~DlgExportEPCT(); +}; + +#endif // _DLGEPCT_HXX_ + diff --git a/filter/source/graphicfilter/epict/dlgepct.src b/filter/source/graphicfilter/epict/dlgepct.src new file mode 100644 index 000000000000..d503c53cf89c --- /dev/null +++ b/filter/source/graphicfilter/epict/dlgepct.src @@ -0,0 +1,163 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgepct.hrc" + +ModalDialog DLG_EXPORT_EPCT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 178 , 89 ) ; + Text [ en-US ] = "PICT Options" ; + Moveable = TRUE ; + Closeable = TRUE ; + MetricField MTF_SIZEX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 55 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 100 ; + Maximum = 99999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 100 ; + Last = 99999 ; + SpinSize = 100 ; + }; + MetricField MTF_SIZEY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 60 , 71 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 100 ; + Maximum = 99999 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_MM ; + First = 100 ; + Last = 99999 ; + SpinSize = 100 ; + }; + FixedLine GRP_SIZE + { + Pos = MAP_APPFONT ( 6 , 44 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_SIZEX + { + Pos = MAP_APPFONT ( 12 , 57 ) ; + Size = MAP_APPFONT ( 45 , 8 ) ; + Text [ en-US ] = "Width" ; + }; + FixedText FT_SIZEY + { + Pos = MAP_APPFONT ( 12 , 73 ) ; + Size = MAP_APPFONT ( 45 , 8 ) ; + Text [ en-US ] = "Height" ; + }; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 122 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 122 , 24 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 122 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + RadioButton RB_ORIGINAL + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 98 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Original" ; + }; + RadioButton RB_SIZE + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 98 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Size" ; + }; + FixedLine GRP_MODE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx new file mode 100644 index 000000000000..7e81077e3810 --- /dev/null +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -0,0 +1,2387 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/metaact.hxx> +#include <svtools/filter.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> + +#include <math.h> +#include <vcl/bmpacc.hxx> +#include <vcl/metaact.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/gradient.hxx> +#include <vcl/hatch.hxx> +#include <vcl/metric.hxx> +#include <vcl/font.hxx> +#include <vcl/virdev.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/gdimtf.hxx> + +#include <tools/bigint.hxx> +#include "strings.hrc" +#include "dlgepct.hrc" +#include "dlgepct.hxx" + +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +//============================== PictWriter =================================== + +struct PictWriterAttrStackMember { + struct PictWriterAttrStackMember * pSucc; + Color aLineColor; + Color aFillColor; + RasterOp eRasterOp; + Font aFont; + MapMode aMapMode; + Rectangle aClipRect; +}; + + +enum PictDrawingMethod { + PDM_FRAME, PDM_PAINT, PDM_ERASE, PDM_INVERT, PDM_FILL +}; + + +struct PictPattern { + sal_uInt32 nLo, nHi; +}; + +class PictWriter { + +private: + + BOOL bStatus; + ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde. + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + + SvStream * pPict; + + // Aktuelle Attribute im Quell-Metafile: + Color aLineColor; + Color aFillColor; + RasterOp eSrcRasterOp; + Font aSrcFont; + MapMode aSrcMapMode; + MapMode aTargetMapMode; + Rectangle aClipRect; + PictWriterAttrStackMember * pAttrStack; + + // Aktuelle Attribute im Ziel-Metafile, und ob sie gueltig sind + BOOL bDstBkPatVisible; BOOL bDstBkPatValid; + BYTE nDstTxFace; BOOL bDstTxFaceValid; + RasterOp eDstTxMode; BOOL bDstTxModeValid; + USHORT nDstPnSize; BOOL bDstPnSizeValid; + RasterOp eDstPnMode; BOOL bDstPnModeValid; + PictPattern aDstPnPat; BOOL bDstPnPatValid; + BOOL bDstFillPatVisible; BOOL bDstFillPatValid; + USHORT nDstTxSize; BOOL bDstTxSizeValid; + Color aDstFgCol; BOOL bDstFgColValid; + Color aDstBkCol; BOOL bDstBkColValid; + Point aDstPenPosition; BOOL bDstPenPositionValid; + Point aDstTextPosition; BOOL bDstTextPositionValid; + String aDstFontName; USHORT nDstFontNameId; BOOL bDstFontNameValid; + + ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile + ULONG nNumberOfBitmaps; // Anzahl der Bitmaps + ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Opcodes + ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps + ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist. + + void MayCallback(); + // Berechnet anhand der obigen 5 Parameter eine Prozentzahl + // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen + // moechte. + + void CountActionsAndBitmaps(const GDIMetaFile & rMTF); + // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen + // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist) + + Polygon PolyPolygonToPolygon(const PolyPolygon & rPoly); + // Macht aus einem PolyPolygon ein halbwegs vernuenftiges Polygon + + Rectangle MapRectangle( const Rectangle& rRect ); + void WritePoint(const Point & rPoint); + void WriteSize(const Size & rSize); + void WriteRGBColor(const Color & rColor); + void WriteString( const String & rString ); + void WriteRectangle(const Rectangle & rRect); + void WritePolygon(const Polygon & rPoly); + void WriteArcAngles(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt); + + void ConvertLinePattern(PictPattern & rPat, BOOL bVisible); + void ConvertFillPattern(PictPattern & rPat, BOOL bVisible); + + void WriteOpcode_TxFace(const Font & rFont); + void WriteOpcode_TxMode(RasterOp eMode); + void WriteOpcode_PnSize(USHORT nSize); + void WriteOpcode_PnMode(RasterOp eMode); + void WriteOpcode_PnLinePat(BOOL bVisible); + void WriteOpcode_PnFillPat(BOOL bVisible); + void WriteOpcode_OvSize(const Size & rSize); + void WriteOpcode_TxSize(USHORT nSize); + void WriteOpcode_RGBFgCol(const Color & rColor); + void WriteOpcode_RGBBkCol(const Color & rColor); + void WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt); + void WriteOpcode_LineFrom(const Point & rNewPt); + void WriteOpcode_Text(const Point & rPoint, const String& rString, BOOL bDelta); + void WriteOpcode_FontName(const Font & rFont); + void WriteOpcode_ClipRect( const Rectangle& rRect ); + void WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect); + void WriteOpcode_SameRect(PictDrawingMethod eMethod); + void WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect); + void WriteOpcode_SameRRect(PictDrawingMethod eMethod); + void WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect); + void WriteOpcode_SameOval(PictDrawingMethod eMethod); + void WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect, + const Point & rStartPt, const Point & rEndPt); + void WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect, + const Point & rStartPt, const Point & rEndPt); + void WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly); + void WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap); + void WriteOpcode_EndOfFile(); + + void SetAttrForPaint(); + void SetAttrForFrame(); + void SetAttrForText(); + + void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry); + + void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); + void WriteOpcodes(const GDIMetaFile & rMTF); + + void WriteHeader(const GDIMetaFile & rMTF); + void UpdateHeader(); + +public: + + BOOL WritePict( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem ); +}; + + +//========================== Methoden von PictWriter ========================== + + +void PictWriter::MayCallback() +{ + if ( xStatusIndicator.is() ) + { + ULONG nPercent; + nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions) + *100 + /((nNumberOfBitmaps<<14)+nNumberOfActions); + + if (nPercent>=nLastPercent+3) + { + nLastPercent=nPercent; + if( nPercent<=100 ) + xStatusIndicator->setValue( nPercent ); + } + } +} + +void PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF) +{ + ULONG nAction, nActionCount; + const MetaAction* pMA; + + nActionCount = rMTF.GetActionCount(); + + for (nAction=0; nAction<nActionCount; nAction++) + { + pMA = rMTF.GetAction( nAction ); + + switch( pMA->GetType() ) + { + case META_BMP_ACTION: + case META_BMPSCALE_ACTION: + case META_BMPSCALEPART_ACTION: + case META_BMPEX_ACTION: + case META_BMPEXSCALE_ACTION: + case META_BMPEXSCALEPART_ACTION: + nNumberOfBitmaps++; + break; + } + + nNumberOfActions++; + } +} + + +Polygon PictWriter::PolyPolygonToPolygon(const PolyPolygon & rPolyPoly) +{ + USHORT nCount,nSize1,nSize2,np,i1,i2,i3,nBestIdx1,nBestIdx2; + long nDistSqr,nBestDistSqr, nCountdownTests; + Point aP1,aPRel; + Polygon aPoly1, aPoly2, aPoly3; + + nCount=rPolyPoly.Count(); + if (nCount==0) return Polygon(0); + + aPoly1=rPolyPoly.GetObject(0); + for (np=1; np<nCount; np++) { + aPoly2=rPolyPoly.GetObject(np); + + //-----------------Folgendes verschmilzt aPoly1 und aPoly2 zu aPoly1----------------- + + nSize1=aPoly1.GetSize(); + nSize2=aPoly2.GetSize(); + + // Zunaechst werden ein Punkt in aPoly1 (referenziert durch nBestIdx1) und ein + // Punkt in aPoly2 (referenziert durch nBestIdx2) gesucht, die moeglichst dicht + // beieinander liegen. Da dies mit quadratischem Aufwand einher geht, und somit + // manche Bilder Ewigkeiten benoetigen, um exportiert zu werden, begrenzen wir + // die Anzahl der Tests auf 1000, und brechen die Suche ggf. schon vorher ab. + // Dadruch wird das Ergebnis nicht falsch, sondern eventuell nicht so schoen. + nCountdownTests=1000; + nBestDistSqr=0x7fffffff; + nBestIdx1=0; + nBestIdx2=0; + for (i1=0; i1<nSize1; i1++) { + aP1=aPoly1.GetPoint(i1); + for (i2=0; i2<nSize2; i2++) { + aPRel=aPoly2.GetPoint(i2); aPRel-=aP1; + nDistSqr=aPRel.X()*aPRel.X()+aPRel.Y()*aPRel.Y(); + if (nDistSqr<nBestDistSqr) { + nBestIdx1=i1; + nBestIdx2=i2; + nBestDistSqr=nDistSqr; + } + if (nCountdownTests<=0) break; + nCountdownTests--; + } + if (nCountdownTests<=0) break; + } + + // Nun werden aPoly1 und aPoly2 zu einem Polygon aPoly3 (spaeter aPoly1) zusammengefuegt. + // Die beiden Polygone werden verbunden durch zwei zusaetzliche Kanten zwischen den oben + // gefundenen Punkten. + aPoly3.Clear(); + aPoly3.SetSize(nSize1+nSize2+2); + i3=0; + for (i1=nBestIdx1; i1<nSize1; i1++) aPoly3.SetPoint(aPoly1.GetPoint(i1),i3++); + for (i1=0; i1<=nBestIdx1; i1++) aPoly3.SetPoint(aPoly1.GetPoint(i1),i3++); + for (i2=nBestIdx2; i2<nSize2; i2++) aPoly3.SetPoint(aPoly2.GetPoint(i2),i3++); + for (i2=0; i2<=nBestIdx2; i2++) aPoly3.SetPoint(aPoly2.GetPoint(i2),i3++); + + aPoly1=aPoly3; + + //----------------------------------------------------------------------------------- + + } + return aPoly1; +} + + +void PictWriter::WritePoint(const Point & rPoint) +{ + Point aPoint = OutputDevice::LogicToLogic( rPoint, aSrcMapMode, aTargetMapMode ); + *pPict << ((short)aPoint.Y()) << ((short)aPoint.X()); +} + + +void PictWriter::WriteSize(const Size & rSize) +{ + OutputDevice::LogicToLogic( rSize, aSrcMapMode, aTargetMapMode ); // -Wall is this needed. + *pPict << ((short)rSize.Height()) << ((short)rSize.Width()); +} + + +void PictWriter::WriteRGBColor(const Color & rColor) +{ + const UINT16 nR = ( (UINT16) rColor.GetRed() << 8 ) | (UINT16) rColor.GetRed(); + const UINT16 nG = ( (UINT16) rColor.GetGreen() << 8 ) | (UINT16) rColor.GetGreen(); + const UINT16 nB = ( (UINT16) rColor.GetBlue() << 8 ) | (UINT16) rColor.GetBlue(); + + *pPict << nR << nG << nB; +} + + +void PictWriter::WriteString( const String & rString ) +{ + USHORT i,nLen; + + ByteString aByteString( rString, gsl_getSystemTextEncoding() ); + nLen = aByteString.Len(); + if ( nLen > 255 ) + nLen = 255; + *pPict << ( (BYTE)nLen ); + for ( i = 0; i < nLen; i++ ) + *pPict << aByteString.GetChar( i ); +} + +Rectangle PictWriter::MapRectangle( const Rectangle& rRect ) +{ + Point aPoint = OutputDevice::LogicToLogic( rRect.TopLeft(), aSrcMapMode, aTargetMapMode ); + Size aSize = OutputDevice::LogicToLogic( rRect.GetSize(), aSrcMapMode, aTargetMapMode ); + Rectangle aRect( aPoint, aSize ); + aRect.Justify(); + aRect.nBottom++; + aRect.nRight++; + return aRect; +} + +void PictWriter::WriteRectangle(const Rectangle & rRect) +{ + Rectangle aRect( MapRectangle( rRect ) ); + *pPict << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left() + << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right(); +} + +void PictWriter::WritePolygon(const Polygon & rPoly) +{ + USHORT nDataSize,i,nSize; + short nMinX = 0, nMinY = 0, nMaxX = 0, nMaxY = 0; + short nx,ny; + Polygon aPoly(rPoly); + + nSize=aPoly.GetSize(); + + if (aPoly.GetPoint(0) != aPoly.GetPoint(nSize-1)) + { + nSize++; + aPoly.SetSize(nSize); + aPoly.SetPoint(aPoly.GetPoint(0),nSize-1); + } + + nDataSize=nSize*4+10; + for (i=0; i<nSize; i++) + { + Point aPoint = OutputDevice::LogicToLogic( aPoly.GetPoint( i ), + aSrcMapMode, + aTargetMapMode ); + + nx = (short) aPoint.X(); + ny = (short) aPoint.Y(); + + if ( i==0 || nMinX>nx ) + nMinX=nx; + if ( i==0 || nMinY>ny ) + nMinY=ny; + if ( i==0 || nMaxX<nx ) + nMaxX=nx; + if ( i==0 || nMaxY<ny ) + nMaxY=ny; + } + + *pPict << nDataSize << nMinY << nMinX << nMaxY << nMaxX; + + for (i=0; i<nSize; i++) + WritePoint( aPoly.GetPoint(i) ); +} + + +void PictWriter::WriteArcAngles(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt) +{ + Point aStartPt = OutputDevice::LogicToLogic( rStartPt, + aSrcMapMode, + aTargetMapMode ); + Point aEndPt = OutputDevice::LogicToLogic( rEndPt, + aSrcMapMode, + aTargetMapMode ); + Rectangle aRect( OutputDevice::LogicToLogic( rRect.TopLeft(), + aSrcMapMode, + aTargetMapMode ), + OutputDevice::LogicToLogic( rRect.GetSize(), + aSrcMapMode, + aTargetMapMode ) ); + Point aCenter; + double fAngS, fAngE, fdx, fdy; + short nStartAngle, nArcAngle; + + + aCenter=Point( ( aRect.Left() + aRect.Right() ) >> 1, + ( aRect.Top() + aRect.Bottom() ) >> 1 ); + + fdx=(double)(aStartPt.X()-aCenter.X()); + fdy=(double)(aStartPt.Y()-aCenter.Y()); + if ( fdx==0.0 && fdy==0.0 ) + fdx=1.0; + fAngE=atan2(fdx,-fdy); + + fdx=(double)(aEndPt.X()-aCenter.X()); + fdy=(double)(aEndPt.Y()-aCenter.Y()); + if ( fdx==0.0 && fdy==0.0 ) + fdx=1.0; + fAngS=atan2(fdx,-fdy); + + nStartAngle=(short)(fAngS*180.0/3.14159265359); + nArcAngle=((short)(fAngE*180.0/3.14159265359))-nStartAngle; + if (nArcAngle<0) + nArcAngle += 360; + *pPict << nStartAngle << nArcAngle; +} + + +void PictWriter::ConvertLinePattern(PictPattern & rPat, BOOL bVisible) +{ + if( bVisible ) + { + rPat.nHi=0xffffffff; + rPat.nLo=0xffffffff; + } + else + { + rPat.nHi=0x00000000; + rPat.nLo=0x00000000; + } +} + +void PictWriter::ConvertFillPattern(PictPattern & rPat, BOOL bVisible) +{ + if( bVisible ) + { + rPat.nHi=0xffffffff; + rPat.nLo=0xffffffff; + } + else + { + rPat.nHi=0x00000000; + rPat.nLo=0x00000000; + } +} + + +void PictWriter::WriteOpcode_TxFace(const Font & rFont) +{ + BYTE nFace; + FontWeight eWeight; + + nFace=0; + eWeight=rFont.GetWeight(); + if (eWeight==WEIGHT_BOLD || + eWeight==WEIGHT_SEMIBOLD || + eWeight==WEIGHT_ULTRABOLD || + eWeight==WEIGHT_BLACK) nFace|=0x01; + if (rFont.GetItalic()!=ITALIC_NONE) nFace|=0x02; + if (rFont.GetUnderline()!=UNDERLINE_NONE) nFace|=0x04; + if (rFont.IsOutline()==TRUE) nFace|=0x08; + if (rFont.IsShadow()==TRUE) nFace|=0x10; + + if (bDstTxFaceValid==FALSE || nDstTxFace!=nFace) { + *pPict << (USHORT)0x0004 << nFace << (BYTE)0; + nDstTxFace=nFace; + bDstTxFaceValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_TxMode(RasterOp eMode) +{ + USHORT nVal; + + if (bDstTxModeValid==FALSE || eDstTxMode!=eMode) { + switch (eMode) { + case ROP_INVERT: nVal=0x000c; break; + case ROP_XOR: nVal=0x000a; break; + default: nVal=0x0008; + } + *pPict << (USHORT)0x0005 << nVal; + eDstTxMode=eMode; + bDstTxModeValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_PnSize(USHORT nSize) +{ + if (nSize==0) nSize=1; + if (bDstPnSizeValid==FALSE || nDstPnSize!=nSize) { + *pPict << (USHORT)0x0007 << nSize << nSize; + nDstPnSize=nSize; + bDstPnSizeValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_PnMode(RasterOp eMode) +{ + USHORT nVal; + + if (bDstPnModeValid==FALSE || eDstPnMode!=eMode) { + switch (eMode) + { + case ROP_INVERT: nVal=0x000c; break; + case ROP_XOR: nVal=0x000a; break; + default: nVal=0x0008; + } + *pPict << (USHORT)0x0008 << nVal; + eDstPnMode=eMode; + bDstPnModeValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_PnLinePat(BOOL bVisible) +{ + PictPattern aPat; + + ConvertLinePattern(aPat,bVisible); + if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) { + *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo; + aDstPnPat=aPat; + bDstPnPatValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_PnFillPat(BOOL bVisible) +{ + PictPattern aPat; + + ConvertFillPattern(aPat,bVisible); + if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) { + *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo; + aDstPnPat=aPat; + bDstPnPatValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_OvSize(const Size & rSize) +{ + *pPict << (USHORT)0x000b; + WriteSize(rSize); +} + + +void PictWriter::WriteOpcode_TxSize(USHORT nSize) +{ + if (bDstTxSizeValid==FALSE || nDstTxSize!=nSize) { + + nDstTxSize = (USHORT) OutputDevice::LogicToLogic( Size( 0, nSize ), + aSrcMapMode, aTargetMapMode ).Height(); + + *pPict << (USHORT)0x000d << nDstTxSize; + bDstTxSizeValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_RGBFgCol(const Color & rColor) +{ + if (bDstFgColValid==FALSE || aDstFgCol!=rColor) { + *pPict << (USHORT)0x001a; + WriteRGBColor(rColor); + aDstFgCol=rColor; + bDstFgColValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_RGBBkCol(const Color & rColor) +{ + if (bDstBkColValid==FALSE || aDstBkCol!=rColor) { + *pPict << (USHORT)0x001b; + WriteRGBColor(rColor); + aDstBkCol=rColor; + bDstBkColValid=TRUE; + } +} + + +void PictWriter::WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt) +{ + Point aLocPt = OutputDevice::LogicToLogic( rLocPt, + aSrcMapMode, + aTargetMapMode ); + Point aNewPt = OutputDevice::LogicToLogic( rNewPt, + aSrcMapMode, + aTargetMapMode ); + long dh,dv; + + dh=aNewPt.X()-aLocPt.X(); + dv=aNewPt.Y()-aLocPt.Y(); + if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128) + { // ShortLine + *pPict << (USHORT)0x0022; + WritePoint(rLocPt); + *pPict << (char)dh << (char)dv; + } + else + { + *pPict << (USHORT)0x0020; + WritePoint(rLocPt); + WritePoint(rNewPt); + } + aDstPenPosition=rNewPt; + bDstPenPositionValid=TRUE; +} + + +void PictWriter::WriteOpcode_LineFrom(const Point & rNewPt) +{ + Point aNewPt = OutputDevice::LogicToLogic( rNewPt, + aSrcMapMode, + aTargetMapMode ); + long dh,dv; + + dh = aNewPt.X()-aDstPenPosition.X(); + dv = aNewPt.Y()-aDstPenPosition.Y(); + + if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128) + { // ShortLine + *pPict << (USHORT)0x0023; + *pPict << (char)dh << (char)dv; + } + else + { + *pPict << (USHORT)0x0021; + WritePoint(rNewPt); + } + aDstPenPosition=rNewPt; + bDstPenPositionValid=TRUE; +} + + +void PictWriter::WriteOpcode_Text(const Point & rPoint, const String& rString, BOOL bDelta) +{ + Point aPoint = OutputDevice::LogicToLogic( rPoint, + aSrcMapMode, + aTargetMapMode ); + long dh,dv; + ULONG nPos; + + nPos = pPict->Tell(); + dh = aPoint.X()-aDstTextPosition.X(); + dv = aPoint.Y()-aDstTextPosition.Y(); + + if (bDstTextPositionValid==FALSE || dh<0 || dh>255 || dv<0 || dv>0 || bDelta==FALSE) + { + *pPict << (USHORT)0x0028; + WritePoint(rPoint); + } + else if (dv==0) + { + *pPict << (USHORT)0x0029 << (BYTE)dh; + } + else if (dh==0) + { + *pPict << (USHORT)0x002a << (BYTE)dv; + } + else + { + *pPict << (USHORT)0x002b << (BYTE)dh << (BYTE)dv; + } + + WriteString( rString ); + if (((pPict->Tell()-nPos)&1)!=0) + *pPict << (BYTE)0; + + aDstTextPosition = aPoint; + bDstTextPositionValid=TRUE; +} + + +void PictWriter::WriteOpcode_FontName(const Font & rFont) +{ + USHORT nDataLen,nFontId; + + switch (rFont.GetFamily()) { + case FAMILY_MODERN: nFontId=22; break; + case FAMILY_ROMAN: nFontId=20; break; + case FAMILY_SWISS: nFontId=21; break; + default: nFontId=1; + } + + if (bDstFontNameValid==FALSE || nDstFontNameId!=nFontId || aDstFontName!=rFont.GetName()) + { + ByteString aByteString( rFont.GetName(), gsl_getSystemTextEncoding() ); + sal_uInt16 nFontNameLen = aByteString.Len(); + if ( nFontNameLen ) + { + nDataLen = 3 + nFontNameLen; + *pPict << (USHORT)0x002c << nDataLen << nFontId; + WriteString( rFont.GetName() ); + if ( ( nFontNameLen & 1 ) == 0 ) + *pPict << (BYTE)0; + } + *pPict << (USHORT)0x0003 << nFontId; + aDstFontName=rFont.GetName(); + nDstFontNameId=nFontId; + bDstFontNameValid=TRUE; + } +} + +void PictWriter::WriteOpcode_ClipRect( const Rectangle& rRect ) +{ + Rectangle aRect( MapRectangle( rRect ) ); + aRect.nBottom++; + aRect.nRight++; + *pPict << (sal_uInt16)1 // opcode 1 + << (sal_uInt16)10 // data size + << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left() + << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right(); + aClipRect = aRect; +} + +void PictWriter::WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0030; break; + case PDM_PAINT: oc=0x0031; break; + case PDM_ERASE: oc=0x0032; break; + case PDM_INVERT: oc=0x0033; break; + case PDM_FILL: oc=0x0034; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WriteRectangle(rRect); +} + + +void PictWriter::WriteOpcode_SameRect(PictDrawingMethod eMethod) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0038; break; + case PDM_PAINT: oc=0x0039; break; + case PDM_ERASE: oc=0x003a; break; + case PDM_INVERT: oc=0x003b; break; + case PDM_FILL: oc=0x003c; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; +} + + +void PictWriter::WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0040; break; + case PDM_PAINT: oc=0x0041; break; + case PDM_ERASE: oc=0x0042; break; + case PDM_INVERT: oc=0x0043; break; + case PDM_FILL: oc=0x0044; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WriteRectangle(rRect); +} + + +void PictWriter::WriteOpcode_SameRRect(PictDrawingMethod eMethod) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0048; break; + case PDM_PAINT: oc=0x0049; break; + case PDM_ERASE: oc=0x004a; break; + case PDM_INVERT: oc=0x004b; break; + case PDM_FILL: oc=0x004c; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; +} + + +void PictWriter::WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0050; break; + case PDM_PAINT: oc=0x0051; break; + case PDM_ERASE: oc=0x0052; break; + case PDM_INVERT: oc=0x0053; break; + case PDM_FILL: oc=0x0054; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WriteRectangle(rRect); +} + + +void PictWriter::WriteOpcode_SameOval(PictDrawingMethod eMethod) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0058; break; + case PDM_PAINT: oc=0x0059; break; + case PDM_ERASE: oc=0x005a; break; + case PDM_INVERT: oc=0x005b; break; + case PDM_FILL: oc=0x005c; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; +} + + +void PictWriter::WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect, + const Point & rStartPt, const Point & rEndPt) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0060; break; + case PDM_PAINT: oc=0x0061; break; + case PDM_ERASE: oc=0x0062; break; + case PDM_INVERT: oc=0x0063; break; + case PDM_FILL: oc=0x0064; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WriteRectangle(rRect); + WriteArcAngles(rRect,rStartPt,rEndPt); +} + + +void PictWriter::WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect, + const Point & rStartPt, const Point & rEndPt) +{ + USHORT oc; + switch (eMethod) { + case PDM_FRAME: oc=0x0068; break; + case PDM_PAINT: oc=0x0069; break; + case PDM_ERASE: oc=0x006a; break; + case PDM_INVERT: oc=0x006b; break; + case PDM_FILL: oc=0x006c; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WriteArcAngles(rRect,rStartPt,rEndPt); +} + + +void PictWriter::WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly) +{ + USHORT oc; + + if (rPoly.GetSize()<3) return; + switch (eMethod) { + case PDM_FRAME: oc=0x0070; break; + case PDM_PAINT: oc=0x0071; break; + case PDM_ERASE: oc=0x0072; break; + case PDM_INVERT: oc=0x0073; break; + case PDM_FILL: oc=0x0074; break; + default: oc=0; break; // -Wall a default for oc... + } + *pPict << oc; + WritePolygon(rPoly); +} + + +void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap) +{ + BitmapReadAccess* pAcc = NULL; + Bitmap aBitmap( rBitmap ); + + ULONG nWidth, nHeight, nDstRowBytes, nx, nc, ny, nCount, nColTabSize, i; + ULONG nDstRowPos, nSrcRowBytes, nEqu3, nPos, nDstMapPos; + USHORT nBitsPerPixel, nPackType; + BYTE *pComp[4], *pPix, *pTemp; + BYTE nEquData = 0; + BYTE nFlagCounterByte, nRed, nGreen, nBlue; + + SetAttrForPaint(); + + // temopraere Windows-BMP-Datei erzeugen: + nActBitmapPercent=30; + MayCallback(); + + if ( bStatus == FALSE ) + return; + if ( ( pAcc = aBitmap.AcquireReadAccess() ) == NULL ) + return; + + nBitsPerPixel = aBitmap.GetBitCount(); + + // export code below only handles four discrete cases + nBitsPerPixel = + nBitsPerPixel <= 1 ? 1 : nBitsPerPixel <= 4 ? 4 : nBitsPerPixel <= 8 ? 8 : 24; + + nWidth = pAcc->Width(); + nHeight = pAcc->Height(); + + // Wenn 24-Bit, dann den Opcode 'DirectBitsRect' erzeugen: + if ( nBitsPerPixel == 24 ) + { + + // Anzahl Bytes einer (ungepackten) Zeile in Quelle und Ziel berechnen: + nSrcRowBytes =( ( 3 * nWidth ) + 0x0003 ) & 0xfffc; + nDstRowBytes = nWidth * 4; + + // Opcode und BaseAddr (?) schreiben: + *pPict << (USHORT)0x009a << (sal_uInt32)0x000000ff; + + // Normalerweise wollen wir den Packing-Type 4 (Run length encoding + // for 32-Bit Pixels) erzeugen. Wenn aber RowBytes<8 gilt, sind die Daten + // grundsaetzlich ungepackt, auch wenn der Packing-Type 4 angegeben ist, + // was etwas komisch erscheint. Daher wollen wir in so einem Fall lieber + // gleich den Packing-Type 1 (ungepackt) angeben: + + if ( nDstRowBytes < 8 ) + nPackType = 1; + else + nPackType = 4; + + // PixMap-Struktur schreiben: + *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist + << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle + << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle + << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle + << (USHORT)nWidth // X2-Position der Bitmap in der Quelle + << (USHORT)0x0000 // Version + << (USHORT)nPackType // Packing type + << (sal_uInt32) 0x00000000 // Packing size (?) + << (sal_uInt32) 0x00480000 // H-Res + << (sal_uInt32) 0x00480000 // V-Res + << (USHORT)0x0010 // Pixel type (?) + << (USHORT)0x0020 // Pixel size: 32 bit + << (USHORT)0x0004 // CmpCount: 4 Komponenten + << (USHORT)0x0008 // CmpSize: 8 Bits + << (sal_uInt32) 0x00000000 // PlaneBytes (?) + << (sal_uInt32) 0x00000000 // (?) + << (sal_uInt32) 0x00000000; // (?) + + // Source-Rectangle schreiben: + *pPict << (USHORT)0x0000 // Y1-Position auf der Bitmap + << (USHORT)0x0000 // X1-Position auf der Bitmap + << (USHORT)nHeight // Y2-Position auf der Bitmap + << (USHORT)nWidth; // X2-Position auf der Bitmap + + // Destination-Rectangle schreiben: + WritePoint( rPoint ); + WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) ); + + // Transfer mode schreiben: + *pPict << (USHORT)0x0000; // (?) + + // Position der Map-Daten in Ziel merken: + nDstMapPos=pPict->Tell(); + + if ( nPackType == 1 ) // bei 24 bits nWidth == 1 !! + { // nicht packen + for ( ny = 0; ny < nHeight; ny++ ) + { + *pPict << (BYTE)0; + *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetRed(); + *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetGreen(); + *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetBlue(); + // Prozente zaehlen, Callback, Fehler pruefen: + nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus) + MayCallback(); + } + } + else // packen ( PackType == 4 ) + { + // Speicher fuer Zeilen-Zwischen-Datenstruktur allozieren: + for ( nc = 0; nc < 4; nc++ ) + pComp[ nc ] = new BYTE[ nWidth ]; + + // Schleife ueber Zeilen: + for ( ny = 0; ny < nHeight; ny++ ) + { + // Zeil ny der Quelle in die Zwischen-Datenstrktur einlesen: + + for ( nx = 0; nx < nWidth; nx++ ) + { + pComp[ 1 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetRed(); + pComp[ 2 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetGreen(); + pComp[ 3 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetBlue(); + pComp[ 0 ][ nx ] = 0; + } + + // Anfang der Zeile im Ziel merken: + nDstRowPos = pPict->Tell(); + + // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt): + if ( nDstRowBytes > 250 ) + *pPict << (USHORT)0; + else + *pPict << (BYTE)0; + + // Schleife ueber Componenten: + for ( nc = 0; nc < 4; nc++ ) + { + // Schleife ueber x: + nx = 0; + while ( nx < nWidth ) + { + // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken. + // wenn nicht gefunden, dann nEqu3=nWidth setzten. + // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken. + nEqu3 = nx; + for (;;) + { + if ( nEqu3 + 2 >= nWidth ) + { + nEqu3 = nWidth; + break; + } + nEquData = pComp[nc][nEqu3]; + if ( nEquData == pComp[nc][nEqu3+1] && nEquData==pComp[nc][nEqu3+2] ) + break; + nEqu3++; + } + + // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records): + while ( nEqu3 > nx ) + { + nCount = nEqu3 - nx; + if ( nCount > 128 ) + nCount=128; + nFlagCounterByte = (BYTE)(nCount-1); + *pPict << nFlagCounterByte; + do + { + *pPict << pComp[nc][nx++]; + nCount--; + } + while ( nCount > 0 ); + } + + // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3 + // gleiche Bytes gefunden): + if ( nx < nWidth ) + { // Hinweis: es gilt nx==nEqu3 (hoffentlich) + nCount=3; // Drei Bytes sind gleich, wie weiter oben herausgefunden. + // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten): + while ( nx + nCount < nWidth && nCount < 128 ) + { + if ( nEquData != pComp[ nc ][ nx + nCount ] ) + break; + nCount++; + } + // nCount gleiche Bytes komprimiert schreiben: + nFlagCounterByte = (BYTE)( 1 - (long)nCount ); + *pPict << nFlagCounterByte << nEquData; + nx += nCount; + } + } + } + // ByteCount berichtigen: + nPos = pPict->Tell(); + pPict->Seek( nDstRowPos ); + if ( nDstRowBytes > 250 ) + *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) ); + else + *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) ); + pPict->Seek( nPos ); + + // Prozente zaehlen, Callback, Fehler pruefen: + nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus) + MayCallback(); + } + // Aufraeumen: + for ( nc = 0; nc < 4; nc++ ) + delete pComp[ nc ]; + } + } + else + { // nicht 24-Bit also Opcode 'PackBitsRect' erzeugen: + + // Bei 1-Bit-Bildern ignorieren manche Import-Filter die Palette und nehmen statt + // dessen die Vorder- und Hintergrundfarbe: + if ( nBitsPerPixel == 1 ) + { + WriteOpcode_RGBBkCol( pAcc->GetPaletteColor( 0 ) ); + WriteOpcode_RGBFgCol( pAcc->GetPaletteColor( 1 ) ); + } + else + { + WriteOpcode_RGBBkCol( Color( COL_BLACK ) ); + WriteOpcode_RGBFgCol( Color( COL_WHITE ) ); + } + + // Anzahl Bytes einer (ungepackten) Zeile in Ziel und Quelle berechnen: + nDstRowBytes = ( nWidth * nBitsPerPixel + 7 ) >> 3; + nSrcRowBytes = ( nDstRowBytes + 3 ) & 0xfffffffc; + + // Opcode schreiben: + *pPict << (USHORT)0x0098; + + // Normalerweise wollen wir den Packing-Type 0 (default Packing) erzeugen. + // Wenn aber RowBytes<8 gilt, sind die Daten grundsaetzlich ungepackt, + // auch wenn der Packing-Type 0 angegeben ist, was etwas komisch erscheint. + // Daher wollen wir in so einem Fall lieber gleich den Packing-Type 1 (ungepackt) + // angeben: + if ( nDstRowBytes < 8 ) + nPackType = 1; + else + nPackType = 0; + + // PixMap-Struktur schreiben: + *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist + << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle + << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle + << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle + << (USHORT)nWidth // X2-Position der Bitmap in der Quelle + << (USHORT)0x0000 // Version + << (USHORT)nPackType // Packing type + << (sal_uInt32) 0x00000000 // Packing size (?) + << (sal_uInt32) 0x00480000 // H-Res + << (sal_uInt32) 0x00480000 // V-Res + << (USHORT)0x0000 // Pixel type (?) + << (USHORT)nBitsPerPixel // Pixel size + << (USHORT)0x0001 // CmpCount: 1 Komponente + << (USHORT)nBitsPerPixel // CmpSize + << (sal_uInt32) 0x00000000 // PlaneBytes (?) + << (sal_uInt32) 0x00000000 // (?) + << (sal_uInt32) 0x00000000; // (?) + + // Palette lesen und schreiben: + nColTabSize = pAcc->GetPaletteEntryCount(); + *pPict << (sal_uInt32)0 << (USHORT)0x8000 << (USHORT)( nColTabSize - 1 ); + + for ( i = 0; i < nColTabSize; i++ ) + { + nRed = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetRed(); + nGreen = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetGreen(); + nBlue = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetBlue(); + *pPict << (UINT16)0 << nRed << nRed << nGreen << nGreen << nBlue << nBlue; + } + + // Source-Rectangle schreiben: + *pPict << (USHORT)0 << (USHORT)0 << (USHORT)nHeight << (USHORT)nWidth; + + // Destination-Rectangle schreiben: + WritePoint( rPoint ); + WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) ); + + // Transfer mode schreiben: + *pPict << (USHORT)0; // (?) + + // Speicher fuer eine Zeile allozieren: + pPix = new BYTE[ nSrcRowBytes ]; + + // Position der Map-Daten in Ziel merken: + nDstMapPos=pPict->Tell(); + + // Schleife ueber Zeilen: + for ( ny = 0; ny < nHeight; ny++ ) + { + + // Zeile ny der Quelle in den Zwischenspeicher einlesen: + + switch ( nBitsPerPixel ) + { + case 1 : + for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ ) + *pTemp++ = (BYTE)0; + for ( i = 0; i < nWidth; i++ ) + pPix[ ( i >> 3 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 1 ) << ( ( i & 7 ) ^ 7 ); + break; + case 4 : + for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ ) + *pTemp++ = (BYTE)0; + for ( i = 0; i < nWidth; i++ ) + pPix[ ( i >> 1 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 15 ) << ( ( i & 1 ) << 2 ) ; + break; + case 8 : + for ( i = 0; i < nWidth; i++ ) + pPix[ i ] = (BYTE)pAcc->GetPixel( ny, i ); + break; + } + + if ( nPackType == 1 ) + { // nicht packen + pPict->Write( pPix, nDstRowBytes ); + } + else + { // Packen (nPackType==0) + + // Anfang der Zeile im Ziel merken: + nDstRowPos = pPict->Tell(); + + // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt): + if ( nDstRowBytes > 250 ) + *pPict << (USHORT)0; + else + *pPict << (BYTE)0; + + // Schleife ueber Bytes der Zeile: + nx=0; + while ( nx < nDstRowBytes && bStatus ) + { + // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken. + // wenn nicht gefunden, dann nEqu3=nDstRowBytes setzten. + // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken. + nEqu3 = nx; + for (;;) + { + if ( nEqu3 + 2 >= nDstRowBytes ) + { + nEqu3 = nDstRowBytes; + break; + } + nEquData = pPix[ nEqu3 ]; + if ( nEquData == pPix[ nEqu3 + 1 ] && nEquData == pPix[ nEqu3 + 2 ] ) + break; + nEqu3++; + } + + // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records): + while ( nEqu3 > nx ) + { + nCount = nEqu3 - nx; + if ( nCount > 128 ) + nCount = 128; + nFlagCounterByte = (BYTE)( nCount - 1 ); + *pPict << nFlagCounterByte; + do + { + *pPict << pPix[ nx++ ]; + nCount--; + } while ( nCount > 0 ); + } + + // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3 + // gleiche Bytes gefunden): + if ( nx < nDstRowBytes ) + { // Hinweis: es gilt nx==nEqu3 (hoffentlich) + nCount = 3; // Drei Bytes sind gleich, wie weiter oben herausgefunden. + // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten): + while ( nx + nCount < nDstRowBytes && nCount < 128 ) + { + if ( nEquData != pPix[ nx + nCount ] ) + break; + nCount++; + } + // nCount gleiche Bytes komprimiert schreiben: + nFlagCounterByte = (BYTE)( 1 - (long)nCount ); + *pPict << nFlagCounterByte << nEquData; + nx += nCount; + } + } + + // ByteCount berichtigen: + nPos = pPict->Tell(); + pPict->Seek( nDstRowPos ); + if ( nDstRowBytes > 250 ) + *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) ); + else + *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) ); + pPict->Seek( nPos ); + } + + // Prozente zaehlen, Callback, Fehler pruefen: + nActBitmapPercent =( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus) + MayCallback(); + if ( pPict->GetError() ) + bStatus = FALSE; + } + // Aufraeumen: + delete[] pPix; + } + + // Map-Daten muessen gerade Anzahl von Bytes sein: + if ( ( ( pPict->Tell() - nDstMapPos ) & 1 ) != 0 ) + *pPict << (BYTE)0; + + // Bitmaps zaehlen: + nWrittenBitmaps++; + nActBitmapPercent = 0; + if ( pAcc ) + aBitmap.ReleaseAccess( pAcc ); +} + +void PictWriter::WriteOpcode_EndOfFile() +{ + *pPict << (USHORT)0x00ff; +} + + +void PictWriter::SetAttrForPaint() +{ + WriteOpcode_PnMode(eSrcRasterOp); + WriteOpcode_RGBFgCol(aFillColor); + WriteOpcode_RGBBkCol(aFillColor); + WriteOpcode_PnFillPat(aFillColor!=Color( COL_TRANSPARENT )); +} + + +void PictWriter::SetAttrForFrame() +{ + WriteOpcode_PnMode(eSrcRasterOp); + WriteOpcode_PnSize(0); + WriteOpcode_RGBFgCol(aLineColor); + WriteOpcode_PnLinePat(aLineColor!=Color( COL_TRANSPARENT )); +} + + +void PictWriter::SetAttrForText() +{ + WriteOpcode_RGBFgCol(aSrcFont.GetColor()); + WriteOpcode_RGBBkCol(aSrcFont.GetFillColor()); + WriteOpcode_PnLinePat(TRUE); + WriteOpcode_FontName(aSrcFont); + WriteOpcode_TxSize((USHORT)(aSrcFont.GetSize().Height())); + WriteOpcode_TxMode(eSrcRasterOp); + WriteOpcode_TxFace(aSrcFont); +} + + +void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry) +{ + USHORT i,nLen; + sal_Unicode c; + BOOL bDelta; + Point aPt; + + if ( pDXAry == NULL ) + WriteOpcode_Text( rPoint, rString, FALSE ); + else + { + bDelta = FALSE; + nLen = rString.Len(); + for ( i = 0; i < nLen; i++ ) + { + c = rString.GetChar( i ); + if ( c && ( c != 0x20 ) ) + { + aPt = rPoint; + if ( i > 0 ) + aPt.X() += pDXAry[ i - 1 ]; + + WriteOpcode_Text( aPt, String( c ), bDelta ); + bDelta = TRUE; + } + } + } +} + +void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision(); + const sal_uInt32 nPolyCount(aLinePolyPolygon.count()); + SetAttrForFrame(); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount); + const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0)); + Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY())); + + for(sal_uInt32 b(0); b < nEdgeCount; b++) + { + const sal_uInt32 nNextIndex((b + 1) % nPointCount); + const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex)); + const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY())); + + WriteOpcode_Line(nCurr, nNext); + nCurr = nNext; + } + } + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(aLineColor); + const Color aOldFillColor(aFillColor); + + aLineColor = Color( COL_TRANSPARENT ); + aFillColor = aOldLineColor; + SetAttrForPaint(); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision()); + WriteOpcode_Poly(PDM_PAINT, aPolygon); + } + + aLineColor = aOldLineColor; + aFillColor = aOldFillColor; + } + } +} + +void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) +{ + ULONG nA, nACount; + const MetaAction* pMA; + + if( !bStatus) + return; + + nACount=rMTF.GetActionCount(); + + for (nA=0; nA<nACount; nA++) + { + pMA = rMTF.GetAction(nA); + + switch (pMA->GetType()) + { + case META_PIXEL_ACTION: + { + const MetaPixelAction* pA = (const MetaPixelAction*) pMA; + WriteOpcode_PnMode(eSrcRasterOp); + WriteOpcode_PnSize(1); + WriteOpcode_RGBFgCol(pA->GetColor()); + WriteOpcode_PnLinePat(TRUE); + WriteOpcode_Line(pA->GetPoint(),pA->GetPoint()); + } + break; + + case META_POINT_ACTION: + { + const MetaPointAction* pA = (const MetaPointAction*) pMA; + + if( aLineColor != Color( COL_TRANSPARENT ) ) + { + SetAttrForFrame(); + WriteOpcode_Line( pA->GetPoint(),pA->GetPoint() ); + } + } + break; + + case META_LINE_ACTION: + { + const MetaLineAction* pA = (const MetaLineAction*) pMA; + + if( aLineColor != Color( COL_TRANSPARENT ) ) + { + if(pA->GetLineInfo().IsDefault()) + { + SetAttrForFrame(); + WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } + } + break; + } + + case META_RECT_ACTION: + { + const MetaRectAction* pA = (const MetaRectAction*) pMA; + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Rect(PDM_PAINT,pA->GetRect()); + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_SameRect(PDM_FRAME); + } + } + else if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_Rect(PDM_FRAME,pA->GetRect()); + } + } + break; + + case META_ROUNDRECT_ACTION: + { + const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA; + + WriteOpcode_OvSize( Size( pA->GetHorzRound(), pA->GetVertRound() ) ); + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_RRect(PDM_PAINT,pA->GetRect()); + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_SameRRect(PDM_FRAME); + } + } + else if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_RRect(PDM_FRAME,pA->GetRect()); + } + } + break; + + case META_ELLIPSE_ACTION: + { + const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA; + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Oval(PDM_PAINT,pA->GetRect()); + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_SameOval(PDM_FRAME); + } + } + else if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_Oval(PDM_FRAME,pA->GetRect()); + } + } + break; + + case META_ARC_ACTION: + { + const MetaArcAction* pA = (const MetaArcAction*) pMA; + + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint()); + } + } + break; + + case META_PIE_ACTION: + { + const MetaPieAction* pA = (const MetaPieAction *) pMA; + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Arc(PDM_PAINT,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint()); + + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_SameArc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint()); + } + } + else if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint()); + } + + if (aLineColor!=Color( COL_TRANSPARENT )) + { + double fxc,fyc,fxr,fyr,fx1,fy1,fx2,fy2,l1,l2; + + fxc=((double)(pA->GetRect().Left()+pA->GetRect().Right()))/2.0; + fyc=((double)(pA->GetRect().Top()+pA->GetRect().Bottom()))/2.0; + fxr=((double)pA->GetRect().GetWidth())/2.0; + fyr=((double)pA->GetRect().GetHeight())/2.0; + fx1=((double)pA->GetStartPoint().X())-fxc; + fy1=((double)pA->GetStartPoint().Y())-fyc; + fx2=((double)pA->GetEndPoint().X())-fxc; + fy2=((double)pA->GetEndPoint().Y())-fyc; + l1=sqrt(fx1*fx1+fy1*fy1); + l2=sqrt(fx2*fx2+fy2*fy2); + + if (l1>0) + { + fx1=fx1/l1*fxr; + fy1=fy1/l1*fyr; + } + + if (l2>0) + { + fx2=fx2/l2*fxr; + fy2=fy2/l2*fyr; + } + fx1+=fxc; fy1+=fyc; fx2+=fxc; fy2+=fyc; + WriteOpcode_Line(Point((long)(fx1+0.5),(long)(fy1+0.5)), Point((long)(fxc+0.5),(long)(fyc+0.5))); + WriteOpcode_LineFrom(Point((long)(fx2+0.5),(long)(fy2+0.5))); + } + } + break; + + case META_CHORD_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_CHORD_ACTION!" ); + } + break; + + case META_POLYLINE_ACTION: + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA; + + if( aLineColor!=Color( COL_TRANSPARENT ) ) + { + const Polygon& rPoly = pA->GetPolygon(); + + if( rPoly.GetSize() ) + { + if(pA->GetLineInfo().IsDefault()) + { + Polygon aSimplePoly; + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; + + const USHORT nSize = aSimplePoly.GetSize(); + Point aLast; + + if ( nSize ) + { + SetAttrForFrame(); + aLast = aSimplePoly[0]; + + for ( USHORT i = 1; i < nSize; i++ ) + { + WriteOpcode_Line( aLast, aSimplePoly[i] ); + aLast = aSimplePoly[i]; + } + } + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } + } + } + break; + + case META_POLYGON_ACTION: + { + const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA; + + const Polygon& rPoly = pA->GetPolygon(); + + Polygon aSimplePoly; + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Poly( PDM_PAINT, aSimplePoly ); + } + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + WriteOpcode_Poly( PDM_FRAME, aSimplePoly ); + } + } + break; + + case META_POLYPOLYGON_ACTION: + { + const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA; + + const PolyPolygon& rPolyPoly = pA->GetPolyPolygon(); + sal_uInt16 nPolyCount = rPolyPoly.Count(); + PolyPolygon aSimplePolyPoly( rPolyPoly ); + for ( sal_uInt16 i = 0; i < nPolyCount; i++ ) + { + if ( aSimplePolyPoly[ i ].HasFlags() ) + { + Polygon aSimplePoly; + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); + aSimplePolyPoly[ i ] = aSimplePoly; + } + } + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Poly( PDM_PAINT, PolyPolygonToPolygon( aSimplePolyPoly )); + } + + if (aLineColor!=Color( COL_TRANSPARENT )) + { + USHORT nCount,i; + SetAttrForFrame(); + nCount = aSimplePolyPoly.Count(); + for ( i = 0; i < nCount; i++ ) + WriteOpcode_Poly( PDM_FRAME, aSimplePolyPoly.GetObject( i ) ); + } + } + break; + + case META_TEXT_ACTION: + { + const MetaTextAction* pA = (const MetaTextAction*) pMA; + Point aPt( pA->GetPoint() ); + + if ( aSrcFont.GetAlign() != ALIGN_BASELINE ) + { + VirtualDevice aVirDev; + + if (aSrcFont.GetAlign()==ALIGN_TOP) + aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + else + aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + } + + SetAttrForText(); + String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() ); + WriteOpcode_Text( aPt, aStr, FALSE ); + } + break; + + case META_TEXTARRAY_ACTION: + { + const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA; + Point aPt( pA->GetPoint() ); + + if (aSrcFont.GetAlign()!=ALIGN_BASELINE) + { + VirtualDevice aVirDev; + + if (aSrcFont.GetAlign()==ALIGN_TOP) + aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + else + aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + } + SetAttrForText(); + String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() ); + WriteTextArray( aPt, aStr, pA->GetDXArray() ); + break; + } + + case META_STRETCHTEXT_ACTION: + { + const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA; + Point aPt( pA->GetPoint() ); + String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() ); + VirtualDevice aVirDev; + sal_Int32* pDXAry = new sal_Int32[ aStr.Len() ]; + sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry ) ); + USHORT i; + + if (aSrcFont.GetAlign()!=ALIGN_BASELINE) + { + if (aSrcFont.GetAlign()==ALIGN_TOP) + aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent(); + else + aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent(); + } + + for ( i = 0; i < aStr.Len() - 1; i++ ) + pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize; + + SetAttrForText(); + WriteTextArray( aPt, aStr, pDXAry ); + delete[] pDXAry; + } + break; + + case META_TEXTRECT_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_TEXTRECT_ACTION!" ); + } + break; + + case META_BMP_ACTION: + { + const MetaBmpAction* pA = (const MetaBmpAction*) pMA; + WriteOpcode_BitsRect( pA->GetPoint(),pA->GetBitmap().GetSizePixel(), pA->GetBitmap() ); + } + break; + + case META_BMPSCALE_ACTION: + { + const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA; + WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() ); + } + break; + + case META_BMPSCALEPART_ACTION: + { + const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA; + Bitmap aBmp( pA->GetBitmap() ); + + aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp ); + } + break; + + case META_BMPEX_ACTION: + { + const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA; + const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + WriteOpcode_BitsRect( pA->GetPoint(), aBmp.GetSizePixel(), aBmp ); + } + break; + + case META_BMPEXSCALE_ACTION: + { + const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA; + const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp ); + } + break; + + case META_BMPEXSCALEPART_ACTION: + { + const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA; + Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() ); + + aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); + WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp ); + } + break; + + case META_EPS_ACTION : + { + const MetaEPSAction* pA = (const MetaEPSAction*)pMA; + const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); + + INT32 nCount = aGDIMetaFile.GetActionCount(); + for ( INT32 i = 0; i < nCount; i++ ) + { + const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); + if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) + { + const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct; + WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() ); + break; + } + } + } + break; + + case META_MASK_ACTION: + case META_MASKSCALE_ACTION: + case META_MASKSCALEPART_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_MASK..._ACTION!" ); + } + break; + + case META_GRADIENT_ACTION: + { + VirtualDevice aVDev; + GDIMetaFile aTmpMtf; + const MetaGradientAction* pA = (const MetaGradientAction*) pMA; + + aVDev.SetMapMode( aTargetMapMode ); + aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf ); + WriteOpcodes( aTmpMtf ); + } + break; + + case META_HATCH_ACTION: + { + VirtualDevice aVDev; + GDIMetaFile aTmpMtf; + const MetaHatchAction* pA = (const MetaHatchAction*) pMA; + + aVDev.SetMapMode( aTargetMapMode ); + aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf ); + WriteOpcodes( aTmpMtf ); + } + break; + + case META_WALLPAPER_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_WALLPAPER_ACTION!" ); + } + break; + + case META_CLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_CLIPREGION_ACTION!" ); + } + break; + + case META_ISECTRECTCLIPREGION_ACTION: + { + const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA; + WriteOpcode_ClipRect( pA->GetRect() ); + } + break; + + case META_ISECTREGIONCLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_ISECTREGIONCLIPREGION_ACTION!" ); + } + break; + + case META_MOVECLIPREGION_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_MOVECLIPREGION_ACTION!" ); + } + break; + + case META_LINECOLOR_ACTION: + { + const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA; + + if( pA->IsSetting() ) + aLineColor = pA->GetColor(); + else + aLineColor = Color( COL_TRANSPARENT ); + } + break; + + case META_FILLCOLOR_ACTION: + { + const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA; + + if( pA->IsSetting() ) + aFillColor = pA->GetColor(); + else + aFillColor = Color( COL_TRANSPARENT ); + } + break; + + case META_TEXTCOLOR_ACTION: + { + const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA; + aSrcFont.SetColor( pA->GetColor() ); + } + break; + + case META_TEXTFILLCOLOR_ACTION: + { + const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA; + + if( pA->IsSetting() ) + aSrcFont.SetFillColor( pA->GetColor() ); + else + aSrcFont.SetFillColor( Color( COL_TRANSPARENT ) ); + } + break; + + case META_TEXTALIGN_ACTION: + { +// DBG_ERROR( "Unsupported PICT-Action: META_TEXTALIGN_ACTION!" ); + } + break; + + case META_MAPMODE_ACTION: + { + const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA; + + if (aSrcMapMode!=pA->GetMapMode()) + { + if( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE ) + { + MapMode aMM = pA->GetMapMode(); + Fraction aScaleX = aMM.GetScaleX(); + Fraction aScaleY = aMM.GetScaleY(); + + Point aOrigin = aSrcMapMode.GetOrigin(); + BigInt aX( aOrigin.X() ); + aX *= BigInt( aScaleX.GetDenominator() ); + if( aOrigin.X() >= 0 ) + { + if( aScaleX.GetNumerator() >= 0 ) + aX += BigInt( aScaleX.GetNumerator()/2 ); + else + aX -= BigInt( (aScaleX.GetNumerator()+1)/2 ); + } + else + { + if( aScaleX.GetNumerator() >= 0 ) + aX -= BigInt( (aScaleX.GetNumerator()-1)/2 ); + else + aX += BigInt( aScaleX.GetNumerator()/2 ); + } + + aX /= BigInt( aScaleX.GetNumerator() ); + aOrigin.X() = (long)aX + aMM.GetOrigin().X(); + BigInt aY( aOrigin.Y() ); + aY *= BigInt( aScaleY.GetDenominator() ); + + if( aOrigin.Y() >= 0 ) + { + if( aScaleY.GetNumerator() >= 0 ) + aY += BigInt( aScaleY.GetNumerator()/2 ); + else + aY -= BigInt( (aScaleY.GetNumerator()+1)/2 ); + } + else + { + if( aScaleY.GetNumerator() >= 0 ) + aY -= BigInt( (aScaleY.GetNumerator()-1)/2 ); + else + aY += BigInt( aScaleY.GetNumerator()/2 ); + } + + aY /= BigInt( aScaleY.GetNumerator() ); + aOrigin.Y() = (long)aY + aMM.GetOrigin().Y(); + aSrcMapMode.SetOrigin( aOrigin ); + + aScaleX *= aSrcMapMode.GetScaleX(); + aScaleY *= aSrcMapMode.GetScaleY(); + aSrcMapMode.SetScaleX( aScaleX ); + aSrcMapMode.SetScaleY( aScaleY ); + } + else + aSrcMapMode = pA->GetMapMode(); + } + } + break; + + case META_FONT_ACTION: + { + const MetaFontAction* pA = (const MetaFontAction*) pMA; + aSrcFont=pA->GetFont(); + } + break; + + case META_PUSH_ACTION: + { + PictWriterAttrStackMember * pAt = new PictWriterAttrStackMember; + pAt->aLineColor=aLineColor; + pAt->aFillColor=aFillColor; + pAt->eRasterOp=eSrcRasterOp; + pAt->aFont=aSrcFont; + pAt->aMapMode=aSrcMapMode; + pAt->aClipRect=aClipRect; + pAt->pSucc=pAttrStack; + pAttrStack=pAt; + } + break; + + case META_POP_ACTION: + { + PictWriterAttrStackMember* pAt=pAttrStack; + + if( pAt ) + { + aLineColor=pAt->aLineColor; + aFillColor=pAt->aFillColor; + eSrcRasterOp=pAt->eRasterOp; + aSrcFont=pAt->aFont; + aSrcMapMode=pAt->aMapMode; + if ( pAt->aClipRect != aClipRect ) + { + Rectangle aRect( pAt->aClipRect ); + *pPict << (sal_uInt16)1 // opcode 1 + << (sal_uInt16)10 // data size + << (sal_Int16)aRect.Top() << (sal_Int16)aRect.Left() + << (sal_Int16)aRect.Bottom() << (sal_Int16)aRect.Right(); + } + aClipRect=pAt->aClipRect; + pAttrStack=pAt->pSucc; + delete pAt; + } + } + break; + + case META_RASTEROP_ACTION: + { + const MetaRasterOpAction* pA = (const MetaRasterOpAction*) pMA; + eSrcRasterOp=pA->GetRasterOp(); + } + break; + + case META_TRANSPARENT_ACTION: + { + const PolyPolygon& rPolyPoly = ( (const MetaTransparentAction*) pMA )->GetPolyPolygon(); + + if (aFillColor!=Color( COL_TRANSPARENT )) + { + SetAttrForPaint(); + WriteOpcode_Poly( PDM_PAINT, PolyPolygonToPolygon( rPolyPoly ) ); + } + + if (aLineColor!=Color( COL_TRANSPARENT )) + { + SetAttrForFrame(); + for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) + WriteOpcode_Poly( PDM_FRAME, rPolyPoly.GetObject( i ) ); + } + } + break; + + case META_FLOATTRANSPARENT_ACTION: + { + const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA; + + GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() ); + Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() ); + const Size aSrcSize( aTmpMtf.GetPrefSize() ); + const Point aDestPt( pA->GetPoint() ); + const Size aDestSize( pA->GetSize() ); + const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0; + const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0; + long nMoveX, nMoveY; + + if( fScaleX != 1.0 || fScaleY != 1.0 ) + { + aTmpMtf.Scale( fScaleX, fScaleY ); + aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY ); + } + + nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y(); + + if( nMoveX || nMoveY ) + aTmpMtf.Move( nMoveX, nMoveY ); + + WriteOpcodes( aTmpMtf ); + } + break; + } + + nWrittenActions++; + MayCallback(); + + if (pPict->GetError()) + bStatus=FALSE; + + if (bStatus==FALSE) + break; + } +} + + +void PictWriter::WriteHeader(const GDIMetaFile & rMTF) +{ + USHORT i; + Size aSize( rMTF.GetPrefSize() ); + Point aPoint; + Rectangle aRect( aPoint, aSize ); + + // 512 Bytes "Muell" am Anfang: + for (i=0;i<128;i++) *pPict << (sal_uInt32)0; + + // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell: + *pPict << (USHORT)0; // wird spaeter durch UpdateHeader() berichtigt + + // Das Bounding-Rectangle (y1,x1,y2,x2 !): + WriteRectangle( aRect ); + + // Version 2: + *pPict << (sal_uInt32)0x001102ff; + + // Extended-Version-2-Header: + *pPict << (USHORT)0x0c00 // Opcode + << (USHORT)0xfffe // Version (?) + << (USHORT)0x0000 // Reserved + << (sal_uInt32) 0x00480000 // hRes + << (sal_uInt32) 0x00480000; + WriteRectangle( aRect ); + *pPict << (sal_uInt32)0x00000000; // Reserved + + // viele Import-Filter verlangen die Angabe eines + // Clipping-Bereichs am Anfang + + WriteOpcode_ClipRect( aRect ); +} + + +void PictWriter::UpdateHeader() +{ + ULONG nPos; + + // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell berichtigen: + nPos=pPict->Tell(); + pPict->Seek(512); + *pPict << (USHORT)((nPos-512)&0x0000ffff); + pPict->Seek(nPos); +} + + +BOOL PictWriter::WritePict(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem ) +{ + PictWriterAttrStackMember* pAt; + MapMode aMap72( MAP_INCH ); + Fraction aDPIFrac( 1, 72 ); + + bStatus=TRUE; + nLastPercent=0; + + if ( pFilterConfigItem ) + { + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + pPict=&rTargetStream; + pPict->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN); + + aLineColor=Color( COL_BLACK ); + aFillColor=Color( COL_WHITE ); + eSrcRasterOp=ROP_OVERPAINT; + aSrcFont=Font(); + aSrcMapMode = rMTF.GetPrefMapMode(); + + aMap72.SetScaleX( aDPIFrac ); + aMap72.SetScaleY( aDPIFrac ); + aTargetMapMode = aMap72; + + pAttrStack=NULL; + + bDstBkPatValid=FALSE; + bDstTxFaceValid=FALSE; + bDstTxModeValid=FALSE; + bDstPnSizeValid=FALSE; + bDstPnModeValid=FALSE; + bDstPnPatValid=FALSE; + bDstFillPatValid=FALSE; + bDstTxSizeValid=FALSE; + bDstFgColValid=FALSE; + bDstBkColValid=FALSE; + bDstPenPositionValid=FALSE; + bDstTextPositionValid=FALSE; + bDstFontNameValid=FALSE; + + nNumberOfActions=0; + nNumberOfBitmaps=0; + nWrittenActions=0; + nWrittenBitmaps=0; + nActBitmapPercent=0; + + CountActionsAndBitmaps(rMTF); + + WriteHeader(rMTF); + WriteOpcodes(rMTF); + WriteOpcode_EndOfFile(); + UpdateHeader(); + + while (pAttrStack!=NULL) { + pAt=pAttrStack; + pAttrStack=pAt->pSucc; + delete pAt; + } + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return bStatus; +} + +//================== GraphicExport - die exportierte Funktion ================ + +extern "C" BOOL __LOADONCALLAPI GraphicExport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL) +{ + PictWriter aPictWriter; + + if (rGraphic.GetType()==GRAPHIC_GDIMETAFILE) + { + GDIMetaFile aScaledMtf( rGraphic.GetGDIMetaFile() ); + +/* + MapMode aMap72( MAP_INCH ); + Fraction aDPIFrac( 1, 72 ); + Size aOldSize = aScaledMtf.GetPrefSize(); + + aMap72.SetScaleX( aDPIFrac ); + aMap72.SetScaleY( aDPIFrac ); + + Size aNewSize = OutputDevice::LogicToLogic( aOldSize, + aScaledMtf.GetPrefMapMode(), + aMap72 ); + + aScaledMtf.Scale( Fraction( aNewSize.Width(), aOldSize.Width() ), + Fraction( aNewSize.Height(), aOldSize.Height() ) ); + aScaledMtf.SetPrefMapMode( aMap72 ); + aScaledMtf.SetPrefSize( aNewSize ); +*/ + + return aPictWriter.WritePict( aScaledMtf, rStream, pFilterConfigItem ); + } + else + { + Bitmap aBmp=rGraphic.GetBitmap(); + GDIMetaFile aMTF; + VirtualDevice aVirDev; + + aMTF.Record(&aVirDev); + aVirDev.DrawBitmap(Point(),aBmp); + aMTF.Stop(); + aMTF.SetPrefSize(aBmp.GetSizePixel()); + return aPictWriter.WritePict( aMTF, rStream, pFilterConfigItem ); + } +} + +//================== GraphicDialog - die exportierte Funktion ================ + +extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "ept" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEPCT( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + + +//=============================== fuer Windows ============================== +#ifndef GCC +#endif + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; // HANDLE der DLL + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif + diff --git a/filter/source/graphicfilter/epict/epictstr.src b/filter/source/graphicfilter/epict/epictstr.src new file mode 100644 index 000000000000..8afebcb7564c --- /dev/null +++ b/filter/source/graphicfilter/epict/epictstr.src @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "strings.hrc" + +String KEY_MODE +{ + Text = "ExportMode"; +}; + +String KEY_SIZE +{ + Text = "Size"; +}; diff --git a/filter/source/graphicfilter/epict/exports.map b/filter/source/graphicfilter/epict/exports.map new file mode 100644 index 000000000000..2f21c5c04b53 --- /dev/null +++ b/filter/source/graphicfilter/epict/exports.map @@ -0,0 +1,8 @@ +PICTEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/epict/makefile.mk b/filter/source/graphicfilter/epict/makefile.mk new file mode 100644 index 000000000000..a7c99eb3f732 --- /dev/null +++ b/filter/source/graphicfilter/epict/makefile.mk @@ -0,0 +1,76 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=epict +TARGET2=ept +DEPTARGET=vepict + + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES = dlgepct.src \ + epictstr.src +.IF "$(L10N_framework)"=="" +SLOFILES = $(SLO)$/epict.obj \ + $(SLO)$/dlgepct.obj +.ENDIF +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" +SHL1TARGET= ept$(DLLPOSTFIX) +SHL1IMPLIB= epict +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB) + +SHL1LIBS= $(SLB)$/epict.lib + +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/epict.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/epict/strings.hrc b/filter/source/graphicfilter/epict/strings.hrc new file mode 100644 index 000000000000..7834e3ea2bc0 --- /dev/null +++ b/filter/source/graphicfilter/epict/strings.hrc @@ -0,0 +1,29 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_MODE 260 +#define KEY_SIZE 261 + diff --git a/filter/source/graphicfilter/eppm/dlgeppm.cxx b/filter/source/graphicfilter/eppm/dlgeppm.cxx new file mode 100644 index 000000000000..23822bfebf7c --- /dev/null +++ b/filter/source/graphicfilter/eppm/dlgeppm.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif +#include <tools/ref.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <vcl/msgbox.hxx> +#include "dlgeppm.hxx" +#include "dlgeppm.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEPPM::DlgExportEPPM( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPPM, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), + aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), + aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + // Config-Parameter lesen + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PPM" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 ); + + BOOL bCheck = FALSE; + if ( !nFormat ) + bCheck ^= TRUE; + aRBRaw.Check( bCheck ); + bCheck ^= TRUE; + aRBASCII.Check( bCheck ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPPM, OK ) ); +} + +DlgExportEPPM::~DlgExportEPPM() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPPM, OK, void *, EMPTYARG ) +{ + // Config-Parameter schreiben + sal_Int32 nFormat = 0; + if ( aRBASCII.IsChecked() ) + nFormat++; + pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hrc b/filter/source/graphicfilter/eppm/dlgeppm.hrc new file mode 100644 index 000000000000..876dfa840997 --- /dev/null +++ b/filter/source/graphicfilter/eppm/dlgeppm.hrc @@ -0,0 +1,34 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define GRP_FORMAT 1 +#define RB_RAW 1 +#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hxx b/filter/source/graphicfilter/eppm/dlgeppm.hxx new file mode 100644 index 000000000000..a03ca3ad24f0 --- /dev/null +++ b/filter/source/graphicfilter/eppm/dlgeppm.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _DLGEPPM_HXX_ +#define _DLGEPPM_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> + + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEPPM : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + FixedLine aGrpFormat; + RadioButton aRBRaw; + RadioButton aRBASCII; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + +public: + DlgExportEPPM( FltCallDialogParameter& rPara ); + ~DlgExportEPPM(); +}; + +#endif // _DLGEPPM_HXX_ diff --git a/filter/source/graphicfilter/eppm/dlgeppm.src b/filter/source/graphicfilter/eppm/dlgeppm.src new file mode 100644 index 000000000000..bf6c6ec653cb --- /dev/null +++ b/filter/source/graphicfilter/eppm/dlgeppm.src @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgeppm.hrc" +ModalDialog DLG_EXPORT_EPPM +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 133 , 63 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "PPM Options" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 73 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 73 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 73 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine GRP_FORMAT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "File format"; + }; + RadioButton RB_RAW + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Binary"; + }; + RadioButton RB_ASCII + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Text"; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx new file mode 100644 index 000000000000..bef9ce9d3077 --- /dev/null +++ b/filter/source/graphicfilter/eppm/eppm.cxx @@ -0,0 +1,305 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/svapp.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/msgbox.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "strings.hrc" +#include "dlgeppm.hrc" +#include "dlgeppm.hxx" + +//============================ PPMWriter ================================== + +class PPMWriter { + +private: + + SvStream* mpOStm; // Die auszugebende PPM-Datei + USHORT mpOStmOldModus; + + BOOL mbStatus; + sal_Int32 mnMode; + BitmapReadAccess* mpAcc; + ULONG mnWidth, mnHeight; // Bildausmass in Pixeln + + BOOL ImplWriteHeader(); + void ImplWriteBody(); + void ImplWriteNumber( sal_Int32 ); + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + +public: + PPMWriter(); + ~PPMWriter(); + + BOOL WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem ); +}; + +//=================== Methoden von PPMWriter ============================== + +PPMWriter::PPMWriter() : + mbStatus ( TRUE ), + mpAcc ( NULL ) +{ +} + +// ------------------------------------------------------------------------ + +PPMWriter::~PPMWriter() +{ +} + +// ------------------------------------------------------------------------ + +BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM, FilterConfigItem* pFilterConfigItem ) +{ + + mpOStm = &rPPM; + + if ( pFilterConfigItem ) + { + mnMode = pFilterConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 0 ); + + xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); + if ( xStatusIndicator.is() ) + { + rtl::OUString aMsg; + xStatusIndicator->start( aMsg, 100 ); + } + } + + BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); + Bitmap aBmp = aBmpEx.GetBitmap(); + aBmp.Convert( BMP_CONVERSION_24BIT ); + + mpOStmOldModus = mpOStm->GetNumberFormatInt(); + mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); + + mpAcc = aBmp.AcquireReadAccess(); + if( mpAcc ) + { + if ( ImplWriteHeader() ) + { + ImplWriteBody(); + } + aBmp.ReleaseAccess( mpAcc ); + } + else + mbStatus = FALSE; + + mpOStm->SetNumberFormatInt( mpOStmOldModus ); + + if ( xStatusIndicator.is() ) + xStatusIndicator->end(); + + return mbStatus; +} + +// ------------------------------------------------------------------------ + +BOOL PPMWriter::ImplWriteHeader() +{ + mnWidth = mpAcc->Width(); + mnHeight = mpAcc->Height(); + if ( mnWidth && mnHeight ) + { + if ( mnMode == 0 ) + *mpOStm << "P6\x0a"; + else + *mpOStm << "P3\x0a"; + + ImplWriteNumber( mnWidth ); + *mpOStm << (BYTE)32; + ImplWriteNumber( mnHeight ); + *mpOStm << (BYTE)32; + ImplWriteNumber( 255 ); // max. col. + *mpOStm << (BYTE)10; + } + else + mbStatus = FALSE; + + return mbStatus; +} + +// ------------------------------------------------------------------------ + +void PPMWriter::ImplWriteBody() +{ + if ( mnMode == 0 ) + { + for ( ULONG y = 0; y < mnHeight; y++ ) + { + for ( ULONG x = 0; x < mnWidth; x++ ) + { + const BitmapColor& rColor = mpAcc->GetPixel( y, x ); + *mpOStm << rColor.GetRed(); + *mpOStm << rColor.GetGreen(); + *mpOStm << rColor.GetBlue(); + } + } + } + else + { + for ( ULONG y = 0; y < mnHeight; y++ ) + { + int nCount = 70; + for ( ULONG x = 0; x < mnWidth; x++ ) + { + BYTE i, nDat[3], nNumb; + if ( nCount < 0 ) + { + nCount = 69; + *mpOStm << (BYTE)10; + } + nDat[0] = mpAcc->GetPixel( y, x ).GetRed(); + nDat[1] = mpAcc->GetPixel( y, x ).GetGreen(); + nDat[2] = mpAcc->GetPixel( y, x ).GetBlue(); + for ( i = 0; i < 3; i++ ) + { + nNumb = nDat[ i ] / 100; + if ( nNumb ) + { + *mpOStm << (BYTE)( nNumb + '0' ); + nDat[ i ] -= ( nNumb * 100 ); + nNumb = nDat[ i ] / 10; + *mpOStm << (BYTE)( nNumb + '0' ); + nDat[ i ] -= ( nNumb * 10 ); + *mpOStm << (BYTE)( nDat[ i ] + '0' ); + nCount -= 4; + } + else + { + nNumb = nDat[ i ] / 10; + if ( nNumb ) + { + *mpOStm << (BYTE)( nNumb + '0' ); + nDat[ i ] -= ( nNumb * 10 ); + *mpOStm << (BYTE)( nDat[ i ] + '0' ); + nCount -= 3; + } + else + { + *mpOStm << (BYTE)( nDat[ i ] + '0' ); + nCount -= 2; + } + } + *mpOStm << (BYTE)' '; + } + } + *mpOStm << (BYTE)10; + } + } +} + +// ------------------------------------------------------------------------ +// eine Dezimalzahl im ASCII format wird in den Stream geschrieben + +void PPMWriter::ImplWriteNumber( sal_Int32 nNumber ) +{ + const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); + + for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ ) + *mpOStm << aNum.GetChar( n ); + +} + +// ------------------------------------------------------------------------ + +// --------------------- +// - exported function - +// --------------------- + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL ) +{ + PPMWriter aPPMWriter; + return aPPMWriter.WritePPM( rGraphic, rStream, pFilterConfigItem ); +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow ) + { + ByteString aResMgrName( "epp" ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEPPM( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +#ifndef GCC +#endif + +// ------------------------------------------------------------------------ + +// --------------- +// - Win16 trash - +// --------------- + +#ifdef WIN + +static HINSTANCE hDLLInst = 0; + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ + if ( nHeap ) + UnlockData( 0 ); + + hDLLInst = hDLL; + + return TRUE; +} + +// ------------------------------------------------------------------------ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/filter/source/graphicfilter/eppm/eppmstr.src b/filter/source/graphicfilter/eppm/eppmstr.src new file mode 100644 index 000000000000..8424505dbcd1 --- /dev/null +++ b/filter/source/graphicfilter/eppm/eppmstr.src @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "strings.hrc" + +// Key fuer den Dialog +String KEY_FORMAT +{ + Text = "FileFormat"; +}; diff --git a/filter/source/graphicfilter/eppm/exports.map b/filter/source/graphicfilter/eppm/exports.map new file mode 100644 index 000000000000..0462b75b7b43 --- /dev/null +++ b/filter/source/graphicfilter/eppm/exports.map @@ -0,0 +1,8 @@ +PPMEXPORTER_1_0 { + global: + GraphicExport; + DoExportDialog; + + local: + *; +}; diff --git a/filter/source/graphicfilter/eppm/makefile.mk b/filter/source/graphicfilter/eppm/makefile.mk new file mode 100644 index 000000000000..44e6ca11d34a --- /dev/null +++ b/filter/source/graphicfilter/eppm/makefile.mk @@ -0,0 +1,76 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=filter +TARGET=eppm +TARGET2=epp +DEPTARGET=veppm + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRS1NAME=$(TARGET) +SRC1FILES= dlgeppm.src \ + eppmstr.src +.IF "$(L10N_framework)"=="" +SLOFILES = $(SLO)$/eppm.obj \ + $(SLO)$/dlgeppm.obj +.ENDIF +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs +.IF "$(L10N_framework)"=="" +SHL1TARGET= epp$(DLLPOSTFIX) +SHL1IMPLIB= eppm +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(CPPULIB) $(SVTOOLLIB) $(SALLIB) + +SHL1LIBS= $(SLB)$/eppm.lib + +.IF "$(GUI)" != "UNX" +.IF "$(COM)" != "GCC" +SHL1OBJS= $(SLO)$/eppm.obj +.ENDIF +.ENDIF + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.ENDIF + +# ========================================================================== + +.INCLUDE : target.mk diff --git a/filter/source/graphicfilter/eppm/strings.hrc b/filter/source/graphicfilter/eppm/strings.hrc new file mode 100644 index 000000000000..122719e87d4b --- /dev/null +++ b/filter/source/graphicfilter/eppm/strings.hrc @@ -0,0 +1,27 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/eps/dlgeps.cxx b/filter/source/graphicfilter/eps/dlgeps.cxx new file mode 100644 index 000000000000..c6f2abba5912 --- /dev/null +++ b/filter/source/graphicfilter/eps/dlgeps.cxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" +#ifndef GCC +#endif + +#include <tools/ref.hxx> +#include <vcl/msgbox.hxx> +#include <svtools/FilterConfigItem.hxx> +#include "dlgeps.hxx" +#include "dlgeps.hrc" +#include "strings.hrc" + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, *rPara.pResMgr ) ), + rFltCallPara ( rPara ), + aGrpPreview ( this, ResId( GRP_PREVIEW, *rPara.pResMgr ) ), + aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF, *rPara.pResMgr ) ), + aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI, *rPara.pResMgr ) ), + aGrpVersion ( this, ResId( GRP_VERSION, *rPara.pResMgr ) ), + aRBLevel1 ( this, ResId( RB_LEVEL1, *rPara.pResMgr ) ), + aRBLevel2 ( this, ResId( RB_LEVEL2, *rPara.pResMgr ) ), + aGrpColor ( this, ResId( GRP_COLOR, *rPara.pResMgr ) ), + aRBColor ( this, ResId( RB_COLOR, *rPara.pResMgr ) ), + aRBGrayscale ( this, ResId( RB_GRAYSCALE, *rPara.pResMgr ) ), + aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ), + aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW, *rPara.pResMgr ) ), + aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE, *rPara.pResMgr ) ), + aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/EPS" ) ); + pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + // Config-Parameter lesen + String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ); + String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); + String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ); + String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ); + String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ); + + sal_Int32 nPreview = pConfigItem->ReadInt32( sPreview, 0 ); + sal_Int32 nVersion = pConfigItem->ReadInt32( sVersion, 2 ); + sal_Int32 nColor = pConfigItem->ReadInt32( sColorFormat, 0 ); + sal_Int32 nCompr = pConfigItem->ReadInt32( sCompressionMode, 2 ); + + /* SJ: The following line is not superfluous, reading the item will also #106652# + create the corresponding FilterData Property. Since all filter + are no longer accessing the configuration itself, we have fill the + FilterData sequence with all available configuration items */ + pConfigItem->ReadInt32( sTextMode, 0 ); + + BOOL bCheck = FALSE; + if ( nPreview & 1 ) + bCheck = TRUE; + aCBPreviewTiff.Check( bCheck ); + if ( nPreview & 2 ) + bCheck = TRUE; + aCBPreviewEPSI.Check( bCheck ); + + bCheck = FALSE; + if ( nVersion == 1 ) + bCheck ^= TRUE; + aRBLevel1.Check( bCheck ); + bCheck ^= TRUE; + aRBLevel2.Check( bCheck ); + + bCheck = FALSE; + if ( nColor == 1 ) + bCheck ^= TRUE; + aRBColor.Check( bCheck ); + bCheck ^= TRUE; + aRBGrayscale.Check( bCheck ); + + bCheck = FALSE; + if ( nCompr == 1 ) + bCheck ^= TRUE; + aRBCompressionLZW.Check( bCheck ); + bCheck ^= TRUE; + aRBCompressionNone.Check( bCheck ); + + if ( aRBLevel1.IsChecked() ) + { + aRBColor.Disable(); + aRBGrayscale.Disable(); + aRBCompressionNone.Disable(); + aRBCompressionLZW.Disable(); + aRBCompressionNone.Disable(); + } + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) ); + aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) ); + aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) ); +} + +DlgExportEPS::~DlgExportEPS() +{ + delete pConfigItem; +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG ) +{ + + // Config-Parameter schreiben + sal_Int32 nCheck = 0; + if ( aCBPreviewTiff.IsChecked() ) + nCheck++; + if ( aCBPreviewEPSI.IsChecked() ) + nCheck += 2; + + String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ); + pConfigItem->WriteInt32( sPreview, nCheck ); + + nCheck = 1; + if ( aRBLevel2.IsChecked() ) + nCheck++; + String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); + pConfigItem->WriteInt32( sVersion, nCheck ); + + nCheck = 1; + if ( aRBGrayscale.IsChecked() ) + nCheck++; + String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ); + pConfigItem->WriteInt32( sColorFormat, nCheck ); + + nCheck = 1; + if ( aRBCompressionNone.IsChecked() ) + nCheck++; + String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ); + pConfigItem->WriteInt32( sCompressionMode, nCheck ); + + rFltCallPara.aFilterData = pConfigItem->GetFilterData(); + EndDialog( RET_OK ); + + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG ) +{ + if ( aRBLevel1.IsChecked() ) + { + aRBColor.Disable(); + aRBGrayscale.Disable(); + aRBCompressionLZW.Disable(); + aRBCompressionNone.Disable(); + } + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG ) +{ + if ( aRBLevel2.IsChecked() ) + { + aRBColor.Enable(); + aRBGrayscale.Enable(); + aRBCompressionLZW.Enable(); + aRBCompressionNone.Enable(); + } + return 0; +} diff --git a/filter/source/graphicfilter/eps/dlgeps.hrc b/filter/source/graphicfilter/eps/dlgeps.hrc new file mode 100644 index 000000000000..061c8b2db6cb --- /dev/null +++ b/filter/source/graphicfilter/eps/dlgeps.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "filter.hrc" + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 +#define GRP_PREVIEW 1 +#define GRP_VERSION 2 +#define GRP_COLOR 3 +#define GRP_COMPRESSION 4 +#define CB_PREVIEW_TIFF 1 +#define CB_PREVIEW_EPSI 2 +#define RB_LEVEL1 1 +#define RB_LEVEL2 2 +#define RB_COLOR 3 +#define RB_GRAYSCALE 4 +#define RB_COMPRESSION_LZW 5 +#define RB_COMPRESSION_NONE 6 diff --git a/filter/source/graphicfilter/eps/dlgeps.hxx b/filter/source/graphicfilter/eps/dlgeps.hxx new file mode 100644 index 000000000000..ada390b44e87 --- /dev/null +++ b/filter/source/graphicfilter/eps/dlgeps.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DLGEPS_HXX_ +#define _DLGEPS_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <svtools/stdctrl.hxx> + + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class FilterConfigItem; +class ResMgr; + +class DlgExportEPS : public ModalDialog +{ +private: + + FltCallDialogParameter& rFltCallPara; + + FixedLine aGrpPreview; + CheckBox aCBPreviewTiff; + CheckBox aCBPreviewEPSI; + FixedLine aGrpVersion; + RadioButton aRBLevel1; + RadioButton aRBLevel2; + FixedLine aGrpColor; + RadioButton aRBColor; + RadioButton aRBGrayscale; + FixedLine aGrpCompression; + RadioButton aRBCompressionLZW; + RadioButton aRBCompressionNone; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + FilterConfigItem* pConfigItem; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + DECL_LINK( LEVEL1, void* ); + DECL_LINK( LEVEL2, void* ); + +public: + DlgExportEPS( FltCallDialogParameter& rPara ); + ~DlgExportEPS(); +}; + +#endif // _DLGEPS_HXX_ diff --git a/filter/source/graphicfilter/eps/dlgeps.src b/filter/source/graphicfilter/eps/dlgeps.src new file mode 100644 index 000000000000..31ddccd5be4f --- /dev/null +++ b/filter/source/graphicfilter/eps/dlgeps.src @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "dlgeps.hrc" +ModalDialog DLG_EXPORT_EPS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 230, 161 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text [ en-US ] = "EPS Export Options"; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 174 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 174, 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 174 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + + FixedLine GRP_PREVIEW + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text [ en-US ] = "Preview"; + }; + CheckBox CB_PREVIEW_TIFF + { + Pos = MAP_APPFONT ( 12, 14 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Image ~preview (TIFF)"; + }; + CheckBox CB_PREVIEW_EPSI + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Interchange (EPSI)"; + }; + FixedLine GRP_VERSION + { + Pos = MAP_APPFONT ( 6, 41 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text [ en-US ] = "Version"; + }; + RadioButton RB_LEVEL1 + { + Pos = MAP_APPFONT ( 12 , 52 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Level ~1"; + }; + RadioButton RB_LEVEL2 + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Level ~2"; + }; + + FixedLine GRP_COLOR + { + Pos = MAP_APPFONT ( 6 , 79 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text [ en-US ] = "Color format"; + }; + RadioButton RB_COLOR + { + Pos = MAP_APPFONT ( 12 , 90 ) ; + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Color"; + }; + RadioButton RB_GRAYSCALE + { + Pos = MAP_APPFONT ( 12 , 104 ) ; + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Grayscale"; + }; + + FixedLine GRP_COMPRESSION + { + Pos = MAP_APPFONT ( 6 , 117 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text [ en-US ] = "Compression"; + }; + RadioButton RB_COMPRESSION_LZW + { + Pos = MAP_APPFONT ( 12, 128 ); + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "LZW encoding"; + }; + RadioButton RB_COMPRESSION_NONE + { + Pos = MAP_APPFONT ( 12, 141 ) ; + Size = MAP_APPFONT ( 150, 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "None"; + }; +}; + + + + + + + + + + + + + + + + + + + + + diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx new file mode 100644 index 000000000000..5e221b58c72e --- /dev/null +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -0,0 +1,2793 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include <vcl/sv.h> +#include <tools/stream.hxx> +#include <tools/bigint.hxx> +#include <tools/poly.hxx> +#include <vcl/svapp.hxx> +#include <vcl/metaact.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/region.hxx> +#include <vcl/metric.hxx> +#include <vcl/font.hxx> +#include <vcl/virdev.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/cvtgrf.hxx> +#include <vcl/gradient.hxx> +#include <svl/solar.hrc> +#include <svtools/fltcall.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <vcl/graphictools.hxx> +#include "strings.hrc" +#include "dlgeps.hrc" +#include "dlgeps.hxx" + +#include <math.h> + +#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox + // in the first 4096 bytes + +#define EPS_PREVIEW_TIFF 1 +#define EPS_PREVIEW_EPSI 2 + +#define PS_LINESIZE 70 // maximum number of characters a line in the output + +#define PS_NONE 0 // formating mode: action which is inserted behind the output +#define PS_SPACE 1 +#define PS_RET 2 +#define PS_WRAP 4 + +// -----------------------------Feld-Typen------------------------------- + +struct ChrSet +{ + struct ChrSet * pSucc; + BYTE nSet; + String aName; + FontWeight eWeight; +}; + +struct StackMember +{ + struct StackMember * pSucc; + Color aGlobalCol; + BOOL bLineCol; + Color aLineCol; + BOOL bFillCol; + Color aFillCol; + Color aTextCol; + BOOL bTextFillCol; + Color aTextFillCol; + Color aBackgroundCol; + Font aFont; + TextAlign eTextAlign; + + double fLineWidth; + double fMiterLimit; + SvtGraphicStroke::CapType eLineCap; + SvtGraphicStroke::JoinType eJoinType; + SvtGraphicStroke::DashArray aDashArray; +}; + +struct PSLZWCTreeNode +{ + + PSLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat + PSLZWCTreeNode* pFirstChild; // erster Sohn + USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn + USHORT nValue; // Der Pixelwert +}; + +class PSWriter +{ +private: + BOOL mbStatus; + ULONG mnLevelWarning; // number of embedded eps files which was not exported + ULONG mnLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde. + UINT32 mnLatestPush; // offset auf streamposition, an der zuletzt gepusht wurde + + long mnLevel; // dialog options + sal_Bool mbGrayScale; + sal_Bool mbCompression; + sal_Int32 mnPreview; + sal_Int32 mnTextMode; + + SvStream* mpPS; + const GDIMetaFile* pMTF; + GDIMetaFile* pAMTF; // only created if Graphics is not a Metafile + VirtualDevice aVDev; + + double nBoundingX1; // this represents the bounding box + double nBoundingY1; + double nBoundingX2; + double nBoundingY2; + // + StackMember* pGDIStack; + ULONG mnCursorPos; // aktuelle Cursorposition im Output + Color aColor; // aktuelle Farbe die fuer den Output benutzt wird + BOOL bLineColor; + Color aLineColor; // aktuelle GDIMetafile Farbeinstellungen + BOOL bFillColor; // + Color aFillColor; // + Color aTextColor; // + BOOL bTextFillColor; // + Color aTextFillColor; // + Color aBackgroundColor; // + BOOL bRegionChanged; + TextAlign eTextAlign; // + + double fLineWidth; + double fMiterLimit; + SvtGraphicStroke::CapType eLineCap; + SvtGraphicStroke::JoinType eJoinType; + SvtGraphicStroke::DashArray aDashArray; + + Font maFont; + Font maLastFont; + BYTE nChrSet; + ChrSet* pChrSetList; // Liste der Character-Sets + BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id + + PSLZWCTreeNode* pTable; // LZW compression data + PSLZWCTreeNode* pPrefix; // the compression is as same as the TIFF compression + USHORT nDataSize; + USHORT nClearCode; + USHORT nEOICode; + USHORT nTableSize; + USHORT nCodeSize; + ULONG nOffset; + ULONG dwShift; + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + + void ImplWriteProlog( const Graphic* pPreviewEPSI = NULL ); + void ImplWriteEpilog(); + void ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ); + + // this method makes LF's, space inserting and word wrapping as used in all nMode + // parameters + inline void ImplExecMode( ULONG nMode ); + + // writes char[] + LF to stream + inline void ImplWriteLine( const char*, ULONG nMode = PS_RET ); + + // writes ( nNumb / 10^nCount ) in ASCII format to stream + void ImplWriteF( sal_Int32 nNumb, ULONG nCount = 3, ULONG nMode = PS_SPACE ); + + // writes a double in ASCII format to stream + void ImplWriteDouble( double, ULONG nMode = PS_SPACE ); + + // writes a long in ASCII format to stream + void ImplWriteLong( sal_Int32 nNumb, ULONG nMode = PS_SPACE ); + + // writes a byte in ASCII format to stream + void ImplWriteByte( BYTE nNumb, ULONG nMode = PS_SPACE ); + + // writes a byte in ASCII (hex) format to stream + void ImplWriteHexByte( BYTE nNumb, ULONG nMode = PS_WRAP ); + + // writes nNumb as number from 0.000 till 1.000 in ASCII format to stream + void ImplWriteB1( BYTE nNumb, ULONG nMode = PS_SPACE ); + + inline void ImplWritePoint( const Point&, sal_uInt32 nMode = PS_SPACE ); + void ImplMoveTo( const Point&, sal_uInt32 nMode = PS_SPACE ); + void ImplLineTo( const Point&, sal_uInt32 nMode = PS_SPACE ); + void ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode = PS_SPACE ); + void ImplTranslate( const double& fX, const double& fY, sal_uInt32 nMode = PS_RET ); + void ImplScale( const double& fX, const double& fY, sal_uInt32 nMode = PS_RET ); + + void ImplWriteLine( const Polygon & rPolygon ); + void ImplAddPath( const Polygon & rPolygon ); + void ImplWriteLineInfo( double fLineWidth, double fMiterLimit, SvtGraphicStroke::CapType eLineCap, + SvtGraphicStroke::JoinType eJoinType, SvtGraphicStroke::DashArray& rDashArray ); + void ImplWriteLineInfo( const LineInfo& rLineInfo ); + void ImplRect( const Rectangle & rRectangle ); + void ImplRectFill ( const Rectangle & rRectangle ); + void ImplWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev ); + void ImplIntersect( const PolyPolygon& rPolyPoly ); + void ImplPolyPoly( const PolyPolygon & rPolyPolygon, sal_Bool bTextOutline = sal_False ); + void ImplPolyLine( const Polygon & rPolygon ); + + void ImplSetClipRegion( Region& rRegion ); + void ImplBmp( Bitmap*, Bitmap*, const Point &, double nWidth, double nHeight ); + void ImplText( const String& rUniString, const Point& rPos, const INT32* pDXArry, sal_Int32 nWidth, VirtualDevice& rVDev ); + void ImplSetAttrForText( const Point & rPoint ); + void ImplWriteCharacter( sal_Char ); + void ImplWriteString( const ByteString&, VirtualDevice& rVDev, const INT32* pDXArry = NULL, BOOL bStretch = FALSE ); + void ImplDefineFont( const char*, const char* ); + + void ImplClosePathDraw( ULONG nMode = PS_RET ); + void ImplPathDraw(); + + inline void ImplWriteLineColor( ULONG nMode = PS_RET ); + inline void ImplWriteFillColor( ULONG nMode = PS_RET ); + inline void ImplWriteTextColor( ULONG nMode = PS_RET ); + inline void ImplWriteTextFillColor( ULONG nMode = PS_RET ); + void ImplWriteColor( ULONG nMode ); + + double ImplGetScaling( const MapMode& ); + void ImplGetMapMode( const MapMode& ); + BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ); + BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ); + // LZW methods + void StartCompression(); + void Compress( BYTE nSrc ); + void EndCompression(); + inline void WriteBits( USHORT nCode, USHORT nCodeLen ); + +public: + BOOL WritePS( const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem* ); + PSWriter(); + ~PSWriter(); +}; + +//========================== Methoden von PSWriter ========================== + +//--------------------------------------------------------------------------------- + +PSWriter::PSWriter() +{ + pAMTF = NULL; +} + + +PSWriter::~PSWriter() +{ + delete pAMTF; +} + +//--------------------------------------------------------------------------------- + +BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem* pFilterConfigItem ) +{ + UINT32 nStreamPosition = 0, nPSPosition = 0; // -Wall warning, unset, check + + mbStatus = TRUE; + mnPreview = 0; |