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 <table.hrc>
38 :
39 0 : void SwTableHeightDlg::Apply()
40 : {
41 0 : SwTwips nHeight = static_cast< SwTwips >(m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FUNIT_TWIP)));
42 0 : SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
43 :
44 0 : SwFrmSize eFrmSize = (SwFrmSize) m_pAutoHeightCB->IsChecked() ?
45 0 : ATT_MIN_SIZE : ATT_FIX_SIZE;
46 0 : if(eFrmSize != aSz.GetHeightSizeType())
47 : {
48 0 : aSz.SetHeightSizeType(eFrmSize);
49 : }
50 0 : rSh.SetRowHeight( aSz );
51 0 : }
52 :
53 :
54 0 : SwTableHeightDlg::SwTableHeightDlg(Window *pParent, SwWrtShell &rS)
55 : : SvxStandardDialog(pParent, "RowHeightDialog", "modules/swriter/ui/rowheight.ui")
56 0 : , rSh( rS )
57 : {
58 0 : get(m_pHeightEdit, "heightmf");
59 0 : get(m_pAutoHeightCB, "fit");
60 :
61 0 : FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
62 0 : rSh.GetView().GetDocShell() ) )->GetMetric();
63 0 : ::SetFieldUnit(*m_pHeightEdit, eFieldUnit);
64 :
65 0 : m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP);
66 0 : if(!m_pHeightEdit->GetMin())
67 0 : m_pHeightEdit->SetMin(1);
68 : SwFmtFrmSize *pSz;
69 0 : rSh.GetRowHeight( pSz );
70 0 : if ( pSz )
71 : {
72 0 : long nHeight = pSz->GetHeight();
73 0 : m_pAutoHeightCB->Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
74 0 : m_pHeightEdit->SetValue(m_pHeightEdit->Normalize(nHeight), FUNIT_TWIP);
75 :
76 0 : delete pSz;
77 : }
78 0 : }
79 :
80 :
81 :
82 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|