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 <rtl/ustring.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <vcl/vclptr.hxx>
28 // forward ---------------------------------------------------------------
30 namespace com
{ namespace sun
{ namespace star
{ namespace linguistic2
{
36 namespace vcl
{ class Window
; }
38 // misc functions ---------------------------------------------------------------
40 void EDITENG_DLLPUBLIC
SvxPrepareAutoCorrect( OUString
&rOldText
, const OUString
&rNewText
);
42 /*--------------------------------------------------------------------
43 Description: The SpellWrapper
44 --------------------------------------------------------------------*/
46 class EDITENG_DLLPUBLIC SvxSpellWrapper
{
48 friend class SvxSpellCheckDialog
;
49 friend class SvxHyphenWordDialog
;
50 friend struct SvxHyphenWordDialog_Impl
;
52 VclPtr
<vcl::Window
> pWin
;
54 css::uno::XInterface
> xLast
; // result of last spelling/hyphenation attempt
56 css::linguistic2::XHyphenator
> xHyph
;
58 bool bOtherCntnt
: 1; // set => Check special sections initially
59 bool bDialog
: 1; // Is pWin the Svx...Dialog?
60 bool bHyphen
: 1; // Split instead of spell checking
61 bool bReverse
: 1; // Reverse spell check
62 bool bStartDone
: 1; // Beginning already corrected
63 bool bEndDone
: 1; // End part already corrected
64 bool bStartChk
: 1; // Examine the beginning
65 bool bRevAllowed
: 1; // Reverse spell check prohibited
66 bool bAllRight
: 1; // Record wrong words in the dedicated
67 // dictionary and do not start the dialog.
69 EDITENG_DLLPRIVATE
bool SpellNext(); // select next area
70 bool FindSpellError(); // Check for errors (over areas)
72 SvxSpellWrapper(SvxSpellWrapper
const &) = delete;
73 void operator =(SvxSpellWrapper
const &) = delete;
76 SvxSpellWrapper( vcl::Window
* pWn
,
77 const bool bStart
= false, const bool bIsAllRight
= false );
78 SvxSpellWrapper( vcl::Window
* pWn
,
79 css::uno::Reference
< css::linguistic2::XHyphenator
> &xHyphenator
,
80 const bool bStart
= false, const bool bOther
= false );
82 virtual ~SvxSpellWrapper();
84 static sal_Int16
CheckSpellLang(
85 css::uno::Reference
< css::linguistic2::XSpellChecker1
> const & xSpell
,
87 static sal_Int16
CheckHyphLang(
88 css::uno::Reference
< css::linguistic2::XHyphenator
>const & xHyph
,
91 static void ShowLanguageErrors();
93 void SpellDocument(); // Perform Spell Checking
94 inline bool IsStartDone(){ return bStartDone
; }
95 inline bool IsEndDone(){ return bEndDone
; }
96 inline bool IsHyphen(){ return bHyphen
; } // Split instead of Spell check
97 inline void SetHyphen() { bHyphen
= true; }
98 inline bool IsAllRight() { return bAllRight
; }
101 const css::uno::Reference
< css::uno::XInterface
>&
102 GetLast() { return xLast
; }
103 void SetLast(const css::uno::Reference
< css::uno::XInterface
> &xNewLast
)
104 { xLast
= xNewLast
; }
105 virtual bool SpellMore(); // examine further documents?
106 virtual bool HasOtherCnt(); // Are there any special areas?
107 virtual void SpellStart( SvxSpellArea eSpell
); // Preparing the area
108 virtual void SpellContinue(); // Check Areas
109 // Result available through GetLast
110 virtual void ReplaceAll( const OUString
&rNewText
, sal_Int16 nLanguage
); //Replace word from the replace list
111 static css::uno::Reference
< css::linguistic2::XDictionary
>
113 virtual void SpellEnd(); // Finish area
114 virtual void InsertHyphen( const sal_Int32 nPos
); // Insert hyphen
116 void SetCurTextObj( SdrObject
* pObj
) { mpTextObj
= pObj
; }
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */