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 #include <hintids.hxx>
28cdf0e10cSrcweir #include <tools/list.hxx>
29cdf0e10cSrcweir #include <tools/urlobj.hxx>
30cdf0e10cSrcweir #include <vcl/cmdevt.hxx>
31cdf0e10cSrcweir #include <unotools/charclass.hxx>
32cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
33cdf0e10cSrcweir #include <unotools/transliterationwrapper.hxx>
34cdf0e10cSrcweir #include <swwait.hxx>
35cdf0e10cSrcweir #include <fmtsrnd.hxx>
36cdf0e10cSrcweir #include <fmtinfmt.hxx>
37cdf0e10cSrcweir #include <txtinet.hxx>
38cdf0e10cSrcweir #include <frmfmt.hxx>
39cdf0e10cSrcweir #include <charfmt.hxx>
40cdf0e10cSrcweir #include <doc.hxx>
41cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx>
42cdf0e10cSrcweir #include <docary.hxx>
43cdf0e10cSrcweir #include <editsh.hxx>
44cdf0e10cSrcweir #include <frame.hxx>
45cdf0e10cSrcweir #include <cntfrm.hxx>
46cdf0e10cSrcweir #include <pam.hxx>
47cdf0e10cSrcweir #include <ndtxt.hxx> // fuer SwTxtNode
48cdf0e10cSrcweir #include <grfatr.hxx>
49cdf0e10cSrcweir #include <flyfrm.hxx>
50cdf0e10cSrcweir #include <swtable.hxx>
51cdf0e10cSrcweir #include <swundo.hxx> // UNDO_START, UNDO_END
52cdf0e10cSrcweir #include <calc.hxx>
53cdf0e10cSrcweir #include <edimp.hxx>
54cdf0e10cSrcweir #include <ndgrf.hxx>
55cdf0e10cSrcweir #include <ndole.hxx>
56cdf0e10cSrcweir #include <txtfrm.hxx>
57cdf0e10cSrcweir #include <rootfrm.hxx>
58cdf0e10cSrcweir #include <extinput.hxx>
59cdf0e10cSrcweir #include <crsskip.hxx>
60cdf0e10cSrcweir #include <scriptinfo.hxx>
61cdf0e10cSrcweir #include <unocrsrhelper.hxx>
62cdf0e10cSrcweir #include <section.hxx>
63cdf0e10cSrcweir #include <unochart.hxx>
64cdf0e10cSrcweir #include <numrule.hxx>
65cdf0e10cSrcweir #include <SwNodeNum.hxx>
66cdf0e10cSrcweir #include <unocrsr.hxx>
67cdf0e10cSrcweir #include <switerator.hxx>
68cdf0e10cSrcweir
69cdf0e10cSrcweir using namespace com::sun::star;
70cdf0e10cSrcweir
71cdf0e10cSrcweir
SV_IMPL_PTRARR(SwGetINetAttrs,SwGetINetAttr *)72cdf0e10cSrcweir SV_IMPL_PTRARR(SwGetINetAttrs, SwGetINetAttr*)
73cdf0e10cSrcweir
74cdf0e10cSrcweir /******************************************************************************
75cdf0e10cSrcweir * void SwEditShell::Insert(char c)
76cdf0e10cSrcweir ******************************************************************************/
77cdf0e10cSrcweir
78cdf0e10cSrcweir
79cdf0e10cSrcweir void SwEditShell::Insert( sal_Unicode c, sal_Bool bOnlyCurrCrsr )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir StartAllAction();
82cdf0e10cSrcweir FOREACHPAM_START(this)
83cdf0e10cSrcweir
84cdf0e10cSrcweir const bool bSuccess = GetDoc()->InsertString(*PCURCRSR, c);
85cdf0e10cSrcweir ASSERT( bSuccess, "Doc->Insert() failed." );
86cdf0e10cSrcweir (void) bSuccess;
87cdf0e10cSrcweir
88cdf0e10cSrcweir SaveTblBoxCntnt( PCURCRSR->GetPoint() );
89cdf0e10cSrcweir if( bOnlyCurrCrsr )
90cdf0e10cSrcweir break;
91cdf0e10cSrcweir
92cdf0e10cSrcweir FOREACHPAM_END()
93cdf0e10cSrcweir
94cdf0e10cSrcweir EndAllAction();
95cdf0e10cSrcweir }
96cdf0e10cSrcweir
97cdf0e10cSrcweir
98cdf0e10cSrcweir /******************************************************************************
99cdf0e10cSrcweir * void SwEditShell::Insert(const String &rStr)
100cdf0e10cSrcweir ******************************************************************************/
101cdf0e10cSrcweir
102cdf0e10cSrcweir
Insert2(const String & rStr,const bool bForceExpandHints)103cdf0e10cSrcweir void SwEditShell::Insert2(const String &rStr, const bool bForceExpandHints )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir StartAllAction();
106cdf0e10cSrcweir {
107cdf0e10cSrcweir const enum IDocumentContentOperations::InsertFlags nInsertFlags =
108cdf0e10cSrcweir (bForceExpandHints)
109cdf0e10cSrcweir ? static_cast<IDocumentContentOperations::InsertFlags>(
110cdf0e10cSrcweir IDocumentContentOperations::INS_FORCEHINTEXPAND |
111cdf0e10cSrcweir IDocumentContentOperations::INS_EMPTYEXPAND)
112cdf0e10cSrcweir : IDocumentContentOperations::INS_EMPTYEXPAND;
113cdf0e10cSrcweir
114cdf0e10cSrcweir SwPaM *_pStartCrsr = getShellCrsr( true ), *__pStartCrsr = _pStartCrsr;
115cdf0e10cSrcweir do {
116cdf0e10cSrcweir //OPT: GetSystemCharSet
117cdf0e10cSrcweir const bool bSuccess =
118cdf0e10cSrcweir GetDoc()->InsertString(*_pStartCrsr, rStr, nInsertFlags);
119cdf0e10cSrcweir ASSERT( bSuccess, "Doc->Insert() failed." );
120cdf0e10cSrcweir (void) bSuccess;
121cdf0e10cSrcweir
122cdf0e10cSrcweir SaveTblBoxCntnt( _pStartCrsr->GetPoint() );
123cdf0e10cSrcweir
124cdf0e10cSrcweir } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr );
125cdf0e10cSrcweir }
126cdf0e10cSrcweir
127cdf0e10cSrcweir // calculate cursor bidi level
128cdf0e10cSrcweir SwCursor* pTmpCrsr = _GetCrsr();
129cdf0e10cSrcweir const sal_Bool bDoNotSetBidiLevel = ! pTmpCrsr ||
130cdf0e10cSrcweir ( 0 != dynamic_cast<SwUnoCrsr*>(pTmpCrsr) );
131cdf0e10cSrcweir
132cdf0e10cSrcweir if ( ! bDoNotSetBidiLevel )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir SwNode& rNode = pTmpCrsr->GetPoint()->nNode.GetNode();
135cdf0e10cSrcweir if ( rNode.IsTxtNode() )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir SwIndex& rIdx = pTmpCrsr->GetPoint()->nContent;
138cdf0e10cSrcweir xub_StrLen nPos = rIdx.GetIndex();
139cdf0e10cSrcweir xub_StrLen nPrevPos = nPos;
140cdf0e10cSrcweir if ( nPrevPos )
141cdf0e10cSrcweir --nPrevPos;
142cdf0e10cSrcweir
143cdf0e10cSrcweir SwScriptInfo* pSI = SwScriptInfo::GetScriptInfo( ((SwTxtNode&)rNode),
144cdf0e10cSrcweir sal_True );
145cdf0e10cSrcweir
146cdf0e10cSrcweir sal_uInt8 nLevel = 0;
147cdf0e10cSrcweir if ( ! pSI )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir // seems to be an empty paragraph.
150cdf0e10cSrcweir Point aPt;
151cdf0e10cSrcweir SwCntntFrm* pFrm =
152cdf0e10cSrcweir ((SwTxtNode&)rNode).getLayoutFrm( GetLayout(), &aPt, pTmpCrsr->GetPoint(),
153cdf0e10cSrcweir sal_False );
154cdf0e10cSrcweir
155cdf0e10cSrcweir SwScriptInfo aScriptInfo;
156cdf0e10cSrcweir aScriptInfo.InitScriptInfo( (SwTxtNode&)rNode, pFrm->IsRightToLeft() );
157cdf0e10cSrcweir nLevel = aScriptInfo.DirType( nPrevPos );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir else
160cdf0e10cSrcweir {
161cdf0e10cSrcweir if ( STRING_LEN != pSI->GetInvalidity() )
162cdf0e10cSrcweir pSI->InitScriptInfo( (SwTxtNode&)rNode );
163cdf0e10cSrcweir nLevel = pSI->DirType( nPrevPos );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir pTmpCrsr->SetCrsrBidiLevel( nLevel );
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
170cdf0e10cSrcweir SetInFrontOfLabel( sal_False ); // #i27615#
171cdf0e10cSrcweir
172cdf0e10cSrcweir EndAllAction();
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir
176cdf0e10cSrcweir /******************************************************************************
177cdf0e10cSrcweir * void SwEditShell::Overwrite(const String &rStr)
178cdf0e10cSrcweir ******************************************************************************/
179cdf0e10cSrcweir
180cdf0e10cSrcweir
Overwrite(const String & rStr)181cdf0e10cSrcweir void SwEditShell::Overwrite(const String &rStr)
182cdf0e10cSrcweir {
183cdf0e10cSrcweir StartAllAction();
184cdf0e10cSrcweir FOREACHPAM_START(this)
185cdf0e10cSrcweir if( !GetDoc()->Overwrite(*PCURCRSR, rStr ) )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir ASSERT( sal_False, "Doc->Overwrite(Str) failed." )
188cdf0e10cSrcweir }
189cdf0e10cSrcweir SaveTblBoxCntnt( PCURCRSR->GetPoint() );
190cdf0e10cSrcweir FOREACHPAM_END()
191cdf0e10cSrcweir EndAllAction();
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir
195cdf0e10cSrcweir /******************************************************************************
196cdf0e10cSrcweir * long SwEditShell::SplitNode()
197cdf0e10cSrcweir ******************************************************************************/
198cdf0e10cSrcweir
SplitNode(sal_Bool bAutoFormat,sal_Bool bCheckTableStart)199cdf0e10cSrcweir long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir StartAllAction();
202cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
203cdf0e10cSrcweir
204cdf0e10cSrcweir FOREACHPAM_START(this)
205cdf0e10cSrcweir // eine Tabellen Zelle wird jetzt zu einer normalen Textzelle!
206cdf0e10cSrcweir GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
207cdf0e10cSrcweir GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart );
208cdf0e10cSrcweir FOREACHPAM_END()
209cdf0e10cSrcweir
210cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
211cdf0e10cSrcweir
212cdf0e10cSrcweir if( bAutoFormat )
213cdf0e10cSrcweir AutoFmtBySplitNode();
214cdf0e10cSrcweir
215cdf0e10cSrcweir ClearTblBoxCntnt();
216cdf0e10cSrcweir
217cdf0e10cSrcweir EndAllAction();
218cdf0e10cSrcweir return(1L);
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
221cdf0e10cSrcweir /*-- 11.05.2004 09:41:20---------------------------------------------------
222cdf0e10cSrcweir
223cdf0e10cSrcweir -----------------------------------------------------------------------*/
AppendTxtNode()224cdf0e10cSrcweir sal_Bool SwEditShell::AppendTxtNode()
225cdf0e10cSrcweir {
226cdf0e10cSrcweir sal_Bool bRet = sal_False;
227cdf0e10cSrcweir StartAllAction();
228cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
229cdf0e10cSrcweir
230cdf0e10cSrcweir FOREACHPAM_START(this)
231cdf0e10cSrcweir GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
232cdf0e10cSrcweir bRet = GetDoc()->AppendTxtNode( *PCURCRSR->GetPoint()) || bRet;
233cdf0e10cSrcweir FOREACHPAM_END()
234cdf0e10cSrcweir
235cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
236cdf0e10cSrcweir
237cdf0e10cSrcweir ClearTblBoxCntnt();
238cdf0e10cSrcweir
239cdf0e10cSrcweir EndAllAction();
240cdf0e10cSrcweir return bRet;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir
243cdf0e10cSrcweir /******************************************************************************
244cdf0e10cSrcweir * liefert einen Pointer auf einen SwGrfNode; dieser wird von
245cdf0e10cSrcweir * GetGraphic() und GetGraphicSize() verwendet.
246cdf0e10cSrcweir ******************************************************************************/
247cdf0e10cSrcweir
248cdf0e10cSrcweir
_GetGrfNode() const249cdf0e10cSrcweir SwGrfNode * SwEditShell::_GetGrfNode() const
250cdf0e10cSrcweir {
251cdf0e10cSrcweir SwGrfNode *pGrfNode = 0;
252cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
253cdf0e10cSrcweir if( !pCrsr->HasMark() ||
254cdf0e10cSrcweir pCrsr->GetPoint()->nNode == pCrsr->GetMark()->nNode )
255cdf0e10cSrcweir pGrfNode = pCrsr->GetPoint()->nNode.GetNode().GetGrfNode();
256cdf0e10cSrcweir
257cdf0e10cSrcweir return pGrfNode;
258cdf0e10cSrcweir }
259cdf0e10cSrcweir /******************************************************************************
260cdf0e10cSrcweir * liefert Pointer auf eine Graphic, wenn CurCrsr->GetPoint() auf
261cdf0e10cSrcweir * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist
262cdf0e10cSrcweir * oder auf die gleiche Graphic zeigt)
263cdf0e10cSrcweir ******************************************************************************/
264cdf0e10cSrcweir
265cdf0e10cSrcweir // --> OD 2005-02-09 #119353# - robust
GetGraphic(sal_Bool bWait) const266cdf0e10cSrcweir const Graphic* SwEditShell::GetGraphic( sal_Bool bWait ) const
267cdf0e10cSrcweir {
268cdf0e10cSrcweir SwGrfNode* pGrfNode = _GetGrfNode();
269cdf0e10cSrcweir // --> OD 2005-02-09 #119353# - robust
270cdf0e10cSrcweir const Graphic* pGrf( 0L );
271cdf0e10cSrcweir if ( pGrfNode )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir pGrf = &(pGrfNode->GetGrf());
274cdf0e10cSrcweir // --> OD 2007-03-01 #i73788#
275cdf0e10cSrcweir // no load of linked graphic, if its not needed now (bWait = sal_False).
276cdf0e10cSrcweir if ( bWait )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir if( pGrf->IsSwapOut() ||
279cdf0e10cSrcweir ( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) )
280cdf0e10cSrcweir {
281cdf0e10cSrcweir #ifdef DBG_UTIL
282cdf0e10cSrcweir ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
283cdf0e10cSrcweir #else
284cdf0e10cSrcweir pGrfNode->SwapIn( bWait );
285cdf0e10cSrcweir #endif
286cdf0e10cSrcweir }
287cdf0e10cSrcweir }
288cdf0e10cSrcweir else
289cdf0e10cSrcweir {
290cdf0e10cSrcweir if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir #ifdef DBG_UTIL
293cdf0e10cSrcweir ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" );
294cdf0e10cSrcweir #else
295cdf0e10cSrcweir pGrfNode->SwapIn( bWait );
296cdf0e10cSrcweir #endif
297cdf0e10cSrcweir }
298cdf0e10cSrcweir }
299cdf0e10cSrcweir // <--
300cdf0e10cSrcweir }
301cdf0e10cSrcweir return pGrf;
302cdf0e10cSrcweir // <--
303cdf0e10cSrcweir }
304cdf0e10cSrcweir
IsGrfSwapOut(sal_Bool bOnlyLinked) const305cdf0e10cSrcweir sal_Bool SwEditShell::IsGrfSwapOut( sal_Bool bOnlyLinked ) const
306cdf0e10cSrcweir {
307cdf0e10cSrcweir SwGrfNode *pGrfNode = _GetGrfNode();
308cdf0e10cSrcweir return pGrfNode &&
309cdf0e10cSrcweir (bOnlyLinked ? ( pGrfNode->IsLinkedFile() &&
310cdf0e10cSrcweir ( GRAPHIC_DEFAULT == pGrfNode->GetGrfObj().GetType()||
311cdf0e10cSrcweir pGrfNode->GetGrfObj().IsSwappedOut()))
312cdf0e10cSrcweir : pGrfNode->GetGrfObj().IsSwappedOut());
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
315cdf0e10cSrcweir // --> OD 2005-02-09 #119353# - robust
GetGraphicObj() const316cdf0e10cSrcweir const GraphicObject* SwEditShell::GetGraphicObj() const
317cdf0e10cSrcweir {
318cdf0e10cSrcweir SwGrfNode* pGrfNode = _GetGrfNode();
319cdf0e10cSrcweir // --> OD 2005-02-09 #119353# - robust
320cdf0e10cSrcweir return pGrfNode ? &(pGrfNode->GetGrfObj()) : 0L;
321cdf0e10cSrcweir // <--
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
GetGraphicType() const324cdf0e10cSrcweir sal_uInt16 SwEditShell::GetGraphicType() const
325cdf0e10cSrcweir {
326cdf0e10cSrcweir SwGrfNode *pGrfNode = _GetGrfNode();
327cdf0e10cSrcweir return static_cast<sal_uInt16>(pGrfNode ? pGrfNode->GetGrfObj().GetType() : GRAPHIC_NONE);
328cdf0e10cSrcweir }
329cdf0e10cSrcweir
330cdf0e10cSrcweir /******************************************************************************
331cdf0e10cSrcweir * liefert die Groesse der Graphic, wenn CurCrsr->GetPoint() auf
332cdf0e10cSrcweir * einen SwGrfNode zeigt (und GetMark nicht gesetzt ist
333cdf0e10cSrcweir * oder auf die gleiche Graphic zeigt)
334cdf0e10cSrcweir ******************************************************************************/
335cdf0e10cSrcweir
GetGrfSize(Size & rSz) const336cdf0e10cSrcweir sal_Bool SwEditShell::GetGrfSize(Size& rSz) const
337cdf0e10cSrcweir {
338cdf0e10cSrcweir SwNoTxtNode* pNoTxtNd;
339cdf0e10cSrcweir SwPaM* pCurrentCrsr = GetCrsr();
340cdf0e10cSrcweir if( ( !pCurrentCrsr->HasMark()
341cdf0e10cSrcweir || pCurrentCrsr->GetPoint()->nNode == pCurrentCrsr->GetMark()->nNode )
342cdf0e10cSrcweir && 0 != ( pNoTxtNd = pCurrentCrsr->GetNode()->GetNoTxtNode() ) )
343cdf0e10cSrcweir {
344cdf0e10cSrcweir rSz = pNoTxtNd->GetTwipSize();
345cdf0e10cSrcweir return sal_True;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir return sal_False;
348cdf0e10cSrcweir
349cdf0e10cSrcweir }
350cdf0e10cSrcweir /******************************************************************************
351cdf0e10cSrcweir * erneutes Einlesen, falls Graphic nicht Ok ist. Die
352cdf0e10cSrcweir * aktuelle wird durch die neue ersetzt.
353cdf0e10cSrcweir ******************************************************************************/
354cdf0e10cSrcweir
ReRead(const String & rGrfName,const String & rFltName,const Graphic * pGraphic,const GraphicObject * pGrfObj)355cdf0e10cSrcweir void SwEditShell::ReRead( const String& rGrfName, const String& rFltName,
356cdf0e10cSrcweir const Graphic* pGraphic, const GraphicObject* pGrfObj )
357cdf0e10cSrcweir {
358cdf0e10cSrcweir StartAllAction();
359cdf0e10cSrcweir pDoc->ReRead( *GetCrsr(), rGrfName, rFltName, pGraphic, pGrfObj );
360cdf0e10cSrcweir EndAllAction();
361cdf0e10cSrcweir }
362cdf0e10cSrcweir
363cdf0e10cSrcweir
364cdf0e10cSrcweir /******************************************************************************
365cdf0e10cSrcweir * liefert den Namen und den FilterNamen einer Graphic, wenn der Cursor
366cdf0e10cSrcweir * auf einer Graphic steht
367cdf0e10cSrcweir * Ist ein String-Ptr != 0 dann returne den entsp. Namen
368cdf0e10cSrcweir ******************************************************************************/
369cdf0e10cSrcweir
370cdf0e10cSrcweir
GetGrfNms(String * pGrfName,String * pFltName,const SwFlyFrmFmt * pFmt) const371cdf0e10cSrcweir void SwEditShell::GetGrfNms( String* pGrfName, String* pFltName,
372cdf0e10cSrcweir const SwFlyFrmFmt* pFmt ) const
373cdf0e10cSrcweir {
374cdf0e10cSrcweir ASSERT( pGrfName || pFltName, "was wird denn nun erfragt?" );
375cdf0e10cSrcweir if( pFmt )
376cdf0e10cSrcweir GetDoc()->GetGrfNms( *pFmt, pGrfName, pFltName );
377cdf0e10cSrcweir else
378cdf0e10cSrcweir {
379cdf0e10cSrcweir SwGrfNode *pGrfNode = _GetGrfNode();
380cdf0e10cSrcweir if( pGrfNode && pGrfNode->IsLinkedFile() )
381cdf0e10cSrcweir pGrfNode->GetFileFilterNms( pGrfName, pFltName );
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
385cdf0e10cSrcweir
386cdf0e10cSrcweir // alternativen Text abfragen/setzen
387cdf0e10cSrcweir //const String& SwEditShell::GetAlternateText() const
388cdf0e10cSrcweir //{
389cdf0e10cSrcweir // SwPaM* pCrsr = GetCrsr();
390cdf0e10cSrcweir // const SwNoTxtNode* pNd;
391cdf0e10cSrcweir // if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
392cdf0e10cSrcweir // return pNd->GetAlternateText();
393cdf0e10cSrcweir
394cdf0e10cSrcweir // return aEmptyStr;
395cdf0e10cSrcweir //}
396cdf0e10cSrcweir
397cdf0e10cSrcweir
398cdf0e10cSrcweir //void SwEditShell::SetAlternateText( const String& rTxt )
399cdf0e10cSrcweir //{
400cdf0e10cSrcweir // SwPaM* pCrsr = GetCrsr();
401cdf0e10cSrcweir // SwNoTxtNode* pNd;
402cdf0e10cSrcweir // if( !pCrsr->HasMark() && 0 != ( pNd = pCrsr->GetNode()->GetNoTxtNode()) )
403cdf0e10cSrcweir // {
404cdf0e10cSrcweir // pNd->SetAlternateText( rTxt, sal_True );
405cdf0e10cSrcweir // GetDoc()->SetModified();
406cdf0e10cSrcweir // }
407cdf0e10cSrcweir //}
408cdf0e10cSrcweir
409cdf0e10cSrcweir
GetGraphicPolygon() const410cdf0e10cSrcweir const PolyPolygon *SwEditShell::GetGraphicPolygon() const
411cdf0e10cSrcweir {
412cdf0e10cSrcweir SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
413cdf0e10cSrcweir return pNd->HasContour();
414cdf0e10cSrcweir }
415cdf0e10cSrcweir
416cdf0e10cSrcweir
SetGraphicPolygon(const PolyPolygon * pPoly)417cdf0e10cSrcweir void SwEditShell::SetGraphicPolygon( const PolyPolygon *pPoly )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
420cdf0e10cSrcweir StartAllAction();
421cdf0e10cSrcweir pNd->SetContour( pPoly );
422cdf0e10cSrcweir SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper();
423cdf0e10cSrcweir const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
424cdf0e10cSrcweir pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
425cdf0e10cSrcweir GetDoc()->SetModified();
426cdf0e10cSrcweir EndAllAction();
427cdf0e10cSrcweir }
428cdf0e10cSrcweir
ClearAutomaticContour()429cdf0e10cSrcweir void SwEditShell::ClearAutomaticContour()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir SwNoTxtNode *pNd = GetCrsr()->GetNode()->GetNoTxtNode();
432cdf0e10cSrcweir ASSERT( pNd, "is no NoTxtNode!" );
433cdf0e10cSrcweir if( pNd->HasAutomaticContour() )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir StartAllAction();
436cdf0e10cSrcweir pNd->SetContour( NULL, sal_False );
437cdf0e10cSrcweir SwFlyFrm *pFly = (SwFlyFrm*)pNd->getLayoutFrm(GetLayout())->GetUpper();
438cdf0e10cSrcweir const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
439cdf0e10cSrcweir pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
440cdf0e10cSrcweir GetDoc()->SetModified();
441cdf0e10cSrcweir EndAllAction();
442cdf0e10cSrcweir }
443cdf0e10cSrcweir }
444cdf0e10cSrcweir
445cdf0e10cSrcweir /******************************************************************************
446cdf0e10cSrcweir * liefert Pointer auf ein SvInPlaceObjectRef, wenn CurCrsr->GetPoint() auf
447cdf0e10cSrcweir * einen SwOLENode zeigt (und GetMark nicht gesetzt ist
448cdf0e10cSrcweir * oder auf das gleiche SvInPlaceObjectRef zeigt)
449cdf0e10cSrcweir * besorgt den Pointer vom Doc wenn das Objekt per Namen gesucht werden
450cdf0e10cSrcweir * soll
451cdf0e10cSrcweir ******************************************************************************/
452cdf0e10cSrcweir
GetOLEObject() const453cdf0e10cSrcweir svt::EmbeddedObjectRef& SwEditShell::GetOLEObject() const
454cdf0e10cSrcweir {
455cdf0e10cSrcweir ASSERT( CNT_OLE == GetCntType(), "GetOLEObj: kein OLENode." );
456cdf0e10cSrcweir ASSERT( !GetCrsr()->HasMark() ||
457cdf0e10cSrcweir (GetCrsr()->HasMark() &&
458cdf0e10cSrcweir GetCrsr()->GetPoint()->nNode == GetCrsr()->GetMark()->nNode),
459cdf0e10cSrcweir "GetOLEObj: kein OLENode." );
460cdf0e10cSrcweir
461cdf0e10cSrcweir SwOLENode *pOLENode = GetCrsr()->GetNode()->GetOLENode();
462cdf0e10cSrcweir ASSERT( pOLENode, "GetOLEObj: kein OLENode." );
463cdf0e10cSrcweir SwOLEObj& rOObj = pOLENode->GetOLEObj();
464cdf0e10cSrcweir return rOObj.GetObject();
465cdf0e10cSrcweir }
466cdf0e10cSrcweir
467cdf0e10cSrcweir
HasOLEObj(const String & rName) const468cdf0e10cSrcweir sal_Bool SwEditShell::HasOLEObj( const String &rName ) const
469cdf0e10cSrcweir {
470cdf0e10cSrcweir SwStartNode *pStNd;
471cdf0e10cSrcweir SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
472cdf0e10cSrcweir while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
473cdf0e10cSrcweir {
474cdf0e10cSrcweir aIdx++;
475cdf0e10cSrcweir SwNode& rNd = aIdx.GetNode();
476cdf0e10cSrcweir if( rNd.IsOLENode() &&
477cdf0e10cSrcweir rName == ((SwOLENode&)rNd).GetChartTblName() &&
478cdf0e10cSrcweir ((SwOLENode&)rNd).getLayoutFrm( GetLayout() ) )
479cdf0e10cSrcweir return sal_True;
480cdf0e10cSrcweir
481cdf0e10cSrcweir aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir return sal_False;
484cdf0e10cSrcweir }
485cdf0e10cSrcweir
486cdf0e10cSrcweir
SetChartName(const String & rName)487cdf0e10cSrcweir void SwEditShell::SetChartName( const String &rName )
488cdf0e10cSrcweir {
489cdf0e10cSrcweir SwOLENode *pONd = GetCrsr()->GetNode()->GetOLENode();
490cdf0e10cSrcweir ASSERT( pONd, "ChartNode not found" );
491cdf0e10cSrcweir pONd->SetChartTblName( rName );
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
UpdateCharts(const String & rName)494cdf0e10cSrcweir void SwEditShell::UpdateCharts( const String &rName )
495cdf0e10cSrcweir {
496cdf0e10cSrcweir GetDoc()->UpdateCharts( rName );
497cdf0e10cSrcweir }
498cdf0e10cSrcweir
499cdf0e10cSrcweir
500cdf0e10cSrcweir /******************************************************************************
501cdf0e10cSrcweir * Aenderung des Tabellennamens
502cdf0e10cSrcweir ******************************************************************************/
503cdf0e10cSrcweir
SetTableName(SwFrmFmt & rTblFmt,const String & rNewName)504cdf0e10cSrcweir void SwEditShell::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName )
505cdf0e10cSrcweir {
506cdf0e10cSrcweir GetDoc()->SetTableName( rTblFmt, rNewName );
507cdf0e10cSrcweir }
508cdf0e10cSrcweir
509cdf0e10cSrcweir // erfragen des akt. Wortes
510cdf0e10cSrcweir
GetCurWord()511cdf0e10cSrcweir String SwEditShell::GetCurWord()
512cdf0e10cSrcweir {
513cdf0e10cSrcweir const SwPaM& rPaM = *GetCrsr();
514cdf0e10cSrcweir const SwTxtNode* pNd = rPaM.GetNode()->GetTxtNode();
515cdf0e10cSrcweir String aString = pNd ?
516cdf0e10cSrcweir pNd->GetCurWord(rPaM.GetPoint()->nContent.GetIndex()) :
517cdf0e10cSrcweir aEmptyStr;
518cdf0e10cSrcweir return aString;
519cdf0e10cSrcweir }
520cdf0e10cSrcweir
521cdf0e10cSrcweir /****************************************************************************
522cdf0e10cSrcweir * void SwEditShell::UpdateDocStat( SwDocStat& rStat )
523cdf0e10cSrcweir ****************************************************************************/
524cdf0e10cSrcweir
525cdf0e10cSrcweir
UpdateDocStat(SwDocStat & rStat)526cdf0e10cSrcweir void SwEditShell::UpdateDocStat( SwDocStat& rStat )
527cdf0e10cSrcweir {
528cdf0e10cSrcweir StartAllAction();
529cdf0e10cSrcweir GetDoc()->UpdateDocStat( rStat );
530cdf0e10cSrcweir EndAllAction();
531cdf0e10cSrcweir }
532cdf0e10cSrcweir
533cdf0e10cSrcweir // OPT: eddocinl.cxx
534cdf0e10cSrcweir
535cdf0e10cSrcweir
536cdf0e10cSrcweir // returne zum Namen die im Doc gesetzte Referenz
GetRefMark(const String & rName) const537cdf0e10cSrcweir const SwFmtRefMark* SwEditShell::GetRefMark( const String& rName ) const
538cdf0e10cSrcweir {
539cdf0e10cSrcweir return GetDoc()->GetRefMark( rName );
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
542cdf0e10cSrcweir // returne die Namen aller im Doc gesetzten Referenzen
GetRefMarks(SvStringsDtor * pStrings) const543cdf0e10cSrcweir sal_uInt16 SwEditShell::GetRefMarks( SvStringsDtor* pStrings ) const
544cdf0e10cSrcweir {
545cdf0e10cSrcweir return GetDoc()->GetRefMarks( pStrings );
546cdf0e10cSrcweir }
547cdf0e10cSrcweir
548cdf0e10cSrcweir /******************************************************************************
549cdf0e10cSrcweir * DropCap-SS
550cdf0e10cSrcweir ******************************************************************************/
551cdf0e10cSrcweir
552cdf0e10cSrcweir
GetDropTxt(const sal_uInt16 nChars) const553cdf0e10cSrcweir String SwEditShell::GetDropTxt( const sal_uInt16 nChars ) const
554cdf0e10cSrcweir {
555cdf0e10cSrcweir /**
556cdf0e10cSrcweir * pb: made changes for #i74939#
557cdf0e10cSrcweir *
558cdf0e10cSrcweir * always return a string even though there is a selection
559cdf0e10cSrcweir */
560cdf0e10cSrcweir
561cdf0e10cSrcweir String aTxt;
562cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
563cdf0e10cSrcweir if ( IsMultiSelection() )
564cdf0e10cSrcweir {
565cdf0e10cSrcweir // if a multi selection exists, search for the first line
566cdf0e10cSrcweir // -> it is the cursor with the lowest index
567cdf0e10cSrcweir sal_uLong nIndex = pCrsr->GetMark()->nNode.GetIndex();
568cdf0e10cSrcweir bool bPrev = true;
569cdf0e10cSrcweir SwPaM* pLast = pCrsr;
570cdf0e10cSrcweir SwPaM* pTemp = pCrsr;
571cdf0e10cSrcweir while ( bPrev )
572cdf0e10cSrcweir {
573cdf0e10cSrcweir SwPaM* pPrev2 = dynamic_cast< SwPaM* >( pTemp->GetPrev() );
574cdf0e10cSrcweir bPrev = ( pPrev2 && pPrev2 != pLast );
575cdf0e10cSrcweir if ( bPrev )
576cdf0e10cSrcweir {
577cdf0e10cSrcweir pTemp = pPrev2;
578cdf0e10cSrcweir sal_uLong nTemp = pPrev2->GetMark()->nNode.GetIndex();
579cdf0e10cSrcweir if ( nTemp < nIndex )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir nIndex = nTemp;
582cdf0e10cSrcweir pCrsr = pPrev2;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir }
585cdf0e10cSrcweir }
586cdf0e10cSrcweir }
587cdf0e10cSrcweir
588cdf0e10cSrcweir SwTxtNode* pTxtNd = pCrsr->GetNode( !pCrsr->HasMark() )->GetTxtNode();
589cdf0e10cSrcweir if( pTxtNd )
590cdf0e10cSrcweir {
591cdf0e10cSrcweir xub_StrLen nDropLen = pTxtNd->GetDropLen( nChars );
592cdf0e10cSrcweir if( nDropLen )
593cdf0e10cSrcweir aTxt = pTxtNd->GetTxt().Copy( 0, nDropLen );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir
596cdf0e10cSrcweir return aTxt;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir
ReplaceDropTxt(const String & rStr)599cdf0e10cSrcweir void SwEditShell::ReplaceDropTxt( const String &rStr )
600cdf0e10cSrcweir {
601cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
602cdf0e10cSrcweir if( pCrsr->GetPoint()->nNode == pCrsr->GetMark()->nNode &&
603cdf0e10cSrcweir pCrsr->GetNode()->GetTxtNode()->IsTxtNode() )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir StartAllAction();
606cdf0e10cSrcweir
607cdf0e10cSrcweir const SwNodeIndex& rNd = pCrsr->GetPoint()->nNode;
608cdf0e10cSrcweir SwPaM aPam( rNd, rStr.Len(), rNd, 0 );
609cdf0e10cSrcweir if( !GetDoc()->Overwrite( aPam, rStr ) )
610cdf0e10cSrcweir {
611cdf0e10cSrcweir ASSERT( sal_False, "Doc->Overwrite(Str) failed." );
612cdf0e10cSrcweir }
613cdf0e10cSrcweir
614cdf0e10cSrcweir EndAllAction();
615cdf0e10cSrcweir }
616cdf0e10cSrcweir }
617cdf0e10cSrcweir
618cdf0e10cSrcweir /******************************************************************************
619cdf0e10cSrcweir * Methode :
620cdf0e10cSrcweir * Beschreibung:
621cdf0e10cSrcweir * Erstellt : OK 25.04.94 13:45
622cdf0e10cSrcweir * Aenderung :
623cdf0e10cSrcweir ******************************************************************************/
624cdf0e10cSrcweir
Calculate()625cdf0e10cSrcweir String SwEditShell::Calculate()
626cdf0e10cSrcweir {
627cdf0e10cSrcweir String aFormel; // die entgueltige Formel
628cdf0e10cSrcweir SwPaM *pPaMLast = (SwPaM*)GetCrsr()->GetNext(),
629cdf0e10cSrcweir *pPaM = pPaMLast; // die Pointer auf Cursor
630cdf0e10cSrcweir SwCalc aCalc( *GetDoc() );
631cdf0e10cSrcweir const CharClass& rCC = GetAppCharClass();
632cdf0e10cSrcweir
633cdf0e10cSrcweir do {
634cdf0e10cSrcweir SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
635cdf0e10cSrcweir if(pTxtNd)
636cdf0e10cSrcweir {
637cdf0e10cSrcweir const SwPosition *pStart = pPaM->Start(), *pEnd = pPaM->End();
638cdf0e10cSrcweir xub_StrLen nStt = pStart->nContent.GetIndex();
639cdf0e10cSrcweir String aStr = pTxtNd->GetExpandTxt( nStt, pEnd->nContent.
640cdf0e10cSrcweir GetIndex() - nStt );
641cdf0e10cSrcweir
642cdf0e10cSrcweir rCC.toLower( aStr );
643cdf0e10cSrcweir
644cdf0e10cSrcweir sal_Unicode ch;
645cdf0e10cSrcweir sal_Bool bValidFlds = sal_False;
646cdf0e10cSrcweir xub_StrLen nPos = 0;
647cdf0e10cSrcweir
648cdf0e10cSrcweir while( nPos < aStr.Len() )
649cdf0e10cSrcweir {
650cdf0e10cSrcweir ch = aStr.GetChar( nPos++ );
651cdf0e10cSrcweir if( rCC.isLetter( aStr, nPos-1 ) || ch == '_' )
652cdf0e10cSrcweir {
653cdf0e10cSrcweir xub_StrLen nTmpStt = nPos-1;
654cdf0e10cSrcweir while( nPos < aStr.Len() &&
655cdf0e10cSrcweir 0 != ( ch = aStr.GetChar( nPos++ )) &&
656cdf0e10cSrcweir (rCC.isLetterNumeric( aStr, nPos - 1 ) ||
657cdf0e10cSrcweir ch == '_'|| ch == '.' ))
658cdf0e10cSrcweir ;
659cdf0e10cSrcweir
660cdf0e10cSrcweir if( nPos < aStr.Len() )
661cdf0e10cSrcweir --nPos;
662cdf0e10cSrcweir
663cdf0e10cSrcweir String sVar( aStr.Copy( nTmpStt, nPos - nTmpStt ));
664cdf0e10cSrcweir if( !::FindOperator( sVar ) &&
665cdf0e10cSrcweir (::Find( sVar, aCalc.GetVarTable(),TBLSZ) ||
666cdf0e10cSrcweir aCalc.VarLook( sVar )) )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir if( !bValidFlds )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir GetDoc()->FldsToCalc( aCalc,
671cdf0e10cSrcweir pStart->nNode.GetIndex(),
672cdf0e10cSrcweir pStart->nContent.GetIndex() );
673cdf0e10cSrcweir bValidFlds = sal_True;
674cdf0e10cSrcweir }
675cdf0e10cSrcweir (( aFormel += '(' ) +=
676cdf0e10cSrcweir aCalc.GetStrResult( aCalc.VarLook( sVar )
677cdf0e10cSrcweir ->nValue )) += ')';
678cdf0e10cSrcweir }
679cdf0e10cSrcweir else
680cdf0e10cSrcweir aFormel += sVar;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir else
683cdf0e10cSrcweir aFormel += ch;
684cdf0e10cSrcweir }
685cdf0e10cSrcweir }
686cdf0e10cSrcweir } while( pPaMLast != (pPaM = (SwPaM*)pPaM->GetNext()) );
687cdf0e10cSrcweir
688cdf0e10cSrcweir return aCalc.GetStrResult( aCalc.Calculate(aFormel) );
689cdf0e10cSrcweir }
690cdf0e10cSrcweir
691cdf0e10cSrcweir
GetLinkManager()692cdf0e10cSrcweir sfx2::LinkManager& SwEditShell::GetLinkManager()
693cdf0e10cSrcweir {
694cdf0e10cSrcweir return pDoc->GetLinkManager();
695cdf0e10cSrcweir }
696cdf0e10cSrcweir
697cdf0e10cSrcweir
GetIMapInventor() const698cdf0e10cSrcweir void *SwEditShell::GetIMapInventor() const
699cdf0e10cSrcweir {
700cdf0e10cSrcweir //Als eindeutige Identifikation sollte der Node, auf dem der Crsr steht
701cdf0e10cSrcweir //genuegen.
702cdf0e10cSrcweir return (void*)GetCrsr()->GetNode();
703cdf0e10cSrcweir }
704cdf0e10cSrcweir
705cdf0e10cSrcweir // --> OD 2007-03-01 #i73788#
706cdf0e10cSrcweir // remove default parameter, because method is always called this default value
GetIMapGraphic() const707cdf0e10cSrcweir Graphic SwEditShell::GetIMapGraphic() const
708cdf0e10cSrcweir {
709cdf0e10cSrcweir //Liefert immer eine Graphic, wenn der Crsr in einem Fly steht.
710cdf0e10cSrcweir SET_CURR_SHELL( (ViewShell*)this );
711cdf0e10cSrcweir Graphic aRet;
712cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
713cdf0e10cSrcweir if ( !pCrsr->HasMark() )
714cdf0e10cSrcweir {
715cdf0e10cSrcweir SwNode *pNd =pCrsr->GetNode();
716cdf0e10cSrcweir if( pNd->IsGrfNode() )
717cdf0e10cSrcweir {
718cdf0e10cSrcweir const Graphic& rGrf = ((SwGrfNode*)pNd)->GetGrf();
719cdf0e10cSrcweir if( rGrf.IsSwapOut() || ( ((SwGrfNode*)pNd)->IsLinkedFile() &&
720cdf0e10cSrcweir GRAPHIC_DEFAULT == rGrf.GetType() ) )
721cdf0e10cSrcweir {
722cdf0e10cSrcweir #ifdef DBG_UTIL
723cdf0e10cSrcweir ASSERT( ((SwGrfNode*)pNd)->SwapIn( sal_True ) || !sal_True, "Grafik konnte nicht geladen werden" );
724cdf0e10cSrcweir #else
725cdf0e10cSrcweir ((SwGrfNode*)pNd)->SwapIn( sal_True );
726cdf0e10cSrcweir #endif
727cdf0e10cSrcweir }
728cdf0e10cSrcweir aRet = rGrf;
729cdf0e10cSrcweir }
730cdf0e10cSrcweir else if ( pNd->IsOLENode() )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir aRet = *((SwOLENode*)pNd)->GetGraphic();
733cdf0e10cSrcweir }
734cdf0e10cSrcweir else
735cdf0e10cSrcweir {
736cdf0e10cSrcweir SwFlyFrm* pFlyFrm = pNd->GetCntntNode()->getLayoutFrm( GetLayout() )->FindFlyFrm();
737cdf0e10cSrcweir if(pFlyFrm)
738cdf0e10cSrcweir aRet = pFlyFrm->GetFmt()->MakeGraphic();
739cdf0e10cSrcweir }
740cdf0e10cSrcweir }
741cdf0e10cSrcweir return aRet;
742cdf0e10cSrcweir }
743cdf0e10cSrcweir
744cdf0e10cSrcweir
InsertURL(const SwFmtINetFmt & rFmt,const String & rStr,sal_Bool bKeepSelection)745cdf0e10cSrcweir sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, sal_Bool bKeepSelection )
746cdf0e10cSrcweir {
747cdf0e10cSrcweir // URL und Hinweistext (direkt oder via Selektion) notwendig
748cdf0e10cSrcweir if( !rFmt.GetValue().Len() || ( !rStr.Len() && !HasSelection() ) )
749cdf0e10cSrcweir return sal_False;
750cdf0e10cSrcweir StartAllAction();
751cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_UI_INSERT_URLTXT, NULL);
752cdf0e10cSrcweir sal_Bool bInsTxt = sal_True;
753cdf0e10cSrcweir
754cdf0e10cSrcweir if( rStr.Len() )
755cdf0e10cSrcweir {
756cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
757cdf0e10cSrcweir if( pCrsr->HasMark() && *pCrsr->GetPoint() != *pCrsr->GetMark() )
758cdf0e10cSrcweir {
759cdf0e10cSrcweir // Selection vorhanden, MehrfachSelektion?
760cdf0e10cSrcweir sal_Bool bDelTxt = sal_True;
761cdf0e10cSrcweir if( pCrsr->GetNext() == pCrsr )
762cdf0e10cSrcweir {
763cdf0e10cSrcweir // einfach Selection -> Text ueberpruefen
764cdf0e10cSrcweir String sTxt( GetSelTxt() );
765cdf0e10cSrcweir sTxt.EraseTrailingChars();
766cdf0e10cSrcweir if( sTxt == rStr )
767cdf0e10cSrcweir bDelTxt = bInsTxt = sal_False;
768cdf0e10cSrcweir }
769cdf0e10cSrcweir else if( rFmt.GetValue() == rStr ) // Name und URL gleich?
770cdf0e10cSrcweir bDelTxt = bInsTxt = sal_False;
771cdf0e10cSrcweir
772cdf0e10cSrcweir if( bDelTxt )
773cdf0e10cSrcweir Delete();
774cdf0e10cSrcweir }
775cdf0e10cSrcweir else if( pCrsr->GetNext() != pCrsr && rFmt.GetValue() == rStr )
776cdf0e10cSrcweir bInsTxt = sal_False;
777cdf0e10cSrcweir
778cdf0e10cSrcweir if( bInsTxt )
779cdf0e10cSrcweir {
780cdf0e10cSrcweir Insert2( rStr );
781cdf0e10cSrcweir SetMark();
782cdf0e10cSrcweir ExtendSelection( sal_False, rStr.Len() );
783cdf0e10cSrcweir }
784cdf0e10cSrcweir }
785cdf0e10cSrcweir else
786cdf0e10cSrcweir bInsTxt = sal_False;
787cdf0e10cSrcweir
788*69a74367SOliver-Rainer Wittmann SetAttrItem( rFmt );
789cdf0e10cSrcweir if (bInsTxt && !IsCrsrPtAtEnd())
790cdf0e10cSrcweir SwapPam();
791cdf0e10cSrcweir if(!bKeepSelection)
792cdf0e10cSrcweir ClearMark();
793cdf0e10cSrcweir if( bInsTxt )
794cdf0e10cSrcweir DontExpandFmt();
795cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_UI_INSERT_URLTXT, NULL );
796cdf0e10cSrcweir EndAllAction();
797cdf0e10cSrcweir return sal_True;
798cdf0e10cSrcweir }
799cdf0e10cSrcweir
800cdf0e10cSrcweir
GetINetAttrs(SwGetINetAttrs & rArr)801cdf0e10cSrcweir sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
802cdf0e10cSrcweir {
803cdf0e10cSrcweir if( rArr.Count() )
804cdf0e10cSrcweir rArr.DeleteAndDestroy( 0, rArr.Count() );
805cdf0e10cSrcweir
806cdf0e10cSrcweir const SwTxtNode* pTxtNd;
807cdf0e10cSrcweir const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
808cdf0e10cSrcweir for( sal_uInt16 n = pFmts->Count(); 1 < n; )
809cdf0e10cSrcweir {
810cdf0e10cSrcweir SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
811cdf0e10cSrcweir for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
812cdf0e10cSrcweir {
813cdf0e10cSrcweir if( 0 != ( pTxtNd = pFnd->GetpTxtNode()) &&
814cdf0e10cSrcweir pTxtNd->GetNodes().IsDocNodes() )
815cdf0e10cSrcweir {
816cdf0e10cSrcweir SwTxtINetFmt& rAttr = *pFnd;
817cdf0e10cSrcweir String sTxt( pTxtNd->GetExpandTxt( *rAttr.GetStart(),
818*69a74367SOliver-Rainer Wittmann *rAttr.End() - *rAttr.GetStart() ) );
819cdf0e10cSrcweir
820cdf0e10cSrcweir sTxt.EraseAllChars( 0x0a );
821cdf0e10cSrcweir sTxt.EraseLeadingChars().EraseTrailingChars();
822cdf0e10cSrcweir
823cdf0e10cSrcweir if( sTxt.Len() )
824cdf0e10cSrcweir {
825cdf0e10cSrcweir SwGetINetAttr* pNew = new SwGetINetAttr( sTxt, rAttr );
826cdf0e10cSrcweir rArr.C40_INSERT( SwGetINetAttr, pNew, rArr.Count() );
827cdf0e10cSrcweir }
828cdf0e10cSrcweir }
829cdf0e10cSrcweir }
830cdf0e10cSrcweir }
831cdf0e10cSrcweir return rArr.Count();
832cdf0e10cSrcweir }
833cdf0e10cSrcweir
834cdf0e10cSrcweir
835cdf0e10cSrcweir // ist der Cursor in eine INetAttribut, dann wird das komplett
836cdf0e10cSrcweir // geloescht; inclusive des Hinweistextes (wird beim Drag&Drop gebraucht)
DelINetAttrWithText()837cdf0e10cSrcweir sal_Bool SwEditShell::DelINetAttrWithText()
838cdf0e10cSrcweir {
839cdf0e10cSrcweir sal_Bool bRet = SelectTxtAttr( RES_TXTATR_INETFMT, sal_False );
840cdf0e10cSrcweir if( bRet )
841cdf0e10cSrcweir DeleteSel( *GetCrsr() );
842cdf0e10cSrcweir return bRet;
843cdf0e10cSrcweir }
844cdf0e10cSrcweir
845cdf0e10cSrcweir
846cdf0e10cSrcweir // setzen an den Textzeichenattributen das DontExpand-Flag
DontExpandFmt()847cdf0e10cSrcweir sal_Bool SwEditShell::DontExpandFmt()
848cdf0e10cSrcweir {
849cdf0e10cSrcweir sal_Bool bRet = sal_False;
850cdf0e10cSrcweir if( !IsTableMode() && GetDoc()->DontExpandFmt( *GetCrsr()->GetPoint() ))
851cdf0e10cSrcweir {
852cdf0e10cSrcweir bRet = sal_True;
853cdf0e10cSrcweir CallChgLnk();
854cdf0e10cSrcweir }
855cdf0e10cSrcweir return bRet;
856cdf0e10cSrcweir }
857cdf0e10cSrcweir
GetNumberFormatter()858cdf0e10cSrcweir SvNumberFormatter* SwEditShell::GetNumberFormatter()
859cdf0e10cSrcweir {
860cdf0e10cSrcweir return GetDoc()->GetNumberFormatter();
861cdf0e10cSrcweir }
862cdf0e10cSrcweir
RemoveInvisibleContent()863cdf0e10cSrcweir sal_Bool SwEditShell::RemoveInvisibleContent()
864cdf0e10cSrcweir {
865cdf0e10cSrcweir StartAllAction();
866cdf0e10cSrcweir sal_Bool bRet = GetDoc()->RemoveInvisibleContent();
867cdf0e10cSrcweir EndAllAction();
868cdf0e10cSrcweir return bRet;
869cdf0e10cSrcweir }
ConvertFieldsToText()870cdf0e10cSrcweir sal_Bool SwEditShell::ConvertFieldsToText()
871cdf0e10cSrcweir {
872cdf0e10cSrcweir StartAllAction();
873cdf0e10cSrcweir sal_Bool bRet = GetDoc()->ConvertFieldsToText();
874cdf0e10cSrcweir EndAllAction();
875cdf0e10cSrcweir return bRet;
876cdf0e10cSrcweir }
SetNumberingRestart()877cdf0e10cSrcweir void SwEditShell::SetNumberingRestart()
878cdf0e10cSrcweir {
879cdf0e10cSrcweir StartAllAction();
880cdf0e10cSrcweir Push();
881cdf0e10cSrcweir //iterate over all text contents - body, frames, header, footer, footnote text
882cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
883cdf0e10cSrcweir for(sal_uInt16 i = 0; i < 2; i++)
884cdf0e10cSrcweir {
885cdf0e10cSrcweir if(!i)
886cdf0e10cSrcweir MakeFindRange(DOCPOS_START, DOCPOS_END, pCrsr); //body content
887cdf0e10cSrcweir else
888cdf0e10cSrcweir MakeFindRange(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, pCrsr); //extra content
889cdf0e10cSrcweir SwPosition* pSttPos = pCrsr->Start(), *pEndPos = pCrsr->End();
890cdf0e10cSrcweir sal_uLong nCurrNd = pSttPos->nNode.GetIndex();
891cdf0e10cSrcweir sal_uLong nEndNd = pEndPos->nNode.GetIndex();
892cdf0e10cSrcweir if( nCurrNd <= nEndNd )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir SwCntntFrm* pCntFrm;
895cdf0e10cSrcweir sal_Bool bGoOn = sal_True;
896cdf0e10cSrcweir //iterate over all paragraphs
897cdf0e10cSrcweir while( bGoOn )
898cdf0e10cSrcweir {
899cdf0e10cSrcweir SwNode* pNd = GetDoc()->GetNodes()[ nCurrNd ];
900cdf0e10cSrcweir switch( pNd->GetNodeType() )
901cdf0e10cSrcweir {
902cdf0e10cSrcweir case ND_TEXTNODE:
903cdf0e10cSrcweir if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( GetLayout() )) )
904cdf0e10cSrcweir {
905cdf0e10cSrcweir //jump over hidden frames - ignore protection!
906cdf0e10cSrcweir if( !((SwTxtFrm*)pCntFrm)->IsHiddenNow() )
907cdf0e10cSrcweir {
908cdf0e10cSrcweir //if the node is numbered and the starting value of the numbering equals the
909cdf0e10cSrcweir //start value of the numbering rule then set this value as hard starting value
910cdf0e10cSrcweir
911cdf0e10cSrcweir //get the node num
912cdf0e10cSrcweir // OD 2005-11-09
913cdf0e10cSrcweir SwTxtNode* pTxtNd( static_cast<SwTxtNode*>(pNd) );
914cdf0e10cSrcweir SwNumRule* pNumRule( pTxtNd->GetNumRule() );
915cdf0e10cSrcweir
916cdf0e10cSrcweir if ( pNumRule && pTxtNd->GetNum() &&
917cdf0e10cSrcweir ( pTxtNd->HasNumber() || pTxtNd->HasBullet() ) &&
918cdf0e10cSrcweir pTxtNd->IsCountedInList() &&
919cdf0e10cSrcweir !pTxtNd->IsListRestart() &&
920cdf0e10cSrcweir pTxtNd->GetNum()->GetNumber() ==
921cdf0e10cSrcweir pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ).GetStart() )
922cdf0e10cSrcweir {
923cdf0e10cSrcweir //now set a the start value as attribute
924cdf0e10cSrcweir SwPosition aCurrentNode(*pNd);
925cdf0e10cSrcweir GetDoc()->SetNumRuleStart( aCurrentNode, sal_True );
926cdf0e10cSrcweir }
927cdf0e10cSrcweir }
928cdf0e10cSrcweir }
929cdf0e10cSrcweir break;
930cdf0e10cSrcweir case ND_SECTIONNODE:
931cdf0e10cSrcweir // jump over hidden sections - ignore protection!
932cdf0e10cSrcweir if(((SwSectionNode*)pNd)->GetSection().IsHidden() )
933cdf0e10cSrcweir nCurrNd = pNd->EndOfSectionIndex();
934cdf0e10cSrcweir break;
935cdf0e10cSrcweir case ND_ENDNODE:
936cdf0e10cSrcweir {
937cdf0e10cSrcweir break;
938cdf0e10cSrcweir }
939cdf0e10cSrcweir }
940cdf0e10cSrcweir
941cdf0e10cSrcweir bGoOn = nCurrNd < nEndNd;
942cdf0e10cSrcweir ++nCurrNd;
943cdf0e10cSrcweir }
944cdf0e10cSrcweir }
945cdf0e10cSrcweir }
946cdf0e10cSrcweir
947cdf0e10cSrcweir
948cdf0e10cSrcweir Pop(sal_False);
949cdf0e10cSrcweir EndAllAction();
950cdf0e10cSrcweir }
951cdf0e10cSrcweir
GetLineCount(sal_Bool bActPos)952cdf0e10cSrcweir sal_uInt16 SwEditShell::GetLineCount( sal_Bool bActPos )
953cdf0e10cSrcweir {
954cdf0e10cSrcweir sal_uInt16 nRet = 0;
955cdf0e10cSrcweir CalcLayout();
956cdf0e10cSrcweir SwPaM* pPam = GetCrsr();
957cdf0e10cSrcweir SwNodeIndex& rPtIdx = pPam->GetPoint()->nNode;
958cdf0e10cSrcweir SwNodeIndex aStart( rPtIdx );
959cdf0e10cSrcweir SwCntntNode* pCNd;
960cdf0e10cSrcweir SwCntntFrm *pCntFrm = 0;
961cdf0e10cSrcweir sal_uLong nTmpPos;
962cdf0e10cSrcweir
963cdf0e10cSrcweir if( !bActPos )
964cdf0e10cSrcweir aStart = 0;
965cdf0e10cSrcweir else if( rPtIdx > ( nTmpPos = GetDoc()->GetNodes().GetEndOfExtras().GetIndex()) )
966cdf0e10cSrcweir // BodyBereich => Start ist EndOfIcons + 1
967cdf0e10cSrcweir aStart = nTmpPos + 1;
968cdf0e10cSrcweir else
969cdf0e10cSrcweir {
970cdf0e10cSrcweir if( 0 != ( pCNd = pPam->GetCntntNode() ) &&
971cdf0e10cSrcweir 0 != ( pCntFrm = pCNd->getLayoutFrm( GetLayout() ) ) )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir const SwStartNode *pTmp;
974cdf0e10cSrcweir if( pCntFrm->IsInFly() ) // Fly
975cdf0e10cSrcweir pTmp = pCNd->FindFlyStartNode();
976cdf0e10cSrcweir else if( pCntFrm->IsInFtn() ) // Footnote
977cdf0e10cSrcweir pTmp = pCNd->FindFootnoteStartNode();
978cdf0e10cSrcweir else
979cdf0e10cSrcweir { // Footer/Header
980cdf0e10cSrcweir const sal_uInt16 nTyp = FRM_HEADER | FRM_FOOTER;
981cdf0e10cSrcweir SwFrm* pFrm = pCntFrm;
982cdf0e10cSrcweir while( pFrm && !(pFrm->GetType() & nTyp) )
983cdf0e10cSrcweir pFrm = pFrm->GetUpper();
984cdf0e10cSrcweir ASSERT( pFrm, "Wo bin ich?" );
985cdf0e10cSrcweir if( pFrm && ( pFrm->GetType() & FRM_FOOTER ) )
986cdf0e10cSrcweir pTmp = pCNd->FindFooterStartNode();
987cdf0e10cSrcweir else
988cdf0e10cSrcweir pTmp = pCNd->FindHeaderStartNode();
989cdf0e10cSrcweir }
990cdf0e10cSrcweir ASSERT( pTmp, "Missing StartNode" );
991cdf0e10cSrcweir aStart = *pTmp;
992cdf0e10cSrcweir }
993cdf0e10cSrcweir ASSERT( pCNd && pCntFrm, "Missing Layout-Information" );
994cdf0e10cSrcweir }
995cdf0e10cSrcweir
996cdf0e10cSrcweir while( 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection(
997cdf0e10cSrcweir &aStart, sal_True, sal_False )) && ( !bActPos || aStart <= rPtIdx ) )
998cdf0e10cSrcweir {
999cdf0e10cSrcweir if( 0 != ( pCntFrm = pCNd->getLayoutFrm( GetLayout() ) ) && pCntFrm->IsTxtFrm() )
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir xub_StrLen nActPos = bActPos && aStart == rPtIdx ?
1002cdf0e10cSrcweir pPam->GetPoint()->nContent.GetIndex() : USHRT_MAX;
1003cdf0e10cSrcweir nRet = nRet + ((SwTxtFrm*)pCntFrm)->GetLineCount( nActPos );
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir return nRet;
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir
CompareDoc(const SwDoc & rDoc)1009cdf0e10cSrcweir long SwEditShell::CompareDoc( const SwDoc& rDoc )
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir StartAllAction();
1012cdf0e10cSrcweir long nRet = GetDoc()->CompareDoc( rDoc );
1013cdf0e10cSrcweir EndAllAction();
1014cdf0e10cSrcweir return nRet;
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir
MergeDoc(const SwDoc & rDoc)1017cdf0e10cSrcweir long SwEditShell::MergeDoc( const SwDoc& rDoc )
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir StartAllAction();
1020cdf0e10cSrcweir long nRet = GetDoc()->MergeDoc( rDoc );
1021cdf0e10cSrcweir EndAllAction();
1022cdf0e10cSrcweir return nRet;
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir
1025cdf0e10cSrcweir
GetFtnInfo() const1026cdf0e10cSrcweir const SwFtnInfo& SwEditShell::GetFtnInfo() const
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir return GetDoc()->GetFtnInfo();
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir
SetFtnInfo(const SwFtnInfo & rInfo)1031cdf0e10cSrcweir void SwEditShell::SetFtnInfo(const SwFtnInfo& rInfo)
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir StartAllAction();
1034cdf0e10cSrcweir SET_CURR_SHELL( this );
1035cdf0e10cSrcweir GetDoc()->SetFtnInfo(rInfo);
1036cdf0e10cSrcweir CallChgLnk();
1037cdf0e10cSrcweir EndAllAction();
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir
GetEndNoteInfo() const1040cdf0e10cSrcweir const SwEndNoteInfo& SwEditShell::GetEndNoteInfo() const
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir return GetDoc()->GetEndNoteInfo();
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir
SetEndNoteInfo(const SwEndNoteInfo & rInfo)1045cdf0e10cSrcweir void SwEditShell::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
1046cdf0e10cSrcweir {
1047cdf0e10cSrcweir StartAllAction();
1048cdf0e10cSrcweir SET_CURR_SHELL( this );
1049cdf0e10cSrcweir GetDoc()->SetEndNoteInfo(rInfo);
1050cdf0e10cSrcweir EndAllAction();
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir
GetLineNumberInfo() const1053cdf0e10cSrcweir const SwLineNumberInfo& SwEditShell::GetLineNumberInfo() const
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir return GetDoc()->GetLineNumberInfo();
1056cdf0e10cSrcweir }
1057cdf0e10cSrcweir
SetLineNumberInfo(const SwLineNumberInfo & rInfo)1058cdf0e10cSrcweir void SwEditShell::SetLineNumberInfo(const SwLineNumberInfo& rInfo)
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir StartAllAction();
1061cdf0e10cSrcweir SET_CURR_SHELL( this );
1062cdf0e10cSrcweir GetDoc()->SetLineNumberInfo(rInfo);
1063cdf0e10cSrcweir AddPaintRect( GetLayout()->Frm() );
1064cdf0e10cSrcweir EndAllAction();
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir
GetLinkUpdMode(sal_Bool bDocSettings) const1067cdf0e10cSrcweir sal_uInt16 SwEditShell::GetLinkUpdMode(sal_Bool bDocSettings) const
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir return getIDocumentSettingAccess()->getLinkUpdateMode( !bDocSettings );
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir
SetLinkUpdMode(sal_uInt16 nMode)1072cdf0e10cSrcweir void SwEditShell::SetLinkUpdMode( sal_uInt16 nMode )
1073cdf0e10cSrcweir {
1074cdf0e10cSrcweir getIDocumentSettingAccess()->setLinkUpdateMode( nMode );
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir
1077cdf0e10cSrcweir
1078cdf0e10cSrcweir // Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe
1079cdf0e10cSrcweir // von japanischen/chinesischen Zeichen)
CreateExtTextInput(LanguageType eInputLanguage)1080cdf0e10cSrcweir SwExtTextInput* SwEditShell::CreateExtTextInput(LanguageType eInputLanguage)
1081cdf0e10cSrcweir {
1082cdf0e10cSrcweir SwExtTextInput* pRet = GetDoc()->CreateExtTextInput( *GetCrsr() );
1083cdf0e10cSrcweir pRet->SetLanguage(eInputLanguage);
1084cdf0e10cSrcweir pRet->SetOverwriteCursor( SwCrsrShell::IsOverwriteCrsr() );
1085cdf0e10cSrcweir return pRet;
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir
DeleteExtTextInput(SwExtTextInput * pDel,sal_Bool bInsText)1088cdf0e10cSrcweir String SwEditShell::DeleteExtTextInput( SwExtTextInput* pDel, sal_Bool bInsText )
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir if( !pDel )
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir const SwPosition& rPos = *GetCrsr()->GetPoint();
1093cdf0e10cSrcweir pDel = GetDoc()->GetExtTextInput( rPos.nNode.GetNode(),
1094cdf0e10cSrcweir rPos.nContent.GetIndex() );
1095cdf0e10cSrcweir if( !pDel )
1096cdf0e10cSrcweir {
1097cdf0e10cSrcweir //JP 25.10.2001: under UNIX the cursor is moved before the Input-
1098cdf0e10cSrcweir // Engine event comes in. So take any - normally there
1099cdf0e10cSrcweir // exist only one at the time. -- Task 92016
1100cdf0e10cSrcweir pDel = GetDoc()->GetExtTextInput();
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir String sRet;
1104cdf0e10cSrcweir if( pDel )
1105cdf0e10cSrcweir {
1106cdf0e10cSrcweir rtl::OUString sTmp;
1107cdf0e10cSrcweir SwUnoCursorHelper::GetTextFromPam(*pDel, sTmp);
1108cdf0e10cSrcweir sRet = sTmp;
1109cdf0e10cSrcweir SET_CURR_SHELL( this );
1110cdf0e10cSrcweir StartAllAction();
1111cdf0e10cSrcweir pDel->SetInsText( bInsText );
1112cdf0e10cSrcweir SetOverwriteCrsr( pDel->IsOverwriteCursor() );
1113cdf0e10cSrcweir const SwPosition aPos( *pDel->GetPoint() );
1114cdf0e10cSrcweir GetDoc()->DeleteExtTextInput( pDel );
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir // In this case, the "replace" function did not set the cursor
1117cdf0e10cSrcweir // to the original position. Therefore we have to do this manually.
1118cdf0e10cSrcweir if ( ! bInsText && IsOverwriteCrsr() )
1119cdf0e10cSrcweir *GetCrsr()->GetPoint() = aPos;
1120cdf0e10cSrcweir
1121cdf0e10cSrcweir EndAllAction();
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir return sRet;
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir
SetExtTextInputData(const CommandExtTextInputData & rData)1126cdf0e10cSrcweir void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData )
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir const SwPosition& rPos = *GetCrsr()->GetPoint();
1129cdf0e10cSrcweir SwExtTextInput* pInput = GetDoc()->GetExtTextInput( rPos.nNode.GetNode()
1130cdf0e10cSrcweir /*, rPos.nContent.GetIndex()*/ );
1131cdf0e10cSrcweir if( pInput )
1132cdf0e10cSrcweir {
1133cdf0e10cSrcweir StartAllAction();
1134cdf0e10cSrcweir SET_CURR_SHELL( this );
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir if( !rData.IsOnlyCursorChanged() )
1137cdf0e10cSrcweir pInput->SetInputData( rData );
1138cdf0e10cSrcweir // Cursor positionieren:
1139cdf0e10cSrcweir const SwPosition& rStt = *pInput->Start();
1140cdf0e10cSrcweir xub_StrLen nNewCrsrPos = rStt.nContent.GetIndex() + rData.GetCursorPos();
1141cdf0e10cSrcweir
1142cdf0e10cSrcweir // zwar unschoen aber was hilfts
1143cdf0e10cSrcweir ShowCrsr();
1144cdf0e10cSrcweir long nDiff = nNewCrsrPos - rPos.nContent.GetIndex();
1145cdf0e10cSrcweir if( 0 > nDiff )
1146cdf0e10cSrcweir Left( (xub_StrLen)-nDiff, CRSR_SKIP_CHARS );
1147cdf0e10cSrcweir else if( 0 < nDiff )
1148cdf0e10cSrcweir Right( (xub_StrLen)nDiff, CRSR_SKIP_CHARS );
1149cdf0e10cSrcweir
1150cdf0e10cSrcweir SetOverwriteCrsr( rData.IsCursorOverwrite() );
1151cdf0e10cSrcweir
1152cdf0e10cSrcweir EndAllAction();
1153cdf0e10cSrcweir
1154cdf0e10cSrcweir if( !rData.IsCursorVisible() ) // must be called after the EndAction
1155cdf0e10cSrcweir HideCrsr();
1156cdf0e10cSrcweir }
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir
TransliterateText(sal_uInt32 nType)1159cdf0e10cSrcweir void SwEditShell::TransliterateText( sal_uInt32 nType )
1160cdf0e10cSrcweir {
1161cdf0e10cSrcweir utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType );
1162cdf0e10cSrcweir StartAllAction();
1163cdf0e10cSrcweir SET_CURR_SHELL( this );
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir SwPaM* pCrsr = GetCrsr();
1166cdf0e10cSrcweir if( pCrsr->GetNext() != pCrsr )
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
1169cdf0e10cSrcweir FOREACHPAM_START( this )
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir if( PCURCRSR->HasMark() )
1172cdf0e10cSrcweir GetDoc()->TransliterateText( *PCURCRSR, aTrans );
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir FOREACHPAM_END()
1175cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir else
1178cdf0e10cSrcweir GetDoc()->TransliterateText( *pCrsr, aTrans );
1179cdf0e10cSrcweir
1180cdf0e10cSrcweir EndAllAction();
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir
CountWords(SwDocStat & rStat) const1183cdf0e10cSrcweir void SwEditShell::CountWords( SwDocStat& rStat ) const
1184cdf0e10cSrcweir {
1185cdf0e10cSrcweir FOREACHPAM_START( this )
1186cdf0e10cSrcweir
1187cdf0e10cSrcweir if( PCURCRSR->HasMark() )
1188cdf0e10cSrcweir GetDoc()->CountWords( *PCURCRSR, rStat );
1189cdf0e10cSrcweir
1190cdf0e10cSrcweir FOREACHPAM_END()
1191cdf0e10cSrcweir }
1192cdf0e10cSrcweir
ApplyViewOptions(const SwViewOption & rOpt)1193cdf0e10cSrcweir void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt )
1194cdf0e10cSrcweir {
1195cdf0e10cSrcweir SwCrsrShell::StartAction();
1196cdf0e10cSrcweir ViewShell::ApplyViewOptions( rOpt );
1197cdf0e10cSrcweir SwEditShell::EndAction();
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir
1200cdf0e10cSrcweir
1201