2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:16:55 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +00:00
|
|
|
* $RCSfile: select.cxx,v $
|
|
|
|
* $Revision: 1.33 $
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +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:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +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:15:01 +00:00
|
|
|
*
|
2008-04-10 21:16:55 +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:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 22:39:41 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
#include <hintids.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/eitem.hxx>
|
|
|
|
#include <svl/macitem.hxx>
|
2000-10-25 14:39:12 +00:00
|
|
|
#include <unotools/charclass.hxx>
|
2001-05-16 17:08:06 +00:00
|
|
|
#include <svx/scripttypeitem.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#ifndef _CMDID_H
|
|
|
|
#include <cmdid.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _VIEW_HXX
|
|
|
|
#include <view.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _BASESH_HXX
|
|
|
|
#include <basesh.hxx>
|
|
|
|
#endif
|
|
|
|
#include <wrtsh.hxx>
|
|
|
|
#include <frmatr.hxx>
|
|
|
|
#include <initui.hxx>
|
|
|
|
#include <mdiexp.hxx>
|
|
|
|
#include <fmtcol.hxx>
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#include <swundo.hxx> // fuer Undo-Ids
|
|
|
|
#include <swevent.hxx>
|
2001-09-11 13:57:42 +00:00
|
|
|
#include <swdtflvr.hxx>
|
2002-02-01 11:51:13 +00:00
|
|
|
#include <crsskip.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2003-04-15 16:05:11 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2000-09-18 16:15:01 +00:00
|
|
|
#include <pam.hxx>
|
|
|
|
#endif
|
|
|
|
|
2001-03-12 07:18:49 +00:00
|
|
|
namespace com { namespace sun { namespace star { namespace util {
|
|
|
|
struct SearchOptions;
|
|
|
|
} } } }
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
using namespace ::com::sun::star::util;
|
2001-03-12 07:18:49 +00:00
|
|
|
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
static long nStartDragX = 0, nStartDragY = 0;
|
|
|
|
static BOOL bStartDrag = FALSE;
|
|
|
|
|
2009-09-18 10:15:03 +00:00
|
|
|
void SwWrtShell::Invalidate()
|
|
|
|
{
|
|
|
|
// to avoid making the slot volatile, invalidate it everytime if something could have been changed
|
|
|
|
// this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
|
|
|
|
GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
BOOL SwWrtShell::SelNearestWrd()
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
|
|
|
|
PrvWrd();
|
|
|
|
if( IsEndWrd() )
|
2002-02-01 11:51:13 +00:00
|
|
|
Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE );
|
2000-09-18 16:15:01 +00:00
|
|
|
return SelWrd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOL SwWrtShell::SelWrd(const Point *pPt, BOOL )
|
|
|
|
{
|
|
|
|
BOOL bRet;
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
SttSelect();
|
|
|
|
bRet = SwCrsrShell::SelectWord( pPt );
|
|
|
|
}
|
|
|
|
EndSelect();
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
bSelWrd = TRUE;
|
|
|
|
if(pPt)
|
|
|
|
aStart = *pPt;
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2004-09-09 08:15:18 +00:00
|
|
|
void SwWrtShell::SelSentence(const Point *pPt, BOOL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
ClearMark();
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::GoStartSentence();
|
2000-09-18 16:15:01 +00:00
|
|
|
SttSelect();
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::GoEndSentence();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
EndSelect();
|
2004-09-09 08:15:18 +00:00
|
|
|
if(pPt)
|
|
|
|
aStart = *pPt;
|
|
|
|
bSelLn = TRUE;
|
|
|
|
bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 08:15:18 +00:00
|
|
|
void SwWrtShell::SelPara(const Point *pPt, BOOL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
ClearMark();
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
|
2000-09-18 16:15:01 +00:00
|
|
|
SttSelect();
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
EndSelect();
|
|
|
|
if(pPt)
|
|
|
|
aStart = *pPt;
|
2004-09-09 08:15:18 +00:00
|
|
|
bSelLn = FALSE;
|
2000-09-18 16:15:01 +00:00
|
|
|
bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::SelAll()
|
|
|
|
{
|
2003-03-27 14:45:43 +00:00
|
|
|
const BOOL bLockedView = IsViewLocked();
|
|
|
|
LockView( TRUE );
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2009-08-27 15:54:55 +00:00
|
|
|
if(bBlockMode)
|
|
|
|
LeaveBlockMode();
|
2000-09-18 16:15:01 +00:00
|
|
|
MV_KONTEXT(this);
|
|
|
|
BOOL bMoveTable = FALSE;
|
2009-02-13 11:19:56 +00:00
|
|
|
SwPosition *pStartPos = 0;
|
|
|
|
SwPosition *pEndPos = 0;
|
|
|
|
SwShellCrsr* pTmpCrsr = 0;
|
2000-09-18 16:15:01 +00:00
|
|
|
if( !HasWholeTabSelection() )
|
|
|
|
{
|
|
|
|
if ( IsSelection() && IsCrsrPtAtEnd() )
|
|
|
|
SwapPam();
|
2009-02-13 11:19:56 +00:00
|
|
|
pTmpCrsr = getShellCrsr( false );
|
|
|
|
if( pTmpCrsr )
|
|
|
|
{
|
|
|
|
pStartPos = new SwPosition( *pTmpCrsr->GetPoint() );
|
|
|
|
pEndPos = new SwPosition( *pTmpCrsr->GetMark() );
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
Push();
|
|
|
|
BOOL bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
|
|
|
|
SwapPam();
|
|
|
|
bIsFullSel &= !MoveSection( fnSectionCurr, fnSectionEnd);
|
|
|
|
Pop(FALSE);
|
|
|
|
GoStart(TRUE, &bMoveTable, FALSE, !bIsFullSel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnterStdMode();
|
2007-09-27 11:53:01 +00:00
|
|
|
SttEndDoc(TRUE);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
SttSelect();
|
|
|
|
GoEnd(TRUE, &bMoveTable);
|
2009-02-13 11:19:56 +00:00
|
|
|
if( pStartPos )
|
|
|
|
{
|
|
|
|
pTmpCrsr = getShellCrsr( false );
|
|
|
|
if( pTmpCrsr )
|
|
|
|
{
|
|
|
|
// Some special handling for sections (e.g. TOC) at the beginning of the document body
|
|
|
|
// to avoid the selection of the first section
|
|
|
|
// if the last selection was behind the first section or
|
|
|
|
// if the last selection was already the first section
|
|
|
|
// In this both cases we select to the end of document
|
|
|
|
if( *pTmpCrsr->GetPoint() < *pEndPos ||
|
|
|
|
( *pStartPos == *pTmpCrsr->GetMark() &&
|
|
|
|
*pEndPos == *pTmpCrsr->GetPoint() ) )
|
|
|
|
SwCrsrShell::SttEndDoc(FALSE);
|
|
|
|
}
|
|
|
|
delete pStartPos;
|
|
|
|
delete pEndPos;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
EndSelect();
|
2003-03-27 14:45:43 +00:00
|
|
|
LockView( bLockedView );
|
2000-09-18 16:15:01 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Textsuche
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
2009-01-02 15:51:45 +00:00
|
|
|
ULONG SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, BOOL bSearchInNotes,
|
2000-09-18 16:15:01 +00:00
|
|
|
SwDocPositions eStt, SwDocPositions eEnd,
|
|
|
|
FindRanges eFlags, int bReplace )
|
|
|
|
{
|
|
|
|
// keine Erweiterung bestehender Selektionen
|
|
|
|
if(!(eFlags & FND_IN_SEL))
|
|
|
|
ClearMark();
|
2002-09-13 12:19:33 +00:00
|
|
|
BOOL bCancel = FALSE;
|
2009-01-02 15:51:45 +00:00
|
|
|
ULONG nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
|
2002-09-13 12:19:33 +00:00
|
|
|
if(bCancel)
|
|
|
|
{
|
2007-09-27 11:53:01 +00:00
|
|
|
Undo(UNDO_EMPTY, 1);
|
2002-09-13 12:19:33 +00:00
|
|
|
nRet = ULONG_MAX;
|
|
|
|
}
|
|
|
|
return nRet;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Suche nach Vorlagen
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ULONG SwWrtShell::SearchTempl( const String &rTempl,
|
|
|
|
SwDocPositions eStt, SwDocPositions eEnd,
|
|
|
|
FindRanges eFlags, const String* pReplTempl )
|
|
|
|
{
|
|
|
|
// keine Erweiterung bestehender Selektionen
|
|
|
|
if(!(eFlags & FND_IN_SEL))
|
|
|
|
ClearMark();
|
|
|
|
SwTxtFmtColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME);
|
|
|
|
SwTxtFmtColl *pReplaceColl = 0;
|
|
|
|
if( pReplTempl )
|
|
|
|
pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
|
|
|
|
|
2002-09-13 12:19:33 +00:00
|
|
|
BOOL bCancel = FALSE;
|
|
|
|
ULONG nRet = Find(pColl? *pColl: GetDfltTxtFmtColl(),
|
|
|
|
eStt,eEnd, bCancel, eFlags, pReplaceColl);
|
|
|
|
if(bCancel)
|
|
|
|
{
|
2007-09-27 11:53:01 +00:00
|
|
|
Undo(UNDO_EMPTY, 1);
|
2002-09-13 12:19:33 +00:00
|
|
|
nRet = ULONG_MAX;
|
|
|
|
}
|
|
|
|
return nRet;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Suche nach Attributen ----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
|
|
|
|
SwDocPositions eStart, SwDocPositions eEnde,
|
2001-03-12 07:18:49 +00:00
|
|
|
FindRanges eFlags, const SearchOptions* pSearchOpt,
|
2000-09-18 16:15:01 +00:00
|
|
|
const SfxItemSet* pReplaceSet )
|
|
|
|
{
|
|
|
|
// Keine Erweiterung bestehender Selektionen
|
|
|
|
if (!(eFlags & FND_IN_SEL))
|
|
|
|
ClearMark();
|
|
|
|
|
|
|
|
// Suchen
|
2002-09-13 12:19:33 +00:00
|
|
|
BOOL bCancel = FALSE;
|
|
|
|
ULONG nRet = Find( rFindSet, bNoColls, eStart, eEnde, bCancel, eFlags, pSearchOpt, pReplaceSet);
|
|
|
|
|
|
|
|
if(bCancel)
|
|
|
|
{
|
2007-09-27 11:53:01 +00:00
|
|
|
Undo(UNDO_EMPTY, 1);
|
2002-09-13 12:19:33 +00:00
|
|
|
nRet = ULONG_MAX;
|
|
|
|
}
|
|
|
|
return nRet;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------- Selektionsmodi ----------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::PushMode()
|
|
|
|
{
|
2007-11-22 14:42:50 +00:00
|
|
|
pModeStack = new ModeStack( pModeStack, bIns, bExtMode, bAddMode, bBlockMode );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::PopMode()
|
|
|
|
{
|
|
|
|
if ( 0 == pModeStack )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( bExtMode && !pModeStack->bExt )
|
|
|
|
LeaveExtMode();
|
|
|
|
if ( bAddMode && !pModeStack->bAdd )
|
|
|
|
LeaveAddMode();
|
2007-11-22 14:42:50 +00:00
|
|
|
if ( bBlockMode && !pModeStack->bBlock )
|
|
|
|
LeaveBlockMode();
|
2000-09-18 16:15:01 +00:00
|
|
|
bIns = pModeStack->bIns;
|
|
|
|
|
|
|
|
ModeStack *pTmp = pModeStack->pNext;
|
|
|
|
delete pModeStack;
|
|
|
|
pModeStack = pTmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Zwei Methoden fuer das Cursorsetzen; die erste mappt auf die
|
|
|
|
* gleichnamige Methoden an der CursorShell, die zweite hebt
|
|
|
|
* zuerst alle Selektionen auf.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::SetCrsr(const Point *pPt, BOOL bTextOnly)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* eine gfs. bestehende Selektion an der Position des
|
|
|
|
* Mausklicks aufheben
|
|
|
|
*/
|
|
|
|
if(!IsInSelect() && ChgCurrPam(*pPt)) {
|
|
|
|
ClearMark();
|
|
|
|
}
|
2006-07-26 11:19:57 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::SetCrsrKillSel(const Point *pPt, BOOL bTextOnly )
|
|
|
|
{
|
|
|
|
ACT_KONTEXT(this);
|
|
|
|
ResetSelect(pPt,FALSE);
|
|
|
|
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::UnSelectFrm()
|
|
|
|
{
|
2002-04-23 13:10:22 +00:00
|
|
|
// Rahmenselektion aufheben mit garantiert ungueltiger Position
|
2000-09-18 16:15:01 +00:00
|
|
|
Point aPt(LONG_MIN, LONG_MIN);
|
2002-04-23 13:10:22 +00:00
|
|
|
SelectObj(aPt, 0);
|
2001-09-11 13:57:42 +00:00
|
|
|
SwTransferable::ClearSelection( *this );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Aufheben aller Selektionen
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::ResetSelect(const Point *,BOOL)
|
|
|
|
{
|
|
|
|
if(IsSelFrmMode())
|
|
|
|
{
|
|
|
|
UnSelectFrm();
|
|
|
|
LeaveSelFrmMode();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ACT_KONTEXT() macht eine Action auf -
|
|
|
|
um im Basicablauf keine Probleme mit der
|
|
|
|
Shellumschaltung zu bekommen, darf
|
|
|
|
GetChgLnk().Call() erst nach
|
|
|
|
EndAction() gerufen werden.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
ACT_KONTEXT(this);
|
|
|
|
bSelWrd = bSelLn = FALSE;
|
|
|
|
KillPams();
|
|
|
|
ClearMark();
|
|
|
|
fnKillSel = &SwWrtShell::Ignore;
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsr;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* nach dem Aufheben aller Selektionen koennte ein Update der
|
|
|
|
* Attr-Controls notwendig sein.
|
|
|
|
*/
|
|
|
|
GetChgLnk().Call(this);
|
|
|
|
}
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2001-09-11 13:57:42 +00:00
|
|
|
SwTransferable::ClearSelection( *this );
|
2000-09-18 16:15:01 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tue nichts
|
|
|
|
*/
|
|
|
|
long SwWrtShell::Ignore(const Point *, BOOL ) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start eines Selektionsvorganges.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::SttSelect()
|
|
|
|
{
|
|
|
|
if(bInSelect)
|
|
|
|
return;
|
|
|
|
if(!HasMark())
|
|
|
|
SetMark();
|
2007-11-22 14:42:50 +00:00
|
|
|
if( bBlockMode )
|
|
|
|
{
|
|
|
|
SwShellCrsr* pTmp = getShellCrsr( true );
|
|
|
|
if( !pTmp->HasMark() )
|
|
|
|
pTmp->SetMark();
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
fnKillSel = &SwWrtShell::Ignore;
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsr;
|
|
|
|
bInSelect = TRUE;
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2001-09-11 13:57:42 +00:00
|
|
|
SwTransferable::CreateSelection( *this );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Ende eines Selektionsvorganges.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::EndSelect()
|
|
|
|
{
|
|
|
|
if(!bInSelect || bExtMode)
|
|
|
|
return;
|
|
|
|
bInSelect = FALSE;
|
|
|
|
(this->*fnLeaveSelect)(0,FALSE);
|
|
|
|
if(!bAddMode) {
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Methode, um eine bestehende wortweise oder zeilenweise Selektion
|
|
|
|
* zu erweitern.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline BOOL operator<(const Point &rP1,const Point &rP2)
|
|
|
|
{
|
|
|
|
return rP1.Y() < rP2.Y() || (rP1.Y() == rP2.Y() && rP1.X() < rP2.X());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::ExtSelWrd(const Point *pPt, BOOL )
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
if( IsTableMode() )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
// Bug 66823: actual crsr has in additional mode no selection?
|
|
|
|
// Then destroy the actual an go to prev, this will be expand
|
|
|
|
if( !HasMark() && GoPrevCrsr() )
|
|
|
|
{
|
|
|
|
BOOL bHasMark = HasMark(); // thats wrong!
|
|
|
|
GoNextCrsr();
|
|
|
|
if( bHasMark )
|
|
|
|
{
|
|
|
|
DestroyCrsr();
|
|
|
|
GoPrevCrsr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// check the direction of the selection with the new point
|
2004-08-12 12:14:59 +00:00
|
|
|
BOOL bRet = FALSE, bMoveCrsr = TRUE, bToTop = FALSE;
|
2000-09-18 16:15:01 +00:00
|
|
|
SwCrsrShell::SelectWord( &aStart ); // select the startword
|
|
|
|
SwCrsrShell::Push(); // save the cursor
|
|
|
|
SwCrsrShell::SetCrsr( *pPt ); // and check the direction
|
|
|
|
|
|
|
|
switch( SwCrsrShell::CompareCursor( StackMkCurrPt ))
|
|
|
|
{
|
|
|
|
case -1: bToTop = FALSE; break;
|
|
|
|
case 1: bToTop = TRUE; break;
|
|
|
|
default: bMoveCrsr = FALSE; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwCrsrShell::Pop( FALSE ); // retore the saved cursor
|
|
|
|
|
|
|
|
if( bMoveCrsr )
|
|
|
|
{
|
|
|
|
// select to Top but cursor select to Bottom? or
|
|
|
|
// select to Bottom but cursor select to Top? --> swap the cursor
|
|
|
|
if( bToTop )
|
|
|
|
SwapPam();
|
|
|
|
|
|
|
|
SwCrsrShell::Push(); // save cur cursor
|
|
|
|
if( SwCrsrShell::SelectWord( pPt )) // select the current word
|
|
|
|
{
|
|
|
|
if( bToTop )
|
|
|
|
SwapPam();
|
|
|
|
Combine();
|
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SwCrsrShell::Pop( FALSE );
|
|
|
|
if( bToTop )
|
|
|
|
SwapPam();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bRet = TRUE;
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::ExtSelLn(const Point *pPt, BOOL )
|
|
|
|
{
|
|
|
|
MV_KONTEXT(this);
|
|
|
|
SwCrsrShell::SetCrsr(*pPt);
|
|
|
|
if( IsTableMode() )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
// Bug 66823: actual crsr has in additional mode no selection?
|
|
|
|
// Then destroy the actual an go to prev, this will be expand
|
|
|
|
if( !HasMark() && GoPrevCrsr() )
|
|
|
|
{
|
|
|
|
BOOL bHasMark = HasMark(); // thats wrong!
|
|
|
|
GoNextCrsr();
|
|
|
|
if( bHasMark )
|
|
|
|
{
|
|
|
|
DestroyCrsr();
|
|
|
|
GoPrevCrsr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ggfs. den Mark der Selektion anpassen
|
|
|
|
BOOL bToTop = !IsCrsrPtAtEnd();
|
|
|
|
SwapPam();
|
|
|
|
|
|
|
|
// der "Mark" muss am Zeilenende/-anfang stehen
|
2004-09-09 08:15:18 +00:00
|
|
|
if( bToTop ? !IsEndSentence() : !IsStartSentence() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if( bToTop )
|
|
|
|
{
|
|
|
|
if( !IsEndPara() )
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::GoEndSentence();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
2004-09-09 08:15:18 +00:00
|
|
|
SwCrsrShell::GoStartSentence();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
SwapPam();
|
|
|
|
|
2004-09-09 08:15:18 +00:00
|
|
|
return bToTop ? SwCrsrShell::GoStartSentence() : SwCrsrShell::GoEndSentence();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* zurueck in den Standard Mode: kein Mode, keine Selektionen.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void SwWrtShell::EnterStdMode()
|
|
|
|
{
|
|
|
|
if(bAddMode)
|
|
|
|
LeaveAddMode();
|
2007-11-22 14:42:50 +00:00
|
|
|
if(bBlockMode)
|
|
|
|
LeaveBlockMode();
|
|
|
|
bBlockMode = FALSE;
|
2000-09-18 16:15:01 +00:00
|
|
|
bExtMode = FALSE;
|
|
|
|
bInSelect = FALSE;
|
2002-10-24 10:05:45 +00:00
|
|
|
if(IsSelFrmMode())
|
|
|
|
{
|
|
|
|
UnSelectFrm();
|
|
|
|
LeaveSelFrmMode();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ACT_KONTEXT() opens and action which has to be
|
|
|
|
closed prior to the call of
|
|
|
|
GetChgLnk().Call()
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
ACT_KONTEXT(this);
|
|
|
|
bSelWrd = bSelLn = FALSE;
|
2007-11-22 14:42:50 +00:00
|
|
|
if( !IsRetainSelection() )
|
|
|
|
KillPams();
|
2002-10-24 10:05:45 +00:00
|
|
|
ClearMark();
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
}
|
|
|
|
}
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2002-10-24 10:05:45 +00:00
|
|
|
SwTransferable::ClearSelection( *this );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extended Mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::EnterExtMode()
|
|
|
|
{
|
2007-11-22 14:42:50 +00:00
|
|
|
if(bBlockMode)
|
|
|
|
{
|
|
|
|
LeaveBlockMode();
|
|
|
|
KillPams();
|
|
|
|
ClearMark();
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
bExtMode = TRUE;
|
|
|
|
bAddMode = FALSE;
|
2007-11-22 14:42:50 +00:00
|
|
|
bBlockMode = FALSE;
|
2000-09-18 16:15:01 +00:00
|
|
|
SttSelect();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::LeaveExtMode()
|
|
|
|
{
|
|
|
|
bExtMode = FALSE;
|
|
|
|
EndSelect();
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Ende einer Selektion; falls die Selektion leer ist,
|
|
|
|
* ClearMark().
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::SttLeaveSelect(const Point *, BOOL )
|
|
|
|
{
|
|
|
|
if(SwCrsrShell::HasSelection() && !IsSelTblCells() && bClearMark) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
// if( IsSelTblCells() ) aSelTblLink.Call(this);
|
|
|
|
ClearMark();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Verlassen des Selektionsmodus in Additional Mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::AddLeaveSelect(const Point *, BOOL )
|
|
|
|
{
|
|
|
|
if(IsTableMode()) LeaveAddMode();
|
|
|
|
else if(SwCrsrShell::HasSelection())
|
|
|
|
CreateCrsr();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Additional Mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::EnterAddMode()
|
|
|
|
{
|
|
|
|
if(IsTableMode()) return;
|
2007-11-22 14:42:50 +00:00
|
|
|
if(bBlockMode)
|
|
|
|
LeaveBlockMode();
|
2000-09-18 16:15:01 +00:00
|
|
|
fnLeaveSelect = &SwWrtShell::AddLeaveSelect;
|
|
|
|
fnKillSel = &SwWrtShell::Ignore;
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsr;
|
|
|
|
bAddMode = TRUE;
|
2007-11-22 14:42:50 +00:00
|
|
|
bBlockMode = FALSE;
|
2000-09-18 16:15:01 +00:00
|
|
|
bExtMode = FALSE;
|
|
|
|
if(SwCrsrShell::HasSelection())
|
|
|
|
CreateCrsr();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::LeaveAddMode()
|
|
|
|
{
|
|
|
|
fnLeaveSelect = &SwWrtShell::SttLeaveSelect;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
bAddMode = FALSE;
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2007-11-22 14:42:50 +00:00
|
|
|
/*
|
|
|
|
* Block Mode
|
|
|
|
*/
|
|
|
|
|
|
|
|
void SwWrtShell::EnterBlockMode()
|
|
|
|
{
|
|
|
|
bBlockMode = FALSE;
|
|
|
|
EnterStdMode();
|
|
|
|
bBlockMode = TRUE;
|
|
|
|
CrsrToBlockCrsr();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2007-11-22 14:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::LeaveBlockMode()
|
|
|
|
{
|
|
|
|
bBlockMode = FALSE;
|
|
|
|
BlockCrsrToCrsr();
|
|
|
|
EndSelect();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2007-11-22 14:42:50 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
// Einfuegemodus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::SetInsMode( BOOL bOn )
|
|
|
|
{
|
|
|
|
bIns = bOn;
|
2000-11-28 17:49:16 +00:00
|
|
|
SwCrsrShell::SetOverwriteCrsr( !bIns );
|
2000-09-18 16:15:01 +00:00
|
|
|
const SfxBoolItem aTmp( SID_ATTR_INSERT, bIns );
|
|
|
|
GetView().GetViewFrame()->GetBindings().SetState( aTmp );
|
2000-11-28 17:49:16 +00:00
|
|
|
StartAction();
|
|
|
|
EndAction();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2009-08-06 12:44:16 +00:00
|
|
|
//Overwrite mode is incompatible with red-lining
|
|
|
|
void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
|
|
|
|
{
|
|
|
|
SetRedlineMode( eMode );
|
|
|
|
if (IsRedlineOn())
|
|
|
|
SetInsMode( true );
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Rahmen bearbeiten
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::BeginFrmDrag(const Point *pPt, BOOL)
|
|
|
|
{
|
|
|
|
fnDrag = &SwFEShell::Drag;
|
|
|
|
if(bStartDrag)
|
|
|
|
{
|
|
|
|
Point aTmp( nStartDragX, nStartDragY );
|
|
|
|
SwFEShell::BeginDrag( &aTmp, FALSE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SwFEShell::BeginDrag( pPt, FALSE );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::EnterSelFrmMode(const Point *pPos)
|
|
|
|
{
|
|
|
|
if(pPos)
|
|
|
|
{
|
|
|
|
nStartDragX = pPos->X();
|
|
|
|
nStartDragY = pPos->Y();
|
|
|
|
bStartDrag = TRUE;
|
|
|
|
}
|
|
|
|
bNoEdit = bLayoutMode = TRUE;
|
|
|
|
HideCrsr();
|
|
|
|
|
|
|
|
// gleicher Aufruf von BeginDrag an der SwFEShell
|
|
|
|
fnDrag = &SwWrtShell::BeginFrmDrag;
|
|
|
|
fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
|
|
|
|
SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SwWrtShell::LeaveSelFrmMode()
|
|
|
|
{
|
|
|
|
fnDrag = &SwWrtShell::BeginDrag;
|
|
|
|
fnEndDrag = &SwWrtShell::EndDrag;
|
|
|
|
bLayoutMode = FALSE;
|
|
|
|
bStartDrag = FALSE;
|
|
|
|
Edit();
|
|
|
|
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Rahmengebundenes Macro ausfuehren
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFmt )
|
|
|
|
{
|
|
|
|
const SwFrmFmt *pFmt = pFlyFmt ? (SwFrmFmt*)pFlyFmt : GetFlyFrmFmt();
|
|
|
|
ASSERT(pFmt, kein FrameFormat.);
|
|
|
|
const SvxMacroItem &rFmtMac = pFmt->GetMacro();
|
|
|
|
|
|
|
|
if(rFmtMac.HasMacro(SW_EVENT_OBJECT_SELECT))
|
|
|
|
{
|
|
|
|
const SvxMacro &rMac = rFmtMac.GetMacro(SW_EVENT_OBJECT_SELECT);
|
|
|
|
if( IsFrmSelected() )
|
|
|
|
bLayoutMode = TRUE;
|
|
|
|
CallChgLnk();
|
|
|
|
ExecMacro( rMac );
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
|
|
|
|
{
|
|
|
|
// voerst Dummy
|
|
|
|
SwFEShell::EndDrag( pPt, FALSE );
|
|
|
|
fnDrag = &SwWrtShell::BeginFrmDrag;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handler fuer das Togglen der Modi. Liefern alten Mode zurueck.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::ToggleAddMode()
|
|
|
|
{
|
|
|
|
bAddMode ? LeaveAddMode(): EnterAddMode();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
return !bAddMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-22 14:42:50 +00:00
|
|
|
long SwWrtShell::ToggleBlockMode()
|
|
|
|
{
|
|
|
|
bBlockMode ? LeaveBlockMode(): EnterBlockMode();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2007-11-22 14:42:50 +00:00
|
|
|
return !bBlockMode;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
long SwWrtShell::ToggleExtMode()
|
|
|
|
{
|
|
|
|
bExtMode ? LeaveExtMode() : EnterExtMode();
|
2009-09-18 10:15:03 +00:00
|
|
|
Invalidate();
|
2000-09-18 16:15:01 +00:00
|
|
|
return !bExtMode;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Draggen im Standard Modus (Selektieren von Inhalt)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
long SwWrtShell::BeginDrag(const Point * /*pPt*/, BOOL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if(bSelWrd)
|
|
|
|
{
|
|
|
|
bInSelect = TRUE;
|
|
|
|
if( !IsCrsrPtAtEnd() )
|
|
|
|
SwapPam();
|
|
|
|
|
|
|
|
fnDrag = &SwWrtShell::ExtSelWrd;
|
|
|
|
fnSetCrsr = &SwWrtShell::Ignore;
|
|
|
|
}
|
|
|
|
else if(bSelLn)
|
|
|
|
{
|
|
|
|
bInSelect = TRUE;
|
|
|
|
fnDrag = &SwWrtShell::ExtSelLn;
|
|
|
|
fnSetCrsr = &SwWrtShell::Ignore;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fnDrag = &SwWrtShell::Drag;
|
|
|
|
SttSelect();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long SwWrtShell::Drag(const Point *, BOOL )
|
|
|
|
{
|
|
|
|
if( IsSelTblCells() )
|
|
|
|
aSelTblLink.Call(this);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
long SwWrtShell::EndDrag(const Point * /*pPt*/, BOOL )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
fnDrag = &SwWrtShell::BeginDrag;
|
|
|
|
if( IsExtSel() )
|
|
|
|
LeaveExtSel();
|
|
|
|
|
|
|
|
if( IsSelTblCells() )
|
|
|
|
aSelTblLink.Call(this);
|
|
|
|
EndSelect();
|
|
|
|
return 1;
|
|
|
|
}
|
2004-09-09 08:15:18 +00:00
|
|
|
|
|
|
|
// --> FME 2004-07-30 #i32329# Enhanced table selection
|
2008-03-07 14:10:07 +00:00
|
|
|
BOOL SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
|
2004-09-09 08:15:18 +00:00
|
|
|
{
|
2005-10-19 07:33:07 +00:00
|
|
|
MV_KONTEXT(this);
|
2005-01-05 15:11:13 +00:00
|
|
|
SttSelect();
|
2008-03-07 14:10:07 +00:00
|
|
|
if(SelTblRowCol( rPt, pEnd, bRowDrag ))
|
2006-01-05 13:52:00 +00:00
|
|
|
{
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2004-09-09 08:15:18 +00:00
|
|
|
}
|
|
|
|
// <--
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Selektion einer Tabellenzeile / Spalte
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
BOOL SwWrtShell::SelectTableRow()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if ( SelTblRow() )
|
|
|
|
{
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
BOOL SwWrtShell::SelectTableCol()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if ( SelTblCol() )
|
|
|
|
{
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-09-27 11:53:01 +00:00
|
|
|
BOOL SwWrtShell::SelectTableCell()
|
2004-08-02 12:13:09 +00:00
|
|
|
{
|
|
|
|
if ( SelTblBox() )
|
|
|
|
{
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
/*------------------------------------------------------------------------
|
|
|
|
Beschreibung: Prueft, ob eine Wortselektion vorliegt.
|
|
|
|
Gemaess den Regeln fuer intelligentes Cut / Paste
|
|
|
|
werden umgebende Spaces rausgeschnitten.
|
|
|
|
Return: Liefert Art der Wortselektion zurueck.
|
|
|
|
------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int SwWrtShell::IntelligentCut(int nSelection, BOOL bCut)
|
|
|
|
{
|
|
|
|
// kein intelligentes Drag and Drop bei Mehrfachselektion
|
|
|
|
// es existieren mehrere Cursor, da ein zweiter bereits
|
|
|
|
// an die Zielposition gesetzt wurde
|
2007-09-27 11:53:01 +00:00
|
|
|
if( IsAddMode() || !(nSelection & nsSelectionType::SEL_TXT) )
|
2000-09-18 16:15:01 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2000-10-25 14:39:12 +00:00
|
|
|
String sTxt;
|
|
|
|
CharClass& rCC = GetAppCharClass();
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
// wenn das erste und das letzte Zeichen kein Wortzeichen ist,
|
|
|
|
// ist kein Wort selektiert.
|
2000-11-21 07:49:57 +00:00
|
|
|
sal_Unicode cPrev = GetChar(FALSE);
|
|
|
|
sal_Unicode cNext = GetChar(TRUE, -1);
|
2003-04-17 15:12:13 +00:00
|
|
|
if( !cPrev || !cNext ||
|
2001-05-16 17:08:06 +00:00
|
|
|
!rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) ||
|
2000-11-21 07:49:57 +00:00
|
|
|
!rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
return NO_WORD;
|
2000-10-25 14:39:12 +00:00
|
|
|
|
2000-11-21 07:49:57 +00:00
|
|
|
cPrev = GetChar(FALSE, -1);
|
|
|
|
cNext = GetChar(TRUE);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
int cWord = NO_WORD;
|
|
|
|
// ist ein Wort selektiert?
|
|
|
|
if(!cWord && cPrev && cNext &&
|
|
|
|
CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
|
|
|
|
CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
|
2000-10-25 14:39:12 +00:00
|
|
|
!rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) &&
|
|
|
|
!rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
cWord = WORD_NO_SPACE;
|
2000-10-25 14:39:12 +00:00
|
|
|
|
|
|
|
if(cWord == WORD_NO_SPACE && ' ' == cPrev )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
cWord = WORD_SPACE_BEFORE;
|
|
|
|
// Space davor loeschen
|
|
|
|
if(bCut)
|
|
|
|
{
|
|
|
|
Push();
|
|
|
|
if(IsCrsrPtAtEnd())
|
|
|
|
SwapPam();
|
|
|
|
ClearMark();
|
|
|
|
SetMark();
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
|
2000-09-18 16:15:01 +00:00
|
|
|
SwFEShell::Delete();
|
|
|
|
Pop( FALSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(cWord == WORD_NO_SPACE && cNext == ' ')
|
|
|
|
{
|
|
|
|
cWord = WORD_SPACE_AFTER;
|
|
|
|
// Space dahinter loeschen
|
|
|
|
if(bCut) {
|
|
|
|
Push();
|
|
|
|
if(!IsCrsrPtAtEnd()) SwapPam();
|
|
|
|
ClearMark();
|
|
|
|
SetMark();
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
|
2000-09-18 16:15:01 +00:00
|
|
|
SwFEShell::Delete();
|
|
|
|
Pop( FALSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cWord;
|
|
|
|
}
|
2002-02-08 14:06:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// jump to the next / previous hyperlink - inside text and also
|
|
|
|
// on graphics
|
2007-09-27 11:53:01 +00:00
|
|
|
BOOL SwWrtShell::SelectNextPrevHyperlink( BOOL bNext )
|
2002-02-08 14:06:36 +00:00
|
|
|
{
|
|
|
|
StartAction();
|
2007-09-27 11:53:01 +00:00
|
|
|
BOOL bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
|
2002-02-08 14:06:36 +00:00
|
|
|
if( !bRet )
|
|
|
|
{
|
|
|
|
// will we have this feature?
|
|
|
|
EnterStdMode();
|
|
|
|
if( bNext )
|
2007-09-27 11:53:01 +00:00
|
|
|
SttEndDoc(TRUE);
|
2002-02-08 14:06:36 +00:00
|
|
|
else
|
2007-09-27 11:53:01 +00:00
|
|
|
SttEndDoc(FALSE);
|
2002-02-08 14:06:36 +00:00
|
|
|
bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
|
|
|
|
}
|
|
|
|
EndAction();
|
|
|
|
|
|
|
|
BOOL bCreateXSelection = FALSE;
|
2007-09-27 11:53:01 +00:00
|
|
|
const BOOL bFrmSelected = IsFrmSelected() || IsObjSelected();
|
2002-02-08 14:06:36 +00:00
|
|
|
if( IsSelection() )
|
|
|
|
{
|
|
|
|
if ( bFrmSelected )
|
|
|
|
UnSelectFrm();
|
|
|
|
|
|
|
|
// Funktionspointer fuer das Aufheben der Selektion setzen
|
|
|
|
// bei Cursor setzen
|
|
|
|
fnKillSel = &SwWrtShell::ResetSelect;
|
|
|
|
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
|
|
|
|
bCreateXSelection = TRUE;
|
|
|
|
}
|
|
|
|
else if( bFrmSelected )
|
|
|
|
{
|
|
|
|
EnterSelFrmMode();
|
|
|
|
bCreateXSelection = TRUE;
|
|
|
|
}
|
|
|
|
else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
|
|
|
|
{
|
|
|
|
SelectObj( GetCharRect().Pos() );
|
|
|
|
EnterSelFrmMode();
|
|
|
|
bCreateXSelection = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bCreateXSelection )
|
|
|
|
SwTransferable::CreateSelection( *this );
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
/* fuer den Erhalt der Selektion wird nach SetMark() der Cursor
|
|
|
|
* nach links bewegt, damit er durch das Einfuegen von Text nicht
|
|
|
|
* verschoben wird. Da auf der CORE-Seite am aktuellen Cursor
|
|
|
|
* eine bestehende Selektion aufgehoben wird, wird der Cursor auf
|
|
|
|
* den Stack gepushed. Nach dem Verschieben werden sie wieder
|
|
|
|
* zusammengefasst. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|