LCOV - code coverage report
Current view: top level - libreoffice/linguistic/source - defs.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 23 8.7 %
Date: 2012-12-27 Functions: 2 12 16.7 %
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           0 : struct LangSvcEntries
      37             : {
      38             :     css::uno::Sequence< ::rtl::OUString >   aSvcImplNames;
      39             : 
      40             :     sal_Int16   nLastTriedSvcIndex;
      41             :     bool        bAlreadyWarned;
      42             :     bool        bDoWarnAgain;
      43             : 
      44             :     LangSvcEntries() : nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false) {}
      45             : 
      46           0 :     inline LangSvcEntries( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) :
      47             :         aSvcImplNames(rSvcImplNames),
      48           0 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      49             :     {
      50           0 :     }
      51             : 
      52           0 :     inline LangSvcEntries( const ::rtl::OUString &rSvcImplName ) :
      53           0 :         nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
      54             :     {
      55           0 :         aSvcImplNames.realloc(1);
      56           0 :         aSvcImplNames[0] = rSvcImplName;
      57           0 :     }
      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           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           0 : struct LangSvcEntries_Spell : public LangSvcEntries
      74             : {
      75             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > >  aSvcRefs;
      76             : 
      77             :     LangSvcEntries_Spell() : LangSvcEntries() {}
      78           0 :     LangSvcEntries_Spell( const css::uno::Sequence< ::rtl::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 ::rtl::OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
      87             : };
      88             : 
      89           0 : struct LangSvcEntries_Hyph : public LangSvcEntries
      90             : {
      91             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > >  aSvcRefs;
      92             : 
      93             :     LangSvcEntries_Hyph() : LangSvcEntries() {}
      94           0 :     LangSvcEntries_Hyph( const ::rtl::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< ::rtl::OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
     103             : };
     104             : 
     105             : 
     106             : // virtual base class for the different dispatchers
     107          13 : 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< rtl::OUString > &rSvcImplNames ) = 0;
     113             :     virtual css::uno::Sequence< rtl::OUString > GetServiceList( const css::lang::Locale &rLocale ) const = 0;
     114             :     virtual DspType GetDspType() const = 0;
     115             : 
     116             : protected:
     117           2 :     ~LinguDispatcher() {}
     118             : };
     119             : 
     120             : 
     121             : #endif
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10