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