1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 23cdf0e10cSrcweir #include "precompiled_sw.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <wrtsh.hxx> 26cdf0e10cSrcweir #include <crsskip.hxx> 27cdf0e10cSrcweir #include <swcrsr.hxx> 28cdf0e10cSrcweir #include <editeng/lrspitem.hxx> // #i23725# 29cdf0e10cSrcweir // --> OD 2006-07-10 #134369# 30cdf0e10cSrcweir #ifndef _VIEW_HXX 31cdf0e10cSrcweir #include <view.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir #ifndef _DRAWBASE_HXX 34cdf0e10cSrcweir #include <drawbase.hxx> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir // <-- 37cdf0e10cSrcweir 38cdf0e10cSrcweir inline void SwWrtShell::OpenMark() 39cdf0e10cSrcweir { 40cdf0e10cSrcweir StartAllAction(); 41cdf0e10cSrcweir ResetCursorStack(); 42cdf0e10cSrcweir KillPams(); 43cdf0e10cSrcweir SetMark(); 44cdf0e10cSrcweir } 45cdf0e10cSrcweir 46cdf0e10cSrcweir inline void SwWrtShell::CloseMark( sal_Bool bOkFlag ) 47cdf0e10cSrcweir { 48cdf0e10cSrcweir if( bOkFlag ) 49cdf0e10cSrcweir UpdateAttr(); 50cdf0e10cSrcweir else 51cdf0e10cSrcweir SwapPam(); 52cdf0e10cSrcweir 53cdf0e10cSrcweir ClearMark(); 54cdf0e10cSrcweir EndAllAction(); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir // #i23725# 58cdf0e10cSrcweir sal_Bool SwWrtShell::TryRemoveIndent() 59cdf0e10cSrcweir { 60cdf0e10cSrcweir sal_Bool bResult = sal_False; 61cdf0e10cSrcweir 62cdf0e10cSrcweir SfxItemSet aAttrSet(GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE); 63cdf0e10cSrcweir GetCurAttr(aAttrSet); 64cdf0e10cSrcweir 65cdf0e10cSrcweir SvxLRSpaceItem aItem = (const SvxLRSpaceItem &)aAttrSet.Get(RES_LR_SPACE); 66cdf0e10cSrcweir short aOldFirstLineOfst = aItem.GetTxtFirstLineOfst(); 67cdf0e10cSrcweir 68cdf0e10cSrcweir if (aOldFirstLineOfst > 0) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir aItem.SetTxtFirstLineOfst(0); 71cdf0e10cSrcweir bResult = sal_True; 72cdf0e10cSrcweir } 73cdf0e10cSrcweir else if (aOldFirstLineOfst < 0) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir aItem.SetTxtFirstLineOfst(0); 76cdf0e10cSrcweir aItem.SetLeft(aItem.GetLeft() + aOldFirstLineOfst); 77cdf0e10cSrcweir 78cdf0e10cSrcweir bResult = sal_True; 79cdf0e10cSrcweir } 80cdf0e10cSrcweir else if (aItem.GetLeft() != 0) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir aItem.SetLeft(0); 83cdf0e10cSrcweir bResult = sal_True; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir if (bResult) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir aAttrSet.Put(aItem); 8969a74367SOliver-Rainer Wittmann SetAttrSet(aAttrSet); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir return bResult; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir /*------------------------------------------------------------------------ 96*2b518738Smseidel Beschreibung: Zeile löschen 97cdf0e10cSrcweir ------------------------------------------------------------------------*/ 98cdf0e10cSrcweir 99cdf0e10cSrcweir 100cdf0e10cSrcweir 101cdf0e10cSrcweir long SwWrtShell::DelLine() 102cdf0e10cSrcweir { 103*2b518738Smseidel ACT_CONTEXT(this); 104cdf0e10cSrcweir ResetCursorStack(); 105cdf0e10cSrcweir // alten Cursor merken 106cdf0e10cSrcweir Push(); 107cdf0e10cSrcweir ClearMark(); 108cdf0e10cSrcweir SwCrsrShell::LeftMargin(); 109cdf0e10cSrcweir SetMark(); 110cdf0e10cSrcweir SwCrsrShell::RightMargin(); 111*2b518738Smseidel //Warum soll hier noch ein Zeichen in der nächsten Zeile gelöscht werden? 112cdf0e10cSrcweir // if(!IsEndOfPara()) 113cdf0e10cSrcweir // SwCrsrShell::Right(); 114cdf0e10cSrcweir long nRet = Delete(); 115cdf0e10cSrcweir Pop(sal_False); 116cdf0e10cSrcweir if( nRet ) 117cdf0e10cSrcweir UpdateAttr(); 118cdf0e10cSrcweir return nRet; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir long SwWrtShell::DelToStartOfLine() 124cdf0e10cSrcweir { 125cdf0e10cSrcweir OpenMark(); 126cdf0e10cSrcweir SwCrsrShell::LeftMargin(); 127cdf0e10cSrcweir long nRet = Delete(); 128cdf0e10cSrcweir CloseMark( 0 != nRet ); 129cdf0e10cSrcweir return nRet; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir 133cdf0e10cSrcweir 134cdf0e10cSrcweir long SwWrtShell::DelToEndOfLine() 135cdf0e10cSrcweir { 136cdf0e10cSrcweir OpenMark(); 137cdf0e10cSrcweir SwCrsrShell::RightMargin(); 138cdf0e10cSrcweir long nRet = Delete(); 139cdf0e10cSrcweir CloseMark( 0 != nRet ); 140cdf0e10cSrcweir return 1; 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir long SwWrtShell::DelLeft() 144cdf0e10cSrcweir { 145cdf0e10cSrcweir // wenns denn ein Fly ist, wech damit 146cdf0e10cSrcweir int nSelType = GetSelectionType(); 147cdf0e10cSrcweir const int nCmp = nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW; 148cdf0e10cSrcweir if( nCmp & nSelType ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir /* #108205# Remember object's position. */ 151cdf0e10cSrcweir Point aTmpPt = GetObjRect().TopLeft(); 152cdf0e10cSrcweir 153cdf0e10cSrcweir DelSelectedObj(); 154cdf0e10cSrcweir 155cdf0e10cSrcweir /* #108205# Set cursor to remembered position. */ 156cdf0e10cSrcweir SetCrsr(&aTmpPt); 157cdf0e10cSrcweir 158cdf0e10cSrcweir LeaveSelFrmMode(); 159cdf0e10cSrcweir UnSelectFrm(); 160cdf0e10cSrcweir 161cdf0e10cSrcweir nSelType = GetSelectionType(); 162cdf0e10cSrcweir if ( nCmp & nSelType ) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir EnterSelFrmMode(); 165cdf0e10cSrcweir GotoNextFly(); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir 168cdf0e10cSrcweir return 1L; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir // wenn eine Selektion existiert, diese loeschen. 172cdf0e10cSrcweir if ( IsSelection() ) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir if( !IsBlockMode() || HasSelection() ) 175cdf0e10cSrcweir { 176*2b518738Smseidel //OS: wieder einmal Basic: ACT_CONTEXT muss vor 177cdf0e10cSrcweir //EnterStdMode verlassen werden! 178cdf0e10cSrcweir { 179*2b518738Smseidel ACT_CONTEXT(this); 180cdf0e10cSrcweir ResetCursorStack(); 181cdf0e10cSrcweir Delete(); 182cdf0e10cSrcweir UpdateAttr(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir if( IsBlockMode() ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir NormalizePam(); 187cdf0e10cSrcweir ClearMark(); 188cdf0e10cSrcweir EnterBlockMode(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir else 191cdf0e10cSrcweir EnterStdMode(); 192cdf0e10cSrcweir return 1L; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir else 195cdf0e10cSrcweir EnterStdMode(); 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir // JP 29.06.95: nie eine davor stehende Tabelle loeschen. 199cdf0e10cSrcweir sal_Bool bSwap = sal_False; 200cdf0e10cSrcweir const SwTableNode * pWasInTblNd = SwCrsrShell::IsCrsrInTbl(); 201cdf0e10cSrcweir 202cdf0e10cSrcweir if( SwCrsrShell::IsSttPara()) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we 205cdf0e10cSrcweir // changed the table cell, compare DelRight(). 206cdf0e10cSrcweir const SwStartNode * pSNdOld = pWasInTblNd ? 207cdf0e10cSrcweir GetSwCrsr()->GetNode()->FindTableBoxStartNode() : 208cdf0e10cSrcweir 0; 209cdf0e10cSrcweir // <-- 210cdf0e10cSrcweir 211cdf0e10cSrcweir /* If the cursor is at the beginning of a paragraph, try to step 212cdf0e10cSrcweir backwards. On failure we are done. */ 213cdf0e10cSrcweir if( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) ) 214cdf0e10cSrcweir return 0; 215cdf0e10cSrcweir 216cdf0e10cSrcweir /* If the cursor entered or left a table (or both) we are done. No step 217cdf0e10cSrcweir back. */ 218cdf0e10cSrcweir const SwTableNode* pIsInTblNd = SwCrsrShell::IsCrsrInTbl(); 219cdf0e10cSrcweir if( pIsInTblNd != pWasInTblNd ) 220cdf0e10cSrcweir return 0; 221cdf0e10cSrcweir 222cdf0e10cSrcweir const SwStartNode* pSNdNew = pIsInTblNd ? 223cdf0e10cSrcweir GetSwCrsr()->GetNode()->FindTableBoxStartNode() : 224cdf0e10cSrcweir 0; 225cdf0e10cSrcweir 226cdf0e10cSrcweir // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we 227cdf0e10cSrcweir // changed the table cell, compare DelRight(). 228cdf0e10cSrcweir if ( pSNdOld != pSNdNew ) 229cdf0e10cSrcweir return 0; 230cdf0e10cSrcweir // <-- 231cdf0e10cSrcweir 232cdf0e10cSrcweir OpenMark(); 233cdf0e10cSrcweir SwCrsrShell::Right(1,CRSR_SKIP_CHARS); 234cdf0e10cSrcweir SwCrsrShell::SwapPam(); 235cdf0e10cSrcweir bSwap = sal_True; 236cdf0e10cSrcweir } 237cdf0e10cSrcweir else 238cdf0e10cSrcweir { 239cdf0e10cSrcweir OpenMark(); 240cdf0e10cSrcweir SwCrsrShell::Left(1,CRSR_SKIP_CHARS); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir long nRet = Delete(); 243cdf0e10cSrcweir if( !nRet && bSwap ) 244cdf0e10cSrcweir SwCrsrShell::SwapPam(); 245cdf0e10cSrcweir CloseMark( 0 != nRet ); 246cdf0e10cSrcweir return nRet; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir long SwWrtShell::DelRight() 250cdf0e10cSrcweir { 251cdf0e10cSrcweir // werden verodert, wenn Tabellenselektion vorliegt; 252cdf0e10cSrcweir // wird hier auf nsSelectionType::SEL_TBL umgesetzt. 253cdf0e10cSrcweir long nRet = 0; 254cdf0e10cSrcweir int nSelection = GetSelectionType(); 255cdf0e10cSrcweir if(nSelection & nsSelectionType::SEL_TBL_CELLS) 256cdf0e10cSrcweir nSelection = nsSelectionType::SEL_TBL; 257cdf0e10cSrcweir if(nSelection & nsSelectionType::SEL_TXT) 258cdf0e10cSrcweir nSelection = nsSelectionType::SEL_TXT; 259cdf0e10cSrcweir 260cdf0e10cSrcweir const SwTableNode * pWasInTblNd = NULL; 261cdf0e10cSrcweir 262cdf0e10cSrcweir switch( nSelection & ~(nsSelectionType::SEL_BEZ) ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir case nsSelectionType::SEL_POSTIT: 265cdf0e10cSrcweir case nsSelectionType::SEL_TXT: 266cdf0e10cSrcweir case nsSelectionType::SEL_TBL: 267cdf0e10cSrcweir case nsSelectionType::SEL_NUM: 268cdf0e10cSrcweir // wenn eine Selektion existiert, diese loeschen. 269cdf0e10cSrcweir if( IsSelection() ) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir if( !IsBlockMode() || HasSelection() ) 272cdf0e10cSrcweir { 273*2b518738Smseidel //OS: wieder einmal Basic: ACT_CONTEXT muss vor 274cdf0e10cSrcweir //EnterStdMode verlassen werden! 275cdf0e10cSrcweir { 276*2b518738Smseidel ACT_CONTEXT(this); 277cdf0e10cSrcweir ResetCursorStack(); 278cdf0e10cSrcweir Delete(); 279cdf0e10cSrcweir UpdateAttr(); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir if( IsBlockMode() ) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir NormalizePam(); 284cdf0e10cSrcweir ClearMark(); 285cdf0e10cSrcweir EnterBlockMode(); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir else 288cdf0e10cSrcweir EnterStdMode(); 289cdf0e10cSrcweir nRet = 1L; 290cdf0e10cSrcweir break; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir else 293cdf0e10cSrcweir EnterStdMode(); 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir pWasInTblNd = IsCrsrInTbl(); 297cdf0e10cSrcweir 298cdf0e10cSrcweir if( nsSelectionType::SEL_TXT & nSelection && SwCrsrShell::IsSttPara() && 299cdf0e10cSrcweir SwCrsrShell::IsEndPara() ) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir // save cursor 302cdf0e10cSrcweir SwCrsrShell::Push(); 303cdf0e10cSrcweir 304cdf0e10cSrcweir bool bDelFull = false; 305cdf0e10cSrcweir if ( SwCrsrShell::Right(1,CRSR_SKIP_CHARS) ) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir const SwTableNode * pCurrTblNd = IsCrsrInTbl(); 308cdf0e10cSrcweir bDelFull = pCurrTblNd && pCurrTblNd != pWasInTblNd; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir // restore cursor 312cdf0e10cSrcweir SwCrsrShell::Pop( sal_False ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir if( bDelFull ) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir DelFullPara(); 317cdf0e10cSrcweir UpdateAttr(); 318cdf0e10cSrcweir break; 319cdf0e10cSrcweir } 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir { 323cdf0e10cSrcweir /* #108049# Save the startnode of the current cell */ 324cdf0e10cSrcweir const SwStartNode * pSNdOld; 325cdf0e10cSrcweir pSNdOld = GetSwCrsr()->GetNode()-> 326cdf0e10cSrcweir FindTableBoxStartNode(); 327cdf0e10cSrcweir 328cdf0e10cSrcweir if ( SwCrsrShell::IsEndPara() ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir // --> FME 2005-01-28 #i41424# Introduced a couple of 331cdf0e10cSrcweir // Push()-Pop() pairs here. The reason for this is that a 332cdf0e10cSrcweir // Right()-Left() combination does not make sure, that 333cdf0e10cSrcweir // the cursor will be in its initial state, because there 334cdf0e10cSrcweir // may be a numbering in front of the next paragraph. 335cdf0e10cSrcweir SwCrsrShell::Push(); 336cdf0e10cSrcweir // <-- 337cdf0e10cSrcweir 338cdf0e10cSrcweir if ( SwCrsrShell::Right(1, CRSR_SKIP_CHARS) ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir if (IsCrsrInTbl() || (pWasInTblNd != IsCrsrInTbl())) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir /* #108049# Save the startnode of the current 343cdf0e10cSrcweir cell. May be different to pSNdOld as we have 344cdf0e10cSrcweir moved. */ 345cdf0e10cSrcweir const SwStartNode * pSNdNew = GetSwCrsr() 346cdf0e10cSrcweir ->GetNode()->FindTableBoxStartNode(); 347cdf0e10cSrcweir 348cdf0e10cSrcweir /* #108049# Only move instead of deleting if we 349cdf0e10cSrcweir have moved to a different cell */ 350cdf0e10cSrcweir if (pSNdOld != pSNdNew) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir SwCrsrShell::Pop( sal_True ); 353cdf0e10cSrcweir break; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir } 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir // restore cursor 359cdf0e10cSrcweir SwCrsrShell::Pop( sal_False ); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir OpenMark(); 364cdf0e10cSrcweir SwCrsrShell::Right(1,CRSR_SKIP_CELLS); 365cdf0e10cSrcweir nRet = Delete(); 366cdf0e10cSrcweir CloseMark( 0 != nRet ); 367cdf0e10cSrcweir break; 368cdf0e10cSrcweir 369cdf0e10cSrcweir case nsSelectionType::SEL_FRM: 370cdf0e10cSrcweir case nsSelectionType::SEL_GRF: 371cdf0e10cSrcweir case nsSelectionType::SEL_OLE: 372cdf0e10cSrcweir case nsSelectionType::SEL_DRW: 373cdf0e10cSrcweir case nsSelectionType::SEL_DRW_TXT: 374cdf0e10cSrcweir case nsSelectionType::SEL_DRW_FORM: 375cdf0e10cSrcweir { 376cdf0e10cSrcweir /* #108205# Remember object's position. */ 377cdf0e10cSrcweir Point aTmpPt = GetObjRect().TopLeft(); 378cdf0e10cSrcweir 379cdf0e10cSrcweir DelSelectedObj(); 380cdf0e10cSrcweir 381cdf0e10cSrcweir /* #108205# Set cursor to remembered position. */ 382cdf0e10cSrcweir SetCrsr(&aTmpPt); 383cdf0e10cSrcweir 384cdf0e10cSrcweir LeaveSelFrmMode(); 385cdf0e10cSrcweir UnSelectFrm(); 386cdf0e10cSrcweir // --> OD 2006-07-06 #134369# 387cdf0e10cSrcweir ASSERT( !IsFrmSelected(), 388cdf0e10cSrcweir "<SwWrtShell::DelRight(..)> - <SwWrtShell::UnSelectFrm()> should unmark all objects" ) 389cdf0e10cSrcweir // <-- 390cdf0e10cSrcweir // --> OD 2006-07-10 #134369# 391cdf0e10cSrcweir // leave draw mode, if necessary. 392cdf0e10cSrcweir { 393cdf0e10cSrcweir if (GetView().GetDrawFuncPtr()) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir GetView().GetDrawFuncPtr()->Deactivate(); 396cdf0e10cSrcweir GetView().SetDrawFuncPtr(NULL); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir if ( GetView().IsDrawMode() ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir GetView().LeaveDrawCreate(); 401cdf0e10cSrcweir } 402cdf0e10cSrcweir } 403cdf0e10cSrcweir // <-- 404cdf0e10cSrcweir } 405cdf0e10cSrcweir 406cdf0e10cSrcweir // --> OD 2006-07-07 #134369# 407cdf0e10cSrcweir // <IsFrmSelected()> can't be true - see above. 408cdf0e10cSrcweir // <-- 409cdf0e10cSrcweir { 410cdf0e10cSrcweir nSelection = GetSelectionType(); 411cdf0e10cSrcweir if ( nsSelectionType::SEL_FRM & nSelection || 412cdf0e10cSrcweir nsSelectionType::SEL_GRF & nSelection || 413cdf0e10cSrcweir nsSelectionType::SEL_OLE & nSelection || 414cdf0e10cSrcweir nsSelectionType::SEL_DRW & nSelection ) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir EnterSelFrmMode(); 417cdf0e10cSrcweir GotoNextFly(); 418cdf0e10cSrcweir } 419cdf0e10cSrcweir } 420cdf0e10cSrcweir nRet = 1; 421cdf0e10cSrcweir break; 422cdf0e10cSrcweir } 423cdf0e10cSrcweir return nRet; 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir 427cdf0e10cSrcweir 428cdf0e10cSrcweir long SwWrtShell::DelToEndOfPara() 429cdf0e10cSrcweir { 430*2b518738Smseidel ACT_CONTEXT(this); 431cdf0e10cSrcweir ResetCursorStack(); 432cdf0e10cSrcweir Push(); 433cdf0e10cSrcweir SetMark(); 434cdf0e10cSrcweir if( !MovePara(fnParaCurr,fnParaEnd)) 435cdf0e10cSrcweir { 436cdf0e10cSrcweir Pop(sal_False); 437cdf0e10cSrcweir return 0; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir long nRet = Delete(); 440cdf0e10cSrcweir Pop(sal_False); 441cdf0e10cSrcweir if( nRet ) 442cdf0e10cSrcweir UpdateAttr(); 443cdf0e10cSrcweir return nRet; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir 447cdf0e10cSrcweir 448cdf0e10cSrcweir long SwWrtShell::DelToStartOfPara() 449cdf0e10cSrcweir { 450*2b518738Smseidel ACT_CONTEXT(this); 451cdf0e10cSrcweir ResetCursorStack(); 452cdf0e10cSrcweir Push(); 453cdf0e10cSrcweir SetMark(); 454cdf0e10cSrcweir if( !MovePara(fnParaCurr,fnParaStart)) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir Pop(sal_False); 457cdf0e10cSrcweir return 0; 458cdf0e10cSrcweir } 459cdf0e10cSrcweir long nRet = Delete(); 460cdf0e10cSrcweir Pop(sal_False); 461cdf0e10cSrcweir if( nRet ) 462cdf0e10cSrcweir UpdateAttr(); 463cdf0e10cSrcweir return nRet; 464cdf0e10cSrcweir } 465cdf0e10cSrcweir /* 466*2b518738Smseidel * alle Löschoperationen sollten mit Find statt mit 467cdf0e10cSrcweir * Nxt-/PrvDelim arbeiten, da letzteren mit Wrap Around arbeiten 468*2b518738Smseidel * -- das ist wohl nicht gewünscht. 469cdf0e10cSrcweir */ 470cdf0e10cSrcweir 471cdf0e10cSrcweir 472cdf0e10cSrcweir 473cdf0e10cSrcweir long SwWrtShell::DelToStartOfSentence() 474cdf0e10cSrcweir { 475cdf0e10cSrcweir if(IsStartOfDoc()) 476cdf0e10cSrcweir return 0; 477cdf0e10cSrcweir OpenMark(); 478e789bd50SOliver-Rainer Wittmann 479e789bd50SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *(_GetCrsr()) ); 480e789bd50SOliver-Rainer Wittmann sal_Bool bSuccessfulSelection = _BwdSentence(); 481e789bd50SOliver-Rainer Wittmann if ( _GetCrsr()->IsInProtectTable( sal_True ) 482e789bd50SOliver-Rainer Wittmann || _GetCrsr()->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | 483e789bd50SOliver-Rainer Wittmann nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) ) 484e789bd50SOliver-Rainer Wittmann { 485e789bd50SOliver-Rainer Wittmann bSuccessfulSelection = sal_False; 486e789bd50SOliver-Rainer Wittmann } 487e789bd50SOliver-Rainer Wittmann long nRet = bSuccessfulSelection ? Delete() : 0; 488e789bd50SOliver-Rainer Wittmann 489cdf0e10cSrcweir CloseMark( 0 != nRet ); 490cdf0e10cSrcweir return nRet; 491cdf0e10cSrcweir } 492cdf0e10cSrcweir 493cdf0e10cSrcweir 494cdf0e10cSrcweir 495cdf0e10cSrcweir long SwWrtShell::DelToEndOfSentence() 496cdf0e10cSrcweir { 497cdf0e10cSrcweir if(IsEndOfDoc()) 498cdf0e10cSrcweir return 0; 499cdf0e10cSrcweir OpenMark(); 500cdf0e10cSrcweir long nRet = _FwdSentence() ? Delete() : 0; 501cdf0e10cSrcweir CloseMark( 0 != nRet ); 502cdf0e10cSrcweir return nRet; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir 506cdf0e10cSrcweir 507cdf0e10cSrcweir long SwWrtShell::DelNxtWord() 508cdf0e10cSrcweir { 509cdf0e10cSrcweir if(IsEndOfDoc()) 510cdf0e10cSrcweir return 0; 511*2b518738Smseidel ACT_CONTEXT(this); 512cdf0e10cSrcweir ResetCursorStack(); 513cdf0e10cSrcweir EnterStdMode(); 514cdf0e10cSrcweir SetMark(); 515cdf0e10cSrcweir if(IsEndWrd() && !IsSttWrd()) 516cdf0e10cSrcweir _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468# 517cdf0e10cSrcweir if(IsSttWrd() || IsEndPara()) 518cdf0e10cSrcweir _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468# 519cdf0e10cSrcweir else 520cdf0e10cSrcweir _EndWrd(); 521cdf0e10cSrcweir 522cdf0e10cSrcweir long nRet = Delete(); 523cdf0e10cSrcweir if( nRet ) 524cdf0e10cSrcweir UpdateAttr(); 525cdf0e10cSrcweir else 526cdf0e10cSrcweir SwapPam(); 527cdf0e10cSrcweir ClearMark(); 528cdf0e10cSrcweir return nRet; 529cdf0e10cSrcweir } 530cdf0e10cSrcweir 531cdf0e10cSrcweir 532cdf0e10cSrcweir 533cdf0e10cSrcweir long SwWrtShell::DelPrvWord() 534cdf0e10cSrcweir { 535cdf0e10cSrcweir if(IsStartOfDoc()) 536cdf0e10cSrcweir return 0; 537*2b518738Smseidel ACT_CONTEXT(this); 538cdf0e10cSrcweir ResetCursorStack(); 539cdf0e10cSrcweir EnterStdMode(); 540cdf0e10cSrcweir SetMark(); 541cdf0e10cSrcweir if ( !IsSttWrd() || 542cdf0e10cSrcweir !_PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468# 543cdf0e10cSrcweir { 544cdf0e10cSrcweir if( IsEndWrd() ) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir if ( _PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468# 547cdf0e10cSrcweir { 54830d6b308SRegina Henschel // skip over all spaces 54930d6b308SRegina Henschel short n = 0; 550cdf0e10cSrcweir while( ' ' == GetChar( sal_False, n )) 551cdf0e10cSrcweir --n; 552cdf0e10cSrcweir 553cdf0e10cSrcweir if( ++n ) 554cdf0e10cSrcweir ExtendSelection( sal_False, -n ); 555cdf0e10cSrcweir } 556cdf0e10cSrcweir } 557cdf0e10cSrcweir else if( IsSttPara()) 558cdf0e10cSrcweir _PrvWrdForDelete(); // --> OD 2008-08-06 #i92468# 559cdf0e10cSrcweir else 560cdf0e10cSrcweir _SttWrd(); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir long nRet = Delete(); 563cdf0e10cSrcweir if( nRet ) 564cdf0e10cSrcweir UpdateAttr(); 565cdf0e10cSrcweir else 566cdf0e10cSrcweir SwapPam(); 567cdf0e10cSrcweir ClearMark(); 568cdf0e10cSrcweir return nRet; 569cdf0e10cSrcweir } 570*2b518738Smseidel 571*2b518738Smseidel /* vim: set noet sw=4 ts=4: */ 572