LibreOffice Module editeng (master) 1
splwrap.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#ifndef INCLUDED_EDITENG_SPLWRAP_HXX
20#define INCLUDED_EDITENG_SPLWRAP_HXX
21
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>
28
29// forward ---------------------------------------------------------------
30
32 class XDictionary;
33 class XSpellChecker1;
34 class XHyphenator;
35}
36
37// misc functions ---------------------------------------------------------------
38
39void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( OUString &rOldText, std::u16string_view rNewText );
40
41/*--------------------------------------------------------------------
42 Description: The SpellWrapper
43 --------------------------------------------------------------------*/
44
46private:
47 friend class SvxSpellCheckDialog;
48 friend class SvxHyphenWordDialog;
49 friend struct SvxHyphenWordDialog_Impl;
50
52 std::unique_ptr<weld::WaitObject> xWait;
53 css::uno::Reference<
54 css::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
55 css::uno::Reference<
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.
65
66 EDITENG_DLLPRIVATE bool SpellNext(); // select next area
67 bool FindSpellError(); // Check for errors (over areas)
68
70 void operator =(SvxSpellWrapper const &) = delete;
71
72public:
74 const bool bStart, const bool bIsAllRight );
76 css::uno::Reference< css::linguistic2::XHyphenator > const &xHyphenator,
77 const bool bStart, const bool bOther );
78
79 virtual ~SvxSpellWrapper();
80
81 static sal_Int16 CheckSpellLang(
82 css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpell,
83 LanguageType nLang );
84 static sal_Int16 CheckHyphLang(
85 css::uno::Reference< css::linguistic2::XHyphenator >const & xHyph,
86 LanguageType nLang );
87
88 static void ShowLanguageErrors();
89
90 void SpellDocument(); // Perform Spell Checking
91 bool IsStartDone() const { return bStartDone; }
92 bool IsEndDone() const { return bEndDone; }
93 bool IsAllRight() const { return bAllRight; }
94
95protected:
96 const css::uno::Reference< css::uno::XInterface >&
97 GetLast() const { return xLast; }
98 void SetLast(const css::uno::Reference< css::uno::XInterface > &xNewLast)
99 { xLast = 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 >
106 GetAllRightDic();
107 virtual void SpellEnd(); // Finish area
108 virtual void InsertHyphen( const sal_Int32 nPos ); // Insert hyphen
109};
110
111#endif
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsEndDone() const
Definition: splwrap.hxx:92
const css::uno::Reference< css::uno::XInterface > & GetLast() const
Definition: splwrap.hxx:97
SvxSpellWrapper(SvxSpellWrapper const &)=delete
bool IsAllRight() const
Definition: splwrap.hxx:93
SvxSpellWrapper(weld::Widget *pWn, css::uno::Reference< css::linguistic2::XHyphenator > const &xHyphenator, const bool bStart, const bool bOther)
css::uno::Reference< css::linguistic2::XHyphenator > xHyph
Definition: splwrap.hxx:56
void SetLast(const css::uno::Reference< css::uno::XInterface > &xNewLast)
Definition: splwrap.hxx:98
css::uno::Reference< css::uno::XInterface > xLast
Definition: splwrap.hxx:54
bool IsStartDone() const
Definition: splwrap.hxx:91
bool bRevAllowed
Definition: splwrap.hxx:62
weld::Widget * pWin
Definition: splwrap.hxx:51
std::unique_ptr< weld::WaitObject > xWait
Definition: splwrap.hxx:52
bool bOtherCntnt
Definition: splwrap.hxx:57
#define EDITENG_DLLPRIVATE
Definition: editengdllapi.h:30
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect(OUString &rOldText, std::u16string_view rNewText)
Definition: splwrap.cxx:55
SvxSpellArea
Definition: svxenum.hxx:133