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 class SwFormatTablePage
: public SfxTabPage
32 SwTableRep
* m_pTableData
;
33 std::unique_ptr
<SwTableRep
> m_xOrigTableData
;
35 SwTwips m_nMinTableWidth
;
40 std::unique_ptr
<weld::Entry
> m_xNameED
;
41 std::unique_ptr
<weld::Label
> m_xWidthFT
;
42 std::unique_ptr
<SwPercentField
> m_xWidthMF
;
43 std::unique_ptr
<weld::CheckButton
> m_xRelWidthCB
;
45 std::unique_ptr
<weld::RadioButton
> m_xFullBtn
;
46 std::unique_ptr
<weld::RadioButton
> m_xLeftBtn
;
47 std::unique_ptr
<weld::RadioButton
> m_xFromLeftBtn
;
48 std::unique_ptr
<weld::RadioButton
> m_xRightBtn
;
49 std::unique_ptr
<weld::RadioButton
> m_xCenterBtn
;
50 std::unique_ptr
<weld::RadioButton
> m_xFreeBtn
;
52 std::unique_ptr
<weld::Label
> m_xLeftFT
;
53 std::unique_ptr
<SwPercentField
> m_xLeftMF
;
54 std::unique_ptr
<weld::Label
> m_xRightFT
;
55 std::unique_ptr
<SwPercentField
> m_xRightMF
;
56 std::unique_ptr
<weld::Label
> m_xTopFT
;
57 std::unique_ptr
<weld::MetricSpinButton
> m_xTopMF
;
58 std::unique_ptr
<weld::Label
> m_xBottomFT
;
59 std::unique_ptr
<weld::MetricSpinButton
> m_xBottomMF
;
61 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextDirectionLB
;
62 std::unique_ptr
<weld::Widget
> m_xProperties
;
64 sal_Int64 m_nOrigWidthMin
;
65 sal_Int64 m_nOrigWidthMax
;
66 sal_Int64 m_nOrigLeftMin
;
67 sal_Int64 m_nOrigLeftMax
;
68 sal_Int64 m_nOrigRightMin
;
69 sal_Int64 m_nOrigRightMax
;
72 void ModifyHdl(const weld::MetricSpinButton
& rEdit
, bool bAllowInconsistencies
= false);
74 DECL_LINK(AutoClickHdl
, weld::Toggleable
&, void);
75 DECL_LINK(RelWidthClickHdl
, weld::Toggleable
&, void);
77 DECL_LINK(ValueChangedHdl
, weld::MetricSpinButton
&, void);
80 SwFormatTablePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
81 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
82 virtual ~SwFormatTablePage() override
;
84 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
85 virtual void Reset( const SfxItemSet
* rSet
) override
;
86 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
87 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
90 // TabPage Format/Table/Columns
91 #define MET_FIELDS 5 //Number of the used MetricFields
93 class SwTableColumnPage
: public SfxTabPage
95 SwTableRep
* m_pTableData
;
96 std::unique_ptr
<SwTableRep
> m_xOrigTableData
;
97 ImplSVEvent
* m_pSizeHdlEvent
;
98 SwTwips m_nTableWidth
;
100 sal_uInt16 m_nMetFields
;
101 sal_uInt16 m_nNoOfCols
;
102 sal_uInt16 m_nNoOfVisibleCols
;
103 // Remember the width, when switching to autoalign
104 sal_uInt16 m_aValueTable
[MET_FIELDS
];// primary assignment of the MetricFields
106 bool m_bModifyTable
:1;
107 bool m_bPercentMode
:1;
109 SwPercentField m_aFieldArr
[MET_FIELDS
];
110 std::unique_ptr
<weld::Label
> m_aTextArr
[MET_FIELDS
];
111 std::unique_ptr
<weld::CheckButton
> m_xModifyTableCB
;
112 std::unique_ptr
<weld::CheckButton
> m_xProportionalCB
;
113 std::unique_ptr
<weld::Label
> m_xSpaceFT
;
114 std::unique_ptr
<weld::Label
> m_xSpaceSFT
;
115 std::unique_ptr
<weld::MetricSpinButton
> m_xSpaceED
;
116 std::unique_ptr
<weld::Button
> m_xUpBtn
;
117 std::unique_ptr
<weld::Button
> m_xDownBtn
;
119 void Init(bool bWeb
);
120 DECL_LINK(AutoClickHdl
, weld::Button
&, void);
121 void ModifyHdl(const weld::MetricSpinButton
* pEdit
);
122 DECL_LINK(ValueChangedHdl
, weld::MetricSpinButton
&, void);
123 DECL_LINK(ModeHdl
, weld::Toggleable
&, void);
124 void UpdateCols( sal_uInt16 nCurrentPos
);
125 SwTwips
GetVisibleWidth(sal_uInt16 nPos
);
126 void SetVisibleWidth(sal_uInt16 nPos
, SwTwips nNewWidth
);
127 DECL_LINK(SizeHdl
, void*, void);
130 SwTableColumnPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
131 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
132 virtual ~SwTableColumnPage() override
;
134 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
135 virtual void Reset( const SfxItemSet
* rSet
) override
;
136 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
137 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
141 class SwTextFlowPage
: public SfxTabPage
143 SwWrtShell
* m_pShell
;
147 std::unique_ptr
<weld::CheckButton
> m_xPgBrkCB
;
148 std::unique_ptr
<weld::RadioButton
> m_xPgBrkRB
;
149 std::unique_ptr
<weld::RadioButton
> m_xColBrkRB
;
150 std::unique_ptr
<weld::RadioButton
> m_xPgBrkBeforeRB
;
151 std::unique_ptr
<weld::RadioButton
> m_xPgBrkAfterRB
;
152 std::unique_ptr
<weld::CheckButton
> m_xPageCollCB
;
153 std::unique_ptr
<weld::ComboBox
> m_xPageCollLB
;
154 std::unique_ptr
<weld::CheckButton
> m_xPageNoCB
;
155 std::unique_ptr
<weld::SpinButton
> m_xPageNoNF
;
156 std::unique_ptr
<weld::CheckButton
> m_xSplitCB
;
157 std::unique_ptr
<weld::CheckButton
> m_xSplitRowCB
;
158 std::unique_ptr
<weld::CheckButton
> m_xKeepCB
;
159 std::unique_ptr
<weld::CheckButton
> m_xHeadLineCB
;
160 std::unique_ptr
<weld::Widget
> m_xRepeatHeaderCombo
;
161 std::unique_ptr
<weld::SpinButton
> m_xRepeatHeaderNF
;
162 std::unique_ptr
<weld::ComboBox
> m_xTextDirectionLB
;
163 std::unique_ptr
<weld::ComboBox
> m_xVertOrientLB
;
165 DECL_LINK(PageBreakHdl_Impl
, weld::Toggleable
&, void);
166 DECL_LINK(ApplyCollClickHdl_Impl
, weld::Toggleable
&, void);
167 DECL_LINK(PageBreakPosHdl_Impl
, weld::Toggleable
&, void);
168 DECL_LINK(PageBreakTypeHdl_Impl
, weld::Toggleable
&, void);
169 DECL_LINK(PageNoClickHdl_Impl
, weld::Toggleable
&, void);
170 DECL_LINK(SplitHdl_Impl
, weld::Toggleable
&, void);
171 DECL_LINK(HeadLineCBClickHdl
, weld::Toggleable
&, void);
174 SwTextFlowPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
175 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
176 virtual ~SwTextFlowPage() override
;
177 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
178 virtual void Reset( const SfxItemSet
* rSet
) override
;
180 void SetShell(SwWrtShell
* pSh
);
182 void DisablePageBreak();
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */