Update ooo320-m1
[ooovba.git] / linguistic / source / hyphdsp.hxx
blob364244a3a096aacea88bc7e97940aa2e30882731
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hyphdsp.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGUISTIC_HYPHDSP_HXX_
32 #define _LINGUISTIC_HYPHDSP_HXX_
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <com/sun/star/lang/XServiceDisplayName.hpp>
38 #include <com/sun/star/linguistic2/XHyphenator.hpp>
39 #include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
42 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
44 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
45 #include <cppuhelper/implbase1.hxx> // helper for implementations
47 #include <boost/shared_ptr.hpp>
48 #include <map>
50 #include "lngopt.hxx"
51 #include "misc.hxx"
52 #include "defs.hxx"
54 class LngSvcMgr;
56 ///////////////////////////////////////////////////////////////////////////
58 class HyphenatorDispatcher :
59 public cppu::WeakImplHelper1
61 ::com::sun::star::linguistic2::XHyphenator
63 public LinguDispatcher
65 typedef boost::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t;
66 typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t;
67 HyphSvcByLangMap_t aSvcMap;
69 ::com::sun::star::uno::Reference<
70 ::com::sun::star::beans::XPropertySet > xPropSet;
71 ::com::sun::star::uno::Reference<
72 ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
74 LngSvcMgr &rMgr;
76 // disallow copy-constructor and assignment-operator for now
77 HyphenatorDispatcher(const HyphenatorDispatcher &);
78 HyphenatorDispatcher & operator = (const HyphenatorDispatcher &);
80 inline ::com::sun::star::uno::Reference<
81 ::com::sun::star::beans::XPropertySet >
82 GetPropSet();
83 inline ::com::sun::star::uno::Reference<
84 ::com::sun::star::linguistic2::XSearchableDictionaryList >
85 GetDicList();
87 void ClearSvcList();
89 com::sun::star::uno::Reference<
90 ::com::sun::star::linguistic2::XHyphenatedWord>
91 buildHyphWord( const rtl::OUString rOrigWord,
92 const ::com::sun::star::uno::Reference<
93 ::com::sun::star::linguistic2::XDictionaryEntry> &xEntry,
94 INT16 nLang, INT16 nMaxLeading );
96 com::sun::star::uno::Reference<
97 ::com::sun::star::linguistic2::XPossibleHyphens >
98 buildPossHyphens( const ::com::sun::star::uno::Reference<
99 ::com::sun::star::linguistic2::XDictionaryEntry > &xEntry,
100 INT16 nLanguage );
102 public:
103 HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr );
104 virtual ~HyphenatorDispatcher();
106 // XSupportedLocales
107 virtual ::com::sun::star::uno::Sequence<
108 ::com::sun::star::lang::Locale > SAL_CALL
109 getLocales()
110 throw(::com::sun::star::uno::RuntimeException);
111 virtual sal_Bool SAL_CALL
112 hasLocale( const ::com::sun::star::lang::Locale& aLocale )
113 throw(::com::sun::star::uno::RuntimeException);
115 // XHyphenator
116 virtual ::com::sun::star::uno::Reference<
117 ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
118 hyphenate( const ::rtl::OUString& aWord,
119 const ::com::sun::star::lang::Locale& aLocale,
120 sal_Int16 nMaxLeading,
121 const ::com::sun::star::beans::PropertyValues& aProperties )
122 throw(::com::sun::star::lang::IllegalArgumentException,
123 ::com::sun::star::uno::RuntimeException);
124 virtual ::com::sun::star::uno::Reference<
125 ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
126 queryAlternativeSpelling( const ::rtl::OUString& aWord,
127 const ::com::sun::star::lang::Locale& aLocale,
128 sal_Int16 nIndex,
129 const ::com::sun::star::beans::PropertyValues& aProperties )
130 throw(::com::sun::star::lang::IllegalArgumentException,
131 ::com::sun::star::uno::RuntimeException);
132 virtual ::com::sun::star::uno::Reference<
133 ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL
134 createPossibleHyphens(
135 const ::rtl::OUString& aWord,
136 const ::com::sun::star::lang::Locale& aLocale,
137 const ::com::sun::star::beans::PropertyValues& aProperties )
138 throw(::com::sun::star::lang::IllegalArgumentException,
139 ::com::sun::star::uno::RuntimeException);
141 // LinguDispatcher
142 virtual void
143 SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
144 const ::com::sun::star::uno::Sequence<
145 rtl::OUString > &rSvcImplNames );
146 virtual ::com::sun::star::uno::Sequence< rtl::OUString >
147 GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
148 virtual DspType
149 GetDspType() const;
153 inline ::com::sun::star::uno::Reference<
154 ::com::sun::star::beans::XPropertySet >
155 HyphenatorDispatcher::GetPropSet()
157 return xPropSet.is() ?
158 xPropSet : xPropSet = ::linguistic::GetLinguProperties();
162 inline ::com::sun::star::uno::Reference<
163 ::com::sun::star::linguistic2::XSearchableDictionaryList >
164 HyphenatorDispatcher::GetDicList()
166 return xDicList.is() ?
167 xDicList : xDicList = ::linguistic::GetSearchableDictionaryList();
171 ///////////////////////////////////////////////////////////////////////////
174 #endif