summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-05-23 15:40:08 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-06-08 14:50:33 +0200
commitc4f615b359be56e88e4fbf9aaaf30affb29d57e2 (patch)
tree484f1caaf27bc3cefc0d1a7e0614342927117440 /cui/source
parent064a13e94e9b38bc88381b5c497cf6c9ddbe93e4 (diff)
editengine-columns: Create document model and dialog page
Change-Id: I056aad9474ca18134d1f1686a53618cc9ab3d525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116038 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/factory/dlgfact.cxx5
-rw-r--r--cui/source/inc/TextColumnsPage.hxx40
-rw-r--r--cui/source/tabpages/TextColumnsPage.cxx82
-rw-r--r--cui/source/tabpages/textanim.cxx2
4 files changed, 129 insertions, 0 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index ebfd9bfb0ea5..19b30518e426 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -91,6 +91,7 @@
#include <toolbarmodedlg.hxx>
#include <DiagramDialog.hxx>
#include <fileextcheckdlg.hxx>
+#include <TextColumnsPage.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
@@ -1499,6 +1500,8 @@ CreateTabPage AbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nId
return SvxGrfCropPage::Create;
case RID_SVXPAGE_MACROASSIGN :
return SfxMacroTabPage::Create;
+ case RID_SVXPAGE_TEXTCOLUMNS:
+ return SvxTextColumnsPage::Create;
default:
break;
}
@@ -1562,6 +1565,8 @@ GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( sal_uInt16 nI
return SvxPageDescPage::GetRanges;
case RID_SVXPAGE_ASIAN_LAYOUT:
return SvxAsianLayoutPage::GetRanges;
+ case RID_SVXPAGE_TEXTCOLUMNS:
+ return SvxTextColumnsPage::GetRanges;
default:
break;
}
diff --git a/cui/source/inc/TextColumnsPage.hxx b/cui/source/inc/TextColumnsPage.hxx
new file mode 100644
index 000000000000..6153cd27a520
--- /dev/null
+++ b/cui/source/inc/TextColumnsPage.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <sfx2/tabdlg.hxx>
+
+#include <memory>
+
+/// Tab page for EditEngine columns properties
+class SvxTextColumnsPage : public SfxTabPage
+{
+private:
+ static const sal_uInt16 pRanges[];
+
+ std::unique_ptr<weld::SpinButton> m_xColumnsNumber;
+ std::unique_ptr<weld::MetricSpinButton> m_xColumnsSpacing;
+
+public:
+ SvxTextColumnsPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
+ virtual ~SvxTextColumnsPage() override;
+
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
+ static const sal_uInt16* GetRanges() { return pRanges; }
+
+ virtual bool FillItemSet(SfxItemSet*) override;
+ virtual void Reset(const SfxItemSet*) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/tabpages/TextColumnsPage.cxx b/cui/source/tabpages/TextColumnsPage.cxx
new file mode 100644
index 000000000000..db83722e6be1
--- /dev/null
+++ b/cui/source/tabpages/TextColumnsPage.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <sal/config.h>
+
+#include <svtools/unitconv.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+#include <TextColumnsPage.hxx>
+
+const sal_uInt16 SvxTextColumnsPage::pRanges[]
+ = { SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST, 0 };
+
+SvxTextColumnsPage::SvxTextColumnsPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs)
+ : SfxTabPage(pPage, pController, "cui/ui/textcolumnstabpage.ui", "TextColumnsPage", &rInAttrs)
+ , m_xColumnsNumber(m_xBuilder->weld_spin_button("FLD_COL_NUMBER"))
+ , m_xColumnsSpacing(
+ m_xBuilder->weld_metric_spin_button("MTR_FLD_COL_SPACING", GetModuleFieldUnit(rInAttrs)))
+{
+}
+
+SvxTextColumnsPage::~SvxTextColumnsPage() = default;
+
+// read the passed item set
+void SvxTextColumnsPage::Reset(const SfxItemSet* rAttrs)
+{
+ SfxItemPool* pPool = rAttrs->GetPool();
+ assert(pPool);
+
+ {
+ auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_NUMBER);
+ if (!pItem)
+ pItem = &pPool->GetDefaultItem(SDRATTR_TEXTCOLUMNS_NUMBER);
+ m_xColumnsNumber->set_value(pItem->GetValue());
+ m_xColumnsNumber->save_value();
+ }
+
+ {
+ MapUnit eUnit = pPool->GetMetric(SDRATTR_TEXTCOLUMNS_SPACING);
+ auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_SPACING);
+ if (!pItem)
+ pItem = &pPool->GetDefaultItem(SDRATTR_TEXTCOLUMNS_SPACING);
+ SetMetricValue(*m_xColumnsSpacing, pItem->GetValue(), eUnit);
+ m_xColumnsSpacing->save_value();
+ }
+}
+
+// fill the passed item set with dialog box attributes
+bool SvxTextColumnsPage::FillItemSet(SfxItemSet* rAttrs)
+{
+ if (m_xColumnsNumber->get_value_changed_from_saved())
+ rAttrs->Put(SfxInt16Item(SDRATTR_TEXTCOLUMNS_NUMBER, m_xColumnsNumber->get_value()));
+
+ if (m_xColumnsSpacing->get_value_changed_from_saved())
+ {
+ SfxItemPool* pPool = rAttrs->GetPool();
+ assert(pPool);
+ MapUnit eUnit = pPool->GetMetric(SDRATTR_TEXTCOLUMNS_SPACING);
+ sal_Int32 nValue = GetCoreValue(*m_xColumnsSpacing, eUnit);
+ rAttrs->Put(SdrMetricItem(SDRATTR_TEXTCOLUMNS_SPACING, nValue));
+ }
+
+ return true;
+}
+
+std::unique_ptr<SfxTabPage> SvxTextColumnsPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrs)
+{
+ return std::make_unique<SvxTextColumnsPage>(pPage, pController, *rAttrs);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index 71a5d185a3dc..43b69d77afd6 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -19,6 +19,7 @@
#include <textanim.hxx>
#include <textattr.hxx>
+#include <TextColumnsPage.hxx>
#include <svx/dlgutil.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdview.hxx>
@@ -47,6 +48,7 @@ SvxTextTabDialog::SvxTextTabDialog(weld::Window* pParent, const SfxItemSet* pAtt
{
AddTabPage("RID_SVXPAGE_TEXTATTR", SvxTextAttrPage::Create, nullptr);
AddTabPage("RID_SVXPAGE_TEXTANIMATION", SvxTextAnimationPage::Create, nullptr);
+ AddTabPage("RID_SVXPAGE_TEXTCOLUMNS", SvxTextColumnsPage::Create, nullptr);
}
/*************************************************************************