xref: /aoo41x/main/sc/source/ui/inc/spelldialog.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 SC_SPELLDIALOG_HXX
29 #define SC_SPELLDIALOG_HXX
30 
31 #include <memory>
32 #include <svx/SpellDialogChildWindow.hxx>
33 
34 // ============================================================================
35 
36 class ScConversionEngineBase;
37 class ScSelectionState;
38 class ScTabViewShell;
39 class ScViewData;
40 class ScDocShell;
41 class ScDocument;
42 
43 /** Specialized spell check dialog child window for Calc.
44 
45     This derivation of the ::svx::SpellDialogChildWindow base class provides
46     Calc specific implementations of the virtual functions GetNextWrongSentence()
47     and ApplyChangedSentence().
48  */
49 class ScSpellDialogChildWindow : public ::svx::SpellDialogChildWindow
50 {
51 public:
52     SFX_DECL_CHILDWINDOW( ScSpellDialogChildWindow );
53 
54     explicit            ScSpellDialogChildWindow( Window* pParent, sal_uInt16 nId,
55                             SfxBindings* pBindings, SfxChildWinInfo* pInfo );
56     virtual             ~ScSpellDialogChildWindow();
57 
58     /** This method makes the one from the base class public so that
59         it can be called from the view shell when one is created.
60     */
61     virtual void        InvalidateSpellDialog();
62 
63 protected:
64     /** Iterate over the sentences in all text shapes and stop at the
65         next sentence with spelling errors. While doing so the view
66         mode may be changed and text shapes are set into edit mode.
67     */
68     virtual ::svx::SpellPortions GetNextWrongSentence( bool bRecheck );
69 
70     /** This method is responsible for merging corrections made in the
71         spelling dialog back into the document.
72     */
73     virtual void        ApplyChangedSentence( const ::svx::SpellPortions& rChanged, bool bRecheck );
74     virtual void        GetFocus();
75     virtual void        LoseFocus();
76 
77 private:
78     void                Reset();
79     void                Init();
80 
81     bool                IsSelectionChanged();
82 
83 private:
84     typedef ::std::auto_ptr< ScConversionEngineBase >   ScConvEnginePtr;
85     typedef ::std::auto_ptr< ScDocument >               ScDocumentPtr;
86     typedef ::std::auto_ptr< ScSelectionState >         ScSelectionStatePtr;
87 
88     ScConvEnginePtr     mxEngine;
89     ScDocumentPtr       mxUndoDoc;
90     ScDocumentPtr       mxRedoDoc;
91     ScSelectionStatePtr mxOldSel;           /// Old selection state for comparison.
92     ScTabViewShell*     mpViewShell;
93     ScViewData*         mpViewData;
94     ScDocShell*         mpDocShell;
95     ScDocument*         mpDoc;
96     bool                mbNeedNextObj;
97     bool                mbOldIdleDisabled;
98 };
99 
100 // ============================================================================
101 
102 #endif
103 
104