xref: /AOO41X/main/linguistic/inc/linguistic/hyphdta.hxx (revision 63ce064adffbff2897afdaa4d6906d07224572bb)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _LINGUISTIC_HYPHDTA_HXX_
25 #define _LINGUISTIC_HYPHDTA_HXX_
26 
27 
28 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
29 #include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
30 
31 #include <tools/solar.h>
32 
33 #include <uno/lbnames.h>            // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
34 #include <cppuhelper/implbase1.hxx> // helper for implementations
35 
36 
37 namespace linguistic
38 {
39 
40 ///////////////////////////////////////////////////////////////////////////
41 
42 class HyphenatedWord :
43     public cppu::WeakImplHelper1
44     <
45         ::com::sun::star::linguistic2::XHyphenatedWord
46     >
47 {
48     ::rtl::OUString     aWord;
49     ::rtl::OUString     aHyphenatedWord;
50     sal_Int16               nHyphPos;
51     sal_Int16               nHyphenationPos;
52     sal_Int16               nLanguage;
53     sal_Bool                bIsAltSpelling;
54 
55     // disallow copy-constructor and assignment-operator for now
56     HyphenatedWord(const HyphenatedWord &);
57     HyphenatedWord & operator = (const HyphenatedWord &);
58 
59 public:
60     HyphenatedWord(const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
61                    const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
62     virtual ~HyphenatedWord();
63 
64     // XHyphenatedWord
65     virtual ::rtl::OUString SAL_CALL
66         getWord()
67             throw(::com::sun::star::uno::RuntimeException);
68     virtual ::com::sun::star::lang::Locale SAL_CALL
69         getLocale()
70             throw(::com::sun::star::uno::RuntimeException);
71     virtual sal_Int16 SAL_CALL
72         getHyphenationPos()
73             throw(::com::sun::star::uno::RuntimeException);
74     virtual ::rtl::OUString SAL_CALL
75         getHyphenatedWord()
76             throw(::com::sun::star::uno::RuntimeException);
77     virtual sal_Int16 SAL_CALL
78         getHyphenPos()
79             throw(::com::sun::star::uno::RuntimeException);
80     virtual sal_Bool SAL_CALL
81         isAlternativeSpelling()
82             throw(::com::sun::star::uno::RuntimeException);
83 
GetWord()84     ::rtl::OUString GetWord()           { return aWord; }
GetHyphenatedWord()85     ::rtl::OUString GetHyphenatedWord() { return aHyphenatedWord; }
GetLanguage()86     sal_Int16           GetLanguage()       { return nLanguage; }
SetWord(::rtl::OUString & rTxt)87     void            SetWord( ::rtl::OUString &rTxt )            { aWord = rTxt; }
SetHyphenatedWord(::rtl::OUString & rTxt)88     void            SetHyphenatedWord( ::rtl::OUString &rTxt )  { aHyphenatedWord = rTxt; }
SetLanguage(sal_Int16 nLang)89     void            SetLanguage( sal_Int16 nLang )                  { nLanguage = nLang; }
90 };
91 
92 
93 ///////////////////////////////////////////////////////////////////////////
94 
95 class PossibleHyphens :
96     public cppu::WeakImplHelper1
97     <
98         ::com::sun::star::linguistic2::XPossibleHyphens
99     >
100 {
101     ::rtl::OUString             aWord;
102     ::rtl::OUString             aWordWithHyphens;
103     ::com::sun::star::uno::Sequence< sal_Int16 >    aOrigHyphenPos;
104     sal_Int16                       nLanguage;
105 
106     // disallow copy-constructor and assignment-operator for now
107     PossibleHyphens(const PossibleHyphens &);
108     PossibleHyphens & operator = (const PossibleHyphens &);
109 
110 public:
111     PossibleHyphens(const ::rtl::OUString &rWord, sal_Int16 nLang,
112             const ::rtl::OUString &rHyphWord,
113             const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions);
114     virtual ~PossibleHyphens();
115 
116     // XPossibleHyphens
117     virtual ::rtl::OUString SAL_CALL
118         getWord()
119             throw(::com::sun::star::uno::RuntimeException);
120     virtual ::com::sun::star::lang::Locale SAL_CALL
121         getLocale()
122             throw(::com::sun::star::uno::RuntimeException);
123     virtual ::rtl::OUString SAL_CALL
124         getPossibleHyphens()
125             throw(::com::sun::star::uno::RuntimeException);
126     virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL
127         getHyphenationPositions()
128             throw(::com::sun::star::uno::RuntimeException);
129 
GetWord()130     ::rtl::OUString GetWord()       { return aWord; }
GetLanguage()131     sal_Int16           GetLanguage()   { return nLanguage; }
SetWord(::rtl::OUString & rTxt)132     void            SetWord( ::rtl::OUString &rTxt )    { aWord = rTxt; }
SetLanguage(sal_Int16 nLang)133     void            SetLanguage( sal_Int16 nLang )          { nLanguage = nLang; }
134 };
135 
136 
137 ///////////////////////////////////////////////////////////////////////////
138 
139 } // namespace linguistic
140 
141 #endif
142 
143