LCOV - code coverage report
Current view: top level - editeng/source/uno - UnoForbiddenCharsTable.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 53 0.0 %
Date: 2014-04-14 Functions: 0 10 0.0 %
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             : 
      20             : #include <editeng/UnoForbiddenCharsTable.hxx>
      21             : #include <editeng/forbiddencharacterstable.hxx>
      22             : #include <osl/mutex.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <editeng/unolingu.hxx>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : using namespace ::com::sun::star::uno;
      28             : using namespace ::com::sun::star::container;
      29             : using namespace ::com::sun::star::lang;
      30             : using namespace ::com::sun::star::i18n;
      31             : using namespace ::rtl;
      32             : using namespace ::cppu;
      33             : 
      34           0 : SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(::rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars) :
      35           0 :     mxForbiddenChars( xForbiddenChars )
      36             : {
      37           0 : }
      38             : 
      39           0 : SvxUnoForbiddenCharsTable::~SvxUnoForbiddenCharsTable()
      40             : {
      41           0 : }
      42             : 
      43           0 : void SvxUnoForbiddenCharsTable::onChange()
      44             : {
      45           0 : }
      46             : 
      47           0 : ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Locale& rLocale )
      48             :     throw(NoSuchElementException, RuntimeException, std::exception)
      49             : {
      50           0 :     SolarMutexGuard aGuard;
      51             : 
      52           0 :     if(!mxForbiddenChars.is())
      53           0 :         throw RuntimeException();
      54             : 
      55           0 :     const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
      56           0 :     const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, false );
      57           0 :     if(!pForbidden)
      58           0 :         throw NoSuchElementException();
      59             : 
      60           0 :     return *pForbidden;
      61             : }
      62             : 
      63           0 : sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocale )
      64             :     throw(RuntimeException, std::exception)
      65             : {
      66           0 :     SolarMutexGuard aGuard;
      67             : 
      68           0 :     if(!mxForbiddenChars.is())
      69           0 :         return sal_False;
      70             : 
      71           0 :     const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
      72           0 :     const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, false );
      73             : 
      74           0 :     return NULL != pForbidden;
      75             : }
      76             : 
      77           0 : void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, const ForbiddenCharacters& rForbiddenCharacters )
      78             :     throw(RuntimeException, std::exception)
      79             : {
      80           0 :     SolarMutexGuard aGuard;
      81             : 
      82           0 :     if(!mxForbiddenChars.is())
      83           0 :         throw RuntimeException();
      84             : 
      85           0 :     const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
      86           0 :     mxForbiddenChars->SetForbiddenCharacters( eLang, rForbiddenCharacters );
      87             : 
      88           0 :     onChange();
      89           0 : }
      90             : 
      91           0 : void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale )
      92             :     throw(RuntimeException, std::exception)
      93             : {
      94           0 :     SolarMutexGuard aGuard;
      95             : 
      96           0 :     if(!mxForbiddenChars.is())
      97           0 :         throw RuntimeException();
      98             : 
      99           0 :     const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
     100           0 :     mxForbiddenChars->ClearForbiddenCharacters( eLang );
     101             : 
     102           0 :     onChange();
     103           0 : }
     104             : 
     105             : // XSupportedLocales
     106           0 : Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
     107             :     throw(RuntimeException, std::exception)
     108             : {
     109           0 :     SolarMutexGuard aGuard;
     110             : 
     111           0 :     const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->GetMap().size() : 0;
     112             : 
     113           0 :     Sequence< Locale > aLocales( nCount );
     114           0 :     if( nCount )
     115             :     {
     116           0 :         Locale* pLocales = aLocales.getArray();
     117             : 
     118           0 :         for( SvxForbiddenCharactersTable::Map::iterator it = mxForbiddenChars->GetMap().begin();
     119           0 :              it != mxForbiddenChars->GetMap().end(); ++it )
     120             :         {
     121           0 :             const sal_uLong nLanguage = it->first;
     122           0 :             *pLocales++ = LanguageTag( static_cast < LanguageType > (nLanguage) ).getLocale();
     123             :         }
     124             :     }
     125             : 
     126           0 :     return aLocales;
     127             : }
     128             : 
     129           0 : sal_Bool SAL_CALL SvxUnoForbiddenCharsTable::hasLocale( const Locale& aLocale )
     130             :     throw(RuntimeException, std::exception)
     131             : {
     132           0 :     SolarMutexGuard aGuard;
     133             : 
     134           0 :     return hasForbiddenCharacters( aLocale );
     135             : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10