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