1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <editeng/unolingu.hxx>
21 #include <vcl/svapp.hxx>
22 #include <unotools/pathoptions.hxx>
23 #include <svtools/ctrltool.hxx>
24 #include <svl/sfontitm.hxx>
25 #include <sfx2/printer.hxx>
26 #include <sfx2/objsh.hxx>
27 #include <sfx2/viewsh.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <vcl/msgbox.hxx>
31 #include <svx/dialmgr.hxx>
32 #include <svx/dialogs.hrc>
33 #include <svtools/unitconv.hxx>
34 #include <svl/languageoptions.hxx>
35 #include <svx/xtable.hxx> // XColorList
36 #include "chardlg.hxx"
37 #include "editeng/fontitem.hxx"
38 #include <editeng/postitem.hxx>
39 #include <editeng/udlnitem.hxx>
40 #include <editeng/crossedoutitem.hxx>
41 #include <editeng/contouritem.hxx>
42 #include <editeng/langitem.hxx>
43 #include <editeng/wghtitem.hxx>
44 #include <editeng/fhgtitem.hxx>
45 #include <editeng/shdditem.hxx>
46 #include <editeng/escapementitem.hxx>
47 #include <editeng/prszitem.hxx>
48 #include <editeng/wrlmitem.hxx>
49 #include <editeng/cmapitem.hxx>
50 #include <editeng/kernitem.hxx>
51 #include <editeng/blinkitem.hxx>
52 #include "editeng/flstitem.hxx"
53 #include <editeng/autokernitem.hxx>
54 #include <editeng/brushitem.hxx>
55 #include <editeng/colritem.hxx>
56 #include "svx/drawitem.hxx"
57 #include "svx/dlgutil.hxx"
58 #include <dialmgr.hxx>
59 #include <sfx2/htmlmode.hxx>
60 #include "cuicharmap.hxx"
62 #include <editeng/emphasismarkitem.hxx>
63 #include <editeng/charreliefitem.hxx>
64 #include <editeng/twolinesitem.hxx>
65 #include <editeng/charhiddenitem.hxx>
66 #include <svl/stritem.hxx>
67 #include <editeng/charscaleitem.hxx>
68 #include <editeng/charrotateitem.hxx>
69 #include <svx/svxdlg.hxx>
71 #include <svl/intitem.hxx>
72 #include <sfx2/request.hxx>
73 #include "svx/flagsdef.hxx"
75 using namespace ::com::sun::star
;
77 // define ----------------------------------------------------------------
79 #define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT
81 #define CLEARTITEM rSet.InvalidateItem(nWhich)
85 #define LW_CONDENSED 2
87 // static ----------------------------------------------------------------
89 static sal_uInt16 pNameRanges
[] =
93 SID_ATTR_CHAR_FONTHEIGHT
,
94 SID_ATTR_CHAR_FONTHEIGHT
,
97 SID_ATTR_CHAR_LANGUAGE
,
98 SID_ATTR_CHAR_LANGUAGE
,
99 SID_ATTR_CHAR_CJK_FONT
,
100 SID_ATTR_CHAR_CJK_WEIGHT
,
101 SID_ATTR_CHAR_CTL_FONT
,
102 SID_ATTR_CHAR_CTL_WEIGHT
,
106 static sal_uInt16 pEffectsRanges
[] =
108 SID_ATTR_CHAR_SHADOWED
,
109 SID_ATTR_CHAR_UNDERLINE
,
112 SID_ATTR_CHAR_CASEMAP
,
113 SID_ATTR_CHAR_CASEMAP
,
116 SID_ATTR_CHAR_EMPHASISMARK
,
117 SID_ATTR_CHAR_EMPHASISMARK
,
118 SID_ATTR_CHAR_RELIEF
,
119 SID_ATTR_CHAR_RELIEF
,
120 SID_ATTR_CHAR_HIDDEN
,
121 SID_ATTR_CHAR_HIDDEN
,
122 SID_ATTR_CHAR_OVERLINE
,
123 SID_ATTR_CHAR_OVERLINE
,
127 static sal_uInt16 pPositionRanges
[] =
129 SID_ATTR_CHAR_KERNING
,
130 SID_ATTR_CHAR_KERNING
,
131 SID_ATTR_CHAR_ESCAPEMENT
,
132 SID_ATTR_CHAR_ESCAPEMENT
,
133 SID_ATTR_CHAR_AUTOKERN
,
134 SID_ATTR_CHAR_AUTOKERN
,
135 SID_ATTR_CHAR_ROTATED
,
136 SID_ATTR_CHAR_SCALEWIDTH
,
137 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
,
138 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
,
142 static sal_uInt16 pTwoLinesRanges
[] =
144 SID_ATTR_CHAR_TWO_LINES
,
145 SID_ATTR_CHAR_TWO_LINES
,
149 // C-Funktion ------------------------------------------------------------
151 inline sal_Bool
StateToAttr( TriState aState
)
153 return ( STATE_CHECK
== aState
);
156 // class SvxCharBasePage -------------------------------------------------
158 inline SvxFont
& SvxCharBasePage::GetPreviewFont()
160 return m_pPreviewWin
->GetFont();
163 // -----------------------------------------------------------------------
165 inline SvxFont
& SvxCharBasePage::GetPreviewCJKFont()
167 return m_pPreviewWin
->GetCJKFont();
169 // -----------------------------------------------------------------------
171 inline SvxFont
& SvxCharBasePage::GetPreviewCTLFont()
173 return m_pPreviewWin
->GetCTLFont();
176 // -----------------------------------------------------------------------
178 SvxCharBasePage::SvxCharBasePage(Window
* pParent
, const OString
& rID
, const OUString
& rUIXMLDescription
, const SfxItemSet
& rItemset
)
179 : SfxTabPage( pParent
, rID
, rUIXMLDescription
, rItemset
)
180 , m_pPreviewWin(NULL
)
181 , m_bPreviewBackgroundToCharacter( sal_False
)
185 // -----------------------------------------------------------------------
187 SvxCharBasePage::~SvxCharBasePage()
191 // -----------------------------------------------------------------------
193 void SvxCharBasePage::ActivatePage( const SfxItemSet
& rSet
)
195 m_pPreviewWin
->SetFromItemSet( rSet
, m_bPreviewBackgroundToCharacter
);
199 // -----------------------------------------------------------------------
201 void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet
& rSet
)
203 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
206 const SvxCharScaleWidthItem
&rItem
= ( SvxCharScaleWidthItem
& ) rSet
.Get( nWhich
);
207 m_pPreviewWin
->SetFontWidthScale( rItem
.GetValue() );
211 // -----------------------------------------------------------------------
214 // -----------------------------------------------------------------------
215 void setPrevFontEscapement(SvxFont
& _rFont
,sal_uInt8 nProp
, sal_uInt8 nEscProp
, short nEsc
)
217 _rFont
.SetPropr( nProp
);
218 _rFont
.SetProprRel( nEscProp
);
219 _rFont
.SetEscapement( nEsc
);
221 // -----------------------------------------------------------------------
222 // -----------------------------------------------------------------------
224 // -----------------------------------------------------------------------
226 void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp
, sal_uInt8 nEscProp
, short nEsc
)
228 setPrevFontEscapement(GetPreviewFont(),nProp
,nEscProp
,nEsc
);
229 setPrevFontEscapement(GetPreviewCJKFont(),nProp
,nEscProp
,nEsc
);
230 setPrevFontEscapement(GetPreviewCTLFont(),nProp
,nEscProp
,nEsc
);
231 m_pPreviewWin
->Invalidate();
234 // SvxCharNamePage_Impl --------------------------------------------------
236 struct SvxCharNamePage_Impl
238 Timer m_aUpdateTimer
;
239 String m_aNoStyleText
;
240 const FontList
* m_pFontList
;
241 sal_uInt16 m_nExtraEntryPos
;
242 sal_Bool m_bMustDelete
;
243 sal_Bool m_bInSearchMode
;
245 SvxCharNamePage_Impl() :
247 m_pFontList ( NULL
),
248 m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND
),
249 m_bMustDelete ( sal_False
),
250 m_bInSearchMode ( sal_False
)
253 m_aUpdateTimer
.SetTimeout( 350 );
256 ~SvxCharNamePage_Impl()
263 // class SvxCharNamePage -------------------------------------------------
265 SvxCharNamePage::SvxCharNamePage( Window
* pParent
, const SfxItemSet
& rInSet
)
266 : SvxCharBasePage(pParent
, "CharNamePage", "cui/ui/charnamepage.ui", rInSet
)
267 , m_pImpl(new SvxCharNamePage_Impl
)
269 m_pImpl
->m_aNoStyleText
= String( CUI_RES( RID_SVXSTR_CHARNAME_NOSTYLE
) );
271 SvtLanguageOptions aLanguageOptions
;
272 sal_Bool bShowCJK
= aLanguageOptions
.IsCJKFontEnabled();
273 sal_Bool bShowCTL
= aLanguageOptions
.IsCTLFontEnabled();
274 sal_Bool bShowNonWestern
= bShowCJK
|| bShowCTL
;
278 get(m_pWestFrame
, "western");
279 get(m_pWestFontNameFT
, "westfontnameft-cjk");
280 get(m_pWestFontNameLB
, "westfontnamelb-cjk");
281 get(m_pWestFontStyleFT
, "weststyleft-cjk");
282 get(m_pWestFontStyleLB
, "weststylelb-cjk");
283 get(m_pWestFontSizeFT
, "westsizeft-cjk");
284 get(m_pWestFontSizeLB
, "westsizelb-cjk");
286 get(m_pWestFontLanguageFT
, "westlangft-cjk");
287 get(m_pWestFontLanguageLB
, "westlanglb-cjk");
288 get(m_pWestFontTypeFT
, "westfontinfo-cjk");
292 get(m_pWestFrame
, "simple");
293 get(m_pWestFontNameFT
, "westfontnameft-nocjk");
294 get(m_pWestFontNameLB
, "westfontnamelb-nocjk");
295 get(m_pWestFontStyleFT
, "weststyleft-nocjk");
296 get(m_pWestFontStyleLB
, "weststylelb-nocjk");
297 get(m_pWestFontSizeFT
, "westsizeft-nocjk");
298 get(m_pWestFontSizeLB
, "westsizelb-nocjk");
300 get(m_pWestFontLanguageFT
, "westlangft-nocjk");
301 get(m_pWestFontLanguageLB
, "westlanglb-nocjk");
302 get(m_pWestFontTypeFT
, "westfontinfo-nocjk");
305 get(m_pEastFrame
, "asian");
306 get(m_pEastFontNameFT
, "eastfontnameft");
307 get(m_pEastFontNameLB
, "eastfontnamelb");
308 get(m_pEastFontStyleFT
, "eaststyleft");
309 get(m_pEastFontStyleLB
, "eaststylelb");
310 get(m_pEastFontSizeFT
, "eastsizeft");
311 get(m_pEastFontSizeLB
, "eastsizelb");
312 get(m_pEastFontLanguageFT
, "eastlangft");
313 get(m_pEastFontLanguageLB
, "eastlanglb");
314 get(m_pEastFontTypeFT
, "eastfontinfo");
316 get(m_pCTLFrame
, "ctl");
317 get(m_pCTLFontNameFT
, "ctlfontnameft");
318 get(m_pCTLFontNameLB
, "ctlfontnamelb");
319 get(m_pCTLFontStyleFT
, "ctlstyleft");
320 get(m_pCTLFontStyleLB
, "ctlstylelb");
321 get(m_pCTLFontSizeFT
, "ctlsizeft");
322 get(m_pCTLFontSizeLB
, "ctlsizelb");
323 get(m_pCTLFontLanguageFT
, "ctllangft");
324 get(m_pCTLFontLanguageLB
, "ctllanglb");
325 get(m_pCTLFontTypeFT
, "ctlfontinfo");
327 //In MacOSX the standard dialogs name font-name, font-style as
329 //In GNOME the standard dialogs name font-name, font-style as
331 //In Windows the standard dialogs name font-name, font-style as
334 String
sFontFamilyString(CUI_RES(RID_SVXSTR_CHARNAME_FONT
));
336 String
sFontFamilyString(CUI_RES(RID_SVXSTR_CHARNAME_FAMILY
));
338 m_pWestFontNameFT
->SetText(sFontFamilyString
);
339 m_pEastFontNameFT
->SetText(sFontFamilyString
);
340 m_pCTLFontNameFT
->SetText(sFontFamilyString
);
343 String
sFontStyleString(CUI_RES(RID_SVXSTR_CHARNAME_TYPEFACE
));
345 String
sFontStyleString(CUI_RES(RID_SVXSTR_CHARNAME_STYLE
));
347 m_pWestFontStyleFT
->SetText(sFontStyleString
);
348 m_pEastFontStyleFT
->SetText(sFontStyleString
);
349 m_pCTLFontStyleFT
->SetText(sFontStyleString
);
351 m_pWestFrame
->Show(true);
352 m_pEastFrame
->Show(bShowCJK
);
353 m_pCTLFrame
->Show(bShowCTL
);
355 get(m_pPreviewWin
, "preview");
357 m_pWestFontLanguageLB
->SetLanguageList(LANG_LIST_WESTERN
, sal_True
, sal_False
, sal_True
);
358 m_pEastFontLanguageLB
->SetLanguageList(LANG_LIST_CJK
, sal_True
, sal_False
, sal_True
);
359 m_pCTLFontLanguageLB
->SetLanguageList(LANG_LIST_CTL
, sal_True
, sal_False
, sal_True
);
361 if (!bShowNonWestern
)
364 sal_Int32 nHeight
= m_pWestFontSizeLB
->CalcWindowSizePixel(10);
365 m_pWestFontNameLB
->set_height_request(nHeight
);
366 m_pWestFontStyleLB
->set_height_request(nHeight
);
367 m_pWestFontSizeLB
->set_height_request(nHeight
);
373 // -----------------------------------------------------------------------
375 SvxCharNamePage::~SvxCharNamePage()
380 // -----------------------------------------------------------------------
382 void SvxCharNamePage::Initialize()
384 // to handle the changes of the other pages
385 SetExchangeSupport();
387 Link aLink
= LINK( this, SvxCharNamePage
, FontModifyHdl_Impl
);
388 m_pWestFontNameLB
->SetModifyHdl( aLink
);
389 m_pWestFontStyleLB
->SetModifyHdl( aLink
);
390 m_pWestFontSizeLB
->SetModifyHdl( aLink
);
391 m_pWestFontLanguageLB
->SetSelectHdl( aLink
);
392 m_pEastFontNameLB
->SetModifyHdl( aLink
);
393 m_pEastFontStyleLB
->SetModifyHdl( aLink
);
394 m_pEastFontSizeLB
->SetModifyHdl( aLink
);
395 m_pEastFontLanguageLB
->SetSelectHdl( aLink
);
396 m_pCTLFontNameLB
->SetModifyHdl( aLink
);
397 m_pCTLFontStyleLB
->SetModifyHdl( aLink
);
398 m_pCTLFontSizeLB
->SetModifyHdl( aLink
);
399 m_pCTLFontLanguageLB
->SetSelectHdl( aLink
);
401 m_pImpl
->m_aUpdateTimer
.SetTimeoutHdl( LINK( this, SvxCharNamePage
, UpdateHdl_Impl
) );
404 // -----------------------------------------------------------------------
406 const FontList
* SvxCharNamePage::GetFontList() const
408 if ( !m_pImpl
->m_pFontList
)
410 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
411 const SfxPoolItem
* pItem
;
413 /* #110771# SvxFontListItem::GetFontList can return NULL */
416 pItem
= pDocSh
->GetItem( SID_ATTR_CHAR_FONTLIST
);
419 DBG_ASSERT(NULL
!= ( (SvxFontListItem
*)pItem
)->GetFontList(),
420 "Where is the font list?");
421 m_pImpl
->m_pFontList
= static_cast<const SvxFontListItem
*>(pItem
)->GetFontList()->Clone();
422 m_pImpl
->m_bMustDelete
= sal_True
;
425 if(!m_pImpl
->m_pFontList
)
427 m_pImpl
->m_pFontList
=
428 new FontList( Application::GetDefaultDevice() );
429 m_pImpl
->m_bMustDelete
= sal_True
;
433 return m_pImpl
->m_pFontList
;
436 // -----------------------------------------------------------------------------
439 FontInfo
calcFontInfo( SvxFont
& _rFont
,
440 SvxCharNamePage
* _pPage
,
441 const FontNameBox
* _pFontNameLB
,
442 const FontStyleBox
* _pFontStyleLB
,
443 const FontSizeBox
* _pFontSizeLB
,
444 const SvxLanguageBox
* _pLanguageLB
,
445 const FontList
* _pFontList
,
446 sal_uInt16 _nFontWhich
,
447 sal_uInt16 _nFontHeightWhich
)
449 Size aSize
= _rFont
.GetSize();
452 String
sFontName(_pFontNameLB
->GetText());
453 sal_Bool bFontAvailable
= _pFontList
->IsAvailable( sFontName
);
454 if (bFontAvailable
|| _pFontNameLB
->GetSavedValue() != sFontName
)
455 aFontInfo
= _pFontList
->Get( sFontName
, _pFontStyleLB
->GetText() );
458 //get the font from itemset
459 SfxItemState eState
= _pPage
->GetItemSet().GetItemState( _nFontWhich
);
460 if ( eState
>= SFX_ITEM_DEFAULT
)
462 const SvxFontItem
* pFontItem
= (const SvxFontItem
*)&( _pPage
->GetItemSet().Get( _nFontWhich
) );
463 aFontInfo
.SetName(pFontItem
->GetFamilyName());
464 aFontInfo
.SetStyleName(pFontItem
->GetStyleName());
465 aFontInfo
.SetFamily(pFontItem
->GetFamily());
466 aFontInfo
.SetPitch(pFontItem
->GetPitch());
467 aFontInfo
.SetCharSet(pFontItem
->GetCharSet());
470 if ( _pFontSizeLB
->IsRelative() )
472 DBG_ASSERT( _pPage
->GetItemSet().GetParent(), "No parent set" );
473 const SvxFontHeightItem
& rOldItem
= (SvxFontHeightItem
&)_pPage
->GetItemSet().GetParent()->Get( _nFontHeightWhich
);
477 if ( _pFontSizeLB
->IsPtRelative() )
478 nHeight
= rOldItem
.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB
->GetValue() / 10) );
480 nHeight
= static_cast<long>(rOldItem
.GetHeight() * _pFontSizeLB
->GetValue() / 100);
482 // conversion twips for the example-window
484 ItemToControl( nHeight
, _pPage
->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich
), SFX_FUNIT_TWIP
);
486 else if ( !_pFontSizeLB
->GetText().isEmpty() )
487 aSize
.Height() = PointToTwips( static_cast<long>(_pFontSizeLB
->GetValue() / 10) );
489 aSize
.Height() = 200; // default 10pt
490 aFontInfo
.SetSize( aSize
);
492 _rFont
.SetLanguage(_pLanguageLB
->GetSelectLanguage());
494 _rFont
.SetFamily( aFontInfo
.GetFamily() );
495 _rFont
.SetName( aFontInfo
.GetName() );
496 _rFont
.SetStyleName( aFontInfo
.GetStyleName() );
497 _rFont
.SetPitch( aFontInfo
.GetPitch() );
498 _rFont
.SetCharSet( aFontInfo
.GetCharSet() );
499 _rFont
.SetWeight( aFontInfo
.GetWeight() );
500 _rFont
.SetItalic( aFontInfo
.GetItalic() );
501 _rFont
.SetSize( aFontInfo
.GetSize() );
507 // -----------------------------------------------------------------------
509 void SvxCharNamePage::UpdatePreview_Impl()
511 SvxFont
& rFont
= GetPreviewFont();
512 SvxFont
& rCJKFont
= GetPreviewCJKFont();
513 SvxFont
& rCTLFont
= GetPreviewCTLFont();
515 Size aSize
= rFont
.GetSize();
517 Size aCJKSize
= rCJKFont
.GetSize();
518 aCJKSize
.Width() = 0;
519 Size aCTLSize
= rCTLFont
.GetSize();
520 aCTLSize
.Width() = 0;
522 const FontList
* pFontList
= GetFontList();
524 FontInfo aWestFontInfo
= calcFontInfo(rFont
, this, m_pWestFontNameLB
,
525 m_pWestFontStyleLB
, m_pWestFontSizeLB
, m_pWestFontLanguageLB
,
526 pFontList
, GetWhich(SID_ATTR_CHAR_FONT
),
527 GetWhich(SID_ATTR_CHAR_FONTHEIGHT
));
528 m_pWestFontTypeFT
->SetText(pFontList
->GetFontMapText(aWestFontInfo
));
530 FontInfo aEastFontInfo
= calcFontInfo(rCJKFont
, this, m_pEastFontNameLB
,
531 m_pEastFontStyleLB
, m_pEastFontSizeLB
, m_pEastFontLanguageLB
,
532 pFontList
, GetWhich(SID_ATTR_CHAR_CJK_FONT
),
533 GetWhich(SID_ATTR_CHAR_CJK_FONTHEIGHT
));
534 m_pEastFontTypeFT
->SetText(pFontList
->GetFontMapText(aEastFontInfo
));
536 FontInfo aCTLFontInfo
= calcFontInfo(rCTLFont
,
537 this, m_pCTLFontNameLB
, m_pCTLFontStyleLB
, m_pCTLFontSizeLB
,
538 m_pCTLFontLanguageLB
, pFontList
, GetWhich(SID_ATTR_CHAR_CTL_FONT
),
539 GetWhich(SID_ATTR_CHAR_CTL_FONTHEIGHT
));
540 m_pCTLFontTypeFT
->SetText(pFontList
->GetFontMapText(aCTLFontInfo
));
542 m_pPreviewWin
->Invalidate();
545 // -----------------------------------------------------------------------
547 void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox
* pNameBox
)
549 const FontList
* pFontList
= GetFontList();
550 DBG_ASSERT( pFontList
, "no fontlist" );
552 FontStyleBox
* pStyleBox
= NULL
;
554 if ( m_pWestFontNameLB
== pNameBox
)
555 pStyleBox
= m_pWestFontStyleLB
;
556 else if ( m_pEastFontNameLB
== pNameBox
)
557 pStyleBox
= m_pEastFontStyleLB
;
558 else if ( m_pCTLFontNameLB
== pNameBox
)
559 pStyleBox
= m_pCTLFontStyleLB
;
562 SAL_WARN( "cui.tabpages", "invalid font name box" );
566 pStyleBox
->Fill( pNameBox
->GetText(), pFontList
);
568 if ( m_pImpl
->m_bInSearchMode
)
570 // additional entries for the search:
571 // "not bold" and "not italic"
572 String aEntry
= m_pImpl
->m_aNoStyleText
;
573 const sal_Char sS
[] = "%1";
574 aEntry
.SearchAndReplaceAscii( sS
, pFontList
->GetBoldStr() );
575 m_pImpl
->m_nExtraEntryPos
= pStyleBox
->InsertEntry( aEntry
);
576 aEntry
= m_pImpl
->m_aNoStyleText
;
577 aEntry
.SearchAndReplaceAscii( sS
, pFontList
->GetItalicStr() );
578 pStyleBox
->InsertEntry( aEntry
);
582 // -----------------------------------------------------------------------
584 void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox
* pNameBox
)
586 const FontList
* pFontList
= GetFontList();
587 DBG_ASSERT( pFontList
, "no fontlist" );
589 FontStyleBox
* pStyleBox
= NULL
;
590 FontSizeBox
* pSizeBox
= NULL
;
592 if ( m_pWestFontNameLB
== pNameBox
)
594 pStyleBox
= m_pWestFontStyleLB
;
595 pSizeBox
= m_pWestFontSizeLB
;
597 else if ( m_pEastFontNameLB
== pNameBox
)
599 pStyleBox
= m_pEastFontStyleLB
;
600 pSizeBox
= m_pEastFontSizeLB
;
602 else if ( m_pCTLFontNameLB
== pNameBox
)
604 pStyleBox
= m_pCTLFontStyleLB
;
605 pSizeBox
= m_pCTLFontSizeLB
;
609 SAL_WARN( "cui.tabpages", "invalid font name box" );
613 FontInfo
_aFontInfo( pFontList
->Get( pNameBox
->GetText(), pStyleBox
->GetText() ) );
614 pSizeBox
->Fill( &_aFontInfo
, pFontList
);
617 // -----------------------------------------------------------------------
619 void SvxCharNamePage::Reset_Impl( const SfxItemSet
& rSet
, LanguageGroup eLangGrp
)
621 FontNameBox
* pNameBox
= NULL
;
622 FixedText
* pStyleLabel
= NULL
;
623 FontStyleBox
* pStyleBox
= NULL
;
624 FixedText
* pSizeLabel
= NULL
;
625 FontSizeBox
* pSizeBox
= NULL
;
626 FixedText
* pLangFT
= NULL
;
627 SvxLanguageBox
* pLangBox
= NULL
;
628 sal_uInt16 nWhich
= 0;
633 pNameBox
= m_pWestFontNameLB
;
634 pStyleLabel
= m_pWestFontStyleFT
;
635 pStyleBox
= m_pWestFontStyleLB
;
636 pSizeLabel
= m_pWestFontSizeFT
;
637 pSizeBox
= m_pWestFontSizeLB
;
638 pLangFT
= m_pWestFontLanguageFT
;
639 pLangBox
= m_pWestFontLanguageLB
;
640 nWhich
= GetWhich( SID_ATTR_CHAR_FONT
);
644 pNameBox
= m_pEastFontNameLB
;
645 pStyleLabel
= m_pEastFontStyleFT
;
646 pStyleBox
= m_pEastFontStyleLB
;
647 pSizeLabel
= m_pEastFontSizeFT
;
648 pSizeBox
= m_pEastFontSizeLB
;
649 pLangFT
= m_pEastFontLanguageFT
;
650 pLangBox
= m_pEastFontLanguageLB
;
651 nWhich
= GetWhich( SID_ATTR_CHAR_CJK_FONT
);
655 pNameBox
= m_pCTLFontNameLB
;
656 pStyleLabel
= m_pCTLFontStyleFT
;
657 pStyleBox
= m_pCTLFontStyleLB
;
658 pSizeLabel
= m_pCTLFontSizeFT
;
659 pSizeBox
= m_pCTLFontSizeLB
;
660 pLangFT
= m_pCTLFontLanguageFT
;
661 pLangBox
= m_pCTLFontLanguageLB
;
662 nWhich
= GetWhich( SID_ATTR_CHAR_CTL_FONT
);
666 const FontList
* pFontList
= GetFontList();
667 pNameBox
->Fill( pFontList
);
669 const SvxFontItem
* pFontItem
= NULL
;
670 SfxItemState eState
= rSet
.GetItemState( nWhich
);
672 if ( eState
>= SFX_ITEM_DEFAULT
)
674 pFontItem
= (const SvxFontItem
*)&( rSet
.Get( nWhich
) );
675 pNameBox
->SetText( pFontItem
->GetFamilyName() );
679 pNameBox
->SetText( String() );
682 FillStyleBox_Impl( pNameBox
);
685 bool bStyleAvailable
= true;
686 FontItalic eItalic
= ITALIC_NONE
;
687 FontWeight eWeight
= WEIGHT_NORMAL
;
690 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_POSTURE
); break;
691 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_POSTURE
); break;
692 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_POSTURE
); break;
694 eState
= rSet
.GetItemState( nWhich
);
696 if ( eState
>= SFX_ITEM_DEFAULT
)
698 const SvxPostureItem
& rItem
= (SvxPostureItem
&)rSet
.Get( nWhich
);
699 eItalic
= (FontItalic
)rItem
.GetValue();
702 bStyleAvailable
= bStyleAvailable
&& (eState
>= SFX_ITEM_DONTCARE
);
706 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_WEIGHT
); break;
707 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_WEIGHT
); break;
708 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_WEIGHT
); break;
710 eState
= rSet
.GetItemState( nWhich
);
712 if ( eState
>= SFX_ITEM_DEFAULT
)
714 SvxWeightItem
& rItem
= (SvxWeightItem
&)rSet
.Get( nWhich
);
715 eWeight
= (FontWeight
)rItem
.GetValue();
719 bStyleAvailable
= bStyleAvailable
&& (eState
>= SFX_ITEM_DONTCARE
);
721 // currently chosen font
722 if ( bStyle
&& pFontItem
)
724 FontInfo aInfo
= pFontList
->Get( pFontItem
->GetFamilyName(), eWeight
, eItalic
);
725 pStyleBox
->SetText( pFontList
->GetStyleName( aInfo
) );
727 else if ( !m_pImpl
->m_bInSearchMode
|| !bStyle
)
729 pStyleBox
->SetText( String() );
733 FontInfo aInfo
= pFontList
->Get( String(), eWeight
, eItalic
);
734 pStyleBox
->SetText( pFontList
->GetStyleName( aInfo
) );
736 if (!bStyleAvailable
)
738 pStyleBox
->Disable( );
739 pStyleLabel
->Disable( );
742 FillSizeBox_Impl( pNameBox
);
745 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_FONTHEIGHT
); break;
746 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT
); break;
747 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT
); break;
749 eState
= rSet
.GetItemState( nWhich
);
751 if ( pSizeBox
->IsRelativeMode() )
753 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
754 const SvxFontHeightItem
& rItem
= (SvxFontHeightItem
&)rSet
.Get( nWhich
);
756 if( rItem
.GetProp() != 100 || SFX_MAPUNIT_RELATIVE
!= rItem
.GetPropUnit() )
758 sal_Bool bPtRel
= SFX_MAPUNIT_POINT
== rItem
.GetPropUnit();
759 pSizeBox
->SetPtRelative( bPtRel
);
760 pSizeBox
->SetValue( bPtRel
? ((short)rItem
.GetProp()) * 10 : rItem
.GetProp() );
764 pSizeBox
->SetRelative();
765 pSizeBox
->SetValue( (long)CalcToPoint( rItem
.GetHeight(), eUnit
, 10 ) );
768 else if ( eState
>= SFX_ITEM_DEFAULT
)
770 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
771 const SvxFontHeightItem
& rItem
= (SvxFontHeightItem
&)rSet
.Get( nWhich
);
772 pSizeBox
->SetValue( (long)CalcToPoint( rItem
.GetHeight(), eUnit
, 10 ) );
776 pSizeBox
->SetText( String() );
777 if ( eState
<= SFX_ITEM_READONLY
)
779 pSizeBox
->Disable( );
780 pSizeLabel
->Disable( );
786 case Western
: nWhich
= GetWhich( SID_ATTR_CHAR_LANGUAGE
); break;
787 case Asian
: nWhich
= GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE
); break;
788 case Ctl
: nWhich
= GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE
); break;
790 pLangBox
->SetNoSelection();
791 eState
= rSet
.GetItemState( nWhich
);
795 case SFX_ITEM_UNKNOWN
:
800 case SFX_ITEM_DISABLED
:
801 case SFX_ITEM_READONLY
:
806 case SFX_ITEM_DEFAULT
:
809 const SvxLanguageItem
& rItem
= (SvxLanguageItem
&)rSet
.Get( nWhich
);
810 LanguageType eLangType
= (LanguageType
)rItem
.GetValue();
811 DBG_ASSERT( eLangType
!= LANGUAGE_SYSTEM
, "LANGUAGE_SYSTEM not allowed" );
812 if ( eLangType
!= LANGUAGE_DONTKNOW
)
813 pLangBox
->SelectLanguage( eLangType
);
818 OUString
sMapText(pFontList
->GetFontMapText(
819 pFontList
->Get(pNameBox
->GetText(), pStyleBox
->GetText())));
824 m_pWestFontTypeFT
->SetText(sMapText
);
827 m_pEastFontTypeFT
->SetText(sMapText
);
830 m_pCTLFontTypeFT
->SetText(sMapText
);
834 // save these settings
835 pNameBox
->SaveValue();
836 pStyleBox
->SaveValue();
837 pSizeBox
->SaveValue();
838 pLangBox
->SaveValue();
841 // -----------------------------------------------------------------------
843 sal_Bool
SvxCharNamePage::FillItemSet_Impl( SfxItemSet
& rSet
, LanguageGroup eLangGrp
)
845 sal_Bool bModified
= sal_False
;
847 FontNameBox
* pNameBox
= NULL
;
848 FontStyleBox
* pStyleBox
= NULL
;
849 FontSizeBox
* pSizeBox
= NULL
;
850 SvxLanguageBox
* pLangBox
= NULL
;
851 sal_uInt16 nWhich
= 0;
852 sal_uInt16 nSlot
= 0;
857 pNameBox
= m_pWestFontNameLB
;
858 pStyleBox
= m_pWestFontStyleLB
;
859 pSizeBox
= m_pWestFontSizeLB
;
860 pLangBox
= m_pWestFontLanguageLB
;
861 nSlot
= SID_ATTR_CHAR_FONT
;
865 pNameBox
= m_pEastFontNameLB
;
866 pStyleBox
= m_pEastFontStyleLB
;
867 pSizeBox
= m_pEastFontSizeLB
;
868 pLangBox
= m_pEastFontLanguageLB
;
869 nSlot
= SID_ATTR_CHAR_CJK_FONT
;
873 pNameBox
= m_pCTLFontNameLB
;
874 pStyleBox
= m_pCTLFontStyleLB
;
875 pSizeBox
= m_pCTLFontSizeLB
;
876 pLangBox
= m_pCTLFontLanguageLB
;
877 nSlot
= SID_ATTR_CHAR_CTL_FONT
;
881 nWhich
= GetWhich( nSlot
);
882 const SfxPoolItem
* pItem
= NULL
;
883 const SfxItemSet
& rOldSet
= GetItemSet();
884 const SfxPoolItem
* pOld
= NULL
;
886 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
888 bool bChanged
= true;
889 const String
& rFontName
= pNameBox
->GetText();
890 const FontList
* pFontList
= GetFontList();
891 String aStyleBoxText
=pStyleBox
->GetText();
892 sal_uInt16 nEntryPos
= pStyleBox
->GetEntryPos( aStyleBoxText
);
893 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
894 aStyleBoxText
.Erase();
895 FontInfo
aInfo( pFontList
->Get( rFontName
, aStyleBoxText
) );
896 SvxFontItem
aFontItem( aInfo
.GetFamily(), aInfo
.GetName(), aInfo
.GetStyleName(),
897 aInfo
.GetPitch(), aInfo
.GetCharSet(), nWhich
);
898 pOld
= GetOldItem( rSet
, nSlot
);
902 const SvxFontItem
& rItem
= *( (const SvxFontItem
*)pOld
);
904 if ( rItem
.GetFamilyName() == aFontItem
.GetFamilyName() )
909 bChanged
= pNameBox
->GetSavedValue().isEmpty();
911 if ( !bChanged
&& pExampleSet
&&
912 pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
913 ( (SvxFontItem
*)pItem
)->GetFamilyName() != aFontItem
.GetFamilyName() )
916 if ( bChanged
&& rFontName
.Len() )
918 rSet
.Put( aFontItem
);
919 bModified
= sal_True
;
921 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
922 rSet
.ClearItem( nWhich
);
928 case Western
: nSlot
= SID_ATTR_CHAR_WEIGHT
; break;
929 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_WEIGHT
; break;
930 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_WEIGHT
; break;
932 nWhich
= GetWhich( nSlot
);
933 FontWeight eWeight
= aInfo
.GetWeight();
934 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
935 eWeight
= WEIGHT_NORMAL
;
936 SvxWeightItem
aWeightItem( eWeight
, nWhich
);
937 pOld
= GetOldItem( rSet
, nSlot
);
941 const SvxWeightItem
& rItem
= *( (const SvxWeightItem
*)pOld
);
943 if ( rItem
.GetValue() == aWeightItem
.GetValue() )
949 bChanged
= pStyleBox
->GetSavedValue().isEmpty();
951 if ( m_pImpl
->m_bInSearchMode
&& bChanged
&&
952 aInfo
.GetWeight() == WEIGHT_NORMAL
&& aInfo
.GetItalic() != ITALIC_NONE
)
956 if ( !bChanged
&& pExampleSet
&&
957 pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
958 ( (SvxWeightItem
*)pItem
)->GetValue() != aWeightItem
.GetValue() )
961 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
962 bChanged
= ( nEntryPos
== m_pImpl
->m_nExtraEntryPos
);
964 String
aText( pStyleBox
->GetText() ); // Tristate, then text empty
966 if ( bChanged
&& aText
.Len() )
968 rSet
.Put( aWeightItem
);
969 bModified
= sal_True
;
971 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
977 case Western
: nSlot
= SID_ATTR_CHAR_POSTURE
; break;
978 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_POSTURE
; break;
979 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_POSTURE
; break;
981 nWhich
= GetWhich( nSlot
);
982 FontItalic eItalic
= aInfo
.GetItalic();
983 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
984 eItalic
= ITALIC_NONE
;
985 SvxPostureItem
aPostureItem( eItalic
, nWhich
);
986 pOld
= GetOldItem( rSet
, nSlot
);
990 const SvxPostureItem
& rItem
= *( (const SvxPostureItem
*)pOld
);
992 if ( rItem
.GetValue() == aPostureItem
.GetValue() )
998 bChanged
= pStyleBox
->GetSavedValue().isEmpty();
1000 if ( m_pImpl
->m_bInSearchMode
&& bChanged
&&
1001 aInfo
.GetItalic() == ITALIC_NONE
&& aInfo
.GetWeight() != WEIGHT_NORMAL
)
1005 if ( !bChanged
&& pExampleSet
&&
1006 pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
1007 ( (SvxPostureItem
*)pItem
)->GetValue() != aPostureItem
.GetValue() )
1010 if ( nEntryPos
>= m_pImpl
->m_nExtraEntryPos
)
1011 bChanged
= ( nEntryPos
== ( m_pImpl
->m_nExtraEntryPos
+ 1 ) );
1013 if ( bChanged
&& aText
.Len() )
1015 rSet
.Put( aPostureItem
);
1016 bModified
= sal_True
;
1018 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
1022 long nSize
= static_cast<long>(pSizeBox
->GetValue());
1024 if ( pSizeBox
->GetText().isEmpty() ) // GetValue() returns the min-value
1026 long nSavedSize
= pSizeBox
->GetSavedValue().toInt32();
1029 if ( !pSizeBox
->IsRelative() )
1037 case Western
: nSlot
= SID_ATTR_CHAR_FONTHEIGHT
; break;
1038 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_FONTHEIGHT
; break;
1039 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_FONTHEIGHT
; break;
1041 nWhich
= GetWhich( nSlot
);
1042 const SvxFontHeightItem
* pOldHeight
= (const SvxFontHeightItem
*)GetOldItem( rSet
, nSlot
);
1043 bChanged
= ( nSize
!= nSavedSize
);
1045 if ( !bChanged
&& pExampleSet
&&
1046 pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
)
1048 float fSize
= (float)nSize
/ 10;
1049 long nVal
= CalcToUnit( fSize
, rSet
.GetPool()->GetMetric( nWhich
) );
1050 if ( ( (SvxFontHeightItem
*)pItem
)->GetHeight() != (sal_uInt32
)nVal
)
1054 if ( bChanged
|| !pOldHeight
||
1055 bRel
!= ( SFX_MAPUNIT_RELATIVE
!= pOldHeight
->GetPropUnit() || 100 != pOldHeight
->GetProp() ) )
1057 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
1058 if ( pSizeBox
->IsRelative() )
1060 DBG_ASSERT( GetItemSet().GetParent(), "No parent set" );
1061 const SvxFontHeightItem
& rOldItem
=
1062 (const SvxFontHeightItem
&)GetItemSet().GetParent()->Get( nWhich
);
1064 SvxFontHeightItem
aHeight( 240, 100, nWhich
);
1065 if ( pSizeBox
->IsPtRelative() )
1066 aHeight
.SetHeight( rOldItem
.GetHeight(), (sal_uInt16
)( nSize
/ 10 ), SFX_MAPUNIT_POINT
, eUnit
);
1068 aHeight
.SetHeight( rOldItem
.GetHeight(), (sal_uInt16
)nSize
, SFX_MAPUNIT_RELATIVE
);
1069 rSet
.Put( aHeight
);
1073 float fSize
= (float)nSize
/ 10;
1074 rSet
.Put( SvxFontHeightItem( CalcToUnit( fSize
, eUnit
), 100, nWhich
) );
1076 bModified
= sal_True
;
1078 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
1084 case Western
: nSlot
= SID_ATTR_CHAR_LANGUAGE
; break;
1085 case Asian
: nSlot
= SID_ATTR_CHAR_CJK_LANGUAGE
; break;
1086 case Ctl
: nSlot
= SID_ATTR_CHAR_CTL_LANGUAGE
; break;
1088 nWhich
= GetWhich( nSlot
);
1089 pOld
= GetOldItem( rSet
, nSlot
);
1090 sal_uInt16 nLangPos
= pLangBox
->GetSelectEntryPos();
1091 LanguageType eLangType
= (LanguageType
)(sal_uLong
)pLangBox
->GetEntryData( nLangPos
);
1095 const SvxLanguageItem
& rItem
= *( (const SvxLanguageItem
*)pOld
);
1097 if ( nLangPos
== LISTBOX_ENTRY_NOTFOUND
|| eLangType
== (LanguageType
)rItem
.GetValue() )
1102 bChanged
= ( pLangBox
->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
);
1104 if ( bChanged
&& nLangPos
!= LISTBOX_ENTRY_NOTFOUND
)
1106 rSet
.Put( SvxLanguageItem( eLangType
, nWhich
) );
1107 bModified
= sal_True
;
1109 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
1115 // -----------------------------------------------------------------------
1117 IMPL_LINK_NOARG(SvxCharNamePage
, UpdateHdl_Impl
)
1119 UpdatePreview_Impl();
1123 // -----------------------------------------------------------------------
1125 IMPL_LINK( SvxCharNamePage
, FontModifyHdl_Impl
, void*, pNameBox
)
1127 m_pImpl
->m_aUpdateTimer
.Start();
1129 if ( m_pWestFontNameLB
== pNameBox
|| m_pEastFontNameLB
== pNameBox
|| m_pCTLFontNameLB
== pNameBox
)
1131 FillStyleBox_Impl( (FontNameBox
*)pNameBox
);
1132 FillSizeBox_Impl( (FontNameBox
*)pNameBox
);
1137 // -----------------------------------------------------------------------
1139 void SvxCharNamePage::ActivatePage( const SfxItemSet
& rSet
)
1141 SvxCharBasePage::ActivatePage( rSet
);
1143 UpdatePreview_Impl(); // instead of asynchronous calling in ctor
1146 // -----------------------------------------------------------------------
1148 int SvxCharNamePage::DeactivatePage( SfxItemSet
* _pSet
)
1151 FillItemSet( *_pSet
);
1155 // -----------------------------------------------------------------------
1157 SfxTabPage
* SvxCharNamePage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1159 return new SvxCharNamePage( pParent
, rSet
);
1162 // -----------------------------------------------------------------------
1164 sal_uInt16
* SvxCharNamePage::GetRanges()
1169 // -----------------------------------------------------------------------
1171 void SvxCharNamePage::Reset( const SfxItemSet
& rSet
)
1173 Reset_Impl( rSet
, Western
);
1174 Reset_Impl( rSet
, Asian
);
1175 Reset_Impl( rSet
, Ctl
);
1177 SetPrevFontWidthScale( rSet
);
1178 UpdatePreview_Impl();
1181 // -----------------------------------------------------------------------
1183 sal_Bool
SvxCharNamePage::FillItemSet( SfxItemSet
& rSet
)
1185 sal_Bool bModified
= FillItemSet_Impl( rSet
, Western
);
1186 bModified
|= FillItemSet_Impl( rSet
, Asian
);
1187 bModified
|= FillItemSet_Impl( rSet
, Ctl
);
1191 // -----------------------------------------------------------------------
1193 void SvxCharNamePage::SetFontList( const SvxFontListItem
& rItem
)
1195 if ( m_pImpl
->m_bMustDelete
)
1197 delete m_pImpl
->m_pFontList
;
1199 m_pImpl
->m_pFontList
= rItem
.GetFontList()->Clone();
1200 m_pImpl
->m_bMustDelete
= sal_True
;
1203 // -----------------------------------------------------------------------
1206 void enableRelativeMode( SvxCharNamePage
* _pPage
, FontSizeBox
* _pFontSizeLB
, sal_uInt16 _nHeightWhich
)
1208 _pFontSizeLB
->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5
1210 const SvxFontHeightItem
& rHeightItem
=
1211 (SvxFontHeightItem
&)_pPage
->GetItemSet().GetParent()->Get( _nHeightWhich
);
1212 SfxMapUnit eUnit
= _pPage
->GetItemSet().GetPool()->GetMetric( _nHeightWhich
);
1214 static_cast< short >( CalcToPoint( rHeightItem
.GetHeight(), eUnit
, 1 ) * 10 );
1216 // based on the current height:
1217 // - negative until minimum of 2 pt
1218 // - positive until maximum of 999 pt
1219 _pFontSizeLB
->EnablePtRelativeMode( sal::static_int_cast
< short >(-(nCurHeight
- 20)), (9999 - nCurHeight
), 10 );
1222 // -----------------------------------------------------------------------------
1224 void SvxCharNamePage::EnableRelativeMode()
1226 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" );
1227 enableRelativeMode(this,m_pWestFontSizeLB
,GetWhich( SID_ATTR_CHAR_FONTHEIGHT
));
1228 enableRelativeMode(this,m_pEastFontSizeLB
,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT
));
1229 enableRelativeMode(this,m_pCTLFontSizeLB
,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT
));
1232 // -----------------------------------------------------------------------
1234 void SvxCharNamePage::EnableSearchMode()
1236 m_pImpl
->m_bInSearchMode
= sal_True
;
1238 // -----------------------------------------------------------------------
1239 void SvxCharNamePage::DisableControls( sal_uInt16 nDisable
)
1241 if ( DISABLE_LANGUAGE
& nDisable
)
1243 if ( m_pWestFontLanguageFT
) m_pWestFontLanguageFT
->Disable();
1244 if ( m_pWestFontLanguageLB
) m_pWestFontLanguageLB
->Disable();
1245 if ( m_pEastFontLanguageFT
) m_pEastFontLanguageFT
->Disable();
1246 if ( m_pEastFontLanguageLB
) m_pEastFontLanguageLB
->Disable();
1247 if ( m_pCTLFontLanguageFT
) m_pCTLFontLanguageFT
->Disable();
1248 if ( m_pCTLFontLanguageLB
) m_pCTLFontLanguageLB
->Disable();
1251 if ( DISABLE_HIDE_LANGUAGE
& nDisable
)
1253 if ( m_pWestFontLanguageFT
) m_pWestFontLanguageFT
->Hide();
1254 if ( m_pWestFontLanguageLB
) m_pWestFontLanguageLB
->Hide();
1255 if ( m_pEastFontLanguageFT
) m_pEastFontLanguageFT
->Hide();
1256 if ( m_pEastFontLanguageLB
) m_pEastFontLanguageLB
->Hide();
1257 if ( m_pCTLFontLanguageFT
) m_pCTLFontLanguageFT
->Hide();
1258 if ( m_pCTLFontLanguageLB
) m_pCTLFontLanguageLB
->Hide();
1262 // -----------------------------------------------------------------------
1263 void SvxCharNamePage::SetPreviewBackgroundToCharacter()
1265 m_bPreviewBackgroundToCharacter
= sal_True
;
1268 // -----------------------------------------------------------------------
1269 void SvxCharNamePage::PageCreated (SfxAllItemSet aSet
)
1271 SFX_ITEMSET_ARG (&aSet
,pFontListItem
,SvxFontListItem
,SID_ATTR_CHAR_FONTLIST
,sal_False
);
1272 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
1273 SFX_ITEMSET_ARG (&aSet
,pDisalbeItem
,SfxUInt16Item
,SID_DISABLE_CTL
,sal_False
);
1275 SetFontList(*pFontListItem
);
1279 sal_uInt32 nFlags
=pFlagItem
->GetValue();
1280 if ( ( nFlags
& SVX_RELATIVE_MODE
) == SVX_RELATIVE_MODE
)
1281 EnableRelativeMode();
1282 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
1283 SetPreviewBackgroundToCharacter();
1286 DisableControls(pDisalbeItem
->GetValue());
1288 // class SvxCharEffectsPage ----------------------------------------------
1290 SvxCharEffectsPage::SvxCharEffectsPage( Window
* pParent
, const SfxItemSet
& rInSet
)
1291 : SvxCharBasePage(pParent
, "EffectsPage", "cui/ui/effectspage.ui", rInSet
)
1292 , m_aTransparentColorName(CUI_RES(RID_SVXSTR_CHARNAME_TRANSPARENT
))
1294 get(m_pFontColorFT
, "fontcolorft");
1295 get(m_pFontColorLB
, "fontcolorlb");
1296 get(m_pEffectsFT
, "effectsft");
1297 get(m_pEffectsLB
, "effectslb");
1298 get(m_pReliefFT
, "reliefft");
1299 get(m_pReliefLB
, "relieflb");
1300 get(m_pOutlineBtn
, "outlinecb");
1301 get(m_pShadowBtn
, "shadowcb");
1302 get(m_pBlinkingBtn
, "blinkingcb");
1303 get(m_pHiddenBtn
, "hiddencb");
1304 get(m_pOverlineLB
, "overlinelb");
1305 get(m_pOverlineColorFT
, "overlinecolorft");
1306 get(m_pOverlineColorLB
, "overlinecolorlb");
1307 get(m_pStrikeoutLB
, "strikeoutlb");
1308 get(m_pUnderlineLB
, "underlinelb");
1309 get(m_pUnderlineColorFT
, "underlinecolorft");
1310 get(m_pUnderlineColorLB
, "underlinecolorlb");
1311 get(m_pIndividualWordsBtn
, "individualwordscb");
1312 get(m_pEmphasisFT
, "emphasisft");
1313 get(m_pEmphasisLB
, "emphasislb");
1314 get(m_pPositionFT
, "positionft");
1315 get(m_pPositionLB
, "positionlb");
1317 get(m_pPreviewWin
, "preview");
1321 // -----------------------------------------------------------------------
1323 void SvxCharEffectsPage::Initialize()
1325 // to handle the changes of the other pages
1326 SetExchangeSupport();
1329 const SfxPoolItem
* pItem
;
1330 SfxObjectShell
* pShell
;
1331 if ( SFX_ITEM_SET
== GetItemSet().GetItemState( SID_HTML_MODE
, sal_False
, &pItem
) ||
1332 ( NULL
!= ( pShell
= SfxObjectShell::Current() ) &&
1333 NULL
!= ( pItem
= pShell
->GetItem( SID_HTML_MODE
) ) ) )
1335 m_nHtmlMode
= ( (const SfxUInt16Item
*)pItem
)->GetValue();
1336 if ( ( m_nHtmlMode
& HTMLMODE_ON
) == HTMLMODE_ON
)
1338 //!!! hide some controls please
1342 // fill the color box
1343 SfxObjectShell
* pDocSh
= SfxObjectShell::Current();
1344 DBG_ASSERT( pDocSh
, "DocShell not found!" );
1345 XColorListRef pColorTable
;
1349 pItem
= pDocSh
->GetItem( SID_COLOR_TABLE
);
1350 if ( pItem
!= NULL
)
1351 pColorTable
= ( (SvxColorListItem
*)pItem
)->GetColorList();
1354 if ( !pColorTable
.is() )
1355 pColorTable
= XColorList::CreateStdColorList();
1357 m_pUnderlineColorLB
->SetUpdateMode( sal_False
);
1358 m_pOverlineColorLB
->SetUpdateMode( sal_False
);
1359 m_pFontColorLB
->SetUpdateMode( sal_False
);
1362 SfxPoolItem
* pDummy
= NULL
;
1363 SfxViewFrame
* pFrame
= SfxViewFrame::GetFirst( pDocSh
);
1365 SFX_ITEM_DEFAULT
> pFrame
->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID
, pDummy
) )
1367 m_pUnderlineColorLB
->InsertAutomaticEntryColor( Color( COL_AUTO
) );
1368 m_pOverlineColorLB
->InsertAutomaticEntryColor( Color( COL_AUTO
) );
1369 m_pFontColorLB
->InsertAutomaticEntryColor( Color( COL_AUTO
) );
1373 for ( long i
= 0; i
< pColorTable
->Count(); i
++ )
1375 XColorEntry
* pEntry
= pColorTable
->GetColor(i
);
1376 m_pUnderlineColorLB
->InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1377 m_pOverlineColorLB
->InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1378 m_pFontColorLB
->InsertEntry( pEntry
->GetColor(), pEntry
->GetName() );
1381 m_pUnderlineColorLB
->SetUpdateMode( sal_True
);
1382 m_pOverlineColorLB
->SetUpdateMode( sal_True
);
1383 m_pFontColorLB
->SetUpdateMode( sal_True
);
1384 m_pFontColorLB
->SetSelectHdl( LINK( this, SvxCharEffectsPage
, ColorBoxSelectHdl_Impl
) );
1387 Link aLink
= LINK( this, SvxCharEffectsPage
, SelectHdl_Impl
);
1388 m_pUnderlineLB
->SetSelectHdl( aLink
);
1389 m_pUnderlineColorLB
->SetSelectHdl( aLink
);
1390 m_pOverlineLB
->SetSelectHdl( aLink
);
1391 m_pOverlineColorLB
->SetSelectHdl( aLink
);
1392 m_pStrikeoutLB
->SetSelectHdl( aLink
);
1393 m_pEmphasisLB
->SetSelectHdl( aLink
);
1394 m_pPositionLB
->SetSelectHdl( aLink
);
1395 m_pEffectsLB
->SetSelectHdl( aLink
);
1396 m_pReliefLB
->SetSelectHdl( aLink
);
1398 m_pUnderlineLB
->SelectEntryPos( 0 );
1399 m_pUnderlineColorLB
->SelectEntryPos( 0 );
1400 m_pOverlineLB
->SelectEntryPos( 0 );
1401 m_pOverlineColorLB
->SelectEntryPos( 0 );
1402 m_pStrikeoutLB
->SelectEntryPos( 0 );
1403 m_pEmphasisLB
->SelectEntryPos( 0 );
1404 m_pPositionLB
->SelectEntryPos( 0 );
1405 SelectHdl_Impl( NULL
);
1406 SelectHdl_Impl( m_pEmphasisLB
);
1408 m_pEffectsLB
->SelectEntryPos( 0 );
1410 m_pIndividualWordsBtn
->SetClickHdl( LINK( this, SvxCharEffectsPage
, CbClickHdl_Impl
) );
1411 aLink
= LINK( this, SvxCharEffectsPage
, TristClickHdl_Impl
);
1412 m_pOutlineBtn
->SetClickHdl( aLink
);
1413 m_pShadowBtn
->SetClickHdl( aLink
);
1415 if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
1417 m_pEmphasisFT
->Hide();
1418 m_pEmphasisLB
->Hide();
1419 m_pPositionFT
->Hide();
1420 m_pPositionLB
->Hide();
1424 SvxCharEffectsPage::~SvxCharEffectsPage()
1428 // -----------------------------------------------------------------------
1430 void SvxCharEffectsPage::UpdatePreview_Impl()
1432 SvxFont
& rFont
= GetPreviewFont();
1433 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1434 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1436 sal_uInt16 nPos
= m_pUnderlineLB
->GetSelectEntryPos();
1437 FontUnderline eUnderline
= (FontUnderline
)(sal_uLong
)m_pUnderlineLB
->GetEntryData( nPos
);
1438 nPos
= m_pOverlineLB
->GetSelectEntryPos();
1439 FontUnderline eOverline
= (FontUnderline
)(sal_uLong
)m_pOverlineLB
->GetEntryData( nPos
);
1440 nPos
= m_pStrikeoutLB
->GetSelectEntryPos();
1441 FontStrikeout eStrikeout
= (FontStrikeout
)(sal_uLong
)m_pStrikeoutLB
->GetEntryData( nPos
);
1442 rFont
.SetUnderline( eUnderline
);
1443 rCJKFont
.SetUnderline( eUnderline
);
1444 rCTLFont
.SetUnderline( eUnderline
);
1445 m_pPreviewWin
->SetTextLineColor( m_pUnderlineColorLB
->GetSelectEntryColor() );
1446 rFont
.SetOverline( eOverline
);
1447 rCJKFont
.SetOverline( eOverline
);
1448 rCTLFont
.SetOverline( eOverline
);
1449 m_pPreviewWin
->SetOverlineColor( m_pOverlineColorLB
->GetSelectEntryColor() );
1450 rFont
.SetStrikeout( eStrikeout
);
1451 rCJKFont
.SetStrikeout( eStrikeout
);
1452 rCTLFont
.SetStrikeout( eStrikeout
);
1454 nPos
= m_pPositionLB
->GetSelectEntryPos();
1455 sal_Bool bUnder
= ( CHRDLG_POSITION_UNDER
== (sal_uLong
)m_pPositionLB
->GetEntryData( nPos
) );
1456 FontEmphasisMark eMark
= (FontEmphasisMark
)m_pEmphasisLB
->GetSelectEntryPos();
1457 eMark
|= bUnder
? EMPHASISMARK_POS_BELOW
: EMPHASISMARK_POS_ABOVE
;
1458 rFont
.SetEmphasisMark( eMark
);
1459 rCJKFont
.SetEmphasisMark( eMark
);
1460 rCTLFont
.SetEmphasisMark( eMark
);
1462 sal_uInt16 nRelief
= m_pReliefLB
->GetSelectEntryPos();
1463 if(LISTBOX_ENTRY_NOTFOUND
!= nRelief
)
1465 rFont
.SetRelief( (FontRelief
)nRelief
);
1466 rCJKFont
.SetRelief( (FontRelief
)nRelief
);
1467 rCTLFont
.SetRelief( (FontRelief
)nRelief
);
1470 rFont
.SetOutline( StateToAttr( m_pOutlineBtn
->GetState() ) );
1471 rCJKFont
.SetOutline( rFont
.IsOutline() );
1472 rCTLFont
.SetOutline( rFont
.IsOutline() );
1474 rFont
.SetShadow( StateToAttr( m_pShadowBtn
->GetState() ) );
1475 rCJKFont
.SetShadow( rFont
.IsShadow() );
1476 rCTLFont
.SetShadow( rFont
.IsShadow() );
1478 sal_uInt16 nCapsPos
= m_pEffectsLB
->GetSelectEntryPos();
1479 if ( nCapsPos
!= LISTBOX_ENTRY_NOTFOUND
)
1481 rFont
.SetCaseMap( (SvxCaseMap
)nCapsPos
);
1482 rCJKFont
.SetCaseMap( (SvxCaseMap
)nCapsPos
);
1483 // #i78474# small caps do not exist in CTL fonts
1484 rCTLFont
.SetCaseMap( static_cast<SvxCaseMap
>( nCapsPos
== SVX_CASEMAP_KAPITAELCHEN
? SVX_CASEMAP_NOT_MAPPED
: (SvxCaseMap
)nCapsPos
) );
1487 sal_Bool bWordLine
= m_pIndividualWordsBtn
->IsChecked();
1488 rFont
.SetWordLineMode( bWordLine
);
1489 rCJKFont
.SetWordLineMode( bWordLine
);
1490 rCTLFont
.SetWordLineMode( bWordLine
);
1492 m_pPreviewWin
->Invalidate();
1495 // -----------------------------------------------------------------------
1497 void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap
)
1499 if ( SVX_CASEMAP_END
> eCaseMap
)
1500 m_pEffectsLB
->SelectEntryPos(
1501 sal::static_int_cast
< sal_uInt16
>( eCaseMap
) );
1504 m_pEffectsLB
->SetNoSelection();
1505 eCaseMap
= SVX_CASEMAP_NOT_MAPPED
;
1508 UpdatePreview_Impl();
1511 // -----------------------------------------------------------------------
1513 void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet
& rSet
)
1515 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
1516 SfxItemState eState
= rSet
.GetItemState( nWhich
);
1520 case SFX_ITEM_UNKNOWN
:
1521 m_pFontColorFT
->Hide();
1522 m_pFontColorLB
->Hide();
1525 case SFX_ITEM_DISABLED
:
1526 case SFX_ITEM_READONLY
:
1527 m_pFontColorFT
->Disable();
1528 m_pFontColorLB
->Disable();
1531 case SFX_ITEM_DONTCARE
:
1532 m_pFontColorLB
->SetNoSelection();
1535 case SFX_ITEM_DEFAULT
:
1538 SvxFont
& rFont
= GetPreviewFont();
1539 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1540 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1542 const SvxColorItem
& rItem
= (SvxColorItem
&)rSet
.Get( nWhich
);
1543 Color aColor
= rItem
.GetValue();
1544 rFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1545 rCJKFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1546 rCTLFont
.SetColor( aColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aColor
);
1548 m_pPreviewWin
->Invalidate();
1549 sal_uInt16 nSelPos
= m_pFontColorLB
->GetEntryPos( aColor
);
1550 if ( nSelPos
== LISTBOX_ENTRY_NOTFOUND
&& aColor
== Color( COL_TRANSPARENT
) )
1551 nSelPos
= m_pFontColorLB
->GetEntryPos( m_aTransparentColorName
);
1553 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
1554 m_pFontColorLB
->SelectEntryPos( nSelPos
);
1557 nSelPos
= m_pFontColorLB
->GetEntryPos( aColor
);
1558 if ( LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
1559 m_pFontColorLB
->SelectEntryPos( nSelPos
);
1561 m_pFontColorLB
->SelectEntryPos(
1562 m_pFontColorLB
->InsertEntry( aColor
, String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
1569 // -----------------------------------------------------------------------
1571 sal_Bool
SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet
& rSet
)
1573 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_COLOR
);
1574 const SvxColorItem
* pOld
= (const SvxColorItem
*)GetOldItem( rSet
, SID_ATTR_CHAR_COLOR
);
1575 const SvxColorItem
* pItem
= NULL
;
1576 sal_Bool bChanged
= sal_True
;
1577 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
1578 const SfxItemSet
& rOldSet
= GetItemSet();
1580 Color aSelectedColor
;
1581 if ( m_pFontColorLB
->GetSelectEntry() == m_aTransparentColorName
)
1582 aSelectedColor
= Color( COL_TRANSPARENT
);
1584 aSelectedColor
= m_pFontColorLB
->GetSelectEntryColor();
1586 if ( pOld
&& pOld
->GetValue() == aSelectedColor
)
1587 bChanged
= sal_False
;
1590 bChanged
= ( m_pFontColorLB
->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
);
1592 if ( !bChanged
&& pExampleSet
&&
1593 pExampleSet
->GetItemState( nWhich
, sal_False
, (const SfxPoolItem
**)&pItem
) == SFX_ITEM_SET
&&
1594 ( (SvxColorItem
*)pItem
)->GetValue() != aSelectedColor
)
1595 bChanged
= sal_True
;
1597 sal_Bool bModified
= sal_False
;
1599 if ( bChanged
&& m_pFontColorLB
->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND
)
1601 rSet
.Put( SvxColorItem( aSelectedColor
, nWhich
) );
1602 bModified
= sal_True
;
1604 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
1610 // -----------------------------------------------------------------------
1612 IMPL_LINK( SvxCharEffectsPage
, SelectHdl_Impl
, ListBox
*, pBox
)
1614 if ( m_pEmphasisLB
== pBox
)
1616 sal_uInt16 nEPos
= m_pEmphasisLB
->GetSelectEntryPos();
1617 sal_Bool bEnable
= ( nEPos
> 0 && nEPos
!= LISTBOX_ENTRY_NOTFOUND
);
1618 m_pPositionFT
->Enable( bEnable
);
1619 m_pPositionLB
->Enable( bEnable
);
1621 else if( m_pReliefLB
== pBox
)
1623 sal_Bool bEnable
= ( pBox
->GetSelectEntryPos() == 0 );
1624 m_pOutlineBtn
->Enable( bEnable
);
1625 m_pShadowBtn
->Enable( bEnable
);
1627 else if ( m_pPositionLB
!= pBox
)
1629 sal_uInt16 nUPos
= m_pUnderlineLB
->GetSelectEntryPos(),
1630 nOPos
= m_pOverlineLB
->GetSelectEntryPos(),
1631 nSPos
= m_pStrikeoutLB
->GetSelectEntryPos();
1632 sal_Bool bUEnable
= ( nUPos
> 0 && nUPos
!= LISTBOX_ENTRY_NOTFOUND
);
1633 sal_Bool bOEnable
= ( nOPos
> 0 && nOPos
!= LISTBOX_ENTRY_NOTFOUND
);
1634 m_pUnderlineColorFT
->Enable( bUEnable
);
1635 m_pUnderlineColorLB
->Enable( bUEnable
);
1636 m_pOverlineColorFT
->Enable( bOEnable
);
1637 m_pOverlineColorLB
->Enable( bOEnable
);
1638 m_pIndividualWordsBtn
->Enable( bUEnable
|| bOEnable
|| ( nSPos
> 0 && nSPos
!= LISTBOX_ENTRY_NOTFOUND
) );
1640 UpdatePreview_Impl();
1644 // -----------------------------------------------------------------------
1646 IMPL_LINK_NOARG(SvxCharEffectsPage
, UpdatePreview_Impl
)
1648 bool bEnable
= ( ( m_pUnderlineLB
->GetSelectEntryPos() > 0 ) ||
1649 ( m_pOverlineLB
->GetSelectEntryPos() > 0 ) ||
1650 ( m_pStrikeoutLB
->GetSelectEntryPos() > 0 ) );
1651 m_pIndividualWordsBtn
->Enable( bEnable
);
1653 UpdatePreview_Impl();
1657 // -----------------------------------------------------------------------
1659 IMPL_LINK_NOARG(SvxCharEffectsPage
, CbClickHdl_Impl
)
1661 UpdatePreview_Impl();
1665 // -----------------------------------------------------------------------
1667 IMPL_LINK_NOARG(SvxCharEffectsPage
, TristClickHdl_Impl
)
1669 UpdatePreview_Impl();
1673 // -----------------------------------------------------------------------
1675 IMPL_LINK( SvxCharEffectsPage
, ColorBoxSelectHdl_Impl
, ColorListBox
*, pBox
)
1677 SvxFont
& rFont
= GetPreviewFont();
1678 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1679 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1681 Color aSelectedColor
;
1682 if ( pBox
->GetSelectEntry() == m_aTransparentColorName
)
1683 aSelectedColor
= Color( COL_TRANSPARENT
);
1685 aSelectedColor
= pBox
->GetSelectEntryColor();
1686 rFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1687 rCJKFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1688 rCTLFont
.SetColor( aSelectedColor
.GetColor() == COL_AUTO
? Color(COL_BLACK
) : aSelectedColor
);
1690 m_pPreviewWin
->Invalidate();
1693 // -----------------------------------------------------------------------
1695 int SvxCharEffectsPage::DeactivatePage( SfxItemSet
* _pSet
)
1698 FillItemSet( *_pSet
);
1702 // -----------------------------------------------------------------------
1704 SfxTabPage
* SvxCharEffectsPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1706 return new SvxCharEffectsPage( pParent
, rSet
);
1709 // -----------------------------------------------------------------------
1711 sal_uInt16
* SvxCharEffectsPage::GetRanges()
1713 return pEffectsRanges
;
1716 // -----------------------------------------------------------------------
1718 void SvxCharEffectsPage::Reset( const SfxItemSet
& rSet
)
1720 SvxFont
& rFont
= GetPreviewFont();
1721 SvxFont
& rCJKFont
= GetPreviewCJKFont();
1722 SvxFont
& rCTLFont
= GetPreviewCTLFont();
1724 sal_Bool bEnable
= sal_False
;
1727 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_UNDERLINE
);
1728 rFont
.SetUnderline( UNDERLINE_NONE
);
1729 rCJKFont
.SetUnderline( UNDERLINE_NONE
);
1730 rCTLFont
.SetUnderline( UNDERLINE_NONE
);
1732 m_pUnderlineLB
->SelectEntryPos( 0 );
1733 SfxItemState eState
= rSet
.GetItemState( nWhich
);
1735 if ( eState
>= SFX_ITEM_DONTCARE
)
1737 if ( eState
== SFX_ITEM_DONTCARE
)
1738 m_pUnderlineLB
->SetNoSelection();
1741 const SvxUnderlineItem
& rItem
= (SvxUnderlineItem
&)rSet
.Get( nWhich
);
1742 FontUnderline eUnderline
= (FontUnderline
)rItem
.GetValue();
1743 rFont
.SetUnderline( eUnderline
);
1744 rCJKFont
.SetUnderline( eUnderline
);
1745 rCTLFont
.SetUnderline( eUnderline
);
1747 if ( eUnderline
!= UNDERLINE_NONE
)
1749 for ( sal_uInt16 i
= 0; i
< m_pUnderlineLB
->GetEntryCount(); ++i
)
1751 if ( (FontUnderline
)(sal_uLong
)m_pUnderlineLB
->GetEntryData(i
) == eUnderline
)
1753 m_pUnderlineLB
->SelectEntryPos(i
);
1759 Color aColor
= rItem
.GetColor();
1760 sal_uInt16 nPos
= m_pUnderlineColorLB
->GetEntryPos( aColor
);
1762 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
1763 m_pUnderlineColorLB
->SelectEntryPos( nPos
);
1766 nPos
= m_pUnderlineColorLB
->GetEntryPos( aColor
);
1767 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
1768 m_pUnderlineColorLB
->SelectEntryPos( nPos
);
1770 m_pUnderlineColorLB
->SelectEntryPos(
1771 m_pUnderlineColorLB
->InsertEntry( aColor
,
1772 String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
1777 m_pUnderlineColorLB
->SelectEntry( Color( COL_AUTO
));
1778 m_pUnderlineColorLB
->Disable();
1784 nWhich
= GetWhich( SID_ATTR_CHAR_OVERLINE
);
1785 rFont
.SetOverline( UNDERLINE_NONE
);
1786 rCJKFont
.SetOverline( UNDERLINE_NONE
);
1787 rCTLFont
.SetOverline( UNDERLINE_NONE
);
1789 m_pOverlineLB
->SelectEntryPos( 0 );
1790 eState
= rSet
.GetItemState( nWhich
);
1792 if ( eState
>= SFX_ITEM_DONTCARE
)
1794 if ( eState
== SFX_ITEM_DONTCARE
)
1795 m_pOverlineLB
->SetNoSelection();
1798 const SvxOverlineItem
& rItem
= (SvxOverlineItem
&)rSet
.Get( nWhich
);
1799 FontUnderline eOverline
= (FontUnderline
)rItem
.GetValue();
1800 rFont
.SetOverline( eOverline
);
1801 rCJKFont
.SetOverline( eOverline
);
1802 rCTLFont
.SetOverline( eOverline
);
1804 if ( eOverline
!= UNDERLINE_NONE
)
1806 for ( sal_uInt16 i
= 0; i
< m_pOverlineLB
->GetEntryCount(); ++i
)
1808 if ( (FontUnderline
)(sal_uLong
)m_pOverlineLB
->GetEntryData(i
) == eOverline
)
1810 m_pOverlineLB
->SelectEntryPos(i
);
1816 Color aColor
= rItem
.GetColor();
1817 sal_uInt16 nPos
= m_pOverlineColorLB
->GetEntryPos( aColor
);
1819 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
1820 m_pOverlineColorLB
->SelectEntryPos( nPos
);
1823 nPos
= m_pOverlineColorLB
->GetEntryPos( aColor
);
1824 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
)
1825 m_pOverlineColorLB
->SelectEntryPos( nPos
);
1827 m_pOverlineColorLB
->SelectEntryPos(
1828 m_pOverlineColorLB
->InsertEntry( aColor
,
1829 String( SVX_RES( RID_SVXSTR_COLOR_USER
) ) ) );
1834 m_pOverlineColorLB
->SelectEntry( Color( COL_AUTO
));
1835 m_pOverlineColorLB
->Disable();
1841 nWhich
= GetWhich( SID_ATTR_CHAR_STRIKEOUT
);
1842 rFont
.SetStrikeout( STRIKEOUT_NONE
);
1843 rCJKFont
.SetStrikeout( STRIKEOUT_NONE
);
1844 rCTLFont
.SetStrikeout( STRIKEOUT_NONE
);
1846 m_pStrikeoutLB
->SelectEntryPos( 0 );
1847 eState
= rSet
.GetItemState( nWhich
);
1849 if ( eState
>= SFX_ITEM_DONTCARE
)
1851 if ( eState
== SFX_ITEM_DONTCARE
)
1852 m_pStrikeoutLB
->SetNoSelection();
1855 const SvxCrossedOutItem
& rItem
= (SvxCrossedOutItem
&)rSet
.Get( nWhich
);
1856 FontStrikeout eStrikeout
= (FontStrikeout
)rItem
.GetValue();
1857 rFont
.SetStrikeout( eStrikeout
);
1858 rCJKFont
.SetStrikeout( eStrikeout
);
1859 rCTLFont
.SetStrikeout( eStrikeout
);
1861 if ( eStrikeout
!= STRIKEOUT_NONE
)
1863 for ( sal_uInt16 i
= 0; i
< m_pStrikeoutLB
->GetEntryCount(); ++i
)
1865 if ( (FontStrikeout
)(sal_uLong
)m_pStrikeoutLB
->GetEntryData(i
) == eStrikeout
)
1867 m_pStrikeoutLB
->SelectEntryPos(i
);
1877 nWhich
= GetWhich( SID_ATTR_CHAR_WORDLINEMODE
);
1880 case SFX_ITEM_UNKNOWN
:
1881 m_pIndividualWordsBtn
->Hide();
1884 case SFX_ITEM_DISABLED
:
1885 case SFX_ITEM_READONLY
:
1886 m_pIndividualWordsBtn
->Disable();
1889 case SFX_ITEM_DONTCARE
:
1890 m_pIndividualWordsBtn
->SetState( STATE_DONTKNOW
);
1893 case SFX_ITEM_DEFAULT
:
1896 const SvxWordLineModeItem
& rItem
= (SvxWordLineModeItem
&)rSet
.Get( nWhich
);
1897 rFont
.SetWordLineMode( rItem
.GetValue() );
1898 rCJKFont
.SetWordLineMode( rItem
.GetValue() );
1899 rCTLFont
.SetWordLineMode( rItem
.GetValue() );
1901 m_pIndividualWordsBtn
->Check( rItem
.GetValue() );
1902 m_pIndividualWordsBtn
->Enable( bEnable
);
1908 nWhich
= GetWhich( SID_ATTR_CHAR_EMPHASISMARK
);
1909 eState
= rSet
.GetItemState( nWhich
);
1911 if ( eState
>= SFX_ITEM_DEFAULT
)
1913 const SvxEmphasisMarkItem
& rItem
= (SvxEmphasisMarkItem
&)rSet
.Get( nWhich
);
1914 FontEmphasisMark eMark
= rItem
.GetEmphasisMark();
1915 rFont
.SetEmphasisMark( eMark
);
1916 rCJKFont
.SetEmphasisMark( eMark
);
1917 rCTLFont
.SetEmphasisMark( eMark
);
1919 m_pEmphasisLB
->SelectEntryPos( (sal_uInt16
)( eMark
& EMPHASISMARK_STYLE
) );
1920 eMark
&= ~EMPHASISMARK_STYLE
;
1921 sal_uLong nEntryData
= ( eMark
== EMPHASISMARK_POS_ABOVE
)
1922 ? CHRDLG_POSITION_OVER
1923 : ( eMark
== EMPHASISMARK_POS_BELOW
) ? CHRDLG_POSITION_UNDER
: 0;
1925 for ( sal_uInt16 i
= 0; i
< m_pPositionLB
->GetEntryCount(); i
++ )
1927 if ( nEntryData
== (sal_uLong
)m_pPositionLB
->GetEntryData(i
) )
1929 m_pPositionLB
->SelectEntryPos(i
);
1934 else if ( eState
== SFX_ITEM_DONTCARE
)
1935 m_pEmphasisLB
->SetNoSelection( );
1936 else if ( eState
== SFX_ITEM_UNKNOWN
)
1938 m_pEmphasisFT
->Hide();
1939 m_pEmphasisLB
->Hide();
1941 else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY
1943 m_pEmphasisFT
->Disable();
1944 m_pEmphasisLB
->Disable();
1947 // the select handler for the underline/overline/strikeout list boxes
1948 // SelectHdl_Impl( NULL );
1949 DBG_ASSERT(m_pUnderlineLB
->GetSelectHdl() == m_pOverlineLB
->GetSelectHdl(),
1950 "SvxCharEffectsPage::Reset: inconsistence (1)!");
1951 DBG_ASSERT(m_pUnderlineLB
->GetSelectHdl() == m_pStrikeoutLB
->GetSelectHdl(),
1952 "SvxCharEffectsPage::Reset: inconsistence (1)!");
1953 m_pUnderlineLB
->GetSelectHdl().Call(NULL
);
1954 // don't call SelectHdl_Impl directly!
1955 // in DisableControls, we may have re-reouted the select handler
1957 // the select handler for the emphasis listbox
1958 // SelectHdl_Impl( m_pEmphasisLB );
1959 DBG_ASSERT(m_pEmphasisLB
->GetSelectHdl() == LINK(this, SvxCharEffectsPage
, SelectHdl_Impl
),
1960 "SvxCharEffectsPage::Reset: inconsistence (2)!");
1961 m_pEmphasisLB
->GetSelectHdl().Call( m_pEmphasisLB
);
1962 // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ...
1965 SvxCaseMap eCaseMap
= SVX_CASEMAP_END
;
1966 nWhich
= GetWhich( SID_ATTR_CHAR_CASEMAP
);
1967 eState
= rSet
.GetItemState( nWhich
);
1970 case SFX_ITEM_UNKNOWN
:
1971 m_pEffectsFT
->Hide();
1972 m_pEffectsLB
->Hide();
1975 case SFX_ITEM_DISABLED
:
1976 case SFX_ITEM_READONLY
:
1977 m_pEffectsFT
->Disable();
1978 m_pEffectsLB
->Disable();
1981 case SFX_ITEM_DONTCARE
:
1982 m_pEffectsLB
->SetNoSelection();
1985 case SFX_ITEM_DEFAULT
:
1988 const SvxCaseMapItem
& rItem
= (const SvxCaseMapItem
&)rSet
.Get( nWhich
);
1989 eCaseMap
= (SvxCaseMap
)rItem
.GetValue();
1993 SetCaseMap_Impl( eCaseMap
);
1996 nWhich
= GetWhich(SID_ATTR_CHAR_RELIEF
);
1997 eState
= rSet
.GetItemState( nWhich
);
2000 case SFX_ITEM_UNKNOWN
:
2001 m_pReliefFT
->Hide();
2002 m_pReliefLB
->Hide();
2005 case SFX_ITEM_DISABLED
:
2006 case SFX_ITEM_READONLY
:
2007 m_pReliefFT
->Disable();
2008 m_pReliefLB
->Disable();
2011 case SFX_ITEM_DONTCARE
:
2012 m_pReliefLB
->SetNoSelection();
2015 case SFX_ITEM_DEFAULT
:
2018 const SvxCharReliefItem
& rItem
= (const SvxCharReliefItem
&)rSet
.Get( nWhich
);
2019 m_pReliefLB
->SelectEntryPos(rItem
.GetValue());
2020 SelectHdl_Impl(m_pReliefLB
);
2026 nWhich
= GetWhich( SID_ATTR_CHAR_CONTOUR
);
2027 eState
= rSet
.GetItemState( nWhich
);
2030 case SFX_ITEM_UNKNOWN
:
2031 m_pOutlineBtn
->Hide();
2034 case SFX_ITEM_DISABLED
:
2035 case SFX_ITEM_READONLY
:
2036 m_pOutlineBtn
->Disable();
2039 case SFX_ITEM_DONTCARE
:
2040 m_pOutlineBtn
->SetState( STATE_DONTKNOW
);
2043 case SFX_ITEM_DEFAULT
:
2046 const SvxContourItem
& rItem
= (SvxContourItem
&)rSet
.Get( nWhich
);
2047 m_pOutlineBtn
->SetState( (TriState
)rItem
.GetValue() );
2048 m_pOutlineBtn
->EnableTriState( sal_False
);
2054 nWhich
= GetWhich( SID_ATTR_CHAR_SHADOWED
);
2055 eState
= rSet
.GetItemState( nWhich
);
2059 case SFX_ITEM_UNKNOWN
:
2060 m_pShadowBtn
->Hide();
2063 case SFX_ITEM_DISABLED
:
2064 case SFX_ITEM_READONLY
:
2065 m_pShadowBtn
->Disable();
2068 case SFX_ITEM_DONTCARE
:
2069 m_pShadowBtn
->SetState( STATE_DONTKNOW
);
2072 case SFX_ITEM_DEFAULT
:
2075 const SvxShadowedItem
& rItem
= (SvxShadowedItem
&)rSet
.Get( nWhich
);
2076 m_pShadowBtn
->SetState( (TriState
)rItem
.GetValue() );
2077 m_pShadowBtn
->EnableTriState( sal_False
);
2083 nWhich
= GetWhich( SID_ATTR_FLASH
);
2084 eState
= rSet
.GetItemState( nWhich
);
2088 case SFX_ITEM_UNKNOWN
:
2089 m_pBlinkingBtn
->Hide();
2092 case SFX_ITEM_DISABLED
:
2093 case SFX_ITEM_READONLY
:
2094 m_pBlinkingBtn
->Disable();
2097 case SFX_ITEM_DONTCARE
:
2098 m_pBlinkingBtn
->SetState( STATE_DONTKNOW
);
2101 case SFX_ITEM_DEFAULT
:
2104 const SvxBlinkItem
& rItem
= (SvxBlinkItem
&)rSet
.Get( nWhich
);
2105 m_pBlinkingBtn
->SetState( (TriState
)rItem
.GetValue() );
2106 m_pBlinkingBtn
->EnableTriState( sal_False
);
2111 nWhich
= GetWhich( SID_ATTR_CHAR_HIDDEN
);
2112 eState
= rSet
.GetItemState( nWhich
);
2116 case SFX_ITEM_UNKNOWN
:
2117 m_pHiddenBtn
->Hide();
2120 case SFX_ITEM_DISABLED
:
2121 case SFX_ITEM_READONLY
:
2122 m_pHiddenBtn
->Disable();
2125 case SFX_ITEM_DONTCARE
:
2126 m_pHiddenBtn
->SetState( STATE_DONTKNOW
);
2129 case SFX_ITEM_DEFAULT
:
2132 const SvxCharHiddenItem
& rItem
= (SvxCharHiddenItem
&)rSet
.Get( nWhich
);
2133 m_pHiddenBtn
->SetState( (TriState
)rItem
.GetValue() );
2134 m_pHiddenBtn
->EnableTriState( sal_False
);
2139 SetPrevFontWidthScale( rSet
);
2140 ResetColor_Impl( rSet
);
2143 m_pPreviewWin
->Invalidate();
2145 // save this settings
2146 m_pUnderlineLB
->SaveValue();
2147 m_pUnderlineColorLB
->SaveValue();
2148 m_pOverlineLB
->SaveValue();
2149 m_pOverlineColorLB
->SaveValue();
2150 m_pStrikeoutLB
->SaveValue();
2151 m_pIndividualWordsBtn
->SaveValue();
2152 m_pEmphasisLB
->SaveValue();
2153 m_pPositionLB
->SaveValue();
2154 m_pEffectsLB
->SaveValue();
2155 m_pReliefLB
->SaveValue();
2156 m_pOutlineBtn
->SaveValue();
2157 m_pShadowBtn
->SaveValue();
2158 m_pBlinkingBtn
->SaveValue();
2159 m_pHiddenBtn
->SaveValue();
2160 m_pFontColorLB
->SaveValue();
2163 // -----------------------------------------------------------------------
2165 sal_Bool
SvxCharEffectsPage::FillItemSet( SfxItemSet
& rSet
)
2167 const SfxPoolItem
* pOld
= 0;
2168 const SfxItemSet
& rOldSet
= GetItemSet();
2169 sal_Bool bModified
= sal_False
;
2170 bool bChanged
= true;
2173 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_UNDERLINE
);
2174 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_UNDERLINE
);
2175 sal_uInt16 nPos
= m_pUnderlineLB
->GetSelectEntryPos();
2176 FontUnderline eUnder
= (FontUnderline
)(sal_uLong
)m_pUnderlineLB
->GetEntryData( nPos
);
2180 //! if there are different underline styles in the selection the
2181 //! item-state in the 'rOldSet' will be invalid. In this case
2182 //! changing the underline style will be allowed if a style is
2183 //! selected in the listbox.
2184 sal_Bool bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2185 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, sal_True
);
2187 const SvxUnderlineItem
& rItem
= *( (const SvxUnderlineItem
*)pOld
);
2188 if ( (FontUnderline
)rItem
.GetValue() == eUnder
&&
2189 ( UNDERLINE_NONE
== eUnder
|| rItem
.GetColor() == m_pUnderlineColorLB
->GetSelectEntryColor() ) &&
2196 SvxUnderlineItem
aNewItem( eUnder
, nWhich
);
2197 aNewItem
.SetColor( m_pUnderlineColorLB
->GetSelectEntryColor() );
2198 rSet
.Put( aNewItem
);
2199 bModified
= sal_True
;
2201 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2207 nWhich
= GetWhich( SID_ATTR_CHAR_OVERLINE
);
2208 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_OVERLINE
);
2209 nPos
= m_pOverlineLB
->GetSelectEntryPos();
2210 FontUnderline eOver
= (FontUnderline
)(sal_uLong
)m_pOverlineLB
->GetEntryData( nPos
);
2214 //! if there are different underline styles in the selection the
2215 //! item-state in the 'rOldSet' will be invalid. In this case
2216 //! changing the underline style will be allowed if a style is
2217 //! selected in the listbox.
2218 sal_Bool bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2219 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, sal_True
);
2221 const SvxOverlineItem
& rItem
= *( (const SvxOverlineItem
*)pOld
);
2222 if ( (FontUnderline
)rItem
.GetValue() == eOver
&&
2223 ( UNDERLINE_NONE
== eOver
|| rItem
.GetColor() == m_pOverlineColorLB
->GetSelectEntryColor() ) &&
2230 SvxOverlineItem
aNewItem( eOver
, nWhich
);
2231 aNewItem
.SetColor( m_pOverlineColorLB
->GetSelectEntryColor() );
2232 rSet
.Put( aNewItem
);
2233 bModified
= sal_True
;
2235 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2241 nWhich
= GetWhich( SID_ATTR_CHAR_STRIKEOUT
);
2242 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_STRIKEOUT
);
2243 nPos
= m_pStrikeoutLB
->GetSelectEntryPos();
2244 FontStrikeout eStrike
= (FontStrikeout
)(sal_uLong
)m_pStrikeoutLB
->GetEntryData( nPos
);
2248 //! if there are different strikeout styles in the selection the
2249 //! item-state in the 'rOldSet' will be invalid. In this case
2250 //! changing the strikeout style will be allowed if a style is
2251 //! selected in the listbox.
2252 sal_Bool bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2253 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, sal_True
);
2255 const SvxCrossedOutItem
& rItem
= *( (const SvxCrossedOutItem
*)pOld
);
2256 if ( !m_pStrikeoutLB
->IsEnabled()
2257 || ((FontStrikeout
)rItem
.GetValue() == eStrike
&& !bAllowChg
) )
2263 rSet
.Put( SvxCrossedOutItem( eStrike
, nWhich
) );
2264 bModified
= sal_True
;
2266 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2272 nWhich
= GetWhich( SID_ATTR_CHAR_WORDLINEMODE
);
2273 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_WORDLINEMODE
);
2277 const SvxWordLineModeItem
& rItem
= *( (const SvxWordLineModeItem
*)pOld
);
2278 if ( rItem
.GetValue() == m_pIndividualWordsBtn
->IsChecked() )
2282 if ( rOldSet
.GetItemState( nWhich
) == SFX_ITEM_DONTCARE
&&
2283 m_pIndividualWordsBtn
->IsChecked() == m_pIndividualWordsBtn
->GetSavedValue() )
2288 rSet
.Put( SvxWordLineModeItem( m_pIndividualWordsBtn
->IsChecked(), nWhich
) );
2289 bModified
= sal_True
;
2291 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2297 nWhich
= GetWhich( SID_ATTR_CHAR_EMPHASISMARK
);
2298 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_EMPHASISMARK
);
2299 sal_uInt16 nMarkPos
= m_pEmphasisLB
->GetSelectEntryPos();
2300 sal_uInt16 nPosPos
= m_pPositionLB
->GetSelectEntryPos();
2301 FontEmphasisMark eMark
= (FontEmphasisMark
)nMarkPos
;
2302 if ( m_pPositionLB
->IsEnabled() )
2304 eMark
|= ( CHRDLG_POSITION_UNDER
== (sal_uLong
)m_pPositionLB
->GetEntryData( nPosPos
) )
2305 ? EMPHASISMARK_POS_BELOW
: EMPHASISMARK_POS_ABOVE
;
2310 if( rOldSet
.GetItemState( nWhich
) != SFX_ITEM_DONTCARE
)
2312 const SvxEmphasisMarkItem
& rItem
= *( (const SvxEmphasisMarkItem
*)pOld
);
2313 if ( rItem
.GetEmphasisMark() == eMark
)
2318 if ( rOldSet
.GetItemState( nWhich
) == SFX_ITEM_DONTCARE
&&
2319 m_pEmphasisLB
->GetSavedValue() == nMarkPos
&& m_pPositionLB
->GetSavedValue() == nPosPos
)
2324 rSet
.Put( SvxEmphasisMarkItem( eMark
, nWhich
) );
2325 bModified
= sal_True
;
2327 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2333 nWhich
= GetWhich( SID_ATTR_CHAR_CASEMAP
);
2334 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_CASEMAP
);
2335 SvxCaseMap eCaseMap
= SVX_CASEMAP_NOT_MAPPED
;
2336 bool bChecked
= false;
2337 sal_uInt16 nCapsPos
= m_pEffectsLB
->GetSelectEntryPos();
2338 if ( nCapsPos
!= LISTBOX_ENTRY_NOTFOUND
)
2340 eCaseMap
= (SvxCaseMap
)nCapsPos
;
2346 //! if there are different effect styles in the selection the
2347 //! item-state in the 'rOldSet' will be invalid. In this case
2348 //! changing the effect style will be allowed if a style is
2349 //! selected in the listbox.
2350 sal_Bool bAllowChg
= LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
2351 SFX_ITEM_DEFAULT
> rOldSet
.GetItemState( nWhich
, sal_True
);
2353 const SvxCaseMapItem
& rItem
= *( (const SvxCaseMapItem
*)pOld
);
2354 if ( (SvxCaseMap
)rItem
.GetValue() == eCaseMap
&& !bAllowChg
)
2358 if ( bChanged
&& bChecked
)
2360 rSet
.Put( SvxCaseMapItem( eCaseMap
, nWhich
) );
2361 bModified
= sal_True
;
2363 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2369 nWhich
= GetWhich(SID_ATTR_CHAR_RELIEF
);
2370 if(m_pReliefLB
->GetSelectEntryPos() != m_pReliefLB
->GetSavedValue())
2372 m_pReliefLB
->SaveValue();
2373 SvxCharReliefItem
aRelief((FontRelief
)m_pReliefLB
->GetSelectEntryPos(), nWhich
);
2378 const SfxItemSet
* pExampleSet
= GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL
;
2379 nWhich
= GetWhich( SID_ATTR_CHAR_CONTOUR
);
2380 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_CONTOUR
);
2381 TriState eState
= m_pOutlineBtn
->GetState();
2382 const SfxPoolItem
* pItem
;
2386 const SvxContourItem
& rItem
= *( (const SvxContourItem
*)pOld
);
2387 if ( rItem
.GetValue() == StateToAttr( eState
) && m_pOutlineBtn
->GetSavedValue() == eState
)
2391 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
2392 !StateToAttr( eState
) && ( (SvxContourItem
*)pItem
)->GetValue() )
2395 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2397 rSet
.Put( SvxContourItem( StateToAttr( eState
), nWhich
) );
2398 bModified
= sal_True
;
2400 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2406 nWhich
= GetWhich( SID_ATTR_CHAR_SHADOWED
);
2407 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_SHADOWED
);
2408 eState
= m_pShadowBtn
->GetState();
2412 const SvxShadowedItem
& rItem
= *( (const SvxShadowedItem
*)pOld
);
2413 if ( rItem
.GetValue() == StateToAttr( eState
) && m_pShadowBtn
->GetSavedValue() == eState
)
2417 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
2418 !StateToAttr( eState
) && ( (SvxShadowedItem
*)pItem
)->GetValue() )
2421 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2423 rSet
.Put( SvxShadowedItem( StateToAttr( eState
), nWhich
) );
2424 bModified
= sal_True
;
2426 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2432 nWhich
= GetWhich( SID_ATTR_FLASH
);
2433 pOld
= GetOldItem( rSet
, SID_ATTR_FLASH
);
2434 eState
= m_pBlinkingBtn
->GetState();
2438 const SvxBlinkItem
& rItem
= *( (const SvxBlinkItem
*)pOld
);
2439 if ( rItem
.GetValue() == StateToAttr( eState
) && m_pBlinkingBtn
->GetSavedValue() == eState
)
2443 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
2444 !StateToAttr( eState
) && ( (SvxBlinkItem
*)pItem
)->GetValue() )
2447 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2449 rSet
.Put( SvxBlinkItem( StateToAttr( eState
), nWhich
) );
2452 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2456 nWhich
= GetWhich( SID_ATTR_CHAR_HIDDEN
);
2457 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_HIDDEN
);
2458 eState
= m_pHiddenBtn
->GetState();
2463 const SvxCharHiddenItem
& rItem
= *( (const SvxCharHiddenItem
*)pOld
);
2464 if ( rItem
.GetValue() == StateToAttr( eState
) && m_pHiddenBtn
->GetSavedValue() == eState
)
2468 if ( !bChanged
&& pExampleSet
&& pExampleSet
->GetItemState( nWhich
, sal_False
, &pItem
) == SFX_ITEM_SET
&&
2469 !StateToAttr( eState
) && ( (SvxCharHiddenItem
*)pItem
)->GetValue() )
2472 if ( bChanged
&& eState
!= STATE_DONTKNOW
)
2474 rSet
.Put( SvxCharHiddenItem( StateToAttr( eState
), nWhich
) );
2475 bModified
= sal_True
;
2477 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
2480 bModified
|= FillItemSetColor_Impl( rSet
);
2485 void SvxCharEffectsPage::DisableControls( sal_uInt16 nDisable
)
2487 if ( ( DISABLE_CASEMAP
& nDisable
) == DISABLE_CASEMAP
)
2489 m_pEffectsFT
->Disable();
2490 m_pEffectsLB
->Disable();
2493 if ( ( DISABLE_WORDLINE
& nDisable
) == DISABLE_WORDLINE
)
2494 m_pIndividualWordsBtn
->Disable();
2496 if ( ( DISABLE_BLINK
& nDisable
) == DISABLE_BLINK
)
2497 m_pBlinkingBtn
->Disable();
2499 if ( ( DISABLE_UNDERLINE_COLOR
& nDisable
) == DISABLE_UNDERLINE_COLOR
)
2501 // disable the controls
2502 m_pUnderlineColorFT
->Disable( );
2503 m_pUnderlineColorLB
->Disable( );
2504 // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling
2505 m_pUnderlineLB
->SetSelectHdl(LINK(this, SvxCharEffectsPage
, UpdatePreview_Impl
));
2506 m_pStrikeoutLB
->SetSelectHdl(LINK(this, SvxCharEffectsPage
, UpdatePreview_Impl
));
2510 void SvxCharEffectsPage::EnableFlash()
2512 m_pBlinkingBtn
->Show();
2515 // -----------------------------------------------------------------------
2516 void SvxCharEffectsPage::SetPreviewBackgroundToCharacter()
2518 m_bPreviewBackgroundToCharacter
= sal_True
;
2521 // -----------------------------------------------------------------------
2522 void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet
)
2524 SFX_ITEMSET_ARG (&aSet
,pDisableCtlItem
,SfxUInt16Item
,SID_DISABLE_CTL
,sal_False
);
2525 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
2526 if (pDisableCtlItem
)
2527 DisableControls(pDisableCtlItem
->GetValue());
2531 sal_uInt32 nFlags
=pFlagItem
->GetValue();
2532 if ( ( nFlags
& SVX_ENABLE_FLASH
) == SVX_ENABLE_FLASH
)
2534 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
2535 SetPreviewBackgroundToCharacter();
2539 // class SvxCharPositionPage ---------------------------------------------
2541 SvxCharPositionPage::SvxCharPositionPage( Window
* pParent
, const SfxItemSet
& rInSet
)
2542 : SvxCharBasePage(pParent
, "PositionPage", "cui/ui/positionpage.ui", rInSet
)
2543 , m_nSuperEsc((short)DFLT_ESC_SUPER
)
2544 , m_nSubEsc((short)DFLT_ESC_SUB
)
2545 , m_nScaleWidthItemSetVal(100)
2546 , m_nScaleWidthInitialVal(100)
2547 , m_nSuperProp((sal_uInt8
)DFLT_ESC_PROP
)
2548 , m_nSubProp((sal_uInt8
)DFLT_ESC_PROP
)
2550 get(m_pHighPosBtn
, "superscript");
2551 get(m_pNormalPosBtn
, "normal");
2552 get(m_pLowPosBtn
, "subscript");
2553 get(m_pHighLowFT
, "raiselower");
2554 get(m_pHighLowMF
, "raiselowersb");
2555 get(m_pHighLowRB
, "automatic");
2556 get(m_pFontSizeFT
, "relativefontsize");
2557 get(m_pFontSizeMF
, "fontsizesb");
2558 get(m_pRotationContainer
, "rotationcontainer");
2559 get(m_pScalingFT
, "rotate");
2560 get(m_pScalingAndRotationFT
, "rotateandscale");
2561 get(m_p0degRB
, "0deg");
2562 get(m_p90degRB
, "90deg");
2563 get(m_p270degRB
, "270deg");
2564 get(m_pFitToLineCB
, "fittoline");
2565 get(m_pScaleWidthMF
, "scalewidthsb");
2566 get(m_pKerningLB
, "kerninglb");
2567 get(m_pKerningFT
, "kerningft");
2568 get(m_pKerningMF
, "kerningsb");
2569 get(m_pPairKerningBtn
, "pairkerning");
2571 get(m_pPreviewWin
, "preview");
2576 // -----------------------------------------------------------------------
2578 void SvxCharPositionPage::Initialize()
2580 // to handle the changes of the other pages
2581 SetExchangeSupport();
2583 GetPreviewFont().SetSize( Size( 0, 240 ) );
2584 GetPreviewCJKFont().SetSize( Size( 0, 240 ) );
2585 GetPreviewCTLFont().SetSize( Size( 0, 240 ) );
2587 m_pNormalPosBtn
->Check();
2588 PositionHdl_Impl( m_pNormalPosBtn
);
2589 m_pKerningLB
->SelectEntryPos( 0 );
2590 KerningSelectHdl_Impl( NULL
);
2592 Link aLink
= LINK( this, SvxCharPositionPage
, PositionHdl_Impl
);
2593 m_pHighPosBtn
->SetClickHdl( aLink
);
2594 m_pNormalPosBtn
->SetClickHdl( aLink
);
2595 m_pLowPosBtn
->SetClickHdl( aLink
);
2597 aLink
= LINK( this, SvxCharPositionPage
, RotationHdl_Impl
);
2598 m_p0degRB
->SetClickHdl( aLink
);
2599 m_p90degRB
->SetClickHdl( aLink
);
2600 m_p270degRB
->SetClickHdl( aLink
);
2602 aLink
= LINK( this, SvxCharPositionPage
, FontModifyHdl_Impl
);
2603 m_pHighLowMF
->SetModifyHdl( aLink
);
2604 m_pFontSizeMF
->SetModifyHdl( aLink
);
2606 aLink
= LINK( this, SvxCharPositionPage
, LoseFocusHdl_Impl
);
2607 m_pHighLowMF
->SetLoseFocusHdl( aLink
);
2608 m_pFontSizeMF
->SetLoseFocusHdl( aLink
);
2610 m_pHighLowRB
->SetClickHdl( LINK( this, SvxCharPositionPage
, AutoPositionHdl_Impl
) );
2611 m_pFitToLineCB
->SetClickHdl( LINK( this, SvxCharPositionPage
, FitToLineHdl_Impl
) );
2612 m_pKerningLB
->SetSelectHdl( LINK( this, SvxCharPositionPage
, KerningSelectHdl_Impl
) );
2613 m_pKerningMF
->SetModifyHdl( LINK( this, SvxCharPositionPage
, KerningModifyHdl_Impl
) );
2614 m_pPairKerningBtn
->SetClickHdl( LINK( this, SvxCharPositionPage
, PairKerningHdl_Impl
) );
2615 m_pScaleWidthMF
->SetModifyHdl( LINK( this, SvxCharPositionPage
, ScaleWidthModifyHdl_Impl
) );
2618 SvxCharPositionPage::~SvxCharPositionPage()
2622 // -----------------------------------------------------------------------
2624 void SvxCharPositionPage::UpdatePreview_Impl( sal_uInt8 nProp
, sal_uInt8 nEscProp
, short nEsc
)
2626 SetPrevFontEscapement( nProp
, nEscProp
, nEsc
);
2629 // -----------------------------------------------------------------------
2631 void SvxCharPositionPage::SetEscapement_Impl( sal_uInt16 nEsc
)
2633 SvxEscapementItem
aEscItm( (SvxEscapement
)nEsc
, SID_ATTR_CHAR_ESCAPEMENT
);
2635 if ( SVX_ESCAPEMENT_SUPERSCRIPT
== nEsc
)
2637 aEscItm
.GetEsc() = m_nSuperEsc
;
2638 aEscItm
.GetProp() = m_nSuperProp
;
2640 else if ( SVX_ESCAPEMENT_SUBSCRIPT
== nEsc
)
2642 aEscItm
.GetEsc() = m_nSubEsc
;
2643 aEscItm
.GetProp() = m_nSubProp
;
2646 short nFac
= aEscItm
.GetEsc() < 0 ? -1 : 1;
2648 m_pHighLowMF
->SetValue( aEscItm
.GetEsc() * nFac
);
2649 m_pFontSizeMF
->SetValue( aEscItm
.GetProp() );
2651 if ( SVX_ESCAPEMENT_OFF
== nEsc
)
2653 m_pHighLowFT
->Disable();
2654 m_pHighLowMF
->Disable();
2655 m_pFontSizeFT
->Disable();
2656 m_pFontSizeMF
->Disable();
2657 m_pHighLowRB
->Disable();
2661 m_pFontSizeFT
->Enable();
2662 m_pFontSizeMF
->Enable();
2663 m_pHighLowRB
->Enable();
2665 if ( !m_pHighLowRB
->IsChecked() )
2667 m_pHighLowFT
->Enable();
2668 m_pHighLowMF
->Enable();
2671 AutoPositionHdl_Impl( m_pHighLowRB
);
2674 UpdatePreview_Impl( 100, aEscItm
.GetProp(), aEscItm
.GetEsc() );
2677 // -----------------------------------------------------------------------
2679 IMPL_LINK( SvxCharPositionPage
, PositionHdl_Impl
, RadioButton
*, pBtn
)
2681 sal_uInt16 nEsc
= SVX_ESCAPEMENT_OFF
; // also when pBtn == NULL
2683 if ( m_pHighPosBtn
== pBtn
)
2684 nEsc
= SVX_ESCAPEMENT_SUPERSCRIPT
;
2685 else if ( m_pLowPosBtn
== pBtn
)
2686 nEsc
= SVX_ESCAPEMENT_SUBSCRIPT
;
2688 SetEscapement_Impl( nEsc
);
2692 // -----------------------------------------------------------------------
2694 IMPL_LINK( SvxCharPositionPage
, RotationHdl_Impl
, RadioButton
*, pBtn
)
2696 sal_Bool bEnable
= sal_False
;
2697 if (m_p90degRB
== pBtn
|| m_p270degRB
== pBtn
)
2700 OSL_ENSURE( m_p0degRB
== pBtn
, "unexpected button" );
2701 m_pFitToLineCB
->Enable( bEnable
);
2705 // -----------------------------------------------------------------------
2707 IMPL_LINK_NOARG(SvxCharPositionPage
, FontModifyHdl_Impl
)
2709 sal_uInt8 nEscProp
= (sal_uInt8
)m_pFontSizeMF
->GetValue();
2710 short nEsc
= (short)m_pHighLowMF
->GetValue();
2711 nEsc
*= m_pLowPosBtn
->IsChecked() ? -1 : 1;
2712 UpdatePreview_Impl( 100, nEscProp
, nEsc
);
2716 // -----------------------------------------------------------------------
2718 IMPL_LINK( SvxCharPositionPage
, AutoPositionHdl_Impl
, CheckBox
*, pBox
)
2720 if ( pBox
->IsChecked() )
2722 m_pHighLowFT
->Disable();
2723 m_pHighLowMF
->Disable();
2726 PositionHdl_Impl( m_pHighPosBtn
->IsChecked() ? m_pHighPosBtn
2727 : m_pLowPosBtn
->IsChecked() ? m_pLowPosBtn
2728 : m_pNormalPosBtn
);
2732 // -----------------------------------------------------------------------
2734 IMPL_LINK( SvxCharPositionPage
, FitToLineHdl_Impl
, CheckBox
*, pBox
)
2736 if (m_pFitToLineCB
== pBox
)
2738 sal_uInt16 nVal
= m_nScaleWidthInitialVal
;
2739 if (m_pFitToLineCB
->IsChecked())
2740 nVal
= m_nScaleWidthItemSetVal
;
2741 m_pScaleWidthMF
->SetValue( nVal
);
2743 m_pPreviewWin
->SetFontWidthScale( nVal
);
2748 // -----------------------------------------------------------------------
2750 IMPL_LINK_NOARG(SvxCharPositionPage
, KerningSelectHdl_Impl
)
2752 if ( m_pKerningLB
->GetSelectEntryPos() > LW_NORMAL
)
2754 m_pKerningFT
->Enable();
2755 m_pKerningMF
->Enable();
2757 if ( m_pKerningLB
->GetSelectEntryPos() == LW_CONDENSED
)
2759 // Condensed -> max value == 1/6 of the current font height
2760 SvxFont
& rFont
= GetPreviewFont();
2761 long nMax
= rFont
.GetSize().Height() / 6;
2762 m_pKerningMF
->SetMax( m_pKerningMF
->Normalize( nMax
), FUNIT_TWIP
);
2763 m_pKerningMF
->SetLast( m_pKerningMF
->GetMax( m_pKerningMF
->GetUnit() ) );
2767 m_pKerningMF
->SetMax( 9999 );
2768 m_pKerningMF
->SetLast( 9999 );
2773 m_pKerningMF
->SetValue( 0 );
2774 m_pKerningFT
->Disable();
2775 m_pKerningMF
->Disable();
2778 KerningModifyHdl_Impl( NULL
);
2783 // -----------------------------------------------------------------------
2785 IMPL_LINK_NOARG(SvxCharPositionPage
, KerningModifyHdl_Impl
)
2787 long nVal
= static_cast<long>(m_pKerningMF
->GetValue());
2788 nVal
= LogicToLogic( nVal
, MAP_POINT
, MAP_TWIP
);
2789 long nKern
= (short)m_pKerningMF
->Denormalize( nVal
);
2791 // Condensed? -> then negative
2792 if ( m_pKerningLB
->GetSelectEntryPos() == LW_CONDENSED
)
2795 SvxFont
& rFont
= GetPreviewFont();
2796 SvxFont
& rCJKFont
= GetPreviewCJKFont();
2797 SvxFont
& rCTLFont
= GetPreviewCTLFont();
2799 rFont
.SetFixKerning( (short)nKern
);
2800 rCJKFont
.SetFixKerning( (short)nKern
);
2801 rCTLFont
.SetFixKerning( (short)nKern
);
2802 m_pPreviewWin
->Invalidate();
2806 // -----------------------------------------------------------------------
2808 IMPL_LINK_NOARG(SvxCharPositionPage
, PairKerningHdl_Impl
)
2813 // -----------------------------------------------------------------------
2815 IMPL_LINK( SvxCharPositionPage
, LoseFocusHdl_Impl
, MetricField
*, pField
)
2818 sal_Bool bHigh
= m_pHighPosBtn
->IsChecked();
2820 sal_Bool bLow
= m_pLowPosBtn
->IsChecked();
2821 DBG_ASSERT( bHigh
|| bLow
, "normal position is not valid" );
2823 if ( m_pHighLowMF
== pField
)
2826 m_nSubEsc
= (short)m_pHighLowMF
->GetValue() * -1;
2828 m_nSuperEsc
= (short)m_pHighLowMF
->GetValue();
2830 else if ( m_pFontSizeMF
== pField
)
2833 m_nSubProp
= (sal_uInt8
)m_pFontSizeMF
->GetValue();
2835 m_nSuperProp
= (sal_uInt8
)m_pFontSizeMF
->GetValue();
2840 // -----------------------------------------------------------------------
2842 IMPL_LINK_NOARG(SvxCharPositionPage
, ScaleWidthModifyHdl_Impl
)
2844 m_pPreviewWin
->SetFontWidthScale( sal_uInt16( m_pScaleWidthMF
->GetValue() ) );
2849 void SvxCharPositionPage::ActivatePage( const SfxItemSet
& rSet
)
2851 //update the preview
2852 SvxCharBasePage::ActivatePage( rSet
);
2854 //the only thing that has to be checked is the max. allowed value for the
2855 //condense edit field
2856 if ( m_pKerningLB
->GetSelectEntryPos() == LW_CONDENSED
)
2858 // Condensed -> max value == 1/6 of the current font height
2859 SvxFont
& rFont
= GetPreviewFont();
2860 long nMax
= rFont
.GetSize().Height() / 6;
2861 long nKern
= (short)m_pKerningMF
->Denormalize( LogicToLogic( static_cast<long>(m_pKerningMF
->GetValue()), MAP_POINT
, MAP_TWIP
) );
2862 m_pKerningMF
->SetMax( m_pKerningMF
->Normalize( nKern
> nMax
? nKern
: nMax
), FUNIT_TWIP
);
2863 m_pKerningMF
->SetLast( m_pKerningMF
->GetMax( m_pKerningMF
->GetUnit() ) );
2867 // -----------------------------------------------------------------------
2869 int SvxCharPositionPage::DeactivatePage( SfxItemSet
* _pSet
)
2872 FillItemSet( *_pSet
);
2876 // -----------------------------------------------------------------------
2878 SfxTabPage
* SvxCharPositionPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2880 return new SvxCharPositionPage( pParent
, rSet
);
2883 // -----------------------------------------------------------------------
2885 sal_uInt16
* SvxCharPositionPage::GetRanges()
2887 return pPositionRanges
;
2890 // -----------------------------------------------------------------------
2891 void SvxCharPositionPage::Reset( const SfxItemSet
& rSet
)
2893 String sUser
= GetUserData();
2897 m_nSuperEsc
= (short)sUser
.GetToken( 0 ).ToInt32();
2898 m_nSubEsc
= (short)sUser
.GetToken( 1 ).ToInt32();
2899 m_nSuperProp
= (sal_uInt8
)sUser
.GetToken( 2 ).ToInt32();
2900 m_nSubProp
= (sal_uInt8
)sUser
.GetToken( 3 ).ToInt32();
2904 sal_uInt8 nEscProp
= 100;
2905 sal_uInt8 nProp
= 100;
2907 m_pHighLowFT
->Disable();
2908 m_pHighLowMF
->Disable();
2909 m_pFontSizeFT
->Disable();
2910 m_pFontSizeMF
->Disable();
2912 SvxFont
& rFont
= GetPreviewFont();
2913 SvxFont
& rCJKFont
= GetPreviewCJKFont();
2914 SvxFont
& rCTLFont
= GetPreviewCTLFont();
2915 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_ESCAPEMENT
);
2917 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
2919 const SvxEscapementItem
& rItem
= (SvxEscapementItem
&)rSet
.Get( nWhich
);
2920 nEsc
= rItem
.GetEsc();
2921 nEscProp
= rItem
.GetProp();
2925 m_pHighLowFT
->Enable();
2926 m_pHighLowMF
->Enable();
2927 m_pFontSizeFT
->Enable();
2928 m_pFontSizeMF
->Enable();
2931 sal_Bool
bAutomatic(sal_False
);
2936 m_pHighPosBtn
->Check( sal_True
);
2937 if ( nEsc
== DFLT_ESC_AUTO_SUPER
)
2939 nEsc
= DFLT_ESC_SUPER
;
2940 bAutomatic
= sal_True
;
2946 m_pLowPosBtn
->Check( sal_True
);
2947 if ( nEsc
== DFLT_ESC_AUTO_SUB
)
2949 nEsc
= DFLT_ESC_SUB
;
2950 bAutomatic
= sal_True
;
2953 if (!m_pHighLowRB
->IsEnabled())
2955 m_pHighLowRB
->Enable();
2957 m_pHighLowRB
->Check(bAutomatic
);
2959 if ( m_pHighLowRB
->IsChecked() )
2961 m_pHighLowFT
->Disable();
2962 m_pHighLowMF
->Disable();
2964 m_pHighLowMF
->SetValue( m_pHighLowMF
->Normalize( nFac
* nEsc
) );
2968 m_pNormalPosBtn
->Check( sal_True
);
2969 m_pHighLowRB
->Check( sal_True
);
2970 PositionHdl_Impl( NULL
);
2972 //the height has to be set after the handler is called to keep the value also if the escapement is zero
2973 m_pFontSizeMF
->SetValue( m_pFontSizeMF
->Normalize( nEscProp
) );
2977 m_pHighPosBtn
->Check( sal_False
);
2978 m_pNormalPosBtn
->Check( sal_False
);
2979 m_pLowPosBtn
->Check( sal_False
);
2983 SetPrevFontEscapement( nProp
, nEscProp
, nEsc
);
2986 nWhich
= GetWhich( SID_ATTR_CHAR_KERNING
);
2988 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
2990 const SvxKerningItem
& rItem
= (SvxKerningItem
&)rSet
.Get( nWhich
);
2991 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
2992 MapUnit eOrgUnit
= (MapUnit
)eUnit
;
2993 MapUnit
ePntUnit( MAP_POINT
);
2994 long nBig
= static_cast<long>(m_pKerningMF
->Normalize( static_cast<long>(rItem
.GetValue()) ));
2995 long nKerning
= LogicToLogic( nBig
, eOrgUnit
, ePntUnit
);
2997 // set Kerning at the Font, convert into Twips before
2998 long nKern
= LogicToLogic( rItem
.GetValue(), (MapUnit
)eUnit
, MAP_TWIP
);
2999 rFont
.SetFixKerning( (short)nKern
);
3000 rCJKFont
.SetFixKerning( (short)nKern
);
3001 rCTLFont
.SetFixKerning( (short)nKern
);
3005 m_pKerningLB
->SelectEntryPos( LW_EXPANDED
);
3007 else if ( nKerning
< 0 )
3009 m_pKerningLB
->SelectEntryPos( LW_CONDENSED
);
3010 nKerning
= -nKerning
;
3015 m_pKerningLB
->SelectEntryPos( LW_NORMAL
);
3017 //enable/disable and set min/max of the Edit
3018 KerningSelectHdl_Impl(m_pKerningLB
);
3019 //the attribute value must be displayed also if it's above the maximum allowed value
3020 long nVal
= static_cast<long>(m_pKerningMF
->GetMax());
3022 m_pKerningMF
->SetMax( nKerning
);
3023 m_pKerningMF
->SetValue( nKerning
);
3026 m_pKerningMF
->SetText( String() );
3029 nWhich
= GetWhich( SID_ATTR_CHAR_AUTOKERN
);
3031 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3033 const SvxAutoKernItem
& rItem
= (SvxAutoKernItem
&)rSet
.Get( nWhich
);
3034 m_pPairKerningBtn
->Check( rItem
.GetValue() );
3037 m_pPairKerningBtn
->Check( sal_False
);
3040 nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
3041 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3043 const SvxCharScaleWidthItem
& rItem
= ( SvxCharScaleWidthItem
& ) rSet
.Get( nWhich
);
3044 m_nScaleWidthInitialVal
= rItem
.GetValue();
3045 m_pScaleWidthMF
->SetValue( m_nScaleWidthInitialVal
);
3048 m_pScaleWidthMF
->SetValue( 100 );
3050 nWhich
= GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
);
3051 if ( rSet
.GetItemState( nWhich
) >= SFX_ITEM_DEFAULT
)
3052 m_nScaleWidthItemSetVal
= ((SfxUInt16Item
&) rSet
.Get( nWhich
)).GetValue();
3055 nWhich
= GetWhich( SID_ATTR_CHAR_ROTATED
);
3056 SfxItemState eState
= rSet
.GetItemState( nWhich
);
3057 if( SFX_ITEM_UNKNOWN
== eState
)
3059 m_pRotationContainer
->Hide();
3060 m_pScalingAndRotationFT
->Hide();
3061 m_pScalingFT
->Show();
3065 m_pRotationContainer
->Show();
3066 m_pScalingAndRotationFT
->Show();
3067 m_pScalingFT
->Hide();
3069 Link
aOldLink( m_pFitToLineCB
->GetClickHdl() );
3070 m_pFitToLineCB
->SetClickHdl( Link() );
3071 if( eState
>= SFX_ITEM_DEFAULT
)
3073 const SvxCharRotateItem
& rItem
=
3074 (SvxCharRotateItem
&) rSet
.Get( nWhich
);
3075 if (rItem
.IsBottomToTop())
3076 m_p90degRB
->Check( sal_True
);
3077 else if (rItem
.IsTopToBotton())
3078 m_p270degRB
->Check( sal_True
);
3081 DBG_ASSERT( 0 == rItem
.GetValue(), "incorrect value" );
3082 m_p0degRB
->Check( sal_True
);
3084 m_pFitToLineCB
->Check( rItem
.IsFitToLine() );
3088 if( eState
== SFX_ITEM_DONTCARE
)
3090 m_p0degRB
->Check( sal_False
);
3091 m_p90degRB
->Check( sal_False
);
3092 m_p270degRB
->Check( sal_False
);
3095 m_p0degRB
->Check( sal_True
);
3097 m_pFitToLineCB
->Check( sal_False
);
3099 m_pFitToLineCB
->SetClickHdl( aOldLink
);
3100 m_pFitToLineCB
->Enable( !m_p0degRB
->IsChecked() );
3102 // is this value set?
3103 if( SFX_ITEM_UNKNOWN
== rSet
.GetItemState( GetWhich(
3104 SID_ATTR_CHAR_WIDTH_FIT_TO_LINE
) ))
3105 m_pFitToLineCB
->Hide();
3108 m_pHighPosBtn
->SaveValue();
3109 m_pNormalPosBtn
->SaveValue();
3110 m_pLowPosBtn
->SaveValue();
3111 m_p0degRB
->SaveValue();
3112 m_p90degRB
->SaveValue();
3113 m_p270degRB
->SaveValue();
3114 m_pFitToLineCB
->SaveValue();
3115 m_pScaleWidthMF
->SaveValue();
3116 m_pKerningLB
->SaveValue();
3117 m_pKerningMF
->SaveValue();
3118 m_pPairKerningBtn
->SaveValue();
3121 // -----------------------------------------------------------------------
3123 sal_Bool
SvxCharPositionPage::FillItemSet( SfxItemSet
& rSet
)
3125 // Position (high, normal or low)
3126 const SfxItemSet
& rOldSet
= GetItemSet();
3127 sal_Bool bModified
= sal_False
, bChanged
= sal_True
;
3128 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_ESCAPEMENT
);
3129 const SfxPoolItem
* pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_ESCAPEMENT
);
3130 const bool bHigh
= m_pHighPosBtn
->IsChecked();
3134 if ( bHigh
|| m_pLowPosBtn
->IsChecked() )
3136 if ( m_pHighLowRB
->IsChecked() )
3137 nEsc
= bHigh
? DFLT_ESC_AUTO_SUPER
: DFLT_ESC_AUTO_SUB
;
3140 nEsc
= (short)m_pHighLowMF
->Denormalize( m_pHighLowMF
->GetValue() );
3141 nEsc
*= (bHigh
? 1 : -1);
3143 nEscProp
= (sal_uInt8
)m_pFontSizeMF
->Denormalize( m_pFontSizeMF
->GetValue() );
3153 const SvxEscapementItem
& rItem
= *( (const SvxEscapementItem
*)pOld
);
3154 if ( rItem
.GetEsc() == nEsc
&& rItem
.GetProp() == nEscProp
)
3155 bChanged
= sal_False
;
3158 if ( !bChanged
&& !m_pHighPosBtn
->GetSavedValue() &&
3159 !m_pNormalPosBtn
->GetSavedValue() && !m_pLowPosBtn
->GetSavedValue() )
3160 bChanged
= sal_True
;
3163 ( m_pHighPosBtn
->IsChecked() || m_pNormalPosBtn
->IsChecked() || m_pLowPosBtn
->IsChecked() ) )
3165 rSet
.Put( SvxEscapementItem( nEsc
, nEscProp
, nWhich
) );
3166 bModified
= sal_True
;
3168 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3171 bChanged
= sal_True
;
3174 nWhich
= GetWhich( SID_ATTR_CHAR_KERNING
);
3175 pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_KERNING
);
3176 sal_uInt16 nPos
= m_pKerningLB
->GetSelectEntryPos();
3178 SfxMapUnit eUnit
= rSet
.GetPool()->GetMetric( nWhich
);
3180 if ( nPos
== LW_EXPANDED
|| nPos
== LW_CONDENSED
)
3182 long nTmp
= static_cast<long>(m_pKerningMF
->GetValue());
3183 long nVal
= LogicToLogic( nTmp
, MAP_POINT
, (MapUnit
)eUnit
);
3184 nKerning
= (short)m_pKerningMF
->Denormalize( nVal
);
3186 if ( nPos
== LW_CONDENSED
)
3192 const SvxKerningItem
& rItem
= *( (const SvxKerningItem
*)pOld
);
3193 if ( rItem
.GetValue() == nKerning
)
3194 bChanged
= sal_False
;
3198 ( m_pKerningLB
->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND
||
3199 ( m_pKerningMF
->GetSavedValue().isEmpty() && m_pKerningMF
->IsEnabled() ) ) )
3200 bChanged
= sal_True
;
3202 if ( bChanged
&& nPos
!= LISTBOX_ENTRY_NOTFOUND
)
3204 rSet
.Put( SvxKerningItem( nKerning
, nWhich
) );
3205 bModified
= sal_True
;
3207 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3210 bChanged
= sal_True
;
3213 nWhich
= GetWhich( SID_ATTR_CHAR_AUTOKERN
);
3215 if ( m_pPairKerningBtn
->IsChecked() != m_pPairKerningBtn
->GetSavedValue() )
3217 rSet
.Put( SvxAutoKernItem( m_pPairKerningBtn
->IsChecked(), nWhich
) );
3218 bModified
= sal_True
;
3220 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3224 nWhich
= GetWhich( SID_ATTR_CHAR_SCALEWIDTH
);
3225 if ( m_pScaleWidthMF
->GetText() != m_pScaleWidthMF
->GetSavedValue() )
3227 rSet
.Put( SvxCharScaleWidthItem( (sal_uInt16
)m_pScaleWidthMF
->GetValue(), nWhich
) );
3228 bModified
= sal_True
;
3230 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3234 nWhich
= GetWhich( SID_ATTR_CHAR_ROTATED
);
3235 if ( m_p0degRB
->IsChecked() != m_p0degRB
->GetSavedValue() ||
3236 m_p90degRB
->IsChecked() != m_p90degRB
->GetSavedValue() ||
3237 m_p270degRB
->IsChecked() != m_p270degRB
->GetSavedValue() ||
3238 m_pFitToLineCB
->IsChecked() != m_pFitToLineCB
->GetSavedValue() )
3240 SvxCharRotateItem
aItem( 0, m_pFitToLineCB
->IsChecked(), nWhich
);
3241 if (m_p90degRB
->IsChecked())
3242 aItem
.SetBottomToTop();
3243 else if (m_p270degRB
->IsChecked())
3244 aItem
.SetTopToBotton();
3246 bModified
= sal_True
;
3248 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3254 // -----------------------------------------------------------------------
3256 void SvxCharPositionPage::FillUserData()
3258 const OUString
cTok( ";" );
3260 OUString sUser
= OUString::number( m_nSuperEsc
) + cTok
+
3261 OUString::number( m_nSubEsc
) + cTok
+
3262 OUString::number( m_nSuperProp
) + cTok
+
3263 OUString::number( m_nSubProp
);
3264 SetUserData( sUser
);
3267 // -----------------------------------------------------------------------
3268 void SvxCharPositionPage::SetPreviewBackgroundToCharacter()
3270 m_bPreviewBackgroundToCharacter
= sal_True
;
3272 // -----------------------------------------------------------------------
3273 void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet
)
3275 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
3278 sal_uInt32 nFlags
=pFlagItem
->GetValue();
3279 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
3280 SetPreviewBackgroundToCharacter();
3283 // class SvxCharTwoLinesPage ------------------------------------------------
3285 SvxCharTwoLinesPage::SvxCharTwoLinesPage(Window
* pParent
, const SfxItemSet
& rInSet
)
3286 : SvxCharBasePage(pParent
, "TwoLinesPage", "cui/ui/twolinespage.ui", rInSet
)
3287 , m_nStartBracketPosition( 0 )
3288 , m_nEndBracketPosition( 0 )
3290 get(m_pTwoLinesBtn
, "twolines");
3291 get(m_pEnclosingFrame
, "enclosing");
3292 get(m_pStartBracketLB
, "startbracket");
3293 get(m_pEndBracketLB
, "endbracket");
3295 get(m_pPreviewWin
, "preview");
3300 SvxCharTwoLinesPage::~SvxCharTwoLinesPage()
3304 // -----------------------------------------------------------------------
3306 void SvxCharTwoLinesPage::Initialize()
3308 m_pTwoLinesBtn
->Check( sal_False
);
3309 TwoLinesHdl_Impl( NULL
);
3311 m_pTwoLinesBtn
->SetClickHdl( LINK( this, SvxCharTwoLinesPage
, TwoLinesHdl_Impl
) );
3313 Link aLink
= LINK( this, SvxCharTwoLinesPage
, CharacterMapHdl_Impl
);
3314 m_pStartBracketLB
->SetSelectHdl( aLink
);
3315 m_pEndBracketLB
->SetSelectHdl( aLink
);
3317 SvxFont
& rFont
= GetPreviewFont();
3318 SvxFont
& rCJKFont
= GetPreviewCJKFont();
3319 SvxFont
& rCTLFont
= GetPreviewCTLFont();
3320 rFont
.SetSize( Size( 0, 220 ) );
3321 rCJKFont
.SetSize( Size( 0, 220 ) );
3322 rCTLFont
.SetSize( Size( 0, 220 ) );
3325 // -----------------------------------------------------------------------
3327 void SvxCharTwoLinesPage::SelectCharacter( ListBox
* pBox
)
3329 bool bStart
= pBox
== m_pStartBracketLB
;
3330 SvxCharacterMap
* aDlg
= new SvxCharacterMap( this );
3331 aDlg
->DisableFontSelection();
3333 if ( aDlg
->Execute() == RET_OK
)
3335 sal_Unicode cChar
= (sal_Unicode
) aDlg
->GetChar();
3336 SetBracket( cChar
, bStart
);
3340 pBox
->SelectEntryPos( bStart
? m_nStartBracketPosition
: m_nEndBracketPosition
);
3345 // -----------------------------------------------------------------------
3347 void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket
, sal_Bool bStart
)
3349 sal_uInt16 nEntryPos
= 0;
3350 ListBox
* pBox
= bStart
? m_pStartBracketLB
: m_pEndBracketLB
;
3351 if ( 0 == cBracket
)
3352 pBox
->SelectEntryPos(0);
3355 bool bFound
= false;
3356 for ( sal_uInt16 i
= 1; i
< pBox
->GetEntryCount(); ++i
)
3358 if ( (sal_uLong
)pBox
->GetEntryData(i
) != CHRDLG_ENCLOSE_SPECIAL_CHAR
)
3360 const sal_Unicode cChar
= pBox
->GetEntry(i
).GetChar(0);
3361 if ( cChar
== cBracket
)
3363 pBox
->SelectEntryPos(i
);
3373 nEntryPos
= pBox
->InsertEntry( OUString(cBracket
) );
3374 pBox
->SelectEntryPos( nEntryPos
);
3378 m_nStartBracketPosition
= nEntryPos
;
3380 m_nEndBracketPosition
= nEntryPos
;
3383 // -----------------------------------------------------------------------
3385 IMPL_LINK_NOARG(SvxCharTwoLinesPage
, TwoLinesHdl_Impl
)
3387 sal_Bool bChecked
= m_pTwoLinesBtn
->IsChecked();
3388 m_pEnclosingFrame
->Enable( bChecked
);
3390 UpdatePreview_Impl();
3394 // -----------------------------------------------------------------------
3396 IMPL_LINK( SvxCharTwoLinesPage
, CharacterMapHdl_Impl
, ListBox
*, pBox
)
3398 sal_uInt16 nPos
= pBox
->GetSelectEntryPos();
3399 if ( CHRDLG_ENCLOSE_SPECIAL_CHAR
== (sal_uLong
)pBox
->GetEntryData( nPos
) )
3400 SelectCharacter( pBox
);
3403 bool bStart
= pBox
== m_pStartBracketLB
;
3405 m_nStartBracketPosition
= nPos
;
3407 m_nEndBracketPosition
= nPos
;
3409 UpdatePreview_Impl();
3413 // -----------------------------------------------------------------------
3415 void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet
& rSet
)
3417 SvxCharBasePage::ActivatePage( rSet
);
3420 // -----------------------------------------------------------------------
3422 int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet
* _pSet
)
3425 FillItemSet( *_pSet
);
3429 // -----------------------------------------------------------------------
3431 SfxTabPage
* SvxCharTwoLinesPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
3433 return new SvxCharTwoLinesPage( pParent
, rSet
);
3436 // -----------------------------------------------------------------------
3438 sal_uInt16
* SvxCharTwoLinesPage::GetRanges()
3440 return pTwoLinesRanges
;
3443 // -----------------------------------------------------------------------
3445 void SvxCharTwoLinesPage::Reset( const SfxItemSet
& rSet
)
3447 m_pTwoLinesBtn
->Check( sal_False
);
3448 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_TWO_LINES
);
3449 SfxItemState eState
= rSet
.GetItemState( nWhich
);
3451 if ( eState
>= SFX_ITEM_DONTCARE
)
3453 const SvxTwoLinesItem
& rItem
= (SvxTwoLinesItem
&)rSet
.Get( nWhich
);
3454 m_pTwoLinesBtn
->Check( rItem
.GetValue() );
3456 if ( rItem
.GetValue() )
3458 SetBracket( rItem
.GetStartBracket(), sal_True
);
3459 SetBracket( rItem
.GetEndBracket(), sal_False
);
3462 TwoLinesHdl_Impl( NULL
);
3464 SetPrevFontWidthScale( rSet
);
3467 // -----------------------------------------------------------------------
3469 sal_Bool
SvxCharTwoLinesPage::FillItemSet( SfxItemSet
& rSet
)
3471 const SfxItemSet
& rOldSet
= GetItemSet();
3472 sal_Bool bModified
= sal_False
, bChanged
= sal_True
;
3473 sal_uInt16 nWhich
= GetWhich( SID_ATTR_CHAR_TWO_LINES
);
3474 const SfxPoolItem
* pOld
= GetOldItem( rSet
, SID_ATTR_CHAR_TWO_LINES
);
3475 sal_Bool bOn
= m_pTwoLinesBtn
->IsChecked();
3476 sal_Unicode cStart
= ( bOn
&& m_pStartBracketLB
->GetSelectEntryPos() > 0 )
3477 ? m_pStartBracketLB
->GetSelectEntry().GetChar(0) : 0;
3478 sal_Unicode cEnd
= ( bOn
&& m_pEndBracketLB
->GetSelectEntryPos() > 0 )
3479 ? m_pEndBracketLB
->GetSelectEntry().GetChar(0) : 0;
3483 const SvxTwoLinesItem
& rItem
= *( (const SvxTwoLinesItem
*)pOld
);
3484 if ( rItem
.GetValue() == bOn
&&
3485 ( !bOn
|| ( rItem
.GetStartBracket() == cStart
&& rItem
.GetEndBracket() == cEnd
) ) )
3486 bChanged
= sal_False
;
3491 rSet
.Put( SvxTwoLinesItem( bOn
, cStart
, cEnd
, nWhich
) );
3492 bModified
= sal_True
;
3494 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
, sal_False
) )
3500 void SvxCharTwoLinesPage::UpdatePreview_Impl()
3502 sal_Unicode cStart
= m_pStartBracketLB
->GetSelectEntryPos() > 0
3503 ? m_pStartBracketLB
->GetSelectEntry().GetChar(0) : 0;
3504 sal_Unicode cEnd
= m_pEndBracketLB
->GetSelectEntryPos() > 0
3505 ? m_pEndBracketLB
->GetSelectEntry().GetChar(0) : 0;
3506 m_pPreviewWin
->SetBrackets(cStart
, cEnd
);
3507 m_pPreviewWin
->SetTwoLines(m_pTwoLinesBtn
->IsChecked());
3508 m_pPreviewWin
->Invalidate();
3510 // -----------------------------------------------------------------------
3511 void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter()
3513 m_bPreviewBackgroundToCharacter
= sal_True
;
3516 // -----------------------------------------------------------------------
3517 void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet
)
3519 SFX_ITEMSET_ARG (&aSet
,pFlagItem
,SfxUInt32Item
,SID_FLAG_TYPE
,sal_False
);
3522 sal_uInt32 nFlags
=pFlagItem
->GetValue();
3523 if ( ( nFlags
& SVX_PREVIEW_CHARACTER
) == SVX_PREVIEW_CHARACTER
)
3524 SetPreviewBackgroundToCharacter();
3528 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */