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
: public SfxChildWindow
46 friend class SpellDialog
;
47 VclPtr
<AbstractSpellDialog
> m_xAbstractSpellDialog
;
50 SpellDialogChildWindow(vcl::Window
* pParent
, sal_uInt16 nId
, SfxBindings
* pBindings
);
51 virtual ~SpellDialogChildWindow() override
;
54 /** This abstract method has to be defined by a derived class. It
55 returns the next wrong sentence.
57 returns an empty vector if no error could be found
59 virtual SpellPortions
GetNextWrongSentence(bool bRecheck
) = 0;
61 /** This abstract method applies the changes made in the spelling dialog
63 The dialog always updates its settings when it gets the focus. The document
64 can rely on the fact that the methods ApplyChangedSentence() is called for the
65 position that the last GetNextWrongSentence() returned.
66 If 'bRecheck' is set to true then the same sentence should be rechecked once from
67 the start. This should be used to find errors that the user has introduced by
68 manual changes in the edit field, and in order to not miss the still following errors
71 virtual void ApplyChangedSentence(const SpellPortions
& rChanged
, bool bRecheck
) = 0;
72 /** This methods determines whether the application supports AutoCorrection
74 virtual bool HasAutoCorrection();
75 /** This method adds a word pair to the AutoCorrection - if available
77 virtual void AddAutoCorrection(const OUString
& rOld
, const OUString
& rNew
,
78 LanguageType eLanguage
);
79 /** Return the sfx bindings for this child window. They are
80 retrieved from the dialog so they do not have to be stored in
81 this class as well. The bindings may be necessary to be used
82 by the abstract methods.
84 /** This method determines if grammar checking is supported
86 virtual bool HasGrammarChecking();
87 /** determines if grammar checking is switched on
89 virtual bool IsGrammarChecking();
90 /** switches grammar checking on/off
92 virtual void SetGrammarChecking(bool bOn
);
94 SfxBindings
& GetBindings() const;
95 /** Set the spell dialog into the 'resume' state. This method should be called
96 to notify the SpellDialog about changes in the document that invalidate the
97 current state which results in disabling most of the dialog controls and presenting
98 a "Resume" button that initiates a reinitialization.
100 void InvalidateSpellDialog();
101 /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
102 the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
104 virtual void GetFocus() = 0;
105 /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
106 the current selection/state.
108 virtual void LoseFocus() = 0;
111 } // end of namespace ::svx
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */