LibreOffice Module lingucomponent (master) 1
hyphenimp.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#ifndef INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
21#define INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
22
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/lang/XInitialization.hpp>
27#include <com/sun/star/lang/XServiceDisplayName.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/beans/PropertyValues.hpp>
30#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <com/sun/star/linguistic2/XHyphenator.hpp>
32#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
33
35
36#include <linguistic/misc.hxx>
38
39#include <lingutil.hxx>
40#include <stdio.h>
41
42#include <hyphen.h>
43
44using namespace ::com::sun::star::uno;
45using namespace ::com::sun::star::beans;
46using namespace ::com::sun::star::lang;
47using namespace ::com::sun::star::linguistic2;
48
49struct HDInfo {
50 HyphenDict * aPtr;
51 OUString aName;
53 rtl_TextEncoding eEnc;
54 std::unique_ptr<CharClass> apCC;
55};
56
58 public cppu::WeakImplHelper
59 <
60 XHyphenator,
61 XLinguServiceEventBroadcaster,
62 XInitialization,
63 XComponent,
64 XServiceInfo,
65 XServiceDisplayName
66 >
67{
68 Sequence< Locale > aSuppLocales;
69 std::vector< HDInfo > mvDicts;
70
72 std::unique_ptr<linguistic::PropertyHelper_Hyphenation> pPropHelper;
74
75 Hyphenator(const Hyphenator &) = delete;
76 Hyphenator & operator = (const Hyphenator &) = delete;
77
78 linguistic::PropertyHelper_Hyphenation& GetPropHelper_Impl();
79 linguistic::PropertyHelper_Hyphenation& GetPropHelper()
80 {
82 }
83
84public:
85 Hyphenator();
86
87 virtual ~Hyphenator() override;
88
89 // XSupportedLocales (for XHyphenator)
90 virtual Sequence< Locale > SAL_CALL getLocales() override;
91 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
92
93 // XHyphenator
94 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;
95 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;
96 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;
97
98 // XLinguServiceEventBroadcaster
99 virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
100 virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) override;
101
102 // XServiceDisplayName
103 virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) override;
104
105 // XInitialization
106 virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) override;
107
108 // XComponent
109 virtual void SAL_CALL dispose() override;
110 virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) override;
111 virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) override;
112
113 // XServiceInfo
114 virtual OUString SAL_CALL getImplementationName() override;
115 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
116 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
117
118private:
119 static OUString makeLowerCase(const OUString&, CharClass const *);
120 static OUString makeUpperCase(const OUString&, CharClass const *);
121 static OUString makeInitCap(const OUString&, CharClass const *);
122};
123
124#endif
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OUString makeLowerCase(const OUString &, CharClass const *)
Definition: hyphenimp.cxx:662
Hyphenator(const Hyphenator &)=delete
std::vector< HDInfo > mvDicts
Definition: hyphenimp.hxx:69
virtual sal_Bool SAL_CALL removeLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: hyphenimp.cxx:703
virtual void SAL_CALL addEventListener(const Reference< XEventListener > &rxListener) override
Definition: hyphenimp.cxx:765
Hyphenator & operator=(const Hyphenator &)=delete
linguistic::PropertyHelper_Hyphenation & GetPropHelper()
Definition: hyphenimp.hxx:79
virtual Sequence< Locale > SAL_CALL getLocales() override
Definition: hyphenimp.cxx:98
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: hyphenimp.cxx:491
std::unique_ptr< linguistic::PropertyHelper_Hyphenation > pPropHelper
Definition: hyphenimp.hxx:72
virtual sal_Bool SAL_CALL addLinguServiceEventListener(const Reference< XLinguServiceEventListener > &rxLstnr) override
Definition: hyphenimp.cxx:690
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: hyphenimp.cxx:244
virtual sal_Bool SAL_CALL hasLocale(const Locale &rLocale) override
Definition: hyphenimp.cxx:206
::comphelper::OInterfaceContainerHelper3< XEventListener > aEvtListeners
Definition: hyphenimp.hxx:71
static OUString makeUpperCase(const OUString &, CharClass const *)
Definition: hyphenimp.cxx:669
virtual void SAL_CALL dispose() override
Definition: hyphenimp.cxx:748
virtual OUString SAL_CALL getImplementationName() override
Definition: hyphenimp.cxx:782
Sequence< Locale > aSuppLocales
Definition: hyphenimp.hxx:68
static OUString makeInitCap(const OUString &, CharClass const *)
Definition: hyphenimp.cxx:676
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > &rxListener) override
Definition: hyphenimp.cxx:773
virtual void SAL_CALL initialize(const Sequence< Any > &rArguments) override
Definition: hyphenimp.cxx:722
virtual OUString SAL_CALL getServiceDisplayName(const Locale &rLocale) override
Definition: hyphenimp.cxx:716
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: hyphenimp.cxx:792
bool bDisposing
Definition: hyphenimp.hxx:73
virtual ~Hyphenator() override
Definition: hyphenimp.cxx:72
linguistic::PropertyHelper_Hyphenation & GetPropHelper_Impl()
Definition: hyphenimp.cxx:86
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: hyphenimp.cxx:475
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: hyphenimp.cxx:787
rtl_TextEncoding eEnc
Definition: hyphenimp.hxx:53
HyphenDict * aPtr
Definition: hyphenimp.hxx:50
OUString aName
Definition: hyphenimp.hxx:51
std::unique_ptr< CharClass > apCC
Definition: hyphenimp.hxx:54
Locale aLoc
Definition: hyphenimp.hxx:52
unsigned char sal_Bool