xref: /trunk/main/sw/source/ui/wrtsh/delete.cxx (revision 546f7f5999ca912889b4487dfd727a602cdb1ebc)
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 
OpenMark()38cdf0e10cSrcweir inline void SwWrtShell::OpenMark()
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     StartAllAction();
41cdf0e10cSrcweir     ResetCursorStack();
42cdf0e10cSrcweir     KillPams();
43cdf0e10cSrcweir     SetMark();
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
CloseMark(sal_Bool bOkFlag)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#
TryRemoveIndent()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 /*------------------------------------------------------------------------
962b518738Smseidel  Beschreibung:  Zeile löschen
97cdf0e10cSrcweir ------------------------------------------------------------------------*/
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 
DelLine()101cdf0e10cSrcweir long SwWrtShell::DelLine()
102cdf0e10cSrcweir {
1032b518738Smseidel     ACT_CONTEXT(this);
104cdf0e10cSrcweir     ResetCursorStack();
105cdf0e10cSrcweir         // alten Cursor merken
106cdf0e10cSrcweir     Push();
107cdf0e10cSrcweir     ClearMark();
108cdf0e10cSrcweir     SwCrsrShell::LeftMargin();
109cdf0e10cSrcweir     SetMark();
110cdf0e10cSrcweir     SwCrsrShell::RightMargin();
1112b518738Smseidel //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 
DelToStartOfLine()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 
DelToEndOfLine()134cdf0e10cSrcweir long SwWrtShell::DelToEndOfLine()
135cdf0e10cSrcweir {
136cdf0e10cSrcweir     OpenMark();
137cdf0e10cSrcweir     SwCrsrShell::RightMargin();
138cdf0e10cSrcweir     long nRet = Delete();
139cdf0e10cSrcweir     CloseMark( 0 != nRet );
140cdf0e10cSrcweir     return 1;
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
DelLeft()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         {
1762b518738Smseidel              //OS: wieder einmal Basic: ACT_CONTEXT muss vor
177cdf0e10cSrcweir             //EnterStdMode verlassen werden!
178cdf0e10cSrcweir             {
1792b518738Smseidel                 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 
DelRight()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;
259*546f7f59Smseidel     if(nSelection & nsSelectionType::SEL_FONTWORK)
260*546f7f59Smseidel         nSelection = nsSelectionType::SEL_DRW;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     const SwTableNode * pWasInTblNd = NULL;
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     switch( nSelection & ~(nsSelectionType::SEL_BEZ) )
265cdf0e10cSrcweir     {
266cdf0e10cSrcweir     case nsSelectionType::SEL_POSTIT:
267cdf0e10cSrcweir     case nsSelectionType::SEL_TXT:
268cdf0e10cSrcweir     case nsSelectionType::SEL_TBL:
269cdf0e10cSrcweir     case nsSelectionType::SEL_NUM:
270cdf0e10cSrcweir             //  wenn eine Selektion existiert, diese loeschen.
271cdf0e10cSrcweir         if( IsSelection() )
272cdf0e10cSrcweir         {
273cdf0e10cSrcweir             if( !IsBlockMode() || HasSelection() )
274cdf0e10cSrcweir             {
2752b518738Smseidel                 //OS: wieder einmal Basic: ACT_CONTEXT muss vor
276cdf0e10cSrcweir                 //EnterStdMode verlassen werden!
277cdf0e10cSrcweir                 {
2782b518738Smseidel                     ACT_CONTEXT(this);
279cdf0e10cSrcweir                     ResetCursorStack();
280cdf0e10cSrcweir                     Delete();
281cdf0e10cSrcweir                     UpdateAttr();
282cdf0e10cSrcweir                 }
283cdf0e10cSrcweir                 if( IsBlockMode() )
284cdf0e10cSrcweir                 {
285cdf0e10cSrcweir                     NormalizePam();
286cdf0e10cSrcweir                     ClearMark();
287cdf0e10cSrcweir                     EnterBlockMode();
288cdf0e10cSrcweir                 }
289cdf0e10cSrcweir                 else
290cdf0e10cSrcweir                     EnterStdMode();
291cdf0e10cSrcweir                 nRet = 1L;
292cdf0e10cSrcweir                 break;
293cdf0e10cSrcweir             }
294cdf0e10cSrcweir             else
295cdf0e10cSrcweir                 EnterStdMode();
296cdf0e10cSrcweir         }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir         pWasInTblNd = IsCrsrInTbl();
299cdf0e10cSrcweir 
300cdf0e10cSrcweir         if( nsSelectionType::SEL_TXT & nSelection && SwCrsrShell::IsSttPara() &&
301cdf0e10cSrcweir             SwCrsrShell::IsEndPara() )
302cdf0e10cSrcweir         {
303cdf0e10cSrcweir             // save cursor
304cdf0e10cSrcweir             SwCrsrShell::Push();
305cdf0e10cSrcweir 
306cdf0e10cSrcweir             bool bDelFull = false;
307cdf0e10cSrcweir             if ( SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
308cdf0e10cSrcweir             {
309cdf0e10cSrcweir                 const SwTableNode * pCurrTblNd = IsCrsrInTbl();
310cdf0e10cSrcweir                 bDelFull = pCurrTblNd && pCurrTblNd != pWasInTblNd;
311cdf0e10cSrcweir             }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir             // restore cursor
314cdf0e10cSrcweir             SwCrsrShell::Pop( sal_False );
315cdf0e10cSrcweir 
316cdf0e10cSrcweir             if( bDelFull )
317cdf0e10cSrcweir             {
318cdf0e10cSrcweir                 DelFullPara();
319cdf0e10cSrcweir                 UpdateAttr();
320cdf0e10cSrcweir                 break;
321cdf0e10cSrcweir             }
322cdf0e10cSrcweir         }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir         {
325cdf0e10cSrcweir             /* #108049# Save the startnode of the current cell */
326cdf0e10cSrcweir             const SwStartNode * pSNdOld;
327cdf0e10cSrcweir             pSNdOld = GetSwCrsr()->GetNode()->
328cdf0e10cSrcweir                 FindTableBoxStartNode();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir             if ( SwCrsrShell::IsEndPara() )
331cdf0e10cSrcweir             {
332cdf0e10cSrcweir                 // --> FME 2005-01-28 #i41424# Introduced a couple of
333cdf0e10cSrcweir                 // Push()-Pop() pairs here. The reason for this is that a
334cdf0e10cSrcweir                 // Right()-Left() combination does not make sure, that
335cdf0e10cSrcweir                 // the cursor will be in its initial state, because there
336cdf0e10cSrcweir                 // may be a numbering in front of the next paragraph.
337cdf0e10cSrcweir                 SwCrsrShell::Push();
338cdf0e10cSrcweir                 // <--
339cdf0e10cSrcweir 
340cdf0e10cSrcweir                 if ( SwCrsrShell::Right(1, CRSR_SKIP_CHARS) )
341cdf0e10cSrcweir                 {
342cdf0e10cSrcweir                     if (IsCrsrInTbl() || (pWasInTblNd != IsCrsrInTbl()))
343cdf0e10cSrcweir                     {
344cdf0e10cSrcweir                         /* #108049# Save the startnode of the current
345cdf0e10cSrcweir                             cell. May be different to pSNdOld as we have
346cdf0e10cSrcweir                             moved. */
347cdf0e10cSrcweir                         const SwStartNode * pSNdNew = GetSwCrsr()
348cdf0e10cSrcweir                             ->GetNode()->FindTableBoxStartNode();
349cdf0e10cSrcweir 
350cdf0e10cSrcweir                         /* #108049# Only move instead of deleting if we
351cdf0e10cSrcweir                             have moved to a different cell */
352cdf0e10cSrcweir                         if (pSNdOld != pSNdNew)
353cdf0e10cSrcweir                         {
354cdf0e10cSrcweir                             SwCrsrShell::Pop( sal_True );
355cdf0e10cSrcweir                             break;
356cdf0e10cSrcweir                         }
357cdf0e10cSrcweir                     }
358cdf0e10cSrcweir                 }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir                 // restore cursor
361cdf0e10cSrcweir                 SwCrsrShell::Pop( sal_False );
362cdf0e10cSrcweir             }
363cdf0e10cSrcweir         }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir         OpenMark();
366cdf0e10cSrcweir         SwCrsrShell::Right(1,CRSR_SKIP_CELLS);
367cdf0e10cSrcweir         nRet = Delete();
368cdf0e10cSrcweir         CloseMark( 0 != nRet );
369cdf0e10cSrcweir         break;
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     case nsSelectionType::SEL_FRM:
372cdf0e10cSrcweir     case nsSelectionType::SEL_GRF:
373cdf0e10cSrcweir     case nsSelectionType::SEL_OLE:
374cdf0e10cSrcweir     case nsSelectionType::SEL_DRW:
375cdf0e10cSrcweir     case nsSelectionType::SEL_DRW_TXT:
376cdf0e10cSrcweir     case nsSelectionType::SEL_DRW_FORM:
377cdf0e10cSrcweir         {
378cdf0e10cSrcweir             /*  #108205# Remember object's position. */
379cdf0e10cSrcweir             Point aTmpPt = GetObjRect().TopLeft();
380cdf0e10cSrcweir 
381cdf0e10cSrcweir             DelSelectedObj();
382cdf0e10cSrcweir 
383cdf0e10cSrcweir             /*  #108205# Set cursor to remembered position. */
384cdf0e10cSrcweir             SetCrsr(&aTmpPt);
385cdf0e10cSrcweir 
386cdf0e10cSrcweir             LeaveSelFrmMode();
387cdf0e10cSrcweir             UnSelectFrm();
388cdf0e10cSrcweir             // --> OD 2006-07-06 #134369#
389cdf0e10cSrcweir             ASSERT( !IsFrmSelected(),
390cdf0e10cSrcweir                     "<SwWrtShell::DelRight(..)> - <SwWrtShell::UnSelectFrm()> should unmark all objects" )
391cdf0e10cSrcweir             // <--
392cdf0e10cSrcweir             // --> OD 2006-07-10 #134369#
393cdf0e10cSrcweir             // leave draw mode, if necessary.
394cdf0e10cSrcweir             {
395cdf0e10cSrcweir                 if (GetView().GetDrawFuncPtr())
396cdf0e10cSrcweir                 {
397cdf0e10cSrcweir                     GetView().GetDrawFuncPtr()->Deactivate();
398cdf0e10cSrcweir                     GetView().SetDrawFuncPtr(NULL);
399cdf0e10cSrcweir                 }
400cdf0e10cSrcweir                 if ( GetView().IsDrawMode() )
401cdf0e10cSrcweir                 {
402cdf0e10cSrcweir                     GetView().LeaveDrawCreate();
403cdf0e10cSrcweir                 }
404cdf0e10cSrcweir             }
405cdf0e10cSrcweir             // <--
406cdf0e10cSrcweir         }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir         // --> OD 2006-07-07 #134369#
409cdf0e10cSrcweir         // <IsFrmSelected()> can't be true - see above.
410cdf0e10cSrcweir         // <--
411cdf0e10cSrcweir         {
412cdf0e10cSrcweir             nSelection = GetSelectionType();
413cdf0e10cSrcweir             if ( nsSelectionType::SEL_FRM & nSelection ||
414cdf0e10cSrcweir                  nsSelectionType::SEL_GRF & nSelection ||
415cdf0e10cSrcweir                  nsSelectionType::SEL_OLE & nSelection ||
416cdf0e10cSrcweir                  nsSelectionType::SEL_DRW & nSelection )
417cdf0e10cSrcweir             {
418cdf0e10cSrcweir                 EnterSelFrmMode();
419cdf0e10cSrcweir                 GotoNextFly();
420cdf0e10cSrcweir             }
421cdf0e10cSrcweir         }
422cdf0e10cSrcweir         nRet = 1;
423cdf0e10cSrcweir         break;
424cdf0e10cSrcweir     }
425cdf0e10cSrcweir     return nRet;
426cdf0e10cSrcweir }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 
DelToEndOfPara()430cdf0e10cSrcweir long SwWrtShell::DelToEndOfPara()
431cdf0e10cSrcweir {
4322b518738Smseidel     ACT_CONTEXT(this);
433cdf0e10cSrcweir     ResetCursorStack();
434cdf0e10cSrcweir     Push();
435cdf0e10cSrcweir     SetMark();
436cdf0e10cSrcweir     if( !MovePara(fnParaCurr,fnParaEnd))
437cdf0e10cSrcweir     {
438cdf0e10cSrcweir         Pop(sal_False);
439cdf0e10cSrcweir         return 0;
440cdf0e10cSrcweir     }
441cdf0e10cSrcweir     long nRet = Delete();
442cdf0e10cSrcweir     Pop(sal_False);
443cdf0e10cSrcweir     if( nRet )
444cdf0e10cSrcweir         UpdateAttr();
445cdf0e10cSrcweir     return nRet;
446cdf0e10cSrcweir }
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 
DelToStartOfPara()450cdf0e10cSrcweir long SwWrtShell::DelToStartOfPara()
451cdf0e10cSrcweir {
4522b518738Smseidel     ACT_CONTEXT(this);
453cdf0e10cSrcweir     ResetCursorStack();
454cdf0e10cSrcweir     Push();
455cdf0e10cSrcweir     SetMark();
456cdf0e10cSrcweir     if( !MovePara(fnParaCurr,fnParaStart))
457cdf0e10cSrcweir     {
458cdf0e10cSrcweir         Pop(sal_False);
459cdf0e10cSrcweir         return 0;
460cdf0e10cSrcweir     }
461cdf0e10cSrcweir     long nRet = Delete();
462cdf0e10cSrcweir     Pop(sal_False);
463cdf0e10cSrcweir     if( nRet )
464cdf0e10cSrcweir         UpdateAttr();
465cdf0e10cSrcweir     return nRet;
466cdf0e10cSrcweir }
467cdf0e10cSrcweir /*
4682b518738Smseidel  * alle Löschoperationen sollten mit Find statt mit
469cdf0e10cSrcweir  * Nxt-/PrvDelim arbeiten, da letzteren mit Wrap Around arbeiten
4702b518738Smseidel  * -- das ist wohl nicht gewünscht.
471cdf0e10cSrcweir  */
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 
DelToStartOfSentence()475cdf0e10cSrcweir long SwWrtShell::DelToStartOfSentence()
476cdf0e10cSrcweir {
477cdf0e10cSrcweir     if(IsStartOfDoc())
478cdf0e10cSrcweir         return 0;
479cdf0e10cSrcweir     OpenMark();
480e789bd50SOliver-Rainer Wittmann 
481e789bd50SOliver-Rainer Wittmann     SwCrsrSaveState aSaveState( *(_GetCrsr()) );
482e789bd50SOliver-Rainer Wittmann     sal_Bool bSuccessfulSelection = _BwdSentence();
483e789bd50SOliver-Rainer Wittmann     if ( _GetCrsr()->IsInProtectTable( sal_True )
484e789bd50SOliver-Rainer Wittmann          || _GetCrsr()->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
485e789bd50SOliver-Rainer Wittmann                                   nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
486e789bd50SOliver-Rainer Wittmann     {
487e789bd50SOliver-Rainer Wittmann         bSuccessfulSelection = sal_False;
488e789bd50SOliver-Rainer Wittmann     }
489e789bd50SOliver-Rainer Wittmann     long nRet = bSuccessfulSelection ? Delete() : 0;
490e789bd50SOliver-Rainer Wittmann 
491cdf0e10cSrcweir     CloseMark( 0 != nRet );
492cdf0e10cSrcweir     return nRet;
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 
DelToEndOfSentence()497cdf0e10cSrcweir long SwWrtShell::DelToEndOfSentence()
498cdf0e10cSrcweir {
499cdf0e10cSrcweir     if(IsEndOfDoc())
500cdf0e10cSrcweir         return 0;
501cdf0e10cSrcweir     OpenMark();
502cdf0e10cSrcweir     long nRet = _FwdSentence() ? Delete() : 0;
503cdf0e10cSrcweir     CloseMark( 0 != nRet );
504cdf0e10cSrcweir     return nRet;
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 
DelNxtWord()509cdf0e10cSrcweir long SwWrtShell::DelNxtWord()
510cdf0e10cSrcweir {
511cdf0e10cSrcweir     if(IsEndOfDoc())
512cdf0e10cSrcweir         return 0;
5132b518738Smseidel     ACT_CONTEXT(this);
514cdf0e10cSrcweir     ResetCursorStack();
515cdf0e10cSrcweir     EnterStdMode();
516cdf0e10cSrcweir     SetMark();
517cdf0e10cSrcweir     if(IsEndWrd() && !IsSttWrd())
518cdf0e10cSrcweir         _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
519cdf0e10cSrcweir     if(IsSttWrd() || IsEndPara())
520cdf0e10cSrcweir         _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
521cdf0e10cSrcweir     else
522cdf0e10cSrcweir         _EndWrd();
523cdf0e10cSrcweir 
524cdf0e10cSrcweir     long nRet = Delete();
525cdf0e10cSrcweir     if( nRet )
526cdf0e10cSrcweir         UpdateAttr();
527cdf0e10cSrcweir     else
528cdf0e10cSrcweir         SwapPam();
529cdf0e10cSrcweir     ClearMark();
530cdf0e10cSrcweir     return nRet;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 
DelPrvWord()535cdf0e10cSrcweir long SwWrtShell::DelPrvWord()
536cdf0e10cSrcweir {
537cdf0e10cSrcweir     if(IsStartOfDoc())
538cdf0e10cSrcweir         return 0;
5392b518738Smseidel     ACT_CONTEXT(this);
540cdf0e10cSrcweir     ResetCursorStack();
541cdf0e10cSrcweir     EnterStdMode();
542cdf0e10cSrcweir     SetMark();
543cdf0e10cSrcweir     if ( !IsSttWrd() ||
544cdf0e10cSrcweir          !_PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
545cdf0e10cSrcweir     {
546cdf0e10cSrcweir         if( IsEndWrd() )
547cdf0e10cSrcweir         {
548cdf0e10cSrcweir             if ( _PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
549cdf0e10cSrcweir             {
55030d6b308SRegina Henschel                 // skip over all spaces
55130d6b308SRegina Henschel                 short n = 0;
552cdf0e10cSrcweir                 while( ' ' == GetChar( sal_False, n ))
553cdf0e10cSrcweir                     --n;
554cdf0e10cSrcweir 
555cdf0e10cSrcweir                 if( ++n )
556cdf0e10cSrcweir                     ExtendSelection( sal_False, -n );
557cdf0e10cSrcweir             }
558cdf0e10cSrcweir         }
559cdf0e10cSrcweir         else if( IsSttPara())
560cdf0e10cSrcweir             _PrvWrdForDelete(); // --> OD 2008-08-06 #i92468#
561cdf0e10cSrcweir         else
562cdf0e10cSrcweir             _SttWrd();
563cdf0e10cSrcweir     }
564cdf0e10cSrcweir     long nRet = Delete();
565cdf0e10cSrcweir     if( nRet )
566cdf0e10cSrcweir         UpdateAttr();
567cdf0e10cSrcweir     else
568cdf0e10cSrcweir         SwapPam();
569cdf0e10cSrcweir     ClearMark();
570cdf0e10cSrcweir     return nRet;
571cdf0e10cSrcweir }
5722b518738Smseidel 
5732b518738Smseidel /* vim: set noet sw=4 ts=4: */
574