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 .
24 #include <vcl/fixed.hxx>
25 #include <vcl/field.hxx>
26 #include <vcl/image.hxx>
27 #include <vcl/group.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/timer.hxx>
31 #include <svtools/ctrlbox.hxx>
32 #include <svtools/valueset.hxx>
33 #include <sfx2/basedlgs.hxx>
34 #include <sfx2/tabdlg.hxx>
35 #include <fmtclbl.hxx>
37 #include <prcntfld.hxx>
39 const int nMaxCols
= 99;
44 class SwColumnDlg
: public SfxModalDialog
46 ListBox
* m_pApplyToLB
;
48 SwWrtShell
& rWrtShell
;
49 SwColumnPage
* pTabPage
;
51 SfxItemSet
* pSectionSet
;
52 SfxItemSet
* pSelectionSet
;
53 SfxItemSet
* pFrameSet
;
59 bool bPageChanged
: 1;
60 bool bSectionChanged
: 1;
61 bool bSelSectionChanged
: 1;
62 bool bFrameChanged
: 1;
65 DECL_LINK(ObjectHdl
, ListBox
*);
66 DECL_LINK(OkHdl
, void *);
69 SwColumnDlg(Window
* pParent
, SwWrtShell
& rSh
);
70 virtual ~SwColumnDlg();
72 SwWrtShell
& GetWrtShell() { return rWrtShell
; }
75 class ColumnValueSet
: public ValueSet
78 ColumnValueSet(Window
* pParent
, const ResId
& rResId
)
79 : ValueSet(pParent
, rResId
)
82 ColumnValueSet(Window
* pParent
)
83 : ValueSet(pParent
, WB_TABSTOP
| WB_ITEMBORDER
| WB_DOUBLEBORDER
)
86 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
87 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
90 /*--------------------------------------------------------------------
91 Description: column dialog now as TabPage
92 --------------------------------------------------------------------*/
93 class SwColumnPage
: public SfxTabPage
95 NumericField
* m_pCLNrEdt
;
96 ColumnValueSet
* m_pDefaultVS
;
97 CheckBox
* m_pBalanceColsCB
;
99 PushButton
* m_pBtnBack
;
101 PercentFieldWrap aEd1
;
103 PercentFieldWrap aEd2
;
105 PercentFieldWrap aEd3
;
106 PushButton
* m_pBtnNext
;
107 PercentFieldWrap aDistEd1
;
108 PercentFieldWrap aDistEd2
;
109 CheckBox
* m_pAutoWidthBox
;
111 FixedText
* m_pLineTypeLbl
;
112 LineListBox
* m_pLineTypeDLB
;
113 FixedText
* m_pLineWidthLbl
;
114 MetricField
* m_pLineWidthEdit
;
115 FixedText
* m_pLineColorLbl
;
116 ColorListBox
* m_pLineColorDLB
;
117 FixedText
* m_pLineHeightLbl
;
118 MetricField
* m_pLineHeightEdit
;
119 FixedText
* m_pLinePosLbl
;
120 ListBox
* m_pLinePosDLB
;
122 FixedText
* m_pTextDirectionFT
;
123 ListBox
* m_pTextDirectionLB
;
126 SwColExample
* m_pPgeExampleWN
;
127 SwColumnOnlyExample
* m_pFrmExampleWN
;
131 sal_uInt16 nFirstVis
;
133 long nColWidth
[nMaxCols
];
134 long nColDist
[nMaxCols
];
135 sal_uInt16 nMinWidth
;
136 PercentFieldWrap
* pModifiedField
;
138 std::map
<MetricField
*, PercentFieldWrap
*> m_aPercentFieldWrappersMap
;
146 DECL_LINK( ColModify
, NumericField
* );
147 DECL_LINK( GapModify
, MetricField
* );
148 DECL_LINK( EdModify
, MetricField
* );
149 DECL_LINK( AutoWidthHdl
, CheckBox
* );
150 DECL_LINK( SetDefaultsHdl
, ValueSet
* );
152 DECL_LINK(Up
, void *);
153 DECL_LINK(Down
, void *);
154 DECL_LINK( UpdateColMgr
, void* );
155 void Apply(Button
*);
161 void ResetColWidth();
162 void SetLabels( sal_uInt16 nVis
);
164 using SfxTabPage::ActivatePage
;
165 using SfxTabPage::DeactivatePage
;
167 virtual void ActivatePage(const SfxItemSet
& rSet
);
168 virtual int DeactivatePage(SfxItemSet
*pSet
);
170 SwColumnPage(Window
*pParent
, const SfxItemSet
&rSet
);
172 void connectPercentFieldWrapper(PercentFieldWrap
&rWrap
, const OString
&rName
);
175 virtual ~SwColumnPage();
177 static SfxTabPage
*Create(Window
*pParent
, const SfxItemSet
&rSet
);
178 static sal_uInt16
* GetRanges();
180 virtual sal_Bool
FillItemSet(SfxItemSet
&rSet
);
181 virtual void Reset(const SfxItemSet
&rSet
);
183 void SetFrmMode(sal_Bool bMod
);
184 void SetPageWidth(long nPageWidth
);
186 void SetFormatUsed(sal_Bool bFmt
)
191 void ShowBalance(sal_Bool bShow
)
193 m_pBalanceColsCB
->Show(bShow
);
196 void SetInSection(sal_Bool bSet
);
198 void ActivateColumnControl()
200 m_pCLNrEdt
->GrabFocus();
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */