xref: /aoo41x/main/sw/inc/IGrammarContact.hxx (revision cdf0e10c)
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 IGRAMMARCONTACT_HXX_INCLUDED
29 #define IGRAMMARCONTACT_HXX_INCLUDED
30 
31 struct SwPosition;
32 class SwTxtNode;
33 class SwGrammarMarkUp;
34 class SwDoc;
35 
36 /** Organizer of the contact between SwTxtNodes and grammar checker
37 */
38 class IGrammarContact
39 {
40 public:
41 
42     /** Update cursor position reacts to a change of the current input cursor
43         As long as the cursor in inside a paragraph, the grammar checking does
44         not show new grammar faults. When the cursor leaves the paragraph, these
45         faults are shown.
46     @returns void
47     */
48     virtual void updateCursorPosition( const SwPosition& rNewPos ) = 0;
49 
50     /** getGrammarCheck checks if the given text node is blocked by the current cursor
51         if not, the normal markup list is returned
52         if blocked, it will return a markup list "proxy"
53 	@returns a markup list (grammar) for the given SwTxtNode
54     */
55     virtual SwGrammarMarkUp* getGrammarCheck( SwTxtNode& rTxtNode, bool bCreate ) = 0;
56 
57     /** finishGrammarCheck() has to be called if a grammar checking has been completed
58         for a text node. If this text node has not been hided by the current proxy list
59         it will be repainted. Otherwise the proxy list replaces the old list and the
60         repaint will be triggered by a timer
61 	@returns void
62     */
63     virtual void finishGrammarCheck( SwTxtNode& rTxtNode ) = 0;
64 
65 public:
66     virtual ~IGrammarContact() {}
67 };
68 
69 /** Factory for a grammar contact
70 @returns a new created grammar contact object
71 */
72 IGrammarContact* createGrammarContact();
73 
74 /* Helper functions */
75 
76 /** getGrammarContact() delivers the grammar contact of the document (for a given textnode)
77 @returns grammar contact
78 */
79 IGrammarContact* getGrammarContact( const SwTxtNode& );
80 
81 /** finishGrammarCheck() calls the same function of the grammar contact of the document (for a given textnode)
82 @returns void
83 */
84 void finishGrammarCheck( SwTxtNode& );
85 
86 #endif // IGRAMMARCONTACT_HXX_INCLUDED
87 
88