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: dlgepct.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"
36 #include <vcl/msgbox.hxx>
37 #include <svtools/FilterConfigItem.hxx>
38 #include <com/sun/star/awt/Size.hpp>
39 #include "dlgepct.hxx"
40 #include "dlgepct.hrc"
41 #include "strings.hrc"
43 /*************************************************************************
47 \************************************************************************/
49 DlgExportEPCT::DlgExportEPCT( FltCallDialogParameter
& rPara
) :
50 ModalDialog ( rPara
.pWindow
, ResId( DLG_EXPORT_EPCT
, *rPara
.pResMgr
) ),
51 rFltCallPara ( rPara
),
52 aBtnOK ( this, ResId( BTN_OK
, *rPara
.pResMgr
) ),
53 aBtnCancel ( this, ResId( BTN_CANCEL
, *rPara
.pResMgr
) ),
54 aBtnHelp ( this, ResId( BTN_HELP
, *rPara
.pResMgr
) ),
55 aRbOriginal ( this, ResId( RB_ORIGINAL
, *rPara
.pResMgr
) ),
56 aRbSize ( this, ResId( RB_SIZE
, *rPara
.pResMgr
) ),
57 aGrpMode ( this, ResId( GRP_MODE
, *rPara
.pResMgr
) ),
58 aFtSizeX ( this, ResId( FT_SIZEX
, *rPara
.pResMgr
) ),
59 aMtfSizeX ( this, ResId( MTF_SIZEX
, *rPara
.pResMgr
) ),
60 aFtSizeY ( this, ResId( FT_SIZEY
, *rPara
.pResMgr
) ),
61 aMtfSizeY ( this, ResId( MTF_SIZEY
, *rPara
.pResMgr
) ),
62 aGrpSize ( this, ResId( GRP_SIZE
, *rPara
.pResMgr
) ),
63 pMgr ( rPara
.pResMgr
)
67 String
aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PCT" ) );
68 pConfigItem
= new FilterConfigItem( aFilterConfigPath
, &rPara
.aFilterData
);
70 aBtnOK
.SetClickHdl( LINK( this, DlgExportEPCT
, OK
) );
71 aRbOriginal
.SetClickHdl( LINK( this, DlgExportEPCT
, ClickRbOriginal
) );
72 aRbSize
.SetClickHdl( LINK( this, DlgExportEPCT
, ClickRbSize
) );
74 // Config-Parameter lesen
75 sal_Int32 nStrMode
= pConfigItem
->ReadInt32( String( ResId( KEY_MODE
, *pMgr
) ), 0 );
76 ::com::sun::star::awt::Size
aDefault( 10000, 10000 );
77 ::com::sun::star::awt::Size aSize
;
78 aSize
= pConfigItem
->ReadSize( String( ResId( KEY_SIZE
, *pMgr
) ), aDefault
);
80 aMtfSizeX
.SetDefaultUnit( FUNIT_MM
);
81 aMtfSizeY
.SetDefaultUnit( FUNIT_MM
);
82 aMtfSizeX
.SetValue( aSize
.Width
);
83 aMtfSizeY
.SetValue( aSize
.Height
);
85 switch ( rPara
.eFieldUnit
)
94 break; // -Wall not handled.
101 case FUNIT_100TH_MM
:
103 aMtfSizeX
.SetUnit( rPara
.eFieldUnit
);
104 aMtfSizeY
.SetUnit( rPara
.eFieldUnit
);
110 aRbSize
.Check( TRUE
);
115 aRbOriginal
.Check( TRUE
);
116 ClickRbOriginal( NULL
);
120 DlgExportEPCT::~DlgExportEPCT()
125 /*************************************************************************
127 |* Speichert eingestellte Werte in ini-Datei
129 \**************************************** ********************************/
131 IMPL_LINK( DlgExportEPCT
, OK
, void *, EMPTYARG
)
133 // Config-Parameter schreiben
134 ::com::sun::star::awt::Size
aSize(
135 (sal_Int32
)MetricField::ConvertDoubleValue( aMtfSizeX
.GetValue(), 2, aMtfSizeX
.GetUnit(), MAP_100TH_MM
),
136 (sal_Int32
)MetricField::ConvertDoubleValue( aMtfSizeY
.GetValue(), 2, aMtfSizeY
.GetUnit(), MAP_100TH_MM
) );
138 sal_Int32 nStrMode
= 0;
139 if ( aRbSize
.IsChecked() )
142 pConfigItem
->WriteInt32( String( ResId( KEY_MODE
, *pMgr
) ), nStrMode
);
143 pConfigItem
->WriteSize( String( ResId( KEY_SIZE
, *pMgr
) ), aSize
);
144 rFltCallPara
.aFilterData
= pConfigItem
->GetFilterData();
150 /*************************************************************************
152 |* Enabled/Disabled Controls
154 \************************************************************************/
156 IMPL_LINK( DlgExportEPCT
, ClickRbOriginal
, void*, EMPTYARG
)
168 /*************************************************************************
170 |* Enabled/Disabled Controls
172 \************************************************************************/
174 IMPL_LINK( DlgExportEPCT
, ClickRbSize
, void*, EMPTYARG
)