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

Generated by: LCOV version 1.10