Add Marathi autocorrect
[LibreOffice.git] / sw / source / ui / table / rowht.cxx
blob89506d1304a249e12da446aa1730968f2e778c11
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 <svtools/unitconv.hxx>
22 #include <fmtfsize.hxx>
23 #include <swtypes.hxx>
24 #include <rowht.hxx>
25 #include <wrtsh.hxx>
26 #include <wdocsh.hxx>
27 #include <view.hxx>
28 #include <swmodule.hxx>
29 #include <usrpref.hxx>
31 void SwTableHeightDlg::Apply()
33 SwTwips nHeight = static_cast< SwTwips >(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FieldUnit::TWIP)));
34 SwFormatFrameSize aSz(SwFrameSize::Fixed, 0, nHeight);
36 SwFrameSize eFrameSize = m_xAutoHeightCB->get_active() ? SwFrameSize::Minimum : SwFrameSize::Fixed;
37 if(eFrameSize != aSz.GetHeightSizeType())
39 aSz.SetHeightSizeType(eFrameSize);
41 m_rSh.SetRowHeight(aSz);
44 SwTableHeightDlg::SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS)
45 : GenericDialogController(pParent, u"modules/swriter/ui/rowheight.ui"_ustr, u"RowHeightDialog"_ustr)
46 , m_rSh(rS)
47 , m_xHeightEdit(m_xBuilder->weld_metric_spin_button(u"heightmf"_ustr, FieldUnit::CM))
48 , m_xAutoHeightCB(m_xBuilder->weld_check_button(u"fit"_ustr))
50 FieldUnit eFieldUnit = SwModule::get()->GetUsrPref( dynamic_cast< const SwWebDocShell*>(
51 m_rSh.GetView().GetDocShell() ) != nullptr )->GetMetric();
52 ::SetFieldUnit(*m_xHeightEdit, eFieldUnit);
54 m_xHeightEdit->set_min(MINLAY, FieldUnit::TWIP);
55 std::unique_ptr<SwFormatFrameSize> pSz = m_rSh.GetRowHeight();
56 if (pSz)
58 auto nHeight = pSz->GetHeight();
59 m_xAutoHeightCB->set_active(pSz->GetHeightSizeType() != SwFrameSize::Fixed);
60 m_xHeightEdit->set_value(m_xHeightEdit->normalize(nHeight), FieldUnit::TWIP);
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */