bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / column.hxx
blob8cb80c152e0101f9d9cebb703929b9bc20ffdf59
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _COLUMN_HXX
21 #define _COLUMN_HXX
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>
39 const int nMaxCols = 99;
40 class SwColMgr;
41 class SwWrtShell;
42 class SwColumnPage;
44 class SwColumnDlg : public SfxModalDialog
46 ListBox* m_pApplyToLB;
48 SwWrtShell& rWrtShell;
49 SwColumnPage* pTabPage;
50 SfxItemSet* pPageSet;
51 SfxItemSet* pSectionSet;
52 SfxItemSet* pSelectionSet;
53 SfxItemSet* pFrameSet;
55 long nOldSelection;
56 long nSelectionWidth;
57 long nPageWidth;
59 bool bPageChanged : 1;
60 bool bSectionChanged : 1;
61 bool bSelSectionChanged : 1;
62 bool bFrameChanged : 1;
65 DECL_LINK(ObjectHdl, ListBox*);
66 DECL_LINK(OkHdl, void *);
68 public:
69 SwColumnDlg(Window* pParent, SwWrtShell& rSh);
70 virtual ~SwColumnDlg();
72 SwWrtShell& GetWrtShell() { return rWrtShell; }
75 class ColumnValueSet : public ValueSet
77 public:
78 ColumnValueSet(Window* pParent, const ResId& rResId)
79 : ValueSet(pParent, rResId)
82 ColumnValueSet(Window* pParent)
83 : ValueSet(pParent, WB_TABSTOP | WB_ITEMBORDER | WB_DOUBLEBORDER)
86 virtual void UserDraw( const UserDrawEvent& rUDEvt );
87 virtual void DataChanged( const DataChangedEvent& rDCEvt );
90 /*--------------------------------------------------------------------
91 Description: column dialog now as TabPage
92 --------------------------------------------------------------------*/
93 class SwColumnPage : public SfxTabPage
95 NumericField* m_pCLNrEdt;
96 ColumnValueSet* m_pDefaultVS;
97 CheckBox* m_pBalanceColsCB;
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;
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;
122 FixedText* m_pTextDirectionFT;
123 ListBox* m_pTextDirectionLB;
125 // Example
126 SwColExample* m_pPgeExampleWN;
127 SwColumnOnlyExample* m_pFrmExampleWN;
129 SwColMgr* pColMgr;
131 sal_uInt16 nFirstVis;
132 sal_uInt16 nCols;
133 long nColWidth[nMaxCols];
134 long nColDist[nMaxCols];
135 sal_uInt16 nMinWidth;
136 PercentFieldWrap* pModifiedField;
138 std::map<MetricField*, PercentFieldWrap*> m_aPercentFieldWrappersMap;
140 sal_Bool bFormat;
141 sal_Bool bFrm;
142 sal_Bool bHtmlMode;
143 bool bLockUpdate;
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 * );
152 DECL_LINK(Up, void *);
153 DECL_LINK(Down, void *);
154 DECL_LINK( UpdateColMgr, void* );
155 void Apply(Button *);
156 void Timeout();
158 void Update();
159 void UpdateCols();
160 void Init();
161 void ResetColWidth();
162 void SetLabels( sal_uInt16 nVis );
164 using SfxTabPage::ActivatePage;
165 using SfxTabPage::DeactivatePage;
167 virtual void ActivatePage(const SfxItemSet& rSet);
168 virtual int DeactivatePage(SfxItemSet *pSet);
170 SwColumnPage(Window *pParent, const SfxItemSet &rSet);
172 void connectPercentFieldWrapper(PercentFieldWrap &rWrap, const OString &rName);
174 public:
175 virtual ~SwColumnPage();
177 static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
178 static sal_uInt16* GetRanges();
180 virtual sal_Bool FillItemSet(SfxItemSet &rSet);
181 virtual void Reset(const SfxItemSet &rSet);
183 void SetFrmMode(sal_Bool bMod);
184 void SetPageWidth(long nPageWidth);
186 void SetFormatUsed(sal_Bool bFmt)
188 bFormat = bFmt;
191 void ShowBalance(sal_Bool bShow)
193 m_pBalanceColsCB->Show(bShow);
196 void SetInSection(sal_Bool bSet);
198 void ActivateColumnControl()
200 m_pCLNrEdt->GrabFocus();
204 #endif
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */