1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 // Private methods, which move the cursor over search.
23 // The removal of the selection must be made on the level above.
25 // The beginning of a word is the follow of a
26 // non-delimiter to delimiter. Furthermore, the follow of
27 // non-sentence separators on sentence separator.
28 // The begin of paragraph is also the word beginning.
30 void SwWrtShell::SttWrd()
34 // Create temporary cursor without selection.
38 // not found --> go to the beginning of the paragraph.
39 SwCursorShell::MovePara( GoCurrPara
, fnParaStart
);
41 // If Mark was previously set, summarize.
45 // The end of a word is the follow of separator to nonseparator.
46 // The end of a word is also the sequence of word separators to
48 // The end of a paragraph is also the end of a word.
50 void SwWrtShell::EndWrd()
54 // Create temporary cursor without selection.
58 // not found --> go to the end of the paragraph.
59 SwCursorShell::MovePara(GoCurrPara
, fnParaEnd
);
61 // If Mark was previously set, summarize.
65 bool SwWrtShell::NxtWrd_()
68 while( IsEndPara() ) // If already at the end, then the next???
70 if(!SwCursorShell::Right(1,CRSR_SKIP_CHARS
)) // Document - end ??
72 Pop(SwCursorShell::PopMode::DeleteCurrent
);
83 if( (!IsEndPara() && !SwCursorShell::MovePara( GoCurrPara
, fnParaEnd
) )
84 || !SwCursorShell::Right(1,CRSR_SKIP_CHARS
) )
96 bool SwWrtShell::PrvWrd_()
100 { // if already at the beginning, then the next???
101 if(!SwCursorShell::Left(1,CRSR_SKIP_CHARS
))
102 { // Document - beginning ??
103 Pop(SwCursorShell::PopMode::DeleteCurrent
);
106 bRet
= IsStartWord() || IsEndPara();
114 if( (!IsSttPara() && !SwCursorShell::MovePara( GoCurrPara
, fnParaStart
) )
115 || !SwCursorShell::Left(1,CRSR_SKIP_CHARS
) )
117 bRet
= IsStartWord();
128 // method code of <SwWrtShell::NxtWrd_()> before fix for issue i72162
129 bool SwWrtShell::NxtWrdForDelete()
133 if ( !SwCursorShell::Right(1,CRSR_SKIP_CHARS
) )
135 Pop(SwCursorShell::PopMode::DeleteCurrent
);
144 SwCursorShell::MovePara( GoCurrPara
, fnParaEnd
);
151 // method code of <SwWrtShell::PrvWrd_()> before fix for issue i72162
152 bool SwWrtShell::PrvWrdForDelete()
156 if ( !SwCursorShell::Left(1,CRSR_SKIP_CHARS
) )
158 Pop(SwCursorShell::PopMode::DeleteCurrent
);
167 SwCursorShell::MovePara( GoCurrPara
, fnParaStart
);
174 bool SwWrtShell::FwdSentence_()
178 if(!SwCursorShell::Right(1,CRSR_SKIP_CHARS
))
180 Pop(SwCursorShell::PopMode::DeleteCurrent
);
183 if( !GoNextSentence() && !IsEndPara() )
184 SwCursorShell::MovePara(GoCurrPara
, fnParaEnd
);
191 bool SwWrtShell::BwdSentence_()
195 if(!SwCursorShell::Left(1,CRSR_SKIP_CHARS
))
197 Pop(SwCursorShell::PopMode::DeleteCurrent
);
200 if( !GoStartSentence() && !IsSttPara() )
201 // not found --> go to the beginning of the paragraph
202 SwCursorShell::MovePara( GoCurrPara
, fnParaStart
);
208 bool SwWrtShell::FwdPara_()
212 bool bRet
= SwCursorShell::MovePara(GoNextPara
, fnParaStart
);
219 bool SwWrtShell::BwdPara_()
224 bool bRet
= SwCursorShell::MovePara(GoPrevPara
, fnParaStart
);
225 if ( !bRet
&& !IsSttOfPara() )
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */