LCOV - code coverage report
Current view: top level - libreoffice/unotools/inc/unotools - lingucfg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 3 66.7 %
Date: 2012-12-27 Functions: 3 6 50.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 _unotools_LINGUCFG_HXX_
      21             : #define _unotools_LINGUCFG_HXX_
      22             : 
      23             : #include "unotools/unotoolsdllapi.h"
      24             : #include <com/sun/star/beans/PropertyValues.hpp>
      25             : #include <com/sun/star/uno/Sequence.hxx>
      26             : #include <com/sun/star/uno/Any.h>
      27             : #include <com/sun/star/lang/Locale.hpp>
      28             : #include <com/sun/star/util/XChangesBatch.hpp>
      29             : #include <tools/solar.h>
      30             : #include <rtl/ustring.hxx>
      31             : #include <unotools/configitem.hxx>
      32             : #include <osl/mutex.hxx>
      33             : #include <unotools/options.hxx>
      34             : #include <i18npool/lang.h>
      35             : 
      36             : #include <vector>
      37             : 
      38             : class SvtLinguConfigItem;
      39             : 
      40             : //////////////////////////////////////////////////////////////////////
      41             : 
      42        4482 : struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
      43             : {
      44             :     ::com::sun::star::uno::Sequence< rtl::OUString >    aActiveDics;
      45             :     ::com::sun::star::uno::Sequence< rtl::OUString >    aActiveConvDics;
      46             : 
      47             :     sal_Bool                                                bROActiveDics;
      48             :     sal_Bool                                                bROActiveConvDics;
      49             : 
      50             :     // Hyphenator service specific options
      51             :     sal_Int16   nHyphMinLeading,
      52             :             nHyphMinTrailing,
      53             :             nHyphMinWordLength;
      54             : 
      55             :     sal_Bool    bROHyphMinLeading,
      56             :             bROHyphMinTrailing,
      57             :             bROHyphMinWordLength;
      58             : 
      59             :     // misc options (non-service specific)
      60             :     sal_Int16   nDefaultLanguage;
      61             :     sal_Int16   nDefaultLanguage_CJK;
      62             :     sal_Int16   nDefaultLanguage_CTL;
      63             : 
      64             :     sal_Bool    bRODefaultLanguage;
      65             :     sal_Bool    bRODefaultLanguage_CJK;
      66             :     sal_Bool    bRODefaultLanguage_CTL;
      67             : 
      68             :     // spelling options (non-service specific)
      69             :     sal_Bool    bIsSpellSpecial;
      70             :     sal_Bool    bIsSpellAuto;
      71             :     sal_Bool    bIsSpellReverse;
      72             : 
      73             :     sal_Bool    bROIsSpellSpecial;
      74             :     sal_Bool    bROIsSpellAuto;
      75             :     sal_Bool    bROIsSpellReverse;
      76             : 
      77             :     // hyphenation options (non-service specific)
      78             :     sal_Bool    bIsHyphSpecial;
      79             :     sal_Bool    bIsHyphAuto;
      80             : 
      81             :     sal_Bool    bROIsHyphSpecial;
      82             :     sal_Bool    bROIsHyphAuto;
      83             : 
      84             :     // common to SpellChecker, Hyphenator and Thesaurus service
      85             :     sal_Bool    bIsUseDictionaryList;
      86             :     sal_Bool    bIsIgnoreControlCharacters;
      87             : 
      88             :     sal_Bool    bROIsUseDictionaryList;
      89             :     sal_Bool    bROIsIgnoreControlCharacters;
      90             : 
      91             :     // SpellChecker service specific options
      92             :     sal_Bool    bIsSpellWithDigits,
      93             :             bIsSpellUpperCase,
      94             :             bIsSpellCapitalization;
      95             : 
      96             :     sal_Bool    bROIsSpellWithDigits,
      97             :             bROIsSpellUpperCase,
      98             :             bROIsSpellCapitalization;
      99             : 
     100             :     // text conversion specific options
     101             :     sal_Bool    bIsIgnorePostPositionalWord;
     102             :     sal_Bool    bIsAutoCloseDialog;
     103             :     sal_Bool    bIsShowEntriesRecentlyUsedFirst;
     104             :     sal_Bool    bIsAutoReplaceUniqueEntries;
     105             :     sal_Bool    bIsDirectionToSimplified;
     106             :     sal_Bool    bIsUseCharacterVariants;
     107             :     sal_Bool    bIsTranslateCommonTerms;
     108             :     sal_Bool    bIsReverseMapping;
     109             : 
     110             :     sal_Bool    bROIsIgnorePostPositionalWord;
     111             :     sal_Bool    bROIsAutoCloseDialog;
     112             :     sal_Bool    bROIsShowEntriesRecentlyUsedFirst;
     113             :     sal_Bool    bROIsAutoReplaceUniqueEntries;
     114             :     sal_Bool    bROIsDirectionToSimplified;
     115             :     sal_Bool    bROIsUseCharacterVariants;
     116             :     sal_Bool    bROIsTranslateCommonTerms;
     117             :     sal_Bool    bROIsReverseMapping;
     118             : 
     119             :     // check value need to determine if the configuration needs to updatet
     120             :     // or not (used for a quick check if data files have been changed/added
     121             :     // or deleted
     122             :     sal_Int32   nDataFilesChangedCheckValue;
     123             :     sal_Bool    bRODataFilesChangedCheckValue;
     124             : 
     125             :     sal_Bool    bIsGrammarAuto;
     126             :     sal_Bool    bIsGrammarInteractive;
     127             : 
     128             :     sal_Bool    bROIsGrammarAuto;
     129             :     sal_Bool    bROIsGrammarInteractive;
     130             : 
     131             :     SvtLinguOptions();
     132             : };
     133             : 
     134             : //////////////////////////////////////////////////////////////////////
     135             : 
     136           0 : struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
     137             : {
     138             :     // the URL's pointing to the location of the files the dictionary consists of
     139             :     com::sun::star::uno::Sequence< rtl::OUString >  aLocations;
     140             :     // the name of the dictionary format implement
     141             :     rtl::OUString                                   aFormatName;
     142             :     // the list of languages (ISO names) the dictionary can be used for
     143             :     com::sun::star::uno::Sequence< rtl::OUString >  aLocaleNames;
     144             : };
     145             : 
     146             : //////////////////////////////////////////////////////////////////////
     147             : 
     148             : class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options
     149             : {
     150             :     // returns static object
     151             :     UNOTOOLS_DLLPRIVATE SvtLinguConfigItem &   GetConfigItem();
     152             : 
     153        5410 :     SvtLinguConfigItem &   GetConfigItem() const    { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); }
     154             : 
     155             :     // configuration update access for the 'Linguistic' main node
     156             :     mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess;
     157             : 
     158             :     com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const;
     159             : 
     160             :     com::sun::star::uno::Sequence< rtl::OUString > GetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName ) const;
     161             :     void SetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName, const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const;
     162             : 
     163             :     rtl::OUString GetVendorImageUrl_Impl( const rtl::OUString &rServiceImplName, const rtl::OUString &rImageName ) const;
     164             : 
     165             :     // disallow copy-constructor and assignment-operator for now
     166             :     SvtLinguConfig( const SvtLinguConfig & );
     167             :     SvtLinguConfig & operator = ( const SvtLinguConfig & );
     168             : 
     169             : public:
     170             :     SvtLinguConfig();
     171             :     virtual ~SvtLinguConfig();
     172             : 
     173             :     //
     174             :     // borrowed from utl::ConfigItem
     175             :     //
     176             :     com::sun::star::uno::Sequence< rtl::OUString >
     177             :         GetNodeNames( const rtl::OUString &rNode );
     178             :     //
     179             :     com::sun::star::uno::Sequence< com::sun::star::uno::Any >
     180             :         GetProperties(
     181             :             const com::sun::star::uno::Sequence< rtl::OUString > &rNames );
     182             :     //
     183             :     sal_Bool
     184             :         ReplaceSetProperties(
     185             :             const rtl::OUString &rNode,
     186             :             com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues );
     187             : 
     188             :     com::sun::star::uno::Any
     189             :             GetProperty( const rtl::OUString &rPropertyName ) const;
     190             :     com::sun::star::uno::Any
     191             :             GetProperty( sal_Int32 nPropertyHandle ) const;
     192             : 
     193             :     sal_Bool    SetProperty( const rtl::OUString &rPropertyName,
     194             :                          const com::sun::star::uno::Any &rValue );
     195             :     sal_Bool    SetProperty( sal_Int32 nPropertyHandle,
     196             :                          const com::sun::star::uno::Any &rValue );
     197             : 
     198             :     sal_Bool    GetOptions( SvtLinguOptions &rOptions ) const;
     199             : 
     200             :     sal_Bool    IsReadOnly( const rtl::OUString &rPropertyName ) const;
     201             : 
     202             :     //!
     203             :     //! the following functions work on the 'ServiceManager' sub node of the
     204             :     //! linguistic configuration only
     205             :     //!
     206             :     sal_Bool GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const;
     207             :     //
     208             :     sal_Bool GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const;
     209             : 
     210             :     sal_Bool GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const;
     211             : 
     212             :     com::sun::star::uno::Sequence< rtl::OUString > GetDisabledDictionaries() const;
     213             : 
     214             :     std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName );
     215             : 
     216             :     // functions returning file URLs to the respective images (if found) and empty string otherwise
     217             :     ::rtl::OUString     GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName ) const;
     218             :     ::rtl::OUString     GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName ) const;
     219             :     ::rtl::OUString     GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName ) const;
     220             : 
     221             :     bool                HasGrammarChecker() const;
     222             : };
     223             : 
     224             : //////////////////////////////////////////////////////////////////////
     225             : 
     226             : #endif
     227             : 
     228             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10