update dev300-m58
[ooovba.git] / svtools / source / filter.vcl / filter / dlgejpg.cxx
blob8c972afd4297dd29d1a698152e65ab7684937984
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: dlgejpg.cxx,v $
10 * $Revision: 1.11 $
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_svtools.hxx"
33 #include "dlgejpg.hxx"
34 #include "dlgejpg.hrc"
35 #include "strings.hrc"
36 #include <svtools/FilterConfigItem.hxx>
38 #define KEY_QUALITY "Quality"
39 #define KEY_GRAYSCALES "ColorMode"
41 /*************************************************************************
43 |* Ctor
45 \************************************************************************/
47 DlgExportEJPG::DlgExportEJPG( FltCallDialogParameter& rPara ) :
48 ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_JPG, *rPara.pResMgr ) ),
49 rFltCallPara ( rPara ),
50 aFiDescr ( this, ResId( FI_DESCR, *rPara.pResMgr ) ),
51 aNumFldQuality ( this, ResId( NUM_FLD_QUALITY, *rPara.pResMgr ) ),
52 aGrpQuality ( this, ResId( GRP_QUALITY, *rPara.pResMgr ) ),
53 aRbGray ( this, ResId( RB_GRAY, *rPara.pResMgr ) ),
54 aRbRGB ( this, ResId( RB_RGB, *rPara.pResMgr ) ),
55 aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ),
56 aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ),
57 aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ),
58 aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) )
60 FreeResource();
61 String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) );
62 pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData );
64 // reading filter options
65 sal_Int32 nQuality = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 );
66 sal_Int32 nColorMode = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), 0 );
67 aNumFldQuality.SetValue( nQuality );
69 if ( nColorMode )
70 aRbGray.Check( sal_True );
71 else
72 aRbRGB.Check( sal_True );
74 aBtnOK.SetClickHdl( LINK( this, DlgExportEJPG, OK ) );
78 /*************************************************************************
80 |* Speichert eingestellte Werte in ini-Datei
82 \************************************************************************/
84 IMPL_LINK( DlgExportEJPG, OK, void *, EMPTYARG )
86 // Config-Parameter schreiben
87 pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), (sal_Int32)aNumFldQuality.GetValue() );
88 pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), aRbGray.IsChecked() ? 1 : 0 );
89 rFltCallPara.aFilterData = pConfigItem->GetFilterData();
90 EndDialog( RET_OK );
91 return 0;
94 DlgExportEJPG::~DlgExportEJPG()
96 delete pConfigItem;