LCOV - code coverage report
Current view: top level - i18npool/inc - textconversion.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 Functions: 2 4 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             : #ifndef INCLUDED_I18NPOOL_INC_TEXTCONVERSION_HXX
      20             : #define INCLUDED_I18NPOOL_INC_TEXTCONVERSION_HXX
      21             : 
      22             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      23             : #include <com/sun/star/lang/XServiceInfo.hpp>
      24             : #include <com/sun/star/i18n/XExtendedTextConversion.hpp>
      25             : #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
      26             : #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
      27             : #include <com/sun/star/uno/XComponentContext.hpp>
      28             : #include <cppuhelper/implbase2.hxx>
      29             : #include <osl/module.h>
      30             : 
      31             : namespace com { namespace sun { namespace star { namespace i18n {
      32             : 
      33             : 
      34             : //  class TextConversionService
      35             : 
      36             : class TextConversionService: public cppu::WeakImplHelper2
      37             : <
      38             :     com::sun::star::i18n::XExtendedTextConversion,
      39             :     com::sun::star::lang::XServiceInfo
      40             : >
      41             : {
      42             : public:
      43             :         TextConversionService(const char* pImplName);
      44             :         virtual ~TextConversionService();
      45             :         // Methods
      46             :         virtual com::sun::star::i18n::TextConversionResult SAL_CALL
      47             :         getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
      48             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
      49             :             sal_Int32 nTextConversionOptions )
      50             :             throw(  com::sun::star::uno::RuntimeException,
      51             :                     com::sun::star::lang::IllegalArgumentException,
      52             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE = 0;
      53             :         virtual OUString SAL_CALL
      54             :         getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
      55             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
      56             :             sal_Int32 nTextConversionOptions )
      57             :             throw(  com::sun::star::uno::RuntimeException,
      58             :                     com::sun::star::lang::IllegalArgumentException,
      59             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE = 0;
      60             :         virtual OUString SAL_CALL
      61             :         getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
      62             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
      63             :             sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
      64             :             throw(  com::sun::star::uno::RuntimeException,
      65             :                     com::sun::star::lang::IllegalArgumentException,
      66             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE = 0;
      67             :         virtual sal_Bool SAL_CALL
      68             :         interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
      69             :             sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions )
      70             :             throw(  com::sun::star::uno::RuntimeException,
      71             :                     com::sun::star::lang::IllegalArgumentException,
      72             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE = 0;
      73             : 
      74             :     //XServiceInfo
      75             :     OUString SAL_CALL
      76             :         getImplementationName()
      77             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      78             :     sal_Bool SAL_CALL
      79             :         supportsService(const OUString& ServiceName)
      80             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      81             :     com::sun::star::uno::Sequence< OUString > SAL_CALL
      82             :         getSupportedServiceNames()
      83             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      84             : private:
      85             :     const sal_Char* implementationName;
      86             : protected :
      87             : #ifndef DISABLE_DYNLOADING
      88             :     oslModule hModule;
      89             :     oslGenericFunction SAL_CALL getFunctionBySymbol(const sal_Char* func);
      90             : #endif
      91             : };
      92             : 
      93             : // for Hangul2Hanja conversion
      94             : typedef struct {
      95             :     sal_Unicode code;
      96             :     sal_Int16 address;
      97             :     sal_Int16 count;
      98             : } Hangul_Index;
      99             : 
     100             : 
     101             : //  class TextConversion_ko
     102             : 
     103           0 : class TextConversion_ko : public TextConversionService
     104             : {
     105             : public:
     106             :     TextConversion_ko( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
     107             : 
     108             :         // Methods
     109             :         com::sun::star::i18n::TextConversionResult SAL_CALL
     110             :         getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     111             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     112             :             sal_Int32 nTextConversionOptions )
     113             :             throw(  com::sun::star::uno::RuntimeException,
     114             :                     com::sun::star::lang::IllegalArgumentException,
     115             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     116             :         OUString SAL_CALL
     117             :         getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     118             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     119             :             sal_Int32 nTextConversionOptions )
     120             :             throw(  com::sun::star::uno::RuntimeException,
     121             :                     com::sun::star::lang::IllegalArgumentException,
     122             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     123             :         OUString SAL_CALL
     124             :         getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     125             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     126             :             sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
     127             :             throw(  com::sun::star::uno::RuntimeException,
     128             :                     com::sun::star::lang::IllegalArgumentException,
     129             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     130             :         sal_Bool SAL_CALL
     131             :         interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
     132             :             sal_Int16 nTextConversionType,
     133             :             sal_Int32 nTextConversionOptions )
     134             :             throw(  com::sun::star::uno::RuntimeException,
     135             :                     com::sun::star::lang::IllegalArgumentException,
     136             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     137             : 
     138             : private :
     139             :         // Hangul/Hanja system dictionary
     140             :         com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionary > xCD;
     141             :         // Hangul/Hanja user defined dictionary list
     142             :         com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
     143             :         sal_Int32 maxLeftLength;
     144             :         sal_Int32 maxRightLength;
     145             :         com::sun::star::uno::Sequence< OUString > SAL_CALL
     146             :             getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, bool toHanja);
     147             : };
     148             : 
     149             : 
     150             : //  class TextConversion_zh
     151             : 
     152             : 
     153             : // for SChines/TChinese word conversion
     154             : typedef struct {
     155             :     sal_uInt16 start;
     156             :     sal_Int16 count;
     157             : } STC_WordIndex;
     158             : 
     159           8 : class TextConversion_zh : public TextConversionService
     160             : {
     161             : public:
     162             :     TextConversion_zh( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
     163             : 
     164             :         // Methods
     165             :         com::sun::star::i18n::TextConversionResult SAL_CALL
     166             :         getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     167             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     168             :             sal_Int32 nTextConversionOptions )
     169             :             throw(  com::sun::star::uno::RuntimeException,
     170             :                     com::sun::star::lang::IllegalArgumentException,
     171             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     172             :         OUString SAL_CALL
     173             :         getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     174             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     175             :             sal_Int32 nTextConversionOptions )
     176             :             throw(  com::sun::star::uno::RuntimeException,
     177             :                     com::sun::star::lang::IllegalArgumentException,
     178             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     179             :         OUString SAL_CALL
     180             :         getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
     181             :             const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType,
     182             :             sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset )
     183             :             throw(  com::sun::star::uno::RuntimeException,
     184             :                     com::sun::star::lang::IllegalArgumentException,
     185             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     186             :         sal_Bool SAL_CALL
     187             :         interactiveConversion(const ::com::sun::star::lang::Locale& aLocale,
     188             :             sal_Int16 nTextConversionType,
     189             :             sal_Int32 nTextConversionOptions )
     190             :             throw(  com::sun::star::uno::RuntimeException,
     191             :                     com::sun::star::lang::IllegalArgumentException,
     192             :                     com::sun::star::lang::NoSupportException, std::exception ) SAL_OVERRIDE;
     193             : private :
     194             :         // user defined dictionary list
     195             :         com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL;
     196             :         OUString SAL_CALL getWordConversion(const OUString& aText,
     197             :             sal_Int32 nStartPos, sal_Int32 nLength, bool toSChinese, sal_Int32 nConversionOptions, com::sun::star::uno::Sequence <sal_Int32>& offset);
     198             :         rtl:: OUString SAL_CALL getCharConversion(const rtl:: OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, bool toSChinese, sal_Int32 nConversionOptions);
     199             :         com::sun::star::lang::Locale aLocale;
     200             : };
     201             : 
     202             : } // i18n
     203             : } // star
     204             : } // sun
     205             : } // com
     206             : 
     207             : #endif
     208             : 
     209             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10