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/implbase1.hxx> |
26 | #include <linguistic/lngdllapi.h> |
27 | |
28 | namespace linguistic |
29 | { |
30 | |
31 | class HyphenatedWord : |
32 | public cppu::WeakImplHelper1 |
33 | < |
34 | ::com::sun::star::linguistic2::XHyphenatedWord |
35 | > |
36 | { |
37 | OUString aWord; |
38 | OUString aHyphenatedWord; |
39 | sal_Int16 nHyphPos; |
40 | sal_Int16 nHyphenationPos; |
41 | sal_Int16 nLanguage; |
42 | sal_Bool bIsAltSpelling; |
43 | |
44 | // disallow copy-constructor and assignment-operator for now |
45 | HyphenatedWord(const HyphenatedWord &); |
46 | HyphenatedWord & operator = (const HyphenatedWord &); |
47 | |
48 | public: |
49 | HyphenatedWord(const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, |
50 | const OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); |
51 | virtual ~HyphenatedWord(); |
52 | |
53 | // XHyphenatedWord |
54 | virtual OUString SAL_CALL |
55 | getWord() |
56 | throw(::com::sun::star::uno::RuntimeException); |
57 | virtual ::com::sun::star::lang::Locale SAL_CALL |
58 | getLocale() |
59 | throw(::com::sun::star::uno::RuntimeException); |
60 | virtual sal_Int16 SAL_CALL |
61 | getHyphenationPos() |
62 | throw(::com::sun::star::uno::RuntimeException); |
63 | virtual OUString SAL_CALL |
64 | getHyphenatedWord() |
65 | throw(::com::sun::star::uno::RuntimeException); |
66 | virtual sal_Int16 SAL_CALL |
67 | getHyphenPos() |
68 | throw(::com::sun::star::uno::RuntimeException); |
69 | virtual sal_Bool SAL_CALL |
70 | isAlternativeSpelling() |
71 | throw(::com::sun::star::uno::RuntimeException); |
72 | |
73 | OUString GetWord() { return aWord; } |
74 | OUString GetHyphenatedWord() { return aHyphenatedWord; } |
75 | sal_Int16 GetLanguage() { return nLanguage; } |
76 | void SetWord( OUString &rTxt ) { aWord = rTxt; } |
77 | void SetHyphenatedWord( OUString &rTxt ) { aHyphenatedWord = rTxt; } |
78 | void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } |
79 | static com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord( |
80 | const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, |
81 | const OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); |
82 | }; |
83 | |
84 | |
85 | class PossibleHyphens : |
86 | public cppu::WeakImplHelper1 |
87 | < |
88 | ::com::sun::star::linguistic2::XPossibleHyphens |
89 | > |
90 | { |
91 | OUString aWord; |
92 | OUString aWordWithHyphens; |
93 | ::com::sun::star::uno::Sequence< sal_Int16 > aOrigHyphenPos; |
94 | sal_Int16 nLanguage; |
95 | |
96 | // disallow copy-constructor and assignment-operator for now |
97 | PossibleHyphens(const PossibleHyphens &); |
98 | PossibleHyphens & operator = (const PossibleHyphens &); |
99 | |
100 | public: |
101 | PossibleHyphens(const OUString &rWord, sal_Int16 nLang, |
102 | const OUString &rHyphWord, |
103 | const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions); |
104 | virtual ~PossibleHyphens(); |
105 | |
106 | // XPossibleHyphens |
107 | virtual OUString SAL_CALL |
108 | getWord() |
109 | throw(::com::sun::star::uno::RuntimeException); |
110 | virtual ::com::sun::star::lang::Locale SAL_CALL |
111 | getLocale() |
112 | throw(::com::sun::star::uno::RuntimeException); |
113 | virtual OUString SAL_CALL |
114 | getPossibleHyphens() |
115 | throw(::com::sun::star::uno::RuntimeException); |
116 | virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL |
117 | getHyphenationPositions() |
118 | throw(::com::sun::star::uno::RuntimeException); |
119 | |
120 | OUString GetWord() { return aWord; } |
121 | sal_Int16 GetLanguage() { return nLanguage; } |
122 | void SetWord( OUString &rTxt ) { aWord = rTxt; } |
123 | void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } |
124 | |
125 | static com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens |
126 | (const OUString &rWord, sal_Int16 nLang, |
127 | const OUString &rHyphWord, |
128 | const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions); |
129 | }; |
130 | } // namespace linguistic |
131 | |
132 | #endif |
133 | |
134 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
135 | |