LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/linguistic - misc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2013-07-09 Functions: 1 1 100.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_MISC_HXX_
      21             : #define _LINGUISTIC_MISC_HXX_
      22             : 
      23             : #include <com/sun/star/uno/Sequence.h>
      24             : #include <com/sun/star/uno/Reference.h>
      25             : #include <com/sun/star/beans/PropertyValues.hpp>
      26             : #include <com/sun/star/frame/XTerminateListener.hpp>
      27             : #include <com/sun/star/lang/Locale.hpp>
      28             : #include <com/sun/star/lang/XComponent.hpp>
      29             : #include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
      30             : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
      31             : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
      32             : #include <com/sun/star/linguistic2/XLinguProperties.hpp>
      33             : 
      34             : #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
      35             : #include <cppuhelper/implbase1.hxx> // helper for implementations
      36             : #include <unotools/pathoptions.hxx>
      37             : #include <i18nlangtag/lang.h>
      38             : #include <tools/string.hxx>
      39             : #include <unotools/charclass.hxx>
      40             : #include <osl/thread.h>
      41             : #include <osl/mutex.hxx>
      42             : #include <linguistic/lngdllapi.h>
      43             : 
      44             : namespace com { namespace sun { namespace star { namespace beans {
      45             :     class XPropertySet;
      46             :     class XFastPropertySet;
      47             : }}}}
      48             : 
      49             : namespace com { namespace sun { namespace star { namespace frame {
      50             :     class XDesktop2;
      51             : }}}}
      52             : 
      53             : class LocaleDataWrapper;
      54             : 
      55             : 
      56             : #define SN_GRAMMARCHECKER           "com.sun.star.linguistic2.Proofreader"
      57             : #define SN_SPELLCHECKER             "com.sun.star.linguistic2.SpellChecker"
      58             : #define SN_HYPHENATOR               "com.sun.star.linguistic2.Hyphenator"
      59             : #define SN_THESAURUS                "com.sun.star.linguistic2.Thesaurus"
      60             : 
      61             : 
      62             : namespace linguistic
      63             : {
      64             : 
      65             : /// Flags to be used with the multi-path related functions
      66             : /// @see GetDictionaryPaths
      67             : #define PATH_FLAG_INTERNAL  0x01
      68             : #define PATH_FLAG_USER      0x02
      69             : #define PATH_FLAG_WRITABLE  0x04
      70             : #define PATH_FLAG_ALL       (PATH_FLAG_INTERNAL | PATH_FLAG_USER | PATH_FLAG_WRITABLE)
      71             : 
      72             : 
      73             : // AddEntryToDic return values
      74             : #define DIC_ERR_NONE        0
      75             : #define DIC_ERR_FULL        1
      76             : #define DIC_ERR_READONLY    2
      77             : #define DIC_ERR_UNKNOWN     3
      78             : #define DIC_ERR_NOT_EXISTS  4
      79             : 
      80             : // values asigned to capitalization types
      81             : enum CapType
      82             : {
      83             :     CAPTYPE_UNKNOWN,
      84             :     CAPTYPE_NOCAP,
      85             :     CAPTYPE_INITCAP,
      86             :     CAPTYPE_ALLCAP,
      87             :     CAPTYPE_MIXED
      88             : };
      89             : 
      90             : LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
      91             : 
      92             : LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang );
      93             : 
      94             : sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 );
      95             : 
      96             : /** Convert Locale to LanguageType for legacy handling.
      97             :     Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
      98             :     Does not resolve empty locale as system locale.
      99             :  */
     100             : LNG_DLLPUBLIC LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale );
     101             : 
     102             : /** Convert LanguageType to Locale for legacy handling.
     103             :     Linguistic specific handling of LANGUAGE_NONE resulting in an empty locale.
     104             :     Avoid use!
     105             :  */
     106             : LNG_DLLPUBLIC ::com::sun::star::lang::Locale LinguLanguageToLocale( LanguageType nLanguage );
     107             : 
     108             : /** Checks if a LanguageType is one of the values that denote absence of
     109             :     language or undetermined language or multiple languages, in short all
     110             :     values used in linguistic context that do not denote a specific language.
     111             :  */
     112             : LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
     113             : 
     114             : ::com::sun::star::uno::Sequence< sal_Int16 >
     115             :     LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence<
     116             :         ::com::sun::star::lang::Locale > &rLocaleSeq );
     117             : 
     118             : // checks if file pointed to by rURL is readonly
     119             : // and may also check return if such a file exists or not
     120             : sal_Bool    IsReadOnly( const String &rURL, sal_Bool *pbExist = 0 );
     121             : 
     122             : // checks if a file with the given URL exists
     123             : sal_Bool    FileExists( const String &rURL );
     124             : 
     125             : 
     126             : OUString     GetDictionaryWriteablePath();
     127             : ::com::sun::star::uno::Sequence< OUString > GetDictionaryPaths( sal_Int16 nPathFlags = PATH_FLAG_ALL );
     128             : 
     129             : /// @returns an URL for a new and writable dictionary rDicName.
     130             : ///     The URL will point to the path given by 'GetDictionaryWriteablePath'
     131             : LNG_DLLPUBLIC String  GetWritableDictionaryURL( const String &rDicName );
     132             : 
     133             : LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos );
     134             : 
     135             : ::com::sun::star::uno::Reference<
     136             :     ::com::sun::star::linguistic2::XHyphenatedWord >
     137             :             RebuildHyphensAndControlChars( const OUString &rOrigWord,
     138             :                 ::com::sun::star::uno::Reference<
     139             :                     ::com::sun::star::linguistic2::XHyphenatedWord > &rxHyphWord );
     140             : 
     141             : 
     142             : LNG_DLLPUBLIC sal_Bool        IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage );
     143             : 
     144        5512 : inline sal_Bool        IsUpper( const String &rText, sal_Int16 nLanguage )     { return IsUpper( rText, 0, rText.Len(), nLanguage ); }
     145             : LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass *);
     146             : 
     147             : String      ToLower( const String &rText, sal_Int16 nLanguage );
     148             : LNG_DLLPUBLIC sal_Bool      HasDigits( const OUString &rText );
     149             : LNG_DLLPUBLIC sal_Bool      IsNumeric( const String &rText );
     150             : 
     151             : 
     152             : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName );
     153             : LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguProperties > GetLinguProperties();
     154             : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
     155             : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
     156             : 
     157             : 
     158             : sal_Bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties,
     159             :         const ::com::sun::star::uno::Reference<
     160             :             ::com::sun::star::beans::XPropertySet > &rxPropSet );
     161             : 
     162             : sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties,
     163             :         const ::com::sun::star::uno::Reference<
     164             :             ::com::sun::star::beans::XPropertySet > &rxPropSet );
     165             : 
     166             : ::com::sun::star::uno::Reference<
     167             :     ::com::sun::star::linguistic2::XDictionaryEntry >
     168             :         SearchDicList(
     169             :             const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList >& rDicList,
     170             :             const OUString& rWord, sal_Int16 nLanguage,
     171             :             sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry );
     172             : 
     173             : LNG_DLLPUBLIC sal_uInt8 AddEntryToDic(
     174             :     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary >  &rxDic,
     175             :     const OUString &rWord, sal_Bool bIsNeg,
     176             :     const OUString &rRplcTxt, sal_Int16 nRplcLang,
     177             :     sal_Bool bStripDot = sal_True );
     178             : 
     179             : LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
     180             : 
     181             : // AppExitLstnr:
     182             : // virtual base class that calls it AtExit function when the application
     183             : // (ie the Desktop) is about to terminate
     184             : 
     185             : class AppExitListener :
     186             :     public cppu::WeakImplHelper1
     187             :     <
     188             :         ::com::sun::star::frame::XTerminateListener
     189             :     >
     190             : {
     191             :     ::com::sun::star::uno::Reference<
     192             :         ::com::sun::star::frame::XDesktop2 >     xDesktop;
     193             : 
     194             : public:
     195             :     AppExitListener();
     196             :     virtual ~AppExitListener();
     197             : 
     198             :     virtual void    AtExit() = 0;
     199             : 
     200             :     void            Activate();
     201             :     void            Deactivate();
     202             : 
     203             :     // XEventListener
     204             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     205             : 
     206             :     // XTerminateListener
     207             :     virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
     208             :     virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
     209             : };
     210             : 
     211             : }   // namespace linguistic
     212             : 
     213             : #endif
     214             : 
     215             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10