1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SVX_SPELL_DIALOG_CHILD_WINDOW_HXX 29 #define SVX_SPELL_DIALOG_CHILD_WINDOW_HXX 30 31 #include <sfx2/childwin.hxx> 32 #include <editeng/SpellPortions.hxx> 33 #include "svx/svxdllapi.h" 34 #include <vcl/image.hxx> 35 36 class AbstractSpellDialog; 37 38 namespace svx { 39 40 /** The child window wrapper of the actual spellin dialog. To use the 41 spelling dialog in an application you have to do the ususal things: 42 <ol> 43 <li>Call this class' RegisterChildWindow() method with the module 44 as second argument that you want the dialog included in.</li> 45 <li>In the SFX_IMPL_INTERFACE implementation of the view shell 46 that wants to use the dialog call SFX_CHILDWINDOW_REGISTRATION() 47 with the id returned by this class' GetChildWindowId() 48 method.</li> 49 <li>Include the item associated with this child window to the SDI 50 description of the view shell.</li> 51 </ol> 52 */ 53 class SVX_DLLPUBLIC SpellDialogChildWindow 54 : public SfxChildWindow 55 { 56 friend class SpellDialog; 57 AbstractSpellDialog* m_pAbstractSpellDialog; 58 public: 59 SpellDialogChildWindow ( 60 Window*pParent, 61 sal_uInt16 nId, 62 SfxBindings* pBindings, 63 SfxChildWinInfo* pInfo); 64 virtual ~SpellDialogChildWindow (); 65 66 protected: 67 /** This abstract method has to be defined by a derived class. It 68 returns the next wrong sentence. 69 @return 70 returns an empty vector if no error could be found 71 */ 72 virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0; 73 74 /** This abstract method applies the changes made in the spelling dialog 75 to the document. 76 The dialog always updates its settings when it gets the focus. The document 77 can rely on the fact that the methods ApplyChangedSentence() is called for the 78 position that the last GetNextWrongSentence() returned. 79 If 'bRecheck' is set to true then the same sentence should be rechecked once from 80 the start. This should be used too find errors that the user has introduced by 81 manual changes in the edit field, and in order to not miss the still following errors 82 in that sentence. 83 */ 84 virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0; 85 /** This methods determines whether the application supports AutoCorrection 86 */ 87 virtual bool HasAutoCorrection(); 88 /** This method adds a word pair to the AutoCorrection - if available 89 */ 90 virtual void AddAutoCorrection(const String& rOld, const String& rNew, LanguageType eLanguage); 91 /** Return the sfx bindings for this child window. They are 92 retrieved from the dialog so they do not have to be stored in 93 this class as well. The bindings may be necessary to be used 94 by the abstract methods. 95 */ 96 /** This method determines if grammar checking is supported 97 */ 98 virtual bool HasGrammarChecking(); 99 /** determines if grammar checking is switched on 100 */ 101 virtual bool IsGrammarChecking(); 102 /** switches grammar checking on/off 103 */ 104 virtual void SetGrammarChecking(bool bOn); 105 106 SfxBindings& GetBindings (void) const; 107 /** Set the spell dialog into the 'resume' state. This method should be called 108 to notify the SpellDialog about changes in the document that invalidate the 109 current state which results in disabling most of the dialog controls and presenting 110 a "Resume" button that initiates a reinitialization. 111 */ 112 void InvalidateSpellDialog(); 113 /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if 114 the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog() 115 */ 116 virtual void GetFocus() = 0; 117 /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save 118 the current selection/state. 119 */ 120 virtual void LoseFocus() = 0; 121 }; 122 123 } // end of namespace ::svx 124 125 #endif 126