Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <svl/intitem.hxx>
21 : #include <svl/eitem.hxx>
22 : #include <sfx2/dispatch.hxx>
23 : #include <svx/dlgutil.hxx>
24 :
25 :
26 : #include <fmtfsize.hxx>
27 : #include <swtypes.hxx>
28 : #include <rowht.hxx>
29 : #include <wrtsh.hxx>
30 : #include <frmatr.hxx>
31 : #include <wdocsh.hxx>
32 : #include <view.hxx>
33 : #include <swmodule.hxx>
34 : #include <usrpref.hxx>
35 :
36 : #include <cmdid.h>
37 : #include <rowht.hrc>
38 : #include <table.hrc>
39 :
40 :
41 :
42 :
43 0 : void SwTableHeightDlg::Apply()
44 : {
45 0 : SwTwips nHeight = static_cast< SwTwips >(aHeightEdit.Denormalize(aHeightEdit.GetValue(FUNIT_TWIP)));
46 0 : SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
47 :
48 0 : SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked() ?
49 0 : ATT_MIN_SIZE : ATT_FIX_SIZE;
50 0 : if(eFrmSize != aSz.GetHeightSizeType())
51 : {
52 0 : aSz.SetHeightSizeType(eFrmSize);
53 : }
54 0 : rSh.SetRowHeight( aSz );
55 0 : }
56 :
57 : // CTOR / DTOR -----------------------------------------------------------
58 :
59 :
60 0 : SwTableHeightDlg::SwTableHeightDlg( Window *pParent, SwWrtShell &rS ) :
61 :
62 : SvxStandardDialog(pParent, SW_RES(DLG_ROW_HEIGHT)),
63 : aHeightFL(this, SW_RES(FL_HEIGHT)),
64 :
65 : aHeightEdit(this, SW_RES(ED_HEIGHT)),
66 : aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT)),
67 : aOKBtn(this, SW_RES(BT_OK)),
68 : aCancelBtn(this, SW_RES(BT_CANCEL)),
69 : aHelpBtn( this, SW_RES( BT_HELP ) ),
70 0 : rSh( rS )
71 : {
72 0 : FreeResource();
73 :
74 0 : FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
75 0 : rSh.GetView().GetDocShell() ) )->GetMetric();
76 0 : ::SetFieldUnit( aHeightEdit, eFieldUnit );
77 :
78 0 : aHeightEdit.SetMin(MINLAY, FUNIT_TWIP);
79 0 : if(!aHeightEdit.GetMin())
80 0 : aHeightEdit.SetMin(1);
81 : SwFmtFrmSize *pSz;
82 0 : rSh.GetRowHeight( pSz );
83 0 : if ( pSz )
84 : {
85 0 : long nHeight = pSz->GetHeight();
86 0 : aAutoHeightCB.Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
87 0 : aHeightEdit.SetValue(aHeightEdit.Normalize(nHeight), FUNIT_TWIP);
88 :
89 0 : delete pSz;
90 : }
91 0 : }
92 :
93 :
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|