2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2011-03-31 10:05:04 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <wrtsh.hxx>
|
2002-02-01 11:51:13 +00:00
|
|
|
#include <crsskip.hxx>
|
2003-04-17 09:17:03 +00:00
|
|
|
#include <swcrsr.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <editeng/lrspitem.hxx>
|
2011-04-18 12:37:38 -03:00
|
|
|
// #134369#
|
2006-07-19 08:30:36 +00:00
|
|
|
#include <view.hxx>
|
|
|
|
#include <drawbase.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
inline void SwWrtShell::OpenMark()
|
|
|
|
{
|
|
|
|
StartAllAction();
|
|
|
|
ResetCursorStack();
|
|
|
|
KillPams();
|
|
|
|
SetMark();
|
|
|
|
}
|
|
|
|
|
2013-03-01 15:42:53 +09:00
|
|
|
inline void SwWrtShell::CloseMark( bool bOkFlag )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
if( bOkFlag )
|
|
|
|
UpdateAttr();
|
|
|
|
else
|
|
|
|
SwapPam();
|
|
|
|
|
|
|
|
ClearMark();
|
|
|
|
EndAllAction();
|
|
|
|
}
|
|
|
|
|
2004-04-07 11:46:41 +00:00
|
|
|
// #i23725#
|
2013-02-05 23:42:42 +09:00
|
|
|
bool SwWrtShell::TryRemoveIndent()
|
2004-04-07 11:46:41 +00:00
|
|
|
{
|
2013-02-05 23:42:42 +09:00
|
|
|
bool bResult = false;
|
2004-04-07 11:46:41 +00:00
|
|
|
|
|
|
|
SfxItemSet aAttrSet(GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE);
|
2008-03-05 16:29:43 +00:00
|
|
|
GetCurAttr(aAttrSet);
|
2004-04-07 11:46:41 +00:00
|
|
|
|
2014-12-01 10:18:30 +02:00
|
|
|
SvxLRSpaceItem aItem = static_cast<const SvxLRSpaceItem &>(aAttrSet.Get(RES_LR_SPACE));
|
2015-05-20 13:05:49 +02:00
|
|
|
short aOldFirstLineOfst = aItem.GetTextFirstLineOfst();
|
2004-04-07 11:46:41 +00:00
|
|
|
|
|
|
|
if (aOldFirstLineOfst > 0)
|
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
aItem.SetTextFirstLineOfst(0);
|
2013-02-05 23:42:42 +09:00
|
|
|
bResult = true;
|
2004-04-07 11:46:41 +00:00
|
|
|
}
|
|
|
|
else if (aOldFirstLineOfst < 0)
|
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
aItem.SetTextFirstLineOfst(0);
|
2004-04-07 11:46:41 +00:00
|
|
|
aItem.SetLeft(aItem.GetLeft() + aOldFirstLineOfst);
|
|
|
|
|
2013-02-05 23:42:42 +09:00
|
|
|
bResult = true;
|
2004-04-07 11:46:41 +00:00
|
|
|
}
|
|
|
|
else if (aItem.GetLeft() != 0)
|
|
|
|
{
|
|
|
|
aItem.SetLeft(0);
|
2013-02-05 23:42:42 +09:00
|
|
|
bResult = true;
|
2004-04-07 11:46:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bResult)
|
|
|
|
{
|
|
|
|
aAttrSet.Put(aItem);
|
2013-11-18 11:29:24 +00:00
|
|
|
SetAttrSet(aAttrSet);
|
2004-04-07 11:46:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
/** Description: Erase the line. */
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
long SwWrtShell::DelLine()
|
|
|
|
{
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2000-09-18 16:15:01 +00:00
|
|
|
ResetCursorStack();
|
2013-02-10 00:08:20 +01:00
|
|
|
// remember the old cursor
|
2000-09-18 16:15:01 +00:00
|
|
|
Push();
|
|
|
|
ClearMark();
|
|
|
|
SwCrsrShell::LeftMargin();
|
|
|
|
SetMark();
|
|
|
|
SwCrsrShell::RightMargin();
|
2010-11-30 16:44:46 +01:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
long nRet = Delete();
|
2014-04-25 14:00:35 +02:00
|
|
|
Pop(false);
|
2000-09-18 16:15:01 +00:00
|
|
|
if( nRet )
|
|
|
|
UpdateAttr();
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelToStartOfLine()
|
|
|
|
{
|
|
|
|
OpenMark();
|
|
|
|
SwCrsrShell::LeftMargin();
|
|
|
|
long nRet = Delete();
|
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelToEndOfLine()
|
|
|
|
{
|
|
|
|
OpenMark();
|
|
|
|
SwCrsrShell::RightMargin();
|
|
|
|
long nRet = Delete();
|
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelLeft()
|
|
|
|
{
|
2013-02-10 00:08:20 +01:00
|
|
|
// If it's a Fly, throw it away
|
2000-09-18 16:15:01 +00:00
|
|
|
int nSelType = GetSelectionType();
|
2007-09-27 11:52:35 +00:00
|
|
|
const int nCmp = nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW;
|
2000-09-18 16:15:01 +00:00
|
|
|
if( nCmp & nSelType )
|
|
|
|
{
|
2013-03-17 23:16:05 +01:00
|
|
|
// #108205# Remember object's position.
|
2003-04-17 15:12:02 +00:00
|
|
|
Point aTmpPt = GetObjRect().TopLeft();
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
DelSelectedObj();
|
2003-04-17 15:12:02 +00:00
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
// #108205# Set cursor to remembered position.
|
2003-04-17 15:12:02 +00:00
|
|
|
SetCrsr(&aTmpPt);
|
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
LeaveSelFrmMode();
|
|
|
|
UnSelectFrm();
|
2003-04-17 15:12:02 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
nSelType = GetSelectionType();
|
|
|
|
if ( nCmp & nSelType )
|
|
|
|
{
|
|
|
|
EnterSelFrmMode();
|
|
|
|
GotoNextFly();
|
|
|
|
}
|
2003-04-17 15:12:02 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
return 1L;
|
|
|
|
}
|
|
|
|
|
2013-02-10 00:08:20 +01:00
|
|
|
// If a selection exists, erase this
|
2000-09-18 16:15:01 +00:00
|
|
|
if ( IsSelection() )
|
|
|
|
{
|
2007-11-22 14:42:05 +00:00
|
|
|
if( !IsBlockMode() || HasSelection() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-02-10 00:08:20 +01:00
|
|
|
//OS: Once again Basic: SwActContext must be leaved
|
|
|
|
//before EnterStdMode!
|
2007-11-22 14:42:05 +00:00
|
|
|
{
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2007-11-22 14:42:05 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
Delete();
|
|
|
|
UpdateAttr();
|
|
|
|
}
|
|
|
|
if( IsBlockMode() )
|
|
|
|
{
|
|
|
|
NormalizePam();
|
|
|
|
ClearMark();
|
|
|
|
EnterBlockMode();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
EnterStdMode();
|
|
|
|
return 1L;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2007-11-22 14:42:05 +00:00
|
|
|
else
|
|
|
|
EnterStdMode();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 20:07:23 +02:00
|
|
|
// JP 29.06.95: never erase a table standing in front of it.
|
2013-02-05 23:42:42 +09:00
|
|
|
bool bSwap = false;
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTableNode * pWasInTableNd = SwCrsrShell::IsCrsrInTable();
|
2007-02-28 14:56:24 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
if( SwCrsrShell::IsSttPara())
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i4032# Don't actually call a 'delete' if we
|
2007-02-28 14:56:24 +00:00
|
|
|
// changed the table cell, compare DelRight().
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwStartNode * pSNdOld = pWasInTableNd ?
|
2014-06-18 12:14:29 +02:00
|
|
|
GetSwCrsr()->GetNode().FindTableBoxStartNode() :
|
2007-02-28 14:56:24 +00:00
|
|
|
0;
|
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
// If the cursor is at the beginning of a paragraph, try to step
|
|
|
|
// backwards. On failure we are done.
|
2002-02-01 11:51:13 +00:00
|
|
|
if( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
|
2000-09-18 16:15:01 +00:00
|
|
|
return 0;
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
// If the cursor entered or left a table (or both) we are done. No step
|
|
|
|
// back.
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTableNode* pIsInTableNd = SwCrsrShell::IsCrsrInTable();
|
|
|
|
if( pIsInTableNd != pWasInTableNd )
|
2007-02-28 14:56:24 +00:00
|
|
|
return 0;
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwStartNode* pSNdNew = pIsInTableNd ?
|
2014-06-18 12:14:29 +02:00
|
|
|
GetSwCrsr()->GetNode().FindTableBoxStartNode() :
|
2007-02-28 14:56:24 +00:00
|
|
|
0;
|
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i4032# Don't actually call a 'delete' if we
|
2007-02-28 14:56:24 +00:00
|
|
|
// changed the table cell, compare DelRight().
|
|
|
|
if ( pSNdOld != pSNdNew )
|
2000-09-18 16:15:01 +00:00
|
|
|
return 0;
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2000-09-18 16:15:01 +00:00
|
|
|
OpenMark();
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
|
2000-09-18 16:15:01 +00:00
|
|
|
SwCrsrShell::SwapPam();
|
2013-02-05 23:42:42 +09:00
|
|
|
bSwap = true;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OpenMark();
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
long nRet = Delete();
|
|
|
|
if( !nRet && bSwap )
|
|
|
|
SwCrsrShell::SwapPam();
|
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2007-09-27 11:52:35 +00:00
|
|
|
long SwWrtShell::DelRight()
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-02-10 00:08:20 +01:00
|
|
|
// Will be or'ed, if a tableselection exists;
|
|
|
|
// will here be implemented on nsSelectionType::SEL_TBL
|
2000-09-18 16:15:01 +00:00
|
|
|
long nRet = 0;
|
|
|
|
int nSelection = GetSelectionType();
|
2007-09-27 11:52:35 +00:00
|
|
|
if(nSelection & nsSelectionType::SEL_TBL_CELLS)
|
|
|
|
nSelection = nsSelectionType::SEL_TBL;
|
|
|
|
if(nSelection & nsSelectionType::SEL_TXT)
|
|
|
|
nSelection = nsSelectionType::SEL_TXT;
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTableNode * pWasInTableNd = NULL;
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2007-09-27 11:52:35 +00:00
|
|
|
switch( nSelection & ~(nsSelectionType::SEL_BEZ) )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2008-02-19 13:01:26 +00:00
|
|
|
case nsSelectionType::SEL_POSTIT:
|
2007-09-27 11:52:35 +00:00
|
|
|
case nsSelectionType::SEL_TXT:
|
|
|
|
case nsSelectionType::SEL_TBL:
|
|
|
|
case nsSelectionType::SEL_NUM:
|
2013-02-10 00:08:20 +01:00
|
|
|
// If a selection exists, erase it.
|
2000-09-18 16:15:01 +00:00
|
|
|
if( IsSelection() )
|
|
|
|
{
|
2007-11-22 14:42:05 +00:00
|
|
|
if( !IsBlockMode() || HasSelection() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2013-02-10 00:08:20 +01:00
|
|
|
//OS: And once again Basic: SwActContext must be
|
|
|
|
//leaved before EnterStdMode !
|
2007-11-22 14:42:05 +00:00
|
|
|
{
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2007-11-22 14:42:05 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
Delete();
|
|
|
|
UpdateAttr();
|
|
|
|
}
|
|
|
|
if( IsBlockMode() )
|
|
|
|
{
|
|
|
|
NormalizePam();
|
|
|
|
ClearMark();
|
|
|
|
EnterBlockMode();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
EnterStdMode();
|
|
|
|
nRet = 1L;
|
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2007-11-22 14:42:05 +00:00
|
|
|
else
|
|
|
|
EnterStdMode();
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
pWasInTableNd = IsCrsrInTable();
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2007-09-27 11:52:35 +00:00
|
|
|
if( nsSelectionType::SEL_TXT & nSelection && SwCrsrShell::IsSttPara() &&
|
2005-02-22 07:27:05 +00:00
|
|
|
SwCrsrShell::IsEndPara() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2005-02-22 07:27:05 +00:00
|
|
|
// save cursor
|
|
|
|
SwCrsrShell::Push();
|
|
|
|
|
|
|
|
bool bDelFull = false;
|
|
|
|
if ( SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
|
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
const SwTableNode * pCurrTableNd = IsCrsrInTable();
|
|
|
|
bDelFull = pCurrTableNd && pCurrTableNd != pWasInTableNd;
|
2005-02-22 07:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// restore cursor
|
2014-04-25 14:00:35 +02:00
|
|
|
SwCrsrShell::Pop( false );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( bDelFull )
|
|
|
|
{
|
|
|
|
DelFullPara();
|
|
|
|
UpdateAttr();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-06-01 06:46:52 +00:00
|
|
|
|
2003-03-27 14:45:43 +00:00
|
|
|
{
|
2013-03-17 23:16:05 +01:00
|
|
|
// #108049# Save the startnode of the current cell
|
2003-04-17 09:17:03 +00:00
|
|
|
const SwStartNode * pSNdOld;
|
2014-06-18 12:14:29 +02:00
|
|
|
pSNdOld = GetSwCrsr()->GetNode().FindTableBoxStartNode();
|
2003-03-27 14:45:43 +00:00
|
|
|
|
2005-02-22 07:27:05 +00:00
|
|
|
if ( SwCrsrShell::IsEndPara() )
|
2003-04-17 09:17:03 +00:00
|
|
|
{
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i41424# Introduced a couple of
|
2007-02-28 14:56:24 +00:00
|
|
|
// Push()-Pop() pairs here. The reason for this is that a
|
2005-02-22 07:27:05 +00:00
|
|
|
// Right()-Left() combination does not make sure, that
|
|
|
|
// the cursor will be in its initial state, because there
|
|
|
|
// may be a numbering in front of the next paragraph.
|
|
|
|
SwCrsrShell::Push();
|
|
|
|
|
|
|
|
if ( SwCrsrShell::Right(1, CRSR_SKIP_CHARS) )
|
2003-04-17 09:17:03 +00:00
|
|
|
{
|
2015-05-20 13:05:49 +02:00
|
|
|
if (IsCrsrInTable() || (pWasInTableNd != IsCrsrInTable()))
|
2005-02-22 07:27:05 +00:00
|
|
|
{
|
2013-03-17 23:16:05 +01:00
|
|
|
/** #108049# Save the startnode of the current
|
2005-02-22 07:27:05 +00:00
|
|
|
cell. May be different to pSNdOld as we have
|
|
|
|
moved. */
|
|
|
|
const SwStartNode * pSNdNew = GetSwCrsr()
|
2014-06-18 12:14:29 +02:00
|
|
|
->GetNode().FindTableBoxStartNode();
|
2005-02-22 07:27:05 +00:00
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
/** #108049# Only move instead of deleting if we
|
2005-02-22 07:27:05 +00:00
|
|
|
have moved to a different cell */
|
|
|
|
if (pSNdOld != pSNdNew)
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
SwCrsrShell::Pop( true );
|
2005-02-22 07:27:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-04-17 09:17:03 +00:00
|
|
|
}
|
2005-02-22 07:27:05 +00:00
|
|
|
|
|
|
|
// restore cursor
|
2014-04-25 14:00:35 +02:00
|
|
|
SwCrsrShell::Pop( false );
|
2003-04-17 09:17:03 +00:00
|
|
|
}
|
2003-03-27 14:45:43 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
OpenMark();
|
2002-02-01 11:51:13 +00:00
|
|
|
SwCrsrShell::Right(1,CRSR_SKIP_CELLS);
|
2000-09-18 16:15:01 +00:00
|
|
|
nRet = Delete();
|
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
break;
|
|
|
|
|
2007-09-27 11:52:35 +00:00
|
|
|
case nsSelectionType::SEL_FRM:
|
|
|
|
case nsSelectionType::SEL_GRF:
|
|
|
|
case nsSelectionType::SEL_OLE:
|
|
|
|
case nsSelectionType::SEL_DRW:
|
|
|
|
case nsSelectionType::SEL_DRW_TXT:
|
|
|
|
case nsSelectionType::SEL_DRW_FORM:
|
2003-04-17 15:12:02 +00:00
|
|
|
{
|
2013-03-17 23:16:05 +01:00
|
|
|
// #108205# Remember object's position.
|
2003-04-17 15:12:02 +00:00
|
|
|
Point aTmpPt = GetObjRect().TopLeft();
|
|
|
|
|
|
|
|
DelSelectedObj();
|
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
// #108205# Set cursor to remembered position.
|
2003-04-17 15:12:02 +00:00
|
|
|
SetCrsr(&aTmpPt);
|
|
|
|
|
|
|
|
LeaveSelFrmMode();
|
|
|
|
UnSelectFrm();
|
2011-04-18 12:37:38 -03:00
|
|
|
// #134369#
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE( !IsFrmSelected(),
|
2010-10-25 00:06:12 +02:00
|
|
|
"<SwWrtShell::DelRight(..)> - <SwWrtShell::UnSelectFrm()> should unmark all objects" );
|
2011-04-18 12:37:38 -03:00
|
|
|
// #134369#
|
2006-07-19 08:30:36 +00:00
|
|
|
// leave draw mode, if necessary.
|
|
|
|
{
|
|
|
|
if (GetView().GetDrawFuncPtr())
|
|
|
|
{
|
|
|
|
GetView().GetDrawFuncPtr()->Deactivate();
|
|
|
|
GetView().SetDrawFuncPtr(NULL);
|
|
|
|
}
|
|
|
|
if ( GetView().IsDrawMode() )
|
|
|
|
{
|
|
|
|
GetView().LeaveDrawCreate();
|
|
|
|
}
|
|
|
|
}
|
2003-04-17 15:12:02 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-04-18 12:37:38 -03:00
|
|
|
// #134369#
|
2006-07-19 08:30:36 +00:00
|
|
|
// <IsFrmSelected()> can't be true - see above.
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
nSelection = GetSelectionType();
|
2007-09-27 11:52:35 +00:00
|
|
|
if ( nsSelectionType::SEL_FRM & nSelection ||
|
|
|
|
nsSelectionType::SEL_GRF & nSelection ||
|
|
|
|
nsSelectionType::SEL_OLE & nSelection ||
|
|
|
|
nsSelectionType::SEL_DRW & nSelection )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
EnterSelFrmMode();
|
|
|
|
GotoNextFly();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nRet = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelToEndOfPara()
|
|
|
|
{
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2000-09-18 16:15:01 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
Push();
|
|
|
|
SetMark();
|
|
|
|
if( !MovePara(fnParaCurr,fnParaEnd))
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
Pop(false);
|
2000-09-18 16:15:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
long nRet = Delete();
|
2014-04-25 14:00:35 +02:00
|
|
|
Pop(false);
|
2000-09-18 16:15:01 +00:00
|
|
|
if( nRet )
|
|
|
|
UpdateAttr();
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelToStartOfPara()
|
|
|
|
{
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2000-09-18 16:15:01 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
Push();
|
|
|
|
SetMark();
|
|
|
|
if( !MovePara(fnParaCurr,fnParaStart))
|
|
|
|
{
|
2014-04-25 14:00:35 +02:00
|
|
|
Pop(false);
|
2000-09-18 16:15:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
long nRet = Delete();
|
2014-04-25 14:00:35 +02:00
|
|
|
Pop(false);
|
2000-09-18 16:15:01 +00:00
|
|
|
if( nRet )
|
|
|
|
UpdateAttr();
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2013-03-17 23:16:05 +01:00
|
|
|
// All erase operations should work with Find instead with
|
|
|
|
// Nxt-/PrvDelim, because the latter works with Wrap Around
|
|
|
|
// -- that's probably not wished.
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
long SwWrtShell::DelToStartOfSentence()
|
|
|
|
{
|
|
|
|
if(IsStartOfDoc())
|
|
|
|
return 0;
|
|
|
|
OpenMark();
|
2013-06-27 15:19:47 +02:00
|
|
|
long nRet = _BwdSentence() ? Delete() : 0;
|
2000-09-18 16:15:01 +00:00
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelToEndOfSentence()
|
|
|
|
{
|
|
|
|
if(IsEndOfDoc())
|
|
|
|
return 0;
|
|
|
|
OpenMark();
|
2013-05-17 00:09:39 +02:00
|
|
|
long nRet(0);
|
|
|
|
// fdo#60967: special case that is documented in help: delete
|
|
|
|
// paragraph following table if cursor is at end of last cell in table
|
|
|
|
if (IsEndOfTable())
|
|
|
|
{
|
|
|
|
Push();
|
|
|
|
ClearMark();
|
|
|
|
if (SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
|
|
|
|
{
|
|
|
|
SetMark();
|
2014-04-25 20:09:47 +02:00
|
|
|
if (!IsEndPara()) // can only be at the end if it's empty
|
|
|
|
{ // for an empty paragraph this would actually select the _next_
|
|
|
|
SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
|
|
|
|
}
|
2013-05-17 00:09:39 +02:00
|
|
|
if (!IsEndOfDoc()) // do not delete last paragraph in body text
|
|
|
|
{
|
|
|
|
nRet = DelFullPara() ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Pop(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nRet = _FwdSentence() ? Delete() : 0;
|
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
CloseMark( 0 != nRet );
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelNxtWord()
|
|
|
|
{
|
|
|
|
if(IsEndOfDoc())
|
|
|
|
return 0;
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2000-09-18 16:15:01 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
EnterStdMode();
|
|
|
|
SetMark();
|
2004-10-22 07:15:05 +00:00
|
|
|
if(IsEndWrd() && !IsSttWrd())
|
2011-04-16 22:42:13 -03:00
|
|
|
_NxtWrdForDelete(); // #i92468#
|
2000-09-18 16:15:01 +00:00
|
|
|
if(IsSttWrd() || IsEndPara())
|
2011-04-16 22:42:13 -03:00
|
|
|
_NxtWrdForDelete(); // #i92468#
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
|
|
|
_EndWrd();
|
|
|
|
|
|
|
|
long nRet = Delete();
|
|
|
|
if( nRet )
|
|
|
|
UpdateAttr();
|
|
|
|
else
|
|
|
|
SwapPam();
|
|
|
|
ClearMark();
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
long SwWrtShell::DelPrvWord()
|
|
|
|
{
|
|
|
|
if(IsStartOfDoc())
|
|
|
|
return 0;
|
2012-09-02 16:05:21 +04:00
|
|
|
SwActContext aActContext(this);
|
2000-09-18 16:15:01 +00:00
|
|
|
ResetCursorStack();
|
|
|
|
EnterStdMode();
|
|
|
|
SetMark();
|
2008-08-14 18:44:36 +00:00
|
|
|
if ( !IsSttWrd() ||
|
2011-04-16 22:42:13 -03:00
|
|
|
!_PrvWrdForDelete() ) // #i92468#
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2014-05-03 20:29:26 +02:00
|
|
|
if (IsEndWrd() || IsSttPara())
|
2011-04-16 22:42:13 -03:00
|
|
|
_PrvWrdForDelete(); // #i92468#
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
|
|
|
_SttWrd();
|
|
|
|
}
|
|
|
|
long nRet = Delete();
|
|
|
|
if( nRet )
|
|
|
|
UpdateAttr();
|
|
|
|
else
|
|
|
|
SwapPam();
|
|
|
|
ClearMark();
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|