Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / SpellDialogChildWindow.hxx
bloba50ddbbfb0132efc50401d82aa114c74abda2ee2
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 spellin dialog. To use the
33 spelling dialog in an application you have to do the ususal 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 AbstractSpellDialog* m_pAbstractSpellDialog;
50 public:
51 SpellDialogChildWindow (
52 vcl::Window*pParent,
53 sal_uInt16 nId,
54 SfxBindings* pBindings,
55 SfxChildWinInfo* pInfo);
56 virtual ~SpellDialogChildWindow ();
58 protected:
59 /** This abstract method has to be defined by a derived class. It
60 returns the next wrong sentence.
61 @return
62 returns an empty vector if no error could be found
64 virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0;
66 /** This abstract method applies the changes made in the spelling dialog
67 to the document.
68 The dialog always updates its settings when it gets the focus. The document
69 can rely on the fact that the methods ApplyChangedSentence() is called for the
70 position that the last GetNextWrongSentence() returned.
71 If 'bRecheck' is set to true then the same sentence should be rechecked once from
72 the start. This should be used too find errors that the user has introduced by
73 manual changes in the edit field, and in order to not miss the still following errors
74 in that sentence.
76 virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0;
77 /** This methods determines whether the application supports AutoCorrection
79 virtual bool HasAutoCorrection();
80 /** This method adds a word pair to the AutoCorrection - if available
82 virtual void AddAutoCorrection(const OUString& rOld, const OUString& rNew, LanguageType eLanguage);
83 /** Return the sfx bindings for this child window. They are
84 retrieved from the dialog so they do not have to be stored in
85 this class as well. The bindings may be necessary to be used
86 by the abstract methods.
88 /** This method determines if grammar checking is supported
90 virtual bool HasGrammarChecking();
91 /** determines if grammar checking is switched on
93 virtual bool IsGrammarChecking();
94 /** switches grammar checking on/off
96 virtual void SetGrammarChecking(bool bOn);
98 SfxBindings& GetBindings() const;
99 /** Set the spell dialog into the 'resume' state. This method should be called
100 to notify the SpellDialog about changes in the document that invalidate the
101 current state which results in disabling most of the dialog controls and presenting
102 a "Resume" button that initiates a reinitialization.
104 void InvalidateSpellDialog();
105 /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
106 the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
108 virtual void GetFocus() = 0;
109 /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
110 the current selection/state.
112 virtual void LoseFocus() = 0;
115 } // end of namespace ::svx
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */