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