1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _LINGUISTIC_HYPHDTA_HXX_ 29 #define _LINGUISTIC_HYPHDTA_HXX_ 30 31 32 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> 33 #include <com/sun/star/linguistic2/XPossibleHyphens.hpp> 34 35 #include <tools/solar.h> 36 37 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type 38 #include <cppuhelper/implbase1.hxx> // helper for implementations 39 40 41 namespace linguistic 42 { 43 44 /////////////////////////////////////////////////////////////////////////// 45 46 class HyphenatedWord : 47 public cppu::WeakImplHelper1 48 < 49 ::com::sun::star::linguistic2::XHyphenatedWord 50 > 51 { 52 ::rtl::OUString aWord; 53 ::rtl::OUString aHyphenatedWord; 54 sal_Int16 nHyphPos; 55 sal_Int16 nHyphenationPos; 56 sal_Int16 nLanguage; 57 sal_Bool bIsAltSpelling; 58 59 // disallow copy-constructor and assignment-operator for now 60 HyphenatedWord(const HyphenatedWord &); 61 HyphenatedWord & operator = (const HyphenatedWord &); 62 63 public: 64 HyphenatedWord(const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, 65 const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); 66 virtual ~HyphenatedWord(); 67 68 // XHyphenatedWord 69 virtual ::rtl::OUString SAL_CALL 70 getWord() 71 throw(::com::sun::star::uno::RuntimeException); 72 virtual ::com::sun::star::lang::Locale SAL_CALL 73 getLocale() 74 throw(::com::sun::star::uno::RuntimeException); 75 virtual sal_Int16 SAL_CALL 76 getHyphenationPos() 77 throw(::com::sun::star::uno::RuntimeException); 78 virtual ::rtl::OUString SAL_CALL 79 getHyphenatedWord() 80 throw(::com::sun::star::uno::RuntimeException); 81 virtual sal_Int16 SAL_CALL 82 getHyphenPos() 83 throw(::com::sun::star::uno::RuntimeException); 84 virtual sal_Bool SAL_CALL 85 isAlternativeSpelling() 86 throw(::com::sun::star::uno::RuntimeException); 87 88 ::rtl::OUString GetWord() { return aWord; } 89 ::rtl::OUString GetHyphenatedWord() { return aHyphenatedWord; } 90 sal_Int16 GetLanguage() { return nLanguage; } 91 void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } 92 void SetHyphenatedWord( ::rtl::OUString &rTxt ) { aHyphenatedWord = rTxt; } 93 void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } 94 }; 95 96 97 /////////////////////////////////////////////////////////////////////////// 98 99 class PossibleHyphens : 100 public cppu::WeakImplHelper1 101 < 102 ::com::sun::star::linguistic2::XPossibleHyphens 103 > 104 { 105 ::rtl::OUString aWord; 106 ::rtl::OUString aWordWithHyphens; 107 ::com::sun::star::uno::Sequence< sal_Int16 > aOrigHyphenPos; 108 sal_Int16 nLanguage; 109 110 // disallow copy-constructor and assignment-operator for now 111 PossibleHyphens(const PossibleHyphens &); 112 PossibleHyphens & operator = (const PossibleHyphens &); 113 114 public: 115 PossibleHyphens(const ::rtl::OUString &rWord, sal_Int16 nLang, 116 const ::rtl::OUString &rHyphWord, 117 const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions); 118 virtual ~PossibleHyphens(); 119 120 // XPossibleHyphens 121 virtual ::rtl::OUString SAL_CALL 122 getWord() 123 throw(::com::sun::star::uno::RuntimeException); 124 virtual ::com::sun::star::lang::Locale SAL_CALL 125 getLocale() 126 throw(::com::sun::star::uno::RuntimeException); 127 virtual ::rtl::OUString SAL_CALL 128 getPossibleHyphens() 129 throw(::com::sun::star::uno::RuntimeException); 130 virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL 131 getHyphenationPositions() 132 throw(::com::sun::star::uno::RuntimeException); 133 134 ::rtl::OUString GetWord() { return aWord; } 135 sal_Int16 GetLanguage() { return nLanguage; } 136 void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } 137 void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } 138 }; 139 140 141 /////////////////////////////////////////////////////////////////////////// 142 143 } // namespace linguistic 144 145 #endif 146 147