LCOV - code coverage report
Current view: top level - editeng/source/misc - forbiddencharacterstable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 19 84.2 %
Date: 2012-08-25 Functions: 3 4 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 26 61.5 %

           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                 :            : 
      30                 :            : #include <editeng/forbiddencharacterstable.hxx>
      31                 :            : 
      32                 :            : #include <unotools/localedatawrapper.hxx>
      33                 :            : #include <editeng/unolingu.hxx>
      34                 :            : 
      35                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      36                 :            : 
      37         [ +  - ]:      18181 : SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF)
      38                 :            : {
      39         [ +  - ]:      18181 :     mxMSF = xMSF;
      40                 :      18181 : }
      41                 :            : 
      42                 :     140429 : const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault )
      43                 :            : {
      44                 :     140429 :     com::sun::star::i18n::ForbiddenCharacters* pForbiddenCharacters = NULL;
      45         [ +  - ]:     140429 :     Map::iterator it = maMap.find( nLanguage );
      46         [ +  + ]:     140429 :     if ( it != maMap.end() )
      47                 :      84089 :         pForbiddenCharacters = &(it->second);
      48 [ +  + ][ +  - ]:      56340 :     else if ( bGetDefault && mxMSF.is() )
                 [ +  + ]
      49                 :            :     {
      50 [ +  - ][ +  - ]:      16692 :         LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) );
      51 [ +  - ][ +  - ]:      16692 :         maMap[ nLanguage ] = aWrapper.getForbiddenCharacters();
      52 [ +  - ][ +  - ]:      16692 :         pForbiddenCharacters = &maMap[ nLanguage ];
      53                 :            :     }
      54                 :     140429 :     return pForbiddenCharacters;
      55                 :            : }
      56                 :            : 
      57                 :        100 : void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenChars )
      58                 :            : {
      59                 :        100 :     maMap[ nLanguage ] = rForbiddenChars;
      60                 :        100 : }
      61                 :            : 
      62                 :          0 : void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage )
      63                 :            : {
      64                 :          0 :     maMap.erase( nLanguage );
      65                 :          0 : }
      66                 :            : 
      67                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10