LCOV - code coverage report
Current view: top level - cui/source/options - optasian.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 214 0.0 %
Date: 2012-08-25 Functions: 0 19 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 445 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 <map>
      30                 :            : #include <optasian.hxx>
      31                 :            : #include <editeng/langitem.hxx>
      32                 :            : #include <editeng/unolingu.hxx>
      33                 :            : #include <optasian.hrc>
      34                 :            : #include <dialmgr.hxx>
      35                 :            : #include <cuires.hrc>
      36                 :            : #include <i18npool/mslangid.hxx>
      37                 :            : #include <tools/shl.hxx>
      38                 :            : #include <svl/asiancfg.hxx>
      39                 :            : #include <com/sun/star/lang/Locale.hpp>
      40                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      41                 :            : #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
      42                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      43                 :            : #include <sfx2/viewfrm.hxx>
      44                 :            : #include <sfx2/objsh.hxx>
      45                 :            : #include <vcl/svapp.hxx>
      46                 :            : #include <comphelper/processfactory.hxx>
      47                 :            : #include <unotools/localedatawrapper.hxx>
      48                 :            : 
      49                 :            : using namespace com::sun::star::uno;
      50                 :            : using namespace com::sun::star::lang;
      51                 :            : using namespace com::sun::star::i18n;
      52                 :            : using namespace com::sun::star::frame;
      53                 :            : using namespace com::sun::star::beans;
      54                 :            : using rtl::OUString;
      55                 :            : 
      56                 :            : #define C2U(cChar) rtl::OUString::createFromAscii(cChar)
      57                 :            : 
      58                 :            : const sal_Char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation";
      59                 :            : const sal_Char cCharacterCompressionType[] = "CharacterCompressionType";
      60                 :            : 
      61                 :            : struct SvxForbiddenChars_Impl
      62                 :            : {
      63                 :            :     ~SvxForbiddenChars_Impl();
      64                 :            : 
      65                 :            :     sal_Bool                bRemoved;
      66                 :            :     ForbiddenCharacters*    pCharacters;
      67                 :            : };
      68                 :            : 
      69                 :          0 : SvxForbiddenChars_Impl::~SvxForbiddenChars_Impl()
      70                 :            : {
      71         [ #  # ]:          0 :     delete pCharacters;
      72                 :          0 : }
      73                 :            : 
      74                 :            : typedef ::std::map< LanguageType, SvxForbiddenChars_Impl* > SvxForbiddenCharacterMap_Impl;
      75                 :            : 
      76                 :            : struct SvxAsianLayoutPage_Impl
      77                 :            : {
      78                 :            :     SvxAsianConfig  aConfig;
      79         [ #  # ]:          0 :         SvxAsianLayoutPage_Impl() {}
      80                 :            : 
      81                 :            :     ~SvxAsianLayoutPage_Impl();
      82                 :            : 
      83                 :            :     Reference< XForbiddenCharacters >   xForbidden;
      84                 :            :     Reference< XPropertySet >           xPrSet;
      85                 :            :     Reference< XPropertySetInfo >       xPrSetInfo;
      86                 :            :     SvxForbiddenCharacterMap_Impl       aChangedLanguagesMap;
      87                 :            : 
      88                 :            :     sal_Bool                hasForbiddenCharacters(LanguageType eLang);
      89                 :            :     SvxForbiddenChars_Impl* getForbiddenCharacters(LanguageType eLang);
      90                 :            :     void                    addForbiddenCharacters(LanguageType eLang, ForbiddenCharacters* pForbidden);
      91                 :            : };
      92                 :            : 
      93                 :          0 : SvxAsianLayoutPage_Impl::~SvxAsianLayoutPage_Impl()
      94                 :            : {
      95                 :          0 :     SvxForbiddenCharacterMap_Impl::iterator it;
      96         [ #  # ]:          0 :     for( it = aChangedLanguagesMap.begin(); it != aChangedLanguagesMap.end(); ++it )
      97                 :            :     {
      98         [ #  # ]:          0 :         delete it->second;
      99                 :            :     }
     100                 :          0 : }
     101                 :            : 
     102                 :          0 : sal_Bool    SvxAsianLayoutPage_Impl::hasForbiddenCharacters(LanguageType eLang)
     103                 :            : {
     104                 :          0 :     return aChangedLanguagesMap.count( eLang );
     105                 :            : }
     106                 :            : 
     107                 :          0 : SvxForbiddenChars_Impl* SvxAsianLayoutPage_Impl::getForbiddenCharacters(LanguageType eLang)
     108                 :            : {
     109         [ #  # ]:          0 :     SvxForbiddenCharacterMap_Impl::iterator it = aChangedLanguagesMap.find( eLang );
     110                 :            :     DBG_ASSERT( ( it != aChangedLanguagesMap.end() ), "language not available");
     111         [ #  # ]:          0 :     if( it != aChangedLanguagesMap.end() )
     112                 :          0 :         return it->second;
     113                 :          0 :     return 0;
     114                 :            : }
     115                 :            : 
     116                 :          0 : void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
     117                 :            :     LanguageType eLang, ForbiddenCharacters* pForbidden)
     118                 :            : {
     119         [ #  # ]:          0 :     SvxForbiddenCharacterMap_Impl::iterator itOld = aChangedLanguagesMap.find( eLang );
     120         [ #  # ]:          0 :     if( itOld == aChangedLanguagesMap.end() )
     121                 :            :     {
     122         [ #  # ]:          0 :         SvxForbiddenChars_Impl* pChar = new SvxForbiddenChars_Impl;
     123                 :          0 :         pChar->bRemoved = 0 == pForbidden;
     124 [ #  # ][ #  # ]:          0 :         pChar->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
     125         [ #  # ]:          0 :         aChangedLanguagesMap.insert( ::std::make_pair( eLang, pChar ) );
     126                 :            :     }
     127                 :            :     else
     128                 :            :     {
     129                 :          0 :         itOld->second->bRemoved = 0 == pForbidden;
     130         [ #  # ]:          0 :         delete itOld->second->pCharacters;
     131 [ #  # ][ #  # ]:          0 :         itOld->second->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
     132                 :            :     }
     133                 :          0 : }
     134                 :            : 
     135                 :            : static LanguageType eLastUsedLanguageTypeForForbiddenCharacters = USHRT_MAX;
     136                 :            : 
     137                 :          0 : SvxAsianLayoutPage::SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet ) :
     138                 :          0 :     SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ASIAN_LAYOUT ), rSet),
     139         [ #  # ]:          0 :     aKerningGB(             this, CUI_RES(GB_KERNING            )),
     140         [ #  # ]:          0 :     aCharKerningRB(         this, CUI_RES(RB_CHAR_KERNING       )),
     141         [ #  # ]:          0 :     aCharPunctKerningRB(    this, CUI_RES(RB_CHAR_PUNCT     )),
     142         [ #  # ]:          0 :     aCharDistGB(            this, CUI_RES(GB_CHAR_DIST      )),
     143         [ #  # ]:          0 :     aNoCompressionRB(       this, CUI_RES(RB_NO_COMP            )),
     144         [ #  # ]:          0 :     aPunctCompressionRB(    this, CUI_RES(RB_PUNCT_COMP     )),
     145         [ #  # ]:          0 :      aPunctKanaCompressionRB(this, CUI_RES(RB_PUNCT_KANA_COMP   )),
     146         [ #  # ]:          0 :     aStartEndGB(            this, CUI_RES(GB_START_END      )),
     147         [ #  # ]:          0 :     aLanguageFT(            this, CUI_RES(FT_LANGUAGE           )),
     148         [ #  # ]:          0 :     aLanguageLB(            this, CUI_RES(LB_LANGUAGE           )),
     149         [ #  # ]:          0 :     aStandardCB(            this, CUI_RES(CB_STANDARD           )),
     150         [ #  # ]:          0 :     aStartFT(               this, CUI_RES(FT_START          )),
     151         [ #  # ]:          0 :     aStartED(               this, CUI_RES(ED_START          )),
     152         [ #  # ]:          0 :     aEndFT(                 this, CUI_RES(FT_END                )),
     153         [ #  # ]:          0 :     aEndED(                 this, CUI_RES(ED_END                )),
     154         [ #  # ]:          0 :     aHintFT(                this, CUI_RES(FT_HINT               )),
     155 [ #  # ][ #  # ]:          0 :     pImpl(new SvxAsianLayoutPage_Impl)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     156                 :            : {
     157         [ #  # ]:          0 :     FreeResource();
     158         [ #  # ]:          0 :     LanguageHdl(&aLanguageLB);
     159         [ #  # ]:          0 :     aLanguageLB.SetSelectHdl(LINK(this, SvxAsianLayoutPage, LanguageHdl));
     160         [ #  # ]:          0 :     aStandardCB.SetClickHdl(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl));
     161         [ #  # ]:          0 :     Link aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl));
     162                 :          0 :     aStartED.SetModifyHdl(aLk);
     163                 :          0 :     aEndED.SetModifyHdl(aLk);
     164                 :            : 
     165         [ #  # ]:          0 :     aLanguageLB.SetLanguageList( LANG_LIST_FBD_CHARS, sal_False, sal_False );
     166                 :          0 : }
     167                 :            : 
     168 [ #  # ][ #  # ]:          0 : SvxAsianLayoutPage::~SvxAsianLayoutPage()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     169                 :            : {
     170 [ #  # ][ #  # ]:          0 :     delete pImpl;
     171         [ #  # ]:          0 : }
     172                 :            : 
     173                 :          0 : SfxTabPage* SvxAsianLayoutPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
     174                 :            : {
     175         [ #  # ]:          0 :     return new SvxAsianLayoutPage(pParent, rAttrSet);
     176                 :            : }
     177                 :            : 
     178                 :          0 : sal_Bool SvxAsianLayoutPage::FillItemSet( SfxItemSet& )
     179                 :            : {
     180         [ #  # ]:          0 :     if(aCharKerningRB.IsChecked() != aCharKerningRB.GetSavedValue())
     181                 :            :     {
     182         [ #  # ]:          0 :         pImpl->aConfig.SetKerningWesternTextOnly(aCharKerningRB.IsChecked());
     183                 :          0 :         OUString sPunct(C2U(cIsKernAsianPunctuation));
     184 [ #  # ][ #  # ]:          0 :         if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sPunct))
         [ #  # ][ #  # ]
                 [ #  # ]
     185                 :            :         {
     186                 :          0 :             Any aVal;
     187                 :          0 :             sal_Bool bVal = !aCharKerningRB.IsChecked();
     188         [ #  # ]:          0 :             aVal.setValue(&bVal, ::getBooleanCppuType());
     189 [ #  # ][ #  # ]:          0 :             pImpl->xPrSet->setPropertyValue(sPunct, aVal);
     190                 :          0 :         }
     191                 :            :     }
     192                 :            : 
     193   [ #  #  #  # ]:          0 :     if(aNoCompressionRB.IsChecked() != aNoCompressionRB.GetSavedValue() ||
                 [ #  # ]
     194                 :          0 :             aPunctCompressionRB.IsChecked() != aPunctCompressionRB.GetSavedValue())
     195                 :            :     {
     196                 :          0 :         sal_Int16 nSet = aNoCompressionRB.IsChecked() ? 0 :
     197 [ #  # ][ #  # ]:          0 :                             aPunctCompressionRB.IsChecked() ? 1 : 2;
     198         [ #  # ]:          0 :         pImpl->aConfig.SetCharDistanceCompression(nSet);
     199                 :          0 :         OUString sCompress(C2U(cCharacterCompressionType));
     200 [ #  # ][ #  # ]:          0 :         if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress))
         [ #  # ][ #  # ]
                 [ #  # ]
     201                 :            :         {
     202                 :          0 :             Any aVal;
     203         [ #  # ]:          0 :             aVal <<= nSet;
     204 [ #  # ][ #  # ]:          0 :             pImpl->xPrSet->setPropertyValue(sCompress, aVal);
     205                 :          0 :         }
     206                 :            :     }
     207                 :          0 :     pImpl->aConfig.Commit();
     208         [ #  # ]:          0 :     if(pImpl->xForbidden.is())
     209                 :            :     {
     210                 :            :         try
     211                 :            :         {
     212                 :          0 :             SvxForbiddenCharacterMap_Impl::iterator itElem;
     213         [ #  # ]:          0 :             for( itElem = pImpl->aChangedLanguagesMap.begin();
     214                 :          0 :                 itElem != pImpl->aChangedLanguagesMap.end(); ++itElem )
     215                 :            :             {
     216                 :          0 :                 Locale aLocale;
     217         [ #  # ]:          0 :                 SvxLanguageToLocale( aLocale, itElem->first );
     218         [ #  # ]:          0 :                 if(itElem->second->bRemoved)
     219 [ #  # ][ #  # ]:          0 :                     pImpl->xForbidden->removeForbiddenCharacters( aLocale );
     220         [ #  # ]:          0 :                 else if(itElem->second->pCharacters)
     221 [ #  # ][ #  # ]:          0 :                     pImpl->xForbidden->setForbiddenCharacters( aLocale, *( itElem->second->pCharacters ) );
     222         [ #  # ]:          0 :             }
     223                 :            :         }
     224                 :          0 :         catch (const Exception&)
     225                 :            :         {
     226                 :            :             OSL_FAIL("exception in XForbiddenCharacters");
     227                 :            :         }
     228                 :            :     }
     229                 :          0 :     eLastUsedLanguageTypeForForbiddenCharacters = aLanguageLB.GetSelectLanguage();
     230                 :            : 
     231                 :          0 :     return sal_False;
     232                 :            : }
     233                 :            : 
     234                 :          0 : void SvxAsianLayoutPage::Reset( const SfxItemSet& )
     235                 :            : {
     236         [ #  # ]:          0 :     SfxViewFrame* pCurFrm = SfxViewFrame::Current();
     237 [ #  # ][ #  # ]:          0 :     SfxObjectShell* pDocSh = pCurFrm ? pCurFrm->GetObjectShell() : 0;
     238                 :          0 :     Reference< XModel > xModel;
     239         [ #  # ]:          0 :     if(pDocSh)
     240 [ #  # ][ #  # ]:          0 :         xModel = pDocSh->GetModel();
     241         [ #  # ]:          0 :     Reference<XMultiServiceFactory> xFact(xModel, UNO_QUERY);
     242         [ #  # ]:          0 :     if(xFact.is())
     243                 :            :     {
     244                 :            :         pImpl->xPrSet = Reference<XPropertySet>(
     245 [ #  # ][ #  # ]:          0 :             xFact->createInstance(C2U("com.sun.star.document.Settings")), UNO_QUERY);
         [ #  # ][ #  # ]
     246                 :            :     }
     247         [ #  # ]:          0 :     if( pImpl->xPrSet.is() )
     248 [ #  # ][ #  # ]:          0 :         pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
                 [ #  # ]
     249                 :          0 :     OUString sForbidden(C2U("ForbiddenCharacters"));
     250         [ #  # ]:          0 :     sal_Bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
     251         [ #  # ]:          0 :     sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression();
     252         [ #  # ]:          0 :     if(pImpl->xPrSetInfo.is())
     253                 :            :     {
     254 [ #  # ][ #  # ]:          0 :         if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden))
                 [ #  # ]
     255                 :            :         {
     256 [ #  # ][ #  # ]:          0 :             Any aForbidden = pImpl->xPrSet->getPropertyValue(sForbidden);
     257         [ #  # ]:          0 :             aForbidden >>= pImpl->xForbidden;
     258                 :            :         }
     259                 :          0 :         OUString sCompress(C2U(cCharacterCompressionType));
     260 [ #  # ][ #  # ]:          0 :         if(pImpl->xPrSetInfo->hasPropertyByName(sCompress))
                 [ #  # ]
     261                 :            :         {
     262 [ #  # ][ #  # ]:          0 :             Any aVal = pImpl->xPrSet->getPropertyValue(sCompress);
     263                 :          0 :             aVal >>= nCompress;
     264                 :            :         }
     265                 :          0 :         OUString sPunct(C2U(cIsKernAsianPunctuation));
     266 [ #  # ][ #  # ]:          0 :         if(pImpl->xPrSetInfo->hasPropertyByName(sPunct))
                 [ #  # ]
     267                 :            :         {
     268 [ #  # ][ #  # ]:          0 :             Any aVal = pImpl->xPrSet->getPropertyValue(sPunct);
     269                 :          0 :             bKernWesternText = !*(sal_Bool*)aVal.getValue();
     270                 :          0 :         }
     271                 :            :     }
     272                 :            :     else
     273                 :            :     {
     274         [ #  # ]:          0 :         aStartEndGB.Enable(sal_False);
     275         [ #  # ]:          0 :         aLanguageFT.Enable(sal_False);
     276         [ #  # ]:          0 :         aLanguageLB.Enable(sal_False);
     277         [ #  # ]:          0 :         aStandardCB.Enable(sal_False);
     278         [ #  # ]:          0 :         aStartFT.Enable(sal_False);
     279         [ #  # ]:          0 :         aStartED.Enable(sal_False);
     280         [ #  # ]:          0 :         aEndFT.Enable(sal_False);
     281         [ #  # ]:          0 :         aEndED.Enable(sal_False);
     282         [ #  # ]:          0 :         aHintFT.Enable(sal_False);
     283                 :            :     }
     284         [ #  # ]:          0 :     if(bKernWesternText)
     285         [ #  # ]:          0 :         aCharKerningRB.Check(sal_True);
     286                 :            :     else
     287         [ #  # ]:          0 :         aCharPunctKerningRB.Check(sal_True);
     288      [ #  #  # ]:          0 :     switch(nCompress)
     289                 :            :     {
     290         [ #  # ]:          0 :         case 0 : aNoCompressionRB.Check();        break;
     291         [ #  # ]:          0 :         case 1 : aPunctCompressionRB.Check();     break;
     292         [ #  # ]:          0 :         default: aPunctKanaCompressionRB.Check();
     293                 :            :     }
     294                 :          0 :     aCharKerningRB.SaveValue();
     295                 :          0 :     aNoCompressionRB.SaveValue();
     296                 :          0 :     aPunctCompressionRB.SaveValue();
     297                 :          0 :     aPunctKanaCompressionRB.SaveValue();
     298                 :            : 
     299         [ #  # ]:          0 :     aLanguageLB.SelectEntryPos(0);
     300                 :            :     //preselect the system language in the box - if available
     301         [ #  # ]:          0 :     if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters)
     302                 :            :     {
     303                 :            :         eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage(
     304 [ #  # ][ #  # ]:          0 :             Application::GetSettings().GetLocale() );
                 [ #  # ]
     305 [ #  # ][ #  # ]:          0 :         if (MsLangId::isSimplifiedChinese(eLastUsedLanguageTypeForForbiddenCharacters))
     306                 :          0 :             eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
     307 [ #  # ][ #  # ]:          0 :         else if (MsLangId::isTraditionalChinese(eLastUsedLanguageTypeForForbiddenCharacters))
     308                 :          0 :             eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
     309                 :            :     }
     310         [ #  # ]:          0 :     aLanguageLB.SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters );
     311         [ #  # ]:          0 :     LanguageHdl(&aLanguageLB);
     312                 :          0 : }
     313                 :            : 
     314                 :          0 : IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl)
     315                 :            : {
     316                 :            :     //set current value
     317                 :          0 :     Locale aLocale;
     318         [ #  # ]:          0 :     LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
     319         [ #  # ]:          0 :     SvxLanguageToLocale(aLocale, eSelectLanguage );
     320                 :            : 
     321                 :          0 :     OUString sStart, sEnd;
     322                 :            :     sal_Bool bAvail;
     323         [ #  # ]:          0 :     if(pImpl->xForbidden.is())
     324                 :            :     {
     325         [ #  # ]:          0 :         bAvail = pImpl->hasForbiddenCharacters(eSelectLanguage);
     326         [ #  # ]:          0 :         if(bAvail)
     327                 :            :         {
     328         [ #  # ]:          0 :             SvxForbiddenChars_Impl* pElement = pImpl->getForbiddenCharacters(eSelectLanguage);
     329 [ #  # ][ #  # ]:          0 :             if(pElement->bRemoved || !pElement->pCharacters)
     330                 :            :             {
     331                 :          0 :                 bAvail = sal_False;
     332                 :            :             }
     333                 :            :             else
     334                 :            :             {
     335                 :          0 :                 sStart = pElement->pCharacters->beginLine;
     336                 :          0 :                 sEnd = pElement->pCharacters->endLine;
     337                 :            :             }
     338                 :            :         }
     339                 :            :         else
     340                 :            :         {
     341                 :            :             try
     342                 :            :             {
     343 [ #  # ][ #  # ]:          0 :                 bAvail = pImpl->xForbidden->hasForbiddenCharacters(aLocale);
     344         [ #  # ]:          0 :                 if(bAvail)
     345                 :            :                 {
     346 [ #  # ][ #  # ]:          0 :                     ForbiddenCharacters aForbidden = pImpl->xForbidden->getForbiddenCharacters( aLocale );
     347                 :          0 :                     sStart = aForbidden.beginLine;
     348                 :          0 :                     sEnd = aForbidden.endLine;
     349                 :            :                 }
     350                 :            :             }
     351         [ #  # ]:          0 :             catch (const Exception&)
     352                 :            :             {
     353                 :            :                 OSL_FAIL("exception in XForbiddenCharacters");
     354                 :            :             }
     355                 :            :         }
     356                 :            :     }
     357                 :            :     else
     358                 :            :     {
     359         [ #  # ]:          0 :         bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd );
     360                 :            :     }
     361         [ #  # ]:          0 :     if(!bAvail)
     362                 :            :     {
     363         [ #  # ]:          0 :         Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
     364         [ #  # ]:          0 :         LocaleDataWrapper aWrap( xMSF, aLocale );
     365         [ #  # ]:          0 :         ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
     366                 :          0 :         sStart = aForbidden.beginLine;
     367         [ #  # ]:          0 :         sEnd = aForbidden.endLine;
     368                 :            :     }
     369         [ #  # ]:          0 :     aStandardCB.Check(!bAvail);
     370         [ #  # ]:          0 :     aStartED.Enable(bAvail);
     371         [ #  # ]:          0 :     aEndED.Enable(bAvail);
     372         [ #  # ]:          0 :     aStartFT.Enable(bAvail);
     373         [ #  # ]:          0 :     aEndFT.Enable(bAvail);
     374 [ #  # ][ #  # ]:          0 :     aStartED.SetText(sStart);
                 [ #  # ]
     375 [ #  # ][ #  # ]:          0 :     aEndED.SetText(sEnd);
                 [ #  # ]
     376                 :            : 
     377         [ #  # ]:          0 :     return 0;
     378                 :            : }
     379                 :            : 
     380                 :          0 : IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, CheckBox*, pBox)
     381                 :            : {
     382                 :          0 :     sal_Bool bCheck = pBox->IsChecked();
     383                 :          0 :     aStartED.Enable(!bCheck);
     384                 :          0 :     aEndED.Enable(!bCheck);
     385                 :          0 :     aStartFT.Enable(!bCheck);
     386                 :          0 :     aEndFT.Enable(!bCheck);
     387                 :            : 
     388                 :          0 :     ModifyHdl(&aStartED);
     389                 :          0 :     return 0;
     390                 :            : }
     391                 :            : 
     392                 :          0 : IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit*, pEdit)
     393                 :            : {
     394                 :          0 :     Locale aLocale;
     395         [ #  # ]:          0 :     LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
     396         [ #  # ]:          0 :     SvxLanguageToLocale(aLocale, eSelectLanguage );
     397 [ #  # ][ #  # ]:          0 :     OUString sStart = aStartED.GetText();
                 [ #  # ]
     398 [ #  # ][ #  # ]:          0 :     OUString sEnd = aEndED.GetText();
                 [ #  # ]
     399         [ #  # ]:          0 :     sal_Bool bEnable = pEdit->IsEnabled();
     400         [ #  # ]:          0 :     if(pImpl->xForbidden.is())
     401                 :            :     {
     402                 :            :         try
     403                 :            :         {
     404         [ #  # ]:          0 :             if(bEnable)
     405                 :            :             {
     406                 :          0 :                 ForbiddenCharacters aSet;
     407                 :          0 :                 aSet.beginLine = sStart;
     408                 :          0 :                 aSet.endLine = sEnd;
     409 [ #  # ][ #  # ]:          0 :                 pImpl->addForbiddenCharacters(eSelectLanguage, &aSet);
     410                 :            :             }
     411                 :            :             else
     412         [ #  # ]:          0 :                 pImpl->addForbiddenCharacters(eSelectLanguage, 0);
     413                 :            :         }
     414         [ #  # ]:          0 :         catch (const Exception&)
     415                 :            :         {
     416                 :            :             OSL_FAIL("exception in XForbiddenCharacters");
     417                 :            :         }
     418                 :            :     }
     419 [ #  # ][ #  # ]:          0 :     pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : 0, bEnable ? &sEnd : 0);
                 [ #  # ]
     420                 :          0 :     return 0;
     421                 :            : }
     422                 :            : 
     423                 :          0 : sal_uInt16* SvxAsianLayoutPage::GetRanges()
     424                 :            : {
     425                 :            :     //no items are used
     426                 :            :     static sal_uInt16 pAsianLayoutRanges[] = { 0 };
     427                 :          0 :     return pAsianLayoutRanges;
     428                 :            : }
     429                 :            : 
     430                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10