diff options
Diffstat (limited to 'goodies/source/filter.vcl/epgm')
-rw-r--r-- | goodies/source/filter.vcl/epgm/dlgepgm.cxx | 123 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/dlgepgm.hrc | 68 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/dlgepgm.hxx | 101 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/dlgepgm.src | 198 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/epgm.cxx | 339 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/epgmstr.src | 69 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/makefile.mk | 185 | ||||
-rw-r--r-- | goodies/source/filter.vcl/epgm/strings.hrc | 61 |
8 files changed, 1144 insertions, 0 deletions
diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.cxx b/goodies/source/filter.vcl/epgm/dlgepgm.cxx new file mode 100644 index 000000000000..19a500dbf95e --- /dev/null +++ b/goodies/source/filter.vcl/epgm/dlgepgm.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: dlgepgm.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#pragma hdrstop +#include <tools/ref.hxx> +#include <vcl/config.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 ) ), + aGrpFormat ( this, ResId( GRP_FORMAT ) ), + aRBRaw ( this, ResId( RB_RAW ) ), + aRBASCII ( this, ResId( RB_ASCII ) ), + aBtnOK ( this, ResId( BTN_OK ) ), + aBtnCancel ( this, ResId( BTN_CANCEL ) ), + aBtnHelp ( this, ResId( BTN_HELP ) ), + pConfig ( rPara.pCfg ), + pMgr ( rPara.pResMgr ) +{ + FreeResource(); + + // Config-Parameter lesen + + String aFormatStr( ResId( KEY_FORMAT, pMgr ) ); + sal_Int32 nFormat = pConfig->ReadKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32(); + + BOOL bCheck = FALSE; + if ( !nFormat ) + bCheck ^= TRUE; + aRBRaw.Check( bCheck ); + bCheck ^= TRUE; + aRBASCII.Check( bCheck ); + + aBtnOK.SetClickHdl( LINK( this, DlgExportEPGM, OK ) ); +} + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ + +IMPL_LINK( DlgExportEPGM, OK, void *, EMPTYARG ) +{ + + // Config-Parameter schreiben + sal_Int32 nCheck = 0; + if ( aRBASCII.IsChecked() ) + nCheck++; + String aFormatStr( ResId( KEY_FORMAT, pMgr ) ); + pConfig->WriteKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) ); + + EndDialog( RET_OK ); + + return 0; +} diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.hrc b/goodies/source/filter.vcl/epgm/dlgepgm.hrc new file mode 100644 index 000000000000..c582fdd8b2db --- /dev/null +++ b/goodies/source/filter.vcl/epgm/dlgepgm.hrc @@ -0,0 +1,68 @@ +/************************************************************************* + * + * $RCSfile: dlgepgm.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "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 new file mode 100644 index 000000000000..4cfd937f33da --- /dev/null +++ b/goodies/source/filter.vcl/epgm/dlgepgm.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: dlgepgm.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _DLGEPGM_HXX_ +#define _DLGEPGM_HXX_ +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/group.hxx> +#include <vcl/field.hxx> +#include <svtools/stdctrl.hxx> + + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen +|* +\************************************************************************/ + +class Config; +class ResMgr; + +class DlgExportEPGM : public ModalDialog +{ +private: + GroupBox aGrpFormat; + RadioButton aRBRaw; + RadioButton aRBASCII; + OKButton aBtnOK; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + Config* pConfig; + ResMgr* pMgr; + + DECL_LINK( OK, void * ); + +public: + DlgExportEPGM( FltCallDialogParameter& rPara ); +}; + +#endif // _DLGEPGM_HXX_ diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.src b/goodies/source/filter.vcl/epgm/dlgepgm.src new file mode 100644 index 000000000000..c5d5bd63797b --- /dev/null +++ b/goodies/source/filter.vcl/epgm/dlgepgm.src @@ -0,0 +1,198 @@ +/************************************************************************* + * + * $RCSfile: dlgepgm.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "dlgepgm.hrc" +ModalDialog DLG_EXPORT_EPGM +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 133 , 67 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + Text = "PGM Optionen" ; + Text [ ENGLISH ] = "PGM options" ; + Text [ english_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 ; + }; + GroupBox GRP_FORMAT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 60 , 54 ) ; + Text = "Datei Format" ; + Text [ ENGLISH ] = "file format" ; + Text[ italian ] = "Formato file"; + Text[ portuguese_brazilian ] = "Datei Format"; + Text[ portuguese ] = "Formato do ficheiro"; + Text[ danish ] = "Filformat"; + Text[ french ] = "Format de fichier"; + Text[ swedish ] = "Filformat"; + Text[ dutch ] = "Bestandsformaat"; + Text[ spanish ] = "Formato de archivo"; + Text[ english_us ] = "File format"; + Text[ chinese_simplified ] = "ļʽ"; + Text[ russian ] = " "; + Text[ polish ] = "Format pliku"; + Text[ japanese ] = "̧ق̏"; + Text[ chinese_traditional ] = "ɮ榡"; + Text[ arabic ] = " "; + Text[ dutch ] = "Bestandsformaat"; + Text[ chinese_simplified ] = "ļʽ"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ turkish ] = "Dosya format"; + Text[ language_user1 ] = " "; + }; + RadioButton RB_RAW + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text = "~Binr" ; + Text [ ENGLISH ] = "~raw" ; + TabStop = TRUE ; + Text[ italian ] = "~Binario"; + Text[ portuguese_brazilian ] = "~Binr"; + Text[ portuguese ] = "~Binrio"; + Text[ danish ] = "~Binr"; + Text[ french ] = "~Binaire"; + Text[ swedish ] = "~Binr"; + Text[ dutch ] = "~Binair"; + Text[ spanish ] = "~Binario"; + Text[ english_us ] = "~Binary"; + Text[ chinese_simplified ] = "Ԫ(~B)"; + Text[ russian ] = ""; + Text[ polish ] = "Binarny"; + Text[ japanese ] = "(~B)"; + Text[ language_user1 ] = " "; + Text[ chinese_traditional ] = "G줸(~B)"; + Text[ arabic ] = ""; + Text[ dutch ] = "~Binair"; + Text[ chinese_simplified ] = "Ԫ(~B)"; + Text[ greek ] = ""; + Text[ korean ] = "̳ʸ(~B)"; + Text[ turkish ] = "kili"; + }; + RadioButton RB_ASCII + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 45 , 10 ) ; + Text = "~Text" ; + Text [ ENGLISH ] = "~text" ; + TabStop = TRUE ; + Text[ italian ] = "~Testo"; + Text[ portuguese_brazilian ] = "~Text"; + Text[ portuguese ] = "~Texto"; + Text[ danish ] = "~Tekst"; + Text[ french ] = "~Texte"; + Text[ swedish ] = "~Text"; + Text[ dutch ] = "~Tekst"; + Text[ spanish ] = "~Texto"; + Text[ english_us ] = "~Text"; + Text[ chinese_simplified ] = "(~T)"; + Text[ russian ] = ""; + Text[ polish ] = "Tekst"; + Text[ japanese ] = "÷(~T)"; + Text[ chinese_traditional ] = "r(~T)"; + Text[ arabic ] = ""; + Text[ dutch ] = "~Tekst"; + Text[ chinese_simplified ] = "(~T)"; + Text[ greek ] = ""; + Text[ korean ] = "ؽƮ(~T)"; + Text[ turkish ] = "Metin"; + Text[ language_user1 ] = " "; + }; + Text[ italian ] = "Opzioni PGM"; + Text[ portuguese_brazilian ] = "PGM Optionen"; + Text[ portuguese ] = "Opes PGM"; + Text[ danish ] = "PGM indstillinger"; + Text[ french ] = "Options PGM"; + Text[ swedish ] = "PGM alternativ"; + Text[ dutch ] = "PGM-opties"; + Text[ spanish ] = "Opciones PGM"; + Text[ chinese_simplified ] = "PGM ѡ"; + Text[ russian ] = " PGM"; + Text[ polish ] = "Opcje PGM"; + Text[ japanese ] = "PGM "; + Text[ chinese_traditional ] = "PGMﶵ"; + Text[ arabic ] = "PGM "; + Text[ dutch ] = "PGM-opties"; + Text[ chinese_simplified ] = "PGM ѡ"; + Text[ greek ] = " PGM"; + Text[ korean ] = "PGM ɼ"; + Text[ turkish ] = "PGM seenekleri"; + Text[ language_user1 ] = " "; +}; diff --git a/goodies/source/filter.vcl/epgm/epgm.cxx b/goodies/source/filter.vcl/epgm/epgm.cxx new file mode 100644 index 000000000000..44cd6b6b9b2c --- /dev/null +++ b/goodies/source/filter.vcl/epgm/epgm.cxx @@ -0,0 +1,339 @@ +/************************************************************************* + * + * $RCSfile: epgm.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <vcl/svapp.hxx> +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/config.hxx> +#include <vcl/msgbox.hxx> +#include <svtools/solar.hrc> +#include <svtools/fltcall.hxx> +#include "strings.hrc" +#include "dlgepgm.hrc" +#include "dlgepgm.hxx" + +//============================ PGMWriter ================================== + +class PGMWriter { + +private: + + PFilterCallback mpCallback; + void * mpCallerData; + + SvStream* mpOStm; // Die auszugebende PGM-Datei + USHORT mpOStmOldModus; + + BOOL mbStatus; + UINT32 mnMode; + BitmapReadAccess* mpAcc; + ULONG mnWidth, mnHeight; // Bildausmass in Pixeln + + BOOL ImplCallback( USHORT nPercent ); + BOOL ImplWriteHeader(); + void ImplWriteBody(); + void ImplWriteNumber( sal_Int32 ); + +public: + PGMWriter(); + ~PGMWriter(); + + BOOL WritePGM( const Graphic& rGraphic, SvStream& rPGM, + PFilterCallback pCallback, void* pCallerdata, + Config* pOptionsConfig ); +}; + +//=================== Methoden von PGMWriter ============================== + +PGMWriter::PGMWriter() : + mpAcc ( NULL ), + mbStatus ( TRUE ) +{ +} + +// ------------------------------------------------------------------------ + +PGMWriter::~PGMWriter() +{ +} + +// ------------------------------------------------------------------------ + +BOOL PGMWriter::ImplCallback( USHORT nPercent ) +{ + if ( mpCallback != NULL ) + { + if ( ( (*mpCallback)( mpCallerData, nPercent ) ) == TRUE ) + { + mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR ); + return TRUE; + } + } + return FALSE; +} + +// ------------------------------------------------------------------------ + +BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM, + PFilterCallback pCallback, void* pCallerdata, + Config* pOptionsConfig ) +{ + + mpOStm = &rPGM; + mpCallback = pCallback; + mpCallerData = pCallerdata; + + if ( pOptionsConfig ) + { + mnMode = pOptionsConfig->ReadKey( "PGM-EXPORT-FORMAT", "0" ).ToInt32(); + } + + 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 ); + + 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 ); + if ( ( nNumb = nDat / 100 ) ) + { + *mpOStm << (BYTE)( nNumb + '0' ); + nDat -= ( nNumb * 100 ); + nNumb = nDat / 10; + *mpOStm << (BYTE)( nNumb + '0' ); + nDat -= ( nNumb * 10 ); + *mpOStm << (BYTE)( nDat + '0' ); + nCount -= 4; + } + else if ( ( nNumb = nDat / 10 ) ) + { + *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_Int32 n = 0UL, nLen = aNum.Len(); n < nLen; n++ ) + *mpOStm << aNum.GetChar( n ); + +} + +// ------------------------------------------------------------------------ + +// --------------------- +// - exported function - +// --------------------- + +extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic, + PFilterCallback pCallback, void* pCallerData, + Config* pOptionsConfig, BOOL ) +{ + PGMWriter aPGMWriter; + + return aPGMWriter.WritePGM( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig ); +} + +// ------------------------------------------------------------------------ + +extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) +{ + BOOL bRet = FALSE; + + if ( rPara.pWindow && rPara.pCfg ) + { + ByteString aResMgrName( "epg" ); + ResMgr* pResMgr; + + aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) ); + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() ); + + if( pResMgr ) + { + rPara.pResMgr = pResMgr; + bRet = ( DlgExportEPGM( rPara ).Execute() == RET_OK ); + delete pResMgr; + } + else + bRet = TRUE; + } + + return bRet; +} + +// ------------------------------------------------------------------------ + +#pragma hdrstop + +// --------------- +// - 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 new file mode 100644 index 000000000000..921b45734449 --- /dev/null +++ b/goodies/source/filter.vcl/epgm/epgmstr.src @@ -0,0 +1,69 @@ +/************************************************************************* + * + * $RCSfile: epgmstr.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include "strings.hrc" + +// Key fuer den Dialog +String KEY_FORMAT +{ + Text = "PGM-EXPORT-FORMAT"; +}; diff --git a/goodies/source/filter.vcl/epgm/makefile.mk b/goodies/source/filter.vcl/epgm/makefile.mk new file mode 100644 index 000000000000..9fe3d54d5aae --- /dev/null +++ b/goodies/source/filter.vcl/epgm/makefile.mk @@ -0,0 +1,185 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=goodies +TARGET=epgm +TARGET2=epg +DEPTARGET=vepgm + +PROJECTPCH4DLL=TRUE +PROJECTPCH=eeng_pch +PROJECTPCHSOURCE=eeng_pch + + +# --- Settings ----------------------------------------------------------- + +.IF "$(VCL)" != "" + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Allgemein ---------------------------------------------------------- + +.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!="" +CDEFS+= -DEDITDEBUG +.ENDIF + +SRCFILES= dlgepgm.src \ + epgmstr.src + +SLOFILES = $(SLO)$/epgm.obj \ + $(SLO)$/dlgepgm.obj + +# ========================================================================== + +RESLIB1NAME=$(TARGET2) +RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs + +SHL1TARGET= epg$(UPD)$(DLLPOSTFIX) +SHL1IMPLIB= epgm +SHL1STDLIBS= $(TOOLSLIB) \ + $(SVLIB) \ + $(CPPULIB) \ + $(SVTOOLLIB) + +SHL1DEPN= $(LB)$/epgm.lib +SHL1LIBS= $(SLB)$/epgm.lib + +.IF "$(GUI)" != "UNX" +SHL1OBJS= $(SLO)$/epgm.obj +.ENDIF + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +SHL1BASE=0x1c000000 + +.IF "$(depend)" == "" + +all: ALLTAR + + + +.IF "$(GUI)" == "OS2" + +$(MISC)$/$(SHL1TARGET).def:\ + makefile.mk \ + $(MISC)$/$(SHL1TARGET).flt + @echo ------------------------------------------- + @echo DEF-File erstellen +.IF "$(COM)"!="WTC" + @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@ + @echo DESCRIPTION 'StarView Filter DLL' >>$@ +.IF "$(COM)" == "ZTC" + @echo STUB 'os2STUB.EXE' >>$@ +.ENDIF + @echo PROTMODE >>$@ + @echo CODE LOADONCALL >>$@ + @echo DATA PRELOAD MULTIPLE NONSHARED >>$@ + @echo EXPORTS >>$@ +.IF "$(COM)"=="ICC" + @echo GraphicExport >>$@ + @echo DoExportDialog >>$@ +.ELSE + @echo _GraphicExport >>$@ + @echo _DoExportDialog >>$@ +.ENDIF +.ELSE + @echo option DESCRIPTION 'StarView Filter DLL' >$@ + @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@ + @ldump -E1 -A $(SLB)$/epgm.lib >>temp.def + @gawk -f s:\util\exp.awk temp.def >>$@ + @del temp.def +.ENDIF +.ENDIF + +.IF "$(GUI)"=="WNT" + +$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt + @echo ------------------------------------------- + @echo DEF-File erstellen + @echo LIBRARY $(DLLNAME) >$@ + @echo DESCRIPTION 'Svx RTF DLL' >>$@ + @echo DATA READ WRITE NONSHARED >>$@ + @echo EXPORTS >>$@ + @echo GraphicExport >>$@ + @echo DoExportDialog >>$@ + +.ENDIF + +$(MISC)$/$(SHL1TARGET).flt: + @echo ------------------------------ + @echo Making: $@ + @echo WEP>$@ + @echo LIBMAIN>>$@ + @echo LibMain>>$@ + + +.ENDIF + +.INCLUDE : target.mk + +.ELSE +dummy: + @+echo No VCL - do nothing! +.ENDIF #VCL diff --git a/goodies/source/filter.vcl/epgm/strings.hrc b/goodies/source/filter.vcl/epgm/strings.hrc new file mode 100644 index 000000000000..5a1e869a47dc --- /dev/null +++ b/goodies/source/filter.vcl/epgm/strings.hrc @@ -0,0 +1,61 @@ +/************************************************************************* + * + * $RCSfile: strings.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define KEY_FORMAT 256 |