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