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