bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / table / rowht.cxx
blob9fec8f0bea1dd9cefdb6b5ff0ed884440f7d6d16
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svl/intitem.hxx>
21 #include <svl/eitem.hxx>
22 #include <sfx2/dispatch.hxx>
23 #include <svx/dlgutil.hxx>
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>
36 #include <cmdid.h>
37 #include <table.hrc>
39 void SwTableHeightDlg::Apply()
41 SwTwips nHeight = static_cast< SwTwips >(m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FUNIT_TWIP)));
42 SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
44 SwFrmSize eFrmSize = (SwFrmSize) m_pAutoHeightCB->IsChecked() ?
45 ATT_MIN_SIZE : ATT_FIX_SIZE;
46 if(eFrmSize != aSz.GetHeightSizeType())
48 aSz.SetHeightSizeType(eFrmSize);
50 rSh.SetRowHeight( aSz );
54 SwTableHeightDlg::SwTableHeightDlg(Window *pParent, SwWrtShell &rS)
55 : SvxStandardDialog(pParent, "RowHeightDialog", "modules/swriter/ui/rowheight.ui")
56 , rSh( rS )
58 get(m_pHeightEdit, "heightmf");
59 get(m_pAutoHeightCB, "fit");
61 FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
62 rSh.GetView().GetDocShell() ) )->GetMetric();
63 ::SetFieldUnit(*m_pHeightEdit, eFieldUnit);
65 m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP);
66 if(!m_pHeightEdit->GetMin())
67 m_pHeightEdit->SetMin(1);
68 SwFmtFrmSize *pSz;
69 rSh.GetRowHeight( pSz );
70 if ( pSz )
72 long nHeight = pSz->GetHeight();
73 m_pAutoHeightCB->Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
74 m_pHeightEdit->SetValue(m_pHeightEdit->Normalize(nHeight), FUNIT_TWIP);
76 delete pSz;
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */