1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_LINGUISTIC_SOURCE_HYPHDSP_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_HYPHDSP_HXX
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>
33 #include <cppuhelper/implbase1.hxx>
35 #include <boost/shared_ptr.hpp>
39 #include "linguistic/misc.hxx"
45 class HyphenatorDispatcher
:
46 public cppu::WeakImplHelper1
48 ::com::sun::star::linguistic2::XHyphenator
50 public LinguDispatcher
52 typedef boost::shared_ptr
< LangSvcEntries_Hyph
> LangSvcEntries_Hyph_Ptr_t
;
53 typedef std::map
< LanguageType
, LangSvcEntries_Hyph_Ptr_t
> HyphSvcByLangMap_t
;
54 HyphSvcByLangMap_t aSvcMap
;
56 ::com::sun::star::uno::Reference
<
57 ::com::sun::star::linguistic2::XLinguProperties
> xPropSet
;
58 ::com::sun::star::uno::Reference
<
59 ::com::sun::star::linguistic2::XSearchableDictionaryList
> xDicList
;
63 HyphenatorDispatcher(const HyphenatorDispatcher
&) SAL_DELETED_FUNCTION
;
64 HyphenatorDispatcher
& operator = (const HyphenatorDispatcher
&) SAL_DELETED_FUNCTION
;
66 inline ::com::sun::star::uno::Reference
<
67 ::com::sun::star::linguistic2::XLinguProperties
>
69 inline ::com::sun::star::uno::Reference
<
70 ::com::sun::star::linguistic2::XSearchableDictionaryList
>
75 static com::sun::star::uno::Reference
<
76 ::com::sun::star::linguistic2::XHyphenatedWord
>
77 buildHyphWord( const OUString
& rOrigWord
,
78 const ::com::sun::star::uno::Reference
<
79 ::com::sun::star::linguistic2::XDictionaryEntry
> &xEntry
,
80 sal_Int16 nLang
, sal_Int16 nMaxLeading
);
82 static com::sun::star::uno::Reference
<
83 ::com::sun::star::linguistic2::XPossibleHyphens
>
84 buildPossHyphens( const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::linguistic2::XDictionaryEntry
> &xEntry
,
86 sal_Int16 nLanguage
);
89 HyphenatorDispatcher( LngSvcMgr
&rLngSvcMgr
);
90 virtual ~HyphenatorDispatcher();
93 virtual ::com::sun::star::uno::Sequence
<
94 ::com::sun::star::lang::Locale
> SAL_CALL
96 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual sal_Bool SAL_CALL
98 hasLocale( const ::com::sun::star::lang::Locale
& aLocale
)
99 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual ::com::sun::star::uno::Reference
<
103 ::com::sun::star::linguistic2::XHyphenatedWord
> SAL_CALL
104 hyphenate( const OUString
& aWord
,
105 const ::com::sun::star::lang::Locale
& aLocale
,
106 sal_Int16 nMaxLeading
,
107 const ::com::sun::star::beans::PropertyValues
& aProperties
)
108 throw(::com::sun::star::lang::IllegalArgumentException
,
109 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual ::com::sun::star::uno::Reference
<
111 ::com::sun::star::linguistic2::XHyphenatedWord
> SAL_CALL
112 queryAlternativeSpelling( const OUString
& aWord
,
113 const ::com::sun::star::lang::Locale
& aLocale
,
115 const ::com::sun::star::beans::PropertyValues
& aProperties
)
116 throw(::com::sun::star::lang::IllegalArgumentException
,
117 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
118 virtual ::com::sun::star::uno::Reference
<
119 ::com::sun::star::linguistic2::XPossibleHyphens
> SAL_CALL
120 createPossibleHyphens(
121 const OUString
& aWord
,
122 const ::com::sun::star::lang::Locale
& aLocale
,
123 const ::com::sun::star::beans::PropertyValues
& aProperties
)
124 throw(::com::sun::star::lang::IllegalArgumentException
,
125 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 SetServiceList( const ::com::sun::star::lang::Locale
&rLocale
,
130 const ::com::sun::star::uno::Sequence
<
131 OUString
> &rSvcImplNames
) SAL_OVERRIDE
;
132 virtual ::com::sun::star::uno::Sequence
< OUString
>
133 GetServiceList( const ::com::sun::star::lang::Locale
&rLocale
) const SAL_OVERRIDE
;
135 GetDspType() const SAL_OVERRIDE
;
139 inline ::com::sun::star::uno::Reference
<
140 ::com::sun::star::linguistic2::XLinguProperties
>
141 HyphenatorDispatcher::GetPropSet()
143 return xPropSet
.is() ?
144 xPropSet
: xPropSet
= ::linguistic::GetLinguProperties();
148 inline ::com::sun::star::uno::Reference
<
149 ::com::sun::star::linguistic2::XSearchableDictionaryList
>
150 HyphenatorDispatcher::GetDicList()
152 return xDicList
.is() ?
153 xDicList
: xDicList
= ::linguistic::GetDictionaryList();
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */