look for java, javac and javadoc with the .exe suffix on windows
[LibreOffice.git] / linguistic / source / hyphdsp.hxx
blob348969f1906d210ee2c4f3d3e8c01b14149d88cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <com/sun/star/linguistic2/XHyphenator.hpp>
23 #include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
24 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
26 #include <cppuhelper/implbase.hxx>
28 #include <map>
29 #include <memory>
31 #include <linguistic/misc.hxx>
32 #include "defs.hxx"
34 class LngSvcMgr;
37 class HyphenatorDispatcher :
38 public cppu::WeakImplHelper
40 css::linguistic2::XHyphenator
42 public LinguDispatcher
44 typedef std::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t;
45 typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t;
46 HyphSvcByLangMap_t aSvcMap;
48 css::uno::Reference< css::linguistic2::XLinguProperties > xPropSet;
49 css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList;
51 LngSvcMgr &rMgr;
53 HyphenatorDispatcher(const HyphenatorDispatcher &) = delete;
54 HyphenatorDispatcher & operator = (const HyphenatorDispatcher &) = delete;
56 inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
57 GetPropSet();
58 inline const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &
59 GetDicList();
61 void ClearSvcList();
63 static css::uno::Reference< css::linguistic2::XHyphenatedWord>
64 buildHyphWord( const OUString& rOrigWord,
65 const css::uno::Reference< css::linguistic2::XDictionaryEntry> &xEntry,
66 LanguageType nLang, sal_Int16 nMaxLeading );
68 static css::uno::Reference< css::linguistic2::XPossibleHyphens >
69 buildPossHyphens( const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry,
70 LanguageType nLanguage );
72 public:
73 explicit HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr );
74 virtual ~HyphenatorDispatcher() override;
76 // XSupportedLocales
77 virtual css::uno::Sequence< css::lang::Locale > SAL_CALL
78 getLocales() override;
79 virtual sal_Bool SAL_CALL
80 hasLocale( const css::lang::Locale& aLocale ) override;
82 // XHyphenator
83 virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL
84 hyphenate( const OUString& aWord,
85 const css::lang::Locale& aLocale,
86 sal_Int16 nMaxLeading,
87 const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
88 virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL
89 queryAlternativeSpelling( const OUString& aWord,
90 const css::lang::Locale& aLocale,
91 sal_Int16 nIndex,
92 const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
93 virtual css::uno::Reference<
94 css::linguistic2::XPossibleHyphens > SAL_CALL
95 createPossibleHyphens(
96 const OUString& aWord,
97 const css::lang::Locale& aLocale,
98 const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
100 // LinguDispatcher
101 virtual void
102 SetServiceList( const css::lang::Locale &rLocale,
103 const css::uno::Sequence< OUString > &rSvcImplNames ) override;
104 virtual css::uno::Sequence< OUString >
105 GetServiceList( const css::lang::Locale &rLocale ) const override;
109 inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
110 HyphenatorDispatcher::GetPropSet()
112 if (!xPropSet.is())
113 xPropSet = ::linguistic::GetLinguProperties();
114 return xPropSet;
118 inline const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &
119 HyphenatorDispatcher::GetDicList()
121 if (!xDicList.is())
122 xDicList = ::linguistic::GetDictionaryList();
123 return xDicList;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */