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 <algorithm>
31 : : #include <editeng/eeitem.hxx>
32 : : #include <com/sun/star/i18n/WordType.hpp>
33 : :
34 : : #include <svl/itemset.hxx>
35 : : #include <editeng/editeng.hxx>
36 : : #include <editeng/editview.hxx>
37 : : #include <editeng/unoedhlp.hxx>
38 : : #include <editeng/editdata.hxx>
39 : : #include <editeng/outliner.hxx>
40 : : #include <editeng/editobj.hxx> // only for the GetText crutch
41 : :
42 : : #include <editeng/unofored.hxx>
43 : :
44 : : using namespace ::com::sun::star;
45 : :
46 : : //------------------------------------------------------------------------
47 : :
48 : 1275 : SvxEditEngineForwarder::SvxEditEngineForwarder( EditEngine& rEngine ) :
49 : 1275 : rEditEngine( rEngine )
50 : : {
51 : 1275 : }
52 : :
53 : 1256 : SvxEditEngineForwarder::~SvxEditEngineForwarder()
54 : : {
55 : : // the EditEngine may need to be deleted from the outside
56 [ - + ]: 2512 : }
57 : :
58 : 50095 : sal_uInt16 SvxEditEngineForwarder::GetParagraphCount() const
59 : : {
60 : 50095 : return rEditEngine.GetParagraphCount();
61 : : }
62 : :
63 : 138727 : sal_uInt16 SvxEditEngineForwarder::GetTextLen( sal_uInt16 nParagraph ) const
64 : : {
65 : 138727 : return rEditEngine.GetTextLen( nParagraph );
66 : : }
67 : :
68 : 244 : String SvxEditEngineForwarder::GetText( const ESelection& rSel ) const
69 : : {
70 [ + - ][ + - ]: 244 : return convertLineEnd(rEditEngine.GetText(rSel, LINEEND_LF), GetSystemLineEnd());
[ + - ]
71 : : }
72 : :
73 : 14644 : SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib ) const
74 : : {
75 [ + - ]: 14644 : if( rSel.nStartPara == rSel.nEndPara )
76 : : {
77 : 14644 : sal_uInt8 nFlags = 0;
78 [ + - + - ]: 14644 : switch( bOnlyHardAttrib )
79 : : {
80 : : case EditEngineAttribs_All:
81 : 14454 : nFlags = GETATTRIBS_ALL;
82 : 14454 : break;
83 : : case EditEngineAttribs_HardAndPara:
84 : 0 : nFlags = GETATTRIBS_PARAATTRIBS|GETATTRIBS_CHARATTRIBS;
85 : 0 : break;
86 : : case EditEngineAttribs_OnlyHard:
87 : 190 : nFlags = GETATTRIBS_CHARATTRIBS;
88 : 190 : break;
89 : : default:
90 : : OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
91 : : }
92 : :
93 : 14644 : return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
94 : : }
95 : : else
96 : : {
97 : 14644 : return rEditEngine.GetAttribs( rSel, bOnlyHardAttrib );
98 : : }
99 : : }
100 : :
101 : 680 : SfxItemSet SvxEditEngineForwarder::GetParaAttribs( sal_uInt16 nPara ) const
102 : : {
103 : 680 : SfxItemSet aSet( rEditEngine.GetParaAttribs( nPara ) );
104 : :
105 : 680 : sal_uInt16 nWhich = EE_PARA_START;
106 [ + + ]: 12920 : while( nWhich <= EE_PARA_END )
107 : : {
108 [ + - ][ + + ]: 12240 : if( aSet.GetItemState( nWhich, sal_True ) != SFX_ITEM_ON )
109 : : {
110 [ + - ][ - + ]: 8925 : if( rEditEngine.HasParaAttrib( nPara, nWhich ) )
111 [ # # ][ # # ]: 0 : aSet.Put( rEditEngine.GetParaAttrib( nPara, nWhich ) );
112 : : }
113 : 12240 : nWhich++;
114 : : }
115 : :
116 : 680 : return aSet;
117 : : }
118 : :
119 : 680 : void SvxEditEngineForwarder::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
120 : : {
121 : 680 : rEditEngine.SetParaAttribs( nPara, rSet );
122 : 680 : }
123 : :
124 : 0 : void SvxEditEngineForwarder::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
125 : : {
126 : 0 : rEditEngine.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
127 : 0 : }
128 : :
129 : 4 : SfxItemPool* SvxEditEngineForwarder::GetPool() const
130 : : {
131 : 4 : return rEditEngine.GetEmptyItemSet().GetPool();
132 : : }
133 : :
134 : 116 : void SvxEditEngineForwarder::GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const
135 : : {
136 : 116 : rEditEngine.GetPortions( nPara, rList );
137 : 116 : }
138 : :
139 : 1704 : void SvxEditEngineForwarder::QuickInsertText( const String& rText, const ESelection& rSel )
140 : : {
141 : 1704 : rEditEngine.QuickInsertText( rText, rSel );
142 : 1704 : }
143 : :
144 : 5 : void SvxEditEngineForwarder::QuickInsertLineBreak( const ESelection& rSel )
145 : : {
146 : 5 : rEditEngine.QuickInsertLineBreak( rSel );
147 : 5 : }
148 : :
149 : 885 : void SvxEditEngineForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
150 : : {
151 : 885 : rEditEngine.QuickInsertField( rFld, rSel );
152 : 885 : }
153 : :
154 : 861 : void SvxEditEngineForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
155 : : {
156 : 861 : rEditEngine.QuickSetAttribs( rSet, rSel );
157 : 861 : }
158 : :
159 : 823 : sal_Bool SvxEditEngineForwarder::IsValid() const
160 : : {
161 : : // cannot reliably query EditEngine state
162 : : // while in the middle of an update
163 : 823 : return rEditEngine.GetUpdateMode();
164 : : }
165 : :
166 : 64 : XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor )
167 : : {
168 : 64 : return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
169 : : }
170 : :
171 : 0 : void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos )
172 : : {
173 : 0 : rEditEngine.FieldClicked( rField, nPara, nPos );
174 : 0 : }
175 : :
176 : 6 : sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich )
177 : : {
178 [ + - ]: 6 : std::vector<EECharAttrib> aAttribs;
179 : :
180 : 6 : const SfxPoolItem* pLastItem = NULL;
181 : :
182 : 6 : SfxItemState eState = SFX_ITEM_DEFAULT;
183 : :
184 : : // check all paragraphs inside the selection
185 [ + + ]: 12 : for( sal_uInt16 nPara = rSel.nStartPara; nPara <= rSel.nEndPara; nPara++ )
186 : : {
187 : 6 : SfxItemState eParaState = SFX_ITEM_DEFAULT;
188 : :
189 : : // calculate start and endpos for this paragraph
190 : 6 : sal_uInt16 nPos = 0;
191 [ + - ]: 6 : if( rSel.nStartPara == nPara )
192 : 6 : nPos = rSel.nStartPos;
193 : :
194 : 6 : sal_uInt16 nEndPos = rSel.nEndPos;
195 [ - + ]: 6 : if( rSel.nEndPara != nPara )
196 [ # # ]: 0 : nEndPos = rEditEngine.GetTextLen( nPara );
197 : :
198 : :
199 : : // get list of char attribs
200 [ + - ]: 6 : rEditEngine.GetCharAttribs( nPara, aAttribs );
201 : :
202 : 6 : sal_Bool bEmpty = sal_True; // we found no item inside the selektion of this paragraph
203 : 6 : sal_Bool bGaps = sal_False; // we found items but theire gaps between them
204 : 6 : sal_uInt16 nLastEnd = nPos;
205 : :
206 : 6 : const SfxPoolItem* pParaItem = NULL;
207 : :
208 [ + - ][ + - ]: 42 : for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
[ + + ]
209 : : {
210 : : DBG_ASSERT(i->pAttr, "GetCharAttribs gives corrupt data");
211 : :
212 : 36 : const sal_Bool bEmptyPortion = i->nStart == i->nEnd;
213 [ + - ]: 36 : if((!bEmptyPortion && i->nStart >= nEndPos) ||
[ - + # # ]
[ - + ][ + - ]
214 : 0 : (bEmptyPortion && i->nStart > nEndPos))
215 : 0 : break; // break if we are already behind our selektion
216 : :
217 [ + - ][ + - ]: 36 : if((!bEmptyPortion && i->nEnd <= nPos) ||
[ - + # # ]
[ - + ]
218 : 0 : (bEmptyPortion && i->nEnd < nPos))
219 : 0 : continue; // or if the attribute ends before our selektion
220 : :
221 [ + - ]: 36 : if(i->pAttr->Which() != nWhich)
222 : 36 : continue; // skip if is not the searched item
223 : :
224 : : // if we already found an item
225 [ # # ]: 0 : if( pParaItem )
226 : : {
227 : : // ... and its different to this one than the state is dont care
228 [ # # ][ # # ]: 0 : if(*pParaItem != *(i->pAttr))
229 : 0 : return SFX_ITEM_DONTCARE;
230 : : }
231 : : else
232 : 0 : pParaItem = i->pAttr;
233 : :
234 [ # # ]: 0 : if( bEmpty )
235 : 0 : bEmpty = sal_False;
236 : :
237 [ # # ][ # # ]: 0 : if(!bGaps && i->nStart > nLastEnd)
[ # # ]
238 : 0 : bGaps = sal_True;
239 : :
240 : 0 : nLastEnd = i->nEnd;
241 : : }
242 : :
243 [ - + ][ # # ]: 6 : if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
[ # # ]
244 : 0 : bGaps = sal_True;
245 : :
246 [ + - ]: 6 : if( bEmpty )
247 : 6 : eParaState = SFX_ITEM_DEFAULT;
248 [ # # ]: 0 : else if( bGaps )
249 : 0 : eParaState = SFX_ITEM_DONTCARE;
250 : : else
251 : 0 : eParaState = SFX_ITEM_SET;
252 : :
253 : : // if we already found an item check if we found the same
254 [ - + ]: 6 : if( pLastItem )
255 : : {
256 [ # # ][ # # ]: 0 : if( (pParaItem == NULL) || (*pLastItem != *pParaItem) )
[ # # ][ # # ]
257 : 0 : return SFX_ITEM_DONTCARE;
258 : : }
259 : : else
260 : : {
261 : 6 : pLastItem = pParaItem;
262 : 6 : eState = eParaState;
263 : : }
264 : : }
265 : :
266 : 6 : return eState;
267 : : }
268 : :
269 : 2 : sal_uInt16 SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
270 : : {
271 : 2 : return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich );
272 : : }
273 : :
274 : 0 : sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const
275 : : {
276 : 0 : const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara );
277 : 0 : return rSet.GetItemState( nWhich );
278 : : }
279 : :
280 : 6 : LanguageType SvxEditEngineForwarder::GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const
281 : : {
282 : 6 : return rEditEngine.GetLanguage(nPara, nIndex);
283 : : }
284 : :
285 : 678 : sal_uInt16 SvxEditEngineForwarder::GetFieldCount( sal_uInt16 nPara ) const
286 : : {
287 : 678 : return rEditEngine.GetFieldCount(nPara);
288 : : }
289 : :
290 : 54 : EFieldInfo SvxEditEngineForwarder::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
291 : : {
292 : 54 : return rEditEngine.GetFieldInfo( nPara, nField );
293 : : }
294 : :
295 : 1353 : EBulletInfo SvxEditEngineForwarder::GetBulletInfo( sal_uInt16 ) const
296 : : {
297 : 1353 : return EBulletInfo();
298 : : }
299 : :
300 : 42 : Rectangle SvxEditEngineForwarder::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
301 : : {
302 : : // #101701#
303 : : // EditEngine's 'internal' methods like GetCharacterBounds()
304 : : // don't rotate for vertical text.
305 [ + - ][ + - ]: 42 : Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
306 : 42 : ::std::swap( aSize.Width(), aSize.Height() );
307 [ + - ]: 42 : bool bIsVertical( rEditEngine.IsVertical() == sal_True );
308 : :
309 : : // #108900# Handle virtual position one-past-the end of the string
310 [ + - ][ - + ]: 42 : if( nIndex >= rEditEngine.GetTextLen(nPara) )
311 : : {
312 [ # # ]: 0 : Rectangle aLast;
313 : :
314 [ # # ]: 0 : if( nIndex )
315 : : {
316 : : // use last character, if possible
317 [ # # ]: 0 : aLast = rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex-1) );
318 : :
319 : : // move at end of this last character, make one pixel wide
320 [ # # ]: 0 : aLast.Move( aLast.Right() - aLast.Left(), 0 );
321 [ # # ][ # # ]: 0 : aLast.SetSize( Size(1, aLast.GetHeight()) );
322 : :
323 : : // take care for CTL
324 [ # # ]: 0 : aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
325 : : }
326 : : else
327 : : {
328 : : // #109864# Bounds must lie within the paragraph
329 [ # # ]: 0 : aLast = GetParaBounds( nPara );
330 : :
331 : : // #109151# Don't use paragraph height, but line height
332 : : // instead. aLast is already CTL-correct
333 [ # # ]: 0 : if( bIsVertical)
334 [ # # ][ # # ]: 0 : aLast.SetSize( Size( rEditEngine.GetLineHeight(nPara,0), 1 ) );
335 : : else
336 [ # # ][ # # ]: 0 : aLast.SetSize( Size( 1, rEditEngine.GetLineHeight(nPara,0) ) );
337 : : }
338 : :
339 : 0 : return aLast;
340 : : }
341 : : else
342 : : {
343 : 84 : return SvxEditSourceHelper::EEToUserSpace( rEditEngine.GetCharacterBounds( EPosition(nPara, nIndex) ),
344 [ + - ][ + - ]: 42 : aSize, bIsVertical );
345 : : }
346 : : }
347 : :
348 : 187 : Rectangle SvxEditEngineForwarder::GetParaBounds( sal_uInt16 nPara ) const
349 : : {
350 [ + - ]: 187 : const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
351 : : sal_uLong nWidth;
352 : : sal_uLong nHeight;
353 : : sal_uLong nTextWidth;
354 : :
355 [ + - ][ - + ]: 187 : if( rEditEngine.IsVertical() )
356 : : {
357 : : // #101701#
358 : : // Hargl. EditEngine's 'external' methods return the rotated
359 : : // dimensions, 'internal' methods like GetTextHeight( n )
360 : : // don't rotate.
361 [ # # ]: 0 : nWidth = rEditEngine.GetTextHeight( nPara );
362 [ # # ]: 0 : nHeight = rEditEngine.GetTextHeight();
363 [ # # ]: 0 : nTextWidth = rEditEngine.GetTextHeight();
364 : :
365 [ # # ]: 0 : return Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
366 : : }
367 : : else
368 : : {
369 [ + - ]: 187 : nWidth = rEditEngine.CalcTextWidth();
370 [ + - ]: 187 : nHeight = rEditEngine.GetTextHeight( nPara );
371 : :
372 [ + - ]: 187 : return Rectangle( 0, aPnt.Y(), nWidth, aPnt.Y() + nHeight );
373 : : }
374 : : }
375 : :
376 : 229 : MapMode SvxEditEngineForwarder::GetMapMode() const
377 : : {
378 : 229 : return rEditEngine.GetRefMapMode();
379 : : }
380 : :
381 : 0 : OutputDevice* SvxEditEngineForwarder::GetRefDevice() const
382 : : {
383 : 0 : return rEditEngine.GetRefDevice();
384 : : }
385 : :
386 : 22 : sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_uInt16& nPara, sal_uInt16& nIndex ) const
387 : : {
388 [ + - ][ + - ]: 22 : Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() );
389 : 22 : ::std::swap( aSize.Width(), aSize.Height() );
390 : : Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
391 : : aSize,
392 [ + - ][ + - ]: 22 : rEditEngine.IsVertical() == sal_True ));
393 : :
394 [ + - ]: 22 : EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos );
395 : :
396 : 22 : nPara = aDocPos.nPara;
397 : 22 : nIndex = aDocPos.nIndex;
398 : :
399 : 22 : return sal_True;
400 : : }
401 : :
402 : 0 : sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const
403 : : {
404 [ # # ]: 0 : ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
405 : :
406 [ # # ][ # # ]: 0 : if( aRes.nStartPara == nPara &&
407 : : aRes.nStartPara == aRes.nEndPara )
408 : : {
409 : 0 : nStart = aRes.nStartPos;
410 : 0 : nEnd = aRes.nEndPos;
411 : :
412 : 0 : return sal_True;
413 : : }
414 : :
415 : 0 : return sal_False;
416 : : }
417 : :
418 : 0 : sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
419 : : {
420 : 0 : return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex );
421 : : }
422 : :
423 : 0 : sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_uInt16 nPara ) const
424 : : {
425 : 0 : return rEditEngine.GetLineCount(nPara);
426 : : }
427 : :
428 : 0 : sal_uInt16 SvxEditEngineForwarder::GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const
429 : : {
430 : 0 : return rEditEngine.GetLineLen(nPara, nLine);
431 : : }
432 : :
433 : 0 : void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const
434 : : {
435 : 0 : rEditEngine.GetLineBoundaries(rStart, rEnd, nPara, nLine);
436 : 0 : }
437 : :
438 : 0 : sal_uInt16 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
439 : : {
440 : 0 : return rEditEngine.GetLineNumberAtIndex(nPara, nIndex);
441 : : }
442 : :
443 : :
444 : 0 : sal_Bool SvxEditEngineForwarder::QuickFormatDoc( sal_Bool )
445 : : {
446 : 0 : rEditEngine.QuickFormatDoc();
447 : :
448 : 0 : return sal_True;
449 : : }
450 : :
451 : 0 : sal_Bool SvxEditEngineForwarder::Delete( const ESelection& rSelection )
452 : : {
453 : 0 : rEditEngine.QuickDelete( rSelection );
454 : 0 : rEditEngine.QuickFormatDoc();
455 : :
456 : 0 : return sal_True;
457 : : }
458 : :
459 : 0 : sal_Bool SvxEditEngineForwarder::InsertText( const String& rStr, const ESelection& rSelection )
460 : : {
461 : 0 : rEditEngine.QuickInsertText( rStr, rSelection );
462 : 0 : rEditEngine.QuickFormatDoc();
463 : :
464 : 0 : return sal_True;
465 : : }
466 : :
467 : 0 : sal_Int16 SvxEditEngineForwarder::GetDepth( sal_uInt16 ) const
468 : : {
469 : : // EditEngine does not support outline depth
470 : 0 : return -1;
471 : : }
472 : :
473 : 0 : sal_Bool SvxEditEngineForwarder::SetDepth( sal_uInt16, sal_Int16 nNewDepth )
474 : : {
475 : : // EditEngine does not support outline depth
476 [ # # ]: 0 : return nNewDepth == -1 ? sal_True : sal_False;
477 : : }
478 : :
479 : 0 : const SfxItemSet * SvxEditEngineForwarder::GetEmptyItemSetPtr()
480 : : {
481 : 0 : return &rEditEngine.GetEmptyItemSet();
482 : : }
483 : :
484 : 0 : void SvxEditEngineForwarder::AppendParagraph()
485 : : {
486 : 0 : rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), String::EmptyString() );
487 : 0 : }
488 : :
489 : 0 : xub_StrLen SvxEditEngineForwarder::AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet & /*rSet*/ )
490 : : {
491 : 0 : xub_StrLen nLen = 0;
492 : :
493 : 0 : sal_uInt16 nParaCount = rEditEngine.GetParagraphCount();
494 : : DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" );
495 [ # # ]: 0 : if (/*0 <= nPara && */nPara < nParaCount)
496 : : {
497 : 0 : nLen = rEditEngine.GetTextLen( nPara );
498 [ # # ]: 0 : rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
499 : : }
500 : :
501 : 0 : return nLen;
502 : : }
503 : :
504 : 0 : void SvxEditEngineForwarder::CopyText(const SvxTextForwarder& rSource)
505 : : {
506 [ # # ]: 0 : const SvxEditEngineForwarder* pSourceForwarder = dynamic_cast< const SvxEditEngineForwarder* >( &rSource );
507 [ # # ]: 0 : if( !pSourceForwarder )
508 : 0 : return;
509 : 0 : EditTextObject* pNewTextObject = pSourceForwarder->rEditEngine.CreateTextObject();
510 : 0 : rEditEngine.SetText( *pNewTextObject );
511 [ # # ]: 0 : delete pNewTextObject;
512 : : }
513 : :
514 : : //------------------------------------------------------------------------
515 : :
516 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|