bump product version to 6.4.0.3
[LibreOffice.git] / cui / source / dialogs / splitcelldlg.cxx
blob40b798b7c2c9a9a147d4e57f9926b28578851eca
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 <splitcelldlg.hxx>
22 SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal)
23 : GenericDialogController(pParent, "cui/ui/splitcellsdialog.ui", "SplitCellsDialog")
24 , m_xCountEdit(m_xBuilder->weld_spin_button("countnf"))
25 , m_xHorzBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("hori") : m_xBuilder->weld_radio_button("vert"))
26 , m_xVertBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("vert") : m_xBuilder->weld_radio_button("hori"))
27 , m_xPropCB(m_xBuilder->weld_check_button("prop"))
28 , mnMaxVertical(nMaxVertical)
29 , mnMaxHorizontal(nMaxHorizontal)
31 m_xHorzBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
32 m_xPropCB->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
33 m_xVertBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
35 if (mnMaxVertical < 2)
37 if (!bIsTableVertical)
38 m_xVertBox->set_sensitive(false);
39 else
40 m_xHorzBox->set_sensitive(false);
43 //exchange the meaning of horizontal and vertical for vertical text
44 if (bIsTableVertical)
46 int nHorzTopAttach = m_xHorzBox->get_grid_top_attach();
47 int nVertTopAttach = m_xVertBox->get_grid_top_attach();
48 m_xHorzBox->set_grid_top_attach(nVertTopAttach);
49 m_xVertBox->set_grid_top_attach(nHorzTopAttach);
50 m_xHorzBox->set_active(m_xVertBox->get_active());
54 IMPL_LINK(SvxSplitTableDlg, ClickHdl, weld::Button&, rButton, void)
56 const bool bIsVert = &rButton == m_xVertBox.get();
57 long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
58 m_xPropCB->set_sensitive(!bIsVert);
59 m_xCountEdit->set_max(nMax);
62 bool SvxSplitTableDlg::IsHorizontal() const
64 return m_xHorzBox->get_active();
67 bool SvxSplitTableDlg::IsProportional() const
69 return m_xPropCB->get_active() && m_xHorzBox->get_active();
72 long SvxSplitTableDlg::GetCount() const
74 return m_xCountEdit->get_value();
77 short SvxSplitTableDlg::Execute()
79 return run();
82 void SvxSplitTableDlg::SetSplitVerticalByDefault()
84 if( mnMaxVertical >= 2 )
85 m_xVertBox->set_active(true); // tdf#60242
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */