LCOV - code coverage report
Current view: top level - i18npool/inc - breakiteratorImpl.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 2 2 100.0 %
Date: 2014-04-11 Functions: 2 2 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             : #ifndef _I18N_BREAKITERATOR_HXX_
      20             : #define _I18N_BREAKITERATOR_HXX_
      21             : 
      22             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      23             : #include <comphelper/processfactory.hxx>
      24             : #include <com/sun/star/lang/XServiceInfo.hpp>
      25             : #include <com/sun/star/beans/PropertyValues.hpp>
      26             : #include <com/sun/star/i18n/XBreakIterator.hpp>
      27             : #include <com/sun/star/i18n/WordType.hpp>
      28             : #include <com/sun/star/i18n/BreakType.hpp>
      29             : #include <com/sun/star/i18n/ScriptType.hpp>
      30             : #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
      31             : #include <com/sun/star/i18n/CharType.hpp>
      32             : #include <com/sun/star/i18n/XLocaleData.hpp>
      33             : #include <cppuhelper/implbase2.hxx>
      34             : 
      35             : #include <vector>
      36             : 
      37             : namespace com { namespace sun { namespace star { namespace i18n {
      38             : 
      39             : 
      40             : //  class BreakIterator
      41             : 
      42             : class BreakIteratorImpl : public cppu::WeakImplHelper2
      43             : <
      44             :     XBreakIterator,
      45             :     com::sun::star::lang::XServiceInfo
      46             : >
      47             : {
      48             : public:
      49             :     BreakIteratorImpl( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
      50             :     BreakIteratorImpl();
      51             :     virtual ~BreakIteratorImpl();
      52             : 
      53             :     virtual sal_Int32 SAL_CALL nextCharacters( const OUString& Text, sal_Int32 nStartPos,
      54             :         const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      55             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      56             :     virtual sal_Int32 SAL_CALL previousCharacters( const OUString& Text, sal_Int32 nStartPos,
      57             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      58             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      59             : 
      60             :     virtual Boundary SAL_CALL previousWord( const OUString& Text, sal_Int32 nStartPos,
      61             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      62             :     virtual Boundary SAL_CALL nextWord( const OUString& Text, sal_Int32 nStartPos,
      63             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      64             :     virtual Boundary SAL_CALL getWordBoundary( const OUString& Text, sal_Int32 nPos,
      65             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection )
      66             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             : 
      68             :     virtual sal_Bool SAL_CALL isBeginWord( const OUString& Text, sal_Int32 nPos,
      69             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      70             :     virtual sal_Bool SAL_CALL isEndWord( const OUString& Text, sal_Int32 nPos,
      71             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             :     virtual sal_Int16 SAL_CALL getWordType( const OUString& Text, sal_Int32 nPos,
      73             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      74             : 
      75             :     virtual sal_Int32 SAL_CALL beginOfSentence( const OUString& Text, sal_Int32 nStartPos,
      76             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      77             :     virtual sal_Int32 SAL_CALL endOfSentence( const OUString& Text, sal_Int32 nStartPos,
      78             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      79             : 
      80             :     virtual LineBreakResults SAL_CALL getLineBreak( const OUString& Text, sal_Int32 nStartPos,
      81             :         const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos,
      82             :         const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions )
      83             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             : 
      85             :     virtual sal_Int16 SAL_CALL getScriptType( const OUString& Text, sal_Int32 nPos )
      86             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             :     virtual sal_Int32 SAL_CALL beginOfScript( const OUString& Text, sal_Int32 nStartPos,
      88             :         sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             :     virtual sal_Int32 SAL_CALL endOfScript( const OUString& Text, sal_Int32 nStartPos,
      90             :         sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :     virtual sal_Int32 SAL_CALL previousScript( const OUString& Text, sal_Int32 nStartPos,
      92             :         sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     virtual sal_Int32 SAL_CALL nextScript( const OUString& Text, sal_Int32 nStartPos,
      94             :         sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             : 
      96             :     virtual sal_Int32 SAL_CALL beginOfCharBlock( const OUString& Text, sal_Int32 nStartPos,
      97             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual sal_Int32 SAL_CALL endOfCharBlock( const OUString& Text, sal_Int32 nStartPos,
      99             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual sal_Int32 SAL_CALL previousCharBlock( const OUString& Text, sal_Int32 nStartPos,
     101             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     virtual sal_Int32 SAL_CALL nextCharBlock( const OUString& Text, sal_Int32 nStartPos,
     103             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             : 
     105             :     //XServiceInfo
     106             :     virtual OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     107             :     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
     108             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     109             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     110             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     111             : 
     112             :     static sal_Int16 SAL_CALL getScriptClass(sal_uInt32 currentChar);
     113             : protected:
     114             :     Boundary result; // for word break iterator
     115             : 
     116             : private :
     117             : 
     118        4958 :     struct lookupTableItem {
     119        5255 :         lookupTableItem(const com::sun::star::lang::Locale& _aLocale, com::sun::star::uno::Reference < XBreakIterator >& _xBI) : aLocale(_aLocale), xBI(_xBI) {};
     120             :         com::sun::star::lang::Locale aLocale;
     121             :         com::sun::star::uno::Reference < XBreakIterator > xBI;
     122             :     };
     123             :     std::vector<lookupTableItem*> lookupTable;
     124             :     com::sun::star::lang::Locale aLocale;
     125             :     com::sun::star::uno::Reference < XBreakIterator > xBI;
     126             :     com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
     127             : 
     128             :     sal_Bool SAL_CALL createLocaleSpecificBreakIterator( const OUString& aLocaleName )
     129             :         throw( com::sun::star::uno::RuntimeException );
     130             :     com::sun::star::uno::Reference < XBreakIterator > SAL_CALL getLocaleSpecificBreakIterator( const com::sun::star::lang::Locale& rLocale )
     131             :         throw( com::sun::star::uno::RuntimeException );
     132             :     const com::sun::star::lang::Locale& SAL_CALL getLocaleByScriptType(const com::sun::star::lang::Locale& rLocale, const OUString& Text,
     133             :         sal_Int32 nStartPos, sal_Bool forward, sal_Bool skipWhiteSpace)
     134             :         throw(com::sun::star::uno::RuntimeException);
     135             : 
     136             : };
     137             : 
     138             : } // i18n
     139             : } // star
     140             : } // sun
     141             : } // com
     142             : 
     143             : 
     144             : #endif // _I18N_BREAKITERATOR_HXX_
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10