xref: /AOO41X/main/sw/source/ui/inc/column.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _COLUMN_HXX
25 #define _COLUMN_HXX
26 
27 
28 #ifndef _FIXED_HXX //autogen
29 #include <vcl/fixed.hxx>
30 #endif
31 #ifndef _FIELD_HXX //autogen
32 #include <vcl/field.hxx>
33 #endif
34 #ifndef _IMAGE_HXX //autogen
35 #include <vcl/image.hxx>
36 #endif
37 #ifndef _GROUP_HXX //autogen
38 #include <vcl/group.hxx>
39 #endif
40 #ifndef _LSTBOX_HXX //autogen
41 #include <vcl/lstbox.hxx>
42 #endif
43 #ifndef _BUTTON_HXX //autogen
44 #include <vcl/button.hxx>
45 #endif
46 #include <vcl/timer.hxx>
47 #ifndef _IMAGEBTN_HXX //autogen
48 #include <vcl/button.hxx>
49 #endif
50 #include <svtools/ctrlbox.hxx>
51 #include <svtools/valueset.hxx>
52 #include <sfx2/basedlgs.hxx>
53 #include <sfx2/tabdlg.hxx>
54 #include <fmtclbl.hxx>
55 #include <colex.hxx>
56 #include <prcntfld.hxx>
57 
58 const int nMaxCols = 99;
59 class SwColMgr;
60 class SwWrtShell;
61 class SwColumnPage;
62 /*--------------------------------------------------------------------
63     Beschreibung:
64  --------------------------------------------------------------------*/
65 
66 class SwColumnDlg : public SfxModalDialog
67 {
68     OKButton            aOK;
69     CancelButton        aCancel;
70     HelpButton          aHelp;
71 
72     FixedText           aApplyToFT;
73     ListBox             aApplyToLB;
74 
75     SwWrtShell&         rWrtShell;
76     SwColumnPage*       pTabPage;
77     SfxItemSet*         pPageSet;
78     SfxItemSet*         pSectionSet;
79     SfxItemSet*         pSelectionSet;
80     SfxItemSet*         pFrameSet;
81 
82     long                nOldSelection;
83     long                nSelectionWidth;
84     long                nPageWidth;
85 
86     sal_Bool                bPageChanged : 1;
87     sal_Bool                bSectionChanged : 1;
88     sal_Bool                bSelSectionChanged : 1;
89     sal_Bool                bFrameChanged : 1;
90 
91 
92     DECL_LINK(ObjectHdl, ListBox*);
93     DECL_LINK(OkHdl, OKButton*);
94 
95 public:
96     SwColumnDlg(Window* pParent, SwWrtShell& rSh);
97     virtual ~SwColumnDlg();
98 
GetWrtShell()99     SwWrtShell&     GetWrtShell()   { return rWrtShell; }
100 };
101 
102 /*-----------------07.03.97 08.26-------------------
103 
104 --------------------------------------------------*/
105 class ColumnValueSet : public ValueSet
106 {
107     public:
ColumnValueSet(Window * pParent,const ResId & rResId)108         ColumnValueSet(Window* pParent, const ResId& rResId) :
109             ValueSet(pParent, rResId){}
110         ~ColumnValueSet();
111 
112     virtual void    UserDraw( const UserDrawEvent& rUDEvt );
113     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
114 };
115 
116 /*--------------------------------------------------------------------
117     Beschreibung:   Spaltendialog jetzt als TabPage
118  --------------------------------------------------------------------*/
119 class SwColumnPage : public SfxTabPage
120 {
121     FixedLine       aFLGroup;
122     FixedText       aClNrLbl;
123     NumericField    aCLNrEdt;
124     ColumnValueSet  aDefaultVS;
125     ImageList       aPreColsIL;
126     CheckBox        aBalanceColsCB;
127 
128     FixedLine       aFLLayout;
129     ImageButton     aBtnUp;
130     FixedText       aColumnFT;
131     FixedText       aWidthFT;
132     FixedText       aDistFT;
133     FixedText       aLbl1;
134     PercentField    aEd1;
135     PercentField    aDistEd1;
136     FixedText       aLbl2;
137     PercentField    aEd2;
138     PercentField    aDistEd2;
139     FixedText       aLbl3;
140     PercentField    aEd3;
141     ImageButton     aBtnDown;
142     CheckBox        aAutoWidthBox;
143 
144 
145     FixedLine       aFLLineType;
146     FixedText       aLineTypeLbl;
147     LineListBox     aLineTypeDLB;
148     FixedText       aLineHeightLbl;
149     MetricField     aLineHeightEdit;
150     FixedText       aLinePosLbl;
151     ListBox         aLinePosDLB;
152 
153     FixedLine       aVertFL;
154     FixedLine       aPropertiesFL;
155     FixedText       aTextDirectionFT;
156     ListBox         aTextDirectionLB;
157 
158     // Example
159     SwColExample        aPgeExampleWN;
160     SwColumnOnlyExample aFrmExampleWN;
161 
162     SwColMgr*       pColMgr;
163 
164     sal_uInt16          nFirstVis;
165     sal_uInt16          nCols;
166     long            nColWidth[nMaxCols];
167     long            nColDist[nMaxCols];
168     sal_uInt16          nMinWidth;
169     PercentField    *pModifiedField;
170     sal_Bool            bFormat;
171     sal_Bool            bFrm;
172     sal_Bool            bHtmlMode;
173     sal_Bool            bLockUpdate;
174 
175     // Handler
176     DECL_LINK( ColModify, NumericField * );
177     DECL_LINK( GapModify, PercentField * );
178     DECL_LINK( EdModify, PercentField * );
179     DECL_LINK( AutoWidthHdl, CheckBox * );
180     DECL_LINK( Timeout, Timer * );
181     DECL_LINK( SetDefaultsHdl, ValueSet * );
182 
183     DECL_LINK( Up, Button * );
184     DECL_LINK( Down, Button * );
185     void            Apply(Button *);
186     DECL_LINK( UpdateColMgr, void* );
187 
188     void            Update();
189     void            UpdateCols();
190     void            Init();
191     void            ResetColWidth();
192     void            SetLabels( sal_uInt16 nVis );
193 
194     using SfxTabPage::ActivatePage;
195     using SfxTabPage::DeactivatePage;
196 
197     virtual void    ActivatePage(const SfxItemSet& rSet);
198     virtual int     DeactivatePage(SfxItemSet *pSet);
199 
200     SwColumnPage(Window *pParent, const SfxItemSet &rSet);
201 
202 public:
203     virtual ~SwColumnPage();
204 
205     static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
206     static sal_uInt16* GetRanges();
207 
208     virtual sal_Bool    FillItemSet(SfxItemSet &rSet);
209     virtual void    Reset(const SfxItemSet &rSet);
210 
211     void SetFrmMode(sal_Bool bMod);
212     void SetPageWidth(long nPageWidth);
213 
SetFormatUsed(sal_Bool bFmt)214     void SetFormatUsed(sal_Bool bFmt) { bFormat = bFmt; }
215 
ShowBalance(sal_Bool bShow)216     void ShowBalance(sal_Bool bShow) {aBalanceColsCB.Show(bShow);}
217     void SetInSection(sal_Bool bSet);
218 
ActivateColumnControl()219     void ActivateColumnControl() {aCLNrEdt.GrabFocus();}
220 };
221 
222 #endif
223 
224