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