1*3334a7e6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*3334a7e6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*3334a7e6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*3334a7e6SAndrew Rist * distributed with this work for additional information 6*3334a7e6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*3334a7e6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*3334a7e6SAndrew Rist * "License"); you may not use this file except in compliance 9*3334a7e6SAndrew Rist * with the License. You may obtain a copy of the License at 10*3334a7e6SAndrew Rist * 11*3334a7e6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*3334a7e6SAndrew Rist * 13*3334a7e6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*3334a7e6SAndrew Rist * software distributed under the License is distributed on an 15*3334a7e6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*3334a7e6SAndrew Rist * KIND, either express or implied. See the License for the 17*3334a7e6SAndrew Rist * specific language governing permissions and limitations 18*3334a7e6SAndrew Rist * under the License. 19*3334a7e6SAndrew Rist * 20*3334a7e6SAndrew Rist *************************************************************/ 21*3334a7e6SAndrew Rist 22*3334a7e6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SVX_SPELL_DIALOG_CHILD_WINDOW_HXX 25cdf0e10cSrcweir #define SVX_SPELL_DIALOG_CHILD_WINDOW_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sfx2/childwin.hxx> 28cdf0e10cSrcweir #include <editeng/SpellPortions.hxx> 29cdf0e10cSrcweir #include "svx/svxdllapi.h" 30cdf0e10cSrcweir #include <vcl/image.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir class AbstractSpellDialog; 33cdf0e10cSrcweir 34cdf0e10cSrcweir namespace svx { 35cdf0e10cSrcweir 36cdf0e10cSrcweir /** The child window wrapper of the actual spellin dialog. To use the 37cdf0e10cSrcweir spelling dialog in an application you have to do the ususal things: 38cdf0e10cSrcweir <ol> 39cdf0e10cSrcweir <li>Call this class' RegisterChildWindow() method with the module 40cdf0e10cSrcweir as second argument that you want the dialog included in.</li> 41cdf0e10cSrcweir <li>In the SFX_IMPL_INTERFACE implementation of the view shell 42cdf0e10cSrcweir that wants to use the dialog call SFX_CHILDWINDOW_REGISTRATION() 43cdf0e10cSrcweir with the id returned by this class' GetChildWindowId() 44cdf0e10cSrcweir method.</li> 45cdf0e10cSrcweir <li>Include the item associated with this child window to the SDI 46cdf0e10cSrcweir description of the view shell.</li> 47cdf0e10cSrcweir </ol> 48cdf0e10cSrcweir */ 49cdf0e10cSrcweir class SVX_DLLPUBLIC SpellDialogChildWindow 50cdf0e10cSrcweir : public SfxChildWindow 51cdf0e10cSrcweir { 52cdf0e10cSrcweir friend class SpellDialog; 53cdf0e10cSrcweir AbstractSpellDialog* m_pAbstractSpellDialog; 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir SpellDialogChildWindow ( 56cdf0e10cSrcweir Window*pParent, 57cdf0e10cSrcweir sal_uInt16 nId, 58cdf0e10cSrcweir SfxBindings* pBindings, 59cdf0e10cSrcweir SfxChildWinInfo* pInfo); 60cdf0e10cSrcweir virtual ~SpellDialogChildWindow (); 61cdf0e10cSrcweir 62cdf0e10cSrcweir protected: 63cdf0e10cSrcweir /** This abstract method has to be defined by a derived class. It 64cdf0e10cSrcweir returns the next wrong sentence. 65cdf0e10cSrcweir @return 66cdf0e10cSrcweir returns an empty vector if no error could be found 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0; 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** This abstract method applies the changes made in the spelling dialog 71cdf0e10cSrcweir to the document. 72cdf0e10cSrcweir The dialog always updates its settings when it gets the focus. The document 73cdf0e10cSrcweir can rely on the fact that the methods ApplyChangedSentence() is called for the 74cdf0e10cSrcweir position that the last GetNextWrongSentence() returned. 75cdf0e10cSrcweir If 'bRecheck' is set to true then the same sentence should be rechecked once from 76cdf0e10cSrcweir the start. This should be used too find errors that the user has introduced by 77cdf0e10cSrcweir manual changes in the edit field, and in order to not miss the still following errors 78cdf0e10cSrcweir in that sentence. 79cdf0e10cSrcweir */ 80cdf0e10cSrcweir virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0; 81cdf0e10cSrcweir /** This methods determines whether the application supports AutoCorrection 82cdf0e10cSrcweir */ 83cdf0e10cSrcweir virtual bool HasAutoCorrection(); 84cdf0e10cSrcweir /** This method adds a word pair to the AutoCorrection - if available 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir virtual void AddAutoCorrection(const String& rOld, const String& rNew, LanguageType eLanguage); 87cdf0e10cSrcweir /** Return the sfx bindings for this child window. They are 88cdf0e10cSrcweir retrieved from the dialog so they do not have to be stored in 89cdf0e10cSrcweir this class as well. The bindings may be necessary to be used 90cdf0e10cSrcweir by the abstract methods. 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir /** This method determines if grammar checking is supported 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir virtual bool HasGrammarChecking(); 95cdf0e10cSrcweir /** determines if grammar checking is switched on 96cdf0e10cSrcweir */ 97cdf0e10cSrcweir virtual bool IsGrammarChecking(); 98cdf0e10cSrcweir /** switches grammar checking on/off 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir virtual void SetGrammarChecking(bool bOn); 101cdf0e10cSrcweir 102cdf0e10cSrcweir SfxBindings& GetBindings (void) const; 103cdf0e10cSrcweir /** Set the spell dialog into the 'resume' state. This method should be called 104cdf0e10cSrcweir to notify the SpellDialog about changes in the document that invalidate the 105cdf0e10cSrcweir current state which results in disabling most of the dialog controls and presenting 106cdf0e10cSrcweir a "Resume" button that initiates a reinitialization. 107cdf0e10cSrcweir */ 108cdf0e10cSrcweir void InvalidateSpellDialog(); 109cdf0e10cSrcweir /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if 110cdf0e10cSrcweir the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog() 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir virtual void GetFocus() = 0; 113cdf0e10cSrcweir /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save 114cdf0e10cSrcweir the current selection/state. 115cdf0e10cSrcweir */ 116cdf0e10cSrcweir virtual void LoseFocus() = 0; 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir 119cdf0e10cSrcweir } // end of namespace ::svx 120cdf0e10cSrcweir 121cdf0e10cSrcweir #endif 122