1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fuspell.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
35 #include "fuspell.hxx"
37 #include <svx/outliner.hxx>
38 #include <sfx2/bindings.hxx>
40 #include <sfx2/viewfrm.hxx>
42 #include "Outliner.hxx"
43 #include "drawdoc.hxx"
44 #include "DrawViewShell.hxx"
45 #include "OutlineViewShell.hxx"
46 #include "ViewShellBase.hxx"
54 USHORT SidArraySpell
[] = {
62 TYPEINIT1( FuSpell
, FuPoor
);
64 /*************************************************************************
68 \************************************************************************/
76 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
),
82 FunctionReference
FuSpell::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
84 FunctionReference
xFunc( new FuSpell( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
85 xFunc
->DoExecute(rReq
);
89 void FuSpell::DoExecute( SfxRequest
& )
91 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArraySpell
);
93 if ( mpViewShell
->ISA(DrawViewShell
) )
96 pSdOutliner
= new ::sd::Outliner( mpDoc
, OUTLINERMODE_TEXTOBJECT
);
98 else if ( mpViewShell
->ISA(OutlineViewShell
) )
100 bOwnOutliner
= FALSE
;
101 pSdOutliner
= mpDoc
->GetOutliner();
105 pSdOutliner
->PrepareSpelling();
110 /*************************************************************************
114 \************************************************************************/
118 mpDocSh
->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell
);
121 pSdOutliner
->EndSpelling();
127 /*************************************************************************
131 \************************************************************************/
133 void FuSpell::StartSpelling()
135 // Get current main view shell.
136 ViewShellBase
* pBase (ViewShellBase::GetViewShellBase (
137 mpDocSh
->GetViewShell()->GetViewFrame()));
139 mpViewShell
= pBase
->GetMainViewShell().get();
142 if (mpViewShell
!= NULL
)
144 if ( pSdOutliner
&& mpViewShell
->ISA(DrawViewShell
) && !bOwnOutliner
)
146 pSdOutliner
->EndSpelling();
149 pSdOutliner
= new ::sd::Outliner( mpDoc
, OUTLINERMODE_TEXTOBJECT
);
150 pSdOutliner
->PrepareSpelling();
152 else if ( pSdOutliner
&& mpViewShell
->ISA(OutlineViewShell
) && bOwnOutliner
)
154 pSdOutliner
->EndSpelling();
157 bOwnOutliner
= FALSE
;
158 pSdOutliner
= mpDoc
->GetOutliner();
159 pSdOutliner
->PrepareSpelling();
163 pSdOutliner
->StartSpelling();
169 } // end of namespace sd