LibreOffice Module cui (master) 1
TextColumnsPage.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include <sal/config.h>
11
12#include <svtools/unitconv.hxx>
13#include <svx/dlgutil.hxx>
14#include <svx/sdmetitm.hxx>
15#include <svx/svddef.hxx>
16
17#include <TextColumnsPage.hxx>
18
20 SvxTextColumnsPage::pRanges(svl::Items<SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST>);
21
23 const SfxItemSet& rInAttrs)
24 : SfxTabPage(pPage, pController, "cui/ui/textcolumnstabpage.ui", "TextColumnsPage", &rInAttrs)
25 , m_xColumnsNumber(m_xBuilder->weld_spin_button("FLD_COL_NUMBER"))
26 , m_xColumnsSpacing(
27 m_xBuilder->weld_metric_spin_button("MTR_FLD_COL_SPACING", GetModuleFieldUnit(rInAttrs)))
28{
29}
30
32
33// read the passed item set
35{
36 SfxItemPool* pPool = rAttrs->GetPool();
37 assert(pPool);
38
39 {
40 auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_NUMBER);
41 if (!pItem)
43 m_xColumnsNumber->set_value(pItem->GetValue());
44 m_xColumnsNumber->save_value();
45 }
46
47 {
49 auto pItem = GetItem(*rAttrs, SDRATTR_TEXTCOLUMNS_SPACING);
50 if (!pItem)
52 SetMetricValue(*m_xColumnsSpacing, pItem->GetValue(), eUnit);
53 m_xColumnsSpacing->save_value();
54 }
55}
56
57// fill the passed item set with dialog box attributes
59{
60 if (m_xColumnsNumber->get_value_changed_from_saved())
62
63 if (m_xColumnsSpacing->get_value_changed_from_saved())
64 {
65 SfxItemPool* pPool = rAttrs->GetPool();
66 assert(pPool);
68 sal_Int32 nValue = GetCoreValue(*m_xColumnsSpacing, eUnit);
70 }
71
72 return true;
73}
74
75std::unique_ptr<SfxTabPage> SvxTextColumnsPage::Create(weld::Container* pPage,
76 weld::DialogController* pController,
77 const SfxItemSet* rAttrs)
78{
79 return std::make_unique<SvxTextColumnsPage>(pPage, pController, *rAttrs);
80}
81
82/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
std::unique_ptr< weld::MetricSpinButton > m_xColumnsSpacing
virtual bool FillItemSet(SfxItemSet *) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
virtual ~SvxTextColumnsPage() override
virtual void Reset(const SfxItemSet *) override
SvxTextColumnsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
static const WhichRangesContainer pRanges
std::unique_ptr< weld::SpinButton > m_xColumnsNumber
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
sal_Int16 nValue
MapUnit
constexpr TypedWhichId< SfxInt16Item > SDRATTR_TEXTCOLUMNS_NUMBER(SDRATTR_TEXTCOLUMNS_FIRST+0)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXTCOLUMNS_SPACING(SDRATTR_TEXTCOLUMNS_FIRST+1)
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)