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: dlgsize.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_dbaccess.hxx"
33 #ifndef DBAUI_DLGSIZE_HRC
34 #include "dlgsize.hrc"
36 #ifndef _DBAUI_DLGSIZE_HXX
37 #include "dlgsize.hxx"
40 #include "dbu_dlg.hrc"
42 #ifndef _DBAUI_MODULE_DBU_HXX_
43 #include "moduledbu.hxx"
46 //.........................................................................
49 //.........................................................................
52 #define DEF_ROW_HEIGHT 45
53 #define DEF_COL_WIDTH 227
56 //==================================================================
57 DlgSize::DlgSize( Window
* pParent
, sal_Int32 nVal
, sal_Bool bRow
, sal_Int32 _nAlternativeStandard
)
58 :ModalDialog( pParent
, ModuleRes(bRow
? DLG_ROWHEIGHT
: DLG_COLWIDTH
))
60 ,m_nStandard(bRow
? DEF_ROW_HEIGHT
: DEF_COL_WIDTH
)
61 ,aFT_VALUE(this, ModuleRes( FT_VALUE
))
62 ,aMF_VALUE(this, ModuleRes( MF_VALUE
))
63 ,aCB_STANDARD(this, ModuleRes(CB_STANDARD
))
64 ,aPB_OK(this, ModuleRes(PB_OK
))
65 ,aPB_CANCEL(this, ModuleRes(PB_CANCEL
))
66 ,aPB_HELP(this, ModuleRes(PB_HELP
))
68 DBG_CTOR(DlgSize
,NULL
);
70 if ( _nAlternativeStandard
> 0 )
71 m_nStandard
= _nAlternativeStandard
;
72 aCB_STANDARD
.SetClickHdl(LINK(this,DlgSize
,CbClickHdl
));
74 aMF_VALUE
.EnableEmptyFieldValue(sal_True
);
75 sal_Bool bDefault
= -1 == nVal
;
76 aCB_STANDARD
.Check(bDefault
);
79 SetValue(m_nStandard
);
80 m_nPrevValue
= m_nStandard
;
82 LINK(this,DlgSize
,CbClickHdl
).Call(&aCB_STANDARD
);
87 //------------------------------------------------------------------------------
91 DBG_DTOR(DlgSize
,NULL
);
94 //------------------------------------------------------------------------------
95 void DlgSize::SetValue( sal_Int32 nVal
)
97 aMF_VALUE
.SetValue(nVal
, FUNIT_CM
);
100 //------------------------------------------------------------------------------
101 sal_Int32
DlgSize::GetValue()
103 if (aCB_STANDARD
.IsChecked())
105 return (sal_Int32
)aMF_VALUE
.GetValue( FUNIT_CM
);
108 //------------------------------------------------------------------------------
109 IMPL_LINK( DlgSize
, CbClickHdl
, Button
*, pButton
)
112 if( pButton
== &aCB_STANDARD
)
114 aMF_VALUE
.Enable(!aCB_STANDARD
.IsChecked());
115 if (aCB_STANDARD
.IsChecked())
117 m_nPrevValue
= static_cast<sal_Int32
>(aMF_VALUE
.GetValue(FUNIT_CM
));
118 // don't use getValue as this will use aCB_STANDARD.to determine if we're standard
119 aMF_VALUE
.SetEmptyFieldValue();
123 SetValue( m_nPrevValue
);
128 // -----------------------------------------------------------------------------
129 //.........................................................................
131 //.........................................................................