1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: editeng.cxx,v $
10 * $Revision: 1.117.12.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <eeng_pch.hxx>
35 // #define _SOLAR__PRIVATE 1
38 #define _SVSTDARR_USHORTS
39 #include <svtools/svstdarr.hxx>
40 #include <svtools/ctloptions.hxx>
41 #include <svtools/ctrltool.hxx>
43 #include <svx/svxfont.hxx>
44 #include <impedit.hxx>
45 #include <svx/editeng.hxx>
46 #include <svx/editview.hxx>
47 #include <editstat.hxx>
48 #include <editdbg.hxx>
49 #include <eerdll2.hxx>
51 #include <editeng.hrc>
52 #include <svx/flditem.hxx>
53 #include <txtrange.hxx>
54 #include <vcl/graph.hxx>
56 #include <svx/akrnitem.hxx>
57 #include <svx/cntritem.hxx>
58 #include <svx/colritem.hxx>
59 #include <svx/crsditem.hxx>
60 #include <svx/escpitem.hxx>
61 #include <svx/fhgtitem.hxx>
62 #include "fontitem.hxx"
63 #include <svx/kernitem.hxx>
64 #include <svx/lrspitem.hxx>
65 #include <svx/postitem.hxx>
66 #include <svx/shdditem.hxx>
67 #include <svx/udlnitem.hxx>
68 #include <svx/wghtitem.hxx>
69 #include <svx/wrlmitem.hxx>
70 #include <svx/brshitem.hxx>
71 #include <svx/cscoitem.hxx>
72 #include <svx/langitem.hxx>
73 #include <svx/emphitem.hxx>
74 #include <svx/charscaleitem.hxx>
75 #include <svx/charreliefitem.hxx>
77 #include <sot/exchange.hxx>
78 #include <sot/formats.hxx>
80 #include <svx/numitem.hxx>
81 #include <bulitem.hxx>
82 #include <unolingu.hxx>
83 #include <linguistic/lngprops.hxx>
84 #include <sfx2/sfxuno.hxx>
85 #include <i18npool/mslangid.hxx>
86 #include <vcl/help.hxx>
87 #include <svx/xpoly.hxx>
88 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
89 #include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
91 #include <sfx2/srchdefs.hxx>
93 #if OSL_DEBUG_LEVEL > 1
94 #include <svx/frmdiritem.hxx>
96 #include <basegfx/polygon/b2dpolygon.hxx>
98 // Spaeter -> TOOLS\STRING.H (fuer Grep: WS_TARGET)
100 using namespace ::com::sun::star
;
101 using namespace ::com::sun::star::uno
;
102 using namespace ::com::sun::star::linguistic2
;
105 DBG_NAME( EditEngine
)
106 DBG_NAMEEX( EditView
)
108 #if (OSL_DEBUG_LEVEL > 1) || defined ( DBG_UTIL )
109 static sal_Bool bDebugPaint
= sal_False
;
112 SV_IMPL_VARARR( EECharAttribArray
, EECharAttrib
);
115 \f// ----------------------------------------------------------------------
117 // ----------------------------------------------------------------------
118 EditEngine::EditEngine( SfxItemPool
* pItemPool
)
120 DBG_CTOR( EditEngine
, 0 );
121 pImpEditEngine
= new ImpEditEngine( this, pItemPool
);
124 EditEngine::~EditEngine()
126 DBG_DTOR( EditEngine
, 0 );
127 delete pImpEditEngine
;
130 void EditEngine::EnableUndo( sal_Bool bEnable
)
132 DBG_CHKTHIS( EditEngine
, 0 );
133 pImpEditEngine
->EnableUndo( bEnable
);
136 sal_Bool
EditEngine::IsUndoEnabled()
138 DBG_CHKTHIS( EditEngine
, 0 );
139 return pImpEditEngine
->IsUndoEnabled();
142 sal_Bool
EditEngine::IsInUndo()
144 DBG_CHKTHIS( EditEngine
, 0 );
145 return pImpEditEngine
->IsInUndo();
148 SfxUndoManager
& EditEngine::GetUndoManager()
150 DBG_CHKTHIS( EditEngine
, 0 );
151 return pImpEditEngine
->GetUndoManager();
154 void EditEngine::UndoActionStart( sal_uInt16 nId
)
156 DBG_CHKTHIS( EditEngine
, 0 );
157 DBG_ASSERT( !pImpEditEngine
->IsInUndo(), "Aufruf von UndoActionStart im Undomodus!" );
158 if ( !pImpEditEngine
->IsInUndo() )
159 pImpEditEngine
->UndoActionStart( nId
);
162 void EditEngine::UndoActionEnd( sal_uInt16 nId
)
164 DBG_CHKTHIS( EditEngine
, 0 );
165 DBG_ASSERT( !pImpEditEngine
->IsInUndo(), "Aufruf von UndoActionEnd im Undomodus!" );
166 if ( !pImpEditEngine
->IsInUndo() )
167 pImpEditEngine
->UndoActionEnd( nId
);
170 BOOL
EditEngine::HasTriedMergeOnLastAddUndo() const
172 return pImpEditEngine
->mbLastTryMerge
;
175 void EditEngine::SetRefDevice( OutputDevice
* pRefDev
)
177 DBG_CHKTHIS( EditEngine
, 0 );
178 pImpEditEngine
->SetRefDevice( pRefDev
);
181 OutputDevice
* EditEngine::GetRefDevice() const
183 DBG_CHKTHIS( EditEngine
, 0 );
184 return pImpEditEngine
->GetRefDevice();
187 void EditEngine::SetRefMapMode( const MapMode
& rMapMode
)
189 DBG_CHKTHIS( EditEngine
, 0 );
190 pImpEditEngine
->SetRefMapMode( rMapMode
);
193 MapMode
EditEngine::GetRefMapMode()
195 DBG_CHKTHIS( EditEngine
, 0 );
196 return pImpEditEngine
->GetRefMapMode();
199 void EditEngine::SetBackgroundColor( const Color
& rColor
)
201 DBG_CHKTHIS( EditEngine
, 0 );
202 pImpEditEngine
->SetBackgroundColor( rColor
);
205 Color
EditEngine::GetBackgroundColor() const
207 DBG_CHKTHIS( EditEngine
, 0 );
208 return pImpEditEngine
->GetBackgroundColor();
211 Color
EditEngine::GetAutoColor() const
213 DBG_CHKTHIS( EditEngine
, 0 );
214 return pImpEditEngine
->GetAutoColor();
217 void EditEngine::EnableAutoColor( BOOL b
)
219 DBG_CHKTHIS( EditEngine
, 0 );
220 pImpEditEngine
->EnableAutoColor( b
);
223 BOOL
EditEngine::IsAutoColorEnabled() const
225 DBG_CHKTHIS( EditEngine
, 0 );
226 return pImpEditEngine
->IsAutoColorEnabled();
229 void EditEngine::ForceAutoColor( BOOL b
)
231 DBG_CHKTHIS( EditEngine
, 0 );
232 pImpEditEngine
->ForceAutoColor( b
);
235 BOOL
EditEngine::IsForceAutoColor() const
237 DBG_CHKTHIS( EditEngine
, 0 );
238 return pImpEditEngine
->IsForceAutoColor();
241 const SfxItemSet
& EditEngine::GetEmptyItemSet()
243 DBG_CHKTHIS( EditEngine
, 0 );
244 return pImpEditEngine
->GetEmptyItemSet();
247 void EditEngine::Draw( OutputDevice
* pOutDev
, const Rectangle
& rOutRect
)
249 DBG_CHKTHIS( EditEngine
, 0 );
250 Draw( pOutDev
, rOutRect
, Point( 0, 0 ) );
253 void EditEngine::Draw( OutputDevice
* pOutDev
, const Point
& rStartPos
, short nOrientation
)
255 DBG_CHKTHIS( EditEngine
, 0 );
256 // Mit 2 Punkten erzeugen, da bei Positivem Punkt, LONGMAX als Size
257 // Bottom und Right im Bereich > LONGMAX landen.
258 Rectangle
aBigRec( -0x3FFFFFFF, -0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF );
259 if( pOutDev
->GetConnectMetaFile() )
261 Point
aStartPos( rStartPos
);
264 aStartPos
.X() += GetPaperSize().Width();
265 aStartPos
= Rotate( aStartPos
, nOrientation
, rStartPos
);
267 pImpEditEngine
->Paint( pOutDev
, aBigRec
, aStartPos
, sal_False
, nOrientation
);
268 if( pOutDev
->GetConnectMetaFile() )
272 void EditEngine::Draw( OutputDevice
* pOutDev
, const Rectangle
& rOutRect
, const Point
& rStartDocPos
)
274 Draw( pOutDev
, rOutRect
, rStartDocPos
, sal_True
);
277 void EditEngine::Draw( OutputDevice
* pOutDev
, const Rectangle
& rOutRect
, const Point
& rStartDocPos
, sal_Bool bClip
)
279 DBG_CHKTHIS( EditEngine
, 0 );
281 #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
283 EditDbg::ShowEditEngineData( this, sal_False
);
286 // Auf Pixelgrenze ausrichten, damit genau das gleiche
288 Rectangle
aOutRect( pOutDev
->LogicToPixel( rOutRect
) );
289 aOutRect
= pOutDev
->PixelToLogic( aOutRect
);
294 aStartPos
.X() = aOutRect
.Left() - rStartDocPos
.X();
295 aStartPos
.Y() = aOutRect
.Top() - rStartDocPos
.Y();
299 aStartPos
.X() = aOutRect
.Right() + rStartDocPos
.Y();
300 aStartPos
.Y() = aOutRect
.Top() - rStartDocPos
.X();
303 sal_Bool bClipRegion
= pOutDev
->IsClipRegion();
304 sal_Bool bMetafile
= pOutDev
->GetConnectMetaFile() ? sal_True
: sal_False
;
305 Region aOldRegion
= pOutDev
->GetClipRegion();
307 #ifdef EDIT_PRINTER_LOG
308 if ( pOutDev
->GetOutDevType() == OUTDEV_PRINTER
)
310 SvFileStream
aLog( "d:\\editprn.log", STREAM_WRITE
);
311 aLog
.Seek( STREAM_SEEK_TO_END
);
312 aLog
<< '\f' << endl
<< "Printing: ";
313 aLog
<< GetText( "\n\r" ).GetStr();
314 aLog
<< endl
<< endl
;
315 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
;
316 aLog
<< "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tOut-Width: " << String( rOutRect
.GetWidth() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl
;
317 aLog
<< "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tOut-Height: " << String( rOutRect
.GetHeight() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl
;
323 // Wenn es eine gab => Schnittmenge !
324 // Bei der Metafileaufzeichnung Push/Pop verwenden.
328 // Immer die Intersect-Methode, weil beim Metafile ein Muss!
331 // Clip only if neccesary...
332 if ( !rStartDocPos
.X() && !rStartDocPos
.Y() &&
333 ( rOutRect
.GetHeight() >= (long)GetTextHeight() ) &&
334 ( rOutRect
.GetWidth() >= (long)CalcTextWidth() ) )
340 // Einige Druckertreiber bereiten Probleme, wenn Buchstaben die
341 // ClipRegion streifen, deshalb lieber ein Pixel mehr...
342 Rectangle
aClipRect( aOutRect
);
343 if ( pOutDev
->GetOutDevType() == OUTDEV_PRINTER
)
346 aPixSz
= pOutDev
->PixelToLogic( aPixSz
);
347 aClipRect
.Right() += aPixSz
.Width();
348 aClipRect
.Bottom() += aPixSz
.Width();
350 pOutDev
->IntersectClipRegion( aClipRect
);
354 pImpEditEngine
->Paint( pOutDev
, aOutRect
, aStartPos
);
358 else if ( bClipRegion
)
359 pOutDev
->SetClipRegion( aOldRegion
);
361 pOutDev
->SetClipRegion();
364 void EditEngine::InsertView( EditView
* pEditView
, sal_uInt16 nIndex
)
366 DBG_CHKTHIS( EditEngine
, 0 );
367 DBG_CHKOBJ( pEditView
, EditView
, 0 );
369 if ( nIndex
> pImpEditEngine
->GetEditViews().Count() )
370 nIndex
= pImpEditEngine
->GetEditViews().Count();
372 pImpEditEngine
->GetEditViews().Insert( pEditView
, nIndex
);
373 EditSelection aStartSel
;
374 aStartSel
= pImpEditEngine
->GetEditDoc().GetStartPaM();
375 pEditView
->pImpEditView
->SetEditSelection( aStartSel
);
376 if ( !pImpEditEngine
->GetActiveView() )
377 pImpEditEngine
->SetActiveView( pEditView
);
379 pEditView
->pImpEditView
->AddDragAndDropListeners();
382 EditView
* EditEngine::RemoveView( EditView
* pView
)
384 DBG_CHKTHIS( EditEngine
, 0 );
385 DBG_CHKOBJ( pView
, EditView
, 0 );
388 EditView
* pRemoved
= 0;
389 sal_uInt16 nPos
= pImpEditEngine
->GetEditViews().GetPos( pView
);
390 DBG_ASSERT( nPos
!= USHRT_MAX
, "RemoveView mit ungueltigem Index" );
391 if ( nPos
!= USHRT_MAX
)
393 pRemoved
= pImpEditEngine
->GetEditViews().GetObject( nPos
);
394 pImpEditEngine
->GetEditViews().Remove( nPos
);
395 if ( pImpEditEngine
->GetActiveView() == pView
)
397 pImpEditEngine
->SetActiveView( 0 );
398 pImpEditEngine
->GetSelEngine().SetCurView( 0 );
400 pView
->pImpEditView
->RemoveDragAndDropListeners();
406 EditView
* EditEngine::RemoveView( sal_uInt16 nIndex
)
408 DBG_CHKTHIS( EditEngine
, 0 );
409 EditView
* pView
= pImpEditEngine
->GetEditViews().GetObject( nIndex
);
411 return RemoveView( pView
);
415 EditView
* EditEngine::GetView( sal_uInt16 nIndex
) const
417 DBG_CHKTHIS( EditEngine
, 0 );
418 return pImpEditEngine
->GetEditViews().GetObject( nIndex
);
421 sal_uInt16
EditEngine::GetViewCount() const
423 DBG_CHKTHIS( EditEngine
, 0 );
424 return pImpEditEngine
->GetEditViews().Count();
427 sal_Bool
EditEngine::HasView( EditView
* pView
) const
429 return pImpEditEngine
->GetEditViews().GetPos( pView
) != USHRT_MAX
;
432 EditView
* EditEngine::GetActiveView() const
434 DBG_CHKTHIS( EditEngine
, 0 );
435 return pImpEditEngine
->GetActiveView();
438 void EditEngine::SetActiveView( EditView
* pView
)
440 DBG_CHKTHIS( EditEngine
, 0 );
443 DBG_CHKOBJ( pView
, EditView
, 0 );
445 pImpEditEngine
->SetActiveView( pView
);
448 void EditEngine::SetDefTab( sal_uInt16 nDefTab
)
450 DBG_CHKTHIS( EditEngine
, 0 );
451 pImpEditEngine
->GetEditDoc().SetDefTab( nDefTab
);
452 if ( pImpEditEngine
->IsFormatted() )
454 pImpEditEngine
->FormatFullDoc();
455 pImpEditEngine
->UpdateViews( (EditView
*) 0 );
459 sal_uInt16
EditEngine::GetDefTab() const
461 DBG_CHKTHIS( EditEngine
, 0 );
462 return pImpEditEngine
->GetEditDoc().GetDefTab();
465 void EditEngine::SetPaperSize( const Size
& rNewSize
)
467 DBG_CHKTHIS( EditEngine
, 0 );
469 Size
aOldSize( pImpEditEngine
->GetPaperSize() );
470 pImpEditEngine
->SetValidPaperSize( rNewSize
);
471 Size
aNewSize( pImpEditEngine
->GetPaperSize() );
473 sal_Bool bAutoPageSize
= pImpEditEngine
->GetStatus().AutoPageSize();
474 if ( bAutoPageSize
|| ( aNewSize
.Width() != aOldSize
.Width() ) )
476 for ( sal_uInt16 nView
= 0; nView
< pImpEditEngine
->aEditViews
.Count(); nView
++ )
478 EditView
* pView
= pImpEditEngine
->aEditViews
[nView
];
479 DBG_CHKOBJ( pView
, EditView
, 0 );
481 pView
->pImpEditView
->RecalcOutputArea();
482 else if ( pView
->pImpEditView
->DoAutoSize() )
484 pView
->pImpEditView
->ResetOutputArea( Rectangle(
485 pView
->pImpEditView
->GetOutputArea().TopLeft(), aNewSize
) );
489 if ( bAutoPageSize
|| pImpEditEngine
->IsFormatted() )
491 // Aendern der Breite hat bei AutoPageSize keine Wirkung, da durch
492 // Textbreite bestimmt.
493 // Optimierung erst nach Vobis-Auslieferung aktivieren...
494 // if ( !bAutoPageSize )
495 pImpEditEngine
->FormatFullDoc();
498 // pImpEditEngine->FormatDoc(); // PageSize, falls Aenderung
499 // pImpEditEngine->CheckAutoPageSize(); // Falls nichts formatiert wurde
502 pImpEditEngine
->UpdateViews( pImpEditEngine
->GetActiveView() );
504 if ( pImpEditEngine
->GetUpdateMode() && pImpEditEngine
->GetActiveView() )
505 pImpEditEngine
->pActiveView
->ShowCursor( sal_False
, sal_False
);
510 const Size
& EditEngine::GetPaperSize() const
512 DBG_CHKTHIS( EditEngine
, 0 );
513 return pImpEditEngine
->GetPaperSize();
516 void EditEngine::SetVertical( BOOL bVertical
)
518 DBG_CHKTHIS( EditEngine
, 0 );
519 pImpEditEngine
->SetVertical( bVertical
);
522 BOOL
EditEngine::IsVertical() const
524 DBG_CHKTHIS( EditEngine
, 0 );
525 return pImpEditEngine
->IsVertical();
528 void EditEngine::SetFixedCellHeight( BOOL bUseFixedCellHeight
)
530 DBG_CHKTHIS( EditEngine
, 0 );
531 pImpEditEngine
->SetFixedCellHeight( bUseFixedCellHeight
);
534 BOOL
EditEngine::IsFixedCellHeight() const
536 DBG_CHKTHIS( EditEngine
, 0 );
537 return pImpEditEngine
->IsFixedCellHeight();
540 void EditEngine::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir
)
542 DBG_CHKTHIS( EditEngine
, 0 );
543 pImpEditEngine
->SetDefaultHorizontalTextDirection( eHTextDir
);
546 EEHorizontalTextDirection
EditEngine::GetDefaultHorizontalTextDirection() const
548 DBG_CHKTHIS( EditEngine
, 0 );
549 return pImpEditEngine
->GetDefaultHorizontalTextDirection();
552 USHORT
EditEngine::GetScriptType( const ESelection
& rSelection
) const
554 DBG_CHKTHIS( EditEngine
, 0 );
555 EditSelection
aSel( pImpEditEngine
->CreateSel( rSelection
) );
556 return pImpEditEngine
->GetScriptType( aSel
);
559 LanguageType
EditEngine::GetLanguage( USHORT nPara
, USHORT nPos
) const
561 DBG_CHKTHIS( EditEngine
, 0 );
562 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
563 DBG_ASSERT( pNode
, "GetLanguage - nPara is invalid!" );
564 return pNode
? pImpEditEngine
->GetLanguage( EditPaM( pNode
, nPos
) ) : LANGUAGE_DONTKNOW
;
568 void EditEngine::TransliterateText( const ESelection
& rSelection
, sal_Int32 nTransliterationMode
)
570 DBG_CHKTHIS( EditView
, 0 );
571 pImpEditEngine
->TransliterateText( pImpEditEngine
->CreateSel( rSelection
), nTransliterationMode
);
574 void EditEngine::SetAsianCompressionMode( USHORT n
)
576 DBG_CHKTHIS( EditView
, 0 );
577 pImpEditEngine
->SetAsianCompressionMode( n
);
580 USHORT
EditEngine::GetAsianCompressionMode() const
582 DBG_CHKTHIS( EditView
, 0 );
583 return pImpEditEngine
->GetAsianCompressionMode();
586 void EditEngine::SetKernAsianPunctuation( BOOL b
)
588 DBG_CHKTHIS( EditView
, 0 );
589 pImpEditEngine
->SetKernAsianPunctuation( b
);
592 BOOL
EditEngine::IsKernAsianPunctuation() const
594 DBG_CHKTHIS( EditView
, 0 );
595 return pImpEditEngine
->IsKernAsianPunctuation();
598 void EditEngine::SetAddExtLeading( BOOL b
)
600 DBG_CHKTHIS( EditEngine
, 0 );
601 pImpEditEngine
->SetAddExtLeading( b
);
604 BOOL
EditEngine::IsAddExtLeading() const
606 DBG_CHKTHIS( EditEngine
, 0 );
607 return pImpEditEngine
->IsAddExtLeading();
610 void EditEngine::SetPolygon( const basegfx::B2DPolyPolygon
& rPolyPolygon
)
612 DBG_CHKTHIS( EditEngine
, 0 );
613 SetPolygon( rPolyPolygon
, 0L );
616 void EditEngine::SetPolygon(const basegfx::B2DPolyPolygon
& rPolyPolygon
, const basegfx::B2DPolyPolygon
* pLinePolyPolygon
)
618 DBG_CHKTHIS( EditEngine
, 0 );
619 sal_Bool
bSimple(sal_False
);
621 if(pLinePolyPolygon
&& 1L == rPolyPolygon
.count())
623 if(rPolyPolygon
.getB2DPolygon(0L).isClosed())
630 TextRanger
* pRanger
= new TextRanger( rPolyPolygon
, pLinePolyPolygon
, 30, 2, 2, bSimple
, sal_True
);
631 pImpEditEngine
->SetTextRanger( pRanger
);
632 pImpEditEngine
->SetPaperSize( pRanger
->GetBoundRect().GetSize() );
635 void EditEngine::ClearPolygon()
637 DBG_CHKTHIS( EditEngine
, 0 );
638 pImpEditEngine
->SetTextRanger( 0 );
641 const PolyPolygon
* EditEngine::GetPolygon()
643 DBG_CHKTHIS( EditEngine
, 0 );
644 return pImpEditEngine
->GetTextRanger() ?
645 &pImpEditEngine
->GetTextRanger()->GetPolyPolygon() : NULL
;
648 const Size
& EditEngine::GetMinAutoPaperSize() const
650 DBG_CHKTHIS( EditEngine
, 0 );
651 return pImpEditEngine
->GetMinAutoPaperSize();
654 void EditEngine::SetMinAutoPaperSize( const Size
& rSz
)
656 DBG_CHKTHIS( EditEngine
, 0 );
657 pImpEditEngine
->SetMinAutoPaperSize( rSz
);
660 const Size
& EditEngine::GetMaxAutoPaperSize() const
662 DBG_CHKTHIS( EditEngine
, 0 );
663 return pImpEditEngine
->GetMaxAutoPaperSize();
666 void EditEngine::SetMaxAutoPaperSize( const Size
& rSz
)
668 DBG_CHKTHIS( EditEngine
, 0 );
669 pImpEditEngine
->SetMaxAutoPaperSize( rSz
);
672 XubString
EditEngine::GetText( LineEnd eEnd
) const
674 DBG_CHKTHIS( EditEngine
, 0 );
675 return pImpEditEngine
->GetEditDoc().GetText( eEnd
);
678 XubString
EditEngine::GetText( const ESelection
& rESelection
, const LineEnd eEnd
) const
680 DBG_CHKTHIS( EditEngine
, 0 );
681 EditSelection
aSel( pImpEditEngine
->CreateSel( rESelection
) );
682 return pImpEditEngine
->GetSelected( aSel
, eEnd
);
685 sal_uInt32
EditEngine::GetTextLen() const
687 DBG_CHKTHIS( EditEngine
, 0 );
688 return pImpEditEngine
->GetEditDoc().GetTextLen();
691 sal_uInt16
EditEngine::GetParagraphCount() const
693 DBG_CHKTHIS( EditEngine
, 0 );
694 return pImpEditEngine
->aEditDoc
.Count();
697 sal_uInt16
EditEngine::GetLineCount( sal_uInt16 nParagraph
) const
699 DBG_CHKTHIS( EditEngine
, 0 );
700 if ( !pImpEditEngine
->IsFormatted() )
701 pImpEditEngine
->FormatDoc();
702 return pImpEditEngine
->GetLineCount( nParagraph
);
705 sal_uInt16
EditEngine::GetLineLen( sal_uInt16 nParagraph
, sal_uInt16 nLine
) const
707 DBG_CHKTHIS( EditEngine
, 0 );
708 if ( !pImpEditEngine
->IsFormatted() )
709 pImpEditEngine
->FormatDoc();
710 return pImpEditEngine
->GetLineLen( nParagraph
, nLine
);
713 void EditEngine::GetLineBoundaries( /*out*/USHORT
&rStart
, /*out*/USHORT
&rEnd
, USHORT nParagraph
, USHORT nLine
) const
715 DBG_CHKTHIS( EditEngine
, 0 );
716 if ( !pImpEditEngine
->IsFormatted() )
717 pImpEditEngine
->FormatDoc();
718 return pImpEditEngine
->GetLineBoundaries( rStart
, rEnd
, nParagraph
, nLine
);
721 USHORT
EditEngine::GetLineNumberAtIndex( USHORT nPara
, USHORT nIndex
) const
723 DBG_CHKTHIS( EditEngine
, 0 );
724 if ( !pImpEditEngine
->IsFormatted() )
725 pImpEditEngine
->FormatDoc();
726 return pImpEditEngine
->GetLineNumberAtIndex( nPara
, nIndex
);
729 sal_uInt32
EditEngine::GetLineHeight( sal_uInt16 nParagraph
, sal_uInt16 nLine
)
731 DBG_CHKTHIS( EditEngine
, 0 );
732 // Falls jemand mit einer leeren Engine ein GetLineHeight() macht.
733 if ( !pImpEditEngine
->IsFormatted() )
734 pImpEditEngine
->FormatDoc();
735 return pImpEditEngine
->GetLineHeight( nParagraph
, nLine
);
738 sal_uInt16
EditEngine::GetFirstLineOffset( sal_uInt16 nParagraph
)
740 DBG_CHKTHIS( EditEngine
, 0 );
741 if ( !pImpEditEngine
->IsFormatted() )
742 pImpEditEngine
->FormatDoc();
743 ParaPortion
* pPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nParagraph
);
744 return ( pPortion
? pPortion
->GetFirstLineOffset() : 0 );
747 sal_uInt32
EditEngine::GetTextHeight( sal_uInt16 nParagraph
) const
749 DBG_CHKTHIS( EditEngine
, 0 );
751 if ( !pImpEditEngine
->IsFormatted() )
752 pImpEditEngine
->FormatDoc();
754 sal_uInt32 nHeight
= pImpEditEngine
->GetParaHeight( nParagraph
);
758 XubString
EditEngine::GetWord( sal_uInt16 nPara
, sal_uInt16 nIndex
)
760 ESelection
aESel( nPara
, nIndex
, nPara
, nIndex
);
761 EditSelection
aSel( pImpEditEngine
->CreateSel( aESel
) );
762 aSel
= pImpEditEngine
->SelectWord( aSel
);
763 return pImpEditEngine
->GetSelected( aSel
);
766 ESelection
EditEngine::GetWord( const ESelection
& rSelection
, USHORT nWordType
) const
768 // ImpEditEngine-Iteration-Methods should be const!
769 EditEngine
* pE
= (EditEngine
*)this;
771 EditSelection
aSel( pE
->pImpEditEngine
->CreateSel( rSelection
) );
772 aSel
= pE
->pImpEditEngine
->SelectWord( aSel
, nWordType
);
773 return pE
->pImpEditEngine
->CreateESel( aSel
);
776 ESelection
EditEngine::WordLeft( const ESelection
& rSelection
, USHORT nWordType
) const
778 // ImpEditEngine-Iteration-Methods should be const!
779 EditEngine
* pE
= (EditEngine
*)this;
781 EditSelection
aSel( pE
->pImpEditEngine
->CreateSel( rSelection
) );
782 aSel
= pE
->pImpEditEngine
->WordLeft( aSel
.Min(), nWordType
);
783 return pE
->pImpEditEngine
->CreateESel( aSel
);
786 ESelection
EditEngine::WordRight( const ESelection
& rSelection
, USHORT nWordType
) const
788 // ImpEditEngine-Iteration-Methods should be const!
789 EditEngine
* pE
= (EditEngine
*)this;
791 EditSelection
aSel( pE
->pImpEditEngine
->CreateSel( rSelection
) );
792 aSel
= pE
->pImpEditEngine
->WordRight( aSel
.Max(), nWordType
);
793 return pE
->pImpEditEngine
->CreateESel( aSel
);
796 ESelection
EditEngine::CursorLeft( const ESelection
& rSelection
, USHORT nCharacterIteratorMode
) const
798 // ImpEditEngine-Iteration-Methods should be const!
799 EditEngine
* pE
= (EditEngine
*)this;
801 EditSelection
aSel( pE
->pImpEditEngine
->CreateSel( rSelection
) );
802 aSel
= pE
->pImpEditEngine
->CursorLeft( aSel
.Min(), nCharacterIteratorMode
);
803 return pE
->pImpEditEngine
->CreateESel( aSel
);
806 ESelection
EditEngine::CursorRight( const ESelection
& rSelection
, USHORT nCharacterIteratorMode
) const
808 // ImpEditEngine-Iteration-Methods should be const!
809 EditEngine
* pE
= (EditEngine
*)this;
811 EditSelection
aSel( pE
->pImpEditEngine
->CreateSel( rSelection
) );
812 aSel
= pE
->pImpEditEngine
->CursorRight( aSel
.Max(), nCharacterIteratorMode
);
813 return pE
->pImpEditEngine
->CreateESel( aSel
);
816 sal_Bool
EditEngine::PostKeyEvent( const KeyEvent
& rKeyEvent
, EditView
* pEditView
, Window
* pFrameWin
)
818 DBG_CHKTHIS( EditEngine
, 0 );
819 DBG_CHKOBJ( pEditView
, EditView
, 0 );
820 DBG_ASSERT( pEditView
, "Keine View - keine Kekse !" );
822 sal_Bool bDone
= sal_True
;
824 sal_Bool bModified
= sal_False
;
825 sal_Bool bMoved
= sal_False
;
826 sal_Bool bAllowIdle
= sal_True
;
827 sal_Bool bReadOnly
= pEditView
->IsReadOnly();
829 USHORT nNewCursorFlags
= 0;
830 BOOL bSetCursorFlags
= TRUE
;
832 EditSelection
aCurSel( pEditView
->pImpEditView
->GetEditSelection() );
833 DBG_ASSERT( !aCurSel
.IsInvalid(), "Blinde Selection in EditEngine::PostKeyEvent" );
835 String
aAutoText( pImpEditEngine
->GetAutoCompleteText() );
836 if ( pImpEditEngine
->GetAutoCompleteText().Len() )
837 pImpEditEngine
->SetAutoCompleteText( String(), sal_True
);
839 sal_uInt16 nCode
= rKeyEvent
.GetKeyCode().GetCode();
840 KeyFuncType eFunc
= rKeyEvent
.GetKeyCode().GetFunction();
841 if ( eFunc
!= KEYFUNC_DONTKNOW
)
860 default: // wird dann evtl. unten bearbeitet.
861 eFunc
= KEYFUNC_DONTKNOW
;
865 pImpEditEngine
->EnterBlockNotifications();
867 if ( GetNotifyHdl().IsSet() )
869 EENotify
aNotify( EE_NOTIFY_INPUT_START
);
870 aNotify
.pEditEngine
= this;
871 pImpEditEngine
->CallNotify( aNotify
);
874 if ( eFunc
== KEYFUNC_DONTKNOW
)
878 #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
881 if ( rKeyEvent
.GetKeyCode().IsMod1() && rKeyEvent
.GetKeyCode().IsMod2() )
883 USHORT nParas
= GetParagraphCount();
885 Point
aViewStart( pEditView
->GetOutputArea().TopLeft() );
886 long n20
= 40 * pImpEditEngine
->nOnePixelInRef
;
887 for ( USHORT n
= 0; n
< nParas
; n
++ )
889 long nH
= GetTextHeight( n
);
890 Point
P1( aViewStart
.X() + n20
+ n20
*(n
%2), aViewStart
.Y() + aPos
.Y() );
894 pEditView
->GetWindow()->SetLineColor();
895 pEditView
->GetWindow()->SetFillColor( Color( (n
%2) ? COL_YELLOW
: COL_LIGHTGREEN
) );
896 pEditView
->GetWindow()->DrawRect( Rectangle( P1
, P2
) );
905 if ( rKeyEvent
.GetKeyCode().IsMod1() && rKeyEvent
.GetKeyCode().IsMod2() )
907 bDebugPaint
= !bDebugPaint
;
908 ByteString
aInfo( "DebugPaint: " );
909 aInfo
+= bDebugPaint
? "On" : "Off";
910 InfoBox( NULL
, String( aInfo
, RTL_TEXTENCODING_ASCII_US
) ).Execute();
917 if ( rKeyEvent
.GetKeyCode().IsMod1() && rKeyEvent
.GetKeyCode().IsMod2() )
919 EditDbg::ShowEditEngineData( this );
920 #ifdef EDIT_PRINTER_LOG
921 SvFileStream
aLog( "d:\\editprn.log", STREAM_WRITE
);
922 aLog
.Seek( STREAM_SEEK_TO_END
);
923 aLog
<< '\f' << endl
<< "Debug: ";
924 aLog
<< GetText( "\n\r" ).GetStr();
925 aLog
<< endl
<< endl
;
926 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
;
927 aLog
<< "Paper-Width: " << String( GetPaperSize().Width() ).GetStr() << ",\tCalculated: " << String( CalcTextWidth() ).GetStr() << endl
;
928 aLog
<< "Paper-Height: " << String( GetPaperSize().Height() ).GetStr() << ",\tCalculated: " << String( GetTextHeight() ).GetStr() << endl
;
944 case com::sun::star::awt::Key::MOVE_WORD_FORWARD
:
945 case com::sun::star::awt::Key::SELECT_WORD_FORWARD
:
946 case com::sun::star::awt::Key::MOVE_WORD_BACKWARD
:
947 case com::sun::star::awt::Key::SELECT_WORD_BACKWARD
:
948 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE
:
949 case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE
:
950 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE
:
951 case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE
:
952 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH
:
953 case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH
:
954 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH
:
955 case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH
:
956 case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT
:
957 case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT
:
958 case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT
:
959 case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT
:
961 if ( !rKeyEvent
.GetKeyCode().IsMod2() || ( nCode
== KEY_LEFT
) || ( nCode
== KEY_RIGHT
) )
963 if ( pImpEditEngine
->DoVisualCursorTraveling( aCurSel
.Max().GetNode() ) && ( ( nCode
== KEY_LEFT
) || ( nCode
== KEY_RIGHT
) /* || ( nCode == KEY_HOME ) || ( nCode == KEY_END ) */ ) )
964 bSetCursorFlags
= FALSE
; // Will be manipulated within visual cursor move
966 aCurSel
= pImpEditEngine
->MoveCursor( rKeyEvent
, pEditView
);
968 if ( aCurSel
.HasRange() ) {
969 Reference
<com::sun::star::datatransfer::clipboard::XClipboard
> aSelection(pEditView
->GetWindow()->GetPrimarySelection());
970 pEditView
->pImpEditView
->CutCopy( aSelection
, FALSE
);
974 if ( nCode
== KEY_HOME
)
975 nNewCursorFlags
|= GETCRSR_STARTOFLINE
;
976 else if ( nCode
== KEY_END
)
977 nNewCursorFlags
|= GETCRSR_ENDOFLINE
;
980 #if OSL_DEBUG_LEVEL > 1
981 GetLanguage( pImpEditEngine
->GetEditDoc().GetPos( aCurSel
.Max().GetNode() ), aCurSel
.Max().GetIndex() );
987 case com::sun::star::awt::Key::DELETE_WORD_BACKWARD
:
988 case com::sun::star::awt::Key::DELETE_WORD_FORWARD
:
989 case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH
:
990 case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH
:
992 if ( !bReadOnly
&& !rKeyEvent
.GetKeyCode().IsMod2() )
994 // check if we are behind a bullet and using the backspace key
995 ContentNode
*pNode
= aCurSel
.Min().GetNode();
996 const SvxNumberFormat
*pFmt
= pImpEditEngine
->GetNumberFormat( pNode
);
997 if (pFmt
&& nCode
== KEY_BACKSPACE
&&
998 !aCurSel
.HasRange() && aCurSel
.Min().GetIndex() == 0)
1000 // if the bullet is still visible just do not paint it from
1001 // now on and that will be all. Otherwise continue as usual.
1004 USHORT nPara
= pImpEditEngine
->GetEditDoc().GetPos( pNode
);
1005 SfxBoolItem
aBulletState( (const SfxBoolItem
&) pImpEditEngine
->GetParaAttrib( nPara
, EE_PARA_BULLETSTATE
) );
1006 bool bBulletIsVisible
= aBulletState
.GetValue() ? true : false;
1008 // just toggling EE_PARA_BULLETSTATE should be fine for both cases...
1009 aBulletState
.SetValue( !bBulletIsVisible
);
1010 SfxItemSet
aSet( pImpEditEngine
->GetParaAttribs( nPara
) );
1011 aSet
.Put( aBulletState
);
1012 pImpEditEngine
->SetParaAttribs( nPara
, aSet
);
1014 // have this and the following paragraphs formatted and repainted.
1015 // (not painting a numbering in the list may cause the following
1016 // numberings to have different numbers than before and thus the
1017 // length may have changed as well )
1018 pImpEditEngine
->FormatAndUpdate( pImpEditEngine
->GetActiveView() );
1020 if (bBulletIsVisible
) // bullet just turned invisible...
1024 BYTE nDel
= 0, nMode
= 0;
1027 case com::sun::star::awt::Key::DELETE_WORD_BACKWARD
:
1028 nMode
= DELMODE_RESTOFWORD
;
1031 case com::sun::star::awt::Key::DELETE_WORD_FORWARD
:
1032 nMode
= DELMODE_RESTOFWORD
;
1035 case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH
:
1036 nMode
= DELMODE_RESTOFCONTENT
;
1039 case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH
:
1040 nMode
= DELMODE_RESTOFCONTENT
;
1044 nDel
= ( nCode
== KEY_DELETE
) ? DEL_RIGHT
: DEL_LEFT
;
1045 nMode
= rKeyEvent
.GetKeyCode().IsMod1() ? DELMODE_RESTOFWORD
: DELMODE_SIMPLE
;
1046 if ( ( nMode
== DELMODE_RESTOFWORD
) && rKeyEvent
.GetKeyCode().IsShift() )
1047 nMode
= DELMODE_RESTOFCONTENT
;
1051 pEditView
->pImpEditView
->DrawSelection();
1052 pImpEditEngine
->UndoActionStart( EDITUNDO_DELETE
);
1053 aCurSel
= pImpEditEngine
->DeleteLeftOrRight( aCurSel
, nDel
, nMode
);
1054 pImpEditEngine
->UndoActionEnd( EDITUNDO_DELETE
);
1055 bModified
= sal_True
;
1056 bAllowIdle
= sal_False
;
1062 if ( !bReadOnly
&& !rKeyEvent
.GetKeyCode().IsMod1() && !rKeyEvent
.GetKeyCode().IsMod2() )
1064 sal_Bool bShift
= rKeyEvent
.GetKeyCode().IsShift();
1065 if ( pImpEditEngine
->GetStatus().DoTabIndenting() &&
1066 ( aCurSel
.Min().GetNode() != aCurSel
.Max().GetNode() ) )
1068 pImpEditEngine
->IndentBlock( pEditView
, !bShift
);
1072 sal_Bool bSel
= pEditView
->HasSelection();
1074 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1075 if ( pImpEditEngine
->GetStatus().DoAutoCorrect() )
1076 aCurSel
= pImpEditEngine
->AutoCorrect( aCurSel
, 0, !pEditView
->IsInsertMode(), pFrameWin
);
1077 aCurSel
= pImpEditEngine
->InsertTab( aCurSel
);
1079 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1080 bModified
= sal_True
;
1091 pEditView
->pImpEditView
->DrawSelection();
1092 if ( !rKeyEvent
.GetKeyCode().IsMod1() && !rKeyEvent
.GetKeyCode().IsMod2() )
1094 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1095 if ( rKeyEvent
.GetKeyCode().IsShift() )
1097 aCurSel
= pImpEditEngine
->AutoCorrect( aCurSel
, 0, !pEditView
->IsInsertMode(), pFrameWin
);
1098 aCurSel
= pImpEditEngine
->InsertLineBreak( aCurSel
);
1102 if ( !aAutoText
.Len() )
1104 if ( pImpEditEngine
->GetStatus().DoAutoCorrect() )
1105 aCurSel
= pImpEditEngine
->AutoCorrect( aCurSel
, 0, !pEditView
->IsInsertMode(), pFrameWin
);
1106 aCurSel
= pImpEditEngine
->InsertParaBreak( aCurSel
);
1110 DBG_ASSERT( !aCurSel
.HasRange(), "Selektion bei Complete?!" );
1111 EditPaM
aStart( pImpEditEngine
->WordLeft( aCurSel
.Max() ) );
1112 aCurSel
= pImpEditEngine
->InsertText(
1113 EditSelection( aStart
, aCurSel
.Max() ), aAutoText
);
1114 pImpEditEngine
->SetAutoCompleteText( String(), sal_True
);
1117 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1118 bModified
= sal_True
;
1125 if ( !rKeyEvent
.GetKeyCode().IsMod1() && !rKeyEvent
.GetKeyCode().IsMod2() )
1126 pEditView
->SetInsertMode( !pEditView
->IsInsertMode() );
1131 #if (OSL_DEBUG_LEVEL > 1) && !defined( PRODUCT )
1132 if ( ( nCode
== KEY_W
) && rKeyEvent
.GetKeyCode().IsMod1() && rKeyEvent
.GetKeyCode().IsMod2() )
1134 SfxItemSet aAttribs
= pEditView
->GetAttribs();
1135 const SvxFrameDirectionItem
& rCurrentWritingMode
= (const SvxFrameDirectionItem
&)aAttribs
.Get( EE_PARA_WRITINGDIR
);
1136 SvxFrameDirectionItem
aNewItem( FRMDIR_HORI_LEFT_TOP
, EE_PARA_WRITINGDIR
);
1137 if ( rCurrentWritingMode
.GetValue() != FRMDIR_HORI_RIGHT_TOP
)
1138 aNewItem
.SetValue( FRMDIR_HORI_RIGHT_TOP
);
1139 aAttribs
.Put( aNewItem
);
1140 pEditView
->SetAttribs( aAttribs
);
1143 if ( !bReadOnly
&& IsSimpleCharInput( rKeyEvent
) )
1145 xub_Unicode nCharCode
= rKeyEvent
.GetCharCode();
1146 pEditView
->pImpEditView
->DrawSelection();
1148 if ( ( pImpEditEngine
->GetStatus().DoAutoCorrect() ) &&
1149 ( ( nCharCode
== ' ' ) || ( nCharCode
== '*' ) ||
1150 ( nCharCode
== '\"' ) || ( nCharCode
== '\'' ) ||
1151 ( nCharCode
== '_' ) ))
1153 aCurSel
= pImpEditEngine
->AutoCorrect(
1154 aCurSel
, nCharCode
, !pEditView
->IsInsertMode(), pFrameWin
);
1158 aCurSel
= pImpEditEngine
->InsertText( (const EditSelection
&)aCurSel
, nCharCode
, !pEditView
->IsInsertMode(), sal_True
);
1161 if ( pImpEditEngine
->GetStatus().DoAutoComplete() && ( nCharCode
!= ' ' ) )
1163 // Aber nur wenn Wort-Ende...
1164 sal_uInt16 nIndex
= aCurSel
.Max().GetIndex();
1165 if ( ( nIndex
>= aCurSel
.Max().GetNode()->Len() ) ||
1166 ( pImpEditEngine
->aWordDelimiters
.Search( aCurSel
.Max().GetNode()->GetChar( nIndex
) ) != STRING_NOTFOUND
) )
1168 EditPaM
aStart( pImpEditEngine
->WordLeft( aCurSel
.Max() ) );
1169 String aWord
= pImpEditEngine
->GetSelected( EditSelection( aStart
, aCurSel
.Max() ) );
1170 if ( aWord
.Len() >= 3 )
1174 LanguageType eLang
= pImpEditEngine
->GetLanguage( EditPaM( aStart
.GetNode(), aStart
.GetIndex()+1));
1175 lang::Locale
aLocale( MsLangId::convertLanguageToLocale( eLang
));
1177 if (!pImpEditEngine
->xLocaleDataWrapper
.isInitialized())
1178 pImpEditEngine
->xLocaleDataWrapper
.init( SvtSysLocale().GetLocaleData().getServiceFactory(), aLocale
, eLang
);
1180 pImpEditEngine
->xLocaleDataWrapper
.changeLocale( aLocale
, eLang
);
1182 if (!pImpEditEngine
->xTransliterationWrapper
.isInitialized())
1183 pImpEditEngine
->xTransliterationWrapper
.init( SvtSysLocale().GetLocaleData().getServiceFactory(), eLang
, i18n::TransliterationModules_IGNORE_CASE
);
1185 pImpEditEngine
->xTransliterationWrapper
.changeLocale( eLang
);
1187 const ::utl::TransliterationWrapper
* pTransliteration
= pImpEditEngine
->xTransliterationWrapper
.get();
1188 Sequence
< i18n::CalendarItem
> xItem
= pImpEditEngine
->xLocaleDataWrapper
->getDefaultCalendarDays();
1189 sal_Int32 nCount
= xItem
.getLength();
1190 const i18n::CalendarItem
* pArr
= xItem
.getArray();
1191 for( sal_Int32 n
= 0; n
<= nCount
; ++n
)
1193 const ::rtl::OUString
& rDay
= pArr
[n
].FullName
;
1194 if( pTransliteration
->isMatch( aWord
, rDay
) )
1201 if ( !aComplete
.Len() )
1203 xItem
= pImpEditEngine
->xLocaleDataWrapper
->getDefaultCalendarMonths();
1204 sal_Int32 nMonthCount
= xItem
.getLength();
1205 const i18n::CalendarItem
* pMonthArr
= xItem
.getArray();
1206 for( sal_Int32 n
= 0; n
<= nMonthCount
; ++n
)
1208 const ::rtl::OUString
& rMon
= pMonthArr
[n
].FullName
;
1209 if( pTransliteration
->isMatch( aWord
, rMon
) )
1217 if( aComplete
.Len() && ( ( aWord
.Len() + 1 ) < aComplete
.Len() ) )
1219 pImpEditEngine
->SetAutoCompleteText( aComplete
, sal_False
);
1220 Point aPos
= pImpEditEngine
->PaMtoEditCursor( aCurSel
.Max() ).TopLeft();
1221 aPos
= pEditView
->pImpEditView
->GetWindowPos( aPos
);
1222 aPos
= pEditView
->pImpEditView
->GetWindow()->LogicToPixel( aPos
);
1223 aPos
= pEditView
->GetWindow()->OutputToScreenPixel( aPos
);
1225 Help::ShowQuickHelp( pEditView
->GetWindow(), Rectangle( aPos
, Size( 1, 1 ) ), aComplete
, QUICKHELP_BOTTOM
|QUICKHELP_LEFT
);
1230 bModified
= sal_True
;
1238 pEditView
->pImpEditView
->SetEditSelection( aCurSel
);
1239 pImpEditEngine
->UpdateSelections();
1241 if ( ( !IsVertical() && ( nCode
!= KEY_UP
) && ( nCode
!= KEY_DOWN
) ) ||
1242 ( IsVertical() && ( nCode
!= KEY_LEFT
) && ( nCode
!= KEY_RIGHT
) ))
1244 pEditView
->pImpEditView
->nTravelXPos
= TRAVEL_X_DONTKNOW
;
1247 if ( /* ( nCode != KEY_HOME ) && ( nCode != KEY_END ) && */
1248 ( !IsVertical() && ( nCode
!= KEY_LEFT
) && ( nCode
!= KEY_RIGHT
) ) ||
1249 ( IsVertical() && ( nCode
!= KEY_UP
) && ( nCode
!= KEY_DOWN
) ))
1251 pEditView
->pImpEditView
->SetCursorBidiLevel( 0xFFFF );
1254 if ( bSetCursorFlags
)
1255 pEditView
->pImpEditView
->nExtraCursorFlags
= nNewCursorFlags
;
1259 DBG_ASSERT( !bReadOnly
, "ReadOnly but modified???" );
1260 // Idle-Formatter nur, wenn AnyInput.
1261 if ( bAllowIdle
&& pImpEditEngine
->GetStatus().UseIdleFormatter()
1262 && Application::AnyInput( INPUT_KEYBOARD
) )
1263 pImpEditEngine
->IdleFormatAndUpdate( pEditView
);
1265 pImpEditEngine
->FormatAndUpdate( pEditView
);
1269 sal_Bool bGotoCursor
= pEditView
->pImpEditView
->DoAutoScroll();
1270 pEditView
->pImpEditView
->ShowCursor( bGotoCursor
, sal_True
);
1271 pImpEditEngine
->CallStatusHdl();
1274 if ( GetNotifyHdl().IsSet() )
1276 EENotify
aNotify( EE_NOTIFY_INPUT_END
);
1277 aNotify
.pEditEngine
= this;
1278 pImpEditEngine
->CallNotify( aNotify
);
1281 pImpEditEngine
->LeaveBlockNotifications();
1286 sal_uInt32
EditEngine::GetTextHeight() const
1288 DBG_CHKTHIS( EditEngine
, 0 );
1290 if ( !pImpEditEngine
->IsFormatted() )
1291 pImpEditEngine
->FormatDoc();
1293 sal_uInt32 nHeight
= !IsVertical() ? pImpEditEngine
->GetTextHeight() : pImpEditEngine
->CalcTextWidth( TRUE
);
1297 sal_uInt32
EditEngine::CalcTextWidth()
1299 DBG_CHKTHIS( EditEngine
, 0 );
1301 if ( !pImpEditEngine
->IsFormatted() )
1302 pImpEditEngine
->FormatDoc();
1304 sal_uInt32 nWidth
= !IsVertical() ? pImpEditEngine
->CalcTextWidth( TRUE
) : pImpEditEngine
->GetTextHeight();
1308 void EditEngine::SetUpdateMode( sal_Bool bUpdate
)
1310 DBG_CHKTHIS( EditEngine
, 0 );
1311 pImpEditEngine
->SetUpdateMode( bUpdate
);
1312 if ( pImpEditEngine
->pActiveView
)
1313 pImpEditEngine
->pActiveView
->ShowCursor( sal_False
, sal_False
);
1316 sal_Bool
EditEngine::GetUpdateMode() const
1318 DBG_CHKTHIS( EditEngine
, 0 );
1319 return pImpEditEngine
->GetUpdateMode();
1322 void EditEngine::Clear()
1324 DBG_CHKTHIS( EditEngine
, 0 );
1325 pImpEditEngine
->Clear();
1328 void EditEngine::SetText( const XubString
& rText
)
1330 DBG_CHKTHIS( EditEngine
, 0 );
1331 pImpEditEngine
->SetText( rText
);
1333 pImpEditEngine
->FormatAndUpdate();
1336 ULONG
EditEngine::Read( SvStream
& rInput
, const String
& rBaseURL
, EETextFormat eFormat
, SvKeyValueIterator
* pHTTPHeaderAttrs
/* = NULL */ )
1338 DBG_CHKTHIS( EditEngine
, 0 );
1339 sal_Bool bUndoEnabled
= pImpEditEngine
->IsUndoEnabled();
1340 pImpEditEngine
->EnableUndo( sal_False
);
1341 pImpEditEngine
->SetText( XubString() );
1342 EditPaM
aPaM( pImpEditEngine
->GetEditDoc().GetStartPaM() );
1343 pImpEditEngine
->Read( rInput
, rBaseURL
, eFormat
, EditSelection( aPaM
, aPaM
), pHTTPHeaderAttrs
);
1344 pImpEditEngine
->EnableUndo( bUndoEnabled
);
1345 return rInput
.GetError();
1348 ULONG
EditEngine::Write( SvStream
& rOutput
, EETextFormat eFormat
)
1350 DBG_CHKTHIS( EditEngine
, 0 );
1351 EditPaM
aStartPaM( pImpEditEngine
->GetEditDoc().GetStartPaM() );
1352 EditPaM
aEndPaM( pImpEditEngine
->GetEditDoc().GetEndPaM() );
1353 pImpEditEngine
->Write( rOutput
, eFormat
, EditSelection( aStartPaM
, aEndPaM
) );
1354 return rOutput
.GetError();
1357 EditTextObject
* EditEngine::CreateTextObject()
1359 DBG_CHKTHIS( EditEngine
, 0 );
1360 return pImpEditEngine
->CreateTextObject();
1363 EditTextObject
* EditEngine::CreateTextObject( const ESelection
& rESelection
)
1365 DBG_CHKTHIS( EditEngine
, 0 );
1366 EditSelection
aSel( pImpEditEngine
->CreateSel( rESelection
) );
1367 return pImpEditEngine
->CreateTextObject( aSel
);
1370 void EditEngine::SetText( const EditTextObject
& rTextObject
)
1372 DBG_CHKTHIS( EditEngine
, 0 );
1373 pImpEditEngine
->EnterBlockNotifications();
1374 pImpEditEngine
->SetText( rTextObject
);
1375 pImpEditEngine
->FormatAndUpdate();
1376 pImpEditEngine
->LeaveBlockNotifications();
1379 void EditEngine::ShowParagraph( sal_uInt16 nParagraph
, sal_Bool bShow
)
1381 DBG_CHKTHIS( EditEngine
, 0 );
1382 pImpEditEngine
->ShowParagraph( nParagraph
, bShow
);
1385 sal_Bool
EditEngine::IsParagraphVisible( sal_uInt16 nParagraph
)
1387 DBG_CHKTHIS( EditEngine
, 0 );
1388 return pImpEditEngine
->IsParagraphVisible( nParagraph
);
1391 void EditEngine::SetNotifyHdl( const Link
& rLink
)
1393 DBG_CHKTHIS( EditEngine
, 0 );
1394 pImpEditEngine
->SetNotifyHdl( rLink
);
1397 Link
EditEngine::GetNotifyHdl() const
1399 DBG_CHKTHIS( EditEngine
, 0 );
1400 return pImpEditEngine
->GetNotifyHdl();
1403 void EditEngine::SetStatusEventHdl( const Link
& rLink
)
1405 DBG_CHKTHIS( EditEngine
, 0 );
1406 pImpEditEngine
->SetStatusEventHdl( rLink
);
1409 Link
EditEngine::GetStatusEventHdl() const
1411 DBG_CHKTHIS( EditEngine
, 0 );
1412 return pImpEditEngine
->GetStatusEventHdl();
1415 void EditEngine::SetImportHdl( const Link
& rLink
)
1417 DBG_CHKTHIS( EditEngine
, 0 );
1418 pImpEditEngine
->aImportHdl
= rLink
;
1421 Link
EditEngine::GetImportHdl() const
1423 DBG_CHKTHIS( EditEngine
, 0 );
1424 return pImpEditEngine
->aImportHdl
;
1427 void EditEngine::SetBeginMovingParagraphsHdl( const Link
& rLink
)
1429 DBG_CHKTHIS( EditEngine
, 0 );
1430 pImpEditEngine
->aBeginMovingParagraphsHdl
= rLink
;
1433 void EditEngine::SetEndMovingParagraphsHdl( const Link
& rLink
)
1435 DBG_CHKTHIS( EditEngine
, 0 );
1436 pImpEditEngine
->aEndMovingParagraphsHdl
= rLink
;
1439 void EditEngine::SetBeginPasteOrDropHdl( const Link
& rLink
)
1441 DBG_CHKTHIS( EditEngine
, 0 );
1443 pImpEditEngine
->aBeginPasteOrDropHdl
= rLink
;
1446 void EditEngine::SetEndPasteOrDropHdl( const Link
& rLink
)
1448 DBG_CHKTHIS( EditEngine
, 0 );
1449 pImpEditEngine
->aEndPasteOrDropHdl
= rLink
;
1452 EditTextObject
* EditEngine::CreateTextObject( sal_uInt16 nPara
, sal_uInt16 nParas
)
1454 DBG_CHKTHIS( EditEngine
, 0 );
1455 DBG_ASSERT( nPara
< pImpEditEngine
->GetEditDoc().Count(), "CreateTextObject: Startpara out of Range" );
1456 DBG_ASSERT( nPara
+nParas
-1 < pImpEditEngine
->GetEditDoc().Count(), "CreateTextObject: Endpara out of Range" );
1458 ContentNode
* pStartNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
1459 ContentNode
* pEndNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
+nParas
-1 );
1460 DBG_ASSERT( pStartNode
, "Start-Absatz existiert nicht: CreateTextObject" );
1461 DBG_ASSERT( pEndNode
, "End-Absatz existiert nicht: CreateTextObject" );
1463 if ( pStartNode
&& pEndNode
)
1465 EditSelection aTmpSel
;
1466 aTmpSel
.Min() = EditPaM( pStartNode
, 0 );
1467 aTmpSel
.Max() = EditPaM( pEndNode
, pEndNode
->Len() );
1468 return pImpEditEngine
->CreateTextObject( aTmpSel
);
1473 void EditEngine::RemoveParagraph( sal_uInt16 nPara
)
1475 DBG_CHKTHIS( EditEngine
, 0 );
1476 DBG_ASSERT( pImpEditEngine
->GetEditDoc().Count() > 1, "Der erste Absatz darf nicht geloescht werden!" );
1477 if( pImpEditEngine
->GetEditDoc().Count() <= 1 )
1480 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
1481 ParaPortion
* pPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nPara
);
1482 DBG_ASSERT( pPortion
&& pNode
, "Absatz nicht gefunden: RemoveParagraph" );
1483 if ( pNode
&& pPortion
)
1485 // Keine Undokappselung noetig.
1486 pImpEditEngine
->ImpRemoveParagraph( nPara
);
1487 pImpEditEngine
->InvalidateFromParagraph( nPara
);
1488 pImpEditEngine
->UpdateSelections();
1489 pImpEditEngine
->FormatAndUpdate();
1493 sal_uInt16
EditEngine::GetTextLen( sal_uInt16 nPara
) const
1495 DBG_CHKTHIS( EditEngine
, 0 );
1496 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
1497 DBG_ASSERT( pNode
, "Absatz nicht gefunden: GetTextLen" );
1499 return pNode
->Len();
1503 XubString
EditEngine::GetText( sal_uInt16 nPara
) const
1505 DBG_CHKTHIS( EditEngine
, 0 );
1507 if ( nPara
< pImpEditEngine
->GetEditDoc().Count() )
1508 aStr
= pImpEditEngine
->GetEditDoc().GetParaAsString( nPara
);
1512 void EditEngine::SetModifyHdl( const Link
& rLink
)
1514 DBG_CHKTHIS( EditEngine
, 0 );
1515 pImpEditEngine
->SetModifyHdl( rLink
);
1518 Link
EditEngine::GetModifyHdl() const
1520 DBG_CHKTHIS( EditEngine
, 0 );
1521 return pImpEditEngine
->GetModifyHdl();
1525 void EditEngine::ClearModifyFlag()
1527 DBG_CHKTHIS( EditEngine
, 0 );
1528 pImpEditEngine
->SetModifyFlag( sal_False
);
1531 void EditEngine::SetModified()
1533 DBG_CHKTHIS( EditEngine
, 0 );
1534 pImpEditEngine
->SetModifyFlag( sal_True
);
1537 sal_Bool
EditEngine::IsModified() const
1539 DBG_CHKTHIS( EditEngine
, 0 );
1540 return pImpEditEngine
->IsModified();
1543 sal_Bool
EditEngine::IsInSelectionMode() const
1545 DBG_CHKTHIS( EditEngine
, 0 );
1546 return ( pImpEditEngine
->IsInSelectionMode() ||
1547 pImpEditEngine
->GetSelEngine().IsInSelection() );
1550 void EditEngine::StopSelectionMode()
1552 DBG_CHKTHIS( EditEngine
, 0 );
1553 pImpEditEngine
->StopSelectionMode();
1556 void EditEngine::InsertParagraph( sal_uInt16 nPara
, const EditTextObject
& rTxtObj
)
1558 DBG_CHKTHIS( EditEngine
, 0 );
1559 if ( nPara
> GetParagraphCount() )
1561 DBG_ASSERTWARNING( nPara
== USHRT_MAX
, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " );
1562 nPara
= GetParagraphCount();
1565 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1567 // Keine Undoklammerung noetig.
1568 EditPaM
aPaM( pImpEditEngine
->InsertParagraph( nPara
) );
1569 // Bei einem InsertParagraph von aussen sollen keine Harten
1570 // Attribute uebernommen werden !
1571 pImpEditEngine
->RemoveCharAttribs( nPara
);
1572 pImpEditEngine
->InsertText( rTxtObj
, EditSelection( aPaM
, aPaM
) );
1574 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1576 pImpEditEngine
->FormatAndUpdate();
1579 void EditEngine::InsertParagraph( sal_uInt16 nPara
, const XubString
& rTxt
)
1581 DBG_CHKTHIS( EditEngine
, 0 );
1582 if ( nPara
> GetParagraphCount() )
1584 DBG_ASSERTWARNING( nPara
== USHRT_MAX
, "AbsatzNr zu Gro???, aber nicht LIST_APPEND! " );
1585 nPara
= GetParagraphCount();
1588 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1589 EditPaM
aPaM( pImpEditEngine
->InsertParagraph( nPara
) );
1590 // Bei einem InsertParagraph von aussen sollen keine Harten
1591 // Attribute uebernommen werden !
1592 pImpEditEngine
->RemoveCharAttribs( nPara
);
1593 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1594 pImpEditEngine
->ImpInsertText( EditSelection( aPaM
, aPaM
), rTxt
);
1595 pImpEditEngine
->FormatAndUpdate();
1598 void EditEngine::SetText( sal_uInt16 nPara
, const EditTextObject
& rTxtObj
)
1600 DBG_CHKTHIS( EditEngine
, 0 );
1601 EditSelection
* pSel
= pImpEditEngine
->SelectParagraph( nPara
);
1604 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1605 pImpEditEngine
->InsertText( rTxtObj
, *pSel
);
1606 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1607 pImpEditEngine
->FormatAndUpdate();
1612 void EditEngine::SetText( sal_uInt16 nPara
, const XubString
& rTxt
)
1614 DBG_CHKTHIS( EditEngine
, 0 );
1615 EditSelection
* pSel
= pImpEditEngine
->SelectParagraph( nPara
);
1618 pImpEditEngine
->UndoActionStart( EDITUNDO_INSERT
);
1619 pImpEditEngine
->ImpInsertText( *pSel
, rTxt
);
1620 pImpEditEngine
->UndoActionEnd( EDITUNDO_INSERT
);
1621 pImpEditEngine
->FormatAndUpdate();
1626 void EditEngine::SetParaAttribs( sal_uInt16 nPara
, const SfxItemSet
& rSet
)
1628 DBG_CHKTHIS( EditEngine
, 0 );
1629 // Keine Undoklammerung noetig.
1630 pImpEditEngine
->SetParaAttribs( nPara
, rSet
);
1631 pImpEditEngine
->FormatAndUpdate();
1634 const SfxItemSet
& EditEngine::GetParaAttribs( sal_uInt16 nPara
) const
1636 DBG_CHKTHIS( EditEngine
, 0 );
1637 return pImpEditEngine
->GetParaAttribs( nPara
);
1640 sal_Bool
EditEngine::HasParaAttrib( sal_uInt16 nPara
, sal_uInt16 nWhich
) const
1642 DBG_CHKTHIS( EditEngine
, 0 );
1643 return pImpEditEngine
->HasParaAttrib( nPara
, nWhich
);
1646 const SfxPoolItem
& EditEngine::GetParaAttrib( sal_uInt16 nPara
, sal_uInt16 nWhich
)
1648 DBG_CHKTHIS( EditEngine
, 0 );
1649 return pImpEditEngine
->GetParaAttrib( nPara
, nWhich
);
1652 void EditEngine::GetCharAttribs( sal_uInt16 nPara
, EECharAttribArray
& rLst
) const
1654 DBG_CHKTHIS( EditEngine
, 0 );
1655 pImpEditEngine
->GetCharAttribs( nPara
, rLst
);
1658 SfxItemSet
EditEngine::GetAttribs( const ESelection
& rSel
, BOOL bOnlyHardAttrib
)
1660 DBG_CHKTHIS( EditEngine
, 0 );
1661 EditSelection
aSel( pImpEditEngine
->
1662 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
1663 return pImpEditEngine
->GetAttribs( aSel
, bOnlyHardAttrib
);
1666 SfxItemSet
EditEngine::GetAttribs( USHORT nPara
, USHORT nStart
, USHORT nEnd
, sal_uInt8 nFlags
) const
1668 DBG_CHKTHIS( EditEngine
, 0 );
1669 return pImpEditEngine
->GetAttribs( nPara
, nStart
, nEnd
, nFlags
);
1672 void EditEngine::RemoveAttribs( const ESelection
& rSelection
, sal_Bool bRemoveParaAttribs
, sal_uInt16 nWhich
)
1674 DBG_CHKTHIS( EditEngine
, 0 );
1676 pImpEditEngine
->UndoActionStart( EDITUNDO_RESETATTRIBS
);
1677 EditSelection
aSel( pImpEditEngine
->ConvertSelection( rSelection
.nStartPara
, rSelection
.nStartPos
, rSelection
.nEndPara
, rSelection
.nEndPos
) );
1678 pImpEditEngine
->RemoveCharAttribs( aSel
, bRemoveParaAttribs
, nWhich
);
1679 pImpEditEngine
->UndoActionEnd( EDITUNDO_RESETATTRIBS
);
1680 pImpEditEngine
->FormatAndUpdate();
1683 // MT: Can be removed after 6.x?
1684 Font
EditEngine::GetStandardFont( sal_uInt16 nPara
)
1686 DBG_CHKTHIS( EditEngine
, 0 );
1687 return GetStandardSvxFont( nPara
);
1690 SvxFont
EditEngine::GetStandardSvxFont( sal_uInt16 nPara
)
1692 DBG_CHKTHIS( EditEngine
, 0 );
1693 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
1694 return pNode
->GetCharAttribs().GetDefFont();
1697 void EditEngine::StripPortions()
1699 DBG_CHKTHIS( EditEngine
, 0 );
1700 VirtualDevice aTmpDev
;
1701 Rectangle
aBigRec( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) );
1704 aBigRec
.Right() = 0;
1705 aBigRec
.Left() = -0x7FFFFFFF;
1707 pImpEditEngine
->Paint( &aTmpDev
, aBigRec
, Point(), sal_True
);
1710 void EditEngine::GetPortions( sal_uInt16 nPara
, SvUShorts
& rList
)
1712 if ( !pImpEditEngine
->IsFormatted() )
1713 pImpEditEngine
->FormatFullDoc();
1715 ParaPortion
* pParaPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nPara
);
1718 sal_uInt16 nEnd
= 0;
1719 sal_uInt16 nTextPortions
= pParaPortion
->GetTextPortions().Count();
1720 for ( sal_uInt16 n
= 0; n
< nTextPortions
; n
++ )
1722 nEnd
= nEnd
+ pParaPortion
->GetTextPortions()[n
]->GetLen();
1723 rList
.Insert( nEnd
, rList
.Count() );
1728 void EditEngine::SetFlatMode( sal_Bool bFlat
)
1730 DBG_CHKTHIS( EditEngine
, 0 );
1731 pImpEditEngine
->SetFlatMode( bFlat
);
1734 sal_Bool
EditEngine::IsFlatMode() const
1736 DBG_CHKTHIS( EditEngine
, 0 );
1737 return !( pImpEditEngine
->aStatus
.UseCharAttribs() );
1740 void EditEngine::SetControlWord( sal_uInt32 nWord
)
1742 DBG_CHKTHIS( EditEngine
, 0 );
1744 if ( nWord
!= pImpEditEngine
->aStatus
.GetControlWord() )
1746 sal_uInt32 nPrev
= pImpEditEngine
->aStatus
.GetControlWord();
1747 pImpEditEngine
->aStatus
.GetControlWord() = nWord
;
1749 sal_uInt32 nChanges
= nPrev
^ nWord
;
1750 if ( pImpEditEngine
->IsFormatted() )
1752 // ggf. neu formatieren:
1753 if ( ( nChanges
& EE_CNTRL_USECHARATTRIBS
) ||
1754 ( nChanges
& EE_CNTRL_USEPARAATTRIBS
) ||
1755 ( nChanges
& EE_CNTRL_ONECHARPERLINE
) ||
1756 ( nChanges
& EE_CNTRL_STRETCHING
) ||
1757 ( nChanges
& EE_CNTRL_OUTLINER
) ||
1758 ( nChanges
& EE_CNTRL_NOCOLORS
) ||
1759 ( nChanges
& EE_CNTRL_OUTLINER2
) )
1761 if ( ( nChanges
& EE_CNTRL_USECHARATTRIBS
) ||
1762 ( nChanges
& EE_CNTRL_USEPARAATTRIBS
) )
1764 sal_Bool bUseCharAttribs
= ( nWord
& EE_CNTRL_USECHARATTRIBS
) ? sal_True
: sal_False
;
1765 pImpEditEngine
->GetEditDoc().CreateDefFont( bUseCharAttribs
);
1768 pImpEditEngine
->FormatFullDoc();
1769 pImpEditEngine
->UpdateViews( pImpEditEngine
->GetActiveView() );
1773 sal_Bool bSpellingChanged
= nChanges
& EE_CNTRL_ONLINESPELLING
? sal_True
: sal_False
;
1775 if ( bSpellingChanged
)
1777 pImpEditEngine
->StopOnlineSpellTimer();
1778 if ( bSpellingChanged
&& ( nWord
& EE_CNTRL_ONLINESPELLING
) )
1780 // WrongListen anlegen, Timer starten...
1781 sal_uInt16 nNodes
= pImpEditEngine
->GetEditDoc().Count();
1782 for ( sal_uInt16 n
= 0; n
< nNodes
; n
++ )
1784 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().GetObject( n
);
1785 pNode
->CreateWrongList();
1787 pImpEditEngine
->StartOnlineSpellTimer();
1792 sal_uInt16 nNodes
= pImpEditEngine
->GetEditDoc().Count();
1793 for ( sal_uInt16 n
= 0; n
< nNodes
; n
++ )
1795 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().GetObject( n
);
1796 ParaPortion
* pPortion
= pImpEditEngine
->GetParaPortions().GetObject( n
);
1797 sal_Bool bWrongs
= ( bSpellingChanged
|| ( nWord
& EE_CNTRL_ONLINESPELLING
) ) ? pNode
->GetWrongList()->HasWrongs() : sal_False
;
1798 if ( bSpellingChanged
) // Also aus
1799 pNode
->DestroyWrongList(); // => vorm Paint weghaun.
1802 pImpEditEngine
->aInvalidRec
.Left() = 0;
1803 pImpEditEngine
->aInvalidRec
.Right() = pImpEditEngine
->GetPaperSize().Width();
1804 pImpEditEngine
->aInvalidRec
.Top() = nY
+1;
1805 pImpEditEngine
->aInvalidRec
.Bottom() = nY
+pPortion
->GetHeight()-1;
1806 pImpEditEngine
->UpdateViews( pImpEditEngine
->pActiveView
);
1808 nY
+= pPortion
->GetHeight();
1815 sal_uInt32
EditEngine::GetControlWord() const
1817 DBG_CHKTHIS( EditEngine
, 0 );
1818 return pImpEditEngine
->aStatus
.GetControlWord();
1821 long EditEngine::GetFirstLineStartX( sal_uInt16 nParagraph
)
1823 DBG_CHKTHIS( EditEngine
, 0 );
1826 ParaPortion
* pPPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nParagraph
);
1829 DBG_ASSERT( pImpEditEngine
->IsFormatted() || !pImpEditEngine
->IsFormatting(), "GetFirstLineStartX: Doc not formatted - unable to format!" );
1830 if ( !pImpEditEngine
->IsFormatted() )
1831 pImpEditEngine
->FormatDoc();
1832 EditLine
* pFirstLine
= pPPortion
->GetLines()[0];
1833 nX
= pFirstLine
->GetStartPosX();
1838 Point
EditEngine::GetDocPos( const Point
& rPaperPos
) const
1840 Point
aDocPos( rPaperPos
);
1843 aDocPos
.X() = rPaperPos
.Y();
1844 aDocPos
.Y() = GetPaperSize().Width() - rPaperPos
.X();
1849 Point
EditEngine::GetDocPosTopLeft( sal_uInt16 nParagraph
)
1851 DBG_CHKTHIS( EditEngine
, 0 );
1852 ParaPortion
* pPPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nParagraph
);
1853 DBG_ASSERT( pPPortion
, "Absatz nicht gefunden: GetWindowPosTopLeft" );
1857 // Falls jemand mit einer leeren Engine ein GetLineHeight() macht.
1858 DBG_ASSERT( pImpEditEngine
->IsFormatted() || !pImpEditEngine
->IsFormatting(), "GetDocPosTopLeft: Doc not formatted - unable to format!" );
1859 if ( !pImpEditEngine
->IsFormatted() )
1860 pImpEditEngine
->FormatAndUpdate();
1861 if ( pPPortion
->GetLines().Count() )
1863 // So richtiger, falls grosses Bullet.
1864 EditLine
* pFirstLine
= pPPortion
->GetLines()[0];
1865 aPoint
.X() = pFirstLine
->GetStartPosX();
1869 const SvxLRSpaceItem
& rLRItem
= pImpEditEngine
->GetLRSpaceItem( pPPortion
->GetNode() );
1870 // TL_NF_LR aPoint.X() = pImpEditEngine->GetXValue( (short)(rLRItem.GetTxtLeft() + rLRItem.GetTxtFirstLineOfst()) );
1871 sal_Int32 nSpaceBefore
= 0;
1872 pImpEditEngine
->GetSpaceBeforeAndMinLabelWidth( pPPortion
->GetNode(), &nSpaceBefore
);
1873 short nX
= (short)(rLRItem
.GetTxtLeft()
1874 + rLRItem
.GetTxtFirstLineOfst()
1876 aPoint
.X() = pImpEditEngine
->GetXValue( nX
1879 aPoint
.Y() = pImpEditEngine
->GetParaPortions().GetYOffset( pPPortion
);
1884 const SvxNumberFormat
* EditEngine::GetNumberFormat( USHORT nPara
) const
1886 // derived objects may overload this function to give access to
1887 // bullet information (see Outliner)
1892 BOOL
EditEngine::IsRightToLeft( USHORT nPara
) const
1894 DBG_CHKTHIS( EditEngine
, 0 );
1895 return pImpEditEngine
->IsRightToLeft( nPara
);
1898 sal_Bool
EditEngine::IsTextPos( const Point
& rPaperPos
, sal_uInt16 nBorder
)
1900 DBG_CHKTHIS( EditEngine
, 0 );
1902 if ( !pImpEditEngine
->IsFormatted() )
1903 pImpEditEngine
->FormatDoc();
1905 sal_Bool bTextPos
= sal_False
;
1906 // #90780# take unrotated positions for calculation here
1907 Point aDocPos
= GetDocPos( rPaperPos
);
1909 if ( ( aDocPos
.Y() > 0 ) && ( aDocPos
.Y() < (long)pImpEditEngine
->GetTextHeight() ) )
1911 EditPaM aPaM
= pImpEditEngine
->GetPaM( aDocPos
, sal_False
);
1912 if ( aPaM
.GetNode() )
1914 ParaPortion
* pParaPortion
= pImpEditEngine
->FindParaPortion( aPaM
.GetNode() );
1915 DBG_ASSERT( pParaPortion
, "ParaPortion?" );
1917 sal_uInt16 nLine
= pParaPortion
->GetLineNumber( aPaM
.GetIndex() );
1918 EditLine
* pLine
= pParaPortion
->GetLines().GetObject( nLine
);
1919 Range aLineXPosStartEnd
= pImpEditEngine
->GetLineXPosStartEnd( pParaPortion
, pLine
);
1920 if ( ( aDocPos
.X() >= aLineXPosStartEnd
.Min() - nBorder
) &&
1921 ( aDocPos
.X() <= aLineXPosStartEnd
.Max() + nBorder
) )
1923 bTextPos
= sal_True
;
1930 void EditEngine::SetEditTextObjectPool( SfxItemPool
* pPool
)
1932 DBG_CHKTHIS( EditEngine
, 0 );
1933 pImpEditEngine
->SetEditTextObjectPool( pPool
);
1936 SfxItemPool
* EditEngine::GetEditTextObjectPool() const
1938 DBG_CHKTHIS( EditEngine
, 0 );
1939 return pImpEditEngine
->GetEditTextObjectPool();
1942 void EditEngine::QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
)
1944 DBG_CHKTHIS( EditEngine
, 0 );
1946 EditSelection
aSel( pImpEditEngine
->
1947 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
1949 pImpEditEngine
->SetAttribs( aSel
, rSet
);
1952 void EditEngine::QuickMarkInvalid( const ESelection
& rSel
)
1954 DBG_CHKTHIS( EditEngine
, 0 );
1955 DBG_ASSERT( rSel
.nStartPara
< pImpEditEngine
->GetEditDoc().Count(), "MarkInvalid: Start out of Range!" );
1956 DBG_ASSERT( rSel
.nEndPara
< pImpEditEngine
->GetEditDoc().Count(), "MarkInvalid: End out of Range!" );
1957 for ( sal_uInt16 nPara
= rSel
.nStartPara
; nPara
<= rSel
.nEndPara
; nPara
++ )
1959 ParaPortion
* pPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nPara
);
1961 pPortion
->MarkSelectionInvalid( 0, pPortion
->GetNode()->Len() );
1965 void EditEngine::QuickInsertText( const XubString
& rText
, const ESelection
& rSel
)
1967 DBG_CHKTHIS( EditEngine
, 0 );
1969 EditSelection
aSel( pImpEditEngine
->
1970 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
1972 pImpEditEngine
->ImpInsertText( aSel
, rText
);
1975 void EditEngine::QuickDelete( const ESelection
& rSel
)
1977 DBG_CHKTHIS( EditEngine
, 0 );
1979 EditSelection
aSel( pImpEditEngine
->
1980 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
1982 pImpEditEngine
->ImpDeleteSelection( aSel
);
1985 void EditEngine::QuickMarkToBeRepainted( sal_uInt16 nPara
)
1987 DBG_CHKTHIS( EditEngine
, 0 );
1988 ParaPortion
* pPortion
= pImpEditEngine
->GetParaPortions().SaveGetObject( nPara
);
1990 pPortion
->SetMustRepaint( sal_True
);
1993 void EditEngine::QuickInsertLineBreak( const ESelection
& rSel
)
1995 DBG_CHKTHIS( EditEngine
, 0 );
1997 EditSelection
aSel( pImpEditEngine
->
1998 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
2000 pImpEditEngine
->InsertLineBreak( aSel
);
2003 void EditEngine::QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
)
2005 DBG_CHKTHIS( EditEngine
, 0 );
2007 EditSelection
aSel( pImpEditEngine
->
2008 ConvertSelection( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPara
, rSel
.nEndPos
) );
2010 pImpEditEngine
->ImpInsertFeature( aSel
, rFld
);
2013 void EditEngine::QuickFormatDoc( sal_Bool bFull
)
2015 DBG_CHKTHIS( EditEngine
, 0 );
2017 pImpEditEngine
->FormatFullDoc();
2019 pImpEditEngine
->FormatDoc();
2021 // #111072# Don't pass active view, maybe selection is not updated yet...
2022 pImpEditEngine
->UpdateViews( NULL
);
2025 void EditEngine::QuickRemoveCharAttribs( sal_uInt16 nPara
, sal_uInt16 nWhich
)
2027 DBG_CHKTHIS( EditEngine
, 0 );
2028 pImpEditEngine
->RemoveCharAttribs( nPara
, nWhich
);
2031 void EditEngine::SetStyleSheet( sal_uInt16 nPara
, SfxStyleSheet
* pStyle
)
2033 DBG_CHKTHIS( EditEngine
, 0 );
2034 pImpEditEngine
->SetStyleSheet( nPara
, pStyle
);
2037 SfxStyleSheet
* EditEngine::GetStyleSheet( sal_uInt16 nPara
) const
2039 DBG_CHKTHIS( EditEngine
, 0 );
2040 return pImpEditEngine
->GetStyleSheet( nPara
);
2043 void EditEngine::SetStyleSheetPool( SfxStyleSheetPool
* pSPool
)
2045 DBG_CHKTHIS( EditEngine
, 0 );
2046 pImpEditEngine
->SetStyleSheetPool( pSPool
);
2049 SfxStyleSheetPool
* EditEngine::GetStyleSheetPool()
2051 DBG_CHKTHIS( EditEngine
, 0 );
2052 return pImpEditEngine
->GetStyleSheetPool();
2055 void EditEngine::SetWordDelimiters( const XubString
& rDelimiters
)
2057 DBG_CHKTHIS( EditEngine
, 0 );
2058 pImpEditEngine
->aWordDelimiters
= rDelimiters
;
2059 if ( pImpEditEngine
->aWordDelimiters
.Search( CH_FEATURE
) == STRING_NOTFOUND
)
2060 pImpEditEngine
->aWordDelimiters
.Insert( CH_FEATURE
);
2063 XubString
EditEngine::GetWordDelimiters() const
2065 DBG_CHKTHIS( EditEngine
, 0 );
2066 return pImpEditEngine
->aWordDelimiters
;
2069 void EditEngine::SetGroupChars( const XubString
& rChars
)
2071 DBG_CHKTHIS( EditEngine
, 0 );
2072 DBG_ASSERT( ( rChars
.Len() % 2 ) == 0, "SetGroupChars: Ungerade Anzahl!" );
2073 pImpEditEngine
->aGroupChars
= rChars
;
2076 XubString
EditEngine::GetGroupChars() const
2078 DBG_CHKTHIS( EditEngine
, 0 );
2079 return pImpEditEngine
->aGroupChars
;
2082 void EditEngine::EnablePasteSpecial( sal_Bool bEnable
)
2084 DBG_CHKTHIS( EditEngine
, 0 );
2086 pImpEditEngine
->GetStatus().TurnOnFlags( EE_CNTRL_PASTESPECIAL
);
2088 pImpEditEngine
->GetStatus().TurnOffFlags( EE_CNTRL_PASTESPECIAL
);
2091 sal_Bool
EditEngine::IsPasteSpecialEnabled() const
2093 DBG_CHKTHIS( EditEngine
, 0 );
2094 return pImpEditEngine
->GetStatus().AllowPasteSpecial();
2097 void EditEngine::EnableIdleFormatter( sal_Bool bEnable
)
2099 DBG_CHKTHIS( EditEngine
, 0 );
2101 pImpEditEngine
->GetStatus().TurnOnFlags( EE_CNTRL_DOIDLEFORMAT
);
2103 pImpEditEngine
->GetStatus().TurnOffFlags( EE_CNTRL_DOIDLEFORMAT
);
2106 sal_Bool
EditEngine::IsIdleFormatterEnabled() const
2108 DBG_CHKTHIS( EditEngine
, 0 );
2109 return pImpEditEngine
->GetStatus().UseIdleFormatter();
2112 void EditEngine::EraseVirtualDevice()
2114 DBG_CHKTHIS( EditEngine
, 0 );
2115 pImpEditEngine
->EraseVirtualDevice();
2118 void EditEngine::SetSpeller( Reference
< XSpellChecker1
> &xSpeller
)
2120 DBG_CHKTHIS( EditEngine
, 0 );
2121 pImpEditEngine
->SetSpeller( xSpeller
);
2123 Reference
< XSpellChecker1
> EditEngine::GetSpeller()
2125 DBG_CHKTHIS( EditEngine
, 0 );
2126 return pImpEditEngine
->GetSpeller();
2128 Reference
< XHyphenator
> EditEngine::GetHyphenator() const
2130 DBG_CHKTHIS( EditEngine
, 0 );
2131 return pImpEditEngine
->GetHyphenator();
2134 void EditEngine::SetHyphenator( Reference
< XHyphenator
> & xHyph
)
2136 DBG_CHKTHIS( EditEngine
, 0 );
2137 pImpEditEngine
->SetHyphenator( xHyph
);
2140 void EditEngine::SetForbiddenCharsTable( vos::ORef
<SvxForbiddenCharactersTable
> xForbiddenChars
)
2142 DBG_CHKTHIS( EditEngine
, 0 );
2143 pImpEditEngine
->SetForbiddenCharsTable( xForbiddenChars
);
2146 vos::ORef
<SvxForbiddenCharactersTable
> EditEngine::GetForbiddenCharsTable() const
2148 DBG_CHKTHIS( EditEngine
, 0 );
2149 return pImpEditEngine
->GetForbiddenCharsTable( FALSE
);
2153 void EditEngine::SetDefaultLanguage( LanguageType eLang
)
2155 DBG_CHKTHIS( EditEngine
, 0 );
2156 pImpEditEngine
->SetDefaultLanguage( eLang
);
2159 LanguageType
EditEngine::GetDefaultLanguage() const
2161 DBG_CHKTHIS( EditEngine
, 0 );
2162 return pImpEditEngine
->GetDefaultLanguage();
2165 sal_Bool __EXPORT
EditEngine::SpellNextDocument()
2167 DBG_CHKTHIS( EditEngine
, 0 );
2171 EESpellState
EditEngine::HasSpellErrors()
2173 DBG_CHKTHIS( EditEngine
, 0 );
2174 if ( !pImpEditEngine
->GetSpeller().is() )
2175 return EE_SPELL_NOSPELLER
;
2177 return pImpEditEngine
->HasSpellErrors();
2179 /*-- 13.10.2003 16:56:23---------------------------------------------------
2181 -----------------------------------------------------------------------*/
2182 void EditEngine::StartSpelling(EditView
& rEditView
, sal_Bool bMultipleDoc
)
2184 DBG_CHKTHIS( EditEngine
, 0 );
2185 pImpEditEngine
->StartSpelling(rEditView
, bMultipleDoc
);
2187 /*-- 13.10.2003 16:56:23---------------------------------------------------
2189 -----------------------------------------------------------------------*/
2190 void EditEngine::EndSpelling()
2192 DBG_CHKTHIS( EditEngine
, 0 );
2193 pImpEditEngine
->EndSpelling();
2196 /*-- 13.10.2003 16:43:27---------------------------------------------------
2198 -----------------------------------------------------------------------*/
2199 bool EditEngine::SpellSentence(EditView
& rView
, ::svx::SpellPortions
& rToFill
, bool bIsGrammarChecking
)
2201 DBG_CHKTHIS( EditEngine
, 0 );
2202 return pImpEditEngine
->SpellSentence( rView
, rToFill
, bIsGrammarChecking
);
2204 /*-- 08.09.2008 11:38:32---------------------------------------------------
2206 -----------------------------------------------------------------------*/
2207 void EditEngine::PutSpellingToSentenceStart( EditView
& rEditView
)
2209 DBG_CHKTHIS( EditEngine
, 0 );
2210 pImpEditEngine
->PutSpellingToSentenceStart( rEditView
);
2212 /*-- 13.10.2003 16:43:27---------------------------------------------------
2214 -----------------------------------------------------------------------*/
2215 void EditEngine::ApplyChangedSentence(EditView
& rEditView
, const ::svx::SpellPortions
& rNewPortions
, bool bIsGrammarChecking
)
2217 DBG_CHKTHIS( EditEngine
, 0 );
2218 pImpEditEngine
->ApplyChangedSentence( rEditView
, rNewPortions
, bIsGrammarChecking
);
2221 sal_Bool
EditEngine::HasConvertibleTextPortion( LanguageType nLang
)
2223 DBG_CHKTHIS( EditEngine
, 0 );
2224 return pImpEditEngine
->HasConvertibleTextPortion( nLang
);
2227 sal_Bool __EXPORT
EditEngine::ConvertNextDocument()
2229 DBG_CHKTHIS( EditEngine
, 0 );
2233 sal_Bool
EditEngine::HasText( const SvxSearchItem
& rSearchItem
)
2235 DBG_CHKTHIS( EditEngine
, 0 );
2236 return pImpEditEngine
->HasText( rSearchItem
);
2239 void EditEngine::SetGlobalCharStretching( sal_uInt16 nX
, sal_uInt16 nY
)
2241 DBG_CHKTHIS( EditEngine
, 0 );
2242 pImpEditEngine
->SetCharStretching( nX
, nY
);
2245 void EditEngine::GetGlobalCharStretching( sal_uInt16
& rX
, sal_uInt16
& rY
)
2247 DBG_CHKTHIS( EditEngine
, 0 );
2248 pImpEditEngine
->GetCharStretching( rX
, rY
);
2251 void EditEngine::DoStretchChars( sal_uInt16 nX
, sal_uInt16 nY
)
2253 DBG_CHKTHIS( EditEngine
, 0 );
2254 pImpEditEngine
->DoStretchChars( nX
, nY
);
2257 void EditEngine::SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount
)
2259 DBG_CHKTHIS( EditEngine
, 0 );
2260 pImpEditEngine
->SetBigTextObjectStart( nStartAtPortionCount
);
2263 sal_uInt16
EditEngine::GetBigTextObjectStart() const
2265 DBG_CHKTHIS( EditEngine
, 0 );
2266 return pImpEditEngine
->GetBigTextObjectStart();
2269 sal_Bool
EditEngine::ShouldCreateBigTextObject() const
2271 DBG_CHKTHIS( EditEngine
, 0 );
2272 sal_uInt16 nTextPortions
= 0;
2273 sal_uInt16 nParas
= pImpEditEngine
->GetEditDoc().Count();
2274 for ( sal_uInt16 nPara
= 0; nPara
< nParas
; nPara
++ )
2276 ParaPortion
* pParaPortion
= pImpEditEngine
->GetParaPortions()[nPara
];
2277 nTextPortions
= nTextPortions
+ pParaPortion
->GetTextPortions().Count();
2279 return ( nTextPortions
>= pImpEditEngine
->GetBigTextObjectStart() ) ? sal_True
: sal_False
;
2282 USHORT
EditEngine::GetFieldCount( USHORT nPara
) const
2285 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
2288 const CharAttribArray
& rAttrs
= pNode
->GetCharAttribs().GetAttribs();
2289 for ( sal_uInt16 nAttr
= 0; nAttr
< rAttrs
.Count(); nAttr
++ )
2291 EditCharAttrib
* pAttr
= rAttrs
[nAttr
];
2292 if ( pAttr
->Which() == EE_FEATURE_FIELD
)
2300 EFieldInfo
EditEngine::GetFieldInfo( USHORT nPara
, USHORT nField
) const
2302 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( nPara
);
2305 USHORT nCurrentField
= 0;
2306 const CharAttribArray
& rAttrs
= pNode
->GetCharAttribs().GetAttribs();
2307 for ( sal_uInt16 nAttr
= 0; nAttr
< rAttrs
.Count(); nAttr
++ )
2309 EditCharAttrib
* pAttr
= rAttrs
[nAttr
];
2310 if ( pAttr
->Which() == EE_FEATURE_FIELD
)
2312 if ( nCurrentField
== nField
)
2314 EFieldInfo
aInfo( *(const SvxFieldItem
*)pAttr
->GetItem(), nPara
, pAttr
->GetStart() );
2315 aInfo
.aCurrentText
= ((EditCharAttribField
*)pAttr
)->GetFieldValue();
2323 return EFieldInfo();
2327 sal_Bool
EditEngine::UpdateFields()
2329 DBG_CHKTHIS( EditEngine
, 0 );
2330 sal_Bool bChanges
= pImpEditEngine
->UpdateFields();
2332 pImpEditEngine
->FormatAndUpdate();
2336 void EditEngine::RemoveFields( sal_Bool bKeepFieldText
, TypeId aType
)
2338 DBG_CHKTHIS( EditEngine
, 0 );
2340 if ( bKeepFieldText
)
2341 pImpEditEngine
->UpdateFields();
2343 sal_uInt16 nParas
= pImpEditEngine
->GetEditDoc().Count();
2344 for ( sal_uInt16 nPara
= 0; nPara
< nParas
; nPara
++ )
2346 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().GetObject( nPara
);
2347 const CharAttribArray
& rAttrs
= pNode
->GetCharAttribs().GetAttribs();
2348 for ( sal_uInt16 nAttr
= rAttrs
.Count(); nAttr
; )
2350 const EditCharAttrib
* pAttr
= rAttrs
[--nAttr
];
2351 if ( pAttr
->Which() == EE_FEATURE_FIELD
)
2353 const SvxFieldData
* pFldData
= ((const SvxFieldItem
*)pAttr
->GetItem())->GetField();
2354 if ( pFldData
&& ( !aType
|| ( pFldData
->IsA( aType
) ) ) )
2356 DBG_ASSERT( pAttr
->GetItem()->ISA( SvxFieldItem
), "Kein FeldItem..." );
2357 EditSelection
aSel( EditPaM( pNode
, pAttr
->GetStart() ), EditPaM( pNode
, pAttr
->GetEnd() ) );
2358 String aFieldText
= ((EditCharAttribField
*)pAttr
)->GetFieldValue();
2359 pImpEditEngine
->ImpInsertText( aSel
, aFieldText
);
2366 sal_Bool
EditEngine::HasOnlineSpellErrors() const
2368 DBG_CHKTHIS( EditEngine
, 0 );
2369 sal_uInt16 nNodes
= pImpEditEngine
->GetEditDoc().Count();
2370 for ( sal_uInt16 n
= 0; n
< nNodes
; n
++ )
2372 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().GetObject( n
);
2373 if ( pNode
->GetWrongList() && pNode
->GetWrongList()->Count() )
2379 void EditEngine::CompleteOnlineSpelling()
2381 DBG_CHKTHIS( EditEngine
, 0 );
2382 if ( pImpEditEngine
->GetStatus().DoOnlineSpelling() )
2384 if( !pImpEditEngine
->IsFormatted() )
2385 pImpEditEngine
->FormatAndUpdate();
2387 pImpEditEngine
->StopOnlineSpellTimer();
2388 pImpEditEngine
->DoOnlineSpelling( 0, sal_True
, sal_False
);
2392 USHORT
EditEngine::FindParagraph( long nDocPosY
)
2394 return pImpEditEngine
->GetParaPortions().FindParagraph( nDocPosY
);
2397 EPosition
EditEngine::FindDocPosition( const Point
& rDocPos
) const
2400 // From the point of the API, this is const....
2401 EditPaM aPaM
= ((EditEngine
*)this)->pImpEditEngine
->GetPaM( rDocPos
, FALSE
);
2402 if ( aPaM
.GetNode() )
2404 aPos
.nPara
= pImpEditEngine
->aEditDoc
.GetPos( aPaM
.GetNode() );
2405 aPos
.nIndex
= aPaM
.GetIndex();
2410 Rectangle
EditEngine::GetCharacterBounds( const EPosition
& rPos
) const
2413 ContentNode
* pNode
= pImpEditEngine
->GetEditDoc().SaveGetObject( rPos
.nPara
);
2415 // #109151# Check against index, not paragraph
2416 if ( pNode
&& ( rPos
.nIndex
< pNode
->Len() ) )
2418 aBounds
= pImpEditEngine
->PaMtoEditCursor( EditPaM( pNode
, rPos
.nIndex
), GETCRSR_TXTONLY
);
2419 Rectangle aR2
= pImpEditEngine
->PaMtoEditCursor( EditPaM( pNode
, rPos
.nIndex
+1 ), GETCRSR_TXTONLY
|GETCRSR_ENDOFLINE
);
2420 if ( aR2
.Right() > aBounds
.Right() )
2421 aBounds
.Right() = aR2
.Right();
2426 ParagraphInfos
EditEngine::GetParagraphInfos( sal_uInt16 nPara
)
2428 DBG_CHKTHIS( EditEngine
, 0 );
2430 // Funktioniert nur, wenn nicht bereits in der Formatierung...
2431 if ( !pImpEditEngine
->IsFormatted() )
2432 pImpEditEngine
->FormatDoc();
2434 ParagraphInfos aInfos
;
2435 aInfos
.bValid
= pImpEditEngine
->IsFormatted();
2436 if ( pImpEditEngine
->IsFormatted() )
2438 ParaPortion
* pParaPortion
= pImpEditEngine
->GetParaPortions()[nPara
];
2439 EditLine
* pLine
= (pParaPortion
&& pParaPortion
->GetLines().Count()) ?
2440 pParaPortion
->GetLines().GetObject( 0 ) : NULL
;
2441 DBG_ASSERT( pParaPortion
&& pLine
, "GetParagraphInfos - Paragraph out of range" );
2442 if ( pParaPortion
&& pLine
)
2444 aInfos
.nParaHeight
= (USHORT
)pParaPortion
->GetHeight();
2445 aInfos
.nLines
= pParaPortion
->GetLines().Count();
2446 aInfos
.nFirstLineStartX
= pLine
->GetStartPosX();
2447 aInfos
.nFirstLineOffset
= pParaPortion
->GetFirstLineOffset();
2448 aInfos
.nFirstLineHeight
= pLine
->GetHeight();
2449 aInfos
.nFirstLineTextHeight
= pLine
->GetTxtHeight();
2450 aInfos
.nFirstLineMaxAscent
= pLine
->GetMaxAscent();
2456 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>
2457 EditEngine::CreateTransferable( const ESelection
& rSelection
) const
2459 DBG_CHKTHIS( EditEngine
, 0 );
2460 EditSelection
aSel( pImpEditEngine
->CreateSel( rSelection
) );
2461 return pImpEditEngine
->CreateTransferable( aSel
);
2464 // =====================================================================
2465 // ====================== Virtuelle Methoden =======================
2466 // =====================================================================
2467 void __EXPORT
EditEngine::DrawingText( const Point
&, const XubString
&, USHORT
, USHORT
,
2468 const sal_Int32
*, const SvxFont
&, sal_uInt16
, sal_uInt16
, BYTE
,
2469 const EEngineData::WrongSpellVector
*, const SvxFieldData
*, bool, bool, bool,
2470 const ::com::sun::star::lang::Locale
*, const Color
&, const Color
&)
2473 DBG_CHKTHIS( EditEngine
, 0 );
2476 void __EXPORT
EditEngine::PaintingFirstLine( sal_uInt16
, const Point
&, long, const Point
&, short, OutputDevice
* )
2478 DBG_CHKTHIS( EditEngine
, 0 );
2481 void __EXPORT
EditEngine::ParagraphInserted( sal_uInt16 nPara
)
2483 DBG_CHKTHIS( EditEngine
, 0 );
2485 if ( GetNotifyHdl().IsSet() )
2487 EENotify
aNotify( EE_NOTIFY_PARAGRAPHINSERTED
);
2488 aNotify
.pEditEngine
= this;
2489 aNotify
.nParagraph
= nPara
;
2490 pImpEditEngine
->CallNotify( aNotify
);
2494 void __EXPORT
EditEngine::ParagraphDeleted( sal_uInt16 nPara
)
2496 DBG_CHKTHIS( EditEngine
, 0 );
2498 if ( GetNotifyHdl().IsSet() )
2500 EENotify
aNotify( EE_NOTIFY_PARAGRAPHREMOVED
);
2501 aNotify
.pEditEngine
= this;
2502 aNotify
.nParagraph
= nPara
;
2503 pImpEditEngine
->CallNotify( aNotify
);
2506 void EditEngine::ParagraphConnected( USHORT
/*nLeftParagraph*/, USHORT
/*nRightParagraph*/ )
2508 DBG_CHKTHIS( EditEngine
, 0 );
2511 sal_Bool __EXPORT
EditEngine::FormattingParagraph( sal_uInt16
)
2513 // return sal_True, wenn die Attribute geaendert wurden...
2514 DBG_CHKTHIS( EditEngine
, 0 );
2518 void __EXPORT
EditEngine::ParaAttribsChanged( sal_uInt16
/* nParagraph */ )
2520 DBG_CHKTHIS( EditEngine
, 0 );
2523 void __EXPORT
EditEngine::StyleSheetChanged( SfxStyleSheet
* /* pStyle */ )
2525 DBG_CHKTHIS( EditEngine
, 0 );
2528 void __EXPORT
EditEngine::ParagraphHeightChanged( sal_uInt16 nPara
)
2530 DBG_CHKTHIS( EditEngine
, 0 );
2532 if ( GetNotifyHdl().IsSet() )
2534 EENotify
aNotify( EE_NOTIFY_TEXTHEIGHTCHANGED
);
2535 aNotify
.pEditEngine
= this;
2536 aNotify
.nParagraph
= nPara
;
2537 pImpEditEngine
->CallNotify( aNotify
);
2541 XubString __EXPORT
EditEngine::GetUndoComment( sal_uInt16 nId
) const
2543 DBG_CHKTHIS( EditEngine
, 0 );
2547 case EDITUNDO_REMOVECHARS
:
2548 case EDITUNDO_CONNECTPARAS
:
2549 case EDITUNDO_REMOVEFEATURE
:
2550 case EDITUNDO_DELCONTENT
:
2551 case EDITUNDO_DELETE
:
2553 aComment
= XubString( EditResId( RID_EDITUNDO_DEL
) );
2555 case EDITUNDO_MOVEPARAGRAPHS
:
2556 case EDITUNDO_MOVEPARAS
:
2557 case EDITUNDO_DRAGANDDROP
:
2558 aComment
= XubString( EditResId( RID_EDITUNDO_MOVE
) );
2560 case EDITUNDO_INSERTFEATURE
:
2561 case EDITUNDO_SPLITPARA
:
2562 case EDITUNDO_INSERTCHARS
:
2563 case EDITUNDO_PASTE
:
2564 case EDITUNDO_INSERT
:
2566 aComment
= XubString( EditResId( RID_EDITUNDO_INSERT
) );
2568 case EDITUNDO_SRCHANDREPL
:
2569 case EDITUNDO_REPLACEALL
:
2570 aComment
= XubString( EditResId( RID_EDITUNDO_REPLACE
) );
2572 case EDITUNDO_ATTRIBS
:
2573 case EDITUNDO_PARAATTRIBS
:
2574 case EDITUNDO_STRETCH
:
2575 aComment
= XubString( EditResId( RID_EDITUNDO_SETATTRIBS
) );
2577 case EDITUNDO_RESETATTRIBS
:
2578 aComment
= XubString( EditResId( RID_EDITUNDO_RESETATTRIBS
) );
2580 case EDITUNDO_STYLESHEET
:
2581 aComment
= XubString( EditResId( RID_EDITUNDO_SETSTYLE
) );
2583 case EDITUNDO_TRANSLITERATE
:
2584 aComment
= XubString( EditResId( RID_EDITUNDO_TRANSLITERATE
) );
2586 case EDITUNDO_INDENTBLOCK
:
2587 case EDITUNDO_UNINDENTBLOCK
:
2588 aComment
= XubString( EditResId( RID_EDITUNDO_INDENT
) );
2594 Rectangle
EditEngine::GetBulletArea( sal_uInt16
)
2596 return Rectangle( Point(), Point() );
2599 XubString __EXPORT
EditEngine::CalcFieldValue( const SvxFieldItem
&, sal_uInt16
, sal_uInt16
, Color
*&, Color
*& )
2601 DBG_CHKTHIS( EditEngine
, 0 );
2605 void __EXPORT
EditEngine::FieldClicked( const SvxFieldItem
&, sal_uInt16
, sal_uInt16
)
2607 DBG_CHKTHIS( EditEngine
, 0 );
2610 void __EXPORT
EditEngine::FieldSelected( const SvxFieldItem
&, sal_uInt16
, sal_uInt16
)
2612 DBG_CHKTHIS( EditEngine
, 0 );
2615 \f// =====================================================================
2616 // ====================== Statische Methoden =======================
2617 // =====================================================================
2618 SfxItemPool
* EditEngine::CreatePool( sal_Bool bPersistentRefCounts
)
2620 SfxItemPool
* pPool
= new EditEngineItemPool( bPersistentRefCounts
);
2624 sal_uInt32
EditEngine::RegisterClipboardFormatName()
2626 static sal_uInt32 nFormat
= 0;
2628 nFormat
= SotExchange::RegisterFormatName( String( RTL_CONSTASCII_USTRINGPARAM( "EditEngineFormat" ) ) );
2632 sal_uInt16
EditEngine::GetAvailableSearchOptions()
2634 return SEARCH_OPTIONS_SEARCH
| SEARCH_OPTIONS_REPLACE
|
2635 SEARCH_OPTIONS_REPLACE_ALL
| SEARCH_OPTIONS_WHOLE_WORDS
|
2636 SEARCH_OPTIONS_BACKWARDS
| SEARCH_OPTIONS_REG_EXP
|
2637 SEARCH_OPTIONS_EXACT
| SEARCH_OPTIONS_SELECTION
;
2640 void EditEngine::SetFontInfoInItemSet( SfxItemSet
& rSet
, const Font
& rFont
)
2642 SvxFont
aSvxFont( rFont
);
2643 SetFontInfoInItemSet( rSet
, aSvxFont
);
2647 void EditEngine::SetFontInfoInItemSet( SfxItemSet
& rSet
, const SvxFont
& rFont
)
2649 rSet
.Put( SvxLanguageItem( rFont
.GetLanguage(), EE_CHAR_LANGUAGE
) );
2650 rSet
.Put( SvxFontItem( rFont
.GetFamily(), rFont
.GetName(), XubString(), rFont
.GetPitch(), rFont
.GetCharSet(), EE_CHAR_FONTINFO
) );
2651 rSet
.Put( SvxFontHeightItem( rFont
.GetSize().Height(), 100, EE_CHAR_FONTHEIGHT
) );
2652 rSet
.Put( SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH
) );
2653 rSet
.Put( SvxShadowedItem( rFont
.IsShadow(), EE_CHAR_SHADOW
) );
2654 rSet
.Put( SvxEscapementItem( rFont
.GetEscapement(), rFont
.GetPropr(), EE_CHAR_ESCAPEMENT
) );
2655 rSet
.Put( SvxWeightItem( rFont
.GetWeight(), EE_CHAR_WEIGHT
) );
2656 rSet
.Put( SvxColorItem( rFont
.GetColor(), EE_CHAR_COLOR
) );
2657 rSet
.Put( SvxUnderlineItem( rFont
.GetUnderline(), EE_CHAR_UNDERLINE
) );
2658 rSet
.Put( SvxOverlineItem( rFont
.GetOverline(), EE_CHAR_OVERLINE
) );
2659 rSet
.Put( SvxCrossedOutItem( rFont
.GetStrikeout(), EE_CHAR_STRIKEOUT
) );
2660 rSet
.Put( SvxPostureItem( rFont
.GetItalic(), EE_CHAR_ITALIC
) );
2661 rSet
.Put( SvxContourItem( rFont
.IsOutline(), EE_CHAR_OUTLINE
) );
2662 rSet
.Put( SvxAutoKernItem( rFont
.IsKerning(), EE_CHAR_PAIRKERNING
) );
2663 rSet
.Put( SvxKerningItem( rFont
.GetFixKerning(), EE_CHAR_KERNING
) );
2664 rSet
.Put( SvxWordLineModeItem( rFont
.IsWordLineMode(), EE_CHAR_WLM
) );
2665 rSet
.Put( SvxEmphasisMarkItem( rFont
.GetEmphasisMark(), EE_CHAR_EMPHASISMARK
) );
2666 rSet
.Put( SvxCharReliefItem( rFont
.GetRelief(), EE_CHAR_RELIEF
) );
2669 Font
EditEngine::CreateFontFromItemSet( const SfxItemSet
& rItemSet
, USHORT nScriptType
)
2672 CreateFont( aFont
, rItemSet
, true, nScriptType
);
2676 // Maybe we can remove the next two methods, check after 6.x
2677 Font
EditEngine::CreateFontFromItemSet( const SfxItemSet
& rItemSet
)
2679 return CreateSvxFontFromItemSet( rItemSet
);
2682 SvxFont
EditEngine::CreateSvxFontFromItemSet( const SfxItemSet
& rItemSet
)
2685 CreateFont( aFont
, rItemSet
);
2689 sal_Bool
EditEngine::DoesKeyMoveCursor( const KeyEvent
& rKeyEvent
)
2691 sal_Bool bDoesMove
= sal_False
;
2693 switch ( rKeyEvent
.GetKeyCode().GetCode() )
2704 if ( !rKeyEvent
.GetKeyCode().IsMod2() )
2705 bDoesMove
= sal_True
;
2712 sal_Bool
EditEngine::DoesKeyChangeText( const KeyEvent
& rKeyEvent
)
2714 sal_Bool bDoesChange
= sal_False
;
2716 KeyFuncType eFunc
= rKeyEvent
.GetKeyCode().GetFunction();
2717 if ( eFunc
!= KEYFUNC_DONTKNOW
)
2724 case KEYFUNC_PASTE
: bDoesChange
= sal_True
;
2726 default: // wird dann evtl. unten bearbeitet.
2727 eFunc
= KEYFUNC_DONTKNOW
;
2730 if ( eFunc
== KEYFUNC_DONTKNOW
)
2732 switch ( rKeyEvent
.GetKeyCode().GetCode() )
2735 case KEY_BACKSPACE
: bDoesChange
= sal_True
;
2740 if ( !rKeyEvent
.GetKeyCode().IsMod1() && !rKeyEvent
.GetKeyCode().IsMod2() )
2741 bDoesChange
= sal_True
;
2746 bDoesChange
= IsSimpleCharInput( rKeyEvent
);
2753 sal_Bool
EditEngine::IsSimpleCharInput( const KeyEvent
& rKeyEvent
)
2755 if( EditEngine::IsPrintable( rKeyEvent
.GetCharCode() ) &&
2756 ( KEY_MOD2
!= (rKeyEvent
.GetKeyCode().GetModifier() & ~KEY_SHIFT
) ) &&
2757 ( KEY_MOD1
!= (rKeyEvent
.GetKeyCode().GetModifier() & ~KEY_SHIFT
) ) )
2764 // Mal in den Outliner schieben...
2765 void EditEngine::ImportBulletItem( SvxNumBulletItem
& /*rNumBullet*/, sal_uInt16
/*nLevel*/,
2766 const SvxBulletItem
* /*pOldBullet*/, const SvxLRSpaceItem
* /*pOldLRSpace*/ )
2769 if ( pOldBullet || pOldLRSpace )
2771 // Numberformat dynamisch, weil Zuweisungsoperator nicht implementiert.
2773 // Altes NumBulletItem nur uebernehmen, wenn kein altes BulletItem
2774 const SvxNumberFormat* pFmt = ( !pOldBullet && ( rNumBullet.GetNumRule()->GetLevelCount() > nLevel ) ) ?
2775 rNumBullet.GetNumRule()->Get( nLevel ) : NULL;
2776 SvxNumberFormat* pNumberFormat = pFmt
2777 ? new SvxNumberFormat( *pFmt )
2778 : new SvxNumberFormat( SVX_NUM_NUMBER_NONE );
2782 SvxExtNumType eNumType;
2783 switch( pOldBullet->GetStyle() )
2785 case BS_BMP: eNumType = SVX_NUM_BITMAP; break;
2786 case BS_BULLET: eNumType = SVX_NUM_CHAR_SPECIAL; break;
2787 case BS_ROMAN_BIG: eNumType = SVX_NUM_ROMAN_UPPER; break;
2788 case BS_ROMAN_SMALL: eNumType = SVX_NUM_ROMAN_LOWER; break;
2789 case BS_ABC_BIG: eNumType = SVX_NUM_CHARS_UPPER_LETTER; break;
2790 case BS_ABC_SMALL: eNumType = SVX_NUM_CHARS_LOWER_LETTER; break;
2791 case BS_123: eNumType = SVX_NUM_ARABIC; break;
2792 default: eNumType = SVX_NUM_NUMBER_NONE; break;
2794 pNumberFormat->SetNumberingType(
2795 sal::static_int_cast< sal_Int16 >( eNumType ) );
2799 switch( pOldBullet->GetJustification() & (BJ_HRIGHT|BJ_HCENTER|BJ_HLEFT) )
2801 case BJ_HRIGHT: eAdjust = SVX_ADJUST_RIGHT; break;
2802 case BJ_HCENTER: eAdjust = SVX_ADJUST_CENTER; break;
2803 default: eAdjust = SVX_ADJUST_LEFT; break;
2805 pNumberFormat->SetNumAdjust(eAdjust);
2808 pNumberFormat->SetPrefix( pOldBullet->GetPrevText() );
2809 pNumberFormat->SetSuffix( pOldBullet->GetFollowText() );
2812 if ( eNumType != SVX_NUM_BITMAP )
2814 Font aTmpFont = pOldBullet->GetFont();
2815 pNumberFormat->SetBulletFont( &aTmpFont );
2819 pNumberFormat->SetBulletColor( pOldBullet->GetFont().GetColor() );
2822 pNumberFormat->SetStart( pOldBullet->GetStart() );
2825 pNumberFormat->SetBulletRelSize( pOldBullet->GetScale() );
2828 if( eNumType == SVX_NUM_CHAR_SPECIAL )
2830 pNumberFormat->SetBulletChar( pOldBullet->GetSymbol() );
2832 else if( eNumType == SVX_NUM_BITMAP )
2834 SvxBrushItem aBItem( Graphic( pOldBullet->GetBitmap() ), GPOS_NONE, SID_ATTR_BRUSH );
2835 pNumberFormat->SetGraphicBrush( &aBItem );
2839 // Einzug und Erstzeileneinzug
2840 //TL_NFLR if ( pOldLRSpace )
2842 //TL_NFLR short nLSpace = (short)pOldLRSpace->GetTxtLeft();
2843 //TL_NFLR pNumberFormat->SetLSpace( nLSpace );
2844 //TL_NFLR pNumberFormat->SetAbsLSpace( nLSpace );
2845 //TL_NFLR pNumberFormat->SetFirstLineOffset( pOldLRSpace->GetTxtFirstLineOfst() );
2848 rNumBullet.GetNumRule()->SetLevel( nLevel, *pNumberFormat );
2849 delete pNumberFormat;
2854 BOOL
EditEngine::HasValidData( const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& rTransferable
)
2856 BOOL bValidData
= FALSE
;
2858 if ( rTransferable
.is() )
2860 // Every application that copies rtf or any other text format also copies plain text into the clipboard....
2861 datatransfer::DataFlavor aFlavor
;
2862 SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING
, aFlavor
);
2863 bValidData
= rTransferable
->isDataFlavorSupported( aFlavor
);
2869 /** sets a link that is called at the beginning of a drag operation at an edit view */
2870 void EditEngine::SetBeginDropHdl( const Link
& rLink
)
2872 pImpEditEngine
->SetBeginDropHdl( rLink
);
2875 Link
EditEngine::GetBeginDropHdl() const
2877 return pImpEditEngine
->GetBeginDropHdl();
2880 /** sets a link that is called at the end of a drag operation at an edit view */
2881 void EditEngine::SetEndDropHdl( const Link
& rLink
)
2883 pImpEditEngine
->SetEndDropHdl( rLink
);
2886 Link
EditEngine::GetEndDropHdl() const
2888 return pImpEditEngine
->GetEndDropHdl();
2891 void EditEngine::SetFirstWordCapitalization( BOOL bCapitalize
)
2893 pImpEditEngine
->SetFirstWordCapitalization( bCapitalize
);
2896 BOOL
EditEngine::IsFirstWordCapitalization() const
2898 return pImpEditEngine
->IsFirstWordCapitalization();
2902 // ---------------------------------------------------
2905 EFieldInfo::EFieldInfo()
2911 EFieldInfo::EFieldInfo( const SvxFieldItem
& rFieldItem
, USHORT nPara
, USHORT nPos
) : aPosition( nPara
, nPos
)
2913 pFieldItem
= new SvxFieldItem( rFieldItem
);
2916 EFieldInfo::~EFieldInfo()
2921 EFieldInfo::EFieldInfo( const EFieldInfo
& rFldInfo
)
2926 EFieldInfo
& EFieldInfo::operator= ( const EFieldInfo
& rFldInfo
)
2928 if( this == &rFldInfo
)
2931 pFieldItem
= rFldInfo
.pFieldItem
? new SvxFieldItem( *rFldInfo
.pFieldItem
) : 0;
2932 aCurrentText
= rFldInfo
.aCurrentText
;
2933 aPosition
= rFldInfo
.aPosition
;