merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / filter / source / graphicfilter / eps / dlgeps.cxx
bloba2ddc39f8d2faf1020af4df121ed385d12638deb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_filter.hxx"
32 #include <tools/ref.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <svtools/FilterConfigItem.hxx>
35 #include "dlgeps.hxx"
36 #include "dlgeps.hrc"
37 #include "strings.hrc"
39 /*************************************************************************
41 |* Ctor
43 \************************************************************************/
45 DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) :
46 ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, *rPara.pResMgr ) ),
47 rFltCallPara ( rPara ),
48 aGrpPreview ( this, ResId( GRP_PREVIEW, *rPara.pResMgr ) ),
49 aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF, *rPara.pResMgr ) ),
50 aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI, *rPara.pResMgr ) ),
51 aGrpVersion ( this, ResId( GRP_VERSION, *rPara.pResMgr ) ),
52 aRBLevel1 ( this, ResId( RB_LEVEL1, *rPara.pResMgr ) ),
53 aRBLevel2 ( this, ResId( RB_LEVEL2, *rPara.pResMgr ) ),
54 aGrpColor ( this, ResId( GRP_COLOR, *rPara.pResMgr ) ),
55 aRBColor ( this, ResId( RB_COLOR, *rPara.pResMgr ) ),
56 aRBGrayscale ( this, ResId( RB_GRAYSCALE, *rPara.pResMgr ) ),
57 aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ),
58 aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW, *rPara.pResMgr ) ),
59 aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE, *rPara.pResMgr ) ),
60 aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
61 aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
62 aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
63 pMgr ( rPara.pResMgr )
65 FreeResource();
67 String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/EPS" ) );
68 pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
70 // Config-Parameter lesen
71 String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
72 String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
73 String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
74 String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
75 String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) );
77 sal_Int32 nPreview = pConfigItem->ReadInt32( sPreview, 0 );
78 sal_Int32 nVersion = pConfigItem->ReadInt32( sVersion, 2 );
79 sal_Int32 nColor = pConfigItem->ReadInt32( sColorFormat, 0 );
80 sal_Int32 nCompr = pConfigItem->ReadInt32( sCompressionMode, 2 );
82 /* SJ: The following line is not superfluous, reading the item will also #106652#
83 create the corresponding FilterData Property. Since all filter
84 are no longer accessing the configuration itself, we have fill the
85 FilterData sequence with all available configuration items */
86 pConfigItem->ReadInt32( sTextMode, 0 );
88 BOOL bCheck = FALSE;
89 if ( nPreview & 1 )
90 bCheck = TRUE;
91 aCBPreviewTiff.Check( bCheck );
92 if ( nPreview & 2 )
93 bCheck = TRUE;
94 aCBPreviewEPSI.Check( bCheck );
96 bCheck = FALSE;
97 if ( nVersion == 1 )
98 bCheck ^= TRUE;
99 aRBLevel1.Check( bCheck );
100 bCheck ^= TRUE;
101 aRBLevel2.Check( bCheck );
103 bCheck = FALSE;
104 if ( nColor == 1 )
105 bCheck ^= TRUE;
106 aRBColor.Check( bCheck );
107 bCheck ^= TRUE;
108 aRBGrayscale.Check( bCheck );
110 bCheck = FALSE;
111 if ( nCompr == 1 )
112 bCheck ^= TRUE;
113 aRBCompressionLZW.Check( bCheck );
114 bCheck ^= TRUE;
115 aRBCompressionNone.Check( bCheck );
117 if ( aRBLevel1.IsChecked() )
119 aRBColor.Disable();
120 aRBGrayscale.Disable();
121 aRBCompressionNone.Disable();
122 aRBCompressionLZW.Disable();
123 aRBCompressionNone.Disable();
126 aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) );
127 aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) );
128 aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) );
131 DlgExportEPS::~DlgExportEPS()
133 delete pConfigItem;
136 /*************************************************************************
138 |* Speichert eingestellte Werte in ini-Datei
140 \************************************************************************/
142 IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG )
145 // Config-Parameter schreiben
146 sal_Int32 nCheck = 0;
147 if ( aCBPreviewTiff.IsChecked() )
148 nCheck++;
149 if ( aCBPreviewEPSI.IsChecked() )
150 nCheck += 2;
152 String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
153 pConfigItem->WriteInt32( sPreview, nCheck );
155 nCheck = 1;
156 if ( aRBLevel2.IsChecked() )
157 nCheck++;
158 String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
159 pConfigItem->WriteInt32( sVersion, nCheck );
161 nCheck = 1;
162 if ( aRBGrayscale.IsChecked() )
163 nCheck++;
164 String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
165 pConfigItem->WriteInt32( sColorFormat, nCheck );
167 nCheck = 1;
168 if ( aRBCompressionNone.IsChecked() )
169 nCheck++;
170 String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
171 pConfigItem->WriteInt32( sCompressionMode, nCheck );
173 rFltCallPara.aFilterData = pConfigItem->GetFilterData();
174 EndDialog( RET_OK );
176 return 0;
179 //------------------------------------------------------------------------
181 IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG )
183 if ( aRBLevel1.IsChecked() )
185 aRBColor.Disable();
186 aRBGrayscale.Disable();
187 aRBCompressionLZW.Disable();
188 aRBCompressionNone.Disable();
190 return 0;
193 //------------------------------------------------------------------------
195 IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG )
197 if ( aRBLevel2.IsChecked() )
199 aRBColor.Enable();
200 aRBGrayscale.Enable();
201 aRBCompressionLZW.Enable();
202 aRBCompressionNone.Enable();
204 return 0;
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */