merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / eps / dlgeps.cxx
blob467bd3eb59cdf010818c465f9098c3372877e051
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgeps.cxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
33 #ifndef GCC
34 #endif
36 #include <tools/ref.hxx>
37 #include <vcl/msgbox.hxx>
38 #include <svtools/FilterConfigItem.hxx>
39 #include "dlgeps.hxx"
40 #include "dlgeps.hrc"
41 #include "strings.hrc"
43 /*************************************************************************
45 |* Ctor
47 \************************************************************************/
49 DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) :
50 ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, *rPara.pResMgr ) ),
51 rFltCallPara ( rPara ),
52 aGrpPreview ( this, ResId( GRP_PREVIEW, *rPara.pResMgr ) ),
53 aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF, *rPara.pResMgr ) ),
54 aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI, *rPara.pResMgr ) ),
55 aGrpVersion ( this, ResId( GRP_VERSION, *rPara.pResMgr ) ),
56 aRBLevel1 ( this, ResId( RB_LEVEL1, *rPara.pResMgr ) ),
57 aRBLevel2 ( this, ResId( RB_LEVEL2, *rPara.pResMgr ) ),
58 aGrpColor ( this, ResId( GRP_COLOR, *rPara.pResMgr ) ),
59 aRBColor ( this, ResId( RB_COLOR, *rPara.pResMgr ) ),
60 aRBGrayscale ( this, ResId( RB_GRAYSCALE, *rPara.pResMgr ) ),
61 aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ),
62 aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW, *rPara.pResMgr ) ),
63 aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE, *rPara.pResMgr ) ),
64 aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
65 aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
66 aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ),
67 pMgr ( rPara.pResMgr )
69 FreeResource();
71 String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/EPS" ) );
72 pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
74 // Config-Parameter lesen
75 String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
76 String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
77 String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
78 String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
79 String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) );
81 sal_Int32 nPreview = pConfigItem->ReadInt32( sPreview, 0 );
82 sal_Int32 nVersion = pConfigItem->ReadInt32( sVersion, 2 );
83 sal_Int32 nColor = pConfigItem->ReadInt32( sColorFormat, 0 );
84 sal_Int32 nCompr = pConfigItem->ReadInt32( sCompressionMode, 2 );
86 /* SJ: The following line is not superfluous, reading the item will also #106652#
87 create the corresponding FilterData Property. Since all filter
88 are no longer accessing the configuration itself, we have fill the
89 FilterData sequence with all available configuration items */
90 pConfigItem->ReadInt32( sTextMode, 0 );
92 BOOL bCheck = FALSE;
93 if ( nPreview & 1 )
94 bCheck = TRUE;
95 aCBPreviewTiff.Check( bCheck );
96 if ( nPreview & 2 )
97 bCheck = TRUE;
98 aCBPreviewEPSI.Check( bCheck );
100 bCheck = FALSE;
101 if ( nVersion == 1 )
102 bCheck ^= TRUE;
103 aRBLevel1.Check( bCheck );
104 bCheck ^= TRUE;
105 aRBLevel2.Check( bCheck );
107 bCheck = FALSE;
108 if ( nColor == 1 )
109 bCheck ^= TRUE;
110 aRBColor.Check( bCheck );
111 bCheck ^= TRUE;
112 aRBGrayscale.Check( bCheck );
114 bCheck = FALSE;
115 if ( nCompr == 1 )
116 bCheck ^= TRUE;
117 aRBCompressionLZW.Check( bCheck );
118 bCheck ^= TRUE;
119 aRBCompressionNone.Check( bCheck );
121 if ( aRBLevel1.IsChecked() )
123 aRBColor.Disable();
124 aRBGrayscale.Disable();
125 aRBCompressionNone.Disable();
126 aRBCompressionLZW.Disable();
127 aRBCompressionNone.Disable();
130 aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) );
131 aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) );
132 aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) );
135 DlgExportEPS::~DlgExportEPS()
137 delete pConfigItem;
140 /*************************************************************************
142 |* Speichert eingestellte Werte in ini-Datei
144 \************************************************************************/
146 IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG )
149 // Config-Parameter schreiben
150 sal_Int32 nCheck = 0;
151 if ( aCBPreviewTiff.IsChecked() )
152 nCheck++;
153 if ( aCBPreviewEPSI.IsChecked() )
154 nCheck += 2;
156 String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) );
157 pConfigItem->WriteInt32( sPreview, nCheck );
159 nCheck = 1;
160 if ( aRBLevel2.IsChecked() )
161 nCheck++;
162 String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) );
163 pConfigItem->WriteInt32( sVersion, nCheck );
165 nCheck = 1;
166 if ( aRBGrayscale.IsChecked() )
167 nCheck++;
168 String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) );
169 pConfigItem->WriteInt32( sColorFormat, nCheck );
171 nCheck = 1;
172 if ( aRBCompressionNone.IsChecked() )
173 nCheck++;
174 String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) );
175 pConfigItem->WriteInt32( sCompressionMode, nCheck );
177 rFltCallPara.aFilterData = pConfigItem->GetFilterData();
178 EndDialog( RET_OK );
180 return 0;
183 //------------------------------------------------------------------------
185 IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG )
187 if ( aRBLevel1.IsChecked() )
189 aRBColor.Disable();
190 aRBGrayscale.Disable();
191 aRBCompressionLZW.Disable();
192 aRBCompressionNone.Disable();
194 return 0;
197 //------------------------------------------------------------------------
199 IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG )
201 if ( aRBLevel2.IsChecked() )
203 aRBColor.Enable();
204 aRBGrayscale.Enable();
205 aRBCompressionLZW.Enable();
206 aRBCompressionNone.Enable();
208 return 0;