LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/linguistic/source - lngopt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 74 10.8 %
Date: 2013-07-09 Functions: 6 39 15.4 %
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_LNGOPT_HHX_
      21             : #define _LINGUISTIC_LNGOPT_HHX_
      22             : 
      23             : #include <functional>
      24             : 
      25             : #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
      26             : #include <cppuhelper/implbase5.hxx> // helper for implementations
      27             : #include <cppuhelper/interfacecontainer.hxx>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : #include <com/sun/star/beans/XFastPropertySet.hpp>
      30             : #include <com/sun/star/beans/XPropertyAccess.hpp>
      31             : #include <com/sun/star/lang/XServiceInfo.hpp>
      32             : #include <com/sun/star/lang/XComponent.hpp>
      33             : #include <com/sun/star/linguistic2/XLinguProperties.hpp>
      34             : #include <unotools/lingucfg.hxx>
      35             : #include <svl/itemprop.hxx>
      36             : #include <unotools/configitem.hxx>
      37             : #include <unotools/linguprops.hxx>
      38             : #include <com/sun/star/uno/Any.h>
      39             : #include <tools/solar.h>
      40             : 
      41             : #include "linguistic/misc.hxx"
      42             : #include "defs.hxx"
      43             : 
      44             : namespace com { namespace sun { namespace star {
      45             :     namespace beans {
      46             :         struct PropertyChangeEvent;
      47             :     }
      48             : }}}
      49             : 
      50             : 
      51             : 
      52             : // LinguOptions
      53             : // This class represents all Linguistik relevant options.
      54             : 
      55             : class LinguOptions
      56             : {
      57             :     static SvtLinguOptions     *pData;
      58             :     static oslInterlockedCount  nRefCount;  // number of objects of this class
      59             : 
      60             : public:
      61             :     LinguOptions();
      62             :     LinguOptions(const LinguOptions &rOpt);
      63             :     ~LinguOptions();
      64             : 
      65             :     static OUString    GetName( sal_Int32 nWID );
      66             : 
      67             :     const ::com::sun::star::uno::Sequence< OUString >
      68          20 :             GetActiveDics() const   { return pData->aActiveDics; }
      69             : 
      70             :     const ::com::sun::star::uno::Sequence< OUString >
      71             :             GetActiveConvDics() const   { return pData->aActiveConvDics; }
      72             : };
      73             : 
      74             : 
      75             : 
      76             : // uses templates from <cppuhelper/interfacecontainer.h>
      77             : 
      78             : 
      79             : // helper function call class
      80             : struct PropHashType_Impl
      81             : {
      82             :     size_t operator()(const sal_Int32 &s) const { return s; }
      83             : };
      84             : 
      85             : typedef cppu::OMultiTypeInterfaceContainerHelperVar
      86             :     <
      87             :         sal_Int32,
      88             :         PropHashType_Impl,
      89             :         std::equal_to< sal_Int32 >
      90             :     > OPropertyListenerContainerHelper;
      91             : 
      92             : 
      93             : 
      94          54 : class LinguProps :
      95             :     public cppu::WeakImplHelper5
      96             :     <
      97             :         com::sun::star::linguistic2::XLinguProperties,
      98             :         com::sun::star::beans::XFastPropertySet,
      99             :         com::sun::star::beans::XPropertyAccess,
     100             :         com::sun::star::lang::XComponent,
     101             :         com::sun::star::lang::XServiceInfo
     102             :     >
     103             : {
     104             :     ::cppu::OInterfaceContainerHelper           aEvtListeners;
     105             :     OPropertyListenerContainerHelper            aPropListeners;
     106             : 
     107             :     SfxItemPropertyMap                          aPropertyMap;
     108             :     SvtLinguConfig                              aConfig;
     109             : 
     110             :     sal_Bool                                        bDisposing;
     111             : 
     112             :     // disallow copy-constructor and assignment-operator for now
     113             :     LinguProps(const LinguProps &);
     114             :     LinguProps & operator = (const LinguProps &);
     115             : 
     116             :     void    launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
     117             : 
     118             :     sal_Bool getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     119             :     sal_Int16 getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     120             :     css::lang::Locale getPropertyLocale(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     121           0 :     void setProperty(const OUString& aPropertyName, sal_Bool p1) throw (css::uno::RuntimeException)
     122           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     123           0 :     void setProperty(const OUString& aPropertyName, sal_Int16 p1) throw (css::uno::RuntimeException)
     124           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     125           0 :     void setProperty(const OUString& aPropertyName, css::lang::Locale p1) throw (css::uno::RuntimeException)
     126           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     127             : 
     128             : public:
     129             :     LinguProps();
     130             : 
     131           0 :     virtual sal_Bool SAL_CALL getIsUseDictionaryList() throw (css::uno::RuntimeException)
     132           0 :         { return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST); }
     133           0 :     virtual void SAL_CALL setIsUseDictionaryList(sal_Bool p1) throw (css::uno::RuntimeException)
     134           0 :         { setProperty(UPN_IS_USE_DICTIONARY_LIST, p1); }
     135           0 :     virtual sal_Bool SAL_CALL getIsIgnoreControlCharacters() throw (css::uno::RuntimeException)
     136           0 :         { return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS); }
     137           0 :     virtual void SAL_CALL setIsIgnoreControlCharacters(sal_Bool p1) throw (css::uno::RuntimeException)
     138           0 :         { setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS, p1); }
     139           0 :     virtual sal_Bool SAL_CALL getIsSpellUpperCase() throw (css::uno::RuntimeException)
     140           0 :         { return getPropertyBool(UPN_IS_SPELL_UPPER_CASE); }
     141           0 :     virtual void SAL_CALL setIsSpellUpperCase(sal_Bool p1) throw (css::uno::RuntimeException)
     142           0 :         { setProperty(UPN_IS_SPELL_UPPER_CASE, p1); }
     143           0 :     virtual sal_Bool SAL_CALL getIsSpellWithDigits() throw (css::uno::RuntimeException)
     144           0 :         { return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS); }
     145           0 :     virtual void SAL_CALL setIsSpellWithDigits(sal_Bool p1) throw (css::uno::RuntimeException)
     146           0 :         { setProperty(UPN_IS_SPELL_WITH_DIGITS, p1); }
     147           0 :     virtual sal_Bool SAL_CALL getIsSpellCapitalization() throw (css::uno::RuntimeException)
     148           0 :         { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); }
     149           0 :     virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) throw (css::uno::RuntimeException)
     150           0 :         { setProperty(UPN_IS_SPELL_CAPITALIZATION, p1); }
     151           0 :     virtual sal_Int16 SAL_CALL getHyphMinLeading() throw (css::uno::RuntimeException)
     152           0 :         { return getPropertyBool(UPN_HYPH_MIN_LEADING); }
     153           0 :     virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) throw (css::uno::RuntimeException)
     154           0 :         { setProperty(UPN_HYPH_MIN_LEADING, p1); }
     155           0 :     virtual sal_Int16 SAL_CALL getHyphMinTrailing() throw (css::uno::RuntimeException)
     156           0 :         { return getPropertyInt16(UPN_HYPH_MIN_TRAILING); }
     157           0 :     virtual void SAL_CALL setHyphMinTrailing(sal_Int16 p1) throw (css::uno::RuntimeException)
     158           0 :         { setProperty(UPN_HYPH_MIN_TRAILING, p1); }
     159           0 :     virtual sal_Int16 SAL_CALL getHyphMinWordLength() throw (css::uno::RuntimeException)
     160           0 :         { return getPropertyInt16(UPN_HYPH_MIN_WORD_LENGTH); }
     161           0 :     virtual void SAL_CALL setHyphMinWordLength(sal_Int16 p1) throw (css::uno::RuntimeException)
     162           0 :         { setProperty(UPN_HYPH_MIN_WORD_LENGTH, p1); }
     163           0 :     virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale() throw (css::uno::RuntimeException)
     164           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE); }
     165           0 :     virtual void SAL_CALL setDefaultLocale(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException)
     166           0 :         { setProperty(UPN_DEFAULT_LOCALE, p1); }
     167           0 :     virtual sal_Bool SAL_CALL getIsHyphAuto() throw (css::uno::RuntimeException)
     168           0 :         { return getPropertyBool(UPN_IS_HYPH_AUTO); }
     169           0 :     virtual void SAL_CALL setIsHyphAuto(sal_Bool p1) throw (css::uno::RuntimeException)
     170           0 :         { setProperty(UPN_IS_HYPH_AUTO, p1); }
     171           0 :     virtual sal_Bool SAL_CALL getIsHyphSpecial() throw (css::uno::RuntimeException)
     172           0 :         { return getPropertyBool(UPN_IS_HYPH_SPECIAL); }
     173           0 :     virtual void SAL_CALL setIsHyphSpecial(sal_Bool p1) throw (css::uno::RuntimeException)
     174           0 :         { setProperty(UPN_IS_HYPH_SPECIAL, p1); }
     175           0 :     virtual sal_Bool SAL_CALL getIsSpellAuto() throw (css::uno::RuntimeException)
     176           0 :         { return getPropertyBool(UPN_IS_SPELL_AUTO); }
     177           0 :     virtual void SAL_CALL setIsSpellAuto(sal_Bool p1) throw (css::uno::RuntimeException)
     178           0 :         { setProperty(UPN_IS_SPELL_AUTO, p1); }
     179           9 :     virtual sal_Bool SAL_CALL getIsSpellSpecial() throw (css::uno::RuntimeException)
     180           9 :         { return getPropertyBool(UPN_IS_SPELL_SPECIAL); }
     181           0 :     virtual void SAL_CALL setIsSpellSpecial(sal_Bool p1) throw (css::uno::RuntimeException)
     182           0 :         { setProperty(UPN_IS_SPELL_SPECIAL, p1); }
     183          18 :     virtual sal_Bool SAL_CALL getIsWrapReverse() throw (css::uno::RuntimeException)
     184          18 :         { return getPropertyBool(UPN_IS_WRAP_REVERSE); }
     185           0 :     virtual void SAL_CALL setIsWrapReverse(sal_Bool p1) throw (css::uno::RuntimeException)
     186           0 :         { setProperty(UPN_IS_WRAP_REVERSE, p1); }
     187           0 :     virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale_CJK() throw (css::uno::RuntimeException)
     188           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK); }
     189           0 :     virtual void SAL_CALL setDefaultLocale_CJK(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException)
     190           0 :         { setProperty(UPN_DEFAULT_LOCALE_CJK, p1); }
     191           0 :     virtual css::lang::Locale SAL_CALL getDefaultLocale_CTL() throw (css::uno::RuntimeException)
     192           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE_CTL); }
     193           0 :     virtual void SAL_CALL setDefaultLocale_CTL(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException)
     194           0 :         { setProperty(UPN_DEFAULT_LOCALE_CTL, p1); }
     195             : 
     196             :     // XPropertySet
     197             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
     198             :     virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     199             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     200             :     virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     201             :     virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     202             :     virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     203             :     virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     204             : 
     205             :     // XFastPropertySet
     206             :     virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     207             :     virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     208             : 
     209             :     // XPropertyAccess
     210             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
     211             :     virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     212             : 
     213             :     // XComponent
     214             :     virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
     215             :     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
     216             :     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
     217             : 
     218             :     // XServiceInfo
     219             :     virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
     220             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     221             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
     222             : 
     223             : 
     224             :     static inline OUString getImplementationName_Static() throw();
     225             :     static com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw();
     226             : };
     227             : 
     228          86 : inline OUString LinguProps::getImplementationName_Static() throw()
     229             : {
     230          86 :     return OUString( "com.sun.star.lingu2.LinguProps" );
     231             : }
     232             : 
     233             : 
     234             : #endif
     235             : 
     236             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10