nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / uibase / inc / column.hxx
blob006eec66bfa94729e4ecfb0e20dc008be6125eec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
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 "colex.hxx"
28 #include "prcntfld.hxx"
30 const int nMaxCols = 99;
31 class SwColMgr;
32 class SwWrtShell;
33 class SwColumnPage;
35 class SwColumnDlg : public SfxDialogController
37 SwWrtShell& m_rWrtShell;
38 std::unique_ptr<SwColumnPage> m_xTabPage;
39 std::unique_ptr<SfxItemSet> m_pPageSet;
40 std::unique_ptr<SfxItemSet> m_pSectionSet;
41 std::unique_ptr<SfxItemSet> m_pSelectionSet;
42 SfxItemSet* m_pFrameSet;
44 tools::Long m_nOldSelection;
45 tools::Long m_nSelectionWidth;
46 tools::Long m_nPageWidth;
48 bool m_bPageChanged : 1;
49 bool m_bSectionChanged : 1;
50 bool m_bSelSectionChanged : 1;
51 bool m_bFrameChanged : 1;
53 std::unique_ptr<weld::Container> m_xContentArea;
54 std::unique_ptr<weld::Button> m_xOkButton;
56 DECL_LINK(ObjectListBoxHdl, weld::ComboBox&, void);
57 DECL_LINK(OkHdl, weld::Button&, void);
58 void ObjectHdl(const weld::ComboBox*);
59 SfxItemSet* EvalCurrentSelection(void);
61 public:
62 SwColumnDlg(weld::Window* pParent, SwWrtShell& rSh);
63 virtual ~SwColumnDlg() override;
66 class ColumnValueSet : public ValueSet
68 public:
69 ColumnValueSet()
70 : ValueSet(nullptr)
73 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
75 ValueSet::SetDrawingArea(pDrawingArea);
76 SetStyle(WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER);
78 virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
79 virtual void StyleUpdated() override;
82 // column dialog now as TabPage
83 class SwColumnPage : public SfxTabPage
85 std::unique_ptr<SwColMgr> m_xColMgr;
87 sal_uInt16 m_nFirstVis;
88 sal_uInt16 m_nCols;
89 tools::Long m_nColWidth[nMaxCols];
90 tools::Long m_nColDist[nMaxCols];
91 SwPercentField* m_pModifiedField;
93 std::map<weld::MetricSpinButton*, SwPercentField*> m_aPercentFieldsMap;
95 bool m_bFormat;
96 bool m_bFrame;
97 bool m_bHtmlMode;
98 bool m_bLockUpdate;
100 ColumnValueSet m_aDefaultVS;
101 SwColExample m_aPgeExampleWN;
102 SwColumnOnlyExample m_aFrameExampleWN;
104 std::unique_ptr<weld::SpinButton> m_xCLNrEdt;
105 std::unique_ptr<weld::CheckButton> m_xBalanceColsCB;
106 std::unique_ptr<weld::Button> m_xBtnBack;
107 std::unique_ptr<weld::Label> m_xLbl1;
108 std::unique_ptr<weld::Label> m_xLbl2;
109 std::unique_ptr<weld::Label> m_xLbl3;
110 std::unique_ptr<weld::Button> m_xBtnNext;
111 std::unique_ptr<weld::CheckButton> m_xAutoWidthBox;
112 std::unique_ptr<weld::Label> m_xLineTypeLbl;
113 std::unique_ptr<weld::Label> m_xLineWidthLbl;
114 std::unique_ptr<weld::MetricSpinButton> m_xLineWidthEdit;
115 std::unique_ptr<weld::Label> m_xLineColorLbl;
116 std::unique_ptr<weld::Label> m_xLineHeightLbl;
117 std::unique_ptr<weld::MetricSpinButton> m_xLineHeightEdit;
118 std::unique_ptr<weld::Label> m_xLinePosLbl;
119 std::unique_ptr<weld::ComboBox> m_xLinePosDLB;
120 std::unique_ptr<weld::Label> m_xTextDirectionFT;
121 std::unique_ptr<svx::FrameDirectionListBox> m_xTextDirectionLB;
122 std::unique_ptr<ColorListBox> m_xLineColorDLB;
123 std::unique_ptr<SvtLineListBox> m_xLineTypeDLB;
124 std::unique_ptr<SwPercentField> m_xEd1;
125 std::unique_ptr<SwPercentField> m_xEd2;
126 std::unique_ptr<SwPercentField> m_xEd3;
127 std::unique_ptr<SwPercentField> m_xDistEd1;
128 std::unique_ptr<SwPercentField> m_xDistEd2;
129 std::unique_ptr<weld::CustomWeld> m_xDefaultVS;
130 // Example
131 std::unique_ptr<weld::CustomWeld> m_xPgeExampleWN;
132 std::unique_ptr<weld::CustomWeld> m_xFrameExampleWN;
134 std::unique_ptr<weld::Label> m_xApplyToFT;
135 std::unique_ptr<weld::ComboBox> m_xApplyToLB;
137 // Handler
138 DECL_LINK(ColModify, weld::SpinButton&, void);
139 void ColModify(const weld::SpinButton*);
140 DECL_LINK(GapModify, weld::MetricSpinButton&, void);
141 DECL_LINK(EdModify, weld::MetricSpinButton&, void);
142 DECL_LINK(AutoWidthHdl, weld::ToggleButton&, void );
143 DECL_LINK(SetDefaultsHdl, ValueSet *, void);
145 DECL_LINK(Up, weld::Button&, void);
146 DECL_LINK(Down, weld::Button&, void);
147 DECL_LINK(UpdateColMgr, weld::MetricSpinButton&, void);
148 DECL_LINK(UpdateColMgrListBox, weld::ComboBox&, void);
149 DECL_LINK(UpdateColMgrLineBox, SvtLineListBox&, void);
150 DECL_LINK(UpdateColMgrColorBox, ColorListBox&, void);
151 void Timeout();
153 void Update(const weld::MetricSpinButton* pInteractiveField);
154 void UpdateCols();
155 void Init();
156 void ResetColWidth();
157 void SetLabels( sal_uInt16 nVis );
159 virtual void ActivatePage(const SfxItemSet& rSet) override;
160 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
162 void connectPercentField(SwPercentField &rWrap);
164 bool isLineNotNone() const;
166 static const sal_uInt16 aPageRg[];
168 public:
169 SwColumnPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
170 virtual ~SwColumnPage() override;
172 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
173 static const sal_uInt16* GetRanges() { return aPageRg; }
175 virtual bool FillItemSet(SfxItemSet *rSet) override;
176 virtual void Reset(const SfxItemSet *rSet) override;
178 void SetFrameMode(bool bMod);
179 void SetPageWidth(tools::Long nPageWidth);
181 void SetFormatUsed(bool bFormatUsed)
183 m_bFormat = bFormatUsed;
186 void ShowBalance(bool bShow)
188 m_xBalanceColsCB->set_visible(bShow);
191 void SetInSection(bool bSet);
193 void ActivateColumnControl()
195 m_xCLNrEdt->grab_focus();
198 weld::Label* GetApplyLabel() { return m_xApplyToFT.get(); }
199 weld::ComboBox* GetApplyComboBox() { return m_xApplyToLB.get(); }
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */