LibreOffice Module linguistic (master) 1
hyphdsp.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/linguistic2/XHyphenator.hpp>
23#include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
24#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
25
27
28#include <map>
29#include <memory>
30
31#include <linguistic/misc.hxx>
32#include "defs.hxx"
33
34class LngSvcMgr;
35
36
38 public cppu::WeakImplHelper
39 <
40 css::linguistic2::XHyphenator
41 >,
42 public LinguDispatcher
43{
44 typedef std::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t;
45 typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t;
47
48 css::uno::Reference< css::linguistic2::XLinguProperties > xPropSet;
49 css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList;
50
52
55
56 inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
57 GetPropSet();
58 inline const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &
59 GetDicList();
60
61 void ClearSvcList();
62
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 );
67
68 static css::uno::Reference< css::linguistic2::XPossibleHyphens >
69 buildPossHyphens( const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry,
70 LanguageType nLanguage );
71
72public:
73 explicit HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr );
74 virtual ~HyphenatorDispatcher() override;
75
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;
81
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
96 const OUString& aWord,
97 const css::lang::Locale& aLocale,
98 const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
99
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;
106};
107
108
109inline const css::uno::Reference< css::linguistic2::XLinguProperties > &
111{
112 if (!xPropSet.is())
114 return xPropSet;
115}
116
117
118inline const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &
120{
121 if (!xDicList.is())
123 return xDicList;
124}
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > GetServiceList(const css::lang::Locale &rLocale) const override
Definition: hyphdsp.cxx:684
virtual ~HyphenatorDispatcher() override
Definition: hyphdsp.cxx:62
std::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t
Definition: hyphdsp.hxx:44
HyphenatorDispatcher & operator=(const HyphenatorDispatcher &)=delete
virtual css::uno::Reference< css::linguistic2::XPossibleHyphens > SAL_CALL createPossibleHyphens(const OUString &aWord, const css::lang::Locale &aLocale, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:535
const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > & GetDicList()
Definition: hyphdsp.hxx:119
virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL hyphenate(const OUString &aWord, const css::lang::Locale &aLocale, sal_Int16 nMaxLeading, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:268
std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t
Definition: hyphdsp.hxx:45
static css::uno::Reference< css::linguistic2::XHyphenatedWord > buildHyphWord(const OUString &rOrigWord, const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry, LanguageType nLang, sal_Int16 nMaxLeading)
Definition: hyphdsp.cxx:75
HyphenatorDispatcher(const HyphenatorDispatcher &)=delete
LngSvcMgr & rMgr
Definition: hyphdsp.hxx:51
virtual void SetServiceList(const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames) override
Definition: hyphdsp.cxx:652
const css::uno::Reference< css::linguistic2::XLinguProperties > & GetPropSet()
Definition: hyphdsp.hxx:110
css::uno::Reference< css::linguistic2::XLinguProperties > xPropSet
Definition: hyphdsp.hxx:48
virtual css::uno::Reference< css::linguistic2::XHyphenatedWord > SAL_CALL queryAlternativeSpelling(const OUString &aWord, const css::lang::Locale &aLocale, sal_Int16 nIndex, const css::uno::Sequence< ::css::beans::PropertyValue > &aProperties) override
Definition: hyphdsp.cxx:404
css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList
Definition: hyphdsp.hxx:49
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales() override
Definition: hyphdsp.cxx:245
HyphSvcByLangMap_t aSvcMap
Definition: hyphdsp.hxx:46
virtual sal_Bool SAL_CALL hasLocale(const css::lang::Locale &aLocale) override
Definition: hyphdsp.cxx:259
static css::uno::Reference< css::linguistic2::XPossibleHyphens > buildPossHyphens(const css::uno::Reference< css::linguistic2::XDictionaryEntry > &xEntry, LanguageType nLanguage)
Definition: hyphdsp.cxx:181
uno::Reference< XSearchableDictionaryList > GetDictionaryList()
Definition: misc.cxx:671
uno::Reference< XLinguProperties > GetLinguProperties()
Definition: misc.cxx:666
unsigned char sal_Bool