tdf#124162: Crash when trying to accept changes
[LibreOffice.git] / include / linguistic / spelldta.hxx
blob1f0ecf6b37a7b2d237ab8c182ad13d813a254d18
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 #ifndef INCLUDED_LINGUISTIC_SPELLDTA_HXX
21 #define INCLUDED_LINGUISTIC_SPELLDTA_HXX
23 #include <vector>
24 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
25 #include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <linguistic/lngdllapi.h>
28 #include <i18nlangtag/lang.h>
30 namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; }
33 namespace linguistic
36 std::vector< OUString >
37 MergeProposalSeqs(
38 std::vector< OUString > &rAlt1,
39 std::vector< OUString > &rAlt2 );
41 void SeqRemoveNegEntries(
42 std::vector< OUString > &rSeq,
43 css::uno::Reference< css::linguistic2::XSearchableDictionaryList > const &rxDicList,
44 LanguageType nLanguage );
46 void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
47 css::uno::Reference< css::linguistic2::XSearchableDictionaryList > const &xDicList,
48 std::vector< OUString > & rDicListProps );
51 class SpellAlternatives
52 : public cppu::WeakImplHelper
54 css::linguistic2::XSpellAlternatives,
55 css::linguistic2::XSetSpellAlternatives
58 css::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
59 OUString aWord;
60 sal_Int16 nType; // type of failure
61 LanguageType nLanguage;
63 public:
64 LNG_DLLPUBLIC SpellAlternatives();
65 SpellAlternatives(const OUString &rWord, LanguageType nLang,
66 const css::uno::Sequence< OUString > &rAlternatives );
67 virtual ~SpellAlternatives() override;
68 SpellAlternatives(const SpellAlternatives&) = delete;
69 SpellAlternatives& operator=( const SpellAlternatives& ) = delete;
71 // XSpellAlternatives
72 virtual OUString SAL_CALL getWord( ) override;
73 virtual css::lang::Locale SAL_CALL getLocale( ) override;
74 virtual ::sal_Int16 SAL_CALL getFailureType( ) override;
75 virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) override;
76 virtual css::uno::Sequence< OUString > SAL_CALL getAlternatives( ) override;
78 // XSetSpellAlternatives
79 virtual void SAL_CALL setAlternatives( const css::uno::Sequence< OUString >& aAlternatives ) override;
80 virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) override;
82 // non-interface specific functions
83 void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, LanguageType nLang);
84 void LNG_DLLPUBLIC SetFailureType(sal_Int16 nTypeP);
85 void LNG_DLLPUBLIC SetAlternatives( const css::uno::Sequence< OUString > &rAlt );
86 static css::uno::Reference < css::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives(
87 const OUString &rWord, LanguageType nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt );
90 } // namespace linguistic
92 #endif
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */