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 .
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>
27 class AbstractSpellDialog
;
31 /** The child window wrapper of the actual spelling dialog. To use the
32 spelling dialog in an application you have to do the usual things:
34 <li>Call this class' RegisterChildWindow() method with the module
35 as second argument that you want the dialog included in.</li>
36 <li>In the SFX_IMPL_INTERFACE implementation of the view shell
37 that wants to use the dialog call RegisterChildWindow()
38 with the id returned by this class' GetChildWindowId()
40 <li>Include the item associated with this child window to the SDI
41 description of the view shell.</li>
44 class SVX_DLLPUBLIC SpellDialogChildWindow
45 : public SfxChildWindow
47 friend class SpellDialog
;
48 VclPtr
<AbstractSpellDialog
> m_xAbstractSpellDialog
;
50 SpellDialogChildWindow (
53 SfxBindings
* pBindings
);
54 virtual ~SpellDialogChildWindow () override
;
57 /** This abstract method has to be defined by a derived class. It
58 returns the next wrong sentence.
60 returns an empty vector if no error could be found
62 virtual SpellPortions
GetNextWrongSentence (bool bRecheck
) = 0;
64 /** This abstract method applies the changes made in the spelling dialog
66 The dialog always updates its settings when it gets the focus. The document
67 can rely on the fact that the methods ApplyChangedSentence() is called for the
68 position that the last GetNextWrongSentence() returned.
69 If 'bRecheck' is set to true then the same sentence should be rechecked once from
70 the start. This should be used to find errors that the user has introduced by
71 manual changes in the edit field, and in order to not miss the still following errors
74 virtual void ApplyChangedSentence(const SpellPortions
& rChanged
, bool bRecheck
) = 0;
75 /** This methods determines whether the application supports AutoCorrection
77 virtual bool HasAutoCorrection();
78 /** This method adds a word pair to the AutoCorrection - if available
80 virtual void AddAutoCorrection(const OUString
& rOld
, const OUString
& rNew
, LanguageType eLanguage
);
81 /** Return the sfx bindings for this child window. They are
82 retrieved from the dialog so they do not have to be stored in
83 this class as well. The bindings may be necessary to be used
84 by the abstract methods.
86 /** This method determines if grammar checking is supported
88 virtual bool HasGrammarChecking();
89 /** determines if grammar checking is switched on
91 virtual bool IsGrammarChecking();
92 /** switches grammar checking on/off
94 virtual void SetGrammarChecking(bool bOn
);
96 SfxBindings
& GetBindings() const;
97 /** Set the spell dialog into the 'resume' state. This method should be called
98 to notify the SpellDialog about changes in the document that invalidate the
99 current state which results in disabling most of the dialog controls and presenting
100 a "Resume" button that initiates a reinitialization.
102 void InvalidateSpellDialog();
103 /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
104 the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
106 virtual void GetFocus() = 0;
107 /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
108 the current selection/state.
110 virtual void LoseFocus() = 0;
113 } // end of namespace ::svx
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */