2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* $RCSfile: fuspell.cxx,v $
|
|
|
|
* $Revision: 1.12 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:26:33 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 17:56:29 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-01-20 10:18:36 +00:00
|
|
|
#include "fuspell.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/outliner.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
2004-10-04 17:35:09 +00:00
|
|
|
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "fupoor.hxx"
|
2004-01-20 10:18:36 +00:00
|
|
|
#include "Outliner.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "drawdoc.hxx"
|
2004-01-20 10:18:36 +00:00
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#include "OutlineViewShell.hxx"
|
|
|
|
#include "ViewShellBase.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "app.hrc"
|
|
|
|
|
|
|
|
class SfxRequest;
|
|
|
|
|
2004-01-20 10:18:36 +00:00
|
|
|
namespace sd {
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
USHORT SidArraySpell[] = {
|
|
|
|
SID_DRAWINGMODE,
|
|
|
|
SID_OUTLINEMODE,
|
|
|
|
SID_DIAMODE,
|
|
|
|
SID_NOTESMODE,
|
|
|
|
SID_HANDOUTMODE,
|
|
|
|
0 };
|
|
|
|
|
|
|
|
TYPEINIT1( FuSpell, FuPoor );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 10:18:36 +00:00
|
|
|
FuSpell::FuSpell (
|
|
|
|
ViewShell* pViewSh,
|
|
|
|
::sd::Window* pWin,
|
|
|
|
::sd::View* pView,
|
|
|
|
SdDrawDocument* pDoc,
|
|
|
|
SfxRequest& rReq )
|
|
|
|
: FuPoor(pViewSh, pWin, pView, pDoc, rReq),
|
|
|
|
pSdOutliner(NULL),
|
|
|
|
bOwnOutliner(FALSE)
|
2005-12-14 16:04:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionReference FuSpell::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
|
|
|
|
{
|
|
|
|
FunctionReference xFunc( new FuSpell( pViewSh, pWin, pView, pDoc, rReq ) );
|
|
|
|
xFunc->DoExecute(rReq);
|
|
|
|
return xFunc;
|
|
|
|
}
|
|
|
|
|
2006-12-12 16:24:33 +00:00
|
|
|
void FuSpell::DoExecute( SfxRequest& )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-12-12 16:24:33 +00:00
|
|
|
mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-12-12 16:24:33 +00:00
|
|
|
if ( mpViewShell->ISA(DrawViewShell) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
bOwnOutliner = TRUE;
|
2006-12-12 16:24:33 +00:00
|
|
|
pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2006-12-12 16:24:33 +00:00
|
|
|
else if ( mpViewShell->ISA(OutlineViewShell) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
bOwnOutliner = FALSE;
|
2006-12-12 16:24:33 +00:00
|
|
|
pSdOutliner = mpDoc->GetOutliner();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pSdOutliner)
|
|
|
|
pSdOutliner->PrepareSpelling();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Destruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
FuSpell::~FuSpell()
|
|
|
|
{
|
2006-12-12 16:24:33 +00:00
|
|
|
mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if (pSdOutliner)
|
|
|
|
pSdOutliner->EndSpelling();
|
|
|
|
|
|
|
|
if (bOwnOutliner)
|
|
|
|
delete pSdOutliner;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Pruefung starten
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void FuSpell::StartSpelling()
|
|
|
|
{
|
2004-01-20 10:18:36 +00:00
|
|
|
// Get current main view shell.
|
2004-07-13 12:53:06 +00:00
|
|
|
ViewShellBase* pBase (ViewShellBase::GetViewShellBase (
|
2006-12-12 16:24:33 +00:00
|
|
|
mpDocSh->GetViewShell()->GetViewFrame()));
|
2004-07-13 12:53:06 +00:00
|
|
|
if (pBase != NULL)
|
2007-04-03 15:01:55 +00:00
|
|
|
mpViewShell = pBase->GetMainViewShell().get();
|
2004-07-13 12:53:06 +00:00
|
|
|
else
|
2006-12-12 16:24:33 +00:00
|
|
|
mpViewShell = NULL;
|
|
|
|
if (mpViewShell != NULL)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-12-12 16:24:33 +00:00
|
|
|
if ( pSdOutliner && mpViewShell->ISA(DrawViewShell) && !bOwnOutliner )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pSdOutliner->EndSpelling();
|
|
|
|
|
|
|
|
bOwnOutliner = TRUE;
|
2006-12-12 16:24:33 +00:00
|
|
|
pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSdOutliner->PrepareSpelling();
|
|
|
|
}
|
2006-12-12 16:24:33 +00:00
|
|
|
else if ( pSdOutliner && mpViewShell->ISA(OutlineViewShell) && bOwnOutliner )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pSdOutliner->EndSpelling();
|
|
|
|
delete pSdOutliner;
|
|
|
|
|
|
|
|
bOwnOutliner = FALSE;
|
2006-12-12 16:24:33 +00:00
|
|
|
pSdOutliner = mpDoc->GetOutliner();
|
2000-09-18 16:07:07 +00:00
|
|
|
pSdOutliner->PrepareSpelling();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pSdOutliner)
|
|
|
|
pSdOutliner->StartSpelling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 10:18:36 +00:00
|
|
|
} // end of namespace sd
|