LCOV - code coverage report
Current view: top level - sc/source/ui/app - scmod2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 26 34.6 %
Date: 2012-08-25 Functions: 1 3 33.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 8 42 19.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 <unotools/lingucfg.hxx>
      31                 :            : #include <i18npool/mslangid.hxx>
      32                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      33                 :            : #include <com/sun/star/linguistic2/XThesaurus.hpp>
      34                 :            : #include <com/sun/star/lang/Locale.hpp>
      35                 :            : 
      36                 :            : using namespace com::sun::star;
      37                 :            : 
      38                 :            : #include "scmod.hxx"
      39                 :            : 
      40                 :            : //------------------------------------------------------------------
      41                 :            : 
      42                 :            : #define LINGUPROP_AUTOSPELL         "IsSpellAuto"
      43                 :            : 
      44                 :            : //------------------------------------------------------------------
      45                 :            : 
      46                 :        412 : void ScModule::GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang,
      47                 :            :                                     sal_Bool& rAutoSpell )
      48                 :            : {
      49                 :            :     //  use SvtLinguConfig instead of service LinguProperties to avoid
      50                 :            :     //  loading the linguistic component
      51         [ +  - ]:        412 :     SvtLinguConfig aConfig;
      52                 :            : 
      53         [ +  - ]:        412 :     SvtLinguOptions aOptions;
      54         [ +  - ]:        412 :     aConfig.GetOptions( aOptions );
      55                 :            : 
      56         [ +  - ]:        412 :     rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
      57         [ +  - ]:        412 :     rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
      58         [ +  - ]:        412 :     rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
      59 [ +  - ][ +  - ]:        412 :     rAutoSpell = aOptions.bIsSpellAuto;
      60                 :        412 : }
      61                 :            : 
      62                 :          0 : void ScModule::SetAutoSpellProperty( sal_Bool bSet )
      63                 :            : {
      64                 :            :     //  use SvtLinguConfig instead of service LinguProperties to avoid
      65                 :            :     //  loading the linguistic component
      66         [ #  # ]:          0 :     SvtLinguConfig aConfig;
      67                 :            : 
      68                 :          0 :     uno::Any aAny;
      69         [ #  # ]:          0 :     aAny <<= bSet;
      70 [ #  # ][ #  # ]:          0 :     aConfig.SetProperty( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( LINGUPROP_AUTOSPELL )), aAny );
                 [ #  # ]
      71                 :          0 : }
      72                 :            : 
      73                 :            : 
      74                 :            : 
      75                 :          0 : sal_Bool ScModule::HasThesaurusLanguage( sal_uInt16 nLang )
      76                 :            : {
      77         [ #  # ]:          0 :     if ( nLang == LANGUAGE_NONE )
      78                 :          0 :         return false;
      79                 :            : 
      80                 :          0 :     lang::Locale aLocale;
      81         [ #  # ]:          0 :     SvxLanguageToLocale( aLocale, nLang );
      82                 :            : 
      83                 :          0 :     sal_Bool bHasLang = false;
      84                 :            :     try
      85                 :            :     {
      86         [ #  # ]:          0 :         uno::Reference< linguistic2::XThesaurus > xThes(LinguMgr::GetThesaurus());
      87         [ #  # ]:          0 :         if ( xThes.is() )
      88 [ #  # ][ #  # ]:          0 :             bHasLang = xThes->hasLocale( aLocale );
                 [ #  # ]
      89                 :            :     }
      90         [ #  # ]:          0 :     catch( uno::Exception& )
      91                 :            :     {
      92                 :            :         OSL_FAIL("Error in Thesaurus");
      93                 :            :     }
      94                 :            : 
      95                 :          0 :     return bHasLang;
      96                 :            : }
      97                 :            : 
      98                 :            : 
      99                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10