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 INCLUDED_LINGUISTIC_HYPHDTA_HXX 21 #define INCLUDED_LINGUISTIC_HYPHDTA_HXX 22 23 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> 24 #include <com/sun/star/linguistic2/XPossibleHyphens.hpp> 25 #include <cppuhelper/implbase.hxx> 26 #include <linguistic/lngdllapi.h> 27 #include <i18nlangtag/lang.h> 28 29 namespace linguistic 30 { 31 32 class HyphenatedWord final : 33 public cppu::WeakImplHelper< css::linguistic2::XHyphenatedWord > 34 { 35 OUString aWord; 36 OUString aHyphenatedWord; 37 sal_Int16 nHyphPos; 38 sal_Int16 nHyphenationPos; 39 LanguageType nLanguage; 40 bool bIsAltSpelling; 41 42 HyphenatedWord(const HyphenatedWord &) = delete; 43 HyphenatedWord & operator = (const HyphenatedWord &) = delete; 44 45 public: 46 HyphenatedWord(const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos, 47 const OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); 48 virtual ~HyphenatedWord() override; 49 50 // XHyphenatedWord 51 virtual OUString SAL_CALL 52 getWord() override; 53 virtual css::lang::Locale SAL_CALL 54 getLocale() override; 55 virtual sal_Int16 SAL_CALL 56 getHyphenationPos() override; 57 virtual OUString SAL_CALL 58 getHyphenatedWord() override; 59 virtual sal_Int16 SAL_CALL 60 getHyphenPos() override; 61 virtual sal_Bool SAL_CALL 62 isAlternativeSpelling() override; 63 64 static css::uno::Reference <css::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord( 65 const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos, 66 const OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); 67 }; 68 69 70 class PossibleHyphens final : 71 public cppu::WeakImplHelper 72 < 73 css::linguistic2::XPossibleHyphens 74 > 75 { 76 OUString aWord; 77 OUString aWordWithHyphens; 78 css::uno::Sequence< sal_Int16 > aOrigHyphenPos; 79 LanguageType nLanguage; 80 81 PossibleHyphens(const PossibleHyphens &) = delete; 82 PossibleHyphens & operator = (const PossibleHyphens &) = delete; 83 84 public: 85 PossibleHyphens(const OUString &rWord, LanguageType nLang, 86 const OUString &rHyphWord, 87 const css::uno::Sequence< sal_Int16 > &rPositions); 88 virtual ~PossibleHyphens() override; 89 90 // XPossibleHyphens 91 virtual OUString SAL_CALL 92 getWord() override; 93 virtual css::lang::Locale SAL_CALL 94 getLocale() override; 95 virtual OUString SAL_CALL 96 getPossibleHyphens() override; 97 virtual css::uno::Sequence< sal_Int16 > SAL_CALL 98 getHyphenationPositions() override; 99 100 static css::uno::Reference < css::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens 101 (const OUString &rWord, LanguageType nLang, 102 const OUString &rHyphWord, 103 const css::uno::Sequence< sal_Int16 > &rPositions); 104 }; 105 } // namespace linguistic 106 107 #endif 108 109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 110