LCOV - code coverage report
Current view: top level - linguistic/source - defs.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 15 23 65.2 %
Date: 2015-06-13 12:38:46 Functions: 9 12 75.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             : #ifndef INCLUDED_LINGUISTIC_SOURCE_DEFS_HXX
      21             : #define INCLUDED_LINGUISTIC_SOURCE_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         307 : 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         301 :     explicit LangSvcEntries( const css::uno::Sequence< OUString > &rSvcImplNames ) :
      47             :         aSvcImplNames(rSvcImplNames),
      48         301 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      49             :     {
      50         301 :     }
      51             : 
      52          43 :     explicit LangSvcEntries( const OUString &rSvcImplName ) :
      53          43 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      54             :     {
      55          43 :         aSvcImplNames.realloc(1);
      56          43 :         aSvcImplNames[0] = rSvcImplName;
      57          43 :     }
      58             : 
      59             :     bool    IsAlreadyWarned() const         { return bAlreadyWarned; }
      60             :     void    SetAlreadyWarned( bool bVal )   { bAlreadyWarned = bVal; }
      61             :     bool    IsDoWarnAgain() const           { return bDoWarnAgain; }
      62             :     void    SetDoWarnAgain( bool bVal )     { bDoWarnAgain = bVal; }
      63             : 
      64           0 :     inline void Clear()
      65             :     {
      66           0 :         aSvcImplNames.realloc(0);
      67           0 :         nLastTriedSvcIndex  = -1;
      68           0 :         bAlreadyWarned      = false;
      69           0 :         bDoWarnAgain        = false;
      70           0 :     }
      71             : };
      72             : 
      73         266 : struct LangSvcEntries_Spell : public LangSvcEntries
      74             : {
      75             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > >  aSvcRefs;
      76             : 
      77             :     LangSvcEntries_Spell() : LangSvcEntries() {}
      78         301 :     explicit 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             :     explicit LangSvcEntries_Grammar( const OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
      87             : };
      88             : 
      89          41 : struct LangSvcEntries_Hyph : public LangSvcEntries
      90             : {
      91             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > >  aSvcRefs;
      92             : 
      93             :     LangSvcEntries_Hyph() : LangSvcEntries() {}
      94          43 :     explicit 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 :     explicit LangSvcEntries_Thes( const css::uno::Sequence< OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
     103             : };
     104             : 
     105             : 
     106             : // virtual base class for the different dispatchers
     107         131 : 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         119 :     ~LinguDispatcher() {}
     118             : };
     119             : 
     120             : 
     121             : #endif
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11