summaryrefslogtreecommitdiffstats
path: root/cui/source/tabpages/dstribut.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /cui/source/tabpages/dstribut.cxx
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--cui/source/tabpages/dstribut.cxx152
1 files changed, 152 insertions, 0 deletions
diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
new file mode 100644
index 000000000..e1653ca4d
--- /dev/null
+++ b/cui/source/tabpages/dstribut.cxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sfx2/basedlgs.hxx>
+#include <dstribut.hxx>
+
+/*************************************************************************
+|*
+|* Dialog
+|*
+\************************************************************************/
+
+SvxDistributeDialog::SvxDistributeDialog(weld::Window* pParent,
+ const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
+ SvxDistributeVertical eVer)
+ : SfxSingleTabDialogController(pParent, &rInAttrs, "cui/ui/distributiondialog.ui",
+ "DistributionDialog")
+{
+ SetTabPage(std::make_unique<SvxDistributePage>(get_content_area(), this, rInAttrs, eHor, eVer));
+ mpPage = static_cast<SvxDistributePage*>(GetTabPage());
+}
+
+SvxDistributeDialog::~SvxDistributeDialog()
+{
+}
+
+/*************************************************************************
+|*
+|* Tabpage
+|*
+\************************************************************************/
+
+SvxDistributePage::SvxDistributePage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs, SvxDistributeHorizontal eHor,
+ SvxDistributeVertical eVer)
+ : SfxTabPage(pPage, pController, "cui/ui/distributionpage.ui", "DistributionPage",
+ &rInAttrs)
+ , m_eDistributeHor(eHor)
+ , m_eDistributeVer(eVer)
+ , m_xBtnHorNone(m_xBuilder->weld_radio_button("hornone"))
+ , m_xBtnHorLeft(m_xBuilder->weld_radio_button("horleft"))
+ , m_xBtnHorCenter(m_xBuilder->weld_radio_button("horcenter"))
+ , m_xBtnHorDistance(m_xBuilder->weld_radio_button("hordistance"))
+ , m_xBtnHorRight(m_xBuilder->weld_radio_button("horright"))
+ , m_xBtnVerNone(m_xBuilder->weld_radio_button("vernone"))
+ , m_xBtnVerTop(m_xBuilder->weld_radio_button("vertop"))
+ , m_xBtnVerCenter(m_xBuilder->weld_radio_button("vercenter"))
+ , m_xBtnVerDistance(m_xBuilder->weld_radio_button("verdistance"))
+ , m_xBtnVerBottom(m_xBuilder->weld_radio_button("verbottom"))
+{
+}
+
+SvxDistributePage::~SvxDistributePage()
+{
+}
+
+/*************************************************************************
+|*
+|* read the delivered Item-Set
+|*
+\************************************************************************/
+
+void SvxDistributePage::Reset(const SfxItemSet* )
+{
+ m_xBtnHorNone->set_active(false);
+ m_xBtnHorLeft->set_active(false);
+ m_xBtnHorCenter->set_active(false);
+ m_xBtnHorDistance->set_active(false);
+ m_xBtnHorRight->set_active(false);
+
+ switch(m_eDistributeHor)
+ {
+ case SvxDistributeHorizontal::NONE : m_xBtnHorNone->set_active(true); break;
+ case SvxDistributeHorizontal::Left : m_xBtnHorLeft->set_active(true); break;
+ case SvxDistributeHorizontal::Center : m_xBtnHorCenter->set_active(true); break;
+ case SvxDistributeHorizontal::Distance : m_xBtnHorDistance->set_active(true); break;
+ case SvxDistributeHorizontal::Right : m_xBtnHorRight->set_active(true); break;
+ }
+
+ m_xBtnVerNone->set_active(false);
+ m_xBtnVerTop->set_active(false);
+ m_xBtnVerCenter->set_active(false);
+ m_xBtnVerDistance->set_active(false);
+ m_xBtnVerBottom->set_active(false);
+
+ switch(m_eDistributeVer)
+ {
+ case SvxDistributeVertical::NONE : m_xBtnVerNone->set_active(true); break;
+ case SvxDistributeVertical::Top : m_xBtnVerTop->set_active(true); break;
+ case SvxDistributeVertical::Center : m_xBtnVerCenter->set_active(true); break;
+ case SvxDistributeVertical::Distance : m_xBtnVerDistance->set_active(true); break;
+ case SvxDistributeVertical::Bottom : m_xBtnVerBottom->set_active(true); break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Fill the delivered Item-Set with dialogbox-attributes
+|*
+\************************************************************************/
+
+bool SvxDistributePage::FillItemSet( SfxItemSet* )
+{
+ SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontal::NONE);
+ SvxDistributeVertical eDistributeVer(SvxDistributeVertical::NONE);
+
+ if(m_xBtnHorLeft->get_active())
+ eDistributeHor = SvxDistributeHorizontal::Left;
+ else if(m_xBtnHorCenter->get_active())
+ eDistributeHor = SvxDistributeHorizontal::Center;
+ else if(m_xBtnHorDistance->get_active())
+ eDistributeHor = SvxDistributeHorizontal::Distance;
+ else if(m_xBtnHorRight->get_active())
+ eDistributeHor = SvxDistributeHorizontal::Right;
+
+ if(m_xBtnVerTop->get_active())
+ eDistributeVer = SvxDistributeVertical::Top;
+ else if(m_xBtnVerCenter->get_active())
+ eDistributeVer = SvxDistributeVertical::Center;
+ else if(m_xBtnVerDistance->get_active())
+ eDistributeVer = SvxDistributeVertical::Distance;
+ else if(m_xBtnVerBottom->get_active())
+ eDistributeVer = SvxDistributeVertical::Bottom;
+
+ if(eDistributeHor != m_eDistributeHor || eDistributeVer != m_eDistributeVer)
+ {
+ m_eDistributeHor = eDistributeHor;
+ m_eDistributeVer = eDistributeVer;
+ return true;
+ }
+
+ return false;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */