bump product version to 6.4.0.3
[LibreOffice.git] / cui / source / tabpages / dstribut.cxx
blobe1653ca4d65e8b62fdecafd02527d09a63734b39
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 <sfx2/basedlgs.hxx>
21 #include <dstribut.hxx>
23 /*************************************************************************
25 |* Dialog
27 \************************************************************************/
29 SvxDistributeDialog::SvxDistributeDialog(weld::Window* pParent,
30 const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
31 SvxDistributeVertical eVer)
32 : SfxSingleTabDialogController(pParent, &rInAttrs, "cui/ui/distributiondialog.ui",
33 "DistributionDialog")
35 SetTabPage(std::make_unique<SvxDistributePage>(get_content_area(), this, rInAttrs, eHor, eVer));
36 mpPage = static_cast<SvxDistributePage*>(GetTabPage());
39 SvxDistributeDialog::~SvxDistributeDialog()
43 /*************************************************************************
45 |* Tabpage
47 \************************************************************************/
49 SvxDistributePage::SvxDistributePage(weld::Container* pPage, weld::DialogController* pController,
50 const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
51 SvxDistributeVertical eVer)
52 : SfxTabPage(pPage, pController, "cui/ui/distributionpage.ui", "DistributionPage",
53 &rInAttrs)
54 , m_eDistributeHor(eHor)
55 , m_eDistributeVer(eVer)
56 , m_xBtnHorNone(m_xBuilder->weld_radio_button("hornone"))
57 , m_xBtnHorLeft(m_xBuilder->weld_radio_button("horleft"))
58 , m_xBtnHorCenter(m_xBuilder->weld_radio_button("horcenter"))
59 , m_xBtnHorDistance(m_xBuilder->weld_radio_button("hordistance"))
60 , m_xBtnHorRight(m_xBuilder->weld_radio_button("horright"))
61 , m_xBtnVerNone(m_xBuilder->weld_radio_button("vernone"))
62 , m_xBtnVerTop(m_xBuilder->weld_radio_button("vertop"))
63 , m_xBtnVerCenter(m_xBuilder->weld_radio_button("vercenter"))
64 , m_xBtnVerDistance(m_xBuilder->weld_radio_button("verdistance"))
65 , m_xBtnVerBottom(m_xBuilder->weld_radio_button("verbottom"))
69 SvxDistributePage::~SvxDistributePage()
73 /*************************************************************************
75 |* read the delivered Item-Set
77 \************************************************************************/
79 void SvxDistributePage::Reset(const SfxItemSet* )
81 m_xBtnHorNone->set_active(false);
82 m_xBtnHorLeft->set_active(false);
83 m_xBtnHorCenter->set_active(false);
84 m_xBtnHorDistance->set_active(false);
85 m_xBtnHorRight->set_active(false);
87 switch(m_eDistributeHor)
89 case SvxDistributeHorizontal::NONE : m_xBtnHorNone->set_active(true); break;
90 case SvxDistributeHorizontal::Left : m_xBtnHorLeft->set_active(true); break;
91 case SvxDistributeHorizontal::Center : m_xBtnHorCenter->set_active(true); break;
92 case SvxDistributeHorizontal::Distance : m_xBtnHorDistance->set_active(true); break;
93 case SvxDistributeHorizontal::Right : m_xBtnHorRight->set_active(true); break;
96 m_xBtnVerNone->set_active(false);
97 m_xBtnVerTop->set_active(false);
98 m_xBtnVerCenter->set_active(false);
99 m_xBtnVerDistance->set_active(false);
100 m_xBtnVerBottom->set_active(false);
102 switch(m_eDistributeVer)
104 case SvxDistributeVertical::NONE : m_xBtnVerNone->set_active(true); break;
105 case SvxDistributeVertical::Top : m_xBtnVerTop->set_active(true); break;
106 case SvxDistributeVertical::Center : m_xBtnVerCenter->set_active(true); break;
107 case SvxDistributeVertical::Distance : m_xBtnVerDistance->set_active(true); break;
108 case SvxDistributeVertical::Bottom : m_xBtnVerBottom->set_active(true); break;
112 /*************************************************************************
114 |* Fill the delivered Item-Set with dialogbox-attributes
116 \************************************************************************/
118 bool SvxDistributePage::FillItemSet( SfxItemSet* )
120 SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontal::NONE);
121 SvxDistributeVertical eDistributeVer(SvxDistributeVertical::NONE);
123 if(m_xBtnHorLeft->get_active())
124 eDistributeHor = SvxDistributeHorizontal::Left;
125 else if(m_xBtnHorCenter->get_active())
126 eDistributeHor = SvxDistributeHorizontal::Center;
127 else if(m_xBtnHorDistance->get_active())
128 eDistributeHor = SvxDistributeHorizontal::Distance;
129 else if(m_xBtnHorRight->get_active())
130 eDistributeHor = SvxDistributeHorizontal::Right;
132 if(m_xBtnVerTop->get_active())
133 eDistributeVer = SvxDistributeVertical::Top;
134 else if(m_xBtnVerCenter->get_active())
135 eDistributeVer = SvxDistributeVertical::Center;
136 else if(m_xBtnVerDistance->get_active())
137 eDistributeVer = SvxDistributeVertical::Distance;
138 else if(m_xBtnVerBottom->get_active())
139 eDistributeVer = SvxDistributeVertical::Bottom;
141 if(eDistributeHor != m_eDistributeHor || eDistributeVer != m_eDistributeVer)
143 m_eDistributeHor = eDistributeHor;
144 m_eDistributeVer = eDistributeVer;
145 return true;
148 return false;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */