Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / SpellDialogChildWindow.hxx
blob15c0f6868891840caecce04654e6a1bde1db0147
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_SVX_SPELLDIALOGCHILDWINDOW_HXX
21 #define INCLUDED_SVX_SPELLDIALOGCHILDWINDOW_HXX
23 #include <sfx2/childwin.hxx>
24 #include <editeng/SpellPortions.hxx>
25 #include <svx/svxdllapi.h>
26 #include <vcl/image.hxx>
28 class AbstractSpellDialog;
30 namespace svx {
32 /** The child window wrapper of the actual spelling dialog. To use the
33 spelling dialog in an application you have to do the usual things:
34 <ol>
35 <li>Call this class' RegisterChildWindow() method with the module
36 as second argument that you want the dialog included in.</li>
37 <li>In the SFX_IMPL_INTERFACE implementation of the view shell
38 that wants to use the dialog call RegisterChildWindow()
39 with the id returned by this class' GetChildWindowId()
40 method.</li>
41 <li>Include the item associated with this child window to the SDI
42 description of the view shell.</li>
43 </ol>
45 class SVX_DLLPUBLIC SpellDialogChildWindow
46 : public SfxChildWindow
48 friend class SpellDialog;
49 VclPtr<AbstractSpellDialog> m_xAbstractSpellDialog;
50 public:
51 SpellDialogChildWindow (
52 vcl::Window*pParent,
53 sal_uInt16 nId,
54 SfxBindings* pBindings);
55 virtual ~SpellDialogChildWindow () override;
57 protected:
58 /** This abstract method has to be defined by a derived class. It
59 returns the next wrong sentence.
60 @return
61 returns an empty vector if no error could be found
63 virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0;
65 /** This abstract method applies the changes made in the spelling dialog
66 to the document.
67 The dialog always updates its settings when it gets the focus. The document
68 can rely on the fact that the methods ApplyChangedSentence() is called for the
69 position that the last GetNextWrongSentence() returned.
70 If 'bRecheck' is set to true then the same sentence should be rechecked once from
71 the start. This should be used too find errors that the user has introduced by
72 manual changes in the edit field, and in order to not miss the still following errors
73 in that sentence.
75 virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0;
76 /** This methods determines whether the application supports AutoCorrection
78 virtual bool HasAutoCorrection();
79 /** This method adds a word pair to the AutoCorrection - if available
81 virtual void AddAutoCorrection(const OUString& rOld, const OUString& rNew, LanguageType eLanguage);
82 /** Return the sfx bindings for this child window. They are
83 retrieved from the dialog so they do not have to be stored in
84 this class as well. The bindings may be necessary to be used
85 by the abstract methods.
87 /** This method determines if grammar checking is supported
89 virtual bool HasGrammarChecking();
90 /** determines if grammar checking is switched on
92 virtual bool IsGrammarChecking();
93 /** switches grammar checking on/off
95 virtual void SetGrammarChecking(bool bOn);
97 SfxBindings& GetBindings() const;
98 /** Set the spell dialog into the 'resume' state. This method should be called
99 to notify the SpellDialog about changes in the document that invalidate the
100 current state which results in disabling most of the dialog controls and presenting
101 a "Resume" button that initiates a reinitialization.
103 void InvalidateSpellDialog();
104 /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
105 the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
107 virtual void GetFocus() = 0;
108 /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
109 the current selection/state.
111 virtual void LoseFocus() = 0;
114 } // end of namespace ::svx
116 #endif
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */