LCOV - code coverage report
Current view: top level - linguistic/source - lngopt.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 74 0.0 %
Date: 2014-04-14 Functions: 0 39 0.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_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           0 :             GetActiveDics() const   { return pData->aActiveDics; }
      64             : 
      65             :     const ::com::sun::star::uno::Sequence< OUString >
      66             :             GetActiveConvDics() const   { return pData->aActiveConvDics; }
      67             : };
      68             : 
      69             : 
      70             : 
      71             : // uses templates from <cppuhelper/interfacecontainer.h>
      72             : 
      73             : 
      74             : // helper function call class
      75             : struct PropHashType_Impl
      76             : {
      77             :     size_t operator()(const sal_Int32 &s) const { return s; }
      78             : };
      79             : 
      80             : typedef cppu::OMultiTypeInterfaceContainerHelperVar
      81             :     <
      82             :         sal_Int32,
      83             :         PropHashType_Impl
      84             :     > OPropertyListenerContainerHelper;
      85             : 
      86             : 
      87             : 
      88           0 : class LinguProps :
      89             :     public cppu::WeakImplHelper5
      90             :     <
      91             :         com::sun::star::linguistic2::XLinguProperties,
      92             :         com::sun::star::beans::XFastPropertySet,
      93             :         com::sun::star::beans::XPropertyAccess,
      94             :         com::sun::star::lang::XComponent,
      95             :         com::sun::star::lang::XServiceInfo
      96             :     >
      97             : {
      98             :     ::cppu::OInterfaceContainerHelper           aEvtListeners;
      99             :     OPropertyListenerContainerHelper            aPropListeners;
     100             : 
     101             :     SfxItemPropertyMap                          aPropertyMap;
     102             :     SvtLinguConfig                              aConfig;
     103             : 
     104             :     sal_Bool                                        bDisposing;
     105             : 
     106             :     // disallow copy-constructor and assignment-operator for now
     107             :     LinguProps(const LinguProps &);
     108             :     LinguProps & operator = (const LinguProps &);
     109             : 
     110             :     void    launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
     111             : 
     112             :     sal_Bool getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     113             :     sal_Int16 getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     114             :     css::lang::Locale getPropertyLocale(const OUString& aPropertyName) throw (css::uno::RuntimeException);
     115           0 :     void setProperty(const OUString& aPropertyName, sal_Bool p1) throw (css::uno::RuntimeException)
     116           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     117           0 :     void setProperty(const OUString& aPropertyName, sal_Int16 p1) throw (css::uno::RuntimeException)
     118           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     119           0 :     void setProperty(const OUString& aPropertyName, css::lang::Locale p1) throw (css::uno::RuntimeException)
     120           0 :         { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
     121             : 
     122             : public:
     123             :     LinguProps();
     124             : 
     125           0 :     virtual sal_Bool SAL_CALL getIsUseDictionaryList() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     126           0 :         { return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST); }
     127           0 :     virtual void SAL_CALL setIsUseDictionaryList(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     128           0 :         { setProperty(UPN_IS_USE_DICTIONARY_LIST, p1); }
     129           0 :     virtual sal_Bool SAL_CALL getIsIgnoreControlCharacters() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     130           0 :         { return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS); }
     131           0 :     virtual void SAL_CALL setIsIgnoreControlCharacters(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     132           0 :         { setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS, p1); }
     133           0 :     virtual sal_Bool SAL_CALL getIsSpellUpperCase() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     134           0 :         { return getPropertyBool(UPN_IS_SPELL_UPPER_CASE); }
     135           0 :     virtual void SAL_CALL setIsSpellUpperCase(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     136           0 :         { setProperty(UPN_IS_SPELL_UPPER_CASE, p1); }
     137           0 :     virtual sal_Bool SAL_CALL getIsSpellWithDigits() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     138           0 :         { return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS); }
     139           0 :     virtual void SAL_CALL setIsSpellWithDigits(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     140           0 :         { setProperty(UPN_IS_SPELL_WITH_DIGITS, p1); }
     141           0 :     virtual sal_Bool SAL_CALL getIsSpellCapitalization() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     142           0 :         { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); }
     143           0 :     virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     144           0 :         { setProperty(UPN_IS_SPELL_CAPITALIZATION, p1); }
     145           0 :     virtual sal_Int16 SAL_CALL getHyphMinLeading() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     146           0 :         { return getPropertyInt16(UPN_HYPH_MIN_LEADING); }
     147           0 :     virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     148           0 :         { setProperty(UPN_HYPH_MIN_LEADING, p1); }
     149           0 :     virtual sal_Int16 SAL_CALL getHyphMinTrailing() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     150           0 :         { return getPropertyInt16(UPN_HYPH_MIN_TRAILING); }
     151           0 :     virtual void SAL_CALL setHyphMinTrailing(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     152           0 :         { setProperty(UPN_HYPH_MIN_TRAILING, p1); }
     153           0 :     virtual sal_Int16 SAL_CALL getHyphMinWordLength() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     154           0 :         { return getPropertyInt16(UPN_HYPH_MIN_WORD_LENGTH); }
     155           0 :     virtual void SAL_CALL setHyphMinWordLength(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     156           0 :         { setProperty(UPN_HYPH_MIN_WORD_LENGTH, p1); }
     157           0 :     virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     158           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE); }
     159           0 :     virtual void SAL_CALL setDefaultLocale(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     160           0 :         { setProperty(UPN_DEFAULT_LOCALE, p1); }
     161           0 :     virtual sal_Bool SAL_CALL getIsHyphAuto() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     162           0 :         { return getPropertyBool(UPN_IS_HYPH_AUTO); }
     163           0 :     virtual void SAL_CALL setIsHyphAuto(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     164           0 :         { setProperty(UPN_IS_HYPH_AUTO, p1); }
     165           0 :     virtual sal_Bool SAL_CALL getIsHyphSpecial() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     166           0 :         { return getPropertyBool(UPN_IS_HYPH_SPECIAL); }
     167           0 :     virtual void SAL_CALL setIsHyphSpecial(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     168           0 :         { setProperty(UPN_IS_HYPH_SPECIAL, p1); }
     169           0 :     virtual sal_Bool SAL_CALL getIsSpellAuto() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     170           0 :         { return getPropertyBool(UPN_IS_SPELL_AUTO); }
     171           0 :     virtual void SAL_CALL setIsSpellAuto(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     172           0 :         { setProperty(UPN_IS_SPELL_AUTO, p1); }
     173           0 :     virtual sal_Bool SAL_CALL getIsSpellSpecial() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     174           0 :         { return getPropertyBool(UPN_IS_SPELL_SPECIAL); }
     175           0 :     virtual void SAL_CALL setIsSpellSpecial(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     176           0 :         { setProperty(UPN_IS_SPELL_SPECIAL, p1); }
     177           0 :     virtual sal_Bool SAL_CALL getIsWrapReverse() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     178           0 :         { return getPropertyBool(UPN_IS_WRAP_REVERSE); }
     179           0 :     virtual void SAL_CALL setIsWrapReverse(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     180           0 :         { setProperty(UPN_IS_WRAP_REVERSE, p1); }
     181           0 :     virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale_CJK() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     182           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK); }
     183           0 :     virtual void SAL_CALL setDefaultLocale_CJK(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     184           0 :         { setProperty(UPN_DEFAULT_LOCALE_CJK, p1); }
     185           0 :     virtual css::lang::Locale SAL_CALL getDefaultLocale_CTL() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     186           0 :         { return getPropertyLocale(UPN_DEFAULT_LOCALE_CTL); }
     187           0 :     virtual void SAL_CALL setDefaultLocale_CTL(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     188           0 :         { setProperty(UPN_DEFAULT_LOCALE_CTL, p1); }
     189             : 
     190             :     // XPropertySet
     191             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             :     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;
     193             :     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;
     194             :     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;
     195             :     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;
     196             :     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;
     197             :     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;
     198             : 
     199             :     // XFastPropertySet
     200             :     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;
     201             :     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;
     202             : 
     203             :     // XPropertyAccess
     204             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     205             :     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;
     206             : 
     207             :     // XComponent
     208             :     virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             :     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;
     210             :     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;
     211             : 
     212             :     // XServiceInfo
     213             :     virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     214             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             : 
     217             : 
     218             :     static inline OUString getImplementationName_Static() throw();
     219             :     static com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw();
     220             : };
     221             : 
     222           0 : inline OUString LinguProps::getImplementationName_Static() throw()
     223             : {
     224           0 :     return OUString( "com.sun.star.lingu2.LinguProps" );
     225             : }
     226             : 
     227             : 
     228             : #endif
     229             : 
     230             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10