1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19*efeef26fSAndrew Rist *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <svl/intitem.hxx>
33cdf0e10cSrcweir #include <svl/eitem.hxx>
34cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
35cdf0e10cSrcweir #include <svx/dlgutil.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include <fmtfsize.hxx>
39cdf0e10cSrcweir #include <swtypes.hxx>
40cdf0e10cSrcweir #include <rowht.hxx>
41cdf0e10cSrcweir #include <wrtsh.hxx>
42cdf0e10cSrcweir #include <frmatr.hxx>
43cdf0e10cSrcweir #ifndef _WDOCSH_HXX
44cdf0e10cSrcweir #include <wdocsh.hxx>
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir #ifndef _VIEW_HXX
47cdf0e10cSrcweir #include <view.hxx>
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #include <swmodule.hxx>
50cdf0e10cSrcweir #include <usrpref.hxx>
51cdf0e10cSrcweir
52cdf0e10cSrcweir #ifndef _CMDID_H
53cdf0e10cSrcweir #include <cmdid.h>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #ifndef _ROWHT_HRC
56cdf0e10cSrcweir #include <rowht.hrc>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #ifndef _TABLE_HRC
59cdf0e10cSrcweir #include <table.hrc>
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir
62cdf0e10cSrcweir
63cdf0e10cSrcweir
64cdf0e10cSrcweir
Apply()65cdf0e10cSrcweir void SwTableHeightDlg::Apply()
66cdf0e10cSrcweir {
67cdf0e10cSrcweir SwTwips nHeight = static_cast< SwTwips >(aHeightEdit.Denormalize(aHeightEdit.GetValue(FUNIT_TWIP)));
68cdf0e10cSrcweir SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
69cdf0e10cSrcweir
70cdf0e10cSrcweir SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked() ?
71cdf0e10cSrcweir ATT_MIN_SIZE : ATT_FIX_SIZE;
72cdf0e10cSrcweir if(eFrmSize != aSz.GetHeightSizeType())
73cdf0e10cSrcweir {
74cdf0e10cSrcweir aSz.SetHeightSizeType(eFrmSize);
75cdf0e10cSrcweir }
76cdf0e10cSrcweir rSh.SetRowHeight( aSz );
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
79cdf0e10cSrcweir // CTOR / DTOR -----------------------------------------------------------
80cdf0e10cSrcweir
81cdf0e10cSrcweir
SwTableHeightDlg(Window * pParent,SwWrtShell & rS)82cdf0e10cSrcweir SwTableHeightDlg::SwTableHeightDlg( Window *pParent, SwWrtShell &rS ) :
83cdf0e10cSrcweir
84cdf0e10cSrcweir SvxStandardDialog(pParent, SW_RES(DLG_ROW_HEIGHT)),
85cdf0e10cSrcweir aHeightFL(this, SW_RES(FL_HEIGHT)),
86cdf0e10cSrcweir
87cdf0e10cSrcweir aHeightEdit(this, SW_RES(ED_HEIGHT)),
88cdf0e10cSrcweir aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT)),
89cdf0e10cSrcweir aOKBtn(this, SW_RES(BT_OK)),
90cdf0e10cSrcweir aCancelBtn(this, SW_RES(BT_CANCEL)),
91cdf0e10cSrcweir aHelpBtn( this, SW_RES( BT_HELP ) ),
92cdf0e10cSrcweir rSh( rS )
93cdf0e10cSrcweir {
94cdf0e10cSrcweir FreeResource();
95cdf0e10cSrcweir
96cdf0e10cSrcweir FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
97cdf0e10cSrcweir rSh.GetView().GetDocShell() ) )->GetMetric();
98cdf0e10cSrcweir ::SetFieldUnit( aHeightEdit, eFieldUnit );
99cdf0e10cSrcweir
100cdf0e10cSrcweir aHeightEdit.SetMin(MINLAY, FUNIT_TWIP);
101cdf0e10cSrcweir if(!aHeightEdit.GetMin())
102cdf0e10cSrcweir aHeightEdit.SetMin(1);
103cdf0e10cSrcweir SwFmtFrmSize *pSz;
104cdf0e10cSrcweir rSh.GetRowHeight( pSz );
105cdf0e10cSrcweir if ( pSz )
106cdf0e10cSrcweir {
107cdf0e10cSrcweir long nHeight = pSz->GetHeight();
108cdf0e10cSrcweir aAutoHeightCB.Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
109cdf0e10cSrcweir aHeightEdit.SetValue(aHeightEdit.Normalize(nHeight), FUNIT_TWIP);
110cdf0e10cSrcweir
111cdf0e10cSrcweir delete pSz;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir
116cdf0e10cSrcweir
117