1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #ifndef INCLUDED_SD_SOURCE_UI_INC_SPELLDIALOGCHILDWINDOW_HXX 21 #define INCLUDED_SD_SOURCE_UI_INC_SPELLDIALOGCHILDWINDOW_HXX 22 23 #include <svx/SpellDialogChildWindow.hxx> 24 #include <svl/lstner.hxx> 25 26 class SdOutliner; 27 28 namespace sd { 29 30 /** This derivation of the svx::SpellDialogChildWindow base class 31 provides Draw and Impress specific implementations of 32 GetNextWrongSentence() and ApplyChangedSentence(). 33 */ 34 class SpellDialogChildWindow 35 : public svx::SpellDialogChildWindow 36 , public SfxListener 37 { 38 public: 39 SpellDialogChildWindow ( 40 vcl::Window* pParent, 41 sal_uInt16 nId, 42 SfxBindings* pBindings, 43 SfxChildWinInfo* pInfo); 44 virtual ~SpellDialogChildWindow() override; 45 46 /** This method makes the one from the base class public so that 47 it can be called from the view shell when one is created. 48 */ 49 void InvalidateSpellDialog(); 50 51 // SfxListener 52 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; 53 54 SFX_DECL_CHILDWINDOW_WITHID(SpellDialogChildWindow); 55 56 protected: 57 /** Iterate over the sentences in all text shapes and stop at the 58 next sentence with spelling errors. While doing so the view 59 mode may be changed and text shapes are set into edit mode. 60 */ 61 virtual svx::SpellPortions GetNextWrongSentence( bool bRecheck ) override; 62 63 /** This method is responsible for merging corrections made in the 64 spelling dialog back into the document. 65 */ 66 virtual void ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck) override; 67 virtual void GetFocus() override; 68 virtual void LoseFocus() override; 69 70 private: 71 /** This outliner is used to do the main work of iterating over a 72 document and finding sentences with spelling errors. 73 */ 74 SdOutliner* mpSdOutliner; 75 76 /** When this flag is <TRUE/> then eventually we have to destroy 77 the outliner in mpSdOutliner. 78 */ 79 bool mbOwnOutliner; 80 81 /** Provide an outliner in the mpSdOutliner data member. When the 82 view shell has changed since the last call this include the 83 deletion/release of formerly created/obtained one prior to 84 construction/obtaining of a new one. 85 */ 86 void ProvideOutliner(); 87 88 void EndSpellingAndClearOutliner(); 89 }; 90 91 } // end of namespace ::sd 92 93 #endif 94 95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 96