Line data Source code
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 _COLUMN_HXX
21 : #define _COLUMN_HXX
22 :
23 :
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 <vcl/button.hxx>
32 : #include <svtools/ctrlbox.hxx>
33 : #include <svtools/valueset.hxx>
34 : #include <sfx2/basedlgs.hxx>
35 : #include <sfx2/tabdlg.hxx>
36 : #include <fmtclbl.hxx>
37 : #include <colex.hxx>
38 : #include <prcntfld.hxx>
39 :
40 : const int nMaxCols = 99;
41 : class SwColMgr;
42 : class SwWrtShell;
43 : class SwColumnPage;
44 :
45 : class SwColumnDlg : public SfxModalDialog
46 : {
47 : OKButton aOK;
48 : CancelButton aCancel;
49 : HelpButton aHelp;
50 :
51 : FixedText aApplyToFT;
52 : ListBox aApplyToLB;
53 :
54 : SwWrtShell& rWrtShell;
55 : SwColumnPage* pTabPage;
56 : SfxItemSet* pPageSet;
57 : SfxItemSet* pSectionSet;
58 : SfxItemSet* pSelectionSet;
59 : SfxItemSet* pFrameSet;
60 :
61 : long nOldSelection;
62 : long nSelectionWidth;
63 : long nPageWidth;
64 :
65 : sal_Bool bPageChanged : 1;
66 : sal_Bool bSectionChanged : 1;
67 : sal_Bool bSelSectionChanged : 1;
68 : sal_Bool bFrameChanged : 1;
69 :
70 :
71 : DECL_LINK(ObjectHdl, ListBox*);
72 : DECL_LINK(OkHdl, void *);
73 :
74 : public:
75 : SwColumnDlg(Window* pParent, SwWrtShell& rSh);
76 : virtual ~SwColumnDlg();
77 :
78 : SwWrtShell& GetWrtShell() { return rWrtShell; }
79 : };
80 :
81 : class ColumnValueSet : public ValueSet
82 : {
83 : public:
84 0 : ColumnValueSet(Window* pParent, const ResId& rResId) :
85 0 : ValueSet(pParent, rResId){}
86 : ~ColumnValueSet();
87 :
88 : virtual void UserDraw( const UserDrawEvent& rUDEvt );
89 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
90 : };
91 :
92 : /*--------------------------------------------------------------------
93 : Description: column dialog now as TabPage
94 : --------------------------------------------------------------------*/
95 : class SwColumnPage : public SfxTabPage
96 : {
97 : FixedLine aFLGroup;
98 : FixedText aClNrLbl;
99 : NumericField aCLNrEdt;
100 : ColumnValueSet aDefaultVS;
101 : ImageList aPreColsIL;
102 : CheckBox aBalanceColsCB;
103 :
104 : FixedLine aFLLayout;
105 : ImageButton aBtnUp;
106 : FixedText aColumnFT;
107 : FixedText aWidthFT;
108 : FixedText aDistFT;
109 : FixedText aLbl1;
110 : PercentField aEd1;
111 : PercentField aDistEd1;
112 : FixedText aLbl2;
113 : PercentField aEd2;
114 : PercentField aDistEd2;
115 : FixedText aLbl3;
116 : PercentField aEd3;
117 : ImageButton aBtnDown;
118 : CheckBox aAutoWidthBox;
119 :
120 :
121 : FixedLine aFLLineType;
122 : FixedText aLineTypeLbl;
123 : LineListBox aLineTypeDLB;
124 : FixedText aLineWidthLbl;
125 : MetricField aLineWidthEdit;
126 : FixedText aLineColorLbl;
127 : ColorListBox aLineColorDLB;
128 : FixedText aLineHeightLbl;
129 : MetricField aLineHeightEdit;
130 : FixedText aLinePosLbl;
131 : ListBox aLinePosDLB;
132 :
133 : FixedText aTextDirectionFT;
134 : ListBox aTextDirectionLB;
135 :
136 : // Example
137 : SwColExample aPgeExampleWN;
138 : SwColumnOnlyExample aFrmExampleWN;
139 :
140 : SwColMgr* pColMgr;
141 :
142 : sal_uInt16 nFirstVis;
143 : sal_uInt16 nCols;
144 : long nColWidth[nMaxCols];
145 : long nColDist[nMaxCols];
146 : sal_uInt16 nMinWidth;
147 : PercentField *pModifiedField;
148 : sal_Bool bFormat;
149 : sal_Bool bFrm;
150 : sal_Bool bHtmlMode;
151 : sal_Bool bLockUpdate;
152 :
153 : // Handler
154 : DECL_LINK( ColModify, NumericField * );
155 : DECL_LINK( GapModify, PercentField * );
156 : DECL_LINK( EdModify, PercentField * );
157 : DECL_LINK( AutoWidthHdl, CheckBox * );
158 : DECL_LINK( SetDefaultsHdl, ValueSet * );
159 :
160 : DECL_LINK(Up, void *);
161 : DECL_LINK(Down, void *);
162 : DECL_LINK( UpdateColMgr, void* );
163 : void Apply(Button *);
164 : void Timeout();
165 :
166 : void Update();
167 : void UpdateCols();
168 : void Init();
169 : void ResetColWidth();
170 : void SetLabels( sal_uInt16 nVis );
171 :
172 : using SfxTabPage::ActivatePage;
173 : using SfxTabPage::DeactivatePage;
174 :
175 : virtual void ActivatePage(const SfxItemSet& rSet);
176 : virtual int DeactivatePage(SfxItemSet *pSet);
177 :
178 : SwColumnPage(Window *pParent, const SfxItemSet &rSet);
179 :
180 : public:
181 : virtual ~SwColumnPage();
182 :
183 : static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
184 : static sal_uInt16* GetRanges();
185 :
186 : virtual sal_Bool FillItemSet(SfxItemSet &rSet);
187 : virtual void Reset(const SfxItemSet &rSet);
188 :
189 : void SetFrmMode(sal_Bool bMod);
190 : void SetPageWidth(long nPageWidth);
191 :
192 0 : void SetFormatUsed(sal_Bool bFmt) { bFormat = bFmt; }
193 :
194 0 : void ShowBalance(sal_Bool bShow) {aBalanceColsCB.Show(bShow);}
195 : void SetInSection(sal_Bool bSet);
196 :
197 0 : void ActivateColumnControl() {aCLNrEdt.GrabFocus();}
198 : };
199 :
200 : #endif
201 :
202 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|