LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/linguistic - lngprophelp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-12-27 Functions: 0 9 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 _LINGUISTIC_LNGPROPHELP_HXX_
      21             : #define _LINGUISTIC_LNGPROPHELP_HXX_
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <uno/lbnames.h>
      25             : #include <cppuhelper/implbase2.hxx>
      26             : #include <cppuhelper/interfacecontainer.h>
      27             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      28             : #include <com/sun/star/beans/PropertyValues.hpp>
      29             : #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
      30             : #include <linguistic/lngdllapi.h>
      31             : 
      32             : namespace com { namespace sun { namespace star { namespace beans {
      33             :     class   XPropertySet;
      34             : }}}}
      35             : 
      36             : namespace com { namespace sun { namespace star { namespace linguistic2 {
      37             :     struct  LinguServiceEvent;
      38             : }}}}
      39             : 
      40             : 
      41             : namespace linguistic
      42             : {
      43             : 
      44             : // PropertyChgHelper
      45             : // Base class for all XPropertyChangeListener members of the
      46             : // various lingu services.
      47             : 
      48             : 
      49             : // Flags for type of events allowed to be launched
      50             : #define AE_SPELLCHECKER 1
      51             : #define AE_HYPHENATOR   2
      52             : 
      53             : typedef cppu::WeakImplHelper2
      54             : <
      55             :     ::com::sun::star::beans::XPropertyChangeListener,
      56             :     ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster
      57             : > PropertyChgHelperBase;
      58             : 
      59             : class PropertyChgHelper :
      60             :     public PropertyChgHelperBase
      61             : {
      62             :     ::com::sun::star::uno::Sequence< ::rtl::OUString >  aPropNames;
      63             :     ::com::sun::star::uno::Reference<
      64             :         ::com::sun::star::uno::XInterface >             xMyEvtObj;
      65             :     ::cppu::OInterfaceContainerHelper                   aLngSvcEvtListeners;
      66             :     ::com::sun::star::uno::Reference<
      67             :         ::com::sun::star::beans::XPropertySet >         xPropSet;
      68             : 
      69             :     int     nEvtFlags;  // flags for event types allowed to be launched
      70             : 
      71             :     // default values
      72             :     sal_Bool    bIsIgnoreControlCharacters;
      73             :     sal_Bool    bIsUseDictionaryList;
      74             : 
      75             :     // return values, will be set to default value or current temporary value
      76             :     sal_Bool    bResIsIgnoreControlCharacters;
      77             :     sal_Bool    bResIsUseDictionaryList;
      78             : 
      79             : 
      80             :     // disallow use of copy-constructor and assignment-operator
      81             :     PropertyChgHelper( const PropertyChgHelper & );
      82             :     PropertyChgHelper & operator = ( const PropertyChgHelper & );
      83             : 
      84             : protected:
      85             :     virtual void    SetDefaultValues();
      86             :     virtual void    GetCurrentValues();
      87             : 
      88             :     ::com::sun::star::uno::Sequence< ::rtl::OUString > &
      89           0 :             GetPropNames()  { return aPropNames; }
      90             :     ::com::sun::star::uno::Reference<
      91             :         ::com::sun::star::beans::XPropertySet > &
      92           0 :             GetPropSet()    { return xPropSet; }
      93             : 
      94             :     void    AddPropNames( const char *pNewNames[], sal_Int32 nCount );
      95             : 
      96             :     virtual sal_Bool    propertyChange_Impl(
      97             :                             const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
      98             : 
      99             : public:
     100             :     PropertyChgHelper(
     101             :             const ::com::sun::star::uno::Reference<
     102             :                 ::com::sun::star::uno::XInterface > &rxSource,
     103             :             ::com::sun::star::uno::Reference<
     104             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet,
     105             :             int nAllowedEvents );
     106             :     virtual ~PropertyChgHelper();
     107             : 
     108             :     virtual void    SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     109             : 
     110             :     // XEventListener
     111             :     virtual void SAL_CALL
     112             :         disposing( const ::com::sun::star::lang::EventObject& rSource )
     113             :             throw(::com::sun::star::uno::RuntimeException);
     114             : 
     115             :     // XPropertyChangeListener
     116             :     virtual void SAL_CALL
     117             :         propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
     118             :             throw(::com::sun::star::uno::RuntimeException);
     119             : 
     120             :     // XLinguServiceEventBroadcaster
     121             :     virtual sal_Bool SAL_CALL
     122             :         addLinguServiceEventListener(
     123             :                 const ::com::sun::star::uno::Reference<
     124             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     125             :             throw(::com::sun::star::uno::RuntimeException);
     126             :     virtual sal_Bool SAL_CALL
     127             :         removeLinguServiceEventListener(
     128             :                 const ::com::sun::star::uno::Reference<
     129             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     130             :             throw(::com::sun::star::uno::RuntimeException);
     131             : 
     132             :     // non-UNO functions
     133             :     void    LNG_DLLPUBLIC AddAsPropListener();
     134             :     void    LNG_DLLPUBLIC RemoveAsPropListener();
     135             :     void    LaunchEvent(
     136             :                 const ::com::sun::star::linguistic2::LinguServiceEvent& rEvt );
     137             : 
     138             :     const ::com::sun::star::uno::Sequence< ::rtl::OUString > &
     139             :             GetPropNames() const    { return aPropNames; }
     140             :     const ::com::sun::star::uno::Reference<
     141             :         ::com::sun::star::beans::XPropertySet > &
     142             :             GetPropSet() const      { return xPropSet; }
     143             :     const ::com::sun::star::uno::Reference<
     144             :         ::com::sun::star::uno::XInterface > &
     145           0 :             GetEvtObj() const       { return xMyEvtObj; }
     146             : 
     147             :     sal_Bool    IsIgnoreControlCharacters() const   { return bResIsIgnoreControlCharacters; }
     148             :     sal_Bool    IsUseDictionaryList() const         { return bResIsUseDictionaryList; }
     149             : };
     150             : 
     151             : 
     152             : class PropertyHelper_Thes :
     153             :     public PropertyChgHelper
     154             : {
     155             :     // disallow use of copy-constructor and assignment-operator
     156             :     PropertyHelper_Thes( const PropertyHelper_Thes & );
     157             :     PropertyHelper_Thes & operator = ( const PropertyHelper_Thes & );
     158             : 
     159             : public:
     160             :     PropertyHelper_Thes(
     161             :             const ::com::sun::star::uno::Reference<
     162             :                 ::com::sun::star::uno::XInterface > &rxSource,
     163             :             ::com::sun::star::uno::Reference<
     164             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet );
     165             :     virtual ~PropertyHelper_Thes();
     166             : 
     167             :     // XPropertyChangeListener
     168             :     virtual void SAL_CALL
     169             :         propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
     170             :             throw(::com::sun::star::uno::RuntimeException);
     171             : };
     172             : 
     173             : class LNG_DLLPUBLIC PropertyHelper_Thesaurus
     174             : {
     175             :     PropertyHelper_Thes* pInst;
     176             :     com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >    xPropHelper;
     177             : 
     178             :     // disallow use of copy-constructor and assignment-operator
     179             :     PropertyHelper_Thesaurus( const PropertyHelper_Thes & );
     180             :     PropertyHelper_Thesaurus & operator = ( const PropertyHelper_Thes & );
     181             : 
     182             : public:
     183             :     PropertyHelper_Thesaurus(
     184             :             const ::com::sun::star::uno::Reference<
     185             :                 ::com::sun::star::uno::XInterface > &rxSource,
     186             :             ::com::sun::star::uno::Reference<
     187             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet );
     188             :     ~PropertyHelper_Thesaurus();
     189             :     void    AddAsPropListener();
     190             :     void    RemoveAsPropListener();
     191             :     void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     192             : };
     193             : 
     194             : 
     195             : class LNG_DLLPUBLIC PropertyHelper_Spell :
     196             :     public PropertyChgHelper
     197             : {
     198             :     // default values
     199             :     sal_Bool    bIsSpellUpperCase;
     200             :     sal_Bool    bIsSpellWithDigits;
     201             :     sal_Bool    bIsSpellCapitalization;
     202             : 
     203             :     // return values, will be set to default value or current temporary value
     204             :     sal_Int16   nResMaxNumberOfSuggestions; // special value that is not part of the property set and thus needs to be handled differently
     205             :     sal_Bool    bResIsSpellUpperCase;
     206             :     sal_Bool    bResIsSpellWithDigits;
     207             :     sal_Bool    bResIsSpellCapitalization;
     208             : 
     209             : 
     210             :     // disallow use of copy-constructor and assignment-operator
     211             :     PropertyHelper_Spell( const PropertyHelper_Spell & );
     212             :     PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & );
     213             : 
     214             : protected:
     215             :     // PropertyChgHelper
     216             :     virtual void    SetDefaultValues();
     217             :     virtual void    GetCurrentValues();
     218             :     virtual sal_Bool    propertyChange_Impl(
     219             :                             const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
     220             : 
     221             : public:
     222             :     PropertyHelper_Spell(
     223             :             const ::com::sun::star::uno::Reference<
     224             :                 ::com::sun::star::uno::XInterface > &rxSource,
     225             :             ::com::sun::star::uno::Reference<
     226             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet );
     227             :     virtual ~PropertyHelper_Spell();
     228             : 
     229             :     virtual void    SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     230             : 
     231             :     // XPropertyChangeListener
     232             :     virtual void SAL_CALL
     233             :         propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
     234             :             throw(::com::sun::star::uno::RuntimeException);
     235             : 
     236             :     virtual sal_Int16   GetDefaultNumberOfSuggestions() const;
     237             : 
     238             :     sal_Int16   GetMaxNumberOfSuggestions() const   { return nResMaxNumberOfSuggestions; }
     239           0 :     sal_Bool    IsSpellUpperCase() const            { return bResIsSpellUpperCase; }
     240           0 :     sal_Bool    IsSpellWithDigits() const           { return bResIsSpellWithDigits; }
     241           0 :     sal_Bool    IsSpellCapitalization() const       { return bResIsSpellCapitalization; }
     242             : };
     243             : 
     244             : 
     245             : class LNG_DLLPUBLIC PropertyHelper_Spelling
     246             : {
     247             :     PropertyHelper_Spell* pInst;
     248             :     com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >    xPropHelper;
     249             : 
     250             :     // disallow use of copy-constructor and assignment-operator
     251             :     PropertyHelper_Spelling( const PropertyHelper_Spell & );
     252             :     PropertyHelper_Spelling & operator = ( const PropertyHelper_Spell & );
     253             : 
     254             : public:
     255             :     PropertyHelper_Spelling(
     256             :             const ::com::sun::star::uno::Reference<
     257             :                 ::com::sun::star::uno::XInterface > &rxSource,
     258             :             ::com::sun::star::uno::Reference<
     259             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet );
     260             :     ~PropertyHelper_Spelling();
     261             : 
     262             :     void    AddAsPropListener();
     263             :     void    RemoveAsPropListener();
     264             :     void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     265             :     sal_Bool    IsSpellUpperCase() const;
     266             :     sal_Bool    IsSpellWithDigits() const;
     267             :     sal_Bool    IsSpellCapitalization() const;
     268             :     sal_Bool addLinguServiceEventListener(
     269             :                 const ::com::sun::star::uno::Reference<
     270             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     271             :             throw(::com::sun::star::uno::RuntimeException);
     272             :     sal_Bool removeLinguServiceEventListener(
     273             :                 const ::com::sun::star::uno::Reference<
     274             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     275             :             throw(::com::sun::star::uno::RuntimeException);
     276             : };
     277             : 
     278             : 
     279             : class PropertyHelper_Hyphen :
     280             :     public PropertyChgHelper
     281             : {
     282             :     // default values
     283             :     sal_Int16   nHyphMinLeading,
     284             :             nHyphMinTrailing,
     285             :             nHyphMinWordLength;
     286             : 
     287             :     // return values, will be set to default value or current temporary value
     288             :     sal_Int16   nResHyphMinLeading,
     289             :             nResHyphMinTrailing,
     290             :             nResHyphMinWordLength;
     291             : 
     292             :     // disallow use of copy-constructor and assignment-operator
     293             :     PropertyHelper_Hyphen( const PropertyHelper_Hyphen & );
     294             :     PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & );
     295             : 
     296             : protected:
     297             :     // PropertyChgHelper
     298             :     virtual void    SetDefaultValues();
     299             :     virtual void    GetCurrentValues();
     300             :     virtual sal_Bool    propertyChange_Impl(
     301             :                             const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
     302             : 
     303             : public:
     304             :     PropertyHelper_Hyphen(
     305             :             const ::com::sun::star::uno::Reference<
     306             :                 ::com::sun::star::uno::XInterface > &rxSource,
     307             :             ::com::sun::star::uno::Reference<
     308             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet);
     309             :     virtual ~PropertyHelper_Hyphen();
     310             : 
     311             :     virtual void    SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     312             : 
     313             :     // XPropertyChangeListener
     314             :     virtual void SAL_CALL
     315             :         propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
     316             :             throw(::com::sun::star::uno::RuntimeException);
     317             : 
     318           0 :     sal_Int16   GetMinLeading() const               { return nResHyphMinLeading; }
     319           0 :     sal_Int16   GetMinTrailing() const              { return nResHyphMinTrailing; }
     320           0 :     sal_Int16   GetMinWordLength() const            { return nResHyphMinWordLength; }
     321             : };
     322             : 
     323             : class LNG_DLLPUBLIC PropertyHelper_Hyphenation
     324             : {
     325             :     PropertyHelper_Hyphen* pInst;
     326             :     com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >    xPropHelper;
     327             : 
     328             :     // disallow use of copy-constructor and assignment-operator
     329             :     PropertyHelper_Hyphenation( const PropertyHelper_Hyphen & );
     330             :     PropertyHelper_Hyphenation & operator = ( const PropertyHelper_Hyphen & );
     331             : 
     332             : public:
     333             :     PropertyHelper_Hyphenation(
     334             :             const ::com::sun::star::uno::Reference<
     335             :                 ::com::sun::star::uno::XInterface > &rxSource,
     336             :             ::com::sun::star::uno::Reference<
     337             :                 ::com::sun::star::beans::XPropertySet > &rxPropSet);
     338             :     ~PropertyHelper_Hyphenation();
     339             : 
     340             :     void    AddAsPropListener();
     341             :     void    RemoveAsPropListener();
     342             :     void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
     343             :     sal_Int16   GetMinLeading() const;
     344             :     sal_Int16   GetMinTrailing() const;
     345             :     sal_Int16   GetMinWordLength() const;
     346             :     sal_Bool addLinguServiceEventListener(
     347             :                 const ::com::sun::star::uno::Reference<
     348             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     349             :             throw(::com::sun::star::uno::RuntimeException);
     350             :     sal_Bool removeLinguServiceEventListener(
     351             :                 const ::com::sun::star::uno::Reference<
     352             :                     ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
     353             :             throw(::com::sun::star::uno::RuntimeException);
     354             : };
     355             : 
     356             : }   // namespace linguistic
     357             : 
     358             : #endif
     359             : 
     360             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10