LCOV - code coverage report
Current view: top level - cui/source/tabpages - chardlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2032 0.0 %
Date: 2012-08-25 Functions: 0 119 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 3227 0.0 %

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

Generated by: LCOV version 1.10