1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_EDITENG_SPLWRAP_HXX
20 #define INCLUDED_EDITENG_SPLWRAP_HXX
22 #include <editeng/editengdllapi.h>
23 #include <editeng/svxenum.hxx>
24 #include <i18nlangtag/lang.h>
25 #include <rtl/ustring.hxx>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <vcl/weld.hxx>
29 // forward ---------------------------------------------------------------
31 namespace com::sun::star::linguistic2
{
37 // misc functions ---------------------------------------------------------------
39 void EDITENG_DLLPUBLIC
SvxPrepareAutoCorrect( OUString
&rOldText
, const OUString
&rNewText
);
41 /*--------------------------------------------------------------------
42 Description: The SpellWrapper
43 --------------------------------------------------------------------*/
45 class EDITENG_DLLPUBLIC SvxSpellWrapper
{
47 friend class SvxSpellCheckDialog
;
48 friend class SvxHyphenWordDialog
;
49 friend struct SvxHyphenWordDialog_Impl
;
52 std::unique_ptr
<weld::WaitObject
> xWait
;
54 css::uno::XInterface
> xLast
; // result of last spelling/hyphenation attempt
56 css::linguistic2::XHyphenator
> xHyph
;
57 bool bOtherCntnt
: 1; // set => Check special sections initially
58 bool bReverse
: 1; // Reverse spell check
59 bool bStartDone
: 1; // Beginning already corrected
60 bool bEndDone
: 1; // End part already corrected
61 bool bStartChk
: 1; // Examine the beginning
62 bool bRevAllowed
: 1; // Reverse spell check prohibited
63 bool bAllRight
: 1; // Record wrong words in the dedicated
64 // dictionary and do not start the dialog.
66 EDITENG_DLLPRIVATE
bool SpellNext(); // select next area
67 bool FindSpellError(); // Check for errors (over areas)
69 SvxSpellWrapper(SvxSpellWrapper
const &) = delete;
70 void operator =(SvxSpellWrapper
const &) = delete;
73 SvxSpellWrapper( weld::Widget
* pWn
,
74 const bool bStart
, const bool bIsAllRight
);
75 SvxSpellWrapper( weld::Widget
* pWn
,
76 css::uno::Reference
< css::linguistic2::XHyphenator
> const &xHyphenator
,
77 const bool bStart
, const bool bOther
);
79 virtual ~SvxSpellWrapper();
81 static sal_Int16
CheckSpellLang(
82 css::uno::Reference
< css::linguistic2::XSpellChecker1
> const & xSpell
,
84 static sal_Int16
CheckHyphLang(
85 css::uno::Reference
< css::linguistic2::XHyphenator
>const & xHyph
,
88 static void ShowLanguageErrors();
90 void SpellDocument(); // Perform Spell Checking
91 bool IsStartDone() const { return bStartDone
; }
92 bool IsEndDone() const { return bEndDone
; }
93 bool IsAllRight() const { return bAllRight
; }
96 const css::uno::Reference
< css::uno::XInterface
>&
97 GetLast() const { return xLast
; }
98 void SetLast(const css::uno::Reference
< css::uno::XInterface
> &xNewLast
)
100 virtual bool SpellMore(); // examine further documents?
101 virtual void SpellStart( SvxSpellArea eSpell
); // Preparing the area
102 virtual void SpellContinue(); // Check Areas
103 // Result available through GetLast
104 virtual void ReplaceAll( const OUString
&rNewText
); //Replace word from the replace list
105 static css::uno::Reference
< css::linguistic2::XDictionary
>
107 virtual void SpellEnd(); // Finish area
108 virtual void InsertHyphen( const sal_Int32 nPos
); // Insert hyphen
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */