LCOV - code coverage report
Current view: top level - svx/source/sidebar/text - TextCharacterSpacingControl.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 291 0.3 %
Date: 2015-06-13 12:38:46 Functions: 2 14 14.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "TextCharacterSpacingControl.hxx"
      20             : #include "TextPropertyPanel.hrc"
      21             : #include <sfx2/sidebar/ResourceDefinitions.hrc>
      22             : #include <svx/dialogs.hrc>
      23             : #include <svx/dialmgr.hxx>
      24             : #include <unotools/viewoptions.hxx>
      25             : #include <editeng/kernitem.hxx>
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <sfx2/sidebar/Theme.hxx>
      28             : #include <vcl/settings.hxx>
      29             : 
      30             : namespace svx { namespace sidebar {
      31             : 
      32           0 : TextCharacterSpacingControl::TextCharacterSpacingControl (
      33             :     vcl::Window* pParent,
      34             :     svx::sidebar::TextPropertyPanel& rPanel,
      35             :     SfxBindings* pBindings)
      36           0 : :   PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING))
      37             : ,   mrTextPropertyPanel(rPanel)
      38             : ,   mpBindings(pBindings)
      39           0 : ,   maVSSpacing     (VclPtr<ValueSetWithTextControl>::Create(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING)))
      40           0 : ,   maLastCus       (VclPtr<FixedText>::Create(this, SVX_RES(FT_LASTCUSTOM)))
      41             : //, maBorder        (this, SVX_RES(CT_BORDER))
      42           0 : ,   maFTSpacing     (VclPtr<FixedText>::Create(this, SVX_RES(FT_SPACING)))
      43           0 : ,   maLBKerning     (VclPtr<ListBox>::Create(this, SVX_RES(LB_KERNING)))
      44           0 : ,   maFTBy          (VclPtr<FixedText>::Create(this, SVX_RES(FT_BY)))
      45           0 : ,   maEditKerning   (VclPtr<MetricField>::Create(this, SVX_RES(ED_KERNING)))
      46             : 
      47             : ,   mpImg           (NULL)
      48             : ,   mpImgSel        (NULL)
      49             : ,   mpStr           (NULL)
      50             : ,   mpStrTip        (NULL)
      51             : 
      52           0 : ,   maImgCus        (SVX_RES(IMG_CUSTOM))
      53           0 : ,   maImgCusGrey    (SVX_RES(IMG_CUSTOM_GRAY))
      54           0 : ,   maStrCus        (SVX_RESSTR(STR_CUSTOM))
      55           0 : ,   maStrCusE       (SVX_RESSTR(STR_CUSTOM_E_TIP)) //add
      56           0 : ,   maStrCusC       (SVX_RESSTR(STR_CUSTOM_C_TIP)) //add
      57           0 : ,   maStrCusN       (SVX_RESSTR(STR_NORMAL_TIP))   //add
      58           0 : ,   maStrUnit       (SVX_RESSTR(STR_PT))           //add
      59             : 
      60             : ,   mnCustomKern(0)
      61             : ,   mnLastCus ( SPACING_NOCUSTOM )
      62             : ,   mbCusEnable(false)
      63           0 : ,   mbVS(true)
      64             : {
      65           0 :     initial();
      66           0 :     FreeResource();
      67           0 :     Link<> aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl);
      68           0 :     maLBKerning->SetSelectHdl(aLink);
      69           0 :     aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl);
      70           0 :     maEditKerning->SetModifyHdl(aLink);
      71             : 
      72           0 : }
      73             : 
      74           0 : TextCharacterSpacingControl::~TextCharacterSpacingControl()
      75             : {
      76           0 :     disposeOnce();
      77           0 : }
      78             : 
      79           0 : void TextCharacterSpacingControl::dispose()
      80             : {
      81           0 :     delete[] mpImg;
      82           0 :     delete[] mpImgSel;
      83           0 :     delete[] mpStr;
      84           0 :     delete[] mpStrTip;
      85           0 :     maVSSpacing.disposeAndClear();
      86           0 :     maLastCus.disposeAndClear();
      87           0 :     maFTSpacing.disposeAndClear();
      88           0 :     maLBKerning.disposeAndClear();
      89           0 :     maFTBy.disposeAndClear();
      90           0 :     maEditKerning.disposeAndClear();
      91           0 :     svx::sidebar::PopupControl::dispose();
      92           0 : }
      93             : 
      94           0 : void TextCharacterSpacingControl::initial()
      95             : {
      96           0 :     maVSSpacing->SetStyle( maVSSpacing->GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );
      97             :     {
      98           0 :         maVSSpacing->SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
      99           0 :         GetSettings().GetStyleSettings().GetMenuColor():
     100           0 :         sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
     101           0 :         maVSSpacing->SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
     102           0 :         GetSettings().GetStyleSettings().GetMenuColor():
     103           0 :         sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
     104           0 :         maVSSpacing->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
     105           0 :         GetSettings().GetStyleSettings().GetMenuColor():
     106           0 :         sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
     107           0 :         maFTSpacing->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
     108           0 :         GetSettings().GetStyleSettings().GetMenuColor():
     109           0 :         sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
     110           0 :         maFTBy->SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
     111           0 :         GetSettings().GetStyleSettings().GetMenuColor():
     112           0 :         sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
     113             :     }
     114           0 :     mpImg = new Image[5];
     115           0 :     mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT));
     116           0 :     mpImg[1] = Image(SVX_RES(IMG_TIGHT));
     117           0 :     mpImg[2] = Image(SVX_RES(IMG_NORMAL));
     118           0 :     mpImg[3] = Image(SVX_RES(IMG_LOOSE));
     119           0 :     mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE));
     120             : 
     121           0 :     mpImgSel = new Image[5];
     122           0 :     mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S));
     123           0 :     mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S));
     124           0 :     mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S));
     125           0 :     mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S));
     126           0 :     mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S));
     127             : 
     128           0 :     mpStr = new OUString[5];
     129           0 :     mpStr[0] = SVX_RESSTR(STR_VERY_TIGHT);
     130           0 :     mpStr[1] = SVX_RESSTR(STR_TIGHT);
     131           0 :     mpStr[2] = SVX_RESSTR(STR_NORMAL);
     132           0 :     mpStr[3] = SVX_RESSTR(STR_LOOSE);
     133           0 :     mpStr[4] = SVX_RESSTR(STR_VERY_LOOSE);
     134             : 
     135             : 
     136           0 :     mpStrTip = new OUString[5];
     137           0 :     mpStrTip[0] = SVX_RESSTR(STR_VERY_TIGHT_TIP);
     138           0 :     mpStrTip[1] = SVX_RESSTR(STR_TIGHT_TIP);
     139           0 :     mpStrTip[2] = SVX_RESSTR(STR_NORMAL_TIP);
     140           0 :     mpStrTip[3] = SVX_RESSTR(STR_LOOSE_TIP);
     141           0 :     mpStrTip[4] = SVX_RESSTR(STR_VERY_LOOSE_TIP);
     142             : 
     143           0 :     for (int i=0;i<5;i++)
     144           0 :         maVSSpacing->AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
     145             : 
     146           0 :     maVSSpacing->AddItem( maImgCus, 0, maStrCus, 0 );
     147             : 
     148           0 :     maVSSpacing->SetNoSelection();
     149           0 :     Link<> aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl );
     150           0 :     maVSSpacing->SetSelectHdl(aLink);
     151           0 :     maVSSpacing->StartSelection();
     152           0 :     maVSSpacing->Show();
     153           0 : }
     154             : 
     155           0 : void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning)
     156             : {
     157           0 :     mbVS = true;
     158           0 :     maVSSpacing->SetNoSelection();
     159           0 :     SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
     160           0 :     if ( aWinOpt.Exists() )
     161             :     {
     162           0 :         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
     163           0 :         ::rtl::OUString aTmp;
     164           0 :         if ( aSeq.getLength())
     165           0 :             aSeq[0].Value >>= aTmp;
     166             : 
     167           0 :         OUString aWinData( aTmp );
     168           0 :         mnCustomKern = aWinData.toInt32();
     169           0 :         mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
     170           0 :         mbCusEnable = true;
     171             :     }
     172             :     else
     173             :     {
     174           0 :         mnLastCus = SPACING_NOCUSTOM;
     175           0 :         mbCusEnable = false;
     176             :     }
     177             : 
     178           0 :     if( !mnLastCus )
     179             :     {
     180           0 :         maVSSpacing->ReplaceItemImages(6, maImgCusGrey,0);
     181             :     }
     182             :     else
     183             :     {
     184             :         //set custom tips
     185           0 :         maVSSpacing->ReplaceItemImages(6, maImgCus,0);
     186           0 :         if(mnCustomKern > 0)
     187             :         {
     188           0 :             OUString aStrTip( maStrCusE);   //LAST CUSTOM no tip defect //add
     189           0 :             aStrTip += OUString::number( (double)mnCustomKern / 10);
     190           0 :             aStrTip += " " + maStrUnit;      // modify
     191           0 :             maVSSpacing->SetItemText(6,aStrTip);
     192             :         }
     193           0 :         else if(mnCustomKern < 0)
     194             :         {
     195           0 :             OUString aStrTip(maStrCusC) ;     //LAST CUSTOM no tip defect //add
     196           0 :             aStrTip += OUString::number( (double)-mnCustomKern / 10);
     197           0 :             aStrTip += " " + maStrUnit;      // modify
     198           0 :             maVSSpacing->SetItemText( 6, aStrTip );
     199             :         }
     200             :         else
     201             :         {
     202           0 :             OUString aStrTip(maStrCusN) ;     //LAST CUSTOM no tip defect //add
     203           0 :             maVSSpacing->SetItemText( 6, aStrTip );
     204             :         }
     205             : 
     206             :     }
     207             : 
     208           0 :     if(bLBAvailable && bAvailable)
     209             :     {
     210           0 :         maLBKerning->Enable();
     211           0 :         maFTSpacing->Enable();
     212             : 
     213           0 :         SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
     214           0 :         MapUnit eOrgUnit = (MapUnit)eUnit;
     215           0 :         MapUnit ePntUnit( MAP_POINT );
     216           0 :         long nBig = maEditKerning->Normalize(nKerning);
     217           0 :         nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
     218             : 
     219           0 :         if ( nKerning > 0 )
     220             :         {
     221           0 :             maFTBy->Enable();
     222           0 :             maEditKerning->Enable();
     223           0 :             maEditKerning->SetMax( 9999 );
     224           0 :             maEditKerning->SetLast( 9999 );
     225           0 :             maEditKerning->SetValue( nKerning );
     226           0 :             maLBKerning->SelectEntryPos( SIDEBAR_SPACE_EXPAND );
     227           0 :             if(nKerning == 30)
     228             :             {
     229           0 :                 maVSSpacing->SelectItem(4);
     230             :             }
     231           0 :             else if(nKerning == 60)
     232             :             {
     233           0 :                 maVSSpacing->SelectItem(5);
     234             :             }
     235             :             else
     236             :             {
     237           0 :                 maVSSpacing->SetNoSelection();
     238           0 :                 maVSSpacing->SelectItem(0);
     239           0 :                 mbVS = false;
     240             :             }
     241             :         }
     242           0 :         else if ( nKerning < 0 )
     243             :         {
     244           0 :             maFTBy->Enable();
     245           0 :             maEditKerning->Enable();
     246           0 :             maEditKerning->SetValue( -nKerning );
     247           0 :             maLBKerning->SelectEntryPos( SIDEBAR_SPACE_CONDENSED );
     248           0 :             long nMax = mrTextPropertyPanel.GetSelFontSize()/6;
     249           0 :             maEditKerning->SetMax( maEditKerning->Normalize( nMax ), FUNIT_POINT );
     250           0 :             maEditKerning->SetLast( maEditKerning->GetMax( maEditKerning->GetUnit() ) );
     251           0 :             if( nKerning == -30 )
     252             :             {
     253           0 :                 maVSSpacing->SelectItem(1);
     254             :             }
     255           0 :             else if( nKerning == -15 )
     256             :             {
     257           0 :                 maVSSpacing->SelectItem(2);
     258             :             }
     259             :             else
     260             :             {
     261           0 :                 maVSSpacing->SetNoSelection();
     262           0 :                 maVSSpacing->SelectItem(0);
     263           0 :                 mbVS = false;
     264             :             }
     265             :         }
     266             :         else
     267             :         {
     268           0 :             maVSSpacing->SelectItem(3);
     269           0 :             maLBKerning->SelectEntryPos( SIDEBAR_SPACE_NORMAL );
     270           0 :             maFTBy->Disable();
     271           0 :             maEditKerning->Disable();
     272           0 :             maEditKerning->SetValue( 0 );
     273           0 :             maEditKerning->SetMax( 9999 );
     274           0 :             maEditKerning->SetLast( 9999 );
     275           0 :         }
     276             :     }
     277           0 :     else if(bLBAvailable && !bAvailable)
     278             :     {
     279             :         //modified
     280           0 :         maVSSpacing->SetNoSelection();
     281           0 :         maVSSpacing->SelectItem(0);
     282           0 :         mbVS = false;
     283           0 :         maLBKerning->Enable();
     284           0 :         maFTSpacing->Enable();
     285           0 :         maLBKerning->SetNoSelection();
     286           0 :         maEditKerning->SetText(OUString());
     287           0 :         maEditKerning->Disable();
     288           0 :         maFTBy->Disable();
     289             :     }
     290             :     else
     291             :     {
     292           0 :         maVSSpacing->SetNoSelection();
     293           0 :         maVSSpacing->SelectItem(0);
     294           0 :         mbVS = false;
     295           0 :         maEditKerning->SetText(OUString());
     296           0 :         maLBKerning->SetNoSelection();
     297           0 :         maLBKerning->Disable();
     298           0 :         maFTSpacing->Disable();
     299           0 :         maEditKerning->Disable();
     300           0 :         maFTBy->Disable();
     301             :     }
     302           0 :     GetFocus();
     303           0 :     maVSSpacing->SetFormat();
     304           0 :     maVSSpacing->Invalidate();
     305           0 :     maVSSpacing->StartSelection();
     306           0 : }
     307           0 : IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
     308             : {
     309           0 :     mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     310             : 
     311           0 :     if(pControl == maVSSpacing.get())
     312             :     {
     313           0 :         sal_uInt16 iPos = maVSSpacing->GetSelectItemId();
     314           0 :         short nKern = 0;
     315           0 :         SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
     316           0 :         long nVal = 0;
     317           0 :         if(iPos == 1)
     318             :         {
     319           0 :             nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
     320           0 :             nKern = (short)maEditKerning->Denormalize(nVal);
     321           0 :             SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
     322           0 :             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     323           0 :             mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     324             :         }
     325           0 :         else if(iPos == 2)
     326             :         {
     327           0 :             nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit);
     328           0 :             nKern = (short)maEditKerning->Denormalize(nVal);
     329           0 :             SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
     330           0 :             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     331           0 :             mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     332             :         }
     333           0 :         else if(iPos == 3)
     334             :         {
     335           0 :             SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING);
     336           0 :             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     337           0 :             mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     338             :         }
     339           0 :         else if(iPos == 4)
     340             :         {
     341           0 :             nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
     342           0 :             nKern = (short)maEditKerning->Denormalize(nVal);
     343           0 :             SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
     344           0 :             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     345           0 :             mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     346             :         }
     347           0 :         else if(iPos == 5)
     348             :         {
     349           0 :             nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit);
     350           0 :             nKern = (short)maEditKerning->Denormalize(nVal);
     351           0 :             SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
     352           0 :             mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     353           0 :             mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     354             :         }
     355           0 :         else if(iPos == 6)
     356             :         {
     357             :             //modified
     358           0 :             if(mbCusEnable)
     359             :             {
     360           0 :                 nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit);
     361           0 :                 nKern = (short)maEditKerning->Denormalize(nVal);
     362           0 :                 SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING);
     363           0 :                 mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     364           0 :                 mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
     365             :             }
     366             :             else
     367             :             {
     368           0 :                 maVSSpacing->SetNoSelection();       //add , set no selection and keep the last select item
     369           0 :                 maVSSpacing->SetFormat();
     370           0 :                 maVSSpacing->Invalidate();
     371           0 :                 Invalidate();
     372           0 :                 maVSSpacing->StartSelection();
     373             :             }
     374             :             //modify end
     375             :         }
     376             : 
     377           0 :         if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add
     378           0 :             mrTextPropertyPanel.EndSpacingPopupMode();
     379             :     }
     380             : 
     381             : 
     382             : 
     383           0 :     return 0;
     384             : }
     385             : 
     386           0 : IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*,)
     387             : {
     388           0 :     if ( maLBKerning->GetSelectEntryPos() > 0 )
     389             :     {
     390           0 :         maFTBy->Enable();
     391           0 :         maEditKerning->Enable();
     392             :     }
     393             :     else
     394             :     {
     395           0 :         maEditKerning->SetValue( 0 );
     396           0 :         maFTBy->Disable();
     397           0 :         maEditKerning->Disable();
     398             :     }
     399             : 
     400           0 :     if ( maVSSpacing->GetSelectItemId() > 0 )
     401             :     {
     402           0 :         maVSSpacing->SetNoSelection();
     403           0 :         maVSSpacing->SelectItem(0);
     404           0 :         maVSSpacing->SetFormat();
     405           0 :         maVSSpacing->Invalidate();
     406           0 :         Invalidate();
     407           0 :         maVSSpacing->StartSelection();
     408             :     }
     409           0 :     KerningModifyHdl( NULL );
     410           0 :     return 0;
     411             : }
     412           0 : IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*,)
     413             : {
     414           0 :     if ( maVSSpacing->GetSelectItemId() > 0 )
     415             :     {
     416           0 :         maVSSpacing->SetNoSelection();
     417           0 :         maVSSpacing->SelectItem(0);
     418           0 :         maVSSpacing->SetFormat();
     419           0 :         maVSSpacing->Invalidate();
     420           0 :         Invalidate();
     421           0 :         maVSSpacing->StartSelection();
     422             :     }
     423           0 :     sal_uInt16 nPos = maLBKerning->GetSelectEntryPos();
     424           0 :     short nKern = 0;
     425           0 :     SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
     426           0 :     mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
     427           0 :     if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED )
     428             :     {
     429           0 :         long nTmp = static_cast<long>(maEditKerning->GetValue());
     430           0 :         if ( nPos == SIDEBAR_SPACE_CONDENSED )
     431             :         {
     432           0 :             long nMax =  mrTextPropertyPanel.GetSelFontSize()/6;
     433           0 :             maEditKerning->SetMax( maEditKerning->Normalize( nMax ), FUNIT_TWIP );
     434           0 :             maEditKerning->SetLast( maEditKerning->GetMax( maEditKerning->GetUnit() ) );
     435           0 :             if(nTmp > maEditKerning->GetMax())
     436           0 :                 nTmp = maEditKerning->GetMax();
     437           0 :             mnCustomKern = -nTmp;
     438           0 :             long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
     439           0 :             nKern = (short)maEditKerning->Denormalize( nVal );
     440           0 :             nKern *= - 1;
     441             :         }
     442             :         else
     443             :         {
     444           0 :             maEditKerning->SetMax( 9999 );
     445           0 :             maEditKerning->SetLast( 9999 );
     446           0 :             if(nTmp > maEditKerning->GetMax(FUNIT_TWIP))
     447           0 :                 nTmp = maEditKerning->GetMax(FUNIT_TWIP);
     448           0 :             mnCustomKern = nTmp;
     449           0 :             long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
     450           0 :             nKern = (short)maEditKerning->Denormalize( nVal );
     451           0 :         }
     452             :     }
     453             :     else
     454             :     {
     455           0 :         mnCustomKern = 0;
     456             :     }
     457           0 :     SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
     458           0 :     mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SfxCallMode::RECORD, &aKernItem, 0L);
     459           0 :     return 0;
     460             : }
     461             : 
     462         390 : }} // end of namespace sidebar
     463             : 
     464             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11