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