Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <hintids.hxx>
30 : : #include <comphelper/string.hxx>
31 : : #include <svl/itemiter.hxx>
32 : : #include <editeng/lrspitem.hxx>
33 : : #include <editeng/adjitem.hxx>
34 : : #include <editeng/brkitem.hxx>
35 : : #include <svx/svdobj.hxx>
36 : : #include <crsrsh.hxx>
37 : : #include <doc.hxx>
38 : : #include <IDocumentUndoRedo.hxx>
39 : : #include <pagefrm.hxx>
40 : : #include <cntfrm.hxx>
41 : : #include <rootfrm.hxx>
42 : : #include <pam.hxx>
43 : : #include <ndtxt.hxx>
44 : : #include <fldbas.hxx>
45 : : #include <swtable.hxx>
46 : : #include <docary.hxx>
47 : : #include <txtfld.hxx>
48 : : #include <fmtfld.hxx>
49 : : #include <txtftn.hxx>
50 : : #include <txtinet.hxx>
51 : : #include <fmtinfmt.hxx>
52 : : #include <txttxmrk.hxx>
53 : : #include <frmfmt.hxx>
54 : : #include <flyfrm.hxx>
55 : : #include <viscrs.hxx>
56 : : #include <callnk.hxx>
57 : : #include <doctxm.hxx>
58 : : #include <docfld.hxx>
59 : : #include <expfld.hxx>
60 : : #include <reffld.hxx>
61 : : #include <flddat.hxx>
62 : : #include <cellatr.hxx>
63 : : #include <swundo.hxx>
64 : : #include <redline.hxx>
65 : : #include <fmtcntnt.hxx>
66 : : #include <fmthdft.hxx>
67 : : #include <pagedesc.hxx>
68 : : #include <fesh.hxx>
69 : : #include <charfmt.hxx>
70 : : #include <fmturl.hxx>
71 : : #include "txtfrm.hxx"
72 : : #include <wrong.hxx>
73 : : #include <switerator.hxx>
74 : : #include <vcl/window.hxx>
75 : : #include <docufld.hxx>
76 : :
77 : : using namespace ::com::sun::star;
78 : :
79 : : /// go to next/previous point on the same level
80 : 0 : sal_Bool SwCrsrShell::GotoNextNum()
81 : : {
82 : 0 : sal_Bool bRet = GetDoc()->GotoNextNum( *pCurCrsr->GetPoint() );
83 [ # # ]: 0 : if( bRet )
84 : : {
85 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
86 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
87 [ # # ]: 0 : if( !ActionPend() )
88 : : {
89 [ # # ]: 0 : SET_CURR_SHELL( this );
90 : : // try to set cursor onto this position, at half of the char-
91 : : // SRectangle's height
92 : 0 : Point aPt( pCurCrsr->GetPtPos() );
93 [ # # ]: 0 : SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
94 [ # # ]: 0 : pCurCrsr->GetPoint() );
95 [ # # ]: 0 : pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
96 [ # # ]: 0 : pFrm->Calc();
97 [ # # ][ # # ]: 0 : if( pFrm->IsVertical() )
98 : : {
99 [ # # ]: 0 : aPt.X() = aCharRect.Center().X();
100 : 0 : aPt.Y() = pFrm->Frm().Top() + nUpDownX;
101 : : }
102 : : else
103 : : {
104 [ # # ]: 0 : aPt.Y() = aCharRect.Center().Y();
105 : 0 : aPt.X() = pFrm->Frm().Left() + nUpDownX;
106 : : }
107 [ # # ]: 0 : pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
108 : : bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
109 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
110 [ # # ]: 0 : if( bRet )
111 : : UpdateCrsr(SwCrsrShell::UPDOWN |
112 : : SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
113 [ # # ][ # # ]: 0 : SwCrsrShell::READONLY );
114 [ # # ][ # # ]: 0 : }
115 : : }
116 : 0 : return bRet;
117 : : }
118 : :
119 : :
120 : 0 : sal_Bool SwCrsrShell::GotoPrevNum()
121 : : {
122 : 0 : sal_Bool bRet = GetDoc()->GotoPrevNum( *pCurCrsr->GetPoint() );
123 [ # # ]: 0 : if( bRet )
124 : : {
125 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
126 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
127 [ # # ]: 0 : if( !ActionPend() )
128 : : {
129 [ # # ]: 0 : SET_CURR_SHELL( this );
130 : : // try to set cursor onto this position, at half of the char-
131 : : // SRectangle's height
132 : 0 : Point aPt( pCurCrsr->GetPtPos() );
133 [ # # ]: 0 : SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
134 [ # # ]: 0 : pCurCrsr->GetPoint() );
135 [ # # ]: 0 : pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
136 [ # # ]: 0 : pFrm->Calc();
137 [ # # ][ # # ]: 0 : if( pFrm->IsVertical() )
138 : : {
139 [ # # ]: 0 : aPt.X() = aCharRect.Center().X();
140 : 0 : aPt.Y() = pFrm->Frm().Top() + nUpDownX;
141 : : }
142 : : else
143 : : {
144 [ # # ]: 0 : aPt.Y() = aCharRect.Center().Y();
145 : 0 : aPt.X() = pFrm->Frm().Left() + nUpDownX;
146 : : }
147 [ # # ]: 0 : pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
148 : : bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
149 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
150 [ # # ]: 0 : if( bRet )
151 : : UpdateCrsr(SwCrsrShell::UPDOWN |
152 : : SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
153 [ # # ][ # # ]: 0 : SwCrsrShell::READONLY );
154 [ # # ][ # # ]: 0 : }
155 : : }
156 : 0 : return bRet;
157 : : }
158 : :
159 : : /// jump from content to header
160 : 0 : sal_Bool SwCrsrShell::GotoHeaderTxt()
161 : : {
162 : 0 : const SwFrm* pFrm = GetCurrFrm()->FindPageFrm();
163 [ # # ][ # # ]: 0 : while( pFrm && !pFrm->IsHeaderFrm() )
[ # # ]
164 : 0 : pFrm = pFrm->GetLower();
165 : : // found header, search 1. content frame
166 [ # # ][ # # ]: 0 : while( pFrm && !pFrm->IsCntntFrm() )
[ # # ]
167 : 0 : pFrm = pFrm->GetLower();
168 [ # # ]: 0 : if( pFrm )
169 : : {
170 [ # # ]: 0 : SET_CURR_SHELL( this );
171 : : // get header frame
172 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
173 [ # # ][ # # ]: 0 : SwCursor *pTmpCrsr = getShellCrsr( true );
174 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pTmpCrsr );
175 [ # # ]: 0 : pFrm->Calc();
176 : 0 : Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() );
177 [ # # ]: 0 : pFrm->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
178 [ # # ][ # # ]: 0 : if( !pTmpCrsr->IsSelOvr() )
179 [ # # ]: 0 : UpdateCrsr();
180 : : else
181 [ # # ][ # # ]: 0 : pFrm = 0;
[ # # ]
182 : : }
183 : 0 : return 0 != pFrm;
184 : : }
185 : :
186 : : /// jump from content to footer
187 : 0 : sal_Bool SwCrsrShell::GotoFooterTxt()
188 : : {
189 : 0 : const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm();
190 [ # # ]: 0 : if( pFrm )
191 : : {
192 : 0 : const SwFrm* pLower = pFrm->GetLastLower();
193 : :
194 [ # # ][ # # ]: 0 : while( pLower && !pLower->IsFooterFrm() )
[ # # ]
195 : 0 : pLower = pLower->GetLower();
196 : : // found footer, search 1. content frame
197 [ # # ][ # # ]: 0 : while( pLower && !pLower->IsCntntFrm() )
[ # # ]
198 : 0 : pLower = pLower->GetLower();
199 : :
200 [ # # ]: 0 : if( pLower )
201 : : {
202 [ # # ][ # # ]: 0 : SwCursor *pTmpCrsr = getShellCrsr( true );
203 [ # # ]: 0 : SET_CURR_SHELL( this );
204 : : // get position in footer
205 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
206 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pTmpCrsr );
207 [ # # ]: 0 : pLower->Calc();
208 : 0 : Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() );
209 [ # # ]: 0 : pLower->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
210 [ # # ][ # # ]: 0 : if( !pTmpCrsr->IsSelOvr() )
211 [ # # ]: 0 : UpdateCrsr();
212 : : else
213 [ # # ][ # # ]: 0 : pFrm = 0;
[ # # ]
214 : : }
215 : : else
216 : 0 : pFrm = 0;
217 : : }
218 : : else
219 : 0 : pFrm = 0;
220 : 0 : return 0 != pFrm;
221 : : }
222 : :
223 : 0 : sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader )
224 : : {
225 : 0 : sal_Bool bRet = sal_False;
226 : 0 : SwDoc *pMyDoc = GetDoc();
227 : :
228 [ # # ]: 0 : SET_CURR_SHELL( this );
229 : :
230 [ # # ]: 0 : if( USHRT_MAX == nDescNo )
231 : : {
232 : : // take the current one
233 [ # # ][ # # ]: 0 : const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm();
234 [ # # ]: 0 : if( pPage )
235 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pMyDoc->GetPageDescCnt(); ++i )
236 [ # # ][ # # ]: 0 : if( pPage->GetPageDesc() == &pMyDoc->GetPageDesc( i ) )
237 : : {
238 : 0 : nDescNo = i;
239 : 0 : break;
240 : : }
241 : : }
242 : :
243 [ # # ][ # # ]: 0 : if( USHRT_MAX != nDescNo && nDescNo < pMyDoc->GetPageDescCnt() )
[ # # ]
244 : : {
245 : : // check if the attribute exists
246 : : const SwPageDesc& rDesc = const_cast<const SwDoc *>(pMyDoc)
247 [ # # ]: 0 : ->GetPageDesc( nDescNo );
248 : 0 : const SwFmtCntnt* pCnt = 0;
249 [ # # ]: 0 : if( bInHeader )
250 : : {
251 : : // mirrored pages? ignore for now
252 [ # # ]: 0 : const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader();
253 [ # # ]: 0 : if( rHd.GetHeaderFmt() )
254 [ # # ]: 0 : pCnt = &rHd.GetHeaderFmt()->GetCntnt();
255 : : }
256 : : else
257 : : {
258 [ # # ]: 0 : const SwFmtFooter& rFt = rDesc.GetMaster().GetFooter();
259 [ # # ]: 0 : if( rFt.GetFooterFmt() )
260 [ # # ]: 0 : pCnt = &rFt.GetFooterFmt()->GetCntnt();
261 : : }
262 : :
263 [ # # ][ # # ]: 0 : if( pCnt && pCnt->GetCntntIdx() )
[ # # ]
264 : : {
265 [ # # ]: 0 : SwNodeIndex aIdx( *pCnt->GetCntntIdx(), 1 );
266 : 0 : SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
267 [ # # ]: 0 : if( !pCNd )
268 [ # # ][ # # ]: 0 : pCNd = pMyDoc->GetNodes().GoNext( &aIdx );
269 : :
270 : : const SwFrm* pFrm;
271 : 0 : Point aPt( pCurCrsr->GetPtPos() );
272 : :
273 [ # # ][ # # ]: 0 : if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ))
[ # # ][ # # ]
[ # # ]
274 : : {
275 : : // then we can set the cursor in here
276 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
277 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
278 : :
279 [ # # ]: 0 : ClearMark();
280 : :
281 : 0 : SwPosition& rPos = *pCurCrsr->GetPoint();
282 [ # # ]: 0 : rPos.nNode = *pCNd;
283 [ # # ][ # # ]: 0 : rPos.nContent.Assign( pCNd, 0 );
284 : :
285 [ # # ]: 0 : bRet = !pCurCrsr->IsSelOvr();
286 [ # # ]: 0 : if( bRet )
287 : : UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
288 [ # # ][ # # ]: 0 : SwCrsrShell::READONLY );
[ # # ]
289 [ # # ]: 0 : }
290 : : }
291 : : }
292 [ # # ]: 0 : return bRet;
293 : : }
294 : :
295 : : /// jump to the next index
296 : 0 : sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName )
297 : : {
298 : 0 : sal_Bool bRet = sal_False;
299 : :
300 : 0 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
301 : 0 : SwCntntNode* pFnd = 0;
302 [ # # ]: 0 : for( sal_uInt16 n = rFmts.size(); n; )
303 : : {
304 : 0 : const SwSection* pSect = rFmts[ --n ]->GetSection();
305 : : const SwSectionNode* pSectNd;
306 [ # # # # ]: 0 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ # # # # ]
[ # # ][ # #
# # # # ]
307 : 0 : 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
308 : 0 : pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() &&
309 : 0 : ( !pFnd || pFnd->GetIndex() > pSectNd->GetIndex() ) &&
310 [ # # ]: 0 : ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
311 : : )
312 : : {
313 [ # # ]: 0 : SwNodeIndex aIdx( *pSectNd, 1 );
314 : 0 : SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
315 [ # # ]: 0 : if( !pCNd )
316 [ # # ][ # # ]: 0 : pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
317 : : const SwCntntFrm* pCFrm;
318 [ # # # # ]: 0 : if( pCNd &&
[ # # ]
[ # # # # ]
[ # # ][ # # ]
319 : 0 : pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
320 [ # # ]: 0 : 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
321 [ # # ]: 0 : ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
322 : : {
323 : 0 : pFnd = pCNd;
324 [ # # ]: 0 : }
325 : : }
326 : : }
327 [ # # ]: 0 : if( pFnd )
328 : : {
329 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
330 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
331 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pFnd;
332 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
333 [ # # ]: 0 : bRet = !pCurCrsr->IsSelOvr();
334 [ # # ]: 0 : if( bRet )
335 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ]
336 : : }
337 : 0 : return bRet;
338 : : }
339 : :
340 : : /// jump to previous index
341 : 0 : sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName )
342 : : {
343 : 0 : sal_Bool bRet = sal_False;
344 : :
345 : 0 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
346 : 0 : SwCntntNode* pFnd = 0;
347 [ # # ]: 0 : for( sal_uInt16 n = rFmts.size(); n; )
348 : : {
349 : 0 : const SwSection* pSect = rFmts[ --n ]->GetSection();
350 : : const SwSectionNode* pSectNd;
351 [ # # # # ]: 0 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ # # # # ]
[ # # ][ # #
# # # # ]
352 : 0 : 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
353 : 0 : pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() &&
354 : 0 : ( !pFnd || pFnd->GetIndex() < pSectNd->GetIndex() ) &&
355 [ # # ]: 0 : ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
356 : : )
357 : : {
358 [ # # ]: 0 : SwNodeIndex aIdx( *pSectNd, 1 );
359 : 0 : SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
360 [ # # ]: 0 : if( !pCNd )
361 [ # # ][ # # ]: 0 : pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
362 : : const SwCntntFrm* pCFrm;
363 [ # # # # ]: 0 : if( pCNd &&
[ # # ]
[ # # # # ]
[ # # ][ # # ]
364 : 0 : pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
365 [ # # ]: 0 : 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
366 [ # # ]: 0 : ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
367 : : {
368 : 0 : pFnd = pCNd;
369 [ # # ]: 0 : }
370 : : }
371 : : }
372 : :
373 [ # # ]: 0 : if( pFnd )
374 : : {
375 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
376 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
377 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pFnd;
378 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
379 [ # # ]: 0 : bRet = !pCurCrsr->IsSelOvr();
380 [ # # ]: 0 : if( bRet )
381 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ]
382 : : }
383 : 0 : return bRet;
384 : : }
385 : :
386 : : /// jump to index of TOXMark
387 : 0 : sal_Bool SwCrsrShell::GotoTOXMarkBase()
388 : : {
389 : 0 : sal_Bool bRet = sal_False;
390 : :
391 [ # # ]: 0 : SwTOXMarks aMarks;
392 [ # # ]: 0 : sal_uInt16 nCnt = GetDoc()->GetCurTOXMark( *pCurCrsr->GetPoint(), aMarks );
393 [ # # ]: 0 : if( nCnt )
394 : : {
395 : : // Take the 1. and get the index type. Search in its dependency list
396 : : // for the actual index
397 : 0 : const SwTOXType* pType = aMarks[0]->GetTOXType();
398 [ # # ]: 0 : SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
399 : : const SwSectionNode* pSectNd;
400 : : const SwSectionFmt* pSectFmt;
401 : :
402 [ # # ][ # # ]: 0 : for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
[ # # ]
403 : : {
404 [ # # ][ # # ]: 0 : if( pTOX->ISA( SwTOXBaseSection ) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
405 : 0 : 0 != ( pSectFmt = ((SwTOXBaseSection*)pTOX)->GetFmt() ) &&
406 : : 0 != ( pSectNd = pSectFmt->GetSectionNode() ))
407 : : {
408 [ # # ]: 0 : SwNodeIndex aIdx( *pSectNd, 1 );
409 : 0 : SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
410 [ # # ]: 0 : if( !pCNd )
411 [ # # ][ # # ]: 0 : pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
412 : : const SwCntntFrm* pCFrm;
413 [ # # # # ]: 0 : if( pCNd &&
[ # # ]
[ # # # # ]
[ # # ][ # # ]
414 : 0 : pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() &&
415 [ # # ]: 0 : 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
416 [ # # ]: 0 : ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
417 : : {
418 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
419 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
420 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pCNd;
421 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
422 [ # # ]: 0 : bRet = !pCurCrsr->IsInProtectTable() &&
423 [ # # ][ # # ]: 0 : !pCurCrsr->IsSelOvr();
[ # # ]
424 [ # # ]: 0 : if( bRet )
425 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
426 [ # # ][ # # ]: 0 : break;
427 [ # # ][ # # ]: 0 : }
428 : : }
429 [ # # ]: 0 : }
430 : : }
431 : 0 : return bRet;
432 : : }
433 : :
434 : : /// Jump to next/previous table formula
435 : : /// Optionally it is possible to also jump to broken formulas
436 : 0 : sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors )
437 : : {
438 [ # # ]: 0 : if( IsTableMode() )
439 : 0 : return sal_False;
440 : :
441 : 0 : sal_Bool bFnd = sal_False;
442 : 0 : SwPosition& rPos = *pCurCrsr->GetPoint();
443 : :
444 : 0 : Point aPt;
445 [ # # ][ # # ]: 0 : SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
446 [ # # ]: 0 : if( !bNext )
447 [ # # ]: 0 : aFndPos.nNode = 0;
448 [ # # ][ # # ]: 0 : _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
449 : :
450 : : {
451 [ # # ]: 0 : const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
452 [ # # ]: 0 : if( pSttNd )
453 : : {
454 [ # # ]: 0 : const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
455 [ # # ]: 0 : GetTblBox( pSttNd->GetIndex() );
456 [ # # ]: 0 : if( pTBox )
457 [ # # ]: 0 : aCurGEF = _SetGetExpFld( *pTBox );
458 : : }
459 : : }
460 : :
461 [ # # ][ # # ]: 0 : if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
[ # # ][ # # ]
462 : : // also at collection use only the first frame
463 [ # # ]: 0 : aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),
464 [ # # ][ # # ]: 0 : &aPt, &rPos, sal_False ) );
465 : : {
466 : : const SfxPoolItem* pItem;
467 : : const SwTableBox* pTBox;
468 [ # # ]: 0 : sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
469 : :
470 [ # # ]: 0 : for( n = 0; n < nMaxItems; ++n )
471 [ # # ][ # # ]: 0 : if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
472 : 0 : RES_BOXATR_FORMULA, n ) ) &&
473 : : 0 != (pTBox = ((SwTblBoxFormula*)pItem)->GetTableBox() ) &&
474 : 0 : pTBox->GetSttNd() &&
475 [ # # ]: 0 : pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
476 : : ( !bOnlyErrors ||
477 [ # # ]: 0 : !((SwTblBoxFormula*)pItem)->HasValidBoxes() ) )
478 : : {
479 : : const SwCntntFrm* pCFrm;
480 [ # # ]: 0 : SwNodeIndex aIdx( *pTBox->GetSttNd() );
481 [ # # ][ # # ]: 0 : const SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
482 [ # # ][ # # ]: 0 : if( pCNd && 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ) &&
[ # # ]
[ # # # # ]
[ # # ][ # # ]
483 [ # # ]: 0 : (IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
484 : : {
485 [ # # ]: 0 : _SetGetExpFld aCmp( *pTBox );
486 [ # # ]: 0 : aCmp.SetBodyPos( *pCFrm );
487 : :
488 [ # # ][ # # ]: 0 : if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
489 [ # # ][ # # ]: 0 : : ( aCmp < aCurGEF && aFndGEF < aCmp ))
490 : : {
491 : 0 : aFndGEF = aCmp;
492 : 0 : bFnd = sal_True;
493 : : }
494 [ # # ]: 0 : }
495 : : }
496 : : }
497 : :
498 [ # # ]: 0 : if( bFnd )
499 : : {
500 [ # # ]: 0 : SET_CURR_SHELL( this );
501 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
502 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
503 : :
504 [ # # ]: 0 : aFndGEF.GetPosOfContent( rPos );
505 [ # # ]: 0 : pCurCrsr->DeleteMark();
506 : :
507 [ # # ]: 0 : bFnd = !pCurCrsr->IsSelOvr();
508 [ # # ]: 0 : if( bFnd )
509 : : UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
510 [ # # ][ # # ]: 0 : SwCrsrShell::READONLY );
[ # # ][ # # ]
511 : : }
512 [ # # ]: 0 : return bFnd;
513 : : }
514 : :
515 : : /// jump to next/previous index marker
516 : 0 : sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext )
517 : : {
518 [ # # ]: 0 : if( IsTableMode() )
519 : 0 : return sal_False;
520 : :
521 : 0 : sal_Bool bFnd = sal_False;
522 : 0 : SwPosition& rPos = *pCurCrsr->GetPoint();
523 : :
524 : 0 : Point aPt;
525 [ # # ][ # # ]: 0 : SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
526 [ # # ]: 0 : if( !bNext )
527 [ # # ]: 0 : aFndPos.nNode = 0;
528 [ # # ][ # # ]: 0 : _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
529 : :
530 [ # # ][ # # ]: 0 : if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
531 : : // also at collection use only the first frame
532 : 0 : aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
533 [ # # # # ]: 0 : GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
[ # # ]
534 : : {
535 : : const SfxPoolItem* pItem;
536 : : const SwCntntFrm* pCFrm;
537 : : const SwTxtNode* pTxtNd;
538 : : const SwTxtTOXMark* pTxtTOX;
539 [ # # ]: 0 : sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
540 : :
541 [ # # ]: 0 : for( n = 0; n < nMaxItems; ++n )
542 [ # # ][ # # ]: 0 : if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ][ # # ]
543 : 0 : RES_TXTATR_TOXMARK, n ) ) &&
544 : : 0 != (pTxtTOX = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
545 [ # # ]: 0 : ( pTxtNd = &pTxtTOX->GetTxtNode())->GetNodes().IsDocNodes() &&
546 [ # # ]: 0 : 0 != ( pCFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False )) &&
547 [ # # ]: 0 : ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
548 : : {
549 [ # # ]: 0 : SwNodeIndex aNdIndex( *pTxtNd ); // UNIX needs this object
550 [ # # ]: 0 : _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 );
551 [ # # ]: 0 : aCmp.SetBodyPos( *pCFrm );
552 : :
553 [ # # ][ # # ]: 0 : if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
554 [ # # ][ # # ]: 0 : : ( aCmp < aCurGEF && aFndGEF < aCmp ))
555 : : {
556 : 0 : aFndGEF = aCmp;
557 : 0 : bFnd = sal_True;
558 [ # # ]: 0 : }
559 : : }
560 : : }
561 : :
562 [ # # ]: 0 : if( bFnd )
563 : : {
564 [ # # ]: 0 : SET_CURR_SHELL( this );
565 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
566 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
567 : :
568 [ # # ]: 0 : aFndGEF.GetPosOfContent( rPos );
569 : :
570 [ # # ]: 0 : bFnd = !pCurCrsr->IsSelOvr();
571 [ # # ]: 0 : if( bFnd )
572 : : UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
573 [ # # ][ # # ]: 0 : SwCrsrShell::READONLY );
[ # # ][ # # ]
574 : : }
575 [ # # ]: 0 : return bFnd;
576 : : }
577 : :
578 : : /// traveling between marks
579 : 0 : const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
580 : : SwTOXSearch eDir )
581 : : {
582 [ # # ]: 0 : SET_CURR_SHELL( this );
583 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
584 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
585 : :
586 : : const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
587 [ # # ]: 0 : IsReadOnlyAvailable() );
588 : : // set position
589 [ # # ]: 0 : SwPosition& rPos = *GetCrsr()->GetPoint();
590 [ # # ]: 0 : rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode();
591 : 0 : rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
592 [ # # ][ # # ]: 0 : *rNewMark.GetTxtTOXMark()->GetStart() );
593 : :
594 [ # # ][ # # ]: 0 : if( !pCurCrsr->IsSelOvr() )
595 : : UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
596 [ # # ]: 0 : SwCrsrShell::READONLY );
597 : :
598 [ # # ][ # # ]: 0 : return rNewMark;
[ # # ]
599 : : }
600 : :
601 : : /// jump to next/previous field type
602 : 0 : void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType,
603 : : sal_uInt16 nSubType, sal_Bool bInReadOnly,
604 : : sal_Bool bChkInpFlag = sal_False )
605 : : {
606 : : // always search the 1. frame
607 : 0 : Point aPt;
608 : : SwTxtFld* pTxtFld;
609 [ # # ]: 0 : SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
610 : 0 : bool bSubType = nSubType != USHRT_MAX;
611 [ # # ][ # # ]: 0 : for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
[ # # ]
612 [ # # ]: 0 : if( 0 != ( pTxtFld = pFmtFld->GetTxtFld() ) &&
[ # # # # ]
[ # # ][ # # ]
[ # # ]
613 : 0 : ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFld().GetFld())
614 : 0 : ->GetInputFlag() ) &&
615 [ # # ]: 0 : (!bSubType || (pFmtFld->GetFld()->GetSubType()
616 : : & 0xff ) == nSubType ))
617 : : {
618 : : SwCntntFrm* pCFrm;
619 : 0 : const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
620 [ # # ][ # # ]: 0 : if( 0 != ( pCFrm = rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False )) &&
[ # # ][ # # ]
[ # # ][ # # ]
621 [ # # ]: 0 : ( bInReadOnly || !pCFrm->IsProtected() ))
622 : : {
623 : : _SetGetExpFld* pNew = new _SetGetExpFld(
624 [ # # ][ # # ]: 0 : SwNodeIndex( rTxtNode ), pTxtFld );
[ # # ][ # # ]
625 [ # # ]: 0 : pNew->SetBodyPos( *pCFrm );
626 [ # # ]: 0 : rLst.insert( pNew );
627 : : }
628 [ # # ]: 0 : }
629 : 0 : }
630 : :
631 : :
632 : 0 : sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
633 : : sal_uInt16 nSubType, sal_uInt16 nResType )
634 : : {
635 : : // sorted list of all fields
636 [ # # ]: 0 : _SetGetExpFlds aSrtLst;
637 : :
638 [ # # ]: 0 : if (pFldType)
639 : : {
640 [ # # ][ # # ]: 0 : if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
[ # # ]
641 : 0 : return sal_False;
642 : :
643 : : // found Modify object, add all fields to array
644 [ # # ]: 0 : ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() );
645 : :
646 [ # # ]: 0 : if( RES_INPUTFLD == pFldType->Which() )
647 : : {
648 : : // there are hidden input fields in the set exp. fields
649 [ # # ]: 0 : const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
650 : 0 : const sal_uInt16 nSize = rFldTypes.size();
651 : :
652 : : // iterate over all types
653 [ # # ]: 0 : for( sal_uInt16 i=0; i < nSize; ++i )
654 [ # # ][ # # ]: 0 : if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() )
655 : : ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
656 [ # # ]: 0 : IsReadOnlyAvailable(), sal_True );
657 : : }
658 : : }
659 : : else
660 : : {
661 [ # # ]: 0 : const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
662 : 0 : const sal_uInt16 nSize = rFldTypes.size();
663 : :
664 : : // iterate over all types
665 [ # # ]: 0 : for( sal_uInt16 i=0; i < nSize; ++i )
666 [ # # ][ # # ]: 0 : if( nResType == ( pFldType = rFldTypes[ i ] )->Which() )
667 : : ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
668 [ # # ]: 0 : IsReadOnlyAvailable() );
669 : : }
670 : :
671 : : // found no fields?
672 [ # # ]: 0 : if( aSrtLst.empty() )
673 : 0 : return sal_False;
674 : :
675 : 0 : _SetGetExpFlds::const_iterator it;
676 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
677 : : {
678 : : // (1998): Always use field for search so that the right one is found as
679 : : // well some are in frames that are anchored to a paragraph that has a
680 : : // field
681 : 0 : const SwPosition& rPos = *pCrsr->GetPoint();
682 : :
683 : 0 : SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
684 : : OSL_ENSURE( pTNd, "No CntntNode" );
685 : :
686 : : SwTxtFld * pTxtFld = static_cast<SwTxtFld *>(
687 : 0 : pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(),
688 [ # # ]: 0 : RES_TXTATR_FIELD));
689 : 0 : sal_Bool bDelFld = 0 == pTxtFld;
690 [ # # ]: 0 : if( bDelFld )
691 : : {
692 : : SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
693 [ # # ][ # # ]: 0 : (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
[ # # ][ # # ]
[ # # ]
694 : :
695 : 0 : pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(),
696 [ # # ][ # # ]: 0 : pDoc->IsClipBoard() );
697 : 0 : pTxtFld->ChgTxtNode( pTNd );
698 : : }
699 : :
700 [ # # ]: 0 : _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent );
701 [ # # ][ # # ]: 0 : if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
702 : : {
703 : : // also at collection use only the first frame
704 : 0 : Point aPt;
705 [ # # ][ # # ]: 0 : aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
[ # # ]
706 : : }
707 : :
708 [ # # ]: 0 : it = aSrtLst.lower_bound( &aSrch );
709 [ # # ]: 0 : if( bDelFld )
710 : : {
711 [ # # ][ # # ]: 0 : delete (SwFmtFld*)&pTxtFld->GetAttr();
712 [ # # ][ # # ]: 0 : delete pTxtFld;
713 : : }
714 : :
715 [ # # ][ # # ]: 0 : if( it != aSrtLst.end() && **it == aSrch ) // found
[ # # ][ # # ]
[ # # # # ]
716 : : {
717 [ # # ]: 0 : if( bNext )
718 : : {
719 [ # # ][ # # ]: 0 : if( ++it == aSrtLst.end() )
720 : 0 : return sal_False; // already at the end
721 : : }
722 : : else
723 : : {
724 [ # # ][ # # ]: 0 : if( it == aSrtLst.begin() )
725 : 0 : return sal_False; // no more steps backward possible
726 : 0 : --it;
727 : : }
728 : : }
729 : : else // not found
730 : : {
731 [ # # ]: 0 : if( bNext )
732 : : {
733 [ # # ][ # # ]: 0 : if( it == aSrtLst.end() )
734 : 0 : return sal_False;
735 : : }
736 : : else
737 : : {
738 [ # # ][ # # ]: 0 : if( it == aSrtLst.begin() )
739 : 0 : return sal_False; // no more steps backward possible
740 : 0 : --it;
741 : : }
742 : : }
743 : : }
744 : 0 : const _SetGetExpFld& rFnd = **it;
745 : :
746 : :
747 [ # # ]: 0 : SET_CURR_SHELL( this );
748 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
749 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
750 : :
751 [ # # ]: 0 : rFnd.GetPosOfContent( *pCrsr->GetPoint() );
752 : : sal_Bool bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
753 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE );
754 [ # # ]: 0 : if( bRet )
755 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
756 [ # # ][ # # ]: 0 : return bRet;
[ # # ][ # # ]
757 : : }
758 : :
759 : :
760 : 0 : sal_Bool SwCrsrShell::GotoFld( const SwFmtFld& rFld )
761 : : {
762 : 0 : sal_Bool bRet = sal_False;
763 [ # # ]: 0 : if( rFld.GetTxtFld() )
764 : : {
765 [ # # ]: 0 : SET_CURR_SHELL( this );
766 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
767 : :
768 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
769 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
770 : :
771 : 0 : SwTxtNode* pTNd = (SwTxtNode*)rFld.GetTxtFld()->GetpTxtNode();
772 [ # # ]: 0 : pCrsr->GetPoint()->nNode = *pTNd;
773 [ # # ][ # # ]: 0 : pCrsr->GetPoint()->nContent.Assign( pTNd, *rFld.GetTxtFld()->GetStart() );
774 : :
775 [ # # ]: 0 : bRet = !pCrsr->IsSelOvr();
776 [ # # ]: 0 : if( bRet )
777 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ][ # # ]
778 : : }
779 : 0 : return bRet;
780 : : }
781 : :
782 : :
783 : 0 : void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
784 : : {
785 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
786 : :
787 [ # # ]: 0 : SET_CURR_SHELL( this );
788 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
789 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
790 : :
791 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
792 [ # # ][ # # ]: 0 : SwTxtNode* pTxtNd = (SwTxtNode*)rNds.GetOutLineNds()[ nIdx ]->GetTxtNode();
793 [ # # ]: 0 : pCrsr->GetPoint()->nNode = *pTxtNd;
794 [ # # ][ # # ]: 0 : pCrsr->GetPoint()->nContent.Assign( pTxtNd, 0 );
795 : :
796 [ # # ][ # # ]: 0 : if( !pCrsr->IsSelOvr() )
797 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ][ # # ]
798 : 0 : }
799 : :
800 : :
801 : 0 : sal_Bool SwCrsrShell::GotoOutline( const String& rName )
802 : : {
803 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
804 : :
805 [ # # ]: 0 : SET_CURR_SHELL( this );
806 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
807 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
808 : :
809 : 0 : sal_Bool bRet = sal_False;
810 [ # # ][ # # ]: 0 : if( pDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() )
[ # # ][ # # ]
[ # # ]
811 : : {
812 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
813 : 0 : bRet = sal_True;
814 : : }
815 [ # # ][ # # ]: 0 : return bRet;
[ # # ]
816 : : }
817 : :
818 : : /// jump to next node with outline num.
819 : 0 : sal_Bool SwCrsrShell::GotoNextOutline()
820 : : {
821 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
822 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
823 : :
824 : 0 : SwNode* pNd = pCrsr->GetNode();
825 : : sal_uInt16 nPos;
826 [ # # ][ # # ]: 0 : if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
[ # # ]
827 : 0 : ++nPos;
828 : :
829 [ # # ][ # # ]: 0 : if( nPos == rNds.GetOutLineNds().size() )
830 : 0 : return sal_False;
831 : :
832 [ # # ][ # # ]: 0 : pNd = rNds.GetOutLineNds()[ nPos ];
833 : :
834 [ # # ]: 0 : SET_CURR_SHELL( this );
835 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
836 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
837 [ # # ]: 0 : pCrsr->GetPoint()->nNode = *pNd;
838 [ # # ][ # # ]: 0 : pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
[ # # ][ # # ]
839 : :
840 [ # # ]: 0 : sal_Bool bRet = !pCrsr->IsSelOvr();
841 [ # # ]: 0 : if( bRet )
842 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
843 [ # # ][ # # ]: 0 : return bRet;
[ # # ]
844 : : }
845 : :
846 : : /// jump to previous node with outline num.
847 : 0 : sal_Bool SwCrsrShell::GotoPrevOutline()
848 : : {
849 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
850 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
851 : :
852 : 0 : SwNode* pNd = pCrsr->GetNode();
853 : : sal_uInt16 nPos;
854 [ # # ][ # # ]: 0 : rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
855 : :
856 : 0 : sal_Bool bRet = sal_False;
857 [ # # ]: 0 : if( nPos )
858 : : {
859 : 0 : --nPos; // before
860 : :
861 [ # # ][ # # ]: 0 : pNd = rNds.GetOutLineNds()[ nPos ];
862 [ # # ]: 0 : if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() )
863 : 0 : return sal_False;
864 : :
865 [ # # ]: 0 : SET_CURR_SHELL( this );
866 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
867 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
868 [ # # ]: 0 : pCrsr->GetPoint()->nNode = *pNd;
869 [ # # ][ # # ]: 0 : pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
[ # # ][ # # ]
870 : :
871 [ # # ]: 0 : bRet = !pCrsr->IsSelOvr();
872 [ # # ]: 0 : if( bRet )
873 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ][ # # ]
874 : : }
875 : 0 : return bRet;
876 : : }
877 : :
878 : : /// search "outline position" before previous outline node at given level
879 : 0 : sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel )
880 : : {
881 [ # # ][ # # ]: 0 : SwPaM* pCrsr = getShellCrsr( true );
882 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
883 : :
884 : 0 : SwNode* pNd = pCrsr->GetNode();
885 : : sal_uInt16 nPos;
886 [ # # ][ # # ]: 0 : if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
[ # # ]
887 : 0 : nPos++; // is at correct position; take next for while
888 : :
889 [ # # ]: 0 : while( nPos-- ) // check the one in front of the current
890 : : {
891 [ # # ][ # # ]: 0 : pNd = rNds.GetOutLineNds()[ nPos ];
892 : :
893 [ # # ][ # # ]: 0 : if( ((SwTxtNode*)pNd)->GetAttrOutlineLevel()-1 <= nLevel )
[ # # ]
894 : 0 : return nPos;
895 : :
896 : : }
897 : 0 : return USHRT_MAX; // no more left
898 : : }
899 : :
900 : :
901 : 0 : sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
902 : : sal_Bool bWithChildren )
903 : : {
904 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
905 [ # # ]: 0 : const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
906 [ # # ]: 0 : if( rOutlNds.empty() )
907 : 0 : return sal_False;
908 : :
909 [ # # ]: 0 : SET_CURR_SHELL( this );
910 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
911 : :
912 [ # # ]: 0 : if( nSttPos > nEndPos ) // parameters switched?
913 : : {
914 : : OSL_ENSURE( !this, "Start > End for array access" );
915 : 0 : sal_uInt16 nTmp = nSttPos;
916 : 0 : nSttPos = nEndPos;
917 : 0 : nEndPos = nTmp;
918 : : }
919 : :
920 [ # # ]: 0 : SwNode* pSttNd = rOutlNds[ nSttPos ];
921 [ # # ]: 0 : SwNode* pEndNd = rOutlNds[ nEndPos ];
922 : :
923 [ # # ]: 0 : if( bWithChildren )
924 : : {
925 [ # # ]: 0 : const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
926 [ # # ]: 0 : for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
927 : : {
928 [ # # ]: 0 : pEndNd = rOutlNds[ nEndPos ];
929 [ # # ]: 0 : const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
930 [ # # ]: 0 : if( nNxtLevel <= nLevel )
931 : 0 : break; // EndPos is now on the next one
932 : : }
933 : : }
934 : : // if without children then set onto next one
935 [ # # ]: 0 : else if( ++nEndPos < rOutlNds.size() )
936 [ # # ]: 0 : pEndNd = rOutlNds[ nEndPos ];
937 : :
938 [ # # ]: 0 : if( nEndPos == rOutlNds.size() ) // no end found
939 : 0 : pEndNd = &rNds.GetEndOfContent();
940 : :
941 [ # # ]: 0 : KillPams();
942 : :
943 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
944 : :
945 : : // set end to the end of the previous content node
946 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pSttNd;
947 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 );
948 [ # # ]: 0 : pCurCrsr->SetMark();
949 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pEndNd;
950 [ # # ]: 0 : pCurCrsr->Move( fnMoveBackward, fnGoNode ); // end of predecessor
951 : :
952 : : // and everything is already selected
953 [ # # ]: 0 : sal_Bool bRet = !pCurCrsr->IsSelOvr();
954 [ # # ]: 0 : if( bRet )
955 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
956 [ # # ][ # # ]: 0 : return bRet;
[ # # ]
957 : : }
958 : :
959 : :
960 : : /// jump to reference marker
961 : 0 : sal_Bool SwCrsrShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType,
962 : : sal_uInt16 nSeqNo )
963 : : {
964 [ # # ]: 0 : SET_CURR_SHELL( this );
965 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
966 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
967 : :
968 : : sal_uInt16 nPos;
969 : : SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
970 [ # # ]: 0 : nSubType, nSeqNo, &nPos );
971 [ # # ][ # # ]: 0 : if( pTxtNd && pTxtNd->GetNodes().IsDocNodes() )
[ # # ][ # # ]
972 : : {
973 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *pTxtNd;
974 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pTxtNd, nPos );
975 : :
976 [ # # ][ # # ]: 0 : if( !pCurCrsr->IsSelOvr() )
977 : : {
978 [ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
979 : 0 : return sal_True;
980 : : }
981 : : }
982 [ # # ][ # # ]: 0 : return sal_False;
[ # # ]
983 : : }
984 : :
985 : 369 : sal_Bool SwCrsrShell::IsPageAtPos( const Point &rPt ) const
986 : : {
987 [ + - ]: 369 : if( GetLayout() )
988 : 369 : return 0 != GetLayout()->GetPageAtPos( rPt );
989 : 369 : return sal_False;
990 : : }
991 : :
992 : 0 : sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
993 : : SwContentAtPos& rCntntAtPos,
994 : : sal_Bool bSetCrsr,
995 : : SwRect* pFldRect )
996 : : {
997 [ # # ]: 0 : SET_CURR_SHELL( this );
998 : 0 : sal_Bool bRet = sal_False;
999 : :
1000 [ # # ]: 0 : if( !IsTableMode() )
1001 : : {
1002 : 0 : Point aPt( rPt );
1003 [ # # ]: 0 : SwPosition aPos( *pCurCrsr->GetPoint() );
1004 : :
1005 : : SwTxtNode* pTxtNd;
1006 : 0 : SwCntntFrm *pFrm(0);
1007 : : SwTxtAttr* pTxtAttr;
1008 : 0 : SwCrsrMoveState aTmpState;
1009 : 0 : aTmpState.bFieldInfo = sal_True;
1010 : 0 : aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos );
1011 [ # # ]: 0 : aTmpState.bCntntCheck = (SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos) ? sal_True : sal_False;
1012 : 0 : aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
1013 : :
1014 : 0 : SwSpecialPos aSpecialPos;
1015 : : aTmpState.pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos ) ?
1016 [ # # ]: 0 : &aSpecialPos : 0;
1017 : :
1018 [ # # ][ # # ]: 0 : const sal_Bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
1019 : 0 : pTxtNd = aPos.nNode.GetNode().GetTxtNode();
1020 : :
1021 [ # # ]: 0 : const SwNodes& rNds = GetDoc()->GetNodes();
1022 [ # # ]: 0 : if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
[ # # # # ]
[ # # ]
1023 [ # # ]: 0 : && !rNds.GetOutLineNds().empty() )
1024 : : {
1025 [ # # ]: 0 : const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
1026 [ # # ]: 0 : if( pONd )
1027 : : {
1028 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
1029 [ # # ][ # # ]: 0 : rCntntAtPos.sStr = pONd->GetExpandTxt( 0, STRING_LEN, true );
[ # # ]
1030 : 0 : bRet = sal_True;
1031 : : }
1032 : : }
1033 : : // #i43742# New function
1034 [ # # ][ # # ]: 0 : else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos &&
1035 : : bCrsrFoundExact )
1036 : : {
1037 : 0 : bRet = sal_True;
1038 : : }
1039 : : // #i23726#
1040 [ # # ][ # # ]: 0 : else if( pTxtNd &&
1041 : : SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
1042 : : {
1043 : 0 : bRet = aTmpState.bInNumPortion;
1044 : 0 : rCntntAtPos.aFnd.pNode = pTxtNd;
1045 : :
1046 : 0 : Size aSizeLogic(aTmpState.nInNumPostionOffset, 0);
1047 [ # # ]: 0 : Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
1048 : 0 : rCntntAtPos.nDist = aSizePixel.Width();
1049 : : }
1050 [ # # ][ # # ]: 0 : else if( bCrsrFoundExact && pTxtNd )
1051 : : {
1052 [ # # ]: 0 : if( !aTmpState.bPosCorr )
1053 : : {
1054 [ # # ][ # # ]: 0 : if( !bRet && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
[ # # ]
1055 : 0 : && !aTmpState.bFtnNoInfo )
1056 : : {
1057 [ # # ]: 0 : const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
1058 : 0 : xub_StrLen nCurrent = aPos.nContent.GetIndex();
1059 : 0 : xub_StrLen nBegin = nCurrent;
1060 : 0 : xub_StrLen nLen = 1;
1061 : :
1062 [ # # ][ # # ]: 0 : if ( pSmartTagList && pSmartTagList->InWrongWord( nCurrent, nLen ) && !pTxtNd->IsSymbol(nBegin) )
[ # # ][ # # ]
[ # # ][ # # ]
1063 : : {
1064 [ # # ]: 0 : const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
1065 [ # # ]: 0 : const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
1066 [ # # ]: 0 : if ( pSubList )
1067 : : {
1068 : 0 : nCurrent = aTmpState.pSpecialPos->nCharOfst;
1069 : :
1070 [ # # ][ # # ]: 0 : if ( pSubList->InWrongWord( nCurrent, nLen ) )
1071 : 0 : bRet = sal_True;
1072 : : }
1073 : : else
1074 : 0 : bRet = sal_True;
1075 : :
1076 [ # # ][ # # ]: 0 : if( bRet && bSetCrsr )
1077 : : {
1078 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1079 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1080 [ # # ]: 0 : pCurCrsr->DeleteMark();
1081 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1082 [ # # ]: 0 : if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
1083 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
1084 : 0 : bRet = sal_False;
1085 : : else
1086 [ # # ][ # # ]: 0 : UpdateCrsr();
[ # # ]
1087 : : }
1088 [ # # ]: 0 : if( bRet )
1089 : : {
1090 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
1091 : :
1092 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1093 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1094 : : }
1095 : : }
1096 : : }
1097 : :
1098 [ # # ][ # # ]: 0 : if( !bRet && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
[ # # ]
1099 : 0 : & rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
1100 : : {
1101 : : pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
1102 [ # # ]: 0 : aPos.nContent.GetIndex(), RES_TXTATR_FIELD );
1103 : : const SwField* pFld = pTxtAttr
1104 : 0 : ? pTxtAttr->GetFld().GetFld()
1105 [ # # ]: 0 : : 0;
1106 [ # # ][ # # ]: 0 : if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos &&
[ # # ][ # # ]
1107 [ # # ]: 0 : pFld && !pFld->HasClickHdl() )
1108 : 0 : pFld = 0;
1109 : :
1110 [ # # ]: 0 : if( pFld )
1111 : : {
1112 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1113 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1114 : :
1115 [ # # ]: 0 : if( bSetCrsr )
1116 : : {
1117 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1118 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1119 [ # # ]: 0 : pCurCrsr->DeleteMark();
1120 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1121 [ # # ][ # # ]: 0 : if( pCurCrsr->IsSelOvr() )
1122 : : {
1123 : : // allow click fields in protected sections
1124 : : // only placeholder is not possible
1125 [ # # # # ]: 0 : if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
[ # # ]
1126 : 0 : || RES_JUMPEDITFLD == pFld->Which() )
1127 : 0 : pFld = 0;
1128 : : }
1129 : : else
1130 [ # # ][ # # ]: 0 : UpdateCrsr();
[ # # ]
1131 : : }
1132 [ # # # # ]: 0 : else if( RES_TABLEFLD == pFld->Which() &&
[ # # ]
1133 : 0 : ((SwTblField*)pFld)->IsIntrnlName() )
1134 : : {
1135 : : // create from internal (for CORE) the external
1136 : : // (for UI) formula
1137 [ # # ]: 0 : const SwTableNode* pTblNd = pTxtNd->FindTableNode();
1138 [ # # ]: 0 : if( pTblNd ) // steht in einer Tabelle
1139 [ # # ]: 0 : ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
1140 : : }
1141 : : }
1142 : :
1143 [ # # ]: 0 : if( pFld )
1144 : : {
1145 : 0 : rCntntAtPos.aFnd.pFld = pFld;
1146 : 0 : rCntntAtPos.pFndTxtAttr = pTxtAttr;
1147 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
1148 : 0 : bRet = sal_True;
1149 : : }
1150 : : }
1151 : :
1152 [ # # ][ # # ]: 0 : if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
1153 : : {
1154 [ # # ]: 0 : IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
1155 [ # # ]: 0 : sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
1156 [ # # ][ # # ]: 0 : if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
[ # # ]
1157 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
1158 : 0 : rCntntAtPos.aFnd.pFldmark = pFldBookmark;
1159 : 0 : bRet=sal_True;
1160 : : }
1161 : : }
1162 : :
1163 [ # # ][ # # ]: 0 : if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
1164 : : {
1165 [ # # ]: 0 : if( aTmpState.bFtnNoInfo )
1166 : : {
1167 : : // over the footnote's char
1168 : 0 : bRet = sal_True;
1169 [ # # ]: 0 : if( bSetCrsr )
1170 : : {
1171 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1172 [ # # ][ # # ]: 0 : if( !GotoFtnAnchor() )
1173 : 0 : bRet = sal_False;
1174 : : }
1175 [ # # ]: 0 : if( bRet )
1176 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
1177 : : }
1178 [ # # ][ # # ]: 0 : else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
1179 : 0 : aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
1180 : : {
1181 : 0 : bRet = sal_True;
1182 [ # # ]: 0 : if( bSetCrsr )
1183 : : {
1184 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1185 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1186 [ # # ]: 0 : pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
1187 [ # # ]: 0 : SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
1188 : 0 : &pCurCrsr->GetPoint()->nNode,
1189 [ # # ]: 0 : sal_True, !IsReadOnlyAvailable() );
1190 : :
1191 [ # # ]: 0 : if( pCNd )
1192 : : {
1193 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
1194 [ # # ]: 0 : if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
1195 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
1196 : 0 : bRet = sal_False;
1197 : : else
1198 [ # # ]: 0 : UpdateCrsr();
1199 : : }
1200 : : else
1201 [ # # ][ # # ]: 0 : bRet = sal_False;
1202 : : }
1203 : :
1204 [ # # ]: 0 : if( bRet )
1205 : : {
1206 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
1207 : 0 : rCntntAtPos.pFndTxtAttr = pTxtAttr;
1208 : 0 : rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
1209 : :
1210 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1211 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1212 : : }
1213 : : }
1214 : : }
1215 : :
1216 [ # # ][ # # ]: 0 : if( !bRet && ( SwContentAtPos::SW_TOXMARK |
[ # # ]
1217 : : SwContentAtPos::SW_REFMARK ) &
1218 : 0 : rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
1219 : : {
1220 : 0 : pTxtAttr = 0;
1221 [ # # ]: 0 : if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
1222 : : {
1223 : : ::std::vector<SwTxtAttr *> const marks(
1224 : : pTxtNd->GetTxtAttrsAt(
1225 [ # # ]: 0 : aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
1226 [ # # ]: 0 : if (marks.size())
1227 : : { // hmm... can only return 1 here
1228 : 0 : pTxtAttr = *marks.begin();
1229 : 0 : }
1230 : : }
1231 : :
1232 [ # # ][ # # ]: 0 : if( !pTxtAttr &&
1233 : : SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
1234 : : {
1235 : : ::std::vector<SwTxtAttr *> const marks(
1236 : : pTxtNd->GetTxtAttrsAt(
1237 [ # # ]: 0 : aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
1238 [ # # ]: 0 : if (marks.size())
1239 : : { // hmm... can only return 1 here
1240 : 0 : pTxtAttr = *marks.begin();
1241 : 0 : }
1242 : : }
1243 : :
1244 [ # # ]: 0 : if( pTxtAttr )
1245 : : {
1246 : 0 : bRet = sal_True;
1247 [ # # ]: 0 : if( bSetCrsr )
1248 : : {
1249 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1250 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1251 [ # # ]: 0 : pCurCrsr->DeleteMark();
1252 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1253 [ # # ]: 0 : if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
1254 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
1255 : 0 : bRet = sal_False;
1256 : : else
1257 [ # # ][ # # ]: 0 : UpdateCrsr();
[ # # ]
1258 : : }
1259 : :
1260 [ # # ]: 0 : if( bRet )
1261 : : {
1262 [ # # ]: 0 : const xub_StrLen* pEnd = pTxtAttr->GetEnd();
1263 [ # # ]: 0 : if( pEnd )
1264 : : rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
1265 : 0 : *pTxtAttr->GetStart(),
1266 [ # # ][ # # ]: 0 : *pEnd - *pTxtAttr->GetStart() );
[ # # ]
1267 [ # # ][ # # ]: 0 : else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
1268 : 0 : rCntntAtPos.sStr = pTxtAttr->GetTOXMark().
1269 [ # # ]: 0 : GetAlternativeText();
1270 : :
1271 : : rCntntAtPos.eCntntAtPos =
1272 [ # # ]: 0 : RES_TXTATR_TOXMARK == pTxtAttr->Which()
1273 : : ? SwContentAtPos::SW_TOXMARK
1274 [ # # ]: 0 : : SwContentAtPos::SW_REFMARK;
1275 : 0 : rCntntAtPos.pFndTxtAttr = pTxtAttr;
1276 : 0 : rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
1277 : :
1278 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1279 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1280 : : }
1281 : : }
1282 : : }
1283 : :
1284 [ # # ][ # # ]: 0 : if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
[ # # ]
1285 : 0 : && !aTmpState.bFtnNoInfo )
1286 : : {
1287 : : pTxtAttr = pTxtNd->GetTxtAttrAt(
1288 [ # # ]: 0 : aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
1289 : : // "detect" only INetAttrs with URLs
1290 [ # # ][ # # ]: 0 : if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
[ # # ]
1291 : : {
1292 : 0 : bRet = sal_True;
1293 [ # # ]: 0 : if( bSetCrsr )
1294 : : {
1295 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1296 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1297 [ # # ]: 0 : pCurCrsr->DeleteMark();
1298 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1299 [ # # ]: 0 : if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
1300 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
1301 : 0 : bRet = sal_False;
1302 : : else
1303 [ # # ][ # # ]: 0 : UpdateCrsr();
[ # # ]
1304 : : }
1305 [ # # ]: 0 : if( bRet )
1306 : : {
1307 : : rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
1308 : 0 : *pTxtAttr->GetStart(),
1309 [ # # ][ # # ]: 0 : *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
[ # # ][ # # ]
1310 : :
1311 : 0 : rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
1312 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
1313 : 0 : rCntntAtPos.pFndTxtAttr = pTxtAttr;
1314 : :
1315 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1316 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1317 : : }
1318 : : }
1319 : : }
1320 : :
1321 [ # # ][ # # ]: 0 : if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
1322 : : {
1323 [ # # ]: 0 : const SwRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
1324 [ # # ]: 0 : if( pRedl )
1325 : : {
1326 : 0 : rCntntAtPos.aFnd.pRedl = pRedl;
1327 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
1328 : 0 : rCntntAtPos.pFndTxtAttr = 0;
1329 : 0 : bRet = sal_True;
1330 : :
1331 [ # # ][ # # ]: 0 : if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
[ # # ][ # # ]
[ # # ]
1332 [ # # ]: 0 : pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1333 : : }
1334 : : }
1335 : : }
1336 : :
1337 [ # # ][ # # ]: 0 : if( !bRet && (
1338 : : SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
1339 : : #ifdef DBG_UTIL
1340 : : || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
1341 : : #endif
1342 : : ))
1343 : : {
1344 : : const SwTableNode* pTblNd;
1345 : : const SwTableBox* pBox;
1346 [ # # ]: 0 : const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
1347 : : const SfxPoolItem* pItem;
1348 [ # # ][ # # ]: 0 : if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
[ # # # # ]
[ # # ][ # # ]
[ # # ]
1349 : 0 : 0 != ( pBox = pTblNd->GetTable().GetTblBox(
1350 : 0 : pSttNd->GetIndex() )) &&
1351 : : #ifdef DBG_UTIL
1352 : : ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
1353 : : RES_BOXATR_FORMULA, sal_False, &pItem ) ||
1354 : : SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
1355 : : RES_BOXATR_VALUE, sal_False, &pItem ))
1356 : : #else
1357 : 0 : SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
1358 [ # # ]: 0 : RES_BOXATR_FORMULA, sal_False, &pItem )
1359 : : #endif
1360 : : )
1361 : : {
1362 [ # # ][ # # ]: 0 : SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
1363 [ # # ]: 0 : if( pF )
1364 : : {
1365 : : // then the CellFrame
1366 : 0 : pFrm = (SwCntntFrm*)pF;
1367 [ # # ][ # # ]: 0 : while( pF && !pF->IsCellFrm() )
[ # # ]
1368 : 0 : pF = pF->GetUpper();
1369 : : }
1370 : :
1371 [ # # ]: 0 : if( aTmpState.bPosCorr )
1372 : : {
1373 [ # # ][ # # ]: 0 : if( pF && !pF->Frm().IsInside( aPt ))
[ # # ][ # # ]
1374 : 0 : pF = 0;
1375 : : }
1376 [ # # ]: 0 : else if( !pF )
1377 : 0 : pF = pFrm;
1378 : :
1379 [ # # ]: 0 : if( pF ) // only then it is valid
1380 : : {
1381 : : // create from internal (for CORE) the external
1382 : : // (for UI) formula
1383 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
1384 : : #ifdef DBG_UTIL
1385 : : if( RES_BOXATR_VALUE == pItem->Which() )
1386 : : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
1387 : : else
1388 : : #endif
1389 [ # # ]: 0 : ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
1390 : :
1391 : 0 : bRet = sal_True;
1392 [ # # ]: 0 : if( bSetCrsr )
1393 : : {
1394 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1395 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1396 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1397 [ # # ]: 0 : if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
1398 [ # # ]: 0 : nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
1399 : 0 : bRet = sal_False;
1400 : : else
1401 [ # # ][ # # ]: 0 : UpdateCrsr();
[ # # ]
1402 : : }
1403 : :
1404 [ # # ]: 0 : if( bRet )
1405 : : {
1406 [ # # ]: 0 : if( pFldRect )
1407 : : {
1408 : 0 : *pFldRect = pF->Prt();
1409 : 0 : *pFldRect += pF->Frm().Pos();
1410 : : }
1411 : 0 : rCntntAtPos.pFndTxtAttr = 0;
1412 : 0 : rCntntAtPos.aFnd.pAttr = pItem;
1413 : : }
1414 : : }
1415 : : }
1416 : : }
1417 : :
1418 : : #ifdef DBG_UTIL
1419 : : if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
1420 : : {
1421 : : xub_StrLen n = aPos.nContent.GetIndex();
1422 : : SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
1423 : : POOLATTR_END - 1 );
1424 : : if( pTxtNd->GetpSwpHints() )
1425 : : {
1426 : : for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
1427 : : {
1428 : : const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
1429 : : xub_StrLen nAttrStart = *pHt->GetStart();
1430 : : if( nAttrStart > n ) // over the section
1431 : : break;
1432 : :
1433 : : if( 0 != pHt->GetEnd() && (
1434 : : ( nAttrStart < n &&
1435 : : ( pHt->DontExpand() ? n < *pHt->GetEnd()
1436 : : : n <= *pHt->GetEnd() )) ||
1437 : : ( n == nAttrStart &&
1438 : : ( nAttrStart == *pHt->GetEnd() || !n ))) )
1439 : : {
1440 : : aSet.Put( pHt->GetAttr() );
1441 : : }
1442 : : }
1443 : : if( pTxtNd->HasSwAttrSet() &&
1444 : : pTxtNd->GetpSwAttrSet()->Count() )
1445 : : {
1446 : : SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
1447 : : // remove all from format set that are also in TextSet
1448 : : aFmtSet.Differentiate( aSet );
1449 : : // now merge all together
1450 : : aSet.Put( aFmtSet );
1451 : : }
1452 : : }
1453 : : else
1454 : : pTxtNd->SwCntntNode::GetAttr( aSet );
1455 : :
1456 : : rCntntAtPos.sStr.AssignAscii(
1457 : : RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
1458 : : rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
1459 : : rCntntAtPos.sStr += ':';
1460 : : rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
1461 : : rCntntAtPos.sStr += ')';
1462 : : rCntntAtPos.sStr.AppendAscii(
1463 : : RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " )); // translation *might be* "paragraph template"
1464 : : rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
1465 : : if( pTxtNd->GetCondFmtColl() )
1466 : : rCntntAtPos.sStr.AppendAscii(
1467 : : RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " )) // translation *might be* "conditional template"
1468 : : += pTxtNd->GetCondFmtColl()->GetName();
1469 : :
1470 : : if( aSet.Count() )
1471 : : {
1472 : : String sAttrs;
1473 : : SfxItemIter aIter( aSet );
1474 : : const SfxPoolItem* pItem = aIter.FirstItem();
1475 : : while( sal_True )
1476 : : {
1477 : : if( !IsInvalidItem( pItem ))
1478 : : {
1479 : : String aStr;
1480 : : GetDoc()->GetAttrPool().GetPresentation( *pItem,
1481 : : SFX_ITEM_PRESENTATION_COMPLETE,
1482 : : SFX_MAPUNIT_CM, aStr );
1483 : : if( sAttrs.Len() )
1484 : : sAttrs.AppendAscii(
1485 : : RTL_CONSTASCII_STRINGPARAM( ", " ));
1486 : : sAttrs += aStr;
1487 : : }
1488 : : if( aIter.IsAtEnd() )
1489 : : break;
1490 : : pItem = aIter.NextItem();
1491 : : }
1492 : : if( sAttrs.Len() )
1493 : : {
1494 : : if( rCntntAtPos.sStr.Len() )
1495 : : rCntntAtPos.sStr += '\n';
1496 : : rCntntAtPos.sStr.AppendAscii(
1497 : : RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
1498 : : += sAttrs;
1499 : : }
1500 : : }
1501 : : bRet = sal_True;
1502 : : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
1503 : : }
1504 : : #endif
1505 [ # # ]: 0 : }
1506 : : }
1507 : :
1508 [ # # ]: 0 : if( !bRet )
1509 : : {
1510 : 0 : rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
1511 : 0 : rCntntAtPos.aFnd.pFld = 0;
1512 : : }
1513 [ # # ]: 0 : return bRet;
1514 : : }
1515 : :
1516 : : // #i90516#
1517 : 19573 : const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
1518 : : {
1519 : 19573 : const SwPostItField* pPostItFld = 0;
1520 : :
1521 [ + + ]: 19573 : if ( !IsTableMode() )
1522 : : {
1523 : 19557 : const SwPosition* pCursorPos = _GetCrsr()->GetPoint();
1524 : 19557 : const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
1525 [ + - ]: 19557 : if ( pTxtNd )
1526 : : {
1527 : : SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
1528 : 19557 : pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD );
1529 [ + + ]: 19557 : const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
1530 [ + + ][ - + ]: 19557 : if ( pFld && pFld->Which()== RES_POSTITFLD )
[ - + ]
1531 : : {
1532 : 0 : pPostItFld = static_cast<const SwPostItField*>(pFld);
1533 : : }
1534 : : }
1535 : : }
1536 : :
1537 : 19573 : return pPostItFld;
1538 : : }
1539 : :
1540 : : /// is the node in a protected section?
1541 : 0 : sal_Bool SwContentAtPos::IsInProtectSect() const
1542 : : {
1543 : 0 : const SwTxtNode* pNd = 0;
1544 [ # # ]: 0 : if( pFndTxtAttr )
1545 : : {
1546 [ # # # # ]: 0 : switch( eCntntAtPos )
1547 : : {
1548 : : case SW_FIELD:
1549 : : case SW_CLICKFIELD:
1550 : 0 : pNd = ((SwTxtFld*)pFndTxtAttr)->GetpTxtNode();
1551 : 0 : break;
1552 : :
1553 : : case SW_FTN:
1554 : 0 : pNd = &((SwTxtFtn*)pFndTxtAttr)->GetTxtNode();
1555 : 0 : break;
1556 : :
1557 : : case SW_INETATTR:
1558 : 0 : pNd = ((SwTxtINetFmt*)pFndTxtAttr)->GetpTxtNode();
1559 : 0 : break;
1560 : :
1561 : : default:
1562 : 0 : break;
1563 : : }
1564 : : }
1565 : :
1566 : : const SwCntntFrm* pFrm;
1567 : 0 : return pNd && ( pNd->IsInProtectSect() ||
1568 : 0 : ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), 0,0,sal_False)) &&
1569 [ # # # # : 0 : pFrm->IsProtected() ));
# # ][ # # ]
1570 : : }
1571 : :
1572 : 0 : bool SwContentAtPos::IsInRTLText()const
1573 : : {
1574 : 0 : bool bRet = false;
1575 : 0 : const SwTxtNode* pNd = 0;
1576 [ # # ][ # # ]: 0 : if (pFndTxtAttr && (eCntntAtPos == SW_FTN))
1577 : : {
1578 : 0 : const SwTxtFtn* pTxtFtn = static_cast<const SwTxtFtn*>(pFndTxtAttr);
1579 [ # # ]: 0 : if(pTxtFtn->GetStartNode())
1580 : : {
1581 : 0 : SwStartNode* pSttNd = pTxtFtn->GetStartNode()->GetNode().GetStartNode();
1582 [ # # ]: 0 : SwPaM aTemp( *pSttNd );
1583 [ # # ]: 0 : aTemp.Move(fnMoveForward, fnGoNode);
1584 : 0 : SwCntntNode* pCntntNode = aTemp.GetCntntNode();
1585 [ # # ][ # # ]: 0 : if(pCntntNode && pCntntNode->IsTxtNode())
[ # # ]
1586 [ # # ]: 0 : pNd = static_cast<SwTxtNode*>(pCntntNode);
1587 : : }
1588 : : }
1589 [ # # ]: 0 : if(pNd)
1590 : : {
1591 [ # # ]: 0 : SwIterator<SwTxtFrm,SwTxtNode> aIter(*pNd);
1592 [ # # ]: 0 : SwTxtFrm* pTmpFrm = aIter.First();
1593 [ # # ]: 0 : while( pTmpFrm )
1594 : : {
1595 [ # # ]: 0 : if ( !pTmpFrm->IsFollow())
1596 : : {
1597 [ # # ]: 0 : bRet = pTmpFrm->IsRightToLeft();
1598 : 0 : break;
1599 : : }
1600 [ # # ]: 0 : pTmpFrm = aIter.Next();
1601 [ # # ]: 0 : }
1602 : : }
1603 : 0 : return bRet;
1604 : : }
1605 : :
1606 : 0 : sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand,
1607 : : const SwTxtAttr* pTxtAttr )
1608 : : {
1609 [ # # ]: 0 : SET_CURR_SHELL( this );
1610 : 0 : sal_Bool bRet = sal_False;
1611 : :
1612 [ # # ]: 0 : if( !IsTableMode() )
1613 : : {
1614 : 0 : SwPosition& rPos = *pCurCrsr->GetPoint();
1615 [ # # ]: 0 : if( !pTxtAttr )
1616 : : {
1617 : 0 : SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
1618 : : pTxtAttr = (pTxtNd)
1619 : 0 : ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
1620 : : static_cast<RES_TXTATR>(nWhich),
1621 [ # # ]: 0 : (bExpand) ? SwTxtNode::EXPAND : SwTxtNode::DEFAULT)
1622 [ # # # # ]: 0 : : 0;
1623 : : }
1624 : :
1625 [ # # ]: 0 : if( pTxtAttr )
1626 : : {
1627 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1628 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1629 : :
1630 [ # # ]: 0 : pCurCrsr->DeleteMark();
1631 [ # # ]: 0 : rPos.nContent = *pTxtAttr->GetStart();
1632 [ # # ]: 0 : pCurCrsr->SetMark();
1633 [ # # ]: 0 : const xub_StrLen* pEnd = pTxtAttr->GetEnd();
1634 [ # # ][ # # ]: 0 : rPos.nContent = pEnd ? *pEnd : *pTxtAttr->GetStart() + 1;
1635 : :
1636 [ # # ][ # # ]: 0 : if( !pCurCrsr->IsSelOvr() )
1637 : : {
1638 [ # # ]: 0 : UpdateCrsr();
1639 : 0 : bRet = sal_True;
1640 [ # # ][ # # ]: 0 : }
1641 : : }
1642 : : }
1643 [ # # ]: 0 : return bRet;
1644 : : }
1645 : :
1646 : :
1647 : 0 : sal_Bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
1648 : : {
1649 : 0 : sal_Bool bRet = sal_False;
1650 [ # # ]: 0 : if( rAttr.GetpTxtNode() )
1651 : : {
1652 [ # # ][ # # ]: 0 : SwCursor* pCrsr = getShellCrsr( true );
1653 : :
1654 [ # # ]: 0 : SET_CURR_SHELL( this );
1655 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1656 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCrsr );
1657 : :
1658 [ # # ]: 0 : pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
1659 : 0 : pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
1660 [ # # ][ # # ]: 0 : *rAttr.GetStart() );
1661 [ # # ]: 0 : bRet = !pCrsr->IsSelOvr();
1662 [ # # ]: 0 : if( bRet )
1663 [ # # ][ # # ]: 0 : UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
[ # # ][ # # ]
1664 : : }
1665 : 0 : return bRet;
1666 : : }
1667 : :
1668 : :
1669 : 0 : const SwFmtINetFmt* SwCrsrShell::FindINetAttr( const String& rName ) const
1670 : : {
1671 : 0 : return pDoc->FindINetAttr( rName );
1672 : : }
1673 : :
1674 : 0 : sal_Bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
1675 : : SwRect& rRect, sal_Int16& rOrient )
1676 : : {
1677 : :
1678 [ # # ]: 0 : SET_CURR_SHELL( this );
1679 : 0 : sal_Bool bRet = sal_False;
1680 : :
1681 [ # # ][ # # ]: 0 : if (!IsTableMode() && !HasSelection()
[ # # ][ # # ]
[ # # ]
1682 [ # # ][ # # ]: 0 : && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1683 : : {
1684 : 0 : Point aPt( rPt );
1685 [ # # ]: 0 : SwPosition aPos( *pCurCrsr->GetPoint() );
1686 : :
1687 : 0 : SwFillCrsrPos aFPos( eFillMode );
1688 : 0 : SwCrsrMoveState aTmpState( &aFPos );
1689 : :
1690 [ # # ][ # # ]: 0 : if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) &&
[ # # ][ # # ]
[ # # ]
1691 [ # # ]: 0 : !aPos.nNode.GetNode().IsProtect())
1692 : : {
1693 : : // start position in protected section?
1694 : 0 : rRect = aFPos.aCrsr;
1695 : 0 : rOrient = aFPos.eOrient;
1696 : 0 : bRet = sal_True;
1697 [ # # ]: 0 : }
1698 : : }
1699 [ # # ]: 0 : return bRet;
1700 : : }
1701 : :
1702 : 0 : sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
1703 : : {
1704 [ # # ]: 0 : SET_CURR_SHELL( this );
1705 : 0 : sal_Bool bRet = sal_False;
1706 : :
1707 [ # # ][ # # ]: 0 : if (!IsTableMode() && !HasSelection()
[ # # ][ # # ]
[ # # ]
1708 [ # # ][ # # ]: 0 : && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1709 : : {
1710 : 0 : Point aPt( rPt );
1711 [ # # ]: 0 : SwPosition aPos( *pCurCrsr->GetPoint() );
1712 : :
1713 : 0 : SwFillCrsrPos aFPos( eFillMode );
1714 : 0 : SwCrsrMoveState aTmpState( &aFPos );
1715 : :
1716 [ # # ][ # # ]: 0 : if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) )
[ # # ]
1717 : : {
1718 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1719 [ # # ]: 0 : StartAction();
1720 : :
1721 : 0 : SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
1722 : 0 : SwUndoId nUndoId = UNDO_INS_FROM_SHADOWCRSR;
1723 : : // If only the paragraph attributes "Adjust" or "LRSpace" are set,
1724 : : // then the following should not delete those again.
1725 [ # # ][ # # ]: 0 : if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1726 : : ( FILL_INDENT == aFPos.eMode ||
1727 : : ( text::HoriOrientation::NONE != aFPos.eOrient &&
1728 : : 0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
1729 [ # # ]: 0 : pCNd && pCNd->Len() )
1730 : 0 : nUndoId = UNDO_EMPTY;
1731 : :
1732 [ # # ][ # # ]: 0 : GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL );
1733 : :
1734 : 0 : SwTxtFmtColl* pNextFmt = 0;
1735 : 0 : SwTxtNode* pTNd = pCNd->GetTxtNode();
1736 [ # # ]: 0 : if( pTNd )
1737 : 0 : pNextFmt = &pTNd->GetTxtColl()->GetNextTxtFmtColl();
1738 : :
1739 [ # # ]: 0 : const SwSectionNode* pSectNd = pCNd->FindSectionNode();
1740 [ # # ][ # # ]: 0 : if( pSectNd && aFPos.nParaCnt )
1741 : : {
1742 [ # # ]: 0 : SwNodeIndex aEnd( aPos.nNode, 1 );
1743 [ # # # # ]: 0 : while( aEnd.GetNode().IsEndNode() &&
[ # # ]
1744 : 0 : (const SwNode*)&aEnd.GetNode() !=
1745 : 0 : pSectNd->EndOfSectionNode() )
1746 [ # # ]: 0 : aEnd++;
1747 : :
1748 [ # # # # ]: 0 : if( aEnd.GetNode().IsEndNode() &&
[ # # ]
1749 [ # # ]: 0 : pCNd->Len() == aPos.nContent.GetIndex() )
1750 [ # # ][ # # ]: 0 : aPos.nNode = *pSectNd->EndOfSectionNode();
1751 : : }
1752 : :
1753 [ # # ]: 0 : for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
1754 : : {
1755 [ # # ]: 0 : GetDoc()->AppendTxtNode( aPos );
1756 [ # # ][ # # ]: 0 : if( !n && pNextFmt )
1757 : : {
1758 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1759 [ # # ]: 0 : GetDoc()->SetTxtFmtColl( *pCurCrsr, pNextFmt, false );
1760 : : }
1761 [ # # ]: 0 : if( n < aFPos.nColumnCnt )
1762 : : {
1763 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1764 : 0 : GetDoc()->InsertPoolItem( *pCurCrsr,
1765 [ # # ][ # # ]: 0 : SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
[ # # ]
1766 : : }
1767 : : }
1768 : :
1769 [ # # ]: 0 : *pCurCrsr->GetPoint() = aPos;
1770 [ # # # # ]: 0 : switch( aFPos.eMode )
1771 : : {
1772 : : case FILL_INDENT:
1773 [ # # ]: 0 : if( 0 != (pCNd = aPos.nNode.GetNode().GetCntntNode() ))
1774 : : {
1775 : 0 : SfxItemSet aSet( GetDoc()->GetAttrPool(),
1776 : : RES_LR_SPACE, RES_LR_SPACE,
1777 : : RES_PARATR_ADJUST, RES_PARATR_ADJUST,
1778 [ # # ]: 0 : 0 );
1779 : : SvxLRSpaceItem aLR( (SvxLRSpaceItem&)
1780 [ # # ][ # # ]: 0 : pCNd->GetAttr( RES_LR_SPACE ) );
1781 [ # # ]: 0 : aLR.SetTxtLeft( aFPos.nTabCnt );
1782 [ # # ]: 0 : aLR.SetTxtFirstLineOfst( 0 );
1783 [ # # ]: 0 : aSet.Put( aLR );
1784 : :
1785 : : const SvxAdjustItem& rAdj = (SvxAdjustItem&)pCNd->
1786 [ # # ]: 0 : GetAttr( RES_PARATR_ADJUST );
1787 [ # # ]: 0 : if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
1788 [ # # ][ # # ]: 0 : aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
[ # # ]
1789 : :
1790 [ # # ][ # # ]: 0 : GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 );
[ # # ]
1791 : : }
1792 : : else {
1793 : : OSL_ENSURE( !this, "No CntntNode" );
1794 : : }
1795 : 0 : break;
1796 : :
1797 : : case FILL_TAB:
1798 : : case FILL_SPACE:
1799 : : {
1800 [ # # ]: 0 : String sInsert;
1801 [ # # ]: 0 : if( aFPos.nTabCnt )
1802 [ # # ]: 0 : sInsert.Fill( aFPos.nTabCnt, '\t' );
1803 [ # # ]: 0 : if( aFPos.nSpaceCnt )
1804 : : {
1805 [ # # ]: 0 : String sSpace;
1806 [ # # ]: 0 : sSpace.Fill( aFPos.nSpaceCnt );
1807 [ # # ][ # # ]: 0 : sInsert += sSpace;
1808 : : }
1809 [ # # ]: 0 : if( sInsert.Len() )
1810 : : {
1811 [ # # ]: 0 : GetDoc()->InsertString( *pCurCrsr, sInsert );
1812 [ # # ]: 0 : }
1813 : : }
1814 : : // no break - still need to set orientation
1815 : : case FILL_MARGIN:
1816 [ # # ]: 0 : if( text::HoriOrientation::NONE != aFPos.eOrient )
1817 : : {
1818 [ # # ]: 0 : SvxAdjustItem aAdj( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
1819 [ # # # ]: 0 : switch( aFPos.eOrient )
1820 : : {
1821 : : case text::HoriOrientation::CENTER:
1822 : 0 : aAdj.SetAdjust( SVX_ADJUST_CENTER );
1823 : 0 : break;
1824 : : case text::HoriOrientation::RIGHT:
1825 : 0 : aAdj.SetAdjust( SVX_ADJUST_RIGHT );
1826 : 0 : break;
1827 : : default:
1828 : 0 : break;
1829 : : }
1830 [ # # ][ # # ]: 0 : GetDoc()->InsertPoolItem( *pCurCrsr, aAdj, 0 );
1831 : : }
1832 : 0 : break;
1833 : : }
1834 : :
1835 [ # # ][ # # ]: 0 : GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL );
1836 [ # # ]: 0 : EndAction();
1837 : :
1838 [ # # ]: 0 : bRet = sal_True;
1839 [ # # ]: 0 : }
1840 : : }
1841 [ # # ]: 0 : return bRet;
1842 : : }
1843 : :
1844 : 0 : const SwRedline* SwCrsrShell::SelNextRedline()
1845 : : {
1846 : 0 : const SwRedline* pFnd = 0;
1847 [ # # ]: 0 : if( !IsTableMode() )
1848 : : {
1849 [ # # ]: 0 : SET_CURR_SHELL( this );
1850 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1851 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1852 : :
1853 [ # # ]: 0 : pFnd = GetDoc()->SelNextRedline( *pCurCrsr );
1854 [ # # ][ # # ]: 0 : if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
[ # # ][ # # ]
[ # # ][ # # ]
1855 [ # # ]: 0 : UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1856 : : else
1857 [ # # ][ # # ]: 0 : pFnd = 0;
[ # # ]
1858 : : }
1859 : 0 : return pFnd;
1860 : : }
1861 : :
1862 : 0 : const SwRedline* SwCrsrShell::SelPrevRedline()
1863 : : {
1864 : 0 : const SwRedline* pFnd = 0;
1865 [ # # ]: 0 : if( !IsTableMode() )
1866 : : {
1867 [ # # ]: 0 : SET_CURR_SHELL( this );
1868 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1869 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1870 : :
1871 [ # # ]: 0 : pFnd = GetDoc()->SelPrevRedline( *pCurCrsr );
1872 [ # # ][ # # ]: 0 : if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
[ # # ][ # # ]
[ # # ][ # # ]
1873 [ # # ]: 0 : UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1874 : : else
1875 [ # # ][ # # ]: 0 : pFnd = 0;
[ # # ]
1876 : : }
1877 : 0 : return pFnd;
1878 : : }
1879 : :
1880 : 0 : const SwRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
1881 : : {
1882 : 0 : const SwRedline* pFnd = 0;
1883 [ # # ]: 0 : SwCallLink aLk( *this ); // watch Crsr-Moves
1884 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
1885 : :
1886 [ # # ][ # # ]: 0 : pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ];
1887 [ # # ]: 0 : if( pFnd )
1888 : : {
1889 [ # # ][ # # ]: 0 : *pCurCrsr->GetPoint() = *pFnd->Start();
1890 : :
1891 : : SwCntntNode* pCNd;
1892 : 0 : SwNodeIndex* pIdx = &pCurCrsr->GetPoint()->nNode;
1893 [ # # ][ # # ]: 0 : if( !pIdx->GetNode().IsCntntNode() &&
[ # # ][ # # ]
1894 [ # # ]: 0 : 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
1895 : 0 : sal_True, IsReadOnlyAvailable() )) )
1896 : : {
1897 [ # # ][ # # ]: 0 : if( *pIdx <= pFnd->End()->nNode )
1898 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
1899 : : else
1900 : 0 : pFnd = 0;
1901 : : }
1902 : :
1903 [ # # ][ # # ]: 0 : if( pFnd && bSelect )
1904 : : {
1905 [ # # ]: 0 : pCurCrsr->SetMark();
1906 [ # # ][ # # ]: 0 : if( nsRedlineType_t::REDLINE_FMTCOLL == pFnd->GetType() )
1907 : : {
1908 : 0 : pCNd = pIdx->GetNode().GetCntntNode();
1909 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
[ # # ]
1910 [ # # ][ # # ]: 0 : pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
1911 : : }
1912 : : else
1913 [ # # ][ # # ]: 0 : *pCurCrsr->GetPoint() = *pFnd->End();
1914 : :
1915 : 0 : pIdx = &pCurCrsr->GetPoint()->nNode;
1916 [ # # ][ # # ]: 0 : if( !pIdx->GetNode().IsCntntNode() &&
[ # # ][ # # ]
1917 [ # # ]: 0 : 0 != ( pCNd = GetDoc()->GetNodes().GoPrevSection( pIdx,
1918 : 0 : sal_True, IsReadOnlyAvailable() )) )
1919 : : {
1920 [ # # ]: 0 : if( *pIdx >= pCurCrsr->GetMark()->nNode )
1921 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
[ # # ]
1922 : : else
1923 : 0 : pFnd = 0;
1924 : : }
1925 : : }
1926 : :
1927 [ # # ]: 0 : if( !pFnd )
1928 : : {
1929 [ # # ]: 0 : pCurCrsr->DeleteMark();
1930 [ # # ]: 0 : pCurCrsr->RestoreSavePos();
1931 : : }
1932 [ # # ][ # # ]: 0 : else if( bSelect && *pCurCrsr->GetMark() == *pCurCrsr->GetPoint() )
[ # # ][ # # ]
1933 [ # # ]: 0 : pCurCrsr->DeleteMark();
1934 : :
1935 [ # # ][ # # ]: 0 : if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
[ # # ][ # # ]
[ # # ][ # # ]
1936 : : UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE
1937 [ # # ]: 0 : | SwCrsrShell::READONLY );
1938 : : else
1939 : : {
1940 : 0 : pFnd = 0;
1941 [ # # ]: 0 : if( bSelect )
1942 [ # # ]: 0 : pCurCrsr->DeleteMark();
1943 : : }
1944 : : }
1945 [ # # ][ # # ]: 0 : return pFnd;
1946 : : }
1947 : :
1948 : 0 : const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
1949 : : {
1950 : 0 : const SwRedline* pFnd = 0;
1951 [ # # ]: 0 : if( !IsTableMode() )
1952 : : {
1953 [ # # ]: 0 : SET_CURR_SHELL( this );
1954 : :
1955 [ # # ]: 0 : const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
1956 [ # # ]: 0 : const SwRedline* pTmp = rTbl[ nArrPos ];
1957 : 0 : sal_uInt16 nSeqNo = pTmp->GetSeqNo();
1958 [ # # ][ # # ]: 0 : if( nSeqNo && bSelect )
1959 : : {
1960 : 0 : sal_Bool bCheck = sal_False;
1961 : 0 : int nLoopCnt = 2;
1962 : 0 : sal_uInt16 nArrSavPos = nArrPos;
1963 : :
1964 [ # # ]: 0 : do {
1965 [ # # ]: 0 : pTmp = _GotoRedline( nArrPos, sal_True );
1966 : :
1967 [ # # ]: 0 : if( !pFnd )
1968 : 0 : pFnd = pTmp;
1969 : :
1970 [ # # ][ # # ]: 0 : if( pTmp && bCheck )
1971 : : {
1972 : : // Check for overlaps. These can happen when FmtColl-
1973 : : // Redlines were streched over a whole paragraph
1974 [ # # ]: 0 : SwPaM* pCur = pCurCrsr;
1975 : 0 : SwPaM* pNextPam = (SwPaM*)pCur->GetNext();
1976 [ # # ][ # # ]: 0 : SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
1977 [ # # ]: 0 : while( pCur != pNextPam )
1978 : : {
1979 [ # # ]: 0 : const SwPosition *pNStt = pNextPam->Start(),
1980 [ # # ]: 0 : *pNEnd = pNextPam->End();
1981 : :
1982 : 0 : sal_Bool bDel = sal_True;
1983 [ # # # # : 0 : switch( ::ComparePosition( *pCStt, *pCEnd,
# ]
1984 [ # # ]: 0 : *pNStt, *pNEnd ))
1985 : : {
1986 : : case POS_INSIDE: // Pos1 is completely in Pos2
1987 [ # # ]: 0 : if( !pCur->HasMark() )
1988 : : {
1989 [ # # ]: 0 : pCur->SetMark();
1990 [ # # ]: 0 : *pCur->GetMark() = *pNStt;
1991 : : }
1992 : : else
1993 [ # # ]: 0 : *pCStt = *pNStt;
1994 [ # # ]: 0 : *pCEnd = *pNEnd;
1995 : 0 : break;
1996 : :
1997 : : case POS_OUTSIDE: // Pos2 is completely in Pos1
1998 : : case POS_EQUAL: // Pos1 has same size as Pos2
1999 : 0 : break;
2000 : :
2001 : : case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at beginning
2002 [ # # ]: 0 : if( !pCur->HasMark() )
2003 [ # # ]: 0 : pCur->SetMark();
2004 [ # # ]: 0 : *pCEnd = *pNEnd;
2005 : 0 : break;
2006 : : case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at end
2007 [ # # ]: 0 : if( !pCur->HasMark() )
2008 : : {
2009 [ # # ]: 0 : pCur->SetMark();
2010 [ # # ]: 0 : *pCur->GetMark() = *pNStt;
2011 : : }
2012 : : else
2013 [ # # ]: 0 : *pCStt = *pNStt;
2014 : 0 : break;
2015 : :
2016 : : default:
2017 : 0 : bDel = sal_False;
2018 : : }
2019 : :
2020 [ # # ]: 0 : if( bDel )
2021 : : {
2022 : : // not needed anymore
2023 : 0 : SwPaM* pPrevPam = (SwPaM*)pNextPam->GetPrev();
2024 [ # # ][ # # ]: 0 : delete pNextPam;
2025 : 0 : pNextPam = pPrevPam;
2026 : : }
2027 : 0 : pNextPam = (SwPaM*)pNextPam->GetNext();
2028 : : }
2029 : : }
2030 : :
2031 : : sal_uInt16 nFndPos = 2 == nLoopCnt
2032 : 0 : ? rTbl.FindNextOfSeqNo( nArrPos )
2033 [ # # ][ # # ]: 0 : : rTbl.FindPrevOfSeqNo( nArrPos );
[ # # ]
2034 [ # # ][ # # ]: 0 : if( USHRT_MAX != nFndPos ||
[ # # ][ # # ]
[ # # ]
2035 : : ( 0 != ( --nLoopCnt ) && USHRT_MAX != (
2036 : 0 : nFndPos = rTbl.FindPrevOfSeqNo( nArrSavPos ))) )
2037 : : {
2038 [ # # ]: 0 : if( pTmp )
2039 : : {
2040 : : // create new cursor
2041 [ # # ]: 0 : CreateCrsr();
2042 : 0 : bCheck = sal_True;
2043 : : }
2044 : 0 : nArrPos = nFndPos;
2045 : : }
2046 : : else
2047 : 0 : nLoopCnt = 0;
2048 : :
2049 : 0 : } while( nLoopCnt );
2050 : : }
2051 : : else
2052 [ # # ][ # # ]: 0 : pFnd = _GotoRedline( nArrPos, bSelect );
2053 : : }
2054 : 0 : return pFnd;
2055 : : }
2056 : :
2057 : :
2058 : 0 : sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
2059 : : {
2060 [ # # ]: 0 : SwNodes& rNds = GetDoc()->GetNodes();
2061 : 0 : const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
2062 : 0 : const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
2063 : 0 : sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
2064 : 0 : Point aPt;
2065 : :
2066 [ # # ][ # # ]: 0 : _SetGetExpFld aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
[ # # ][ # # ]
2067 [ # # ][ # # ]: 0 : _SetGetExpFld aCurPos( bNext ? *pCurCrsr->End() : *pCurCrsr->Start() );
[ # # ][ # # ]
2068 [ # # ]: 0 : if( aCurPos.GetNode() < nBodySttNdIdx )
2069 : : {
2070 [ # # ]: 0 : const SwCntntNode* pCNd = aCurPos.GetNodeFromCntnt()->GetCntntNode();
2071 : : SwCntntFrm* pFrm;
2072 [ # # ][ # # ]: 0 : if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt )) )
[ # # ][ # # ]
[ # # ]
2073 [ # # ]: 0 : aCurPos.SetBodyPos( *pFrm );
2074 : : }
2075 : :
2076 : : // check first all the hyperlink fields
2077 : : {
2078 : : const SwTxtNode* pTxtNd;
2079 : 0 : const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
2080 [ # # ]: 0 : for( sal_uInt16 n = pFmts->size(); 1 < n; )
2081 : : {
2082 [ # # ]: 0 : SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
2083 : :
2084 [ # # ][ # # ]: 0 : for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
[ # # ]
2085 [ # # ][ # # ]: 0 : if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
[ # # ]
2086 [ # # ]: 0 : pTxtNd->GetNodes().IsDocNodes() )
2087 : : {
2088 : 0 : SwTxtINetFmt& rAttr = *pFnd;
2089 [ # # ]: 0 : SwPosition aTmpPos( *pTxtNd );
2090 [ # # ]: 0 : _SetGetExpFld aPos( aTmpPos.nNode, rAttr );
2091 : : SwCntntFrm* pFrm;
2092 [ # # ][ # # ]: 0 : if( pTxtNd->GetIndex() < nBodySttNdIdx &&
[ # # ][ # # ]
2093 [ # # ]: 0 : 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt )) )
2094 [ # # ]: 0 : aPos.SetBodyPos( *pFrm );
2095 : :
2096 [ # # ][ # # ]: 0 : if( bNext
[ # # ][ # # ]
[ # # ][ # # ]
2097 [ # # ][ # # ]: 0 : ? ( aPos < aCmpPos && aCurPos < aPos )
2098 [ # # ][ # # ]: 0 : : ( aCmpPos < aPos && aPos < aCurPos ))
2099 : : {
2100 : 0 : String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(),
2101 [ # # ][ # # ]: 0 : *rAttr.GetEnd() - *rAttr.GetStart() ) );
2102 : :
2103 [ # # ][ # # ]: 0 : sTxt = comphelper::string::remove(sTxt, 0x0a);
2104 [ # # ][ # # ]: 0 : sTxt = comphelper::string::strip(sTxt, ' ');
[ # # ]
2105 : :
2106 [ # # ]: 0 : if( sTxt.Len() )
2107 [ # # ]: 0 : aCmpPos = aPos;
2108 [ # # ]: 0 : }
2109 : : }
2110 [ # # ]: 0 : }
2111 : : }
2112 : : // then check all the Flys with a URL or imapge map
2113 : : {
2114 : 0 : const SwFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
2115 [ # # ]: 0 : for( sal_uInt16 n = 0, nEnd = pFmts->size(); n < nEnd; ++n )
2116 : : {
2117 : 0 : SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)(*pFmts)[ n ];
2118 [ # # ]: 0 : const SwFmtURL& rURLItem = pFmt->GetURL();
2119 [ # # ][ # # ]: 0 : if( rURLItem.GetMap() || rURLItem.GetURL().Len() )
[ # # ]
2120 : : {
2121 [ # # ]: 0 : SwFlyFrm* pFly = pFmt->GetFrm( &aPt, sal_False );
2122 [ # # ]: 0 : SwPosition aTmpPos( *pBodySttNd );
2123 [ # # ][ # # ]: 0 : if( pFly &&
[ # # ]
2124 [ # # ][ # # ]: 0 : GetBodyTxtNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
2125 : : {
2126 [ # # ]: 0 : _SetGetExpFld aPos( *pFmt, &aTmpPos );
2127 : :
2128 [ # # ][ # # ]: 0 : if( bNext
[ # # ][ # # ]
[ # # ][ # # ]
2129 [ # # ][ # # ]: 0 : ? ( aPos < aCmpPos && aCurPos < aPos )
2130 [ # # ][ # # ]: 0 : : ( aCmpPos < aPos && aPos < aCurPos ))
2131 : 0 : aCmpPos = aPos;
2132 [ # # ]: 0 : }
2133 : : }
2134 : : }
2135 : : }
2136 : :
2137 : : // found any URL ?
2138 : 0 : sal_Bool bRet = sal_False;
2139 : 0 : const SwTxtINetFmt* pFndAttr = aCmpPos.GetINetFmt();
2140 : 0 : const SwFlyFrmFmt* pFndFmt = aCmpPos.GetFlyFmt();
2141 [ # # ][ # # ]: 0 : if( pFndAttr || pFndFmt )
2142 : : {
2143 [ # # ]: 0 : SET_CURR_SHELL( this );
2144 [ # # ]: 0 : SwCallLink aLk( *this );
2145 : :
2146 : : // found a text attribute ?
2147 [ # # ]: 0 : if( pFndAttr )
2148 : : {
2149 [ # # ]: 0 : SwCrsrSaveState aSaveState( *pCurCrsr );
2150 : :
2151 [ # # ]: 0 : aCmpPos.GetPosOfContent( *pCurCrsr->GetPoint() );
2152 [ # # ]: 0 : pCurCrsr->DeleteMark();
2153 [ # # ]: 0 : pCurCrsr->SetMark();
2154 [ # # ][ # # ]: 0 : pCurCrsr->GetPoint()->nContent = *pFndAttr->SwTxtAttr::GetEnd();
2155 : :
2156 [ # # ][ # # ]: 0 : if( !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
[ # # ][ # # ]
[ # # ]
2157 : : {
2158 : : UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|
2159 [ # # ]: 0 : SwCrsrShell::READONLY );
2160 : 0 : bRet = sal_True;
2161 [ # # ]: 0 : }
2162 : : }
2163 : : // found a draw object ?
2164 [ # # ]: 0 : else if( RES_DRAWFRMFMT == pFndFmt->Which() )
2165 : : {
2166 [ # # ]: 0 : const SdrObject* pSObj = pFndFmt->FindSdrObject();
2167 [ # # ][ # # ]: 0 : ((SwFEShell*)this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
[ # # ]
2168 [ # # ]: 0 : MakeSelVisible();
2169 : 0 : bRet = sal_True;
2170 : : }
2171 : : else // then is it a fly
2172 : : {
2173 [ # # ]: 0 : SwFlyFrm* pFly = pFndFmt->GetFrm(&aPt, sal_False );
2174 [ # # ]: 0 : if( pFly )
2175 : : {
2176 [ # # ]: 0 : ((SwFEShell*)this)->SelectFlyFrm( *pFly, sal_True );
2177 [ # # ]: 0 : MakeSelVisible();
2178 : 0 : bRet = sal_True;
2179 : : }
2180 [ # # ][ # # ]: 0 : }
2181 : : }
2182 : 0 : return bRet;
2183 : : }
2184 : :
2185 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|