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 
20 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_COLUMN_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_COLUMN_HXX
22 
23 #include <vcl/timer.hxx>
24 #include <svtools/ctrlbox.hxx>
25 #include <svtools/valueset.hxx>
26 #include <sfx2/basedlgs.hxx>
27 #include <sfx2/tabdlg.hxx>
28 #include <svx/colorbox.hxx>
29 #include <svx/frmdirlbox.hxx>
30 #include <fmtclbl.hxx>
31 #include "colex.hxx"
32 #include "prcntfld.hxx"
33 
34 const int nMaxCols = 99;
35 class SwColMgr;
36 class SwWrtShell;
37 class SwColumnPage;
38 
40 {
43  std::unique_ptr<SfxItemSet> m_pPageSet;
44  std::unique_ptr<SfxItemSet> m_pSectionSet;
45  std::unique_ptr<SfxItemSet> m_pSelectionSet;
47 
51 
52  bool m_bPageChanged : 1;
55  bool m_bFrameChanged : 1;
56 
57  std::unique_ptr<weld::Container> m_xContentArea;
58  std::unique_ptr<weld::Button> m_xOkButton;
59 
60  DECL_LINK(ObjectListBoxHdl, weld::ComboBox&, void);
61  DECL_LINK(OkHdl, weld::Button&, void);
62  void ObjectHdl(const weld::ComboBox*);
64 
65 public:
66  SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh);
67  virtual ~SwColumnDlg() override;
68 };
69 
71 {
72 public:
74  : SvtValueSet(nullptr)
75  {
76  }
77  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
78  {
79  SvtValueSet::SetDrawingArea(pDrawingArea);
81  }
82  virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
83  virtual void StyleUpdated() override;
84 };
85 
86 // column dialog now as TabPage
87 class SwColumnPage : public SfxTabPage
88 {
89  std::unique_ptr<SwColMgr> m_xColMgr;
90 
91  sal_uInt16 m_nFirstVis;
92  sal_uInt16 m_nCols;
96 
97  std::map<weld::MetricSpinButton*, SwPercentField*> m_aPercentFieldsMap;
98 
99  bool m_bFormat;
100  bool m_bFrame;
103 
107 
108  std::unique_ptr<weld::SpinButton> m_xCLNrEdt;
109  std::unique_ptr<weld::CheckButton> m_xBalanceColsCB;
110  std::unique_ptr<weld::Button> m_xBtnBack;
111  std::unique_ptr<weld::Label> m_xLbl1;
112  std::unique_ptr<weld::Label> m_xLbl2;
113  std::unique_ptr<weld::Label> m_xLbl3;
114  std::unique_ptr<weld::Button> m_xBtnNext;
115  std::unique_ptr<weld::CheckButton> m_xAutoWidthBox;
116  std::unique_ptr<weld::Label> m_xLineTypeLbl;
117  std::unique_ptr<weld::Label> m_xLineWidthLbl;
118  std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit;
119  std::unique_ptr<weld::Label> m_xLineColorLbl;
120  std::unique_ptr<weld::Label> m_xLineHeightLbl;
121  std::unique_ptr<weld::MetricSpinButton> m_xLineHeightEdit;
122  std::unique_ptr<weld::Label> m_xLinePosLbl;
123  std::unique_ptr<weld::ComboBox> m_xLinePosDLB;
124  std::unique_ptr<weld::Label> m_xTextDirectionFT;
125  std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
126  std::unique_ptr<ColorListBox> m_xLineColorDLB;
127  std::unique_ptr<SvtLineListBox> m_xLineTypeDLB;
128  std::unique_ptr<SwPercentField> m_xEd1;
129  std::unique_ptr<SwPercentField> m_xEd2;
130  std::unique_ptr<SwPercentField> m_xEd3;
131  std::unique_ptr<SwPercentField> m_xDistEd1;
132  std::unique_ptr<SwPercentField> m_xDistEd2;
133  std::unique_ptr<weld::CustomWeld> m_xDefaultVS;
134  // Example
135  std::unique_ptr<weld::CustomWeld> m_xPgeExampleWN;
136  std::unique_ptr<weld::CustomWeld> m_xFrameExampleWN;
137 
138  std::unique_ptr<weld::Label> m_xApplyToFT;
139  std::unique_ptr<weld::ComboBox> m_xApplyToLB;
140 
141  // Handler
143  void ColModify(const weld::SpinButton*);
144  DECL_LINK(GapModify, weld::MetricSpinButton&, void);
145  DECL_LINK(EdModify, weld::MetricSpinButton&, void);
146  DECL_LINK(AutoWidthHdl, weld::ToggleButton&, void );
147  DECL_LINK(SetDefaultsHdl, SvtValueSet *, void);
148 
149  DECL_LINK(Up, weld::Button&, void);
150  DECL_LINK(Down, weld::Button&, void);
151  DECL_LINK(UpdateColMgr, weld::MetricSpinButton&, void);
152  DECL_LINK(UpdateColMgrListBox, weld::ComboBox&, void);
153  DECL_LINK(UpdateColMgrLineBox, SvtLineListBox&, void);
154  DECL_LINK(UpdateColMgrColorBox, ColorListBox&, void);
155  void Timeout();
156 
157  void Update(const weld::MetricSpinButton* pInteractiveField);
158  void UpdateCols();
159  void Init();
160  void ResetColWidth();
161  void SetLabels( sal_uInt16 nVis );
162 
165 
166  virtual void ActivatePage(const SfxItemSet& rSet) override;
167  virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
168 
169  void connectPercentField(SwPercentField &rWrap);
170 
171  bool isLineNotNone() const;
172 
173  static const sal_uInt16 aPageRg[];
174 
175 public:
176  SwColumnPage(TabPageParent pParent, const SfxItemSet &rSet);
177  virtual ~SwColumnPage() override;
178  virtual void dispose() override;
179 
180  static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet);
181  static const sal_uInt16* GetRanges() { return aPageRg; }
182 
183  virtual bool FillItemSet(SfxItemSet *rSet) override;
184  virtual void Reset(const SfxItemSet *rSet) override;
185 
186  void SetFrameMode(bool bMod);
187  void SetPageWidth(long nPageWidth);
188 
189  void SetFormatUsed(bool bFormatUsed)
190  {
191  m_bFormat = bFormatUsed;
192  }
193 
194  void ShowBalance(bool bShow)
195  {
196  m_xBalanceColsCB->set_visible(bShow);
197  }
198 
199  void SetInSection(bool bSet);
200 
202  {
203  m_xCLNrEdt->grab_focus();
204  }
205 
206  weld::Label* GetApplyLabel() { return m_xApplyToFT.get(); }
207  weld::ComboBox* GetApplyComboBox() { return m_xApplyToLB.get(); }
208 };
209 
210 #endif
211 
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VclPtr< SwColumnPage > m_pTabPage
Definition: column.hxx:42
std::unique_ptr< SwPercentField > m_xEd2
Definition: column.hxx:129
std::unique_ptr< weld::Container > m_xContentArea
Definition: column.hxx:57
std::unique_ptr< weld::MetricSpinButton > m_xLineWidthEdit
Definition: column.hxx:118
void ActivateColumnControl()
Definition: column.hxx:201
SwColumnDlg(weld::Window *pParent, SwWrtShell &rSh)
Definition: column.cxx:88
void ObjectHdl(const weld::ComboBox *)
Definition: column.cxx:223
const SfxItemSet * pSet
std::unique_ptr< weld::CheckButton > m_xAutoWidthBox
Definition: column.hxx:115
bool m_bFormat
Definition: column.hxx:99
void SetFormatUsed(bool bFormatUsed)
Definition: column.hxx:189
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: column.cxx:610
virtual void Reset(const SfxItemSet *rSet) override
Definition: column.cxx:547
virtual void ActivatePage(const SfxItemSet &)
std::unique_ptr< SwPercentField > m_xEd3
Definition: column.hxx:130
void SetFrameMode(bool bMod)
Definition: column.cxx:1313
void UpdateCols()
Definition: column.cxx:828
void SetPageWidth(long nPageWidth)
Definition: column.cxx:529
std::unique_ptr< weld::CustomWeld > m_xFrameExampleWN
Definition: column.hxx:136
SwColumnOnlyExample m_aFrameExampleWN
Definition: column.hxx:106
std::unique_ptr< weld::Label > m_xLineTypeLbl
Definition: column.hxx:116
void ShowBalance(bool bShow)
Definition: column.hxx:194
std::unique_ptr< weld::Label > m_xLbl1
Definition: column.hxx:111
std::unique_ptr< SvtLineListBox > m_xLineTypeDLB
Definition: column.hxx:127
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:86
SwWrtShell & m_rWrtShell
Definition: column.hxx:41
void SetInSection(bool bSet)
Definition: column.cxx:1318
virtual void StyleUpdated() override
Definition: column.cxx:1393
static const sal_uInt16 * GetRanges()
Definition: column.hxx:181
std::unique_ptr< SwPercentField > m_xEd1
Definition: column.hxx:128
std::unique_ptr< ColorListBox > m_xLineColorDLB
Definition: column.hxx:126
std::unique_ptr< weld::Label > m_xTextDirectionFT
Definition: column.hxx:124
#define WB_ITEMBORDER
std::map< weld::MetricSpinButton *, SwPercentField * > m_aPercentFieldsMap
Definition: column.hxx:97
long m_nColWidth[nMaxCols]
Definition: column.hxx:93
std::unique_ptr< SwPercentField > m_xDistEd1
Definition: column.hxx:131
void Update(const weld::MetricSpinButton *pInteractiveField)
Definition: column.cxx:1114
std::unique_ptr< weld::ComboBox > m_xLinePosDLB
Definition: column.hxx:123
std::unique_ptr< weld::Label > m_xLinePosLbl
Definition: column.hxx:122
std::unique_ptr< weld::Button > m_xOkButton
Definition: column.hxx:58
weld::Label * GetApplyLabel()
Definition: column.hxx:206
SwColumnPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: column.cxx:382
ColumnValueSet m_aDefaultVS
Definition: column.hxx:104
void SetStyle(WinBits nStyle)
static const sal_uInt16 aPageRg[]
Definition: column.hxx:173
sal_uInt16 m_nCols
Definition: column.hxx:92
long m_nSelectionWidth
Definition: column.hxx:49
std::unique_ptr< weld::MetricSpinButton > m_xLineHeightEdit
Definition: column.hxx:121
void Timeout()
Definition: column.cxx:1070
long m_nColDist[nMaxCols]
Definition: column.hxx:94
std::unique_ptr< SfxItemSet > m_pSectionSet
Definition: column.hxx:44
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: column.cxx:1169
weld::ComboBox * GetApplyComboBox()
Definition: column.hxx:207
std::unique_ptr< weld::Label > m_xLineColorLbl
Definition: column.hxx:119
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: column.hxx:125
std::unique_ptr< weld::Label > m_xApplyToFT
Definition: column.hxx:138
void ColModify(const weld::SpinButton *)
Definition: column.cxx:924
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
std::unique_ptr< weld::CheckButton > m_xBalanceColsCB
Definition: column.hxx:109
virtual void dispose() override
Definition: column.cxx:513
std::unique_ptr< weld::SpinButton > m_xCLNrEdt
Definition: column.hxx:108
SwColExample m_aPgeExampleWN
Definition: column.hxx:105
long m_nPageWidth
Definition: column.hxx:50
std::unique_ptr< weld::Button > m_xBtnNext
Definition: column.hxx:114
bool m_bPageChanged
Definition: column.hxx:52
bool m_bHtmlMode
Definition: column.hxx:101
SwPercentField * m_pModifiedField
Definition: column.hxx:95
virtual void UserDraw(const UserDrawEvent &rUDEvt) override
Definition: column.cxx:1327
std::unique_ptr< SfxItemSet > m_pSelectionSet
Definition: column.hxx:45
std::unique_ptr< SfxItemSet > m_pPageSet
Definition: column.hxx:43
void SetLabels(sal_uInt16 nVis)
Definition: column.cxx:887
virtual ~SwColumnDlg() override
Definition: column.cxx:213
std::unique_ptr< SwColMgr > m_xColMgr
Definition: column.hxx:89
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: column.cxx:1270
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: column.hxx:77
bool m_bSectionChanged
Definition: column.hxx:53
const int nMaxCols
Definition: column.hxx:34
bool m_bFrame
Definition: column.hxx:100
DECL_LINK(ColModify, weld::SpinButton &, void)
std::unique_ptr< weld::Label > m_xLineWidthLbl
Definition: column.hxx:117
bool m_bLockUpdate
Definition: column.hxx:102
DECL_LINK(ObjectListBoxHdl, weld::ComboBox &, void)
bool isLineNotNone() const
Definition: column.cxx:815
void connectPercentField(SwPercentField &rWrap)
Definition: column.cxx:540
virtual ~SwColumnPage() override
Definition: column.cxx:508
void Init()
Definition: column.cxx:753
sal_uInt16 m_nFirstVis
Definition: column.hxx:91
std::unique_ptr< weld::CustomWeld > m_xDefaultVS
Definition: column.hxx:133
WinBits const WB_TABSTOP
std::unique_ptr< SwPercentField > m_xDistEd2
Definition: column.hxx:132
DeactivateRC
bool m_bSelSectionChanged
Definition: column.hxx:54
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: column.cxx:604
#define WB_DOUBLEBORDER
std::unique_ptr< weld::Label > m_xLbl3
Definition: column.hxx:113
std::unique_ptr< weld::ComboBox > m_xApplyToLB
Definition: column.hxx:139
std::unique_ptr< weld::Label > m_xLbl2
Definition: column.hxx:112
long m_nOldSelection
Definition: column.hxx:48
SfxItemSet * m_pFrameSet
Definition: column.hxx:46
void ResetColWidth()
Definition: column.cxx:367
std::unique_ptr< weld::Label > m_xLineHeightLbl
Definition: column.hxx:120
std::unique_ptr< weld::CustomWeld > m_xPgeExampleWN
Definition: column.hxx:135
SfxItemSet * EvalCurrentSelection(void)
Definition: column.cxx:323
bool m_bFrameChanged
Definition: column.hxx:55
std::unique_ptr< weld::Button > m_xBtnBack
Definition: column.hxx:110