LibreOffice Module sw (master) 1
column.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <svtools/ctrlbox.hxx>
22#include <svtools/valueset.hxx>
23#include <sfx2/basedlgs.hxx>
24#include <sfx2/tabdlg.hxx>
25#include <svx/colorbox.hxx>
26#include <svx/frmdirlbox.hxx>
27#include <map>
28#include "colex.hxx"
29#include "prcntfld.hxx"
30
31const int nMaxCols = 99;
32class SwColMgr;
33class SwWrtShell;
34class SwColumnPage;
35
36class SwColumnDlg final : public SfxDialogController
37{
39 std::unique_ptr<SwColumnPage> m_xTabPage;
40 std::unique_ptr<SfxItemSet> m_pPageSet;
41 std::unique_ptr<SfxItemSet> m_pSectionSet;
42 std::unique_ptr<SfxItemSet> m_pSelectionSet;
44
48
53
54 std::unique_ptr<weld::Container> m_xContentArea;
55 std::unique_ptr<weld::Button> m_xOkButton;
56
57 DECL_LINK(ObjectListBoxHdl, weld::ComboBox&, void);
58 DECL_LINK(OkHdl, weld::Button&, void);
59 void ObjectHdl(const weld::ComboBox*);
61
62public:
63 SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh);
64 virtual ~SwColumnDlg() override;
65};
66
67class ColumnValueSet final : public ValueSet
68{
69public:
71 : ValueSet(nullptr)
72 {
73 }
74 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
75 {
76 ValueSet::SetDrawingArea(pDrawingArea);
78 }
79 virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
80 virtual void StyleUpdated() override;
81};
82
83// column dialog now as TabPage
84class SwColumnPage final : public SfxTabPage
85{
86 std::unique_ptr<SwColMgr> m_xColMgr;
87
88 sal_uInt16 m_nFirstVis;
89 sal_uInt16 m_nCols;
93
94 std::map<weld::MetricSpinButton*, SwPercentField*> m_aPercentFieldsMap;
95
100
104
105 std::unique_ptr<weld::SpinButton> m_xCLNrEdt;
106 std::unique_ptr<weld::CheckButton> m_xBalanceColsCB;
107 std::unique_ptr<weld::Button> m_xBtnBack;
108 std::unique_ptr<weld::Label> m_xLbl1;
109 std::unique_ptr<weld::Label> m_xLbl2;
110 std::unique_ptr<weld::Label> m_xLbl3;
111 std::unique_ptr<weld::Button> m_xBtnNext;
112 std::unique_ptr<weld::CheckButton> m_xAutoWidthBox;
113 std::unique_ptr<weld::Label> m_xLineTypeLbl;
114 std::unique_ptr<weld::Label> m_xLineWidthLbl;
115 std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit;
116 std::unique_ptr<weld::Label> m_xLineColorLbl;
117 std::unique_ptr<weld::Label> m_xLineHeightLbl;
118 std::unique_ptr<weld::MetricSpinButton> m_xLineHeightEdit;
119 std::unique_ptr<weld::Label> m_xLinePosLbl;
120 std::unique_ptr<weld::ComboBox> m_xLinePosDLB;
121 std::unique_ptr<weld::Label> m_xTextDirectionFT;
122 std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
123 std::unique_ptr<ColorListBox> m_xLineColorDLB;
124 std::unique_ptr<SvtLineListBox> m_xLineTypeDLB;
125 std::unique_ptr<SwPercentField> m_xEd1;
126 std::unique_ptr<SwPercentField> m_xEd2;
127 std::unique_ptr<SwPercentField> m_xEd3;
128 std::unique_ptr<SwPercentField> m_xDistEd1;
129 std::unique_ptr<SwPercentField> m_xDistEd2;
130 std::unique_ptr<weld::CustomWeld> m_xDefaultVS;
131 // Example
132 std::unique_ptr<weld::CustomWeld> m_xPgeExampleWN;
133 std::unique_ptr<weld::CustomWeld> m_xFrameExampleWN;
134
135 std::unique_ptr<weld::Label> m_xApplyToFT;
136 std::unique_ptr<weld::ComboBox> m_xApplyToLB;
137
138 // Handler
140 void ColModify(bool bForceColReset);
143 DECL_LINK(AutoWidthHdl, weld::Toggleable&, void );
144 DECL_LINK(SetDefaultsHdl, ValueSet *, void);
145
147 DECL_LINK(Down, weld::Button&, void);
148 DECL_LINK(UpdateColMgr, weld::MetricSpinButton&, void);
149 DECL_LINK(UpdateColMgrListBox, weld::ComboBox&, void);
150 DECL_LINK(UpdateColMgrLineBox, SvtLineListBox&, void);
151 DECL_LINK(UpdateColMgrColorBox, ColorListBox&, void);
152 void Timeout();
153
154 void Update(const weld::MetricSpinButton* pInteractiveField);
155 void UpdateCols();
156 void Init();
157 void ResetColWidth();
158 void SetLabels( sal_uInt16 nVis );
159
160 virtual void ActivatePage(const SfxItemSet& rSet) override;
161 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
162
164
165 bool isLineNotNone() const;
166
168
169public:
170 SwColumnPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
171 virtual ~SwColumnPage() override;
172
173 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
175
176 virtual bool FillItemSet(SfxItemSet *rSet) override;
177 virtual void Reset(const SfxItemSet *rSet) override;
178
179 void SetFrameMode(bool bMod);
180 void SetPageWidth(tools::Long nPageWidth);
181
182 void SetFormatUsed(bool bFormatUsed)
183 {
184 m_bFormat = bFormatUsed;
185 }
186
187 void ShowBalance(bool bShow)
188 {
189 m_xBalanceColsCB->set_visible(bShow);
190 }
191
192 void SetInSection(bool bSet);
193
195 {
196 m_xCLNrEdt->grab_focus();
197 }
198
201};
202
203/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void UserDraw(const UserDrawEvent &rUDEvt) override
Definition: column.cxx:1308
virtual void StyleUpdated() override
Definition: column.cxx:1374
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: column.hxx:74
const SfxItemSet * pSet
SfxItemSet * m_pFrameSet
Definition: column.hxx:43
DECL_LINK(ObjectListBoxHdl, weld::ComboBox &, void)
SwWrtShell & m_rWrtShell
Definition: column.hxx:38
SwColumnDlg(weld::Window *pParent, SwWrtShell &rSh)
Definition: column.cxx:82
virtual ~SwColumnDlg() override
Definition: column.cxx:203
tools::Long m_nSelectionWidth
Definition: column.hxx:46
tools::Long m_nOldSelection
Definition: column.hxx:45
std::unique_ptr< weld::Button > m_xOkButton
Definition: column.hxx:55
SfxItemSet * EvalCurrentSelection(void)
Definition: column.cxx:313
std::unique_ptr< SwColumnPage > m_xTabPage
Definition: column.hxx:39
std::unique_ptr< SfxItemSet > m_pSectionSet
Definition: column.hxx:41
bool m_bSectionChanged
Definition: column.hxx:50
DECL_LINK(OkHdl, weld::Button &, void)
std::unique_ptr< SfxItemSet > m_pSelectionSet
Definition: column.hxx:42
tools::Long m_nPageWidth
Definition: column.hxx:47
bool m_bSelSectionChanged
Definition: column.hxx:51
bool m_bPageChanged
Definition: column.hxx:49
void ObjectHdl(const weld::ComboBox *)
Definition: column.cxx:213
bool m_bFrameChanged
Definition: column.hxx:52
std::unique_ptr< weld::Container > m_xContentArea
Definition: column.hxx:54
std::unique_ptr< SfxItemSet > m_pPageSet
Definition: column.hxx:40
std::unique_ptr< weld::Button > m_xBtnBack
Definition: column.hxx:107
DECL_LINK(UpdateColMgrListBox, weld::ComboBox &, void)
DECL_LINK(UpdateColMgrLineBox, SvtLineListBox &, void)
DECL_LINK(EdModify, weld::MetricSpinButton &, void)
void SetLabels(sal_uInt16 nVis)
Definition: column.cxx:868
virtual void Reset(const SfxItemSet *rSet) override
Definition: column.cxx:529
bool m_bLockUpdate
Definition: column.hxx:99
std::unique_ptr< SwPercentField > m_xEd3
Definition: column.hxx:127
SwPercentField * m_pModifiedField
Definition: column.hxx:92
std::unique_ptr< weld::SpinButton > m_xCLNrEdt
Definition: column.hxx:105
std::unique_ptr< weld::Button > m_xBtnNext
Definition: column.hxx:111
std::unique_ptr< SwPercentField > m_xDistEd1
Definition: column.hxx:128
std::unique_ptr< weld::CheckButton > m_xBalanceColsCB
Definition: column.hxx:106
DECL_LINK(Down, weld::Button &, void)
static const WhichRangesContainer aPageRg
Definition: column.hxx:167
void connectPercentField(SwPercentField &rWrap)
Definition: column.cxx:522
SwColumnPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: column.cxx:369
std::unique_ptr< weld::Label > m_xLbl1
Definition: column.hxx:108
void Timeout()
Definition: column.cxx:1051
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: column.cxx:1150
DECL_LINK(ColModify, weld::SpinButton &, void)
DECL_LINK(UpdateColMgr, weld::MetricSpinButton &, void)
void ActivateColumnControl()
Definition: column.hxx:194
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: column.hxx:122
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: column.cxx:1251
void SetPageWidth(tools::Long nPageWidth)
Definition: column.cxx:511
std::unique_ptr< weld::Label > m_xApplyToFT
Definition: column.hxx:135
void SetFrameMode(bool bMod)
Definition: column.cxx:1294
weld::Label * GetApplyLabel()
Definition: column.hxx:199
std::unique_ptr< weld::ComboBox > m_xLinePosDLB
Definition: column.hxx:120
std::unique_ptr< weld::Label > m_xLineHeightLbl
Definition: column.hxx:117
sal_uInt16 m_nFirstVis
Definition: column.hxx:88
void ColModify(bool bForceColReset)
Definition: column.cxx:905
void SetFormatUsed(bool bFormatUsed)
Definition: column.hxx:182
bool m_bHtmlMode
Definition: column.hxx:98
std::unique_ptr< weld::MetricSpinButton > m_xLineWidthEdit
Definition: column.hxx:115
weld::ComboBox * GetApplyComboBox()
Definition: column.hxx:200
void ResetColWidth()
Definition: column.cxx:354
std::unique_ptr< SwPercentField > m_xEd1
Definition: column.hxx:125
std::unique_ptr< SwPercentField > m_xEd2
Definition: column.hxx:126
bool m_bFormat
Definition: column.hxx:96
std::map< weld::MetricSpinButton *, SwPercentField * > m_aPercentFieldsMap
Definition: column.hxx:94
std::unique_ptr< ColorListBox > m_xLineColorDLB
Definition: column.hxx:123
std::unique_ptr< SvtLineListBox > m_xLineTypeDLB
Definition: column.hxx:124
std::unique_ptr< SwPercentField > m_xDistEd2
Definition: column.hxx:129
std::unique_ptr< SwColMgr > m_xColMgr
Definition: column.hxx:86
std::unique_ptr< weld::Label > m_xTextDirectionFT
Definition: column.hxx:121
std::unique_ptr< weld::Label > m_xLinePosLbl
Definition: column.hxx:119
DECL_LINK(GapModify, weld::MetricSpinButton &, void)
std::unique_ptr< weld::Label > m_xLbl2
Definition: column.hxx:109
std::unique_ptr< weld::CustomWeld > m_xPgeExampleWN
Definition: column.hxx:132
std::unique_ptr< weld::Label > m_xLineColorLbl
Definition: column.hxx:116
SwColExample m_aPgeExampleWN
Definition: column.hxx:102
DECL_LINK(Up, weld::Button &, void)
tools::Long m_nColDist[nMaxCols]
Definition: column.hxx:91
static WhichRangesContainer GetRanges()
Definition: column.hxx:174
void Init()
Definition: column.cxx:734
DECL_LINK(SetDefaultsHdl, ValueSet *, void)
void Update(const weld::MetricSpinButton *pInteractiveField)
Definition: column.cxx:1095
SwColumnOnlyExample m_aFrameExampleWN
Definition: column.hxx:103
void SetInSection(bool bSet)
Definition: column.cxx:1299
ColumnValueSet m_aDefaultVS
Definition: column.hxx:101
std::unique_ptr< weld::CustomWeld > m_xDefaultVS
Definition: column.hxx:130
sal_uInt16 m_nCols
Definition: column.hxx:89
void ShowBalance(bool bShow)
Definition: column.hxx:187
std::unique_ptr< weld::Label > m_xLbl3
Definition: column.hxx:110
std::unique_ptr< weld::CustomWeld > m_xFrameExampleWN
Definition: column.hxx:133
std::unique_ptr< weld::Label > m_xLineTypeLbl
Definition: column.hxx:113
virtual ~SwColumnPage() override
Definition: column.cxx:496
bool isLineNotNone() const
Definition: column.cxx:796
DECL_LINK(AutoWidthHdl, weld::Toggleable &, void)
std::unique_ptr< weld::ComboBox > m_xApplyToLB
Definition: column.hxx:136
std::unique_ptr< weld::Label > m_xLineWidthLbl
Definition: column.hxx:114
bool m_bFrame
Definition: column.hxx:97
void UpdateCols()
Definition: column.cxx:809
std::unique_ptr< weld::CheckButton > m_xAutoWidthBox
Definition: column.hxx:112
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: column.cxx:591
tools::Long m_nColWidth[nMaxCols]
Definition: column.hxx:90
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: column.cxx:585
std::unique_ptr< weld::MetricSpinButton > m_xLineHeightEdit
Definition: column.hxx:118
DECL_LINK(UpdateColMgrColorBox, ColorListBox &, void)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SetStyle(WinBits nStyle)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
const int nMaxCols
Definition: column.hxx:31
long Long
DeactivateRC
#define WB_ITEMBORDER
#define WB_DOUBLEBORDER
WinBits const WB_TABSTOP