xref: /aoo41x/main/cui/source/inc/chardlg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_CHARDLG_HXX
28 #define _SVX_CHARDLG_HXX
29 
30 // include ---------------------------------------------------------------
31 
32 #include <svtools/ctrlbox.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <sfx2/tabdlg.hxx>
35 #include <svx/fntctrl.hxx>
36 #include <svx/checklbx.hxx>
37 #include <svx/langbox.hxx>
38 
39 // forward ---------------------------------------------------------------
40 
41 class SvxFontListItem;
42 class FontList;
43 
44 // -----------------------------------------------------------------------
45 
46 #define DISABLE_CASEMAP				((sal_uInt16)0x0001)
47 #define DISABLE_WORDLINE			((sal_uInt16)0x0002)
48 #define DISABLE_BLINK				((sal_uInt16)0x0004)
49 #define DISABLE_UNDERLINE_COLOR		((sal_uInt16)0x0008)
50 
51 #define DISABLE_LANGUAGE			((sal_uInt16)0x0010)
52 #define DISABLE_HIDE_LANGUAGE		((sal_uInt16)0x0020)
53 
54 // class SvxCharBasePage -------------------------------------------------
55 
56 class SvxCharBasePage : public SfxTabPage
57 {
58 protected:
59 	SvxFontPrevWindow	m_aPreviewWin;
60 	FixedInfo			m_aFontTypeFT;
61 
62 	sal_Bool				m_bPreviewBackgroundToCharacter;
63 
64 						SvxCharBasePage( Window* pParent, const ResId& rResIdTabPage, const SfxItemSet&,
65 											sal_uInt16 nResIdPrewievWin, sal_uInt16 nResIdFontTypeFT );
66 	virtual				~SvxCharBasePage();
67 
68 	void				SetPrevFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont );
69 	void				SetPrevFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont );
70 	void				SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nSlotPosture, sal_uInt16 nSlotWeight, SvxFont& rFont ); // posture/weight
71 	void				SetPrevFontWidthScale( const SfxItemSet& rSet );
72 
73 	void				SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
74 
75 	inline SvxFont&		GetPreviewFont();
76 	inline SvxFont&		GetPreviewCJKFont();
77 	inline SvxFont&		GetPreviewCTLFont();
78 
79 public:
80     using SfxTabPage::ActivatePage;
81     using SfxTabPage::DeactivatePage;
82 
83     virtual void        ActivatePage( const SfxItemSet& rSet );
84 //    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
85 
86 };
87 
88 // class SvxCharNamePage -------------------------------------------------
89 
90 struct SvxCharNamePage_Impl;
91 
92 class SvxCharNamePage : public SvxCharBasePage
93 {
94 
95 private:
96     FixedLine*          m_pWestLine;
97     FixedText*          m_pWestFontNameFT;
98     FontNameBox*        m_pWestFontNameLB;
99     FixedText*          m_pWestFontStyleFT;
100     FontStyleBox*       m_pWestFontStyleLB;
101     FixedText*          m_pWestFontSizeFT;
102     FontSizeBox*        m_pWestFontSizeLB;
103     FixedText*          m_pWestFontLanguageFT;
104     SvxLanguageBox*     m_pWestFontLanguageLB;
105 
106     FixedLine*          m_pEastLine;
107     FixedText*          m_pEastFontNameFT;
108     FontNameBox*        m_pEastFontNameLB;
109     FixedText*          m_pEastFontStyleFT;
110     FontStyleBox*       m_pEastFontStyleLB;
111     FixedText*          m_pEastFontSizeFT;
112     FontSizeBox*        m_pEastFontSizeLB;
113     FixedText*          m_pEastFontLanguageFT;
114     SvxLanguageBox*     m_pEastFontLanguageLB;
115 
116     FixedLine*          m_pCTLLine;
117     FixedText*          m_pCTLFontNameFT;
118     FontNameBox*        m_pCTLFontNameLB;
119     FixedText*          m_pCTLFontStyleFT;
120     FontStyleBox*       m_pCTLFontStyleLB;
121     FixedText*          m_pCTLFontSizeFT;
122     FontSizeBox*        m_pCTLFontSizeLB;
123     FixedText*          m_pCTLFontLanguageFT;
124     SvxLanguageBox*     m_pCTLFontLanguageLB;
125 
126     FixedLine*          m_pColorFL;
127     FixedText*          m_pColorFT;
128     ColorListBox*       m_pColorLB;
129 
130 	SvxCharNamePage_Impl*	m_pImpl;
131 
132 						SvxCharNamePage( Window* pParent, const SfxItemSet& rSet );
133 
134 	void				Initialize();
135 	const FontList*		GetFontList() const;
136 	void                UpdatePreview_Impl();
137 	void                FillStyleBox_Impl( const FontNameBox* rBox );
138 	void                FillSizeBox_Impl( const FontNameBox* rBox );
139 
140 	enum LanguageGroup
141 	{
142 		/** Language for western text.
143 		 */
144 		Western = 0,
145 
146 		/** Language for asian text.
147 		 */
148 		Asian,
149 
150 		/** Language for ctl text.
151 		 */
152 		Ctl
153 	};
154 
155 	void				Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
156 	sal_Bool				FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );
157 	void				ResetColor_Impl( const SfxItemSet& rSet );
158 
159 	DECL_LINK( 			UpdateHdl_Impl, Timer* );
160 	DECL_LINK(			FontModifyHdl_Impl, void* );
161 	DECL_LINK( 			ColorBoxSelectHdl_Impl, ColorListBox* );
162 
163 public:
164     using SfxTabPage::ActivatePage;
165     using SfxTabPage::DeactivatePage;
166 
167     virtual void        ActivatePage( const SfxItemSet& rSet );
168 	virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
169 
170 public:
171 						~SvxCharNamePage();
172 
173 	static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
174 	static sal_uInt16*      GetRanges();
175 
176 	virtual void        Reset( const SfxItemSet& rSet );
177 	virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
178 
179 	void                SetFontList( const SvxFontListItem& rItem );
180 	void                EnableRelativeMode();
181 	void				EnableSearchMode();
182     //                  the writer uses SID_ATTR_BRUSH as font background
183     void                SetPreviewBackgroundToCharacter();
184 
185 	void                DisableControls( sal_uInt16 nDisable );
186 	virtual void		PageCreated (SfxAllItemSet aSet);
187 };
188 
189 // class SvxCharEffectsPage ----------------------------------------------
190 
191 class SvxCharEffectsPage : public SvxCharBasePage
192 {
193 
194 private:
195 	FixedText			m_aFontColorFT;
196 	ColorListBox		m_aFontColorLB;
197 
198 	FixedText			m_aEffectsFT;
199 	SvxCheckListBox		m_aEffectsLB;
200 
201 	ListBox				m_aEffects2LB;
202 
203     FixedText           m_aReliefFT;
204     ListBox             m_aReliefLB;
205 
206     TriStateBox         m_aOutlineBtn;
207 	TriStateBox			m_aShadowBtn;
208 	TriStateBox			m_aBlinkingBtn;
209     TriStateBox         m_aHiddenBtn;
210 
211 	FixedLine			m_aVerticalLine;
212 
213 	FixedText			m_aOverlineFT;
214 	ListBox				m_aOverlineLB;
215 	FixedText			m_aOverlineColorFT;
216 	ColorListBox		m_aOverlineColorLB;
217 
218 	FixedText			m_aStrikeoutFT;
219 	ListBox				m_aStrikeoutLB;
220 
221 	FixedText			m_aUnderlineFT;
222 	ListBox				m_aUnderlineLB;
223 	FixedText			m_aUnderlineColorFT;
224 	ColorListBox		m_aUnderlineColorLB;
225 
226 	CheckBox			m_aIndividualWordsBtn;
227 
228 	FixedLine			m_aAsianLine;
229 
230 	FixedText			m_aEmphasisFT;
231 	ListBox				m_aEmphasisLB;
232 
233 	FixedText			m_aPositionFT;
234 	ListBox				m_aPositionLB;
235 
236 	sal_uInt16				m_nHtmlMode;
237 
238 	String				m_aTransparentColorName;
239 
240 						SvxCharEffectsPage( Window* pParent, const SfxItemSet& rSet );
241 
242 	void				Initialize();
243 	void                UpdatePreview_Impl();
244 	void                SetCaseMap_Impl( SvxCaseMap eCaseMap );
245 	void				ResetColor_Impl( const SfxItemSet& rSet );
246 	sal_Bool				FillItemSetColor_Impl( SfxItemSet& rSet );
247 
248 	DECL_LINK(			SelectHdl_Impl, ListBox* );
249     DECL_LINK(          CbClickHdl_Impl, CheckBox* );
250     DECL_LINK(          TristClickHdl_Impl, TriStateBox* );
251 	DECL_LINK(			UpdatePreview_Impl, ListBox* );
252 	DECL_LINK( 			ColorBoxSelectHdl_Impl, ColorListBox* );
253 
254 public:
255 //    using SfxTabPage::ActivatePage;
256     using SfxTabPage::DeactivatePage;
257 
258 //    virtual void        ActivatePage( const SfxItemSet& rSet );
259     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
260 
261 public:
262 	static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
263 	static sal_uInt16*      GetRanges();
264 
265 	virtual void        Reset( const SfxItemSet& rSet );
266 	virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
267 
268 	void                DisableControls( sal_uInt16 nDisable );
269 	void                EnableFlash();
270     //                  the writer uses SID_ATTR_BRUSH as font background
271     void                SetPreviewBackgroundToCharacter();
272 	virtual void		PageCreated (SfxAllItemSet aSet);
273 };
274 
275 // class SvxCharPositionPage ---------------------------------------------
276 
277 class SvxCharPositionPage : public SvxCharBasePage
278 {
279 
280 private:
281 	FixedLine			m_aPositionLine;
282 	RadioButton			m_aHighPosBtn;
283 	RadioButton			m_aNormalPosBtn;
284 	RadioButton			m_aLowPosBtn;
285 	FixedText			m_aHighLowFT;
286 	MetricField			m_aHighLowEdit;
287 	CheckBox			m_aHighLowRB;
288 	FixedText			m_aFontSizeFT;
289 	MetricField			m_aFontSizeEdit;
290 	FixedLine			m_aRotationScalingFL;
291 	FixedLine			m_aScalingFL;
292 	RadioButton			m_a0degRB;
293 	RadioButton			m_a90degRB;
294 	RadioButton			m_a270degRB;
295 	CheckBox			m_aFitToLineCB;
296 	FixedText			m_aScaleWidthFT;
297 	MetricField			m_aScaleWidthMF;
298 
299 	FixedLine			m_aKerningLine;
300 	ListBox				m_aKerningLB;
301 	FixedText			m_aKerningFT;
302 	MetricField			m_aKerningEdit;
303 	CheckBox			m_aPairKerningBtn;
304 
305 	short               m_nSuperEsc;
306 	short               m_nSubEsc;
307 
308 	sal_uInt16				m_nScaleWidthItemSetVal;
309 	sal_uInt16				m_nScaleWidthInitialVal;
310 
311 	sal_uInt8                m_nSuperProp;
312 	sal_uInt8                m_nSubProp;
313 
314 						SvxCharPositionPage( Window* pParent, const SfxItemSet& rSet );
315 
316 	void				Initialize();
317 	void                UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
318 	void                SetEscapement_Impl( sal_uInt16 nEsc );
319 
320 	DECL_LINK(			PositionHdl_Impl, RadioButton* );
321 	DECL_LINK(			RotationHdl_Impl, RadioButton* );
322 	DECL_LINK(			FontModifyHdl_Impl, MetricField* );
323 	DECL_LINK(			AutoPositionHdl_Impl, CheckBox* );
324 	DECL_LINK(			FitToLineHdl_Impl, CheckBox* );
325 	DECL_LINK(			KerningSelectHdl_Impl, ListBox* );
326 	DECL_LINK(			KerningModifyHdl_Impl, MetricField* );
327 	DECL_LINK( 			PairKerningHdl_Impl, CheckBox* );
328 	DECL_LINK(			LoseFocusHdl_Impl, MetricField* );
329 	DECL_LINK(			ScaleWidthModifyHdl_Impl, MetricField* );
330 
331 public:
332     using SfxTabPage::ActivatePage;
333     using SfxTabPage::DeactivatePage;
334 
335     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
336     virtual void        ActivatePage( const SfxItemSet& rSet );
337 
338 public:
339 	static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
340 	static sal_uInt16*      GetRanges();
341 
342 	virtual void        Reset( const SfxItemSet& rSet );
343 	virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
344 	virtual void        FillUserData();
345     //                  the writer uses SID_ATTR_BRUSH as font background
346     void                SetPreviewBackgroundToCharacter();
347 	virtual void		PageCreated (SfxAllItemSet aSet);
348 };
349 
350 // class SvxCharTwoLinesPage ---------------------------------------------
351 
352 class SvxCharTwoLinesPage : public SvxCharBasePage
353 {
354 private:
355 	FixedLine			m_aSwitchOnLine;
356 	CheckBox			m_aTwoLinesBtn;
357 
358 	FixedLine			m_aEncloseLine;
359 	FixedText			m_aStartBracketFT;
360 	ListBox				m_aStartBracketLB;
361 	FixedText			m_aEndBracketFT;
362 	ListBox				m_aEndBracketLB;
363 
364 	sal_uInt16				m_nStartBracketPosition;
365 	sal_uInt16				m_nEndBracketPosition;
366 
367 						SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rSet );
368 
369 	void				UpdatePreview_Impl();
370 	void				Initialize();
371 	void				SelectCharacter( ListBox* pBox );
372 	void				SetBracket( sal_Unicode cBracket, sal_Bool bStart );
373 
374 	DECL_LINK( 			TwoLinesHdl_Impl, CheckBox* );
375 	DECL_LINK(			CharacterMapHdl_Impl, ListBox* );
376 
377 public:
378     using SfxTabPage::ActivatePage;
379     using SfxTabPage::DeactivatePage;
380 
381     virtual void        ActivatePage( const SfxItemSet& rSet );
382 	virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
383 
384 public:
385 	static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
386 	static sal_uInt16*      GetRanges();
387 
388 	virtual void        Reset( const SfxItemSet& rSet );
389 	virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
390     //                  the writer uses SID_ATTR_BRUSH as font background
391     void                SetPreviewBackgroundToCharacter();
392 	virtual void		PageCreated (SfxAllItemSet aSet);
393 };
394 
395 #endif // #ifndef _SVX_CHARDLG_HXX
396 
397