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