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 <hintids.hxx>
29cdf0e10cSrcweir #include <svl/itemiter.hxx>
30cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
31cdf0e10cSrcweir #include <editeng/adjitem.hxx>
32cdf0e10cSrcweir #include <editeng/brkitem.hxx>
33cdf0e10cSrcweir #include <svx/svdobj.hxx>
34cdf0e10cSrcweir #include <crsrsh.hxx>
35cdf0e10cSrcweir #include <doc.hxx>
36cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
37cdf0e10cSrcweir #include <pagefrm.hxx>
38cdf0e10cSrcweir #include <cntfrm.hxx>
39cdf0e10cSrcweir #include <rootfrm.hxx>
40cdf0e10cSrcweir #include <pam.hxx>
41cdf0e10cSrcweir #include <ndtxt.hxx>
42cdf0e10cSrcweir #include <fldbas.hxx>
4369a74367SOliver-Rainer Wittmann #include <swtable.hxx>
44cdf0e10cSrcweir #include <docary.hxx>
45cdf0e10cSrcweir #include <txtfld.hxx>
46cdf0e10cSrcweir #include <fmtfld.hxx>
47cdf0e10cSrcweir #include <txtftn.hxx>
48cdf0e10cSrcweir #include <txtinet.hxx>
49cdf0e10cSrcweir #include <fmtinfmt.hxx>
50cdf0e10cSrcweir #include <txttxmrk.hxx>
51cdf0e10cSrcweir #include <frmfmt.hxx>
52cdf0e10cSrcweir #include <flyfrm.hxx>
53cdf0e10cSrcweir #include <viscrs.hxx>
54cdf0e10cSrcweir #include <callnk.hxx>
55cdf0e10cSrcweir #include <doctxm.hxx>
56cdf0e10cSrcweir #include <docfld.hxx>
57cdf0e10cSrcweir #include <expfld.hxx>
58cdf0e10cSrcweir #include <reffld.hxx>
5969a74367SOliver-Rainer Wittmann #include <flddat.hxx>
60cdf0e10cSrcweir #include <cellatr.hxx>
61cdf0e10cSrcweir #include <swundo.hxx>
62cdf0e10cSrcweir #include <redline.hxx>
63cdf0e10cSrcweir #include <fmtcntnt.hxx>
64cdf0e10cSrcweir #include <fmthdft.hxx>
65cdf0e10cSrcweir #include <pagedesc.hxx>
66cdf0e10cSrcweir #include <fesh.hxx>
67cdf0e10cSrcweir #include <charfmt.hxx>
68cdf0e10cSrcweir #include <fmturl.hxx>
69cdf0e10cSrcweir #include "txtfrm.hxx"
70cdf0e10cSrcweir #include <wrong.hxx>
71cdf0e10cSrcweir #include <switerator.hxx>
72cdf0e10cSrcweir #include <vcl/window.hxx>
73cdf0e10cSrcweir #include <docufld.hxx> // OD 2008-06-19 #i90516#
74cdf0e10cSrcweir
75cdf0e10cSrcweir using namespace ::com::sun::star;
76cdf0e10cSrcweir
77cdf0e10cSrcweir
78cdf0e10cSrcweir // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
GotoNextNum()79cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoNextNum()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir sal_Bool bRet = GetDoc()->GotoNextNum( *pCurCrsr->GetPoint() );
82cdf0e10cSrcweir if( bRet )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
85cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
86cdf0e10cSrcweir if( !ActionPend() )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir SET_CURR_SHELL( this );
89cdf0e10cSrcweir // dann versuche den Cursor auf die Position zu setzen,
90cdf0e10cSrcweir // auf halber Heohe vom Char-SRectangle
91cdf0e10cSrcweir Point aPt( pCurCrsr->GetPtPos() );
92cdf0e10cSrcweir SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
93cdf0e10cSrcweir pCurCrsr->GetPoint() );
94cdf0e10cSrcweir pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
95cdf0e10cSrcweir pFrm->Calc();
96cdf0e10cSrcweir if( pFrm->IsVertical() )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir aPt.X() = aCharRect.Center().X();
99cdf0e10cSrcweir aPt.Y() = pFrm->Frm().Top() + nUpDownX;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir else
102cdf0e10cSrcweir {
103cdf0e10cSrcweir aPt.Y() = aCharRect.Center().Y();
104cdf0e10cSrcweir aPt.X() = pFrm->Frm().Left() + nUpDownX;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
107cdf0e10cSrcweir bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
108cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
109cdf0e10cSrcweir if( bRet )
110cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::UPDOWN |
111cdf0e10cSrcweir SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
112cdf0e10cSrcweir SwCrsrShell::READONLY );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir }
115cdf0e10cSrcweir return bRet;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir
GotoPrevNum()119cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoPrevNum()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir sal_Bool bRet = GetDoc()->GotoPrevNum( *pCurCrsr->GetPoint() );
122cdf0e10cSrcweir if( bRet )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
125cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
126cdf0e10cSrcweir if( !ActionPend() )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir SET_CURR_SHELL( this );
129cdf0e10cSrcweir // dann versuche den Cursor auf die Position zu setzen,
130cdf0e10cSrcweir // auf halber Heohe vom Char-SRectangle
131cdf0e10cSrcweir Point aPt( pCurCrsr->GetPtPos() );
132cdf0e10cSrcweir SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->getLayoutFrm( GetLayout(), &aPt,
133cdf0e10cSrcweir pCurCrsr->GetPoint() );
134cdf0e10cSrcweir pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
135cdf0e10cSrcweir pFrm->Calc();
136cdf0e10cSrcweir if( pFrm->IsVertical() )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir aPt.X() = aCharRect.Center().X();
139cdf0e10cSrcweir aPt.Y() = pFrm->Frm().Top() + nUpDownX;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir else
142cdf0e10cSrcweir {
143cdf0e10cSrcweir aPt.Y() = aCharRect.Center().Y();
144cdf0e10cSrcweir aPt.X() = pFrm->Frm().Left() + nUpDownX;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
147cdf0e10cSrcweir bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
148cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
149cdf0e10cSrcweir if( bRet )
150cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::UPDOWN |
151cdf0e10cSrcweir SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
152cdf0e10cSrcweir SwCrsrShell::READONLY );
153cdf0e10cSrcweir }
154cdf0e10cSrcweir }
155cdf0e10cSrcweir return bRet;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
158cdf0e10cSrcweir // springe aus dem Content zum Header
159cdf0e10cSrcweir
GotoHeaderTxt()160cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoHeaderTxt()
161cdf0e10cSrcweir {
162cdf0e10cSrcweir const SwFrm* pFrm = GetCurrFrm()->FindPageFrm();
163cdf0e10cSrcweir while( pFrm && !pFrm->IsHeaderFrm() )
164cdf0e10cSrcweir pFrm = pFrm->GetLower();
165cdf0e10cSrcweir // Header gefunden, dann suche den 1.Cntnt-Frame
166cdf0e10cSrcweir while( pFrm && !pFrm->IsCntntFrm() )
167cdf0e10cSrcweir pFrm = pFrm->GetLower();
168cdf0e10cSrcweir if( pFrm )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir SET_CURR_SHELL( this );
171cdf0e10cSrcweir // hole den Header-Frame
172cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
173cdf0e10cSrcweir SwCursor *pTmpCrsr = getShellCrsr( true );
174cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pTmpCrsr );
175cdf0e10cSrcweir pFrm->Calc();
176cdf0e10cSrcweir Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() );
177cdf0e10cSrcweir pFrm->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
178cdf0e10cSrcweir if( !pTmpCrsr->IsSelOvr() )
179cdf0e10cSrcweir UpdateCrsr();
180cdf0e10cSrcweir else
181cdf0e10cSrcweir pFrm = 0;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir return 0 != pFrm;
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
186cdf0e10cSrcweir
187cdf0e10cSrcweir // springe aus dem Content zum Footer
188cdf0e10cSrcweir
GotoFooterTxt()189cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoFooterTxt()
190cdf0e10cSrcweir {
191cdf0e10cSrcweir const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm();
192cdf0e10cSrcweir if( pFrm )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir const SwFrm* pLower = pFrm->GetLastLower();
195cdf0e10cSrcweir
196cdf0e10cSrcweir while( pLower && !pLower->IsFooterFrm() )
197cdf0e10cSrcweir pLower = pLower->GetLower();
198cdf0e10cSrcweir // Header gefunden, dann suche den 1.Cntnt-Frame
199cdf0e10cSrcweir while( pLower && !pLower->IsCntntFrm() )
200cdf0e10cSrcweir pLower = pLower->GetLower();
201cdf0e10cSrcweir
202cdf0e10cSrcweir if( pLower )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir SwCursor *pTmpCrsr = getShellCrsr( true );
205cdf0e10cSrcweir SET_CURR_SHELL( this );
206cdf0e10cSrcweir // hole eine Position im Footer
207cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
208cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pTmpCrsr );
209cdf0e10cSrcweir pLower->Calc();
210cdf0e10cSrcweir Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() );
211cdf0e10cSrcweir pLower->GetCrsrOfst( pTmpCrsr->GetPoint(), aPt );
212cdf0e10cSrcweir if( !pTmpCrsr->IsSelOvr() )
213cdf0e10cSrcweir UpdateCrsr();
214cdf0e10cSrcweir else
215cdf0e10cSrcweir pFrm = 0;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir else
218cdf0e10cSrcweir pFrm = 0;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir else
221cdf0e10cSrcweir pFrm = 0;
222cdf0e10cSrcweir return 0 != pFrm;
223cdf0e10cSrcweir }
224cdf0e10cSrcweir
SetCrsrInHdFt(sal_uInt16 nDescNo,sal_Bool bInHeader)225cdf0e10cSrcweir sal_Bool SwCrsrShell::SetCrsrInHdFt( sal_uInt16 nDescNo, sal_Bool bInHeader )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir sal_Bool bRet = sal_False;
228cdf0e10cSrcweir SwDoc *pMyDoc = GetDoc();
229cdf0e10cSrcweir
230cdf0e10cSrcweir SET_CURR_SHELL( this );
231cdf0e10cSrcweir
232cdf0e10cSrcweir if( USHRT_MAX == nDescNo )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir // dann den akt. nehmen
235cdf0e10cSrcweir const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm();
236cdf0e10cSrcweir if( pPage )
237cdf0e10cSrcweir for( sal_uInt16 i = 0; i < pMyDoc->GetPageDescCnt(); ++i )
238cdf0e10cSrcweir if( pPage->GetPageDesc() ==
239cdf0e10cSrcweir &const_cast<const SwDoc *>(pMyDoc)->GetPageDesc( i ) )
240cdf0e10cSrcweir {
241cdf0e10cSrcweir nDescNo = i;
242cdf0e10cSrcweir break;
243cdf0e10cSrcweir }
244cdf0e10cSrcweir }
245cdf0e10cSrcweir
246cdf0e10cSrcweir if( USHRT_MAX != nDescNo && nDescNo < pMyDoc->GetPageDescCnt() )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir //dann teste mal, ob ueberhaupt das Attribut vorhanden ist.
249cdf0e10cSrcweir const SwPageDesc& rDesc = const_cast<const SwDoc *>(pMyDoc)
250cdf0e10cSrcweir ->GetPageDesc( nDescNo );
251cdf0e10cSrcweir const SwFmtCntnt* pCnt = 0;
252cdf0e10cSrcweir if( bInHeader )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir // gespiegelte Seiten??? erstmal nicht beachten
255cdf0e10cSrcweir const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader();
256cdf0e10cSrcweir if( rHd.GetHeaderFmt() )
257cdf0e10cSrcweir pCnt = &rHd.GetHeaderFmt()->GetCntnt();
258cdf0e10cSrcweir }
259cdf0e10cSrcweir else
260cdf0e10cSrcweir {
261cdf0e10cSrcweir const SwFmtFooter& rFt = rDesc.GetMaster().GetFooter();
262cdf0e10cSrcweir if( rFt.GetFooterFmt() )
263cdf0e10cSrcweir pCnt = &rFt.GetFooterFmt()->GetCntnt();
264cdf0e10cSrcweir }
265cdf0e10cSrcweir
266cdf0e10cSrcweir if( pCnt && pCnt->GetCntntIdx() )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir SwNodeIndex aIdx( *pCnt->GetCntntIdx(), 1 );
269cdf0e10cSrcweir SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
270cdf0e10cSrcweir if( !pCNd )
271cdf0e10cSrcweir pCNd = pMyDoc->GetNodes().GoNext( &aIdx );
272cdf0e10cSrcweir
273cdf0e10cSrcweir const SwFrm* pFrm;
274cdf0e10cSrcweir Point aPt( pCurCrsr->GetPtPos() );
275cdf0e10cSrcweir
276cdf0e10cSrcweir if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ))
277cdf0e10cSrcweir {
278cdf0e10cSrcweir // dann kann der Cursor ja auch hinein gesetzt werden
279cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
280cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
281cdf0e10cSrcweir
282cdf0e10cSrcweir ClearMark();
283cdf0e10cSrcweir
284cdf0e10cSrcweir SwPosition& rPos = *pCurCrsr->GetPoint();
285cdf0e10cSrcweir rPos.nNode = *pCNd;
286cdf0e10cSrcweir rPos.nContent.Assign( pCNd, 0 );
287cdf0e10cSrcweir
288cdf0e10cSrcweir bRet = !pCurCrsr->IsSelOvr();
289cdf0e10cSrcweir if( bRet )
290cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
291cdf0e10cSrcweir SwCrsrShell::READONLY );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir }
294cdf0e10cSrcweir }
295cdf0e10cSrcweir return bRet;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir // springe zum naechsten Verzeichnis
299cdf0e10cSrcweir
GotoNextTOXBase(const String * pName)300cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName )
301cdf0e10cSrcweir {
302cdf0e10cSrcweir sal_Bool bRet = sal_False;
303cdf0e10cSrcweir
304cdf0e10cSrcweir const SwSectionFmts& rFmts = GetDoc()->GetSections();
305cdf0e10cSrcweir SwCntntNode* pFnd = 0;
306cdf0e10cSrcweir for( sal_uInt16 n = rFmts.Count(); n; )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir const SwSection* pSect = rFmts[ --n ]->GetSection();
309cdf0e10cSrcweir const SwSectionNode* pSectNd;
310cdf0e10cSrcweir if( TOX_CONTENT_SECTION == pSect->GetType() &&
311cdf0e10cSrcweir 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
312cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() &&
313cdf0e10cSrcweir ( !pFnd || pFnd->GetIndex() > pSectNd->GetIndex() ) &&
314cdf0e10cSrcweir // JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
315cdf0e10cSrcweir // einstellbar sind, muss ueber den Titel gesucht werden!
316cdf0e10cSrcweir // ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
317cdf0e10cSrcweir ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
318cdf0e10cSrcweir )
319cdf0e10cSrcweir {
320cdf0e10cSrcweir SwNodeIndex aIdx( *pSectNd, 1 );
321cdf0e10cSrcweir SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
322cdf0e10cSrcweir if( !pCNd )
323cdf0e10cSrcweir pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
324cdf0e10cSrcweir const SwCntntFrm* pCFrm;
325cdf0e10cSrcweir if( pCNd &&
326cdf0e10cSrcweir pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
327cdf0e10cSrcweir 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
328cdf0e10cSrcweir ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
329cdf0e10cSrcweir {
330cdf0e10cSrcweir pFnd = pCNd;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir if( pFnd )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
337cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
338cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pFnd;
339cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
340cdf0e10cSrcweir bRet = !pCurCrsr->IsSelOvr();
341cdf0e10cSrcweir if( bRet )
342cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
343cdf0e10cSrcweir }
344cdf0e10cSrcweir return bRet;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir
347cdf0e10cSrcweir // springe zum vorherigen Verzeichnis
348cdf0e10cSrcweir
349cdf0e10cSrcweir
GotoPrevTOXBase(const String * pName)350cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir sal_Bool bRet = sal_False;
353cdf0e10cSrcweir
354cdf0e10cSrcweir const SwSectionFmts& rFmts = GetDoc()->GetSections();
355cdf0e10cSrcweir SwCntntNode* pFnd = 0;
356cdf0e10cSrcweir for( sal_uInt16 n = rFmts.Count(); n; )
357cdf0e10cSrcweir {
358cdf0e10cSrcweir const SwSection* pSect = rFmts[ --n ]->GetSection();
359cdf0e10cSrcweir const SwSectionNode* pSectNd;
360cdf0e10cSrcweir if( TOX_CONTENT_SECTION == pSect->GetType() &&
361cdf0e10cSrcweir 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
362cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() &&
363cdf0e10cSrcweir ( !pFnd || pFnd->GetIndex() < pSectNd->GetIndex() ) &&
364cdf0e10cSrcweir // JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
365cdf0e10cSrcweir // einstellbar sind, muss ueber den Titel gesucht werden!
366cdf0e10cSrcweir // ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
367cdf0e10cSrcweir ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
368cdf0e10cSrcweir )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir SwNodeIndex aIdx( *pSectNd, 1 );
371cdf0e10cSrcweir SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
372cdf0e10cSrcweir if( !pCNd )
373cdf0e10cSrcweir pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
374cdf0e10cSrcweir const SwCntntFrm* pCFrm;
375cdf0e10cSrcweir if( pCNd &&
376cdf0e10cSrcweir pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
377cdf0e10cSrcweir 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
378cdf0e10cSrcweir ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
379cdf0e10cSrcweir {
380cdf0e10cSrcweir pFnd = pCNd;
381cdf0e10cSrcweir }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
385cdf0e10cSrcweir if( pFnd )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
388cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
389cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pFnd;
390cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
391cdf0e10cSrcweir bRet = !pCurCrsr->IsSelOvr();
392cdf0e10cSrcweir if( bRet )
393cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
394cdf0e10cSrcweir }
395cdf0e10cSrcweir return bRet;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
398cdf0e10cSrcweir // springe zum Verzeichnis vom TOXMark
399cdf0e10cSrcweir
GotoTOXMarkBase()400cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoTOXMarkBase()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir sal_Bool bRet = sal_False;
403cdf0e10cSrcweir
404cdf0e10cSrcweir SwTOXMarks aMarks;
405cdf0e10cSrcweir sal_uInt16 nCnt = GetDoc()->GetCurTOXMark( *pCurCrsr->GetPoint(), aMarks );
406cdf0e10cSrcweir if( nCnt )
407cdf0e10cSrcweir {
408cdf0e10cSrcweir // dann nehme den 1. und hole den Verzeichnis-Typ.
409cdf0e10cSrcweir // Suche in seiner Abhaengigkeitsliste nach dem eigentlichem
410cdf0e10cSrcweir // Verzeichnis
411cdf0e10cSrcweir const SwTOXType* pType = aMarks[0]->GetTOXType();
412cdf0e10cSrcweir SwIterator<SwTOXBase,SwTOXType> aIter( *pType );
413cdf0e10cSrcweir const SwSectionNode* pSectNd;
414cdf0e10cSrcweir const SwSectionFmt* pSectFmt;
415cdf0e10cSrcweir
416cdf0e10cSrcweir for( SwTOXBase* pTOX = aIter.First(); pTOX; pTOX = aIter.Next() )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir if( pTOX->ISA( SwTOXBaseSection ) &&
419cdf0e10cSrcweir 0 != ( pSectFmt = ((SwTOXBaseSection*)pTOX)->GetFmt() ) &&
420cdf0e10cSrcweir 0 != ( pSectNd = pSectFmt->GetSectionNode() ))
421cdf0e10cSrcweir {
422cdf0e10cSrcweir SwNodeIndex aIdx( *pSectNd, 1 );
423cdf0e10cSrcweir SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
424cdf0e10cSrcweir if( !pCNd )
425cdf0e10cSrcweir pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
426cdf0e10cSrcweir const SwCntntFrm* pCFrm;
427cdf0e10cSrcweir if( pCNd &&
428cdf0e10cSrcweir pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() &&
429cdf0e10cSrcweir 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) &&
430cdf0e10cSrcweir ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
431cdf0e10cSrcweir {
432cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
433cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
434cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pCNd;
435cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
436cdf0e10cSrcweir bRet = !pCurCrsr->IsInProtectTable() &&
437cdf0e10cSrcweir !pCurCrsr->IsSelOvr();
438cdf0e10cSrcweir if( bRet )
439cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
440cdf0e10cSrcweir break;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir }
443cdf0e10cSrcweir }
444cdf0e10cSrcweir }
445cdf0e10cSrcweir return bRet;
446cdf0e10cSrcweir }
447cdf0e10cSrcweir
448cdf0e10cSrcweir
449cdf0e10cSrcweir // springe zur naechsten (vorherigen) Tabellenformel
450cdf0e10cSrcweir // optional auch nur zu kaputten Formeln springen
GotoNxtPrvTblFormula(sal_Bool bNext,sal_Bool bOnlyErrors)451cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoNxtPrvTblFormula( sal_Bool bNext, sal_Bool bOnlyErrors )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir if( IsTableMode() )
454cdf0e10cSrcweir return sal_False;
455cdf0e10cSrcweir
456cdf0e10cSrcweir sal_Bool bFnd = sal_False;
457cdf0e10cSrcweir SwPosition& rPos = *pCurCrsr->GetPoint();
458cdf0e10cSrcweir
459cdf0e10cSrcweir Point aPt;
460cdf0e10cSrcweir SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
461cdf0e10cSrcweir if( !bNext )
462cdf0e10cSrcweir aFndPos.nNode = 0;
463cdf0e10cSrcweir _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
464cdf0e10cSrcweir
465cdf0e10cSrcweir {
466cdf0e10cSrcweir const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
467cdf0e10cSrcweir if( pSttNd )
468cdf0e10cSrcweir {
469cdf0e10cSrcweir const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
470cdf0e10cSrcweir GetTblBox( pSttNd->GetIndex() );
471cdf0e10cSrcweir if( pTBox )
472cdf0e10cSrcweir aCurGEF = _SetGetExpFld( *pTBox );
473cdf0e10cSrcweir }
474cdf0e10cSrcweir }
475cdf0e10cSrcweir
476cdf0e10cSrcweir if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
477cdf0e10cSrcweir // auch beim Einsammeln wird nur der erste Frame benutzt!
478cdf0e10cSrcweir aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),
479cdf0e10cSrcweir &aPt, &rPos, sal_False ) );
480cdf0e10cSrcweir {
481cdf0e10cSrcweir const SfxPoolItem* pItem;
482cdf0e10cSrcweir const SwTableBox* pTBox;
483cdf0e10cSrcweir sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA );
484cdf0e10cSrcweir
485cdf0e10cSrcweir for( n = 0; n < nMaxItems; ++n )
486cdf0e10cSrcweir if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
487cdf0e10cSrcweir RES_BOXATR_FORMULA, n ) ) &&
488cdf0e10cSrcweir 0 != (pTBox = ((SwTblBoxFormula*)pItem)->GetTableBox() ) &&
489cdf0e10cSrcweir pTBox->GetSttNd() &&
490cdf0e10cSrcweir pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
491cdf0e10cSrcweir ( !bOnlyErrors ||
492cdf0e10cSrcweir !((SwTblBoxFormula*)pItem)->HasValidBoxes() ) )
493cdf0e10cSrcweir {
494cdf0e10cSrcweir const SwCntntFrm* pCFrm;
495cdf0e10cSrcweir SwNodeIndex aIdx( *pTBox->GetSttNd() );
496cdf0e10cSrcweir const SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
497cdf0e10cSrcweir if( pCNd && 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False ) ) &&
498cdf0e10cSrcweir (IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
499cdf0e10cSrcweir {
500cdf0e10cSrcweir _SetGetExpFld aCmp( *pTBox );
501cdf0e10cSrcweir aCmp.SetBodyPos( *pCFrm );
502cdf0e10cSrcweir
503cdf0e10cSrcweir if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
504cdf0e10cSrcweir : ( aCmp < aCurGEF && aFndGEF < aCmp ))
505cdf0e10cSrcweir {
506cdf0e10cSrcweir aFndGEF = aCmp;
507cdf0e10cSrcweir bFnd = sal_True;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir }
510cdf0e10cSrcweir }
511cdf0e10cSrcweir }
512cdf0e10cSrcweir
513cdf0e10cSrcweir if( bFnd )
514cdf0e10cSrcweir {
515cdf0e10cSrcweir SET_CURR_SHELL( this );
516cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
517cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
518cdf0e10cSrcweir
519cdf0e10cSrcweir aFndGEF.GetPosOfContent( rPos );
520cdf0e10cSrcweir pCurCrsr->DeleteMark();
521cdf0e10cSrcweir
522cdf0e10cSrcweir bFnd = !pCurCrsr->IsSelOvr();
523cdf0e10cSrcweir if( bFnd )
524cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
525cdf0e10cSrcweir SwCrsrShell::READONLY );
526cdf0e10cSrcweir }
527cdf0e10cSrcweir return bFnd;
528cdf0e10cSrcweir }
529cdf0e10cSrcweir
530cdf0e10cSrcweir // springe zum naechsten (vorherigen) Verzeichniseintrag
GotoNxtPrvTOXMark(sal_Bool bNext)531cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoNxtPrvTOXMark( sal_Bool bNext )
532cdf0e10cSrcweir {
533cdf0e10cSrcweir if( IsTableMode() )
534cdf0e10cSrcweir return sal_False;
535cdf0e10cSrcweir
536cdf0e10cSrcweir sal_Bool bFnd = sal_False;
537cdf0e10cSrcweir SwPosition& rPos = *pCurCrsr->GetPoint();
538cdf0e10cSrcweir
539cdf0e10cSrcweir Point aPt;
540cdf0e10cSrcweir SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
541cdf0e10cSrcweir if( !bNext )
542cdf0e10cSrcweir aFndPos.nNode = 0;
543cdf0e10cSrcweir _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
544cdf0e10cSrcweir
545cdf0e10cSrcweir if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
546cdf0e10cSrcweir // auch beim Einsammeln wird nur der erste Frame benutzt!
547cdf0e10cSrcweir aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
548cdf0e10cSrcweir GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
549cdf0e10cSrcweir {
550cdf0e10cSrcweir const SfxPoolItem* pItem;
551cdf0e10cSrcweir const SwCntntFrm* pCFrm;
552cdf0e10cSrcweir const SwTxtNode* pTxtNd;
553cdf0e10cSrcweir const SwTxtTOXMark* pTxtTOX;
554cdf0e10cSrcweir sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
555cdf0e10cSrcweir
556cdf0e10cSrcweir for( n = 0; n < nMaxItems; ++n )
557cdf0e10cSrcweir if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
558cdf0e10cSrcweir RES_TXTATR_TOXMARK, n ) ) &&
559cdf0e10cSrcweir 0 != (pTxtTOX = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
560cdf0e10cSrcweir ( pTxtNd = &pTxtTOX->GetTxtNode())->GetNodes().IsDocNodes() &&
561cdf0e10cSrcweir 0 != ( pCFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, 0, sal_False )) &&
562cdf0e10cSrcweir ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
563cdf0e10cSrcweir {
564cdf0e10cSrcweir SwNodeIndex aNdIndex( *pTxtNd ); // UNIX benoetigt dieses Obj.
565cdf0e10cSrcweir _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 );
566cdf0e10cSrcweir aCmp.SetBodyPos( *pCFrm );
567cdf0e10cSrcweir
568cdf0e10cSrcweir if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
569cdf0e10cSrcweir : ( aCmp < aCurGEF && aFndGEF < aCmp ))
570cdf0e10cSrcweir {
571cdf0e10cSrcweir aFndGEF = aCmp;
572cdf0e10cSrcweir bFnd = sal_True;
573cdf0e10cSrcweir }
574cdf0e10cSrcweir }
575cdf0e10cSrcweir }
576cdf0e10cSrcweir
577cdf0e10cSrcweir if( bFnd )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir SET_CURR_SHELL( this );
580cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
581cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
582cdf0e10cSrcweir
583cdf0e10cSrcweir aFndGEF.GetPosOfContent( rPos );
584cdf0e10cSrcweir
585cdf0e10cSrcweir bFnd = !pCurCrsr->IsSelOvr();
586cdf0e10cSrcweir if( bFnd )
587cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
588cdf0e10cSrcweir SwCrsrShell::READONLY );
589cdf0e10cSrcweir }
590cdf0e10cSrcweir return bFnd;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir
593cdf0e10cSrcweir /*--------------------------------------------------------------------
594cdf0e10cSrcweir Beschreibung: Traveling zwischen Markierungen
595cdf0e10cSrcweir --------------------------------------------------------------------*/
596cdf0e10cSrcweir
GotoTOXMark(const SwTOXMark & rStart,SwTOXSearch eDir)597cdf0e10cSrcweir const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
598cdf0e10cSrcweir SwTOXSearch eDir )
599cdf0e10cSrcweir {
600cdf0e10cSrcweir SET_CURR_SHELL( this );
601cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
602cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
603cdf0e10cSrcweir
604cdf0e10cSrcweir const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
605cdf0e10cSrcweir IsReadOnlyAvailable() );
606cdf0e10cSrcweir // Position setzen
607cdf0e10cSrcweir SwPosition& rPos = *GetCrsr()->GetPoint();
608cdf0e10cSrcweir rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode();
609cdf0e10cSrcweir rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
610cdf0e10cSrcweir *rNewMark.GetTxtTOXMark()->GetStart() );
611cdf0e10cSrcweir
612cdf0e10cSrcweir if( !pCurCrsr->IsSelOvr() )
613cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
614cdf0e10cSrcweir SwCrsrShell::READONLY );
615cdf0e10cSrcweir
616cdf0e10cSrcweir return rNewMark;
617cdf0e10cSrcweir }
618cdf0e10cSrcweir
619cdf0e10cSrcweir // springe zum naechsten / vorherigen FeldTypen
620cdf0e10cSrcweir
lcl_MakeFldLst(_SetGetExpFlds & rLst,const SwFieldType & rFldType,const bool bInReadOnly,const bool bChkInpFlag=false)62169a74367SOliver-Rainer Wittmann void lcl_MakeFldLst(
62269a74367SOliver-Rainer Wittmann _SetGetExpFlds& rLst,
62369a74367SOliver-Rainer Wittmann const SwFieldType& rFldType,
62469a74367SOliver-Rainer Wittmann const bool bInReadOnly,
62569a74367SOliver-Rainer Wittmann const bool bChkInpFlag = false )
626cdf0e10cSrcweir {
62769a74367SOliver-Rainer Wittmann // es muss immer der 1. Frame gesucht werden
62869a74367SOliver-Rainer Wittmann Point aPt;
62969a74367SOliver-Rainer Wittmann SwTxtFld* pTxtFld = NULL;
63069a74367SOliver-Rainer Wittmann SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
63169a74367SOliver-Rainer Wittmann for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
63269a74367SOliver-Rainer Wittmann {
63369a74367SOliver-Rainer Wittmann pTxtFld = pFmtFld->GetTxtFld();
63469a74367SOliver-Rainer Wittmann if ( pTxtFld != NULL
63569a74367SOliver-Rainer Wittmann && ( !bChkInpFlag
63669a74367SOliver-Rainer Wittmann || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())->GetInputFlag() ) )
63769a74367SOliver-Rainer Wittmann {
63869a74367SOliver-Rainer Wittmann const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
63969a74367SOliver-Rainer Wittmann const SwCntntFrm* pCFrm =
64069a74367SOliver-Rainer Wittmann rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
64169a74367SOliver-Rainer Wittmann if ( pCFrm != NULL
64269a74367SOliver-Rainer Wittmann && ( bInReadOnly || !pCFrm->IsProtected() ) )
64369a74367SOliver-Rainer Wittmann {
64469a74367SOliver-Rainer Wittmann _SetGetExpFld* pNew = new _SetGetExpFld( SwNodeIndex( rTxtNode ), pTxtFld );
64569a74367SOliver-Rainer Wittmann pNew->SetBodyPos( *pCFrm );
64669a74367SOliver-Rainer Wittmann rLst.Insert( pNew );
64769a74367SOliver-Rainer Wittmann }
64869a74367SOliver-Rainer Wittmann }
64969a74367SOliver-Rainer Wittmann }
650cdf0e10cSrcweir }
651cdf0e10cSrcweir
652cdf0e10cSrcweir
MoveFldType(const SwFieldType * pFldType,const bool bNext,const sal_uInt16 nResType,const bool bAddSetExpressionFldsToInputFlds)65369a74367SOliver-Rainer Wittmann sal_Bool SwCrsrShell::MoveFldType(
65469a74367SOliver-Rainer Wittmann const SwFieldType* pFldType,
65569a74367SOliver-Rainer Wittmann const bool bNext,
65669a74367SOliver-Rainer Wittmann const sal_uInt16 nResType,
65769a74367SOliver-Rainer Wittmann const bool bAddSetExpressionFldsToInputFlds )
658cdf0e10cSrcweir {
65969a74367SOliver-Rainer Wittmann // sortierte Liste aller Felder
66069a74367SOliver-Rainer Wittmann _SetGetExpFlds aSrtLst( 64 );
661cdf0e10cSrcweir
66269a74367SOliver-Rainer Wittmann if ( pFldType )
66369a74367SOliver-Rainer Wittmann {
66469a74367SOliver-Rainer Wittmann if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
66569a74367SOliver-Rainer Wittmann {
66669a74367SOliver-Rainer Wittmann return sal_False;
66769a74367SOliver-Rainer Wittmann }
668cdf0e10cSrcweir
66969a74367SOliver-Rainer Wittmann // Modify-Object gefunden, trage alle Felder ins Array ein
67069a74367SOliver-Rainer Wittmann ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
671cdf0e10cSrcweir
67269a74367SOliver-Rainer Wittmann if( RES_INPUTFLD == pFldType->Which() && bAddSetExpressionFldsToInputFlds )
67369a74367SOliver-Rainer Wittmann {
67469a74367SOliver-Rainer Wittmann // es gibt noch versteckte InputFelder in den SetExp. Feldern
67569a74367SOliver-Rainer Wittmann const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
67669a74367SOliver-Rainer Wittmann const sal_uInt16 nSize = rFldTypes.Count();
67769a74367SOliver-Rainer Wittmann for( sal_uInt16 i=0; i < nSize; ++i )
67869a74367SOliver-Rainer Wittmann {
67969a74367SOliver-Rainer Wittmann pFldType = rFldTypes[ i ];
68069a74367SOliver-Rainer Wittmann if ( RES_SETEXPFLD == pFldType->Which() )
68169a74367SOliver-Rainer Wittmann {
68269a74367SOliver-Rainer Wittmann ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ), true );
68369a74367SOliver-Rainer Wittmann }
68469a74367SOliver-Rainer Wittmann }
68569a74367SOliver-Rainer Wittmann }
68669a74367SOliver-Rainer Wittmann }
68769a74367SOliver-Rainer Wittmann else
68869a74367SOliver-Rainer Wittmann {
68969a74367SOliver-Rainer Wittmann const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
69069a74367SOliver-Rainer Wittmann const sal_uInt16 nSize = rFldTypes.Count();
69169a74367SOliver-Rainer Wittmann for( sal_uInt16 i=0; i < nSize; ++i )
69269a74367SOliver-Rainer Wittmann {
69369a74367SOliver-Rainer Wittmann pFldType = rFldTypes[ i ];
69469a74367SOliver-Rainer Wittmann if( nResType == pFldType->Which() )
69569a74367SOliver-Rainer Wittmann {
69669a74367SOliver-Rainer Wittmann ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
69769a74367SOliver-Rainer Wittmann }
69869a74367SOliver-Rainer Wittmann }
69969a74367SOliver-Rainer Wittmann }
700cdf0e10cSrcweir
701cdf0e10cSrcweir // keine Felder gefunden?
702cdf0e10cSrcweir if( !aSrtLst.Count() )
703cdf0e10cSrcweir return sal_False;
704cdf0e10cSrcweir
705cdf0e10cSrcweir sal_uInt16 nPos;
706cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
707cdf0e10cSrcweir {
708cdf0e10cSrcweir // JP 19.08.98: es muss immer ueber das Feld gesucht werden, damit
709cdf0e10cSrcweir // auch immer das richtige gefunden wird, wenn welche in
710cdf0e10cSrcweir // Rahmen stehen, die in einem Absatz verankert sind,
711cdf0e10cSrcweir // in dem ein Feld steht - siehe auch Bug 55247
712cdf0e10cSrcweir const SwPosition& rPos = *pCrsr->GetPoint();
713cdf0e10cSrcweir
714cdf0e10cSrcweir SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
715cdf0e10cSrcweir ASSERT( pTNd, "Wo ist mein CntntNode?" );
716cdf0e10cSrcweir
71769a74367SOliver-Rainer Wittmann SwTxtFld * pTxtFld = pTNd->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true );
71869a74367SOliver-Rainer Wittmann const bool bDelFld = ( pTxtFld == NULL );
71969a74367SOliver-Rainer Wittmann if( bDelFld )
72069a74367SOliver-Rainer Wittmann {
72169a74367SOliver-Rainer Wittmann // create dummy for the search
72269a74367SOliver-Rainer Wittmann SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
72369a74367SOliver-Rainer Wittmann (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
724cdf0e10cSrcweir
725*e91b5f92SOliver-Rainer Wittmann pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(), pDoc->IsClipBoard() );
72669a74367SOliver-Rainer Wittmann pTxtFld->ChgTxtNode( pTNd );
72769a74367SOliver-Rainer Wittmann }
728cdf0e10cSrcweir
72969a74367SOliver-Rainer Wittmann SwIndex aSearchIdx( rPos.nContent );
73069a74367SOliver-Rainer Wittmann if ( !bDelFld && pTxtFld->HasContent() )
73169a74367SOliver-Rainer Wittmann {
73269a74367SOliver-Rainer Wittmann aSearchIdx = *(pTxtFld->GetStart());
73369a74367SOliver-Rainer Wittmann }
73469a74367SOliver-Rainer Wittmann _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &aSearchIdx );
73569a74367SOliver-Rainer Wittmann if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
73669a74367SOliver-Rainer Wittmann {
73769a74367SOliver-Rainer Wittmann // auch beim Einsammeln wird nur der erste Frame benutzt!
73869a74367SOliver-Rainer Wittmann Point aPt;
73969a74367SOliver-Rainer Wittmann aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
74069a74367SOliver-Rainer Wittmann }
741cdf0e10cSrcweir
74269a74367SOliver-Rainer Wittmann sal_Bool bFound = aSrtLst.Seek_Entry( &aSrch, &nPos );
74369a74367SOliver-Rainer Wittmann if( bDelFld )
74469a74367SOliver-Rainer Wittmann {
74569a74367SOliver-Rainer Wittmann delete (SwFmtFld*)&pTxtFld->GetAttr();
74669a74367SOliver-Rainer Wittmann delete pTxtFld;
74769a74367SOliver-Rainer Wittmann }
748cdf0e10cSrcweir
74969a74367SOliver-Rainer Wittmann if( bFound ) // stehe auf einem ?
75069a74367SOliver-Rainer Wittmann {
75169a74367SOliver-Rainer Wittmann if( bNext )
75269a74367SOliver-Rainer Wittmann {
75369a74367SOliver-Rainer Wittmann if( ++nPos >= aSrtLst.Count() )
75469a74367SOliver-Rainer Wittmann return sal_False; // schon am Ende
75569a74367SOliver-Rainer Wittmann }
75669a74367SOliver-Rainer Wittmann else if( !nPos-- )
75769a74367SOliver-Rainer Wittmann return sal_False; // weiter nach vorne geht nicht
75869a74367SOliver-Rainer Wittmann }
75969a74367SOliver-Rainer Wittmann else if( bNext ? nPos >= aSrtLst.Count() : !nPos--)
76069a74367SOliver-Rainer Wittmann {
76169a74367SOliver-Rainer Wittmann return sal_False;
76269a74367SOliver-Rainer Wittmann }
76369a74367SOliver-Rainer Wittmann }
76469a74367SOliver-Rainer Wittmann const _SetGetExpFld& rFnd = **( aSrtLst.GetData() + nPos );
765cdf0e10cSrcweir
766cdf0e10cSrcweir
767cdf0e10cSrcweir SET_CURR_SHELL( this );
768cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
769cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
770cdf0e10cSrcweir
771cdf0e10cSrcweir rFnd.GetPosOfContent( *pCrsr->GetPoint() );
772cdf0e10cSrcweir sal_Bool bRet = !pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
773cdf0e10cSrcweir nsSwCursorSelOverFlags::SELOVER_TOGGLE );
774cdf0e10cSrcweir if( bRet )
775cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
776cdf0e10cSrcweir return bRet;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir
GotoFld(const SwFmtFld & rFld)780cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoFld( const SwFmtFld& rFld )
781cdf0e10cSrcweir {
782cdf0e10cSrcweir sal_Bool bRet = sal_False;
783cdf0e10cSrcweir if( rFld.GetTxtFld() )
784cdf0e10cSrcweir {
785cdf0e10cSrcweir SET_CURR_SHELL( this );
786cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
787cdf0e10cSrcweir
788cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
789cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
790cdf0e10cSrcweir
791cdf0e10cSrcweir SwTxtNode* pTNd = (SwTxtNode*)rFld.GetTxtFld()->GetpTxtNode();
792cdf0e10cSrcweir pCrsr->GetPoint()->nNode = *pTNd;
793cdf0e10cSrcweir pCrsr->GetPoint()->nContent.Assign( pTNd, *rFld.GetTxtFld()->GetStart() );
794cdf0e10cSrcweir
795cdf0e10cSrcweir bRet = !pCrsr->IsSelOvr();
796cdf0e10cSrcweir if( bRet )
797cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
798cdf0e10cSrcweir }
799cdf0e10cSrcweir return bRet;
800cdf0e10cSrcweir }
801cdf0e10cSrcweir
802cdf0e10cSrcweir
GetTxtFldAtPos(const SwPosition * pPos,const bool bIncludeInputFldAtStart) const80369a74367SOliver-Rainer Wittmann SwTxtFld * SwCrsrShell::GetTxtFldAtPos(
80469a74367SOliver-Rainer Wittmann const SwPosition* pPos,
80569a74367SOliver-Rainer Wittmann const bool bIncludeInputFldAtStart ) const
80669a74367SOliver-Rainer Wittmann {
80769a74367SOliver-Rainer Wittmann SwTxtFld* pTxtFld = NULL;
80869a74367SOliver-Rainer Wittmann
80969a74367SOliver-Rainer Wittmann SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
81069a74367SOliver-Rainer Wittmann if ( pNode != NULL )
81169a74367SOliver-Rainer Wittmann {
81269a74367SOliver-Rainer Wittmann pTxtFld = pNode->GetFldTxtAttrAt( pPos->nContent.GetIndex(), bIncludeInputFldAtStart );
81369a74367SOliver-Rainer Wittmann }
81469a74367SOliver-Rainer Wittmann
81569a74367SOliver-Rainer Wittmann return pTxtFld;
81669a74367SOliver-Rainer Wittmann }
81769a74367SOliver-Rainer Wittmann
81869a74367SOliver-Rainer Wittmann
GetFieldAtCrsr(const SwPaM * pCrsr,const bool bIncludeInputFldAtStart) const81969a74367SOliver-Rainer Wittmann SwField* SwCrsrShell::GetFieldAtCrsr(
82069a74367SOliver-Rainer Wittmann const SwPaM* pCrsr,
82169a74367SOliver-Rainer Wittmann const bool bIncludeInputFldAtStart ) const
82269a74367SOliver-Rainer Wittmann {
82369a74367SOliver-Rainer Wittmann SwField* pFieldAtCrsr = NULL;
82469a74367SOliver-Rainer Wittmann
82569a74367SOliver-Rainer Wittmann SwTxtFld* pTxtFld = GetTxtFldAtPos( pCrsr->Start(), bIncludeInputFldAtStart );
82669a74367SOliver-Rainer Wittmann if ( pTxtFld != NULL
82769a74367SOliver-Rainer Wittmann && pCrsr->Start()->nNode == pCrsr->End()->nNode )
82869a74367SOliver-Rainer Wittmann {
82969a74367SOliver-Rainer Wittmann const xub_StrLen nTxtFldLength =
83069a74367SOliver-Rainer Wittmann pTxtFld->End() != NULL
83169a74367SOliver-Rainer Wittmann ? *(pTxtFld->End()) - *(pTxtFld->GetStart())
83269a74367SOliver-Rainer Wittmann : 1;
83369a74367SOliver-Rainer Wittmann if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTxtFldLength )
83469a74367SOliver-Rainer Wittmann {
83569a74367SOliver-Rainer Wittmann pFieldAtCrsr = (SwField*)pTxtFld->GetFmtFld().GetField();
83669a74367SOliver-Rainer Wittmann }
83769a74367SOliver-Rainer Wittmann }
83869a74367SOliver-Rainer Wittmann
83969a74367SOliver-Rainer Wittmann return pFieldAtCrsr;
84069a74367SOliver-Rainer Wittmann }
84169a74367SOliver-Rainer Wittmann
84269a74367SOliver-Rainer Wittmann
GetCurFld(const bool bIncludeInputFldAtStart) const84369a74367SOliver-Rainer Wittmann SwField* SwCrsrShell::GetCurFld( const bool bIncludeInputFldAtStart ) const
84469a74367SOliver-Rainer Wittmann {
84569a74367SOliver-Rainer Wittmann SwPaM* pCrsr = GetCrsr();
84669a74367SOliver-Rainer Wittmann if ( pCrsr->GetNext() != pCrsr )
84769a74367SOliver-Rainer Wittmann {
84869a74367SOliver-Rainer Wittmann // multi selection not handled.
84969a74367SOliver-Rainer Wittmann return NULL;
85069a74367SOliver-Rainer Wittmann }
85169a74367SOliver-Rainer Wittmann
85269a74367SOliver-Rainer Wittmann SwField* pCurFld = GetFieldAtCrsr( pCrsr, bIncludeInputFldAtStart );;
85369a74367SOliver-Rainer Wittmann if ( pCurFld != NULL
85469a74367SOliver-Rainer Wittmann && RES_TABLEFLD == pCurFld->GetTyp()->Which() )
85569a74367SOliver-Rainer Wittmann {
85669a74367SOliver-Rainer Wittmann // TabellenFormel ? wandel internen in externen Namen um
85769a74367SOliver-Rainer Wittmann const SwTableNode* pTblNd = IsCrsrInTbl();
85869a74367SOliver-Rainer Wittmann ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
85969a74367SOliver-Rainer Wittmann }
86069a74367SOliver-Rainer Wittmann
86169a74367SOliver-Rainer Wittmann return pCurFld;
86269a74367SOliver-Rainer Wittmann }
86369a74367SOliver-Rainer Wittmann
86469a74367SOliver-Rainer Wittmann
CrsrInsideInputFld() const86569a74367SOliver-Rainer Wittmann bool SwCrsrShell::CrsrInsideInputFld() const
86669a74367SOliver-Rainer Wittmann {
86769a74367SOliver-Rainer Wittmann bool bCrsrInsideInputFld = false;
86869a74367SOliver-Rainer Wittmann
86969a74367SOliver-Rainer Wittmann const SwPaM* pCrsr = GetCrsr();
87069a74367SOliver-Rainer Wittmann const SwPaM* pFirst = pCrsr;
87169a74367SOliver-Rainer Wittmann do
87269a74367SOliver-Rainer Wittmann {
87369a74367SOliver-Rainer Wittmann bCrsrInsideInputFld = dynamic_cast<const SwInputField*>(GetFieldAtCrsr( pCrsr, false )) != NULL;
87469a74367SOliver-Rainer Wittmann
87569a74367SOliver-Rainer Wittmann pCrsr = static_cast<SwPaM*>(pCrsr->GetNext());
87669a74367SOliver-Rainer Wittmann } while ( !bCrsrInsideInputFld
87769a74367SOliver-Rainer Wittmann && pCrsr != pFirst );
87869a74367SOliver-Rainer Wittmann
87969a74367SOliver-Rainer Wittmann return bCrsrInsideInputFld;
88069a74367SOliver-Rainer Wittmann }
88169a74367SOliver-Rainer Wittmann
88269a74367SOliver-Rainer Wittmann
PosInsideInputFld(const SwPosition & rPos) const88369a74367SOliver-Rainer Wittmann bool SwCrsrShell::PosInsideInputFld( const SwPosition& rPos ) const
88469a74367SOliver-Rainer Wittmann {
88569a74367SOliver-Rainer Wittmann return dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, false )) != NULL;
88669a74367SOliver-Rainer Wittmann }
88769a74367SOliver-Rainer Wittmann
88869a74367SOliver-Rainer Wittmann
DocPtInsideInputFld(const Point & rDocPt) const88969a74367SOliver-Rainer Wittmann bool SwCrsrShell::DocPtInsideInputFld( const Point& rDocPt ) const
89069a74367SOliver-Rainer Wittmann {
89169a74367SOliver-Rainer Wittmann SwPosition aPos( *(GetCrsr()->Start()) );
89269a74367SOliver-Rainer Wittmann Point aDocPt( rDocPt );
89369a74367SOliver-Rainer Wittmann if ( GetLayout()->GetCrsrOfst( &aPos, aDocPt ) )
89469a74367SOliver-Rainer Wittmann {
89569a74367SOliver-Rainer Wittmann return PosInsideInputFld( aPos );
89669a74367SOliver-Rainer Wittmann }
89769a74367SOliver-Rainer Wittmann return false;
89869a74367SOliver-Rainer Wittmann }
89969a74367SOliver-Rainer Wittmann
90069a74367SOliver-Rainer Wittmann
StartOfInputFldAtPos(const SwPosition & rPos) const90169a74367SOliver-Rainer Wittmann xub_StrLen SwCrsrShell::StartOfInputFldAtPos( const SwPosition& rPos ) const
90269a74367SOliver-Rainer Wittmann {
90369a74367SOliver-Rainer Wittmann const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
90469a74367SOliver-Rainer Wittmann if ( pTxtInputFld == NULL )
90569a74367SOliver-Rainer Wittmann {
90669a74367SOliver-Rainer Wittmann ASSERT( false, "<SwEditShell::StartOfInputFldAtPos(..)> - no Input Field at given position" );
90769a74367SOliver-Rainer Wittmann return 0;
90869a74367SOliver-Rainer Wittmann }
90969a74367SOliver-Rainer Wittmann return *(pTxtInputFld->GetStart());
91069a74367SOliver-Rainer Wittmann }
91169a74367SOliver-Rainer Wittmann
91269a74367SOliver-Rainer Wittmann
EndOfInputFldAtPos(const SwPosition & rPos) const91369a74367SOliver-Rainer Wittmann xub_StrLen SwCrsrShell::EndOfInputFldAtPos( const SwPosition& rPos ) const
91469a74367SOliver-Rainer Wittmann {
91569a74367SOliver-Rainer Wittmann const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
91669a74367SOliver-Rainer Wittmann if ( pTxtInputFld == NULL )
91769a74367SOliver-Rainer Wittmann {
91869a74367SOliver-Rainer Wittmann ASSERT( false, "<SwEditShell::EndOfInputFldAtPos(..)> - no Input Field at given position" );
91969a74367SOliver-Rainer Wittmann return 0;
92069a74367SOliver-Rainer Wittmann }
92169a74367SOliver-Rainer Wittmann return *(pTxtInputFld->End());
92269a74367SOliver-Rainer Wittmann }
92369a74367SOliver-Rainer Wittmann
92469a74367SOliver-Rainer Wittmann
GotoOutline(sal_uInt16 nIdx)925cdf0e10cSrcweir void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
926cdf0e10cSrcweir {
927cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
928cdf0e10cSrcweir
929cdf0e10cSrcweir SET_CURR_SHELL( this );
930cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
931cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
932cdf0e10cSrcweir
933cdf0e10cSrcweir const SwNodes& rNds = GetDoc()->GetNodes();
934cdf0e10cSrcweir SwTxtNode* pTxtNd = (SwTxtNode*)rNds.GetOutLineNds()[ nIdx ]->GetTxtNode();
935cdf0e10cSrcweir pCrsr->GetPoint()->nNode = *pTxtNd;
936cdf0e10cSrcweir pCrsr->GetPoint()->nContent.Assign( pTxtNd, 0 );
937cdf0e10cSrcweir
938cdf0e10cSrcweir if( !pCrsr->IsSelOvr() )
939cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
940cdf0e10cSrcweir }
941cdf0e10cSrcweir
942cdf0e10cSrcweir
GotoOutline(const String & rName)943cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoOutline( const String& rName )
944cdf0e10cSrcweir {
945cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
946cdf0e10cSrcweir
947cdf0e10cSrcweir SET_CURR_SHELL( this );
948cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
949cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
950cdf0e10cSrcweir
951cdf0e10cSrcweir sal_Bool bRet = sal_False;
952cdf0e10cSrcweir if( pDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() )
953cdf0e10cSrcweir {
954cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
955cdf0e10cSrcweir bRet = sal_True;
956cdf0e10cSrcweir }
957cdf0e10cSrcweir return bRet;
958cdf0e10cSrcweir }
959cdf0e10cSrcweir
960cdf0e10cSrcweir
961cdf0e10cSrcweir
GotoNextOutline()962cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Num.
963cdf0e10cSrcweir {
964cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
965cdf0e10cSrcweir const SwNodes& rNds = GetDoc()->GetNodes();
966cdf0e10cSrcweir
967cdf0e10cSrcweir SwNode* pNd = pCrsr->GetNode();
968cdf0e10cSrcweir sal_uInt16 nPos;
969cdf0e10cSrcweir if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
970cdf0e10cSrcweir ++nPos;
971cdf0e10cSrcweir
972cdf0e10cSrcweir if( nPos == rNds.GetOutLineNds().Count() )
973cdf0e10cSrcweir return sal_False;
974cdf0e10cSrcweir
975cdf0e10cSrcweir pNd = rNds.GetOutLineNds()[ nPos ];
976cdf0e10cSrcweir
977cdf0e10cSrcweir SET_CURR_SHELL( this );
978cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
979cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
980cdf0e10cSrcweir pCrsr->GetPoint()->nNode = *pNd;
981cdf0e10cSrcweir pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
982cdf0e10cSrcweir
983cdf0e10cSrcweir sal_Bool bRet = !pCrsr->IsSelOvr();
984cdf0e10cSrcweir if( bRet )
985cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
986cdf0e10cSrcweir return bRet;
987cdf0e10cSrcweir }
988cdf0e10cSrcweir
989cdf0e10cSrcweir
GotoPrevOutline()990cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-Num.
991cdf0e10cSrcweir {
992cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
993cdf0e10cSrcweir const SwNodes& rNds = GetDoc()->GetNodes();
994cdf0e10cSrcweir
995cdf0e10cSrcweir SwNode* pNd = pCrsr->GetNode();
996cdf0e10cSrcweir sal_uInt16 nPos;
997cdf0e10cSrcweir rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
998cdf0e10cSrcweir
999cdf0e10cSrcweir sal_Bool bRet = sal_False;
1000cdf0e10cSrcweir if( nPos )
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir --nPos; // davor
1003cdf0e10cSrcweir
1004cdf0e10cSrcweir pNd = rNds.GetOutLineNds()[ nPos ];
1005cdf0e10cSrcweir if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() )
1006cdf0e10cSrcweir return sal_False;
1007cdf0e10cSrcweir
1008cdf0e10cSrcweir SET_CURR_SHELL( this );
1009cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
1010cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
1011cdf0e10cSrcweir pCrsr->GetPoint()->nNode = *pNd;
1012cdf0e10cSrcweir pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
1013cdf0e10cSrcweir
1014cdf0e10cSrcweir bRet = !pCrsr->IsSelOvr();
1015cdf0e10cSrcweir if( bRet )
1016cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir return bRet;
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir
1021cdf0e10cSrcweir
1022cdf0e10cSrcweir // suche die "Outline-Position" vom vorherigen Outline-Node mit dem
1023cdf0e10cSrcweir // Level.
GetOutlinePos(sal_uInt8 nLevel)1024cdf0e10cSrcweir sal_uInt16 SwCrsrShell::GetOutlinePos( sal_uInt8 nLevel )
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir SwPaM* pCrsr = getShellCrsr( true );
1027cdf0e10cSrcweir const SwNodes& rNds = GetDoc()->GetNodes();
1028cdf0e10cSrcweir
1029cdf0e10cSrcweir SwNode* pNd = pCrsr->GetNode();
1030cdf0e10cSrcweir sal_uInt16 nPos;
1031cdf0e10cSrcweir if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
1032cdf0e10cSrcweir nPos++; // steht auf der Position, fuers while zum Naechsten
1033cdf0e10cSrcweir
1034cdf0e10cSrcweir while( nPos-- ) // immer den davor testen !
1035cdf0e10cSrcweir {
1036cdf0e10cSrcweir pNd = rNds.GetOutLineNds()[ nPos ];
1037cdf0e10cSrcweir
1038cdf0e10cSrcweir //if( ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() <= nLevel )//#outline level,zhaojianwei
1039cdf0e10cSrcweir if( ((SwTxtNode*)pNd)->GetAttrOutlineLevel()-1 <= nLevel )//<-end,zhaojianwei
1040cdf0e10cSrcweir return nPos;
1041cdf0e10cSrcweir
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir return USHRT_MAX; // davor keiner mehr also Ende
1044cdf0e10cSrcweir }
1045cdf0e10cSrcweir
1046cdf0e10cSrcweir
MakeOutlineSel(sal_uInt16 nSttPos,sal_uInt16 nEndPos,sal_Bool bWithChilds)1047cdf0e10cSrcweir sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
1048cdf0e10cSrcweir sal_Bool bWithChilds )
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir const SwNodes& rNds = GetDoc()->GetNodes();
1051cdf0e10cSrcweir const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1052cdf0e10cSrcweir if( !rOutlNds.Count() ) // wie jetzt ???
1053cdf0e10cSrcweir return sal_False;
1054cdf0e10cSrcweir
1055cdf0e10cSrcweir SET_CURR_SHELL( this );
1056cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
1057cdf0e10cSrcweir
1058cdf0e10cSrcweir if( nSttPos > nEndPos ) // sollte jemand das vertauscht haben?
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir ASSERT( !this, "Start- > Ende-Position im Array" );
1061cdf0e10cSrcweir sal_uInt16 nTmp = nSttPos;
1062cdf0e10cSrcweir nSttPos = nEndPos;
1063cdf0e10cSrcweir nEndPos = nTmp;
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir
1066cdf0e10cSrcweir SwNode* pSttNd = rOutlNds[ nSttPos ];
1067cdf0e10cSrcweir SwNode* pEndNd = rOutlNds[ nEndPos ];
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir if( bWithChilds )
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir //sal_uInt8 nLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
1072cdf0e10cSrcweir const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end.zhaojianwei
1073cdf0e10cSrcweir for( ++nEndPos; nEndPos < rOutlNds.Count(); ++nEndPos )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir pEndNd = rOutlNds[ nEndPos ];
1076cdf0e10cSrcweir //sal_uInt8 nNxtLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
1077cdf0e10cSrcweir const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei
1078cdf0e10cSrcweir if( nNxtLevel <= nLevel )
1079cdf0e10cSrcweir break; // EndPos steht jetzt auf dem naechsten
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir // ohne Childs, dann aber zumindest auf den naechsten
1083cdf0e10cSrcweir else if( ++nEndPos < rOutlNds.Count() )
1084cdf0e10cSrcweir pEndNd = rOutlNds[ nEndPos ];
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir if( nEndPos == rOutlNds.Count() ) // kein Ende gefunden
1087cdf0e10cSrcweir pEndNd = &rNds.GetEndOfContent();
1088cdf0e10cSrcweir
1089cdf0e10cSrcweir KillPams();
1090cdf0e10cSrcweir
1091cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
1092cdf0e10cSrcweir
1093cdf0e10cSrcweir // Jetzt das Ende ans Ende vom voherigen ContentNode setzen
1094cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pSttNd;
1095cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 );
1096cdf0e10cSrcweir pCurCrsr->SetMark();
1097cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pEndNd;
1098cdf0e10cSrcweir pCurCrsr->Move( fnMoveBackward, fnGoNode ); // ans Ende vom Vorgaenger
1099cdf0e10cSrcweir
1100cdf0e10cSrcweir // und schon ist alles selektiert
1101cdf0e10cSrcweir sal_Bool bRet = !pCurCrsr->IsSelOvr();
1102cdf0e10cSrcweir if( bRet )
1103cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1104cdf0e10cSrcweir return bRet;
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir
1107cdf0e10cSrcweir
1108cdf0e10cSrcweir // springe zu dieser Refmark
GotoRefMark(const String & rRefMark,sal_uInt16 nSubType,sal_uInt16 nSeqNo)1109cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoRefMark( const String& rRefMark, sal_uInt16 nSubType,
1110cdf0e10cSrcweir sal_uInt16 nSeqNo )
1111cdf0e10cSrcweir {
1112cdf0e10cSrcweir SET_CURR_SHELL( this );
1113cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
1114cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir sal_uInt16 nPos;
1117cdf0e10cSrcweir SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
1118cdf0e10cSrcweir nSubType, nSeqNo, &nPos );
1119cdf0e10cSrcweir if( pTxtNd && pTxtNd->GetNodes().IsDocNodes() )
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir pCurCrsr->GetPoint()->nNode = *pTxtNd;
1122cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pTxtNd, nPos );
1123cdf0e10cSrcweir
1124cdf0e10cSrcweir if( !pCurCrsr->IsSelOvr() )
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1127cdf0e10cSrcweir return sal_True;
1128cdf0e10cSrcweir }
1129cdf0e10cSrcweir }
1130cdf0e10cSrcweir return sal_False;
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir
IsPageAtPos(const Point & rPt) const1133cdf0e10cSrcweir sal_Bool SwCrsrShell::IsPageAtPos( const Point &rPt ) const
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir if( GetLayout() )
1136cdf0e10cSrcweir return 0 != GetLayout()->GetPageAtPos( rPt );
1137cdf0e10cSrcweir return sal_False;
1138cdf0e10cSrcweir }
1139cdf0e10cSrcweir
GetContentAtPos(const Point & rPt,SwContentAtPos & rCntntAtPos,sal_Bool bSetCrsr,SwRect * pFldRect)1140cdf0e10cSrcweir sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
1141cdf0e10cSrcweir SwContentAtPos& rCntntAtPos,
1142cdf0e10cSrcweir sal_Bool bSetCrsr,
1143cdf0e10cSrcweir SwRect* pFldRect )
1144cdf0e10cSrcweir {
114569a74367SOliver-Rainer Wittmann SET_CURR_SHELL( this );
114669a74367SOliver-Rainer Wittmann sal_Bool bRet = sal_False;
1147cdf0e10cSrcweir
114869a74367SOliver-Rainer Wittmann if( !IsTableMode() )
114969a74367SOliver-Rainer Wittmann {
115069a74367SOliver-Rainer Wittmann Point aPt( rPt );
115169a74367SOliver-Rainer Wittmann SwPosition aPos( *pCurCrsr->GetPoint() );
115269a74367SOliver-Rainer Wittmann
115369a74367SOliver-Rainer Wittmann SwTxtNode* pTxtNd;
115469a74367SOliver-Rainer Wittmann SwCntntFrm *pFrm(0);
115569a74367SOliver-Rainer Wittmann SwTxtAttr* pTxtAttr;
115669a74367SOliver-Rainer Wittmann SwCrsrMoveState aTmpState;
115769a74367SOliver-Rainer Wittmann aTmpState.bFieldInfo = sal_True;
1158cdf0e10cSrcweir aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos );
1159cdf0e10cSrcweir aTmpState.bCntntCheck = (SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos) ? sal_True : sal_False;
116069a74367SOliver-Rainer Wittmann aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
1161cdf0e10cSrcweir
1162cdf0e10cSrcweir SwSpecialPos aSpecialPos;
1163cdf0e10cSrcweir aTmpState.pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos ) ?
1164cdf0e10cSrcweir &aSpecialPos : 0;
1165cdf0e10cSrcweir
1166cdf0e10cSrcweir const sal_Bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
116769a74367SOliver-Rainer Wittmann pTxtNd = aPos.nNode.GetNode().GetTxtNode();
1168cdf0e10cSrcweir
116969a74367SOliver-Rainer Wittmann const SwNodes& rNds = GetDoc()->GetNodes();
117069a74367SOliver-Rainer Wittmann if( pTxtNd
117169a74367SOliver-Rainer Wittmann && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
117269a74367SOliver-Rainer Wittmann && rNds.GetOutLineNds().Count() )
117369a74367SOliver-Rainer Wittmann {
117469a74367SOliver-Rainer Wittmann const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
117569a74367SOliver-Rainer Wittmann if( pONd )
117669a74367SOliver-Rainer Wittmann {
117769a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
1178cdf0e10cSrcweir rCntntAtPos.sStr = pONd->GetExpandTxt( 0, STRING_LEN, true );
117969a74367SOliver-Rainer Wittmann bRet = sal_True;
118069a74367SOliver-Rainer Wittmann }
118169a74367SOliver-Rainer Wittmann }
118269a74367SOliver-Rainer Wittmann else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos
118369a74367SOliver-Rainer Wittmann && bCrsrFoundExact )
1184cdf0e10cSrcweir {
1185cdf0e10cSrcweir bRet = sal_True;
1186cdf0e10cSrcweir }
118769a74367SOliver-Rainer Wittmann else if( pTxtNd
118869a74367SOliver-Rainer Wittmann && SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
1189cdf0e10cSrcweir {
1190cdf0e10cSrcweir bRet = aTmpState.bInNumPortion;
1191cdf0e10cSrcweir rCntntAtPos.aFnd.pNode = pTxtNd;
1192cdf0e10cSrcweir
1193cdf0e10cSrcweir Size aSizeLogic(aTmpState.nInNumPostionOffset, 0);
1194cdf0e10cSrcweir Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
1195cdf0e10cSrcweir rCntntAtPos.nDist = aSizePixel.Width();
1196cdf0e10cSrcweir }
119769a74367SOliver-Rainer Wittmann else if( bCrsrFoundExact && pTxtNd )
119869a74367SOliver-Rainer Wittmann {
119969a74367SOliver-Rainer Wittmann if( !aTmpState.bPosCorr )
120069a74367SOliver-Rainer Wittmann {
120169a74367SOliver-Rainer Wittmann if ( !bRet
120269a74367SOliver-Rainer Wittmann && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
120369a74367SOliver-Rainer Wittmann && !aTmpState.bFtnNoInfo )
120469a74367SOliver-Rainer Wittmann {
1205cdf0e10cSrcweir const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
1206cdf0e10cSrcweir xub_StrLen nCurrent = aPos.nContent.GetIndex();
1207cdf0e10cSrcweir xub_StrLen nBegin = nCurrent;
1208cdf0e10cSrcweir xub_StrLen nLen = 1;
1209cdf0e10cSrcweir
1210cdf0e10cSrcweir if ( pSmartTagList && pSmartTagList->InWrongWord( nCurrent, nLen ) && !pTxtNd->IsSymbol(nBegin) )
1211cdf0e10cSrcweir {
1212cdf0e10cSrcweir const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
1213cdf0e10cSrcweir const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
1214cdf0e10cSrcweir if ( pSubList )
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir nCurrent = aTmpState.pSpecialPos->nCharOfst;
1217cdf0e10cSrcweir
1218cdf0e10cSrcweir if ( pSubList->InWrongWord( nCurrent, nLen ) )
1219cdf0e10cSrcweir bRet = sal_True;
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir else
1222cdf0e10cSrcweir bRet = sal_True;
1223cdf0e10cSrcweir
122469a74367SOliver-Rainer Wittmann if( bRet && bSetCrsr )
122569a74367SOliver-Rainer Wittmann {
122669a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
122769a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
122869a74367SOliver-Rainer Wittmann pCurCrsr->DeleteMark();
122969a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
123069a74367SOliver-Rainer Wittmann if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
123169a74367SOliver-Rainer Wittmann bRet = sal_False;
123269a74367SOliver-Rainer Wittmann else
123369a74367SOliver-Rainer Wittmann UpdateCrsr();
123469a74367SOliver-Rainer Wittmann }
123569a74367SOliver-Rainer Wittmann if( bRet )
123669a74367SOliver-Rainer Wittmann {
123769a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
1238cdf0e10cSrcweir
123969a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
124069a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
124169a74367SOliver-Rainer Wittmann }
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir }
1244cdf0e10cSrcweir
124569a74367SOliver-Rainer Wittmann if ( !bRet
124669a74367SOliver-Rainer Wittmann && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rCntntAtPos.eCntntAtPos
124769a74367SOliver-Rainer Wittmann && !aTmpState.bFtnNoInfo )
1248cdf0e10cSrcweir {
124969a74367SOliver-Rainer Wittmann pTxtAttr = pTxtNd->GetFldTxtAttrAt( aPos.nContent.GetIndex() );
125069a74367SOliver-Rainer Wittmann const SwField* pFld = pTxtAttr != NULL
125169a74367SOliver-Rainer Wittmann ? pTxtAttr->GetFmtFld().GetField()
125269a74367SOliver-Rainer Wittmann : 0;
125369a74367SOliver-Rainer Wittmann if ( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos
125469a74367SOliver-Rainer Wittmann && pFld && !pFld->HasClickHdl() )
125569a74367SOliver-Rainer Wittmann {
125669a74367SOliver-Rainer Wittmann pFld = 0;
125769a74367SOliver-Rainer Wittmann }
1258cdf0e10cSrcweir
125969a74367SOliver-Rainer Wittmann if ( pFld )
126069a74367SOliver-Rainer Wittmann {
126169a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
126269a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
1263cdf0e10cSrcweir
126469a74367SOliver-Rainer Wittmann if( bSetCrsr )
126569a74367SOliver-Rainer Wittmann {
126669a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
126769a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
126869a74367SOliver-Rainer Wittmann pCurCrsr->DeleteMark();
126969a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
127069a74367SOliver-Rainer Wittmann if( pCurCrsr->IsSelOvr() )
127169a74367SOliver-Rainer Wittmann {
127269a74367SOliver-Rainer Wittmann // Click-Felder in geschuetzten Bereichen zulassen
127369a74367SOliver-Rainer Wittmann // Nur Platzhalter geht nicht!
127469a74367SOliver-Rainer Wittmann if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
127569a74367SOliver-Rainer Wittmann || RES_JUMPEDITFLD == pFld->Which() )
127669a74367SOliver-Rainer Wittmann pFld = 0;
127769a74367SOliver-Rainer Wittmann }
127869a74367SOliver-Rainer Wittmann else
127969a74367SOliver-Rainer Wittmann UpdateCrsr();
128069a74367SOliver-Rainer Wittmann }
128169a74367SOliver-Rainer Wittmann else if( RES_TABLEFLD == pFld->Which() &&
128269a74367SOliver-Rainer Wittmann ((SwTblField*)pFld)->IsIntrnlName() )
128369a74367SOliver-Rainer Wittmann {
128469a74367SOliver-Rainer Wittmann // erzeuge aus der internen (fuer CORE)
128569a74367SOliver-Rainer Wittmann // die externe (fuer UI) Formel
128669a74367SOliver-Rainer Wittmann const SwTableNode* pTblNd = pTxtNd->FindTableNode();
128769a74367SOliver-Rainer Wittmann if( pTblNd ) // steht in einer Tabelle
128869a74367SOliver-Rainer Wittmann ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
128969a74367SOliver-Rainer Wittmann }
129069a74367SOliver-Rainer Wittmann }
1291cdf0e10cSrcweir
129269a74367SOliver-Rainer Wittmann if( pFld )
129369a74367SOliver-Rainer Wittmann {
129469a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pFld = pFld;
129569a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = pTxtAttr;
129669a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
129769a74367SOliver-Rainer Wittmann bRet = sal_True;
129869a74367SOliver-Rainer Wittmann }
129969a74367SOliver-Rainer Wittmann }
1300cdf0e10cSrcweir
130169a74367SOliver-Rainer Wittmann if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
130269a74367SOliver-Rainer Wittmann {
130369a74367SOliver-Rainer Wittmann IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
130469a74367SOliver-Rainer Wittmann sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
130569a74367SOliver-Rainer Wittmann if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
130669a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
130769a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pFldmark = pFldBookmark;
130869a74367SOliver-Rainer Wittmann bRet=sal_True;
130969a74367SOliver-Rainer Wittmann }
131069a74367SOliver-Rainer Wittmann }
131169a74367SOliver-Rainer Wittmann
131269a74367SOliver-Rainer Wittmann if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
131369a74367SOliver-Rainer Wittmann {
131469a74367SOliver-Rainer Wittmann if( aTmpState.bFtnNoInfo )
131569a74367SOliver-Rainer Wittmann {
131669a74367SOliver-Rainer Wittmann // stehe ueber dem Zeichen der Fussnote (??)
131769a74367SOliver-Rainer Wittmann bRet = sal_True;
131869a74367SOliver-Rainer Wittmann if( bSetCrsr )
131969a74367SOliver-Rainer Wittmann {
132069a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
132169a74367SOliver-Rainer Wittmann if( !GotoFtnAnchor() )
132269a74367SOliver-Rainer Wittmann bRet = sal_False;
132369a74367SOliver-Rainer Wittmann }
132469a74367SOliver-Rainer Wittmann if( bRet )
132569a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
132669a74367SOliver-Rainer Wittmann }
1327cdf0e10cSrcweir else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
132869a74367SOliver-Rainer Wittmann aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
132969a74367SOliver-Rainer Wittmann {
133069a74367SOliver-Rainer Wittmann bRet = sal_True;
133169a74367SOliver-Rainer Wittmann if( bSetCrsr )
133269a74367SOliver-Rainer Wittmann {
133369a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
133469a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
133569a74367SOliver-Rainer Wittmann pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
133669a74367SOliver-Rainer Wittmann SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
133769a74367SOliver-Rainer Wittmann &pCurCrsr->GetPoint()->nNode,
133869a74367SOliver-Rainer Wittmann sal_True, !IsReadOnlyAvailable() );
133969a74367SOliver-Rainer Wittmann
134069a74367SOliver-Rainer Wittmann if( pCNd )
134169a74367SOliver-Rainer Wittmann {
134269a74367SOliver-Rainer Wittmann pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
1343cdf0e10cSrcweir if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
134469a74367SOliver-Rainer Wittmann nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
134569a74367SOliver-Rainer Wittmann bRet = sal_False;
134669a74367SOliver-Rainer Wittmann else
134769a74367SOliver-Rainer Wittmann UpdateCrsr();
134869a74367SOliver-Rainer Wittmann }
134969a74367SOliver-Rainer Wittmann else
135069a74367SOliver-Rainer Wittmann bRet = sal_False;
135169a74367SOliver-Rainer Wittmann }
1352cdf0e10cSrcweir
135369a74367SOliver-Rainer Wittmann if( bRet )
135469a74367SOliver-Rainer Wittmann {
135569a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
135669a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = pTxtAttr;
135769a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
1358cdf0e10cSrcweir
135969a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
136069a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
136169a74367SOliver-Rainer Wittmann }
136269a74367SOliver-Rainer Wittmann }
136369a74367SOliver-Rainer Wittmann }
1364cdf0e10cSrcweir
136569a74367SOliver-Rainer Wittmann if( !bRet
136669a74367SOliver-Rainer Wittmann && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rCntntAtPos.eCntntAtPos
136769a74367SOliver-Rainer Wittmann && !aTmpState.bFtnNoInfo )
136869a74367SOliver-Rainer Wittmann {
136969a74367SOliver-Rainer Wittmann pTxtAttr = 0;
137069a74367SOliver-Rainer Wittmann if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
1371cdf0e10cSrcweir {
1372cdf0e10cSrcweir ::std::vector<SwTxtAttr *> const marks(
1373cdf0e10cSrcweir pTxtNd->GetTxtAttrsAt(
1374cdf0e10cSrcweir aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
1375cdf0e10cSrcweir if (marks.size())
1376cdf0e10cSrcweir { // hmm... can only return 1 here
1377cdf0e10cSrcweir pTxtAttr = *marks.begin();
1378cdf0e10cSrcweir }
1379cdf0e10cSrcweir }
1380cdf0e10cSrcweir
138169a74367SOliver-Rainer Wittmann if( !pTxtAttr &&
138269a74367SOliver-Rainer Wittmann SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
1383cdf0e10cSrcweir {
1384cdf0e10cSrcweir ::std::vector<SwTxtAttr *> const marks(
1385cdf0e10cSrcweir pTxtNd->GetTxtAttrsAt(
1386cdf0e10cSrcweir aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
1387cdf0e10cSrcweir if (marks.size())
1388cdf0e10cSrcweir { // hmm... can only return 1 here
1389cdf0e10cSrcweir pTxtAttr = *marks.begin();
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir }
1392cdf0e10cSrcweir
139369a74367SOliver-Rainer Wittmann if( pTxtAttr )
139469a74367SOliver-Rainer Wittmann {
139569a74367SOliver-Rainer Wittmann bRet = sal_True;
139669a74367SOliver-Rainer Wittmann if( bSetCrsr )
139769a74367SOliver-Rainer Wittmann {
139869a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
139969a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
140069a74367SOliver-Rainer Wittmann pCurCrsr->DeleteMark();
140169a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
140269a74367SOliver-Rainer Wittmann if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
140369a74367SOliver-Rainer Wittmann bRet = sal_False;
140469a74367SOliver-Rainer Wittmann else
140569a74367SOliver-Rainer Wittmann UpdateCrsr();
140669a74367SOliver-Rainer Wittmann }
1407cdf0e10cSrcweir
140869a74367SOliver-Rainer Wittmann if( bRet )
140969a74367SOliver-Rainer Wittmann {
141069a74367SOliver-Rainer Wittmann const xub_StrLen* pEnd = pTxtAttr->End();
141169a74367SOliver-Rainer Wittmann if( pEnd )
141269a74367SOliver-Rainer Wittmann rCntntAtPos.sStr =
141369a74367SOliver-Rainer Wittmann pTxtNd->GetExpandTxt( *pTxtAttr->GetStart(), *pEnd - *pTxtAttr->GetStart() );
141469a74367SOliver-Rainer Wittmann else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
141569a74367SOliver-Rainer Wittmann rCntntAtPos.sStr =
141669a74367SOliver-Rainer Wittmann pTxtAttr->GetTOXMark().GetAlternativeText();
141769a74367SOliver-Rainer Wittmann
141869a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos =
141969a74367SOliver-Rainer Wittmann RES_TXTATR_TOXMARK == pTxtAttr->Which()
142069a74367SOliver-Rainer Wittmann ? SwContentAtPos::SW_TOXMARK
142169a74367SOliver-Rainer Wittmann : SwContentAtPos::SW_REFMARK;
142269a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = pTxtAttr;
142369a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
142469a74367SOliver-Rainer Wittmann
142569a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
142669a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
142769a74367SOliver-Rainer Wittmann }
142869a74367SOliver-Rainer Wittmann }
142969a74367SOliver-Rainer Wittmann }
1430cdf0e10cSrcweir
143169a74367SOliver-Rainer Wittmann if ( !bRet
143269a74367SOliver-Rainer Wittmann && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
143369a74367SOliver-Rainer Wittmann && !aTmpState.bFtnNoInfo )
1434cdf0e10cSrcweir {
1435cdf0e10cSrcweir pTxtAttr = pTxtNd->GetTxtAttrAt(
1436cdf0e10cSrcweir aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
143769a74367SOliver-Rainer Wittmann // nur INetAttrs mit URLs "erkennen"
143869a74367SOliver-Rainer Wittmann if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
143969a74367SOliver-Rainer Wittmann {
144069a74367SOliver-Rainer Wittmann bRet = sal_True;
144169a74367SOliver-Rainer Wittmann if( bSetCrsr )
144269a74367SOliver-Rainer Wittmann {
144369a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
144469a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
144569a74367SOliver-Rainer Wittmann pCurCrsr->DeleteMark();
144669a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
1447cdf0e10cSrcweir if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
144869a74367SOliver-Rainer Wittmann nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
144969a74367SOliver-Rainer Wittmann bRet = sal_False;
145069a74367SOliver-Rainer Wittmann else
145169a74367SOliver-Rainer Wittmann UpdateCrsr();
145269a74367SOliver-Rainer Wittmann }
145369a74367SOliver-Rainer Wittmann if( bRet )
145469a74367SOliver-Rainer Wittmann {
145569a74367SOliver-Rainer Wittmann rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
145669a74367SOliver-Rainer Wittmann *pTxtAttr->GetStart(),
145769a74367SOliver-Rainer Wittmann *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
1458cdf0e10cSrcweir
145969a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
146069a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
146169a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = pTxtAttr;
1462cdf0e10cSrcweir
146369a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
146469a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
146569a74367SOliver-Rainer Wittmann }
146669a74367SOliver-Rainer Wittmann }
146769a74367SOliver-Rainer Wittmann }
1468cdf0e10cSrcweir
146969a74367SOliver-Rainer Wittmann if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
147069a74367SOliver-Rainer Wittmann {
147169a74367SOliver-Rainer Wittmann const SwRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
147269a74367SOliver-Rainer Wittmann if( pRedl )
147369a74367SOliver-Rainer Wittmann {
147469a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pRedl = pRedl;
147569a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
147669a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = 0;
147769a74367SOliver-Rainer Wittmann bRet = sal_True;
1478cdf0e10cSrcweir
147969a74367SOliver-Rainer Wittmann if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
148069a74367SOliver-Rainer Wittmann pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
148169a74367SOliver-Rainer Wittmann }
148269a74367SOliver-Rainer Wittmann }
148369a74367SOliver-Rainer Wittmann }
1484cdf0e10cSrcweir
148569a74367SOliver-Rainer Wittmann if( !bRet
148669a74367SOliver-Rainer Wittmann && ( SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
1487cdf0e10cSrcweir #ifdef DBG_UTIL
148869a74367SOliver-Rainer Wittmann || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
1489cdf0e10cSrcweir #endif
149069a74367SOliver-Rainer Wittmann ) )
149169a74367SOliver-Rainer Wittmann {
149269a74367SOliver-Rainer Wittmann const SwTableNode* pTblNd;
149369a74367SOliver-Rainer Wittmann const SwTableBox* pBox;
149469a74367SOliver-Rainer Wittmann const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
149569a74367SOliver-Rainer Wittmann const SfxPoolItem* pItem;
149669a74367SOliver-Rainer Wittmann if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
149769a74367SOliver-Rainer Wittmann 0 != ( pBox = pTblNd->GetTable().GetTblBox(
149869a74367SOliver-Rainer Wittmann pSttNd->GetIndex() )) &&
1499cdf0e10cSrcweir #ifdef DBG_UTIL
150069a74367SOliver-Rainer Wittmann ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
150169a74367SOliver-Rainer Wittmann RES_BOXATR_FORMULA, sal_False, &pItem ) ||
150269a74367SOliver-Rainer Wittmann SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
150369a74367SOliver-Rainer Wittmann RES_BOXATR_VALUE, sal_False, &pItem ))
1504cdf0e10cSrcweir #else
150569a74367SOliver-Rainer Wittmann SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
150669a74367SOliver-Rainer Wittmann RES_BOXATR_FORMULA, sal_False, &pItem )
1507cdf0e10cSrcweir #endif
150869a74367SOliver-Rainer Wittmann )
150969a74367SOliver-Rainer Wittmann {
151069a74367SOliver-Rainer Wittmann SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
151169a74367SOliver-Rainer Wittmann if( pF )
151269a74367SOliver-Rainer Wittmann {
151369a74367SOliver-Rainer Wittmann // dann aber den CellFrame
151469a74367SOliver-Rainer Wittmann pFrm = (SwCntntFrm*)pF;
151569a74367SOliver-Rainer Wittmann while( pF && !pF->IsCellFrm() )
151669a74367SOliver-Rainer Wittmann pF = pF->GetUpper();
151769a74367SOliver-Rainer Wittmann }
1518cdf0e10cSrcweir
151969a74367SOliver-Rainer Wittmann // es wurde ein
152069a74367SOliver-Rainer Wittmann if( aTmpState.bPosCorr )
152169a74367SOliver-Rainer Wittmann {
152269a74367SOliver-Rainer Wittmann if( pF && !pF->Frm().IsInside( aPt ))
152369a74367SOliver-Rainer Wittmann pF = 0;
152469a74367SOliver-Rainer Wittmann }
152569a74367SOliver-Rainer Wittmann else if( !pF )
152669a74367SOliver-Rainer Wittmann pF = pFrm;
1527cdf0e10cSrcweir
152869a74367SOliver-Rainer Wittmann if( pF ) // nur dann ist es gueltig!!
152969a74367SOliver-Rainer Wittmann {
153069a74367SOliver-Rainer Wittmann // erzeuge aus der internen (fuer CORE)
153169a74367SOliver-Rainer Wittmann // die externe (fuer UI) Formel
153269a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
1533cdf0e10cSrcweir #ifdef DBG_UTIL
153469a74367SOliver-Rainer Wittmann if( RES_BOXATR_VALUE == pItem->Which() )
153569a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
153669a74367SOliver-Rainer Wittmann else
1537cdf0e10cSrcweir #endif
153869a74367SOliver-Rainer Wittmann ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
1539cdf0e10cSrcweir
154069a74367SOliver-Rainer Wittmann bRet = sal_True;
154169a74367SOliver-Rainer Wittmann if( bSetCrsr )
154269a74367SOliver-Rainer Wittmann {
154369a74367SOliver-Rainer Wittmann SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
154469a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
154569a74367SOliver-Rainer Wittmann *pCurCrsr->GetPoint() = aPos;
1546cdf0e10cSrcweir if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
154769a74367SOliver-Rainer Wittmann nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
154869a74367SOliver-Rainer Wittmann bRet = sal_False;
154969a74367SOliver-Rainer Wittmann else
155069a74367SOliver-Rainer Wittmann UpdateCrsr();
155169a74367SOliver-Rainer Wittmann }
1552cdf0e10cSrcweir
155369a74367SOliver-Rainer Wittmann if( bRet )
155469a74367SOliver-Rainer Wittmann {
155569a74367SOliver-Rainer Wittmann if( pFldRect )
155669a74367SOliver-Rainer Wittmann {
155769a74367SOliver-Rainer Wittmann *pFldRect = pF->Prt();
155869a74367SOliver-Rainer Wittmann *pFldRect += pF->Frm().Pos();
155969a74367SOliver-Rainer Wittmann }
156069a74367SOliver-Rainer Wittmann rCntntAtPos.pFndTxtAttr = 0;
156169a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pAttr = pItem;
156269a74367SOliver-Rainer Wittmann }
156369a74367SOliver-Rainer Wittmann }
156469a74367SOliver-Rainer Wittmann }
156569a74367SOliver-Rainer Wittmann }
1566cdf0e10cSrcweir
1567cdf0e10cSrcweir #ifdef DBG_UTIL
156869a74367SOliver-Rainer Wittmann if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
156969a74367SOliver-Rainer Wittmann {
157069a74367SOliver-Rainer Wittmann xub_StrLen n = aPos.nContent.GetIndex();
157169a74367SOliver-Rainer Wittmann SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
157269a74367SOliver-Rainer Wittmann POOLATTR_END - 1 );
157369a74367SOliver-Rainer Wittmann if( pTxtNd->GetpSwpHints() )
157469a74367SOliver-Rainer Wittmann {
157569a74367SOliver-Rainer Wittmann for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
157669a74367SOliver-Rainer Wittmann {
157769a74367SOliver-Rainer Wittmann const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
157869a74367SOliver-Rainer Wittmann xub_StrLen nAttrStart = *pHt->GetStart();
157969a74367SOliver-Rainer Wittmann if( nAttrStart > n ) // ueber den Bereich hinaus
158069a74367SOliver-Rainer Wittmann break;
158169a74367SOliver-Rainer Wittmann
158269a74367SOliver-Rainer Wittmann if( 0 != pHt->End() && (
158369a74367SOliver-Rainer Wittmann ( nAttrStart < n &&
158469a74367SOliver-Rainer Wittmann ( pHt->DontExpand() ? n < *pHt->End()
158569a74367SOliver-Rainer Wittmann : n <= *pHt->End() )) ||
158669a74367SOliver-Rainer Wittmann ( n == nAttrStart &&
158769a74367SOliver-Rainer Wittmann ( nAttrStart == *pHt->End() || !n ))) )
158869a74367SOliver-Rainer Wittmann {
158969a74367SOliver-Rainer Wittmann aSet.Put( pHt->GetAttr() );
159069a74367SOliver-Rainer Wittmann }
159169a74367SOliver-Rainer Wittmann }
1592cdf0e10cSrcweir if( pTxtNd->HasSwAttrSet() &&
1593cdf0e10cSrcweir pTxtNd->GetpSwAttrSet()->Count() )
159469a74367SOliver-Rainer Wittmann {
159569a74367SOliver-Rainer Wittmann SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
159669a74367SOliver-Rainer Wittmann // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
159769a74367SOliver-Rainer Wittmann aFmtSet.Differentiate( aSet );
159869a74367SOliver-Rainer Wittmann // jetzt alle zusammen "mergen"
159969a74367SOliver-Rainer Wittmann aSet.Put( aFmtSet );
160069a74367SOliver-Rainer Wittmann }
160169a74367SOliver-Rainer Wittmann }
160269a74367SOliver-Rainer Wittmann else
160369a74367SOliver-Rainer Wittmann pTxtNd->SwCntntNode::GetAttr( aSet );
160469a74367SOliver-Rainer Wittmann
160569a74367SOliver-Rainer Wittmann rCntntAtPos.sStr.AssignAscii(
160669a74367SOliver-Rainer Wittmann RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
160769a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
160869a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += ':';
160969a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
161069a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += ')';
161169a74367SOliver-Rainer Wittmann rCntntAtPos.sStr.AppendAscii(
161269a74367SOliver-Rainer Wittmann RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " ));
161369a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
161469a74367SOliver-Rainer Wittmann if( pTxtNd->GetCondFmtColl() )
161569a74367SOliver-Rainer Wittmann rCntntAtPos.sStr.AppendAscii(
161669a74367SOliver-Rainer Wittmann RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " ))
161769a74367SOliver-Rainer Wittmann += pTxtNd->GetCondFmtColl()->GetName();
161869a74367SOliver-Rainer Wittmann
161969a74367SOliver-Rainer Wittmann if( aSet.Count() )
162069a74367SOliver-Rainer Wittmann {
162169a74367SOliver-Rainer Wittmann String sAttrs;
162269a74367SOliver-Rainer Wittmann SfxItemIter aIter( aSet );
162369a74367SOliver-Rainer Wittmann const SfxPoolItem* pItem = aIter.FirstItem();
162469a74367SOliver-Rainer Wittmann while( sal_True )
162569a74367SOliver-Rainer Wittmann {
162669a74367SOliver-Rainer Wittmann if( !IsInvalidItem( pItem ))
162769a74367SOliver-Rainer Wittmann {
162869a74367SOliver-Rainer Wittmann String aStr;
162969a74367SOliver-Rainer Wittmann GetDoc()->GetAttrPool().GetPresentation( *pItem,
163069a74367SOliver-Rainer Wittmann SFX_ITEM_PRESENTATION_COMPLETE,
163169a74367SOliver-Rainer Wittmann SFX_MAPUNIT_CM, aStr );
163269a74367SOliver-Rainer Wittmann if( sAttrs.Len() )
163369a74367SOliver-Rainer Wittmann sAttrs.AppendAscii(
163469a74367SOliver-Rainer Wittmann RTL_CONSTASCII_STRINGPARAM( ", " ));
163569a74367SOliver-Rainer Wittmann sAttrs += aStr;
163669a74367SOliver-Rainer Wittmann }
163769a74367SOliver-Rainer Wittmann if( aIter.IsAtEnd() )
163869a74367SOliver-Rainer Wittmann break;
163969a74367SOliver-Rainer Wittmann pItem = aIter.NextItem();
164069a74367SOliver-Rainer Wittmann }
164169a74367SOliver-Rainer Wittmann if( sAttrs.Len() )
164269a74367SOliver-Rainer Wittmann {
164369a74367SOliver-Rainer Wittmann if( rCntntAtPos.sStr.Len() )
164469a74367SOliver-Rainer Wittmann rCntntAtPos.sStr += '\n';
164569a74367SOliver-Rainer Wittmann rCntntAtPos.sStr.AppendAscii(
164669a74367SOliver-Rainer Wittmann RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
164769a74367SOliver-Rainer Wittmann += sAttrs;
164869a74367SOliver-Rainer Wittmann }
164969a74367SOliver-Rainer Wittmann }
165069a74367SOliver-Rainer Wittmann bRet = sal_True;
165169a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
165269a74367SOliver-Rainer Wittmann }
1653cdf0e10cSrcweir #endif
165469a74367SOliver-Rainer Wittmann }
165569a74367SOliver-Rainer Wittmann }
1656cdf0e10cSrcweir
165769a74367SOliver-Rainer Wittmann if( !bRet )
165869a74367SOliver-Rainer Wittmann {
165969a74367SOliver-Rainer Wittmann rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
166069a74367SOliver-Rainer Wittmann rCntntAtPos.aFnd.pFld = 0;
166169a74367SOliver-Rainer Wittmann }
166269a74367SOliver-Rainer Wittmann return bRet;
1663cdf0e10cSrcweir }
1664cdf0e10cSrcweir
GetPostItFieldAtCursor() const1665cdf0e10cSrcweir const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
1666cdf0e10cSrcweir {
1667cdf0e10cSrcweir const SwPostItField* pPostItFld = 0;
1668cdf0e10cSrcweir
1669cdf0e10cSrcweir if ( !IsTableMode() )
1670cdf0e10cSrcweir {
1671cdf0e10cSrcweir const SwPosition* pCursorPos = _GetCrsr()->GetPoint();
1672cdf0e10cSrcweir const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
1673cdf0e10cSrcweir if ( pTxtNd )
1674cdf0e10cSrcweir {
167569a74367SOliver-Rainer Wittmann SwTxtAttr* pTxtAttr = pTxtNd->GetFldTxtAttrAt( pCursorPos->nContent.GetIndex() );
167669a74367SOliver-Rainer Wittmann const SwField* pFld = pTxtAttr != NULL ? pTxtAttr->GetFmtFld().GetField() : 0;
1677cdf0e10cSrcweir if ( pFld && pFld->Which()== RES_POSTITFLD )
1678cdf0e10cSrcweir {
1679cdf0e10cSrcweir pPostItFld = static_cast<const SwPostItField*>(pFld);
1680cdf0e10cSrcweir }
1681cdf0e10cSrcweir }
1682cdf0e10cSrcweir }
1683cdf0e10cSrcweir
1684cdf0e10cSrcweir return pPostItFld;
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir
1687cdf0e10cSrcweir // befindet sich der Node in einem geschuetzten Bereich?
IsInProtectSect() const1688cdf0e10cSrcweir sal_Bool SwContentAtPos::IsInProtectSect() const
1689cdf0e10cSrcweir {
1690cdf0e10cSrcweir const SwTxtNode* pNd = 0;
1691cdf0e10cSrcweir if( pFndTxtAttr )
1692cdf0e10cSrcweir {
1693cdf0e10cSrcweir switch( eCntntAtPos )
1694cdf0e10cSrcweir {
1695cdf0e10cSrcweir case SW_FIELD:
1696cdf0e10cSrcweir case SW_CLICKFIELD:
1697cdf0e10cSrcweir pNd = ((SwTxtFld*)pFndTxtAttr)->GetpTxtNode();
1698cdf0e10cSrcweir break;
1699cdf0e10cSrcweir
1700cdf0e10cSrcweir case SW_FTN:
1701cdf0e10cSrcweir pNd = &((SwTxtFtn*)pFndTxtAttr)->GetTxtNode();
1702cdf0e10cSrcweir break;
1703cdf0e10cSrcweir
1704cdf0e10cSrcweir case SW_INETATTR:
1705cdf0e10cSrcweir pNd = ((SwTxtINetFmt*)pFndTxtAttr)->GetpTxtNode();
1706cdf0e10cSrcweir break;
1707cdf0e10cSrcweir
1708cdf0e10cSrcweir default:
1709cdf0e10cSrcweir break;
1710cdf0e10cSrcweir }
1711cdf0e10cSrcweir }
1712cdf0e10cSrcweir
1713cdf0e10cSrcweir const SwCntntFrm* pFrm;
1714cdf0e10cSrcweir return pNd && ( pNd->IsInProtectSect() ||
1715cdf0e10cSrcweir ( 0 != ( pFrm = pNd->getLayoutFrm( pNd->GetDoc()->GetCurrentLayout(), 0,0,sal_False)) &&
1716cdf0e10cSrcweir pFrm->IsProtected() ));
1717cdf0e10cSrcweir }
1718cdf0e10cSrcweir
IsInRTLText() const1719cdf0e10cSrcweir bool SwContentAtPos::IsInRTLText()const
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir bool bRet = false;
1722cdf0e10cSrcweir const SwTxtNode* pNd = 0;
1723cdf0e10cSrcweir if (pFndTxtAttr && (eCntntAtPos == SW_FTN))
1724cdf0e10cSrcweir {
1725cdf0e10cSrcweir const SwTxtFtn* pTxtFtn = static_cast<const SwTxtFtn*>(pFndTxtAttr);
1726cdf0e10cSrcweir if(pTxtFtn->GetStartNode())
1727cdf0e10cSrcweir {
1728cdf0e10cSrcweir SwStartNode* pSttNd = pTxtFtn->GetStartNode()->GetNode().GetStartNode();
1729cdf0e10cSrcweir SwPaM aTemp( *pSttNd );
1730cdf0e10cSrcweir aTemp.Move(fnMoveForward, fnGoNode);
1731cdf0e10cSrcweir SwCntntNode* pCntntNode = aTemp.GetCntntNode();
1732cdf0e10cSrcweir if(pCntntNode && pCntntNode->IsTxtNode())
1733cdf0e10cSrcweir pNd = static_cast<SwTxtNode*>(pCntntNode);
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir }
1736cdf0e10cSrcweir if(pNd)
1737cdf0e10cSrcweir {
1738cdf0e10cSrcweir SwIterator<SwTxtFrm,SwTxtNode> aIter(*pNd);
1739cdf0e10cSrcweir SwTxtFrm* pTmpFrm = aIter.First();
1740cdf0e10cSrcweir while( pTmpFrm )
1741cdf0e10cSrcweir {
1742cdf0e10cSrcweir if ( !pTmpFrm->IsFollow())
1743cdf0e10cSrcweir {
1744cdf0e10cSrcweir bRet = pTmpFrm->IsRightToLeft();
1745cdf0e10cSrcweir break;
1746cdf0e10cSrcweir }
1747cdf0e10cSrcweir pTmpFrm = aIter.Next();
1748cdf0e10cSrcweir }
1749cdf0e10cSrcweir }
1750cdf0e10cSrcweir return bRet;
1751cdf0e10cSrcweir }
1752cdf0e10cSrcweir
175369a74367SOliver-Rainer Wittmann
SelectTxt(const xub_StrLen nStart,const xub_StrLen nEnd)175469a74367SOliver-Rainer Wittmann sal_Bool SwCrsrShell::SelectTxt( const xub_StrLen nStart,
175569a74367SOliver-Rainer Wittmann const xub_StrLen nEnd )
1756cdf0e10cSrcweir {
175769a74367SOliver-Rainer Wittmann SET_CURR_SHELL( this );
175869a74367SOliver-Rainer Wittmann sal_Bool bRet = sal_False;
1759cdf0e10cSrcweir
176069a74367SOliver-Rainer Wittmann SwCallLink aLk( *this );
176169a74367SOliver-Rainer Wittmann SwCrsrSaveState aSaveState( *pCurCrsr );
176269a74367SOliver-Rainer Wittmann
176369a74367SOliver-Rainer Wittmann SwPosition& rPos = *pCurCrsr->GetPoint();
176469a74367SOliver-Rainer Wittmann pCurCrsr->DeleteMark();
176569a74367SOliver-Rainer Wittmann rPos.nContent = nStart;
176669a74367SOliver-Rainer Wittmann pCurCrsr->SetMark();
176769a74367SOliver-Rainer Wittmann rPos.nContent = nEnd;
176869a74367SOliver-Rainer Wittmann
176969a74367SOliver-Rainer Wittmann if( !pCurCrsr->IsSelOvr() )
177069a74367SOliver-Rainer Wittmann {
177169a74367SOliver-Rainer Wittmann UpdateCrsr();
177269a74367SOliver-Rainer Wittmann bRet = sal_True;
177369a74367SOliver-Rainer Wittmann }
177469a74367SOliver-Rainer Wittmann
177569a74367SOliver-Rainer Wittmann return bRet;
177669a74367SOliver-Rainer Wittmann }
177769a74367SOliver-Rainer Wittmann
177869a74367SOliver-Rainer Wittmann
SelectTxtAttr(sal_uInt16 nWhich,sal_Bool bExpand,const SwTxtAttr * pTxtAttr)177969a74367SOliver-Rainer Wittmann sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich,
178069a74367SOliver-Rainer Wittmann sal_Bool bExpand,
178169a74367SOliver-Rainer Wittmann const SwTxtAttr* pTxtAttr )
178269a74367SOliver-Rainer Wittmann {
178369a74367SOliver-Rainer Wittmann SET_CURR_SHELL( this );
178469a74367SOliver-Rainer Wittmann sal_Bool bRet = sal_False;
178569a74367SOliver-Rainer Wittmann
178669a74367SOliver-Rainer Wittmann if( !IsTableMode() )
178769a74367SOliver-Rainer Wittmann {
178869a74367SOliver-Rainer Wittmann if( !pTxtAttr )
178969a74367SOliver-Rainer Wittmann {
179069a74367SOliver-Rainer Wittmann SwPosition& rPos = *pCurCrsr->GetPoint();
179169a74367SOliver-Rainer Wittmann SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
1792cdf0e10cSrcweir pTxtAttr = (pTxtNd)
1793cdf0e10cSrcweir ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
1794cdf0e10cSrcweir static_cast<RES_TXTATR>(nWhich),
1795cdf0e10cSrcweir (bExpand) ? SwTxtNode::EXPAND : SwTxtNode::DEFAULT)
1796cdf0e10cSrcweir : 0;
1797cdf0e10cSrcweir }
1798cdf0e10cSrcweir
179969a74367SOliver-Rainer Wittmann if( pTxtAttr )
180069a74367SOliver-Rainer Wittmann {
180169a74367SOliver-Rainer Wittmann const xub_StrLen* pEnd = pTxtAttr->End();
180269a74367SOliver-Rainer Wittmann bRet = SelectTxt( *pTxtAttr->GetStart(), ( pEnd ? *pEnd : *pTxtAttr->GetStart() + 1 ) );
180369a74367SOliver-Rainer Wittmann }
180469a74367SOliver-Rainer Wittmann }
180569a74367SOliver-Rainer Wittmann return bRet;
1806cdf0e10cSrcweir }
1807cdf0e10cSrcweir
1808cdf0e10cSrcweir
GotoINetAttr(const SwTxtINetFmt & rAttr)1809cdf0e10cSrcweir sal_Bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
1810cdf0e10cSrcweir {
1811cdf0e10cSrcweir sal_Bool bRet = sal_False;
1812cdf0e10cSrcweir if( rAttr.GetpTxtNode() )
1813cdf0e10cSrcweir {
1814cdf0e10cSrcweir SwCursor* pCrsr = getShellCrsr( true );
1815cdf0e10cSrcweir
1816cdf0e10cSrcweir SET_CURR_SHELL( this );
1817cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
1818cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCrsr );
1819cdf0e10cSrcweir
1820cdf0e10cSrcweir pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
1821cdf0e10cSrcweir pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
1822cdf0e10cSrcweir *rAttr.GetStart() );
1823cdf0e10cSrcweir bRet = !pCrsr->IsSelOvr();
1824cdf0e10cSrcweir if( bRet )
1825cdf0e10cSrcweir UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
1826cdf0e10cSrcweir }
1827cdf0e10cSrcweir return bRet;
1828cdf0e10cSrcweir }
1829cdf0e10cSrcweir
1830cdf0e10cSrcweir
FindINetAttr(const String & rName) const1831cdf0e10cSrcweir const SwFmtINetFmt* SwCrsrShell::FindINetAttr( const String& rName ) const
1832cdf0e10cSrcweir {
1833cdf0e10cSrcweir return pDoc->FindINetAttr( rName );
1834cdf0e10cSrcweir }
1835cdf0e10cSrcweir
GetShadowCrsrPos(const Point & rPt,SwFillMode eFillMode,SwRect & rRect,sal_Int16 & rOrient)1836cdf0e10cSrcweir sal_Bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
1837cdf0e10cSrcweir SwRect& rRect, sal_Int16& rOrient )
1838cdf0e10cSrcweir {
1839cdf0e10cSrcweir
1840cdf0e10cSrcweir SET_CURR_SHELL( this );
1841cdf0e10cSrcweir sal_Bool bRet = sal_False;
1842cdf0e10cSrcweir
1843cdf0e10cSrcweir if (!IsTableMode() && !HasSelection()
1844cdf0e10cSrcweir && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1845cdf0e10cSrcweir {
1846cdf0e10cSrcweir Point aPt( rPt );
1847cdf0e10cSrcweir SwPosition aPos( *pCurCrsr->GetPoint() );
1848cdf0e10cSrcweir
1849cdf0e10cSrcweir SwFillCrsrPos aFPos( eFillMode );
1850cdf0e10cSrcweir SwCrsrMoveState aTmpState( &aFPos );
1851cdf0e10cSrcweir
1852cdf0e10cSrcweir if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) &&
1853cdf0e10cSrcweir !aPos.nNode.GetNode().IsProtect())
1854cdf0e10cSrcweir {
1855cdf0e10cSrcweir // Start-Position im geschuetzten Bereich?
1856cdf0e10cSrcweir rRect = aFPos.aCrsr;
1857cdf0e10cSrcweir rOrient = aFPos.eOrient;
1858cdf0e10cSrcweir bRet = sal_True;
1859cdf0e10cSrcweir }
1860cdf0e10cSrcweir }
1861cdf0e10cSrcweir return bRet;
1862cdf0e10cSrcweir }
1863cdf0e10cSrcweir
SetShadowCrsrPos(const Point & rPt,SwFillMode eFillMode)1864cdf0e10cSrcweir sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
1865cdf0e10cSrcweir {
1866cdf0e10cSrcweir SET_CURR_SHELL( this );
1867cdf0e10cSrcweir sal_Bool bRet = sal_False;
1868cdf0e10cSrcweir
1869cdf0e10cSrcweir if (!IsTableMode() && !HasSelection()
1870cdf0e10cSrcweir && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
1871cdf0e10cSrcweir {
1872cdf0e10cSrcweir Point aPt( rPt );
1873cdf0e10cSrcweir SwPosition aPos( *pCurCrsr->GetPoint() );
1874cdf0e10cSrcweir
1875cdf0e10cSrcweir SwFillCrsrPos aFPos( eFillMode );
1876cdf0e10cSrcweir SwCrsrMoveState aTmpState( &aFPos );
1877cdf0e10cSrcweir
1878cdf0e10cSrcweir if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) )
1879cdf0e10cSrcweir {
1880cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen
1881cdf0e10cSrcweir StartAction();
1882cdf0e10cSrcweir
1883cdf0e10cSrcweir SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
1884cdf0e10cSrcweir SwUndoId nUndoId = UNDO_INS_FROM_SHADOWCRSR;
1885cdf0e10cSrcweir // Werden nur die Absatzattribute Adjust oder LRSpace gesetzt,
1886cdf0e10cSrcweir // dann sollte der naechste Aufruf die NICHT wieder entfernen.
1887cdf0e10cSrcweir if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
1888cdf0e10cSrcweir ( FILL_INDENT == aFPos.eMode ||
1889cdf0e10cSrcweir ( text::HoriOrientation::NONE != aFPos.eOrient &&
1890cdf0e10cSrcweir 0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
1891cdf0e10cSrcweir pCNd && pCNd->Len() )
1892cdf0e10cSrcweir nUndoId = UNDO_EMPTY;
1893cdf0e10cSrcweir
1894cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL );
1895cdf0e10cSrcweir
1896cdf0e10cSrcweir SwTxtFmtColl* pNextFmt = 0;
1897cdf0e10cSrcweir SwTxtNode* pTNd = pCNd->GetTxtNode();
1898cdf0e10cSrcweir if( pTNd )
1899cdf0e10cSrcweir pNextFmt = &pTNd->GetTxtColl()->GetNextTxtFmtColl();
1900cdf0e10cSrcweir
1901cdf0e10cSrcweir const SwSectionNode* pSectNd = pCNd->FindSectionNode();
1902cdf0e10cSrcweir if( pSectNd && aFPos.nParaCnt )
1903cdf0e10cSrcweir {
1904cdf0e10cSrcweir SwNodeIndex aEnd( aPos.nNode, 1 );
1905cdf0e10cSrcweir while( aEnd.GetNode().IsEndNode() &&
1906cdf0e10cSrcweir (const SwNode*)&aEnd.GetNode() !=
1907cdf0e10cSrcweir pSectNd->EndOfSectionNode() )
1908cdf0e10cSrcweir aEnd++;
1909cdf0e10cSrcweir
1910cdf0e10cSrcweir if( aEnd.GetNode().IsEndNode() &&
1911cdf0e10cSrcweir pCNd->Len() == aPos.nContent.GetIndex() )
1912cdf0e10cSrcweir aPos.nNode = *pSectNd->EndOfSectionNode();
1913cdf0e10cSrcweir }
1914cdf0e10cSrcweir
1915cdf0e10cSrcweir for( sal_uInt16 n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
1916cdf0e10cSrcweir {
1917cdf0e10cSrcweir GetDoc()->AppendTxtNode( aPos );
1918cdf0e10cSrcweir if( !n && pNextFmt )
1919cdf0e10cSrcweir {
1920cdf0e10cSrcweir *pCurCrsr->GetPoint() = aPos;
1921cdf0e10cSrcweir GetDoc()->SetTxtFmtColl( *pCurCrsr, pNextFmt, false );
1922cdf0e10cSrcweir //JP 04.11.97: erstmal keine Folgevorlage der
1923cdf0e10cSrcweir // Folgevorlage beachten
1924cdf0e10cSrcweir // pNextFmt = pNextFmt->GetNextTxtFmtColl();
1925cdf0e10cSrcweir }
1926cdf0e10cSrcweir if( n < aFPos.nColumnCnt )
1927cdf0e10cSrcweir {
1928cdf0e10cSrcweir *pCurCrsr->GetPoint() = aPos;
1929cdf0e10cSrcweir GetDoc()->InsertPoolItem( *pCurCrsr,
1930cdf0e10cSrcweir SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE, RES_BREAK ), 0);
1931cdf0e10cSrcweir }
1932cdf0e10cSrcweir }
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir *pCurCrsr->GetPoint() = aPos;
1935cdf0e10cSrcweir switch( aFPos.eMode )
1936cdf0e10cSrcweir {
1937cdf0e10cSrcweir case FILL_INDENT:
1938cdf0e10cSrcweir if( 0 != (pCNd = aPos.nNode.GetNode().GetCntntNode() ))
1939cdf0e10cSrcweir {
1940cdf0e10cSrcweir SfxItemSet aSet( GetDoc()->GetAttrPool(),
1941cdf0e10cSrcweir RES_LR_SPACE, RES_LR_SPACE,
1942cdf0e10cSrcweir RES_PARATR_ADJUST, RES_PARATR_ADJUST,
1943cdf0e10cSrcweir 0 );
1944cdf0e10cSrcweir SvxLRSpaceItem aLR( (SvxLRSpaceItem&)
1945cdf0e10cSrcweir pCNd->GetAttr( RES_LR_SPACE ) );
1946cdf0e10cSrcweir aLR.SetTxtLeft( aFPos.nTabCnt );
1947cdf0e10cSrcweir aLR.SetTxtFirstLineOfst( 0 );
1948cdf0e10cSrcweir aSet.Put( aLR );
1949cdf0e10cSrcweir
1950cdf0e10cSrcweir const SvxAdjustItem& rAdj = (SvxAdjustItem&)pCNd->
1951cdf0e10cSrcweir GetAttr( RES_PARATR_ADJUST );
1952cdf0e10cSrcweir if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
1953cdf0e10cSrcweir aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ) );
1954cdf0e10cSrcweir
1955cdf0e10cSrcweir GetDoc()->InsertItemSet( *pCurCrsr, aSet, 0 );
1956cdf0e10cSrcweir }
1957cdf0e10cSrcweir else {
1958cdf0e10cSrcweir ASSERT( !this, "wo ist mein CntntNode?" );
1959cdf0e10cSrcweir }
1960cdf0e10cSrcweir break;
1961cdf0e10cSrcweir
1962cdf0e10cSrcweir case FILL_TAB:
1963cdf0e10cSrcweir case FILL_SPACE:
1964cdf0e10cSrcweir {
1965cdf0e10cSrcweir String sInsert;
1966cdf0e10cSrcweir if( aFPos.nTabCnt )
1967cdf0e10cSrcweir sInsert.Fill( aFPos.nTabCnt, '\t' );
1968cdf0e10cSrcweir if( aFPos.nSpaceCnt )
1969cdf0e10cSrcweir {
1970cdf0e10cSrcweir String sSpace;
1971cdf0e10cSrcweir sSpace.Fill( aFPos.nSpaceCnt );
1972cdf0e10cSrcweir sInsert += sSpace;
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir if( sInsert.Len() )
1975cdf0e10cSrcweir {
1976cdf0e10cSrcweir GetDoc()->InsertString( *pCurCrsr, sInsert );
1977cdf0e10cSrcweir }
1978cdf0e10cSrcweir }
1979cdf0e10cSrcweir // kein break - Ausrichtung muss noch gesetzt werden
1980cdf0e10cSrcweir case FILL_MARGIN:
1981cdf0e10cSrcweir if( text::HoriOrientation::NONE != aFPos.eOrient )
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir SvxAdjustItem aAdj( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
1984cdf0e10cSrcweir switch( aFPos.eOrient )
1985cdf0e10cSrcweir {
1986cdf0e10cSrcweir case text::HoriOrientation::CENTER:
1987cdf0e10cSrcweir aAdj.SetAdjust( SVX_ADJUST_CENTER );
1988cdf0e10cSrcweir break;
1989cdf0e10cSrcweir case text::HoriOrientation::RIGHT:
1990cdf0e10cSrcweir aAdj.SetAdjust( SVX_ADJUST_RIGHT );
1991cdf0e10cSrcweir break;
1992cdf0e10cSrcweir default:
1993cdf0e10cSrcweir break;
1994cdf0e10cSrcweir }
1995cdf0e10cSrcweir GetDoc()->InsertPoolItem( *pCurCrsr, aAdj, 0 );
1996cdf0e10cSrcweir }
1997cdf0e10cSrcweir break;
1998cdf0e10cSrcweir }
1999cdf0e10cSrcweir
2000cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL );
2001cdf0e10cSrcweir EndAction();
2002cdf0e10cSrcweir
2003cdf0e10cSrcweir bRet = sal_True;
2004cdf0e10cSrcweir }
2005cdf0e10cSrcweir }
2006cdf0e10cSrcweir return bRet;
2007cdf0e10cSrcweir }
2008cdf0e10cSrcweir
SelNextRedline()2009cdf0e10cSrcweir const SwRedline* SwCrsrShell::SelNextRedline()
2010cdf0e10cSrcweir {
2011cdf0e10cSrcweir const SwRedline* pFnd = 0;
2012cdf0e10cSrcweir if( !IsTableMode() )
2013cdf0e10cSrcweir {
2014cdf0e10cSrcweir SET_CURR_SHELL( this );
2015cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
2016cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
2017cdf0e10cSrcweir
2018cdf0e10cSrcweir pFnd = GetDoc()->SelNextRedline( *pCurCrsr );
2019cdf0e10cSrcweir if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
2020cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
2021cdf0e10cSrcweir else
2022cdf0e10cSrcweir pFnd = 0;
2023cdf0e10cSrcweir }
2024cdf0e10cSrcweir return pFnd;
2025cdf0e10cSrcweir }
2026cdf0e10cSrcweir
SelPrevRedline()2027cdf0e10cSrcweir const SwRedline* SwCrsrShell::SelPrevRedline()
2028cdf0e10cSrcweir {
2029cdf0e10cSrcweir const SwRedline* pFnd = 0;
2030cdf0e10cSrcweir if( !IsTableMode() )
2031cdf0e10cSrcweir {
2032cdf0e10cSrcweir SET_CURR_SHELL( this );
2033cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
2034cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
2035cdf0e10cSrcweir
2036cdf0e10cSrcweir pFnd = GetDoc()->SelPrevRedline( *pCurCrsr );
2037cdf0e10cSrcweir if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
2038cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
2039cdf0e10cSrcweir else
2040cdf0e10cSrcweir pFnd = 0;
2041cdf0e10cSrcweir }
2042cdf0e10cSrcweir return pFnd;
2043cdf0e10cSrcweir }
2044cdf0e10cSrcweir
_GotoRedline(sal_uInt16 nArrPos,sal_Bool bSelect)2045cdf0e10cSrcweir const SwRedline* SwCrsrShell::_GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
2046cdf0e10cSrcweir {
2047cdf0e10cSrcweir const SwRedline* pFnd = 0;
2048cdf0e10cSrcweir SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
2049cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
2050cdf0e10cSrcweir
2051cdf0e10cSrcweir pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ];
2052cdf0e10cSrcweir if( pFnd )
2053cdf0e10cSrcweir {
2054cdf0e10cSrcweir *pCurCrsr->GetPoint() = *pFnd->Start();
2055cdf0e10cSrcweir
2056cdf0e10cSrcweir SwCntntNode* pCNd;
2057cdf0e10cSrcweir SwNodeIndex* pIdx = &pCurCrsr->GetPoint()->nNode;
2058cdf0e10cSrcweir if( !pIdx->GetNode().IsCntntNode() &&
2059cdf0e10cSrcweir 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
2060cdf0e10cSrcweir sal_True, IsReadOnlyAvailable() )) )
2061cdf0e10cSrcweir {
2062cdf0e10cSrcweir if( *pIdx <= pFnd->End()->nNode )
2063cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
2064cdf0e10cSrcweir else
2065cdf0e10cSrcweir pFnd = 0;
2066cdf0e10cSrcweir }
2067cdf0e10cSrcweir
2068cdf0e10cSrcweir if( pFnd && bSelect )
2069cdf0e10cSrcweir {
2070cdf0e10cSrcweir pCurCrsr->SetMark();
2071cdf0e10cSrcweir if( nsRedlineType_t::REDLINE_FMTCOLL == pFnd->GetType() )
2072cdf0e10cSrcweir {
2073cdf0e10cSrcweir pCNd = pIdx->GetNode().GetCntntNode();
2074cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2075cdf0e10cSrcweir pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
2076cdf0e10cSrcweir }
2077cdf0e10cSrcweir else
2078cdf0e10cSrcweir *pCurCrsr->GetPoint() = *pFnd->End();
2079cdf0e10cSrcweir
2080cdf0e10cSrcweir pIdx = &pCurCrsr->GetPoint()->nNode;
2081cdf0e10cSrcweir if( !pIdx->GetNode().IsCntntNode() &&
2082cdf0e10cSrcweir 0 != ( pCNd = GetDoc()->GetNodes().GoPrevSection( pIdx,
2083cdf0e10cSrcweir sal_True, IsReadOnlyAvailable() )) )
2084cdf0e10cSrcweir {
2085cdf0e10cSrcweir if( *pIdx >= pCurCrsr->GetMark()->nNode )
2086cdf0e10cSrcweir pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
2087cdf0e10cSrcweir else
2088cdf0e10cSrcweir pFnd = 0;
2089cdf0e10cSrcweir }
2090cdf0e10cSrcweir }
2091cdf0e10cSrcweir
2092cdf0e10cSrcweir if( !pFnd )
2093cdf0e10cSrcweir {
2094cdf0e10cSrcweir pCurCrsr->DeleteMark();
2095cdf0e10cSrcweir pCurCrsr->RestoreSavePos();
2096cdf0e10cSrcweir }
2097cdf0e10cSrcweir else if( bSelect && *pCurCrsr->GetMark() == *pCurCrsr->GetPoint() )
2098cdf0e10cSrcweir pCurCrsr->DeleteMark();
2099cdf0e10cSrcweir
2100cdf0e10cSrcweir if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
2101cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE
2102cdf0e10cSrcweir | SwCrsrShell::READONLY );
2103cdf0e10cSrcweir else
2104cdf0e10cSrcweir {
2105cdf0e10cSrcweir pFnd = 0;
2106cdf0e10cSrcweir if( bSelect )
2107cdf0e10cSrcweir pCurCrsr->DeleteMark();
2108cdf0e10cSrcweir }
2109cdf0e10cSrcweir }
2110cdf0e10cSrcweir return pFnd;
2111cdf0e10cSrcweir }
2112cdf0e10cSrcweir
GotoRedline(sal_uInt16 nArrPos,sal_Bool bSelect)2113cdf0e10cSrcweir const SwRedline* SwCrsrShell::GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect )
2114cdf0e10cSrcweir {
2115cdf0e10cSrcweir const SwRedline* pFnd = 0;
2116cdf0e10cSrcweir if( !IsTableMode() )
2117cdf0e10cSrcweir {
2118cdf0e10cSrcweir SET_CURR_SHELL( this );
2119cdf0e10cSrcweir
2120cdf0e10cSrcweir const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
2121cdf0e10cSrcweir const SwRedline* pTmp = rTbl[ nArrPos ];
2122cdf0e10cSrcweir sal_uInt16 nSeqNo = pTmp->GetSeqNo();
2123cdf0e10cSrcweir if( nSeqNo && bSelect )
2124cdf0e10cSrcweir {
2125cdf0e10cSrcweir sal_Bool bCheck = sal_False;
2126cdf0e10cSrcweir int nLoopCnt = 2;
2127cdf0e10cSrcweir sal_uInt16 nArrSavPos = nArrPos;
2128cdf0e10cSrcweir
2129cdf0e10cSrcweir do {
2130cdf0e10cSrcweir pTmp = _GotoRedline( nArrPos, sal_True );
2131cdf0e10cSrcweir
2132cdf0e10cSrcweir if( !pFnd )
2133cdf0e10cSrcweir pFnd = pTmp;
2134cdf0e10cSrcweir
2135cdf0e10cSrcweir if( pTmp && bCheck )
2136cdf0e10cSrcweir {
2137cdf0e10cSrcweir // checke auf Ueberlappungen. Das kann durch
2138cdf0e10cSrcweir // FmtColl-Redlines kommen, die auf den gesamten Absatz
2139cdf0e10cSrcweir // aus gedehnt werden.
2140cdf0e10cSrcweir
2141cdf0e10cSrcweir SwPaM* pCur = pCurCrsr;
2142cdf0e10cSrcweir SwPaM* pNextPam = (SwPaM*)pCur->GetNext();
2143cdf0e10cSrcweir SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
2144cdf0e10cSrcweir while( pCur != pNextPam )
2145cdf0e10cSrcweir {
2146cdf0e10cSrcweir const SwPosition *pNStt = pNextPam->Start(),
2147cdf0e10cSrcweir *pNEnd = pNextPam->End();
2148cdf0e10cSrcweir
2149cdf0e10cSrcweir sal_Bool bDel = sal_True;
2150cdf0e10cSrcweir switch( ::ComparePosition( *pCStt, *pCEnd,
2151cdf0e10cSrcweir *pNStt, *pNEnd ))
2152cdf0e10cSrcweir {
2153cdf0e10cSrcweir case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2
2154cdf0e10cSrcweir if( !pCur->HasMark() )
2155cdf0e10cSrcweir {
2156cdf0e10cSrcweir pCur->SetMark();
2157cdf0e10cSrcweir *pCur->GetMark() = *pNStt;
2158cdf0e10cSrcweir }
2159cdf0e10cSrcweir else
2160cdf0e10cSrcweir *pCStt = *pNStt;
2161cdf0e10cSrcweir *pCEnd = *pNEnd;
2162cdf0e10cSrcweir break;
2163cdf0e10cSrcweir
2164cdf0e10cSrcweir case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1
2165cdf0e10cSrcweir case POS_EQUAL: // Pos1 ist genauso gross wie Pos2
2166cdf0e10cSrcweir break;
2167cdf0e10cSrcweir
2168cdf0e10cSrcweir case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang
2169cdf0e10cSrcweir if( !pCur->HasMark() )
2170cdf0e10cSrcweir pCur->SetMark();
2171cdf0e10cSrcweir *pCEnd = *pNEnd;
2172cdf0e10cSrcweir break;
2173cdf0e10cSrcweir case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende
2174cdf0e10cSrcweir if( !pCur->HasMark() )
2175cdf0e10cSrcweir {
2176cdf0e10cSrcweir pCur->SetMark();
2177cdf0e10cSrcweir *pCur->GetMark() = *pNStt;
2178cdf0e10cSrcweir }
2179cdf0e10cSrcweir else
2180cdf0e10cSrcweir *pCStt = *pNStt;
2181cdf0e10cSrcweir break;
2182cdf0e10cSrcweir
2183cdf0e10cSrcweir default:
2184cdf0e10cSrcweir bDel = sal_False;
2185cdf0e10cSrcweir }
2186cdf0e10cSrcweir
2187cdf0e10cSrcweir if( bDel )
2188cdf0e10cSrcweir {
2189cdf0e10cSrcweir // den brauchen wir nicht mehr
2190cdf0e10cSrcweir SwPaM* pPrevPam = (SwPaM*)pNextPam->GetPrev();
2191cdf0e10cSrcweir delete pNextPam;
2192cdf0e10cSrcweir pNextPam = pPrevPam;
2193cdf0e10cSrcweir }
2194cdf0e10cSrcweir pNextPam = (SwPaM*)pNextPam->GetNext();
2195cdf0e10cSrcweir }
2196cdf0e10cSrcweir }
2197cdf0e10cSrcweir
2198cdf0e10cSrcweir sal_uInt16 nFndPos = 2 == nLoopCnt
2199cdf0e10cSrcweir ? rTbl.FindNextOfSeqNo( nArrPos )
2200cdf0e10cSrcweir : rTbl.FindPrevOfSeqNo( nArrPos );
2201cdf0e10cSrcweir if( USHRT_MAX != nFndPos ||
2202cdf0e10cSrcweir ( 0 != ( --nLoopCnt ) && USHRT_MAX != (
2203cdf0e10cSrcweir nFndPos = rTbl.FindPrevOfSeqNo( nArrSavPos ))) )
2204cdf0e10cSrcweir {
2205cdf0e10cSrcweir if( pTmp )
2206cdf0e10cSrcweir {
2207cdf0e10cSrcweir // neuen Cursor erzeugen
2208cdf0e10cSrcweir CreateCrsr();
2209cdf0e10cSrcweir bCheck = sal_True;
2210cdf0e10cSrcweir }
2211cdf0e10cSrcweir nArrPos = nFndPos;
2212cdf0e10cSrcweir }
2213cdf0e10cSrcweir else
2214cdf0e10cSrcweir nLoopCnt = 0;
2215cdf0e10cSrcweir
2216cdf0e10cSrcweir } while( nLoopCnt );
2217cdf0e10cSrcweir }
2218cdf0e10cSrcweir else
2219cdf0e10cSrcweir pFnd = _GotoRedline( nArrPos, bSelect );
2220cdf0e10cSrcweir }
2221cdf0e10cSrcweir return pFnd;
2222cdf0e10cSrcweir }
2223cdf0e10cSrcweir
2224cdf0e10cSrcweir
SelectNxtPrvHyperlink(sal_Bool bNext)2225cdf0e10cSrcweir sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
2226cdf0e10cSrcweir {
2227cdf0e10cSrcweir SwNodes& rNds = GetDoc()->GetNodes();
2228cdf0e10cSrcweir const SwNode* pBodyEndNd = &rNds.GetEndOfContent();
2229cdf0e10cSrcweir const SwNode* pBodySttNd = pBodyEndNd->StartOfSectionNode();
2230cdf0e10cSrcweir sal_uLong nBodySttNdIdx = pBodySttNd->GetIndex();
2231cdf0e10cSrcweir Point aPt;
2232cdf0e10cSrcweir
2233cdf0e10cSrcweir _SetGetExpFld aCmpPos( SwPosition( bNext ? *pBodyEndNd : *pBodySttNd ) );
2234cdf0e10cSrcweir _SetGetExpFld aCurPos( bNext ? *pCurCrsr->End() : *pCurCrsr->Start() );
2235cdf0e10cSrcweir if( aCurPos.GetNode() < nBodySttNdIdx )
2236cdf0e10cSrcweir {
2237cdf0e10cSrcweir const SwCntntNode* pCNd = aCurPos.GetNodeFromCntnt()->GetCntntNode();
2238cdf0e10cSrcweir SwCntntFrm* pFrm;
2239cdf0e10cSrcweir if( pCNd && 0 != ( pFrm = pCNd->getLayoutFrm( GetLayout(), &aPt )) )
2240cdf0e10cSrcweir aCurPos.SetBodyPos( *pFrm );
2241cdf0e10cSrcweir }
2242cdf0e10cSrcweir
2243cdf0e10cSrcweir // check first all the hyperlink fields
2244cdf0e10cSrcweir {
2245cdf0e10cSrcweir const SwTxtNode* pTxtNd;
2246cdf0e10cSrcweir const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
2247cdf0e10cSrcweir for( sal_uInt16 n = pFmts->Count(); 1 < n; )
2248cdf0e10cSrcweir {
2249cdf0e10cSrcweir SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
2250cdf0e10cSrcweir
2251cdf0e10cSrcweir for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
2252cdf0e10cSrcweir if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
2253cdf0e10cSrcweir pTxtNd->GetNodes().IsDocNodes() )
2254cdf0e10cSrcweir {
2255cdf0e10cSrcweir SwTxtINetFmt& rAttr = *pFnd;
2256cdf0e10cSrcweir SwPosition aTmpPos( *pTxtNd );
2257cdf0e10cSrcweir _SetGetExpFld aPos( aTmpPos.nNode, rAttr );
2258cdf0e10cSrcweir SwCntntFrm* pFrm;
2259cdf0e10cSrcweir if( pTxtNd->GetIndex() < nBodySttNdIdx &&
2260cdf0e10cSrcweir 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt )) )
2261cdf0e10cSrcweir aPos.SetBodyPos( *pFrm );
2262cdf0e10cSrcweir
2263cdf0e10cSrcweir if( bNext
2264cdf0e10cSrcweir ? ( aPos < aCmpPos && aCurPos < aPos )
2265cdf0e10cSrcweir : ( aCmpPos < aPos && aPos < aCurPos ))
2266cdf0e10cSrcweir {
2267cdf0e10cSrcweir String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(),
2268cdf0e10cSrcweir *rAttr.GetEnd() - *rAttr.GetStart() ) );
2269cdf0e10cSrcweir
2270cdf0e10cSrcweir sTxt.EraseAllChars( 0x0a );
2271cdf0e10cSrcweir sTxt.EraseLeadingChars().EraseTrailingChars();
2272cdf0e10cSrcweir
2273cdf0e10cSrcweir if( sTxt.Len() )
2274cdf0e10cSrcweir aCmpPos = aPos;
2275cdf0e10cSrcweir }
2276cdf0e10cSrcweir }
2277cdf0e10cSrcweir }
2278cdf0e10cSrcweir }
2279cdf0e10cSrcweir // then check all the Flys with a URL or imapge map
2280cdf0e10cSrcweir {
2281cdf0e10cSrcweir const SwSpzFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
2282cdf0e10cSrcweir for( sal_uInt16 n = 0, nEnd = pFmts->Count(); n < nEnd; ++n )
2283cdf0e10cSrcweir {
2284cdf0e10cSrcweir SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)(*pFmts)[ n ];
2285cdf0e10cSrcweir const SwFmtURL& rURLItem = pFmt->GetURL();
2286cdf0e10cSrcweir if( rURLItem.GetMap() || rURLItem.GetURL().Len() )
2287cdf0e10cSrcweir {
2288cdf0e10cSrcweir SwFlyFrm* pFly = pFmt->GetFrm( &aPt, sal_False );
2289cdf0e10cSrcweir SwPosition aTmpPos( *pBodySttNd );
2290cdf0e10cSrcweir if( pFly &&
2291cdf0e10cSrcweir GetBodyTxtNode( *GetDoc(), aTmpPos, *pFly->GetLower() ) )
2292cdf0e10cSrcweir {
2293cdf0e10cSrcweir _SetGetExpFld aPos( *pFmt, &aTmpPos );
2294cdf0e10cSrcweir
2295cdf0e10cSrcweir if( bNext
2296cdf0e10cSrcweir ? ( aPos < aCmpPos && aCurPos < aPos )
2297cdf0e10cSrcweir : ( aCmpPos < aPos && aPos < aCurPos ))
2298cdf0e10cSrcweir aCmpPos = aPos;
2299cdf0e10cSrcweir }
2300cdf0e10cSrcweir }
2301cdf0e10cSrcweir }
2302cdf0e10cSrcweir }
2303cdf0e10cSrcweir
2304cdf0e10cSrcweir // found any URL ?
2305cdf0e10cSrcweir sal_Bool bRet = sal_False;
2306cdf0e10cSrcweir const SwTxtINetFmt* pFndAttr = aCmpPos.GetINetFmt();
2307cdf0e10cSrcweir const SwFlyFrmFmt* pFndFmt = aCmpPos.GetFlyFmt();
2308cdf0e10cSrcweir if( pFndAttr || pFndFmt )
2309cdf0e10cSrcweir {
2310cdf0e10cSrcweir SET_CURR_SHELL( this );
2311cdf0e10cSrcweir SwCallLink aLk( *this );
2312cdf0e10cSrcweir
2313cdf0e10cSrcweir // find a text attribute ?
2314cdf0e10cSrcweir if( pFndAttr )
2315cdf0e10cSrcweir {
2316cdf0e10cSrcweir SwCrsrSaveState aSaveState( *pCurCrsr );
2317cdf0e10cSrcweir
2318cdf0e10cSrcweir aCmpPos.GetPosOfContent( *pCurCrsr->GetPoint() );
2319cdf0e10cSrcweir pCurCrsr->DeleteMark();
2320cdf0e10cSrcweir pCurCrsr->SetMark();
232169a74367SOliver-Rainer Wittmann pCurCrsr->GetPoint()->nContent = *pFndAttr->End();
2322cdf0e10cSrcweir
2323cdf0e10cSrcweir if( !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
2324cdf0e10cSrcweir {
2325cdf0e10cSrcweir UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|
2326cdf0e10cSrcweir SwCrsrShell::READONLY );
2327cdf0e10cSrcweir bRet = sal_True;
2328cdf0e10cSrcweir }
2329cdf0e10cSrcweir }
2330cdf0e10cSrcweir // find a draw object ?
2331cdf0e10cSrcweir else if( RES_DRAWFRMFMT == pFndFmt->Which() )
2332cdf0e10cSrcweir {
2333cdf0e10cSrcweir const SdrObject* pSObj = pFndFmt->FindSdrObject();
2334cdf0e10cSrcweir ((SwFEShell*)this)->SelectObj( pSObj->GetCurrentBoundRect().Center() );
2335cdf0e10cSrcweir MakeSelVisible();
2336cdf0e10cSrcweir bRet = sal_True;
2337cdf0e10cSrcweir }
2338cdf0e10cSrcweir else // then is it a fly
2339cdf0e10cSrcweir {
2340cdf0e10cSrcweir SwFlyFrm* pFly = pFndFmt->GetFrm(&aPt, sal_False );
2341cdf0e10cSrcweir if( pFly )
2342cdf0e10cSrcweir {
2343cdf0e10cSrcweir ((SwFEShell*)this)->SelectFlyFrm( *pFly, sal_True );
2344cdf0e10cSrcweir MakeSelVisible();
2345cdf0e10cSrcweir bRet = sal_True;
2346cdf0e10cSrcweir }
2347cdf0e10cSrcweir }
2348cdf0e10cSrcweir }
2349cdf0e10cSrcweir return bRet;
2350cdf0e10cSrcweir }
2351cdf0e10cSrcweir
2352