1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chardlg.cxx,v $
10 * $Revision: 1.102.148.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
38 // include ---------------------------------------------------------------
39 #include <unolingu.hxx>
40 #include <vcl/svapp.hxx>
41 #include <svtools/pathoptions.hxx>
42 #include <svtools/ctrltool.hxx>
43 #include <svtools/sfontitm.hxx>
44 #include <sfx2/printer.hxx>
45 #include <sfx2/objsh.hxx>
46 #include <sfx2/viewsh.hxx>
47 #include <sfx2/bindings.hxx>
48 #include <sfx2/viewfrm.hxx>
49 #include <vcl/msgbox.hxx>
51 #define _SVX_CHARDLG_CXX
52 #include <svtools/languageoptions.hxx>
54 #include <svx/dialogs.hrc>
55 #include <svx/svxitems.hrc>
56 #include "chardlg.hrc"
58 //Erstmal definieren, damit die Klassendeklarionen angezogen werden.
60 #include <svx/xtable.hxx> // XColorTable
61 #include "chardlg.hxx"
62 #include "fontitem.hxx"
63 #include <svx/postitem.hxx>
64 #include <svx/udlnitem.hxx>
65 #include <svx/crsditem.hxx>
66 #include <svx/cntritem.hxx>
67 #include <svx/langitem.hxx>
68 #include <svx/wghtitem.hxx>
69 #include <svx/fhgtitem.hxx>
70 #include <svx/shdditem.hxx>
71 #include <svx/escpitem.hxx>
72 #include <svx/prszitem.hxx>
73 #include <svx/wrlmitem.hxx>
74 #include <svx/cmapitem.hxx>
75 #include <svx/kernitem.hxx>
76 #include <svx/blnkitem.hxx>
77 #include "flstitem.hxx"
78 #include <svx/akrnitem.hxx>
79 #include <svx/brshitem.hxx>
80 #include <svx/colritem.hxx>
81 #include "drawitem.hxx"
82 #include "dlgutil.hxx"
83 #include <svx/dialmgr.hxx>
84 #include "htmlmode.hxx"
85 #include "cuicharmap.hxx"
87 #include <svx/emphitem.hxx>
88 #include <svx/charreliefitem.hxx>
89 #include <svx/twolinesitem.hxx>
90 #include <charhiddenitem.hxx>
91 #include <svtools/stritem.hxx>
92 #include <svx/charscaleitem.hxx>
93 #include <svx/charrotateitem.hxx>
94 #include <svx/svxdlg.hxx> //CHINA001
95 #include <svx/dialogs.hrc> //CHINA001
96 #include <svtools/intitem.hxx> //CHINA001
97 #include <sfx2/request.hxx> //CHINA001
98 #include "flagsdef.hxx" //CHINA001
100 using namespace ::com::sun::star
;
102 // define ----------------------------------------------------------------
104 #define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT
106 #define CLEARTITEM rSet.InvalidateItem(nWhich)
109 #define LW_GESPERRT 1
112 // static ----------------------------------------------------------------
114 static USHORT pNameRanges
[] =
117 SID_ATTR_CHAR_WEIGHT
,
118 SID_ATTR_CHAR_FONTHEIGHT
,
119 SID_ATTR_CHAR_FONTHEIGHT
,
122 SID_ATTR_CHAR_LANGUAGE
,
123 SID_ATTR_CHAR_LANGUAGE
,
124 SID_ATTR_CHAR_CJK_FONT
,
125 SID_ATTR_CHAR_CJK_WEIGHT
,
126 SID_ATTR_CHAR_CTL_FONT
,
127 SID_ATTR_CHAR_CTL_WEIGHT
,
131 static USHORT pEffectsRanges
[] =
133 SID_ATTR_CHAR_SHADOWED
,
134 SID_ATTR_CHAR_UNDERLINE
,
137 SID_ATTR_CHAR_CASEMAP
,
138 SID_ATTR_CHAR_CASEMAP
,
141 SID_ATTR_CHAR_EMPHASISMARK
,
142 SID_ATTR_CHAR_EMPHASISMARK
,
143 SID_ATTR_CHAR_RELIEF
,
144 SID_ATTR_CHAR_RELIEF
,
145 SID_ATTR_CHAR_HIDDEN
,
146 SID_ATTR_CHAR_HIDDEN
,
147 SID_ATTR_CHAR_OVERLINE
,
148 SID_ATTR_CHAR_OVERLINE
,
152 static USHORT pPositionRanges
[] =
154 SID_ATTR_CHAR_KERNING
,
155 SID_ATTR_CHAR_KERNING
,
156 SID_ATTR_CHAR_ESCAPEMENT
,
157 SID_ATTR_CHAR_ESCAPEMENT
,
158 SID_ATTR_CHAR_AUTOKERN
,
159 SID_ATTR_CHAR_AUTOKERN
,
160 SID_ATTR_CHAR_ROTATED
,
161 SID_ATTR_CHAR_SCALEWIDTH
,
162 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
,
163 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
,
167 static USHORT pTwoLinesRanges
[] =
169 SID_ATTR_CHAR_TWO_LINES
,
170 SID_ATTR_CHAR_TWO_LINES
,
174 // C-Funktion ------------------------------------------------------------
176 inline BOOL
StateToAttr( TriState aState
)
178 return ( STATE_CHECK
== aState
);
181 // class SvxCharBasePage -------------------------------------------------
183 inline SvxFont
& SvxCharBasePage::GetPreviewFont()
185 return m_aPreviewWin
.GetFont();
188 // -----------------------------------------------------------------------
190 inline SvxFont
& SvxCharBasePage::GetPreviewCJKFont()
192 return m_aPreviewWin
.GetCJKFont();
194 // -----------------------------------------------------------------------
196 inline SvxFont
& SvxCharBasePage::GetPreviewCTLFont()
198 return m_aPreviewWin
.GetCTLFont();
201 // -----------------------------------------------------------------------
203 SvxCharBasePage::SvxCharBasePage( Window
* pParent
, const ResId
& rResId
, const SfxItemSet
& rItemset
,
204 USHORT nResIdPrewievWin
, USHORT nResIdFontTypeFT
):
205 SfxTabPage( pParent
, rResId
, rItemset
),
206 m_aPreviewWin( this, ResId( nResIdPrewievWin
, *rResId
.GetResMgr() ) ),
207 m_aFontTypeFT( this, ResId( nResIdFontTypeFT
, *rResId
.GetResMgr() ) ),
208 m_bPreviewBackgroundToCharacter( FALSE
)
212 // -----------------------------------------------------------------------
214 SvxCharBasePage::~SvxCharBasePage()
218 // -----------------------------------------------------------------------
220 //void SvxCharBasePage::SetPrevFontAttributes( const SfxItemSet& rSet )
221 void SvxCharBasePage::ActivatePage( const SfxItemSet
& rSet
)
223 SvxFont
& rFont
= GetPreviewFont();
224 SvxFont
& rCJKFont
= GetPreviewCJKFont();
225 SvxFont
& rCTLFont
= GetPreviewCTLFont();
228 nWhich
= GetWhich( SID_CHAR_DLG_PREVIEW_STRING
);
231 const SfxStringItem
& rItem
= ( SfxStringItem
& ) rSet
.Get( nWhich
);
232 ::rtl::OUString aString
= rItem
.GetValue();
233 if( aString
.getLength() != 0 )
234 m_aPreviewWin
.SetPreviewText( aString
);
236 m_aPreviewWin
.SetFontNameAsPreviewText();
240 FontUnderline eUnderline
;
241 nWhich
= GetWhich( SID_ATTR_CHAR_UNDERLINE
);
244 const SvxUnderlineItem
& rItem
= ( SvxUnderlineItem
& ) rSet
.Get( nWhich
);
245 eUnderline
= ( FontUnderline
) rItem
.GetValue();
246 m_aPreviewWin
.SetTextLineColor( rItem
.GetColor() );
249 eUnderline
= UNDERLINE_NONE
;
251 rFont
.SetUnderline( eUnderline
);
252 rCJKFont
.SetUnderline( eUnderline
);
253 rCTLFont
.SetUnderline( eUnderline
);
256 FontUnderline eOverline
;
257 nWhich
= GetWhich( SID_ATTR_CHAR_OVERLINE
);
260 const SvxOverlineItem
& rItem
= ( SvxOverlineItem
& ) rSet
.Get( nWhich
);
261 eOverline
= ( FontUnderline
) rItem
.GetValue();
262 m_aPreviewWin
.SetOverlineColor( rItem
.GetColor() );
265 eOverline
= UNDERLINE_NONE
;
267 rFont
.SetOverline( eOverline
);
268 rCJKFont
.SetOverline( eOverline
);
269 rCTLFont
.SetOverline( eOverline
);
272 FontStrikeout eStrikeout
;
273 nWhich
= GetWhich( SID_ATTR_CHAR_STRIKEOUT
);
276 const SvxCrossedOutItem
& rItem
= ( SvxCrossedOutItem
& ) rSet
.Get( nWhich
);
277 eStrikeout
= ( FontStrikeout
) rItem
.GetValue();
280 eStrikeout
= STRIKEOUT_NONE
;
282 rFont
.SetStrikeout( eStrikeout
);
283 rCJKFont
.SetStrikeout( eStrikeout
);
284 rCTLFont
.SetStrikeout( eStrikeout
);
287 nWhich
= GetWhich( SID_ATTR_CHAR_WORDLINEMODE
);
290 const SvxWordLineModeItem
& rItem
= ( SvxWordLineModeItem
& ) rSet
.Get( nWhich
);
291 rFont
.SetWordLineMode( rItem
.GetValue() );
292 rCJKFont
.SetWordLineMode( rItem
.GetValue() );
293 rCTLFont
.SetWordLineMode( rItem
.GetValue() );
297 nWhich
= GetWhich( SID_ATTR_CHAR_EMPHASISMARK
);
300 const SvxEmphasisMarkItem
& rItem
= ( SvxEmphasisMarkItem
& ) rSet
.Get( nWhich
);
301 FontEmphasisMark eMark
= rItem
.GetEmphasisMark();
302 rFont
.SetEmphasisMark( eMark
);
303 rCJKFont
.SetEmphasisMark( eMark
);
304 rCTLFont
.SetEmphasisMark( eMark
);
308 nWhich
= GetWhich( SID_ATTR_CHAR_RELIEF
);
311 const SvxCharReliefItem
& rItem
= ( SvxCharReliefItem
& ) rSet
.Get( nWhich
);
312 FontRelief eFontRelief
= ( FontRelief
) rItem
.GetValue();
313 rFont
.SetRelief( eFontRelief
);
314 rCJKFont
.SetRelief( eFontRelief
);
315 rCTLFont
.SetRelief( eFontRelief
);
319 nWhich
= GetWhich( SID_ATTR_CHAR_CASEMAP
);
322 const SvxCaseMapItem
& rItem
= ( SvxCaseMapItem
& ) rSet
.Get( nWhich
);
323 SvxCaseMap eCaseMap
= ( SvxCaseMap
) rItem
.GetValue();
324 rFont
.SetCaseMap( eCaseMap
);
325 rCJKFont
.SetCaseMap( eCaseMap
);
326 // #i78474# small caps do not exist in CTL fonts
327 rCTLFont
.SetCaseMap( eCaseMap
== SVX_CASEMAP_KAPITAELCHEN
? SVX_CASEMAP_NOT_MAPPED
: eCaseMap
);
331 nWhich
= GetWhich( SID_ATTR_CHAR_CONTOUR
);
334 const SvxContourItem
& rItem
= ( SvxContourItem
& ) rSet
.Get( nWhich
);
335 BOOL bOutline
= rItem
.GetValue();
336 rFont
.SetOutline( bOutline
);
337 rCJKFont
.SetOutline( bOutline
);
338 rCTLFont
.SetOutline( bOutline
);
342 nWhich
= GetWhich( SID_ATTR_CHAR_SHADOWED
);
345 const SvxShadowedItem
& rItem
= ( SvxShadowedItem
& ) rSet
.Get( nWhich
);
346 BOOL bShadow
= rItem
.GetValue();
347 rFont
.SetShadow( bShadow
);
348 rCJKFont
.SetShadow( bShadow
);
349 rCTLFont
.SetShadow( bShadow
);
354 nWhich
= GetWhich( m_bPreviewBackgroundToCharacter
? SID_ATTR_BRUSH
: SID_ATTR_BRUSH_CHAR
);
357 const SvxBrushItem
& rBrush
= ( SvxBrushItem
& ) rSet
.Get( nWhich
);
358 const Color
& rColor
= rBrush
.GetColor();
359 bTransparent
= rColor
.GetTransparency() > 0;
360 rFont
.SetFillColor( rColor
);
361 rCJKFont
.SetFillColor( rColor
);
362 rCTLFont
.SetFillColor( rColor
);
367 rFont
.SetTransparent( bTransparent
);
368 rCJKFont
.SetTransparent( bTransparent
);
369 rCTLFont
.SetTransparent( bTransparent
);
371 Color
aBackCol( COL_TRANSPARENT
);
372 if( !m_bPreviewBackgroundToCharacter
)
374 nWhich
= GetWhich( SID_ATTR_BRUSH
);
377 const SvxBrushItem
& rBrush
= ( SvxBrushItem
& ) rSet
.Get( nWhich
);
378 if( GPOS_NONE
== rBrush
.GetGraphicPos() )
379 aBackCol
= rBrush
.GetColor();
382 m_aPreviewWin
.SetBackColor( aBackCol
);
385 SetPrevFont( rSet
, SID_ATTR_CHAR_FONT
, rFont
);
386 SetPrevFont( rSet
, SID_ATTR_CHAR_CJK_FONT
, rCJKFont
);
387 SetPrevFont( rSet
, SID_ATTR_CHAR_CTL_FONT
, rCTLFont
);
390 SetPrevFontStyle( rSet
, SID_ATTR_CHAR_POSTURE
, SID_ATTR_CHAR_WEIGHT
, rFont
);
391 SetPrevFontStyle( rSet
, SID_ATTR_CHAR_CJK_POSTURE
, SID_ATTR_CHAR_CJK_WEIGHT
, rCJKFont
);
392 SetPrevFontStyle( rSet
, SID_ATTR_CHAR_CTL_POSTURE
, SID_ATTR_CHAR_CTL_WEIGHT
, rCTLFont
);
395 SetPrevFontSize( rSet
, SID_ATTR_CHAR_FONTHEIGHT
, rFont
);
396 SetPrevFontSize( rSet
, SID_ATTR_CHAR_CJK_FONTHEIGHT
, rCJKFont
);
397 SetPrevFontSize( rSet
, SID_ATTR_CHAR_CTL_FONTHEIGHT
, rCTLFont
);
400 nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
403 const SvxColorItem
& rItem
= ( SvxColorItem
& ) rSet
.Get( nWhich
);
404 Color
aCol( rItem
.GetValue() );
405 rFont
.SetColor( aCol
);
406 rCJKFont
.SetColor( aCol
);
407 rCTLFont
.SetColor( aCol
);
409 m_aPreviewWin
.AutoCorrectFontColor(); // handle color COL_AUTO
413 nWhich
= GetWhich( SID_ATTR_CHAR_KERNING
);
416 const SvxKerningItem
& rItem
= ( SvxKerningItem
& ) rSet
.Get( nWhich
);
417 short nKern
= ( short )
418 LogicToLogic( rItem
.GetValue(), ( MapUnit
) rSet
.GetPool()->GetMetric( nWhich
), MAP_TWIP
);
419 rFont
.SetFixKerning( nKern
);
420 rCJKFont
.SetFixKerning( nKern
);
421 rCTLFont
.SetFixKerning( nKern
);
425 nWhich
= GetWhich( SID_ATTR_CHAR_ESCAPEMENT
);
426 const BYTE nProp
= 100;
431 const SvxEscapementItem
& rItem
= ( SvxEscapementItem
& ) rSet
.Get( nWhich
);
432 nEsc
= rItem
.GetEsc();
433 nEscProp
= rItem
.GetProp();
435 if( nEsc
== DFLT_ESC_AUTO_SUPER
)
436 nEsc
= DFLT_ESC_SUPER
;
437 else if( nEsc
== DFLT_ESC_AUTO_SUB
)
446 SetPrevFontEscapement( nProp
, nEscProp
, nEsc
);
449 SetPrevFontWidthScale( rSet
);
451 m_aPreviewWin
.Invalidate();
454 // -----------------------------------------------------------------------
456 void SvxCharBasePage::SetPrevFontSize( const SfxItemSet
& rSet
, USHORT nSlot
, SvxFont
& rFont
)
458 USHORT nWhich
= GetWhich( nSlot
);
460 if( rSet
.GetItemState( nWhich
) >= SFX_ITEM_SET
)
462 nH
= LogicToLogic( ( ( SvxFontHeightItem
& ) rSet
.Get( nWhich
) ).GetHeight(),
463 ( MapUnit
) rSet
.GetPool()->GetMetric( nWhich
),
467 nH
= 240; // as default 12pt
469 rFont
.SetSize( Size( 0, nH
) );
472 // -----------------------------------------------------------------------
474 void SvxCharBasePage::SetPrevFont( const SfxItemSet
& rSet
, USHORT nSlot
, SvxFont
& rFont
)
476 USHORT nWhich
= GetWhich( nSlot
);
479 const SvxFontItem
& rFontItem
= ( SvxFontItem
& ) rSet
.Get( nWhich
);
480 rFont
.SetFamily( rFontItem
.GetFamily() );
481 rFont
.SetName( rFontItem
.GetFamilyName() );
482 rFont
.SetPitch( rFontItem
.GetPitch() );
483 rFont
.SetCharSet( rFontItem
.GetCharSet() );
484 rFont
.SetStyleName( rFontItem
.GetStyleName() );
488 // -----------------------------------------------------------------------
490 void SvxCharBasePage::SetPrevFontStyle( const SfxItemSet
& rSet
, USHORT nPosture
, USHORT nWeight
, SvxFont
& rFont
)
492 USHORT nWhich
= GetWhich( nPosture
);
495 const SvxPostureItem
& rItem
= ( SvxPostureItem
& ) rSet
.Get( nWhich
);
496 rFont
.SetItalic( ( FontItalic
) rItem
.GetValue() != ITALIC_NONE
? ITALIC_NORMAL
: ITALIC_NONE
);
499 nWhich
= GetWhich( nWeight
);
502 SvxWeightItem
& rItem
= ( SvxWeightItem
& ) rSet
.Get( nWhich
);
503 rFont
.SetWeight( ( FontWeight
) rItem
.GetValue() != WEIGHT_NORMAL
? WEIGHT_BOLD
: WEIGHT_NORMAL
);
507 // -----------------------------------------------------------------------
509 void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet
& rSet
)
511 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
514 const SvxCharScaleWidthItem
& rItem
= ( SvxCharScaleWidthItem
& ) rSet
.Get( nWhich
);
516 m_aPreviewWin
.SetFontWidthScale( rItem
.GetValue() );
520 // -----------------------------------------------------------------------
523 // -----------------------------------------------------------------------
524 void setPrevFontEscapement(SvxFont
& _rFont
,BYTE nProp
, BYTE nEscProp
, short nEsc
)
526 _rFont
.SetPropr( nProp
);
527 _rFont
.SetProprRel( nEscProp
);
528 _rFont
.SetEscapement( nEsc
);
530 // -----------------------------------------------------------------------
531 // -----------------------------------------------------------------------
533 // -----------------------------------------------------------------------
535 void SvxCharBasePage::SetPrevFontEscapement( BYTE nProp
, BYTE nEscProp
, short nEsc
)
537 setPrevFontEscapement(GetPreviewFont(),nProp
,nEscProp
,nEsc
);
538 setPrevFontEscapement(GetPreviewCJKFont(),nProp
,nEscProp
,nEsc
);
539 setPrevFontEscapement(GetPreviewCTLFont(),nProp
,nEscProp
,nEsc
);
540 m_aPreviewWin
.Invalidate();
543 // SvxCharNamePage_Impl --------------------------------------------------
545 struct SvxCharNamePage_Impl
547 Timer m_aUpdateTimer
;
548 String m_aNoStyleText
;
549 String m_aTransparentText
;
550 const FontList
* m_pFontList
;
551 USHORT m_nExtraEntryPos
;
553 BOOL m_bInSearchMode
;
555 SvxCharNamePage_Impl() :
557 m_pFontList ( NULL
),
558 m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND
),
559 m_bMustDelete ( FALSE
),
560 m_bInSearchMode ( FALSE
)
563 m_aUpdateTimer
.SetTimeout( 350 );
566 ~SvxCharNamePage_Impl()
573 // class SvxCharNamePage -------------------------------------------------
575 SvxCharNamePage::SvxCharNamePage( Window
* pParent
, const SfxItemSet
& rInSet
) :
577 SvxCharBasePage( pParent
, SVX_RES( RID_SVXPAGE_CHAR_NAME
), rInSet
, WIN_CHAR_PREVIEW
, FT_CHAR_FONTTYPE
),
578 m_pImpl ( new SvxCharNamePage_Impl
)
580 m_pImpl
->m_aNoStyleText
= String( SVX_RES( STR_CHARNAME_NOSTYLE
) );
581 m_pImpl
->m_aTransparentText
= String( SVX_RES( STR_CHARNAME_TRANSPARENT
) );
583 SvtLanguageOptions aLanguageOptions
;
584 sal_Bool bCJK
= ( aLanguageOptions
.IsCJKFontEnabled() || aLanguageOptions
.IsCTLFontEnabled() );
586 m_pWestLine
= new FixedLine( this, SVX_RES( FL_WEST
) );
587 m_pWestFontNameFT
= new FixedText( this, SVX_RES( bCJK
? FT_WEST_NAME
: FT_WEST_NAME_NOCJK
) );
588 m_pWestFontNameLB
= new FontNameBox( this, SVX_RES( bCJK
? LB_WEST_NAME
: LB_WEST_NAME_NOCJK
) );
589 m_pWestFontStyleFT
= new FixedText( this, SVX_RES( bCJK
? FT_WEST_STYLE
: FT_WEST_STYLE_NOCJK
) );
590 m_pWestFontStyleLB
= new FontStyleBox( this, SVX_RES( bCJK
? LB_WEST_STYLE
: LB_WEST_STYLE_NOCJK
) );
591 m_pWestFontSizeFT
= new FixedText( this, SVX_RES( bCJK
? FT_WEST_SIZE
: FT_WEST_SIZE_NOCJK
) );
592 m_pWestFontSizeLB
= new FontSizeBox( this, SVX_RES( bCJK
? LB_WEST_SIZE
: LB_WEST_SIZE_NOCJK
) );
596 m_pColorFL
= new FixedLine( this, SVX_RES( FL_COLOR2
) );
597 m_pColorFT
= new FixedText( this, SVX_RES( FT_COLOR2
) );
598 m_pColorLB
= new ColorListBox( this, SVX_RES( LB_COLOR2
) );
601 m_pWestFontLanguageFT
= new FixedText( this, SVX_RES( bCJK
? FT_WEST_LANG
: FT_WEST_LANG_NOCJK
) );
602 m_pWestFontLanguageLB
= new SvxLanguageBox( this, SVX_RES( bCJK
? LB_WEST_LANG
: LB_WEST_LANG_NOCJK
) );
604 m_pEastLine
= new FixedLine( this, SVX_RES( FL_EAST
) );
605 m_pEastFontNameFT
= new FixedText( this, SVX_RES( FT_EAST_NAME
) );
606 m_pEastFontNameLB
= new FontNameBox( this, SVX_RES( LB_EAST_NAME
) );
607 m_pEastFontStyleFT
= new FixedText( this, SVX_RES( FT_EAST_STYLE
) );
608 m_pEastFontStyleLB
= new FontStyleBox( this, SVX_RES( LB_EAST_STYLE
) );
609 m_pEastFontSizeFT
= new FixedText( this, SVX_RES( FT_EAST_SIZE
) );
610 m_pEastFontSizeLB
= new FontSizeBox( this, SVX_RES( LB_EAST_SIZE
) );
611 m_pEastFontLanguageFT
= new FixedText( this, SVX_RES( FT_EAST_LANG
) );
612 m_pEastFontLanguageLB
= new SvxLanguageBox( this, SVX_RES( LB_EAST_LANG
) );
614 m_pCTLLine
= new FixedLine( this, SVX_RES( FL_CTL
) );
615 m_pCTLFontNameFT
= new FixedText( this, SVX_RES( FT_CTL_NAME
) );
616 m_pCTLFontNameLB
= new FontNameBox( this, SVX_RES( LB_CTL_NAME
) );
617 m_pCTLFontStyleFT
= new FixedText( this, SVX_RES( FT_CTL_STYLE
) );
618 m_pCTLFontStyleLB
= new FontStyleBox( this, SVX_RES( LB_CTL_STYLE
) );
619 m_pCTLFontSizeFT
= new FixedText( this, SVX_RES( FT_CTL_SIZE
) );
620 m_pCTLFontSizeLB
= new FontSizeBox( this, SVX_RES( LB_CTL_SIZE
) );
621 m_pCTLFontLanguageFT
= new FixedText( this, SVX_RES( FT_CTL_LANG
) );
622 m_pCTLFontLanguageLB
= new SvxLanguageBox( this, SVX_RES( LB_CTL_LANG
) );
626 m_pColorFL
= new FixedLine( this, SVX_RES( FL_COLOR2
) );
627 m_pColorFT
= new FixedText( this, SVX_RES( FT_COLOR2
) );
628 m_pColorLB
= new ColorListBox( this, SVX_RES( LB_COLOR2
) );
631 m_pWestLine
->Show( bCJK
);
632 m_pColorFL
->Show( bCJK
);
634 bCJK
= aLanguageOptions
.IsCJKFontEnabled();
635 m_pEastLine
->Show( bCJK
);
636 m_pEastFontNameFT
->Show( bCJK
);
637 m_pEastFontNameLB
->Show( bCJK
);
638 m_pEastFontStyleFT
->Show( bCJK
);
639 m_pEastFontStyleLB
->Show( bCJK
);
640 m_pEastFontSizeFT
->Show( bCJK
);
641 m_pEastFontSizeLB
->Show( bCJK
);
642 m_pEastFontLanguageFT
->Show( bCJK
);
643 m_pEastFontLanguageLB
->Show( bCJK
);
645 sal_Bool bShowCTL
= aLanguageOptions
.IsCTLFontEnabled();
646 if ( bShowCTL
&& !bCJK
)
648 // move CTL controls to the places of the CJK controls, if these controls aren't visible
649 m_pCTLLine
->SetPosPixel( m_pEastLine
->GetPosPixel() );
650 m_pCTLFontNameFT
->SetPosPixel( m_pEastFontNameFT
->GetPosPixel() );
651 m_pCTLFontNameLB
->SetPosPixel( m_pEastFontNameLB
->GetPosPixel() );
652 m_pCTLFontStyleFT
->SetPosPixel( m_pEastFontStyleFT
->GetPosPixel() );
653 m_pCTLFontStyleLB
->SetPosPixel( m_pEastFontStyleLB
->GetPosPixel() );
654 m_pCTLFontSizeFT
->SetPosPixel( m_pEastFontSizeFT
->GetPosPixel() );
655 m_pCTLFontSizeLB
->SetPosPixel( m_pEastFontSizeLB
->GetPosPixel() );
656 m_pCTLFontLanguageFT
->SetPosPixel( m_pEastFontLanguageFT
->GetPosPixel() );
657 m_pCTLFontLanguageLB
->SetPosPixel( m_pEastFontLanguageLB
->GetPosPixel() );
659 m_pCTLLine
->Show( bShowCTL
);
660 m_pCTLFontNameFT
->Show( bShowCTL
);
661 m_pCTLFontNameLB
->Show( bShowCTL
);
662 m_pCTLFontStyleFT
->Show( bShowCTL
);
663 m_pCTLFontStyleLB
->Show( bShowCTL
);
664 m_pCTLFontSizeFT
->Show( bShowCTL
);
665 m_pCTLFontSizeLB
->Show( bShowCTL
);
666 m_pCTLFontLanguageFT
->Show( bShowCTL
);
667 m_pCTLFontLanguageLB
->Show( bShowCTL
);
671 m_pWestFontLanguageLB
->SetLanguageList( LANG_LIST_WESTERN
, TRUE
, FALSE
, TRUE
);
672 m_pEastFontLanguageLB
->SetLanguageList( LANG_LIST_CJK
, TRUE
, FALSE
, TRUE
);
673 m_pCTLFontLanguageLB
->SetLanguageList( LANG_LIST_CTL
, TRUE
, FALSE
, TRUE
);
678 // -----------------------------------------------------------------------
680 SvxCharNamePage::~SvxCharNamePage()
685 delete m_pWestFontNameFT
;
686 delete m_pWestFontNameLB
;
687 delete m_pWestFontStyleFT
;
688 delete m_pWestFontStyleLB
;
689 delete m_pWestFontSizeFT
;
690 delete m_pWestFontSizeLB
;
691 delete m_pWestFontLanguageFT
;
692 delete m_pWestFontLanguageLB
;
695 delete m_pEastFontNameFT
;
696 delete m_pEastFontNameLB
;
697 delete m_pEastFontStyleFT
;
698 delete m_pEastFontStyleLB
;
699 delete m_pEastFontSizeFT
;
700 delete m_pEastFontSizeLB
;
701 delete m_pEastFontLanguageFT
;
702 delete m_pEastFontLanguageLB
;
705 delete m_pCTLFontNameFT
;
706 delete m_pCTLFontNameLB
;
707 delete m_pCTLFontStyleFT
;
708 delete m_pCTLFontStyleLB
;
709 delete m_pCTLFontSizeFT
;
710 delete m_pCTLFontSizeLB
;
711 delete m_pCTLFontLanguageFT
;
712 delete m_pCTLFontLanguageLB
;
719 // -----------------------------------------------------------------------
721 void SvxCharNamePage::Initialize()
723 // to handle the changes of the other pages
724 SetExchangeSupport();
726 // fill the color box
727 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
728 //DBG_ASSERT( pDocSh, "DocShell not found!" );
729 XColorTable
* pColorTable
= NULL
;
730 FASTBOOL bKillTable
= FALSE
;
731 const SfxPoolItem
* pItem
= NULL
;
735 pItem
= pDocSh
->GetItem( SID_COLOR_TABLE
);
737 pColorTable
= ( (SvxColorTableItem
*)pItem
)->GetColorTable();
742 pColorTable
= new XColorTable( SvtPathOptions().GetPalettePath() );
746 m_pColorLB
->SetUpdateMode( FALSE
);
750 SfxViewFrame
* pFrame
= SfxViewFrame::GetFirst( pDocSh
);
751 if( !pFrame
|| SFX_ITEM_DEFAULT
> pFrame
->GetBindings().QueryState(
752 SID_ATTR_AUTO_COLOR_INVALID
, pDummy
))
753 m_pColorLB
->InsertEntry( Color( COL_AUTO
),
754 SVX_RESSTR( RID_SVXSTR_AUTOMATIC
));
756 for ( long i
= 0; i
< pColorTable
->Count(); i
++ )
758 XColorEntry
* pEntry
= pColorTable
->GetColor(i
);
759 m_pColorLB
->InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
762 m_pColorLB
->SetUpdateMode( TRUE
);
767 m_pColorLB
->SetSelectHdl( LINK( this, SvxCharNamePage
, ColorBoxSelectHdl_Impl
) );
769 Link aLink
= LINK( this, SvxCharNamePage
, FontModifyHdl_Impl
);
770 m_pWestFontNameLB
->SetModifyHdl( aLink
);
771 m_pWestFontStyleLB
->SetModifyHdl( aLink
);
772 m_pWestFontSizeLB
->SetModifyHdl( aLink
);
773 m_pEastFontNameLB
->SetModifyHdl( aLink
);
774 m_pEastFontStyleLB
->SetModifyHdl( aLink
);
775 m_pEastFontSizeLB
->SetModifyHdl( aLink
);
776 m_pCTLFontNameLB
->SetModifyHdl( aLink
);
777 m_pCTLFontStyleLB
->SetModifyHdl( aLink
);
778 m_pCTLFontSizeLB
->SetModifyHdl( aLink
);
780 m_pImpl
->m_aUpdateTimer
.SetTimeoutHdl( LINK( this, SvxCharNamePage
, UpdateHdl_Impl
) );
787 // -----------------------------------------------------------------------
789 const FontList
* SvxCharNamePage::GetFontList() const
791 if ( !m_pImpl
->m_pFontList
)
793 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
794 const SfxPoolItem
* pItem
;
796 /* #110771# SvxFontListItem::GetFontList can return NULL */
799 pItem
= pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
802 DBG_ASSERT(NULL
!= ( (SvxFontListItem
*)pItem
)->GetFontList(),
803 "Where is the font list?");
804 m_pImpl
->m_pFontList
= static_cast<const SvxFontListItem
*>(pItem
)->GetFontList()->Clone();
805 m_pImpl
->m_bMustDelete
= TRUE
;
808 if(!m_pImpl
->m_pFontList
)
810 m_pImpl
->m_pFontList
=
811 new FontList( Application::GetDefaultDevice() );
812 m_pImpl
->m_bMustDelete
= TRUE
;
816 return m_pImpl
->m_pFontList
;
819 // -----------------------------------------------------------------------------
822 FontInfo
calcFontInfo( SvxFont
& _rFont
,
823 SvxCharNamePage
* _pPage
,
824 const FontNameBox
* _pFontNameLB
,
825 const FontStyleBox
* _pFontStyleLB
,
826 const FontSizeBox
* _pFontSizeLB
,
827 const FontList
* _pFontList
,
829 USHORT _nFontHeightWhich
)
831 Size aSize
= _rFont
.GetSize();
834 String
sFontName(_pFontNameLB
->GetText());
835 BOOL bFontAvailable
= _pFontList
->IsAvailable( sFontName
);
836 if(bFontAvailable
|| _pFontNameLB
->GetSavedValue() != sFontName
)
837 aFontInfo
= _pFontList
->Get( sFontName
, _pFontStyleLB
->GetText() );
840 //get the font from itemset
841 SfxItemState eState
= _pPage
->GetItemSet().GetItemState( _nFontWhich
);
842 if ( eState
>= SFX_ITEM_DEFAULT
)
844 const SvxFontItem
* pFontItem
= (const SvxFontItem
*)&( _pPage
->GetItemSet().Get( _nFontWhich
) );
845 aFontInfo
.SetName(pFontItem
->GetFamilyName());
846 aFontInfo
.SetStyleName(pFontItem
->GetStyleName());
847 aFontInfo
.SetFamily(pFontItem
->GetFamily());
848 aFontInfo
.SetPitch(pFontItem
->GetPitch());
849 aFontInfo
.SetCharSet(pFontItem
->GetCharSet());
852 if ( _pFontSizeLB
->IsRelative() )
854 DBG_ASSERT( _pPage
->GetItemSet().GetParent(), "No parent set" );
855 const SvxFontHeightItem
& rOldItem
= (SvxFontHeightItem
&)_pPage
->GetItemSet().GetParent()->Get( _nFontHeightWhich
);
857 // alter Wert, skaliert
859 if ( _pFontSizeLB
->IsPtRelative() )
860 nHeight
= rOldItem
.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB
->GetValue() / 10) );
862 nHeight
= static_cast<long>(rOldItem
.GetHeight() * _pFontSizeLB
->GetValue() / 100);
864 // Umrechnung in twips fuer das Beispiel-Window
866 ItemToControl( nHeight
, _pPage
->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich
), SFX_FUNIT_TWIP
);
868 else if ( _pFontSizeLB
->GetText().Len() )
869 aSize
.Height() = PointToTwips( static_cast<long>(_pFontSizeLB
->GetValue() / 10) );
871 aSize
.Height() = 200; // default 10pt
872 aFontInfo
.SetSize( aSize
);
874 _rFont
.SetFamily( aFontInfo
.GetFamily() );
875 _rFont
.SetName( aFontInfo
.GetName() );
876 _rFont
.SetStyleName( aFontInfo
.GetStyleName() );
877 _rFont
.SetPitch( aFontInfo
.GetPitch() );
878 _rFont
.SetCharSet( aFontInfo
.GetCharSet() );
879 _rFont
.SetWeight( aFontInfo
.GetWeight() );
880 _rFont
.SetItalic( aFontInfo
.GetItalic() );
881 _rFont
.SetSize( aFontInfo
.GetSize() );
887 // -----------------------------------------------------------------------
889 void SvxCharNamePage::UpdatePreview_Impl()
891 SvxFont
& rFont
= GetPreviewFont();
892 SvxFont
& rCJKFont
= GetPreviewCJKFont();
893 SvxFont
& rCTLFont
= GetPreviewCTLFont();
895 Size aSize
= rFont
.GetSize();
897 Size aCJKSize
= rCJKFont
.GetSize();
898 aCJKSize
.Width() = 0;
899 Size aCTLSize
= rCTLFont
.GetSize();
900 aCTLSize
.Width() = 0;
902 const FontList
* pFontList
= GetFontList();
904 calcFontInfo(rFont
,this,m_pWestFontNameLB
,m_pWestFontStyleLB
,m_pWestFontSizeLB
,pFontList
,GetWhich( SID_ATTR_CHAR_FONT
),GetWhich( SID_ATTR_CHAR_FONTHEIGHT
));
906 calcFontInfo(rCJKFont
,this,m_pEastFontNameLB
,m_pEastFontStyleLB
,m_pEastFontSizeLB
,pFontList
,GetWhich( SID_ATTR_CHAR_CJK_FONT
),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT
));
908 calcFontInfo(rCTLFont
,this,m_pCTLFontNameLB
,m_pCTLFontStyleLB
,m_pCTLFontSizeLB
,pFontList
,GetWhich( SID_ATTR_CHAR_CTL_FONT
),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT
));
910 m_aPreviewWin
.Invalidate();
911 m_aFontTypeFT
.SetText( pFontList
->GetFontMapText( aFontInfo
) );
914 // -----------------------------------------------------------------------
916 void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox
* pNameBox
)
918 const FontList
* pFontList
= GetFontList();
919 DBG_ASSERT( pFontList
, "no fontlist" );
921 FontStyleBox
* pStyleBox
= NULL
;
923 if ( m_pWestFontNameLB
== pNameBox
)
924 pStyleBox
= m_pWestFontStyleLB
;
925 else if ( m_pEastFontNameLB
== pNameBox
)
926 pStyleBox
= m_pEastFontStyleLB
;
927 else if ( m_pCTLFontNameLB
== pNameBox
)
928 pStyleBox
= m_pCTLFontStyleLB
;
931 DBG_ERRORFILE( "invalid font name box" );
934 pStyleBox
->Fill( pNameBox
->GetText(), pFontList
);
936 if ( m_pImpl
->m_bInSearchMode
)
938 // Bei der Suche zus"atzliche Eintr"age:
939 // "Nicht Fett" und "Nicht Kursiv"
940 String aEntry
= m_pImpl
->m_aNoStyleText
;
941 const sal_Char sS
[] = "%1";
942 aEntry
.SearchAndReplaceAscii( sS
, pFontList
->GetBoldStr() );
943 m_pImpl
->m_nExtraEntryPos
= pStyleBox
->InsertEntry( aEntry
);
944 aEntry
= m_pImpl
->m_aNoStyleText
;
945 aEntry
.SearchAndReplaceAscii( sS
, pFontList
->GetItalicStr() );
946 pStyleBox
->InsertEntry( aEntry
);
950 // -----------------------------------------------------------------------
952 void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox
* pNameBox
)
954 const FontList
* pFontList
= GetFontList();
955 DBG_ASSERT( pFontList
, "no fontlist" );
957 FontStyleBox
* pStyleBox
= NULL
;
958 FontSizeBox
* pSizeBox
= NULL
;
960 if ( m_pWestFontNameLB
== pNameBox
)
962 pStyleBox
= m_pWestFontStyleLB
;
963 pSizeBox
= m_pWestFontSizeLB
;
965 else if ( m_pEastFontNameLB
== pNameBox
)
967 pStyleBox
= m_pEastFontStyleLB
;
968 pSizeBox
= m_pEastFontSizeLB
;
970 else if ( m_pCTLFontNameLB
== pNameBox
)
972 pStyleBox
= m_pCTLFontStyleLB
;
973 pSizeBox
= m_pCTLFontSizeLB
;
977 DBG_ERRORFILE( "invalid font name box" );
980 FontInfo
_aFontInfo( pFontList
->Get( pNameBox
->GetText(), pStyleBox
->GetText() ) );
981 pSizeBox
->Fill( &_aFontInfo
, pFontList
);
984 // -----------------------------------------------------------------------
986 void SvxCharNamePage::Reset_Impl( const SfxItemSet
& rSet
, LanguageGroup eLangGrp
)
988 FixedText
* pNameLabel
= NULL
;
989 FontNameBox
* pNameBox
= NULL
;
990 FixedText
* pStyleLabel
= NULL
;
991 FontStyleBox
* pStyleBox
= NULL
;
992 FixedText
* pSizeLabel
= NULL
;
993 FontSizeBox
* pSizeBox
= NULL
;
994 FixedText
* pLangFT
= NULL
;
995 SvxLanguageBox
* pLangBox
= NULL
;
1001 pNameLabel
= m_pWestFontNameFT
;
1002 pNameBox
= m_pWestFontNameLB
;
1003 pStyleLabel
= m_pWestFontStyleFT
;
1004 pStyleBox
= m_pWestFontStyleLB
;
1005 pSizeLabel
= m_pWestFontSizeFT
;
1006 pSizeBox
= m_pWestFontSizeLB
;
1007 pLangFT
= m_pWestFontLanguageFT
;
1008 pLangBox
= m_pWestFontLanguageLB
;
1009 nWhich
= GetWhich( SID_ATTR_CHAR_FONT
);
1013 pNameLabel
= m_pEastFontNameFT
;
1014 pNameBox
= m_pEastFontNameLB
;
1015 pStyleLabel
= m_pEastFontStyleFT
;
1016 pStyleBox
= m_pEastFontStyleLB
;
1017 pSizeLabel
= m_pEastFontSizeFT
;
1018 pSizeBox
= m_pEastFontSizeLB
;
1019 pLangFT
= m_pEastFontLanguageFT
;
1020 pLangBox
= m_pEastFontLanguageLB
;
1021 nWhich
= GetWhich( SID_ATTR_CHAR_CJK_FONT
);
1025 pNameLabel
= m_pCTLFontNameFT
;
1026 pNameBox
= m_pCTLFontNameLB
;
1027 pStyleLabel
= m_pCTLFontStyleFT
;
1028 pStyleBox
= m_pCTLFontStyleLB
;
1029 pSizeLabel
= m_pCTLFontSizeFT
;
1030 pSizeBox
= m_pCTLFontSizeLB
;
1031 pLangFT
= m_pCTLFontLanguageFT
;
1032 pLangBox
= m_pCTLFontLanguageLB
;
1033 nWhich
= GetWhich( SID_ATTR_CHAR_CTL_FONT
);
1037 // die FontListBox fuellen
1038 const FontList
* pFontList
= GetFontList();
1039 pNameBox
->Fill( pFontList
);
1042 const SvxFontItem
* pFontItem
= NULL
;
1043 SfxItemState eState
= rSet
.GetItemState( nWhich
);
1045 if ( eState
>= SFX_ITEM_DEFAULT
)
1047 pFontItem
= (const SvxFontItem
*)&( rSet
.Get( nWhich
) );
1048 pNameBox
->SetText( pFontItem
->GetFamilyName() );
1052 pNameBox
->SetText( String() );
1055 FillStyleBox_Impl( pNameBox
);
1057 FASTBOOL bStyle
= FALSE
;
1058 FASTBOOL bStyleAvailable
= TRUE
;
1059 FontItalic eItalic
= ITALIC_NONE
;
1060 FontWeight eWeight
= WEIGHT_NORMAL
;
1063 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_POSTURE
); break;
1064 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_POSTURE
); break;
1065 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_POSTURE
); break;
1067 eState
= rSet
.GetItemState( nWhich
);
1069 if ( eState
>= SFX_ITEM_DEFAULT
)
1071 const SvxPostureItem
& rItem
= (SvxPostureItem
&)rSet
.Get( nWhich
);
1072 eItalic
= (FontItalic
)rItem
.GetValue();
1075 bStyleAvailable
= bStyleAvailable
&& (eState
>= SFX_ITEM_DONTCARE
);
1079 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_WEIGHT
); break;
1080 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_WEIGHT
); break;
1081 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_WEIGHT
); break;
1083 eState
= rSet
.GetItemState( nWhich
);
1085 if ( eState
>= SFX_ITEM_DEFAULT
)
1087 SvxWeightItem
& rItem
= (SvxWeightItem
&)rSet
.Get( nWhich
);
1088 eWeight
= (FontWeight
)rItem
.GetValue();
1092 bStyleAvailable
= bStyleAvailable
&& (eState
>= SFX_ITEM_DONTCARE
);
1094 // Aktuell eingestellter Font
1095 if ( bStyle
&& pFontItem
)
1097 FontInfo aInfo
= pFontList
->Get( pFontItem
->GetFamilyName(), eWeight
, eItalic
);
1098 pStyleBox
->SetText( pFontList
->GetStyleName( aInfo
) );
1100 else if ( !m_pImpl
->m_bInSearchMode
|| !bStyle
)
1102 pStyleBox
->SetText( String() );
1106 FontInfo aInfo
= pFontList
->Get( String(), eWeight
, eItalic
);
1107 pStyleBox
->SetText( pFontList
->GetStyleName( aInfo
) );
1109 if (!bStyleAvailable
)
1111 pStyleBox
->Disable( );
1112 pStyleLabel
->Disable( );
1116 FillSizeBox_Impl( pNameBox
);
1119 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_FONTHEIGHT
); break;
1120 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT
); break;
1121 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT
); break;
1123 eState
= rSet
.GetItemState( nWhich
);
1125 if ( pSizeBox
->IsRelativeMode() )
1127 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
1128 const SvxFontHeightItem
& rItem
= (SvxFontHeightItem
&)rSet
.Get( nWhich
);
1130 if( rItem
.GetProp() != 100 || SFX_MAPUNIT_RELATIVE
!= rItem
.GetPropUnit() )
1132 BOOL bPtRel
= SFX_MAPUNIT_POINT
== rItem
.GetPropUnit();
1133 pSizeBox
->SetPtRelative( bPtRel
);
1134 pSizeBox
->SetValue( bPtRel
? ((short)rItem
.GetProp()) * 10 : rItem
.GetProp() );
1138 pSizeBox
->SetRelative();
1139 pSizeBox
->SetValue( (long)CalcToPoint( rItem
.GetHeight(), eUnit
, 10 ) );
1142 else if ( eState
>= SFX_ITEM_DEFAULT
)
1144 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
1145 const SvxFontHeightItem
& rItem
= (SvxFontHeightItem
&)rSet
.Get( nWhich
);
1146 pSizeBox
->SetValue( (long)CalcToPoint( rItem
.GetHeight(), eUnit
, 10 ) );
1150 pSizeBox
->SetText( String() );
1151 if ( eState
<= SFX_ITEM_READONLY
)
1153 pSizeBox
->Disable( );
1154 pSizeLabel
->Disable( );
1160 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_LANGUAGE
); break;
1161 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE
); break;
1162 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE
); break;
1164 pLangBox
->SetNoSelection();
1165 eState
= rSet
.GetItemState( nWhich
);
1169 case SFX_ITEM_UNKNOWN
:
1174 case SFX_ITEM_DISABLED
:
1175 case SFX_ITEM_READONLY
:
1177 pLangBox
->Disable();
1180 case SFX_ITEM_DEFAULT
:
1183 const SvxLanguageItem
& rItem
= (SvxLanguageItem
&)rSet
.Get( nWhich
);
1184 LanguageType eLangType
= (LanguageType
)rItem
.GetValue();
1185 DBG_ASSERT( eLangType
!= LANGUAGE_SYSTEM
, "LANGUAGE_SYSTEM not allowed" );
1186 if ( eLangType
!= LANGUAGE_DONTKNOW
)
1187 pLangBox
->SelectLanguage( eLangType
);
1192 if ( Western
== eLangGrp
)
1193 m_aFontTypeFT
.SetText( pFontList
->GetFontMapText(
1194 pFontList
->Get( pNameBox
->GetText(), pStyleBox
->GetText() ) ) );
1196 // save these settings
1197 pNameBox
->SaveValue();
1198 pStyleBox
->SaveValue();
1199 pSizeBox
->SaveValue();
1200 pLangBox
->SaveValue();
1203 // -----------------------------------------------------------------------
1205 BOOL
SvxCharNamePage::FillItemSet_Impl( SfxItemSet
& rSet
, LanguageGroup eLangGrp
)
1207 BOOL bModified
= FALSE
;
1209 FontNameBox
* pNameBox
= NULL
;
1210 FontStyleBox
* pStyleBox
= NULL
;
1211 FontSizeBox
* pSizeBox
= NULL
;
1212 SvxLanguageBox
* pLangBox
= NULL
;
1219 pNameBox
= m_pWestFontNameLB
;
1220 pStyleBox
= m_pWestFontStyleLB
;
1221 pSizeBox
= m_pWestFontSizeLB
;
1222 pLangBox
= m_pWestFontLanguageLB
;
1223 nSlot
= SID_ATTR_CHAR_FONT
;
1227 pNameBox
= m_pEastFontNameLB
;
1228 pStyleBox
= m_pEastFontStyleLB
;
1229 pSizeBox
= m_pEastFontSizeLB
;
1230 pLangBox
= m_pEastFontLanguageLB
;
1231 nSlot
= SID_ATTR_CHAR_CJK_FONT
;
1235 pNameBox
= m_pCTLFontNameLB
;
1236 pStyleBox
= m_pCTLFontStyleLB
;
1237 pSizeBox
= m_pCTLFontSizeLB
;
1238 pLangBox
= m_pCTLFontLanguageLB
;
1239 nSlot
= SID_ATTR_CHAR_CTL_FONT
;
1243 nWhich
= GetWhich( nSlot
);
1244 const SfxPoolItem
* pItem
= NULL
;
1245 const SfxItemSet
& rOldSet
= GetItemSet();
1246 const SfxPoolItem
* pOld
= NULL
;
1248 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
1250 FASTBOOL bChanged
= TRUE
;
1251 const String
& rFontName
= pNameBox
->GetText();
1252 const FontList
* pFontList
= GetFontList();
1253 String aStyleBoxText
=pStyleBox
->GetText();
1254 USHORT nEntryPos
= pStyleBox
->GetEntryPos( aStyleBoxText
);
1255 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1256 aStyleBoxText
.Erase();
1257 FontInfo
aInfo( pFontList
->Get( rFontName
, aStyleBoxText
) );
1258 SvxFontItem
aFontItem( aInfo
.GetFamily(), aInfo
.GetName(), aInfo
.GetStyleName(),
1259 aInfo
.GetPitch(), aInfo
.GetCharSet(), nWhich
);
1260 pOld
= GetOldItem( rSet
, nSlot
);
1264 const SvxFontItem
& rItem
= *( (const SvxFontItem
*)pOld
);
1266 if ( rItem
.GetFamilyName() == aFontItem
.GetFamilyName() )
1271 bChanged
= !pNameBox
->GetSavedValue().Len();
1273 if ( !bChanged
&& pExampleSet
&&
1274 pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
1275 ( (SvxFontItem
*)pItem
)->GetFamilyName() != aFontItem
.GetFamilyName() )
1278 if ( bChanged
&& rFontName
.Len() )
1280 rSet
.Put( aFontItem
);
1283 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1284 rSet
.ClearItem( nWhich
);
1290 case Western
: nSlot
= SID_ATTR_CHAR_WEIGHT
; break;
1291 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_WEIGHT
; break;
1292 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_WEIGHT
; break;
1294 nWhich
= GetWhich( nSlot
);
1295 FontWeight eWeight
= aInfo
.GetWeight();
1296 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1297 eWeight
= WEIGHT_NORMAL
;
1298 SvxWeightItem
aWeightItem( eWeight
, nWhich
);
1299 pOld
= GetOldItem( rSet
, nSlot
);
1303 const SvxWeightItem
& rItem
= *( (const SvxWeightItem
*)pOld
);
1305 if ( rItem
.GetValue() == aWeightItem
.GetValue() )
1311 bChanged
= !pStyleBox
->GetSavedValue().Len();
1313 if ( m_pImpl
->m_bInSearchMode
&& bChanged
&&
1314 aInfo
.GetWeight() == WEIGHT_NORMAL
&& aInfo
.GetItalic() != ITALIC_NONE
)
1318 if ( !bChanged
&& pExampleSet
&&
1319 pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
1320 ( (SvxWeightItem
*)pItem
)->GetValue() != aWeightItem
.GetValue() )
1323 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1324 bChanged
= ( nEntryPos
== m_pImpl
->m_nExtraEntryPos
);
1326 String
aText( pStyleBox
->GetText() ); // Tristate, dann Text leer
1328 if ( bChanged
&& aText
.Len() )
1330 rSet
.Put( aWeightItem
);
1333 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1339 case Western
: nSlot
= SID_ATTR_CHAR_POSTURE
; break;
1340 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_POSTURE
; break;
1341 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_POSTURE
; break;
1343 nWhich
= GetWhich( nSlot
);
1344 FontItalic eItalic
= aInfo
.GetItalic();
1345 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1346 eItalic
= ITALIC_NONE
;
1347 SvxPostureItem
aPostureItem( eItalic
, nWhich
);
1348 pOld
= GetOldItem( rSet
, nSlot
);
1352 const SvxPostureItem
& rItem
= *( (const SvxPostureItem
*)pOld
);
1354 if ( rItem
.GetValue() == aPostureItem
.GetValue() )
1360 bChanged
= !pStyleBox
->GetSavedValue().Len();
1362 if ( m_pImpl
->m_bInSearchMode
&& bChanged
&&
1363 aInfo
.GetItalic() == ITALIC_NONE
&& aInfo
.GetWeight() != WEIGHT_NORMAL
)
1367 if ( !bChanged
&& pExampleSet
&&
1368 pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
1369 ( (SvxPostureItem
*)pItem
)->GetValue() != aPostureItem
.GetValue() )
1372 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1373 bChanged
= ( nEntryPos
== ( m_pImpl
->m_nExtraEntryPos
+ 1 ) );
1375 if ( bChanged
&& aText
.Len() )
1377 rSet
.Put( aPostureItem
);
1380 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1384 long nSize
= static_cast<long>(pSizeBox
->GetValue());
1386 if ( !pSizeBox
->GetText().Len() ) // GetValue() gibt dann Min-Wert zurueck
1388 long nSavedSize
= pSizeBox
->GetSavedValue().ToInt32();
1389 FASTBOOL bRel
= TRUE
;
1391 if ( !pSizeBox
->IsRelative() )
1399 case Western
: nSlot
= SID_ATTR_CHAR_FONTHEIGHT
; break;
1400 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_FONTHEIGHT
; break;
1401 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_FONTHEIGHT
; break;
1403 nWhich
= GetWhich( nSlot
);
1404 const SvxFontHeightItem
* pOldHeight
= (const SvxFontHeightItem
*)GetOldItem( rSet
, nSlot
);
1405 bChanged
= ( nSize
!= nSavedSize
);
1407 if ( !bChanged
&& pExampleSet
&&
1408 pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
)
1410 float fSize
= (float)nSize
/ 10;
1411 long nVal
= CalcToUnit( fSize
, rSet
.GetPool()->GetMetric( nWhich
) );
1412 if ( ( (SvxFontHeightItem
*)pItem
)->GetHeight() != (UINT32
)nVal
)
1416 if ( bChanged
|| !pOldHeight
||
1417 bRel
!= ( SFX_MAPUNIT_RELATIVE
!= pOldHeight
->GetPropUnit() || 100 != pOldHeight
->GetProp() ) )
1419 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
1420 if ( pSizeBox
->IsRelative() )
1422 DBG_ASSERT( GetItemSet().GetParent(), "No parent set" );
1423 const SvxFontHeightItem
& rOldItem
=
1424 (const SvxFontHeightItem
&)GetItemSet().GetParent()->Get( nWhich
);
1426 SvxFontHeightItem
aHeight( 240, 100, nWhich
);
1427 if ( pSizeBox
->IsPtRelative() )
1428 aHeight
.SetHeight( rOldItem
.GetHeight(), (USHORT
)( nSize
/ 10 ), SFX_MAPUNIT_POINT
, eUnit
);
1430 aHeight
.SetHeight( rOldItem
.GetHeight(), (USHORT
)nSize
, SFX_MAPUNIT_RELATIVE
);
1431 rSet
.Put( aHeight
);
1435 float fSize
= (float)nSize
/ 10;
1436 rSet
.Put( SvxFontHeightItem( CalcToUnit( fSize
, eUnit
), 100, nWhich
) );
1440 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1446 case Western
: nSlot
= SID_ATTR_CHAR_LANGUAGE
; break;
1447 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_LANGUAGE
; break;
1448 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_LANGUAGE
; break;
1450 nWhich
= GetWhich( nSlot
);
1451 pOld
= GetOldItem( rSet
, nSlot
);
1452 USHORT nLangPos
= pLangBox
->GetSelectEntryPos();
1453 LanguageType eLangType
= (LanguageType
)(ULONG
)pLangBox
->GetEntryData( nLangPos
);
1457 const SvxLanguageItem
& rItem
= *( (const SvxLanguageItem
*)pOld
);
1459 if ( nLangPos
== LISTBOX_ENTRY_NOTFOUND
|| eLangType
== (LanguageType
)rItem
.GetValue() )
1464 bChanged
= ( pLangBox
->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
);
1466 if ( bChanged
&& nLangPos
!= LISTBOX_ENTRY_NOTFOUND
)
1468 rSet
.Put( SvxLanguageItem( eLangType
, nWhich
) );
1471 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1477 // -----------------------------------------------------------------------
1479 void SvxCharNamePage::ResetColor_Impl( const SfxItemSet
& rSet
)
1481 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
1482 SfxItemState eState
= rSet
.GetItemState( nWhich
);
1486 case SFX_ITEM_UNKNOWN
:
1490 case SFX_ITEM_DISABLED
:
1491 case SFX_ITEM_READONLY
:
1492 m_pColorLB
->Disable();
1495 case SFX_ITEM_DONTCARE
:
1496 m_pColorLB
->SetNoSelection();
1499 case SFX_ITEM_DEFAULT
:
1502 SvxFont
& rFont
= GetPreviewFont();
1503 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1504 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1505 const SvxColorItem
& rItem
= (SvxColorItem
&)rSet
.Get( nWhich
);
1506 Color aColor
= rItem
.GetValue();
1507 rFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1508 rCJKFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1509 rCTLFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1510 m_aPreviewWin
.Invalidate();
1511 USHORT nSelPos
= m_pColorLB
->GetEntryPos( aColor
);
1512 if ( nSelPos
== LISTBOX_ENTRY_NOTFOUND
&& aColor
== Color( COL_TRANSPARENT
) )
1513 nSelPos
= m_pColorLB
->GetEntryPos( m_pImpl
->m_aTransparentText
);
1515 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
1516 m_pColorLB
->SelectEntryPos( nSelPos
);
1519 nSelPos
= m_pColorLB
->GetEntryPos( aColor
);
1520 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
1521 m_pColorLB
->SelectEntryPos( nSelPos
);
1523 m_pColorLB
->SelectEntryPos(
1524 m_pColorLB
->InsertEntry( aColor
, String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
1531 // -----------------------------------------------------------------------
1533 BOOL
SvxCharNamePage::FillItemSetColor_Impl( SfxItemSet
& rSet
)
1535 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
1536 const SvxColorItem
* pOld
= (const SvxColorItem
*)GetOldItem( rSet
, SID_ATTR_CHAR_COLOR
);
1537 const SvxColorItem
* pItem
= NULL
;
1538 BOOL bChanged
= TRUE
;
1539 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
1540 const SfxItemSet
& rOldSet
= GetItemSet();
1542 Color aSelectedColor
;
1543 if ( m_pColorLB
->GetSelectEntry() == m_pImpl
->m_aTransparentText
)
1544 aSelectedColor
= Color( COL_TRANSPARENT
);
1546 aSelectedColor
= m_pColorLB
->GetSelectEntryColor();
1548 if ( pOld
&& pOld
->GetValue() == aSelectedColor
)
1552 bChanged
= ( m_pColorLB
->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
);
1554 if ( !bChanged
&& pExampleSet
&&
1555 pExampleSet
->GetItemState( nWhich
, FALSE
, (const SfxPoolItem
**)&pItem
) == SFX_ITEM_SET
&&
1556 ( (SvxColorItem
*)pItem
)->GetValue() != aSelectedColor
)
1559 BOOL bModified
= FALSE
;
1561 if ( bChanged
&& m_pColorLB
->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1563 rSet
.Put( SvxColorItem( aSelectedColor
, nWhich
) );
1566 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
1572 // -----------------------------------------------------------------------
1574 IMPL_LINK( SvxCharNamePage
, UpdateHdl_Impl
, Timer
*, EMPTYARG
)
1576 UpdatePreview_Impl();
1580 // -----------------------------------------------------------------------
1582 IMPL_LINK( SvxCharNamePage
, FontModifyHdl_Impl
, void*, pNameBox
)
1584 m_pImpl
->m_aUpdateTimer
.Start();
1586 if ( m_pWestFontNameLB
== pNameBox
|| m_pEastFontNameLB
== pNameBox
|| m_pCTLFontNameLB
== pNameBox
)
1588 FillStyleBox_Impl( (FontNameBox
*)pNameBox
);
1589 FillSizeBox_Impl( (FontNameBox
*)pNameBox
);
1594 // -----------------------------------------------------------------------
1596 IMPL_LINK( SvxCharNamePage
, ColorBoxSelectHdl_Impl
, ColorListBox
*, pBox
)
1598 SvxFont
& rFont
= GetPreviewFont();
1599 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1600 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1601 Color aSelectedColor
;
1602 if ( pBox
->GetSelectEntry() == m_pImpl
->m_aTransparentText
)
1603 aSelectedColor
= Color( COL_TRANSPARENT
);
1605 aSelectedColor
= pBox
->GetSelectEntryColor();
1606 rFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1607 rCJKFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1608 rCTLFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1609 m_aPreviewWin
.Invalidate();
1613 // -----------------------------------------------------------------------
1615 void SvxCharNamePage::ActivatePage( const SfxItemSet
& rSet
)
1617 SvxCharBasePage::ActivatePage( rSet
);
1619 UpdatePreview_Impl(); // instead of asynchronous calling in ctor
1622 // -----------------------------------------------------------------------
1624 int SvxCharNamePage::DeactivatePage( SfxItemSet
* _pSet
)
1627 FillItemSet( *_pSet
);
1631 // -----------------------------------------------------------------------
1633 SfxTabPage
* SvxCharNamePage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1635 return new SvxCharNamePage( pParent
, rSet
);
1638 // -----------------------------------------------------------------------
1640 USHORT
* SvxCharNamePage::GetRanges()
1645 // -----------------------------------------------------------------------
1647 void SvxCharNamePage::Reset( const SfxItemSet
& rSet
)
1649 Reset_Impl( rSet
, Western
);
1650 Reset_Impl( rSet
, Asian
);
1651 Reset_Impl( rSet
, Ctl
);
1652 ResetColor_Impl( rSet
);
1653 m_pColorLB
->SaveValue();
1655 SetPrevFontWidthScale( rSet
);
1656 UpdatePreview_Impl();
1659 // -----------------------------------------------------------------------
1661 BOOL
SvxCharNamePage::FillItemSet( SfxItemSet
& rSet
)
1663 BOOL bModified
= FillItemSet_Impl( rSet
, Western
);
1664 bModified
|= FillItemSet_Impl( rSet
, Asian
);
1665 bModified
|= FillItemSet_Impl( rSet
, Ctl
);
1666 //! bModified |= FillItemSetColor_Impl( rSet );
1670 // -----------------------------------------------------------------------
1672 void SvxCharNamePage::SetFontList( const SvxFontListItem
& rItem
)
1674 if ( m_pImpl
->m_bMustDelete
)
1676 delete m_pImpl
->m_pFontList
;
1678 m_pImpl
->m_pFontList
= rItem
.GetFontList()->Clone();
1679 m_pImpl
->m_bMustDelete
= TRUE
;
1682 // -----------------------------------------------------------------------
1685 void enableRelativeMode( SvxCharNamePage
* _pPage
, FontSizeBox
* _pFontSizeLB
, USHORT _nHeightWhich
)
1687 _pFontSizeLB
->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5
1689 const SvxFontHeightItem
& rHeightItem
=
1690 (SvxFontHeightItem
&)_pPage
->GetItemSet().GetParent()->Get( _nHeightWhich
);
1691 SfxMapUnit eUnit
= _pPage
->GetItemSet().GetPool()->GetMetric( _nHeightWhich
);
1693 static_cast< short >( CalcToPoint( rHeightItem
.GetHeight(), eUnit
, 1 ) * 10 );
1695 // ausgehend von der akt. Hoehe:
1696 // - negativ bis minimal 2 pt
1697 // - positiv bis maximal 999 pt
1698 _pFontSizeLB
->EnablePtRelativeMode( sal::static_int_cast
< short >(-(nCurHeight
- 20)), (9999 - nCurHeight
), 10 );
1701 // -----------------------------------------------------------------------------
1703 void SvxCharNamePage::EnableRelativeMode()
1705 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" );
1706 enableRelativeMode(this,m_pWestFontSizeLB
,GetWhich( SID_ATTR_CHAR_FONTHEIGHT
));
1707 enableRelativeMode(this,m_pEastFontSizeLB
,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT
));
1708 enableRelativeMode(this,m_pCTLFontSizeLB
,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT
));
1711 // -----------------------------------------------------------------------
1713 void SvxCharNamePage::EnableSearchMode()
1715 m_pImpl
->m_bInSearchMode
= TRUE
;
1717 // -----------------------------------------------------------------------
1718 void SvxCharNamePage::DisableControls( USHORT nDisable
)
1720 if ( DISABLE_LANGUAGE
& nDisable
)
1722 if ( m_pWestFontLanguageFT
) m_pWestFontLanguageFT
->Disable();
1723 if ( m_pWestFontLanguageLB
) m_pWestFontLanguageLB
->Disable();
1724 if ( m_pEastFontLanguageFT
) m_pEastFontLanguageFT
->Disable();
1725 if ( m_pEastFontLanguageLB
) m_pEastFontLanguageLB
->Disable();
1726 if ( m_pCTLFontLanguageFT
) m_pCTLFontLanguageFT
->Disable();
1727 if ( m_pCTLFontLanguageLB
) m_pCTLFontLanguageLB
->Disable();
1730 if ( DISABLE_HIDE_LANGUAGE
& nDisable
)
1732 if ( m_pWestFontLanguageFT
) m_pWestFontLanguageFT
->Hide();
1733 if ( m_pWestFontLanguageLB
) m_pWestFontLanguageLB
->Hide();
1734 if ( m_pEastFontLanguageFT
) m_pEastFontLanguageFT
->Hide();
1735 if ( m_pEastFontLanguageLB
) m_pEastFontLanguageLB
->Hide();
1736 if ( m_pCTLFontLanguageFT
) m_pCTLFontLanguageFT
->Hide();
1737 if ( m_pCTLFontLanguageLB
) m_pCTLFontLanguageLB
->Hide();
1741 // -----------------------------------------------------------------------
1742 void SvxCharNamePage::SetPreviewBackgroundToCharacter()
1744 m_bPreviewBackgroundToCharacter
= sal_True
;
1747 // -----------------------------------------------------------------------
1748 void SvxCharNamePage::PageCreated (SfxAllItemSet aSet
) //add CHINA001
1750 SFX_ITEMSET_ARG (&aSet
,pFontListItem
,SvxFontListItem
,SID_ATTR_CHAR_FONTLIST
,sal_False
);
1751 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
1752 SFX_ITEMSET_ARG (&aSet
,pDisalbeItem
,SfxUInt16Item
,SID_DISABLE_CTL
,sal_False
);
1754 SetFontList(*pFontListItem
);
1755 //CHINA001 SetFontList(pFontListItem->GetFontList());
1759 UINT32 nFlags
=pFlagItem
->GetValue();
1760 if ( ( nFlags
& SVX_RELATIVE_MODE
) == SVX_RELATIVE_MODE
)
1761 EnableRelativeMode();
1762 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
1763 SetPreviewBackgroundToCharacter();
1766 DisableControls(pDisalbeItem
->GetValue());
1768 // class SvxCharEffectsPage ----------------------------------------------
1770 SvxCharEffectsPage::SvxCharEffectsPage( Window
* pParent
, const SfxItemSet
& rInSet
) :
1772 SvxCharBasePage( pParent
, SVX_RES( RID_SVXPAGE_CHAR_EFFECTS
), rInSet
, WIN_EFFECTS_PREVIEW
, FT_EFFECTS_FONTTYPE
),
1774 m_aFontColorFT ( this, SVX_RES( FT_FONTCOLOR
) ),
1775 m_aFontColorLB ( this, SVX_RES( LB_FONTCOLOR
) ),
1777 m_aEffectsFT ( this, SVX_RES( FT_EFFECTS
) ),
1778 m_aEffectsLB ( this, 0 ),
1780 m_aEffects2LB ( this, SVX_RES( LB_EFFECTS2
) ),
1782 m_aReliefFT ( this, SVX_RES( FT_RELIEF
) ),
1783 m_aReliefLB ( this, SVX_RES( LB_RELIEF
) ),
1785 m_aOutlineBtn ( this, SVX_RES( CB_OUTLINE
) ),
1786 m_aShadowBtn ( this, SVX_RES( CB_SHADOW
) ),
1787 m_aBlinkingBtn ( this, SVX_RES( CB_BLINKING
) ),
1788 m_aHiddenBtn ( this, SVX_RES( CB_CHARHIDDEN
) ),
1790 m_aVerticalLine ( this, SVX_RES( FL_EFFECTS_VERTICAL
) ),
1792 m_aOverlineFT ( this, SVX_RES( FT_OVERLINE
) ),
1793 m_aOverlineLB ( this, SVX_RES( LB_OVERLINE
) ),
1794 m_aOverlineColorFT ( this, SVX_RES( FT_OVERLINE_COLOR
) ),
1795 m_aOverlineColorLB ( this, SVX_RES( LB_OVERLINE_COLOR
) ),
1796 m_aStrikeoutFT ( this, SVX_RES( FT_STRIKEOUT
) ),
1797 m_aStrikeoutLB ( this, SVX_RES( LB_STRIKEOUT
) ),
1798 m_aUnderlineFT ( this, SVX_RES( FT_UNDERLINE
) ),
1799 m_aUnderlineLB ( this, SVX_RES( LB_UNDERLINE
) ),
1800 m_aUnderlineColorFT ( this, SVX_RES( FT_UNDERLINE_COLOR
) ),
1801 m_aUnderlineColorLB ( this, SVX_RES( LB_UNDERLINE_COLOR
) ),
1802 m_aIndividualWordsBtn ( this, SVX_RES( CB_INDIVIDUALWORDS
) ),
1804 m_aAsianLine ( this, SVX_RES( FL_EFFECTS_ASIAN
) ),
1806 m_aEmphasisFT ( this, SVX_RES( FT_EMPHASIS
) ),
1807 m_aEmphasisLB ( this, SVX_RES( LB_EMPHASIS
) ),
1808 m_aPositionFT ( this, SVX_RES( FT_POSITION
) ),
1809 m_aPositionLB ( this, SVX_RES( LB_POSITION
) ),
1811 m_aTransparentColorName ( SVX_RES( STR_CHARNAME_TRANSPARENT
) )
1814 m_aEffectsLB
.Hide();
1819 // -----------------------------------------------------------------------
1821 void SvxCharEffectsPage::Initialize()
1823 // to handle the changes of the other pages
1824 SetExchangeSupport();
1827 const SfxPoolItem
* pItem
;
1828 SfxObjectShell
* pShell
;
1829 if ( SFX_ITEM_SET
== GetItemSet().GetItemState( SID_HTML_MODE
, FALSE
, &pItem
) ||
1830 ( NULL
!= ( pShell
= SfxObjectShell::Current() ) &&
1831 NULL
!= ( pItem
= pShell
->GetItem( SID_HTML_MODE
) ) ) )
1833 m_nHtmlMode
= ( (const SfxUInt16Item
*)pItem
)->GetValue();
1834 if ( ( m_nHtmlMode
& HTMLMODE_ON
) == HTMLMODE_ON
)
1836 //!!! hide some controls please
1840 // fill the color box
1841 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
1842 DBG_ASSERT( pDocSh
, "DocShell not found!" );
1843 XColorTable
* pColorTable
= NULL
;
1844 FASTBOOL bKillTable
= FALSE
;
1848 pItem
= pDocSh
->GetItem( SID_COLOR_TABLE
);
1849 if ( pItem
!= NULL
)
1850 pColorTable
= ( (SvxColorTableItem
*)pItem
)->GetColorTable();
1855 pColorTable
= new XColorTable( SvtPathOptions().GetPalettePath() );
1859 m_aUnderlineColorLB
.SetUpdateMode( FALSE
);
1860 m_aOverlineColorLB
.SetUpdateMode( FALSE
);
1861 m_aFontColorLB
.SetUpdateMode( FALSE
);
1864 SfxPoolItem
* pDummy
;
1865 SfxViewFrame
* pFrame
= SfxViewFrame::GetFirst( pDocSh
);
1867 SFX_ITEM_DEFAULT
> pFrame
->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID
, pDummy
) )
1869 m_aUnderlineColorLB
.InsertAutomaticEntry();
1870 m_aOverlineColorLB
.InsertAutomaticEntry();
1871 m_aFontColorLB
.InsertAutomaticEntry();
1874 for ( long i
= 0; i
< pColorTable
->Count(); i
++ )
1876 XColorEntry
* pEntry
= pColorTable
->GetColor(i
);
1877 m_aUnderlineColorLB
.InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1878 m_aOverlineColorLB
.InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1879 m_aFontColorLB
.InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1882 m_aUnderlineColorLB
.SetUpdateMode( TRUE
);
1883 m_aOverlineColorLB
.SetUpdateMode( TRUE
);
1884 m_aFontColorLB
.SetUpdateMode( TRUE
);
1885 m_aFontColorLB
.SetSelectHdl( LINK( this, SvxCharEffectsPage
, ColorBoxSelectHdl_Impl
) );
1891 Link aLink
= LINK( this, SvxCharEffectsPage
, SelectHdl_Impl
);
1892 m_aUnderlineLB
.SetSelectHdl( aLink
);
1893 m_aUnderlineColorLB
.SetSelectHdl( aLink
);
1894 m_aOverlineLB
.SetSelectHdl( aLink
);
1895 m_aOverlineColorLB
.SetSelectHdl( aLink
);
1896 m_aStrikeoutLB
.SetSelectHdl( aLink
);
1897 m_aEmphasisLB
.SetSelectHdl( aLink
);
1898 m_aPositionLB
.SetSelectHdl( aLink
);
1899 m_aEffects2LB
.SetSelectHdl( aLink
);
1900 m_aReliefLB
.SetSelectHdl( aLink
);
1902 m_aUnderlineLB
.SelectEntryPos( 0 );
1903 m_aUnderlineColorLB
.SelectEntryPos( 0 );
1904 m_aOverlineLB
.SelectEntryPos( 0 );
1905 m_aOverlineColorLB
.SelectEntryPos( 0 );
1906 m_aStrikeoutLB
.SelectEntryPos( 0 );
1907 m_aEmphasisLB
.SelectEntryPos( 0 );
1908 m_aPositionLB
.SelectEntryPos( 0 );
1909 SelectHdl_Impl( NULL
);
1910 SelectHdl_Impl( &m_aEmphasisLB
);
1912 m_aEffects2LB
.SelectEntryPos( 0 );
1914 m_aIndividualWordsBtn
.SetClickHdl( LINK( this, SvxCharEffectsPage
, CbClickHdl_Impl
) );
1915 aLink
= LINK( this, SvxCharEffectsPage
, TristClickHdl_Impl
);
1916 m_aOutlineBtn
.SetClickHdl( aLink
);
1917 m_aShadowBtn
.SetClickHdl( aLink
);
1919 if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
1921 m_aAsianLine
.Hide();
1922 m_aEmphasisFT
.Hide();
1923 m_aEmphasisLB
.Hide();
1924 m_aPositionFT
.Hide();
1925 m_aPositionLB
.Hide();
1928 // -----------------------------------------------------------------------
1930 void SvxCharEffectsPage::UpdatePreview_Impl()
1932 SvxFont
& rFont
= GetPreviewFont();
1933 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1934 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1936 USHORT nPos
= m_aUnderlineLB
.GetSelectEntryPos();
1937 FontUnderline eUnderline
= (FontUnderline
)(ULONG
)m_aUnderlineLB
.GetEntryData( nPos
);
1938 nPos
= m_aOverlineLB
.GetSelectEntryPos();
1939 FontUnderline eOverline
= (FontUnderline
)(ULONG
)m_aOverlineLB
.GetEntryData( nPos
);
1940 nPos
= m_aStrikeoutLB
.GetSelectEntryPos();
1941 FontStrikeout eStrikeout
= (FontStrikeout
)(ULONG
)m_aStrikeoutLB
.GetEntryData( nPos
);
1942 rFont
.SetUnderline( eUnderline
);
1943 rCJKFont
.SetUnderline( eUnderline
);
1944 rCTLFont
.SetUnderline( eUnderline
);
1945 m_aPreviewWin
.SetTextLineColor( m_aUnderlineColorLB
.GetSelectEntryColor() );
1946 rFont
.SetOverline( eOverline
);
1947 rCJKFont
.SetOverline( eOverline
);
1948 rCTLFont
.SetOverline( eOverline
);
1949 m_aPreviewWin
.SetOverlineColor( m_aOverlineColorLB
.GetSelectEntryColor() );
1950 rFont
.SetStrikeout( eStrikeout
);
1951 rCJKFont
.SetStrikeout( eStrikeout
);
1952 rCTLFont
.SetStrikeout( eStrikeout
);
1954 nPos
= m_aPositionLB
.GetSelectEntryPos();
1955 BOOL bUnder
= ( CHRDLG_POSITION_UNDER
== (ULONG
)m_aPositionLB
.GetEntryData( nPos
) );
1956 FontEmphasisMark eMark
= (FontEmphasisMark
)m_aEmphasisLB
.GetSelectEntryPos();
1957 eMark
|= bUnder
? EMPHASISMARK_POS_BELOW
: EMPHASISMARK_POS_ABOVE
;
1958 rFont
.SetEmphasisMark( eMark
);
1959 rCJKFont
.SetEmphasisMark( eMark
);
1960 rCTLFont
.SetEmphasisMark( eMark
);
1962 USHORT nRelief
= m_aReliefLB
.GetSelectEntryPos();
1963 if(LISTBOX_ENTRY_NOTFOUND
!= nRelief
)
1965 rFont
.SetRelief( (FontRelief
)nRelief
);
1966 rCJKFont
.SetRelief( (FontRelief
)nRelief
);
1967 rCTLFont
.SetRelief( (FontRelief
)nRelief
);
1970 rFont
.SetOutline( StateToAttr( m_aOutlineBtn
.GetState() ) );
1971 rCJKFont
.SetOutline( rFont
.IsOutline() );
1972 rCTLFont
.SetOutline( rFont
.IsOutline() );
1974 rFont
.SetShadow( StateToAttr( m_aShadowBtn
.GetState() ) );
1975 rCJKFont
.SetShadow( rFont
.IsShadow() );
1976 rCTLFont
.SetShadow( rFont
.IsShadow() );
1978 USHORT nCapsPos
= m_aEffects2LB
.GetSelectEntryPos();
1979 if ( nCapsPos
!= LISTBOX_ENTRY_NOTFOUND
)
1981 rFont
.SetCaseMap( (SvxCaseMap
)nCapsPos
);
1982 rCJKFont
.SetCaseMap( (SvxCaseMap
)nCapsPos
);
1983 // #i78474# small caps do not exist in CTL fonts
1984 rCTLFont
.SetCaseMap( static_cast<SvxCaseMap
>( nCapsPos
== SVX_CASEMAP_KAPITAELCHEN
? SVX_CASEMAP_NOT_MAPPED
: (SvxCaseMap
)nCapsPos
) );
1987 BOOL bWordLine
= m_aIndividualWordsBtn
.IsChecked();
1988 rFont
.SetWordLineMode( bWordLine
);
1989 rCJKFont
.SetWordLineMode( bWordLine
);
1990 rCTLFont
.SetWordLineMode( bWordLine
);
1992 m_aPreviewWin
.Invalidate();
1995 // -----------------------------------------------------------------------
1997 void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap
)
1999 if ( SVX_CASEMAP_END
> eCaseMap
)
2000 m_aEffects2LB
.SelectEntryPos(
2001 sal::static_int_cast
< USHORT
>( eCaseMap
) );
2004 m_aEffects2LB
.SetNoSelection();
2005 eCaseMap
= SVX_CASEMAP_NOT_MAPPED
;
2008 UpdatePreview_Impl();
2011 // -----------------------------------------------------------------------
2013 void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet
& rSet
)
2015 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
2016 SfxItemState eState
= rSet
.GetItemState( nWhich
);
2020 case SFX_ITEM_UNKNOWN
:
2021 m_aFontColorFT
.Hide();
2022 m_aFontColorLB
.Hide();
2025 case SFX_ITEM_DISABLED
:
2026 case SFX_ITEM_READONLY
:
2027 m_aFontColorFT
.Disable();
2028 m_aFontColorLB
.Disable();
2031 case SFX_ITEM_DONTCARE
:
2032 m_aFontColorLB
.SetNoSelection();
2035 case SFX_ITEM_DEFAULT
:
2038 SvxFont
& rFont
= GetPreviewFont();
2039 SvxFont
& rCJKFont
= GetPreviewCJKFont();
2040 SvxFont
& rCTLFont
= GetPreviewCTLFont();
2042 const SvxColorItem
& rItem
= (SvxColorItem
&)rSet
.Get( nWhich
);
2043 Color aColor
= rItem
.GetValue();
2044 rFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
2045 rCJKFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
2046 rCTLFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
2048 m_aPreviewWin
.Invalidate();
2049 USHORT nSelPos
= m_aFontColorLB
.GetEntryPos( aColor
);
2050 if ( nSelPos
== LISTBOX_ENTRY_NOTFOUND
&& aColor
== Color( COL_TRANSPARENT
) )
2051 nSelPos
= m_aFontColorLB
.GetEntryPos( m_aTransparentColorName
);
2053 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
2054 m_aFontColorLB
.SelectEntryPos( nSelPos
);
2057 nSelPos
= m_aFontColorLB
.GetEntryPos( aColor
);
2058 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
2059 m_aFontColorLB
.SelectEntryPos( nSelPos
);
2061 m_aFontColorLB
.SelectEntryPos(
2062 m_aFontColorLB
.InsertEntry( aColor
, String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
2069 // -----------------------------------------------------------------------
2071 BOOL
SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet
& rSet
)
2073 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
2074 const SvxColorItem
* pOld
= (const SvxColorItem
*)GetOldItem( rSet
, SID_ATTR_CHAR_COLOR
);
2075 const SvxColorItem
* pItem
= NULL
;
2076 BOOL bChanged
= TRUE
;
2077 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
2078 const SfxItemSet
& rOldSet
= GetItemSet();
2080 Color aSelectedColor
;
2081 if ( m_aFontColorLB
.GetSelectEntry() == m_aTransparentColorName
)
2082 aSelectedColor
= Color( COL_TRANSPARENT
);
2084 aSelectedColor
= m_aFontColorLB
.GetSelectEntryColor();
2086 if ( pOld
&& pOld
->GetValue() == aSelectedColor
)
2090 bChanged
= ( m_aFontColorLB
.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
);
2092 if ( !bChanged
&& pExampleSet
&&
2093 pExampleSet
->GetItemState( nWhich
, FALSE
, (const SfxPoolItem
**)&pItem
) == SFX_ITEM_SET
&&
2094 ( (SvxColorItem
*)pItem
)->GetValue() != aSelectedColor
)
2097 BOOL bModified
= FALSE
;
2099 if ( bChanged
&& m_aFontColorLB
.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
2101 rSet
.Put( SvxColorItem( aSelectedColor
, nWhich
) );
2104 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2110 // -----------------------------------------------------------------------
2112 IMPL_LINK( SvxCharEffectsPage
, SelectHdl_Impl
, ListBox
*, pBox
)
2114 if ( &m_aEmphasisLB
== pBox
)
2116 USHORT nEPos
= m_aEmphasisLB
.GetSelectEntryPos();
2117 BOOL bEnable
= ( nEPos
> 0 && nEPos
!= LISTBOX_ENTRY_NOTFOUND
);
2118 m_aPositionFT
.Enable( bEnable
);
2119 m_aPositionLB
.Enable( bEnable
);
2121 else if( &m_aReliefLB
== pBox
)
2123 BOOL bEnable
= ( pBox
->GetSelectEntryPos() == 0 );
2124 m_aOutlineBtn
.Enable( bEnable
);
2125 m_aShadowBtn
.Enable( bEnable
);
2127 else if ( &m_aPositionLB
!= pBox
)
2129 USHORT nUPos
= m_aUnderlineLB
.GetSelectEntryPos(),
2130 nOPos
= m_aOverlineLB
.GetSelectEntryPos(),
2131 nSPos
= m_aStrikeoutLB
.GetSelectEntryPos();
2132 BOOL bUEnable
= ( nUPos
> 0 && nUPos
!= LISTBOX_ENTRY_NOTFOUND
);
2133 BOOL bOEnable
= ( nOPos
> 0 && nOPos
!= LISTBOX_ENTRY_NOTFOUND
);
2134 m_aUnderlineColorFT
.Enable( bUEnable
);
2135 m_aUnderlineColorLB
.Enable( bUEnable
);
2136 m_aOverlineColorFT
.Enable( bOEnable
);
2137 m_aOverlineColorLB
.Enable( bOEnable
);
2138 m_aIndividualWordsBtn
.Enable( bUEnable
|| bOEnable
|| ( nSPos
> 0 && nSPos
!= LISTBOX_ENTRY_NOTFOUND
) );
2140 UpdatePreview_Impl();
2144 // -----------------------------------------------------------------------
2146 IMPL_LINK( SvxCharEffectsPage
, UpdatePreview_Impl
, ListBox
*, EMPTYARG
)
2148 bool bEnable
= ( ( m_aUnderlineLB
.GetSelectEntryPos() > 0 ) ||
2149 ( m_aOverlineLB
.GetSelectEntryPos() > 0 ) ||
2150 ( m_aStrikeoutLB
.GetSelectEntryPos() > 0 ) );
2151 m_aIndividualWordsBtn
.Enable( bEnable
);
2153 UpdatePreview_Impl();
2157 // -----------------------------------------------------------------------
2159 IMPL_LINK( SvxCharEffectsPage
, CbClickHdl_Impl
, CheckBox
*, EMPTYARG
)
2161 UpdatePreview_Impl();
2165 // -----------------------------------------------------------------------
2167 IMPL_LINK( SvxCharEffectsPage
, TristClickHdl_Impl
, TriStateBox
*, EMPTYARG
)
2169 UpdatePreview_Impl();
2173 // -----------------------------------------------------------------------
2175 IMPL_LINK( SvxCharEffectsPage
, ColorBoxSelectHdl_Impl
, ColorListBox
*, pBox
)
2177 SvxFont
& rFont
= GetPreviewFont();
2178 SvxFont
& rCJKFont
= GetPreviewCJKFont();
2179 SvxFont
& rCTLFont
= GetPreviewCTLFont();
2181 Color aSelectedColor
;
2182 if ( pBox
->GetSelectEntry() == m_aTransparentColorName
)
2183 aSelectedColor
= Color( COL_TRANSPARENT
);
2185 aSelectedColor
= pBox
->GetSelectEntryColor();
2186 rFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
2187 rCJKFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
2188 rCTLFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
2190 m_aPreviewWin
.Invalidate();
2193 // -----------------------------------------------------------------------
2195 int SvxCharEffectsPage::DeactivatePage( SfxItemSet
* _pSet
)
2198 FillItemSet( *_pSet
);
2202 // -----------------------------------------------------------------------
2204 SfxTabPage
* SvxCharEffectsPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2206 return new SvxCharEffectsPage( pParent
, rSet
);
2209 // -----------------------------------------------------------------------
2211 USHORT
* SvxCharEffectsPage::GetRanges()
2213 return pEffectsRanges
;
2216 // -----------------------------------------------------------------------
2218 void SvxCharEffectsPage::Reset( const SfxItemSet
& rSet
)
2220 SvxFont
& rFont
= GetPreviewFont();
2221 SvxFont
& rCJKFont
= GetPreviewCJKFont();
2222 SvxFont
& rCTLFont
= GetPreviewCTLFont();
2224 BOOL bEnable
= FALSE
;
2227 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_UNDERLINE
);
2228 rFont
.SetUnderline( UNDERLINE_NONE
);
2229 rCJKFont
.SetUnderline( UNDERLINE_NONE
);
2230 rCTLFont
.SetUnderline( UNDERLINE_NONE
);
2232 m_aUnderlineLB
.SelectEntryPos( 0 );
2233 SfxItemState eState
= rSet
.GetItemState( nWhich
);
2235 if ( eState
>= SFX_ITEM_DONTCARE
)
2237 if ( eState
== SFX_ITEM_DONTCARE
)
2238 m_aUnderlineLB
.SetNoSelection();
2241 const SvxUnderlineItem
& rItem
= (SvxUnderlineItem
&)rSet
.Get( nWhich
);
2242 FontUnderline eUnderline
= (FontUnderline
)rItem
.GetValue();
2243 rFont
.SetUnderline( eUnderline
);
2244 rCJKFont
.SetUnderline( eUnderline
);
2245 rCTLFont
.SetUnderline( eUnderline
);
2247 if ( eUnderline
!= UNDERLINE_NONE
)
2249 for ( USHORT i
= 0; i
< m_aUnderlineLB
.GetEntryCount(); ++i
)
2251 if ( (FontUnderline
)(ULONG
)m_aUnderlineLB
.GetEntryData(i
) == eUnderline
)
2253 m_aUnderlineLB
.SelectEntryPos(i
);
2259 Color aColor
= rItem
.GetColor();
2260 USHORT nPos
= m_aUnderlineColorLB
.GetEntryPos( aColor
);
2262 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
2263 m_aUnderlineColorLB
.SelectEntryPos( nPos
);
2266 nPos
= m_aUnderlineColorLB
.GetEntryPos( aColor
);
2267 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
2268 m_aUnderlineColorLB
.SelectEntryPos( nPos
);
2270 m_aUnderlineColorLB
.SelectEntryPos(
2271 m_aUnderlineColorLB
.InsertEntry( aColor
,
2272 String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
2277 m_aUnderlineColorLB
.SelectEntry( Color( COL_AUTO
));
2278 m_aUnderlineColorLB
.Disable();
2284 nWhich
= GetWhich( SID_ATTR_CHAR_OVERLINE
);
2285 rFont
.SetOverline( UNDERLINE_NONE
);
2286 rCJKFont
.SetOverline( UNDERLINE_NONE
);
2287 rCTLFont
.SetOverline( UNDERLINE_NONE
);
2289 m_aOverlineLB
.SelectEntryPos( 0 );
2290 eState
= rSet
.GetItemState( nWhich
);
2292 if ( eState
>= SFX_ITEM_DONTCARE
)
2294 if ( eState
== SFX_ITEM_DONTCARE
)
2295 m_aOverlineLB
.SetNoSelection();
2298 const SvxOverlineItem
& rItem
= (SvxOverlineItem
&)rSet
.Get( nWhich
);
2299 FontUnderline eOverline
= (FontUnderline
)rItem
.GetValue();
2300 rFont
.SetOverline( eOverline
);
2301 rCJKFont
.SetOverline( eOverline
);
2302 rCTLFont
.SetOverline( eOverline
);
2304 if ( eOverline
!= UNDERLINE_NONE
)
2306 for ( USHORT i
= 0; i
< m_aOverlineLB
.GetEntryCount(); ++i
)
2308 if ( (FontUnderline
)(ULONG
)m_aOverlineLB
.GetEntryData(i
) == eOverline
)
2310 m_aOverlineLB
.SelectEntryPos(i
);
2316 Color aColor
= rItem
.GetColor();
2317 USHORT nPos
= m_aOverlineColorLB
.GetEntryPos( aColor
);
2319 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
2320 m_aOverlineColorLB
.SelectEntryPos( nPos
);
2323 nPos
= m_aOverlineColorLB
.GetEntryPos( aColor
);
2324 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
2325 m_aOverlineColorLB
.SelectEntryPos( nPos
);
2327 m_aOverlineColorLB
.SelectEntryPos(
2328 m_aOverlineColorLB
.InsertEntry( aColor
,
2329 String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
2334 m_aOverlineColorLB
.SelectEntry( Color( COL_AUTO
));
2335 m_aOverlineColorLB
.Disable();
2341 nWhich
= GetWhich( SID_ATTR_CHAR_STRIKEOUT
);
2342 rFont
.SetStrikeout( STRIKEOUT_NONE
);
2343 rCJKFont
.SetStrikeout( STRIKEOUT_NONE
);
2344 rCTLFont
.SetStrikeout( STRIKEOUT_NONE
);
2346 m_aStrikeoutLB
.SelectEntryPos( 0 );
2347 eState
= rSet
.GetItemState( nWhich
);
2349 if ( eState
>= SFX_ITEM_DONTCARE
)
2351 if ( eState
== SFX_ITEM_DONTCARE
)
2352 m_aStrikeoutLB
.SetNoSelection();
2355 const SvxCrossedOutItem
& rItem
= (SvxCrossedOutItem
&)rSet
.Get( nWhich
);
2356 FontStrikeout eStrikeout
= (FontStrikeout
)rItem
.GetValue();
2357 rFont
.SetStrikeout( eStrikeout
);
2358 rCJKFont
.SetStrikeout( eStrikeout
);
2359 rCTLFont
.SetStrikeout( eStrikeout
);
2361 if ( eStrikeout
!= STRIKEOUT_NONE
)
2363 for ( USHORT i
= 0; i
< m_aStrikeoutLB
.GetEntryCount(); ++i
)
2365 if ( (FontStrikeout
)(ULONG
)m_aStrikeoutLB
.GetEntryData(i
) == eStrikeout
)
2367 m_aStrikeoutLB
.SelectEntryPos(i
);
2377 nWhich
= GetWhich( SID_ATTR_CHAR_WORDLINEMODE
);
2380 case SFX_ITEM_UNKNOWN
:
2381 m_aIndividualWordsBtn
.Hide();
2384 case SFX_ITEM_DISABLED
:
2385 case SFX_ITEM_READONLY
:
2386 m_aIndividualWordsBtn
.Disable();
2389 case SFX_ITEM_DONTCARE
:
2390 m_aIndividualWordsBtn
.SetState( STATE_DONTKNOW
);
2393 case SFX_ITEM_DEFAULT
:
2396 const SvxWordLineModeItem
& rItem
= (SvxWordLineModeItem
&)rSet
.Get( nWhich
);
2397 rFont
.SetWordLineMode( rItem
.GetValue() );
2398 rCJKFont
.SetWordLineMode( rItem
.GetValue() );
2399 rCTLFont
.SetWordLineMode( rItem
.GetValue() );
2401 m_aIndividualWordsBtn
.Check( rItem
.GetValue() );
2402 m_aIndividualWordsBtn
.Enable( bEnable
);
2408 nWhich
= GetWhich( SID_ATTR_CHAR_EMPHASISMARK
);
2409 eState
= rSet
.GetItemState( nWhich
);
2411 if ( eState
>= SFX_ITEM_DEFAULT
)
2413 const SvxEmphasisMarkItem
& rItem
= (SvxEmphasisMarkItem
&)rSet
.Get( nWhich
);
2414 FontEmphasisMark eMark
= rItem
.GetEmphasisMark();
2415 rFont
.SetEmphasisMark( eMark
);
2416 rCJKFont
.SetEmphasisMark( eMark
);
2417 rCTLFont
.SetEmphasisMark( eMark
);
2419 m_aEmphasisLB
.SelectEntryPos( (USHORT
)( eMark
& EMPHASISMARK_STYLE
) );
2420 eMark
&= ~EMPHASISMARK_STYLE
;
2421 ULONG nEntryData
= ( eMark
== EMPHASISMARK_POS_ABOVE
)
2422 ? CHRDLG_POSITION_OVER
2423 : ( eMark
== EMPHASISMARK_POS_BELOW
) ? CHRDLG_POSITION_UNDER
: 0;
2425 for ( USHORT i
= 0; i
< m_aPositionLB
.GetEntryCount(); i
++ )
2427 if ( nEntryData
== (ULONG
)m_aPositionLB
.GetEntryData(i
) )
2429 m_aPositionLB
.SelectEntryPos(i
);
2434 else if ( eState
== SFX_ITEM_DONTCARE
)
2435 m_aEmphasisLB
.SetNoSelection( );
2436 else if ( eState
== SFX_ITEM_UNKNOWN
)
2438 m_aEmphasisFT
.Hide();
2439 m_aEmphasisLB
.Hide();
2441 else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY
2443 m_aEmphasisFT
.Disable();
2444 m_aEmphasisLB
.Disable();
2447 // the select handler for the underline/overline/strikeout list boxes
2448 // SelectHdl_Impl( NULL );
2449 DBG_ASSERT(m_aUnderlineLB
.GetSelectHdl() == m_aOverlineLB
.GetSelectHdl(),
2450 "SvxCharEffectsPage::Reset: inconsistence (1)!");
2451 DBG_ASSERT(m_aUnderlineLB
.GetSelectHdl() == m_aStrikeoutLB
.GetSelectHdl(),
2452 "SvxCharEffectsPage::Reset: inconsistence (1)!");
2453 m_aUnderlineLB
.GetSelectHdl().Call(NULL
);
2454 // don't call SelectHdl_Impl directly!
2455 // in DisableControls, we may have re-reouted the select handler
2456 // 30.05.2001 - 86262 - frank.schoenheit@germany.sun.com
2458 // the select handler for the emphasis listbox
2459 // SelectHdl_Impl( &m_aEmphasisLB );
2460 DBG_ASSERT(m_aEmphasisLB
.GetSelectHdl() == LINK(this, SvxCharEffectsPage
, SelectHdl_Impl
),
2461 "SvxCharEffectsPage::Reset: inconsistence (2)!");
2462 m_aEmphasisLB
.GetSelectHdl().Call( &m_aEmphasisLB
);
2463 // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ...
2466 SvxCaseMap eCaseMap
= SVX_CASEMAP_END
;
2467 nWhich
= GetWhich( SID_ATTR_CHAR_CASEMAP
);
2468 eState
= rSet
.GetItemState( nWhich
);
2471 case SFX_ITEM_UNKNOWN
:
2472 m_aEffectsFT
.Hide();
2473 m_aEffects2LB
.Hide();
2476 case SFX_ITEM_DISABLED
:
2477 case SFX_ITEM_READONLY
:
2478 m_aEffectsFT
.Disable();
2479 m_aEffects2LB
.Disable();
2482 case SFX_ITEM_DONTCARE
:
2483 m_aEffects2LB
.SetNoSelection();
2486 case SFX_ITEM_DEFAULT
:
2489 const SvxCaseMapItem
& rItem
= (const SvxCaseMapItem
&)rSet
.Get( nWhich
);
2490 eCaseMap
= (SvxCaseMap
)rItem
.GetValue();
2494 SetCaseMap_Impl( eCaseMap
);
2497 nWhich
= GetWhich(SID_ATTR_CHAR_RELIEF
);
2498 eState
= rSet
.GetItemState( nWhich
);
2501 case SFX_ITEM_UNKNOWN
:
2506 case SFX_ITEM_DISABLED
:
2507 case SFX_ITEM_READONLY
:
2508 m_aReliefFT
.Disable();
2509 m_aReliefLB
.Disable();
2512 case SFX_ITEM_DONTCARE
:
2513 m_aReliefLB
.SetNoSelection();
2516 case SFX_ITEM_DEFAULT
:
2519 const SvxCharReliefItem
& rItem
= (const SvxCharReliefItem
&)rSet
.Get( nWhich
);
2520 m_aReliefLB
.SelectEntryPos(rItem
.GetValue());
2521 SelectHdl_Impl(&m_aReliefLB
);
2527 nWhich
= GetWhich( SID_ATTR_CHAR_CONTOUR
);
2528 eState
= rSet
.GetItemState( nWhich
);
2531 case SFX_ITEM_UNKNOWN
:
2532 m_aOutlineBtn
.Hide();
2535 case SFX_ITEM_DISABLED
:
2536 case SFX_ITEM_READONLY
:
2537 m_aOutlineBtn
.Disable();
2540 case SFX_ITEM_DONTCARE
:
2541 m_aOutlineBtn
.SetState( STATE_DONTKNOW
);
2544 case SFX_ITEM_DEFAULT
:
2547 const SvxContourItem
& rItem
= (SvxContourItem
&)rSet
.Get( nWhich
);
2548 m_aOutlineBtn
.SetState( (TriState
)rItem
.GetValue() );
2549 m_aOutlineBtn
.EnableTriState( FALSE
);
2555 nWhich
= GetWhich( SID_ATTR_CHAR_SHADOWED
);
2556 eState
= rSet
.GetItemState( nWhich
);
2560 case SFX_ITEM_UNKNOWN
:
2561 m_aShadowBtn
.Hide();
2564 case SFX_ITEM_DISABLED
:
2565 case SFX_ITEM_READONLY
:
2566 m_aShadowBtn
.Disable();
2569 case SFX_ITEM_DONTCARE
:
2570 m_aShadowBtn
.SetState( STATE_DONTKNOW
);
2573 case SFX_ITEM_DEFAULT
:
2576 const SvxShadowedItem
& rItem
= (SvxShadowedItem
&)rSet
.Get( nWhich
);
2577 m_aShadowBtn
.SetState( (TriState
)rItem
.GetValue() );
2578 m_aShadowBtn
.EnableTriState( FALSE
);
2584 nWhich
= GetWhich( SID_ATTR_FLASH
);
2585 eState
= rSet
.GetItemState( nWhich
);
2589 case SFX_ITEM_UNKNOWN
:
2590 m_aBlinkingBtn
.Hide();
2593 case SFX_ITEM_DISABLED
:
2594 case SFX_ITEM_READONLY
:
2595 m_aBlinkingBtn
.Disable();
2598 case SFX_ITEM_DONTCARE
:
2599 m_aBlinkingBtn
.SetState( STATE_DONTKNOW
);
2602 case SFX_ITEM_DEFAULT
:
2605 const SvxBlinkItem
& rItem
= (SvxBlinkItem
&)rSet
.Get( nWhich
);
2606 m_aBlinkingBtn
.SetState( (TriState
)rItem
.GetValue() );
2607 m_aBlinkingBtn
.EnableTriState( FALSE
);
2612 nWhich
= GetWhich( SID_ATTR_CHAR_HIDDEN
);
2613 eState
= rSet
.GetItemState( nWhich
);
2617 case SFX_ITEM_UNKNOWN
:
2618 m_aHiddenBtn
.Hide();
2621 case SFX_ITEM_DISABLED
:
2622 case SFX_ITEM_READONLY
:
2623 m_aHiddenBtn
.Disable();
2626 case SFX_ITEM_DONTCARE
:
2627 m_aHiddenBtn
.SetState( STATE_DONTKNOW
);
2630 case SFX_ITEM_DEFAULT
:
2633 const SvxCharHiddenItem
& rItem
= (SvxCharHiddenItem
&)rSet
.Get( nWhich
);
2634 m_aHiddenBtn
.SetState( (TriState
)rItem
.GetValue() );
2635 m_aHiddenBtn
.EnableTriState( FALSE
);
2640 SetPrevFontWidthScale( rSet
);
2641 ResetColor_Impl( rSet
);
2644 m_aPreviewWin
.Invalidate();
2646 // save this settings
2647 m_aUnderlineLB
.SaveValue();
2648 m_aUnderlineColorLB
.SaveValue();
2649 m_aOverlineLB
.SaveValue();
2650 m_aOverlineColorLB
.SaveValue();
2651 m_aStrikeoutLB
.SaveValue();
2652 m_aIndividualWordsBtn
.SaveValue();
2653 m_aEmphasisLB
.SaveValue();
2654 m_aPositionLB
.SaveValue();
2655 m_aEffects2LB
.SaveValue();
2656 m_aReliefLB
.SaveValue();
2657 m_aOutlineBtn
.SaveValue();
2658 m_aShadowBtn
.SaveValue();
2659 m_aBlinkingBtn
.SaveValue();
2660 m_aHiddenBtn
.SaveValue();
2661 m_aFontColorLB
.SaveValue();
2664 // -----------------------------------------------------------------------
2666 BOOL
SvxCharEffectsPage::FillItemSet( SfxItemSet
& rSet
)
2668 const SfxPoolItem
* pOld
= 0;
2669 const SfxItemSet
& rOldSet
= GetItemSet();
2670 BOOL bModified
= FALSE
;
2671 FASTBOOL bChanged
= TRUE
;
2674 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_UNDERLINE
);
2675 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_UNDERLINE
);
2676 USHORT nPos
= m_aUnderlineLB
.GetSelectEntryPos();
2677 FontUnderline eUnder
= (FontUnderline
)(ULONG
)m_aUnderlineLB
.GetEntryData( nPos
);
2681 //! if there are different underline styles in the selection the
2682 //! item-state in the 'rOldSet' will be invalid. In this case
2683 //! changing the underline style will be allowed if a style is
2684 //! selected in the listbox.
2685 BOOL bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2686 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, TRUE
);
2688 const SvxUnderlineItem
& rItem
= *( (const SvxUnderlineItem
*)pOld
);
2689 if ( (FontUnderline
)rItem
.GetValue() == eUnder
&&
2690 ( UNDERLINE_NONE
== eUnder
|| rItem
.GetColor() == m_aUnderlineColorLB
.GetSelectEntryColor() ) &&
2697 SvxUnderlineItem
aNewItem( eUnder
, nWhich
);
2698 aNewItem
.SetColor( m_aUnderlineColorLB
.GetSelectEntryColor() );
2699 rSet
.Put( aNewItem
);
2702 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2708 nWhich
= GetWhich( SID_ATTR_CHAR_OVERLINE
);
2709 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_OVERLINE
);
2710 nPos
= m_aOverlineLB
.GetSelectEntryPos();
2711 FontUnderline eOver
= (FontUnderline
)(ULONG
)m_aOverlineLB
.GetEntryData( nPos
);
2715 //! if there are different underline styles in the selection the
2716 //! item-state in the 'rOldSet' will be invalid. In this case
2717 //! changing the underline style will be allowed if a style is
2718 //! selected in the listbox.
2719 BOOL bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2720 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, TRUE
);
2722 const SvxOverlineItem
& rItem
= *( (const SvxOverlineItem
*)pOld
);
2723 if ( (FontUnderline
)rItem
.GetValue() == eOver
&&
2724 ( UNDERLINE_NONE
== eOver
|| rItem
.GetColor() == m_aOverlineColorLB
.GetSelectEntryColor() ) &&
2731 SvxOverlineItem
aNewItem( eOver
, nWhich
);
2732 aNewItem
.SetColor( m_aOverlineColorLB
.GetSelectEntryColor() );
2733 rSet
.Put( aNewItem
);
2736 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2742 nWhich
= GetWhich( SID_ATTR_CHAR_STRIKEOUT
);
2743 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_STRIKEOUT
);
2744 nPos
= m_aStrikeoutLB
.GetSelectEntryPos();
2745 FontStrikeout eStrike
= (FontStrikeout
)(ULONG
)m_aStrikeoutLB
.GetEntryData( nPos
);
2749 //! if there are different strikeout styles in the selection the
2750 //! item-state in the 'rOldSet' will be invalid. In this case
2751 //! changing the strikeout style will be allowed if a style is
2752 //! selected in the listbox.
2753 BOOL bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2754 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, TRUE
);
2756 const SvxCrossedOutItem
& rItem
= *( (const SvxCrossedOutItem
*)pOld
);
2757 if ( !m_aStrikeoutLB
.IsEnabled()
2758 || ((FontStrikeout
)rItem
.GetValue() == eStrike
&& !bAllowChg
) )
2764 rSet
.Put( SvxCrossedOutItem( eStrike
, nWhich
) );
2767 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2773 nWhich
= GetWhich( SID_ATTR_CHAR_WORDLINEMODE
);
2774 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_WORDLINEMODE
);
2778 const SvxWordLineModeItem
& rItem
= *( (const SvxWordLineModeItem
*)pOld
);
2779 if ( rItem
.GetValue() == m_aIndividualWordsBtn
.IsChecked() )
2783 if ( rOldSet
.GetItemState( nWhich
) == SFX_ITEM_DONTCARE
&&
2784 m_aIndividualWordsBtn
.IsChecked() == m_aIndividualWordsBtn
.GetSavedValue() )
2789 rSet
.Put( SvxWordLineModeItem( m_aIndividualWordsBtn
.IsChecked(), nWhich
) );
2792 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2798 nWhich
= GetWhich( SID_ATTR_CHAR_EMPHASISMARK
);
2799 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_EMPHASISMARK
);
2800 USHORT nMarkPos
= m_aEmphasisLB
.GetSelectEntryPos();
2801 USHORT nPosPos
= m_aPositionLB
.GetSelectEntryPos();
2802 FontEmphasisMark eMark
= (FontEmphasisMark
)nMarkPos
;
2803 if ( m_aPositionLB
.IsEnabled() )
2805 eMark
|= ( CHRDLG_POSITION_UNDER
== (ULONG
)m_aPositionLB
.GetEntryData( nPosPos
) )
2806 ? EMPHASISMARK_POS_BELOW
: EMPHASISMARK_POS_ABOVE
;
2811 if( rOldSet
.GetItemState( nWhich
) != SFX_ITEM_DONTCARE
)
2813 const SvxEmphasisMarkItem
& rItem
= *( (const SvxEmphasisMarkItem
*)pOld
);
2814 if ( rItem
.GetEmphasisMark() == eMark
)
2819 if ( rOldSet
.GetItemState( nWhich
) == SFX_ITEM_DONTCARE
&&
2820 m_aEmphasisLB
.GetSavedValue() == nMarkPos
&& m_aPositionLB
.GetSavedValue() == nPosPos
)
2825 rSet
.Put( SvxEmphasisMarkItem( eMark
, nWhich
) );
2828 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2834 nWhich
= GetWhich( SID_ATTR_CHAR_CASEMAP
);
2835 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_CASEMAP
);
2836 SvxCaseMap eCaseMap
= SVX_CASEMAP_NOT_MAPPED
;
2837 FASTBOOL bChecked
= FALSE
;
2838 USHORT nCapsPos
= m_aEffects2LB
.GetSelectEntryPos();
2839 if ( nCapsPos
!= LISTBOX_ENTRY_NOTFOUND
)
2841 eCaseMap
= (SvxCaseMap
)nCapsPos
;
2847 //! if there are different effect styles in the selection the
2848 //! item-state in the 'rOldSet' will be invalid. In this case
2849 //! changing the effect style will be allowed if a style is
2850 //! selected in the listbox.
2851 BOOL bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2852 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, TRUE
);
2854 const SvxCaseMapItem
& rItem
= *( (const SvxCaseMapItem
*)pOld
);
2855 if ( (SvxCaseMap
)rItem
.GetValue() == eCaseMap
&& !bAllowChg
)
2859 if ( bChanged
&& bChecked
)
2861 rSet
.Put( SvxCaseMapItem( eCaseMap
, nWhich
) );
2864 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2870 nWhich
= GetWhich(SID_ATTR_CHAR_RELIEF
);
2871 if(m_aReliefLB
.GetSelectEntryPos() != m_aReliefLB
.GetSavedValue())
2873 m_aReliefLB
.SaveValue();
2874 SvxCharReliefItem
aRelief((FontRelief
)m_aReliefLB
.GetSelectEntryPos(), nWhich
);
2879 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
2880 nWhich
= GetWhich( SID_ATTR_CHAR_CONTOUR
);
2881 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_CONTOUR
);
2882 TriState eState
= m_aOutlineBtn
.GetState();
2883 const SfxPoolItem
* pItem
;
2887 const SvxContourItem
& rItem
= *( (const SvxContourItem
*)pOld
);
2888 if ( rItem
.GetValue() == StateToAttr( eState
) && m_aOutlineBtn
.GetSavedValue() == eState
)
2892 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
2893 !StateToAttr( eState
) && ( (SvxContourItem
*)pItem
)->GetValue() )
2896 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2898 rSet
.Put( SvxContourItem( StateToAttr( eState
), nWhich
) );
2901 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2907 nWhich
= GetWhich( SID_ATTR_CHAR_SHADOWED
);
2908 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_SHADOWED
);
2909 eState
= m_aShadowBtn
.GetState();
2913 const SvxShadowedItem
& rItem
= *( (const SvxShadowedItem
*)pOld
);
2914 if ( rItem
.GetValue() == StateToAttr( eState
) && m_aShadowBtn
.GetSavedValue() == eState
)
2918 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
2919 !StateToAttr( eState
) && ( (SvxShadowedItem
*)pItem
)->GetValue() )
2922 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2924 rSet
.Put( SvxShadowedItem( StateToAttr( eState
), nWhich
) );
2927 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2933 nWhich
= GetWhich( SID_ATTR_FLASH
);
2934 pOld
= GetOldItem( rSet
, SID_ATTR_FLASH
);
2935 eState
= m_aBlinkingBtn
.GetState();
2939 const SvxBlinkItem
& rItem
= *( (const SvxBlinkItem
*)pOld
);
2940 if ( rItem
.GetValue() == StateToAttr( eState
) && m_aBlinkingBtn
.GetSavedValue() == eState
)
2944 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
2945 !StateToAttr( eState
) && ( (SvxBlinkItem
*)pItem
)->GetValue() )
2948 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2950 rSet
.Put( SvxBlinkItem( StateToAttr( eState
), nWhich
) );
2953 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2957 nWhich
= GetWhich( SID_ATTR_CHAR_HIDDEN
);
2958 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_HIDDEN
);
2959 eState
= m_aHiddenBtn
.GetState();
2964 const SvxCharHiddenItem
& rItem
= *( (const SvxCharHiddenItem
*)pOld
);
2965 if ( rItem
.GetValue() == StateToAttr( eState
) && m_aHiddenBtn
.GetSavedValue() == eState
)
2969 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, FALSE
, &pItem
) == SFX_ITEM_SET
&&
2970 !StateToAttr( eState
) && ( (SvxCharHiddenItem
*)pItem
)->GetValue() )
2973 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2975 rSet
.Put( SvxCharHiddenItem( StateToAttr( eState
), nWhich
) );
2978 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
2981 bModified
|= FillItemSetColor_Impl( rSet
);
2986 void SvxCharEffectsPage::DisableControls( USHORT nDisable
)
2988 if ( ( DISABLE_CASEMAP
& nDisable
) == DISABLE_CASEMAP
)
2990 m_aEffectsFT
.Disable();
2991 m_aEffects2LB
.Disable();
2994 if ( ( DISABLE_WORDLINE
& nDisable
) == DISABLE_WORDLINE
)
2995 m_aIndividualWordsBtn
.Disable();
2997 if ( ( DISABLE_BLINK
& nDisable
) == DISABLE_BLINK
)
2998 m_aBlinkingBtn
.Disable();
3000 if ( ( DISABLE_UNDERLINE_COLOR
& nDisable
) == DISABLE_UNDERLINE_COLOR
)
3002 // disable the controls
3003 m_aUnderlineColorFT
.Disable( );
3004 m_aUnderlineColorLB
.Disable( );
3005 // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling
3006 m_aUnderlineLB
.SetSelectHdl(LINK(this, SvxCharEffectsPage
, UpdatePreview_Impl
));
3007 m_aStrikeoutLB
.SetSelectHdl(LINK(this, SvxCharEffectsPage
, UpdatePreview_Impl
));
3011 void SvxCharEffectsPage::EnableFlash()
3013 if ( !( ( m_nHtmlMode
& HTMLMODE_ON
) && !( m_nHtmlMode
& HTMLMODE_BLINK
) ) )
3014 m_aBlinkingBtn
.Show();
3017 // -----------------------------------------------------------------------
3018 void SvxCharEffectsPage::SetPreviewBackgroundToCharacter()
3020 m_bPreviewBackgroundToCharacter
= TRUE
;
3023 // -----------------------------------------------------------------------
3024 void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet
) //add CHINA001
3026 SFX_ITEMSET_ARG (&aSet
,pDisableCtlItem
,SfxUInt16Item
,SID_DISABLE_CTL
,sal_False
);
3027 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
3028 if (pDisableCtlItem
)
3029 DisableControls(pDisableCtlItem
->GetValue());
3033 UINT32 nFlags
=pFlagItem
->GetValue();
3034 if ( ( nFlags
& SVX_ENABLE_FLASH
) == SVX_ENABLE_FLASH
)
3036 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
3037 SetPreviewBackgroundToCharacter();
3041 // class SvxCharPositionPage ---------------------------------------------
3043 SvxCharPositionPage::SvxCharPositionPage( Window
* pParent
, const SfxItemSet
& rInSet
) :
3045 SvxCharBasePage( pParent
, SVX_RES( RID_SVXPAGE_CHAR_POSITION
), rInSet
, WIN_POS_PREVIEW
, FT_POS_FONTTYPE
),
3047 m_aPositionLine ( this, SVX_RES( FL_POSITION
) ),
3048 m_aHighPosBtn ( this, SVX_RES( RB_HIGHPOS
) ),
3049 m_aNormalPosBtn ( this, SVX_RES( RB_NORMALPOS
) ),
3050 m_aLowPosBtn ( this, SVX_RES( RB_LOWPOS
) ),
3051 m_aHighLowFT ( this, SVX_RES( FT_HIGHLOW
) ),
3052 m_aHighLowEdit ( this, SVX_RES( ED_HIGHLOW
) ),
3053 m_aHighLowRB ( this, SVX_RES( CB_HIGHLOW
) ),
3054 m_aFontSizeFT ( this, SVX_RES( FT_FONTSIZE
) ),
3055 m_aFontSizeEdit ( this, SVX_RES( ED_FONTSIZE
) ),
3056 m_aRotationScalingFL( this, SVX_RES( FL_ROTATION_SCALING
) ),
3057 m_aScalingFL ( this, SVX_RES( FL_SCALING
) ),
3058 m_a0degRB ( this, SVX_RES( RB_0_DEG
) ),
3059 m_a90degRB ( this, SVX_RES( RB_90_DEG
) ),
3060 m_a270degRB ( this, SVX_RES( RB_270_DEG
) ),
3061 m_aFitToLineCB ( this, SVX_RES( CB_FIT_TO_LINE
) ),
3062 m_aScaleWidthFT ( this, SVX_RES( FT_SCALE_WIDTH
) ),
3063 m_aScaleWidthMF ( this, SVX_RES( MF_SCALE_WIDTH
) ),
3065 m_aKerningLine ( this, SVX_RES( FL_KERNING2
) ),
3066 m_aKerningLB ( this, SVX_RES( LB_KERNING2
) ),
3067 m_aKerningFT ( this, SVX_RES( FT_KERNING2
) ),
3068 m_aKerningEdit ( this, SVX_RES( ED_KERNING2
) ),
3069 m_aPairKerningBtn ( this, SVX_RES( CB_PAIRKERNING
) ),
3071 m_nSuperEsc ( (short)DFLT_ESC_SUPER
),
3072 m_nSubEsc ( (short)DFLT_ESC_SUB
),
3073 m_nScaleWidthItemSetVal ( 100 ),
3074 m_nScaleWidthInitialVal ( 100 ),
3075 m_nSuperProp ( (BYTE
)DFLT_ESC_PROP
),
3076 m_nSubProp ( (BYTE
)DFLT_ESC_PROP
)
3082 // -----------------------------------------------------------------------
3084 void SvxCharPositionPage::Initialize()
3086 // to handle the changes of the other pages
3087 SetExchangeSupport();
3089 GetPreviewFont().SetSize( Size( 0, 240 ) );
3090 GetPreviewCJKFont().SetSize( Size( 0, 240 ) );
3091 GetPreviewCTLFont().SetSize( Size( 0, 240 ) );
3093 m_aNormalPosBtn
.Check();
3094 PositionHdl_Impl( &m_aNormalPosBtn
);
3095 m_aKerningLB
.SelectEntryPos( 0 );
3096 KerningSelectHdl_Impl( NULL
);
3098 Link aLink
= LINK( this, SvxCharPositionPage
, PositionHdl_Impl
);
3099 m_aHighPosBtn
.SetClickHdl( aLink
);
3100 m_aNormalPosBtn
.SetClickHdl( aLink
);
3101 m_aLowPosBtn
.SetClickHdl( aLink
);
3103 aLink
= LINK( this, SvxCharPositionPage
, RotationHdl_Impl
);
3104 m_a0degRB
.SetClickHdl( aLink
);
3105 m_a90degRB
.SetClickHdl( aLink
);
3106 m_a270degRB
.SetClickHdl( aLink
);
3108 aLink
= LINK( this, SvxCharPositionPage
, FontModifyHdl_Impl
);
3109 m_aHighLowEdit
.SetModifyHdl( aLink
);
3110 m_aFontSizeEdit
.SetModifyHdl( aLink
);
3112 aLink
= LINK( this, SvxCharPositionPage
, LoseFocusHdl_Impl
);
3113 m_aHighLowEdit
.SetLoseFocusHdl( aLink
);
3114 m_aFontSizeEdit
.SetLoseFocusHdl( aLink
);
3116 m_aHighLowRB
.SetClickHdl( LINK( this, SvxCharPositionPage
, AutoPositionHdl_Impl
) );
3117 m_aFitToLineCB
.SetClickHdl( LINK( this, SvxCharPositionPage
, FitToLineHdl_Impl
) );
3118 m_aKerningLB
.SetSelectHdl( LINK( this, SvxCharPositionPage
, KerningSelectHdl_Impl
) );
3119 m_aKerningEdit
.SetModifyHdl( LINK( this, SvxCharPositionPage
, KerningModifyHdl_Impl
) );
3120 m_aPairKerningBtn
.SetClickHdl( LINK( this, SvxCharPositionPage
, PairKerningHdl_Impl
) );
3121 m_aScaleWidthMF
.SetModifyHdl( LINK( this, SvxCharPositionPage
, ScaleWidthModifyHdl_Impl
) );
3124 // -----------------------------------------------------------------------
3126 void SvxCharPositionPage::UpdatePreview_Impl( BYTE nProp
, BYTE nEscProp
, short nEsc
)
3128 SetPrevFontEscapement( nProp
, nEscProp
, nEsc
);
3131 // -----------------------------------------------------------------------
3133 void SvxCharPositionPage::SetEscapement_Impl( USHORT nEsc
)
3135 SvxEscapementItem
aEscItm( (SvxEscapement
)nEsc
, SID_ATTR_CHAR_ESCAPEMENT
);
3137 if ( SVX_ESCAPEMENT_SUPERSCRIPT
== nEsc
)
3139 aEscItm
.GetEsc() = m_nSuperEsc
;
3140 aEscItm
.GetProp() = m_nSuperProp
;
3142 else if ( SVX_ESCAPEMENT_SUBSCRIPT
== nEsc
)
3144 aEscItm
.GetEsc() = m_nSubEsc
;
3145 aEscItm
.GetProp() = m_nSubProp
;
3148 short nFac
= aEscItm
.GetEsc() < 0 ? -1 : 1;
3150 m_aHighLowEdit
.SetValue( aEscItm
.GetEsc() * nFac
);
3151 m_aFontSizeEdit
.SetValue( aEscItm
.GetProp() );
3153 if ( SVX_ESCAPEMENT_OFF
== nEsc
)
3155 m_aHighLowFT
.Disable();
3156 m_aHighLowEdit
.Disable();
3157 m_aFontSizeFT
.Disable();
3158 m_aFontSizeEdit
.Disable();
3159 m_aHighLowRB
.Disable();
3163 m_aFontSizeFT
.Enable();
3164 m_aFontSizeEdit
.Enable();
3165 m_aHighLowRB
.Enable();
3167 if ( !m_aHighLowRB
.IsChecked() )
3169 m_aHighLowFT
.Enable();
3170 m_aHighLowEdit
.Enable();
3173 AutoPositionHdl_Impl( &m_aHighLowRB
);
3176 UpdatePreview_Impl( 100, aEscItm
.GetProp(), aEscItm
.GetEsc() );
3179 // -----------------------------------------------------------------------
3181 IMPL_LINK( SvxCharPositionPage
, PositionHdl_Impl
, RadioButton
*, pBtn
)
3183 USHORT nEsc
= SVX_ESCAPEMENT_OFF
; // also when pBtn == NULL
3185 if ( &m_aHighPosBtn
== pBtn
)
3186 nEsc
= SVX_ESCAPEMENT_SUPERSCRIPT
;
3187 else if ( &m_aLowPosBtn
== pBtn
)
3188 nEsc
= SVX_ESCAPEMENT_SUBSCRIPT
;
3190 SetEscapement_Impl( nEsc
);
3194 // -----------------------------------------------------------------------
3196 IMPL_LINK( SvxCharPositionPage
, RotationHdl_Impl
, RadioButton
*, pBtn
)
3198 BOOL bEnable
= FALSE
;
3199 if (&m_a90degRB
== pBtn
|| &m_a270degRB
== pBtn
)
3202 OSL_ENSURE( &m_a0degRB
== pBtn
, "unexpected button" );
3203 m_aFitToLineCB
.Enable( bEnable
);
3207 // -----------------------------------------------------------------------
3209 IMPL_LINK( SvxCharPositionPage
, FontModifyHdl_Impl
, MetricField
*, EMPTYARG
)
3211 BYTE nEscProp
= (BYTE
)m_aFontSizeEdit
.GetValue();
3212 short nEsc
= (short)m_aHighLowEdit
.GetValue();
3213 nEsc
*= m_aLowPosBtn
.IsChecked() ? -1 : 1;
3214 UpdatePreview_Impl( 100, nEscProp
, nEsc
);
3218 // -----------------------------------------------------------------------
3220 IMPL_LINK( SvxCharPositionPage
, AutoPositionHdl_Impl
, CheckBox
*, pBox
)
3222 if ( pBox
->IsChecked() )
3224 m_aHighLowFT
.Disable();
3225 m_aHighLowEdit
.Disable();
3228 PositionHdl_Impl( m_aHighPosBtn
.IsChecked() ? &m_aHighPosBtn
3229 : m_aLowPosBtn
.IsChecked() ? &m_aLowPosBtn
3230 : &m_aNormalPosBtn
);
3234 // -----------------------------------------------------------------------
3236 IMPL_LINK( SvxCharPositionPage
, FitToLineHdl_Impl
, CheckBox
*, pBox
)
3238 if ( &m_aFitToLineCB
== pBox
)
3240 UINT16 nVal
= m_nScaleWidthInitialVal
;
3241 if (m_aFitToLineCB
.IsChecked())
3242 nVal
= m_nScaleWidthItemSetVal
;
3243 m_aScaleWidthMF
.SetValue( nVal
);
3245 m_aPreviewWin
.SetFontWidthScale( nVal
);
3250 // -----------------------------------------------------------------------
3252 IMPL_LINK( SvxCharPositionPage
, KerningSelectHdl_Impl
, ListBox
*, EMPTYARG
)
3254 if ( m_aKerningLB
.GetSelectEntryPos() > 0 )
3256 m_aKerningFT
.Enable();
3257 m_aKerningEdit
.Enable();
3259 if ( m_aKerningLB
.GetSelectEntryPos() == 2 )
3261 // Condensed -> max value == 1/6 of the current font height
3262 SvxFont
& rFont
= GetPreviewFont();
3263 long nMax
= rFont
.GetSize().Height() / 6;
3264 m_aKerningEdit
.SetMax( m_aKerningEdit
.Normalize( nMax
), FUNIT_TWIP
);
3265 m_aKerningEdit
.SetLast( m_aKerningEdit
.GetMax( m_aKerningEdit
.GetUnit() ) );
3269 m_aKerningEdit
.SetMax( 9999 );
3270 m_aKerningEdit
.SetLast( 9999 );
3275 m_aKerningEdit
.SetValue( 0 );
3276 m_aKerningFT
.Disable();
3277 m_aKerningEdit
.Disable();
3280 KerningModifyHdl_Impl( NULL
);
3285 // -----------------------------------------------------------------------
3287 IMPL_LINK( SvxCharPositionPage
, KerningModifyHdl_Impl
, MetricField
*, EMPTYARG
)
3289 long nVal
= static_cast<long>(m_aKerningEdit
.GetValue());
3290 nVal
= LogicToLogic( nVal
, MAP_POINT
, MAP_TWIP
);
3291 long nKern
= (short)m_aKerningEdit
.Denormalize( nVal
);
3293 // Condensed? -> then negative
3294 if ( m_aKerningLB
.GetSelectEntryPos() == 2 )
3297 SvxFont
& rFont
= GetPreviewFont();
3298 SvxFont
& rCJKFont
= GetPreviewCJKFont();
3299 SvxFont
& rCTLFont
= GetPreviewCTLFont();
3301 rFont
.SetFixKerning( (short)nKern
);
3302 rCJKFont
.SetFixKerning( (short)nKern
);
3303 rCTLFont
.SetFixKerning( (short)nKern
);
3304 m_aPreviewWin
.Invalidate();
3308 // -----------------------------------------------------------------------
3310 IMPL_LINK( SvxCharPositionPage
, PairKerningHdl_Impl
, CheckBox
*, EMPTYARG
)
3315 // -----------------------------------------------------------------------
3317 IMPL_LINK( SvxCharPositionPage
, LoseFocusHdl_Impl
, MetricField
*, pField
)
3320 sal_Bool bHigh
= m_aHighPosBtn
.IsChecked();
3322 sal_Bool bLow
= m_aLowPosBtn
.IsChecked();
3323 DBG_ASSERT( bHigh
|| bLow
, "normal position is not valid" );
3325 if ( &m_aHighLowEdit
== pField
)
3328 m_nSubEsc
= (short)m_aHighLowEdit
.GetValue() * -1;
3330 m_nSuperEsc
= (short)m_aHighLowEdit
.GetValue();
3332 else if ( &m_aFontSizeEdit
== pField
)
3335 m_nSubProp
= (BYTE
)m_aFontSizeEdit
.GetValue();
3337 m_nSuperProp
= (BYTE
)m_aFontSizeEdit
.GetValue();
3342 // -----------------------------------------------------------------------
3344 IMPL_LINK( SvxCharPositionPage
, ScaleWidthModifyHdl_Impl
, MetricField
*, EMPTYARG
)
3346 m_aPreviewWin
.SetFontWidthScale( USHORT( m_aScaleWidthMF
.GetValue() ) );
3351 /* -----------------28.08.2003 12:12-----------------
3353 --------------------------------------------------*/
3354 void SvxCharPositionPage::ActivatePage( const SfxItemSet
& rSet
)
3356 //update the preview
3357 SvxCharBasePage::ActivatePage( rSet
);
3359 //the only thing that has to be checked is the max. allowed value for the
3360 //condense edit field
3361 if ( m_aKerningLB
.GetSelectEntryPos() == 2 )
3363 // Condensed -> max value == 1/6 of the current font height
3364 SvxFont
& rFont
= GetPreviewFont();
3365 long nMax
= rFont
.GetSize().Height() / 6;
3366 long nKern
= (short)m_aKerningEdit
.Denormalize( LogicToLogic( static_cast<long>(m_aKerningEdit
.GetValue()), MAP_POINT
, MAP_TWIP
) );
3367 m_aKerningEdit
.SetMax( m_aKerningEdit
.Normalize( nKern
> nMax
? nKern
: nMax
), FUNIT_TWIP
);
3368 m_aKerningEdit
.SetLast( m_aKerningEdit
.GetMax( m_aKerningEdit
.GetUnit() ) );
3372 // -----------------------------------------------------------------------
3374 int SvxCharPositionPage::DeactivatePage( SfxItemSet
* _pSet
)
3377 FillItemSet( *_pSet
);
3381 // -----------------------------------------------------------------------
3383 SfxTabPage
* SvxCharPositionPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
3385 return new SvxCharPositionPage( pParent
, rSet
);
3388 // -----------------------------------------------------------------------
3390 USHORT
* SvxCharPositionPage::GetRanges()
3392 return pPositionRanges
;
3395 // -----------------------------------------------------------------------
3396 #define ENABLE_AND_CHECK( aCheckBox ) \
3397 if ( !aCheckBox.IsEnabled() ) \
3398 aCheckBox.Enable(); \
3399 aCheckBox.Check( TRUE )
3401 void SvxCharPositionPage::Reset( const SfxItemSet
& rSet
)
3403 String sUser
= GetUserData();
3407 m_nSuperEsc
= (short)sUser
.GetToken( 0 ).ToInt32();
3408 m_nSubEsc
= (short)sUser
.GetToken( 1 ).ToInt32();
3409 m_nSuperProp
= (BYTE
)sUser
.GetToken( 2 ).ToInt32();
3410 m_nSubProp
= (BYTE
)sUser
.GetToken( 3 ).ToInt32();
3414 BYTE nEscProp
= 100;
3417 m_aHighLowFT
.Disable();
3418 m_aHighLowEdit
.Disable();
3419 m_aFontSizeFT
.Disable();
3420 m_aFontSizeEdit
.Disable();
3422 SvxFont
& rFont
= GetPreviewFont();
3423 SvxFont
& rCJKFont
= GetPreviewCJKFont();
3424 SvxFont
& rCTLFont
= GetPreviewCTLFont();
3425 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_ESCAPEMENT
);
3427 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3429 const SvxEscapementItem
& rItem
= (SvxEscapementItem
&)rSet
.Get( nWhich
);
3430 nEsc
= rItem
.GetEsc();
3431 nEscProp
= rItem
.GetProp();
3435 m_aHighLowFT
.Enable();
3436 m_aHighLowEdit
.Enable();
3437 m_aFontSizeFT
.Enable();
3438 m_aFontSizeEdit
.Enable();
3445 m_aHighPosBtn
.Check( TRUE
);
3446 if ( nEsc
== DFLT_ESC_AUTO_SUPER
)
3448 ENABLE_AND_CHECK( m_aHighLowRB
);
3449 nEsc
= DFLT_ESC_SUPER
;
3455 m_aLowPosBtn
.Check( TRUE
);
3456 if ( nEsc
== DFLT_ESC_AUTO_SUB
)
3458 ENABLE_AND_CHECK( m_aHighLowRB
);
3459 nEsc
= DFLT_ESC_SUB
;
3463 if ( m_aHighLowRB
.IsChecked() )
3465 m_aHighLowFT
.Disable();
3466 m_aHighLowEdit
.Disable();
3468 m_aHighLowEdit
.SetValue( m_aHighLowEdit
.Normalize( nFac
* nEsc
) );
3472 m_aNormalPosBtn
.Check( TRUE
);
3473 m_aHighLowRB
.Check( TRUE
);
3474 PositionHdl_Impl( NULL
);
3476 //the height has to be set after the handler is called to keep the value also if the escapement is zero
3477 m_aFontSizeEdit
.SetValue( m_aFontSizeEdit
.Normalize( nEscProp
) );
3481 m_aHighPosBtn
.Check( FALSE
);
3482 m_aNormalPosBtn
.Check( FALSE
);
3483 m_aLowPosBtn
.Check( FALSE
);
3487 SetPrevFontEscapement( nProp
, nEscProp
, nEsc
);
3490 nWhich
= GetWhich( SID_ATTR_CHAR_KERNING
);
3492 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3494 const SvxKerningItem
& rItem
= (SvxKerningItem
&)rSet
.Get( nWhich
);
3495 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
3496 MapUnit eOrgUnit
= (MapUnit
)eUnit
;
3497 MapUnit
ePntUnit( MAP_POINT
);
3498 long nBig
= static_cast<long>(m_aKerningEdit
.Normalize( static_cast<long>(rItem
.GetValue()) ));
3499 long nKerning
= LogicToLogic( nBig
, eOrgUnit
, ePntUnit
);
3501 // Kerning am Font setzen, vorher in Twips umrechnen
3502 long nKern
= LogicToLogic( rItem
.GetValue(), (MapUnit
)eUnit
, MAP_TWIP
);
3503 rFont
.SetFixKerning( (short)nKern
);
3504 rCJKFont
.SetFixKerning( (short)nKern
);
3505 rCTLFont
.SetFixKerning( (short)nKern
);
3509 m_aKerningLB
.SelectEntryPos( LW_GESPERRT
);
3511 else if ( nKerning
< 0 )
3513 m_aKerningLB
.SelectEntryPos( LW_SCHMAL
);
3514 nKerning
= -nKerning
;
3519 m_aKerningLB
.SelectEntryPos( LW_NORMAL
);
3521 //enable/disable and set min/max of the Edit
3522 KerningSelectHdl_Impl(&m_aKerningLB
);
3523 //the attribute value must be displayed also if it's above the maximum allowed value
3524 long nVal
= static_cast<long>(m_aKerningEdit
.GetMax());
3526 m_aKerningEdit
.SetMax( nKerning
);
3527 m_aKerningEdit
.SetValue( nKerning
);
3530 m_aKerningEdit
.SetText( String() );
3533 nWhich
= GetWhich( SID_ATTR_CHAR_AUTOKERN
);
3535 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3537 const SvxAutoKernItem
& rItem
= (SvxAutoKernItem
&)rSet
.Get( nWhich
);
3538 m_aPairKerningBtn
.Check( rItem
.GetValue() );
3541 m_aPairKerningBtn
.Check( FALSE
);
3544 nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
3545 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3547 const SvxCharScaleWidthItem
& rItem
= ( SvxCharScaleWidthItem
& ) rSet
.Get( nWhich
);
3548 m_nScaleWidthInitialVal
= rItem
.GetValue();
3549 m_aScaleWidthMF
.SetValue( m_nScaleWidthInitialVal
);
3552 m_aScaleWidthMF
.SetValue( 100 );
3554 nWhich
= GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
);
3555 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3556 m_nScaleWidthItemSetVal
= ((SfxUInt16Item
&) rSet
.Get( nWhich
)).GetValue();
3559 nWhich
= GetWhich( SID_ATTR_CHAR_ROTATED
);
3560 SfxItemState eState
= rSet
.GetItemState( nWhich
);
3561 if( SFX_ITEM_UNKNOWN
== eState
)
3563 m_aRotationScalingFL
.Hide();
3564 m_aScalingFL
.Show();
3568 m_aFitToLineCB
.Hide();
3569 m_aFitToLineCB
.Hide();
3572 // move the following controls upwards
3573 Window
* aCntrlArr
[] = {
3574 &m_aScaleWidthFT
, &m_aScaleWidthMF
, &m_aKerningLine
,
3575 &m_aKerningLB
, &m_aKerningFT
, &m_aKerningEdit
, &m_aPairKerningBtn
,
3578 long nDiff
= m_aScaleWidthMF
.GetPosPixel().Y() -
3579 m_a0degRB
.GetPosPixel().Y();
3581 for( Window
** ppW
= aCntrlArr
; *ppW
; ++ppW
)
3583 Point
aPnt( (*ppW
)->GetPosPixel() );
3585 (*ppW
)->SetPosPixel( aPnt
);
3590 m_aScalingFL
.Hide();
3592 Link
aOldLink( m_aFitToLineCB
.GetClickHdl() );
3593 m_aFitToLineCB
.SetClickHdl( Link() );
3594 if( eState
>= SFX_ITEM_DEFAULT
)
3596 const SvxCharRotateItem
& rItem
=
3597 (SvxCharRotateItem
&) rSet
.Get( nWhich
);
3598 if (rItem
.IsBottomToTop())
3599 m_a90degRB
.Check( TRUE
);
3600 else if (rItem
.IsTopToBotton())
3601 m_a270degRB
.Check( TRUE
);
3604 DBG_ASSERT( 0 == rItem
.GetValue(), "incorrect value" );
3605 m_a0degRB
.Check( TRUE
);
3607 m_aFitToLineCB
.Check( rItem
.IsFitToLine() );
3611 if( eState
== SFX_ITEM_DONTCARE
)
3613 m_a0degRB
.Check( FALSE
);
3614 m_a90degRB
.Check( FALSE
);
3615 m_a270degRB
.Check( FALSE
);
3618 m_a0degRB
.Check( TRUE
);
3620 m_aFitToLineCB
.Check( FALSE
);
3622 m_aFitToLineCB
.SetClickHdl( aOldLink
);
3623 m_aFitToLineCB
.Enable( !m_a0degRB
.IsChecked() );
3625 // is this value set?
3626 if( SFX_ITEM_UNKNOWN
== rSet
.GetItemState( GetWhich(
3627 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
) ))
3628 m_aFitToLineCB
.Hide();
3631 m_aHighPosBtn
.SaveValue();
3632 m_aNormalPosBtn
.SaveValue();
3633 m_aLowPosBtn
.SaveValue();
3634 m_a0degRB
.SaveValue();
3635 m_a90degRB
.SaveValue();
3636 m_a270degRB
.SaveValue();
3637 m_aFitToLineCB
.SaveValue();
3638 m_aScaleWidthMF
.SaveValue();
3639 m_aKerningLB
.SaveValue();
3640 m_aKerningEdit
.SaveValue();
3641 m_aPairKerningBtn
.SaveValue();
3644 // -----------------------------------------------------------------------
3646 BOOL
SvxCharPositionPage::FillItemSet( SfxItemSet
& rSet
)
3648 // Position (hoch, normal oder tief)
3649 const SfxItemSet
& rOldSet
= GetItemSet();
3650 BOOL bModified
= FALSE
, bChanged
= TRUE
;
3651 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_ESCAPEMENT
);
3652 const SfxPoolItem
* pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_ESCAPEMENT
);
3653 const FASTBOOL bHigh
= m_aHighPosBtn
.IsChecked();
3657 if ( bHigh
|| m_aLowPosBtn
.IsChecked() )
3659 if ( m_aHighLowRB
.IsChecked() )
3660 nEsc
= bHigh
? DFLT_ESC_AUTO_SUPER
: DFLT_ESC_AUTO_SUB
;
3663 nEsc
= (short)m_aHighLowEdit
.Denormalize( m_aHighLowEdit
.GetValue() );
3664 nEsc
*= bHigh
? 1 : -1;
3666 nEscProp
= (BYTE
)m_aFontSizeEdit
.Denormalize( m_aFontSizeEdit
.GetValue() );
3676 const SvxEscapementItem
& rItem
= *( (const SvxEscapementItem
*)pOld
);
3677 if ( rItem
.GetEsc() == nEsc
&& rItem
.GetProp() == nEscProp
)
3681 if ( !bChanged
&& !m_aHighPosBtn
.GetSavedValue() &&
3682 !m_aNormalPosBtn
.GetSavedValue() && !m_aLowPosBtn
.GetSavedValue() )
3686 ( m_aHighPosBtn
.IsChecked() || m_aNormalPosBtn
.IsChecked() || m_aLowPosBtn
.IsChecked() ) )
3688 rSet
.Put( SvxEscapementItem( nEsc
, nEscProp
, nWhich
) );
3691 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
3697 nWhich
= GetWhich( SID_ATTR_CHAR_KERNING
);
3698 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_KERNING
);
3699 USHORT nPos
= m_aKerningLB
.GetSelectEntryPos();
3701 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
3703 if ( nPos
== LW_GESPERRT
|| nPos
== LW_SCHMAL
)
3705 long nTmp
= static_cast<long>(m_aKerningEdit
.GetValue());
3706 long nVal
= LogicToLogic( nTmp
, MAP_POINT
, (MapUnit
)eUnit
);
3707 nKerning
= (short)m_aKerningEdit
.Denormalize( nVal
);
3709 if ( nPos
== LW_SCHMAL
)
3715 const SvxKerningItem
& rItem
= *( (const SvxKerningItem
*)pOld
);
3716 if ( rItem
.GetValue() == nKerning
)
3721 ( m_aKerningLB
.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
||
3722 ( !m_aKerningEdit
.GetSavedValue().Len() && m_aKerningEdit
.IsEnabled() ) ) )
3725 if ( bChanged
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
3727 rSet
.Put( SvxKerningItem( nKerning
, nWhich
) );
3730 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
3736 nWhich
= GetWhich( SID_ATTR_CHAR_AUTOKERN
);
3738 if ( m_aPairKerningBtn
.IsChecked() != m_aPairKerningBtn
.GetSavedValue() )
3740 rSet
.Put( SvxAutoKernItem( m_aPairKerningBtn
.IsChecked(), nWhich
) );
3743 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
3747 nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
3748 if ( m_aScaleWidthMF
.GetText() != m_aScaleWidthMF
.GetSavedValue() )
3750 rSet
.Put( SvxCharScaleWidthItem( (USHORT
)m_aScaleWidthMF
.GetValue(), nWhich
) );
3753 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
3757 nWhich
= GetWhich( SID_ATTR_CHAR_ROTATED
);
3758 if ( m_a0degRB
.IsChecked() != m_a0degRB
.GetSavedValue() ||
3759 m_a90degRB
.IsChecked() != m_a90degRB
.GetSavedValue() ||
3760 m_a270degRB
.IsChecked() != m_a270degRB
.GetSavedValue() ||
3761 m_aFitToLineCB
.IsChecked() != m_aFitToLineCB
.GetSavedValue() )
3763 SvxCharRotateItem
aItem( 0, m_aFitToLineCB
.IsChecked(), nWhich
);
3764 if (m_a90degRB
.IsChecked())
3765 aItem
.SetBottomToTop();
3766 else if (m_a270degRB
.IsChecked())
3767 aItem
.SetTopToBotton();
3771 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
3777 // -----------------------------------------------------------------------
3779 void SvxCharPositionPage::FillUserData()
3781 const sal_Unicode cTok
= ';';
3783 String
sUser( UniString::CreateFromInt32( m_nSuperEsc
) );
3784 sUser
.Append( cTok
);
3785 sUser
.Append( UniString::CreateFromInt32( m_nSubEsc
) );
3786 sUser
.Append( cTok
);
3787 sUser
.Append( UniString::CreateFromInt32( m_nSuperProp
) );
3788 sUser
.Append( cTok
);
3789 sUser
.Append( UniString::CreateFromInt32( m_nSubProp
) );
3790 SetUserData( sUser
);
3793 // -----------------------------------------------------------------------
3794 void SvxCharPositionPage::SetPreviewBackgroundToCharacter()
3796 m_bPreviewBackgroundToCharacter
= TRUE
;
3798 // -----------------------------------------------------------------------
3799 void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet
) //add CHINA001
3801 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
3804 UINT32 nFlags
=pFlagItem
->GetValue();
3805 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
3806 SetPreviewBackgroundToCharacter();
3809 // class SvxCharTwoLinesPage ------------------------------------------------
3811 SvxCharTwoLinesPage::SvxCharTwoLinesPage( Window
* pParent
, const SfxItemSet
& rInSet
) :
3813 SvxCharBasePage( pParent
, SVX_RES( RID_SVXPAGE_CHAR_TWOLINES
), rInSet
, WIN_TWOLINES_PREVIEW
, FT_TWOLINES_FONTTYPE
),
3815 m_aSwitchOnLine ( this, SVX_RES( FL_SWITCHON
) ),
3816 m_aTwoLinesBtn ( this, SVX_RES( CB_TWOLINES
) ),
3818 m_aEncloseLine ( this, SVX_RES( FL_ENCLOSE
) ),
3819 m_aStartBracketFT ( this, SVX_RES( FT_STARTBRACKET
) ),
3820 m_aStartBracketLB ( this, SVX_RES( ED_STARTBRACKET
) ),
3821 m_aEndBracketFT ( this, SVX_RES( FT_ENDBRACKET
) ),
3822 m_aEndBracketLB ( this, SVX_RES( ED_ENDBRACKET
) ),
3823 m_nStartBracketPosition( 0 ),
3824 m_nEndBracketPosition( 0 )
3830 // -----------------------------------------------------------------------
3832 void SvxCharTwoLinesPage::Initialize()
3834 Size aSize
= m_aStartBracketLB
.GetSizePixel();
3835 aSize
.Height() = m_aStartBracketLB
.CalcSize( 1, 6 ).Height();
3836 m_aStartBracketLB
.SetSizePixel( aSize
);
3837 aSize
= m_aEndBracketLB
.GetSizePixel();
3838 aSize
.Height() = m_aEndBracketLB
.CalcSize( 1, 6 ).Height();
3839 m_aEndBracketLB
.SetSizePixel( aSize
);
3841 m_aTwoLinesBtn
.Check( FALSE
);
3842 TwoLinesHdl_Impl( NULL
);
3844 m_aTwoLinesBtn
.SetClickHdl( LINK( this, SvxCharTwoLinesPage
, TwoLinesHdl_Impl
) );
3846 Link aLink
= LINK( this, SvxCharTwoLinesPage
, CharacterMapHdl_Impl
);
3847 m_aStartBracketLB
.SetSelectHdl( aLink
);
3848 m_aEndBracketLB
.SetSelectHdl( aLink
);
3850 SvxFont
& rFont
= GetPreviewFont();
3851 SvxFont
& rCJKFont
= GetPreviewCJKFont();
3852 SvxFont
& rCTLFont
= GetPreviewCTLFont();
3853 rFont
.SetSize( Size( 0, 220 ) );
3854 rCJKFont
.SetSize( Size( 0, 220 ) );
3855 rCTLFont
.SetSize( Size( 0, 220 ) );
3858 // -----------------------------------------------------------------------
3860 void SvxCharTwoLinesPage::SelectCharacter( ListBox
* pBox
)
3862 //CHINA001 SvxCharacterMap aDlg( this );
3863 bool bStart
= pBox
== &m_aStartBracketLB
;
3864 //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
3867 //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP );
3868 SvxCharacterMap
* aDlg
= new SvxCharacterMap( this );
3869 aDlg
->DisableFontSelection();//CHINA001 aDlg.DisableFontSelection();
3871 if ( aDlg
->Execute() == RET_OK
)//CHINA001 ( aDlg.Execute() == RET_OK )
3873 sal_Unicode cChar
= (sal_Unicode
) aDlg
->GetChar();//CHINA001 aDlg.GetChar();
3874 SetBracket( cChar
, bStart
);
3878 pBox
->SelectEntryPos( bStart
? m_nStartBracketPosition
: m_nEndBracketPosition
);
3880 delete aDlg
; //add CHINA001
3884 // -----------------------------------------------------------------------
3886 void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket
, BOOL bStart
)
3888 USHORT nEntryPos
= 0;
3889 ListBox
* pBox
= bStart
? &m_aStartBracketLB
: &m_aEndBracketLB
;
3890 if ( 0 == cBracket
)
3891 pBox
->SelectEntryPos(0);
3894 FASTBOOL bFound
= FALSE
;
3895 for ( USHORT i
= 1; i
< pBox
->GetEntryCount(); ++i
)
3897 if ( (ULONG
)pBox
->GetEntryData(i
) != CHRDLG_ENCLOSE_SPECIAL_CHAR
)
3899 const sal_Unicode cChar
= pBox
->GetEntry(i
).GetChar(0);
3900 if ( cChar
== cBracket
)
3902 pBox
->SelectEntryPos(i
);
3912 nEntryPos
= pBox
->InsertEntry( String( cBracket
) );
3913 pBox
->SelectEntryPos( nEntryPos
);
3917 m_nStartBracketPosition
= nEntryPos
;
3919 m_nEndBracketPosition
= nEntryPos
;
3922 // -----------------------------------------------------------------------
3924 IMPL_LINK( SvxCharTwoLinesPage
, TwoLinesHdl_Impl
, CheckBox
*, EMPTYARG
)
3926 BOOL bChecked
= m_aTwoLinesBtn
.IsChecked();
3927 m_aStartBracketFT
.Enable( bChecked
);
3928 m_aStartBracketLB
.Enable( bChecked
);
3929 m_aEndBracketFT
.Enable( bChecked
);
3930 m_aEndBracketLB
.Enable( bChecked
);
3932 UpdatePreview_Impl();
3936 // -----------------------------------------------------------------------
3938 IMPL_LINK( SvxCharTwoLinesPage
, CharacterMapHdl_Impl
, ListBox
*, pBox
)
3940 USHORT nPos
= pBox
->GetSelectEntryPos();
3941 if ( CHRDLG_ENCLOSE_SPECIAL_CHAR
== (ULONG
)pBox
->GetEntryData( nPos
) )
3942 SelectCharacter( pBox
);
3945 bool bStart
= pBox
== &m_aStartBracketLB
;
3947 m_nStartBracketPosition
= nPos
;
3949 m_nEndBracketPosition
= nPos
;
3951 UpdatePreview_Impl();
3955 // -----------------------------------------------------------------------
3957 void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet
& rSet
)
3959 SvxCharBasePage::ActivatePage( rSet
);
3962 // -----------------------------------------------------------------------
3964 int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet
* _pSet
)
3967 FillItemSet( *_pSet
);
3971 // -----------------------------------------------------------------------
3973 SfxTabPage
* SvxCharTwoLinesPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
3975 return new SvxCharTwoLinesPage( pParent
, rSet
);
3978 // -----------------------------------------------------------------------
3980 USHORT
* SvxCharTwoLinesPage::GetRanges()
3982 return pTwoLinesRanges
;
3985 // -----------------------------------------------------------------------
3987 void SvxCharTwoLinesPage::Reset( const SfxItemSet
& rSet
)
3989 m_aTwoLinesBtn
.Check( FALSE
);
3990 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_TWO_LINES
);
3991 SfxItemState eState
= rSet
.GetItemState( nWhich
);
3993 if ( eState
>= SFX_ITEM_DONTCARE
)
3995 const SvxTwoLinesItem
& rItem
= (SvxTwoLinesItem
&)rSet
.Get( nWhich
);
3996 m_aTwoLinesBtn
.Check( rItem
.GetValue() );
3998 if ( rItem
.GetValue() )
4000 SetBracket( rItem
.GetStartBracket(), TRUE
);
4001 SetBracket( rItem
.GetEndBracket(), FALSE
);
4004 TwoLinesHdl_Impl( NULL
);
4006 SetPrevFontWidthScale( rSet
);
4009 // -----------------------------------------------------------------------
4011 BOOL
SvxCharTwoLinesPage::FillItemSet( SfxItemSet
& rSet
)
4013 const SfxItemSet
& rOldSet
= GetItemSet();
4014 BOOL bModified
= FALSE
, bChanged
= TRUE
;
4015 USHORT nWhich
= GetWhich( SID_ATTR_CHAR_TWO_LINES
);
4016 const SfxPoolItem
* pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_TWO_LINES
);
4017 sal_Bool bOn
= m_aTwoLinesBtn
.IsChecked();
4018 sal_Unicode cStart
= ( bOn
&& m_aStartBracketLB
.GetSelectEntryPos() > 0 )
4019 ? m_aStartBracketLB
.GetSelectEntry().GetChar(0) : 0;
4020 sal_Unicode cEnd
= ( bOn
&& m_aEndBracketLB
.GetSelectEntryPos() > 0 )
4021 ? m_aEndBracketLB
.GetSelectEntry().GetChar(0) : 0;
4025 const SvxTwoLinesItem
& rItem
= *( (const SvxTwoLinesItem
*)pOld
);
4026 if ( rItem
.GetValue() == bOn
&&
4027 ( !bOn
|| ( rItem
.GetStartBracket() == cStart
&& rItem
.GetEndBracket() == cEnd
) ) )
4033 rSet
.Put( SvxTwoLinesItem( bOn
, cStart
, cEnd
, nWhich
) );
4036 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, FALSE
) )
4041 /* -----------------------------04.12.00 09:48--------------------------------
4043 ---------------------------------------------------------------------------*/
4044 void SvxCharTwoLinesPage::UpdatePreview_Impl()
4046 sal_Unicode cStart
= m_aStartBracketLB
.GetSelectEntryPos() > 0
4047 ? m_aStartBracketLB
.GetSelectEntry().GetChar(0) : 0;
4048 sal_Unicode cEnd
= m_aEndBracketLB
.GetSelectEntryPos() > 0
4049 ? m_aEndBracketLB
.GetSelectEntry().GetChar(0) : 0;
4050 m_aPreviewWin
.SetBrackets(cStart
, cEnd
);
4051 m_aPreviewWin
.SetTwoLines(m_aTwoLinesBtn
.IsChecked());
4052 m_aPreviewWin
.Invalidate();
4054 // -----------------------------------------------------------------------
4055 void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter()
4057 m_bPreviewBackgroundToCharacter
= TRUE
;
4060 // -----------------------------------------------------------------------
4061 void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet
) //add CHINA001
4063 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
4066 UINT32 nFlags
=pFlagItem
->GetValue();
4067 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
4068 SetPreviewBackgroundToCharacter();