1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_editeng.hxx"
26
27 #include <vcl/wrkwin.hxx>
28 #include <vcl/dialog.hxx>
29 #include <vcl/msgbox.hxx>
30 #include <vcl/svapp.hxx>
31
32 #define USE_SVXFONT
33
34 #define _SVSTDARR_sal_uInt16S
35 #include <svl/svstdarr.hxx>
36 #include <svl/ctloptions.hxx>
37 #include <svtools/ctrltool.hxx>
38
39 #include <editeng/svxfont.hxx>
40 #include <impedit.hxx>
41 #include <editeng/editeng.hxx>
42 #include <editeng/editview.hxx>
43 #include <editeng/editstat.hxx>
44 #include <editdbg.hxx>
45 #include <eerdll2.hxx>
46 #include <editeng/eerdll.hxx>
47 #include <editeng.hrc>
48 #include <editeng/acorrcfg.hxx>
49 #include <editeng/flditem.hxx>
50 #include <editeng/txtrange.hxx>
51 #include <vcl/graph.hxx>
52
53 #include <editeng/akrnitem.hxx>
54 #include <editeng/cntritem.hxx>
55 #include <editeng/colritem.hxx>
56 #include <editeng/crsditem.hxx>
57 #include <editeng/escpitem.hxx>
58 #include <editeng/fhgtitem.hxx>
59 #include <editeng/fontitem.hxx>
60 #include <editeng/kernitem.hxx>
61 #include <editeng/lrspitem.hxx>
62 #include <editeng/postitem.hxx>
63 #include <editeng/shdditem.hxx>
64 #include <editeng/udlnitem.hxx>
65 #include <editeng/wghtitem.hxx>
66 #include <editeng/wrlmitem.hxx>
67 #include <editeng/brshitem.hxx>
68 #include <editeng/cscoitem.hxx>
69 #include <editeng/langitem.hxx>
70 #include <editeng/emphitem.hxx>
71 #include <editeng/charscaleitem.hxx>
72 #include <editeng/charreliefitem.hxx>
73
74 #include <sot/exchange.hxx>
75 #include <sot/formats.hxx>
76
77 #include <editeng/numitem.hxx>
78 #include <editeng/bulitem.hxx>
79 #include <editeng/unolingu.hxx>
80 #include <linguistic/lngprops.hxx>
81 #include <i18npool/mslangid.hxx>
82 #include <vcl/help.hxx>
83 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
84 #include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
85
86 #include <svl/srchdefs.hxx>
87
88 #if OSL_DEBUG_LEVEL > 1
89 #include <editeng/frmdiritem.hxx>
90 #endif
91 #include <basegfx/polygon/b2dpolygon.hxx>
92
93 // Spaeter -> TOOLS\STRING.H (fuer Grep: WS_TARGET)
94
95 using namespace ::com::sun::star;
96 using namespace ::com::sun::star::uno;
97 using namespace ::com::sun::star::linguistic2;
98
99
100 DBG_NAME( EditEngine )
101 DBG_NAMEEX( EditView )
102
103 #if (OSL_DEBUG_LEVEL > 1) || defined ( DBG_UTIL )
104 static sal_Bool bDebugPaint = sal_False;
105 #endif
106
107 SV_IMPL_VARARR( EECharAttribArray, EECharAttrib );
108
109 static SfxItemPool* pGlobalPool=0;
110
111 // ----------------------------------------------------------------------
112 // EditEngine
113 // ----------------------------------------------------------------------
EditEngine(SfxItemPool * pItemPool)114 EditEngine::EditEngine( SfxItemPool* pItemPool )
115 {
116 DBG_CTOR( EditEngine, 0 );
117 pImpEditEngine = new ImpEditEngine( this, pItemPool );
118 }
119
~EditEngine()120 EditEngine::~EditEngine()
121 {
122 DBG_DTOR( EditEngine, 0 );
123 delete pImpEditEngine;
124 }
125
EnableUndo(sal_Bool bEnable)126 void EditEngine::EnableUndo( sal_Bool bEnable )
127 {
128 DBG_CHKTHIS( EditEngine, 0 );
129 pImpEditEngine->EnableUndo( bEnable );
130 }
131
IsUndoEnabled()132 sal_Bool EditEngine::IsUndoEnabled()
133 {
134 DBG_CHKTHIS( EditEngine, 0 );
135 return pImpEditEngine->IsUndoEnabled();
136 }
137
IsInUndo()138 sal_Bool EditEngine::IsInUndo()
139 {
140 DBG_CHKTHIS( EditEngine, 0 );
141 return pImpEditEngine->IsInUndo();
142 }
143
GetUndoManager()144 ::svl::IUndoManager& EditEngine::GetUndoManager()
145 {
146 DBG_CHKTHIS( EditEngine, 0 );
147 return pImpEditEngine->GetUndoManager();
148 }
149
SetUndoManager(::svl::IUndoManager * pNew)150 ::svl::IUndoManager* EditEngine::SetUndoManager(::svl::IUndoManager* pNew)
151 {
152 DBG_CHKTHIS( EditEngine, 0 );
153 return pImpEditEngine->SetUndoManager(pNew);
154 }
155
UndoActionStart(sal_uInt16 nId)156 void EditEngine::UndoActionStart( sal_uInt16 nId )
157 {
158 DBG_CHKTHIS( EditEngine, 0 );
159 DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Aufruf von UndoActionStart im Undomodus!" );
160 if ( !pImpEditEngine->IsInUndo() )
161 pImpEditEngine->UndoActionStart( nId );
162 }
163
UndoActionEnd(sal_uInt16 nId)164 void EditEngine::UndoActionEnd( sal_uInt16 nId )
165 {
166 DBG_CHKTHIS( EditEngine, 0 );
167 DBG_ASSERT( !pImpEditEngine->IsInUndo(), "Aufruf von UndoActionEnd im Undomodus!" );
168 if ( !pImpEditEngine->IsInUndo() )
169 pImpEditEngine->UndoActionEnd( nId );
170 }
171
HasTriedMergeOnLastAddUndo() const172 sal_Bool EditEngine::HasTriedMergeOnLastAddUndo() const
173 {
174 return pImpEditEngine->mbLastTryMerge;
175 }
176
SetRefDevice(OutputDevice * pRefDev)177 void EditEngine::SetRefDevice( OutputDevice* pRefDev )
178 {
179 DBG_CHKTHIS( EditEngine, 0 );
180 pImpEditEngine->SetRefDevice( pRefDev );
181 }
182
GetRefDevice() const183 OutputDevice* EditEngine::GetRefDevice() const
184 {
185 DBG_CHKTHIS( EditEngine, 0 );
186 return pImpEditEngine->GetRefDevice();
187 }
188
SetRefMapMode(const MapMode & rMapMode)189 void EditEngine::SetRefMapMode( const MapMode& rMapMode )
190 {
191 DBG_CHKTHIS( EditEngine, 0 );
192 pImpEditEngine->SetRefMapMode( rMapMode );
193 }
194
GetRefMapMode()195 MapMode EditEngine::GetRefMapMode()
196 {
197 DBG_CHKTHIS( EditEngine, 0 );
198 return pImpEditEngine->GetRefMapMode();
199 }
200
SetBackgroundColor(const Color & rColor)201 void EditEngine::SetBackgroundColor( const Color& rColor )
202 {
203 DBG_CHKTHIS( EditEngine, 0 );
204 pImpEditEngine->SetBackgroundColor( rColor );
205 }
206
GetBackgroundColor() const207 Color EditEngine::GetBackgroundColor() const
208 {
209 DBG_CHKTHIS( EditEngine, 0 );
210 return pImpEditEngine->GetBackgroundColor();
211 }
212
GetAutoColor() const213 Color EditEngine::GetAutoColor() const
214 {
215 DBG_CHKTHIS( EditEngine, 0 );
216 return pImpEditEngine->GetAutoColor();
217 }
218
EnableAutoColor(sal_Bool b)219 void EditEngine::EnableAutoColor( sal_Bool b )
220 {
221 DBG_CHKTHIS( EditEngine, 0 );
222 pImpEditEngine->EnableAutoColor( b );
223 }
224
IsAutoColorEnabled() const225 sal_Bool EditEngine::IsAutoColorEnabled() const
226 {
227 DBG_CHKTHIS( EditEngine, 0 );
228 return pImpEditEngine->IsAutoColorEnabled();
229 }
230
ForceAutoColor(sal_Bool b)231 void EditEngine::ForceAutoColor( sal_Bool b )
232 {
233 DBG_CHKTHIS( EditEngine, 0 );
234 pImpEditEngine->ForceAutoColor( b );
235 }
236
IsForceAutoColor() const237 sal_Bool EditEngine::IsForceAutoColor() const
238 {
239 DBG_CHKTHIS( EditEngine, 0 );
240 return pImpEditEngine->IsForceAutoColor();
241 }
242
GetEmptyItemSet()243 const SfxItemSet& EditEngine::GetEmptyItemSet()
244 {
245 DBG_CHKTHIS( EditEngine, 0 );
246 return pImpEditEngine->GetEmptyItemSet();
247 }
248
Draw(OutputDevice * pOutDev,const Rectangle & rOutRect)249 void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect )
250 {
251 DBG_CHKTHIS( EditEngine, 0 );
252 Draw( pOutDev, rOutRect, Point( 0, 0 ) );
253 }
254
Draw(OutputDevice * pOutDev,const Point & rStartPos,short nOrientation)255 void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation )
256 {
257 DBG_CHKTHIS( EditEngine, 0 );
258 // Mit 2 Punkten erzeugen, da bei Positivem Punkt, LONGMAX als Size
259 // Bottom und Right im Bereich > LONGMAX landen.
260 Rectangle aBigRec( -0x3FFFFFFF, -0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF );
261 if( pOutDev->GetConnectMetaFile() )
262 pOutDev->Push();
263 Point aStartPos( rStartPos );
264 if ( IsVertical() )
265 {
266 aStartPos.X() += GetPaperSize().Width();
267 aStartPos = Rotate( aStartPos, nOrientation, rStartPos );
268 }
269 pImpEditEngine->Paint( pOutDev, aBigRec, aStartPos, sal_False, nOrientation );
270 if( pOutDev->GetConnectMetaFile() )
271 pOutDev->Pop();
272 }
273
Draw(OutputDevice * pOutDev,const Rectangle & rOutRect,const Point & rStartDocPos)274 void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos )
275 {
276 Draw( pOutDev, rOutRect, rStartDocPos, sal_True );
277 }
278
Draw(OutputDevice * pOutDev,const Rectangle & rOutRect,const Point & rStartDocPos,sal_Bool bClip)279 void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip )
280 {
281 DBG_CHKTHIS( EditEngine, 0 );
282
283 #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
284 if ( bDebugPaint )
285 EditDbg::ShowEditEngineData( this, sal_False );
286 #endif
287
288 // Auf Pixelgrenze ausrichten, damit genau das gleiche
289 // wie bei Paint().
290 Rectangle aOutRect( pOutDev->LogicToPixel( rOutRect ) );
291 aOutRect = pOutDev->PixelToLogic( aOutRect );
292
293 Point aStartPos;
294 if ( !IsVertical() )
295 {
296 aStartPos.X() = aOutRect.Left() - rStartDocPos.X();
297 aStartPos.Y() = aOutRect.Top() - rStartDocPos.Y();
298 }
299 else
300 {
301 aStartPos.X() = aOutRect.Right() + rStartDocPos.Y();
302 aStartPos.Y() = aOutRect.Top() - rStartDocPos.X();
303 }
304
305 sal_Bool bClipRegion = pOutDev->IsClipRegion();
306 sal_Bool bMetafile = pOutDev->GetConnectMetaFile() ? sal_True : sal_False;
307 Region aOldRegion = pOutDev->GetClipRegion();
308
309 #ifdef EDIT_PRINTER_LOG
310 if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
311 {
312 SvFileStream aLog( "d:\\editprn.log", STREAM_WRITE );
313 aLog.Seek( STREAM_SEEK_TO_END );
314 aLog << '' << endl << "Printing: ";
315 aLog << GetText( "\n\r" ).GetStr();
316 aLog << endl << endl;
317 aLog << "Ref-Device: " << String( (sal_uInt32)GetRefDevice() ).GetStr() << " Type=" << String( (sal_uInt16)GetRefDevice()->GetOutDevType() ).GetStr() << ", MapX=" << String( GetRefDevice()->GetMapMode().GetScaleX().GetNumerator() ).GetStr() << "/" << String( GetRefDevice()->GetMapMode().GetScaleX().GetDenominator() ).GetStr() <<endl;
318 aLog << "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tOut-Width: " << String( rOutRect.GetWidth() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl;
319 aLog << "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tOut-Height: " << String( rOutRect.GetHeight() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl;
320
321 aLog << endl;
322 }
323 #endif
324
325 // Wenn es eine gab => Schnittmenge !
326 // Bei der Metafileaufzeichnung Push/Pop verwenden.
327 if ( bMetafile )
328 pOutDev->Push();
329
330 // Immer die Intersect-Methode, weil beim Metafile ein Muss!
331 if ( bClip )
332 {
333 // Clip only if necessary...
334 if ( !rStartDocPos.X() && !rStartDocPos.Y() &&
335 ( rOutRect.GetHeight() >= (long)GetTextHeight() ) &&
336 ( rOutRect.GetWidth() >= (long)CalcTextWidth() ) )
337 {
338 bClip = sal_False;
339 }
340 else
341 {
342 // Einige Druckertreiber bereiten Probleme, wenn Buchstaben die
343 // ClipRegion streifen, deshalb lieber ein Pixel mehr...
344 Rectangle aClipRect( aOutRect );
345 if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
346 {
347 Size aPixSz( 1, 0 );
348 aPixSz = pOutDev->PixelToLogic( aPixSz );
349 aClipRect.Right() += aPixSz.Width();
350 aClipRect.Bottom() += aPixSz.Width();
351 }
352 pOutDev->IntersectClipRegion( aClipRect );
353 }
354 }
355
356 pImpEditEngine->Paint( pOutDev, aOutRect, aStartPos );
357
358 if ( bMetafile )
359 pOutDev->Pop();
360 else if ( bClipRegion )
361 pOutDev->SetClipRegion( aOldRegion );
362 else
363 pOutDev->SetClipRegion();
364 }
365
InsertView(EditView * pEditView,sal_uInt16 nIndex)366 void EditEngine::InsertView( EditView* pEditView, sal_uInt16 nIndex )
367 {
368 DBG_CHKTHIS( EditEngine, 0 );
369 DBG_CHKOBJ( pEditView, EditView, 0 );
370
371 if ( nIndex > pImpEditEngine->GetEditViews().Count() )
372 nIndex = pImpEditEngine->GetEditViews().Count();
373
374 pImpEditEngine->GetEditViews().Insert( pEditView, nIndex );
375 EditSelection aStartSel;
376 aStartSel = pImpEditEngine->GetEditDoc().GetStartPaM();
377 pEditView->pImpEditView->SetEditSelection( aStartSel );
378 if ( !pImpEditEngine->GetActiveView() )
379 pImpEditEngine->SetActiveView( pEditView );
380
381 pEditView->pImpEditView->AddDragAndDropListeners();
382 }
383
RemoveView(EditView * pView)384 EditView* EditEngine::RemoveView( EditView* pView )
385 {
386 DBG_CHKTHIS( EditEngine, 0 );
387 DBG_CHKOBJ( pView, EditView, 0 );
388
389 pView->HideCursor();
390 EditView* pRemoved = 0;
391 sal_uInt16 nPos = pImpEditEngine->GetEditViews().GetPos( pView );
392 DBG_ASSERT( nPos != USHRT_MAX, "RemoveView mit ungueltigem Index" );
393 if ( nPos != USHRT_MAX )
394 {
395 pRemoved = pImpEditEngine->GetEditViews().GetObject( nPos );
396 pImpEditEngine->GetEditViews().Remove( nPos );
397 if ( pImpEditEngine->GetActiveView() == pView )
398 {
399 pImpEditEngine->SetActiveView( 0 );
400 pImpEditEngine->GetSelEngine().SetCurView( 0 );
401 }
402 pView->pImpEditView->RemoveDragAndDropListeners();
403
404 }
405 return pRemoved;
406 }
407
RemoveView(sal_uInt16 nIndex)408 EditView* EditEngine::RemoveView( sal_uInt16 nIndex )
409 {
410 DBG_CHKTHIS( EditEngine, 0 );
411 EditView* pView = pImpEditEngine->GetEditViews().GetObject( nIndex );
412 if ( pView )
413 return RemoveView( pView );
414 return NULL;
415 }
416
GetView(sal_uInt16 nIndex) const417 EditView* EditEngine::GetView( sal_uInt16 nIndex ) const
418 {
419 DBG_CHKTHIS( EditEngine, 0 );
420 return pImpEditEngine->GetEditViews().GetObject( nIndex );
421 }
422
GetViewCount() const423 sal_uInt16 EditEngine::GetViewCount() const
424 {
425 DBG_CHKTHIS( EditEngine, 0 );
426 return pImpEditEngine->GetEditViews().Count();
427 }
428
HasView(EditView * pView) const429 sal_Bool EditEngine::HasView( EditView* pView ) const
430 {
431 return pImpEditEngine->GetEditViews().GetPos( pView ) != USHRT_MAX;
432 }
433
GetActiveView() const434 EditView* EditEngine::GetActiveView() const
435 {
436 DBG_CHKTHIS( EditEngine, 0 );
437 return pImpEditEngine->GetActiveView();
438 }
439
SetActiveView(EditView * pView)440 void EditEngine::SetActiveView( EditView* pView )
441 {
442 DBG_CHKTHIS( EditEngine, 0 );
443 if ( pView )
444 {
445 DBG_CHKOBJ( pView, EditView, 0 );
446 }
447 pImpEditEngine->SetActiveView( pView );
448 }
449
SetDefTab(sal_uInt16 nDefTab)450 void EditEngine::SetDefTab( sal_uInt16 nDefTab )
451 {
452 DBG_CHKTHIS( EditEngine, 0 );
453 pImpEditEngine->GetEditDoc().SetDefTab( nDefTab );
454 if ( pImpEditEngine->IsFormatted() )
455 {
456 pImpEditEngine->FormatFullDoc();
457 pImpEditEngine->UpdateViews( (EditView*) 0 );
458 }
459 }
460
GetDefTab() const461 sal_uInt16 EditEngine::GetDefTab() const
462 {
463 DBG_CHKTHIS( EditEngine, 0 );
464 return pImpEditEngine->GetEditDoc().GetDefTab();
465 }
466
SetPaperSize(const Size & rNewSize)467 void EditEngine::SetPaperSize( const Size& rNewSize )
468 {
469 DBG_CHKTHIS( EditEngine, 0 );
470
471 Size aOldSize( pImpEditEngine->GetPaperSize() );
472 pImpEditEngine->SetValidPaperSize( rNewSize );
473 Size aNewSize( pImpEditEngine->GetPaperSize() );
474
475 sal_Bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize();
476 if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) )
477 {
478 for ( sal_uInt16 nView = 0; nView < pImpEditEngine->aEditViews.Count(); nView++ )
479 {
480 EditView* pView = pImpEditEngine->aEditViews[nView];
481 DBG_CHKOBJ( pView, EditView, 0 );
482 if ( bAutoPageSize )
483 pView->pImpEditView->RecalcOutputArea();
484 else if ( pView->pImpEditView->DoAutoSize() )
485 {
486 pView->pImpEditView->ResetOutputArea( Rectangle(
487 pView->pImpEditView->GetOutputArea().TopLeft(), aNewSize ) );
488 }
489 }
490
491 if ( bAutoPageSize || pImpEditEngine->IsFormatted() )
492 {
493 // Aendern der Breite hat bei AutoPageSize keine Wirkung, da durch
494 // Textbreite bestimmt.
495 // Optimierung erst nach Vobis-Auslieferung aktivieren...
496 // if ( !bAutoPageSize )
497 pImpEditEngine->FormatFullDoc();
498 // else
499 // {
500 // pImpEditEngine->FormatDoc(); // PageSize, falls Aenderung
501 // pImpEditEngine->CheckAutoPageSize(); // Falls nichts formatiert wurde
502 // }
503
504 pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
505
506 if ( pImpEditEngine->GetUpdateMode() && pImpEditEngine->GetActiveView() )
507 pImpEditEngine->pActiveView->ShowCursor( sal_False, sal_False );
508 }
509 }
510 }
511
GetPaperSize() const512 const Size& EditEngine::GetPaperSize() const
513 {
514 DBG_CHKTHIS( EditEngine, 0 );
515 return pImpEditEngine->GetPaperSize();
516 }
517
SetVertical(sal_Bool bVertical)518 void EditEngine::SetVertical( sal_Bool bVertical )
519 {
520 DBG_CHKTHIS( EditEngine, 0 );
521 pImpEditEngine->SetVertical( bVertical );
522 }
523
IsVertical() const524 sal_Bool EditEngine::IsVertical() const
525 {
526 DBG_CHKTHIS( EditEngine, 0 );
527 return pImpEditEngine->IsVertical();
528 }
529
SetFixedCellHeight(sal_Bool bUseFixedCellHeight)530 void EditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight )
531 {
532 DBG_CHKTHIS( EditEngine, 0 );
533 pImpEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
534 }
535
IsFixedCellHeight() const536 sal_Bool EditEngine::IsFixedCellHeight() const
537 {
538 DBG_CHKTHIS( EditEngine, 0 );
539 return pImpEditEngine->IsFixedCellHeight();
540 }
541
SetDefaultHorizontalTextDirection(EEHorizontalTextDirection eHTextDir)542 void EditEngine::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
543 {
544 DBG_CHKTHIS( EditEngine, 0 );
545 pImpEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
546 }
547
GetDefaultHorizontalTextDirection() const548 EEHorizontalTextDirection EditEngine::GetDefaultHorizontalTextDirection() const
549 {
550 DBG_CHKTHIS( EditEngine, 0 );
551 return pImpEditEngine->GetDefaultHorizontalTextDirection();
552 }
553
GetScriptType(const ESelection & rSelection) const554 sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const
555 {
556 DBG_CHKTHIS( EditEngine, 0 );
557 EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) );
558 return pImpEditEngine->GetScriptType( aSel );
559 }
560
GetLanguage(sal_uInt32 nPara,sal_uInt16 nPos) const561 LanguageType EditEngine::GetLanguage( sal_uInt32 nPara, sal_uInt16 nPos ) const
562 {
563 DBG_CHKTHIS( EditEngine, 0 );
564 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
565 DBG_ASSERT( pNode, "GetLanguage - nPara is invalid!" );
566 return pNode ? pImpEditEngine->GetLanguage( EditPaM( pNode, nPos ) ) : LANGUAGE_DONTKNOW;
567 }
568
569
TransliterateText(const ESelection & rSelection,sal_Int32 nTransliterationMode)570 void EditEngine::TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode )
571 {
572 DBG_CHKTHIS( EditView, 0 );
573 pImpEditEngine->TransliterateText( pImpEditEngine->CreateSel( rSelection ), nTransliterationMode );
574 }
575
SetAsianCompressionMode(sal_uInt16 n)576 void EditEngine::SetAsianCompressionMode( sal_uInt16 n )
577 {
578 DBG_CHKTHIS( EditView, 0 );
579 pImpEditEngine->SetAsianCompressionMode( n );
580 }
581
GetAsianCompressionMode() const582 sal_uInt16 EditEngine::GetAsianCompressionMode() const
583 {
584 DBG_CHKTHIS( EditView, 0 );
585 return pImpEditEngine->GetAsianCompressionMode();
586 }
587
SetKernAsianPunctuation(sal_Bool b)588 void EditEngine::SetKernAsianPunctuation( sal_Bool b )
589 {
590 DBG_CHKTHIS( EditView, 0 );
591 pImpEditEngine->SetKernAsianPunctuation( b );
592 }
593
IsKernAsianPunctuation() const594 sal_Bool EditEngine::IsKernAsianPunctuation() const
595 {
596 DBG_CHKTHIS( EditView, 0 );
597 return pImpEditEngine->IsKernAsianPunctuation();
598 }
599
SetAddExtLeading(sal_Bool b)600 void EditEngine::SetAddExtLeading( sal_Bool b )
601 {
602 DBG_CHKTHIS( EditEngine, 0 );
603 pImpEditEngine->SetAddExtLeading( b );
604 }
605
IsAddExtLeading() const606 sal_Bool EditEngine::IsAddExtLeading() const
607 {
608 DBG_CHKTHIS( EditEngine, 0 );
609 return pImpEditEngine->IsAddExtLeading();
610 }
611
SetPolygon(const basegfx::B2DPolyPolygon & rPolyPolygon)612 void EditEngine::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
613 {
614 DBG_CHKTHIS( EditEngine, 0 );
615 SetPolygon( rPolyPolygon, 0L );
616 }
617
SetPolygon(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B2DPolyPolygon * pLinePolyPolygon)618 void EditEngine::SetPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
619 {
620 DBG_CHKTHIS( EditEngine, 0 );
621 sal_Bool bSimple(sal_False);
622
623 if(pLinePolyPolygon && 1L == rPolyPolygon.count())
624 {
625 if(rPolyPolygon.getB2DPolygon(0L).isClosed())
626 {
627 // open polygon
628 bSimple = sal_True;
629 }
630 }
631
632 TextRanger* pRanger = new TextRanger( rPolyPolygon, pLinePolyPolygon, 30, 2, 2, bSimple, sal_True );
633 pImpEditEngine->SetTextRanger( pRanger );
634 pImpEditEngine->SetPaperSize( pRanger->GetBoundRect().GetSize() );
635 }
636
ClearPolygon()637 void EditEngine::ClearPolygon()
638 {
639 DBG_CHKTHIS( EditEngine, 0 );
640 pImpEditEngine->SetTextRanger( 0 );
641 }
642
GetPolygon()643 const PolyPolygon* EditEngine::GetPolygon()
644 {
645 DBG_CHKTHIS( EditEngine, 0 );
646 return pImpEditEngine->GetTextRanger() ?
647 &pImpEditEngine->GetTextRanger()->GetPolyPolygon() : NULL;
648 }
649
GetMinAutoPaperSize() const650 const Size& EditEngine::GetMinAutoPaperSize() const
651 {
652 DBG_CHKTHIS( EditEngine, 0 );
653 return pImpEditEngine->GetMinAutoPaperSize();
654 }
655
SetMinAutoPaperSize(const Size & rSz)656 void EditEngine::SetMinAutoPaperSize( const Size& rSz )
657 {
658 DBG_CHKTHIS( EditEngine, 0 );
659 pImpEditEngine->SetMinAutoPaperSize( rSz );
660 }
661
GetMaxAutoPaperSize() const662 const Size& EditEngine::GetMaxAutoPaperSize() const
663 {
664 DBG_CHKTHIS( EditEngine, 0 );
665 return pImpEditEngine->GetMaxAutoPaperSize();
666 }
667
SetMaxAutoPaperSize(const Size & rSz)668 void EditEngine::SetMaxAutoPaperSize( const Size& rSz )
669 {
670 DBG_CHKTHIS( EditEngine, 0 );
671 pImpEditEngine->SetMaxAutoPaperSize( rSz );
672 }
673
GetText(LineEnd eEnd) const674 XubString EditEngine::GetText( LineEnd eEnd ) const
675 {
676 DBG_CHKTHIS( EditEngine, 0 );
677 return pImpEditEngine->GetEditDoc().GetText( eEnd );
678 }
679
GetText(const ESelection & rESelection,const LineEnd eEnd) const680 XubString EditEngine::GetText( const ESelection& rESelection, const LineEnd eEnd ) const
681 {
682 DBG_CHKTHIS( EditEngine, 0 );
683 EditSelection aSel( pImpEditEngine->CreateSel( rESelection ) );
684 return pImpEditEngine->GetSelected( aSel, eEnd );
685 }
686
GetTextLen() const687 sal_uInt32 EditEngine::GetTextLen() const
688 {
689 DBG_CHKTHIS( EditEngine, 0 );
690 return pImpEditEngine->GetEditDoc().GetTextLen();
691 }
692
GetParagraphCount() const693 sal_uInt32 EditEngine::GetParagraphCount() const
694 {
695 DBG_CHKTHIS( EditEngine, 0 );
696 return pImpEditEngine->aEditDoc.Count();
697 }
698
GetLineCount(sal_uInt32 nParagraph) const699 sal_uInt16 EditEngine::GetLineCount( sal_uInt32 nParagraph ) const
700 {
701 DBG_CHKTHIS( EditEngine, 0 );
702 if ( !pImpEditEngine->IsFormatted() )
703 pImpEditEngine->FormatDoc();
704 return pImpEditEngine->GetLineCount( nParagraph );
705 }
706
GetLineLen(sal_uInt32 nParagraph,sal_uInt16 nLine) const707 sal_uInt16 EditEngine::GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const
708 {
709 DBG_CHKTHIS( EditEngine, 0 );
710 if ( !pImpEditEngine->IsFormatted() )
711 pImpEditEngine->FormatDoc();
712 return pImpEditEngine->GetLineLen( nParagraph, nLine );
713 }
714
GetLineBoundaries(sal_uInt16 & rStart,sal_uInt16 & rEnd,sal_uInt32 nParagraph,sal_uInt16 nLine) const715 void EditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt32 nParagraph, sal_uInt16 nLine ) const
716 {
717 DBG_CHKTHIS( EditEngine, 0 );
718 if ( !pImpEditEngine->IsFormatted() )
719 pImpEditEngine->FormatDoc();
720 return pImpEditEngine->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
721 }
722
GetLineNumberAtIndex(sal_uInt32 nPara,sal_uInt16 nIndex) const723 sal_uInt16 EditEngine::GetLineNumberAtIndex( sal_uInt32 nPara, sal_uInt16 nIndex ) const
724 {
725 DBG_CHKTHIS( EditEngine, 0 );
726 if ( !pImpEditEngine->IsFormatted() )
727 pImpEditEngine->FormatDoc();
728 return pImpEditEngine->GetLineNumberAtIndex( nPara, nIndex );
729 }
730
GetLineHeight(sal_uInt32 nParagraph,sal_uInt16 nLine)731 sal_uInt32 EditEngine::GetLineHeight( sal_uInt32 nParagraph, sal_uInt16 nLine )
732 {
733 DBG_CHKTHIS( EditEngine, 0 );
734 // Falls jemand mit einer leeren Engine ein GetLineHeight() macht.
735 if ( !pImpEditEngine->IsFormatted() )
736 pImpEditEngine->FormatDoc();
737 return pImpEditEngine->GetLineHeight( nParagraph, nLine );
738 }
739
GetFirstLineOffset(sal_uInt32 nParagraph)740 sal_uInt16 EditEngine::GetFirstLineOffset( sal_uInt32 nParagraph )
741 {
742 DBG_CHKTHIS( EditEngine, 0 );
743 if ( !pImpEditEngine->IsFormatted() )
744 pImpEditEngine->FormatDoc();
745 ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
746 return ( pPortion ? pPortion->GetFirstLineOffset() : 0 );
747 }
748
GetTextHeight(sal_uInt32 nParagraph) const749 sal_uInt32 EditEngine::GetTextHeight( sal_uInt32 nParagraph ) const
750 {
751 DBG_CHKTHIS( EditEngine, 0 );
752
753 if ( !pImpEditEngine->IsFormatted() )
754 pImpEditEngine->FormatDoc();
755
756 sal_uInt32 nHeight = pImpEditEngine->GetParaHeight( nParagraph );
757 return nHeight;
758 }
759
GetWord(sal_uInt32 nPara,sal_uInt16 nIndex)760 XubString EditEngine::GetWord( sal_uInt32 nPara, sal_uInt16 nIndex )
761 {
762 ESelection aESel( nPara, nIndex, nPara, nIndex );
763 EditSelection aSel( pImpEditEngine->CreateSel( aESel ) );
764 aSel = pImpEditEngine->SelectWord( aSel );
765 return pImpEditEngine->GetSelected( aSel );
766 }
767
GetWord(const ESelection & rSelection,sal_uInt16 nWordType) const768 ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const
769 {
770 // ImpEditEngine-Iteration-Methods should be const!
771 EditEngine* pE = (EditEngine*)this;
772
773 EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
774 aSel = pE->pImpEditEngine->SelectWord( aSel, nWordType );
775 return pE->pImpEditEngine->CreateESel( aSel );
776 }
777
WordLeft(const ESelection & rSelection,sal_uInt16 nWordType) const778 ESelection EditEngine::WordLeft( const ESelection& rSelection, sal_uInt16 nWordType ) const
779 {
780 // ImpEditEngine-Iteration-Methods should be const!
781 EditEngine* pE = (EditEngine*)this;
782
783 EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
784 aSel = pE->pImpEditEngine->WordLeft( aSel.Min(), nWordType );
785 return pE->pImpEditEngine->CreateESel( aSel );
786 }
787
WordRight(const ESelection & rSelection,sal_uInt16 nWordType) const788 ESelection EditEngine::WordRight( const ESelection& rSelection, sal_uInt16 nWordType ) const
789 {
790 // ImpEditEngine-Iteration-Methods should be const!
791 EditEngine* pE = (EditEngine*)this;
792
793 EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
794 aSel = pE->pImpEditEngine->WordRight( aSel.Max(), nWordType );
795 return pE->pImpEditEngine->CreateESel( aSel );
796 }
797
CursorLeft(const ESelection & rSelection,sal_uInt16 nCharacterIteratorMode) const798 ESelection EditEngine::CursorLeft( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const
799 {
800 // ImpEditEngine-Iteration-Methods should be const!
801 EditEngine* pE = (EditEngine*)this;
802
803 EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
804 aSel = pE->pImpEditEngine->CursorLeft( aSel.Min(), nCharacterIteratorMode );
805 return pE->pImpEditEngine->CreateESel( aSel );
806 }
807
CursorRight(const ESelection & rSelection,sal_uInt16 nCharacterIteratorMode) const808 ESelection EditEngine::CursorRight( const ESelection& rSelection, sal_uInt16 nCharacterIteratorMode ) const
809 {
810 // ImpEditEngine-Iteration-Methods should be const!
811 EditEngine* pE = (EditEngine*)this;
812
813 EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
814 aSel = pE->pImpEditEngine->CursorRight( aSel.Max(), nCharacterIteratorMode );
815 return pE->pImpEditEngine->CreateESel( aSel );
816 }
817
SelectSentence(const ESelection & rCurSel) const818 ESelection EditEngine::SelectSentence( const ESelection& rCurSel ) const
819 {
820 EditEngine* pE = (EditEngine*)this;
821 EditSelection aCurSel( pE->pImpEditEngine->CreateSel( rCurSel ) );
822 EditSelection aSentenceSel( pE->pImpEditEngine->SelectSentence( aCurSel ) );
823 return pE->pImpEditEngine->CreateESel( aSentenceSel );
824 }
825
PostKeyEvent(const KeyEvent & rKeyEvent,EditView * pEditView)826 sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView )
827 {
828 DBG_CHKTHIS( EditEngine, 0 );
829 DBG_CHKOBJ( pEditView, EditView, 0 );
830 DBG_ASSERT( pEditView, "Keine View - keine Kekse !" );
831
832 sal_Bool bDone = sal_True;
833
834 sal_Bool bModified = sal_False;
835 sal_Bool bMoved = sal_False;
836 sal_Bool bAllowIdle = sal_True;
837 sal_Bool bReadOnly = pEditView->IsReadOnly();
838
839 sal_uInt16 nNewCursorFlags = 0;
840 sal_Bool bSetCursorFlags = sal_True;
841
842 EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
843 DBG_ASSERT( !aCurSel.IsInvalid(), "Blinde Selection in EditEngine::PostKeyEvent" );
844
845 String aAutoText( pImpEditEngine->GetAutoCompleteText() );
846 if ( pImpEditEngine->GetAutoCompleteText().Len() )
847 pImpEditEngine->SetAutoCompleteText( String(), sal_True );
848
849 sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode();
850 KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
851 if ( eFunc != KEYFUNC_DONTKNOW )
852 {
853 switch ( eFunc )
854 {
855 case KEYFUNC_UNDO:
856 {
857 if ( !bReadOnly )
858 pEditView->Undo();
859 return sal_True;
860 }
861 // break;
862 case KEYFUNC_REDO:
863 {
864 if ( !bReadOnly )
865 pEditView->Redo();
866 return sal_True;
867 }
868 // break;
869
870 default: // wird dann evtl. unten bearbeitet.
871 eFunc = KEYFUNC_DONTKNOW;
872 }
873 }
874
875 pImpEditEngine->EnterBlockNotifications();
876
877 if ( GetNotifyHdl().IsSet() )
878 {
879 EENotify aNotify( EE_NOTIFY_INPUT_START );
880 aNotify.pEditEngine = this;
881 pImpEditEngine->CallNotify( aNotify );
882 }
883
884 if ( eFunc == KEYFUNC_DONTKNOW )
885 {
886 switch ( nCode )
887 {
888 #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
889 case KEY_F1:
890 {
891 if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
892 {
893 sal_uInt32 nParas = GetParagraphCount();
894 Point aPos;
895 Point aViewStart( pEditView->GetOutputArea().TopLeft() );
896 long n20 = 40 * pImpEditEngine->nOnePixelInRef;
897 for ( sal_uInt32 n = 0; n < nParas; n++ )
898 {
899 long nH = GetTextHeight( n );
900 Point P1( aViewStart.X() + n20 + n20*(n%2), aViewStart.Y() + aPos.Y() );
901 Point P2( P1 );
902 P2.X() += n20;
903 P2.Y() += nH;
904 pEditView->GetWindow()->SetLineColor();
905 pEditView->GetWindow()->SetFillColor( Color( (n%2) ? COL_YELLOW : COL_LIGHTGREEN ) );
906 pEditView->GetWindow()->DrawRect( Rectangle( P1, P2 ) );
907 aPos.Y() += nH;
908 }
909 }
910 bDone = sal_False;
911 }
912 break;
913 case KEY_F11:
914 {
915 if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
916 {
917 bDebugPaint = !bDebugPaint;
918 ByteString aInfo( "DebugPaint: " );
919 aInfo += bDebugPaint ? "On" : "Off";
920 InfoBox( NULL, String( aInfo, RTL_TEXTENCODING_ASCII_US ) ).Execute();
921 }
922 bDone = sal_False;
923 }
924 break;
925 case KEY_F12:
926 {
927 if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
928 {
929 EditDbg::ShowEditEngineData( this );
930 #ifdef EDIT_PRINTER_LOG
931 SvFileStream aLog( "d:\\editprn.log", STREAM_WRITE );
932 aLog.Seek( STREAM_SEEK_TO_END );
933 aLog << '' << endl << "Debug: ";
934 aLog << GetText( "\n\r" ).GetStr();
935 aLog << endl << endl;
936 aLog << "Ref-Device: " << String( (sal_uInt32)GetRefDevice() ).GetStr() << " Type=" << String( (sal_uInt16)GetRefDevice()->GetOutDevType() ).GetStr() << ", MapX=" << String( GetRefDevice()->GetMapMode().GetScaleX().GetNumerator() ).GetStr() << "/" << String( GetRefDevice()->GetMapMode().GetScaleX().GetDenominator() ).GetStr() <<endl;
937 aLog << "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl;
938 aLog << "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl;
939 aLog << endl;
940 #endif
941 }
942 bDone = sal_False;
943 }
944 break;
945 #endif
946 case KEY_UP:
947 case KEY_DOWN:
948 case KEY_LEFT:
949 case KEY_RIGHT:
950 case KEY_HOME:
951 case KEY_END:
952 case KEY_PAGEUP:
953 case KEY_PAGEDOWN:
954 case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
955 case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
956 case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
957 case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
958 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
959 case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
960 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
961 case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
962 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
963 case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
964 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
965 case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
966 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
967 case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
968 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
969 case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
970 {
971 if ( !rKeyEvent.GetKeyCode().IsMod2() || ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) )
972 {
973 if ( pImpEditEngine->DoVisualCursorTraveling( aCurSel.Max().GetNode() ) && ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) /* || ( nCode == KEY_HOME ) || ( nCode == KEY_END ) */ ) )
974 bSetCursorFlags = sal_False; // Will be manipulated within visual cursor move
975
976 aCurSel = pImpEditEngine->MoveCursor( rKeyEvent, pEditView );
977
978 if ( aCurSel.HasRange() ) {
979 Reference<com::sun::star::datatransfer::clipboard::XClipboard> aSelection(pEditView->GetWindow()->GetPrimarySelection());
980 pEditView->pImpEditView->CutCopy( aSelection, sal_False );
981 }
982
983 bMoved = sal_True;
984 if ( nCode == KEY_HOME )
985 nNewCursorFlags |= GETCRSR_STARTOFLINE;
986 else if ( nCode == KEY_END )
987 nNewCursorFlags |= GETCRSR_ENDOFLINE;
988
989 }
990 #if OSL_DEBUG_LEVEL > 1
991 GetLanguage( pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() ), aCurSel.Max().GetIndex() );
992 #endif
993 }
994 break;
995 case KEY_BACKSPACE:
996 case KEY_DELETE:
997 case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
998 case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
999 case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
1000 case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
1001 {
1002 if ( !bReadOnly && !rKeyEvent.GetKeyCode().IsMod2() )
1003 {
1004 // check if we are behind a bullet and using the backspace key
1005 ContentNode *pNode = aCurSel.Min().GetNode();
1006 const SvxNumberFormat *pFmt = pImpEditEngine->GetNumberFormat( pNode );
1007 if (pFmt && nCode == KEY_BACKSPACE &&
1008 !aCurSel.HasRange() && aCurSel.Min().GetIndex() == 0)
1009 {
1010 // if the bullet is still visible just do not paint it from
1011 // now on and that will be all. Otherwise continue as usual.
1012 // ...
1013
1014 sal_uInt32 nPara = pImpEditEngine->GetEditDoc().GetPos( pNode );
1015 SfxBoolItem aBulletState( (const SfxBoolItem&) pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) );
1016 bool bBulletIsVisible = aBulletState.GetValue() ? true : false;
1017
1018 // just toggling EE_PARA_BULLETSTATE should be fine for both cases...
1019 aBulletState.SetValue( !bBulletIsVisible );
1020 SfxItemSet aSet( pImpEditEngine->GetParaAttribs( nPara ) );
1021 aSet.Put( aBulletState );
1022 pImpEditEngine->SetParaAttribs( nPara, aSet );
1023
1024 // have this and the following paragraphs formatted and repainted.
1025 // (not painting a numbering in the list may cause the following
1026 // numberings to have different numbers than before and thus the
1027 // length may have changed as well )
1028 pImpEditEngine->FormatAndUpdate( pImpEditEngine->GetActiveView() );
1029
1030 if (bBulletIsVisible) // bullet just turned invisible...
1031 break;
1032 }
1033
1034 sal_uInt8 nDel = 0, nMode = 0;
1035 switch( nCode )
1036 {
1037 case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
1038 nMode = DELMODE_RESTOFWORD;
1039 nDel = DEL_LEFT;
1040 break;
1041 case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
1042 nMode = DELMODE_RESTOFWORD;
1043 nDel = DEL_RIGHT;
1044 break;
1045 case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH:
1046 nMode = DELMODE_RESTOFCONTENT;
1047 nDel = DEL_LEFT;
1048 break;
1049 case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH:
1050 nMode = DELMODE_RESTOFCONTENT;
1051 nDel = DEL_RIGHT;
1052 break;
1053 default:
1054 nDel = ( nCode == KEY_DELETE ) ? DEL_RIGHT : DEL_LEFT;
1055 nMode = rKeyEvent.GetKeyCode().IsMod1() ? DELMODE_RESTOFWORD : DELMODE_SIMPLE;
1056 if ( ( nMode == DELMODE_RESTOFWORD ) && rKeyEvent.GetKeyCode().IsShift() )
1057 nMode = DELMODE_RESTOFCONTENT;
1058 break;
1059 }
1060
1061 pEditView->pImpEditView->DrawSelection();
1062 pImpEditEngine->UndoActionStart( EDITUNDO_DELETE );
1063 aCurSel = pImpEditEngine->DeleteLeftOrRight( aCurSel, nDel, nMode );
1064 pImpEditEngine->UndoActionEnd( EDITUNDO_DELETE );
1065 bModified = sal_True;
1066 bAllowIdle = sal_False;
1067 }
1068 }
1069 break;
1070 case KEY_TAB:
1071 {
1072 if ( !bReadOnly && !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
1073 {
1074 sal_Bool bShift = rKeyEvent.GetKeyCode().IsShift();
1075 if ( pImpEditEngine->GetStatus().DoTabIndenting() &&
1076 ( aCurSel.Min().GetNode() != aCurSel.Max().GetNode() ) )
1077 {
1078 pImpEditEngine->IndentBlock( pEditView, !bShift );
1079 }
1080 else if ( !bShift )
1081 {
1082 sal_Bool bSel = pEditView->HasSelection();
1083 if ( bSel )
1084 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1085 if ( pImpEditEngine->GetStatus().DoAutoCorrect() )
1086 aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() );
1087 aCurSel = pImpEditEngine->InsertTab( aCurSel );
1088 if ( bSel )
1089 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1090 bModified = sal_True;
1091 }
1092 }
1093 else
1094 bDone = sal_False;
1095 }
1096 break;
1097 case KEY_RETURN:
1098 {
1099 if ( !bReadOnly )
1100 {
1101 pEditView->pImpEditView->DrawSelection();
1102 if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
1103 {
1104 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1105 if ( rKeyEvent.GetKeyCode().IsShift() )
1106 {
1107 aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() );
1108 aCurSel = pImpEditEngine->InsertLineBreak( aCurSel );
1109 }
1110 else
1111 {
1112 if ( !aAutoText.Len() )
1113 {
1114 if ( pImpEditEngine->GetStatus().DoAutoCorrect() )
1115 aCurSel = pImpEditEngine->AutoCorrect( aCurSel, 0, !pEditView->IsInsertMode() );
1116 aCurSel = pImpEditEngine->InsertParaBreak( aCurSel );
1117 }
1118 else
1119 {
1120 DBG_ASSERT( !aCurSel.HasRange(), "Selektion bei Complete?!" );
1121 EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) );
1122 aCurSel = pImpEditEngine->InsertText(
1123 EditSelection( aStart, aCurSel.Max() ), aAutoText );
1124 pImpEditEngine->SetAutoCompleteText( String(), sal_True );
1125 }
1126 }
1127 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1128 bModified = sal_True;
1129 }
1130 }
1131 }
1132 break;
1133 case KEY_INSERT:
1134 {
1135 if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
1136 pEditView->SetInsertMode( !pEditView->IsInsertMode() );
1137 }
1138 break;
1139 default:
1140 {
1141 #if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL)
1142 if ( ( nCode == KEY_W ) && rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
1143 {
1144 SfxItemSet aAttribs = pEditView->GetAttribs();
1145 const SvxFrameDirectionItem& rCurrentWritingMode = (const SvxFrameDirectionItem&)aAttribs.Get( EE_PARA_WRITINGDIR );
1146 SvxFrameDirectionItem aNewItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
1147 if ( rCurrentWritingMode.GetValue() != FRMDIR_HORI_RIGHT_TOP )
1148 aNewItem.SetValue( FRMDIR_HORI_RIGHT_TOP );
1149 aAttribs.Put( aNewItem );
1150 pEditView->SetAttribs( aAttribs );
1151 }
1152 #endif
1153 if ( !bReadOnly && IsSimpleCharInput( rKeyEvent ) )
1154 {
1155 xub_Unicode nCharCode = rKeyEvent.GetCharCode();
1156 pEditView->pImpEditView->DrawSelection();
1157 // Autokorrektur ?
1158 SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect();
1159 if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) &&
1160 ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) ||
1161 pAutoCorrect->HasRunNext() ) )
1162 {
1163 aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() );
1164 }
1165 else
1166 {
1167 aCurSel = pImpEditEngine->InsertText( (const EditSelection&)aCurSel, nCharCode, !pEditView->IsInsertMode(), sal_True );
1168 }
1169 // AutoComplete ???
1170 if ( pImpEditEngine->GetStatus().DoAutoComplete() && ( nCharCode != ' ' ) )
1171 {
1172 // Aber nur wenn Wort-Ende...
1173 sal_uInt16 nIndex = aCurSel.Max().GetIndex();
1174 if ( ( nIndex >= aCurSel.Max().GetNode()->Len() ) ||
1175 ( pImpEditEngine->aWordDelimiters.Search( aCurSel.Max().GetNode()->GetChar( nIndex ) ) != STRING_NOTFOUND ) )
1176 {
1177 EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) );
1178 String aWord = pImpEditEngine->GetSelected( EditSelection( aStart, aCurSel.Max() ) );
1179 if ( aWord.Len() >= 3 )
1180 {
1181 String aComplete;
1182
1183 LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1));
1184 lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang));
1185
1186 if (!pImpEditEngine->xLocaleDataWrapper.isInitialized())
1187 pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), aLocale, eLang);
1188 else
1189 pImpEditEngine->xLocaleDataWrapper.changeLocale( aLocale, eLang);
1190
1191 if (!pImpEditEngine->xTransliterationWrapper.isInitialized())
1192 pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), eLang, i18n::TransliterationModules_IGNORE_CASE);
1193 else
1194 pImpEditEngine->xTransliterationWrapper.changeLocale( eLang);
1195
1196 const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->xTransliterationWrapper.get();
1197 Sequence< i18n::CalendarItem > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays();
1198 sal_Int32 nCount = xItem.getLength();
1199 const i18n::CalendarItem* pArr = xItem.getArray();
1200 for( sal_Int32 n = 0; n <= nCount; ++n )
1201 {
1202 const ::rtl::OUString& rDay = pArr[n].FullName;
1203 if( pTransliteration->isMatch( aWord, rDay) )
1204 {
1205 aComplete = rDay;
1206 break;
1207 }
1208 }
1209
1210 if ( !aComplete.Len() )
1211 {
1212 xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths();
1213 sal_Int32 nMonthCount = xItem.getLength();
1214 const i18n::CalendarItem* pMonthArr = xItem.getArray();
1215 for( sal_Int32 n = 0; n <= nMonthCount; ++n )
1216 {
1217 const ::rtl::OUString& rMon = pMonthArr[n].FullName;
1218 if( pTransliteration->isMatch( aWord, rMon) )
1219 {
1220 aComplete = rMon;
1221 break;
1222 }
1223 }
1224 }
1225
1226 if( aComplete.Len() && ( ( aWord.Len() + 1 ) < aComplete.Len() ) )
1227 {
1228 pImpEditEngine->SetAutoCompleteText( aComplete, sal_False );
1229 Point aPos = pImpEditEngine->PaMtoEditCursor( aCurSel.Max() ).TopLeft();
1230 aPos = pEditView->pImpEditView->GetWindowPos( aPos );
1231 aPos = pEditView->pImpEditView->GetWindow()->LogicToPixel( aPos );
1232 aPos = pEditView->GetWindow()->OutputToScreenPixel( aPos );
1233 aPos.Y() -= 3;
1234 Help::ShowQuickHelp( pEditView->GetWindow(), Rectangle( aPos, Size( 1, 1 ) ), aComplete, QUICKHELP_BOTTOM|QUICKHELP_LEFT );
1235 }
1236 }
1237 }
1238 }
1239 bModified = sal_True;
1240 }
1241 else
1242 bDone = sal_False;
1243 }
1244 }
1245 }
1246
1247 pEditView->pImpEditView->SetEditSelection( aCurSel );
1248 pImpEditEngine->UpdateSelections();
1249
1250 if ( ( !IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ) ||
1251 ( IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ))
1252 {
1253 pEditView->pImpEditView->nTravelXPos = TRAVEL_X_DONTKNOW;
1254 }
1255
1256 if ( /* ( nCode != KEY_HOME ) && ( nCode != KEY_END ) && */
1257 ( !IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) ||
1258 ( IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ))
1259 {
1260 pEditView->pImpEditView->SetCursorBidiLevel( 0xFFFF );
1261 }
1262
1263 if ( bSetCursorFlags )
1264 pEditView->pImpEditView->nExtraCursorFlags = nNewCursorFlags;
1265
1266 if ( bModified )
1267 {
1268 DBG_ASSERT( !bReadOnly, "ReadOnly but modified???" );
1269 // Idle-Formatter nur, wenn AnyInput.
1270 if ( bAllowIdle && pImpEditEngine->GetStatus().UseIdleFormatter()
1271 && Application::AnyInput( INPUT_KEYBOARD) )
1272 pImpEditEngine->IdleFormatAndUpdate( pEditView );
1273 else
1274 pImpEditEngine->FormatAndUpdate( pEditView );
1275 }
1276 else if ( bMoved )
1277 {
1278 sal_Bool bGotoCursor = pEditView->pImpEditView->DoAutoScroll();
1279 pEditView->pImpEditView->ShowCursor( bGotoCursor, sal_True );
1280 pImpEditEngine->CallStatusHdl();
1281 }
1282
1283 if ( GetNotifyHdl().IsSet() )
1284 {
1285 EENotify aNotify( EE_NOTIFY_INPUT_END );
1286 aNotify.pEditEngine = this;
1287 pImpEditEngine->CallNotify( aNotify );
1288 }
1289
1290 pImpEditEngine->LeaveBlockNotifications();
1291
1292 return bDone;
1293 }
1294
GetTextHeight() const1295 sal_uInt32 EditEngine::GetTextHeight() const
1296 {
1297 DBG_CHKTHIS( EditEngine, 0 );
1298
1299 if ( !pImpEditEngine->IsFormatted() )
1300 pImpEditEngine->FormatDoc();
1301
1302 sal_uInt32 nHeight = !IsVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( sal_True );
1303 return nHeight;
1304 }
1305
CalcTextWidth()1306 sal_uInt32 EditEngine::CalcTextWidth()
1307 {
1308 DBG_CHKTHIS( EditEngine, 0 );
1309
1310 if ( !pImpEditEngine->IsFormatted() )
1311 pImpEditEngine->FormatDoc();
1312
1313 sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( sal_True ) : pImpEditEngine->GetTextHeight();
1314 return nWidth;
1315 }
1316
SetUpdateMode(sal_Bool bUpdate)1317 void EditEngine::SetUpdateMode( sal_Bool bUpdate )
1318 {
1319 DBG_CHKTHIS( EditEngine, 0 );
1320 pImpEditEngine->SetUpdateMode( bUpdate );
1321 if ( pImpEditEngine->pActiveView )
1322 pImpEditEngine->pActiveView->ShowCursor( sal_False, sal_False );
1323 }
1324
GetUpdateMode() const1325 sal_Bool EditEngine::GetUpdateMode() const
1326 {
1327 DBG_CHKTHIS( EditEngine, 0 );
1328 return pImpEditEngine->GetUpdateMode();
1329 }
1330
Clear()1331 void EditEngine::Clear()
1332 {
1333 DBG_CHKTHIS( EditEngine, 0 );
1334 pImpEditEngine->Clear();
1335 }
1336
SetText(const XubString & rText)1337 void EditEngine::SetText( const XubString& rText )
1338 {
1339 DBG_CHKTHIS( EditEngine, 0 );
1340 pImpEditEngine->SetText( rText );
1341 if ( rText.Len() )
1342 pImpEditEngine->FormatAndUpdate();
1343 }
1344
Read(SvStream & rInput,const String & rBaseURL,EETextFormat eFormat,SvKeyValueIterator * pHTTPHeaderAttrs)1345 sal_uLong EditEngine::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ )
1346 {
1347 DBG_CHKTHIS( EditEngine, 0 );
1348 sal_Bool bUndoEnabled = pImpEditEngine->IsUndoEnabled();
1349 pImpEditEngine->EnableUndo( sal_False );
1350 pImpEditEngine->SetText( XubString() );
1351 EditPaM aPaM( pImpEditEngine->GetEditDoc().GetStartPaM() );
1352 pImpEditEngine->Read( rInput, rBaseURL, eFormat, EditSelection( aPaM, aPaM ), pHTTPHeaderAttrs );
1353 pImpEditEngine->EnableUndo( bUndoEnabled );
1354 return rInput.GetError();
1355 }
1356
Write(SvStream & rOutput,EETextFormat eFormat)1357 sal_uLong EditEngine::Write( SvStream& rOutput, EETextFormat eFormat )
1358 {
1359 DBG_CHKTHIS( EditEngine, 0 );
1360 EditPaM aStartPaM( pImpEditEngine->GetEditDoc().GetStartPaM() );
1361 EditPaM aEndPaM( pImpEditEngine->GetEditDoc().GetEndPaM() );
1362 pImpEditEngine->Write( rOutput, eFormat, EditSelection( aStartPaM, aEndPaM ) );
1363 return rOutput.GetError();
1364 }
1365
CreateTextObject()1366 EditTextObject* EditEngine::CreateTextObject()
1367 {
1368 DBG_CHKTHIS( EditEngine, 0 );
1369 return pImpEditEngine->CreateTextObject();
1370 }
1371
CreateTextObject(const ESelection & rESelection)1372 EditTextObject* EditEngine::CreateTextObject( const ESelection& rESelection )
1373 {
1374 DBG_CHKTHIS( EditEngine, 0 );
1375 EditSelection aSel( pImpEditEngine->CreateSel( rESelection ) );
1376 return pImpEditEngine->CreateTextObject( aSel );
1377 }
1378
SetText(const EditTextObject & rTextObject)1379 void EditEngine::SetText( const EditTextObject& rTextObject )
1380 {
1381 DBG_CHKTHIS( EditEngine, 0 );
1382 pImpEditEngine->EnterBlockNotifications();
1383 pImpEditEngine->SetText( rTextObject );
1384 pImpEditEngine->FormatAndUpdate();
1385 pImpEditEngine->LeaveBlockNotifications();
1386 }
1387
ShowParagraph(sal_uInt32 nParagraph,sal_Bool bShow)1388 void EditEngine::ShowParagraph( sal_uInt32 nParagraph, sal_Bool bShow )
1389 {
1390 DBG_CHKTHIS( EditEngine, 0 );
1391 pImpEditEngine->ShowParagraph( nParagraph, bShow );
1392 }
1393
IsParagraphVisible(sal_uInt32 nParagraph)1394 sal_Bool EditEngine::IsParagraphVisible( sal_uInt32 nParagraph )
1395 {
1396 DBG_CHKTHIS( EditEngine, 0 );
1397 return pImpEditEngine->IsParagraphVisible( nParagraph );
1398 }
1399
SetNotifyHdl(const Link & rLink)1400 void EditEngine::SetNotifyHdl( const Link& rLink )
1401 {
1402 DBG_CHKTHIS( EditEngine, 0 );
1403 pImpEditEngine->SetNotifyHdl( rLink );
1404 }
1405
GetNotifyHdl() const1406 Link EditEngine::GetNotifyHdl() const
1407 {
1408 DBG_CHKTHIS( EditEngine, 0 );
1409 return pImpEditEngine->GetNotifyHdl();
1410 }
1411
SetStatusEventHdl(const Link & rLink)1412 void EditEngine::SetStatusEventHdl( const Link& rLink )
1413 {
1414 DBG_CHKTHIS( EditEngine, 0 );
1415 pImpEditEngine->SetStatusEventHdl( rLink );
1416 }
1417
GetStatusEventHdl() const1418 Link EditEngine::GetStatusEventHdl() const
1419 {
1420 DBG_CHKTHIS( EditEngine, 0 );
1421 return pImpEditEngine->GetStatusEventHdl();
1422 }
1423
SetImportHdl(const Link & rLink)1424 void EditEngine::SetImportHdl( const Link& rLink )
1425 {
1426 DBG_CHKTHIS( EditEngine, 0 );
1427 pImpEditEngine->aImportHdl = rLink;
1428 }
1429
GetImportHdl() const1430 Link EditEngine::GetImportHdl() const
1431 {
1432 DBG_CHKTHIS( EditEngine, 0 );
1433 return pImpEditEngine->aImportHdl;
1434 }
1435
SetBeginMovingParagraphsHdl(const Link & rLink)1436 void EditEngine::SetBeginMovingParagraphsHdl( const Link& rLink )
1437 {
1438 DBG_CHKTHIS( EditEngine, 0 );
1439 pImpEditEngine->aBeginMovingParagraphsHdl = rLink;
1440 }
1441
SetEndMovingParagraphsHdl(const Link & rLink)1442 void EditEngine::SetEndMovingParagraphsHdl( const Link& rLink )
1443 {
1444 DBG_CHKTHIS( EditEngine, 0 );
1445 pImpEditEngine->aEndMovingParagraphsHdl = rLink;
1446 }
1447
SetBeginPasteOrDropHdl(const Link & rLink)1448 void EditEngine::SetBeginPasteOrDropHdl( const Link& rLink )
1449 {
1450 DBG_CHKTHIS( EditEngine, 0 );
1451
1452 pImpEditEngine->aBeginPasteOrDropHdl = rLink;
1453 }
1454
SetEndPasteOrDropHdl(const Link & rLink)1455 void EditEngine::SetEndPasteOrDropHdl( const Link& rLink )
1456 {
1457 DBG_CHKTHIS( EditEngine, 0 );
1458 pImpEditEngine->aEndPasteOrDropHdl = rLink;
1459 }
1460
CreateTextObject(sal_uInt32 nPara,sal_uInt32 nParas)1461 EditTextObject* EditEngine::CreateTextObject( sal_uInt32 nPara, sal_uInt32 nParas )
1462 {
1463 DBG_CHKTHIS( EditEngine, 0 );
1464 DBG_ASSERT( nPara < pImpEditEngine->GetEditDoc().Count(), "CreateTextObject: Startpara out of Range" );
1465 DBG_ASSERT( nPara+nParas-1 < pImpEditEngine->GetEditDoc().Count(), "CreateTextObject: Endpara out of Range" );
1466
1467 ContentNode* pStartNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
1468 ContentNode* pEndNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara+nParas-1 );
1469 DBG_ASSERT( pStartNode, "Start-Absatz existiert nicht: CreateTextObject" );
1470 DBG_ASSERT( pEndNode, "End-Absatz existiert nicht: CreateTextObject" );
1471
1472 if ( pStartNode && pEndNode )
1473 {
1474 EditSelection aTmpSel;
1475 aTmpSel.Min() = EditPaM( pStartNode, 0 );
1476 aTmpSel.Max() = EditPaM( pEndNode, pEndNode->Len() );
1477 return pImpEditEngine->CreateTextObject( aTmpSel );
1478 }
1479 return 0;
1480 }
1481
RemoveParagraph(sal_uInt32 nPara)1482 void EditEngine::RemoveParagraph( sal_uInt32 nPara )
1483 {
1484 DBG_CHKTHIS( EditEngine, 0 );
1485 DBG_ASSERT( pImpEditEngine->GetEditDoc().Count() > 1, "Der erste Absatz darf nicht geloescht werden!" );
1486 if( pImpEditEngine->GetEditDoc().Count() <= 1 )
1487 return;
1488
1489 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
1490 ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
1491 DBG_ASSERT( pPortion && pNode, "Absatz nicht gefunden: RemoveParagraph" );
1492 if ( pNode && pPortion )
1493 {
1494 // Keine Undokappselung noetig.
1495 pImpEditEngine->ImpRemoveParagraph( nPara );
1496 pImpEditEngine->InvalidateFromParagraph( nPara );
1497 pImpEditEngine->UpdateSelections();
1498 pImpEditEngine->FormatAndUpdate();
1499 }
1500 }
1501
GetTextLen(sal_uInt32 nPara) const1502 sal_uInt16 EditEngine::GetTextLen( sal_uInt32 nPara ) const
1503 {
1504 DBG_CHKTHIS( EditEngine, 0 );
1505 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
1506 DBG_ASSERT( pNode, "Absatz nicht gefunden: GetTextLen" );
1507 if ( pNode )
1508 return pNode->Len();
1509 return 0;
1510 }
1511
GetText(sal_uInt32 nPara) const1512 XubString EditEngine::GetText( sal_uInt32 nPara ) const
1513 {
1514 DBG_CHKTHIS( EditEngine, 0 );
1515 XubString aStr;
1516 if ( nPara < pImpEditEngine->GetEditDoc().Count() )
1517 aStr = pImpEditEngine->GetEditDoc().GetParaAsString( nPara );
1518 return aStr;
1519 }
1520
SetModifyHdl(const Link & rLink)1521 void EditEngine::SetModifyHdl( const Link& rLink )
1522 {
1523 DBG_CHKTHIS( EditEngine, 0 );
1524 pImpEditEngine->SetModifyHdl( rLink );
1525 }
1526
GetModifyHdl() const1527 Link EditEngine::GetModifyHdl() const
1528 {
1529 DBG_CHKTHIS( EditEngine, 0 );
1530 return pImpEditEngine->GetModifyHdl();
1531 }
1532
1533
ClearModifyFlag()1534 void EditEngine::ClearModifyFlag()
1535 {
1536 DBG_CHKTHIS( EditEngine, 0 );
1537 pImpEditEngine->SetModifyFlag( sal_False );
1538 }
1539
SetModified()1540 void EditEngine::SetModified()
1541 {
1542 DBG_CHKTHIS( EditEngine, 0 );
1543 pImpEditEngine->SetModifyFlag( sal_True );
1544 }
1545
IsModified() const1546 sal_Bool EditEngine::IsModified() const
1547 {
1548 DBG_CHKTHIS( EditEngine, 0 );
1549 return pImpEditEngine->IsModified();
1550 }
1551
IsInSelectionMode() const1552 sal_Bool EditEngine::IsInSelectionMode() const
1553 {
1554 DBG_CHKTHIS( EditEngine, 0 );
1555 return ( pImpEditEngine->IsInSelectionMode() ||
1556 pImpEditEngine->GetSelEngine().IsInSelection() );
1557 }
1558
StopSelectionMode()1559 void EditEngine::StopSelectionMode()
1560 {
1561 DBG_CHKTHIS( EditEngine, 0 );
1562 pImpEditEngine->StopSelectionMode();
1563 }
1564
InsertParagraph(sal_uInt32 nPara,const EditTextObject & rTxtObj)1565 void EditEngine::InsertParagraph( sal_uInt32 nPara, const EditTextObject& rTxtObj )
1566 {
1567 DBG_CHKTHIS( EditEngine, 0 );
1568 if ( nPara > GetParagraphCount() )
1569 {
1570 DBG_ASSERTWARNING( nPara == USHRT_MAX, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " );
1571 nPara = GetParagraphCount();
1572 }
1573
1574 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1575
1576 // Keine Undoklammerung noetig.
1577 EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) );
1578 // Bei einem InsertParagraph von aussen sollen keine Harten
1579 // Attribute uebernommen werden !
1580 pImpEditEngine->RemoveCharAttribs( nPara );
1581 pImpEditEngine->InsertText( rTxtObj, EditSelection( aPaM, aPaM ) );
1582
1583 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1584
1585 pImpEditEngine->FormatAndUpdate();
1586 }
1587
InsertParagraph(sal_uInt32 nPara,const XubString & rTxt)1588 void EditEngine::InsertParagraph( sal_uInt32 nPara, const XubString& rTxt )
1589 {
1590 DBG_CHKTHIS( EditEngine, 0 );
1591 if ( nPara > GetParagraphCount() )
1592 {
1593 DBG_ASSERTWARNING( nPara == USHRT_MAX, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " );
1594 nPara = GetParagraphCount();
1595 }
1596
1597 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1598 EditPaM aPaM( pImpEditEngine->InsertParagraph( nPara ) );
1599 // Bei einem InsertParagraph von aussen sollen keine Harten
1600 // Attribute uebernommen werden !
1601 pImpEditEngine->RemoveCharAttribs( nPara );
1602 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1603 pImpEditEngine->ImpInsertText( EditSelection( aPaM, aPaM ), rTxt );
1604 pImpEditEngine->FormatAndUpdate();
1605 }
1606
SetText(sal_uInt32 nPara,const EditTextObject & rTxtObj)1607 void EditEngine::SetText( sal_uInt32 nPara, const EditTextObject& rTxtObj )
1608 {
1609 DBG_CHKTHIS( EditEngine, 0 );
1610 EditSelection* pSel = pImpEditEngine->SelectParagraph( nPara );
1611 if ( pSel )
1612 {
1613 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1614 pImpEditEngine->InsertText( rTxtObj, *pSel );
1615 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1616 pImpEditEngine->FormatAndUpdate();
1617 delete pSel;
1618 }
1619 }
1620
SetText(sal_uInt32 nPara,const XubString & rTxt)1621 void EditEngine::SetText( sal_uInt32 nPara, const XubString& rTxt )
1622 {
1623 DBG_CHKTHIS( EditEngine, 0 );
1624 EditSelection* pSel = pImpEditEngine->SelectParagraph( nPara );
1625 if ( pSel )
1626 {
1627 pImpEditEngine->UndoActionStart( EDITUNDO_INSERT );
1628 pImpEditEngine->ImpInsertText( *pSel, rTxt );
1629 pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
1630 pImpEditEngine->FormatAndUpdate();
1631 delete pSel;
1632 }
1633 }
1634
SetParaAttribs(sal_uInt32 nPara,const SfxItemSet & rSet)1635 void EditEngine::SetParaAttribs( sal_uInt32 nPara, const SfxItemSet& rSet )
1636 {
1637 DBG_CHKTHIS( EditEngine, 0 );
1638 // Keine Undoklammerung noetig.
1639 pImpEditEngine->SetParaAttribs( nPara, rSet );
1640 pImpEditEngine->FormatAndUpdate();
1641 }
1642
GetParaAttribs(sal_uInt32 nPara) const1643 const SfxItemSet& EditEngine::GetParaAttribs( sal_uInt32 nPara ) const
1644 {
1645 DBG_CHKTHIS( EditEngine, 0 );
1646 return pImpEditEngine->GetParaAttribs( nPara );
1647 }
1648
HasParaAttrib(sal_uInt32 nPara,sal_uInt16 nWhich) const1649 sal_Bool EditEngine::HasParaAttrib( sal_uInt32 nPara, sal_uInt16 nWhich ) const
1650 {
1651 DBG_CHKTHIS( EditEngine, 0 );
1652 return pImpEditEngine->HasParaAttrib( nPara, nWhich );
1653 }
1654
GetParaAttrib(sal_uInt32 nPara,sal_uInt16 nWhich)1655 const SfxPoolItem& EditEngine::GetParaAttrib( sal_uInt32 nPara, sal_uInt16 nWhich )
1656 {
1657 DBG_CHKTHIS( EditEngine, 0 );
1658 return pImpEditEngine->GetParaAttrib( nPara, nWhich );
1659 }
1660
GetCharAttribs(sal_uInt32 nPara,EECharAttribArray & rLst) const1661 void EditEngine::GetCharAttribs( sal_uInt32 nPara, EECharAttribArray& rLst ) const
1662 {
1663 DBG_CHKTHIS( EditEngine, 0 );
1664 pImpEditEngine->GetCharAttribs( nPara, rLst );
1665 }
1666
GetAttribs(const ESelection & rSel,sal_Bool bOnlyHardAttrib)1667 SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib )
1668 {
1669 DBG_CHKTHIS( EditEngine, 0 );
1670 EditSelection aSel( pImpEditEngine->
1671 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
1672 return pImpEditEngine->GetAttribs( aSel, bOnlyHardAttrib );
1673 }
1674
GetAttribs(sal_uInt32 nPara,sal_uInt16 nStart,sal_uInt16 nEnd,sal_uInt8 nFlags) const1675 SfxItemSet EditEngine::GetAttribs( sal_uInt32 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const
1676 {
1677 DBG_CHKTHIS( EditEngine, 0 );
1678 return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags );
1679 }
1680
RemoveAttribs(const ESelection & rSelection,sal_Bool bRemoveParaAttribs,sal_uInt16 nWhich)1681 void EditEngine::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
1682 {
1683 DBG_CHKTHIS( EditEngine, 0 );
1684
1685 pImpEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
1686 EditSelection aSel( pImpEditEngine->ConvertSelection( rSelection.nStartPara, rSelection.nStartPos, rSelection.nEndPara, rSelection.nEndPos ) );
1687 pImpEditEngine->RemoveCharAttribs( aSel, bRemoveParaAttribs, nWhich );
1688 pImpEditEngine->UndoActionEnd( EDITUNDO_RESETATTRIBS );
1689 pImpEditEngine->FormatAndUpdate();
1690 }
1691
1692 // MT: Can be removed after 6.x?
GetStandardFont(sal_uInt32 nPara)1693 Font EditEngine::GetStandardFont( sal_uInt32 nPara )
1694 {
1695 DBG_CHKTHIS( EditEngine, 0 );
1696 return GetStandardSvxFont( nPara );
1697 }
1698
GetStandardSvxFont(sal_uInt32 nPara)1699 SvxFont EditEngine::GetStandardSvxFont( sal_uInt32 nPara )
1700 {
1701 DBG_CHKTHIS( EditEngine, 0 );
1702 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
1703 return pNode->GetCharAttribs().GetDefFont();
1704 }
1705
StripPortions()1706 void EditEngine::StripPortions()
1707 {
1708 DBG_CHKTHIS( EditEngine, 0 );
1709 VirtualDevice aTmpDev;
1710 Rectangle aBigRec( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) );
1711 if ( IsVertical() )
1712 {
1713 aBigRec.Right() = 0;
1714 aBigRec.Left() = -0x7FFFFFFF;
1715 }
1716 pImpEditEngine->Paint( &aTmpDev, aBigRec, Point(), sal_True );
1717 }
1718
GetPortions(sal_uInt32 nPara,SvUShorts & rList)1719 void EditEngine::GetPortions( sal_uInt32 nPara, SvUShorts& rList )
1720 {
1721 if ( !pImpEditEngine->IsFormatted() )
1722 pImpEditEngine->FormatFullDoc();
1723
1724 ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
1725 if ( pParaPortion )
1726 {
1727 sal_uInt16 nEnd = 0;
1728 sal_uInt16 nTextPortions = pParaPortion->GetTextPortions().Count();
1729 for ( sal_uInt16 n = 0; n < nTextPortions; n++ )
1730 {
1731 nEnd = nEnd + pParaPortion->GetTextPortions()[n]->GetLen();
1732 rList.Insert( nEnd, rList.Count() );
1733 }
1734 }
1735 }
1736
SetFlatMode(sal_Bool bFlat)1737 void EditEngine::SetFlatMode( sal_Bool bFlat)
1738 {
1739 DBG_CHKTHIS( EditEngine, 0 );
1740 pImpEditEngine->SetFlatMode( bFlat );
1741 }
1742
IsFlatMode() const1743 sal_Bool EditEngine::IsFlatMode() const
1744 {
1745 DBG_CHKTHIS( EditEngine, 0 );
1746 return !( pImpEditEngine->aStatus.UseCharAttribs() );
1747 }
1748
SetControlWord(sal_uInt32 nWord)1749 void EditEngine::SetControlWord( sal_uInt32 nWord )
1750 {
1751 DBG_CHKTHIS( EditEngine, 0 );
1752
1753 if ( nWord != pImpEditEngine->aStatus.GetControlWord() )
1754 {
1755 sal_uInt32 nPrev = pImpEditEngine->aStatus.GetControlWord();
1756 pImpEditEngine->aStatus.GetControlWord() = nWord;
1757
1758 sal_uInt32 nChanges = nPrev ^ nWord;
1759 if ( pImpEditEngine->IsFormatted() )
1760 {
1761 // ggf. neu formatieren:
1762 if ( ( nChanges & EE_CNTRL_USECHARATTRIBS ) ||
1763 ( nChanges & EE_CNTRL_USEPARAATTRIBS ) ||
1764 ( nChanges & EE_CNTRL_ONECHARPERLINE ) ||
1765 ( nChanges & EE_CNTRL_STRETCHING ) ||
1766 ( nChanges & EE_CNTRL_OUTLINER ) ||
1767 ( nChanges & EE_CNTRL_NOCOLORS ) ||
1768 ( nChanges & EE_CNTRL_OUTLINER2 ) )
1769 {
1770 if ( ( nChanges & EE_CNTRL_USECHARATTRIBS ) ||
1771 ( nChanges & EE_CNTRL_USEPARAATTRIBS ) )
1772 {
1773 sal_Bool bUseCharAttribs = ( nWord & EE_CNTRL_USECHARATTRIBS ) ? sal_True : sal_False;
1774 pImpEditEngine->GetEditDoc().CreateDefFont( bUseCharAttribs );
1775 }
1776
1777 pImpEditEngine->FormatFullDoc();
1778 pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
1779 }
1780 }
1781
1782 sal_Bool bSpellingChanged = nChanges & EE_CNTRL_ONLINESPELLING ? sal_True : sal_False;
1783
1784 if ( bSpellingChanged )
1785 {
1786 pImpEditEngine->StopOnlineSpellTimer();
1787 if ( bSpellingChanged && ( nWord & EE_CNTRL_ONLINESPELLING ) )
1788 {
1789 // WrongListen anlegen, Timer starten...
1790 sal_uInt32 nNodes = pImpEditEngine->GetEditDoc().Count();
1791 for ( sal_uInt32 n = 0; n < nNodes; n++ )
1792 {
1793 ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
1794 pNode->CreateWrongList();
1795 }
1796 pImpEditEngine->StartOnlineSpellTimer();
1797 }
1798 else
1799 {
1800 long nY = 0;
1801 sal_uInt32 nNodes = pImpEditEngine->GetEditDoc().Count();
1802 for ( sal_uInt32 n = 0; n < nNodes; n++ )
1803 {
1804 ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
1805 ParaPortion* pPortion = pImpEditEngine->GetParaPortions().GetObject( n );
1806 sal_Bool bWrongs = ( bSpellingChanged || ( nWord & EE_CNTRL_ONLINESPELLING ) ) ? pNode->GetWrongList()->HasWrongs() : sal_False;
1807 if ( bSpellingChanged ) // Also aus
1808 pNode->DestroyWrongList(); // => vorm Paint weghaun.
1809 if ( bWrongs )
1810 {
1811 pImpEditEngine->aInvalidRec.Left() = 0;
1812 pImpEditEngine->aInvalidRec.Right() = pImpEditEngine->GetPaperSize().Width();
1813 pImpEditEngine->aInvalidRec.Top() = nY+1;
1814 pImpEditEngine->aInvalidRec.Bottom() = nY+pPortion->GetHeight()-1;
1815 pImpEditEngine->UpdateViews( pImpEditEngine->pActiveView );
1816 }
1817 nY += pPortion->GetHeight();
1818 }
1819 }
1820 }
1821 }
1822 }
1823
GetControlWord() const1824 sal_uInt32 EditEngine::GetControlWord() const
1825 {
1826 DBG_CHKTHIS( EditEngine, 0 );
1827 return pImpEditEngine->aStatus.GetControlWord();
1828 }
1829
GetFirstLineStartX(sal_uInt32 nParagraph)1830 long EditEngine::GetFirstLineStartX( sal_uInt32 nParagraph )
1831 {
1832 DBG_CHKTHIS( EditEngine, 0 );
1833
1834 long nX = 0;
1835 ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
1836 if ( pPPortion )
1837 {
1838 DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!" );
1839 if ( !pImpEditEngine->IsFormatted() )
1840 pImpEditEngine->FormatDoc();
1841 EditLine* pFirstLine = pPPortion->GetLines()[0];
1842 nX = pFirstLine->GetStartPosX();
1843 }
1844 return nX;
1845 }
1846
GetDocPos(const Point & rPaperPos) const1847 Point EditEngine::GetDocPos( const Point& rPaperPos ) const
1848 {
1849 Point aDocPos( rPaperPos );
1850 if ( IsVertical() )
1851 {
1852 aDocPos.X() = rPaperPos.Y();
1853 aDocPos.Y() = GetPaperSize().Width() - rPaperPos.X();
1854 }
1855 return aDocPos;
1856 }
1857
GetDocPosTopLeft(sal_uInt32 nParagraph)1858 Point EditEngine::GetDocPosTopLeft( sal_uInt32 nParagraph )
1859 {
1860 DBG_CHKTHIS( EditEngine, 0 );
1861 ParaPortion* pPPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nParagraph );
1862 DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetWindowPosTopLeft" );
1863 Point aPoint;
1864 if ( pPPortion )
1865 {
1866 // Falls jemand mit einer leeren Engine ein GetLineHeight() macht.
1867 DBG_ASSERT( pImpEditEngine->IsFormatted() || !pImpEditEngine->IsFormatting(), "GetDocPosTopLeft: Doc not formatted - unable to format!" );
1868 if ( !pImpEditEngine->IsFormatted() )
1869 pImpEditEngine->FormatAndUpdate();
1870 if ( pPPortion->GetLines().Count() )
1871 {
1872 // So richtiger, falls grosses Bullet.
1873 EditLine* pFirstLine = pPPortion->GetLines()[0];
1874 aPoint.X() = pFirstLine->GetStartPosX();
1875 }
1876 else
1877 {
1878 const SvxLRSpaceItem& rLRItem = pImpEditEngine->GetLRSpaceItem( pPPortion->GetNode() );
1879 // TL_NF_LR aPoint.X() = pImpEditEngine->GetXValue( (short)(rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst()) );
1880 sal_Int32 nSpaceBefore = 0;
1881 pImpEditEngine->GetSpaceBeforeAndMinLabelWidth( pPPortion->GetNode(), &nSpaceBefore );
1882 short nX = (short)(rLRItem.GetTxtLeft()
1883 + rLRItem.GetTxtFirstLineOfst()
1884 + nSpaceBefore);
1885 aPoint.X() = pImpEditEngine->GetXValue( nX
1886 );
1887 }
1888 aPoint.Y() = pImpEditEngine->GetParaPortions().GetYOffset( pPPortion );
1889 }
1890 return aPoint;
1891 }
1892
GetNumberFormat(sal_uInt32 nPara) const1893 const SvxNumberFormat* EditEngine::GetNumberFormat( sal_uInt32 nPara ) const
1894 {
1895 // derived objects may overload this function to give access to
1896 // bullet information (see Outliner)
1897 (void) nPara;
1898 return 0;
1899 }
1900
IsRightToLeft(sal_uInt32 nPara) const1901 sal_Bool EditEngine::IsRightToLeft( sal_uInt32 nPara ) const
1902 {
1903 DBG_CHKTHIS( EditEngine, 0 );
1904 return pImpEditEngine->IsRightToLeft( nPara );
1905 }
1906
IsTextPos(const Point & rPaperPos,sal_uInt16 nBorder)1907 sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
1908 {
1909 DBG_CHKTHIS( EditEngine, 0 );
1910
1911 if ( !pImpEditEngine->IsFormatted() )
1912 pImpEditEngine->FormatDoc();
1913
1914 sal_Bool bTextPos = sal_False;
1915 // #90780# take unrotated positions for calculation here
1916 Point aDocPos = GetDocPos( rPaperPos );
1917
1918 if ( ( aDocPos.Y() > 0 ) && ( aDocPos.Y() < (long)pImpEditEngine->GetTextHeight() ) )
1919 {
1920 EditPaM aPaM = pImpEditEngine->GetPaM( aDocPos, sal_False );
1921 if ( aPaM.GetNode() )
1922 {
1923 ParaPortion* pParaPortion = pImpEditEngine->FindParaPortion( aPaM.GetNode() );
1924 DBG_ASSERT( pParaPortion, "ParaPortion?" );
1925
1926 sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() );
1927 EditLine* pLine = pParaPortion->GetLines().GetObject( nLine );
1928 Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine );
1929 if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) &&
1930 ( aDocPos.X() <= aLineXPosStartEnd.Max() + nBorder ) )
1931 {
1932 bTextPos = sal_True;
1933 }
1934 }
1935 }
1936 return bTextPos;
1937 }
1938
SetEditTextObjectPool(SfxItemPool * pPool)1939 void EditEngine::SetEditTextObjectPool( SfxItemPool* pPool )
1940 {
1941 DBG_CHKTHIS( EditEngine, 0 );
1942 pImpEditEngine->SetEditTextObjectPool( pPool );
1943 }
1944
GetEditTextObjectPool() const1945 SfxItemPool* EditEngine::GetEditTextObjectPool() const
1946 {
1947 DBG_CHKTHIS( EditEngine, 0 );
1948 return pImpEditEngine->GetEditTextObjectPool();
1949 }
1950
QuickSetAttribs(const SfxItemSet & rSet,const ESelection & rSel)1951 void EditEngine::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
1952 {
1953 DBG_CHKTHIS( EditEngine, 0 );
1954
1955 EditSelection aSel( pImpEditEngine->
1956 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
1957
1958 pImpEditEngine->SetAttribs( aSel, rSet );
1959 }
1960
QuickMarkInvalid(const ESelection & rSel)1961 void EditEngine::QuickMarkInvalid( const ESelection& rSel )
1962 {
1963 DBG_CHKTHIS( EditEngine, 0 );
1964 DBG_ASSERT( rSel.nStartPara < pImpEditEngine->GetEditDoc().Count(), "MarkInvalid: Start out of Range!" );
1965 DBG_ASSERT( rSel.nEndPara < pImpEditEngine->GetEditDoc().Count(), "MarkInvalid: End out of Range!" );
1966 for ( sal_uInt32 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
1967 {
1968 ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
1969 if ( pPortion )
1970 pPortion->MarkSelectionInvalid( 0, pPortion->GetNode()->Len() );
1971 }
1972 }
1973
QuickInsertText(const XubString & rText,const ESelection & rSel)1974 void EditEngine::QuickInsertText( const XubString& rText, const ESelection& rSel )
1975 {
1976 DBG_CHKTHIS( EditEngine, 0 );
1977
1978 EditSelection aSel( pImpEditEngine->
1979 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
1980
1981 pImpEditEngine->ImpInsertText( aSel, rText );
1982 }
1983
QuickDelete(const ESelection & rSel)1984 void EditEngine::QuickDelete( const ESelection& rSel )
1985 {
1986 DBG_CHKTHIS( EditEngine, 0 );
1987
1988 EditSelection aSel( pImpEditEngine->
1989 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
1990
1991 pImpEditEngine->ImpDeleteSelection( aSel );
1992 }
1993
QuickMarkToBeRepainted(sal_uInt32 nPara)1994 void EditEngine::QuickMarkToBeRepainted( sal_uInt32 nPara )
1995 {
1996 DBG_CHKTHIS( EditEngine, 0 );
1997 ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SaveGetObject( nPara );
1998 if ( pPortion )
1999 pPortion->SetMustRepaint( sal_True );
2000 }
2001
QuickInsertLineBreak(const ESelection & rSel)2002 void EditEngine::QuickInsertLineBreak( const ESelection& rSel )
2003 {
2004 DBG_CHKTHIS( EditEngine, 0 );
2005
2006 EditSelection aSel( pImpEditEngine->
2007 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
2008
2009 pImpEditEngine->InsertLineBreak( aSel );
2010 }
2011
QuickInsertField(const SvxFieldItem & rFld,const ESelection & rSel)2012 void EditEngine::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
2013 {
2014 DBG_CHKTHIS( EditEngine, 0 );
2015
2016 EditSelection aSel( pImpEditEngine->
2017 ConvertSelection( rSel.nStartPara, rSel.nStartPos, rSel.nEndPara, rSel.nEndPos ) );
2018
2019 pImpEditEngine->ImpInsertFeature( aSel, rFld );
2020 }
2021
QuickFormatDoc(sal_Bool bFull)2022 void EditEngine::QuickFormatDoc( sal_Bool bFull )
2023 {
2024 DBG_CHKTHIS( EditEngine, 0 );
2025 if ( bFull )
2026 pImpEditEngine->FormatFullDoc();
2027 else
2028 pImpEditEngine->FormatDoc();
2029
2030 // #111072# Don't pass active view, maybe selection is not updated yet...
2031 pImpEditEngine->UpdateViews( NULL );
2032 }
2033
QuickRemoveCharAttribs(sal_uInt32 nPara,sal_uInt16 nWhich)2034 void EditEngine::QuickRemoveCharAttribs( sal_uInt32 nPara, sal_uInt16 nWhich )
2035 {
2036 DBG_CHKTHIS( EditEngine, 0 );
2037 pImpEditEngine->RemoveCharAttribs( nPara, nWhich );
2038 }
2039
SetStyleSheet(sal_uInt32 nPara,SfxStyleSheet * pStyle)2040 void EditEngine::SetStyleSheet( sal_uInt32 nPara, SfxStyleSheet* pStyle )
2041 {
2042 DBG_CHKTHIS( EditEngine, 0 );
2043 pImpEditEngine->SetStyleSheet( nPara, pStyle );
2044 }
2045
GetStyleSheet(sal_uInt32 nPara) const2046 SfxStyleSheet* EditEngine::GetStyleSheet( sal_uInt32 nPara ) const
2047 {
2048 DBG_CHKTHIS( EditEngine, 0 );
2049 return pImpEditEngine->GetStyleSheet( nPara );
2050 }
2051
SetStyleSheetPool(SfxStyleSheetPool * pSPool)2052 void EditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
2053 {
2054 DBG_CHKTHIS( EditEngine, 0 );
2055 pImpEditEngine->SetStyleSheetPool( pSPool );
2056 }
2057
GetStyleSheetPool()2058 SfxStyleSheetPool* EditEngine::GetStyleSheetPool()
2059 {
2060 DBG_CHKTHIS( EditEngine, 0 );
2061 return pImpEditEngine->GetStyleSheetPool();
2062 }
2063
SetWordDelimiters(const XubString & rDelimiters)2064 void EditEngine::SetWordDelimiters( const XubString& rDelimiters )
2065 {
2066 DBG_CHKTHIS( EditEngine, 0 );
2067 pImpEditEngine->aWordDelimiters = rDelimiters;
2068 if ( pImpEditEngine->aWordDelimiters.Search( CH_FEATURE ) == STRING_NOTFOUND )
2069 pImpEditEngine->aWordDelimiters.Insert( CH_FEATURE );
2070 }
2071
GetWordDelimiters() const2072 XubString EditEngine::GetWordDelimiters() const
2073 {
2074 DBG_CHKTHIS( EditEngine, 0 );
2075 return pImpEditEngine->aWordDelimiters;
2076 }
2077
SetGroupChars(const XubString & rChars)2078 void EditEngine::SetGroupChars( const XubString& rChars )
2079 {
2080 DBG_CHKTHIS( EditEngine, 0 );
2081 DBG_ASSERT( ( rChars.Len() % 2 ) == 0, "SetGroupChars: Ungerade Anzahl!" );
2082 pImpEditEngine->aGroupChars = rChars;
2083 }
2084
GetGroupChars() const2085 XubString EditEngine::GetGroupChars() const
2086 {
2087 DBG_CHKTHIS( EditEngine, 0 );
2088 return pImpEditEngine->aGroupChars;
2089 }
2090
EnablePasteSpecial(sal_Bool bEnable)2091 void EditEngine::EnablePasteSpecial( sal_Bool bEnable )
2092 {
2093 DBG_CHKTHIS( EditEngine, 0 );
2094 if ( bEnable )
2095 pImpEditEngine->GetStatus().TurnOnFlags( EE_CNTRL_PASTESPECIAL );
2096 else
2097 pImpEditEngine->GetStatus().TurnOffFlags( EE_CNTRL_PASTESPECIAL );
2098 }
2099
IsPasteSpecialEnabled() const2100 sal_Bool EditEngine::IsPasteSpecialEnabled() const
2101 {
2102 DBG_CHKTHIS( EditEngine, 0 );
2103 return pImpEditEngine->GetStatus().AllowPasteSpecial();
2104 }
2105
EnableIdleFormatter(sal_Bool bEnable)2106 void EditEngine::EnableIdleFormatter( sal_Bool bEnable )
2107 {
2108 DBG_CHKTHIS( EditEngine, 0 );
2109 if ( bEnable )
2110 pImpEditEngine->GetStatus().TurnOnFlags( EE_CNTRL_DOIDLEFORMAT );
2111 else
2112 pImpEditEngine->GetStatus().TurnOffFlags( EE_CNTRL_DOIDLEFORMAT);
2113 }
2114
IsIdleFormatterEnabled() const2115 sal_Bool EditEngine::IsIdleFormatterEnabled() const
2116 {
2117 DBG_CHKTHIS( EditEngine, 0 );
2118 return pImpEditEngine->GetStatus().UseIdleFormatter();
2119 }
2120
EraseVirtualDevice()2121 void EditEngine::EraseVirtualDevice()
2122 {
2123 DBG_CHKTHIS( EditEngine, 0 );
2124 pImpEditEngine->EraseVirtualDevice();
2125 }
2126
SetSpeller(Reference<XSpellChecker1> & xSpeller)2127 void EditEngine::SetSpeller( Reference< XSpellChecker1 > &xSpeller )
2128 {
2129 DBG_CHKTHIS( EditEngine, 0 );
2130 pImpEditEngine->SetSpeller( xSpeller );
2131 }
GetSpeller()2132 Reference< XSpellChecker1 > EditEngine::GetSpeller()
2133 {
2134 DBG_CHKTHIS( EditEngine, 0 );
2135 return pImpEditEngine->GetSpeller();
2136 }
GetHyphenator() const2137 Reference< XHyphenator > EditEngine::GetHyphenator() const
2138 {
2139 DBG_CHKTHIS( EditEngine, 0 );
2140 return pImpEditEngine->GetHyphenator();
2141 }
2142
SetHyphenator(Reference<XHyphenator> & xHyph)2143 void EditEngine::SetHyphenator( Reference< XHyphenator > & xHyph )
2144 {
2145 DBG_CHKTHIS( EditEngine, 0 );
2146 pImpEditEngine->SetHyphenator( xHyph );
2147 }
2148
SetForbiddenCharsTable(vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars)2149 void EditEngine::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars )
2150 {
2151 DBG_CHKTHIS( EditEngine, 0 );
2152 pImpEditEngine->SetForbiddenCharsTable( xForbiddenChars );
2153 }
2154
GetForbiddenCharsTable() const2155 vos::ORef<SvxForbiddenCharactersTable> EditEngine::GetForbiddenCharsTable() const
2156 {
2157 DBG_CHKTHIS( EditEngine, 0 );
2158 return pImpEditEngine->GetForbiddenCharsTable( sal_False );
2159 }
2160
2161
SetDefaultLanguage(LanguageType eLang)2162 void EditEngine::SetDefaultLanguage( LanguageType eLang )
2163 {
2164 DBG_CHKTHIS( EditEngine, 0 );
2165 pImpEditEngine->SetDefaultLanguage( eLang );
2166 }
2167
GetDefaultLanguage() const2168 LanguageType EditEngine::GetDefaultLanguage() const
2169 {
2170 DBG_CHKTHIS( EditEngine, 0 );
2171 return pImpEditEngine->GetDefaultLanguage();
2172 }
2173
SpellNextDocument()2174 sal_Bool __EXPORT EditEngine::SpellNextDocument()
2175 {
2176 DBG_CHKTHIS( EditEngine, 0 );
2177 return sal_False;
2178 }
2179
HasSpellErrors()2180 EESpellState EditEngine::HasSpellErrors()
2181 {
2182 DBG_CHKTHIS( EditEngine, 0 );
2183 if ( !pImpEditEngine->GetSpeller().is() )
2184 return EE_SPELL_NOSPELLER;
2185
2186 return pImpEditEngine->HasSpellErrors();
2187 }
2188 /*-- 13.10.2003 16:56:23---------------------------------------------------
2189
2190 -----------------------------------------------------------------------*/
StartSpelling(EditView & rEditView,sal_Bool bMultipleDoc)2191 void EditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
2192 {
2193 DBG_CHKTHIS( EditEngine, 0 );
2194 pImpEditEngine->StartSpelling(rEditView, bMultipleDoc);
2195 }
2196 /*-- 13.10.2003 16:56:23---------------------------------------------------
2197
2198 -----------------------------------------------------------------------*/
EndSpelling()2199 void EditEngine::EndSpelling()
2200 {
2201 DBG_CHKTHIS( EditEngine, 0 );
2202 pImpEditEngine->EndSpelling();
2203 }
2204
2205 /*-- 13.10.2003 16:43:27---------------------------------------------------
2206
2207 -----------------------------------------------------------------------*/
SpellSentence(EditView & rView,::svx::SpellPortions & rToFill,bool bIsGrammarChecking)2208 bool EditEngine::SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking )
2209 {
2210 DBG_CHKTHIS( EditEngine, 0 );
2211 return pImpEditEngine->SpellSentence( rView, rToFill, bIsGrammarChecking );
2212 }
2213 /*-- 08.09.2008 11:38:32---------------------------------------------------
2214
2215 -----------------------------------------------------------------------*/
PutSpellingToSentenceStart(EditView & rEditView)2216 void EditEngine::PutSpellingToSentenceStart( EditView& rEditView )
2217 {
2218 DBG_CHKTHIS( EditEngine, 0 );
2219 pImpEditEngine->PutSpellingToSentenceStart( rEditView );
2220 }
2221 /*-- 13.10.2003 16:43:27---------------------------------------------------
2222
2223 -----------------------------------------------------------------------*/
ApplyChangedSentence(EditView & rEditView,const::svx::SpellPortions & rNewPortions,bool bRecheck)2224 void EditEngine::ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck )
2225 {
2226 DBG_CHKTHIS( EditEngine, 0 );
2227 pImpEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck );
2228 }
2229
HasConvertibleTextPortion(LanguageType nLang)2230 sal_Bool EditEngine::HasConvertibleTextPortion( LanguageType nLang )
2231 {
2232 DBG_CHKTHIS( EditEngine, 0 );
2233 return pImpEditEngine->HasConvertibleTextPortion( nLang );
2234 }
2235
ConvertNextDocument()2236 sal_Bool __EXPORT EditEngine::ConvertNextDocument()
2237 {
2238 DBG_CHKTHIS( EditEngine, 0 );
2239 return sal_False;
2240 }
2241
HasText(const SvxSearchItem & rSearchItem)2242 sal_Bool EditEngine::HasText( const SvxSearchItem& rSearchItem )
2243 {
2244 DBG_CHKTHIS( EditEngine, 0 );
2245 return pImpEditEngine->HasText( rSearchItem );
2246 }
2247
SetGlobalCharStretching(sal_uInt16 nX,sal_uInt16 nY)2248 void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
2249 {
2250 DBG_CHKTHIS( EditEngine, 0 );
2251 pImpEditEngine->SetCharStretching( nX, nY );
2252 }
2253
GetGlobalCharStretching(sal_uInt16 & rX,sal_uInt16 & rY)2254 void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY )
2255 {
2256 DBG_CHKTHIS( EditEngine, 0 );
2257 pImpEditEngine->GetCharStretching( rX, rY );
2258 }
2259
DoStretchChars(sal_uInt16 nX,sal_uInt16 nY)2260 void EditEngine::DoStretchChars( sal_uInt16 nX, sal_uInt16 nY )
2261 {
2262 DBG_CHKTHIS( EditEngine, 0 );
2263 pImpEditEngine->DoStretchChars( nX, nY );
2264 }
2265
SetBigTextObjectStart(sal_uInt16 nStartAtPortionCount)2266 void EditEngine::SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount )
2267 {
2268 DBG_CHKTHIS( EditEngine, 0 );
2269 pImpEditEngine->SetBigTextObjectStart( nStartAtPortionCount );
2270 }
2271
GetBigTextObjectStart() const2272 sal_uInt16 EditEngine::GetBigTextObjectStart() const
2273 {
2274 DBG_CHKTHIS( EditEngine, 0 );
2275 return pImpEditEngine->GetBigTextObjectStart();
2276 }
2277
ShouldCreateBigTextObject() const2278 sal_Bool EditEngine::ShouldCreateBigTextObject() const
2279 {
2280 DBG_CHKTHIS( EditEngine, 0 );
2281 sal_uInt16 nTextPortions = 0;
2282 sal_uInt32 nParas = pImpEditEngine->GetEditDoc().Count();
2283 for ( sal_uInt32 nPara = 0; nPara < nParas; nPara++ )
2284 {
2285 ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
2286 nTextPortions = nTextPortions + pParaPortion->GetTextPortions().Count();
2287 }
2288 return ( nTextPortions >= pImpEditEngine->GetBigTextObjectStart() ) ? sal_True : sal_False;
2289 }
2290
GetFieldCount(sal_uInt32 nPara) const2291 sal_uInt16 EditEngine::GetFieldCount( sal_uInt32 nPara ) const
2292 {
2293 sal_uInt16 nFields = 0;
2294 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
2295 if ( pNode )
2296 {
2297 const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
2298 for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ )
2299 {
2300 EditCharAttrib* pAttr = rAttrs[nAttr];
2301 if ( pAttr->Which() == EE_FEATURE_FIELD )
2302 nFields++;
2303 }
2304 }
2305
2306 return nFields;
2307 }
2308
GetFieldInfo(sal_uInt32 nPara,sal_uInt16 nField) const2309 EFieldInfo EditEngine::GetFieldInfo( sal_uInt32 nPara, sal_uInt16 nField ) const
2310 {
2311 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( nPara );
2312 if ( pNode )
2313 {
2314 sal_uInt16 nCurrentField = 0;
2315 const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
2316 for ( sal_uInt16 nAttr = 0; nAttr < rAttrs.Count(); nAttr++ )
2317 {
2318 EditCharAttrib* pAttr = rAttrs[nAttr];
2319 if ( pAttr->Which() == EE_FEATURE_FIELD )
2320 {
2321 if ( nCurrentField == nField )
2322 {
2323 EFieldInfo aInfo( *(const SvxFieldItem*)pAttr->GetItem(), nPara, pAttr->GetStart() );
2324 aInfo.aCurrentText = ((EditCharAttribField*)pAttr)->GetFieldValue();
2325 return aInfo;
2326 }
2327
2328 nCurrentField++;
2329 }
2330 }
2331 }
2332 return EFieldInfo();
2333 }
2334
2335
UpdateFields()2336 sal_Bool EditEngine::UpdateFields()
2337 {
2338 DBG_CHKTHIS( EditEngine, 0 );
2339 sal_Bool bChanges = pImpEditEngine->UpdateFields();
2340 if ( bChanges )
2341 pImpEditEngine->FormatAndUpdate();
2342 return bChanges;
2343 }
2344
RemoveFields(sal_Bool bKeepFieldText,TypeId aType)2345 void EditEngine::RemoveFields( sal_Bool bKeepFieldText, TypeId aType )
2346 {
2347 DBG_CHKTHIS( EditEngine, 0 );
2348
2349 if ( bKeepFieldText )
2350 pImpEditEngine->UpdateFields();
2351
2352 sal_uInt32 nParas = pImpEditEngine->GetEditDoc().Count();
2353 for ( sal_uInt32 nPara = 0; nPara < nParas; nPara++ )
2354 {
2355 ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
2356 const CharAttribArray& rAttrs = pNode->GetCharAttribs().GetAttribs();
2357 for ( sal_uInt16 nAttr = rAttrs.Count(); nAttr; )
2358 {
2359 const EditCharAttrib* pAttr = rAttrs[--nAttr];
2360 if ( pAttr->Which() == EE_FEATURE_FIELD )
2361 {
2362 const SvxFieldData* pFldData = ((const SvxFieldItem*)pAttr->GetItem())->GetField();
2363 if ( pFldData && ( !aType || ( pFldData->IsA( aType ) ) ) )
2364 {
2365 DBG_ASSERT( pAttr->GetItem()->ISA( SvxFieldItem ), "Kein FeldItem..." );
2366 EditSelection aSel( EditPaM( pNode, pAttr->GetStart() ), EditPaM( pNode, pAttr->GetEnd() ) );
2367 String aFieldText = ((EditCharAttribField*)pAttr)->GetFieldValue();
2368 pImpEditEngine->ImpInsertText( aSel, aFieldText );
2369 }
2370 }
2371 }
2372 }
2373 }
2374
HasOnlineSpellErrors() const2375 sal_Bool EditEngine::HasOnlineSpellErrors() const
2376 {
2377 DBG_CHKTHIS( EditEngine, 0 );
2378 sal_uInt32 nNodes = pImpEditEngine->GetEditDoc().Count();
2379 for ( sal_uInt32 n = 0; n < nNodes; n++ )
2380 {
2381 ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
2382 if ( pNode->GetWrongList() && pNode->GetWrongList()->Count() )
2383 return sal_True;
2384 }
2385 return sal_False;
2386 }
2387
CompleteOnlineSpelling()2388 void EditEngine::CompleteOnlineSpelling()
2389 {
2390 DBG_CHKTHIS( EditEngine, 0 );
2391 if ( pImpEditEngine->GetStatus().DoOnlineSpelling() )
2392 {
2393 if( !pImpEditEngine->IsFormatted() )
2394 pImpEditEngine->FormatAndUpdate();
2395
2396 pImpEditEngine->StopOnlineSpellTimer();
2397 pImpEditEngine->DoOnlineSpelling( 0, sal_True, sal_False );
2398 }
2399 }
2400
FindParagraph(long nDocPosY)2401 sal_uInt32 EditEngine::FindParagraph( long nDocPosY )
2402 {
2403 return pImpEditEngine->GetParaPortions().FindParagraph( nDocPosY );
2404 }
2405
FindDocPosition(const Point & rDocPos) const2406 EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const
2407 {
2408 EPosition aPos;
2409 // From the point of the API, this is const....
2410 EditPaM aPaM = ((EditEngine*)this)->pImpEditEngine->GetPaM( rDocPos, sal_False );
2411 if ( aPaM.GetNode() )
2412 {
2413 aPos.nPara = pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
2414 aPos.nIndex = aPaM.GetIndex();
2415 }
2416 return aPos;
2417 }
2418
GetCharacterBounds(const EPosition & rPos) const2419 Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const
2420 {
2421 Rectangle aBounds;
2422 ContentNode* pNode = pImpEditEngine->GetEditDoc().SaveGetObject( rPos.nPara );
2423
2424 // #109151# Check against index, not paragraph
2425 if ( pNode && ( rPos.nIndex < pNode->Len() ) )
2426 {
2427 aBounds = pImpEditEngine->PaMtoEditCursor( EditPaM( pNode, rPos.nIndex ), GETCRSR_TXTONLY );
2428 Rectangle aR2 = pImpEditEngine->PaMtoEditCursor( EditPaM( pNode, rPos.nIndex+1 ), GETCRSR_TXTONLY|GETCRSR_ENDOFLINE );
2429 if ( aR2.Right() > aBounds.Right() )
2430 aBounds.Right() = aR2.Right();
2431 }
2432 return aBounds;
2433 }
2434
GetParagraphInfos(sal_uInt32 nPara)2435 ParagraphInfos EditEngine::GetParagraphInfos( sal_uInt32 nPara )
2436 {
2437 DBG_CHKTHIS( EditEngine, 0 );
2438
2439 // Funktioniert nur, wenn nicht bereits in der Formatierung...
2440 if ( !pImpEditEngine->IsFormatted() )
2441 pImpEditEngine->FormatDoc();
2442
2443 ParagraphInfos aInfos;
2444 aInfos.bValid = pImpEditEngine->IsFormatted();
2445 if ( pImpEditEngine->IsFormatted() )
2446 {
2447 ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions()[nPara];
2448 EditLine* pLine = (pParaPortion && pParaPortion->GetLines().Count()) ?
2449 pParaPortion->GetLines().GetObject( 0 ) : NULL;
2450 DBG_ASSERT( pParaPortion && pLine, "GetParagraphInfos - Paragraph out of range" );
2451 if ( pParaPortion && pLine )
2452 {
2453 aInfos.nParaHeight = (sal_uInt16)pParaPortion->GetHeight();
2454 aInfos.nLines = pParaPortion->GetLines().Count();
2455 aInfos.nFirstLineStartX = pLine->GetStartPosX();
2456 aInfos.nFirstLineOffset = pParaPortion->GetFirstLineOffset();
2457 aInfos.nFirstLineHeight = pLine->GetHeight();
2458 aInfos.nFirstLineTextHeight = pLine->GetTxtHeight();
2459 aInfos.nFirstLineMaxAscent = pLine->GetMaxAscent();
2460 }
2461 }
2462 return aInfos;
2463 }
2464
2465 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
CreateTransferable(const ESelection & rSelection) const2466 EditEngine::CreateTransferable( const ESelection& rSelection ) const
2467 {
2468 DBG_CHKTHIS( EditEngine, 0 );
2469 EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) );
2470 return pImpEditEngine->CreateTransferable( aSel );
2471 }
2472
2473 // =====================================================================
2474 // ====================== Virtuelle Methoden =======================
2475 // =====================================================================
DrawingText(const Point &,const XubString &,sal_uInt16,sal_uInt16,const sal_Int32 *,const SvxFont &,sal_uInt32,sal_uInt16,sal_uInt8,const EEngineData::WrongSpellVector *,const SvxFieldData *,bool,bool,bool,const::com::sun::star::lang::Locale *,const Color &,const Color &)2476 void __EXPORT EditEngine::DrawingText( const Point&, const XubString&, sal_uInt16, sal_uInt16,
2477 const sal_Int32*, const SvxFont&, sal_uInt32, sal_uInt16, sal_uInt8,
2478 const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool, bool,
2479 const ::com::sun::star::lang::Locale*, const Color&, const Color&)
2480
2481 {
2482 DBG_CHKTHIS( EditEngine, 0 );
2483 }
2484
PaintingFirstLine(sal_uInt32,const Point &,long,const Point &,short,OutputDevice *)2485 void __EXPORT EditEngine::PaintingFirstLine( sal_uInt32, const Point&, long, const Point&, short, OutputDevice* )
2486 {
2487 DBG_CHKTHIS( EditEngine, 0 );
2488 }
2489
ParagraphInserted(sal_uInt32 nPara)2490 void __EXPORT EditEngine::ParagraphInserted( sal_uInt32 nPara )
2491 {
2492 DBG_CHKTHIS( EditEngine, 0 );
2493
2494 if ( GetNotifyHdl().IsSet() )
2495 {
2496 EENotify aNotify( EE_NOTIFY_PARAGRAPHINSERTED );
2497 aNotify.pEditEngine = this;
2498 aNotify.nParagraph = nPara;
2499 pImpEditEngine->CallNotify( aNotify );
2500 }
2501 }
2502
ParagraphDeleted(sal_uInt32 nPara)2503 void __EXPORT EditEngine::ParagraphDeleted( sal_uInt32 nPara )
2504 {
2505 DBG_CHKTHIS( EditEngine, 0 );
2506
2507 if ( GetNotifyHdl().IsSet() )
2508 {
2509 EENotify aNotify( EE_NOTIFY_PARAGRAPHREMOVED );
2510 aNotify.pEditEngine = this;
2511 aNotify.nParagraph = nPara;
2512 pImpEditEngine->CallNotify( aNotify );
2513 }
2514 }
ParagraphConnected(sal_uInt32,sal_uInt32)2515 void EditEngine::ParagraphConnected( sal_uInt32 /*nLeftParagraph*/, sal_uInt32 /*nRightParagraph*/ )
2516 {
2517 DBG_CHKTHIS( EditEngine, 0 );
2518 }
2519
FormattingParagraph(sal_uInt32)2520 sal_Bool __EXPORT EditEngine::FormattingParagraph( sal_uInt32 )
2521 {
2522 // return sal_True, wenn die Attribute geaendert wurden...
2523 DBG_CHKTHIS( EditEngine, 0 );
2524 return sal_False;
2525 }
2526
ParaAttribsChanged(sal_uInt32)2527 void __EXPORT EditEngine::ParaAttribsChanged( sal_uInt32 /* nParagraph */ )
2528 {
2529 DBG_CHKTHIS( EditEngine, 0 );
2530 }
2531
StyleSheetChanged(SfxStyleSheet *)2532 void __EXPORT EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ )
2533 {
2534 DBG_CHKTHIS( EditEngine, 0 );
2535 }
2536
ParagraphHeightChanged(sal_uInt32 nPara)2537 void __EXPORT EditEngine::ParagraphHeightChanged( sal_uInt32 nPara )
2538 {
2539 DBG_CHKTHIS( EditEngine, 0 );
2540
2541 if ( GetNotifyHdl().IsSet() )
2542 {
2543 EENotify aNotify( EE_NOTIFY_TEXTHEIGHTCHANGED );
2544 aNotify.pEditEngine = this;
2545 aNotify.nParagraph = nPara;
2546 pImpEditEngine->CallNotify( aNotify );
2547 }
2548 }
2549
GetUndoComment(sal_uInt16 nId) const2550 XubString __EXPORT EditEngine::GetUndoComment( sal_uInt16 nId ) const
2551 {
2552 DBG_CHKTHIS( EditEngine, 0 );
2553 XubString aComment;
2554 switch ( nId )
2555 {
2556 case EDITUNDO_REMOVECHARS:
2557 case EDITUNDO_CONNECTPARAS:
2558 case EDITUNDO_REMOVEFEATURE:
2559 case EDITUNDO_DELCONTENT:
2560 case EDITUNDO_DELETE:
2561 case EDITUNDO_CUT:
2562 aComment = XubString( EditResId( RID_EDITUNDO_DEL ) );
2563 break;
2564 case EDITUNDO_MOVEPARAGRAPHS:
2565 case EDITUNDO_MOVEPARAS:
2566 case EDITUNDO_DRAGANDDROP:
2567 aComment = XubString( EditResId( RID_EDITUNDO_MOVE ) );
2568 break;
2569 case EDITUNDO_INSERTFEATURE:
2570 case EDITUNDO_SPLITPARA:
2571 case EDITUNDO_INSERTCHARS:
2572 case EDITUNDO_PASTE:
2573 case EDITUNDO_INSERT:
2574 case EDITUNDO_READ:
2575 aComment = XubString( EditResId( RID_EDITUNDO_INSERT ) );
2576 break;
2577 case EDITUNDO_SRCHANDREPL:
2578 case EDITUNDO_REPLACEALL:
2579 aComment = XubString( EditResId( RID_EDITUNDO_REPLACE ) );
2580 break;
2581 case EDITUNDO_ATTRIBS:
2582 case EDITUNDO_PARAATTRIBS:
2583 case EDITUNDO_STRETCH:
2584 aComment = XubString( EditResId( RID_EDITUNDO_SETATTRIBS ) );
2585 break;
2586 case EDITUNDO_RESETATTRIBS:
2587 aComment = XubString( EditResId( RID_EDITUNDO_RESETATTRIBS ) );
2588 break;
2589 case EDITUNDO_STYLESHEET:
2590 aComment = XubString( EditResId( RID_EDITUNDO_SETSTYLE ) );
2591 break;
2592 case EDITUNDO_TRANSLITERATE:
2593 aComment = XubString( EditResId( RID_EDITUNDO_TRANSLITERATE ) );
2594 break;
2595 case EDITUNDO_INDENTBLOCK:
2596 case EDITUNDO_UNINDENTBLOCK:
2597 aComment = XubString( EditResId( RID_EDITUNDO_INDENT ) );
2598 break;
2599 }
2600 return aComment;
2601 }
2602
GetBulletArea(sal_uInt32)2603 Rectangle EditEngine::GetBulletArea( sal_uInt32 )
2604 {
2605 return Rectangle( Point(), Point() );
2606 }
2607
CalcFieldValue(const SvxFieldItem &,sal_uInt32,sal_uInt16,Color * &,Color * &)2608 XubString __EXPORT EditEngine::CalcFieldValue( const SvxFieldItem&, sal_uInt32, sal_uInt16, Color*&, Color*& )
2609 {
2610 DBG_CHKTHIS( EditEngine, 0 );
2611 return ' ';
2612 }
2613
FieldClicked(const SvxFieldItem &,sal_uInt32,sal_uInt16)2614 void __EXPORT EditEngine::FieldClicked( const SvxFieldItem&, sal_uInt32, sal_uInt16 )
2615 {
2616 DBG_CHKTHIS( EditEngine, 0 );
2617 }
2618
FieldSelected(const SvxFieldItem &,sal_uInt32,sal_uInt16)2619 void __EXPORT EditEngine::FieldSelected( const SvxFieldItem&, sal_uInt32, sal_uInt16 )
2620 {
2621 DBG_CHKTHIS( EditEngine, 0 );
2622 }
2623
2624 // =====================================================================
2625 // ====================== Statische Methoden =======================
2626 // =====================================================================
CreatePool(sal_Bool bPersistentRefCounts)2627 SfxItemPool* EditEngine::CreatePool( sal_Bool bPersistentRefCounts )
2628 {
2629 SfxItemPool* pPool = new EditEngineItemPool( bPersistentRefCounts );
2630 return pPool;
2631 }
2632
GetGlobalItemPool()2633 SfxItemPool& EditEngine::GetGlobalItemPool()
2634 {
2635 if ( !pGlobalPool )
2636 pGlobalPool = CreatePool();
2637 return *pGlobalPool;
2638 }
2639
RegisterClipboardFormatName()2640 sal_uInt32 EditEngine::RegisterClipboardFormatName()
2641 {
2642 static sal_uInt32 nFormat = 0;
2643 if ( !nFormat )
2644 nFormat = SotExchange::RegisterFormatName( String( RTL_CONSTASCII_USTRINGPARAM( "EditEngineFormat" ) ) );
2645 return nFormat;
2646 }
2647
GetAvailableSearchOptions()2648 sal_uInt16 EditEngine::GetAvailableSearchOptions()
2649 {
2650 return SEARCH_OPTIONS_SEARCH | SEARCH_OPTIONS_REPLACE |
2651 SEARCH_OPTIONS_REPLACE_ALL | SEARCH_OPTIONS_WHOLE_WORDS |
2652 SEARCH_OPTIONS_BACKWARDS | SEARCH_OPTIONS_REG_EXP |
2653 SEARCH_OPTIONS_EXACT | SEARCH_OPTIONS_SELECTION;
2654 }
2655
SetFontInfoInItemSet(SfxItemSet & rSet,const Font & rFont)2656 void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const Font& rFont )
2657 {
2658 SvxFont aSvxFont( rFont );
2659 SetFontInfoInItemSet( rSet, aSvxFont );
2660
2661 }
2662
SetFontInfoInItemSet(SfxItemSet & rSet,const SvxFont & rFont)2663 void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const SvxFont& rFont )
2664 {
2665 rSet.Put( SvxLanguageItem( rFont.GetLanguage(), EE_CHAR_LANGUAGE ) );
2666 rSet.Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(), XubString(), rFont.GetPitch(), rFont.GetCharSet(), EE_CHAR_FONTINFO ) );
2667 rSet.Put( SvxFontHeightItem( rFont.GetSize().Height(), 100, EE_CHAR_FONTHEIGHT ) );
2668 rSet.Put( SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ) );
2669 rSet.Put( SvxShadowedItem( rFont.IsShadow(), EE_CHAR_SHADOW ) );
2670 rSet.Put( SvxEscapementItem( rFont.GetEscapement(), rFont.GetPropr(), EE_CHAR_ESCAPEMENT ) );
2671 rSet.Put( SvxWeightItem( rFont.GetWeight(), EE_CHAR_WEIGHT ) );
2672 rSet.Put( SvxColorItem( rFont.GetColor(), EE_CHAR_COLOR ) );
2673 rSet.Put( SvxUnderlineItem( rFont.GetUnderline(), EE_CHAR_UNDERLINE ) );
2674 rSet.Put( SvxOverlineItem( rFont.GetOverline(), EE_CHAR_OVERLINE ) );
2675 rSet.Put( SvxCrossedOutItem( rFont.GetStrikeout(), EE_CHAR_STRIKEOUT ) );
2676 rSet.Put( SvxPostureItem( rFont.GetItalic(), EE_CHAR_ITALIC ) );
2677 rSet.Put( SvxContourItem( rFont.IsOutline(), EE_CHAR_OUTLINE ) );
2678 rSet.Put( SvxAutoKernItem( rFont.IsKerning(), EE_CHAR_PAIRKERNING ) );
2679 rSet.Put( SvxKerningItem( rFont.GetFixKerning(), EE_CHAR_KERNING ) );
2680 rSet.Put( SvxWordLineModeItem( rFont.IsWordLineMode(), EE_CHAR_WLM ) );
2681 rSet.Put( SvxEmphasisMarkItem( rFont.GetEmphasisMark(), EE_CHAR_EMPHASISMARK ) );
2682 rSet.Put( SvxCharReliefItem( rFont.GetRelief(), EE_CHAR_RELIEF ) );
2683 }
2684
CreateFontFromItemSet(const SfxItemSet & rItemSet,sal_uInt16 nScriptType)2685 Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType )
2686 {
2687 SvxFont aFont;
2688 CreateFont( aFont, rItemSet, true, nScriptType );
2689 return aFont;
2690 }
2691
2692 // Maybe we can remove the next two methods, check after 6.x
CreateFontFromItemSet(const SfxItemSet & rItemSet)2693 Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet )
2694 {
2695 return CreateSvxFontFromItemSet( rItemSet );
2696 }
2697
CreateSvxFontFromItemSet(const SfxItemSet & rItemSet)2698 SvxFont EditEngine::CreateSvxFontFromItemSet( const SfxItemSet& rItemSet )
2699 {
2700 SvxFont aFont;
2701 CreateFont( aFont, rItemSet );
2702 return aFont;
2703 }
2704
DoesKeyMoveCursor(const KeyEvent & rKeyEvent)2705 sal_Bool EditEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent )
2706 {
2707 sal_Bool bDoesMove = sal_False;
2708
2709 switch ( rKeyEvent.GetKeyCode().GetCode() )
2710 {
2711 case KEY_UP:
2712 case KEY_DOWN:
2713 case KEY_LEFT:
2714 case KEY_RIGHT:
2715 case KEY_HOME:
2716 case KEY_END:
2717 case KEY_PAGEUP:
2718 case KEY_PAGEDOWN:
2719 {
2720 if ( !rKeyEvent.GetKeyCode().IsMod2() )
2721 bDoesMove = sal_True;
2722 }
2723 break;
2724 }
2725 return bDoesMove;
2726 }
2727
DoesKeyChangeText(const KeyEvent & rKeyEvent)2728 sal_Bool EditEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent )
2729 {
2730 sal_Bool bDoesChange = sal_False;
2731
2732 KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
2733 if ( eFunc != KEYFUNC_DONTKNOW )
2734 {
2735 switch ( eFunc )
2736 {
2737 case KEYFUNC_UNDO:
2738 case KEYFUNC_REDO:
2739 case KEYFUNC_CUT:
2740 case KEYFUNC_PASTE: bDoesChange = sal_True;
2741 break;
2742 default: // wird dann evtl. unten bearbeitet.
2743 eFunc = KEYFUNC_DONTKNOW;
2744 }
2745 }
2746 if ( eFunc == KEYFUNC_DONTKNOW )
2747 {
2748 switch ( rKeyEvent.GetKeyCode().GetCode() )
2749 {
2750 case KEY_DELETE:
2751 case KEY_BACKSPACE: bDoesChange = sal_True;
2752 break;
2753 case KEY_RETURN:
2754 case KEY_TAB:
2755 {
2756 if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
2757 bDoesChange = sal_True;
2758 }
2759 break;
2760 default:
2761 {
2762 bDoesChange = IsSimpleCharInput( rKeyEvent );
2763 }
2764 }
2765 }
2766 return bDoesChange;
2767 }
2768
IsSimpleCharInput(const KeyEvent & rKeyEvent)2769 sal_Bool EditEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent )
2770 {
2771 if( EditEngine::IsPrintable( rKeyEvent.GetCharCode() ) &&
2772 ( KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ) &&
2773 ( KEY_MOD1 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) ) )
2774 {
2775 return sal_True;
2776 }
2777 return sal_False;
2778 }
2779
2780 // Mal in den Outliner schieben...
ImportBulletItem(SvxNumBulletItem &,sal_uInt16,const SvxBulletItem *,const SvxLRSpaceItem *)2781 void EditEngine::ImportBulletItem( SvxNumBulletItem& /*rNumBullet*/, sal_uInt16 /*nLevel*/,
2782 const SvxBulletItem* /*pOldBullet*/, const SvxLRSpaceItem* /*pOldLRSpace*/ )
2783 {
2784 /* TL_NFLR
2785 if ( pOldBullet || pOldLRSpace )
2786 {
2787 // Numberformat dynamisch, weil Zuweisungsoperator nicht implementiert.
2788
2789 // Altes NumBulletItem nur uebernehmen, wenn kein altes BulletItem
2790 const SvxNumberFormat* pFmt = ( !pOldBullet && ( rNumBullet.GetNumRule()->GetLevelCount() > nLevel ) ) ?
2791 rNumBullet.GetNumRule()->Get( nLevel ) : NULL;
2792 SvxNumberFormat* pNumberFormat = pFmt
2793 ? new SvxNumberFormat( *pFmt )
2794 : new SvxNumberFormat( SVX_NUM_NUMBER_NONE );
2795 if ( pOldBullet )
2796 {
2797 // Style
2798 SvxExtNumType eNumType;
2799 switch( pOldBullet->GetStyle() )
2800 {
2801 case BS_BMP: eNumType = SVX_NUM_BITMAP; break;
2802 case BS_BULLET: eNumType = SVX_NUM_CHAR_SPECIAL; break;
2803 case BS_ROMAN_BIG: eNumType = SVX_NUM_ROMAN_UPPER; break;
2804 case BS_ROMAN_SMALL: eNumType = SVX_NUM_ROMAN_LOWER; break;
2805 case BS_ABC_BIG: eNumType = SVX_NUM_CHARS_UPPER_LETTER; break;
2806 case BS_ABC_SMALL: eNumType = SVX_NUM_CHARS_LOWER_LETTER; break;
2807 case BS_123: eNumType = SVX_NUM_ARABIC; break;
2808 default: eNumType = SVX_NUM_NUMBER_NONE; break;
2809 }
2810 pNumberFormat->SetNumberingType(
2811 sal::static_int_cast< sal_Int16 >( eNumType ) );
2812
2813 // Justification
2814 SvxAdjust eAdjust;
2815 switch( pOldBullet->GetJustification() & (BJ_HRIGHT|BJ_HCENTER|BJ_HLEFT) )
2816 {
2817 case BJ_HRIGHT: eAdjust = SVX_ADJUST_RIGHT; break;
2818 case BJ_HCENTER: eAdjust = SVX_ADJUST_CENTER; break;
2819 default: eAdjust = SVX_ADJUST_LEFT; break;
2820 }
2821 pNumberFormat->SetNumAdjust(eAdjust);
2822
2823 // Prefix/Suffix
2824 pNumberFormat->SetPrefix( pOldBullet->GetPrevText() );
2825 pNumberFormat->SetSuffix( pOldBullet->GetFollowText() );
2826
2827 //Font
2828 if ( eNumType != SVX_NUM_BITMAP )
2829 {
2830 Font aTmpFont = pOldBullet->GetFont();
2831 pNumberFormat->SetBulletFont( &aTmpFont );
2832 }
2833
2834 // Color
2835 pNumberFormat->SetBulletColor( pOldBullet->GetFont().GetColor() );
2836
2837 // Start
2838 pNumberFormat->SetStart( pOldBullet->GetStart() );
2839
2840 // Scale
2841 pNumberFormat->SetBulletRelSize( pOldBullet->GetScale() );
2842
2843 // Bullet/Bitmap
2844 if( eNumType == SVX_NUM_CHAR_SPECIAL )
2845 {
2846 pNumberFormat->SetBulletChar( pOldBullet->GetSymbol() );
2847 }
2848 else if( eNumType == SVX_NUM_BITMAP )
2849 {
2850 SvxBrushItem aBItem( Graphic( pOldBullet->GetBitmap() ), GPOS_NONE, SID_ATTR_BRUSH );
2851 pNumberFormat->SetGraphicBrush( &aBItem );
2852 }
2853 }
2854
2855 // Einzug und Erstzeileneinzug
2856 //TL_NFLR if ( pOldLRSpace )
2857 //TL_NFLR {
2858 //TL_NFLR short nLSpace = (short)pOldLRSpace->GetTxtLeft();
2859 //TL_NFLR pNumberFormat->SetLSpace( nLSpace );
2860 //TL_NFLR pNumberFormat->SetAbsLSpace( nLSpace );
2861 //TL_NFLR pNumberFormat->SetFirstLineOffset( pOldLRSpace->GetTxtFirstLineOfst() );
2862 //TL_NFLR }
2863
2864 rNumBullet.GetNumRule()->SetLevel( nLevel, *pNumberFormat );
2865 delete pNumberFormat;
2866 }
2867 */
2868 }
2869
HasValidData(const::com::sun::star::uno::Reference<::com::sun::star::datatransfer::XTransferable> & rTransferable)2870 sal_Bool EditEngine::HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable )
2871 {
2872 sal_Bool bValidData = sal_False;
2873
2874 if ( rTransferable.is() )
2875 {
2876 // Every application that copies rtf or any other text format also copies plain text into the clipboard....
2877 datatransfer::DataFlavor aFlavor;
2878 SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
2879 bValidData = rTransferable->isDataFlavorSupported( aFlavor );
2880 }
2881
2882 return bValidData;
2883 }
2884
2885 /** sets a link that is called at the beginning of a drag operation at an edit view */
SetBeginDropHdl(const Link & rLink)2886 void EditEngine::SetBeginDropHdl( const Link& rLink )
2887 {
2888 pImpEditEngine->SetBeginDropHdl( rLink );
2889 }
2890
GetBeginDropHdl() const2891 Link EditEngine::GetBeginDropHdl() const
2892 {
2893 return pImpEditEngine->GetBeginDropHdl();
2894 }
2895
2896 /** sets a link that is called at the end of a drag operation at an edit view */
SetEndDropHdl(const Link & rLink)2897 void EditEngine::SetEndDropHdl( const Link& rLink )
2898 {
2899 pImpEditEngine->SetEndDropHdl( rLink );
2900 }
2901
GetEndDropHdl() const2902 Link EditEngine::GetEndDropHdl() const
2903 {
2904 return pImpEditEngine->GetEndDropHdl();
2905 }
2906
SetFirstWordCapitalization(sal_Bool bCapitalize)2907 void EditEngine::SetFirstWordCapitalization( sal_Bool bCapitalize )
2908 {
2909 pImpEditEngine->SetFirstWordCapitalization( bCapitalize );
2910 }
2911
IsFirstWordCapitalization() const2912 sal_Bool EditEngine::IsFirstWordCapitalization() const
2913 {
2914 return pImpEditEngine->IsFirstWordCapitalization();
2915 }
2916
2917
2918 // ---------------------------------------------------
2919
2920
EFieldInfo()2921 EFieldInfo::EFieldInfo()
2922 {
2923 pFieldItem = NULL;
2924 }
2925
2926
EFieldInfo(const SvxFieldItem & rFieldItem,sal_uInt32 nPara,sal_uInt16 nPos)2927 EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt32 nPara, sal_uInt16 nPos ) : aPosition( nPara, nPos )
2928 {
2929 pFieldItem = new SvxFieldItem( rFieldItem );
2930 }
2931
~EFieldInfo()2932 EFieldInfo::~EFieldInfo()
2933 {
2934 delete pFieldItem;
2935 }
2936
EFieldInfo(const EFieldInfo & rFldInfo)2937 EFieldInfo::EFieldInfo( const EFieldInfo& rFldInfo )
2938 {
2939 *this = rFldInfo;
2940 }
2941
operator =(const EFieldInfo & rFldInfo)2942 EFieldInfo& EFieldInfo::operator= ( const EFieldInfo& rFldInfo )
2943 {
2944 if( this == &rFldInfo )
2945 return *this;
2946
2947 pFieldItem = rFldInfo.pFieldItem ? new SvxFieldItem( *rFldInfo.pFieldItem ) : 0;
2948 aCurrentText = rFldInfo.aCurrentText;
2949 aPosition = rFldInfo.aPosition;
2950
2951 return *this;
2952 }
2953