LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/linguistic/source - defs.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 23 91.3 %
Date: 2013-07-09 Functions: 10 12 83.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             : 
      20             : #ifndef _LINGUISTIC_DEFS_HXX_
      21             : #define _LINGUISTIC_DEFS_HXX_
      22             : 
      23             : #include <com/sun/star/linguistic2/XSpellChecker.hpp>
      24             : #include <com/sun/star/linguistic2/XProofreader.hpp>
      25             : #include <com/sun/star/linguistic2/XHyphenator.hpp>
      26             : #include <com/sun/star/linguistic2/XThesaurus.hpp>
      27             : 
      28             : #include <boost/shared_ptr.hpp>
      29             : 
      30             : class SvStream;
      31             : 
      32             : 
      33             : 
      34             : typedef boost::shared_ptr< SvStream > SvStreamPtr;
      35             : 
      36         462 : struct LangSvcEntries
      37             : {
      38             :     css::uno::Sequence< OUString >   aSvcImplNames;
      39             : 
      40             :     sal_Int16   nLastTriedSvcIndex;
      41             :     bool        bAlreadyWarned;
      42             :     bool        bDoWarnAgain;
      43             : 
      44             :     LangSvcEntries() : nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false) {}
      45             : 
      46          22 :     inline LangSvcEntries( const css::uno::Sequence< OUString > &rSvcImplNames ) :
      47             :         aSvcImplNames(rSvcImplNames),
      48          22 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      49             :     {
      50          22 :     }
      51             : 
      52         440 :     inline LangSvcEntries( const OUString &rSvcImplName ) :
      53         440 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      54             :     {
      55         440 :         aSvcImplNames.realloc(1);
      56         440 :         aSvcImplNames[0] = rSvcImplName;
      57         440 :     }
      58             : 
      59             :     bool    IsAlreadyWarned() const         { return bAlreadyWarned != 0; }
      60             :     void    SetAlreadyWarned( bool bVal )   { bAlreadyWarned = 0 != bVal; }
      61             :     bool    IsDoWarnAgain() const           { return bDoWarnAgain != 0; }
      62             :     void    SetDoWarnAgain( bool bVal )     { bDoWarnAgain = 0 != bVal; }
      63             : 
      64          21 :     inline void Clear()
      65             :     {
      66          21 :         aSvcImplNames.realloc(0);
      67          21 :         nLastTriedSvcIndex  = -1;
      68          21 :         bAlreadyWarned      = false;
      69          21 :         bDoWarnAgain        = false;
      70          21 :     }
      71             : };
      72             : 
      73          22 : struct LangSvcEntries_Spell : public LangSvcEntries
      74             : {
      75             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > >  aSvcRefs;
      76             : 
      77             :     LangSvcEntries_Spell() : LangSvcEntries() {}
      78          22 :     LangSvcEntries_Spell( const css::uno::Sequence< OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
      79             : };
      80             : 
      81             : struct LangSvcEntries_Grammar : public LangSvcEntries
      82             : {
      83             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XProofreader > >  aSvcRefs;
      84             : 
      85             :     LangSvcEntries_Grammar() : LangSvcEntries() {}
      86             :     LangSvcEntries_Grammar( const OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
      87             : };
      88             : 
      89         440 : struct LangSvcEntries_Hyph : public LangSvcEntries
      90             : {
      91             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > >  aSvcRefs;
      92             : 
      93             :     LangSvcEntries_Hyph() : LangSvcEntries() {}
      94         440 :     LangSvcEntries_Hyph( const OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
      95             : };
      96             : 
      97           0 : struct LangSvcEntries_Thes : public LangSvcEntries
      98             : {
      99             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XThesaurus > >  aSvcRefs;
     100             : 
     101             :     LangSvcEntries_Thes() : LangSvcEntries() {}
     102           0 :     LangSvcEntries_Thes( const css::uno::Sequence< OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
     103             : };
     104             : 
     105             : 
     106             : // virtual base class for the different dispatchers
     107          65 : class LinguDispatcher
     108             : {
     109             : public:
     110             :     enum DspType    { DSP_SPELL, DSP_HYPH, DSP_THES, DSP_GRAMMAR };
     111             : 
     112             :     virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames ) = 0;
     113             :     virtual css::uno::Sequence< OUString > GetServiceList( const css::lang::Locale &rLocale ) const = 0;
     114             :     virtual DspType GetDspType() const = 0;
     115             : 
     116             : protected:
     117          61 :     ~LinguDispatcher() {}
     118             : };
     119             : 
     120             : 
     121             : #endif
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10