diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-15 21:55:40 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-15 21:55:40 +0100 |
commit | 4770f50e0c8e6706f0f514bd73a8bcfd7dd88cb3 (patch) | |
tree | b21b3409ecc71d4802ab2f5eafd6e01c3bfd5254 | |
parent | 003fc5390522ecad9e1f3a2c99b2a0a324ae5473 (diff) |
#i107706#: liquidate goodies module
220 files changed, 163 insertions, 45531 deletions
diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst index df1f8e9f31d3..28e8524a9b38 100644 --- a/canvas/prj/build.lst +++ b/canvas/prj/build.lst @@ -1,4 +1,4 @@ -cv canvas : javaunohelper comphelper cppuhelper offuh unoil tools goodies vcl AGG:agg basegfx CAIRO:cairo NULL +cv canvas : javaunohelper comphelper cppuhelper offuh unoil tools svtools vcl AGG:agg basegfx CAIRO:cairo NULL cv canvas usr1 - all cv_mkout NULL cv canvas\inc nmake - all cv_inc NULL cv canvas\source\tools nmake - all cv_tools cv_inc NULL diff --git a/canvas/source/vcl/cachedbitmap.hxx b/canvas/source/vcl/cachedbitmap.hxx index 8f60f1661a9b..dad3c640de48 100644 --- a/canvas/source/vcl/cachedbitmap.hxx +++ b/canvas/source/vcl/cachedbitmap.hxx @@ -33,7 +33,7 @@ #include <canvas/base/cachedprimitivebase.hxx> -#include <goodies/grfmgr.hxx> +#include <svtools/grfmgr.hxx> #include <boost/shared_ptr.hpp> diff --git a/canvas/source/vcl/makefile.mk b/canvas/source/vcl/makefile.mk index fdfdd62d16b8..9e05587fcb4d 100644 --- a/canvas/source/vcl/makefile.mk +++ b/canvas/source/vcl/makefile.mk @@ -73,7 +73,7 @@ SLOFILES = $(SLO)$/backbuffer.obj \ SHL1TARGET=$(TARGET).uno -SHL1STDLIBS= $(TOOLSLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(GOODIESLIB) $(I18NISOLANGLIB) +SHL1STDLIBS= $(TOOLSLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(SVTOOLLIB) $(I18NISOLANGLIB) SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib diff --git a/goodies/inc/agapidll.hxx b/goodies/inc/agapidll.hxx deleted file mode 100644 index a8cd14dcc71d..000000000000 --- a/goodies/inc/agapidll.hxx +++ /dev/null @@ -1,80 +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: agapidll.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _AGAPIDLL_HXX -#define _AGAPIDLL_HXX - -#include "tools/agapi.hxx" -#include "agsdkdll.hxx" - -class ChannelList; -class ChannelAgentItem; -class INetURLObject; -class Library; - -class AgentApiDll : public AgentApi -{ - Library* pAgentDll; - ChannelApiFncs aChannelApiFncs; - - FncInitAgent fncInitAgent; - FncShutDownAgent fncShutDownAgent; - FncNewDataPermission fncNewDataPermission; - FncNewData fncNewData; - FncNotifyChannelObjFile fncNotifyChannelObjFile; - FncNotifyChannelObjData fncNotifyChannelObjData; - FncRegisterChannels fncRegisterChannels; - FncRegisterUpdateTransmitter fncRegisterUpdateTransmitter; - -protected: - friend class ChannelList; - virtual BOOL StartAgent(); - -public: - AgentApiDll(ChannelAgentItem* pAgent); - ~AgentApiDll(); - - virtual void InitAgent(); - virtual void ShutDownAgent(); - - virtual BOOL NewDataPermission(const String& rChannelName); - virtual void NewData(const String& rChannelName, const INetURLObject& rURL); - - virtual void NotifyChannelObjFile(const INetURLObject& rURL, - const String& rFileName); - virtual void NotifyChannelObjData(const INetURLObject& rURL, - void* pBuffer, long nOffset, long nLen, long nTotalLen); - - virtual void RegisterChannels(); - virtual void RegisterUpdateTransmitter(); -}; - -#endif //_AGAPIDLL_HXX - diff --git a/goodies/inc/agsdkdll.hxx b/goodies/inc/agsdkdll.hxx deleted file mode 100644 index 2cd9ef7d1e7f..000000000000 --- a/goodies/inc/agsdkdll.hxx +++ /dev/null @@ -1,153 +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: agsdkdll.hxx,v $ - * $Revision: 1.4 $ - * - * 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 _AGSDKDLL_HXX -#define _AGSDKDLL_HXX - -#ifndef _SV_CALL -#if defined(WIN) || defined(WNT) || ( defined(OS2) && !defined( ICC )) -#define _SV_CALL _cdecl -#elif defined( ICC ) && defined( OS2 ) -#define _SV_CALL __cdecl -#else -#define _SV_CALL -#endif -#endif - -#define AGSDKDLL_VERSION 2 - -typedef void* AgentInst; - -//////////////////////////////////////////////////////////////////////////////// -// Channel API Functions -// - -enum AgentStreamType { - AS_LOCAL_FILE = 1, - AS_MEMORY = 2 -}; - -typedef void (_SV_CALL *FncChShutDownAgent)(AgentInst pAg); - -typedef void (_SV_CALL *FncChSetLastSuccUpd)(AgentInst pAg); - -typedef void (_SV_CALL *FncChGetChannelObj)(AgentInst pAg, const char* pURL, - AgentStreamType eStreamType, const char* pFileName); - -typedef void (_SV_CALL *FncChAddChannelItem)(AgentInst pAg, const char* pName, - const char* pTransmitter, const char* pChannel, unsigned short nUpdPeriode, - const char* pAgentName ); - -typedef void (_SV_CALL *FncChDelChannelItem)(AgentInst pAg, const char* pChName); - -typedef void (_SV_CALL *FncChSetTransmitter)(AgentInst pAg, const char* pChName, - const char* pURL); - -typedef void (_SV_CALL *FncChSetChannel)(AgentInst pAg, const char* pChName, - const char* pRelURL); - -typedef void (_SV_CALL *FncChSetChannelName)(AgentInst pAg, const char* pChName, - const char* pNewChName); - -typedef void (_SV_CALL *FncChSetUpdPeriode)(AgentInst pAg, const char* pChName, - unsigned short nUpdPeriode); - -typedef void (_SV_CALL *FncChSetChannelAgentName)(AgentInst pAg, const char* pChName, - const char* pAgName); - -typedef void (_SV_CALL *FncChSetUpdateTransmitter)(AgentInst pAg, - const char* pTransmitter); - -typedef const char* (_SV_CALL *FncChGetAgentSourceURL)(AgentInst pAg); - -struct ChannelApiFncs -{ - unsigned short nVersion; - FncChShutDownAgent fncShutDownAgent; - FncChSetLastSuccUpd fncSetLastSuccUpd; - FncChGetChannelObj fncGetChannelObj; - FncChAddChannelItem fncAddChannelItem; - FncChDelChannelItem fncDelChannelItem; - FncChSetTransmitter fncSetTransmitter; - FncChSetChannel fncSetChannel; - FncChSetChannelName fncSetChannelName; - FncChSetUpdPeriode fncSetUpdPeriode; - FncChSetChannelAgentName fncSetChannelAgentName; - FncChSetUpdateTransmitter fncSetUpdateTransmitter; - FncChGetAgentSourceURL fncGetAgentSourceURL; -}; - -//////////////////////////////////////////////////////////////////////////////// -// Agent API Functions -// - -#if defined(WIN) || defined(WNT) || defined(OS2) || defined(UNX) -extern "C" { -#endif - -typedef void (_SV_CALL *FncInitAgent)(AgentInst, ChannelApiFncs*); -void _SV_CALL InitAgent(AgentInst, ChannelApiFncs*); - -typedef void (_SV_CALL *FncShutDownAgent)(); -void _SV_CALL ShutDownAgent(); - -// NewDataPermission -// ChannelName -typedef unsigned char (_SV_CALL *FncNewDataPermission)(const char*); -unsigned char _SV_CALL NewDataPermission(const char*); - -// NewData -// ChannelName, URL -typedef void (_SV_CALL *FncNewData)(const char*, const char*); -void _SV_CALL NewData(const char*, const char*); - -// NotifyChannelObjFile -// URL, abs. Filename -typedef void (_SV_CALL *FncNotifyChannelObjFile)(const char*, const char*); -void _SV_CALL NotifyChannelObjFile(const char*, const char*); - -// NotifyChannelObjData -// URL, Buffer, Offset, Len, TotalLen -typedef void (_SV_CALL *FncNotifyChannelObjData)(const char*, void*, long, long, long); -void _SV_CALL NotifyChannelObjData(const char*, void*, long, long, long); - -typedef void (_SV_CALL *FncRegisterChannels)(AgentInst, ChannelApiFncs*); -void _SV_CALL RegisterChannels(AgentInst, ChannelApiFncs*); - -typedef void (_SV_CALL *FncRegisterUpdateTransmitter)(AgentInst, ChannelApiFncs*); -void _SV_CALL RegisterUpdateTransmitter(AgentInst, ChannelApiFncs*); - -#if defined(WIN) || defined(WNT) || defined(OS2) || defined(UNX) -} -#endif - -#endif //_AGSDKDLL_HXX - - diff --git a/goodies/inc/chagent.hxx b/goodies/inc/chagent.hxx deleted file mode 100644 index fcd78184db37..000000000000 --- a/goodies/inc/chagent.hxx +++ /dev/null @@ -1,199 +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: chagent.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _CHAGENT_HXX -#define _CHAGENT_HXX - -#include <tools/list.hxx> -#include <tools/urlobj.hxx> - -#include <tools/agitem.hxx> - -class ChannelAgentItem; -class ChannelItem; - -DECLARE_LIST(ChannelAgentItemList,ChannelAgentItem*) - -enum AgentType -{ - AG_TYP_DONTKNOW = 0, - AG_TYP_DLL = 1, - AG_TYP_BASIC = 2, - AG_TYP_JAVA = 3 -}; - -#define STR_AG_TYP_DLL "DLL" -#define STR_AG_TYP_BASIC "BASIC" -#define STR_AG_TYP_JAVA "JAVA" - -class ChannelAgentItem : public AgentItem -{ - AgentType eAgentType; - String aChAgentName; - INetURLObject aLocation; - ULONG nLastSuccUpdDate; - long nLastSuccUpdTime; - INetURLObject aSource; - BOOL bEnabled; - DateTime aLastCheckDate; - - // runtime - BOOL bIsActive; - BOOL bIsInUpdate; - BOOL bRestartAfterUpdate; - - ULONG nChObjDate; - long nChObjTime; - ChannelItem* pActChannel; - AgentApi* pAgentApi; - ChannelApi* pChannelApi; - INetURLObject aSourceURL; - - Link aBTXShutdownCallback; - -protected: - friend class ChannelApi; - void DeleteApis(); - -public: - ChannelAgentItem(); - ~ChannelAgentItem(); - - // Set / Get AgentType - void SetChannelAgentType(AgentType eNew) - { eAgentType = eNew; } - AgentType GetChannelAgentType() const - { return eAgentType; } - - // Set / Get ChAgentName - void SetChAgentName(const String& rNew) - { aChAgentName = rNew; } - virtual const String& GetChAgentName() const - { return aChAgentName; } - - // Set / Get Location - void SetLocation(const INetURLObject& rNew) - { aLocation = rNew; } - virtual const INetURLObject& GetLocation() const - { return aLocation; } - - // Set / Get LastSuccUpdDate - void SetLastSuccUpdDate(ULONG nNew) - { nLastSuccUpdDate = nNew; } - ULONG GetLastSuccUpdDate() const - { return nLastSuccUpdDate; } - - // Set / Get LastSuccUpdTime - void SetLastSuccUpdTime(ULONG nNew) - { nLastSuccUpdTime = nNew; } - ULONG GetLastSuccUpdTime() const - { return nLastSuccUpdTime; } - - // Set / Get LastCheckDate - void SetLastCheckDate( const DateTime& rNew ) - { aLastCheckDate = rNew; } - const DateTime& GetLastCheckDate() - { return aLastCheckDate; } - - // Set / Get Source - void SetSource(const INetURLObject& rNew) - { aSource = rNew; } - const INetURLObject& GetSource() const - { return aSource; } - - // Set / Get Enabled - virtual void SetEnabled(BOOL bNew = TRUE) - { bEnabled = bNew; } - virtual BOOL IsEnabled() const - { return bEnabled; } - - // Set / Get IsActive - virtual void SetIsActive(BOOL bNew) - { bIsActive = bNew; } - virtual BOOL IsActive() const - { return bIsActive; } - - // runtime //////////////////////////////////////////////////////////////// - - const INetURLObject& GetAgentSourceURL() const - { return aSourceURL; } - void SetAgentSourceURL(const INetURLObject& rNew) - { aSourceURL = rNew; } - - // Set / Get ActiveChannel - void SetActiveChannel(ChannelItem* pChItem) - { pActChannel = pChItem; } - ChannelItem* GetActiveChannel() const - { return pActChannel; } - - // Set / Get IsInUpdate - void SetIsInUpdate( BOOL bNew ) - { bIsInUpdate = bNew; } - BOOL IsInUpdate() const - { return bIsInUpdate; } - - // Set / Get RestartAfterUpdate - void SetRestartAfterUpdate( BOOL bNew ) - { bRestartAfterUpdate = bNew; } - BOOL RestartAfterUpdate() const - { return bRestartAfterUpdate; } - - // AgentAPI - void SetApi(AgentApi* pNew ) - { pAgentApi = pNew; } - virtual AgentApi* GetApi() const - { return pAgentApi; } - - // ChannelAPI - void SetChApi(ChannelApi* pNew ) - { pChannelApi = pNew; } - virtual ChApi* GetChApi() const - { return (ChApi*)pChannelApi; } - - // Set / Get ChObjDate - void SetChObjDate(ULONG nNew) - { nChObjDate = nNew; } - ULONG GetChObjDate() const - { return nChObjDate; } - - // Set / Get ChObjTime - void SetChObjTime(long nNew) - { nChObjTime = nNew; } - long GetChObjTime() const - { return nChObjTime; } - - void SetBTXShutDownCallBack(const Link& rLnk ) - { aBTXShutdownCallback = rLnk; } - const Link& GetBTXShutDownCallBack() - { return aBTXShutdownCallback; } - -}; - -#endif // _CHAGENT_HXX diff --git a/goodies/inc/chanapi.hxx b/goodies/inc/chanapi.hxx deleted file mode 100644 index abbb272ef22f..000000000000 --- a/goodies/inc/chanapi.hxx +++ /dev/null @@ -1,84 +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: chanapi.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _CHANAPI_HXX -#define _CHANAPI_HXX - - -#include <tools/list.hxx> -#include <tools/chapi.hxx> - -#ifndef _INETSES_HXX //autogen -#include <inet/inetsess.hxx> -#endif - -class ChannelAgentItem; -class ChannelList; -class INetURLObject; -class GetChannelObj; - -DECLARE_LIST(GetChObjList, GetChannelObj*); - -class ChannelApi : public ChApi -{ - INetSessionRef xINetSession; - - ChannelAgentItem* pChAgent; - ChannelList* pChannelList; - - GetChObjList* pGetChObjList; - - DECL_LINK(CloseAgentEvt, void*); - DECL_LINK(CloseChannelObjEvt, void*); - DECL_LINK(GetChannelObjNotify, GetChannelObj*); -public: - ChannelApi( ChannelAgentItem* pAgent, INetSession* pISess, - ChannelList* pChLst ); - ~ChannelApi(); - - void ShutDownAgent(); - void SetLastSuccUpd(); - - void GetChannelObject( const INetURLObject& rURL, RequestType eStreamType, - const String& rFileName ); - void AddChannelItem( const String& aChName, const INetURLObject& aTransmitter, - const String& aChannel, USHORT nUpdPeriode, - const String& rChAgentName ); - void DelChannelItem( const String& aChName ); - void SetChTransmitter( const String& aChName, const String& rNewVal ); - void SetChannel( const String& aChName, const String& rNewVal ); - void SetChannelName( const String& aChName, const String& rNewVal ); - void SetChUpdPeriode( const String& aChName, USHORT nUpdPeriode ); - void SetChannelAgentName( const String& aChName, const String& rNewVal ); - - void SetUpdateTransmitter(ChannelAgentItem* pAgent, const INetURLObject& rTransmitter); -}; - -#endif //_CHANAPI_HXX diff --git a/goodies/inc/channel.hxx b/goodies/inc/channel.hxx deleted file mode 100644 index bd609bb8d544..000000000000 --- a/goodies/inc/channel.hxx +++ /dev/null @@ -1,113 +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: channel.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _CHANNEL_HXX -#define _CHANNEL_HXX - -#include <tools/list.hxx> -#include <tools/urlobj.hxx> - -class ChannelItem; -DECLARE_LIST(ChannelItemList,ChannelItem*) - -class ChannelItem -{ - INetURLObject aTransmitter; - String aChannel; - String aChannelName; - String aChannelAgentName; - ULONG nUpdatePeriode; - ULONG nLastTimerTick; - ULONG nLastSuccUpdDate; - long nLastSuccUpdTime; - - BOOL bAgentUpdChannel; - -public: - ChannelItem(); - ~ChannelItem(); - - // Set / Get Transmitter - void SetTransmitter(const INetURLObject& rNew) - { aTransmitter = rNew; } - const INetURLObject& GetTransmitter() const - { return aTransmitter; } - - // Set / Get Channel - void SetChannel(const String& rNew) - { aChannel = rNew; } - const String& GetChannel() const - { return aChannel; } - - // Set / Get ChannelName - void SetChannelName(const String& rNew) - { aChannelName = rNew; } - const String& GetChannelName() const - { return aChannelName; } - - // Set / Get ChannelAgentName - void SetChannelAgentName(const String& rNew) - { aChannelAgentName = rNew; } - const String& GetChannelAgentName() const - { return aChannelAgentName; } - - // Set / Get UpdatePeriode - void SetUpdatePeriode(ULONG nNew) - { nUpdatePeriode = nNew; } - ULONG GetUpdatePeriode() const - { return nUpdatePeriode; } - - // Set / Get LastTimerTick - void SetLastTimerTick(ULONG nNew) - { nLastTimerTick = nNew; } - ULONG GetLastTimerTick() const - { return nLastTimerTick; } - - // Set / Get LastSuccUpdDate - void SetLastSuccUpdDate(ULONG nNew) - { nLastSuccUpdDate = nNew; } - ULONG GetLastSuccUpdDate() const - { return nLastSuccUpdDate; } - - // Set / Get LastSuccUpdTime - void SetLastSuccUpdTime(long nNew) - { nLastSuccUpdTime = nNew; } - long GetLastSuccUpdTime() const - { return nLastSuccUpdTime; } - - // Set / Get AgentUpdChannel - void SetAgentUpdChannel(BOOL bNew) - { bAgentUpdChannel = bNew; } - BOOL GetAgentUpdChannel() const - { return bAgentUpdChannel; } -}; - -#endif // _CHANNEL_HXX - diff --git a/goodies/inc/chlist.hxx b/goodies/inc/chlist.hxx deleted file mode 100644 index cabf4f381576..000000000000 --- a/goodies/inc/chlist.hxx +++ /dev/null @@ -1,219 +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: chlist.hxx,v $ - * $Revision: 1.4 $ - * - * 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 _CHLIST_HXX -#define _CHLIST_HXX - -#include <tools/urlobj.hxx> -#include <tools/datetime.hxx> -#include <tools/string.hxx> -#include <vcl/timer.hxx> -#include <tools/list.hxx> -#ifndef _INETSES_HXX //autogen -#include <inet/inetsess.hxx> -#endif - -class Downloader; -class ChannelAgentItem; -class ChannelItem; -class ChannelItemList; -class ChannelAgentItemList; -class ChannelTuner; -class ChannelApi; -class GetChannelObj; -class GetChObjList; -class NotifyItem; -class Date; -class Time; -class ResMgr; - -struct UiAgentItem -{ - String aName; - ULONG aUpdPeriode; - DateTime aLastDataDate; - DateTime aLastUpdDate; - BOOL bUnregister; - BOOL bIsEnabled; -}; - -DECLARE_LIST(UiAgentList, UiAgentItem*) -DECLARE_LIST(NotifyList, NotifyItem*) - -#ifndef STRING_LIST -#define STRING_LIST -#define _TOOLS_STRINGLIST -#include <tools/sstring.hxx> -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// -#define JOBID_DOWNLOAD_AGENT 1 -#define JOBID_UPDATE_AGENT 2 -#define JOBID_CHECK_TRANSMITTER 3 - -struct BTXResponse -{ - USHORT nJobId; - BOOL bFinish; - ULONG nTransferStatus; - String aLocalFileName; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// -class ChannelList -{ - ResMgr* pResMgr; - ChannelAgentItemList* pAgentList; - ChannelItemList* pChannelList; - NotifyList* pNotifyList; - GetChObjList* pGetChObjList; - UiAgentList* pUiAgentList; - - ChannelTuner* pChannelTuner; - - String aAgentPath; - AutoTimer aTimer; - INetSessionRef xINetSession; - - Link aNotifyPermissionHdl; - Link aCheckFinishHdl; - // wird von der ChannelList gehandelt; sollte ausgebaut werden; auch im SFX - Link aAgentUpdateHdl; - Downloader* pBTXDecoder; - - void MakeGodChannel(ChannelAgentItem* pAgent); - void DeleteUiAgentList(); - - BOOL StartAgent(ChannelAgentItem* pAgent); - - void DoNotifyAgents(); - void NotifyAgent(ChannelAgentItem* pAgent, ULONG nNotifyItemIdx); - - void UpdateAgent(ChannelAgentItem* pAgent, ULONG nNotifyItemIdx); - void SendItemToTuner(ChannelItem* pItem); - - BOOL ParseDateTime(const String& rSrc, Date& rDate, Time& rTime); - - void UnZipAgent(ChannelAgentItem* pAgent); - static void EnumFilesCallBack(char *pFile, void *pObject); - - DECL_LINK(CheckChannels, void*); - DECL_LINK(CloseChannelObjEvt, void*); - DECL_LINK(GetChannelObjNotify, GetChannelObj*); -protected: - friend class ChannelApi; - friend class ChannelTuner; - - ChannelItem* GetChannelItemByName(const String& rName); - ChannelAgentItem* GetAgentItemByName(const String& rName); - - void ReadChannelList(); - void ReadAgentList(); - void WriteChannelItem(ChannelItem* pItem); - void WriteAgentItem(ChannelAgentItem* pChAgent); - void SetLastSuccUpdChannel(ChannelAgentItem* pChAgent); - void SetLastSuccUpdAgent(ChannelAgentItem* pChAgent); - void SetEnabledAgent(ChannelAgentItem* pChAgent); - - void DeleteAgentItem(ChannelAgentItem* pItem); - void DeleteChannelItem(ChannelItem* pItem); - void RegisterNewChannelItem(ChannelItem* pItem); - - void CancelBTX(); - Downloader* GetBTXDecoder() const { return pBTXDecoder; } - ResMgr* GetResMgr() const { return pResMgr; } - - DECL_LINK(CheckBTXFinishHdl, void*); - - void NotifyTransmitterMsg(const String& rStr); - -public: - ChannelList(const String& rAgentPath); - ~ChannelList(); - - void SubscribeNewAgent(const INetURLObject& rURL); - - void SetINetSession(INetSession* pNewSess); - void SetBTXDecoder(Downloader* pDecoder); - - void SetNotifyPermissionHdl(const Link& rHdl) { aNotifyPermissionHdl = rHdl; } - void SetAgentUpdateHdl(const Link& rHdl) { aAgentUpdateHdl = rHdl; } - - void SetTimerInterval(ULONG nNew); - void StartCheckChannels(); - void StopCheckChannels(); - - void CheckAgentNow(const String& rAgName, BOOL bCheckGOD = FALSE); - void SetCheckFinishHdl(const Link& rHdl) { aCheckFinishHdl = rHdl; } - const Link& GetCheckFinishHdl() const { return aCheckFinishHdl;}; - - UiAgentList* GetUiAgentList(); - void JoinUiAgentList(); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// -class NotifyItem -{ - ChannelItem* pChItem; - - USHORT nGMTOffset; - ULONG nDateLastUpd; - long nTimeLastUpd; - INetURLObject aChObjURL; - String aChName; -public: - NotifyItem( ChannelItem* pItem, short nGMTOff, ULONG nLastDate, - ULONG nLastTime, const INetURLObject& rChObjURL, - const String& rChName); - ~NotifyItem(); - - ChannelItem* GetChannelItem() const { return pChItem; } - - const String& GetChannelName() const { return aChName; } - const INetURLObject GetChannelObjURL() const { return aChObjURL; } - - void SetDateLastUpd(ULONG nNew) { nDateLastUpd = nNew; } - ULONG GetDateLastUpd() const { return nDateLastUpd; } - - void SetTimeLastUpd(long nNew) { nTimeLastUpd = nNew; } - long GetTimeLastUpd() const { return nTimeLastUpd; } - - const String& GetChAgentName() const; - -}; - -#endif // _CHLIST_HXX - diff --git a/goodies/inc/chresid.hxx b/goodies/inc/chresid.hxx deleted file mode 100644 index aff5898f8003..000000000000 --- a/goodies/inc/chresid.hxx +++ /dev/null @@ -1,44 +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: chresid.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _CHRESID_HXX -#define _CHRESID_HXX - -/////////////////////////////////////////////////////////////////////////////// -// legt den ResourceManager fuer die ChannelList in den APPDaten ab. -// -class ChannelResDll -{ -public: - ChannelResDll(); - ~ChannelResDll(); -}; - -#endif //_CHRESID_HXX - diff --git a/goodies/inc/chtuner.hxx b/goodies/inc/chtuner.hxx deleted file mode 100644 index 7a54c1e05a41..000000000000 --- a/goodies/inc/chtuner.hxx +++ /dev/null @@ -1,94 +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: chtuner.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _CHTUNER_HXX -#define _CHTUNER_HXX - -#include <vcl/timer.hxx> -#include <tools/list.hxx> -#ifndef _INETSESS_HXX -#include <inet/inetsess.hxx> -#endif - - -#include <svl/lstner.hxx> - -class ChannelItem; -class ChannelList; -class INetRequest; -class Downloader; -class StringList; - -struct RetryInformation -{ - String aURL; - Time aErrorTime; -}; - -DECLARE_LIST(ReqList,INetRequest*) -DECLARE_LIST(RetryList,RetryInformation*) - -class ChannelTuner : public SfxListener -{ - ChannelList* pChannelList; - INetSessionRef xINetSession; - ReqList* pReqList; - - Link aBTXCallBack; - Downloader* pBTXDecoder; - String aBTXFileName; - - AutoTimer aRetryTimer; - RetryList* pRetryList; - - void SendHttpReq(const INetURLObject& rURL); - void SendFtpReq(const INetURLObject& rURL); - void SendBTXReq(const INetURLObject& rURL); - void GetFileTrans(const INetURLObject& rURL); - - void RemoveRequest(INetRequest* pReq); - void NotifyChannelList(String& rStr); - - virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, - const SfxHint& rHint, const TypeId& rHintType); - - DECL_LINK(RetryCallBack, void*); - DECL_LINK(BTXCallBack, void*); -public: - ChannelTuner(INetSession* pSess, ChannelList* pChList); - ~ChannelTuner(); - - BOOL RequestChannel(ChannelItem* pItem, const Link& rBTXCallBack); - - void SetINetSession(INetSession* pNewSess); - void SetBTXDecoder(Downloader* pDecoder); -}; - -#endif // _CHTUNER_HXX diff --git a/goodies/inc/crypt.hxx b/goodies/inc/crypt.hxx deleted file mode 100644 index 24e4215a3fda..000000000000 --- a/goodies/inc/crypt.hxx +++ /dev/null @@ -1,62 +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: crypt.hxx,v $ - * $Revision: 1.4 $ - * - * 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 --------------------------------------------------------------- -#include <tools/gen.hxx> - -// define ---------------------------------------------------------------- - -#define nInOfs 0x00010000UL -#define nOutOfs 0x00020000UL - -// cryptit --------------------------------------------------------------- - -extern "C" -{ -//ULONG testdll(const String& ,const String& , const String&, BOOL DoCrypt ); -//ULONG __EXPORT testdll(const char* pCrInName, const char* pCrOutName, -// const char* pCrKey, BOOL DoCrypt=1); -#if defined (UNX) -extern ULONG cryptit(const char* pCrInName, const char* pCrOutName, -#else -#ifdef WNT -extern ULONG __stdcall cryptit(const char* pCrInName, const char* pCrOutName, -#else -#if defined( MTW ) || defined( ICC ) -extern ULONG cryptit(const char* pCrInName, const char* pCrOutName, -#else -extern ULONG __pascal cryptit(const char* pCrInName, const char* pCrOutName, -#endif -#endif -#endif - const char* pCrKey, USHORT DoCrypt); -} - - diff --git a/goodies/inc/goodies.hrc b/goodies/inc/goodies.hrc deleted file mode 100644 index 139987c4f6ee..000000000000 --- a/goodies/inc/goodies.hrc +++ /dev/null @@ -1,60 +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: goodies.hrc,v $ - * $Revision: 1.5 $ - * - * 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 _GOODIES_HRC -#define _GOODIES_HRC - -#ifndef _SOLAR_HRC -#include <svl/solar.hrc> -#endif - -// Dialoge --------------------------------------------------------------- - -#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) -#define PAGE_SSL_NEWCERT_OPEN (RID_GOODIES_START+ 14) -#define PAGE_SSL_NEWCERT_SHOWCERT (RID_GOODIES_START+ 15) -#define PAGE_SSL_NEWCERT_ACCEPTCERT (RID_GOODIES_START+ 16) -#define PAGE_SSL_NEWCERT_WARNCERT (RID_GOODIES_START+ 17) -#define PAGE_SSL_NEWCERT_READYCERT (RID_GOODIES_START+ 18) -#define WIN_SSL_INFCERT (RID_GOODIES_START+ 19) -#define WIN_SSL_INFCERT_EDIT (RID_GOODIES_START+ 20) - -#endif - diff --git a/goodies/inc/makefile.mk b/goodies/inc/makefile.mk deleted file mode 100644 index 98924a5a1192..000000000000 --- a/goodies/inc/makefile.mk +++ /dev/null @@ -1,51 +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: 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 -# 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=goodies -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" - diff --git a/goodies/inc/pch/precompiled_goodies.cxx b/goodies/inc/pch/precompiled_goodies.cxx deleted file mode 100644 index 663a76ec3160..000000000000 --- a/goodies/inc/pch/precompiled_goodies.cxx +++ /dev/null @@ -1,32 +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: precompiled_goodies.cxx,v $ - * $Revision: 1.3 $ - * - * 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 "precompiled_goodies.hxx" - diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx deleted file mode 100644 index fe6f2ec433e5..000000000000 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ /dev/null @@ -1,174 +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: precompiled_goodies.hxx,v $ - * $Revision: 1.4.42.1 $ - * - * 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): Generated on 2006-09-01 17:49:44.889563 - -#ifdef PRECOMPILED_HEADERS - -//---MARKER--- -#include "sal/types.h" - -#include "com/sun/star/awt/FontDescriptor.hpp" -#include "com/sun/star/awt/FontUnderline.hpp" -#include "com/sun/star/awt/FontWeight.hpp" -#include "com/sun/star/awt/Gradient.hpp" -#include "com/sun/star/awt/Rectangle.hpp" -#include "com/sun/star/awt/Size.hpp" -#include "com/sun/star/awt/XBitmap.hpp" -#include "com/sun/star/awt/XDevice.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/beans/PropertyState.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/drawing/CircleKind.hpp" -#include "com/sun/star/drawing/FillStyle.hpp" -#include "com/sun/star/drawing/FlagSequence.hpp" -#include "com/sun/star/drawing/Hatch.hpp" -#include "com/sun/star/drawing/LineDash.hpp" -#include "com/sun/star/drawing/LineStyle.hpp" -#include "com/sun/star/drawing/PointSequence.hpp" -#include "com/sun/star/drawing/PointSequenceSequence.hpp" -#include "com/sun/star/drawing/PolyPolygonBezierCoords.hpp" -#include "com/sun/star/drawing/TextAdjust.hpp" -#include "com/sun/star/drawing/XDrawPage.hpp" -#include "com/sun/star/drawing/XDrawPages.hpp" -#include "com/sun/star/drawing/XDrawPagesSupplier.hpp" -#include "com/sun/star/drawing/XShape.hpp" -#include "com/sun/star/drawing/XShapeGrouper.hpp" -#include "com/sun/star/frame/XModel.hpp" -#include "com/sun/star/graphic/GraphicType.hpp" -#include "com/sun/star/graphic/XGraphic.hpp" -#include "com/sun/star/graphic/XGraphicProvider.hpp" -#include "com/sun/star/graphic/XGraphicRenderer.hpp" -#include "com/sun/star/io/XStream.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XUnoTunnel.hpp" -#include "com/sun/star/registry/XRegistryKey.hpp" -#include "com/sun/star/style/HorizontalAlignment.hpp" -#include "com/sun/star/task/XStatusIndicator.hpp" -#include "com/sun/star/text/XText.hpp" -#include "com/sun/star/text/XTextRange.hpp" - -#include "comphelper/processfactory.hxx" -#include "comphelper/propertysethelper.hxx" -#include "comphelper/propertysetinfo.hxx" - -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/servicefactory.hxx" - - -#include "osl/diagnose.h" -#include "osl/endian.h" -#include "osl/file.hxx" -#include "osl/process.h" - -#include "rtl/alloc.h" -#include "rtl/math.hxx" -#include "rtl/ustring.hxx" -#include "rtl/uuid.h" - -#include "svtools/FilterConfigItem.hxx" -#include "unotools/cacheoptions.hxx" -#include "svtools/fltcall.hxx" -#include "svl/itemprop.hxx" -#include "svl/lstner.hxx" -#include "svl/solar.hrc" -#include "svtools/stdctrl.hxx" -#include "svl/svarray.hxx" - -#include "toolkit/helper/vclunohelper.hxx" - -#include "tools/agapi.hxx" -#include "tools/agitem.hxx" -#include "tools/bigint.hxx" -#include "tools/chapi.hxx" -#include "tools/color.hxx" -#include "tools/datetime.hxx" -#include "tools/debug.hxx" -#include "tools/gen.hxx" -#include "tools/list.hxx" -#include "tools/poly.hxx" -#include "tools/rcid.h" -#include "tools/ref.hxx" -#include "tools/resid.hxx" -#include "tools/resmgr.hxx" -#include "tools/rtti.hxx" -#include "tools/shl.hxx" -#include "tools/solar.h" -#include "tools/string.hxx" -#include "tools/table.hxx" -#include "tools/tempfile.hxx" -#include "tools/time.hxx" -#include "tools/urlobj.hxx" -#include "tools/vcompat.hxx" -#include "tools/vector2d.hxx" - -#include "uno/mapping.hxx" - -#include "unotools/localfilehelper.hxx" -#include "unotools/processfactory.hxx" - -#include "vcl/alpha.hxx" -#include "vcl/animate.hxx" -#include "vcl/bitmap.hxx" -#include "vcl/bitmapex.hxx" -#include "vcl/bmpacc.hxx" -#include "vcl/button.hxx" -#include "vcl/dialog.hxx" -#include "vcl/field.hxx" -#include "vcl/fixed.hxx" -#include "vcl/floatwin.hxx" -#include "vcl/font.hxx" -#include "vcl/gdimtf.hxx" -#include "vcl/gradient.hxx" -#include "vcl/graph.h" -#include "vcl/hatch.hxx" -#include "vcl/image.hxx" -#include "vcl/imagerepository.hxx" -#include "vcl/lineinfo.hxx" -#include "vcl/lstbox.hxx" -#include "vcl/metric.hxx" -#include "vcl/msgbox.hxx" -#include "vcl/outdev.hxx" -#include "vcl/region.hxx" -#include "vcl/salbtype.hxx" -#include "vcl/sv.h" -#include "vcl/svapp.hxx" -#include "vcl/timer.hxx" -#include "vcl/virdev.hxx" -#include "vcl/window.hxx" - -#include "vos/macros.hxx" -#include "vos/mutex.hxx" -#include "vos/timer.hxx" -//---MARKER--- - -#endif diff --git a/goodies/prj/build.lst b/goodies/prj/build.lst deleted file mode 100644 index f8edce86c4f8..000000000000 --- a/goodies/prj/build.lst +++ /dev/null @@ -1,31 +0,0 @@ -go goodies : l10n svtools NULL -go goodies usr1 - all g_mkout NULL -go goodies\inc nmake - all g_inc NULL -go goodies\prj get - all g_prj NULL -go goodies\source\base3d nmake - all g_base3d g_inc NULL -go goodies\source\inv nmake - all g_inv g_inc NULL -go goodies\source\graphic nmake - all g_graph g_inc NULL -go goodies\source\filter.vcl\eos2met nmake - all g_vfeom g_inc NULL -go goodies\source\filter.vcl\ios2met nmake - all g_vfiom g_inc NULL -go goodies\source\filter.vcl\epict nmake - all g_vfept g_inc NULL -go goodies\source\filter.vcl\egif nmake - all g_vfegf g_inc NULL -go goodies\source\filter.vcl\ipcd nmake - all g_vfipc g_inc NULL -go goodies\source\filter.vcl\ipcx nmake - all g_vfipx g_inc NULL -go goodies\source\filter.vcl\ipict nmake - all g_vfipt g_inc NULL -go goodies\source\filter.vcl\idxf nmake - all g_vfidx g_inc NULL -go goodies\source\filter.vcl\itiff nmake - all g_vfitf g_inc NULL -go goodies\source\filter.vcl\ipbm nmake - all g_vfpbm g_inc NULL -go goodies\source\filter.vcl\epbm nmake - all g_epbm g_inc NULL -go goodies\source\filter.vcl\epgm nmake - all g_epgm g_inc NULL -go goodies\source\filter.vcl\eppm nmake - all g_eppm g_inc NULL -go goodies\source\filter.vcl\iras nmake - all g_iras g_inc NULL -go goodies\source\filter.vcl\expm nmake - all g_expm g_inc NULL -go goodies\source\filter.vcl\eras nmake - all g_eras g_inc NULL -go goodies\source\filter.vcl\etiff nmake - all g_etiff g_inc NULL -go goodies\source\filter.vcl\eps nmake - all g_eps g_inc NULL -go goodies\source\filter.vcl\itga nmake - all g_itga g_inc NULL -go goodies\source\filter.vcl\ipsd nmake - all g_ipsd g_inc NULL -go goodies\source\filter.vcl\ieps nmake - all g_ieps g_inc NULL -go goodies\source\filter.vcl\icgm nmake - all g_icgm g_inc NULL -go goodies\source\unographic nmake - all g_unographic g_inc NULL -go goodies\util nmake - all g_util g_base3d g_inv g_graph g_unographic NULL diff --git a/goodies/prj/d.lst b/goodies/prj/d.lst deleted file mode 100644 index f30ca516b5da..000000000000 --- a/goodies/prj/d.lst +++ /dev/null @@ -1,82 +0,0 @@ -mkdir: %COMMON_DEST%\bin%_EXT%\hid -..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid -..\%__SRC%\lib\mail.lib %_DEST%\lib%_EXT%\mail.lib -..\%__SRC%\lib\crypt.lib %_DEST%\lib%_EXT%\crypt.lib -..\%__SRC%\lib\icrp.lib %_DEST%\lib%_EXT%\icrp.lib -..\%__SRC%\lib\igo.lib %_DEST%\lib%_EXT%\go.lib -..\%__SRC%\lib\igo.lib %_DEST%\lib%_EXT%\igo.lib -..\%__SRC%\lib\itfu.lib %_DEST%\lib%_EXT%\itfu.lib -..\%__SRC%\slb\go.lib %_DEST%\lib%_EXT%\xgo.lib -..\%__SRC%\slb\gol.lib %_DEST%\lib%_EXT%\gol.lib -..\%__SRC%\bin\ma?????.* %_DEST%\bin%_EXT%\ma?????.* -..\%__SRC%\bin\tfu?????.dll %_DEST%\bin%_EXT%\tfu?????.dll -..\%__SRC%\bin\tfu?????.sym %_DEST%\bin%_EXT%\tfu?????.sym -..\%__SRC%\bin\crp?????.dll %_DEST%\bin%_EXT%\crp?????.dll -..\%__SRC%\bin\crp?????.sym %_DEST%\bin%_EXT%\crp?????.sym -..\%__SRC%\bin\solarvim.dll %_DEST%\bin%_EXT%\solarvim.dll -..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map -..\%__SRC%\bin\ept?????.dll %_DEST%\bin%_EXT%\ept?????.dll -..\%__SRC%\bin\ept?????.sym %_DEST%\bin%_EXT%\ept?????.sym -..\%__SRC%\bin\eme?????.dll %_DEST%\bin%_EXT%\eme?????.dll -..\%__SRC%\bin\eme?????.sym %_DEST%\bin%_EXT%\eme?????.sym -..\%__SRC%\bin\egi?????.dll %_DEST%\bin%_EXT%\egi?????.dll -..\%__SRC%\bin\egi?????.sym %_DEST%\bin%_EXT%\egi?????.sym -..\%__SRC%\bin\eti?????.dll %_DEST%\bin%_EXT%\eti?????.dll -..\%__SRC%\bin\eti?????.sym %_DEST%\bin%_EXT%\eti?????.sym -..\%__SRC%\bin\era?????.dll %_DEST%\bin%_EXT%\era?????.dll -..\%__SRC%\bin\era?????.sym %_DEST%\bin%_EXT%\era?????.sym -..\%__SRC%\bin\eps?????.dll %_DEST%\bin%_EXT%\eps?????.dll -..\%__SRC%\bin\eps?????.sym %_DEST%\bin%_EXT%\eps?????.sym -..\%__SRC%\bin\exp?????.dll %_DEST%\bin%_EXT%\exp?????.dll -..\%__SRC%\bin\exp?????.sym %_DEST%\bin%_EXT%\exp?????.sym -..\%__SRC%\bin\epb?????.dll %_DEST%\bin%_EXT%\epb?????.dll -..\%__SRC%\bin\epb?????.sym %_DEST%\bin%_EXT%\epb?????.sym -..\%__SRC%\bin\epg?????.dll %_DEST%\bin%_EXT%\epg?????.dll -..\%__SRC%\bin\epg?????.sym %_DEST%\bin%_EXT%\epg?????.sym -..\%__SRC%\bin\epp?????.dll %_DEST%\bin%_EXT%\epp?????.dll -..\%__SRC%\bin\epp?????.sym %_DEST%\bin%_EXT%\epp?????.sym -..\%__SRC%\bin\ime?????.dll %_DEST%\bin%_EXT%\ime?????.dll -..\%__SRC%\bin\ime?????.sym %_DEST%\bin%_EXT%\ime?????.sym -..\%__SRC%\bin\ipt?????.dll %_DEST%\bin%_EXT%\ipt?????.dll -..\%__SRC%\bin\ipt?????.sym %_DEST%\bin%_EXT%\ipt?????.sym -..\%__SRC%\bin\icd?????.dll %_DEST%\bin%_EXT%\icd?????.dll -..\%__SRC%\bin\icd?????.sym %_DEST%\bin%_EXT%\icd?????.sym -..\%__SRC%\bin\ipx?????.dll %_DEST%\bin%_EXT%\ipx?????.dll -..\%__SRC%\bin\ipx?????.sym %_DEST%\bin%_EXT%\ipx?????.sym -..\%__SRC%\bin\icg?????.dll %_DEST%\bin%_EXT%\icg?????.dll -..\%__SRC%\bin\icg?????.sym %_DEST%\bin%_EXT%\icg?????.sym -..\%__SRC%\bin\ira?????.dll %_DEST%\bin%_EXT%\ira?????.dll -..\%__SRC%\bin\ira?????.sym %_DEST%\bin%_EXT%\ira?????.sym -..\%__SRC%\bin\itg?????.dll %_DEST%\bin%_EXT%\itg?????.dll -..\%__SRC%\bin\itg?????.sym %_DEST%\bin%_EXT%\itg?????.sym -..\%__SRC%\bin\ipd?????.dll %_DEST%\bin%_EXT%\ipd?????.dll -..\%__SRC%\bin\ipd?????.sym %_DEST%\bin%_EXT%\ipd?????.sym -..\%__SRC%\bin\ips?????.dll %_DEST%\bin%_EXT%\ips?????.dll -..\%__SRC%\bin\ips?????.sym %_DEST%\bin%_EXT%\ips?????.sym -..\%__SRC%\bin\ipb?????.dll %_DEST%\bin%_EXT%\ipb?????.dll -..\%__SRC%\bin\ipb?????.sym %_DEST%\bin%_EXT%\ipb?????.sym -..\%__SRC%\bin\iti?????.dll %_DEST%\bin%_EXT%\iti?????.dll -..\%__SRC%\bin\iti?????.sym %_DEST%\bin%_EXT%\iti?????.sym -..\%__SRC%\bin\igi?????.dll %_DEST%\bin%_EXT%\igi?????.dll -..\%__SRC%\bin\igi?????.sym %_DEST%\bin%_EXT%\igi?????.sym -..\%__SRC%\bin\idx?????.dll %_DEST%\bin%_EXT%\idx?????.dll -..\%__SRC%\bin\idx?????.sym %_DEST%\bin%_EXT%\idx?????.sym -..\%__SRC%\bin\ixb?????.dll %_DEST%\bin%_EXT%\ixb?????.dll -..\%__SRC%\bin\ixb?????.sym %_DEST%\bin%_EXT%\ixb?????.sym -..\%__SRC%\bin\jpg?????.dll %_DEST%\bin%_EXT%\jpg?????.dll -..\%__SRC%\bin\jpg?????.sym %_DEST%\bin%_EXT%\jpg?????.sym -..\%__SRC%\bin\go?????.dll %_DEST%\bin%_EXT%\go?????.dll -..\%__SRC%\bin\go?????.sym %_DEST%\bin%_EXT%\go?????.sym -..\%__SRC%\bin\gol?????.dll %_DEST%\bin%_EXT%\gol?????.dll -..\%__SRC%\bin\gol?????.sym %_DEST%\bin%_EXT%\gol?????.sym - -..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* -..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a -..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib - -mkdir: %_DEST%\inc%_EXT%\goodies -..\inc\grfmgr.hxx %_DEST%\inc%_EXT%\goodies\grfmgr.hxx -..\inc\mailenum.hxx %_DEST%\inc%_EXT%\goodies\mailenum.hxx -..\inc\b3dtrans.hxx %_DEST%\inc%_EXT%\goodies\b3dtrans.hxx -..\inc\agsdkdll.hxx %_DEST%\inc%_EXT%\goodies\agsdkdll.hxx diff --git a/goodies/source/base3d/makefile.mk b/goodies/source/base3d/makefile.mk deleted file mode 100644 index 0203f7e1d3d4..000000000000 --- a/goodies/source/base3d/makefile.mk +++ /dev/null @@ -1,47 +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: makefile.mk,v $ -# -# $Revision: 1.6.42.1 $ -# -# 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=goodies -TARGET=base3d -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = $(SLO)$/b3dtrans.obj - -.INCLUDE : target.mk - diff --git a/goodies/source/filter.vcl/egif/dlgegif.cxx b/goodies/source/filter.vcl/egif/dlgegif.cxx deleted file mode 100644 index d0aa11d3238f..000000000000 --- a/goodies/source/filter.vcl/egif/dlgegif.cxx +++ /dev/null @@ -1,111 +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: dlgegif.cxx,v $ - * $Revision: 1.9 $ - * - * 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_goodies.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/goodies/source/filter.vcl/egif/dlgegif.hrc b/goodies/source/filter.vcl/egif/dlgegif.hrc deleted file mode 100644 index 72196101f288..000000000000 --- a/goodies/source/filter.vcl/egif/dlgegif.hrc +++ /dev/null @@ -1,39 +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: dlgegif.hrc,v $ - * $Revision: 1.3 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/egif/dlgegif.hxx b/goodies/source/filter.vcl/egif/dlgegif.hxx deleted file mode 100644 index d6c93ba862b4..000000000000 --- a/goodies/source/filter.vcl/egif/dlgegif.hxx +++ /dev/null @@ -1,74 +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: dlgegif.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/egif/dlgegif.src b/goodies/source/filter.vcl/egif/dlgegif.src deleted file mode 100644 index c9e1bdbf6a1a..000000000000 --- a/goodies/source/filter.vcl/egif/dlgegif.src +++ /dev/null @@ -1,121 +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: dlgegif.src,v $ - * $Revision: 1.30 $ - * - * 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/goodies/source/filter.vcl/egif/egif.cxx b/goodies/source/filter.vcl/egif/egif.cxx deleted file mode 100644 index 9f2aeaddd686..000000000000 --- a/goodies/source/filter.vcl/egif/egif.cxx +++ /dev/null @@ -1,632 +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: egif.cxx,v $ - * $Revision: 1.10 $ - * - * 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_goodies.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/goodies/source/filter.vcl/egif/egifstr.src b/goodies/source/filter.vcl/egif/egifstr.src deleted file mode 100644 index b9d63708e5d9..000000000000 --- a/goodies/source/filter.vcl/egif/egifstr.src +++ /dev/null @@ -1,42 +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: egifstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/egif/exports.map b/goodies/source/filter.vcl/egif/exports.map deleted file mode 100644 index 10820132c0ce..000000000000 --- a/goodies/source/filter.vcl/egif/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -GIFEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/egif/giflzwc.cxx b/goodies/source/filter.vcl/egif/giflzwc.cxx deleted file mode 100644 index a542cff8b7fa..000000000000 --- a/goodies/source/filter.vcl/egif/giflzwc.cxx +++ /dev/null @@ -1,259 +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: giflzwc.cxx,v $ - * $Revision: 1.5 $ - * - * 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_goodies.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/goodies/source/filter.vcl/egif/giflzwc.hxx b/goodies/source/filter.vcl/egif/giflzwc.hxx deleted file mode 100644 index 51d7842a59db..000000000000 --- a/goodies/source/filter.vcl/egif/giflzwc.hxx +++ /dev/null @@ -1,68 +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: giflzwc.hxx,v $ - * $Revision: 1.3 $ - * - * 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/goodies/source/filter.vcl/egif/makefile.mk b/goodies/source/filter.vcl/egif/makefile.mk deleted file mode 100644 index 418af69c7bf8..000000000000 --- a/goodies/source/filter.vcl/egif/makefile.mk +++ /dev/null @@ -1,82 +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: makefile.mk,v $ -# -# $Revision: 1.14 $ -# -# 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=goodies -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/goodies/source/filter.vcl/egif/strings.hrc b/goodies/source/filter.vcl/egif/strings.hrc deleted file mode 100644 index 8d1231753f49..000000000000 --- a/goodies/source/filter.vcl/egif/strings.hrc +++ /dev/null @@ -1,31 +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: strings.hrc,v $ - * $Revision: 1.3 $ - * - * 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/goodies/source/filter.vcl/eos2met/dlgeos2.cxx b/goodies/source/filter.vcl/eos2met/dlgeos2.cxx deleted file mode 100644 index c42c04aa86ed..000000000000 --- a/goodies/source/filter.vcl/eos2met/dlgeos2.cxx +++ /dev/null @@ -1,182 +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: dlgeos2.cxx,v $ - * $Revision: 1.10 $ - * - * 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_goodies.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/goodies/source/filter.vcl/eos2met/dlgeos2.hrc b/goodies/source/filter.vcl/eos2met/dlgeos2.hrc deleted file mode 100644 index 11c159632cc2..000000000000 --- a/goodies/source/filter.vcl/eos2met/dlgeos2.hrc +++ /dev/null @@ -1,44 +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: dlgeos2.hrc,v $ - * $Revision: 1.3 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/eos2met/dlgeos2.hxx b/goodies/source/filter.vcl/eos2met/dlgeos2.hxx deleted file mode 100644 index c0820e6ba2bf..000000000000 --- a/goodies/source/filter.vcl/eos2met/dlgeos2.hxx +++ /dev/null @@ -1,83 +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: dlgeos2.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/eos2met/dlgeos2.src b/goodies/source/filter.vcl/eos2met/dlgeos2.src deleted file mode 100644 index 9a311d565c3b..000000000000 --- a/goodies/source/filter.vcl/eos2met/dlgeos2.src +++ /dev/null @@ -1,165 +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: dlgeos2.src,v $ - * $Revision: 1.20 $ - * - * 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/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx deleted file mode 100644 index b818e9cd26ba..000000000000 --- a/goodies/source/filter.vcl/eos2met/eos2met.cxx +++ /dev/null @@ -1,2651 +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: eos2met.cxx,v $ - * $Revision: 1.21 $ - * - * 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_goodies.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/goodies/source/filter.vcl/eos2met/eos2mstr.src b/goodies/source/filter.vcl/eos2met/eos2mstr.src deleted file mode 100644 index 9f304706861b..000000000000 --- a/goodies/source/filter.vcl/eos2met/eos2mstr.src +++ /dev/null @@ -1,41 +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: eos2mstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/eos2met/exports.map b/goodies/source/filter.vcl/eos2met/exports.map deleted file mode 100644 index ce76d3850094..000000000000 --- a/goodies/source/filter.vcl/eos2met/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -METEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/eos2met/makefile.mk b/goodies/source/filter.vcl/eos2met/makefile.mk deleted file mode 100644 index 05f2f032e342..000000000000 --- a/goodies/source/filter.vcl/eos2met/makefile.mk +++ /dev/null @@ -1,78 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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=goodies -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/goodies/source/filter.vcl/eos2met/strings.hrc b/goodies/source/filter.vcl/eos2met/strings.hrc deleted file mode 100644 index fe559eb8a2a9..000000000000 --- a/goodies/source/filter.vcl/eos2met/strings.hrc +++ /dev/null @@ -1,32 +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: strings.hrc,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/epbm/dlgepbm.cxx b/goodies/source/filter.vcl/epbm/dlgepbm.cxx deleted file mode 100644 index e43c40033025..000000000000 --- a/goodies/source/filter.vcl/epbm/dlgepbm.cxx +++ /dev/null @@ -1,102 +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: dlgepbm.cxx,v $ - * $Revision: 1.9 $ - * - * 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_goodies.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/goodies/source/filter.vcl/epbm/dlgepbm.hrc b/goodies/source/filter.vcl/epbm/dlgepbm.hrc deleted file mode 100644 index 8c68bc82aee5..000000000000 --- a/goodies/source/filter.vcl/epbm/dlgepbm.hrc +++ /dev/null @@ -1,37 +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: dlgepbm.hrc,v $ - * $Revision: 1.3 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/epbm/dlgepbm.hxx b/goodies/source/filter.vcl/epbm/dlgepbm.hxx deleted file mode 100644 index d6580007449e..000000000000 --- a/goodies/source/filter.vcl/epbm/dlgepbm.hxx +++ /dev/null @@ -1,74 +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: dlgepbm.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/epbm/dlgepbm.src b/goodies/source/filter.vcl/epbm/dlgepbm.src deleted file mode 100644 index 8ef55fc096b6..000000000000 --- a/goodies/source/filter.vcl/epbm/dlgepbm.src +++ /dev/null @@ -1,109 +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: dlgepbm.src,v $ - * $Revision: 1.21 $ - * - * 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/goodies/source/filter.vcl/epbm/epbm.cxx b/goodies/source/filter.vcl/epbm/epbm.cxx deleted file mode 100644 index a624e7f45cfb..000000000000 --- a/goodies/source/filter.vcl/epbm/epbm.cxx +++ /dev/null @@ -1,275 +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: epbm.cxx,v $ - * $Revision: 1.12 $ - * - * 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_goodies.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/goodies/source/filter.vcl/epbm/epbmstr.src b/goodies/source/filter.vcl/epbm/epbmstr.src deleted file mode 100644 index 9fd48e8e5063..000000000000 --- a/goodies/source/filter.vcl/epbm/epbmstr.src +++ /dev/null @@ -1,38 +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: epbmstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/epbm/exports.map b/goodies/source/filter.vcl/epbm/exports.map deleted file mode 100644 index 2d09b0bdb752..000000000000 --- a/goodies/source/filter.vcl/epbm/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -PBMEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/epbm/makefile.mk b/goodies/source/filter.vcl/epbm/makefile.mk deleted file mode 100644 index f4411d04e0fd..000000000000 --- a/goodies/source/filter.vcl/epbm/makefile.mk +++ /dev/null @@ -1,79 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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=goodies -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/goodies/source/filter.vcl/epbm/strings.hrc b/goodies/source/filter.vcl/epbm/strings.hrc deleted file mode 100644 index 1e280524839a..000000000000 --- a/goodies/source/filter.vcl/epbm/strings.hrc +++ /dev/null @@ -1,30 +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: strings.hrc,v $ - * $Revision: 1.3 $ - * - * 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/goodies/source/filter.vcl/epgm/dlgepgm.cxx b/goodies/source/filter.vcl/epgm/dlgepgm.cxx deleted file mode 100644 index 13b63d6a21f7..000000000000 --- a/goodies/source/filter.vcl/epgm/dlgepgm.cxx +++ /dev/null @@ -1,100 +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: dlgepgm.cxx,v $ - * $Revision: 1.9 $ - * - * 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_goodies.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/goodies/source/filter.vcl/epgm/dlgepgm.hrc b/goodies/source/filter.vcl/epgm/dlgepgm.hrc deleted file mode 100644 index 6239e4450ecd..000000000000 --- a/goodies/source/filter.vcl/epgm/dlgepgm.hrc +++ /dev/null @@ -1,37 +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: dlgepgm.hrc,v $ - * $Revision: 1.3 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/epgm/dlgepgm.hxx b/goodies/source/filter.vcl/epgm/dlgepgm.hxx deleted file mode 100644 index 9a8f8b4df158..000000000000 --- a/goodies/source/filter.vcl/epgm/dlgepgm.hxx +++ /dev/null @@ -1,74 +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: dlgepgm.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/epgm/dlgepgm.src b/goodies/source/filter.vcl/epgm/dlgepgm.src deleted file mode 100644 index 4933b6750e7a..000000000000 --- a/goodies/source/filter.vcl/epgm/dlgepgm.src +++ /dev/null @@ -1,108 +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: dlgepgm.src,v $ - * $Revision: 1.25 $ - * - * 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/goodies/source/filter.vcl/epgm/epgm.cxx b/goodies/source/filter.vcl/epgm/epgm.cxx deleted file mode 100644 index 32d6e74a5cfe..000000000000 --- a/goodies/source/filter.vcl/epgm/epgm.cxx +++ /dev/null @@ -1,300 +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: epgm.cxx,v $ - * $Revision: 1.12 $ - * - * 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_goodies.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/goodies/source/filter.vcl/epgm/epgmstr.src b/goodies/source/filter.vcl/epgm/epgmstr.src deleted file mode 100644 index b91380ae2797..000000000000 --- a/goodies/source/filter.vcl/epgm/epgmstr.src +++ /dev/null @@ -1,38 +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: epgmstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/epgm/exports.map b/goodies/source/filter.vcl/epgm/exports.map deleted file mode 100644 index 3967c4684f05..000000000000 --- a/goodies/source/filter.vcl/epgm/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -PGMEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/epgm/makefile.mk b/goodies/source/filter.vcl/epgm/makefile.mk deleted file mode 100644 index 579ee6858a78..000000000000 --- a/goodies/source/filter.vcl/epgm/makefile.mk +++ /dev/null @@ -1,80 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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=goodies -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/goodies/source/filter.vcl/epgm/strings.hrc b/goodies/source/filter.vcl/epgm/strings.hrc deleted file mode 100644 index 1e280524839a..000000000000 --- a/goodies/source/filter.vcl/epgm/strings.hrc +++ /dev/null @@ -1,30 +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: strings.hrc,v $ - * $Revision: 1.3 $ - * - * 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/goodies/source/filter.vcl/epict/dlgepct.cxx b/goodies/source/filter.vcl/epict/dlgepct.cxx deleted file mode 100644 index dd9f0c8a716f..000000000000 --- a/goodies/source/filter.vcl/epict/dlgepct.cxx +++ /dev/null @@ -1,186 +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: dlgepct.cxx,v $ - * $Revision: 1.9 $ - * - * 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_goodies.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/goodies/source/filter.vcl/epict/dlgepct.hrc b/goodies/source/filter.vcl/epict/dlgepct.hrc deleted file mode 100644 index 32d817a7305b..000000000000 --- a/goodies/source/filter.vcl/epict/dlgepct.hrc +++ /dev/null @@ -1,44 +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: dlgepct.hrc,v $ - * $Revision: 1.3 $ - * - * 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 <goodies.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/goodies/source/filter.vcl/epict/dlgepct.hxx b/goodies/source/filter.vcl/epict/dlgepct.hxx deleted file mode 100644 index b5cf3302c44a..000000000000 --- a/goodies/source/filter.vcl/epict/dlgepct.hxx +++ /dev/null @@ -1,83 +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: dlgepct.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/epict/dlgepct.src b/goodies/source/filter.vcl/epict/dlgepct.src deleted file mode 100644 index a0a8020aa0cb..000000000000 --- a/goodies/source/filter.vcl/epict/dlgepct.src +++ /dev/null @@ -1,166 +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: dlgepct.src,v $ - * $Revision: 1.20 $ - * - * 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/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx deleted file mode 100644 index 3e4dca455d05..000000000000 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ /dev/null @@ -1,2306 +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: epict.cxx,v $ - * $Revision: 1.23 $ - * - * 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_goodies.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" - -//============================== 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 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::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 ) ) - { - SetAttrForFrame(); - WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); - } - 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(); - - 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]; - } - } - } - } - 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/goodies/source/filter.vcl/epict/epictstr.src b/goodies/source/filter.vcl/epict/epictstr.src deleted file mode 100644 index 69cf2909f47c..000000000000 --- a/goodies/source/filter.vcl/epict/epictstr.src +++ /dev/null @@ -1,41 +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: epictstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/epict/exports.map b/goodies/source/filter.vcl/epict/exports.map deleted file mode 100644 index 2f21c5c04b53..000000000000 --- a/goodies/source/filter.vcl/epict/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -PICTEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk deleted file mode 100644 index 4aa4bab80ffc..000000000000 --- a/goodies/source/filter.vcl/epict/makefile.mk +++ /dev/null @@ -1,80 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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=goodies -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) - -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/goodies/source/filter.vcl/epict/strings.hrc b/goodies/source/filter.vcl/epict/strings.hrc deleted file mode 100644 index fe559eb8a2a9..000000000000 --- a/goodies/source/filter.vcl/epict/strings.hrc +++ /dev/null @@ -1,32 +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: strings.hrc,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/eppm/dlgeppm.cxx b/goodies/source/filter.vcl/eppm/dlgeppm.cxx deleted file mode 100644 index ce7f6e45f2d9..000000000000 --- a/goodies/source/filter.vcl/eppm/dlgeppm.cxx +++ /dev/null @@ -1,99 +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: dlgeppm.cxx,v $ - * $Revision: 1.9 $ - * - * 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_goodies.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/goodies/source/filter.vcl/eppm/dlgeppm.hrc b/goodies/source/filter.vcl/eppm/dlgeppm.hrc deleted file mode 100644 index 67a392c7eb12..000000000000 --- a/goodies/source/filter.vcl/eppm/dlgeppm.hrc +++ /dev/null @@ -1,37 +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: dlgeppm.hrc,v $ - * $Revision: 1.3 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/eppm/dlgeppm.hxx b/goodies/source/filter.vcl/eppm/dlgeppm.hxx deleted file mode 100644 index 8114f1575784..000000000000 --- a/goodies/source/filter.vcl/eppm/dlgeppm.hxx +++ /dev/null @@ -1,74 +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: dlgeppm.hxx,v $ - * $Revision: 1.6 $ - * - * 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/goodies/source/filter.vcl/eppm/dlgeppm.src b/goodies/source/filter.vcl/eppm/dlgeppm.src deleted file mode 100644 index e6d8e687a6aa..000000000000 --- a/goodies/source/filter.vcl/eppm/dlgeppm.src +++ /dev/null @@ -1,109 +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: dlgeppm.src,v $ - * $Revision: 1.22 $ - * - * 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/goodies/source/filter.vcl/eppm/eppm.cxx b/goodies/source/filter.vcl/eppm/eppm.cxx deleted file mode 100644 index d17b4f7777ae..000000000000 --- a/goodies/source/filter.vcl/eppm/eppm.cxx +++ /dev/null @@ -1,308 +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: eppm.cxx,v $ - * $Revision: 1.12 $ - * - * 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_goodies.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/goodies/source/filter.vcl/eppm/eppmstr.src b/goodies/source/filter.vcl/eppm/eppmstr.src deleted file mode 100644 index 2cf556cf0bc1..000000000000 --- a/goodies/source/filter.vcl/eppm/eppmstr.src +++ /dev/null @@ -1,38 +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: eppmstr.src,v $ - * $Revision: 1.4 $ - * - * 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/goodies/source/filter.vcl/eppm/exports.map b/goodies/source/filter.vcl/eppm/exports.map deleted file mode 100644 index 0462b75b7b43..000000000000 --- a/goodies/source/filter.vcl/eppm/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -PPMEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/eppm/makefile.mk b/goodies/source/filter.vcl/eppm/makefile.mk deleted file mode 100644 index b40f9d897b8a..000000000000 --- a/goodies/source/filter.vcl/eppm/makefile.mk +++ /dev/null @@ -1,80 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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=goodies -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/goodies/source/filter.vcl/eppm/strings.hrc b/goodies/source/filter.vcl/eppm/strings.hrc deleted file mode 100644 index 1e280524839a..000000000000 --- a/goodies/source/filter.vcl/eppm/strings.hrc +++ /dev/null @@ -1,30 +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: strings.hrc,v $ - * $Revision: 1.3 $ - * - * 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/goodies/source/filter.vcl/eps/dlgeps.cxx b/goodies/source/filter.vcl/eps/dlgeps.cxx deleted file mode 100644 index 042b979f4ecd..000000000000 --- a/goodies/source/filter.vcl/eps/dlgeps.cxx +++ /dev/null @@ -1,209 +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: dlgeps.cxx,v $ - * $Revision: 1.14 $ - * - * 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_goodies.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/goodies/source/filter.vcl/eps/dlgeps.hrc b/goodies/source/filter.vcl/eps/dlgeps.hrc deleted file mode 100644 index c2c357cf62d3..000000000000 --- a/goodies/source/filter.vcl/eps/dlgeps.hrc +++ /dev/null @@ -1,46 +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: dlgeps.hrc,v $ - * $Revision: 1.6 $ - * - * 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 "goodies.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/goodies/source/filter.vcl/eps/dlgeps.hxx b/goodies/source/filter.vcl/eps/dlgeps.hxx deleted file mode 100644 index 804c539766fa..000000000000 --- a/goodies/source/filter.vcl/eps/dlgeps.hxx +++ /dev/null @@ -1,85 +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: dlgeps.hxx,v $ - * $Revision: 1.8 $ - * - * 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/goodies/source/filter.vcl/eps/dlgeps.src b/goodies/source/filter.vcl/eps/dlgeps.src deleted file mode 100644 index 278518762441..000000000000 --- a/goodies/source/filter.vcl/eps/dlgeps.src +++ /dev/null @@ -1,163 +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: dlgeps.src,v $ - * $Revision: 1.47 $ - * - * 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/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx deleted file mode 100644 index dc8e407b178e..000000000000 --- a/goodies/source/filter.vcl/eps/eps.cxx +++ /dev/null @@ -1,2743 +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: eps.cxx,v $ - * $Revision: 1.37 $ - * - * 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_goodies.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; - mnLevelWarning = 0; - mnLastPercent = 0; - mnLatestPush = 0xEFFFFFFE; - - if ( pFilterConfigItem ) - { - xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - { - rtl::OUString aMsg; - xStatusIndicator->start( aMsg, 100 ); - } - } - - mpPS = &rTargetStream; - mpPS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - - // default values for the dialog options - mnLevel = 2; - mbGrayScale = FALSE; - mbCompression = TRUE; - mnTextMode = 0; // default0 : export glyph outlines - - // try to get the dialog selection - if ( pFilterConfigItem ) - { - ByteString aResMgrName( "eps" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - String aPreviewStr( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ); - String aVersionStr( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); - String aColorStr( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ); - String aComprStr( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ); - mnPreview = pFilterConfigItem->ReadInt32( aPreviewStr, 1 ); - mnLevel = pFilterConfigItem->ReadInt32( aVersionStr, 2 ); - if ( mnLevel != 1 ) - mnLevel = 2; - mbGrayScale = pFilterConfigItem->ReadInt32( aColorStr, 1 ) == 2; - mbCompression = pFilterConfigItem->ReadInt32( aComprStr, 1 ) == 1; - String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ); - mnTextMode = pFilterConfigItem->ReadInt32( sTextMode, 0 ); - if ( mnTextMode > 2 ) - mnTextMode = 0; - delete pResMgr; - } - } - - // compression is not available for Level 1 - if ( mnLevel == 1 ) - { - mbGrayScale = TRUE; - mbCompression = FALSE; - } - - if ( mnPreview & EPS_PREVIEW_TIFF ) - { - rTargetStream << (UINT32)0xC6D3D0C5; - nStreamPosition = rTargetStream.Tell(); - rTargetStream << (UINT32)0 << (UINT32)0 << (UINT32)0 << (UINT32)0 - << nStreamPosition + 26 << (UINT32)0 << (UINT16)0xffff; - - UINT32 nErrCode; - if ( mbGrayScale ) - { - BitmapEx aTempBitmapEx( rGraphic.GetBitmapEx() ); - aTempBitmapEx.Convert( BMP_CONVERSION_8BIT_GREYS ); - nErrCode = GraphicConverter::Export( rTargetStream, aTempBitmapEx, CVT_TIF ) ; - } - else - nErrCode = GraphicConverter::Export( rTargetStream, rGraphic, CVT_TIF ) ; - - if ( nErrCode == ERRCODE_NONE ) - { - rTargetStream.Seek( STREAM_SEEK_TO_END ); - nPSPosition = rTargetStream.Tell(); - rTargetStream.Seek( nStreamPosition + 20 ); - rTargetStream << nPSPosition - 30; // size of tiff gfx - rTargetStream.Seek( nPSPosition ); - } - else - { - mnPreview &=~ EPS_PREVIEW_TIFF; - rTargetStream.Seek( nStreamPosition - 4 ); - } - } - - // global default value setting - ChrSet* pCS; - StackMember* pGS; - - if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) - pMTF = &rGraphic.GetGDIMetaFile(); - else - pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() ); - aVDev.SetMapMode( pMTF->GetPrefMapMode() ); - nBoundingX1 = nBoundingY1 = 0; - nBoundingX2 = pMTF->GetPrefSize().Width(); - nBoundingY2 = pMTF->GetPrefSize().Height(); - - pGDIStack = NULL; - aColor = Color( COL_TRANSPARENT ); - bLineColor = TRUE; - aLineColor = Color( COL_BLACK ); - bFillColor = TRUE; - aFillColor = Color( COL_WHITE ); - bTextFillColor = TRUE; - aTextFillColor = Color( COL_BLACK ); - fLineWidth = 1; - fMiterLimit = 10; - eLineCap = SvtGraphicStroke::capButt; - eJoinType = SvtGraphicStroke::joinMiter; - aBackgroundColor = Color( COL_WHITE ); - eTextAlign = ALIGN_BASELINE; - bRegionChanged = FALSE; - - nChrSet = 0x00; - pChrSetList = NULL; - nNextChrSetId = 1; - - if( pMTF->GetActionCount() ) - { - ImplWriteProlog( ( mnPreview & EPS_PREVIEW_EPSI ) ? &rGraphic : NULL ); - mnCursorPos = 0; - ImplWriteActions( *pMTF, aVDev ); - ImplWriteEpilog(); - if ( mnPreview & EPS_PREVIEW_TIFF ) - { - UINT32 nPosition = rTargetStream.Tell(); - rTargetStream.Seek( nStreamPosition ); - rTargetStream << nPSPosition; - rTargetStream << nPosition - nPSPosition; - rTargetStream.Seek( nPosition ); - } - while( pChrSetList ) - { - pCS=pChrSetList; - pChrSetList=pCS->pSucc; - delete pCS; - } - while( pGDIStack ) - { - pGS=pGDIStack; - pGDIStack=pGS->pSucc; - delete pGS; - } - } - else - mbStatus = FALSE; - - if ( mbStatus && mnLevelWarning && pFilterConfigItem ) - { - ByteString aResMgrName( "eps" ); - ResMgr* pResMgr; - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - if( pResMgr ) - { - InfoBox aInfoBox( NULL, String( ResId( KEY_VERSION_CHECK, *pResMgr ) ) ); - aInfoBox.Execute(); - delete pResMgr; - } - } - - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); - - return mbStatus; -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteProlog( const Graphic* pPreview ) -{ - ImplWriteLine( "%!PS-Adobe-3.0 EPSF-3.0 " ); - *mpPS << "%%BoundingBox: "; // BoundingBox - ImplWriteLong( 0 ); - ImplWriteLong( 0 ); - Size aSizePoint = Application::GetDefaultDevice()->LogicToLogic( pMTF->GetPrefSize(), - pMTF->GetPrefMapMode(), MAP_POINT ); - ImplWriteLong( aSizePoint.Width() ); - ImplWriteLong( aSizePoint.Height() ,PS_RET ); - ImplWriteLine( "%%Pages: 0" ); - ImplWriteLine( "%%Creator: Sun Microsystems, Inc." ); - ImplWriteLine( "%%Title: none" ); - ImplWriteLine( "%%CreationDate: none" ); - -// defaults - - *mpPS << "%%LanguageLevel: "; // Language level - ImplWriteLong( mnLevel, PS_RET ); - if ( !mbGrayScale && mnLevel == 1 ) - ImplWriteLine( "%%Extensions: CMYK" ); // CMYK extension is to set in color mode in level 1 - ImplWriteLine( "%%EndComments" ); - if ( pPreview && aSizePoint.Width() && aSizePoint.Height() ) - { - Size aSizeBitmap( ( aSizePoint.Width() + 7 ) & ~7, aSizePoint.Height() ); - Bitmap aTmpBitmap( pPreview->GetBitmap() ); - aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_INTERPOLATE ); - aTmpBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); - BitmapReadAccess* pAcc = aTmpBitmap.AcquireReadAccess(); - if ( pAcc ) - { - *mpPS << "%%BeginPreview: "; // BoundingBox - ImplWriteLong( aSizeBitmap.Width() ); - ImplWriteLong( aSizeBitmap.Height() ); - *mpPS << "1 "; - INT32 nLines = aSizeBitmap.Width() / 312; - if ( ( nLines * 312 ) != aSizeBitmap.Width() ) - nLines++; - nLines *= aSizeBitmap.Height(); - ImplWriteLong( nLines ); - char nVal; - INT32 nX, nY, nCount2, nCount = 4; - const BitmapColor aBlack( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); - for ( nY = 0; nY < aSizeBitmap.Height(); nY++ ) - { - nCount2 = 0; - nVal = 0; - for ( nX = 0; nX < aSizeBitmap.Width(); nX++ ) - { - if ( !nCount2 ) - { - ImplExecMode( PS_RET ); - *mpPS << "%"; - nCount2 = 312; - } - nVal <<= 1; - if ( pAcc->GetPixel( nY, nX ) == aBlack ) - nVal |= 1; - if ( ! ( --nCount ) ) - { - if ( nVal > 9 ) - nVal += 'A' - 10; - else - nVal += '0'; - *mpPS << nVal; - nVal = 0; - nCount += 4; - } - nCount2--; - } - } - aTmpBitmap.ReleaseAccess( pAcc ); - ImplExecMode( PS_RET ); - ImplWriteLine( "%%EndPreview" ); - } - } - ImplWriteLine( "%%BeginProlog" ); - ImplWriteLine( "%%BeginResource: procset SDRes-Prolog 1.0 0" ); - -// BEGIN EPSF - ImplWriteLine( "/b4_inc_state save def\n/dict_count countdictstack def\n/op_count count 1 sub def\nuserdict begin" ); - ImplWriteLine( "0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath" ); - ImplWriteLine( "/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if" ); - - ImplWriteLine( "/bdef {bind def} bind def" ); // der neue operator bdef wird erzeugt - if ( mbGrayScale ) - ImplWriteLine( "/c {setgray} bdef" ); - else - ImplWriteLine( "/c {setrgbcolor} bdef" ); - ImplWriteLine( "/l {neg lineto} bdef" ); - ImplWriteLine( "/rl {neg rlineto} bdef" ); - ImplWriteLine( "/lc {setlinecap} bdef" ); - ImplWriteLine( "/lj {setlinejoin} bdef" ); - ImplWriteLine( "/lw {setlinewidth} bdef" ); - ImplWriteLine( "/ml {setmiterlimit} bdef" ); - ImplWriteLine( "/ld {setdash} bdef" ); - ImplWriteLine( "/m {neg moveto} bdef" ); - ImplWriteLine( "/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef" ); - ImplWriteLine( "/r {rotate} bdef" ); - ImplWriteLine( "/t {neg translate} bdef" ); - ImplWriteLine( "/s {scale} bdef" ); - ImplWriteLine( "/sw {show} bdef" ); - ImplWriteLine( "/gs {gsave} bdef" ); - ImplWriteLine( "/gr {grestore} bdef" ); - - ImplWriteLine( "/f {findfont dup length dict begin" ); // Setfont - ImplWriteLine( "{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def" ); - ImplWriteLine( "currentdict end /NFont exch definefont pop /NFont findfont} bdef" ); - - ImplWriteLine( "/p {closepath} bdef" ); - ImplWriteLine( "/sf {scalefont setfont} bdef" ); - - ImplWriteLine( "/ef {eofill}bdef" ); // close path and fill - ImplWriteLine( "/pc {closepath stroke}bdef" ); // close path and draw - ImplWriteLine( "/ps {stroke}bdef" ); // draw current path - ImplWriteLine( "/pum {matrix currentmatrix}bdef" ); // pushes the current matrix - ImplWriteLine( "/pom {setmatrix}bdef" ); // pops the matrix - ImplWriteLine( "/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef" ); - ImplWriteLine( "%%EndResource" ); - ImplWriteLine( "%%EndProlog" ); - ImplWriteLine( "%%BeginSetup" ); - ImplWriteLine( "%%EndSetup" ); - ImplWriteLine( "%%Page: 1 1" ); - ImplWriteLine( "%%BeginPageSetup" ); - ImplWriteLine( "%%EndPageSetup" ); - ImplWriteLine( "pum" ); - ImplScale( (double)aSizePoint.Width() / (double)pMTF->GetPrefSize().Width(), (double)aSizePoint.Height() / (double)pMTF->GetPrefSize().Height() ); - ImplWriteDouble( 0 ); - ImplWriteDouble( -pMTF->GetPrefSize().Height() ); - ImplWriteLine( "t" ); - ImplWriteLine( "/tm matrix currentmatrix def" ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteEpilog() -{ - ImplTranslate( 0, nBoundingY2 ); - ImplWriteLine( "pom" ); - ImplWriteLine( "count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore" ); - - ImplWriteLine( "%%PageTrailer" ); - ImplWriteLine( "%%Trailer" ); - - ImplWriteLine( "%%EOF" ); -} - -//--------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) -{ - PolyPolygon aFillPath; - - for( ULONG nCurAction = 0, nCount = rMtf.GetActionCount(); nCurAction < nCount; nCurAction++ ) - { - MetaAction* pMA = rMtf.GetAction( nCurAction ); - - switch( pMA->GetType() ) - { - case META_NULL_ACTION : - break; - - case META_PIXEL_ACTION : - { - Color aOldLineColor( aLineColor ); - aLineColor = ( (const MetaPixelAction*) pMA )->GetColor(); - ImplWriteLineColor( PS_SPACE ); - ImplMoveTo( ( (const MetaPixelAction*)pMA )->GetPoint() ); - ImplLineTo( ( (const MetaPixelAction*)pMA )->GetPoint() ); - ImplPathDraw(); - aLineColor = aOldLineColor; - } - break; - - case META_POINT_ACTION : - { - ImplWriteLineColor( PS_SPACE ); - ImplMoveTo( ( (const MetaPointAction*)pMA )->GetPoint() ); - ImplLineTo( ( (const MetaPointAction*)pMA )->GetPoint() ); - ImplPathDraw(); - } - break; - - case META_LINE_ACTION : - { - const LineInfo& rLineInfo = ( ( const MetaLineAction*)pMA )->GetLineInfo(); - ImplWriteLineInfo( rLineInfo ); - if ( bLineColor ) - { - ImplWriteLineColor( PS_SPACE ); - ImplMoveTo( ( (const MetaLineAction*) pMA )->GetStartPoint() ); - ImplLineTo( ( (const MetaLineAction*) pMA )->GetEndPoint() ); - ImplPathDraw(); - } - } - break; - - case META_RECT_ACTION : - { - ImplRect( ( (const MetaRectAction*) pMA )->GetRect() ); - } - break; - - case META_ROUNDRECT_ACTION : - ImplRect( ( (const MetaRoundRectAction*) pMA )->GetRect() ); - break; - - case META_ELLIPSE_ACTION : - { - Rectangle aRect = ( ( (const MetaEllipseAction*) pMA )->GetRect() ); - Point aCenter = aRect.Center(); - Polygon aPoly( aCenter, aRect.GetWidth() / 2, aRect.GetHeight() / 2 ); - PolyPolygon aPolyPoly( aPoly ); - ImplPolyPoly( aPolyPoly ); - } - break; - - case META_ARC_ACTION : - { - Polygon aPoly( ( (const MetaArcAction*)pMA )->GetRect(), ( (const MetaArcAction*)pMA )->GetStartPoint(), - ( (const MetaArcAction*)pMA )->GetEndPoint(), POLY_ARC ); - PolyPolygon aPolyPoly( aPoly ); - ImplPolyPoly( aPolyPoly ); - } - break; - - case META_PIE_ACTION : - { - Polygon aPoly( ( (const MetaPieAction*)pMA )->GetRect(), ( (const MetaPieAction*)pMA )->GetStartPoint(), - ( (const MetaPieAction*)pMA )->GetEndPoint(), POLY_PIE ); - PolyPolygon aPolyPoly( aPoly ); - ImplPolyPoly( aPolyPoly ); - } - break; - - case META_CHORD_ACTION : - { - Polygon aPoly( ( (const MetaChordAction*)pMA )->GetRect(), ( (const MetaChordAction*)pMA )->GetStartPoint(), - ( (const MetaChordAction*)pMA )->GetEndPoint(), POLY_CHORD ); - PolyPolygon aPolyPoly( aPoly ); - ImplPolyPoly( aPolyPoly ); - } - break; - - case META_POLYLINE_ACTION : - { - Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() ); - const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo(); - ImplWriteLineInfo( rLineInfo ); - ImplPolyLine( aPoly ); - } - break; - - case META_POLYGON_ACTION : - { - PolyPolygon aPolyPoly( ( (const MetaPolygonAction*) pMA )->GetPolygon() ); - ImplPolyPoly( aPolyPoly ); - } - break; - - case META_POLYPOLYGON_ACTION : - { - ImplPolyPoly( ( (const MetaPolyPolygonAction*) pMA )->GetPolyPolygon() ); - } - break; - - case META_TEXT_ACTION: - { - const MetaTextAction * pA = (const MetaTextAction*) pMA; - - String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() ); - Point aPoint( pA->GetPoint() ); - - ImplText( aUniStr, aPoint, NULL, 0, rVDev ); - } - break; - - case META_TEXTRECT_ACTION: - { - DBG_ERROR( "Unsupported action: TextRect...Action!" ); - } - break; - - case META_STRETCHTEXT_ACTION : - { - const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pMA; - String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() ); - Point aPoint( pA->GetPoint() ); - - ImplText( aUniStr, aPoint, NULL, pA->GetWidth(), rVDev ); - } - break; - - case META_TEXTARRAY_ACTION: - { - const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pMA; - String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() ); - Point aPoint( pA->GetPoint() ); - - ImplText( aUniStr, aPoint, pA->GetDXArray(), 0, rVDev ); - } - break; - - case META_BMP_ACTION : - { - Bitmap aBitmap = ( (const MetaBmpAction*)pMA )->GetBitmap(); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Point aPoint = ( (const MetaBmpAction*) pMA )->GetPoint(); - Size aSize = aBitmap.GetSizePixel(); - ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - case META_BMPSCALE_ACTION : - { - Bitmap aBitmap = ( (const MetaBmpScaleAction*)pMA )->GetBitmap(); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Point aPoint = ( (const MetaBmpScaleAction*) pMA )->GetPoint(); - Size aSize = ( (const MetaBmpScaleAction*)pMA )->GetSize(); - ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - case META_BMPSCALEPART_ACTION : - { - Bitmap aBitmap( ( (const MetaBmpScalePartAction*)pMA )->GetBitmap() ); - aBitmap.Crop( Rectangle( ( (const MetaBmpScalePartAction*)pMA )->GetSrcPoint(), - ( (const MetaBmpScalePartAction*)pMA )->GetSrcSize() ) ); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Point aPoint = ( (const MetaBmpScalePartAction*) pMA)->GetDestPoint(); - Size aSize = ( (const MetaBmpScalePartAction*)pMA )->GetDestSize(); - ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - case META_BMPEX_ACTION : - { - BitmapEx aBitmapEx( ( (MetaBmpExAction*)pMA)->GetBitmapEx() ); - Bitmap aBitmap( aBitmapEx.GetBitmap() ); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Bitmap aMask( aBitmapEx.GetMask() ); - Point aPoint = ( (const MetaBmpExAction*) pMA)->GetPoint(); - Size aSize = ( aBitmap.GetSizePixel() ); - ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - case META_BMPEXSCALE_ACTION : - { - BitmapEx aBitmapEx( ( (MetaBmpExScaleAction*)pMA)->GetBitmapEx() ); - Bitmap aBitmap( aBitmapEx.GetBitmap() ); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Bitmap aMask( aBitmapEx.GetMask() ); - Point aPoint = ( (const MetaBmpExScaleAction*) pMA)->GetPoint(); - Size aSize( ( (const MetaBmpExScaleAction*)pMA )->GetSize() ); - ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - case META_BMPEXSCALEPART_ACTION : - { - BitmapEx aBitmapEx( ( (const MetaBmpExScalePartAction*)pMA )->GetBitmapEx() ); - aBitmapEx.Crop( Rectangle( ( (const MetaBmpExScalePartAction*)pMA )->GetSrcPoint(), - ( (const MetaBmpExScalePartAction*)pMA )->GetSrcSize() ) ); - Bitmap aBitmap( aBitmapEx.GetBitmap() ); - if ( mbGrayScale ) - aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS ); - Bitmap aMask( aBitmapEx.GetMask() ); - Point aPoint = ( (const MetaBmpExScalePartAction*) pMA)->GetDestPoint(); - Size aSize = ( (const MetaBmpExScalePartAction*)pMA )->GetDestSize(); - ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() ); - } - break; - - // Unsupported Actions - case META_MASK_ACTION: - case META_MASKSCALE_ACTION: - case META_MASKSCALEPART_ACTION: - { - DBG_ERROR( "Unsupported action: MetaMask...Action!" ); - } - break; - - case META_GRADIENT_ACTION : - { - PolyPolygon aPolyPoly( ( (const MetaGradientAction*)pMA)->GetRect() ); - ImplWriteGradient( aPolyPoly, ( (const MetaGradientAction*) pMA )->GetGradient(), rVDev ); - } - break; - - case META_GRADIENTEX_ACTION : - { - PolyPolygon aPolyPoly( ( (const MetaGradientExAction*)pMA)->GetPolyPolygon() ); - ImplWriteGradient( aPolyPoly, ( (const MetaGradientExAction*) pMA )->GetGradient(), rVDev ); - } - break; - - case META_HATCH_ACTION : - { - VirtualDevice l_aVDev; - GDIMetaFile aTmpMtf; - - l_aVDev.SetMapMode( rVDev.GetMapMode() ); - l_aVDev.AddHatchActions( ( (const MetaHatchAction*)pMA)->GetPolyPolygon(), - ( (const MetaHatchAction*)pMA )->GetHatch(), aTmpMtf ); - ImplWriteActions( aTmpMtf, rVDev ); - } - break; - - case META_WALLPAPER_ACTION : - { - const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pMA; - Rectangle aRect = pA->GetRect(); - Wallpaper aWallpaper = pA->GetWallpaper(); - - if ( aWallpaper.IsBitmap() ) - { - BitmapEx aBitmapEx = aWallpaper.GetBitmap(); - Bitmap aBitmap( aBitmapEx.GetBitmap() ); - if ( aBitmapEx.IsTransparent() ) - { - if ( aWallpaper.IsGradient() ) - { - - // gradient action - - } - Bitmap aMask( aBitmapEx.GetMask() ); - ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() ); - } - else - ImplBmp( &aBitmap, NULL, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() ); - - // wallpaper Style - - } - else if ( aWallpaper.IsGradient() ) - { - - // gradient action - - } - else - { - aColor = aWallpaper.GetColor(); - ImplRectFill( aRect ); - } - } - break; - - case META_ISECTRECTCLIPREGION_ACTION: - { - const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA; - Region aRegion( pA->GetRect() ); - ImplSetClipRegion( aRegion ); - } - break; - - case META_CLIPREGION_ACTION: - { - const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pMA; - Region aRegion( pA->GetRegion() ); - ImplSetClipRegion( aRegion ); - } - break; - - case META_ISECTREGIONCLIPREGION_ACTION: - { - const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pMA; - Region aRegion( pA->GetRegion() ); - ImplSetClipRegion( aRegion ); - } - break; - - case META_MOVECLIPREGION_ACTION: - { -/* - if ( !aClipRegion.IsEmpty() ) - { - const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pMA; - aClipRegion.Move( pA->GetHorzMove(), pA->GetVertMove() ); - ImplSetClipRegion(); - } -*/ - } - break; - - case META_LINECOLOR_ACTION : - { - if ( ( (const MetaLineColorAction*) pMA)->IsSetting() ) - { - bLineColor = TRUE; - aLineColor = ( (const MetaLineColorAction*) pMA )->GetColor(); - } - else - bLineColor = FALSE; - } - break; - - case META_FILLCOLOR_ACTION : - { - if ( ( (const MetaFillColorAction*) pMA )->IsSetting() ) - { - bFillColor = TRUE; - aFillColor = ( (const MetaFillColorAction*) pMA )->GetColor(); - } - else - bFillColor = FALSE; - } - break; - - case META_TEXTCOLOR_ACTION : - { - aTextColor = ( (const MetaTextColorAction*) pMA )->GetColor(); - } - break; - - case META_TEXTFILLCOLOR_ACTION : - { - if ( ( (const MetaTextFillColorAction*) pMA )->IsSetting() ) - { - bTextFillColor = TRUE; - aTextFillColor = ( (const MetaTextFillColorAction*) pMA )->GetColor(); - } - else - bTextFillColor = FALSE; - } - break; - - case META_TEXTALIGN_ACTION : - { - eTextAlign = ( (const MetaTextAlignAction*) pMA )->GetTextAlign(); - } - break; - - case META_MAPMODE_ACTION : - { - pMA->Execute( &rVDev ); - ImplGetMapMode( rVDev.GetMapMode() ); - } - break; - - case META_FONT_ACTION : - { - maFont = ((const MetaFontAction*)pMA)->GetFont(); - rVDev.SetFont( maFont ); - } - break; - - case META_PUSH_ACTION : - { - rVDev.Push(((const MetaPushAction*)pMA)->GetFlags() ); - StackMember* pGS = new StackMember; - pGS->pSucc = pGDIStack; - pGDIStack = pGS; - pGS->aDashArray = aDashArray; - pGS->eJoinType = eJoinType; - pGS->eLineCap = eLineCap; - pGS->fLineWidth = fLineWidth; - pGS->fMiterLimit = fMiterLimit; - pGS->eTextAlign = eTextAlign; - pGS->aGlobalCol = aColor; - pGS->bLineCol = bLineColor; - pGS->aLineCol = aLineColor; - pGS->bFillCol = bFillColor; - pGS->aFillCol = aFillColor; - pGS->aTextCol = aTextColor; - pGS->bTextFillCol = bTextFillColor; - pGS->aTextFillCol = aTextFillColor; - pGS->aBackgroundCol = aBackgroundColor; - bRegionChanged = FALSE; - pGS->aFont = maFont; - mnLatestPush = mpPS->Tell(); - ImplWriteLine( "gs" ); - } - break; - - case META_POP_ACTION : - { - rVDev.Pop(); - StackMember* pGS; - if( pGDIStack ) - { - pGS = pGDIStack; - pGDIStack = pGS->pSucc; - aDashArray = pGS->aDashArray; - eJoinType = pGS->eJoinType; - eLineCap = pGS->eLineCap; - fLineWidth = pGS->fLineWidth; - fMiterLimit = pGS->fMiterLimit; - eTextAlign = pGS->eTextAlign; - aColor = pGS->aGlobalCol; - bLineColor = pGS->bLineCol; - aLineColor = pGS->aLineCol; - bFillColor = pGS->bFillCol; - aFillColor = pGS->aFillCol; - aTextColor = pGS->aTextCol; - bTextFillColor = pGS->bTextFillCol; - aTextFillColor = pGS->aTextFillCol; - aBackgroundColor = pGS->aBackgroundCol; - maFont = pGS->aFont; - maLastFont = Font(); // set maLastFont != maFont -> so that - delete pGS; - sal_uInt32 nCurrentPos = mpPS->Tell(); - if ( nCurrentPos - 3 == mnLatestPush ) - { - mpPS->Seek( mnLatestPush ); - ImplWriteLine( " " ); - mpPS->Seek( mnLatestPush ); - } - else - ImplWriteLine( "gr" ); - } - } - break; - - case META_EPS_ACTION : - { - GfxLink aGfxLink = ( (const MetaEPSAction*) pMA )->GetLink(); - const GDIMetaFile aSubstitute( ( ( const MetaEPSAction*) pMA )->GetSubstitute() ); - - BOOL bLevelConflict = FALSE; - BYTE* pSource = (BYTE*) aGfxLink.GetData(); - ULONG nSize = aGfxLink.GetDataSize(); - ULONG nParseThis = POSTSCRIPT_BOUNDINGSEARCH; - if ( nSize < 64 ) // assuming eps is larger than 64 bytes - pSource = NULL; - if ( nParseThis > nSize ) - nParseThis = nSize; - - if ( pSource && ( mnLevel == 1 ) ) - { - BYTE* pFound = ImplSearchEntry( pSource, (BYTE*)"%%LanguageLevel:", nParseThis - 10, 16 ); - if ( pFound ) - { - BYTE k, i = 10; - pFound += 16; - while ( --i ) - { - k = *pFound++; - if ( ( k > '0' ) && ( k <= '9' ) ) - { - if ( k != '1' ) - { - bLevelConflict = TRUE; - mnLevelWarning++; - } - break; - } - } - } - } - if ( !bLevelConflict ) - { - double nBoundingBox[4]; - if ( pSource && ImplGetBoundingBox( nBoundingBox, pSource, nParseThis ) ) - { - Point aPoint = ( (const MetaEPSAction*) pMA )->GetPoint(); - Size aSize = ( (const MetaEPSAction*) pMA )->GetSize(); - - MapMode aMapMode( aSubstitute.GetPrefMapMode() ); - Size aOutSize( rVDev.LogicToLogic( aSize, rVDev.GetMapMode(), aMapMode ) ); - Point aOrigin( rVDev.LogicToLogic( aPoint, rVDev.GetMapMode(), aMapMode ) ); - aOrigin.Y() += aOutSize.Height(); - aMapMode.SetOrigin( aOrigin ); - aMapMode.SetScaleX( aOutSize.Width() / ( nBoundingBox[ 2 ] - nBoundingBox[ 0 ] ) ); - aMapMode.SetScaleY( aOutSize.Height() / ( nBoundingBox[ 3 ] - nBoundingBox[ 1 ] ) ); - ImplWriteLine( "gs" ); - ImplGetMapMode( aMapMode ); - ImplWriteLine( "%%BeginDocument:" ); - mpPS->Write( pSource, aGfxLink.GetDataSize() ); - ImplWriteLine( "%%EndDocument\ngr" ); - } - } - } - break; - - case META_TRANSPARENT_ACTION: - { -// ImplLine( ( (const MetaTransparentAction*) pMA )->GetPolyPolygon() ); - } - break; - - case META_RASTEROP_ACTION: - { - pMA->Execute( &rVDev ); - } - 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 ); - - ImplWriteActions( aTmpMtf, rVDev ); - } - break; - - case META_COMMENT_ACTION: - { - const MetaCommentAction* pA = (const MetaCommentAction*) pMA; - if ( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) - { - const MetaGradientExAction* pGradAction = NULL; - while( ++nCurAction < nCount ) - { - MetaAction* pAction = rMtf.GetAction( nCurAction ); - if( pAction->GetType() == META_GRADIENTEX_ACTION ) - pGradAction = (const MetaGradientExAction*) pAction; - else if( ( pAction->GetType() == META_COMMENT_ACTION ) && - ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) ) - { - break; - } - } - if( pGradAction ) - ImplWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), rVDev ); - } - else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_END" ) ) - { - if ( aFillPath.Count() ) - { - aFillPath = PolyPolygon(); - ImplWriteLine( "gr" ); - } - } - else - { - const BYTE* pData = pA->GetData(); - if ( pData ) - { - SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ ); - sal_Bool bSkipSequence = sal_False; - ByteString sSeqEnd; - - if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) ) - { - sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" ); - SvtGraphicStroke aStroke; - aMemStm >> aStroke; - - Polygon aPath; - aStroke.getPath( aPath ); - - PolyPolygon aStartArrow; - PolyPolygon aEndArrow; -// double fTransparency( aStroke.getTransparency() ); - double fStrokeWidth( aStroke.getStrokeWidth() ); - SvtGraphicStroke::JoinType eJT( aStroke.getJoinType() ); - SvtGraphicStroke::DashArray l_aDashArray; - - aStroke.getStartArrow( aStartArrow ); - aStroke.getEndArrow( aEndArrow ); - aStroke.getDashArray( l_aDashArray ); - - bSkipSequence = sal_True; - if ( l_aDashArray.size() > 11 ) // ps dasharray limit is 11 - bSkipSequence = sal_False; - if ( aStartArrow.Count() || aEndArrow.Count() ) - bSkipSequence = sal_False; - if ( (sal_uInt32)eJT > 2 ) - bSkipSequence = sal_False; - if ( l_aDashArray.size() && ( fStrokeWidth != 0.0 ) ) - bSkipSequence = sal_False; - if ( bSkipSequence ) - { - ImplWriteLineInfo( fStrokeWidth, aStroke.getMiterLimit(), - aStroke.getCapType(), eJT, l_aDashArray ); - ImplPolyLine( aPath ); - } - } - else if( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) ) - { - sSeqEnd = ByteString( "XPATHFILL_SEQ_END" ); - SvtGraphicFill aFill; - aMemStm >> aFill; - switch( aFill.getFillType() ) - { - case SvtGraphicFill::fillSolid : - { - bSkipSequence = sal_True; - PolyPolygon aPolyPoly; - aFill.getPath( aPolyPoly ); - sal_uInt16 i, nPolyCount = aPolyPoly.Count(); - if ( nPolyCount ) - { - aFillColor = aFill.getFillColor(); - ImplWriteFillColor( PS_SPACE ); - for ( i = 0; i < nPolyCount; ) - { - ImplAddPath( aPolyPoly.GetObject( i ) ); - if ( ++i < nPolyCount ) - { - *mpPS << "p"; - mnCursorPos += 2; - ImplExecMode( PS_RET ); - } - } - *mpPS << "p ef"; - mnCursorPos += 4; - ImplExecMode( PS_RET ); - } - } - break; - - case SvtGraphicFill::fillTexture : - { - aFill.getPath( aFillPath ); - - /* normally an object filling is consisting of three MetaActions: - MetaBitmapAction using RasterOp xor, - MetaPolyPolygonAction using RasterOp rop_0 - MetaBitmapAction using RasterOp xor - - Because RasterOps cannot been used in Postscript, we have to - replace these actions. The MetaComment "XPATHFILL_SEQ_BEGIN" is - providing the clippath of the object. The following loop is - trying to find the bitmap that is matching the clippath, so that - only one bitmap is exported, otherwise if the bitmap is not - locatable, all metaactions are played normally. - */ - sal_uInt32 nCommentStartAction = nCurAction; - sal_uInt32 nBitmapCount = 0; - sal_uInt32 nBitmapAction = 0; - - sal_Bool bOk = sal_True; - while( bOk && ( ++nCurAction < nCount ) ) - { - MetaAction* pAction = rMtf.GetAction( nCurAction ); - switch( pAction->GetType() ) - { - case META_BMPSCALE_ACTION : - case META_BMPSCALEPART_ACTION : - case META_BMPEXSCALE_ACTION : - case META_BMPEXSCALEPART_ACTION : - { - nBitmapCount++; - nBitmapAction = nCurAction; - } - break; - case META_COMMENT_ACTION : - { - if (((const MetaCommentAction*)pAction)->GetComment().Equals( "XPATHFILL_SEQ_END" )) - bOk = sal_False; - } - break; - } - } - if( nBitmapCount == 2 ) - { - ImplWriteLine( "gs" ); - ImplIntersect( aFillPath ); - GDIMetaFile aTempMtf; - aTempMtf.AddAction( rMtf.GetAction( nBitmapAction )->Clone() ); - ImplWriteActions( aTempMtf, rVDev ); - ImplWriteLine( "gr" ); - aFillPath = PolyPolygon(); - } - else - nCurAction = nCommentStartAction + 1; - } - break; - - case SvtGraphicFill::fillGradient : - aFill.getPath( aFillPath ); - break; - - case SvtGraphicFill::fillHatch : - break; - } - if ( aFillPath.Count() ) - { - ImplWriteLine( "gs" ); - ImplIntersect( aFillPath ); - } - } - if ( bSkipSequence ) - { - while( ++nCurAction < nCount ) - { - pMA = rMtf.GetAction( nCurAction ); - if ( pMA->GetType() == META_COMMENT_ACTION ) - { - ByteString sComment( ((MetaCommentAction*)pMA)->GetComment() ); - if ( sComment.Equals( sSeqEnd ) ) - break; - } - } - } - } - } - } - break; - } - } -} - - - -//--------------------------------------------------------------------------------- - -inline void PSWriter::ImplWritePoint( const Point& rPoint, sal_uInt32 nMode ) -{ - ImplWriteDouble( rPoint.X() ); - ImplWriteDouble( rPoint.Y(), nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplMoveTo( const Point& rPoint, sal_uInt32 nMode ) -{ - ImplWritePoint( rPoint ); - ImplWriteByte( 'm' ); - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplLineTo( const Point& rPoint, sal_uInt32 nMode ) -{ - ImplWritePoint( rPoint ); - ImplWriteByte( 'l' ); - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode ) -{ - ImplWritePoint( rP1 ); - ImplWritePoint( rP2 ); - ImplWritePoint( rP3 ); - *mpPS << "ct "; - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplTranslate( const double& fX, const double& fY, sal_uInt32 nMode ) -{ - ImplWriteDouble( fX ); - ImplWriteDouble( fY ); - ImplWriteByte( 't' ); - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplScale( const double& fX, const double& fY, sal_uInt32 nMode ) -{ - ImplWriteDouble( fX ); - ImplWriteDouble( fY ); - ImplWriteByte( 's' ); - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplRect( const Rectangle & rRect ) -{ - if ( bFillColor ) - ImplRectFill( rRect ); - if ( bLineColor ) - { - double nWidth = rRect.GetWidth(); - double nHeight = rRect.GetHeight(); - - ImplWriteLineColor( PS_SPACE ); - ImplMoveTo( rRect.TopLeft() ); - ImplWriteDouble( nWidth ); - *mpPS << "0 rl 0 "; - ImplWriteDouble( nHeight ); - *mpPS << "rl "; - ImplWriteDouble( nWidth ); - *mpPS << "neg 0 rl "; - ImplClosePathDraw(); - } - *mpPS << (BYTE)10; - mnCursorPos = 0; -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplRectFill( const Rectangle & rRect ) -{ - double nWidth = rRect.GetWidth(); - double nHeight = rRect.GetHeight(); - - ImplWriteFillColor( PS_SPACE ); - ImplMoveTo( rRect.TopLeft() ); - ImplWriteDouble( nWidth ); - *mpPS << "0 rl 0 "; - ImplWriteDouble( nHeight ); - *mpPS << "rl "; - ImplWriteDouble( nWidth ); - *mpPS << "neg 0 rl ef "; - *mpPS << "p ef"; - mnCursorPos += 2; - ImplExecMode( PS_RET ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplAddPath( const Polygon & rPolygon ) -{ - USHORT i = 1; - USHORT nPointCount = rPolygon.GetSize(); - if ( nPointCount > 1 ) - { - ImplMoveTo( rPolygon.GetPoint( 0 ) ); - while ( i < nPointCount ) - { - if ( ( rPolygon.GetFlags( i ) == POLY_CONTROL ) - && ( ( i + 2 ) < nPointCount ) - && ( rPolygon.GetFlags( i + 1 ) == POLY_CONTROL ) - && ( rPolygon.GetFlags( i + 2 ) != POLY_CONTROL ) ) - { - ImplCurveTo( rPolygon[ i ], rPolygon[ i + 1 ], rPolygon[ i + 2 ], PS_WRAP ); - i += 3; - } - else - ImplLineTo( rPolygon.GetPoint( i++ ), PS_SPACE | PS_WRAP ); - } - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplIntersect( const PolyPolygon& rPolyPoly ) -{ - sal_uInt16 i, nPolyCount = rPolyPoly.Count(); - for ( i = 0; i < nPolyCount; ) - { - ImplAddPath( rPolyPoly.GetObject( i ) ); - if ( ++i < nPolyCount ) - { - *mpPS << "p"; - mnCursorPos += 2; - ImplExecMode( PS_RET ); - } - } - ImplWriteLine( "eoclip newpath" ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rVDev ) -{ - VirtualDevice l_aVDev; - GDIMetaFile aTmpMtf; - l_aVDev.SetMapMode( rVDev.GetMapMode() ); - l_aVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); - ImplWriteActions( aTmpMtf, rVDev ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplPolyPoly( const PolyPolygon & rPolyPoly, sal_Bool bTextOutline ) -{ - sal_uInt16 i, nPolyCount = rPolyPoly.Count(); - if ( nPolyCount ) - { - if ( bFillColor || bTextOutline ) - { - if ( bTextOutline ) - ImplWriteTextColor( PS_SPACE ); - else - ImplWriteFillColor( PS_SPACE ); - for ( i = 0; i < nPolyCount; ) - { - ImplAddPath( rPolyPoly.GetObject( i ) ); - if ( ++i < nPolyCount ) - { - *mpPS << "p"; - mnCursorPos += 2; - ImplExecMode( PS_RET ); - } - } - *mpPS << "p ef"; - mnCursorPos += 4; - ImplExecMode( PS_RET ); - } - if ( bLineColor ) - { - ImplWriteLineColor( PS_SPACE ); - for ( i = 0; i < nPolyCount; i++ ) - ImplAddPath( rPolyPoly.GetObject( i ) ); - ImplClosePathDraw( PS_RET ); - } - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplPolyLine( const Polygon & rPoly ) -{ - if ( bLineColor ) - { - ImplWriteLineColor( PS_SPACE ); - sal_uInt16 i, nPointCount = rPoly.GetSize(); - if ( nPointCount ) - { - if ( nPointCount > 1 ) - { - ImplMoveTo( rPoly.GetPoint( 0 ) ); - i = 1; - while ( i < nPointCount ) - { - if ( ( rPoly.GetFlags( i ) == POLY_CONTROL ) - && ( ( i + 2 ) < nPointCount ) - && ( rPoly.GetFlags( i + 1 ) == POLY_CONTROL ) - && ( rPoly.GetFlags( i + 2 ) != POLY_CONTROL ) ) - { - ImplCurveTo( rPoly[ i ], rPoly[ i + 1 ], rPoly[ i + 2 ], PS_WRAP ); - i += 3; - } - else - ImplLineTo( rPoly.GetPoint( i++ ), PS_SPACE | PS_WRAP ); - } - } - - // #104645# explicitely close path if polygon is closed - if( rPoly[ 0 ] == rPoly[ nPointCount-1 ] ) - ImplClosePathDraw( PS_RET ); - else - ImplPathDraw(); - } - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplSetClipRegion( Region& rClipRegion ) -{ - if ( !rClipRegion.IsEmpty() ) - { - Rectangle aRect; - RegionHandle hRegionHandle = rClipRegion.BeginEnumRects(); - - while ( rClipRegion.GetNextEnumRect( hRegionHandle, aRect ) ) - { - double nX1 = aRect.Left(); - double nY1 = aRect.Top(); - double nX2 = aRect.Right(); - double nY2 = aRect.Bottom(); - ImplWriteDouble( nX1 ); - ImplWriteDouble( nY1 ); - ImplWriteByte( 'm' ); - ImplWriteDouble( nX2 ); - ImplWriteDouble( nY1 ); - ImplWriteByte( 'l' ); - ImplWriteDouble( nX2 ); - ImplWriteDouble( nY2 ); - ImplWriteByte( 'l' ); - ImplWriteDouble( nX1 ); - ImplWriteDouble( nY2 ); - ImplWriteByte( 'l' ); - ImplWriteDouble( nX1 ); - ImplWriteDouble( nY1 ); - ImplWriteByte( 'l', PS_SPACE | PS_WRAP ); - }; - rClipRegion.EndEnumRects( hRegionHandle ); - ImplWriteLine( "eoclip newpath" ); - } -} - -//--------------------------------------------------------------------------------- -// possible gfx formats: -// -// level 1: grayscale 8 bit -// color 24 bit -// -// level 2: grayscale 8 bit -// color 1(pal), 4(pal), 8(pal), 24 Bit -// - -void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoint, double nXWidth, double nYHeightOrg ) -{ - if ( !pBitmap ) - return; - - INT32 nHeightOrg = pBitmap->GetSizePixel().Height(); - INT32 nHeightLeft = nHeightOrg; - long nWidth = pBitmap->GetSizePixel().Width(); - Point aSourcePos( rPoint ); - - while ( nHeightLeft ) - { - Bitmap aTileBitmap( *pBitmap ); - long nHeight = nHeightLeft; - double nYHeight = nYHeightOrg; - - BOOL bDoTrans = FALSE; - - Rectangle aRect; - Region aRegion; - - if ( pMaskBitmap ) - { - bDoTrans = TRUE; - while (TRUE) - { - if ( mnLevel == 1 ) - { - if ( nHeight > 10 ) - nHeight = 8; - } - aRect = Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( (long)nWidth, (long)nHeight ) ); - aRegion = Region( pMaskBitmap->CreateRegion( COL_BLACK, aRect ) ); - - if ( ( mnLevel == 1 ) && ( aRegion.GetRectCount() * 5 > 1000 ) ) - { - nHeight >>= 1; - if ( nHeight < 2 ) - return; - continue; - } - break; - } - } - if ( nHeight != nHeightOrg ) - { - nYHeight = nYHeightOrg * nHeight / nHeightOrg; - aTileBitmap.Crop( Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( nWidth, nHeight ) ) ); - } - if ( bDoTrans ) - { - ImplWriteLine( "gs\npum" ); - ImplTranslate( aSourcePos.X(), aSourcePos.Y() ); - ImplScale( nXWidth / nWidth, nYHeight / nHeight ); - RegionHandle hRegionHandle = aRegion.BeginEnumRects(); - - while ( aRegion.GetNextEnumRect( hRegionHandle, aRect ) ) - { - aRect.Move( 0, - ( nHeightOrg - nHeightLeft ) ); - ImplWriteLong( aRect.Left() ); - ImplWriteLong( aRect.Top() ); - ImplWriteByte( 'm' ); - ImplWriteLong( aRect.Right() + 1 ); - ImplWriteLong( aRect.Top() ); - ImplWriteByte( 'l' ); - ImplWriteLong( aRect.Right() + 1 ); - ImplWriteLong( aRect.Bottom() + 1 ); - ImplWriteByte( 'l' ); - ImplWriteLong( aRect.Left() ); - ImplWriteLong( aRect.Bottom() + 1 ); - ImplWriteByte( 'l' ); - ImplWriteByte( 'p', PS_SPACE | PS_WRAP ); - }; - aRegion.EndEnumRects( hRegionHandle ); - ImplWriteLine( "eoclip newpath" ); - ImplWriteLine( "pom" ); - } - BitmapReadAccess* pAcc = aTileBitmap.AcquireReadAccess(); - - if (!bDoTrans ) - ImplWriteLine( "pum" ); - - ImplTranslate( aSourcePos.X(), aSourcePos.Y() + nYHeight ); - ImplScale( nXWidth, nYHeight ); - if ( mnLevel == 1 ) // level 1 is always grayscale !!! - { - ImplWriteLong( nWidth ); - ImplWriteLong( nHeight ); - *mpPS << "8 ["; - ImplWriteLong( nWidth ); - *mpPS << "0 0 "; - ImplWriteLong( -nHeight ); - ImplWriteLong( 0 ); - ImplWriteLong( nHeight ); - ImplWriteLine( "]" ); - *mpPS << "{currentfile "; - ImplWriteLong( nWidth ); - ImplWriteLine( "string readhexstring pop}" ); - ImplWriteLine( "image" ); - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) ); - } - } - *mpPS << (BYTE)10; - } - else // Level 2 - { - if ( mbGrayScale ) - { - ImplWriteLine( "/DeviceGray setcolorspace" ); - ImplWriteLine( "<<" ); - ImplWriteLine( "/ImageType 1" ); - *mpPS << "/Width "; - ImplWriteLong( nWidth, PS_RET ); - *mpPS << "/Height "; - ImplWriteLong( nHeight, PS_RET ); - ImplWriteLine( "/BitsPerComponent 8" ); - ImplWriteLine( "/Decode[0 1]" ); - *mpPS << "/ImageMatrix["; - ImplWriteLong( nWidth ); - *mpPS << "0 0 "; - ImplWriteLong( -nHeight ); - ImplWriteLong( 0 ); - ImplWriteLong( nHeight, PS_NONE ); - ImplWriteByte( ']', PS_RET ); - ImplWriteLine( "/DataSource currentfile" ); - ImplWriteLine( "/ASCIIHexDecode filter" ); - if ( mbCompression ) - ImplWriteLine( "/LZWDecode filter" ); - ImplWriteLine( ">>" ); - ImplWriteLine( "image" ); - if ( mbCompression ) - { - StartCompression(); - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - Compress( (BYTE)pAcc->GetPixel( y, x ) ); - } - } - EndCompression(); - } - else - { - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) ); - } - } - } - } - else - { - // have we to write a palette ? - - if ( pAcc->HasPalette() ) - { - ImplWriteLine( "[/Indexed /DeviceRGB " ); - ImplWriteLong( pAcc->GetPaletteEntryCount() - 1, PS_RET ); - ImplWriteByte( '<', PS_NONE ); - for ( USHORT i = 0; i < pAcc->GetPaletteEntryCount(); i++ ) - { - BitmapColor aBitmapColor = pAcc->GetPaletteColor( i ); - ImplWriteHexByte( aBitmapColor.GetRed(), PS_NONE ); - ImplWriteHexByte( aBitmapColor.GetGreen(), PS_NONE ); - ImplWriteHexByte( aBitmapColor.GetBlue(), PS_SPACE | PS_WRAP ); - } - ImplWriteByte( '>', PS_RET ); - - ImplWriteLine( "] setcolorspace" ); - ImplWriteLine( "<<" ); - ImplWriteLine( "/ImageType 1" ); - *mpPS << "/Width "; - ImplWriteLong( nWidth, PS_RET ); - *mpPS << "/Height "; - ImplWriteLong( nHeight, PS_RET ); - ImplWriteLine( "/BitsPerComponent 8" ); - ImplWriteLine( "/Decode[0 255]" ); - *mpPS << "/ImageMatrix["; - ImplWriteLong( nWidth ); - *mpPS << "0 0 "; - ImplWriteLong( -nHeight ); - ImplWriteLong( 0); - ImplWriteLong( nHeight, PS_NONE ); - ImplWriteByte( ']', PS_RET ); - ImplWriteLine( "/DataSource currentfile" ); - ImplWriteLine( "/ASCIIHexDecode filter" ); - if ( mbCompression ) - ImplWriteLine( "/LZWDecode filter" ); - ImplWriteLine( ">>" ); - ImplWriteLine( "image" ); - if ( mbCompression ) - { - StartCompression(); - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - Compress( (BYTE)pAcc->GetPixel( y, x ) ); - } - } - EndCompression(); - } - else - { - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) ); - } - } - } - } - else // 24 bit color - { - ImplWriteLine( "/DeviceRGB setcolorspace" ); - ImplWriteLine( "<<" ); - ImplWriteLine( "/ImageType 1" ); - *mpPS << "/Width "; - ImplWriteLong( nWidth, PS_RET ); - *mpPS << "/Height "; - ImplWriteLong( nHeight, PS_RET ); - ImplWriteLine( "/BitsPerComponent 8" ); - ImplWriteLine( "/Decode[0 1 0 1 0 1]" ); - *mpPS << "/ImageMatrix["; - ImplWriteLong( nWidth ); - *mpPS << "0 0 "; - ImplWriteLong( -nHeight ); - ImplWriteLong( 0 ); - ImplWriteLong( nHeight, PS_NONE ); - ImplWriteByte( ']', PS_RET ); - ImplWriteLine( "/DataSource currentfile" ); - ImplWriteLine( "/ASCIIHexDecode filter" ); - if ( mbCompression ) - ImplWriteLine( "/LZWDecode filter" ); - ImplWriteLine( ">>" ); - ImplWriteLine( "image" ); - if ( mbCompression ) - { - StartCompression(); - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) ); - Compress( aBitmapColor.GetRed() ); - Compress( aBitmapColor.GetGreen() ); - Compress( aBitmapColor.GetBlue() ); - } - } - EndCompression(); - } - else - { - for ( long y = 0; y < nHeight; y++ ) - { - for ( long x = 0; x < nWidth; x++ ) - { - const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) ); - ImplWriteHexByte( aBitmapColor.GetRed() ); - ImplWriteHexByte( aBitmapColor.GetGreen() ); - ImplWriteHexByte( aBitmapColor.GetBlue() ); - } - } - } - } - } - ImplWriteLine( ">" ); // in Level 2 the dictionary needs to be closed (eod) - } - if ( bDoTrans ) - ImplWriteLine( "gr" ); - else - ImplWriteLine( "pom" ); - - aTileBitmap.ReleaseAccess( pAcc ); - nHeightLeft -= nHeight; - if ( nHeightLeft ) - { - nHeightLeft++; - aSourcePos.Y() = (long) ( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg ); - } - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteCharacter( sal_Char nChar ) -{ - switch( nChar ) - { - case '(' : - case ')' : - case '\\' : - ImplWriteByte( (BYTE)'\\', PS_NONE ); - } - ImplWriteByte( (BYTE)nChar, PS_NONE ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteString( const ByteString& rString, VirtualDevice& rVDev, const INT32* pDXArry, BOOL bStretch ) -{ - USHORT nLen = rString.Len(); - if ( nLen ) - { - USHORT i; - if ( pDXArry ) - { - double nx = 0; - - for( i = 0; i < nLen; i++ ) - { - if ( i > 0 ) - nx = pDXArry[ i - 1 ]; - ImplWriteDouble( ( bStretch ) ? nx : rVDev.GetTextWidth( rString.GetChar( i ) ) ); - ImplWriteDouble( nx ); - ImplWriteLine( "(", PS_NONE ); - ImplWriteCharacter( rString.GetChar( i ) ); - ImplWriteLine( ") bs" ); - } - } - else - { - ImplWriteByte( '(', PS_NONE ); - for ( i = 0; i < nLen; i++ ) - ImplWriteCharacter( rString.GetChar( i ) ); - ImplWriteLine( ") sw" ); - } - } -} - -// ------------------------------------------------------------------------ - -void PSWriter::ImplText( const String& rUniString, const Point& rPos, const INT32* pDXArry, sal_Int32 nWidth, VirtualDevice& rVDev ) -{ - sal_uInt16 nLen = rUniString.Len(); - if ( !nLen ) - return; - if ( mnTextMode == 0 ) // using glpyh outlines - { - Font aNotRotatedFont( maFont ); - aNotRotatedFont.SetOrientation( 0 ); - - VirtualDevice aVirDev( 1 ); - aVirDev.SetMapMode( rVDev.GetMapMode() ); - aVirDev.SetFont( aNotRotatedFont ); - aVirDev.SetTextAlign( eTextAlign ); - - sal_Int16 nRotation = maFont.GetOrientation(); - Polygon aPolyDummy( 1 ); - - PolyPolygon aPolyPoly; - Point aPos( rPos ); - if ( nRotation ) - { - aPolyDummy.SetPoint( aPos, 0 ); - aPolyDummy.Rotate( rPos, nRotation ); - aPos = aPolyDummy.GetPoint( 0 ); - } - sal_Bool bOldLineColor = bLineColor; - bLineColor = sal_False; - std::vector<PolyPolygon> aPolyPolyVec; - if ( aVirDev.GetTextOutlines( aPolyPolyVec, rUniString, 0, 0, STRING_LEN, TRUE, nWidth, pDXArry ) ) - { - // always adjust text position to match baseline alignment - ImplWriteLine( "pum" ); - ImplWriteDouble( aPos.X() ); - ImplWriteDouble( aPos.Y() ); - ImplWriteLine( "t" ); - if ( nRotation ) - { - ImplWriteF( nRotation, 1 ); - *mpPS << "r "; - } - std::vector<PolyPolygon>::iterator aIter( aPolyPolyVec.begin() ); - while ( aIter != aPolyPolyVec.end() ) - ImplPolyPoly( *aIter++, sal_True ); - ImplWriteLine( "pom" ); - } - bLineColor = bOldLineColor; - } - else if ( ( mnTextMode == 1 ) || ( mnTextMode == 2 ) ) // normal text output - { - if ( mnTextMode == 2 ) // forcing output one complete text packet, by - pDXArry = NULL; // ignoring the kerning array - ImplSetAttrForText( rPos ); - ByteString aStr( rUniString, maFont.GetCharSet() ); - ImplWriteString( aStr, rVDev, pDXArry, nWidth != 0 ); - if ( maFont.GetOrientation() ) - ImplWriteLine( "gr" ); - } -} - -// ------------------------------------------------------------------------ - -void PSWriter::ImplSetAttrForText( const Point& rPoint ) -{ - Point aPoint( rPoint ); - - long nRotation = maFont.GetOrientation(); - ImplWriteTextColor(); - - Size aSize = maFont.GetSize(); - - if ( maLastFont != maFont ) - { - if ( maFont.GetPitch() == PITCH_FIXED ) // a little bit font selection - ImplDefineFont( "Courier", "Oblique" ); - else if ( maFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) - ImplWriteLine( "/Symbol findfont" ); - else if ( maFont.GetFamily() == FAMILY_SWISS ) - ImplDefineFont( "Helvetica", "Oblique" ); - else - ImplDefineFont( "Times", "Italic" ); - - maLastFont = maFont; - aSize = maFont.GetSize(); - ImplWriteDouble( aSize.Height() ); - *mpPS << "sf "; - } - if ( eTextAlign != ALIGN_BASELINE ) - { // PostScript kennt kein FontAlignment - if ( eTextAlign == ALIGN_TOP ) // -> ich gehe daher davon aus, dass - aPoint.Y() += ( aSize.Height() * 4 / 5 ); // der Bereich unter der Baseline - else if ( eTextAlign == ALIGN_BOTTOM ) // in etwa 20% der Fontsize ausmacht - aPoint.Y() -= ( aSize.Height() / 5 ); - } - ImplMoveTo( aPoint ); - if ( nRotation ) - { - *mpPS << "gs "; - ImplWriteF( nRotation, 1 ); - *mpPS << "r "; - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplDefineFont( const char* pOriginalName, const char* pItalic ) -{ - *mpPS << (BYTE)'/'; //convert the font pOriginalName using ISOLatin1Encoding - *mpPS << pOriginalName; - switch ( maFont.GetWeight() ) - { - case WEIGHT_SEMIBOLD : - case WEIGHT_BOLD : - case WEIGHT_ULTRABOLD : - case WEIGHT_BLACK : - *mpPS << "-Bold"; - if ( maFont.GetItalic() != ITALIC_NONE ) - *mpPS << pItalic; - break; - default: - if ( maFont.GetItalic() != ITALIC_NONE ) - *mpPS << pItalic; - break; - } - ImplWriteLine( " f" ); -} - -//--------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------- - -void PSWriter::ImplClosePathDraw( ULONG nMode ) -{ - *mpPS << "pc"; - mnCursorPos += 2; - ImplExecMode( nMode ); -} - -void PSWriter::ImplPathDraw() -{ - *mpPS << "ps"; - mnCursorPos += 2; - ImplExecMode( PS_RET ); -} - -//--------------------------------------------------------------------------------- - -inline void PSWriter::ImplWriteLineColor( ULONG nMode ) -{ - if ( aColor != aLineColor ) - { - aColor = aLineColor; - ImplWriteColor( nMode ); - } -} -inline void PSWriter::ImplWriteFillColor( ULONG nMode ) -{ - if ( aColor != aFillColor ) - { - aColor = aFillColor; - ImplWriteColor( nMode ); - } -} -inline void PSWriter::ImplWriteTextColor( ULONG nMode ) -{ - if ( aColor != aTextColor ) - { - aColor = aTextColor; - ImplWriteColor( nMode ); - } -} -inline void PSWriter::ImplWriteTextFillColor( ULONG nMode ) -{ - if ( aColor != aTextFillColor ) - { - aColor = aTextFillColor; - ImplWriteColor( nMode ); - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteColor( ULONG nMode ) -{ - if ( mbGrayScale ) - { - // writes the Color (grayscale) as a Number from 0.000 up to 1.000 - - ImplWriteF( 1000 * ( (BYTE)aColor.GetRed() * 77 + (BYTE)aColor.GetGreen() * 151 + - (BYTE)aColor.GetBlue() * 28 + 1 ) / 65536, 3, nMode ); - } - else - { - ImplWriteB1 ( (BYTE)aColor.GetRed() ); - ImplWriteB1 ( (BYTE)aColor.GetGreen() ); - ImplWriteB1 ( (BYTE)aColor.GetBlue() ); - } - *mpPS << "c"; // ( c is defined as setrgbcolor or setgray ) - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -double PSWriter::ImplGetScaling( const MapMode& rMapMode ) -{ - double nMul; - switch ( rMapMode.GetMapUnit() ) - { - case MAP_PIXEL : - case MAP_SYSFONT : - case MAP_APPFONT : - - case MAP_100TH_MM : - nMul = 1; - break; - case MAP_10TH_MM : - nMul = 10; - break; - case MAP_MM : - nMul = 100; - break; - case MAP_CM : - nMul = 1000; - break; - case MAP_1000TH_INCH : - nMul = 2.54; - break; - case MAP_100TH_INCH : - nMul = 25.4; - break; - case MAP_10TH_INCH : - nMul = 254; - break; - case MAP_INCH : - nMul = 2540; - break; - case MAP_TWIP : - nMul = 1.76388889; - break; - case MAP_POINT : - nMul = 35.27777778; - break; - default: - nMul = 1.0; - break; - } - return nMul; -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplGetMapMode( const MapMode& rMapMode ) -{ - ImplWriteLine( "tm setmatrix" ); - double fMul = ImplGetScaling( rMapMode ); - double fScaleX = (double)rMapMode.GetScaleX() * fMul; - double fScaleY = (double)rMapMode.GetScaleY() * fMul; - ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY ); - ImplScale( fScaleX, fScaleY ); -} - -//--------------------------------------------------------------------------------- - -inline void PSWriter::ImplExecMode( ULONG nMode ) -{ - if ( nMode & PS_WRAP ) - { - if ( mnCursorPos >= PS_LINESIZE ) - { - mnCursorPos = 0; - *mpPS << (BYTE)0xa; - return; - } - } - if ( nMode & PS_SPACE ) - { - *mpPS << (BYTE)32; - mnCursorPos++; - } - if ( nMode & PS_RET ) - { - *mpPS << (BYTE)0xa; - mnCursorPos = 0; - } -} - -//--------------------------------------------------------------------------------- - -inline void PSWriter::ImplWriteLine( const char* pString, ULONG nMode ) -{ - ULONG i = 0; - while ( pString[ i ] ) - { - *mpPS << (BYTE)pString[ i++ ]; - } - mnCursorPos += i; - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteLineInfo( double fLWidth, double fMLimit, - SvtGraphicStroke::CapType eLCap, - SvtGraphicStroke::JoinType eJoin, - SvtGraphicStroke::DashArray& rLDash ) -{ - if ( fLineWidth != fLWidth ) - { - fLineWidth = fLWidth; - ImplWriteDouble( fLineWidth ); - ImplWriteLine( "lw", PS_SPACE ); - } - if ( eLineCap != eLCap ) - { - eLineCap = eLCap; - ImplWriteLong( (sal_Int32)eLineCap, PS_SPACE ); - ImplWriteLine( "lc", PS_SPACE ); - } - if ( eJoinType != eJoin ) - { - eJoinType = eJoin; - ImplWriteLong( (sal_Int32)eJoinType, PS_SPACE ); - ImplWriteLine( "lj", PS_SPACE ); - } - if ( eJoinType == SvtGraphicStroke::joinMiter ) - { - if ( fMiterLimit != fMLimit ) - { - fMiterLimit = fMLimit; - ImplWriteDouble( fMiterLimit ); - ImplWriteLine( "ml", PS_SPACE ); - } - } - if ( aDashArray != rLDash ) - { - aDashArray = rLDash; - sal_uInt32 j, i = aDashArray.size(); - ImplWriteLine( "[", PS_SPACE ); - for ( j = 0; j < i; j++ ) - ImplWriteDouble( aDashArray[ j ] ); - ImplWriteLine( "] 0 ld" ); - } -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo ) -{ - SvtGraphicStroke::DashArray l_aDashArray; - if ( rLineInfo.GetStyle() == LINE_DASH ) - l_aDashArray.push_back( 2 ); - double fLWidth = ( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5; - ImplWriteLineInfo( fLWidth, 10.0, SvtGraphicStroke::capButt, SvtGraphicStroke::joinMiter, l_aDashArray ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteLong( sal_Int32 nNumber, ULONG nMode ) -{ - const ByteString aNumber( ByteString::CreateFromInt32( nNumber ) ); - ULONG nLen = aNumber.Len(); - mnCursorPos += nLen; - for ( USHORT n = 0; n < nLen; n++ ) - *mpPS << aNumber.GetChar( n ); - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteDouble( double fNumber, ULONG nMode ) -{ - sal_Int32 nLength; - - sal_Int32 nPTemp = (sal_Int32)fNumber; - sal_Int32 nATemp = labs( (sal_Int32)( ( fNumber - nPTemp ) * 100000 ) ); - - if ( !nPTemp && nATemp && ( fNumber < 0.0 ) ) - *mpPS << (sal_Char)'-'; - - ByteString aNumber1( ByteString::CreateFromInt32( nPTemp ) ); - nLength = aNumber1.Len(); - mnCursorPos += nLength; - for ( sal_Int32 n = 0; n < nLength; n++ ) - *mpPS << aNumber1.GetChar( (sal_uInt16)n ); - - int zCount = 0; - if ( nATemp ) - { - *mpPS << (BYTE)'.'; - mnCursorPos++; - const ByteString aNumber2( ByteString::CreateFromInt32( nATemp ) ); - - sal_Int16 n, nLen = aNumber2.Len(); - if ( nLen < 8 ) - { - mnCursorPos += 6 - nLen; - for ( n = 0; n < ( 5 - nLen ); n++ ) - { - *mpPS << (BYTE)'0'; - } - } - mnCursorPos += nLen; - for ( n = 0; n < nLen; n++ ) - { - *mpPS << aNumber2.GetChar( n ); - zCount--; - if ( aNumber2.GetChar( n ) != '0' ) - zCount = 0; - } - if ( zCount ) - mpPS->SeekRel( zCount ); - } - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -// writes the number to stream: nNumber / ( 10^nCount ) - -void PSWriter::ImplWriteF( sal_Int32 nNumber, ULONG nCount, ULONG nMode ) -{ - if ( nNumber < 0 ) - { - *mpPS << (BYTE)'-'; - nNumber = -nNumber; - mnCursorPos++; - } - const ByteString aScaleFactor( ByteString::CreateFromInt32( nNumber ) ); - ULONG nLen = aScaleFactor.Len(); - long nStSize = ( nCount + 1 ) - nLen; - if ( nStSize >= 1 ) - { - *mpPS << (BYTE)'0'; - mnCursorPos++; - } - if ( nStSize >= 2 ) - { - *mpPS << (BYTE)'.'; - for ( long i = 1; i < nStSize; i++ ) - { - *mpPS << (BYTE)'0'; - mnCursorPos++; - } - } - mnCursorPos += nLen; - for( USHORT n = 0UL; n < nLen; n++ ) - { - if ( n == nLen - nCount ) - { - *mpPS << (BYTE)'.'; - mnCursorPos++; - } - *mpPS << aScaleFactor.GetChar( n ); - } - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteByte( BYTE nNumb, ULONG nMode ) -{ - *mpPS << ( nNumb ); - mnCursorPos++; - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -void PSWriter::ImplWriteHexByte( BYTE nNumb, ULONG nMode ) -{ - if ( ( nNumb >> 4 ) > 9 ) - *mpPS << (BYTE)( ( nNumb >> 4 ) + 'A' - 10 ); - else - *mpPS << (BYTE)( ( nNumb >> 4 ) + '0' ); - - if ( ( nNumb & 0xf ) > 9 ) - *mpPS << (BYTE)( ( nNumb & 0xf ) + 'A' - 10 ); - else - *mpPS << (BYTE)( ( nNumb & 0xf ) + '0' ); - mnCursorPos += 2; - ImplExecMode( nMode ); -} - -//--------------------------------------------------------------------------------- - -// writes the BYTE nNumb as a Number from 0.000 up to 1.000 - -void PSWriter::ImplWriteB1( BYTE nNumb, ULONG nMode ) -{ - ImplWriteF( 1000 * ( nNumb + 1 ) / 256 , 3, nMode ); -} - - -// ------------------------------------------------------------------------ - -inline void PSWriter::WriteBits( USHORT nCode, USHORT nCodeLen ) -{ - dwShift |= ( nCode << ( nOffset - nCodeLen ) ); - nOffset -= nCodeLen; - while ( nOffset < 24 ) - { - ImplWriteHexByte( (BYTE)( dwShift >> 24 ) ); - dwShift <<= 8; - nOffset += 8; - } - if ( nCode == 257 && nOffset != 32 ) - ImplWriteHexByte( (BYTE)( dwShift >> 24 ) ); -} - -// ------------------------------------------------------------------------ - -void PSWriter::StartCompression() -{ - USHORT i; - nDataSize = 8; - - nClearCode = 1 << nDataSize; - nEOICode = nClearCode + 1; - nTableSize = nEOICode + 1; - nCodeSize = nDataSize + 1; - - nOffset = 32; // anzahl freier bits in dwShift - dwShift = 0; - - pTable = new PSLZWCTreeNode[ 4096 ]; - - for ( i = 0; i < 4096; i++ ) - { - pTable[ i ].pBrother = pTable[ i ].pFirstChild = NULL; - pTable[ i ].nValue = (BYTE)( pTable[ i ].nCode = i ); - } - pPrefix = NULL; - WriteBits( nClearCode, nCodeSize ); -} - -// ------------------------------------------------------------------------ - -void PSWriter::Compress( BYTE nCompThis ) -{ - PSLZWCTreeNode* p; - USHORT i; - BYTE nV; - - if( !pPrefix ) - { - pPrefix = pTable + nCompThis; - } - else - { - nV = nCompThis; - for( p = pPrefix->pFirstChild; p != NULL; p = p->pBrother ) - { - if ( p->nValue == nV ) - break; - } - - if( p ) - pPrefix = p; - else - { - WriteBits( pPrefix->nCode, nCodeSize ); - - if ( nTableSize == 409 ) - { - 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 ) - 1 ) ) - nCodeSize++; - - p = pTable + ( nTableSize++ ); - p->pBrother = pPrefix->pFirstChild; - pPrefix->pFirstChild = p; - p->nValue = nV; - p->pFirstChild = NULL; - } - - pPrefix = pTable + nV; - } - } -} - -// ------------------------------------------------------------------------ - -void PSWriter::EndCompression() -{ - if( pPrefix ) - WriteBits( pPrefix->nCode, nCodeSize ); - - WriteBits( nEOICode, nCodeSize ); - delete[] pTable; -} - -// ------------------------------------------------------------------------ - -BYTE* PSWriter::ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ) -{ - while ( nComp-- >= nSize ) - { - ULONG i; - for ( i = 0; i < nSize; i++ ) - { - if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) - break; - } - if ( i == nSize ) - return pSource; - pSource++; - } - return NULL; -} - -// ------------------------------------------------------------------------ - -BOOL PSWriter::ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize ) -{ - BOOL bRetValue = FALSE; - ULONG nBytesRead; - - if ( nSize < 256 ) // we assume that the file is greater than 256 bytes - return FALSE; - - if ( nSize < POSTSCRIPT_BOUNDINGSEARCH ) - nBytesRead = nSize; - else - nBytesRead = POSTSCRIPT_BOUNDINGSEARCH; - - BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nBytesRead, 14 ); - if ( pDest ) - { - int nSecurityCount = 100; // only 100 bytes following the bounding box will be checked - nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0; - pDest += 14; - for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ ) - { - int nDivision = 1; - BOOL bDivision = FALSE; - BOOL bNegative = FALSE; - BOOL bValid = TRUE; - - while ( ( --nSecurityCount ) && ( ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) ) - pDest++; - BYTE nByte = *pDest; - while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) ) - { - switch ( nByte ) - { - case '.' : - if ( bDivision ) - bValid = FALSE; - else - bDivision = TRUE; - break; - case '-' : - bNegative = TRUE; - break; - default : - if ( ( nByte < '0' ) || ( nByte > '9' ) ) - nSecurityCount = 1; // error parsing the bounding box values - else if ( bValid ) - { - if ( bDivision ) - nDivision*=10; - nNumb[i] *= 10; - nNumb[i] += nByte - '0'; - } - break; - } - nSecurityCount--; - nByte = *(++pDest); - } - if ( bNegative ) - nNumb[i] = -nNumb[i]; - if ( bDivision && ( nDivision != 1 ) ) - nNumb[i] /= nDivision; - } - if ( nSecurityCount) - bRetValue = TRUE; - } - return bRetValue; -} - -//================== GraphicExport - die exportierte Funktion ================ - -extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pFilterConfigItem, BOOL) -{ - PSWriter aPSWriter; - return aPSWriter.WritePS( rGraphic, rStream, pFilterConfigItem ); -} - -//--------------------------------------------------------------------------------- - -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "eps" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPS( 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/goodies/source/filter.vcl/eps/epsstr.src b/goodies/source/filter.vcl/eps/epsstr.src deleted file mode 100644 index c24a89b6e417..000000000000 --- a/goodies/source/filter.vcl/eps/epsstr.src +++ /dev/null @@ -1,73 +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: epsstr.src,v $ - * $Revision: 1.43 $ - * - * 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_VERSION_CHECK -{ - Text [ en-US ] = "Warning: Not all of the imported EPS graphics could be saved at level1\nas some are at a higher level!"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/goodies/source/filter.vcl/eps/exports.map b/goodies/source/filter.vcl/eps/exports.map deleted file mode 100644 index 1b61354c2869..000000000000 --- a/goodies/source/filter.vcl/eps/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -EPSEXPORTER_1_0 { - global: - GraphicExport; - DoExportDialog; - - local: - *; -}; diff --git a/goodies/source/filter.vcl/eps/makefile.mk b/goodies/source/filter.vcl/eps/makefile.mk deleted file mode 100644 index c5599344725a..000000000000 --- a/goodies/source/filter.vcl/eps/makefile.mk +++ /dev/null @@ -1,83 +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: makefile.mk,v $ -# -# $Revision: 1.15 $ -# -# 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=goodies -TARGET=eps -DEPTARGET=veps - -#GEN_HID=TRUE - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Allgemein ---------------------------------------------------------- - -.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" -CDEFS+= -DEDITDEBUG -.ENDIF - -SRS1NAME=$(TARGET) -SRC1FILES = dlgeps.src \ - epsstr.src -.IF "$(L10N_framework)"=="" -EXCEPTIONSFILES=$(SLO)$/eps.obj -SLOFILES = $(SLO)$/eps.obj \ - $(SLO)$/dlgeps.obj -.ENDIF - -# ========================================================================== - -RESLIB1NAME=$(TARGET) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs -.IF "$(L10N_framework)"=="" -SHL1TARGET= eps$(DLLPOSTFIX) -SHL1IMPLIB= eps -SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) - -SHL1LIBS= $(SLB)$/eps.lib - -.IF "$(GUI)" != "UNX" -.IF "$(COM)" != "GCC" -SHL1OBJS= $(SLO)$/eps.obj -.ENDIF -.ENDIF - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) -.ENDIF - -# ========================================================================== - -.INCLUDE : target.mk diff --git a/goodies/source/filter.vcl/eps/strings.hrc b/goodies/source/filter.vcl/eps/strings.hrc deleted file mode 100644 index b0f14dc8c3d5..000000000000 --- a/goodies/source/filter.vcl/eps/strings.hrc +++ /dev/null @@ -1,32 +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: strings.hrc,v $ - * $Revision: 1.6 $ - * - * 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_VERSION_CHECK 260 - diff --git a/goodies/source/filter.vcl/eras/eras.cxx b/goodies/source/filter.vcl/eras/eras.cxx deleted file mode 100644 index 46307f2a56e0..000000000000 --- a/goodies/source/filter.vcl/eras/eras.cxx +++ /dev/null @@ -1,320 +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: eras.cxx,v $ - * $Revision: 1.11.38.1 $ - * - * 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_goodies.hxx" - -#include <vcl/graph.hxx> -#include <vcl/bmpacc.hxx> -#include <svtools/fltcall.hxx> -#include <svtools/FilterConfigItem.hxx> - -//============================ RASWriter ================================== - -class RASWriter { - -private: - - SvStream* mpOStm; - USHORT mpOStmOldModus; - - BOOL mbStatus; - BitmapReadAccess* mpAcc; - - ULONG mnWidth, mnHeight; - USHORT mnColors, mnDepth; - - ULONG mnRepCount; - BYTE mnRepVal; - - com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; - - void ImplCallback( ULONG nCurrentYPos ); - BOOL ImplWriteHeader(); - void ImplWritePalette(); - void ImplWriteBody(); - void ImplPutByte( BYTE ); // RLE decoding - -public: - RASWriter(); - ~RASWriter(); - - BOOL WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem ); -}; - -//=================== Methoden von RASWriter ============================== - -RASWriter::RASWriter() : - mbStatus ( TRUE ), - mpAcc ( NULL ), - mnRepCount ( 0xffffffff ) -{ -} - -// ------------------------------------------------------------------------ - -RASWriter::~RASWriter() -{ -} - -// ------------------------------------------------------------------------ - -void RASWriter::ImplCallback( ULONG nYPos ) -{ - if ( xStatusIndicator.is() ) - xStatusIndicator->setValue( (USHORT)( ( 100 * nYPos ) / mnHeight ) ); -} - -// ------------------------------------------------------------------------ - -BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS, FilterConfigItem* pFilterConfigItem) -{ - Bitmap aBmp; - - mpOStm = &rRAS; - - if ( pFilterConfigItem ) - { - xStatusIndicator = pFilterConfigItem->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - { - rtl::OUString aMsg; - xStatusIndicator->start( aMsg, 100 ); - } - } - - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - aBmp = aBmpEx.GetBitmap(); - - if ( aBmp.GetBitCount() == 4 ) - aBmp.Convert( BMP_CONVERSION_8BIT_COLORS ); - - mnDepth = aBmp.GetBitCount(); - - // export code below only handles three discrete cases - mnDepth = mnDepth <= 1 ? 1 : mnDepth <= 8 ? 8 : 24; - - mpAcc = aBmp.AcquireReadAccess(); - if ( mpAcc ) - { - mpOStmOldModus = mpOStm->GetNumberFormatInt(); - mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - - if ( ImplWriteHeader() ) - { - if ( mnDepth <= 8 ) - ImplWritePalette(); - ImplWriteBody(); - } - aBmp.ReleaseAccess( mpAcc ); - } - else - mbStatus = FALSE; - - mpOStm->SetNumberFormatInt( mpOStmOldModus ); - - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); - - return mbStatus; -} - -// ------------------------------------------------------------------------ - -BOOL RASWriter::ImplWriteHeader() -{ - mnWidth = mpAcc->Width(); - mnHeight = mpAcc->Height(); - if ( mnDepth <= 8 ) - { - mnColors = mpAcc->GetPaletteEntryCount(); - if (mnColors == 0) - mbStatus = FALSE; - } - if ( mbStatus && mnWidth && mnHeight && mnDepth ) - { - *mpOStm << (UINT32)0x59a66a95 << (UINT32)mnWidth << (UINT32)mnHeight - << (UINT32)mnDepth - << (UINT32)(( ( ( ( mnWidth * mnDepth ) + 15 ) >> 4 ) << 1 ) * mnHeight) - << (UINT32)2; - - if ( mnDepth > 8 ) - *mpOStm << (UINT32)0 << (UINT32)0; - else - { - - *mpOStm << (UINT32)1 << (UINT32)( mnColors * 3 ); - } - } - else mbStatus = FALSE; - - return mbStatus; -} - -// ------------------------------------------------------------------------ - -void RASWriter::ImplWritePalette() -{ - USHORT i; - - for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetRed() ) ; - for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetGreen() ) ; - for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetBlue() ) ; -} - -// ------------------------------------------------------------------------ - -void RASWriter::ImplWriteBody() -{ - ULONG x, y; - - if ( mnDepth == 24 ) - { - for ( y = 0; y < mnHeight; y++ ) - { - ImplCallback( y ); // processing output - for ( x = 0; x < mnWidth; x++ ) - { - BitmapColor aColor( mpAcc->GetPixel( y, x ) ); - ImplPutByte( aColor.GetBlue() ); // Format ist BGR - ImplPutByte( aColor.GetGreen() ); - ImplPutByte( aColor.GetRed() ); - } - if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ??? - } - } - else if ( mnDepth == 8 ) - { - for ( y = 0; y < mnHeight; y++ ) - { - ImplCallback( y ); // processing output - for ( x = 0; x < mnWidth; x++ ) - { - ImplPutByte ( mpAcc->GetPixel( y, x ) ); - } - if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ??? - } - } - else if ( mnDepth == 1 ) - { - BYTE nDat = 0; - - for ( y = 0; y < mnHeight; y++ ) - { - ImplCallback( y ); // processing output - for ( x = 0; x < mnWidth; x++ ) - { - nDat = ( ( nDat << 1 ) | ( mpAcc->GetPixel ( y, x ) & 1 ) ); - if ( ( x & 7 ) == 7 ) - ImplPutByte( nDat ); - } - if ( x & 7 ) - ImplPutByte( sal::static_int_cast< BYTE >(nDat << ( ( ( x & 7 ) ^ 7 ) + 1)) );// write remaining bits - if (!( ( x - 1 ) & 0x8 ) ) - ImplPutByte( 0 ); // WORD ALIGNMENT ??? - } - } - ImplPutByte( mnRepVal + 1 ); // end of RLE decoding -} - -// ------------------------------------------------------------------------ - -void RASWriter::ImplPutByte( BYTE nPutThis ) -{ - if ( mnRepCount == 0xffffffff ) - { - mnRepCount = 0; - mnRepVal = nPutThis; - } - else - { - if ( ( nPutThis == mnRepVal ) && ( mnRepCount != 0xff ) ) - mnRepCount++; - else - { - if ( mnRepCount == 0 ) - { - *mpOStm << (BYTE)mnRepVal; - if ( mnRepVal == 0x80 ) - *mpOStm << (BYTE)0; - } - else - { - *mpOStm << (BYTE)0x80; - *mpOStm << (BYTE)mnRepCount; - *mpOStm << (BYTE)mnRepVal; - } - mnRepVal = nPutThis; - mnRepCount = 0; - } - } -} - -// ------------------------------------------------------------------------ - -// --------------------- -// - exported function - -// --------------------- - -extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem, BOOL ) -{ - RASWriter aRASWriter; - - return aRASWriter.WriteRAS( rGraphic, rStream, pFilterConfigItem ); -} -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) |