1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgeos2.cxx,v $
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"
35 #include <com/sun/star/awt/Size.hpp>
36 #include <vcl/msgbox.hxx>
37 #include <svtools/FilterConfigItem.hxx>
38 #include "dlgeos2.hxx"
39 #include "dlgeos2.hrc"
40 #include "strings.hrc"
42 /*************************************************************************
46 \************************************************************************/
48 DlgExportEMET::DlgExportEMET( FltCallDialogParameter
& rPara
) :
49 ModalDialog ( rPara
.pWindow
, ResId( DLG_EXPORT_EMET
, *rPara
.pResMgr
) ),
50 rFltCallPara ( rPara
),
51 aBtnOK ( this, ResId( BTN_OK
, *rPara
.pResMgr
) ),
52 aBtnCancel ( this, ResId( BTN_CANCEL
, *rPara
.pResMgr
) ),
53 aBtnHelp ( this, ResId( BTN_HELP
, *rPara
.pResMgr
) ),
54 aRbOriginal ( this, ResId( RB_ORIGINAL
, *rPara
.pResMgr
) ),
55 aRbSize ( this, ResId( RB_SIZE
, *rPara
.pResMgr
) ),
56 aGrpMode ( this, ResId( GRP_MODE
, *rPara
.pResMgr
) ),
57 aFtSizeX ( this, ResId( FT_SIZEX
, *rPara
.pResMgr
) ),
58 aMtfSizeX ( this, ResId( MTF_SIZEX
, *rPara
.pResMgr
) ),
59 aFtSizeY ( this, ResId( FT_SIZEY
, *rPara
.pResMgr
) ),
60 aMtfSizeY ( this, ResId( MTF_SIZEY
, *rPara
.pResMgr
) ),
61 aGrpSize ( this, ResId( GRP_SIZE
, *rPara
.pResMgr
) ),
62 pMgr ( rPara
.pResMgr
)
66 String
aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/MET" ) );
67 pConfigItem
= new FilterConfigItem( aFilterConfigPath
, &rPara
.aFilterData
);
69 aBtnOK
.SetClickHdl( LINK( this, DlgExportEMET
, OK
) );
70 aRbOriginal
.SetClickHdl( LINK( this, DlgExportEMET
, ClickRbOriginal
) );
71 aRbSize
.SetClickHdl( LINK( this, DlgExportEMET
, ClickRbSize
) );
73 // Config-Parameter lesen
74 sal_Int32 nMode
= pConfigItem
->ReadInt32( String( ResId( KEY_MODE
, *pMgr
) ), 0 );
75 ::com::sun::star::awt::Size
aDefault( 10000, 10000 );
76 ::com::sun::star::awt::Size aSize
;
77 aSize
= pConfigItem
->ReadSize( String( ResId( KEY_SIZE
, *pMgr
) ), aDefault
);
79 aMtfSizeX
.SetDefaultUnit( FUNIT_MM
);
80 aMtfSizeY
.SetDefaultUnit( FUNIT_MM
);
82 aMtfSizeX
.SetValue( aSize
.Width
);
83 aMtfSizeY
.SetValue( aSize
.Height
);
85 switch ( rPara
.eFieldUnit
)
89 // case FUNIT_PERCENT :
90 // case FUNIT_CUSTOM :
100 case FUNIT_100TH_MM
:
102 aMtfSizeX
.SetUnit( rPara
.eFieldUnit
);
103 aMtfSizeY
.SetUnit( rPara
.eFieldUnit
);
107 break; // multiple other value not handled -Wall
111 aRbSize
.Check( TRUE
);
116 aRbOriginal
.Check( TRUE
);
117 ClickRbOriginal( NULL
);
121 DlgExportEMET::~DlgExportEMET()
126 /*************************************************************************
128 |* Speichert eingestellte Werte in ini-Datei
130 \************************************************************************/
132 IMPL_LINK( DlgExportEMET
, OK
, void *, EMPTYARG
)
134 // Config-Parameter schreiben
135 ::com::sun::star::awt::Size
aSize(
136 (sal_Int32
)MetricField::ConvertDoubleValue( aMtfSizeX
.GetValue(), 2, aMtfSizeX
.GetUnit(), MAP_100TH_MM
),
137 (sal_Int32
)MetricField::ConvertDoubleValue( aMtfSizeY
.GetValue(), 2, aMtfSizeY
.GetUnit(), MAP_100TH_MM
) );
138 sal_Int32 nStrMode
= ( aRbSize
.IsChecked() ) ? 1 : 0;
140 pConfigItem
->WriteInt32( String( ResId( KEY_MODE
, *pMgr
) ), nStrMode
);
141 pConfigItem
->WriteSize( String( ResId( KEY_SIZE
, *pMgr
) ), aSize
);
142 rFltCallPara
.aFilterData
= pConfigItem
->GetFilterData();
148 /*************************************************************************
150 |* Enabled/Disabled Controls
152 \************************************************************************/
154 IMPL_LINK( DlgExportEMET
, ClickRbOriginal
, void*, EMPTYARG
)
166 /*************************************************************************
168 |* Enabled/Disabled Controls
170 \************************************************************************/
172 IMPL_LINK( DlgExportEMET
, ClickRbSize
, void*, EMPTYARG
)