1*2ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2ee96f1cSAndrew Rist * distributed with this work for additional information 6*2ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 9*2ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2ee96f1cSAndrew Rist * software distributed under the License is distributed on an 15*2ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 17*2ee96f1cSAndrew Rist * specific language governing permissions and limitations 18*2ee96f1cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2ee96f1cSAndrew Rist *************************************************************/ 21*2ee96f1cSAndrew Rist 22*2ee96f1cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_cui.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir #include <editeng/unolingu.hxx> 29cdf0e10cSrcweir #include <vcl/svapp.hxx> 30cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 31cdf0e10cSrcweir #include <svtools/ctrltool.hxx> 32cdf0e10cSrcweir #include <svl/sfontitm.hxx> 33cdf0e10cSrcweir #include <sfx2/printer.hxx> 34cdf0e10cSrcweir #include <sfx2/objsh.hxx> 35cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 36cdf0e10cSrcweir #include <sfx2/bindings.hxx> 37cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 38cdf0e10cSrcweir #include <vcl/msgbox.hxx> 39cdf0e10cSrcweir #include <svx/dialmgr.hxx> 40cdf0e10cSrcweir #include <svx/dialogs.hrc> 41cdf0e10cSrcweir #include <svtools/unitconv.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #define _SVX_CHARDLG_CXX 44cdf0e10cSrcweir #include <svl/languageoptions.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <cuires.hrc> 47cdf0e10cSrcweir #include "chardlg.hrc" 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include <svx/xtable.hxx> // XColorTable 50cdf0e10cSrcweir #include "chardlg.hxx" 51cdf0e10cSrcweir #include "editeng/fontitem.hxx" 52cdf0e10cSrcweir #include <editeng/postitem.hxx> 53cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 54cdf0e10cSrcweir #include <editeng/crsditem.hxx> 55cdf0e10cSrcweir #include <editeng/cntritem.hxx> 56cdf0e10cSrcweir #include <editeng/langitem.hxx> 57cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 58cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 59cdf0e10cSrcweir #include <editeng/shdditem.hxx> 60cdf0e10cSrcweir #include <editeng/escpitem.hxx> 61cdf0e10cSrcweir #include <editeng/prszitem.hxx> 62cdf0e10cSrcweir #include <editeng/wrlmitem.hxx> 63cdf0e10cSrcweir #include <editeng/cmapitem.hxx> 64cdf0e10cSrcweir #include <editeng/kernitem.hxx> 65cdf0e10cSrcweir #include <editeng/blnkitem.hxx> 66cdf0e10cSrcweir #include "editeng/flstitem.hxx" 67cdf0e10cSrcweir #include <editeng/akrnitem.hxx> 68cdf0e10cSrcweir #include <editeng/brshitem.hxx> 69cdf0e10cSrcweir #include <editeng/colritem.hxx> 70cdf0e10cSrcweir #include "svx/drawitem.hxx" 71cdf0e10cSrcweir #include "svx/dlgutil.hxx" 72cdf0e10cSrcweir #include <dialmgr.hxx> 73cdf0e10cSrcweir #include "svx/htmlmode.hxx" 74cdf0e10cSrcweir #include "cuicharmap.hxx" 75cdf0e10cSrcweir #include "chardlg.h" 76cdf0e10cSrcweir #include <editeng/emphitem.hxx> 77cdf0e10cSrcweir #include <editeng/charreliefitem.hxx> 78cdf0e10cSrcweir #include <editeng/twolinesitem.hxx> 79cdf0e10cSrcweir #include <editeng/charhiddenitem.hxx> 80cdf0e10cSrcweir #include <svl/stritem.hxx> 81cdf0e10cSrcweir #include <editeng/charscaleitem.hxx> 82cdf0e10cSrcweir #include <editeng/charrotateitem.hxx> 83cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 84cdf0e10cSrcweir #include <cuires.hrc> //CHINA001 85cdf0e10cSrcweir #include <svl/intitem.hxx> //CHINA001 86cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001 87cdf0e10cSrcweir #include "svx/flagsdef.hxx" //CHINA001 88cdf0e10cSrcweir 89cdf0e10cSrcweir using namespace ::com::sun::star; 90cdf0e10cSrcweir 91cdf0e10cSrcweir // define ---------------------------------------------------------------- 92cdf0e10cSrcweir 93cdf0e10cSrcweir #define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT 94cdf0e10cSrcweir 95cdf0e10cSrcweir #define CLEARTITEM rSet.InvalidateItem(nWhich) 96cdf0e10cSrcweir 97cdf0e10cSrcweir #define LW_NORMAL 0 98cdf0e10cSrcweir #define LW_GESPERRT 1 99cdf0e10cSrcweir #define LW_SCHMAL 2 100cdf0e10cSrcweir 101cdf0e10cSrcweir // static ---------------------------------------------------------------- 102cdf0e10cSrcweir 103cdf0e10cSrcweir static sal_uInt16 pNameRanges[] = 104cdf0e10cSrcweir { 105cdf0e10cSrcweir SID_ATTR_CHAR_FONT, 106cdf0e10cSrcweir SID_ATTR_CHAR_WEIGHT, 107cdf0e10cSrcweir SID_ATTR_CHAR_FONTHEIGHT, 108cdf0e10cSrcweir SID_ATTR_CHAR_FONTHEIGHT, 109cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 110cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 111cdf0e10cSrcweir SID_ATTR_CHAR_LANGUAGE, 112cdf0e10cSrcweir SID_ATTR_CHAR_LANGUAGE, 113cdf0e10cSrcweir SID_ATTR_CHAR_CJK_FONT, 114cdf0e10cSrcweir SID_ATTR_CHAR_CJK_WEIGHT, 115cdf0e10cSrcweir SID_ATTR_CHAR_CTL_FONT, 116cdf0e10cSrcweir SID_ATTR_CHAR_CTL_WEIGHT, 117cdf0e10cSrcweir 0 118cdf0e10cSrcweir }; 119cdf0e10cSrcweir 120cdf0e10cSrcweir static sal_uInt16 pEffectsRanges[] = 121cdf0e10cSrcweir { 122cdf0e10cSrcweir SID_ATTR_CHAR_SHADOWED, 123cdf0e10cSrcweir SID_ATTR_CHAR_UNDERLINE, 124cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 125cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, 126cdf0e10cSrcweir SID_ATTR_CHAR_CASEMAP, 127cdf0e10cSrcweir SID_ATTR_CHAR_CASEMAP, 128cdf0e10cSrcweir SID_ATTR_FLASH, 129cdf0e10cSrcweir SID_ATTR_FLASH, 130cdf0e10cSrcweir SID_ATTR_CHAR_EMPHASISMARK, 131cdf0e10cSrcweir SID_ATTR_CHAR_EMPHASISMARK, 132cdf0e10cSrcweir SID_ATTR_CHAR_RELIEF, 133cdf0e10cSrcweir SID_ATTR_CHAR_RELIEF, 134cdf0e10cSrcweir SID_ATTR_CHAR_HIDDEN, 135cdf0e10cSrcweir SID_ATTR_CHAR_HIDDEN, 136cdf0e10cSrcweir SID_ATTR_CHAR_OVERLINE, 137cdf0e10cSrcweir SID_ATTR_CHAR_OVERLINE, 138cdf0e10cSrcweir 0 139cdf0e10cSrcweir }; 140cdf0e10cSrcweir 141cdf0e10cSrcweir static sal_uInt16 pPositionRanges[] = 142cdf0e10cSrcweir { 143cdf0e10cSrcweir SID_ATTR_CHAR_KERNING, 144cdf0e10cSrcweir SID_ATTR_CHAR_KERNING, 145cdf0e10cSrcweir SID_ATTR_CHAR_ESCAPEMENT, 146cdf0e10cSrcweir SID_ATTR_CHAR_ESCAPEMENT, 147cdf0e10cSrcweir SID_ATTR_CHAR_AUTOKERN, 148cdf0e10cSrcweir SID_ATTR_CHAR_AUTOKERN, 149cdf0e10cSrcweir SID_ATTR_CHAR_ROTATED, 150cdf0e10cSrcweir SID_ATTR_CHAR_SCALEWIDTH, 151cdf0e10cSrcweir SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, 152cdf0e10cSrcweir SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, 153cdf0e10cSrcweir 0 154cdf0e10cSrcweir }; 155cdf0e10cSrcweir 156cdf0e10cSrcweir static sal_uInt16 pTwoLinesRanges[] = 157cdf0e10cSrcweir { 158cdf0e10cSrcweir SID_ATTR_CHAR_TWO_LINES, 159cdf0e10cSrcweir SID_ATTR_CHAR_TWO_LINES, 160cdf0e10cSrcweir 0 161cdf0e10cSrcweir }; 162cdf0e10cSrcweir 163cdf0e10cSrcweir // C-Funktion ------------------------------------------------------------ 164cdf0e10cSrcweir 165cdf0e10cSrcweir inline sal_Bool StateToAttr( TriState aState ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir return ( STATE_CHECK == aState ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir // class SvxCharBasePage ------------------------------------------------- 171cdf0e10cSrcweir 172cdf0e10cSrcweir inline SvxFont& SvxCharBasePage::GetPreviewFont() 173cdf0e10cSrcweir { 174cdf0e10cSrcweir return m_aPreviewWin.GetFont(); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir // ----------------------------------------------------------------------- 178cdf0e10cSrcweir 179cdf0e10cSrcweir inline SvxFont& SvxCharBasePage::GetPreviewCJKFont() 180cdf0e10cSrcweir { 181cdf0e10cSrcweir return m_aPreviewWin.GetCJKFont(); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir // ----------------------------------------------------------------------- 184cdf0e10cSrcweir 185cdf0e10cSrcweir inline SvxFont& SvxCharBasePage::GetPreviewCTLFont() 186cdf0e10cSrcweir { 187cdf0e10cSrcweir return m_aPreviewWin.GetCTLFont(); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir 190cdf0e10cSrcweir // ----------------------------------------------------------------------- 191cdf0e10cSrcweir 192cdf0e10cSrcweir SvxCharBasePage::SvxCharBasePage( Window* pParent, const ResId& rResId, const SfxItemSet& rItemset, 193cdf0e10cSrcweir sal_uInt16 nResIdPrewievWin, sal_uInt16 nResIdFontTypeFT ): 194cdf0e10cSrcweir SfxTabPage( pParent, rResId, rItemset ), 195cdf0e10cSrcweir m_aPreviewWin( this, ResId( nResIdPrewievWin, *rResId.GetResMgr() ) ), 196cdf0e10cSrcweir m_aFontTypeFT( this, ResId( nResIdFontTypeFT, *rResId.GetResMgr() ) ), 197cdf0e10cSrcweir m_bPreviewBackgroundToCharacter( sal_False ) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir } 200cdf0e10cSrcweir 201cdf0e10cSrcweir // ----------------------------------------------------------------------- 202cdf0e10cSrcweir 203cdf0e10cSrcweir SvxCharBasePage::~SvxCharBasePage() 204cdf0e10cSrcweir { 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir // ----------------------------------------------------------------------- 208cdf0e10cSrcweir 209cdf0e10cSrcweir //void SvxCharBasePage::SetPrevFontAttributes( const SfxItemSet& rSet ) 210cdf0e10cSrcweir void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 213cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 214cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 215cdf0e10cSrcweir sal_uInt16 nWhich; 216cdf0e10cSrcweir 217cdf0e10cSrcweir nWhich = GetWhich( SID_CHAR_DLG_PREVIEW_STRING ); 218cdf0e10cSrcweir if( ISITEMSET ) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir const SfxStringItem& rItem = ( SfxStringItem& ) rSet.Get( nWhich ); 221cdf0e10cSrcweir ::rtl::OUString aString = rItem.GetValue(); 222cdf0e10cSrcweir if( aString.getLength() != 0 ) 223cdf0e10cSrcweir m_aPreviewWin.SetPreviewText( aString ); 224cdf0e10cSrcweir else 225cdf0e10cSrcweir m_aPreviewWin.SetFontNameAsPreviewText(); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir 228cdf0e10cSrcweir // Underline 229cdf0e10cSrcweir FontUnderline eUnderline; 230cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); 231cdf0e10cSrcweir if( ISITEMSET ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir const SvxUnderlineItem& rItem = ( SvxUnderlineItem& ) rSet.Get( nWhich ); 234cdf0e10cSrcweir eUnderline = ( FontUnderline ) rItem.GetValue(); 235cdf0e10cSrcweir m_aPreviewWin.SetTextLineColor( rItem.GetColor() ); 236cdf0e10cSrcweir } 237cdf0e10cSrcweir else 238cdf0e10cSrcweir eUnderline = UNDERLINE_NONE; 239cdf0e10cSrcweir 240cdf0e10cSrcweir rFont.SetUnderline( eUnderline ); 241cdf0e10cSrcweir rCJKFont.SetUnderline( eUnderline ); 242cdf0e10cSrcweir rCTLFont.SetUnderline( eUnderline ); 243cdf0e10cSrcweir 244cdf0e10cSrcweir // Overline 245cdf0e10cSrcweir FontUnderline eOverline; 246cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); 247cdf0e10cSrcweir if( ISITEMSET ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir const SvxOverlineItem& rItem = ( SvxOverlineItem& ) rSet.Get( nWhich ); 250cdf0e10cSrcweir eOverline = ( FontUnderline ) rItem.GetValue(); 251cdf0e10cSrcweir m_aPreviewWin.SetOverlineColor( rItem.GetColor() ); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir else 254cdf0e10cSrcweir eOverline = UNDERLINE_NONE; 255cdf0e10cSrcweir 256cdf0e10cSrcweir rFont.SetOverline( eOverline ); 257cdf0e10cSrcweir rCJKFont.SetOverline( eOverline ); 258cdf0e10cSrcweir rCTLFont.SetOverline( eOverline ); 259cdf0e10cSrcweir 260cdf0e10cSrcweir // Strikeout 261cdf0e10cSrcweir FontStrikeout eStrikeout; 262cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); 263cdf0e10cSrcweir if( ISITEMSET ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir const SvxCrossedOutItem& rItem = ( SvxCrossedOutItem& ) rSet.Get( nWhich ); 266cdf0e10cSrcweir eStrikeout = ( FontStrikeout ) rItem.GetValue(); 267cdf0e10cSrcweir } 268cdf0e10cSrcweir else 269cdf0e10cSrcweir eStrikeout = STRIKEOUT_NONE; 270cdf0e10cSrcweir 271cdf0e10cSrcweir rFont.SetStrikeout( eStrikeout ); 272cdf0e10cSrcweir rCJKFont.SetStrikeout( eStrikeout ); 273cdf0e10cSrcweir rCTLFont.SetStrikeout( eStrikeout ); 274cdf0e10cSrcweir 275cdf0e10cSrcweir // WordLineMode 276cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); 277cdf0e10cSrcweir if( ISITEMSET ) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir const SvxWordLineModeItem& rItem = ( SvxWordLineModeItem& ) rSet.Get( nWhich ); 280cdf0e10cSrcweir rFont.SetWordLineMode( rItem.GetValue() ); 281cdf0e10cSrcweir rCJKFont.SetWordLineMode( rItem.GetValue() ); 282cdf0e10cSrcweir rCTLFont.SetWordLineMode( rItem.GetValue() ); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir // Emphasis 286cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); 287cdf0e10cSrcweir if( ISITEMSET ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir const SvxEmphasisMarkItem& rItem = ( SvxEmphasisMarkItem& ) rSet.Get( nWhich ); 290cdf0e10cSrcweir FontEmphasisMark eMark = rItem.GetEmphasisMark(); 291cdf0e10cSrcweir rFont.SetEmphasisMark( eMark ); 292cdf0e10cSrcweir rCJKFont.SetEmphasisMark( eMark ); 293cdf0e10cSrcweir rCTLFont.SetEmphasisMark( eMark ); 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir // Relief 297cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_RELIEF ); 298cdf0e10cSrcweir if( ISITEMSET ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir const SvxCharReliefItem& rItem = ( SvxCharReliefItem& ) rSet.Get( nWhich ); 301cdf0e10cSrcweir FontRelief eFontRelief = ( FontRelief ) rItem.GetValue(); 302cdf0e10cSrcweir rFont.SetRelief( eFontRelief ); 303cdf0e10cSrcweir rCJKFont.SetRelief( eFontRelief ); 304cdf0e10cSrcweir rCTLFont.SetRelief( eFontRelief ); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir // Effects 308cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); 309cdf0e10cSrcweir if( ISITEMSET ) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir const SvxCaseMapItem& rItem = ( SvxCaseMapItem& ) rSet.Get( nWhich ); 312cdf0e10cSrcweir SvxCaseMap eCaseMap = ( SvxCaseMap ) rItem.GetValue(); 313cdf0e10cSrcweir rFont.SetCaseMap( eCaseMap ); 314cdf0e10cSrcweir rCJKFont.SetCaseMap( eCaseMap ); 315cdf0e10cSrcweir // #i78474# small caps do not exist in CTL fonts 316cdf0e10cSrcweir rCTLFont.SetCaseMap( eCaseMap == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : eCaseMap ); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir // Outline 320cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); 321cdf0e10cSrcweir if( ISITEMSET ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir const SvxContourItem& rItem = ( SvxContourItem& ) rSet.Get( nWhich ); 324cdf0e10cSrcweir sal_Bool bOutline = rItem.GetValue(); 325cdf0e10cSrcweir rFont.SetOutline( bOutline ); 326cdf0e10cSrcweir rCJKFont.SetOutline( bOutline ); 327cdf0e10cSrcweir rCTLFont.SetOutline( bOutline ); 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir // Shadow 331cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); 332cdf0e10cSrcweir if( ISITEMSET ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir const SvxShadowedItem& rItem = ( SvxShadowedItem& ) rSet.Get( nWhich ); 335cdf0e10cSrcweir sal_Bool bShadow = rItem.GetValue(); 336cdf0e10cSrcweir rFont.SetShadow( bShadow ); 337cdf0e10cSrcweir rCJKFont.SetShadow( bShadow ); 338cdf0e10cSrcweir rCTLFont.SetShadow( bShadow ); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir // Background 342cdf0e10cSrcweir sal_Bool bTransparent; 343cdf0e10cSrcweir nWhich = GetWhich( m_bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR ); 344cdf0e10cSrcweir if( ISITEMSET ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich ); 347cdf0e10cSrcweir const Color& rColor = rBrush.GetColor(); 348cdf0e10cSrcweir bTransparent = rColor.GetTransparency() > 0; 349cdf0e10cSrcweir rFont.SetFillColor( rColor ); 350cdf0e10cSrcweir rCJKFont.SetFillColor( rColor ); 351cdf0e10cSrcweir rCTLFont.SetFillColor( rColor ); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir else 354cdf0e10cSrcweir bTransparent = sal_True; 355cdf0e10cSrcweir 356cdf0e10cSrcweir rFont.SetTransparent( bTransparent ); 357cdf0e10cSrcweir rCJKFont.SetTransparent( bTransparent ); 358cdf0e10cSrcweir rCTLFont.SetTransparent( bTransparent ); 359cdf0e10cSrcweir 360cdf0e10cSrcweir Color aBackCol( COL_TRANSPARENT ); 361cdf0e10cSrcweir if( !m_bPreviewBackgroundToCharacter ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH ); 364cdf0e10cSrcweir if( ISITEMSET ) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir const SvxBrushItem& rBrush = ( SvxBrushItem& ) rSet.Get( nWhich ); 367cdf0e10cSrcweir if( GPOS_NONE == rBrush.GetGraphicPos() ) 368cdf0e10cSrcweir aBackCol = rBrush.GetColor(); 369cdf0e10cSrcweir } 370cdf0e10cSrcweir } 371cdf0e10cSrcweir m_aPreviewWin.SetBackColor( aBackCol ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir // Font 374cdf0e10cSrcweir SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont ); 375cdf0e10cSrcweir SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont ); 376cdf0e10cSrcweir SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont ); 377cdf0e10cSrcweir 378cdf0e10cSrcweir // Style 379cdf0e10cSrcweir SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont ); 380cdf0e10cSrcweir SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont ); 381cdf0e10cSrcweir SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont ); 382cdf0e10cSrcweir 383cdf0e10cSrcweir // Size 384cdf0e10cSrcweir SetPrevFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont ); 385cdf0e10cSrcweir SetPrevFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont ); 386cdf0e10cSrcweir SetPrevFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir // Color 389cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); 390cdf0e10cSrcweir if( ISITEMSET ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir const SvxColorItem& rItem = ( SvxColorItem& ) rSet.Get( nWhich ); 393cdf0e10cSrcweir Color aCol( rItem.GetValue() ); 394cdf0e10cSrcweir rFont.SetColor( aCol ); 395cdf0e10cSrcweir rCJKFont.SetColor( aCol ); 396cdf0e10cSrcweir rCTLFont.SetColor( aCol ); 397cdf0e10cSrcweir 398cdf0e10cSrcweir m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO 399cdf0e10cSrcweir } 400cdf0e10cSrcweir 401cdf0e10cSrcweir // Kerning 402cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); 403cdf0e10cSrcweir if( ISITEMSET ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir const SvxKerningItem& rItem = ( SvxKerningItem& ) rSet.Get( nWhich ); 406cdf0e10cSrcweir short nKern = ( short ) 407cdf0e10cSrcweir LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MAP_TWIP ); 408cdf0e10cSrcweir rFont.SetFixKerning( nKern ); 409cdf0e10cSrcweir rCJKFont.SetFixKerning( nKern ); 410cdf0e10cSrcweir rCTLFont.SetFixKerning( nKern ); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir // Escapement 414cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); 415cdf0e10cSrcweir const sal_uInt8 nProp = 100; 416cdf0e10cSrcweir short nEsc; 417cdf0e10cSrcweir sal_uInt8 nEscProp; 418cdf0e10cSrcweir if( ISITEMSET ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir const SvxEscapementItem& rItem = ( SvxEscapementItem& ) rSet.Get( nWhich ); 421cdf0e10cSrcweir nEsc = rItem.GetEsc(); 422cdf0e10cSrcweir nEscProp = rItem.GetProp(); 423cdf0e10cSrcweir 424cdf0e10cSrcweir if( nEsc == DFLT_ESC_AUTO_SUPER ) 425cdf0e10cSrcweir nEsc = DFLT_ESC_SUPER; 426cdf0e10cSrcweir else if( nEsc == DFLT_ESC_AUTO_SUB ) 427cdf0e10cSrcweir nEsc = DFLT_ESC_SUB; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir else 430cdf0e10cSrcweir { 431cdf0e10cSrcweir nEsc = 0; 432cdf0e10cSrcweir nEscProp = 100; 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir SetPrevFontEscapement( nProp, nEscProp, nEsc ); 436cdf0e10cSrcweir 437cdf0e10cSrcweir // Font width scale 438cdf0e10cSrcweir SetPrevFontWidthScale( rSet ); 439cdf0e10cSrcweir 440cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir // ----------------------------------------------------------------------- 444cdf0e10cSrcweir 445cdf0e10cSrcweir void SvxCharBasePage::SetPrevFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont ) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 448cdf0e10cSrcweir long nH; 449cdf0e10cSrcweir if( rSet.GetItemState( nWhich ) >= SFX_ITEM_SET ) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir nH = LogicToLogic( ( ( SvxFontHeightItem& ) rSet.Get( nWhich ) ).GetHeight(), 452cdf0e10cSrcweir ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), 453cdf0e10cSrcweir MAP_TWIP ); 454cdf0e10cSrcweir } 455cdf0e10cSrcweir else 456cdf0e10cSrcweir nH = 240; // as default 12pt 457cdf0e10cSrcweir 458cdf0e10cSrcweir rFont.SetSize( Size( 0, nH ) ); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir 461cdf0e10cSrcweir // ----------------------------------------------------------------------- 462cdf0e10cSrcweir 463cdf0e10cSrcweir void SvxCharBasePage::SetPrevFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 466cdf0e10cSrcweir if( ISITEMSET ) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir const SvxFontItem& rFontItem = ( SvxFontItem& ) rSet.Get( nWhich ); 469cdf0e10cSrcweir rFont.SetFamily( rFontItem.GetFamily() ); 470cdf0e10cSrcweir rFont.SetName( rFontItem.GetFamilyName() ); 471cdf0e10cSrcweir rFont.SetPitch( rFontItem.GetPitch() ); 472cdf0e10cSrcweir rFont.SetCharSet( rFontItem.GetCharSet() ); 473cdf0e10cSrcweir rFont.SetStyleName( rFontItem.GetStyleName() ); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir } 476cdf0e10cSrcweir 477cdf0e10cSrcweir // ----------------------------------------------------------------------- 478cdf0e10cSrcweir 479cdf0e10cSrcweir void SvxCharBasePage::SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont& rFont ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nPosture ); 482cdf0e10cSrcweir if( ISITEMSET ) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir const SvxPostureItem& rItem = ( SvxPostureItem& ) rSet.Get( nWhich ); 485cdf0e10cSrcweir rFont.SetItalic( ( FontItalic ) rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE ); 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir nWhich = GetWhich( nWeight ); 489cdf0e10cSrcweir if( ISITEMSET ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir SvxWeightItem& rItem = ( SvxWeightItem& ) rSet.Get( nWhich ); 492cdf0e10cSrcweir rFont.SetWeight( ( FontWeight ) rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL ); 493cdf0e10cSrcweir } 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir // ----------------------------------------------------------------------- 497cdf0e10cSrcweir 498cdf0e10cSrcweir void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet& rSet ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); 501cdf0e10cSrcweir if( ISITEMSET ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); 504cdf0e10cSrcweir 505cdf0e10cSrcweir m_aPreviewWin.SetFontWidthScale( rItem.GetValue() ); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir // ----------------------------------------------------------------------- 510cdf0e10cSrcweir namespace 511cdf0e10cSrcweir { 512cdf0e10cSrcweir // ----------------------------------------------------------------------- 513cdf0e10cSrcweir void setPrevFontEscapement(SvxFont& _rFont,sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir _rFont.SetPropr( nProp ); 516cdf0e10cSrcweir _rFont.SetProprRel( nEscProp ); 517cdf0e10cSrcweir _rFont.SetEscapement( nEsc ); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir // ----------------------------------------------------------------------- 520cdf0e10cSrcweir // ----------------------------------------------------------------------- 521cdf0e10cSrcweir } 522cdf0e10cSrcweir // ----------------------------------------------------------------------- 523cdf0e10cSrcweir 524cdf0e10cSrcweir void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir setPrevFontEscapement(GetPreviewFont(),nProp,nEscProp,nEsc); 527cdf0e10cSrcweir setPrevFontEscapement(GetPreviewCJKFont(),nProp,nEscProp,nEsc); 528cdf0e10cSrcweir setPrevFontEscapement(GetPreviewCTLFont(),nProp,nEscProp,nEsc); 529cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 530cdf0e10cSrcweir } 531cdf0e10cSrcweir 532cdf0e10cSrcweir // SvxCharNamePage_Impl -------------------------------------------------- 533cdf0e10cSrcweir 534cdf0e10cSrcweir struct SvxCharNamePage_Impl 535cdf0e10cSrcweir { 536cdf0e10cSrcweir Timer m_aUpdateTimer; 537cdf0e10cSrcweir String m_aNoStyleText; 538cdf0e10cSrcweir String m_aTransparentText; 539cdf0e10cSrcweir const FontList* m_pFontList; 540cdf0e10cSrcweir sal_uInt16 m_nExtraEntryPos; 541cdf0e10cSrcweir sal_Bool m_bMustDelete; 542cdf0e10cSrcweir sal_Bool m_bInSearchMode; 543cdf0e10cSrcweir 544cdf0e10cSrcweir SvxCharNamePage_Impl() : 545cdf0e10cSrcweir 546cdf0e10cSrcweir m_pFontList ( NULL ), 547cdf0e10cSrcweir m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND ), 548cdf0e10cSrcweir m_bMustDelete ( sal_False ), 549cdf0e10cSrcweir m_bInSearchMode ( sal_False ) 550cdf0e10cSrcweir 551cdf0e10cSrcweir { 552cdf0e10cSrcweir m_aUpdateTimer.SetTimeout( 350 ); 553cdf0e10cSrcweir } 554cdf0e10cSrcweir 555cdf0e10cSrcweir ~SvxCharNamePage_Impl() 556cdf0e10cSrcweir { 557cdf0e10cSrcweir if ( m_bMustDelete ) 558cdf0e10cSrcweir delete m_pFontList; 559cdf0e10cSrcweir } 560cdf0e10cSrcweir }; 561cdf0e10cSrcweir 562cdf0e10cSrcweir // class SvxCharNamePage ------------------------------------------------- 563cdf0e10cSrcweir 564cdf0e10cSrcweir SvxCharNamePage::SvxCharNamePage( Window* pParent, const SfxItemSet& rInSet ) : 565cdf0e10cSrcweir 566cdf0e10cSrcweir SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_NAME ), rInSet, WIN_CHAR_PREVIEW, FT_CHAR_FONTTYPE ), 567cdf0e10cSrcweir m_pImpl ( new SvxCharNamePage_Impl ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir m_pImpl->m_aNoStyleText = String( CUI_RES( STR_CHARNAME_NOSTYLE ) ); 570cdf0e10cSrcweir m_pImpl->m_aTransparentText = String( CUI_RES( STR_CHARNAME_TRANSPARENT ) ); 571cdf0e10cSrcweir 572cdf0e10cSrcweir SvtLanguageOptions aLanguageOptions; 573cdf0e10cSrcweir sal_Bool bCJK = ( aLanguageOptions.IsCJKFontEnabled() || aLanguageOptions.IsCTLFontEnabled() ); 574cdf0e10cSrcweir 575cdf0e10cSrcweir m_pWestLine = new FixedLine( this, CUI_RES( FL_WEST ) ); 576cdf0e10cSrcweir m_pWestFontNameFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_NAME : FT_WEST_NAME_NOCJK ) ); 577cdf0e10cSrcweir m_pWestFontNameLB = new FontNameBox( this, CUI_RES( bCJK ? LB_WEST_NAME : LB_WEST_NAME_NOCJK ) ); 578cdf0e10cSrcweir m_pWestFontStyleFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_STYLE : FT_WEST_STYLE_NOCJK ) ); 579cdf0e10cSrcweir m_pWestFontStyleLB = new FontStyleBox( this, CUI_RES( bCJK ? LB_WEST_STYLE : LB_WEST_STYLE_NOCJK ) ); 580cdf0e10cSrcweir m_pWestFontSizeFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_SIZE : FT_WEST_SIZE_NOCJK ) ); 581cdf0e10cSrcweir m_pWestFontSizeLB = new FontSizeBox( this, CUI_RES( bCJK ? LB_WEST_SIZE : LB_WEST_SIZE_NOCJK ) ); 582cdf0e10cSrcweir 583cdf0e10cSrcweir if( !bCJK ) 584cdf0e10cSrcweir { 585cdf0e10cSrcweir m_pColorFL = new FixedLine( this, CUI_RES( FL_COLOR2 ) ); 586cdf0e10cSrcweir m_pColorFT = new FixedText( this, CUI_RES( FT_COLOR2 ) ); 587cdf0e10cSrcweir m_pColorLB = new ColorListBox( this, CUI_RES( LB_COLOR2 ) ); 588cdf0e10cSrcweir } 589cdf0e10cSrcweir 590cdf0e10cSrcweir m_pWestFontLanguageFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_LANG : FT_WEST_LANG_NOCJK ) ); 591cdf0e10cSrcweir m_pWestFontLanguageLB = new SvxLanguageBox( this, CUI_RES( bCJK ? LB_WEST_LANG : LB_WEST_LANG_NOCJK ) ); 592cdf0e10cSrcweir 593cdf0e10cSrcweir m_pEastLine = new FixedLine( this, CUI_RES( FL_EAST ) ); 594cdf0e10cSrcweir m_pEastFontNameFT = new FixedText( this, CUI_RES( FT_EAST_NAME ) ); 595cdf0e10cSrcweir m_pEastFontNameLB = new FontNameBox( this, CUI_RES( LB_EAST_NAME ) ); 596cdf0e10cSrcweir m_pEastFontStyleFT = new FixedText( this, CUI_RES( FT_EAST_STYLE ) ); 597cdf0e10cSrcweir m_pEastFontStyleLB = new FontStyleBox( this, CUI_RES( LB_EAST_STYLE ) ); 598cdf0e10cSrcweir m_pEastFontSizeFT = new FixedText( this, CUI_RES( FT_EAST_SIZE ) ); 599cdf0e10cSrcweir m_pEastFontSizeLB = new FontSizeBox( this, CUI_RES( LB_EAST_SIZE ) ); 600cdf0e10cSrcweir m_pEastFontLanguageFT = new FixedText( this, CUI_RES( FT_EAST_LANG ) ); 601cdf0e10cSrcweir m_pEastFontLanguageLB = new SvxLanguageBox( this, CUI_RES( LB_EAST_LANG ) ); 602cdf0e10cSrcweir 603cdf0e10cSrcweir m_pCTLLine = new FixedLine( this, CUI_RES( FL_CTL ) ); 604cdf0e10cSrcweir m_pCTLFontNameFT = new FixedText( this, CUI_RES( FT_CTL_NAME ) ); 605cdf0e10cSrcweir m_pCTLFontNameLB = new FontNameBox( this, CUI_RES( LB_CTL_NAME ) ); 606cdf0e10cSrcweir m_pCTLFontStyleFT = new FixedText( this, CUI_RES( FT_CTL_STYLE ) ); 607cdf0e10cSrcweir m_pCTLFontStyleLB = new FontStyleBox( this, CUI_RES( LB_CTL_STYLE ) ); 608cdf0e10cSrcweir m_pCTLFontSizeFT = new FixedText( this, CUI_RES( FT_CTL_SIZE ) ); 609cdf0e10cSrcweir m_pCTLFontSizeLB = new FontSizeBox( this, CUI_RES( LB_CTL_SIZE ) ); 610cdf0e10cSrcweir m_pCTLFontLanguageFT = new FixedText( this, CUI_RES( FT_CTL_LANG ) ); 611cdf0e10cSrcweir m_pCTLFontLanguageLB = new SvxLanguageBox( this, CUI_RES( LB_CTL_LANG ) ); 612cdf0e10cSrcweir 613cdf0e10cSrcweir if( bCJK ) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir m_pColorFL = new FixedLine( this, CUI_RES( FL_COLOR2 ) ); 616cdf0e10cSrcweir m_pColorFT = new FixedText( this, CUI_RES( FT_COLOR2 ) ); 617cdf0e10cSrcweir m_pColorLB = new ColorListBox( this, CUI_RES( LB_COLOR2 ) ); 618cdf0e10cSrcweir } 619cdf0e10cSrcweir 620cdf0e10cSrcweir m_pWestLine ->Show( bCJK ); 621cdf0e10cSrcweir m_pColorFL ->Show( bCJK ); 622cdf0e10cSrcweir 623cdf0e10cSrcweir bCJK = aLanguageOptions.IsCJKFontEnabled(); 624cdf0e10cSrcweir m_pEastLine ->Show( bCJK ); 625cdf0e10cSrcweir m_pEastFontNameFT ->Show( bCJK ); 626cdf0e10cSrcweir m_pEastFontNameLB ->Show( bCJK ); 627cdf0e10cSrcweir m_pEastFontStyleFT ->Show( bCJK ); 628cdf0e10cSrcweir m_pEastFontStyleLB ->Show( bCJK ); 629cdf0e10cSrcweir m_pEastFontSizeFT ->Show( bCJK ); 630cdf0e10cSrcweir m_pEastFontSizeLB ->Show( bCJK ); 631cdf0e10cSrcweir m_pEastFontLanguageFT ->Show( bCJK ); 632cdf0e10cSrcweir m_pEastFontLanguageLB ->Show( bCJK ); 633cdf0e10cSrcweir 634cdf0e10cSrcweir sal_Bool bShowCTL = aLanguageOptions.IsCTLFontEnabled(); 635cdf0e10cSrcweir if ( bShowCTL && !bCJK ) 636cdf0e10cSrcweir { 637cdf0e10cSrcweir // move CTL controls to the places of the CJK controls, if these controls aren't visible 638cdf0e10cSrcweir m_pCTLLine ->SetPosPixel( m_pEastLine->GetPosPixel() ); 639cdf0e10cSrcweir m_pCTLFontNameFT ->SetPosPixel( m_pEastFontNameFT->GetPosPixel() ); 640cdf0e10cSrcweir m_pCTLFontNameLB ->SetPosPixel( m_pEastFontNameLB->GetPosPixel() ); 641cdf0e10cSrcweir m_pCTLFontStyleFT ->SetPosPixel( m_pEastFontStyleFT->GetPosPixel() ); 642cdf0e10cSrcweir m_pCTLFontStyleLB ->SetPosPixel( m_pEastFontStyleLB->GetPosPixel() ); 643cdf0e10cSrcweir m_pCTLFontSizeFT ->SetPosPixel( m_pEastFontSizeFT->GetPosPixel() ); 644cdf0e10cSrcweir m_pCTLFontSizeLB ->SetPosPixel( m_pEastFontSizeLB->GetPosPixel() ); 645cdf0e10cSrcweir m_pCTLFontLanguageFT ->SetPosPixel( m_pEastFontLanguageFT->GetPosPixel() ); 646cdf0e10cSrcweir m_pCTLFontLanguageLB ->SetPosPixel( m_pEastFontLanguageLB->GetPosPixel() ); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir m_pCTLLine ->Show( bShowCTL ); 649cdf0e10cSrcweir m_pCTLFontNameFT ->Show( bShowCTL ); 650cdf0e10cSrcweir m_pCTLFontNameLB ->Show( bShowCTL ); 651cdf0e10cSrcweir m_pCTLFontStyleFT ->Show( bShowCTL ); 652cdf0e10cSrcweir m_pCTLFontStyleLB ->Show( bShowCTL ); 653cdf0e10cSrcweir m_pCTLFontSizeFT ->Show( bShowCTL ); 654cdf0e10cSrcweir m_pCTLFontSizeLB ->Show( bShowCTL ); 655cdf0e10cSrcweir m_pCTLFontLanguageFT ->Show( bShowCTL ); 656cdf0e10cSrcweir m_pCTLFontLanguageLB ->Show( bShowCTL ); 657cdf0e10cSrcweir 658cdf0e10cSrcweir FreeResource(); 659cdf0e10cSrcweir 660cdf0e10cSrcweir m_pWestFontLanguageLB->SetLanguageList( LANG_LIST_WESTERN, sal_True, sal_False, sal_True ); 661cdf0e10cSrcweir m_pEastFontLanguageLB->SetLanguageList( LANG_LIST_CJK, sal_True, sal_False, sal_True ); 662cdf0e10cSrcweir m_pCTLFontLanguageLB->SetLanguageList( LANG_LIST_CTL, sal_True, sal_False, sal_True ); 663cdf0e10cSrcweir 664cdf0e10cSrcweir Initialize(); 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir // ----------------------------------------------------------------------- 668cdf0e10cSrcweir 669cdf0e10cSrcweir SvxCharNamePage::~SvxCharNamePage() 670cdf0e10cSrcweir { 671cdf0e10cSrcweir delete m_pImpl; 672cdf0e10cSrcweir 673cdf0e10cSrcweir delete m_pWestLine; 674cdf0e10cSrcweir delete m_pWestFontNameFT; 675cdf0e10cSrcweir delete m_pWestFontNameLB; 676cdf0e10cSrcweir delete m_pWestFontStyleFT; 677cdf0e10cSrcweir delete m_pWestFontStyleLB; 678cdf0e10cSrcweir delete m_pWestFontSizeFT; 679cdf0e10cSrcweir delete m_pWestFontSizeLB; 680cdf0e10cSrcweir delete m_pWestFontLanguageFT; 681cdf0e10cSrcweir delete m_pWestFontLanguageLB; 682cdf0e10cSrcweir 683cdf0e10cSrcweir delete m_pEastLine; 684cdf0e10cSrcweir delete m_pEastFontNameFT; 685cdf0e10cSrcweir delete m_pEastFontNameLB; 686cdf0e10cSrcweir delete m_pEastFontStyleFT; 687cdf0e10cSrcweir delete m_pEastFontStyleLB; 688cdf0e10cSrcweir delete m_pEastFontSizeFT; 689cdf0e10cSrcweir delete m_pEastFontSizeLB; 690cdf0e10cSrcweir delete m_pEastFontLanguageFT; 691cdf0e10cSrcweir delete m_pEastFontLanguageLB; 692cdf0e10cSrcweir 693cdf0e10cSrcweir delete m_pCTLLine; 694cdf0e10cSrcweir delete m_pCTLFontNameFT; 695cdf0e10cSrcweir delete m_pCTLFontNameLB; 696cdf0e10cSrcweir delete m_pCTLFontStyleFT; 697cdf0e10cSrcweir delete m_pCTLFontStyleLB; 698cdf0e10cSrcweir delete m_pCTLFontSizeFT; 699cdf0e10cSrcweir delete m_pCTLFontSizeLB; 700cdf0e10cSrcweir delete m_pCTLFontLanguageFT; 701cdf0e10cSrcweir delete m_pCTLFontLanguageLB; 702cdf0e10cSrcweir 703cdf0e10cSrcweir delete m_pColorFL; 704cdf0e10cSrcweir delete m_pColorFT; 705cdf0e10cSrcweir delete m_pColorLB; 706cdf0e10cSrcweir } 707cdf0e10cSrcweir 708cdf0e10cSrcweir // ----------------------------------------------------------------------- 709cdf0e10cSrcweir 710cdf0e10cSrcweir void SvxCharNamePage::Initialize() 711cdf0e10cSrcweir { 712cdf0e10cSrcweir // to handle the changes of the other pages 713cdf0e10cSrcweir SetExchangeSupport(); 714cdf0e10cSrcweir 715cdf0e10cSrcweir // fill the color box 716cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 717cdf0e10cSrcweir //DBG_ASSERT( pDocSh, "DocShell not found!" ); 718cdf0e10cSrcweir XColorTable* pColorTable = NULL; 719cdf0e10cSrcweir FASTBOOL bKillTable = sal_False; 720cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 721cdf0e10cSrcweir 722cdf0e10cSrcweir if ( pDocSh ) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir pItem = pDocSh->GetItem( SID_COLOR_TABLE ); 725cdf0e10cSrcweir if ( pItem != NULL ) 726cdf0e10cSrcweir pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir if ( !pColorTable ) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 732cdf0e10cSrcweir bKillTable = sal_True; 733cdf0e10cSrcweir } 734cdf0e10cSrcweir 735cdf0e10cSrcweir m_pColorLB->SetUpdateMode( sal_False ); 736cdf0e10cSrcweir 737cdf0e10cSrcweir { 738cdf0e10cSrcweir SfxPoolItem* pDummy; 739cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); 740cdf0e10cSrcweir if( !pFrame || SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( 741cdf0e10cSrcweir SID_ATTR_AUTO_COLOR_INVALID, pDummy )) 742cdf0e10cSrcweir m_pColorLB->InsertEntry( Color( COL_AUTO ), 743cdf0e10cSrcweir SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); 744cdf0e10cSrcweir } 745cdf0e10cSrcweir for ( long i = 0; i < pColorTable->Count(); i++ ) 746cdf0e10cSrcweir { 747cdf0e10cSrcweir XColorEntry* pEntry = pColorTable->GetColor(i); 748cdf0e10cSrcweir m_pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir m_pColorLB->SetUpdateMode( sal_True ); 752cdf0e10cSrcweir 753cdf0e10cSrcweir if ( bKillTable ) 754cdf0e10cSrcweir delete pColorTable; 755cdf0e10cSrcweir 756cdf0e10cSrcweir m_pColorLB->SetSelectHdl( LINK( this, SvxCharNamePage, ColorBoxSelectHdl_Impl ) ); 757cdf0e10cSrcweir 758cdf0e10cSrcweir Link aLink = LINK( this, SvxCharNamePage, FontModifyHdl_Impl ); 759cdf0e10cSrcweir m_pWestFontNameLB->SetModifyHdl( aLink ); 760cdf0e10cSrcweir m_pWestFontStyleLB->SetModifyHdl( aLink ); 761cdf0e10cSrcweir m_pWestFontSizeLB->SetModifyHdl( aLink ); 762cdf0e10cSrcweir m_pEastFontNameLB->SetModifyHdl( aLink ); 763cdf0e10cSrcweir m_pEastFontStyleLB->SetModifyHdl( aLink ); 764cdf0e10cSrcweir m_pEastFontSizeLB->SetModifyHdl( aLink ); 765cdf0e10cSrcweir m_pCTLFontNameLB->SetModifyHdl( aLink ); 766cdf0e10cSrcweir m_pCTLFontStyleLB->SetModifyHdl( aLink ); 767cdf0e10cSrcweir m_pCTLFontSizeLB->SetModifyHdl( aLink ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir m_pImpl->m_aUpdateTimer.SetTimeoutHdl( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) ); 770cdf0e10cSrcweir 771cdf0e10cSrcweir m_pColorFL->Hide(); 772cdf0e10cSrcweir m_pColorFT->Hide(); 773cdf0e10cSrcweir m_pColorLB->Hide(); 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir // ----------------------------------------------------------------------- 777cdf0e10cSrcweir 778cdf0e10cSrcweir const FontList* SvxCharNamePage::GetFontList() const 779cdf0e10cSrcweir { 780cdf0e10cSrcweir if ( !m_pImpl->m_pFontList ) 781cdf0e10cSrcweir { 782cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 783cdf0e10cSrcweir const SfxPoolItem* pItem; 784cdf0e10cSrcweir 785cdf0e10cSrcweir /* #110771# SvxFontListItem::GetFontList can return NULL */ 786cdf0e10cSrcweir if ( pDocSh ) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 789cdf0e10cSrcweir if ( pItem != NULL ) 790cdf0e10cSrcweir { 791cdf0e10cSrcweir DBG_ASSERT(NULL != ( (SvxFontListItem*)pItem )->GetFontList(), 792cdf0e10cSrcweir "Where is the font list?"); 793cdf0e10cSrcweir m_pImpl->m_pFontList = static_cast<const SvxFontListItem*>(pItem )->GetFontList()->Clone(); 794cdf0e10cSrcweir m_pImpl->m_bMustDelete = sal_True; 795cdf0e10cSrcweir } 796cdf0e10cSrcweir } 797cdf0e10cSrcweir if(!m_pImpl->m_pFontList) 798cdf0e10cSrcweir { 799cdf0e10cSrcweir m_pImpl->m_pFontList = 800cdf0e10cSrcweir new FontList( Application::GetDefaultDevice() ); 801cdf0e10cSrcweir m_pImpl->m_bMustDelete = sal_True; 802cdf0e10cSrcweir } 803cdf0e10cSrcweir } 804cdf0e10cSrcweir 805cdf0e10cSrcweir return m_pImpl->m_pFontList; 806cdf0e10cSrcweir } 807cdf0e10cSrcweir 808cdf0e10cSrcweir // ----------------------------------------------------------------------------- 809cdf0e10cSrcweir namespace 810cdf0e10cSrcweir { 811cdf0e10cSrcweir FontInfo calcFontInfo( SvxFont& _rFont, 812cdf0e10cSrcweir SvxCharNamePage* _pPage, 813cdf0e10cSrcweir const FontNameBox* _pFontNameLB, 814cdf0e10cSrcweir const FontStyleBox* _pFontStyleLB, 815cdf0e10cSrcweir const FontSizeBox* _pFontSizeLB, 816cdf0e10cSrcweir const FontList* _pFontList, 817cdf0e10cSrcweir sal_uInt16 _nFontWhich, 818cdf0e10cSrcweir sal_uInt16 _nFontHeightWhich) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir Size aSize = _rFont.GetSize(); 821cdf0e10cSrcweir aSize.Width() = 0; 822cdf0e10cSrcweir FontInfo aFontInfo; 823cdf0e10cSrcweir String sFontName(_pFontNameLB->GetText()); 824cdf0e10cSrcweir sal_Bool bFontAvailable = _pFontList->IsAvailable( sFontName ); 825cdf0e10cSrcweir if(bFontAvailable || _pFontNameLB->GetSavedValue() != sFontName) 826cdf0e10cSrcweir aFontInfo = _pFontList->Get( sFontName, _pFontStyleLB->GetText() ); 827cdf0e10cSrcweir else 828cdf0e10cSrcweir { 829cdf0e10cSrcweir //get the font from itemset 830cdf0e10cSrcweir SfxItemState eState = _pPage->GetItemSet().GetItemState( _nFontWhich ); 831cdf0e10cSrcweir if ( eState >= SFX_ITEM_DEFAULT ) 832cdf0e10cSrcweir { 833cdf0e10cSrcweir const SvxFontItem* pFontItem = (const SvxFontItem*)&( _pPage->GetItemSet().Get( _nFontWhich ) ); 834cdf0e10cSrcweir aFontInfo.SetName(pFontItem->GetFamilyName()); 835cdf0e10cSrcweir aFontInfo.SetStyleName(pFontItem->GetStyleName()); 836cdf0e10cSrcweir aFontInfo.SetFamily(pFontItem->GetFamily()); 837cdf0e10cSrcweir aFontInfo.SetPitch(pFontItem->GetPitch()); 838cdf0e10cSrcweir aFontInfo.SetCharSet(pFontItem->GetCharSet()); 839cdf0e10cSrcweir } 840cdf0e10cSrcweir } 841cdf0e10cSrcweir if ( _pFontSizeLB->IsRelative() ) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir DBG_ASSERT( _pPage->GetItemSet().GetParent(), "No parent set" ); 844cdf0e10cSrcweir const SvxFontHeightItem& rOldItem = (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ); 845cdf0e10cSrcweir 846cdf0e10cSrcweir // alter Wert, skaliert 847cdf0e10cSrcweir long nHeight; 848cdf0e10cSrcweir if ( _pFontSizeLB->IsPtRelative() ) 849cdf0e10cSrcweir nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) ); 850cdf0e10cSrcweir else 851cdf0e10cSrcweir nHeight = static_cast<long>(rOldItem.GetHeight() * _pFontSizeLB->GetValue() / 100); 852cdf0e10cSrcweir 853cdf0e10cSrcweir // Umrechnung in twips fuer das Beispiel-Window 854cdf0e10cSrcweir aSize.Height() = 855cdf0e10cSrcweir ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), SFX_FUNIT_TWIP ); 856cdf0e10cSrcweir } 857cdf0e10cSrcweir else if ( _pFontSizeLB->GetText().Len() ) 858cdf0e10cSrcweir aSize.Height() = PointToTwips( static_cast<long>(_pFontSizeLB->GetValue() / 10) ); 859cdf0e10cSrcweir else 860cdf0e10cSrcweir aSize.Height() = 200; // default 10pt 861cdf0e10cSrcweir aFontInfo.SetSize( aSize ); 862cdf0e10cSrcweir 863cdf0e10cSrcweir _rFont.SetFamily( aFontInfo.GetFamily() ); 864cdf0e10cSrcweir _rFont.SetName( aFontInfo.GetName() ); 865cdf0e10cSrcweir _rFont.SetStyleName( aFontInfo.GetStyleName() ); 866cdf0e10cSrcweir _rFont.SetPitch( aFontInfo.GetPitch() ); 867cdf0e10cSrcweir _rFont.SetCharSet( aFontInfo.GetCharSet() ); 868cdf0e10cSrcweir _rFont.SetWeight( aFontInfo.GetWeight() ); 869cdf0e10cSrcweir _rFont.SetItalic( aFontInfo.GetItalic() ); 870cdf0e10cSrcweir _rFont.SetSize( aFontInfo.GetSize() ); 871cdf0e10cSrcweir 872cdf0e10cSrcweir return aFontInfo; 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir 876cdf0e10cSrcweir // ----------------------------------------------------------------------- 877cdf0e10cSrcweir 878cdf0e10cSrcweir void SvxCharNamePage::UpdatePreview_Impl() 879cdf0e10cSrcweir { 880cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 881cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 882cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 883cdf0e10cSrcweir // Size 884cdf0e10cSrcweir Size aSize = rFont.GetSize(); 885cdf0e10cSrcweir aSize.Width() = 0; 886cdf0e10cSrcweir Size aCJKSize = rCJKFont.GetSize(); 887cdf0e10cSrcweir aCJKSize.Width() = 0; 888cdf0e10cSrcweir Size aCTLSize = rCTLFont.GetSize(); 889cdf0e10cSrcweir aCTLSize.Width() = 0; 890cdf0e10cSrcweir // Font 891cdf0e10cSrcweir const FontList* pFontList = GetFontList(); 892cdf0e10cSrcweir FontInfo aFontInfo = 893cdf0e10cSrcweir calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); 894cdf0e10cSrcweir 895cdf0e10cSrcweir calcFontInfo(rCJKFont,this,m_pEastFontNameLB,m_pEastFontStyleLB,m_pEastFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CJK_FONT ),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); 896cdf0e10cSrcweir 897cdf0e10cSrcweir calcFontInfo(rCTLFont,this,m_pCTLFontNameLB,m_pCTLFontStyleLB,m_pCTLFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CTL_FONT ),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); 898cdf0e10cSrcweir 899cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 900cdf0e10cSrcweir m_aFontTypeFT.SetText( pFontList->GetFontMapText( aFontInfo ) ); 901cdf0e10cSrcweir } 902cdf0e10cSrcweir 903cdf0e10cSrcweir // ----------------------------------------------------------------------- 904cdf0e10cSrcweir 905cdf0e10cSrcweir void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox* pNameBox ) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir const FontList* pFontList = GetFontList(); 908cdf0e10cSrcweir DBG_ASSERT( pFontList, "no fontlist" ); 909cdf0e10cSrcweir 910cdf0e10cSrcweir FontStyleBox* pStyleBox = NULL; 911cdf0e10cSrcweir 912cdf0e10cSrcweir if ( m_pWestFontNameLB == pNameBox ) 913cdf0e10cSrcweir pStyleBox = m_pWestFontStyleLB; 914cdf0e10cSrcweir else if ( m_pEastFontNameLB == pNameBox ) 915cdf0e10cSrcweir pStyleBox = m_pEastFontStyleLB; 916cdf0e10cSrcweir else if ( m_pCTLFontNameLB == pNameBox ) 917cdf0e10cSrcweir pStyleBox = m_pCTLFontStyleLB; 918cdf0e10cSrcweir else 919cdf0e10cSrcweir { 920cdf0e10cSrcweir DBG_ERRORFILE( "invalid font name box" ); 921cdf0e10cSrcweir } 922cdf0e10cSrcweir 923cdf0e10cSrcweir pStyleBox->Fill( pNameBox->GetText(), pFontList ); 924cdf0e10cSrcweir 925cdf0e10cSrcweir if ( m_pImpl->m_bInSearchMode ) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir // Bei der Suche zus"atzliche Eintr"age: 928cdf0e10cSrcweir // "Nicht Fett" und "Nicht Kursiv" 929cdf0e10cSrcweir String aEntry = m_pImpl->m_aNoStyleText; 930cdf0e10cSrcweir const sal_Char sS[] = "%1"; 931cdf0e10cSrcweir aEntry.SearchAndReplaceAscii( sS, pFontList->GetBoldStr() ); 932cdf0e10cSrcweir m_pImpl->m_nExtraEntryPos = pStyleBox->InsertEntry( aEntry ); 933cdf0e10cSrcweir aEntry = m_pImpl->m_aNoStyleText; 934cdf0e10cSrcweir aEntry.SearchAndReplaceAscii( sS, pFontList->GetItalicStr() ); 935cdf0e10cSrcweir pStyleBox->InsertEntry( aEntry ); 936cdf0e10cSrcweir } 937cdf0e10cSrcweir } 938cdf0e10cSrcweir 939cdf0e10cSrcweir // ----------------------------------------------------------------------- 940cdf0e10cSrcweir 941cdf0e10cSrcweir void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox* pNameBox ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir const FontList* pFontList = GetFontList(); 944cdf0e10cSrcweir DBG_ASSERT( pFontList, "no fontlist" ); 945cdf0e10cSrcweir 946cdf0e10cSrcweir FontStyleBox* pStyleBox = NULL; 947cdf0e10cSrcweir FontSizeBox* pSizeBox = NULL; 948cdf0e10cSrcweir 949cdf0e10cSrcweir if ( m_pWestFontNameLB == pNameBox ) 950cdf0e10cSrcweir { 951cdf0e10cSrcweir pStyleBox = m_pWestFontStyleLB; 952cdf0e10cSrcweir pSizeBox = m_pWestFontSizeLB; 953cdf0e10cSrcweir } 954cdf0e10cSrcweir else if ( m_pEastFontNameLB == pNameBox ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir pStyleBox = m_pEastFontStyleLB; 957cdf0e10cSrcweir pSizeBox = m_pEastFontSizeLB; 958cdf0e10cSrcweir } 959cdf0e10cSrcweir else if ( m_pCTLFontNameLB == pNameBox ) 960cdf0e10cSrcweir { 961cdf0e10cSrcweir pStyleBox = m_pCTLFontStyleLB; 962cdf0e10cSrcweir pSizeBox = m_pCTLFontSizeLB; 963cdf0e10cSrcweir } 964cdf0e10cSrcweir else 965cdf0e10cSrcweir { 966cdf0e10cSrcweir DBG_ERRORFILE( "invalid font name box" ); 967cdf0e10cSrcweir } 968cdf0e10cSrcweir 969cdf0e10cSrcweir FontInfo _aFontInfo( pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ); 970cdf0e10cSrcweir pSizeBox->Fill( &_aFontInfo, pFontList ); 971cdf0e10cSrcweir } 972cdf0e10cSrcweir 973cdf0e10cSrcweir // ----------------------------------------------------------------------- 974cdf0e10cSrcweir 975cdf0e10cSrcweir void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp ) 976cdf0e10cSrcweir { 977cdf0e10cSrcweir FixedText* pNameLabel = NULL; 978cdf0e10cSrcweir FontNameBox* pNameBox = NULL; 979cdf0e10cSrcweir FixedText* pStyleLabel = NULL; 980cdf0e10cSrcweir FontStyleBox* pStyleBox = NULL; 981cdf0e10cSrcweir FixedText* pSizeLabel = NULL; 982cdf0e10cSrcweir FontSizeBox* pSizeBox = NULL; 983cdf0e10cSrcweir FixedText* pLangFT = NULL; 984cdf0e10cSrcweir SvxLanguageBox* pLangBox = NULL; 985cdf0e10cSrcweir sal_uInt16 nWhich = 0; 986cdf0e10cSrcweir 987cdf0e10cSrcweir switch ( eLangGrp ) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir case Western : 990cdf0e10cSrcweir pNameLabel = m_pWestFontNameFT; 991cdf0e10cSrcweir pNameBox = m_pWestFontNameLB; 992cdf0e10cSrcweir pStyleLabel = m_pWestFontStyleFT; 993cdf0e10cSrcweir pStyleBox = m_pWestFontStyleLB; 994cdf0e10cSrcweir pSizeLabel = m_pWestFontSizeFT; 995cdf0e10cSrcweir pSizeBox = m_pWestFontSizeLB; 996cdf0e10cSrcweir pLangFT = m_pWestFontLanguageFT; 997cdf0e10cSrcweir pLangBox = m_pWestFontLanguageLB; 998cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_FONT ); 999cdf0e10cSrcweir break; 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir case Asian : 1002cdf0e10cSrcweir pNameLabel = m_pEastFontNameFT; 1003cdf0e10cSrcweir pNameBox = m_pEastFontNameLB; 1004cdf0e10cSrcweir pStyleLabel = m_pEastFontStyleFT; 1005cdf0e10cSrcweir pStyleBox = m_pEastFontStyleLB; 1006cdf0e10cSrcweir pSizeLabel = m_pEastFontSizeFT; 1007cdf0e10cSrcweir pSizeBox = m_pEastFontSizeLB; 1008cdf0e10cSrcweir pLangFT = m_pEastFontLanguageFT; 1009cdf0e10cSrcweir pLangBox = m_pEastFontLanguageLB; 1010cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT ); 1011cdf0e10cSrcweir break; 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir case Ctl : 1014cdf0e10cSrcweir pNameLabel = m_pCTLFontNameFT; 1015cdf0e10cSrcweir pNameBox = m_pCTLFontNameLB; 1016cdf0e10cSrcweir pStyleLabel = m_pCTLFontStyleFT; 1017cdf0e10cSrcweir pStyleBox = m_pCTLFontStyleLB; 1018cdf0e10cSrcweir pSizeLabel = m_pCTLFontSizeFT; 1019cdf0e10cSrcweir pSizeBox = m_pCTLFontSizeLB; 1020cdf0e10cSrcweir pLangFT = m_pCTLFontLanguageFT; 1021cdf0e10cSrcweir pLangBox = m_pCTLFontLanguageLB; 1022cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT ); 1023cdf0e10cSrcweir break; 1024cdf0e10cSrcweir } 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir // die FontListBox fuellen 1027cdf0e10cSrcweir const FontList* pFontList = GetFontList(); 1028cdf0e10cSrcweir pNameBox->Fill( pFontList ); 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir // Font ermitteln 1031cdf0e10cSrcweir const SvxFontItem* pFontItem = NULL; 1032cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir if ( eState >= SFX_ITEM_DEFAULT ) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir pFontItem = (const SvxFontItem*)&( rSet.Get( nWhich ) ); 1037cdf0e10cSrcweir pNameBox->SetText( pFontItem->GetFamilyName() ); 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir else 1040cdf0e10cSrcweir { 1041cdf0e10cSrcweir pNameBox->SetText( String() ); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir FillStyleBox_Impl( pNameBox ); 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir FASTBOOL bStyle = sal_False; 1047cdf0e10cSrcweir FASTBOOL bStyleAvailable = sal_True; 1048cdf0e10cSrcweir FontItalic eItalic = ITALIC_NONE; 1049cdf0e10cSrcweir FontWeight eWeight = WEIGHT_NORMAL; 1050cdf0e10cSrcweir switch ( eLangGrp ) 1051cdf0e10cSrcweir { 1052cdf0e10cSrcweir case Western : nWhich = GetWhich( SID_ATTR_CHAR_POSTURE ); break; 1053cdf0e10cSrcweir case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_POSTURE ); break; 1054cdf0e10cSrcweir case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_POSTURE ); break; 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir if ( eState >= SFX_ITEM_DEFAULT ) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir const SvxPostureItem& rItem = (SvxPostureItem&)rSet.Get( nWhich ); 1061cdf0e10cSrcweir eItalic = (FontItalic)rItem.GetValue(); 1062cdf0e10cSrcweir bStyle = sal_True; 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); 1065cdf0e10cSrcweir 1066cdf0e10cSrcweir switch ( eLangGrp ) 1067cdf0e10cSrcweir { 1068cdf0e10cSrcweir case Western : nWhich = GetWhich( SID_ATTR_CHAR_WEIGHT ); break; 1069cdf0e10cSrcweir case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_WEIGHT ); break; 1070cdf0e10cSrcweir case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_WEIGHT ); break; 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir if ( eState >= SFX_ITEM_DEFAULT ) 1075cdf0e10cSrcweir { 1076cdf0e10cSrcweir SvxWeightItem& rItem = (SvxWeightItem&)rSet.Get( nWhich ); 1077cdf0e10cSrcweir eWeight = (FontWeight)rItem.GetValue(); 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir else 1080cdf0e10cSrcweir bStyle = sal_False; 1081cdf0e10cSrcweir bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir // Aktuell eingestellter Font 1084cdf0e10cSrcweir if ( bStyle && pFontItem ) 1085cdf0e10cSrcweir { 1086cdf0e10cSrcweir FontInfo aInfo = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic ); 1087cdf0e10cSrcweir pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); 1088cdf0e10cSrcweir } 1089cdf0e10cSrcweir else if ( !m_pImpl->m_bInSearchMode || !bStyle ) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir pStyleBox->SetText( String() ); 1092cdf0e10cSrcweir } 1093cdf0e10cSrcweir else if ( bStyle ) 1094cdf0e10cSrcweir { 1095cdf0e10cSrcweir FontInfo aInfo = pFontList->Get( String(), eWeight, eItalic ); 1096cdf0e10cSrcweir pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); 1097cdf0e10cSrcweir } 1098cdf0e10cSrcweir if (!bStyleAvailable) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir pStyleBox->Disable( ); 1101cdf0e10cSrcweir pStyleLabel->Disable( ); 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir // SizeBox fuellen 1105cdf0e10cSrcweir FillSizeBox_Impl( pNameBox ); 1106cdf0e10cSrcweir switch ( eLangGrp ) 1107cdf0e10cSrcweir { 1108cdf0e10cSrcweir case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break; 1109cdf0e10cSrcweir case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ); break; 1110cdf0e10cSrcweir case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ); break; 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir if ( pSizeBox->IsRelativeMode() ) 1115cdf0e10cSrcweir { 1116cdf0e10cSrcweir SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); 1117cdf0e10cSrcweir const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir if( rItem.GetProp() != 100 || SFX_MAPUNIT_RELATIVE != rItem.GetPropUnit() ) 1120cdf0e10cSrcweir { 1121cdf0e10cSrcweir sal_Bool bPtRel = SFX_MAPUNIT_POINT == rItem.GetPropUnit(); 1122cdf0e10cSrcweir pSizeBox->SetPtRelative( bPtRel ); 1123cdf0e10cSrcweir pSizeBox->SetValue( bPtRel ? ((short)rItem.GetProp()) * 10 : rItem.GetProp() ); 1124cdf0e10cSrcweir } 1125cdf0e10cSrcweir else 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir pSizeBox->SetRelative(); 1128cdf0e10cSrcweir pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir } 1131cdf0e10cSrcweir else if ( eState >= SFX_ITEM_DEFAULT ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); 1134cdf0e10cSrcweir const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); 1135cdf0e10cSrcweir pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir else 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir pSizeBox->SetText( String() ); 1140cdf0e10cSrcweir if ( eState <= SFX_ITEM_READONLY ) 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir pSizeBox->Disable( ); 1143cdf0e10cSrcweir pSizeLabel->Disable( ); 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir } 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir switch ( eLangGrp ) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir case Western : nWhich = GetWhich( SID_ATTR_CHAR_LANGUAGE ); break; 1150cdf0e10cSrcweir case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break; 1151cdf0e10cSrcweir case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break; 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir pLangBox->SetNoSelection(); 1154cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir switch ( eState ) 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 1159cdf0e10cSrcweir pLangFT->Hide(); 1160cdf0e10cSrcweir pLangBox->Hide(); 1161cdf0e10cSrcweir break; 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir case SFX_ITEM_DISABLED: 1164cdf0e10cSrcweir case SFX_ITEM_READONLY: 1165cdf0e10cSrcweir pLangFT->Disable(); 1166cdf0e10cSrcweir pLangBox->Disable(); 1167cdf0e10cSrcweir break; 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 1170cdf0e10cSrcweir case SFX_ITEM_SET: 1171cdf0e10cSrcweir { 1172cdf0e10cSrcweir const SvxLanguageItem& rItem = (SvxLanguageItem&)rSet.Get( nWhich ); 1173cdf0e10cSrcweir LanguageType eLangType = (LanguageType)rItem.GetValue(); 1174cdf0e10cSrcweir DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" ); 1175cdf0e10cSrcweir if ( eLangType != LANGUAGE_DONTKNOW ) 1176cdf0e10cSrcweir pLangBox->SelectLanguage( eLangType ); 1177cdf0e10cSrcweir break; 1178cdf0e10cSrcweir } 1179cdf0e10cSrcweir } 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir if ( Western == eLangGrp ) 1182cdf0e10cSrcweir m_aFontTypeFT.SetText( pFontList->GetFontMapText( 1183cdf0e10cSrcweir pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ) ); 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir // save these settings 1186cdf0e10cSrcweir pNameBox->SaveValue(); 1187cdf0e10cSrcweir pStyleBox->SaveValue(); 1188cdf0e10cSrcweir pSizeBox->SaveValue(); 1189cdf0e10cSrcweir pLangBox->SaveValue(); 1190cdf0e10cSrcweir } 1191cdf0e10cSrcweir 1192cdf0e10cSrcweir // ----------------------------------------------------------------------- 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir sal_Bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp ) 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir sal_Bool bModified = sal_False; 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir FontNameBox* pNameBox = NULL; 1199cdf0e10cSrcweir FontStyleBox* pStyleBox = NULL; 1200cdf0e10cSrcweir FontSizeBox* pSizeBox = NULL; 1201cdf0e10cSrcweir SvxLanguageBox* pLangBox = NULL; 1202cdf0e10cSrcweir sal_uInt16 nWhich = 0; 1203cdf0e10cSrcweir sal_uInt16 nSlot = 0; 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir switch ( eLangGrp ) 1206cdf0e10cSrcweir { 1207cdf0e10cSrcweir case Western : 1208cdf0e10cSrcweir pNameBox = m_pWestFontNameLB; 1209cdf0e10cSrcweir pStyleBox = m_pWestFontStyleLB; 1210cdf0e10cSrcweir pSizeBox = m_pWestFontSizeLB; 1211cdf0e10cSrcweir pLangBox = m_pWestFontLanguageLB; 1212cdf0e10cSrcweir nSlot = SID_ATTR_CHAR_FONT; 1213cdf0e10cSrcweir break; 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir case Asian : 1216cdf0e10cSrcweir pNameBox = m_pEastFontNameLB; 1217cdf0e10cSrcweir pStyleBox = m_pEastFontStyleLB; 1218cdf0e10cSrcweir pSizeBox = m_pEastFontSizeLB; 1219cdf0e10cSrcweir pLangBox = m_pEastFontLanguageLB; 1220cdf0e10cSrcweir nSlot = SID_ATTR_CHAR_CJK_FONT; 1221cdf0e10cSrcweir break; 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir case Ctl : 1224cdf0e10cSrcweir pNameBox = m_pCTLFontNameLB; 1225cdf0e10cSrcweir pStyleBox = m_pCTLFontStyleLB; 1226cdf0e10cSrcweir pSizeBox = m_pCTLFontSizeLB; 1227cdf0e10cSrcweir pLangBox = m_pCTLFontLanguageLB; 1228cdf0e10cSrcweir nSlot = SID_ATTR_CHAR_CTL_FONT; 1229cdf0e10cSrcweir break; 1230cdf0e10cSrcweir } 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir nWhich = GetWhich( nSlot ); 1233cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1234cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 1235cdf0e10cSrcweir const SfxPoolItem* pOld = NULL; 1236cdf0e10cSrcweir 1237cdf0e10cSrcweir const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir FASTBOOL bChanged = sal_True; 1240cdf0e10cSrcweir const String& rFontName = pNameBox->GetText(); 1241cdf0e10cSrcweir const FontList* pFontList = GetFontList(); 1242cdf0e10cSrcweir String aStyleBoxText =pStyleBox->GetText(); 1243cdf0e10cSrcweir sal_uInt16 nEntryPos = pStyleBox->GetEntryPos( aStyleBoxText ); 1244cdf0e10cSrcweir if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) 1245cdf0e10cSrcweir aStyleBoxText.Erase(); 1246cdf0e10cSrcweir FontInfo aInfo( pFontList->Get( rFontName, aStyleBoxText ) ); 1247cdf0e10cSrcweir SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), 1248cdf0e10cSrcweir aInfo.GetPitch(), aInfo.GetCharSet(), nWhich ); 1249cdf0e10cSrcweir pOld = GetOldItem( rSet, nSlot ); 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir if ( pOld ) 1252cdf0e10cSrcweir { 1253cdf0e10cSrcweir const SvxFontItem& rItem = *( (const SvxFontItem*)pOld ); 1254cdf0e10cSrcweir 1255cdf0e10cSrcweir if ( rItem.GetFamilyName() == aFontItem.GetFamilyName() ) 1256cdf0e10cSrcweir bChanged = sal_False; 1257cdf0e10cSrcweir } 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir if ( !bChanged ) 1260cdf0e10cSrcweir bChanged = !pNameBox->GetSavedValue().Len(); 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir if ( !bChanged && pExampleSet && 1263cdf0e10cSrcweir pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 1264cdf0e10cSrcweir ( (SvxFontItem*)pItem )->GetFamilyName() != aFontItem.GetFamilyName() ) 1265cdf0e10cSrcweir bChanged = sal_True; 1266cdf0e10cSrcweir 1267cdf0e10cSrcweir if ( bChanged && rFontName.Len() ) 1268cdf0e10cSrcweir { 1269cdf0e10cSrcweir rSet.Put( aFontItem ); 1270cdf0e10cSrcweir bModified |= sal_True; 1271cdf0e10cSrcweir } 1272cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1273cdf0e10cSrcweir rSet.ClearItem( nWhich ); 1274cdf0e10cSrcweir 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir bChanged = sal_True; 1277cdf0e10cSrcweir switch ( eLangGrp ) 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir case Western : nSlot = SID_ATTR_CHAR_WEIGHT; break; 1280cdf0e10cSrcweir case Asian : nSlot = SID_ATTR_CHAR_CJK_WEIGHT; break; 1281cdf0e10cSrcweir case Ctl : nSlot = SID_ATTR_CHAR_CTL_WEIGHT; break; 1282cdf0e10cSrcweir } 1283cdf0e10cSrcweir nWhich = GetWhich( nSlot ); 1284cdf0e10cSrcweir FontWeight eWeight = aInfo.GetWeight(); 1285cdf0e10cSrcweir if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) 1286cdf0e10cSrcweir eWeight = WEIGHT_NORMAL; 1287cdf0e10cSrcweir SvxWeightItem aWeightItem( eWeight, nWhich ); 1288cdf0e10cSrcweir pOld = GetOldItem( rSet, nSlot ); 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir if ( pOld ) 1291cdf0e10cSrcweir { 1292cdf0e10cSrcweir const SvxWeightItem& rItem = *( (const SvxWeightItem*)pOld ); 1293cdf0e10cSrcweir 1294cdf0e10cSrcweir if ( rItem.GetValue() == aWeightItem.GetValue() ) 1295cdf0e10cSrcweir bChanged = sal_False; 1296cdf0e10cSrcweir } 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir if ( !bChanged ) 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir bChanged = !pStyleBox->GetSavedValue().Len(); 1301cdf0e10cSrcweir 1302cdf0e10cSrcweir if ( m_pImpl->m_bInSearchMode && bChanged && 1303cdf0e10cSrcweir aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE ) 1304cdf0e10cSrcweir bChanged = sal_False; 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir 1307cdf0e10cSrcweir if ( !bChanged && pExampleSet && 1308cdf0e10cSrcweir pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 1309cdf0e10cSrcweir ( (SvxWeightItem*)pItem )->GetValue() != aWeightItem.GetValue() ) 1310cdf0e10cSrcweir bChanged = sal_True; 1311cdf0e10cSrcweir 1312cdf0e10cSrcweir if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) 1313cdf0e10cSrcweir bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos ); 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir String aText( pStyleBox->GetText() ); // Tristate, dann Text leer 1316cdf0e10cSrcweir 1317cdf0e10cSrcweir if ( bChanged && aText.Len() ) 1318cdf0e10cSrcweir { 1319cdf0e10cSrcweir rSet.Put( aWeightItem ); 1320cdf0e10cSrcweir bModified |= sal_True; 1321cdf0e10cSrcweir } 1322cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1323cdf0e10cSrcweir CLEARTITEM; 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir bChanged = sal_True; 1326cdf0e10cSrcweir switch ( eLangGrp ) 1327cdf0e10cSrcweir { 1328cdf0e10cSrcweir case Western : nSlot = SID_ATTR_CHAR_POSTURE; break; 1329cdf0e10cSrcweir case Asian : nSlot = SID_ATTR_CHAR_CJK_POSTURE; break; 1330cdf0e10cSrcweir case Ctl : nSlot = SID_ATTR_CHAR_CTL_POSTURE; break; 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir nWhich = GetWhich( nSlot ); 1333cdf0e10cSrcweir FontItalic eItalic = aInfo.GetItalic(); 1334cdf0e10cSrcweir if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) 1335cdf0e10cSrcweir eItalic = ITALIC_NONE; 1336cdf0e10cSrcweir SvxPostureItem aPostureItem( eItalic, nWhich ); 1337cdf0e10cSrcweir pOld = GetOldItem( rSet, nSlot ); 1338cdf0e10cSrcweir 1339cdf0e10cSrcweir if ( pOld ) 1340cdf0e10cSrcweir { 1341cdf0e10cSrcweir const SvxPostureItem& rItem = *( (const SvxPostureItem*)pOld ); 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir if ( rItem.GetValue() == aPostureItem.GetValue() ) 1344cdf0e10cSrcweir bChanged = sal_False; 1345cdf0e10cSrcweir } 1346cdf0e10cSrcweir 1347cdf0e10cSrcweir if ( !bChanged ) 1348cdf0e10cSrcweir { 1349cdf0e10cSrcweir bChanged = !pStyleBox->GetSavedValue().Len(); 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir if ( m_pImpl->m_bInSearchMode && bChanged && 1352cdf0e10cSrcweir aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL ) 1353cdf0e10cSrcweir bChanged = sal_False; 1354cdf0e10cSrcweir } 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir if ( !bChanged && pExampleSet && 1357cdf0e10cSrcweir pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 1358cdf0e10cSrcweir ( (SvxPostureItem*)pItem )->GetValue() != aPostureItem.GetValue() ) 1359cdf0e10cSrcweir bChanged = sal_True; 1360cdf0e10cSrcweir 1361cdf0e10cSrcweir if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) 1362cdf0e10cSrcweir bChanged = ( nEntryPos == ( m_pImpl->m_nExtraEntryPos + 1 ) ); 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir if ( bChanged && aText.Len() ) 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir rSet.Put( aPostureItem ); 1367cdf0e10cSrcweir bModified |= sal_True; 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1370cdf0e10cSrcweir CLEARTITEM; 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir // FontSize 1373cdf0e10cSrcweir long nSize = static_cast<long>(pSizeBox->GetValue()); 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir if ( !pSizeBox->GetText().Len() ) // GetValue() gibt dann Min-Wert zurueck 1376cdf0e10cSrcweir nSize = 0; 1377cdf0e10cSrcweir long nSavedSize = pSizeBox->GetSavedValue().ToInt32(); 1378cdf0e10cSrcweir FASTBOOL bRel = sal_True; 1379cdf0e10cSrcweir 1380cdf0e10cSrcweir if ( !pSizeBox->IsRelative() ) 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir nSavedSize *= 10; 1383cdf0e10cSrcweir bRel = sal_False; 1384cdf0e10cSrcweir } 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir switch ( eLangGrp ) 1387cdf0e10cSrcweir { 1388cdf0e10cSrcweir case Western : nSlot = SID_ATTR_CHAR_FONTHEIGHT; break; 1389cdf0e10cSrcweir case Asian : nSlot = SID_ATTR_CHAR_CJK_FONTHEIGHT; break; 1390cdf0e10cSrcweir case Ctl : nSlot = SID_ATTR_CHAR_CTL_FONTHEIGHT; break; 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir nWhich = GetWhich( nSlot ); 1393cdf0e10cSrcweir const SvxFontHeightItem* pOldHeight = (const SvxFontHeightItem*)GetOldItem( rSet, nSlot ); 1394cdf0e10cSrcweir bChanged = ( nSize != nSavedSize ); 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir if ( !bChanged && pExampleSet && 1397cdf0e10cSrcweir pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET ) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir float fSize = (float)nSize / 10; 1400cdf0e10cSrcweir long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) ); 1401cdf0e10cSrcweir if ( ( (SvxFontHeightItem*)pItem )->GetHeight() != (sal_uInt32)nVal ) 1402cdf0e10cSrcweir bChanged = sal_True; 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir if ( bChanged || !pOldHeight || 1406cdf0e10cSrcweir bRel != ( SFX_MAPUNIT_RELATIVE != pOldHeight->GetPropUnit() || 100 != pOldHeight->GetProp() ) ) 1407cdf0e10cSrcweir { 1408cdf0e10cSrcweir SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); 1409cdf0e10cSrcweir if ( pSizeBox->IsRelative() ) 1410cdf0e10cSrcweir { 1411cdf0e10cSrcweir DBG_ASSERT( GetItemSet().GetParent(), "No parent set" ); 1412cdf0e10cSrcweir const SvxFontHeightItem& rOldItem = 1413cdf0e10cSrcweir (const SvxFontHeightItem&)GetItemSet().GetParent()->Get( nWhich ); 1414cdf0e10cSrcweir 1415cdf0e10cSrcweir SvxFontHeightItem aHeight( 240, 100, nWhich ); 1416cdf0e10cSrcweir if ( pSizeBox->IsPtRelative() ) 1417cdf0e10cSrcweir aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)( nSize / 10 ), SFX_MAPUNIT_POINT, eUnit ); 1418cdf0e10cSrcweir else 1419cdf0e10cSrcweir aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)nSize, SFX_MAPUNIT_RELATIVE ); 1420cdf0e10cSrcweir rSet.Put( aHeight ); 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir else 1423cdf0e10cSrcweir { 1424cdf0e10cSrcweir float fSize = (float)nSize / 10; 1425cdf0e10cSrcweir rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) ); 1426cdf0e10cSrcweir } 1427cdf0e10cSrcweir bModified |= sal_True; 1428cdf0e10cSrcweir } 1429cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1430cdf0e10cSrcweir CLEARTITEM; 1431cdf0e10cSrcweir 1432cdf0e10cSrcweir bChanged = sal_True; 1433cdf0e10cSrcweir switch ( eLangGrp ) 1434cdf0e10cSrcweir { 1435cdf0e10cSrcweir case Western : nSlot = SID_ATTR_CHAR_LANGUAGE; break; 1436cdf0e10cSrcweir case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break; 1437cdf0e10cSrcweir case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break; 1438cdf0e10cSrcweir } 1439cdf0e10cSrcweir nWhich = GetWhich( nSlot ); 1440cdf0e10cSrcweir pOld = GetOldItem( rSet, nSlot ); 1441cdf0e10cSrcweir sal_uInt16 nLangPos = pLangBox->GetSelectEntryPos(); 1442cdf0e10cSrcweir LanguageType eLangType = (LanguageType)(sal_uLong)pLangBox->GetEntryData( nLangPos ); 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir if ( pOld ) 1445cdf0e10cSrcweir { 1446cdf0e10cSrcweir const SvxLanguageItem& rItem = *( (const SvxLanguageItem*)pOld ); 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == (LanguageType)rItem.GetValue() ) 1449cdf0e10cSrcweir bChanged = sal_False; 1450cdf0e10cSrcweir } 1451cdf0e10cSrcweir 1452cdf0e10cSrcweir if ( !bChanged ) 1453cdf0e10cSrcweir bChanged = ( pLangBox->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir if ( bChanged && nLangPos != LISTBOX_ENTRY_NOTFOUND ) 1456cdf0e10cSrcweir { 1457cdf0e10cSrcweir rSet.Put( SvxLanguageItem( eLangType, nWhich ) ); 1458cdf0e10cSrcweir bModified |= sal_True; 1459cdf0e10cSrcweir } 1460cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1461cdf0e10cSrcweir CLEARTITEM; 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir return bModified; 1464cdf0e10cSrcweir } 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir // ----------------------------------------------------------------------- 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir void SvxCharNamePage::ResetColor_Impl( const SfxItemSet& rSet ) 1469cdf0e10cSrcweir { 1470cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); 1471cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 1472cdf0e10cSrcweir 1473cdf0e10cSrcweir switch ( eState ) 1474cdf0e10cSrcweir { 1475cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 1476cdf0e10cSrcweir m_pColorLB->Hide(); 1477cdf0e10cSrcweir break; 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir case SFX_ITEM_DISABLED: 1480cdf0e10cSrcweir case SFX_ITEM_READONLY: 1481cdf0e10cSrcweir m_pColorLB->Disable(); 1482cdf0e10cSrcweir break; 1483cdf0e10cSrcweir 1484cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 1485cdf0e10cSrcweir m_pColorLB->SetNoSelection(); 1486cdf0e10cSrcweir break; 1487cdf0e10cSrcweir 1488cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 1489cdf0e10cSrcweir case SFX_ITEM_SET: 1490cdf0e10cSrcweir { 1491cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 1492cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 1493cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 1494cdf0e10cSrcweir const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); 1495cdf0e10cSrcweir Color aColor = rItem.GetValue(); 1496cdf0e10cSrcweir rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1497cdf0e10cSrcweir rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1498cdf0e10cSrcweir rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1499cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 1500cdf0e10cSrcweir sal_uInt16 nSelPos = m_pColorLB->GetEntryPos( aColor ); 1501cdf0e10cSrcweir if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) 1502cdf0e10cSrcweir nSelPos = m_pColorLB->GetEntryPos( m_pImpl->m_aTransparentText ); 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) 1505cdf0e10cSrcweir m_pColorLB->SelectEntryPos( nSelPos ); 1506cdf0e10cSrcweir else 1507cdf0e10cSrcweir { 1508cdf0e10cSrcweir nSelPos = m_pColorLB->GetEntryPos( aColor ); 1509cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) 1510cdf0e10cSrcweir m_pColorLB->SelectEntryPos( nSelPos ); 1511cdf0e10cSrcweir else 1512cdf0e10cSrcweir m_pColorLB->SelectEntryPos( 1513cdf0e10cSrcweir m_pColorLB->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); 1514cdf0e10cSrcweir } 1515cdf0e10cSrcweir break; 1516cdf0e10cSrcweir } 1517cdf0e10cSrcweir } 1518cdf0e10cSrcweir } 1519cdf0e10cSrcweir 1520cdf0e10cSrcweir // ----------------------------------------------------------------------- 1521cdf0e10cSrcweir 1522cdf0e10cSrcweir IMPL_LINK( SvxCharNamePage, UpdateHdl_Impl, Timer*, EMPTYARG ) 1523cdf0e10cSrcweir { 1524cdf0e10cSrcweir UpdatePreview_Impl(); 1525cdf0e10cSrcweir return 0; 1526cdf0e10cSrcweir } 1527cdf0e10cSrcweir 1528cdf0e10cSrcweir // ----------------------------------------------------------------------- 1529cdf0e10cSrcweir 1530cdf0e10cSrcweir IMPL_LINK( SvxCharNamePage, FontModifyHdl_Impl, void*, pNameBox ) 1531cdf0e10cSrcweir { 1532cdf0e10cSrcweir m_pImpl->m_aUpdateTimer.Start(); 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir if ( m_pWestFontNameLB == pNameBox || m_pEastFontNameLB == pNameBox || m_pCTLFontNameLB == pNameBox ) 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir FillStyleBox_Impl( (FontNameBox*)pNameBox ); 1537cdf0e10cSrcweir FillSizeBox_Impl( (FontNameBox*)pNameBox ); 1538cdf0e10cSrcweir } 1539cdf0e10cSrcweir return 0; 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir // ----------------------------------------------------------------------- 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir IMPL_LINK( SvxCharNamePage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) 1545cdf0e10cSrcweir { 1546cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 1547cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 1548cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 1549cdf0e10cSrcweir Color aSelectedColor; 1550cdf0e10cSrcweir if ( pBox->GetSelectEntry() == m_pImpl->m_aTransparentText ) 1551cdf0e10cSrcweir aSelectedColor = Color( COL_TRANSPARENT ); 1552cdf0e10cSrcweir else 1553cdf0e10cSrcweir aSelectedColor = pBox->GetSelectEntryColor(); 1554cdf0e10cSrcweir rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 1555cdf0e10cSrcweir rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 1556cdf0e10cSrcweir rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 1557cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 1558cdf0e10cSrcweir return 0; 1559cdf0e10cSrcweir } 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir // ----------------------------------------------------------------------- 1562cdf0e10cSrcweir 1563cdf0e10cSrcweir void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet ) 1564cdf0e10cSrcweir { 1565cdf0e10cSrcweir SvxCharBasePage::ActivatePage( rSet ); 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir UpdatePreview_Impl(); // instead of asynchronous calling in ctor 1568cdf0e10cSrcweir } 1569cdf0e10cSrcweir 1570cdf0e10cSrcweir // ----------------------------------------------------------------------- 1571cdf0e10cSrcweir 1572cdf0e10cSrcweir int SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet ) 1573cdf0e10cSrcweir { 1574cdf0e10cSrcweir if ( _pSet ) 1575cdf0e10cSrcweir FillItemSet( *_pSet ); 1576cdf0e10cSrcweir return LEAVE_PAGE; 1577cdf0e10cSrcweir } 1578cdf0e10cSrcweir 1579cdf0e10cSrcweir // ----------------------------------------------------------------------- 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir SfxTabPage* SvxCharNamePage::Create( Window* pParent, const SfxItemSet& rSet ) 1582cdf0e10cSrcweir { 1583cdf0e10cSrcweir return new SvxCharNamePage( pParent, rSet ); 1584cdf0e10cSrcweir } 1585cdf0e10cSrcweir 1586cdf0e10cSrcweir // ----------------------------------------------------------------------- 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir sal_uInt16* SvxCharNamePage::GetRanges() 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir return pNameRanges; 1591cdf0e10cSrcweir } 1592cdf0e10cSrcweir 1593cdf0e10cSrcweir // ----------------------------------------------------------------------- 1594cdf0e10cSrcweir 1595cdf0e10cSrcweir void SvxCharNamePage::Reset( const SfxItemSet& rSet ) 1596cdf0e10cSrcweir { 1597cdf0e10cSrcweir Reset_Impl( rSet, Western ); 1598cdf0e10cSrcweir Reset_Impl( rSet, Asian ); 1599cdf0e10cSrcweir Reset_Impl( rSet, Ctl ); 1600cdf0e10cSrcweir ResetColor_Impl( rSet ); 1601cdf0e10cSrcweir m_pColorLB->SaveValue(); 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir SetPrevFontWidthScale( rSet ); 1604cdf0e10cSrcweir UpdatePreview_Impl(); 1605cdf0e10cSrcweir } 1606cdf0e10cSrcweir 1607cdf0e10cSrcweir // ----------------------------------------------------------------------- 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir sal_Bool SvxCharNamePage::FillItemSet( SfxItemSet& rSet ) 1610cdf0e10cSrcweir { 1611cdf0e10cSrcweir sal_Bool bModified = FillItemSet_Impl( rSet, Western ); 1612cdf0e10cSrcweir bModified |= FillItemSet_Impl( rSet, Asian ); 1613cdf0e10cSrcweir bModified |= FillItemSet_Impl( rSet, Ctl ); 1614cdf0e10cSrcweir return bModified; 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir // ----------------------------------------------------------------------- 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir void SvxCharNamePage::SetFontList( const SvxFontListItem& rItem ) 1620cdf0e10cSrcweir { 1621cdf0e10cSrcweir if ( m_pImpl->m_bMustDelete ) 1622cdf0e10cSrcweir { 1623cdf0e10cSrcweir delete m_pImpl->m_pFontList; 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir m_pImpl->m_pFontList = rItem.GetFontList()->Clone(); 1626cdf0e10cSrcweir m_pImpl->m_bMustDelete = sal_True; 1627cdf0e10cSrcweir } 1628cdf0e10cSrcweir 1629cdf0e10cSrcweir // ----------------------------------------------------------------------- 1630cdf0e10cSrcweir namespace 1631cdf0e10cSrcweir { 1632cdf0e10cSrcweir void enableRelativeMode( SvxCharNamePage* _pPage, FontSizeBox* _pFontSizeLB, sal_uInt16 _nHeightWhich ) 1633cdf0e10cSrcweir { 1634cdf0e10cSrcweir _pFontSizeLB->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir const SvxFontHeightItem& rHeightItem = 1637cdf0e10cSrcweir (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nHeightWhich ); 1638cdf0e10cSrcweir SfxMapUnit eUnit = _pPage->GetItemSet().GetPool()->GetMetric( _nHeightWhich ); 1639cdf0e10cSrcweir short nCurHeight = 1640cdf0e10cSrcweir static_cast< short >( CalcToPoint( rHeightItem.GetHeight(), eUnit, 1 ) * 10 ); 1641cdf0e10cSrcweir 1642cdf0e10cSrcweir // ausgehend von der akt. Hoehe: 1643cdf0e10cSrcweir // - negativ bis minimal 2 pt 1644cdf0e10cSrcweir // - positiv bis maximal 999 pt 1645cdf0e10cSrcweir _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight), 10 ); 1646cdf0e10cSrcweir } 1647cdf0e10cSrcweir } 1648cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1649cdf0e10cSrcweir 1650cdf0e10cSrcweir void SvxCharNamePage::EnableRelativeMode() 1651cdf0e10cSrcweir { 1652cdf0e10cSrcweir DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" ); 1653cdf0e10cSrcweir enableRelativeMode(this,m_pWestFontSizeLB,GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); 1654cdf0e10cSrcweir enableRelativeMode(this,m_pEastFontSizeLB,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); 1655cdf0e10cSrcweir enableRelativeMode(this,m_pCTLFontSizeLB,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); 1656cdf0e10cSrcweir } 1657cdf0e10cSrcweir 1658cdf0e10cSrcweir // ----------------------------------------------------------------------- 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir void SvxCharNamePage::EnableSearchMode() 1661cdf0e10cSrcweir { 1662cdf0e10cSrcweir m_pImpl->m_bInSearchMode = sal_True; 1663cdf0e10cSrcweir } 1664cdf0e10cSrcweir // ----------------------------------------------------------------------- 1665cdf0e10cSrcweir void SvxCharNamePage::DisableControls( sal_uInt16 nDisable ) 1666cdf0e10cSrcweir { 1667cdf0e10cSrcweir if ( DISABLE_LANGUAGE & nDisable ) 1668cdf0e10cSrcweir { 1669cdf0e10cSrcweir if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Disable(); 1670cdf0e10cSrcweir if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Disable(); 1671cdf0e10cSrcweir if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Disable(); 1672cdf0e10cSrcweir if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Disable(); 1673cdf0e10cSrcweir if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Disable(); 1674cdf0e10cSrcweir if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Disable(); 1675cdf0e10cSrcweir } 1676cdf0e10cSrcweir 1677cdf0e10cSrcweir if ( DISABLE_HIDE_LANGUAGE & nDisable ) 1678cdf0e10cSrcweir { 1679cdf0e10cSrcweir if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Hide(); 1680cdf0e10cSrcweir if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Hide(); 1681cdf0e10cSrcweir if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Hide(); 1682cdf0e10cSrcweir if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Hide(); 1683cdf0e10cSrcweir if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Hide(); 1684cdf0e10cSrcweir if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Hide(); 1685cdf0e10cSrcweir } 1686cdf0e10cSrcweir } 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir // ----------------------------------------------------------------------- 1689cdf0e10cSrcweir void SvxCharNamePage::SetPreviewBackgroundToCharacter() 1690cdf0e10cSrcweir { 1691cdf0e10cSrcweir m_bPreviewBackgroundToCharacter = sal_True; 1692cdf0e10cSrcweir } 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir // ----------------------------------------------------------------------- 1695cdf0e10cSrcweir void SvxCharNamePage::PageCreated (SfxAllItemSet aSet) //add CHINA001 1696cdf0e10cSrcweir { 1697cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFontListItem,SvxFontListItem,SID_ATTR_CHAR_FONTLIST,sal_False); 1698cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 1699cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pDisalbeItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); 1700cdf0e10cSrcweir if (pFontListItem) 1701cdf0e10cSrcweir SetFontList(*pFontListItem); 1702cdf0e10cSrcweir //CHINA001 SetFontList(pFontListItem->GetFontList()); 1703cdf0e10cSrcweir 1704cdf0e10cSrcweir if (pFlagItem) 1705cdf0e10cSrcweir { 1706cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 1707cdf0e10cSrcweir if ( ( nFlags & SVX_RELATIVE_MODE ) == SVX_RELATIVE_MODE ) 1708cdf0e10cSrcweir EnableRelativeMode(); 1709cdf0e10cSrcweir if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) 1710cdf0e10cSrcweir SetPreviewBackgroundToCharacter(); 1711cdf0e10cSrcweir } 1712cdf0e10cSrcweir if (pDisalbeItem) 1713cdf0e10cSrcweir DisableControls(pDisalbeItem->GetValue()); 1714cdf0e10cSrcweir } 1715cdf0e10cSrcweir // class SvxCharEffectsPage ---------------------------------------------- 1716cdf0e10cSrcweir 1717cdf0e10cSrcweir SvxCharEffectsPage::SvxCharEffectsPage( Window* pParent, const SfxItemSet& rInSet ) : 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_EFFECTS ), rInSet, WIN_EFFECTS_PREVIEW, FT_EFFECTS_FONTTYPE ), 1720cdf0e10cSrcweir 1721cdf0e10cSrcweir m_aFontColorFT ( this, CUI_RES( FT_FONTCOLOR ) ), 1722cdf0e10cSrcweir m_aFontColorLB ( this, CUI_RES( LB_FONTCOLOR ) ), 1723cdf0e10cSrcweir 1724cdf0e10cSrcweir m_aEffectsFT ( this, CUI_RES( FT_EFFECTS ) ), 1725cdf0e10cSrcweir m_aEffectsLB ( this, 0 ), 1726cdf0e10cSrcweir 1727cdf0e10cSrcweir m_aEffects2LB ( this, CUI_RES( LB_EFFECTS2 ) ), 1728cdf0e10cSrcweir 1729cdf0e10cSrcweir m_aReliefFT ( this, CUI_RES( FT_RELIEF ) ), 1730cdf0e10cSrcweir m_aReliefLB ( this, CUI_RES( LB_RELIEF ) ), 1731cdf0e10cSrcweir 1732cdf0e10cSrcweir m_aOutlineBtn ( this, CUI_RES( CB_OUTLINE ) ), 1733cdf0e10cSrcweir m_aShadowBtn ( this, CUI_RES( CB_SHADOW ) ), 1734cdf0e10cSrcweir m_aBlinkingBtn ( this, CUI_RES( CB_BLINKING ) ), 1735cdf0e10cSrcweir m_aHiddenBtn ( this, CUI_RES( CB_CHARHIDDEN ) ), 1736cdf0e10cSrcweir 1737cdf0e10cSrcweir m_aVerticalLine ( this, CUI_RES( FL_EFFECTS_VERTICAL ) ), 1738cdf0e10cSrcweir 1739cdf0e10cSrcweir m_aOverlineFT ( this, CUI_RES( FT_OVERLINE ) ), 1740cdf0e10cSrcweir m_aOverlineLB ( this, CUI_RES( LB_OVERLINE ) ), 1741cdf0e10cSrcweir m_aOverlineColorFT ( this, CUI_RES( FT_OVERLINE_COLOR ) ), 1742cdf0e10cSrcweir m_aOverlineColorLB ( this, CUI_RES( LB_OVERLINE_COLOR ) ), 1743cdf0e10cSrcweir m_aStrikeoutFT ( this, CUI_RES( FT_STRIKEOUT ) ), 1744cdf0e10cSrcweir m_aStrikeoutLB ( this, CUI_RES( LB_STRIKEOUT ) ), 1745cdf0e10cSrcweir m_aUnderlineFT ( this, CUI_RES( FT_UNDERLINE ) ), 1746cdf0e10cSrcweir m_aUnderlineLB ( this, CUI_RES( LB_UNDERLINE ) ), 1747cdf0e10cSrcweir m_aUnderlineColorFT ( this, CUI_RES( FT_UNDERLINE_COLOR ) ), 1748cdf0e10cSrcweir m_aUnderlineColorLB ( this, CUI_RES( LB_UNDERLINE_COLOR ) ), 1749cdf0e10cSrcweir m_aIndividualWordsBtn ( this, CUI_RES( CB_INDIVIDUALWORDS ) ), 1750cdf0e10cSrcweir 1751cdf0e10cSrcweir m_aAsianLine ( this, CUI_RES( FL_EFFECTS_ASIAN ) ), 1752cdf0e10cSrcweir 1753cdf0e10cSrcweir m_aEmphasisFT ( this, CUI_RES( FT_EMPHASIS ) ), 1754cdf0e10cSrcweir m_aEmphasisLB ( this, CUI_RES( LB_EMPHASIS ) ), 1755cdf0e10cSrcweir m_aPositionFT ( this, CUI_RES( FT_POSITION ) ), 1756cdf0e10cSrcweir m_aPositionLB ( this, CUI_RES( LB_POSITION ) ), 1757cdf0e10cSrcweir 1758cdf0e10cSrcweir m_aTransparentColorName ( CUI_RES( STR_CHARNAME_TRANSPARENT ) ) 1759cdf0e10cSrcweir 1760cdf0e10cSrcweir { 1761cdf0e10cSrcweir m_aEffectsLB.Hide(); 1762cdf0e10cSrcweir FreeResource(); 1763cdf0e10cSrcweir Initialize(); 1764cdf0e10cSrcweir } 1765cdf0e10cSrcweir 1766cdf0e10cSrcweir // ----------------------------------------------------------------------- 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir void SvxCharEffectsPage::Initialize() 1769cdf0e10cSrcweir { 1770cdf0e10cSrcweir // to handle the changes of the other pages 1771cdf0e10cSrcweir SetExchangeSupport(); 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir // HTML-Mode 1774cdf0e10cSrcweir const SfxPoolItem* pItem; 1775cdf0e10cSrcweir SfxObjectShell* pShell; 1776cdf0e10cSrcweir if ( SFX_ITEM_SET == GetItemSet().GetItemState( SID_HTML_MODE, sal_False, &pItem ) || 1777cdf0e10cSrcweir ( NULL != ( pShell = SfxObjectShell::Current() ) && 1778cdf0e10cSrcweir NULL != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) 1779cdf0e10cSrcweir { 1780cdf0e10cSrcweir m_nHtmlMode = ( (const SfxUInt16Item*)pItem )->GetValue(); 1781cdf0e10cSrcweir if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON ) 1782cdf0e10cSrcweir { 1783cdf0e10cSrcweir //!!! hide some controls please 1784cdf0e10cSrcweir } 1785cdf0e10cSrcweir } 1786cdf0e10cSrcweir 1787cdf0e10cSrcweir // fill the color box 1788cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 1789cdf0e10cSrcweir DBG_ASSERT( pDocSh, "DocShell not found!" ); 1790cdf0e10cSrcweir XColorTable* pColorTable = NULL; 1791cdf0e10cSrcweir FASTBOOL bKillTable = sal_False; 1792cdf0e10cSrcweir 1793cdf0e10cSrcweir if ( pDocSh ) 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir pItem = pDocSh->GetItem( SID_COLOR_TABLE ); 1796cdf0e10cSrcweir if ( pItem != NULL ) 1797cdf0e10cSrcweir pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 1798cdf0e10cSrcweir } 1799cdf0e10cSrcweir 1800cdf0e10cSrcweir if ( !pColorTable ) 1801cdf0e10cSrcweir { 1802cdf0e10cSrcweir pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 1803cdf0e10cSrcweir bKillTable = sal_True; 1804cdf0e10cSrcweir } 1805cdf0e10cSrcweir 1806cdf0e10cSrcweir m_aUnderlineColorLB.SetUpdateMode( sal_False ); 1807cdf0e10cSrcweir m_aOverlineColorLB.SetUpdateMode( sal_False ); 1808cdf0e10cSrcweir m_aFontColorLB.SetUpdateMode( sal_False ); 1809cdf0e10cSrcweir 1810cdf0e10cSrcweir { 1811cdf0e10cSrcweir SfxPoolItem* pDummy; 1812cdf0e10cSrcweir SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); 1813cdf0e10cSrcweir if ( !pFrame || 1814cdf0e10cSrcweir SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID, pDummy ) ) 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir m_aUnderlineColorLB.InsertAutomaticEntry(); 1817cdf0e10cSrcweir m_aOverlineColorLB.InsertAutomaticEntry(); 1818cdf0e10cSrcweir m_aFontColorLB.InsertAutomaticEntry(); 1819cdf0e10cSrcweir } 1820cdf0e10cSrcweir } 1821cdf0e10cSrcweir for ( long i = 0; i < pColorTable->Count(); i++ ) 1822cdf0e10cSrcweir { 1823cdf0e10cSrcweir XColorEntry* pEntry = pColorTable->GetColor(i); 1824cdf0e10cSrcweir m_aUnderlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 1825cdf0e10cSrcweir m_aOverlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 1826cdf0e10cSrcweir m_aFontColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 1827cdf0e10cSrcweir } 1828cdf0e10cSrcweir 1829cdf0e10cSrcweir m_aUnderlineColorLB.SetUpdateMode( sal_True ); 1830cdf0e10cSrcweir m_aOverlineColorLB.SetUpdateMode( sal_True ); 1831cdf0e10cSrcweir m_aFontColorLB.SetUpdateMode( sal_True ); 1832cdf0e10cSrcweir m_aFontColorLB.SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) ); 1833cdf0e10cSrcweir 1834cdf0e10cSrcweir if ( bKillTable ) 1835cdf0e10cSrcweir delete pColorTable; 1836cdf0e10cSrcweir 1837cdf0e10cSrcweir // handler 1838cdf0e10cSrcweir Link aLink = LINK( this, SvxCharEffectsPage, SelectHdl_Impl ); 1839cdf0e10cSrcweir m_aUnderlineLB.SetSelectHdl( aLink ); 1840cdf0e10cSrcweir m_aUnderlineColorLB.SetSelectHdl( aLink ); 1841cdf0e10cSrcweir m_aOverlineLB.SetSelectHdl( aLink ); 1842cdf0e10cSrcweir m_aOverlineColorLB.SetSelectHdl( aLink ); 1843cdf0e10cSrcweir m_aStrikeoutLB.SetSelectHdl( aLink ); 1844cdf0e10cSrcweir m_aEmphasisLB.SetSelectHdl( aLink ); 1845cdf0e10cSrcweir m_aPositionLB.SetSelectHdl( aLink ); 1846cdf0e10cSrcweir m_aEffects2LB.SetSelectHdl( aLink ); 1847cdf0e10cSrcweir m_aReliefLB.SetSelectHdl( aLink ); 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir m_aUnderlineLB.SelectEntryPos( 0 ); 1850cdf0e10cSrcweir m_aUnderlineColorLB.SelectEntryPos( 0 ); 1851cdf0e10cSrcweir m_aOverlineLB.SelectEntryPos( 0 ); 1852cdf0e10cSrcweir m_aOverlineColorLB.SelectEntryPos( 0 ); 1853cdf0e10cSrcweir m_aStrikeoutLB.SelectEntryPos( 0 ); 1854cdf0e10cSrcweir m_aEmphasisLB.SelectEntryPos( 0 ); 1855cdf0e10cSrcweir m_aPositionLB.SelectEntryPos( 0 ); 1856cdf0e10cSrcweir SelectHdl_Impl( NULL ); 1857cdf0e10cSrcweir SelectHdl_Impl( &m_aEmphasisLB ); 1858cdf0e10cSrcweir 1859cdf0e10cSrcweir m_aEffects2LB.SelectEntryPos( 0 ); 1860cdf0e10cSrcweir 1861cdf0e10cSrcweir m_aIndividualWordsBtn.SetClickHdl( LINK( this, SvxCharEffectsPage, CbClickHdl_Impl ) ); 1862cdf0e10cSrcweir aLink = LINK( this, SvxCharEffectsPage, TristClickHdl_Impl ); 1863cdf0e10cSrcweir m_aOutlineBtn.SetClickHdl( aLink ); 1864cdf0e10cSrcweir m_aShadowBtn.SetClickHdl( aLink ); 1865cdf0e10cSrcweir 1866cdf0e10cSrcweir if ( !SvtLanguageOptions().IsAsianTypographyEnabled() ) 1867cdf0e10cSrcweir { 1868cdf0e10cSrcweir m_aAsianLine.Hide(); 1869cdf0e10cSrcweir m_aEmphasisFT.Hide(); 1870cdf0e10cSrcweir m_aEmphasisLB.Hide(); 1871cdf0e10cSrcweir m_aPositionFT.Hide(); 1872cdf0e10cSrcweir m_aPositionLB.Hide(); 1873cdf0e10cSrcweir } 1874cdf0e10cSrcweir } 1875cdf0e10cSrcweir // ----------------------------------------------------------------------- 1876cdf0e10cSrcweir 1877cdf0e10cSrcweir void SvxCharEffectsPage::UpdatePreview_Impl() 1878cdf0e10cSrcweir { 1879cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 1880cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 1881cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir sal_uInt16 nPos = m_aUnderlineLB.GetSelectEntryPos(); 1884cdf0e10cSrcweir FontUnderline eUnderline = (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData( nPos ); 1885cdf0e10cSrcweir nPos = m_aOverlineLB.GetSelectEntryPos(); 1886cdf0e10cSrcweir FontUnderline eOverline = (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData( nPos ); 1887cdf0e10cSrcweir nPos = m_aStrikeoutLB.GetSelectEntryPos(); 1888cdf0e10cSrcweir FontStrikeout eStrikeout = (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData( nPos ); 1889cdf0e10cSrcweir rFont.SetUnderline( eUnderline ); 1890cdf0e10cSrcweir rCJKFont.SetUnderline( eUnderline ); 1891cdf0e10cSrcweir rCTLFont.SetUnderline( eUnderline ); 1892cdf0e10cSrcweir m_aPreviewWin.SetTextLineColor( m_aUnderlineColorLB.GetSelectEntryColor() ); 1893cdf0e10cSrcweir rFont.SetOverline( eOverline ); 1894cdf0e10cSrcweir rCJKFont.SetOverline( eOverline ); 1895cdf0e10cSrcweir rCTLFont.SetOverline( eOverline ); 1896cdf0e10cSrcweir m_aPreviewWin.SetOverlineColor( m_aOverlineColorLB.GetSelectEntryColor() ); 1897cdf0e10cSrcweir rFont.SetStrikeout( eStrikeout ); 1898cdf0e10cSrcweir rCJKFont.SetStrikeout( eStrikeout ); 1899cdf0e10cSrcweir rCTLFont.SetStrikeout( eStrikeout ); 1900cdf0e10cSrcweir 1901cdf0e10cSrcweir nPos = m_aPositionLB.GetSelectEntryPos(); 1902cdf0e10cSrcweir sal_Bool bUnder = ( CHRDLG_POSITION_UNDER == (sal_uLong)m_aPositionLB.GetEntryData( nPos ) ); 1903cdf0e10cSrcweir FontEmphasisMark eMark = (FontEmphasisMark)m_aEmphasisLB.GetSelectEntryPos(); 1904cdf0e10cSrcweir eMark |= bUnder ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; 1905cdf0e10cSrcweir rFont.SetEmphasisMark( eMark ); 1906cdf0e10cSrcweir rCJKFont.SetEmphasisMark( eMark ); 1907cdf0e10cSrcweir rCTLFont.SetEmphasisMark( eMark ); 1908cdf0e10cSrcweir 1909cdf0e10cSrcweir sal_uInt16 nRelief = m_aReliefLB.GetSelectEntryPos(); 1910cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND != nRelief) 1911cdf0e10cSrcweir { 1912cdf0e10cSrcweir rFont.SetRelief( (FontRelief)nRelief ); 1913cdf0e10cSrcweir rCJKFont.SetRelief( (FontRelief)nRelief ); 1914cdf0e10cSrcweir rCTLFont.SetRelief( (FontRelief)nRelief ); 1915cdf0e10cSrcweir } 1916cdf0e10cSrcweir 1917cdf0e10cSrcweir rFont.SetOutline( StateToAttr( m_aOutlineBtn.GetState() ) ); 1918cdf0e10cSrcweir rCJKFont.SetOutline( rFont.IsOutline() ); 1919cdf0e10cSrcweir rCTLFont.SetOutline( rFont.IsOutline() ); 1920cdf0e10cSrcweir 1921cdf0e10cSrcweir rFont.SetShadow( StateToAttr( m_aShadowBtn.GetState() ) ); 1922cdf0e10cSrcweir rCJKFont.SetShadow( rFont.IsShadow() ); 1923cdf0e10cSrcweir rCTLFont.SetShadow( rFont.IsShadow() ); 1924cdf0e10cSrcweir 1925cdf0e10cSrcweir sal_uInt16 nCapsPos = m_aEffects2LB.GetSelectEntryPos(); 1926cdf0e10cSrcweir if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) 1927cdf0e10cSrcweir { 1928cdf0e10cSrcweir rFont.SetCaseMap( (SvxCaseMap)nCapsPos ); 1929cdf0e10cSrcweir rCJKFont.SetCaseMap( (SvxCaseMap)nCapsPos ); 1930cdf0e10cSrcweir // #i78474# small caps do not exist in CTL fonts 1931cdf0e10cSrcweir rCTLFont.SetCaseMap( static_cast<SvxCaseMap>( nCapsPos == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : (SvxCaseMap)nCapsPos) ); 1932cdf0e10cSrcweir } 1933cdf0e10cSrcweir 1934cdf0e10cSrcweir sal_Bool bWordLine = m_aIndividualWordsBtn.IsChecked(); 1935cdf0e10cSrcweir rFont.SetWordLineMode( bWordLine ); 1936cdf0e10cSrcweir rCJKFont.SetWordLineMode( bWordLine ); 1937cdf0e10cSrcweir rCTLFont.SetWordLineMode( bWordLine ); 1938cdf0e10cSrcweir 1939cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 1940cdf0e10cSrcweir } 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir // ----------------------------------------------------------------------- 1943cdf0e10cSrcweir 1944cdf0e10cSrcweir void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap ) 1945cdf0e10cSrcweir { 1946cdf0e10cSrcweir if ( SVX_CASEMAP_END > eCaseMap ) 1947cdf0e10cSrcweir m_aEffects2LB.SelectEntryPos( 1948cdf0e10cSrcweir sal::static_int_cast< sal_uInt16 >( eCaseMap ) ); 1949cdf0e10cSrcweir else 1950cdf0e10cSrcweir { 1951cdf0e10cSrcweir m_aEffects2LB.SetNoSelection(); 1952cdf0e10cSrcweir eCaseMap = SVX_CASEMAP_NOT_MAPPED; 1953cdf0e10cSrcweir } 1954cdf0e10cSrcweir 1955cdf0e10cSrcweir UpdatePreview_Impl(); 1956cdf0e10cSrcweir } 1957cdf0e10cSrcweir 1958cdf0e10cSrcweir // ----------------------------------------------------------------------- 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet ) 1961cdf0e10cSrcweir { 1962cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); 1963cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 1964cdf0e10cSrcweir 1965cdf0e10cSrcweir switch ( eState ) 1966cdf0e10cSrcweir { 1967cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 1968cdf0e10cSrcweir m_aFontColorFT.Hide(); 1969cdf0e10cSrcweir m_aFontColorLB.Hide(); 1970cdf0e10cSrcweir break; 1971cdf0e10cSrcweir 1972cdf0e10cSrcweir case SFX_ITEM_DISABLED: 1973cdf0e10cSrcweir case SFX_ITEM_READONLY: 1974cdf0e10cSrcweir m_aFontColorFT.Disable(); 1975cdf0e10cSrcweir m_aFontColorLB.Disable(); 1976cdf0e10cSrcweir break; 1977cdf0e10cSrcweir 1978cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 1979cdf0e10cSrcweir m_aFontColorLB.SetNoSelection(); 1980cdf0e10cSrcweir break; 1981cdf0e10cSrcweir 1982cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 1983cdf0e10cSrcweir case SFX_ITEM_SET: 1984cdf0e10cSrcweir { 1985cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 1986cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 1987cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 1988cdf0e10cSrcweir 1989cdf0e10cSrcweir const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); 1990cdf0e10cSrcweir Color aColor = rItem.GetValue(); 1991cdf0e10cSrcweir rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1992cdf0e10cSrcweir rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1993cdf0e10cSrcweir rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); 1994cdf0e10cSrcweir 1995cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 1996cdf0e10cSrcweir sal_uInt16 nSelPos = m_aFontColorLB.GetEntryPos( aColor ); 1997cdf0e10cSrcweir if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) 1998cdf0e10cSrcweir nSelPos = m_aFontColorLB.GetEntryPos( m_aTransparentColorName ); 1999cdf0e10cSrcweir 2000cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) 2001cdf0e10cSrcweir m_aFontColorLB.SelectEntryPos( nSelPos ); 2002cdf0e10cSrcweir else 2003cdf0e10cSrcweir { 2004cdf0e10cSrcweir nSelPos = m_aFontColorLB.GetEntryPos( aColor ); 2005cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) 2006cdf0e10cSrcweir m_aFontColorLB.SelectEntryPos( nSelPos ); 2007cdf0e10cSrcweir else 2008cdf0e10cSrcweir m_aFontColorLB.SelectEntryPos( 2009cdf0e10cSrcweir m_aFontColorLB.InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir break; 2012cdf0e10cSrcweir } 2013cdf0e10cSrcweir } 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir // ----------------------------------------------------------------------- 2017cdf0e10cSrcweir 2018cdf0e10cSrcweir sal_Bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) 2019cdf0e10cSrcweir { 2020cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); 2021cdf0e10cSrcweir const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR ); 2022cdf0e10cSrcweir const SvxColorItem* pItem = NULL; 2023cdf0e10cSrcweir sal_Bool bChanged = sal_True; 2024cdf0e10cSrcweir const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; 2025cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 2026cdf0e10cSrcweir 2027cdf0e10cSrcweir Color aSelectedColor; 2028cdf0e10cSrcweir if ( m_aFontColorLB.GetSelectEntry() == m_aTransparentColorName ) 2029cdf0e10cSrcweir aSelectedColor = Color( COL_TRANSPARENT ); 2030cdf0e10cSrcweir else 2031cdf0e10cSrcweir aSelectedColor = m_aFontColorLB.GetSelectEntryColor(); 2032cdf0e10cSrcweir 2033cdf0e10cSrcweir if ( pOld && pOld->GetValue() == aSelectedColor ) 2034cdf0e10cSrcweir bChanged = sal_False; 2035cdf0e10cSrcweir 2036cdf0e10cSrcweir if ( !bChanged ) 2037cdf0e10cSrcweir bChanged = ( m_aFontColorLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); 2038cdf0e10cSrcweir 2039cdf0e10cSrcweir if ( !bChanged && pExampleSet && 2040cdf0e10cSrcweir pExampleSet->GetItemState( nWhich, sal_False, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET && 2041cdf0e10cSrcweir ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor ) 2042cdf0e10cSrcweir bChanged = sal_True; 2043cdf0e10cSrcweir 2044cdf0e10cSrcweir sal_Bool bModified = sal_False; 2045cdf0e10cSrcweir 2046cdf0e10cSrcweir if ( bChanged && m_aFontColorLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 2047cdf0e10cSrcweir { 2048cdf0e10cSrcweir rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); 2049cdf0e10cSrcweir bModified = sal_True; 2050cdf0e10cSrcweir } 2051cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2052cdf0e10cSrcweir CLEARTITEM; 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir return bModified; 2055cdf0e10cSrcweir } 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir // ----------------------------------------------------------------------- 2058cdf0e10cSrcweir 2059cdf0e10cSrcweir IMPL_LINK( SvxCharEffectsPage, SelectHdl_Impl, ListBox*, pBox ) 2060cdf0e10cSrcweir { 2061cdf0e10cSrcweir if ( &m_aEmphasisLB == pBox ) 2062cdf0e10cSrcweir { 2063cdf0e10cSrcweir sal_uInt16 nEPos = m_aEmphasisLB.GetSelectEntryPos(); 2064cdf0e10cSrcweir sal_Bool bEnable = ( nEPos > 0 && nEPos != LISTBOX_ENTRY_NOTFOUND ); 2065cdf0e10cSrcweir m_aPositionFT.Enable( bEnable ); 2066cdf0e10cSrcweir m_aPositionLB.Enable( bEnable ); 2067cdf0e10cSrcweir } 2068cdf0e10cSrcweir else if( &m_aReliefLB == pBox) 2069cdf0e10cSrcweir { 2070cdf0e10cSrcweir sal_Bool bEnable = ( pBox->GetSelectEntryPos() == 0 ); 2071cdf0e10cSrcweir m_aOutlineBtn.Enable( bEnable ); 2072cdf0e10cSrcweir m_aShadowBtn.Enable( bEnable ); 2073cdf0e10cSrcweir } 2074cdf0e10cSrcweir else if ( &m_aPositionLB != pBox ) 2075cdf0e10cSrcweir { 2076cdf0e10cSrcweir sal_uInt16 nUPos = m_aUnderlineLB.GetSelectEntryPos(), 2077cdf0e10cSrcweir nOPos = m_aOverlineLB.GetSelectEntryPos(), 2078cdf0e10cSrcweir nSPos = m_aStrikeoutLB.GetSelectEntryPos(); 2079cdf0e10cSrcweir sal_Bool bUEnable = ( nUPos > 0 && nUPos != LISTBOX_ENTRY_NOTFOUND ); 2080cdf0e10cSrcweir sal_Bool bOEnable = ( nOPos > 0 && nOPos != LISTBOX_ENTRY_NOTFOUND ); 2081cdf0e10cSrcweir m_aUnderlineColorFT.Enable( bUEnable ); 2082cdf0e10cSrcweir m_aUnderlineColorLB.Enable( bUEnable ); 2083cdf0e10cSrcweir m_aOverlineColorFT.Enable( bOEnable ); 2084cdf0e10cSrcweir m_aOverlineColorLB.Enable( bOEnable ); 2085cdf0e10cSrcweir m_aIndividualWordsBtn.Enable( bUEnable || bOEnable || ( nSPos > 0 && nSPos != LISTBOX_ENTRY_NOTFOUND ) ); 2086cdf0e10cSrcweir } 2087cdf0e10cSrcweir UpdatePreview_Impl(); 2088cdf0e10cSrcweir return 0; 2089cdf0e10cSrcweir } 2090cdf0e10cSrcweir 2091cdf0e10cSrcweir // ----------------------------------------------------------------------- 2092cdf0e10cSrcweir 2093cdf0e10cSrcweir IMPL_LINK( SvxCharEffectsPage, UpdatePreview_Impl, ListBox*, EMPTYARG ) 2094cdf0e10cSrcweir { 2095cdf0e10cSrcweir bool bEnable = ( ( m_aUnderlineLB.GetSelectEntryPos() > 0 ) || 2096cdf0e10cSrcweir ( m_aOverlineLB.GetSelectEntryPos() > 0 ) || 2097cdf0e10cSrcweir ( m_aStrikeoutLB.GetSelectEntryPos() > 0 ) ); 2098cdf0e10cSrcweir m_aIndividualWordsBtn.Enable( bEnable ); 2099cdf0e10cSrcweir 2100cdf0e10cSrcweir UpdatePreview_Impl(); 2101cdf0e10cSrcweir return 0; 2102cdf0e10cSrcweir } 2103cdf0e10cSrcweir 2104cdf0e10cSrcweir // ----------------------------------------------------------------------- 2105cdf0e10cSrcweir 2106cdf0e10cSrcweir IMPL_LINK( SvxCharEffectsPage, CbClickHdl_Impl, CheckBox*, EMPTYARG ) 2107cdf0e10cSrcweir { 2108cdf0e10cSrcweir UpdatePreview_Impl(); 2109cdf0e10cSrcweir return 0; 2110cdf0e10cSrcweir } 2111cdf0e10cSrcweir 2112cdf0e10cSrcweir // ----------------------------------------------------------------------- 2113cdf0e10cSrcweir 2114cdf0e10cSrcweir IMPL_LINK( SvxCharEffectsPage, TristClickHdl_Impl, TriStateBox*, EMPTYARG ) 2115cdf0e10cSrcweir { 2116cdf0e10cSrcweir UpdatePreview_Impl(); 2117cdf0e10cSrcweir return 0; 2118cdf0e10cSrcweir } 2119cdf0e10cSrcweir 2120cdf0e10cSrcweir // ----------------------------------------------------------------------- 2121cdf0e10cSrcweir 2122cdf0e10cSrcweir IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) 2123cdf0e10cSrcweir { 2124cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 2125cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 2126cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 2127cdf0e10cSrcweir 2128cdf0e10cSrcweir Color aSelectedColor; 2129cdf0e10cSrcweir if ( pBox->GetSelectEntry() == m_aTransparentColorName ) 2130cdf0e10cSrcweir aSelectedColor = Color( COL_TRANSPARENT ); 2131cdf0e10cSrcweir else 2132cdf0e10cSrcweir aSelectedColor = pBox->GetSelectEntryColor(); 2133cdf0e10cSrcweir rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 2134cdf0e10cSrcweir rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 2135cdf0e10cSrcweir rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); 2136cdf0e10cSrcweir 2137cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 2138cdf0e10cSrcweir return 0; 2139cdf0e10cSrcweir } 2140cdf0e10cSrcweir // ----------------------------------------------------------------------- 2141cdf0e10cSrcweir 2142cdf0e10cSrcweir int SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) 2143cdf0e10cSrcweir { 2144cdf0e10cSrcweir if ( _pSet ) 2145cdf0e10cSrcweir FillItemSet( *_pSet ); 2146cdf0e10cSrcweir return LEAVE_PAGE; 2147cdf0e10cSrcweir } 2148cdf0e10cSrcweir 2149cdf0e10cSrcweir // ----------------------------------------------------------------------- 2150cdf0e10cSrcweir 2151cdf0e10cSrcweir SfxTabPage* SvxCharEffectsPage::Create( Window* pParent, const SfxItemSet& rSet ) 2152cdf0e10cSrcweir { 2153cdf0e10cSrcweir return new SvxCharEffectsPage( pParent, rSet ); 2154cdf0e10cSrcweir } 2155cdf0e10cSrcweir 2156cdf0e10cSrcweir // ----------------------------------------------------------------------- 2157cdf0e10cSrcweir 2158cdf0e10cSrcweir sal_uInt16* SvxCharEffectsPage::GetRanges() 2159cdf0e10cSrcweir { 2160cdf0e10cSrcweir return pEffectsRanges; 2161cdf0e10cSrcweir } 2162cdf0e10cSrcweir 2163cdf0e10cSrcweir // ----------------------------------------------------------------------- 2164cdf0e10cSrcweir 2165cdf0e10cSrcweir void SvxCharEffectsPage::Reset( const SfxItemSet& rSet ) 2166cdf0e10cSrcweir { 2167cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 2168cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 2169cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 2170cdf0e10cSrcweir 2171cdf0e10cSrcweir sal_Bool bEnable = sal_False; 2172cdf0e10cSrcweir 2173cdf0e10cSrcweir // Underline 2174cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); 2175cdf0e10cSrcweir rFont.SetUnderline( UNDERLINE_NONE ); 2176cdf0e10cSrcweir rCJKFont.SetUnderline( UNDERLINE_NONE ); 2177cdf0e10cSrcweir rCTLFont.SetUnderline( UNDERLINE_NONE ); 2178cdf0e10cSrcweir 2179cdf0e10cSrcweir m_aUnderlineLB.SelectEntryPos( 0 ); 2180cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 2181cdf0e10cSrcweir 2182cdf0e10cSrcweir if ( eState >= SFX_ITEM_DONTCARE ) 2183cdf0e10cSrcweir { 2184cdf0e10cSrcweir if ( eState == SFX_ITEM_DONTCARE ) 2185cdf0e10cSrcweir m_aUnderlineLB.SetNoSelection(); 2186cdf0e10cSrcweir else 2187cdf0e10cSrcweir { 2188cdf0e10cSrcweir const SvxUnderlineItem& rItem = (SvxUnderlineItem&)rSet.Get( nWhich ); 2189cdf0e10cSrcweir FontUnderline eUnderline = (FontUnderline)rItem.GetValue(); 2190cdf0e10cSrcweir rFont.SetUnderline( eUnderline ); 2191cdf0e10cSrcweir rCJKFont.SetUnderline( eUnderline ); 2192cdf0e10cSrcweir rCTLFont.SetUnderline( eUnderline ); 2193cdf0e10cSrcweir 2194cdf0e10cSrcweir if ( eUnderline != UNDERLINE_NONE ) 2195cdf0e10cSrcweir { 2196cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < m_aUnderlineLB.GetEntryCount(); ++i ) 2197cdf0e10cSrcweir { 2198cdf0e10cSrcweir if ( (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData(i) == eUnderline ) 2199cdf0e10cSrcweir { 2200cdf0e10cSrcweir m_aUnderlineLB.SelectEntryPos(i); 2201cdf0e10cSrcweir bEnable |= sal_True; 2202cdf0e10cSrcweir break; 2203cdf0e10cSrcweir } 2204cdf0e10cSrcweir } 2205cdf0e10cSrcweir 2206cdf0e10cSrcweir Color aColor = rItem.GetColor(); 2207cdf0e10cSrcweir sal_uInt16 nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); 2208cdf0e10cSrcweir 2209cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nPos ) 2210cdf0e10cSrcweir m_aUnderlineColorLB.SelectEntryPos( nPos ); 2211cdf0e10cSrcweir else 2212cdf0e10cSrcweir { 2213cdf0e10cSrcweir nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); 2214cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nPos ) 2215cdf0e10cSrcweir m_aUnderlineColorLB.SelectEntryPos( nPos ); 2216cdf0e10cSrcweir else 2217cdf0e10cSrcweir m_aUnderlineColorLB.SelectEntryPos( 2218cdf0e10cSrcweir m_aUnderlineColorLB.InsertEntry( aColor, 2219cdf0e10cSrcweir String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); 2220cdf0e10cSrcweir } 2221cdf0e10cSrcweir } 2222cdf0e10cSrcweir else 2223cdf0e10cSrcweir { 2224cdf0e10cSrcweir m_aUnderlineColorLB.SelectEntry( Color( COL_AUTO )); 2225cdf0e10cSrcweir m_aUnderlineColorLB.Disable(); 2226cdf0e10cSrcweir } 2227cdf0e10cSrcweir } 2228cdf0e10cSrcweir } 2229cdf0e10cSrcweir 2230cdf0e10cSrcweir // Overline 2231cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); 2232cdf0e10cSrcweir rFont.SetOverline( UNDERLINE_NONE ); 2233cdf0e10cSrcweir rCJKFont.SetOverline( UNDERLINE_NONE ); 2234cdf0e10cSrcweir rCTLFont.SetOverline( UNDERLINE_NONE ); 2235cdf0e10cSrcweir 2236cdf0e10cSrcweir m_aOverlineLB.SelectEntryPos( 0 ); 2237cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2238cdf0e10cSrcweir 2239cdf0e10cSrcweir if ( eState >= SFX_ITEM_DONTCARE ) 2240cdf0e10cSrcweir { 2241cdf0e10cSrcweir if ( eState == SFX_ITEM_DONTCARE ) 2242cdf0e10cSrcweir m_aOverlineLB.SetNoSelection(); 2243cdf0e10cSrcweir else 2244cdf0e10cSrcweir { 2245cdf0e10cSrcweir const SvxOverlineItem& rItem = (SvxOverlineItem&)rSet.Get( nWhich ); 2246cdf0e10cSrcweir FontUnderline eOverline = (FontUnderline)rItem.GetValue(); 2247cdf0e10cSrcweir rFont.SetOverline( eOverline ); 2248cdf0e10cSrcweir rCJKFont.SetOverline( eOverline ); 2249cdf0e10cSrcweir rCTLFont.SetOverline( eOverline ); 2250cdf0e10cSrcweir 2251cdf0e10cSrcweir if ( eOverline != UNDERLINE_NONE ) 2252cdf0e10cSrcweir { 2253cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < m_aOverlineLB.GetEntryCount(); ++i ) 2254cdf0e10cSrcweir { 2255cdf0e10cSrcweir if ( (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData(i) == eOverline ) 2256cdf0e10cSrcweir { 2257cdf0e10cSrcweir m_aOverlineLB.SelectEntryPos(i); 2258cdf0e10cSrcweir bEnable |= sal_True; 2259cdf0e10cSrcweir break; 2260cdf0e10cSrcweir } 2261cdf0e10cSrcweir } 2262cdf0e10cSrcweir 2263cdf0e10cSrcweir Color aColor = rItem.GetColor(); 2264cdf0e10cSrcweir sal_uInt16 nPos = m_aOverlineColorLB.GetEntryPos( aColor ); 2265cdf0e10cSrcweir 2266cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nPos ) 2267cdf0e10cSrcweir m_aOverlineColorLB.SelectEntryPos( nPos ); 2268cdf0e10cSrcweir else 2269cdf0e10cSrcweir { 2270cdf0e10cSrcweir nPos = m_aOverlineColorLB.GetEntryPos( aColor ); 2271cdf0e10cSrcweir if ( LISTBOX_ENTRY_NOTFOUND != nPos ) 2272cdf0e10cSrcweir m_aOverlineColorLB.SelectEntryPos( nPos ); 2273cdf0e10cSrcweir else 2274cdf0e10cSrcweir m_aOverlineColorLB.SelectEntryPos( 2275cdf0e10cSrcweir m_aOverlineColorLB.InsertEntry( aColor, 2276cdf0e10cSrcweir String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); 2277cdf0e10cSrcweir } 2278cdf0e10cSrcweir } 2279cdf0e10cSrcweir else 2280cdf0e10cSrcweir { 2281cdf0e10cSrcweir m_aOverlineColorLB.SelectEntry( Color( COL_AUTO )); 2282cdf0e10cSrcweir m_aOverlineColorLB.Disable(); 2283cdf0e10cSrcweir } 2284cdf0e10cSrcweir } 2285cdf0e10cSrcweir } 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir // Strikeout 2288cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); 2289cdf0e10cSrcweir rFont.SetStrikeout( STRIKEOUT_NONE ); 2290cdf0e10cSrcweir rCJKFont.SetStrikeout( STRIKEOUT_NONE ); 2291cdf0e10cSrcweir rCTLFont.SetStrikeout( STRIKEOUT_NONE ); 2292cdf0e10cSrcweir 2293cdf0e10cSrcweir m_aStrikeoutLB.SelectEntryPos( 0 ); 2294cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2295cdf0e10cSrcweir 2296cdf0e10cSrcweir if ( eState >= SFX_ITEM_DONTCARE ) 2297cdf0e10cSrcweir { 2298cdf0e10cSrcweir if ( eState == SFX_ITEM_DONTCARE ) 2299cdf0e10cSrcweir m_aStrikeoutLB.SetNoSelection(); 2300cdf0e10cSrcweir else 2301cdf0e10cSrcweir { 2302cdf0e10cSrcweir const SvxCrossedOutItem& rItem = (SvxCrossedOutItem&)rSet.Get( nWhich ); 2303cdf0e10cSrcweir FontStrikeout eStrikeout = (FontStrikeout)rItem.GetValue(); 2304cdf0e10cSrcweir rFont.SetStrikeout( eStrikeout ); 2305cdf0e10cSrcweir rCJKFont.SetStrikeout( eStrikeout ); 2306cdf0e10cSrcweir rCTLFont.SetStrikeout( eStrikeout ); 2307cdf0e10cSrcweir 2308cdf0e10cSrcweir if ( eStrikeout != STRIKEOUT_NONE ) 2309cdf0e10cSrcweir { 2310cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < m_aStrikeoutLB.GetEntryCount(); ++i ) 2311cdf0e10cSrcweir { 2312cdf0e10cSrcweir if ( (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData(i) == eStrikeout ) 2313cdf0e10cSrcweir { 2314cdf0e10cSrcweir m_aStrikeoutLB.SelectEntryPos(i); 2315cdf0e10cSrcweir bEnable |= sal_True; 2316cdf0e10cSrcweir break; 2317cdf0e10cSrcweir } 2318cdf0e10cSrcweir } 2319cdf0e10cSrcweir } 2320cdf0e10cSrcweir } 2321cdf0e10cSrcweir } 2322cdf0e10cSrcweir 2323cdf0e10cSrcweir // WordLineMode 2324cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); 2325cdf0e10cSrcweir switch ( eState ) 2326cdf0e10cSrcweir { 2327cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2328cdf0e10cSrcweir m_aIndividualWordsBtn.Hide(); 2329cdf0e10cSrcweir break; 2330cdf0e10cSrcweir 2331cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2332cdf0e10cSrcweir case SFX_ITEM_READONLY: 2333cdf0e10cSrcweir m_aIndividualWordsBtn.Disable(); 2334cdf0e10cSrcweir break; 2335cdf0e10cSrcweir 2336cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2337cdf0e10cSrcweir m_aIndividualWordsBtn.SetState( STATE_DONTKNOW ); 2338cdf0e10cSrcweir break; 2339cdf0e10cSrcweir 2340cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2341cdf0e10cSrcweir case SFX_ITEM_SET: 2342cdf0e10cSrcweir { 2343cdf0e10cSrcweir const SvxWordLineModeItem& rItem = (SvxWordLineModeItem&)rSet.Get( nWhich ); 2344cdf0e10cSrcweir rFont.SetWordLineMode( rItem.GetValue() ); 2345cdf0e10cSrcweir rCJKFont.SetWordLineMode( rItem.GetValue() ); 2346cdf0e10cSrcweir rCTLFont.SetWordLineMode( rItem.GetValue() ); 2347cdf0e10cSrcweir 2348cdf0e10cSrcweir m_aIndividualWordsBtn.Check( rItem.GetValue() ); 2349cdf0e10cSrcweir m_aIndividualWordsBtn.Enable( bEnable ); 2350cdf0e10cSrcweir break; 2351cdf0e10cSrcweir } 2352cdf0e10cSrcweir } 2353cdf0e10cSrcweir 2354cdf0e10cSrcweir // Emphasis 2355cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); 2356cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2357cdf0e10cSrcweir 2358cdf0e10cSrcweir if ( eState >= SFX_ITEM_DEFAULT ) 2359cdf0e10cSrcweir { 2360cdf0e10cSrcweir const SvxEmphasisMarkItem& rItem = (SvxEmphasisMarkItem&)rSet.Get( nWhich ); 2361cdf0e10cSrcweir FontEmphasisMark eMark = rItem.GetEmphasisMark(); 2362cdf0e10cSrcweir rFont.SetEmphasisMark( eMark ); 2363cdf0e10cSrcweir rCJKFont.SetEmphasisMark( eMark ); 2364cdf0e10cSrcweir rCTLFont.SetEmphasisMark( eMark ); 2365cdf0e10cSrcweir 2366cdf0e10cSrcweir m_aEmphasisLB.SelectEntryPos( (sal_uInt16)( eMark & EMPHASISMARK_STYLE ) ); 2367cdf0e10cSrcweir eMark &= ~EMPHASISMARK_STYLE; 2368cdf0e10cSrcweir sal_uLong nEntryData = ( eMark == EMPHASISMARK_POS_ABOVE ) 2369cdf0e10cSrcweir ? CHRDLG_POSITION_OVER 2370cdf0e10cSrcweir : ( eMark == EMPHASISMARK_POS_BELOW ) ? CHRDLG_POSITION_UNDER : 0; 2371cdf0e10cSrcweir 2372cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < m_aPositionLB.GetEntryCount(); i++ ) 2373cdf0e10cSrcweir { 2374cdf0e10cSrcweir if ( nEntryData == (sal_uLong)m_aPositionLB.GetEntryData(i) ) 2375cdf0e10cSrcweir { 2376cdf0e10cSrcweir m_aPositionLB.SelectEntryPos(i); 2377cdf0e10cSrcweir break; 2378cdf0e10cSrcweir } 2379cdf0e10cSrcweir } 2380cdf0e10cSrcweir } 2381cdf0e10cSrcweir else if ( eState == SFX_ITEM_DONTCARE ) 2382cdf0e10cSrcweir m_aEmphasisLB.SetNoSelection( ); 2383cdf0e10cSrcweir else if ( eState == SFX_ITEM_UNKNOWN ) 2384cdf0e10cSrcweir { 2385cdf0e10cSrcweir m_aEmphasisFT.Hide(); 2386cdf0e10cSrcweir m_aEmphasisLB.Hide(); 2387cdf0e10cSrcweir } 2388cdf0e10cSrcweir else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY 2389cdf0e10cSrcweir { 2390cdf0e10cSrcweir m_aEmphasisFT.Disable(); 2391cdf0e10cSrcweir m_aEmphasisLB.Disable(); 2392cdf0e10cSrcweir } 2393cdf0e10cSrcweir 2394cdf0e10cSrcweir // the select handler for the underline/overline/strikeout list boxes 2395cdf0e10cSrcweir // SelectHdl_Impl( NULL ); 2396cdf0e10cSrcweir DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aOverlineLB.GetSelectHdl(), 2397cdf0e10cSrcweir "SvxCharEffectsPage::Reset: inconsistence (1)!"); 2398cdf0e10cSrcweir DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aStrikeoutLB.GetSelectHdl(), 2399cdf0e10cSrcweir "SvxCharEffectsPage::Reset: inconsistence (1)!"); 2400cdf0e10cSrcweir m_aUnderlineLB.GetSelectHdl().Call(NULL); 2401cdf0e10cSrcweir // don't call SelectHdl_Impl directly! 2402cdf0e10cSrcweir // in DisableControls, we may have re-reouted the select handler 2403cdf0e10cSrcweir // 30.05.2001 - 86262 - frank.schoenheit@germany.sun.com 2404cdf0e10cSrcweir 2405cdf0e10cSrcweir // the select handler for the emphasis listbox 2406cdf0e10cSrcweir // SelectHdl_Impl( &m_aEmphasisLB ); 2407cdf0e10cSrcweir DBG_ASSERT(m_aEmphasisLB.GetSelectHdl() == LINK(this, SvxCharEffectsPage, SelectHdl_Impl), 2408cdf0e10cSrcweir "SvxCharEffectsPage::Reset: inconsistence (2)!"); 2409cdf0e10cSrcweir m_aEmphasisLB.GetSelectHdl().Call( &m_aEmphasisLB ); 2410cdf0e10cSrcweir // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ... 2411cdf0e10cSrcweir 2412cdf0e10cSrcweir // Effects 2413cdf0e10cSrcweir SvxCaseMap eCaseMap = SVX_CASEMAP_END; 2414cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); 2415cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2416cdf0e10cSrcweir switch ( eState ) 2417cdf0e10cSrcweir { 2418cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2419cdf0e10cSrcweir m_aEffectsFT.Hide(); 2420cdf0e10cSrcweir m_aEffects2LB.Hide(); 2421cdf0e10cSrcweir break; 2422cdf0e10cSrcweir 2423cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2424cdf0e10cSrcweir case SFX_ITEM_READONLY: 2425cdf0e10cSrcweir m_aEffectsFT.Disable(); 2426cdf0e10cSrcweir m_aEffects2LB.Disable(); 2427cdf0e10cSrcweir break; 2428cdf0e10cSrcweir 2429cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2430cdf0e10cSrcweir m_aEffects2LB.SetNoSelection(); 2431cdf0e10cSrcweir break; 2432cdf0e10cSrcweir 2433cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2434cdf0e10cSrcweir case SFX_ITEM_SET: 2435cdf0e10cSrcweir { 2436cdf0e10cSrcweir const SvxCaseMapItem& rItem = (const SvxCaseMapItem&)rSet.Get( nWhich ); 2437cdf0e10cSrcweir eCaseMap = (SvxCaseMap)rItem.GetValue(); 2438cdf0e10cSrcweir break; 2439cdf0e10cSrcweir } 2440cdf0e10cSrcweir } 2441cdf0e10cSrcweir SetCaseMap_Impl( eCaseMap ); 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir //Relief 2444cdf0e10cSrcweir nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); 2445cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2446cdf0e10cSrcweir switch ( eState ) 2447cdf0e10cSrcweir { 2448cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2449cdf0e10cSrcweir m_aReliefFT.Hide(); 2450cdf0e10cSrcweir m_aReliefLB.Hide(); 2451cdf0e10cSrcweir break; 2452cdf0e10cSrcweir 2453cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2454cdf0e10cSrcweir case SFX_ITEM_READONLY: 2455cdf0e10cSrcweir m_aReliefFT.Disable(); 2456cdf0e10cSrcweir m_aReliefLB.Disable(); 2457cdf0e10cSrcweir break; 2458cdf0e10cSrcweir 2459cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2460cdf0e10cSrcweir m_aReliefLB.SetNoSelection(); 2461cdf0e10cSrcweir break; 2462cdf0e10cSrcweir 2463cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2464cdf0e10cSrcweir case SFX_ITEM_SET: 2465cdf0e10cSrcweir { 2466cdf0e10cSrcweir const SvxCharReliefItem& rItem = (const SvxCharReliefItem&)rSet.Get( nWhich ); 2467cdf0e10cSrcweir m_aReliefLB.SelectEntryPos(rItem.GetValue()); 2468cdf0e10cSrcweir SelectHdl_Impl(&m_aReliefLB); 2469cdf0e10cSrcweir break; 2470cdf0e10cSrcweir } 2471cdf0e10cSrcweir } 2472cdf0e10cSrcweir 2473cdf0e10cSrcweir // Outline 2474cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); 2475cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2476cdf0e10cSrcweir switch ( eState ) 2477cdf0e10cSrcweir { 2478cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2479cdf0e10cSrcweir m_aOutlineBtn.Hide(); 2480cdf0e10cSrcweir break; 2481cdf0e10cSrcweir 2482cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2483cdf0e10cSrcweir case SFX_ITEM_READONLY: 2484cdf0e10cSrcweir m_aOutlineBtn.Disable(); 2485cdf0e10cSrcweir break; 2486cdf0e10cSrcweir 2487cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2488cdf0e10cSrcweir m_aOutlineBtn.SetState( STATE_DONTKNOW ); 2489cdf0e10cSrcweir break; 2490cdf0e10cSrcweir 2491cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2492cdf0e10cSrcweir case SFX_ITEM_SET: 2493cdf0e10cSrcweir { 2494cdf0e10cSrcweir const SvxContourItem& rItem = (SvxContourItem&)rSet.Get( nWhich ); 2495cdf0e10cSrcweir m_aOutlineBtn.SetState( (TriState)rItem.GetValue() ); 2496cdf0e10cSrcweir m_aOutlineBtn.EnableTriState( sal_False ); 2497cdf0e10cSrcweir break; 2498cdf0e10cSrcweir } 2499cdf0e10cSrcweir } 2500cdf0e10cSrcweir 2501cdf0e10cSrcweir // Shadow 2502cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); 2503cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2504cdf0e10cSrcweir 2505cdf0e10cSrcweir switch ( eState ) 2506cdf0e10cSrcweir { 2507cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2508cdf0e10cSrcweir m_aShadowBtn.Hide(); 2509cdf0e10cSrcweir break; 2510cdf0e10cSrcweir 2511cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2512cdf0e10cSrcweir case SFX_ITEM_READONLY: 2513cdf0e10cSrcweir m_aShadowBtn.Disable(); 2514cdf0e10cSrcweir break; 2515cdf0e10cSrcweir 2516cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2517cdf0e10cSrcweir m_aShadowBtn.SetState( STATE_DONTKNOW ); 2518cdf0e10cSrcweir break; 2519cdf0e10cSrcweir 2520cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2521cdf0e10cSrcweir case SFX_ITEM_SET: 2522cdf0e10cSrcweir { 2523cdf0e10cSrcweir const SvxShadowedItem& rItem = (SvxShadowedItem&)rSet.Get( nWhich ); 2524cdf0e10cSrcweir m_aShadowBtn.SetState( (TriState)rItem.GetValue() ); 2525cdf0e10cSrcweir m_aShadowBtn.EnableTriState( sal_False ); 2526cdf0e10cSrcweir break; 2527cdf0e10cSrcweir } 2528cdf0e10cSrcweir } 2529cdf0e10cSrcweir 2530cdf0e10cSrcweir // Blinking 2531cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_FLASH ); 2532cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2533cdf0e10cSrcweir 2534cdf0e10cSrcweir switch ( eState ) 2535cdf0e10cSrcweir { 2536cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2537cdf0e10cSrcweir m_aBlinkingBtn.Hide(); 2538cdf0e10cSrcweir break; 2539cdf0e10cSrcweir 2540cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2541cdf0e10cSrcweir case SFX_ITEM_READONLY: 2542cdf0e10cSrcweir m_aBlinkingBtn.Disable(); 2543cdf0e10cSrcweir break; 2544cdf0e10cSrcweir 2545cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2546cdf0e10cSrcweir m_aBlinkingBtn.SetState( STATE_DONTKNOW ); 2547cdf0e10cSrcweir break; 2548cdf0e10cSrcweir 2549cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2550cdf0e10cSrcweir case SFX_ITEM_SET: 2551cdf0e10cSrcweir { 2552cdf0e10cSrcweir const SvxBlinkItem& rItem = (SvxBlinkItem&)rSet.Get( nWhich ); 2553cdf0e10cSrcweir m_aBlinkingBtn.SetState( (TriState)rItem.GetValue() ); 2554cdf0e10cSrcweir m_aBlinkingBtn.EnableTriState( sal_False ); 2555cdf0e10cSrcweir break; 2556cdf0e10cSrcweir } 2557cdf0e10cSrcweir } 2558cdf0e10cSrcweir // Hidden 2559cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); 2560cdf0e10cSrcweir eState = rSet.GetItemState( nWhich ); 2561cdf0e10cSrcweir 2562cdf0e10cSrcweir switch ( eState ) 2563cdf0e10cSrcweir { 2564cdf0e10cSrcweir case SFX_ITEM_UNKNOWN: 2565cdf0e10cSrcweir m_aHiddenBtn.Hide(); 2566cdf0e10cSrcweir break; 2567cdf0e10cSrcweir 2568cdf0e10cSrcweir case SFX_ITEM_DISABLED: 2569cdf0e10cSrcweir case SFX_ITEM_READONLY: 2570cdf0e10cSrcweir m_aHiddenBtn.Disable(); 2571cdf0e10cSrcweir break; 2572cdf0e10cSrcweir 2573cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2574cdf0e10cSrcweir m_aHiddenBtn.SetState( STATE_DONTKNOW ); 2575cdf0e10cSrcweir break; 2576cdf0e10cSrcweir 2577cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 2578cdf0e10cSrcweir case SFX_ITEM_SET: 2579cdf0e10cSrcweir { 2580cdf0e10cSrcweir const SvxCharHiddenItem& rItem = (SvxCharHiddenItem&)rSet.Get( nWhich ); 2581cdf0e10cSrcweir m_aHiddenBtn.SetState( (TriState)rItem.GetValue() ); 2582cdf0e10cSrcweir m_aHiddenBtn.EnableTriState( sal_False ); 2583cdf0e10cSrcweir break; 2584cdf0e10cSrcweir } 2585cdf0e10cSrcweir } 2586cdf0e10cSrcweir 2587cdf0e10cSrcweir SetPrevFontWidthScale( rSet ); 2588cdf0e10cSrcweir ResetColor_Impl( rSet ); 2589cdf0e10cSrcweir 2590cdf0e10cSrcweir // preview update 2591cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 2592cdf0e10cSrcweir 2593cdf0e10cSrcweir // save this settings 2594cdf0e10cSrcweir m_aUnderlineLB.SaveValue(); 2595cdf0e10cSrcweir m_aUnderlineColorLB.SaveValue(); 2596cdf0e10cSrcweir m_aOverlineLB.SaveValue(); 2597cdf0e10cSrcweir m_aOverlineColorLB.SaveValue(); 2598cdf0e10cSrcweir m_aStrikeoutLB.SaveValue(); 2599cdf0e10cSrcweir m_aIndividualWordsBtn.SaveValue(); 2600cdf0e10cSrcweir m_aEmphasisLB.SaveValue(); 2601cdf0e10cSrcweir m_aPositionLB.SaveValue(); 2602cdf0e10cSrcweir m_aEffects2LB.SaveValue(); 2603cdf0e10cSrcweir m_aReliefLB.SaveValue(); 2604cdf0e10cSrcweir m_aOutlineBtn.SaveValue(); 2605cdf0e10cSrcweir m_aShadowBtn.SaveValue(); 2606cdf0e10cSrcweir m_aBlinkingBtn.SaveValue(); 2607cdf0e10cSrcweir m_aHiddenBtn.SaveValue(); 2608cdf0e10cSrcweir m_aFontColorLB.SaveValue(); 2609cdf0e10cSrcweir } 2610cdf0e10cSrcweir 2611cdf0e10cSrcweir // ----------------------------------------------------------------------- 2612cdf0e10cSrcweir 2613cdf0e10cSrcweir sal_Bool SvxCharEffectsPage::FillItemSet( SfxItemSet& rSet ) 2614cdf0e10cSrcweir { 2615cdf0e10cSrcweir const SfxPoolItem* pOld = 0; 2616cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 2617cdf0e10cSrcweir sal_Bool bModified = sal_False; 2618cdf0e10cSrcweir FASTBOOL bChanged = sal_True; 2619cdf0e10cSrcweir 2620cdf0e10cSrcweir // Underline 2621cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); 2622cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_UNDERLINE ); 2623cdf0e10cSrcweir sal_uInt16 nPos = m_aUnderlineLB.GetSelectEntryPos(); 2624cdf0e10cSrcweir FontUnderline eUnder = (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData( nPos ); 2625cdf0e10cSrcweir 2626cdf0e10cSrcweir if ( pOld ) 2627cdf0e10cSrcweir { 2628cdf0e10cSrcweir //! if there are different underline styles in the selection the 2629cdf0e10cSrcweir //! item-state in the 'rOldSet' will be invalid. In this case 2630cdf0e10cSrcweir //! changing the underline style will be allowed if a style is 2631cdf0e10cSrcweir //! selected in the listbox. 2632cdf0e10cSrcweir sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && 2633cdf0e10cSrcweir SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); 2634cdf0e10cSrcweir 2635cdf0e10cSrcweir const SvxUnderlineItem& rItem = *( (const SvxUnderlineItem*)pOld ); 2636cdf0e10cSrcweir if ( (FontUnderline)rItem.GetValue() == eUnder && 2637cdf0e10cSrcweir ( UNDERLINE_NONE == eUnder || rItem.GetColor() == m_aUnderlineColorLB.GetSelectEntryColor() ) && 2638cdf0e10cSrcweir ! bAllowChg ) 2639cdf0e10cSrcweir bChanged = sal_False; 2640cdf0e10cSrcweir } 2641cdf0e10cSrcweir 2642cdf0e10cSrcweir if ( bChanged ) 2643cdf0e10cSrcweir { 2644cdf0e10cSrcweir SvxUnderlineItem aNewItem( eUnder, nWhich ); 2645cdf0e10cSrcweir aNewItem.SetColor( m_aUnderlineColorLB.GetSelectEntryColor() ); 2646cdf0e10cSrcweir rSet.Put( aNewItem ); 2647cdf0e10cSrcweir bModified |= sal_True; 2648cdf0e10cSrcweir } 2649cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2650cdf0e10cSrcweir CLEARTITEM; 2651cdf0e10cSrcweir 2652cdf0e10cSrcweir bChanged = sal_True; 2653cdf0e10cSrcweir 2654cdf0e10cSrcweir // Overline 2655cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); 2656cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_OVERLINE ); 2657cdf0e10cSrcweir nPos = m_aOverlineLB.GetSelectEntryPos(); 2658cdf0e10cSrcweir FontUnderline eOver = (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData( nPos ); 2659cdf0e10cSrcweir 2660cdf0e10cSrcweir if ( pOld ) 2661cdf0e10cSrcweir { 2662cdf0e10cSrcweir //! if there are different underline styles in the selection the 2663cdf0e10cSrcweir //! item-state in the 'rOldSet' will be invalid. In this case 2664cdf0e10cSrcweir //! changing the underline style will be allowed if a style is 2665cdf0e10cSrcweir //! selected in the listbox. 2666cdf0e10cSrcweir sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && 2667cdf0e10cSrcweir SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); 2668cdf0e10cSrcweir 2669cdf0e10cSrcweir const SvxOverlineItem& rItem = *( (const SvxOverlineItem*)pOld ); 2670cdf0e10cSrcweir if ( (FontUnderline)rItem.GetValue() == eOver && 2671cdf0e10cSrcweir ( UNDERLINE_NONE == eOver || rItem.GetColor() == m_aOverlineColorLB.GetSelectEntryColor() ) && 2672cdf0e10cSrcweir ! bAllowChg ) 2673cdf0e10cSrcweir bChanged = sal_False; 2674cdf0e10cSrcweir } 2675cdf0e10cSrcweir 2676cdf0e10cSrcweir if ( bChanged ) 2677cdf0e10cSrcweir { 2678cdf0e10cSrcweir SvxOverlineItem aNewItem( eOver, nWhich ); 2679cdf0e10cSrcweir aNewItem.SetColor( m_aOverlineColorLB.GetSelectEntryColor() ); 2680cdf0e10cSrcweir rSet.Put( aNewItem ); 2681cdf0e10cSrcweir bModified |= sal_True; 2682cdf0e10cSrcweir } 2683cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2684cdf0e10cSrcweir CLEARTITEM; 2685cdf0e10cSrcweir 2686cdf0e10cSrcweir bChanged = sal_True; 2687cdf0e10cSrcweir 2688cdf0e10cSrcweir // Strikeout 2689cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); 2690cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_STRIKEOUT ); 2691cdf0e10cSrcweir nPos = m_aStrikeoutLB.GetSelectEntryPos(); 2692cdf0e10cSrcweir FontStrikeout eStrike = (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData( nPos ); 2693cdf0e10cSrcweir 2694cdf0e10cSrcweir if ( pOld ) 2695cdf0e10cSrcweir { 2696cdf0e10cSrcweir //! if there are different strikeout styles in the selection the 2697cdf0e10cSrcweir //! item-state in the 'rOldSet' will be invalid. In this case 2698cdf0e10cSrcweir //! changing the strikeout style will be allowed if a style is 2699cdf0e10cSrcweir //! selected in the listbox. 2700cdf0e10cSrcweir sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && 2701cdf0e10cSrcweir SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); 2702cdf0e10cSrcweir 2703cdf0e10cSrcweir const SvxCrossedOutItem& rItem = *( (const SvxCrossedOutItem*)pOld ); 2704cdf0e10cSrcweir if ( !m_aStrikeoutLB.IsEnabled() 2705cdf0e10cSrcweir || ((FontStrikeout)rItem.GetValue() == eStrike && !bAllowChg) ) 2706cdf0e10cSrcweir bChanged = sal_False; 2707cdf0e10cSrcweir } 2708cdf0e10cSrcweir 2709cdf0e10cSrcweir if ( bChanged ) 2710cdf0e10cSrcweir { 2711cdf0e10cSrcweir rSet.Put( SvxCrossedOutItem( eStrike, nWhich ) ); 2712cdf0e10cSrcweir bModified |= sal_True; 2713cdf0e10cSrcweir } 2714cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2715cdf0e10cSrcweir CLEARTITEM; 2716cdf0e10cSrcweir 2717cdf0e10cSrcweir bChanged = sal_True; 2718cdf0e10cSrcweir 2719cdf0e10cSrcweir // Individual words 2720cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); 2721cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_WORDLINEMODE ); 2722cdf0e10cSrcweir 2723cdf0e10cSrcweir if ( pOld ) 2724cdf0e10cSrcweir { 2725cdf0e10cSrcweir const SvxWordLineModeItem& rItem = *( (const SvxWordLineModeItem*)pOld ); 2726cdf0e10cSrcweir if ( rItem.GetValue() == m_aIndividualWordsBtn.IsChecked() ) 2727cdf0e10cSrcweir bChanged = sal_False; 2728cdf0e10cSrcweir } 2729cdf0e10cSrcweir 2730cdf0e10cSrcweir if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && 2731cdf0e10cSrcweir m_aIndividualWordsBtn.IsChecked() == m_aIndividualWordsBtn.GetSavedValue() ) 2732cdf0e10cSrcweir bChanged = sal_False; 2733cdf0e10cSrcweir 2734cdf0e10cSrcweir if ( bChanged ) 2735cdf0e10cSrcweir { 2736cdf0e10cSrcweir rSet.Put( SvxWordLineModeItem( m_aIndividualWordsBtn.IsChecked(), nWhich ) ); 2737cdf0e10cSrcweir bModified |= sal_True; 2738cdf0e10cSrcweir } 2739cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2740cdf0e10cSrcweir CLEARTITEM; 2741cdf0e10cSrcweir 2742cdf0e10cSrcweir bChanged = sal_True; 2743cdf0e10cSrcweir 2744cdf0e10cSrcweir // Emphasis 2745cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); 2746cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_EMPHASISMARK ); 2747cdf0e10cSrcweir sal_uInt16 nMarkPos = m_aEmphasisLB.GetSelectEntryPos(); 2748cdf0e10cSrcweir sal_uInt16 nPosPos = m_aPositionLB.GetSelectEntryPos(); 2749cdf0e10cSrcweir FontEmphasisMark eMark = (FontEmphasisMark)nMarkPos; 2750cdf0e10cSrcweir if ( m_aPositionLB.IsEnabled() ) 2751cdf0e10cSrcweir { 2752cdf0e10cSrcweir eMark |= ( CHRDLG_POSITION_UNDER == (sal_uLong)m_aPositionLB.GetEntryData( nPosPos ) ) 2753cdf0e10cSrcweir ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; 2754cdf0e10cSrcweir } 2755cdf0e10cSrcweir 2756cdf0e10cSrcweir if ( pOld ) 2757cdf0e10cSrcweir { 2758cdf0e10cSrcweir if( rOldSet.GetItemState( nWhich ) != SFX_ITEM_DONTCARE ) 2759cdf0e10cSrcweir { 2760cdf0e10cSrcweir const SvxEmphasisMarkItem& rItem = *( (const SvxEmphasisMarkItem*)pOld ); 2761cdf0e10cSrcweir if ( rItem.GetEmphasisMark() == eMark ) 2762cdf0e10cSrcweir bChanged = sal_False; 2763cdf0e10cSrcweir } 2764cdf0e10cSrcweir } 2765cdf0e10cSrcweir 2766cdf0e10cSrcweir if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && 2767cdf0e10cSrcweir m_aEmphasisLB.GetSavedValue() == nMarkPos && m_aPositionLB.GetSavedValue() == nPosPos ) 2768cdf0e10cSrcweir bChanged = sal_False; 2769cdf0e10cSrcweir 2770cdf0e10cSrcweir if ( bChanged ) 2771cdf0e10cSrcweir { 2772cdf0e10cSrcweir rSet.Put( SvxEmphasisMarkItem( eMark, nWhich ) ); 2773cdf0e10cSrcweir bModified |= sal_True; 2774cdf0e10cSrcweir } 2775cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2776cdf0e10cSrcweir CLEARTITEM; 2777cdf0e10cSrcweir 2778cdf0e10cSrcweir bChanged = sal_True; 2779cdf0e10cSrcweir 2780cdf0e10cSrcweir // Effects 2781cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); 2782cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_CASEMAP ); 2783cdf0e10cSrcweir SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED; 2784cdf0e10cSrcweir FASTBOOL bChecked = sal_False; 2785cdf0e10cSrcweir sal_uInt16 nCapsPos = m_aEffects2LB.GetSelectEntryPos(); 2786cdf0e10cSrcweir if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) 2787cdf0e10cSrcweir { 2788cdf0e10cSrcweir eCaseMap = (SvxCaseMap)nCapsPos; 2789cdf0e10cSrcweir bChecked = sal_True; 2790cdf0e10cSrcweir } 2791cdf0e10cSrcweir 2792cdf0e10cSrcweir if ( pOld ) 2793cdf0e10cSrcweir { 2794cdf0e10cSrcweir //! if there are different effect styles in the selection the 2795cdf0e10cSrcweir //! item-state in the 'rOldSet' will be invalid. In this case 2796cdf0e10cSrcweir //! changing the effect style will be allowed if a style is 2797cdf0e10cSrcweir //! selected in the listbox. 2798cdf0e10cSrcweir sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && 2799cdf0e10cSrcweir SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); 2800cdf0e10cSrcweir 2801cdf0e10cSrcweir const SvxCaseMapItem& rItem = *( (const SvxCaseMapItem*)pOld ); 2802cdf0e10cSrcweir if ( (SvxCaseMap)rItem.GetValue() == eCaseMap && !bAllowChg ) 2803cdf0e10cSrcweir bChanged = sal_False; 2804cdf0e10cSrcweir } 2805cdf0e10cSrcweir 2806cdf0e10cSrcweir if ( bChanged && bChecked ) 2807cdf0e10cSrcweir { 2808cdf0e10cSrcweir rSet.Put( SvxCaseMapItem( eCaseMap, nWhich ) ); 2809cdf0e10cSrcweir bModified |= sal_True; 2810cdf0e10cSrcweir } 2811cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2812cdf0e10cSrcweir CLEARTITEM; 2813cdf0e10cSrcweir 2814cdf0e10cSrcweir bChanged = sal_True; 2815cdf0e10cSrcweir 2816cdf0e10cSrcweir //Relief 2817cdf0e10cSrcweir nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); 2818cdf0e10cSrcweir if(m_aReliefLB.GetSelectEntryPos() != m_aReliefLB.GetSavedValue()) 2819cdf0e10cSrcweir { 2820cdf0e10cSrcweir m_aReliefLB.SaveValue(); 2821cdf0e10cSrcweir SvxCharReliefItem aRelief((FontRelief)m_aReliefLB.GetSelectEntryPos(), nWhich); 2822cdf0e10cSrcweir rSet.Put(aRelief); 2823cdf0e10cSrcweir } 2824cdf0e10cSrcweir 2825cdf0e10cSrcweir // Outline 2826cdf0e10cSrcweir const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; 2827cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); 2828cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_CONTOUR ); 2829cdf0e10cSrcweir TriState eState = m_aOutlineBtn.GetState(); 2830cdf0e10cSrcweir const SfxPoolItem* pItem; 2831cdf0e10cSrcweir 2832cdf0e10cSrcweir if ( pOld ) 2833cdf0e10cSrcweir { 2834cdf0e10cSrcweir const SvxContourItem& rItem = *( (const SvxContourItem*)pOld ); 2835cdf0e10cSrcweir if ( rItem.GetValue() == StateToAttr( eState ) && m_aOutlineBtn.GetSavedValue() == eState ) 2836cdf0e10cSrcweir bChanged = sal_False; 2837cdf0e10cSrcweir } 2838cdf0e10cSrcweir 2839cdf0e10cSrcweir if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 2840cdf0e10cSrcweir !StateToAttr( eState ) && ( (SvxContourItem*)pItem )->GetValue() ) 2841cdf0e10cSrcweir bChanged = sal_True; 2842cdf0e10cSrcweir 2843cdf0e10cSrcweir if ( bChanged && eState != STATE_DONTKNOW ) 2844cdf0e10cSrcweir { 2845cdf0e10cSrcweir rSet.Put( SvxContourItem( StateToAttr( eState ), nWhich ) ); 2846cdf0e10cSrcweir bModified |= sal_True; 2847cdf0e10cSrcweir } 2848cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2849cdf0e10cSrcweir CLEARTITEM; 2850cdf0e10cSrcweir 2851cdf0e10cSrcweir bChanged = sal_True; 2852cdf0e10cSrcweir 2853cdf0e10cSrcweir // Shadow 2854cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); 2855cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_SHADOWED ); 2856cdf0e10cSrcweir eState = m_aShadowBtn.GetState(); 2857cdf0e10cSrcweir 2858cdf0e10cSrcweir if ( pOld ) 2859cdf0e10cSrcweir { 2860cdf0e10cSrcweir const SvxShadowedItem& rItem = *( (const SvxShadowedItem*)pOld ); 2861cdf0e10cSrcweir if ( rItem.GetValue() == StateToAttr( eState ) && m_aShadowBtn.GetSavedValue() == eState ) 2862cdf0e10cSrcweir bChanged = sal_False; 2863cdf0e10cSrcweir } 2864cdf0e10cSrcweir 2865cdf0e10cSrcweir if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 2866cdf0e10cSrcweir !StateToAttr( eState ) && ( (SvxShadowedItem*)pItem )->GetValue() ) 2867cdf0e10cSrcweir bChanged = sal_True; 2868cdf0e10cSrcweir 2869cdf0e10cSrcweir if ( bChanged && eState != STATE_DONTKNOW ) 2870cdf0e10cSrcweir { 2871cdf0e10cSrcweir rSet.Put( SvxShadowedItem( StateToAttr( eState ), nWhich ) ); 2872cdf0e10cSrcweir bModified = sal_True; 2873cdf0e10cSrcweir } 2874cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2875cdf0e10cSrcweir CLEARTITEM; 2876cdf0e10cSrcweir 2877cdf0e10cSrcweir bChanged = sal_True; 2878cdf0e10cSrcweir 2879cdf0e10cSrcweir // Blinking 2880cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_FLASH ); 2881cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_FLASH ); 2882cdf0e10cSrcweir eState = m_aBlinkingBtn.GetState(); 2883cdf0e10cSrcweir 2884cdf0e10cSrcweir if ( pOld ) 2885cdf0e10cSrcweir { 2886cdf0e10cSrcweir const SvxBlinkItem& rItem = *( (const SvxBlinkItem*)pOld ); 2887cdf0e10cSrcweir if ( rItem.GetValue() == StateToAttr( eState ) && m_aBlinkingBtn.GetSavedValue() == eState ) 2888cdf0e10cSrcweir bChanged = sal_False; 2889cdf0e10cSrcweir } 2890cdf0e10cSrcweir 2891cdf0e10cSrcweir if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 2892cdf0e10cSrcweir !StateToAttr( eState ) && ( (SvxBlinkItem*)pItem )->GetValue() ) 2893cdf0e10cSrcweir bChanged = sal_True; 2894cdf0e10cSrcweir 2895cdf0e10cSrcweir if ( bChanged && eState != STATE_DONTKNOW ) 2896cdf0e10cSrcweir { 2897cdf0e10cSrcweir rSet.Put( SvxBlinkItem( StateToAttr( eState ), nWhich ) ); 2898cdf0e10cSrcweir bModified = sal_True; 2899cdf0e10cSrcweir } 2900cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2901cdf0e10cSrcweir CLEARTITEM; 2902cdf0e10cSrcweir 2903cdf0e10cSrcweir // Hidden 2904cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); 2905cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_HIDDEN ); 2906cdf0e10cSrcweir eState = m_aHiddenBtn.GetState(); 2907cdf0e10cSrcweir bChanged = sal_True; 2908cdf0e10cSrcweir 2909cdf0e10cSrcweir if ( pOld ) 2910cdf0e10cSrcweir { 2911cdf0e10cSrcweir const SvxCharHiddenItem& rItem = *( (const SvxCharHiddenItem*)pOld ); 2912cdf0e10cSrcweir if ( rItem.GetValue() == StateToAttr( eState ) && m_aHiddenBtn.GetSavedValue() == eState ) 2913cdf0e10cSrcweir bChanged = sal_False; 2914cdf0e10cSrcweir } 2915cdf0e10cSrcweir 2916cdf0e10cSrcweir if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && 2917cdf0e10cSrcweir !StateToAttr( eState ) && ( (SvxCharHiddenItem*)pItem )->GetValue() ) 2918cdf0e10cSrcweir bChanged = sal_True; 2919cdf0e10cSrcweir 2920cdf0e10cSrcweir if ( bChanged && eState != STATE_DONTKNOW ) 2921cdf0e10cSrcweir { 2922cdf0e10cSrcweir rSet.Put( SvxCharHiddenItem( StateToAttr( eState ), nWhich ) ); 2923cdf0e10cSrcweir bModified = sal_True; 2924cdf0e10cSrcweir } 2925cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 2926cdf0e10cSrcweir CLEARTITEM; 2927cdf0e10cSrcweir 2928cdf0e10cSrcweir bModified |= FillItemSetColor_Impl( rSet ); 2929cdf0e10cSrcweir 2930cdf0e10cSrcweir return bModified; 2931cdf0e10cSrcweir } 2932cdf0e10cSrcweir 2933cdf0e10cSrcweir void SvxCharEffectsPage::DisableControls( sal_uInt16 nDisable ) 2934cdf0e10cSrcweir { 2935cdf0e10cSrcweir if ( ( DISABLE_CASEMAP & nDisable ) == DISABLE_CASEMAP ) 2936cdf0e10cSrcweir { 2937cdf0e10cSrcweir m_aEffectsFT.Disable(); 2938cdf0e10cSrcweir m_aEffects2LB.Disable(); 2939cdf0e10cSrcweir } 2940cdf0e10cSrcweir 2941cdf0e10cSrcweir if ( ( DISABLE_WORDLINE & nDisable ) == DISABLE_WORDLINE ) 2942cdf0e10cSrcweir m_aIndividualWordsBtn.Disable(); 2943cdf0e10cSrcweir 2944cdf0e10cSrcweir if ( ( DISABLE_BLINK & nDisable ) == DISABLE_BLINK ) 2945cdf0e10cSrcweir m_aBlinkingBtn.Disable(); 2946cdf0e10cSrcweir 2947cdf0e10cSrcweir if ( ( DISABLE_UNDERLINE_COLOR & nDisable ) == DISABLE_UNDERLINE_COLOR ) 2948cdf0e10cSrcweir { 2949cdf0e10cSrcweir // disable the controls 2950cdf0e10cSrcweir m_aUnderlineColorFT.Disable( ); 2951cdf0e10cSrcweir m_aUnderlineColorLB.Disable( ); 2952cdf0e10cSrcweir // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling 2953cdf0e10cSrcweir m_aUnderlineLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); 2954cdf0e10cSrcweir m_aStrikeoutLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); 2955cdf0e10cSrcweir } 2956cdf0e10cSrcweir } 2957cdf0e10cSrcweir 2958cdf0e10cSrcweir void SvxCharEffectsPage::EnableFlash() 2959cdf0e10cSrcweir { 2960cdf0e10cSrcweir if ( !( ( m_nHtmlMode & HTMLMODE_ON ) && !( m_nHtmlMode & HTMLMODE_BLINK ) ) ) 2961cdf0e10cSrcweir m_aBlinkingBtn.Show(); 2962cdf0e10cSrcweir } 2963cdf0e10cSrcweir 2964cdf0e10cSrcweir // ----------------------------------------------------------------------- 2965cdf0e10cSrcweir void SvxCharEffectsPage::SetPreviewBackgroundToCharacter() 2966cdf0e10cSrcweir { 2967cdf0e10cSrcweir m_bPreviewBackgroundToCharacter = sal_True; 2968cdf0e10cSrcweir } 2969cdf0e10cSrcweir 2970cdf0e10cSrcweir // ----------------------------------------------------------------------- 2971cdf0e10cSrcweir void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 2972cdf0e10cSrcweir { 2973cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pDisableCtlItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); 2974cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 2975cdf0e10cSrcweir if (pDisableCtlItem) 2976cdf0e10cSrcweir DisableControls(pDisableCtlItem->GetValue()); 2977cdf0e10cSrcweir 2978cdf0e10cSrcweir if (pFlagItem) 2979cdf0e10cSrcweir { 2980cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 2981cdf0e10cSrcweir if ( ( nFlags & SVX_ENABLE_FLASH ) == SVX_ENABLE_FLASH ) 2982cdf0e10cSrcweir EnableFlash(); 2983cdf0e10cSrcweir if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) 2984cdf0e10cSrcweir SetPreviewBackgroundToCharacter(); 2985cdf0e10cSrcweir } 2986cdf0e10cSrcweir } 2987cdf0e10cSrcweir 2988cdf0e10cSrcweir // class SvxCharPositionPage --------------------------------------------- 2989cdf0e10cSrcweir 2990cdf0e10cSrcweir SvxCharPositionPage::SvxCharPositionPage( Window* pParent, const SfxItemSet& rInSet ) : 2991cdf0e10cSrcweir 2992cdf0e10cSrcweir SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_POSITION ), rInSet, WIN_POS_PREVIEW, FT_POS_FONTTYPE ), 2993cdf0e10cSrcweir 2994cdf0e10cSrcweir m_aPositionLine ( this, CUI_RES( FL_POSITION ) ), 2995cdf0e10cSrcweir m_aHighPosBtn ( this, CUI_RES( RB_HIGHPOS ) ), 2996cdf0e10cSrcweir m_aNormalPosBtn ( this, CUI_RES( RB_NORMALPOS ) ), 2997cdf0e10cSrcweir m_aLowPosBtn ( this, CUI_RES( RB_LOWPOS ) ), 2998cdf0e10cSrcweir m_aHighLowFT ( this, CUI_RES( FT_HIGHLOW ) ), 2999cdf0e10cSrcweir m_aHighLowEdit ( this, CUI_RES( ED_HIGHLOW ) ), 3000cdf0e10cSrcweir m_aHighLowRB ( this, CUI_RES( CB_HIGHLOW ) ), 3001cdf0e10cSrcweir m_aFontSizeFT ( this, CUI_RES( FT_FONTSIZE ) ), 3002cdf0e10cSrcweir m_aFontSizeEdit ( this, CUI_RES( ED_FONTSIZE ) ), 3003cdf0e10cSrcweir m_aRotationScalingFL( this, CUI_RES( FL_ROTATION_SCALING ) ), 3004cdf0e10cSrcweir m_aScalingFL ( this, CUI_RES( FL_SCALING ) ), 3005cdf0e10cSrcweir m_a0degRB ( this, CUI_RES( RB_0_DEG ) ), 3006cdf0e10cSrcweir m_a90degRB ( this, CUI_RES( RB_90_DEG ) ), 3007cdf0e10cSrcweir m_a270degRB ( this, CUI_RES( RB_270_DEG ) ), 3008cdf0e10cSrcweir m_aFitToLineCB ( this, CUI_RES( CB_FIT_TO_LINE ) ), 3009cdf0e10cSrcweir m_aScaleWidthFT ( this, CUI_RES( FT_SCALE_WIDTH ) ), 3010cdf0e10cSrcweir m_aScaleWidthMF ( this, CUI_RES( MF_SCALE_WIDTH ) ), 3011cdf0e10cSrcweir 3012cdf0e10cSrcweir m_aKerningLine ( this, CUI_RES( FL_KERNING2 ) ), 3013cdf0e10cSrcweir m_aKerningLB ( this, CUI_RES( LB_KERNING2 ) ), 3014cdf0e10cSrcweir m_aKerningFT ( this, CUI_RES( FT_KERNING2 ) ), 3015cdf0e10cSrcweir m_aKerningEdit ( this, CUI_RES( ED_KERNING2 ) ), 3016cdf0e10cSrcweir m_aPairKerningBtn ( this, CUI_RES( CB_PAIRKERNING ) ), 3017cdf0e10cSrcweir 3018cdf0e10cSrcweir m_nSuperEsc ( (short)DFLT_ESC_SUPER ), 3019cdf0e10cSrcweir m_nSubEsc ( (short)DFLT_ESC_SUB ), 3020cdf0e10cSrcweir m_nScaleWidthItemSetVal ( 100 ), 3021cdf0e10cSrcweir m_nScaleWidthInitialVal ( 100 ), 3022cdf0e10cSrcweir m_nSuperProp ( (sal_uInt8)DFLT_ESC_PROP ), 3023cdf0e10cSrcweir m_nSubProp ( (sal_uInt8)DFLT_ESC_PROP ) 3024cdf0e10cSrcweir { 3025cdf0e10cSrcweir FreeResource(); 3026cdf0e10cSrcweir Initialize(); 3027cdf0e10cSrcweir } 3028cdf0e10cSrcweir 3029cdf0e10cSrcweir // ----------------------------------------------------------------------- 3030cdf0e10cSrcweir 3031cdf0e10cSrcweir void SvxCharPositionPage::Initialize() 3032cdf0e10cSrcweir { 3033cdf0e10cSrcweir // to handle the changes of the other pages 3034cdf0e10cSrcweir SetExchangeSupport(); 3035cdf0e10cSrcweir 3036cdf0e10cSrcweir GetPreviewFont().SetSize( Size( 0, 240 ) ); 3037cdf0e10cSrcweir GetPreviewCJKFont().SetSize( Size( 0, 240 ) ); 3038cdf0e10cSrcweir GetPreviewCTLFont().SetSize( Size( 0, 240 ) ); 3039cdf0e10cSrcweir 3040cdf0e10cSrcweir m_aNormalPosBtn.Check(); 3041cdf0e10cSrcweir PositionHdl_Impl( &m_aNormalPosBtn ); 3042cdf0e10cSrcweir m_aKerningLB.SelectEntryPos( 0 ); 3043cdf0e10cSrcweir KerningSelectHdl_Impl( NULL ); 3044cdf0e10cSrcweir 3045cdf0e10cSrcweir Link aLink = LINK( this, SvxCharPositionPage, PositionHdl_Impl ); 3046cdf0e10cSrcweir m_aHighPosBtn.SetClickHdl( aLink ); 3047cdf0e10cSrcweir m_aNormalPosBtn.SetClickHdl( aLink ); 3048cdf0e10cSrcweir m_aLowPosBtn.SetClickHdl( aLink ); 3049cdf0e10cSrcweir 3050cdf0e10cSrcweir aLink = LINK( this, SvxCharPositionPage, RotationHdl_Impl ); 3051cdf0e10cSrcweir m_a0degRB .SetClickHdl( aLink ); 3052cdf0e10cSrcweir m_a90degRB .SetClickHdl( aLink ); 3053cdf0e10cSrcweir m_a270degRB.SetClickHdl( aLink ); 3054cdf0e10cSrcweir 3055cdf0e10cSrcweir aLink = LINK( this, SvxCharPositionPage, FontModifyHdl_Impl ); 3056cdf0e10cSrcweir m_aHighLowEdit.SetModifyHdl( aLink ); 3057cdf0e10cSrcweir m_aFontSizeEdit.SetModifyHdl( aLink ); 3058cdf0e10cSrcweir 3059cdf0e10cSrcweir aLink = LINK( this, SvxCharPositionPage, LoseFocusHdl_Impl ); 3060cdf0e10cSrcweir m_aHighLowEdit.SetLoseFocusHdl( aLink ); 3061cdf0e10cSrcweir m_aFontSizeEdit.SetLoseFocusHdl( aLink ); 3062cdf0e10cSrcweir 3063cdf0e10cSrcweir m_aHighLowRB.SetClickHdl( LINK( this, SvxCharPositionPage, AutoPositionHdl_Impl ) ); 3064cdf0e10cSrcweir m_aFitToLineCB.SetClickHdl( LINK( this, SvxCharPositionPage, FitToLineHdl_Impl ) ); 3065cdf0e10cSrcweir m_aKerningLB.SetSelectHdl( LINK( this, SvxCharPositionPage, KerningSelectHdl_Impl ) ); 3066cdf0e10cSrcweir m_aKerningEdit.SetModifyHdl( LINK( this, SvxCharPositionPage, KerningModifyHdl_Impl ) ); 3067cdf0e10cSrcweir m_aPairKerningBtn.SetClickHdl( LINK( this, SvxCharPositionPage, PairKerningHdl_Impl ) ); 3068cdf0e10cSrcweir m_aScaleWidthMF.SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) ); 3069cdf0e10cSrcweir } 3070cdf0e10cSrcweir 3071cdf0e10cSrcweir // ----------------------------------------------------------------------- 3072cdf0e10cSrcweir 3073cdf0e10cSrcweir void SvxCharPositionPage::UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) 3074cdf0e10cSrcweir { 3075cdf0e10cSrcweir SetPrevFontEscapement( nProp, nEscProp, nEsc ); 3076cdf0e10cSrcweir } 3077cdf0e10cSrcweir 3078cdf0e10cSrcweir // ----------------------------------------------------------------------- 3079cdf0e10cSrcweir 3080cdf0e10cSrcweir void SvxCharPositionPage::SetEscapement_Impl( sal_uInt16 nEsc ) 3081cdf0e10cSrcweir { 3082cdf0e10cSrcweir SvxEscapementItem aEscItm( (SvxEscapement)nEsc, SID_ATTR_CHAR_ESCAPEMENT ); 3083cdf0e10cSrcweir 3084cdf0e10cSrcweir if ( SVX_ESCAPEMENT_SUPERSCRIPT == nEsc ) 3085cdf0e10cSrcweir { 3086cdf0e10cSrcweir aEscItm.GetEsc() = m_nSuperEsc; 3087cdf0e10cSrcweir aEscItm.GetProp() = m_nSuperProp; 3088cdf0e10cSrcweir } 3089cdf0e10cSrcweir else if ( SVX_ESCAPEMENT_SUBSCRIPT == nEsc ) 3090cdf0e10cSrcweir { 3091cdf0e10cSrcweir aEscItm.GetEsc() = m_nSubEsc; 3092cdf0e10cSrcweir aEscItm.GetProp() = m_nSubProp; 3093cdf0e10cSrcweir } 3094cdf0e10cSrcweir 3095cdf0e10cSrcweir short nFac = aEscItm.GetEsc() < 0 ? -1 : 1; 3096cdf0e10cSrcweir 3097cdf0e10cSrcweir m_aHighLowEdit.SetValue( aEscItm.GetEsc() * nFac ); 3098cdf0e10cSrcweir m_aFontSizeEdit.SetValue( aEscItm.GetProp() ); 3099cdf0e10cSrcweir 3100cdf0e10cSrcweir if ( SVX_ESCAPEMENT_OFF == nEsc ) 3101cdf0e10cSrcweir { 3102cdf0e10cSrcweir m_aHighLowFT.Disable(); 3103cdf0e10cSrcweir m_aHighLowEdit.Disable(); 3104cdf0e10cSrcweir m_aFontSizeFT.Disable(); 3105cdf0e10cSrcweir m_aFontSizeEdit.Disable(); 3106cdf0e10cSrcweir m_aHighLowRB.Disable(); 3107cdf0e10cSrcweir } 3108cdf0e10cSrcweir else 3109cdf0e10cSrcweir { 3110cdf0e10cSrcweir m_aFontSizeFT.Enable(); 3111cdf0e10cSrcweir m_aFontSizeEdit.Enable(); 3112cdf0e10cSrcweir m_aHighLowRB.Enable(); 3113cdf0e10cSrcweir 3114cdf0e10cSrcweir if ( !m_aHighLowRB.IsChecked() ) 3115cdf0e10cSrcweir { 3116cdf0e10cSrcweir m_aHighLowFT.Enable(); 3117cdf0e10cSrcweir m_aHighLowEdit.Enable(); 3118cdf0e10cSrcweir } 3119cdf0e10cSrcweir else 3120cdf0e10cSrcweir AutoPositionHdl_Impl( &m_aHighLowRB ); 3121cdf0e10cSrcweir } 3122cdf0e10cSrcweir 3123cdf0e10cSrcweir UpdatePreview_Impl( 100, aEscItm.GetProp(), aEscItm.GetEsc() ); 3124cdf0e10cSrcweir } 3125cdf0e10cSrcweir 3126cdf0e10cSrcweir // ----------------------------------------------------------------------- 3127cdf0e10cSrcweir 3128cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, PositionHdl_Impl, RadioButton*, pBtn ) 3129cdf0e10cSrcweir { 3130cdf0e10cSrcweir sal_uInt16 nEsc = SVX_ESCAPEMENT_OFF; // also when pBtn == NULL 3131cdf0e10cSrcweir 3132cdf0e10cSrcweir if ( &m_aHighPosBtn == pBtn ) 3133cdf0e10cSrcweir nEsc = SVX_ESCAPEMENT_SUPERSCRIPT; 3134cdf0e10cSrcweir else if ( &m_aLowPosBtn == pBtn ) 3135cdf0e10cSrcweir nEsc = SVX_ESCAPEMENT_SUBSCRIPT; 3136cdf0e10cSrcweir 3137cdf0e10cSrcweir SetEscapement_Impl( nEsc ); 3138cdf0e10cSrcweir return 0; 3139cdf0e10cSrcweir } 3140cdf0e10cSrcweir 3141cdf0e10cSrcweir // ----------------------------------------------------------------------- 3142cdf0e10cSrcweir 3143cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, RotationHdl_Impl, RadioButton*, pBtn ) 3144cdf0e10cSrcweir { 3145cdf0e10cSrcweir sal_Bool bEnable = sal_False; 3146cdf0e10cSrcweir if (&m_a90degRB == pBtn || &m_a270degRB == pBtn) 3147cdf0e10cSrcweir bEnable = sal_True; 3148cdf0e10cSrcweir else 3149cdf0e10cSrcweir OSL_ENSURE( &m_a0degRB == pBtn, "unexpected button" ); 3150cdf0e10cSrcweir m_aFitToLineCB.Enable( bEnable ); 3151cdf0e10cSrcweir return 0; 3152cdf0e10cSrcweir } 3153cdf0e10cSrcweir 3154cdf0e10cSrcweir // ----------------------------------------------------------------------- 3155cdf0e10cSrcweir 3156cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, FontModifyHdl_Impl, MetricField*, EMPTYARG ) 3157cdf0e10cSrcweir { 3158cdf0e10cSrcweir sal_uInt8 nEscProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); 3159cdf0e10cSrcweir short nEsc = (short)m_aHighLowEdit.GetValue(); 3160cdf0e10cSrcweir nEsc *= m_aLowPosBtn.IsChecked() ? -1 : 1; 3161cdf0e10cSrcweir UpdatePreview_Impl( 100, nEscProp, nEsc ); 3162cdf0e10cSrcweir return 0; 3163cdf0e10cSrcweir } 3164cdf0e10cSrcweir 3165cdf0e10cSrcweir // ----------------------------------------------------------------------- 3166cdf0e10cSrcweir 3167cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, AutoPositionHdl_Impl, CheckBox*, pBox ) 3168cdf0e10cSrcweir { 3169cdf0e10cSrcweir if ( pBox->IsChecked() ) 3170cdf0e10cSrcweir { 3171cdf0e10cSrcweir m_aHighLowFT.Disable(); 3172cdf0e10cSrcweir m_aHighLowEdit.Disable(); 3173cdf0e10cSrcweir } 3174cdf0e10cSrcweir else 3175cdf0e10cSrcweir PositionHdl_Impl( m_aHighPosBtn.IsChecked() ? &m_aHighPosBtn 3176cdf0e10cSrcweir : m_aLowPosBtn.IsChecked() ? &m_aLowPosBtn 3177cdf0e10cSrcweir : &m_aNormalPosBtn ); 3178cdf0e10cSrcweir return 0; 3179cdf0e10cSrcweir } 3180cdf0e10cSrcweir 3181cdf0e10cSrcweir // ----------------------------------------------------------------------- 3182cdf0e10cSrcweir 3183cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, FitToLineHdl_Impl, CheckBox*, pBox ) 3184cdf0e10cSrcweir { 3185cdf0e10cSrcweir if ( &m_aFitToLineCB == pBox) 3186cdf0e10cSrcweir { 3187cdf0e10cSrcweir sal_uInt16 nVal = m_nScaleWidthInitialVal; 3188cdf0e10cSrcweir if (m_aFitToLineCB.IsChecked()) 3189cdf0e10cSrcweir nVal = m_nScaleWidthItemSetVal; 3190cdf0e10cSrcweir m_aScaleWidthMF.SetValue( nVal ); 3191cdf0e10cSrcweir 3192cdf0e10cSrcweir m_aPreviewWin.SetFontWidthScale( nVal ); 3193cdf0e10cSrcweir } 3194cdf0e10cSrcweir return 0; 3195cdf0e10cSrcweir } 3196cdf0e10cSrcweir 3197cdf0e10cSrcweir // ----------------------------------------------------------------------- 3198cdf0e10cSrcweir 3199cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, KerningSelectHdl_Impl, ListBox*, EMPTYARG ) 3200cdf0e10cSrcweir { 3201cdf0e10cSrcweir if ( m_aKerningLB.GetSelectEntryPos() > 0 ) 3202cdf0e10cSrcweir { 3203cdf0e10cSrcweir m_aKerningFT.Enable(); 3204cdf0e10cSrcweir m_aKerningEdit.Enable(); 3205cdf0e10cSrcweir 3206cdf0e10cSrcweir if ( m_aKerningLB.GetSelectEntryPos() == 2 ) 3207cdf0e10cSrcweir { 3208cdf0e10cSrcweir // Condensed -> max value == 1/6 of the current font height 3209cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 3210cdf0e10cSrcweir long nMax = rFont.GetSize().Height() / 6; 3211cdf0e10cSrcweir m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nMax ), FUNIT_TWIP ); 3212cdf0e10cSrcweir m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); 3213cdf0e10cSrcweir } 3214cdf0e10cSrcweir else 3215cdf0e10cSrcweir { 3216cdf0e10cSrcweir m_aKerningEdit.SetMax( 9999 ); 3217cdf0e10cSrcweir m_aKerningEdit.SetLast( 9999 ); 3218cdf0e10cSrcweir } 3219cdf0e10cSrcweir } 3220cdf0e10cSrcweir else 3221cdf0e10cSrcweir { 3222cdf0e10cSrcweir m_aKerningEdit.SetValue( 0 ); 3223cdf0e10cSrcweir m_aKerningFT.Disable(); 3224cdf0e10cSrcweir m_aKerningEdit.Disable(); 3225cdf0e10cSrcweir } 3226cdf0e10cSrcweir 3227cdf0e10cSrcweir KerningModifyHdl_Impl( NULL ); 3228cdf0e10cSrcweir 3229cdf0e10cSrcweir return 0; 3230cdf0e10cSrcweir } 3231cdf0e10cSrcweir 3232cdf0e10cSrcweir // ----------------------------------------------------------------------- 3233cdf0e10cSrcweir 3234cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, KerningModifyHdl_Impl, MetricField*, EMPTYARG ) 3235cdf0e10cSrcweir { 3236cdf0e10cSrcweir long nVal = static_cast<long>(m_aKerningEdit.GetValue()); 3237cdf0e10cSrcweir nVal = LogicToLogic( nVal, MAP_POINT, MAP_TWIP ); 3238cdf0e10cSrcweir long nKern = (short)m_aKerningEdit.Denormalize( nVal ); 3239cdf0e10cSrcweir 3240cdf0e10cSrcweir // Condensed? -> then negative 3241cdf0e10cSrcweir if ( m_aKerningLB.GetSelectEntryPos() == 2 ) 3242cdf0e10cSrcweir nKern *= -1; 3243cdf0e10cSrcweir 3244cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 3245cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 3246cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 3247cdf0e10cSrcweir 3248cdf0e10cSrcweir rFont.SetFixKerning( (short)nKern ); 3249cdf0e10cSrcweir rCJKFont.SetFixKerning( (short)nKern ); 3250cdf0e10cSrcweir rCTLFont.SetFixKerning( (short)nKern ); 3251cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 3252cdf0e10cSrcweir return 0; 3253cdf0e10cSrcweir } 3254cdf0e10cSrcweir 3255cdf0e10cSrcweir // ----------------------------------------------------------------------- 3256cdf0e10cSrcweir 3257cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, PairKerningHdl_Impl, CheckBox*, EMPTYARG ) 3258cdf0e10cSrcweir { 3259cdf0e10cSrcweir return 0; 3260cdf0e10cSrcweir } 3261cdf0e10cSrcweir 3262cdf0e10cSrcweir // ----------------------------------------------------------------------- 3263cdf0e10cSrcweir 3264cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, LoseFocusHdl_Impl, MetricField*, pField ) 3265cdf0e10cSrcweir { 3266cdf0e10cSrcweir #ifdef DBG_UTIL 3267cdf0e10cSrcweir sal_Bool bHigh = m_aHighPosBtn.IsChecked(); 3268cdf0e10cSrcweir #endif 3269cdf0e10cSrcweir sal_Bool bLow = m_aLowPosBtn.IsChecked(); 3270cdf0e10cSrcweir DBG_ASSERT( bHigh || bLow, "normal position is not valid" ); 3271cdf0e10cSrcweir 3272cdf0e10cSrcweir if ( &m_aHighLowEdit == pField ) 3273cdf0e10cSrcweir { 3274cdf0e10cSrcweir if ( bLow ) 3275cdf0e10cSrcweir m_nSubEsc = (short)m_aHighLowEdit.GetValue() * -1; 3276cdf0e10cSrcweir else 3277cdf0e10cSrcweir m_nSuperEsc = (short)m_aHighLowEdit.GetValue(); 3278cdf0e10cSrcweir } 3279cdf0e10cSrcweir else if ( &m_aFontSizeEdit == pField ) 3280cdf0e10cSrcweir { 3281cdf0e10cSrcweir if ( bLow ) 3282cdf0e10cSrcweir m_nSubProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); 3283cdf0e10cSrcweir else 3284cdf0e10cSrcweir m_nSuperProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); 3285cdf0e10cSrcweir } 3286cdf0e10cSrcweir return 0; 3287cdf0e10cSrcweir } 3288cdf0e10cSrcweir 3289cdf0e10cSrcweir // ----------------------------------------------------------------------- 3290cdf0e10cSrcweir 3291cdf0e10cSrcweir IMPL_LINK( SvxCharPositionPage, ScaleWidthModifyHdl_Impl, MetricField*, EMPTYARG ) 3292cdf0e10cSrcweir { 3293cdf0e10cSrcweir m_aPreviewWin.SetFontWidthScale( sal_uInt16( m_aScaleWidthMF.GetValue() ) ); 3294cdf0e10cSrcweir 3295cdf0e10cSrcweir return 0; 3296cdf0e10cSrcweir } 3297cdf0e10cSrcweir 3298cdf0e10cSrcweir /* -----------------28.08.2003 12:12----------------- 3299cdf0e10cSrcweir 3300cdf0e10cSrcweir --------------------------------------------------*/ 3301cdf0e10cSrcweir void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet ) 3302cdf0e10cSrcweir { 3303cdf0e10cSrcweir //update the preview 3304cdf0e10cSrcweir SvxCharBasePage::ActivatePage( rSet ); 3305cdf0e10cSrcweir 3306cdf0e10cSrcweir //the only thing that has to be checked is the max. allowed value for the 3307cdf0e10cSrcweir //condense edit field 3308cdf0e10cSrcweir if ( m_aKerningLB.GetSelectEntryPos() == 2 ) 3309cdf0e10cSrcweir { 3310cdf0e10cSrcweir // Condensed -> max value == 1/6 of the current font height 3311cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 3312cdf0e10cSrcweir long nMax = rFont.GetSize().Height() / 6; 3313cdf0e10cSrcweir long nKern = (short)m_aKerningEdit.Denormalize( LogicToLogic( static_cast<long>(m_aKerningEdit.GetValue()), MAP_POINT, MAP_TWIP ) ); 3314cdf0e10cSrcweir m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP ); 3315cdf0e10cSrcweir m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); 3316cdf0e10cSrcweir } 3317cdf0e10cSrcweir } 3318cdf0e10cSrcweir 3319cdf0e10cSrcweir // ----------------------------------------------------------------------- 3320cdf0e10cSrcweir 3321cdf0e10cSrcweir int SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet ) 3322cdf0e10cSrcweir { 3323cdf0e10cSrcweir if ( _pSet ) 3324cdf0e10cSrcweir FillItemSet( *_pSet ); 3325cdf0e10cSrcweir return LEAVE_PAGE; 3326cdf0e10cSrcweir } 3327cdf0e10cSrcweir 3328cdf0e10cSrcweir // ----------------------------------------------------------------------- 3329cdf0e10cSrcweir 3330cdf0e10cSrcweir SfxTabPage* SvxCharPositionPage::Create( Window* pParent, const SfxItemSet& rSet ) 3331cdf0e10cSrcweir { 3332cdf0e10cSrcweir return new SvxCharPositionPage( pParent, rSet ); 3333cdf0e10cSrcweir } 3334cdf0e10cSrcweir 3335cdf0e10cSrcweir // ----------------------------------------------------------------------- 3336cdf0e10cSrcweir 3337cdf0e10cSrcweir sal_uInt16* SvxCharPositionPage::GetRanges() 3338cdf0e10cSrcweir { 3339cdf0e10cSrcweir return pPositionRanges; 3340cdf0e10cSrcweir } 3341cdf0e10cSrcweir 3342cdf0e10cSrcweir // ----------------------------------------------------------------------- 3343cdf0e10cSrcweir void SvxCharPositionPage::Reset( const SfxItemSet& rSet ) 3344cdf0e10cSrcweir { 3345cdf0e10cSrcweir String sUser = GetUserData(); 3346cdf0e10cSrcweir 3347cdf0e10cSrcweir if ( sUser.Len() ) 3348cdf0e10cSrcweir { 3349cdf0e10cSrcweir m_nSuperEsc = (short)sUser.GetToken( 0 ).ToInt32(); 3350cdf0e10cSrcweir m_nSubEsc = (short)sUser.GetToken( 1 ).ToInt32(); 3351cdf0e10cSrcweir m_nSuperProp = (sal_uInt8)sUser.GetToken( 2 ).ToInt32(); 3352cdf0e10cSrcweir m_nSubProp = (sal_uInt8)sUser.GetToken( 3 ).ToInt32(); 3353cdf0e10cSrcweir } 3354cdf0e10cSrcweir 3355cdf0e10cSrcweir short nEsc = 0; 3356cdf0e10cSrcweir sal_uInt8 nEscProp = 100; 3357cdf0e10cSrcweir sal_uInt8 nProp = 100; 3358cdf0e10cSrcweir 3359cdf0e10cSrcweir m_aHighLowFT.Disable(); 3360cdf0e10cSrcweir m_aHighLowEdit.Disable(); 3361cdf0e10cSrcweir m_aFontSizeFT.Disable(); 3362cdf0e10cSrcweir m_aFontSizeEdit.Disable(); 3363cdf0e10cSrcweir 3364cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 3365cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 3366cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 3367cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); 3368cdf0e10cSrcweir 3369cdf0e10cSrcweir if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) 3370cdf0e10cSrcweir { 3371cdf0e10cSrcweir const SvxEscapementItem& rItem = (SvxEscapementItem&)rSet.Get( nWhich ); 3372cdf0e10cSrcweir nEsc = rItem.GetEsc(); 3373cdf0e10cSrcweir nEscProp = rItem.GetProp(); 3374cdf0e10cSrcweir 3375cdf0e10cSrcweir if ( nEsc != 0 ) 3376cdf0e10cSrcweir { 3377cdf0e10cSrcweir m_aHighLowFT.Enable(); 3378cdf0e10cSrcweir m_aHighLowEdit.Enable(); 3379cdf0e10cSrcweir m_aFontSizeFT.Enable(); 3380cdf0e10cSrcweir m_aFontSizeEdit.Enable(); 3381cdf0e10cSrcweir 3382cdf0e10cSrcweir short nFac; 3383cdf0e10cSrcweir sal_Bool bAutomatic(sal_False); 3384cdf0e10cSrcweir 3385cdf0e10cSrcweir if ( nEsc > 0 ) 3386cdf0e10cSrcweir { 3387cdf0e10cSrcweir nFac = 1; 3388cdf0e10cSrcweir m_aHighPosBtn.Check( sal_True ); 3389cdf0e10cSrcweir if ( nEsc == DFLT_ESC_AUTO_SUPER ) 3390cdf0e10cSrcweir { 3391cdf0e10cSrcweir nEsc = DFLT_ESC_SUPER; 3392cdf0e10cSrcweir bAutomatic = sal_True; 3393cdf0e10cSrcweir } 3394cdf0e10cSrcweir } 3395cdf0e10cSrcweir else 3396cdf0e10cSrcweir { 3397cdf0e10cSrcweir nFac = -1; 3398cdf0e10cSrcweir m_aLowPosBtn.Check( sal_True ); 3399cdf0e10cSrcweir if ( nEsc == DFLT_ESC_AUTO_SUB ) 3400cdf0e10cSrcweir { 3401cdf0e10cSrcweir nEsc = DFLT_ESC_SUB; 3402cdf0e10cSrcweir bAutomatic = sal_True; 3403cdf0e10cSrcweir } 3404cdf0e10cSrcweir } 3405cdf0e10cSrcweir if (!m_aHighLowRB.IsEnabled()) 3406cdf0e10cSrcweir { 3407cdf0e10cSrcweir m_aHighLowRB.Enable(); 3408cdf0e10cSrcweir } 3409cdf0e10cSrcweir m_aHighLowRB.Check(bAutomatic); 3410cdf0e10cSrcweir 3411cdf0e10cSrcweir if ( m_aHighLowRB.IsChecked() ) 3412cdf0e10cSrcweir { 3413cdf0e10cSrcweir m_aHighLowFT.Disable(); 3414cdf0e10cSrcweir m_aHighLowEdit.Disable(); 3415cdf0e10cSrcweir } 3416cdf0e10cSrcweir m_aHighLowEdit.SetValue( m_aHighLowEdit.Normalize( nFac * nEsc ) ); 3417cdf0e10cSrcweir } 3418cdf0e10cSrcweir else 3419cdf0e10cSrcweir { 3420cdf0e10cSrcweir m_aNormalPosBtn.Check( sal_True ); 3421cdf0e10cSrcweir m_aHighLowRB.Check( sal_True ); 3422cdf0e10cSrcweir PositionHdl_Impl( NULL ); 3423cdf0e10cSrcweir } 3424cdf0e10cSrcweir //the height has to be set after the handler is called to keep the value also if the escapement is zero 3425cdf0e10cSrcweir m_aFontSizeEdit.SetValue( m_aFontSizeEdit.Normalize( nEscProp ) ); 3426cdf0e10cSrcweir } 3427cdf0e10cSrcweir else 3428cdf0e10cSrcweir { 3429cdf0e10cSrcweir m_aHighPosBtn.Check( sal_False ); 3430cdf0e10cSrcweir m_aNormalPosBtn.Check( sal_False ); 3431cdf0e10cSrcweir m_aLowPosBtn.Check( sal_False ); 3432cdf0e10cSrcweir } 3433cdf0e10cSrcweir 3434cdf0e10cSrcweir // BspFont setzen 3435cdf0e10cSrcweir SetPrevFontEscapement( nProp, nEscProp, nEsc ); 3436cdf0e10cSrcweir 3437cdf0e10cSrcweir // Kerning 3438cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); 3439cdf0e10cSrcweir 3440cdf0e10cSrcweir if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) 3441cdf0e10cSrcweir { 3442cdf0e10cSrcweir const SvxKerningItem& rItem = (SvxKerningItem&)rSet.Get( nWhich ); 3443cdf0e10cSrcweir SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); 3444cdf0e10cSrcweir MapUnit eOrgUnit = (MapUnit)eUnit; 3445cdf0e10cSrcweir MapUnit ePntUnit( MAP_POINT ); 3446cdf0e10cSrcweir long nBig = static_cast<long>(m_aKerningEdit.Normalize( static_cast<long>(rItem.GetValue()) )); 3447cdf0e10cSrcweir long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); 3448cdf0e10cSrcweir 3449cdf0e10cSrcweir // Kerning am Font setzen, vorher in Twips umrechnen 3450cdf0e10cSrcweir long nKern = LogicToLogic( rItem.GetValue(), (MapUnit)eUnit, MAP_TWIP ); 3451cdf0e10cSrcweir rFont.SetFixKerning( (short)nKern ); 3452cdf0e10cSrcweir rCJKFont.SetFixKerning( (short)nKern ); 3453cdf0e10cSrcweir rCTLFont.SetFixKerning( (short)nKern ); 3454cdf0e10cSrcweir 3455cdf0e10cSrcweir if ( nKerning > 0 ) 3456cdf0e10cSrcweir { 3457cdf0e10cSrcweir m_aKerningLB.SelectEntryPos( LW_GESPERRT ); 3458cdf0e10cSrcweir } 3459cdf0e10cSrcweir else if ( nKerning < 0 ) 3460cdf0e10cSrcweir { 3461cdf0e10cSrcweir m_aKerningLB.SelectEntryPos( LW_SCHMAL ); 3462cdf0e10cSrcweir nKerning = -nKerning; 3463cdf0e10cSrcweir } 3464cdf0e10cSrcweir else 3465cdf0e10cSrcweir { 3466cdf0e10cSrcweir nKerning = 0; 3467cdf0e10cSrcweir m_aKerningLB.SelectEntryPos( LW_NORMAL ); 3468cdf0e10cSrcweir } 3469cdf0e10cSrcweir //enable/disable and set min/max of the Edit 3470cdf0e10cSrcweir KerningSelectHdl_Impl(&m_aKerningLB); 3471cdf0e10cSrcweir //the attribute value must be displayed also if it's above the maximum allowed value 3472cdf0e10cSrcweir long nVal = static_cast<long>(m_aKerningEdit.GetMax()); 3473cdf0e10cSrcweir if(nVal < nKerning) 3474cdf0e10cSrcweir m_aKerningEdit.SetMax( nKerning ); 3475cdf0e10cSrcweir m_aKerningEdit.SetValue( nKerning ); 3476cdf0e10cSrcweir } 3477cdf0e10cSrcweir else 3478cdf0e10cSrcweir m_aKerningEdit.SetText( String() ); 3479cdf0e10cSrcweir 3480cdf0e10cSrcweir // Pair kerning 3481cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); 3482cdf0e10cSrcweir 3483cdf0e10cSrcweir if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) 3484cdf0e10cSrcweir { 3485cdf0e10cSrcweir const SvxAutoKernItem& rItem = (SvxAutoKernItem&)rSet.Get( nWhich ); 3486cdf0e10cSrcweir m_aPairKerningBtn.Check( rItem.GetValue() ); 3487cdf0e10cSrcweir } 3488cdf0e10cSrcweir else 3489cdf0e10cSrcweir m_aPairKerningBtn.Check( sal_False ); 3490cdf0e10cSrcweir 3491cdf0e10cSrcweir // Scale Width 3492cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); 3493cdf0e10cSrcweir if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) 3494cdf0e10cSrcweir { 3495cdf0e10cSrcweir const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); 3496cdf0e10cSrcweir m_nScaleWidthInitialVal = rItem.GetValue(); 3497cdf0e10cSrcweir m_aScaleWidthMF.SetValue( m_nScaleWidthInitialVal ); 3498cdf0e10cSrcweir } 3499cdf0e10cSrcweir else 3500cdf0e10cSrcweir m_aScaleWidthMF.SetValue( 100 ); 3501cdf0e10cSrcweir 3502cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ); 3503cdf0e10cSrcweir if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) 3504cdf0e10cSrcweir m_nScaleWidthItemSetVal = ((SfxUInt16Item&) rSet.Get( nWhich )).GetValue(); 3505cdf0e10cSrcweir 3506cdf0e10cSrcweir // Rotation 3507cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); 3508cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 3509cdf0e10cSrcweir if( SFX_ITEM_UNKNOWN == eState ) 3510cdf0e10cSrcweir { 3511cdf0e10cSrcweir m_aRotationScalingFL.Hide(); 3512cdf0e10cSrcweir m_aScalingFL.Show(); 3513cdf0e10cSrcweir m_a0degRB.Hide(); 3514cdf0e10cSrcweir m_a90degRB.Hide(); 3515cdf0e10cSrcweir m_a270degRB.Hide(); 3516cdf0e10cSrcweir m_aFitToLineCB.Hide(); 3517cdf0e10cSrcweir m_aFitToLineCB .Hide(); 3518cdf0e10cSrcweir 3519cdf0e10cSrcweir 3520cdf0e10cSrcweir // move the following controls upwards 3521cdf0e10cSrcweir Window* aCntrlArr[] = { 3522cdf0e10cSrcweir &m_aScaleWidthFT, &m_aScaleWidthMF, &m_aKerningLine, 3523cdf0e10cSrcweir &m_aKerningLB, &m_aKerningFT, &m_aKerningEdit, &m_aPairKerningBtn, 3524cdf0e10cSrcweir 0 }; 3525cdf0e10cSrcweir 3526cdf0e10cSrcweir long nDiff = m_aScaleWidthMF.GetPosPixel().Y() - 3527cdf0e10cSrcweir m_a0degRB.GetPosPixel().Y(); 3528cdf0e10cSrcweir 3529cdf0e10cSrcweir for( Window** ppW = aCntrlArr; *ppW; ++ppW ) 3530cdf0e10cSrcweir { 3531cdf0e10cSrcweir Point aPnt( (*ppW)->GetPosPixel() ); 3532cdf0e10cSrcweir aPnt.Y() -= nDiff; 3533cdf0e10cSrcweir (*ppW)->SetPosPixel( aPnt ); 3534cdf0e10cSrcweir } 3535cdf0e10cSrcweir } 3536cdf0e10cSrcweir else 3537cdf0e10cSrcweir { 3538cdf0e10cSrcweir m_aScalingFL.Hide(); 3539cdf0e10cSrcweir 3540cdf0e10cSrcweir Link aOldLink( m_aFitToLineCB.GetClickHdl() ); 3541cdf0e10cSrcweir m_aFitToLineCB.SetClickHdl( Link() ); 3542cdf0e10cSrcweir if( eState >= SFX_ITEM_DEFAULT ) 3543cdf0e10cSrcweir { 3544cdf0e10cSrcweir const SvxCharRotateItem& rItem = 3545cdf0e10cSrcweir (SvxCharRotateItem&) rSet.Get( nWhich ); 3546cdf0e10cSrcweir if (rItem.IsBottomToTop()) 3547cdf0e10cSrcweir m_a90degRB.Check( sal_True ); 3548cdf0e10cSrcweir else if (rItem.IsTopToBotton()) 3549cdf0e10cSrcweir m_a270degRB.Check( sal_True ); 3550cdf0e10cSrcweir else 3551cdf0e10cSrcweir { 3552cdf0e10cSrcweir DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" ); 3553cdf0e10cSrcweir m_a0degRB.Check( sal_True ); 3554cdf0e10cSrcweir } 3555cdf0e10cSrcweir m_aFitToLineCB.Check( rItem.IsFitToLine() ); 3556cdf0e10cSrcweir } 3557cdf0e10cSrcweir else 3558cdf0e10cSrcweir { 3559cdf0e10cSrcweir if( eState == SFX_ITEM_DONTCARE ) 3560cdf0e10cSrcweir { 3561cdf0e10cSrcweir m_a0degRB.Check( sal_False ); 3562cdf0e10cSrcweir m_a90degRB.Check( sal_False ); 3563cdf0e10cSrcweir m_a270degRB.Check( sal_False ); 3564cdf0e10cSrcweir } 3565cdf0e10cSrcweir else 3566cdf0e10cSrcweir m_a0degRB.Check( sal_True ); 3567cdf0e10cSrcweir 3568cdf0e10cSrcweir m_aFitToLineCB.Check( sal_False ); 3569cdf0e10cSrcweir } 3570cdf0e10cSrcweir m_aFitToLineCB.SetClickHdl( aOldLink ); 3571cdf0e10cSrcweir m_aFitToLineCB.Enable( !m_a0degRB.IsChecked() ); 3572cdf0e10cSrcweir 3573cdf0e10cSrcweir // is this value set? 3574cdf0e10cSrcweir if( SFX_ITEM_UNKNOWN == rSet.GetItemState( GetWhich( 3575cdf0e10cSrcweir SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) )) 3576cdf0e10cSrcweir m_aFitToLineCB.Hide(); 3577cdf0e10cSrcweir } 3578cdf0e10cSrcweir 3579cdf0e10cSrcweir m_aHighPosBtn.SaveValue(); 3580cdf0e10cSrcweir m_aNormalPosBtn.SaveValue(); 3581cdf0e10cSrcweir m_aLowPosBtn.SaveValue(); 3582cdf0e10cSrcweir m_a0degRB.SaveValue(); 3583cdf0e10cSrcweir m_a90degRB.SaveValue(); 3584cdf0e10cSrcweir m_a270degRB.SaveValue(); 3585cdf0e10cSrcweir m_aFitToLineCB.SaveValue(); 3586cdf0e10cSrcweir m_aScaleWidthMF.SaveValue(); 3587cdf0e10cSrcweir m_aKerningLB.SaveValue(); 3588cdf0e10cSrcweir m_aKerningEdit.SaveValue(); 3589cdf0e10cSrcweir m_aPairKerningBtn.SaveValue(); 3590cdf0e10cSrcweir } 3591cdf0e10cSrcweir 3592cdf0e10cSrcweir // ----------------------------------------------------------------------- 3593cdf0e10cSrcweir 3594cdf0e10cSrcweir sal_Bool SvxCharPositionPage::FillItemSet( SfxItemSet& rSet ) 3595cdf0e10cSrcweir { 3596cdf0e10cSrcweir // Position (hoch, normal oder tief) 3597cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 3598cdf0e10cSrcweir sal_Bool bModified = sal_False, bChanged = sal_True; 3599cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); 3600cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_ESCAPEMENT ); 3601cdf0e10cSrcweir const FASTBOOL bHigh = m_aHighPosBtn.IsChecked(); 3602cdf0e10cSrcweir short nEsc; 3603cdf0e10cSrcweir sal_uInt8 nEscProp; 3604cdf0e10cSrcweir 3605cdf0e10cSrcweir if ( bHigh || m_aLowPosBtn.IsChecked() ) 3606cdf0e10cSrcweir { 3607cdf0e10cSrcweir if ( m_aHighLowRB.IsChecked() ) 3608cdf0e10cSrcweir nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB; 3609cdf0e10cSrcweir else 3610cdf0e10cSrcweir { 3611cdf0e10cSrcweir nEsc = (short)m_aHighLowEdit.Denormalize( m_aHighLowEdit.GetValue() ); 3612cdf0e10cSrcweir nEsc *= bHigh ? 1 : -1; 3613cdf0e10cSrcweir } 3614cdf0e10cSrcweir nEscProp = (sal_uInt8)m_aFontSizeEdit.Denormalize( m_aFontSizeEdit.GetValue() ); 3615cdf0e10cSrcweir } 3616cdf0e10cSrcweir else 3617cdf0e10cSrcweir { 3618cdf0e10cSrcweir nEsc = 0; 3619cdf0e10cSrcweir nEscProp = 100; 3620cdf0e10cSrcweir } 3621cdf0e10cSrcweir 3622cdf0e10cSrcweir if ( pOld ) 3623cdf0e10cSrcweir { 3624cdf0e10cSrcweir const SvxEscapementItem& rItem = *( (const SvxEscapementItem*)pOld ); 3625cdf0e10cSrcweir if ( rItem.GetEsc() == nEsc && rItem.GetProp() == nEscProp ) 3626cdf0e10cSrcweir bChanged = sal_False; 3627cdf0e10cSrcweir } 3628cdf0e10cSrcweir 3629cdf0e10cSrcweir if ( !bChanged && !m_aHighPosBtn.GetSavedValue() && 3630cdf0e10cSrcweir !m_aNormalPosBtn.GetSavedValue() && !m_aLowPosBtn.GetSavedValue() ) 3631cdf0e10cSrcweir bChanged = sal_True; 3632cdf0e10cSrcweir 3633cdf0e10cSrcweir if ( bChanged && 3634cdf0e10cSrcweir ( m_aHighPosBtn.IsChecked() || m_aNormalPosBtn.IsChecked() || m_aLowPosBtn.IsChecked() ) ) 3635cdf0e10cSrcweir { 3636cdf0e10cSrcweir rSet.Put( SvxEscapementItem( nEsc, nEscProp, nWhich ) ); 3637cdf0e10cSrcweir bModified = sal_True; 3638cdf0e10cSrcweir } 3639cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3640cdf0e10cSrcweir CLEARTITEM; 3641cdf0e10cSrcweir 3642cdf0e10cSrcweir bChanged = sal_True; 3643cdf0e10cSrcweir 3644cdf0e10cSrcweir // Kerning 3645cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); 3646cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_CHAR_KERNING ); 3647cdf0e10cSrcweir sal_uInt16 nPos = m_aKerningLB.GetSelectEntryPos(); 3648cdf0e10cSrcweir short nKerning = 0; 3649cdf0e10cSrcweir SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); 3650cdf0e10cSrcweir 3651cdf0e10cSrcweir if ( nPos == LW_GESPERRT || nPos == LW_SCHMAL ) 3652cdf0e10cSrcweir { 3653cdf0e10cSrcweir long nTmp = static_cast<long>(m_aKerningEdit.GetValue()); 3654cdf0e10cSrcweir long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); 3655cdf0e10cSrcweir nKerning = (short)m_aKerningEdit.Denormalize( nVal ); 3656cdf0e10cSrcweir 3657cdf0e10cSrcweir if ( nPos == LW_SCHMAL ) 3658cdf0e10cSrcweir nKerning *= - 1; 3659cdf0e10cSrcweir } 3660cdf0e10cSrcweir 3661cdf0e10cSrcweir if ( pOld ) 3662cdf0e10cSrcweir { 3663cdf0e10cSrcweir const SvxKerningItem& rItem = *( (const SvxKerningItem*)pOld ); 3664cdf0e10cSrcweir if ( rItem.GetValue() == nKerning ) 3665cdf0e10cSrcweir bChanged = sal_False; 3666cdf0e10cSrcweir } 3667cdf0e10cSrcweir 3668cdf0e10cSrcweir if ( !bChanged && 3669cdf0e10cSrcweir ( m_aKerningLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND || 3670cdf0e10cSrcweir ( !m_aKerningEdit.GetSavedValue().Len() && m_aKerningEdit.IsEnabled() ) ) ) 3671cdf0e10cSrcweir bChanged = sal_True; 3672cdf0e10cSrcweir 3673cdf0e10cSrcweir if ( bChanged && nPos != LISTBOX_ENTRY_NOTFOUND ) 3674cdf0e10cSrcweir { 3675cdf0e10cSrcweir rSet.Put( SvxKerningItem( nKerning, nWhich ) ); 3676cdf0e10cSrcweir bModified |= sal_True; 3677cdf0e10cSrcweir } 3678cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3679cdf0e10cSrcweir CLEARTITEM; 3680cdf0e10cSrcweir 3681cdf0e10cSrcweir bChanged = sal_True; 3682cdf0e10cSrcweir 3683cdf0e10cSrcweir // Pair-Kerning 3684cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); 3685cdf0e10cSrcweir 3686cdf0e10cSrcweir if ( m_aPairKerningBtn.IsChecked() != m_aPairKerningBtn.GetSavedValue() ) 3687cdf0e10cSrcweir { 3688cdf0e10cSrcweir rSet.Put( SvxAutoKernItem( m_aPairKerningBtn.IsChecked(), nWhich ) ); 3689cdf0e10cSrcweir bModified |= sal_True; 3690cdf0e10cSrcweir } 3691cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3692cdf0e10cSrcweir CLEARTITEM; 3693cdf0e10cSrcweir 3694cdf0e10cSrcweir // Scale Width 3695cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); 3696cdf0e10cSrcweir if ( m_aScaleWidthMF.GetText() != m_aScaleWidthMF.GetSavedValue() ) 3697cdf0e10cSrcweir { 3698cdf0e10cSrcweir rSet.Put( SvxCharScaleWidthItem( (sal_uInt16)m_aScaleWidthMF.GetValue(), nWhich ) ); 3699cdf0e10cSrcweir bModified |= sal_True; 3700cdf0e10cSrcweir } 3701cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3702cdf0e10cSrcweir CLEARTITEM; 3703cdf0e10cSrcweir 3704cdf0e10cSrcweir // Rotation 3705cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); 3706cdf0e10cSrcweir if ( m_a0degRB .IsChecked() != m_a0degRB .GetSavedValue() || 3707cdf0e10cSrcweir m_a90degRB .IsChecked() != m_a90degRB .GetSavedValue() || 3708cdf0e10cSrcweir m_a270degRB .IsChecked() != m_a270degRB .GetSavedValue() || 3709cdf0e10cSrcweir m_aFitToLineCB.IsChecked() != m_aFitToLineCB.GetSavedValue() ) 3710cdf0e10cSrcweir { 3711cdf0e10cSrcweir SvxCharRotateItem aItem( 0, m_aFitToLineCB.IsChecked(), nWhich ); 3712cdf0e10cSrcweir if (m_a90degRB.IsChecked()) 3713cdf0e10cSrcweir aItem.SetBottomToTop(); 3714cdf0e10cSrcweir else if (m_a270degRB.IsChecked()) 3715cdf0e10cSrcweir aItem.SetTopToBotton(); 3716cdf0e10cSrcweir rSet.Put( aItem ); 3717cdf0e10cSrcweir bModified |= sal_True; 3718cdf0e10cSrcweir } 3719cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3720cdf0e10cSrcweir CLEARTITEM; 3721cdf0e10cSrcweir 3722cdf0e10cSrcweir return bModified; 3723cdf0e10cSrcweir } 3724cdf0e10cSrcweir 3725cdf0e10cSrcweir // ----------------------------------------------------------------------- 3726cdf0e10cSrcweir 3727cdf0e10cSrcweir void SvxCharPositionPage::FillUserData() 3728cdf0e10cSrcweir { 3729cdf0e10cSrcweir const sal_Unicode cTok = ';'; 3730cdf0e10cSrcweir 3731cdf0e10cSrcweir String sUser( UniString::CreateFromInt32( m_nSuperEsc ) ); 3732cdf0e10cSrcweir sUser.Append( cTok ); 3733cdf0e10cSrcweir sUser.Append( UniString::CreateFromInt32( m_nSubEsc ) ); 3734cdf0e10cSrcweir sUser.Append( cTok ); 3735cdf0e10cSrcweir sUser.Append( UniString::CreateFromInt32( m_nSuperProp ) ); 3736cdf0e10cSrcweir sUser.Append( cTok ); 3737cdf0e10cSrcweir sUser.Append( UniString::CreateFromInt32( m_nSubProp ) ); 3738cdf0e10cSrcweir SetUserData( sUser ); 3739cdf0e10cSrcweir } 3740cdf0e10cSrcweir 3741cdf0e10cSrcweir // ----------------------------------------------------------------------- 3742cdf0e10cSrcweir void SvxCharPositionPage::SetPreviewBackgroundToCharacter() 3743cdf0e10cSrcweir { 3744cdf0e10cSrcweir m_bPreviewBackgroundToCharacter = sal_True; 3745cdf0e10cSrcweir } 3746cdf0e10cSrcweir // ----------------------------------------------------------------------- 3747cdf0e10cSrcweir void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 3748cdf0e10cSrcweir { 3749cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 3750cdf0e10cSrcweir if (pFlagItem) 3751cdf0e10cSrcweir { 3752cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 3753cdf0e10cSrcweir if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) 3754cdf0e10cSrcweir SetPreviewBackgroundToCharacter(); 3755cdf0e10cSrcweir } 3756cdf0e10cSrcweir } 3757cdf0e10cSrcweir // class SvxCharTwoLinesPage ------------------------------------------------ 3758cdf0e10cSrcweir 3759cdf0e10cSrcweir SvxCharTwoLinesPage::SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rInSet ) : 3760cdf0e10cSrcweir 3761cdf0e10cSrcweir SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_TWOLINES ), rInSet, WIN_TWOLINES_PREVIEW, FT_TWOLINES_FONTTYPE ), 3762cdf0e10cSrcweir 3763cdf0e10cSrcweir m_aSwitchOnLine ( this, CUI_RES( FL_SWITCHON ) ), 3764cdf0e10cSrcweir m_aTwoLinesBtn ( this, CUI_RES( CB_TWOLINES ) ), 3765cdf0e10cSrcweir 3766cdf0e10cSrcweir m_aEncloseLine ( this, CUI_RES( FL_ENCLOSE ) ), 3767cdf0e10cSrcweir m_aStartBracketFT ( this, CUI_RES( FT_STARTBRACKET ) ), 3768cdf0e10cSrcweir m_aStartBracketLB ( this, CUI_RES( ED_STARTBRACKET ) ), 3769cdf0e10cSrcweir m_aEndBracketFT ( this, CUI_RES( FT_ENDBRACKET ) ), 3770cdf0e10cSrcweir m_aEndBracketLB ( this, CUI_RES( ED_ENDBRACKET ) ), 3771cdf0e10cSrcweir m_nStartBracketPosition( 0 ), 3772cdf0e10cSrcweir m_nEndBracketPosition( 0 ) 3773cdf0e10cSrcweir { 3774cdf0e10cSrcweir FreeResource(); 3775cdf0e10cSrcweir Initialize(); 3776cdf0e10cSrcweir } 3777cdf0e10cSrcweir 3778cdf0e10cSrcweir // ----------------------------------------------------------------------- 3779cdf0e10cSrcweir 3780cdf0e10cSrcweir void SvxCharTwoLinesPage::Initialize() 3781cdf0e10cSrcweir { 3782cdf0e10cSrcweir Size aSize = m_aStartBracketLB.GetSizePixel(); 3783cdf0e10cSrcweir aSize.Height() = m_aStartBracketLB.CalcSize( 1, 6 ).Height(); 3784cdf0e10cSrcweir m_aStartBracketLB.SetSizePixel( aSize ); 3785cdf0e10cSrcweir aSize = m_aEndBracketLB.GetSizePixel(); 3786cdf0e10cSrcweir aSize.Height() = m_aEndBracketLB.CalcSize( 1, 6 ).Height(); 3787cdf0e10cSrcweir m_aEndBracketLB.SetSizePixel( aSize ); 3788cdf0e10cSrcweir 3789cdf0e10cSrcweir m_aTwoLinesBtn.Check( sal_False ); 3790cdf0e10cSrcweir TwoLinesHdl_Impl( NULL ); 3791cdf0e10cSrcweir 3792cdf0e10cSrcweir m_aTwoLinesBtn.SetClickHdl( LINK( this, SvxCharTwoLinesPage, TwoLinesHdl_Impl ) ); 3793cdf0e10cSrcweir 3794cdf0e10cSrcweir Link aLink = LINK( this, SvxCharTwoLinesPage, CharacterMapHdl_Impl ); 3795cdf0e10cSrcweir m_aStartBracketLB.SetSelectHdl( aLink ); 3796cdf0e10cSrcweir m_aEndBracketLB.SetSelectHdl( aLink ); 3797cdf0e10cSrcweir 3798cdf0e10cSrcweir SvxFont& rFont = GetPreviewFont(); 3799cdf0e10cSrcweir SvxFont& rCJKFont = GetPreviewCJKFont(); 3800cdf0e10cSrcweir SvxFont& rCTLFont = GetPreviewCTLFont(); 3801cdf0e10cSrcweir rFont.SetSize( Size( 0, 220 ) ); 3802cdf0e10cSrcweir rCJKFont.SetSize( Size( 0, 220 ) ); 3803cdf0e10cSrcweir rCTLFont.SetSize( Size( 0, 220 ) ); 3804cdf0e10cSrcweir } 3805cdf0e10cSrcweir 3806cdf0e10cSrcweir // ----------------------------------------------------------------------- 3807cdf0e10cSrcweir 3808cdf0e10cSrcweir void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox ) 3809cdf0e10cSrcweir { 3810cdf0e10cSrcweir //CHINA001 SvxCharacterMap aDlg( this ); 3811cdf0e10cSrcweir bool bStart = pBox == &m_aStartBracketLB; 3812cdf0e10cSrcweir //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 3813cdf0e10cSrcweir //if(pFact) 3814cdf0e10cSrcweir { 3815cdf0e10cSrcweir //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP ); 3816cdf0e10cSrcweir SvxCharacterMap* aDlg = new SvxCharacterMap( this ); 3817cdf0e10cSrcweir aDlg->DisableFontSelection();//CHINA001 aDlg.DisableFontSelection(); 3818cdf0e10cSrcweir 3819cdf0e10cSrcweir if ( aDlg->Execute() == RET_OK )//CHINA001 ( aDlg.Execute() == RET_OK ) 3820cdf0e10cSrcweir { 3821cdf0e10cSrcweir sal_Unicode cChar = (sal_Unicode) aDlg->GetChar();//CHINA001 aDlg.GetChar(); 3822cdf0e10cSrcweir SetBracket( cChar, bStart ); 3823cdf0e10cSrcweir } 3824cdf0e10cSrcweir else 3825cdf0e10cSrcweir { 3826cdf0e10cSrcweir pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition ); 3827cdf0e10cSrcweir } 3828cdf0e10cSrcweir delete aDlg; //add CHINA001 3829cdf0e10cSrcweir } 3830cdf0e10cSrcweir } 3831cdf0e10cSrcweir 3832cdf0e10cSrcweir // ----------------------------------------------------------------------- 3833cdf0e10cSrcweir 3834cdf0e10cSrcweir void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, sal_Bool bStart ) 3835cdf0e10cSrcweir { 3836cdf0e10cSrcweir sal_uInt16 nEntryPos = 0; 3837cdf0e10cSrcweir ListBox* pBox = bStart ? &m_aStartBracketLB : &m_aEndBracketLB; 3838cdf0e10cSrcweir if ( 0 == cBracket ) 3839cdf0e10cSrcweir pBox->SelectEntryPos(0); 3840cdf0e10cSrcweir else 3841cdf0e10cSrcweir { 3842cdf0e10cSrcweir FASTBOOL bFound = sal_False; 3843cdf0e10cSrcweir for ( sal_uInt16 i = 1; i < pBox->GetEntryCount(); ++i ) 3844cdf0e10cSrcweir { 3845cdf0e10cSrcweir if ( (sal_uLong)pBox->GetEntryData(i) != CHRDLG_ENCLOSE_SPECIAL_CHAR ) 3846cdf0e10cSrcweir { 3847cdf0e10cSrcweir const sal_Unicode cChar = pBox->GetEntry(i).GetChar(0); 3848cdf0e10cSrcweir if ( cChar == cBracket ) 3849cdf0e10cSrcweir { 3850cdf0e10cSrcweir pBox->SelectEntryPos(i); 3851cdf0e10cSrcweir nEntryPos = i; 3852cdf0e10cSrcweir bFound = sal_True; 3853cdf0e10cSrcweir break; 3854cdf0e10cSrcweir } 3855cdf0e10cSrcweir } 3856cdf0e10cSrcweir } 3857cdf0e10cSrcweir 3858cdf0e10cSrcweir if ( !bFound ) 3859cdf0e10cSrcweir { 3860cdf0e10cSrcweir nEntryPos = pBox->InsertEntry( String( cBracket ) ); 3861cdf0e10cSrcweir pBox->SelectEntryPos( nEntryPos ); 3862cdf0e10cSrcweir } 3863cdf0e10cSrcweir } 3864cdf0e10cSrcweir if( bStart ) 3865cdf0e10cSrcweir m_nStartBracketPosition = nEntryPos; 3866cdf0e10cSrcweir else 3867cdf0e10cSrcweir m_nEndBracketPosition = nEntryPos; 3868cdf0e10cSrcweir } 3869cdf0e10cSrcweir 3870cdf0e10cSrcweir // ----------------------------------------------------------------------- 3871cdf0e10cSrcweir 3872cdf0e10cSrcweir IMPL_LINK( SvxCharTwoLinesPage, TwoLinesHdl_Impl, CheckBox*, EMPTYARG ) 3873cdf0e10cSrcweir { 3874cdf0e10cSrcweir sal_Bool bChecked = m_aTwoLinesBtn.IsChecked(); 3875cdf0e10cSrcweir m_aStartBracketFT.Enable( bChecked ); 3876cdf0e10cSrcweir m_aStartBracketLB.Enable( bChecked ); 3877cdf0e10cSrcweir m_aEndBracketFT.Enable( bChecked ); 3878cdf0e10cSrcweir m_aEndBracketLB.Enable( bChecked ); 3879cdf0e10cSrcweir 3880cdf0e10cSrcweir UpdatePreview_Impl(); 3881cdf0e10cSrcweir return 0; 3882cdf0e10cSrcweir } 3883cdf0e10cSrcweir 3884cdf0e10cSrcweir // ----------------------------------------------------------------------- 3885cdf0e10cSrcweir 3886cdf0e10cSrcweir IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox*, pBox ) 3887cdf0e10cSrcweir { 3888cdf0e10cSrcweir sal_uInt16 nPos = pBox->GetSelectEntryPos(); 3889cdf0e10cSrcweir if ( CHRDLG_ENCLOSE_SPECIAL_CHAR == (sal_uLong)pBox->GetEntryData( nPos ) ) 3890cdf0e10cSrcweir SelectCharacter( pBox ); 3891cdf0e10cSrcweir else 3892cdf0e10cSrcweir { 3893cdf0e10cSrcweir bool bStart = pBox == &m_aStartBracketLB; 3894cdf0e10cSrcweir if( bStart ) 3895cdf0e10cSrcweir m_nStartBracketPosition = nPos; 3896cdf0e10cSrcweir else 3897cdf0e10cSrcweir m_nEndBracketPosition = nPos; 3898cdf0e10cSrcweir } 3899cdf0e10cSrcweir UpdatePreview_Impl(); 3900cdf0e10cSrcweir return 0; 3901cdf0e10cSrcweir } 3902cdf0e10cSrcweir 3903cdf0e10cSrcweir // ----------------------------------------------------------------------- 3904cdf0e10cSrcweir 3905cdf0e10cSrcweir void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet& rSet ) 3906cdf0e10cSrcweir { 3907cdf0e10cSrcweir SvxCharBasePage::ActivatePage( rSet ); 3908cdf0e10cSrcweir } 3909cdf0e10cSrcweir 3910cdf0e10cSrcweir // ----------------------------------------------------------------------- 3911cdf0e10cSrcweir 3912cdf0e10cSrcweir int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet ) 3913cdf0e10cSrcweir { 3914cdf0e10cSrcweir if ( _pSet ) 3915cdf0e10cSrcweir FillItemSet( *_pSet ); 3916cdf0e10cSrcweir return LEAVE_PAGE; 3917cdf0e10cSrcweir } 3918cdf0e10cSrcweir 3919cdf0e10cSrcweir // ----------------------------------------------------------------------- 3920cdf0e10cSrcweir 3921cdf0e10cSrcweir SfxTabPage* SvxCharTwoLinesPage::Create( Window* pParent, const SfxItemSet& rSet ) 3922cdf0e10cSrcweir { 3923cdf0e10cSrcweir return new SvxCharTwoLinesPage( pParent, rSet ); 3924cdf0e10cSrcweir } 3925cdf0e10cSrcweir 3926cdf0e10cSrcweir // ----------------------------------------------------------------------- 3927cdf0e10cSrcweir 3928cdf0e10cSrcweir sal_uInt16* SvxCharTwoLinesPage::GetRanges() 3929cdf0e10cSrcweir { 3930cdf0e10cSrcweir return pTwoLinesRanges; 3931cdf0e10cSrcweir } 3932cdf0e10cSrcweir 3933cdf0e10cSrcweir // ----------------------------------------------------------------------- 3934cdf0e10cSrcweir 3935cdf0e10cSrcweir void SvxCharTwoLinesPage::Reset( const SfxItemSet& rSet ) 3936cdf0e10cSrcweir { 3937cdf0e10cSrcweir m_aTwoLinesBtn.Check( sal_False ); 3938cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); 3939cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich ); 3940cdf0e10cSrcweir 3941cdf0e10cSrcweir if ( eState >= SFX_ITEM_DONTCARE ) 3942cdf0e10cSrcweir { 3943cdf0e10cSrcweir const SvxTwoLinesItem& rItem = (SvxTwoLinesItem&)rSet.Get( nWhich ); 3944cdf0e10cSrcweir m_aTwoLinesBtn.Check( rItem.GetValue() ); 3945cdf0e10cSrcweir 3946cdf0e10cSrcweir if ( rItem.GetValue() ) 3947cdf0e10cSrcweir { 3948cdf0e10cSrcweir SetBracket( rItem.GetStartBracket(), sal_True ); 3949cdf0e10cSrcweir SetBracket( rItem.GetEndBracket(), sal_False ); 3950cdf0e10cSrcweir } 3951cdf0e10cSrcweir } 3952cdf0e10cSrcweir TwoLinesHdl_Impl( NULL ); 3953cdf0e10cSrcweir 3954cdf0e10cSrcweir SetPrevFontWidthScale( rSet ); 3955cdf0e10cSrcweir } 3956cdf0e10cSrcweir 3957cdf0e10cSrcweir // ----------------------------------------------------------------------- 3958cdf0e10cSrcweir 3959cdf0e10cSrcweir sal_Bool SvxCharTwoLinesPage::FillItemSet( SfxItemSet& rSet ) 3960cdf0e10cSrcweir { 3961cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 3962cdf0e10cSrcweir sal_Bool bModified = sal_False, bChanged = sal_True; 3963cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); 3964cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_TWO_LINES ); 3965cdf0e10cSrcweir sal_Bool bOn = m_aTwoLinesBtn.IsChecked(); 3966cdf0e10cSrcweir sal_Unicode cStart = ( bOn && m_aStartBracketLB.GetSelectEntryPos() > 0 ) 3967cdf0e10cSrcweir ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; 3968cdf0e10cSrcweir sal_Unicode cEnd = ( bOn && m_aEndBracketLB.GetSelectEntryPos() > 0 ) 3969cdf0e10cSrcweir ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; 3970cdf0e10cSrcweir 3971cdf0e10cSrcweir if ( pOld ) 3972cdf0e10cSrcweir { 3973cdf0e10cSrcweir const SvxTwoLinesItem& rItem = *( (const SvxTwoLinesItem*)pOld ); 3974cdf0e10cSrcweir if ( rItem.GetValue() == bOn && 3975cdf0e10cSrcweir ( !bOn || ( rItem.GetStartBracket() == cStart && rItem.GetEndBracket() == cEnd ) ) ) 3976cdf0e10cSrcweir bChanged = sal_False; 3977cdf0e10cSrcweir } 3978cdf0e10cSrcweir 3979cdf0e10cSrcweir if ( bChanged ) 3980cdf0e10cSrcweir { 3981cdf0e10cSrcweir rSet.Put( SvxTwoLinesItem( bOn, cStart, cEnd, nWhich ) ); 3982cdf0e10cSrcweir bModified |= sal_True; 3983cdf0e10cSrcweir } 3984cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 3985cdf0e10cSrcweir CLEARTITEM; 3986cdf0e10cSrcweir 3987cdf0e10cSrcweir return bModified; 3988cdf0e10cSrcweir } 3989cdf0e10cSrcweir /* -----------------------------04.12.00 09:48-------------------------------- 3990cdf0e10cSrcweir 3991cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 3992cdf0e10cSrcweir void SvxCharTwoLinesPage::UpdatePreview_Impl() 3993cdf0e10cSrcweir { 3994cdf0e10cSrcweir sal_Unicode cStart = m_aStartBracketLB.GetSelectEntryPos() > 0 3995cdf0e10cSrcweir ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; 3996cdf0e10cSrcweir sal_Unicode cEnd = m_aEndBracketLB.GetSelectEntryPos() > 0 3997cdf0e10cSrcweir ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; 3998cdf0e10cSrcweir m_aPreviewWin.SetBrackets(cStart, cEnd); 3999cdf0e10cSrcweir m_aPreviewWin.SetTwoLines(m_aTwoLinesBtn.IsChecked()); 4000cdf0e10cSrcweir m_aPreviewWin.Invalidate(); 4001cdf0e10cSrcweir } 4002cdf0e10cSrcweir // ----------------------------------------------------------------------- 4003cdf0e10cSrcweir void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter() 4004cdf0e10cSrcweir { 4005cdf0e10cSrcweir m_bPreviewBackgroundToCharacter = sal_True; 4006cdf0e10cSrcweir } 4007cdf0e10cSrcweir 4008cdf0e10cSrcweir // ----------------------------------------------------------------------- 4009cdf0e10cSrcweir void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 4010cdf0e10cSrcweir { 4011cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 4012cdf0e10cSrcweir if (pFlagItem) 4013cdf0e10cSrcweir { 4014cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 4015cdf0e10cSrcweir if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) 4016cdf0e10cSrcweir SetPreviewBackgroundToCharacter(); 4017cdf0e10cSrcweir } 4018cdf0e10cSrcweir } 4019