Branch data 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 : :
20 : : #ifndef _LINGUISTIC_HYPHDSP_HXX_
21 : : #define _LINGUISTIC_HYPHDSP_HXX_
22 : :
23 : :
24 : : #include <com/sun/star/lang/XComponent.hpp>
25 : : #include <com/sun/star/lang/XInitialization.hpp>
26 : : #include <com/sun/star/lang/XServiceDisplayName.hpp>
27 : : #include <com/sun/star/linguistic2/XHyphenator.hpp>
28 : : #include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
29 : : #include <com/sun/star/lang/XServiceInfo.hpp>
30 : : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
31 : : #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
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 : : #include <boost/shared_ptr.hpp>
37 : : #include <map>
38 : :
39 : : #include "lngopt.hxx"
40 : : #include "linguistic/misc.hxx"
41 : : #include "defs.hxx"
42 : :
43 : : class LngSvcMgr;
44 : :
45 : :
46 : : class HyphenatorDispatcher :
47 : : public cppu::WeakImplHelper1
48 : : <
49 : : ::com::sun::star::linguistic2::XHyphenator
50 : : >,
51 : : public LinguDispatcher
52 : : {
53 : : typedef boost::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t;
54 : : typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t;
55 : : HyphSvcByLangMap_t aSvcMap;
56 : :
57 : : ::com::sun::star::uno::Reference<
58 : : ::com::sun::star::beans::XPropertySet > xPropSet;
59 : : ::com::sun::star::uno::Reference<
60 : : ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
61 : :
62 : : LngSvcMgr &rMgr;
63 : :
64 : : // disallow copy-constructor and assignment-operator for now
65 : : HyphenatorDispatcher(const HyphenatorDispatcher &);
66 : : HyphenatorDispatcher & operator = (const HyphenatorDispatcher &);
67 : :
68 : : inline ::com::sun::star::uno::Reference<
69 : : ::com::sun::star::beans::XPropertySet >
70 : : GetPropSet();
71 : : inline ::com::sun::star::uno::Reference<
72 : : ::com::sun::star::linguistic2::XSearchableDictionaryList >
73 : : GetDicList();
74 : :
75 : : void ClearSvcList();
76 : :
77 : : com::sun::star::uno::Reference<
78 : : ::com::sun::star::linguistic2::XHyphenatedWord>
79 : : buildHyphWord( const rtl::OUString rOrigWord,
80 : : const ::com::sun::star::uno::Reference<
81 : : ::com::sun::star::linguistic2::XDictionaryEntry> &xEntry,
82 : : sal_Int16 nLang, sal_Int16 nMaxLeading );
83 : :
84 : : com::sun::star::uno::Reference<
85 : : ::com::sun::star::linguistic2::XPossibleHyphens >
86 : : buildPossHyphens( const ::com::sun::star::uno::Reference<
87 : : ::com::sun::star::linguistic2::XDictionaryEntry > &xEntry,
88 : : sal_Int16 nLanguage );
89 : :
90 : : public:
91 : : HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr );
92 : : virtual ~HyphenatorDispatcher();
93 : :
94 : : // XSupportedLocales
95 : : virtual ::com::sun::star::uno::Sequence<
96 : : ::com::sun::star::lang::Locale > SAL_CALL
97 : : getLocales()
98 : : throw(::com::sun::star::uno::RuntimeException);
99 : : virtual sal_Bool SAL_CALL
100 : : hasLocale( const ::com::sun::star::lang::Locale& aLocale )
101 : : throw(::com::sun::star::uno::RuntimeException);
102 : :
103 : : // XHyphenator
104 : : virtual ::com::sun::star::uno::Reference<
105 : : ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
106 : : hyphenate( const ::rtl::OUString& aWord,
107 : : const ::com::sun::star::lang::Locale& aLocale,
108 : : sal_Int16 nMaxLeading,
109 : : const ::com::sun::star::beans::PropertyValues& aProperties )
110 : : throw(::com::sun::star::lang::IllegalArgumentException,
111 : : ::com::sun::star::uno::RuntimeException);
112 : : virtual ::com::sun::star::uno::Reference<
113 : : ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
114 : : queryAlternativeSpelling( const ::rtl::OUString& aWord,
115 : : const ::com::sun::star::lang::Locale& aLocale,
116 : : sal_Int16 nIndex,
117 : : const ::com::sun::star::beans::PropertyValues& aProperties )
118 : : throw(::com::sun::star::lang::IllegalArgumentException,
119 : : ::com::sun::star::uno::RuntimeException);
120 : : virtual ::com::sun::star::uno::Reference<
121 : : ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL
122 : : createPossibleHyphens(
123 : : const ::rtl::OUString& aWord,
124 : : const ::com::sun::star::lang::Locale& aLocale,
125 : : const ::com::sun::star::beans::PropertyValues& aProperties )
126 : : throw(::com::sun::star::lang::IllegalArgumentException,
127 : : ::com::sun::star::uno::RuntimeException);
128 : :
129 : : // LinguDispatcher
130 : : virtual void
131 : : SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
132 : : const ::com::sun::star::uno::Sequence<
133 : : rtl::OUString > &rSvcImplNames );
134 : : virtual ::com::sun::star::uno::Sequence< rtl::OUString >
135 : : GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
136 : : virtual DspType
137 : : GetDspType() const;
138 : : };
139 : :
140 : :
141 : : inline ::com::sun::star::uno::Reference<
142 : : ::com::sun::star::beans::XPropertySet >
143 : 67215 : HyphenatorDispatcher::GetPropSet()
144 : : {
145 : 67215 : return xPropSet.is() ?
146 [ + - ][ + - ]: 67215 : xPropSet : xPropSet = ::linguistic::GetLinguProperties();
[ + + ][ # # ]
[ + + ]
147 : : }
148 : :
149 : :
150 : : inline ::com::sun::star::uno::Reference<
151 : : ::com::sun::star::linguistic2::XSearchableDictionaryList >
152 : 67206 : HyphenatorDispatcher::GetDicList()
153 : : {
154 : 67206 : return xDicList.is() ?
155 [ + - ][ + - ]: 67206 : xDicList : xDicList = ::linguistic::GetSearchableDictionaryList();
[ + + ][ # # ]
[ + + ]
156 : : }
157 : :
158 : :
159 : :
160 : :
161 : : #endif
162 : :
163 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|