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 <svtools/ctrlbox.hxx>
32 : #include <svtools/valueset.hxx>
33 : #include <sfx2/basedlgs.hxx>
34 : #include <sfx2/tabdlg.hxx>
35 : #include <fmtclbl.hxx>
36 : #include <colex.hxx>
37 : #include <prcntfld.hxx>
38 :
39 : const int nMaxCols = 99;
40 : class SwColMgr;
41 : class SwWrtShell;
42 : class SwColumnPage;
43 :
44 : class SwColumnDlg : public SfxModalDialog
45 : {
46 : ListBox* m_pApplyToLB;
47 :
48 : SwWrtShell& rWrtShell;
49 : SwColumnPage* pTabPage;
50 : SfxItemSet* pPageSet;
51 : SfxItemSet* pSectionSet;
52 : SfxItemSet* pSelectionSet;
53 : SfxItemSet* pFrameSet;
54 :
55 : long nOldSelection;
56 : long nSelectionWidth;
57 : long nPageWidth;
58 :
59 : bool bPageChanged : 1;
60 : bool bSectionChanged : 1;
61 : bool bSelSectionChanged : 1;
62 : bool bFrameChanged : 1;
63 :
64 :
65 : DECL_LINK(ObjectHdl, ListBox*);
66 : DECL_LINK(OkHdl, void *);
67 :
68 : public:
69 : SwColumnDlg(Window* pParent, SwWrtShell& rSh);
70 : virtual ~SwColumnDlg();
71 :
72 : SwWrtShell& GetWrtShell() { return rWrtShell; }
73 : };
74 :
75 0 : class ColumnValueSet : public ValueSet
76 : {
77 : public:
78 : ColumnValueSet(Window* pParent, const ResId& rResId)
79 : : ValueSet(pParent, rResId)
80 : {
81 : }
82 0 : ColumnValueSet(Window* pParent)
83 0 : : ValueSet(pParent, WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER)
84 : {
85 0 : }
86 : virtual void UserDraw( const UserDrawEvent& rUDEvt );
87 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
88 : };
89 :
90 : /*--------------------------------------------------------------------
91 : Description: column dialog now as TabPage
92 : --------------------------------------------------------------------*/
93 : class SwColumnPage : public SfxTabPage
94 : {
95 : NumericField* m_pCLNrEdt;
96 : ColumnValueSet* m_pDefaultVS;
97 : CheckBox* m_pBalanceColsCB;
98 :
99 : PushButton* m_pBtnBack;
100 : FixedText* m_pLbl1;
101 : PercentFieldWrap aEd1;
102 : FixedText* m_pLbl2;
103 : PercentFieldWrap aEd2;
104 : FixedText* m_pLbl3;
105 : PercentFieldWrap aEd3;
106 : PushButton* m_pBtnNext;
107 : PercentFieldWrap aDistEd1;
108 : PercentFieldWrap aDistEd2;
109 : CheckBox* m_pAutoWidthBox;
110 :
111 : FixedText* m_pLineTypeLbl;
112 : LineListBox* m_pLineTypeDLB;
113 : FixedText* m_pLineWidthLbl;
114 : MetricField* m_pLineWidthEdit;
115 : FixedText* m_pLineColorLbl;
116 : ColorListBox* m_pLineColorDLB;
117 : FixedText* m_pLineHeightLbl;
118 : MetricField* m_pLineHeightEdit;
119 : FixedText* m_pLinePosLbl;
120 : ListBox* m_pLinePosDLB;
121 :
122 : FixedText* m_pTextDirectionFT;
123 : ListBox* m_pTextDirectionLB;
124 :
125 : // Example
126 : SwColExample* m_pPgeExampleWN;
127 : SwColumnOnlyExample* m_pFrmExampleWN;
128 :
129 : SwColMgr* pColMgr;
130 :
131 : sal_uInt16 nFirstVis;
132 : sal_uInt16 nCols;
133 : long nColWidth[nMaxCols];
134 : long nColDist[nMaxCols];
135 : sal_uInt16 nMinWidth;
136 : PercentFieldWrap* pModifiedField;
137 :
138 : std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap;
139 :
140 : sal_Bool bFormat;
141 : sal_Bool bFrm;
142 : sal_Bool bHtmlMode;
143 : bool bLockUpdate;
144 :
145 : // Handler
146 : DECL_LINK( ColModify, NumericField * );
147 : DECL_LINK( GapModify, MetricField * );
148 : DECL_LINK( EdModify, MetricField * );
149 : DECL_LINK( AutoWidthHdl, CheckBox * );
150 : DECL_LINK( SetDefaultsHdl, ValueSet * );
151 :
152 : DECL_LINK(Up, void *);
153 : DECL_LINK(Down, void *);
154 : DECL_LINK( UpdateColMgr, void* );
155 : void Apply(Button *);
156 : void Timeout();
157 :
158 : void Update();
159 : void UpdateCols();
160 : void Init();
161 : void ResetColWidth();
162 : void SetLabels( sal_uInt16 nVis );
163 :
164 : using SfxTabPage::ActivatePage;
165 : using SfxTabPage::DeactivatePage;
166 :
167 : virtual void ActivatePage(const SfxItemSet& rSet);
168 : virtual int DeactivatePage(SfxItemSet *pSet);
169 :
170 : SwColumnPage(Window *pParent, const SfxItemSet &rSet);
171 :
172 : void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
173 :
174 : public:
175 : virtual ~SwColumnPage();
176 :
177 : static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
178 : static sal_uInt16* GetRanges();
179 :
180 : virtual sal_Bool FillItemSet(SfxItemSet &rSet);
181 : virtual void Reset(const SfxItemSet &rSet);
182 :
183 : void SetFrmMode(sal_Bool bMod);
184 : void SetPageWidth(long nPageWidth);
185 :
186 0 : void SetFormatUsed(sal_Bool bFmt)
187 : {
188 0 : bFormat = bFmt;
189 0 : }
190 :
191 0 : void ShowBalance(sal_Bool bShow)
192 : {
193 0 : m_pBalanceColsCB->Show(bShow);
194 0 : }
195 :
196 : void SetInSection(sal_Bool bSet);
197 :
198 0 : void ActivateColumnControl()
199 : {
200 0 : m_pCLNrEdt->GrabFocus();
201 0 : }
202 : };
203 :
204 : #endif
205 :
206 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|