1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef IGRAMMARCONTACT_HXX_INCLUDED 25 #define IGRAMMARCONTACT_HXX_INCLUDED 26 27 struct SwPosition; 28 class SwTxtNode; 29 class SwGrammarMarkUp; 30 class SwDoc; 31 32 /** Organizer of the contact between SwTxtNodes and grammar checker 33 */ 34 class IGrammarContact 35 { 36 public: 37 38 /** Update cursor position reacts to a change of the current input cursor 39 As long as the cursor in inside a paragraph, the grammar checking does 40 not show new grammar faults. When the cursor leaves the paragraph, these 41 faults are shown. 42 @returns void 43 */ 44 virtual void updateCursorPosition( const SwPosition& rNewPos ) = 0; 45 46 /** getGrammarCheck checks if the given text node is blocked by the current cursor 47 if not, the normal markup list is returned 48 if blocked, it will return a markup list "proxy" 49 @returns a markup list (grammar) for the given SwTxtNode 50 */ 51 virtual SwGrammarMarkUp* getGrammarCheck( SwTxtNode& rTxtNode, bool bCreate ) = 0; 52 53 /** finishGrammarCheck() has to be called if a grammar checking has been completed 54 for a text node. If this text node has not been hided by the current proxy list 55 it will be repainted. Otherwise the proxy list replaces the old list and the 56 repaint will be triggered by a timer 57 @returns void 58 */ 59 virtual void finishGrammarCheck( SwTxtNode& rTxtNode ) = 0; 60 61 public: ~IGrammarContact()62 virtual ~IGrammarContact() {} 63 }; 64 65 /** Factory for a grammar contact 66 @returns a new created grammar contact object 67 */ 68 IGrammarContact* createGrammarContact(); 69 70 /* Helper functions */ 71 72 /** getGrammarContact() delivers the grammar contact of the document (for a given textnode) 73 @returns grammar contact 74 */ 75 IGrammarContact* getGrammarContact( const SwTxtNode& ); 76 77 /** finishGrammarCheck() calls the same function of the grammar contact of the document (for a given textnode) 78 @returns void 79 */ 80 void finishGrammarCheck( SwTxtNode& ); 81 82 #endif // IGRAMMARCONTACT_HXX_INCLUDED 83 84