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