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 <doc.hxx>
29cdf0e10cSrcweir #include <node.hxx>
30cdf0e10cSrcweir #include <rootfrm.hxx>
31cdf0e10cSrcweir #include <editsh.hxx>
32cdf0e10cSrcweir #include <viscrs.hxx>
33cdf0e10cSrcweir #include <IMark.hxx>
34cdf0e10cSrcweir #include <bookmrk.hxx>
35cdf0e10cSrcweir #include <redline.hxx>
36cdf0e10cSrcweir #include <mvsave.hxx>
37cdf0e10cSrcweir #include <docary.hxx>
38cdf0e10cSrcweir #include <unocrsr.hxx>
39cdf0e10cSrcweir #include <swundo.hxx>
40cdf0e10cSrcweir #include <hints.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir /*
43cdf0e10cSrcweir * MACROS um ueber alle CrsrShells zu iterieren
44cdf0e10cSrcweir */
45cdf0e10cSrcweir #define PCURSH ((SwCrsrShell*)_pStartShell)
46cdf0e10cSrcweir #define FOREACHSHELL_START( pEShell ) \
47cdf0e10cSrcweir {\
48cdf0e10cSrcweir ViewShell *_pStartShell = pEShell; \
49cdf0e10cSrcweir do { \
50cdf0e10cSrcweir if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \
51cdf0e10cSrcweir {
52cdf0e10cSrcweir
53cdf0e10cSrcweir #define FOREACHSHELL_END( pEShell ) \
54cdf0e10cSrcweir } \
55cdf0e10cSrcweir } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
58cdf0e10cSrcweir #define PCURCRSR (_pCurrCrsr)
59cdf0e10cSrcweir #define FOREACHPAM_START(pSttCrsr) \
60cdf0e10cSrcweir {\
61cdf0e10cSrcweir SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
62cdf0e10cSrcweir do {
63cdf0e10cSrcweir
64cdf0e10cSrcweir #define FOREACHPAM_END() \
65cdf0e10cSrcweir } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
66cdf0e10cSrcweir }
67cdf0e10cSrcweir
68cdf0e10cSrcweir namespace
69cdf0e10cSrcweir {
70cdf0e10cSrcweir // find the relevant section in which the SwUnoCrsr may wander.
71cdf0e10cSrcweir // returns NULL if no restrictions apply
lcl_FindUnoCrsrSection(const SwNode & rNode)72cdf0e10cSrcweir static const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir const SwStartNode* pStartNode = rNode.StartOfSectionNode();
75cdf0e10cSrcweir while( ( pStartNode != NULL ) &&
76cdf0e10cSrcweir ( pStartNode->StartOfSectionNode() != pStartNode ) &&
77cdf0e10cSrcweir ( pStartNode->GetStartNodeType() == SwNormalStartNode ) )
78cdf0e10cSrcweir pStartNode = pStartNode->StartOfSectionNode();
79cdf0e10cSrcweir
80cdf0e10cSrcweir return pStartNode;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir
lcl_PosCorrAbs(SwPosition & rPos,const SwPosition & rStart,const SwPosition & rEnd,const SwPosition & rNewPos)83cdf0e10cSrcweir static inline bool lcl_PosCorrAbs(SwPosition & rPos,
84cdf0e10cSrcweir const SwPosition& rStart,
85cdf0e10cSrcweir const SwPosition& rEnd,
86cdf0e10cSrcweir const SwPosition& rNewPos)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir if ((rStart <= rPos) && (rPos <= rEnd))
89cdf0e10cSrcweir {
90cdf0e10cSrcweir rPos = rNewPos;
91cdf0e10cSrcweir return true;
92cdf0e10cSrcweir }
93cdf0e10cSrcweir return false;
94cdf0e10cSrcweir };
95cdf0e10cSrcweir
lcl_PaMCorrAbs(SwPaM & rPam,const SwPosition & rStart,const SwPosition & rEnd,const SwPosition & rNewPos)96cdf0e10cSrcweir static inline bool lcl_PaMCorrAbs(SwPaM & rPam,
97cdf0e10cSrcweir const SwPosition& rStart,
98cdf0e10cSrcweir const SwPosition& rEnd,
99cdf0e10cSrcweir const SwPosition& rNewPos)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir bool bRet = false;
102cdf0e10cSrcweir bRet |= lcl_PosCorrAbs(rPam.GetBound(true ), rStart, rEnd, rNewPos);
103cdf0e10cSrcweir bRet |= lcl_PosCorrAbs(rPam.GetBound(false), rStart, rEnd, rNewPos);
104cdf0e10cSrcweir return bRet;
105cdf0e10cSrcweir };
106cdf0e10cSrcweir
lcl_PaMCorrRel1(SwPaM * pPam,SwNode const * const pOldNode,const SwPosition & rNewPos,const xub_StrLen nCntIdx)107cdf0e10cSrcweir static inline void lcl_PaMCorrRel1(SwPaM * pPam,
108cdf0e10cSrcweir SwNode const * const pOldNode,
109cdf0e10cSrcweir const SwPosition& rNewPos,
110cdf0e10cSrcweir const xub_StrLen nCntIdx)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir for(int nb = 0; nb < 2; ++nb)
113cdf0e10cSrcweir if(&((pPam)->GetBound(sal_Bool(nb)).nNode.GetNode()) == pOldNode)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir (pPam)->GetBound(sal_Bool(nb)).nNode = rNewPos.nNode;
116cdf0e10cSrcweir (pPam)->GetBound(sal_Bool(nb)).nContent.Assign(
117cdf0e10cSrcweir const_cast<SwIndexReg*>(rNewPos.nContent.GetIdxReg()),
118cdf0e10cSrcweir nCntIdx + (pPam)->GetBound(sal_Bool(nb)).nContent.GetIndex());
119cdf0e10cSrcweir }
120cdf0e10cSrcweir }
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir
PaMCorrAbs(const SwPaM & rRange,const SwPosition & rNewPos)124cdf0e10cSrcweir void PaMCorrAbs( const SwPaM& rRange,
125cdf0e10cSrcweir const SwPosition& rNewPos )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir SwPosition const aStart( *rRange.Start() );
128cdf0e10cSrcweir SwPosition const aEnd( *rRange.End() );
129cdf0e10cSrcweir SwPosition const aNewPos( rNewPos );
130cdf0e10cSrcweir SwDoc *const pDoc = aStart.nNode.GetNode().GetDoc();
131cdf0e10cSrcweir SwCrsrShell *const pShell = pDoc->GetEditShell();
132cdf0e10cSrcweir
133cdf0e10cSrcweir if( pShell )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir FOREACHSHELL_START( pShell )
136cdf0e10cSrcweir SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
137cdf0e10cSrcweir if( _pStkCrsr )
138cdf0e10cSrcweir do {
139cdf0e10cSrcweir lcl_PaMCorrAbs( *_pStkCrsr, aStart, aEnd, aNewPos );
140cdf0e10cSrcweir } while ( (_pStkCrsr != 0 ) &&
141cdf0e10cSrcweir ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
142cdf0e10cSrcweir
143cdf0e10cSrcweir FOREACHPAM_START( PCURSH->_GetCrsr() )
144cdf0e10cSrcweir lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
145cdf0e10cSrcweir FOREACHPAM_END()
146cdf0e10cSrcweir
147cdf0e10cSrcweir if( PCURSH->IsTableMode() )
148cdf0e10cSrcweir lcl_PaMCorrAbs( *PCURSH->GetTblCrs(), aStart, aEnd, aNewPos );
149cdf0e10cSrcweir
150cdf0e10cSrcweir FOREACHSHELL_END( pShell )
151cdf0e10cSrcweir }
152cdf0e10cSrcweir {
153cdf0e10cSrcweir SwUnoCrsrTbl& rTbl = const_cast<SwUnoCrsrTbl&>(pDoc->GetUnoCrsrTbl());
154cdf0e10cSrcweir
155cdf0e10cSrcweir for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir SwUnoCrsr *const pUnoCursor = rTbl[ n ];
158cdf0e10cSrcweir
159cdf0e10cSrcweir bool bChange = false; // has the UNO cursor been corrected?
160cdf0e10cSrcweir
161cdf0e10cSrcweir // determine whether the UNO cursor will leave it's designated
162cdf0e10cSrcweir // section
163cdf0e10cSrcweir bool const bLeaveSection =
164cdf0e10cSrcweir pUnoCursor->IsRemainInSection() &&
165cdf0e10cSrcweir ( lcl_FindUnoCrsrSection( aNewPos.nNode.GetNode() ) !=
166cdf0e10cSrcweir lcl_FindUnoCrsrSection(
167cdf0e10cSrcweir pUnoCursor->GetPoint()->nNode.GetNode() ) );
168cdf0e10cSrcweir
169cdf0e10cSrcweir FOREACHPAM_START( pUnoCursor )
170cdf0e10cSrcweir bChange |= lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
171cdf0e10cSrcweir FOREACHPAM_END()
172cdf0e10cSrcweir
173cdf0e10cSrcweir SwUnoTableCrsr *const pUnoTblCrsr =
174cdf0e10cSrcweir dynamic_cast<SwUnoTableCrsr *>(rTbl[ n ]);
175cdf0e10cSrcweir if( pUnoTblCrsr )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
178cdf0e10cSrcweir bChange |=
179cdf0e10cSrcweir lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
180cdf0e10cSrcweir FOREACHPAM_END()
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir // if a UNO cursor leaves its designated section, we must inform
184cdf0e10cSrcweir // (and invalidate) said cursor
185cdf0e10cSrcweir if (bChange && bLeaveSection)
186cdf0e10cSrcweir {
187cdf0e10cSrcweir // the UNO cursor has left its section. We need to notify it!
188cdf0e10cSrcweir SwMsgPoolItem aHint( RES_UNOCURSOR_LEAVES_SECTION );
189cdf0e10cSrcweir pUnoCursor->ModifyNotification( &aHint, NULL );
190cdf0e10cSrcweir }
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
CorrAbs(const SwNodeIndex & rOldNode,const SwPosition & rNewPos,const xub_StrLen nOffset,sal_Bool bMoveCrsr)195cdf0e10cSrcweir void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
196cdf0e10cSrcweir const SwPosition& rNewPos,
197cdf0e10cSrcweir const xub_StrLen nOffset,
198cdf0e10cSrcweir sal_Bool bMoveCrsr)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir SwCntntNode *const pCntntNode( rOldNode.GetNode().GetCntntNode() );
201cdf0e10cSrcweir SwPaM const aPam(rOldNode, 0,
202cdf0e10cSrcweir rOldNode, (pCntntNode) ? pCntntNode->Len() : 0);
203cdf0e10cSrcweir SwPosition aNewPos(rNewPos);
204cdf0e10cSrcweir aNewPos.nContent += nOffset;
205cdf0e10cSrcweir
206cdf0e10cSrcweir getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
207dec99bbdSOliver-Rainer Wittmann
208dec99bbdSOliver-Rainer Wittmann // fix redlines
209dec99bbdSOliver-Rainer Wittmann {
210cdf0e10cSrcweir SwRedlineTbl& rTbl = *pRedlineTbl;
211cdf0e10cSrcweir for (sal_uInt16 n = 0; n < rTbl.Count(); )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir // is on position ??
214cdf0e10cSrcweir SwRedline *const pRedline( rTbl[ n ] );
215cdf0e10cSrcweir bool const bChanged =
216cdf0e10cSrcweir lcl_PaMCorrAbs(*pRedline, *aPam.Start(), *aPam.End(), aNewPos);
217cdf0e10cSrcweir // clean up empty redlines: docredln.cxx asserts these as invalid
218cdf0e10cSrcweir if (bChanged && (*pRedline->GetPoint() == *pRedline->GetMark())
219cdf0e10cSrcweir && (pRedline->GetContentIdx() == NULL))
220cdf0e10cSrcweir {
221cdf0e10cSrcweir rTbl.DeleteAndDestroy(n);
222cdf0e10cSrcweir }
223cdf0e10cSrcweir else
224cdf0e10cSrcweir {
225cdf0e10cSrcweir ++n;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir }
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir if(bMoveCrsr)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir ::PaMCorrAbs(aPam, aNewPos);
233cdf0e10cSrcweir }
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
CorrAbs(const SwPaM & rRange,const SwPosition & rNewPos,sal_Bool bMoveCrsr)236*332f371aSOliver-Rainer Wittmann void SwDoc::CorrAbs(
237*332f371aSOliver-Rainer Wittmann const SwPaM& rRange,
238cdf0e10cSrcweir const SwPosition& rNewPos,
239*332f371aSOliver-Rainer Wittmann sal_Bool bMoveCrsr )
240cdf0e10cSrcweir {
241cdf0e10cSrcweir SwPosition aStart(*rRange.Start());
242cdf0e10cSrcweir SwPosition aEnd(*rRange.End());
243cdf0e10cSrcweir SwPosition aNewPos(rNewPos);
244cdf0e10cSrcweir
245*332f371aSOliver-Rainer Wittmann _DelBookmarks( aStart.nNode, aEnd.nNode, NULL, &aStart.nContent, &aEnd.nContent );
246*332f371aSOliver-Rainer Wittmann
247cdf0e10cSrcweir if(bMoveCrsr)
248cdf0e10cSrcweir ::PaMCorrAbs(rRange, rNewPos);
249cdf0e10cSrcweir }
250cdf0e10cSrcweir
CorrAbs(const SwNodeIndex & rStartNode,const SwNodeIndex & rEndNode,const SwPosition & rNewPos,sal_Bool bMoveCrsr)251*332f371aSOliver-Rainer Wittmann void SwDoc::CorrAbs(
252*332f371aSOliver-Rainer Wittmann const SwNodeIndex& rStartNode,
253*332f371aSOliver-Rainer Wittmann const SwNodeIndex& rEndNode,
254*332f371aSOliver-Rainer Wittmann const SwPosition& rNewPos,
255*332f371aSOliver-Rainer Wittmann sal_Bool bMoveCrsr )
256cdf0e10cSrcweir {
257*332f371aSOliver-Rainer Wittmann _DelBookmarks( rStartNode, rEndNode );
258cdf0e10cSrcweir
259cdf0e10cSrcweir if(bMoveCrsr)
260cdf0e10cSrcweir {
261cdf0e10cSrcweir SwCntntNode *const pCntntNode( rEndNode.GetNode().GetCntntNode() );
262cdf0e10cSrcweir SwPaM const aPam(rStartNode, 0,
263cdf0e10cSrcweir rEndNode, (pCntntNode) ? pCntntNode->Len() : 0);
264cdf0e10cSrcweir ::PaMCorrAbs(aPam, rNewPos);
265cdf0e10cSrcweir }
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
268cdf0e10cSrcweir
269cdf0e10cSrcweir
270cdf0e10cSrcweir
271cdf0e10cSrcweir
PaMCorrRel(const SwNodeIndex & rOldNode,const SwPosition & rNewPos,const xub_StrLen nOffset)272cdf0e10cSrcweir void PaMCorrRel( const SwNodeIndex &rOldNode,
273cdf0e10cSrcweir const SwPosition &rNewPos,
274cdf0e10cSrcweir const xub_StrLen nOffset )
275cdf0e10cSrcweir {
276cdf0e10cSrcweir const SwNode* pOldNode = &rOldNode.GetNode();
277cdf0e10cSrcweir SwPosition aNewPos( rNewPos );
278cdf0e10cSrcweir const SwDoc* pDoc = pOldNode->GetDoc();
279cdf0e10cSrcweir
280cdf0e10cSrcweir xub_StrLen nCntIdx = rNewPos.nContent.GetIndex() + nOffset;
281cdf0e10cSrcweir
282cdf0e10cSrcweir SwCrsrShell* pShell = pDoc->GetEditShell();
283cdf0e10cSrcweir if( pShell )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir FOREACHSHELL_START( pShell )
286cdf0e10cSrcweir SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
287cdf0e10cSrcweir if( _pStkCrsr )
288cdf0e10cSrcweir do {
289cdf0e10cSrcweir lcl_PaMCorrRel1( _pStkCrsr, pOldNode, aNewPos, nCntIdx );
290cdf0e10cSrcweir } while ( (_pStkCrsr != 0 ) &&
291cdf0e10cSrcweir ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
292cdf0e10cSrcweir
293cdf0e10cSrcweir FOREACHPAM_START( PCURSH->_GetCrsr() )
294cdf0e10cSrcweir lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx);
295cdf0e10cSrcweir FOREACHPAM_END()
296cdf0e10cSrcweir
297cdf0e10cSrcweir if( PCURSH->IsTableMode() )
298cdf0e10cSrcweir lcl_PaMCorrRel1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nCntIdx );
299cdf0e10cSrcweir
300cdf0e10cSrcweir FOREACHSHELL_END( pShell )
301cdf0e10cSrcweir }
302cdf0e10cSrcweir {
303cdf0e10cSrcweir SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
304cdf0e10cSrcweir for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir FOREACHPAM_START( rTbl[ n ] )
307cdf0e10cSrcweir lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
308cdf0e10cSrcweir FOREACHPAM_END()
309cdf0e10cSrcweir
310cdf0e10cSrcweir SwUnoTableCrsr* pUnoTblCrsr =
311cdf0e10cSrcweir dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]);
312cdf0e10cSrcweir if( pUnoTblCrsr )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
315cdf0e10cSrcweir lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
316cdf0e10cSrcweir FOREACHPAM_END()
317cdf0e10cSrcweir }
318cdf0e10cSrcweir }
319cdf0e10cSrcweir }
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
CorrRel(const SwNodeIndex & rOldNode,const SwPosition & rNewPos,const xub_StrLen nOffset,sal_Bool bMoveCrsr)322cdf0e10cSrcweir void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
323cdf0e10cSrcweir const SwPosition& rNewPos,
324cdf0e10cSrcweir const xub_StrLen nOffset,
325cdf0e10cSrcweir sal_Bool bMoveCrsr)
326cdf0e10cSrcweir {
327cdf0e10cSrcweir getIDocumentMarkAccess()->correctMarksRelative(rOldNode, rNewPos, nOffset);
328cdf0e10cSrcweir
329cdf0e10cSrcweir { // dann die Redlines korrigieren
330cdf0e10cSrcweir SwRedlineTbl& rTbl = *pRedlineTbl;
331cdf0e10cSrcweir SwPosition aNewPos(rNewPos);
332cdf0e10cSrcweir for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
333cdf0e10cSrcweir {
334cdf0e10cSrcweir // liegt auf der Position ??
335cdf0e10cSrcweir lcl_PaMCorrRel1( rTbl[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset );
336cdf0e10cSrcweir }
337cdf0e10cSrcweir }
338cdf0e10cSrcweir
339cdf0e10cSrcweir if(bMoveCrsr)
340cdf0e10cSrcweir ::PaMCorrRel(rOldNode, rNewPos, nOffset);
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir
GetEditShell(ViewShell ** ppSh) const344cdf0e10cSrcweir SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const
345cdf0e10cSrcweir {
346cdf0e10cSrcweir // Layout und OLE-Shells sollten vorhanden sein!
347cdf0e10cSrcweir if( pCurrentView )
348cdf0e10cSrcweir {
349cdf0e10cSrcweir ViewShell *pSh = pCurrentView, *pVSh = pSh;
350cdf0e10cSrcweir if( ppSh )
351cdf0e10cSrcweir *ppSh = pSh;
352cdf0e10cSrcweir
353cdf0e10cSrcweir // wir suchen uns eine EditShell, falls diese existiert
354cdf0e10cSrcweir do {
355cdf0e10cSrcweir if( pSh->IsA( TYPE( SwEditShell ) ) )
356cdf0e10cSrcweir return (SwEditShell*)pSh;
357cdf0e10cSrcweir
358cdf0e10cSrcweir } while( pVSh != ( pSh = (ViewShell*)pSh->GetNext() ));
359cdf0e10cSrcweir }
360cdf0e10cSrcweir else if( ppSh )
361cdf0e10cSrcweir *ppSh = 0; //swmod 071029//swmod 071225
362cdf0e10cSrcweir
363cdf0e10cSrcweir return 0;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
GetIShellCursorSupplier()366cdf0e10cSrcweir ::sw::IShellCursorSupplier * SwDoc::GetIShellCursorSupplier()
367cdf0e10cSrcweir {
368cdf0e10cSrcweir return GetEditShell(0);
369cdf0e10cSrcweir }
370cdf0e10cSrcweir
371