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: rowht.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_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
39 #include <svtools/intitem.hxx>
40 #include <svtools/eitem.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <svx/dlgutil.hxx>
45 #include <fmtfsize.hxx>
46 #include <swtypes.hxx>
56 #include <swmodule.hxx>
57 #include <usrpref.hxx>
72 void SwTableHeightDlg::Apply()
74 SwTwips nHeight
= static_cast< SwTwips
>(aHeightEdit
.Denormalize(aHeightEdit
.GetValue(FUNIT_TWIP
)));
75 SwFmtFrmSize
aSz(ATT_FIX_SIZE
, 0, nHeight
);
77 SwFrmSize eFrmSize
= (SwFrmSize
) aAutoHeightCB
.IsChecked() ?
78 ATT_MIN_SIZE
: ATT_FIX_SIZE
;
79 if(eFrmSize
!= aSz
.GetHeightSizeType())
81 aSz
.SetHeightSizeType(eFrmSize
);
83 rSh
.SetRowHeight( aSz
);
86 // CTOR / DTOR -----------------------------------------------------------
89 SwTableHeightDlg::SwTableHeightDlg( Window
*pParent
, SwWrtShell
&rS
) :
91 SvxStandardDialog(pParent
, SW_RES(DLG_ROW_HEIGHT
)),
93 aHeightEdit(this, SW_RES(ED_HEIGHT
)),
94 aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT
)),
95 aHeightFL(this, SW_RES(FL_HEIGHT
)),
96 aOKBtn(this, SW_RES(BT_OK
)),
97 aCancelBtn(this, SW_RES(BT_CANCEL
)),
98 aHelpBtn( this, SW_RES( BT_HELP
) ),
103 FieldUnit eFieldUnit
= SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell
,
104 rSh
.GetView().GetDocShell() ) )->GetMetric();
105 ::SetFieldUnit( aHeightEdit
, eFieldUnit
);
107 aHeightEdit
.SetMin(MINLAY
, FUNIT_TWIP
);
108 if(!aHeightEdit
.GetMin())
109 aHeightEdit
.SetMin(1);
111 rSh
.GetRowHeight( pSz
);
114 long nHeight
= pSz
->GetHeight();
115 aAutoHeightCB
.Check(pSz
->GetHeightSizeType() != ATT_FIX_SIZE
);
116 aHeightEdit
.SetValue(aHeightEdit
.Normalize(nHeight
), FUNIT_TWIP
);