LCOV - code coverage report
Current view: top level - libreoffice/i18npool/inc - breakiterator_unicode.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-12-27 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_UNICODE_HXX_
      20             : #define _I18N_BREAKITERATOR_UNICODE_HXX_
      21             : 
      22             : #include <breakiteratorImpl.hxx>
      23             : 
      24             : #include "warnings_guard_unicode_brkiter.h"
      25             : 
      26             : namespace com { namespace sun { namespace star { namespace i18n {
      27             : 
      28             : #define LOAD_CHARACTER_BREAKITERATOR    0
      29             : #define LOAD_WORD_BREAKITERATOR         1
      30             : #define LOAD_SENTENCE_BREAKITERATOR     2
      31             : #define LOAD_LINE_BREAKITERATOR         3
      32             : 
      33             : //  ----------------------------------------------------
      34             : //  class BreakIterator_Unicode
      35             : //  ----------------------------------------------------
      36             : class BreakIterator_Unicode : public BreakIteratorImpl
      37             : {
      38             : public:
      39             :     BreakIterator_Unicode();
      40             :     ~BreakIterator_Unicode();
      41             : 
      42             :     virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
      43             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      44             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
      45             :     virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos,
      46             :         const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount,
      47             :         sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException);
      48             : 
      49             :     virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos,
      50             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
      51             :     virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos,
      52             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException);
      53             :     virtual Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos,
      54             :         const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection )
      55             :         throw(com::sun::star::uno::RuntimeException);
      56             : 
      57             :     virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
      58             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
      59             :     virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos,
      60             :         const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException);
      61             : 
      62             :     virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos,
      63             :         const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos,
      64             :         const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions )
      65             :         throw(com::sun::star::uno::RuntimeException);
      66             : 
      67             :     //XServiceInfo
      68             :     virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
      69             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
      70             :         throw( com::sun::star::uno::RuntimeException );
      71             :     virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
      72             :         throw( com::sun::star::uno::RuntimeException );
      73             : 
      74             : protected:
      75             :     const sal_Char *cBreakIterator, *wordRule, *lineRule;
      76             :     Boundary result; // for word break iterator
      77             : 
      78             :     struct BI_Data
      79             :     {
      80             :         rtl::OUString aICUText;
      81             :         UText *ut;
      82             :         icu::BreakIterator *aBreakIterator;
      83             :         com::sun::star::lang::Locale maLocale;
      84             : 
      85         651 :         BI_Data()
      86             :             : ut(NULL)
      87         651 :             , aBreakIterator(NULL)
      88             :         {
      89         651 :         }
      90         476 :         ~BI_Data()
      91         476 :         {
      92         476 :             utext_close(ut);
      93         476 :         }
      94             : 
      95             :     } character, sentence, line, *icuBI;
      96             :     BI_Data words[4]; // 4 is css::i18n::WordType enumeration size
      97             : 
      98             :     sal_Int16 aBreakType;
      99             : 
     100             :     void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale,
     101             :         sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText) throw(com::sun::star::uno::RuntimeException);
     102             : };
     103             : 
     104             : } } } }
     105             : 
     106             : #endif
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10