1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <sfx2/tabdlg.hxx>
22 #include <prcntfld.hxx>
23 #include <swtypes.hxx>
24 #include <svx/frmdirlbox.hxx>
30 /// Provides the Table tab page on the Table -> Properties dialog, which works on an existing table.
32 /// Has nothing to do with the other SwFormatSomething classes, which are subclasses of SfxPoolItem.
33 class SwFormatTablePage
: public SfxTabPage
35 SwTableRep
* m_pTableData
;
36 std::unique_ptr
<SwTableRep
> m_xOrigTableData
;
38 SwTwips m_nMinTableWidth
;
43 std::unique_ptr
<weld::Entry
> m_xNameED
;
44 std::unique_ptr
<weld::Label
> m_xWidthFT
;
45 std::unique_ptr
<SwPercentField
> m_xWidthMF
;
46 std::unique_ptr
<weld::CheckButton
> m_xRelWidthCB
;
48 std::unique_ptr
<weld::RadioButton
> m_xFullBtn
;
49 std::unique_ptr
<weld::RadioButton
> m_xLeftBtn
;
50 std::unique_ptr
<weld::RadioButton
> m_xFromLeftBtn
;
51 std::unique_ptr
<weld::RadioButton
> m_xRightBtn
;
52 std::unique_ptr
<weld::RadioButton
> m_xCenterBtn
;
53 std::unique_ptr
<weld::RadioButton
> m_xFreeBtn
;
55 std::unique_ptr
<weld::Label
> m_xLeftFT
;
56 std::unique_ptr
<SwPercentField
> m_xLeftMF
;
57 std::unique_ptr
<weld::Label
> m_xRightFT
;
58 std::unique_ptr
<SwPercentField
> m_xRightMF
;
59 std::unique_ptr
<weld::Label
> m_xTopFT
;
60 std::unique_ptr
<weld::MetricSpinButton
> m_xTopMF
;
61 std::unique_ptr
<weld::Label
> m_xBottomFT
;
62 std::unique_ptr
<weld::MetricSpinButton
> m_xBottomMF
;
64 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextDirectionLB
;
65 std::unique_ptr
<weld::Widget
> m_xProperties
;
67 sal_Int64 m_nOrigWidthMin
;
68 sal_Int64 m_nOrigWidthMax
;
69 sal_Int64 m_nOrigLeftMin
;
70 sal_Int64 m_nOrigLeftMax
;
71 sal_Int64 m_nOrigRightMin
;
72 sal_Int64 m_nOrigRightMax
;
75 void ModifyHdl(const weld::MetricSpinButton
& rEdit
, bool bAllowInconsistencies
= false);
77 DECL_LINK(AutoClickHdl
, weld::Toggleable
&, void);
78 DECL_LINK(RelWidthClickHdl
, weld::Toggleable
&, void);
80 DECL_LINK(ValueChangedHdl
, weld::MetricSpinButton
&, void);
83 SwFormatTablePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
84 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
85 virtual ~SwFormatTablePage() override
;
87 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
88 virtual void Reset( const SfxItemSet
* rSet
) override
;
89 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
90 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
93 // TabPage Format/Table/Columns
94 #define MET_FIELDS 5 //Number of the used MetricFields
96 class SwTableColumnPage
: public SfxTabPage
98 SwTableRep
* m_pTableData
;
99 std::unique_ptr
<SwTableRep
> m_xOrigTableData
;
100 ImplSVEvent
* m_pSizeHdlEvent
;
101 SwTwips m_nTableWidth
;
103 sal_uInt16 m_nMetFields
;
104 sal_uInt16 m_nNoOfCols
;
105 sal_uInt16 m_nNoOfVisibleCols
;
106 // Remember the width, when switching to autoalign
107 sal_uInt16 m_aValueTable
[MET_FIELDS
];// primary assignment of the MetricFields
109 bool m_bModifyTable
:1;
110 bool m_bPercentMode
:1;
112 SwPercentField m_aFieldArr
[MET_FIELDS
];
113 std::unique_ptr
<weld::Label
> m_aTextArr
[MET_FIELDS
];
114 std::unique_ptr
<weld::Grid
> m_xColumnWidthsGrid
;
115 std::unique_ptr
<weld::CheckButton
> m_xModifyTableCB
;
116 std::unique_ptr
<weld::CheckButton
> m_xProportionalCB
;
117 std::unique_ptr
<weld::Label
> m_xSpaceFT
;
118 std::unique_ptr
<weld::Label
> m_xSpaceSFT
;
119 std::unique_ptr
<weld::MetricSpinButton
> m_xSpaceED
;
120 std::unique_ptr
<weld::Button
> m_xUpBtn
;
121 std::unique_ptr
<weld::Button
> m_xDownBtn
;
123 void Init(bool bWeb
);
124 DECL_LINK(AutoClickHdl
, weld::Button
&, void);
125 void ModifyHdl(const weld::MetricSpinButton
* pEdit
);
126 DECL_LINK(ValueChangedHdl
, weld::MetricSpinButton
&, void);
127 DECL_LINK(ModeHdl
, weld::Toggleable
&, void);
128 void UpdateCols( sal_uInt16 nCurrentPos
);
129 SwTwips
GetVisibleWidth(sal_uInt16 nPos
);
130 void SetVisibleWidth(sal_uInt16 nPos
, SwTwips nNewWidth
);
131 DECL_LINK(SizeHdl
, void*, void);
134 SwTableColumnPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
135 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
136 virtual ~SwTableColumnPage() override
;
138 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
139 virtual void Reset( const SfxItemSet
* rSet
) override
;
140 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
141 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
145 class SwTextFlowPage
: public SfxTabPage
147 SwWrtShell
* m_pShell
;
151 std::unique_ptr
<weld::CheckButton
> m_xPgBrkCB
;
152 std::unique_ptr
<weld::RadioButton
> m_xPgBrkRB
;
153 std::unique_ptr
<weld::RadioButton
> m_xColBrkRB
;
154 std::unique_ptr
<weld::RadioButton
> m_xPgBrkBeforeRB
;
155 std::unique_ptr
<weld::RadioButton
> m_xPgBrkAfterRB
;
156 std::unique_ptr
<weld::CheckButton
> m_xPageCollCB
;
157 std::unique_ptr
<weld::ComboBox
> m_xPageCollLB
;
158 std::unique_ptr
<weld::CheckButton
> m_xPageNoCB
;
159 std::unique_ptr
<weld::SpinButton
> m_xPageNoNF
;
160 std::unique_ptr
<weld::CheckButton
> m_xSplitCB
;
161 std::unique_ptr
<weld::CheckButton
> m_xSplitRowCB
;
162 std::unique_ptr
<weld::CheckButton
> m_xKeepCB
;
163 std::unique_ptr
<weld::CheckButton
> m_xHeadLineCB
;
164 std::unique_ptr
<weld::Widget
> m_xRepeatHeaderCombo
;
165 std::unique_ptr
<weld::SpinButton
> m_xRepeatHeaderNF
;
166 std::unique_ptr
<weld::ComboBox
> m_xTextDirectionLB
;
167 std::unique_ptr
<weld::ComboBox
> m_xVertOrientLB
;
169 DECL_LINK(PageBreakHdl_Impl
, weld::Toggleable
&, void);
170 DECL_LINK(ApplyCollClickHdl_Impl
, weld::Toggleable
&, void);
171 DECL_LINK(PageBreakPosHdl_Impl
, weld::Toggleable
&, void);
172 DECL_LINK(PageBreakTypeHdl_Impl
, weld::Toggleable
&, void);
173 DECL_LINK(PageNoClickHdl_Impl
, weld::Toggleable
&, void);
174 DECL_LINK(SplitHdl_Impl
, weld::Toggleable
&, void);
175 DECL_LINK(HeadLineCBClickHdl
, weld::Toggleable
&, void);
178 SwTextFlowPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
179 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
180 virtual ~SwTextFlowPage() override
;
181 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
182 virtual void Reset( const SfxItemSet
* rSet
) override
;
184 void SetShell(SwWrtShell
* pSh
);
186 void DisablePageBreak();
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */