xref: /aoo42x/main/sw/source/ui/inc/column.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _COLUMN_HXX
29 #define _COLUMN_HXX
30 
31 
32 #ifndef _FIXED_HXX //autogen
33 #include <vcl/fixed.hxx>
34 #endif
35 #ifndef _FIELD_HXX //autogen
36 #include <vcl/field.hxx>
37 #endif
38 #ifndef _IMAGE_HXX //autogen
39 #include <vcl/image.hxx>
40 #endif
41 #ifndef _GROUP_HXX //autogen
42 #include <vcl/group.hxx>
43 #endif
44 #ifndef _LSTBOX_HXX //autogen
45 #include <vcl/lstbox.hxx>
46 #endif
47 #ifndef _BUTTON_HXX //autogen
48 #include <vcl/button.hxx>
49 #endif
50 #include <vcl/timer.hxx>
51 #ifndef _IMAGEBTN_HXX //autogen
52 #include <vcl/button.hxx>
53 #endif
54 #include <svtools/ctrlbox.hxx>
55 #include <svtools/valueset.hxx>
56 #include <sfx2/basedlgs.hxx>
57 #include <sfx2/tabdlg.hxx>
58 #include <fmtclbl.hxx>
59 #include <colex.hxx>
60 #include <prcntfld.hxx>
61 
62 const int nMaxCols = 99;
63 class SwColMgr;
64 class SwWrtShell;
65 class SwColumnPage;
66 /*--------------------------------------------------------------------
67 	Beschreibung:
68  --------------------------------------------------------------------*/
69 
70 class SwColumnDlg : public SfxModalDialog
71 {
72 	OKButton 			aOK;
73 	CancelButton 		aCancel;
74 	HelpButton 			aHelp;
75 
76 	FixedText			aApplyToFT;
77 	ListBox				aApplyToLB;
78 
79 	SwWrtShell& 		rWrtShell;
80 	SwColumnPage*		pTabPage;
81 	SfxItemSet* 		pPageSet;
82 	SfxItemSet* 		pSectionSet;
83 	SfxItemSet* 		pSelectionSet;
84 	SfxItemSet* 		pFrameSet;
85 
86 	long				nOldSelection;
87 	long 				nSelectionWidth;
88 	long 				nPageWidth;
89 
90 	sal_Bool				bPageChanged : 1;
91 	sal_Bool				bSectionChanged : 1;
92 	sal_Bool				bSelSectionChanged : 1;
93 	sal_Bool				bFrameChanged : 1;
94 
95 
96 	DECL_LINK(ObjectHdl, ListBox*);
97 	DECL_LINK(OkHdl, OKButton*);
98 
99 public:
100 	SwColumnDlg(Window* pParent, SwWrtShell& rSh);
101 	virtual ~SwColumnDlg();
102 
103 	SwWrtShell& 	GetWrtShell()	{ return rWrtShell; }
104 };
105 
106 /*-----------------07.03.97 08.26-------------------
107 
108 --------------------------------------------------*/
109 class ColumnValueSet : public ValueSet
110 {
111 	public:
112 		ColumnValueSet(Window* pParent, const ResId& rResId) :
113 			ValueSet(pParent, rResId){}
114 		~ColumnValueSet();
115 
116 	virtual void	UserDraw( const UserDrawEvent& rUDEvt );
117     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
118 };
119 
120 /*--------------------------------------------------------------------
121 	Beschreibung:	Spaltendialog jetzt als TabPage
122  --------------------------------------------------------------------*/
123 class SwColumnPage : public SfxTabPage
124 {
125 	FixedLine		aFLGroup;
126 	FixedText		aClNrLbl;
127 	NumericField	aCLNrEdt;
128 	ColumnValueSet	aDefaultVS;
129 	ImageList		aPreColsIL;
130 	CheckBox		aBalanceColsCB;
131 
132 	FixedLine		aFLLayout;
133 	ImageButton		aBtnUp;
134     FixedText       aColumnFT;
135 	FixedText		aWidthFT;
136 	FixedText		aDistFT;
137     FixedText       aLbl1;
138 	PercentField	aEd1;
139 	PercentField	aDistEd1;
140     FixedText       aLbl2;
141 	PercentField	aEd2;
142 	PercentField	aDistEd2;
143     FixedText       aLbl3;
144 	PercentField	aEd3;
145 	ImageButton		aBtnDown;
146 	CheckBox		aAutoWidthBox;
147 
148 
149 	FixedLine		aFLLineType;
150 	FixedText		aLineTypeLbl;
151 	LineListBox		aLineTypeDLB;
152 	FixedText		aLineHeightLbl;
153 	MetricField		aLineHeightEdit;
154 	FixedText		aLinePosLbl;
155 	ListBox			aLinePosDLB;
156 
157     FixedLine       aVertFL;
158     FixedLine       aPropertiesFL;
159     FixedText       aTextDirectionFT;
160     ListBox         aTextDirectionLB;
161 
162     // Example
163 	SwColExample 		aPgeExampleWN;
164 	SwColumnOnlyExample	aFrmExampleWN;
165 
166 	SwColMgr*       pColMgr;
167 
168 	sal_uInt16			nFirstVis;
169 	sal_uInt16			nCols;
170 	long			nColWidth[nMaxCols];
171 	long			nColDist[nMaxCols];
172 	sal_uInt16			nMinWidth;
173 	PercentField	*pModifiedField;
174 	sal_Bool 			bFormat;
175 	sal_Bool			bFrm;
176 	sal_Bool 			bHtmlMode;
177 	sal_Bool			bLockUpdate;
178 
179 	// Handler
180 	DECL_LINK( ColModify, NumericField * );
181 	DECL_LINK( GapModify, PercentField * );
182 	DECL_LINK( EdModify, PercentField * );
183 	DECL_LINK( AutoWidthHdl, CheckBox * );
184 	DECL_LINK( Timeout, Timer * );
185 	DECL_LINK( SetDefaultsHdl, ValueSet * );
186 
187 	DECL_LINK( Up, Button * );
188 	DECL_LINK( Down, Button * );
189 	void			Apply(Button *);
190 	DECL_LINK( UpdateColMgr, void* );
191 
192 	void			Update();
193 	void			UpdateCols();
194 	void			Init();
195 	void			ResetColWidth();
196 	void			SetLabels( sal_uInt16 nVis );
197 
198     using SfxTabPage::ActivatePage;
199     using SfxTabPage::DeactivatePage;
200 
201 	virtual void 	ActivatePage(const SfxItemSet& rSet);
202 	virtual int 	DeactivatePage(SfxItemSet *pSet);
203 
204 	SwColumnPage(Window *pParent, const SfxItemSet &rSet);
205 
206 public:
207     virtual ~SwColumnPage();
208 
209 	static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
210 	static sal_uInt16* GetRanges();
211 
212 	virtual sal_Bool 	FillItemSet(SfxItemSet &rSet);
213 	virtual void 	Reset(const SfxItemSet &rSet);
214 
215 	void SetFrmMode(sal_Bool bMod);
216 	void SetPageWidth(long nPageWidth);
217 
218 	void SetFormatUsed(sal_Bool bFmt) { bFormat = bFmt; }
219 
220 	void ShowBalance(sal_Bool bShow) {aBalanceColsCB.Show(bShow);}
221     void SetInSection(sal_Bool bSet);
222 
223     void ActivateColumnControl() {aCLNrEdt.GrabFocus();}
224 };
225 
226 #endif
227 
228