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