Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <algorithm>
22 : #include <svl/style.hxx>
23 : #include <com/sun/star/i18n/WordType.hpp>
24 :
25 : #include <svl/itemset.hxx>
26 : #include <editeng/editeng.hxx>
27 : #include <editeng/editdata.hxx>
28 : #include <editeng/outliner.hxx>
29 : #include <editeng/unoedhlp.hxx>
30 : #include <svl/poolitem.hxx>
31 : #include <vcl/wrkwin.hxx>
32 : #include <editeng/eeitem.hxx>
33 :
34 : #include <editeng/unoforou.hxx>
35 : #include <editeng/unofored.hxx>
36 : #include <editeng/outlobj.hxx>
37 : #include <unofored_internal.hxx>
38 :
39 : using namespace ::com::sun::star;
40 :
41 :
42 :
43 27240 : SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, bool bOutlText /* = false */ ) :
44 : rOutliner( rOutl ),
45 : bOutlinerText( bOutlText ),
46 : mpAttribsCache( NULL ),
47 : mpParaAttribsCache( NULL ),
48 27240 : mnParaAttribsCache( 0 )
49 : {
50 27240 : }
51 :
52 81261 : SvxOutlinerForwarder::~SvxOutlinerForwarder()
53 : {
54 27087 : flushCache();
55 54174 : }
56 :
57 416391 : sal_Int32 SvxOutlinerForwarder::GetParagraphCount() const
58 : {
59 416391 : return rOutliner.GetParagraphCount();
60 : }
61 :
62 1072073 : sal_Int32 SvxOutlinerForwarder::GetTextLen( sal_Int32 nParagraph ) const
63 : {
64 1072073 : return rOutliner.GetEditEngine().GetTextLen( nParagraph );
65 : }
66 :
67 4224 : OUString SvxOutlinerForwarder::GetText( const ESelection& rSel ) const
68 : {
69 : //! GetText (ESelection) should probably also be in the Outliner
70 : // in the time being use as the hack for the EditEngine:
71 4224 : EditEngine* pEditEngine = const_cast<EditEngine*>(&rOutliner.GetEditEngine());
72 4224 : return pEditEngine->GetText( rSel, LINEEND_LF );
73 : }
74 :
75 14692 : static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib, EditEngine& rEditEngine )
76 : {
77 14692 : if( rSel.nStartPara == rSel.nEndPara )
78 : {
79 14514 : GetAttribsFlags nFlags = GetAttribsFlags::NONE;
80 :
81 14514 : switch( nOnlyHardAttrib )
82 : {
83 : case EditEngineAttribs_All:
84 13631 : nFlags = GetAttribsFlags::ALL;
85 13631 : break;
86 : case EditEngineAttribs_HardAndPara:
87 0 : nFlags = GetAttribsFlags::PARAATTRIBS|GetAttribsFlags::CHARATTRIBS;
88 0 : break;
89 : case EditEngineAttribs_OnlyHard:
90 883 : nFlags = GetAttribsFlags::CHARATTRIBS;
91 883 : break;
92 : default:
93 : OSL_FAIL("unknown flags for SvxOutlinerForwarder::GetAttribs");
94 : }
95 14514 : return rEditEngine.GetAttribs( rSel.nStartPara, rSel.nStartPos, rSel.nEndPos, nFlags );
96 : }
97 : else
98 : {
99 178 : return rEditEngine.GetAttribs( rSel, nOnlyHardAttrib );
100 : }
101 : }
102 :
103 20631 : SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const
104 : {
105 20631 : if( mpAttribsCache && ( EditEngineAttribs_All == nOnlyHardAttrib ) )
106 : {
107 : // have we the correct set in cache?
108 6747 : if( const_cast<SvxOutlinerForwarder*>(this)->maAttribCacheSelection.IsEqual(rSel) )
109 : {
110 : // yes! just return the cache
111 5939 : return *mpAttribsCache;
112 : }
113 : else
114 : {
115 : // no, we need delete the old cache
116 808 : delete mpAttribsCache;
117 808 : mpAttribsCache = NULL;
118 : }
119 : }
120 :
121 : //! Does it not exist on the Outliner?
122 : //! and why is the GetAttribs on the EditEngine not a const?
123 14692 : EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
124 :
125 14692 : SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, nOnlyHardAttrib, rEditEngine ) );
126 :
127 14692 : if( EditEngineAttribs_All == nOnlyHardAttrib )
128 : {
129 13809 : mpAttribsCache = new SfxItemSet( aSet );
130 13809 : maAttribCacheSelection = rSel;
131 : }
132 :
133 14692 : SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( rSel.nStartPara );
134 14692 : if( pStyle )
135 9822 : aSet.SetParent( &(pStyle->GetItemSet() ) );
136 :
137 14692 : return aSet;
138 : }
139 :
140 24112 : SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const
141 : {
142 24112 : if( mpParaAttribsCache )
143 : {
144 : // have we the correct set in cache?
145 10464 : if( nPara == mnParaAttribsCache )
146 : {
147 : // yes! just return the cache
148 10076 : return *mpParaAttribsCache;
149 : }
150 : else
151 : {
152 : // no, we need delete the old cache
153 388 : delete mpParaAttribsCache;
154 388 : mpParaAttribsCache = NULL;
155 : }
156 : }
157 :
158 14036 : mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) );
159 14036 : mnParaAttribsCache = nPara;
160 :
161 14036 : EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
162 :
163 14036 : SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
164 14036 : if( pStyle )
165 10597 : mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
166 :
167 14036 : return *mpParaAttribsCache;
168 : }
169 :
170 11934 : void SvxOutlinerForwarder::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
171 : {
172 11934 : flushCache();
173 :
174 11934 : const SfxItemSet* pOldParent = rSet.GetParent();
175 11934 : if( pOldParent )
176 9282 : const_cast<SfxItemSet*>(&rSet)->SetParent( NULL );
177 :
178 11934 : rOutliner.SetParaAttribs( nPara, rSet );
179 :
180 11934 : if( pOldParent )
181 9282 : const_cast<SfxItemSet*>(&rSet)->SetParent( pOldParent );
182 11934 : }
183 :
184 468 : void SvxOutlinerForwarder::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich )
185 : {
186 468 : rOutliner.RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
187 468 : }
188 :
189 6 : SfxItemPool* SvxOutlinerForwarder::GetPool() const
190 : {
191 6 : return rOutliner.GetEmptyItemSet().GetPool();
192 : }
193 :
194 1824 : void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
195 : {
196 1824 : ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList );
197 1824 : }
198 :
199 30310 : void SvxOutlinerForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel )
200 : {
201 30310 : flushCache();
202 30310 : if( rText.isEmpty() )
203 : {
204 2515 : rOutliner.QuickDelete( rSel );
205 : }
206 : else
207 : {
208 27795 : rOutliner.QuickInsertText( rText, rSel );
209 : }
210 30310 : }
211 :
212 38 : void SvxOutlinerForwarder::QuickInsertLineBreak( const ESelection& rSel )
213 : {
214 38 : flushCache();
215 38 : rOutliner.QuickInsertLineBreak( rSel );
216 38 : }
217 :
218 549 : void SvxOutlinerForwarder::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
219 : {
220 549 : flushCache();
221 549 : rOutliner.QuickInsertField( rFld, rSel );
222 549 : }
223 :
224 7296 : void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
225 : {
226 7296 : flushCache();
227 7296 : rOutliner.QuickSetAttribs( rSet, rSel );
228 7296 : }
229 :
230 277 : OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
231 : {
232 277 : return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
233 : }
234 :
235 0 : void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
236 : {
237 0 : rOutliner.FieldClicked( rField, nPara, nPos );
238 0 : }
239 :
240 0 : bool SvxOutlinerForwarder::IsValid() const
241 : {
242 : // cannot reliably query outliner state
243 : // while in the middle of an update
244 0 : return rOutliner.GetUpdateMode();
245 : }
246 :
247 2051 : SfxItemState SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
248 : {
249 2051 : return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich );
250 : }
251 :
252 1500 : SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
253 : {
254 1500 : const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara );
255 1500 : return rSet.GetItemState( nWhich );
256 : }
257 :
258 :
259 104689 : void SvxOutlinerForwarder::flushCache()
260 : {
261 104689 : if( mpAttribsCache )
262 : {
263 13001 : delete mpAttribsCache;
264 13001 : mpAttribsCache = NULL;
265 : }
266 :
267 104689 : if( mpParaAttribsCache )
268 : {
269 13648 : delete mpParaAttribsCache;
270 13648 : mpParaAttribsCache = NULL;
271 : }
272 104689 : }
273 :
274 0 : LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const
275 : {
276 0 : return rOutliner.GetLanguage(nPara, nIndex);
277 : }
278 :
279 0 : sal_Int32 SvxOutlinerForwarder::GetFieldCount( sal_Int32 nPara ) const
280 : {
281 0 : return rOutliner.GetEditEngine().GetFieldCount(nPara);
282 : }
283 :
284 0 : EFieldInfo SvxOutlinerForwarder::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
285 : {
286 0 : return rOutliner.GetEditEngine().GetFieldInfo( nPara, nField );
287 : }
288 :
289 0 : EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_Int32 nPara ) const
290 : {
291 0 : return rOutliner.GetBulletInfo( nPara );
292 : }
293 :
294 0 : Rectangle SvxOutlinerForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const
295 : {
296 : // EditEngine's 'internal' methods like GetCharacterBounds()
297 : // don't rotate for vertical text.
298 0 : Size aSize( rOutliner.CalcTextSize() );
299 0 : ::std::swap( aSize.Width(), aSize.Height() );
300 0 : bool bIsVertical( rOutliner.IsVertical() );
301 :
302 : // #108900# Handle virtual position one-past-the end of the string
303 0 : if( nIndex >= GetTextLen(nPara) )
304 : {
305 0 : Rectangle aLast;
306 :
307 0 : if( nIndex )
308 : {
309 : // use last character, if possible
310 0 : aLast = rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex-1) );
311 :
312 : // move at end of this last character, make one pixel wide
313 0 : aLast.Move( aLast.Right() - aLast.Left(), 0 );
314 0 : aLast.SetSize( Size(1, aLast.GetHeight()) );
315 :
316 : // take care for CTL
317 0 : aLast = SvxEditSourceHelper::EEToUserSpace( aLast, aSize, bIsVertical );
318 : }
319 : else
320 : {
321 : // #109864# Bounds must lie within the paragraph
322 0 : aLast = GetParaBounds( nPara );
323 :
324 : // #109151# Don't use paragraph height, but line height
325 : // instead. aLast is already CTL-correct
326 0 : if( bIsVertical)
327 0 : aLast.SetSize( Size( rOutliner.GetLineHeight(nPara,0), 1 ) );
328 : else
329 0 : aLast.SetSize( Size( 1, rOutliner.GetLineHeight(nPara,0) ) );
330 : }
331 :
332 0 : return aLast;
333 : }
334 : else
335 : {
336 0 : return SvxEditSourceHelper::EEToUserSpace( rOutliner.GetEditEngine().GetCharacterBounds( EPosition(nPara, nIndex) ),
337 0 : aSize, bIsVertical );
338 : }
339 : }
340 :
341 0 : Rectangle SvxOutlinerForwarder::GetParaBounds( sal_Int32 nPara ) const
342 : {
343 0 : Point aPnt = rOutliner.GetDocPosTopLeft( nPara );
344 0 : Size aSize = rOutliner.CalcTextSize();
345 :
346 0 : if( rOutliner.IsVertical() )
347 : {
348 : // Hargl. Outliner's 'external' methods return the rotated
349 : // dimensions, 'internal' methods like GetTextHeight( n )
350 : // don't rotate.
351 0 : sal_uLong nWidth = rOutliner.GetTextHeight( nPara );
352 :
353 0 : return Rectangle( aSize.Width() - aPnt.Y() - nWidth, 0, aSize.Width() - aPnt.Y(), aSize.Height() );
354 : }
355 : else
356 : {
357 0 : sal_uLong nHeight = rOutliner.GetTextHeight( nPara );
358 :
359 0 : return Rectangle( 0, aPnt.Y(), aSize.Width(), aPnt.Y() + nHeight );
360 : }
361 : }
362 :
363 0 : MapMode SvxOutlinerForwarder::GetMapMode() const
364 : {
365 0 : return rOutliner.GetRefMapMode();
366 : }
367 :
368 0 : OutputDevice* SvxOutlinerForwarder::GetRefDevice() const
369 : {
370 0 : return rOutliner.GetRefDevice();
371 : }
372 :
373 0 : bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_Int32& nIndex ) const
374 : {
375 0 : Size aSize( rOutliner.CalcTextSize() );
376 0 : ::std::swap( aSize.Width(), aSize.Height() );
377 : Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
378 : aSize,
379 0 : rOutliner.IsVertical() ));
380 :
381 0 : EPosition aDocPos = rOutliner.GetEditEngine().FindDocPosition( aEEPos );
382 :
383 0 : nPara = aDocPos.nPara;
384 0 : nIndex = aDocPos.nIndex;
385 :
386 0 : return true;
387 : }
388 :
389 0 : bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const
390 : {
391 0 : ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD );
392 :
393 0 : if( aRes.nStartPara == nPara &&
394 0 : aRes.nStartPara == aRes.nEndPara )
395 : {
396 0 : nStart = aRes.nStartPos;
397 0 : nEnd = aRes.nEndPos;
398 :
399 0 : return true;
400 : }
401 :
402 0 : return false;
403 : }
404 :
405 0 : bool SvxOutlinerForwarder::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell ) const
406 : {
407 0 : return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex, bInCell );
408 : }
409 :
410 0 : sal_Int32 SvxOutlinerForwarder::GetLineCount( sal_Int32 nPara ) const
411 : {
412 0 : return rOutliner.GetLineCount(nPara);
413 : }
414 :
415 0 : sal_Int32 SvxOutlinerForwarder::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const
416 : {
417 0 : return rOutliner.GetLineLen(nPara, nLine);
418 : }
419 :
420 0 : void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nPara, sal_Int32 nLine ) const
421 : {
422 0 : return rOutliner.GetEditEngine().GetLineBoundaries( rStart, rEnd, nPara, nLine );
423 : }
424 :
425 0 : sal_Int32 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const
426 : {
427 0 : return rOutliner.GetEditEngine().GetLineNumberAtIndex( nPara, nIndex );
428 : }
429 :
430 0 : bool SvxOutlinerForwarder::QuickFormatDoc( bool )
431 : {
432 0 : rOutliner.QuickFormatDoc();
433 :
434 0 : return true;
435 : }
436 :
437 0 : bool SvxOutlinerForwarder::Delete( const ESelection& rSelection )
438 : {
439 0 : flushCache();
440 0 : rOutliner.QuickDelete( rSelection );
441 0 : rOutliner.QuickFormatDoc();
442 :
443 0 : return true;
444 : }
445 :
446 0 : bool SvxOutlinerForwarder::InsertText( const OUString& rStr, const ESelection& rSelection )
447 : {
448 0 : flushCache();
449 0 : rOutliner.QuickInsertText( rStr, rSelection );
450 0 : rOutliner.QuickFormatDoc();
451 :
452 0 : return true;
453 : }
454 :
455 2529 : sal_Int16 SvxOutlinerForwarder::GetDepth( sal_Int32 nPara ) const
456 : {
457 : DBG_ASSERT( 0 <= nPara && nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index");
458 :
459 2529 : Paragraph* pPara = rOutliner.GetParagraph( nPara );
460 :
461 2529 : sal_Int16 nLevel = -1;
462 :
463 2529 : if( pPara )
464 2529 : nLevel = rOutliner.GetDepth( nPara );
465 :
466 2529 : return nLevel;
467 : }
468 :
469 2861 : bool SvxOutlinerForwarder::SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth )
470 : {
471 : DBG_ASSERT( 0 <= nPara && nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index");
472 :
473 2861 : if( (nNewDepth >= -1) && (nNewDepth <= 9) && (0 <= nPara && nPara < GetParagraphCount()) )
474 : {
475 2861 : Paragraph* pPara = rOutliner.GetParagraph( nPara );
476 2861 : if( pPara )
477 : {
478 2861 : rOutliner.SetDepth( pPara, nNewDepth );
479 :
480 : // const bool bOutlinerText = pSdrObject && (pSdrObject->GetObjInventor() == SdrInventor) && (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT);
481 2861 : if( bOutlinerText )
482 154 : rOutliner.SetLevelDependendStyleSheet( nPara );
483 :
484 2861 : return true;
485 : }
486 : }
487 :
488 0 : return false;
489 : }
490 :
491 2 : sal_Int32 SvxOutlinerForwarder::GetNumberingStartValue( sal_Int32 nPara )
492 : {
493 2 : if( 0 <= nPara && nPara < GetParagraphCount() )
494 : {
495 2 : return rOutliner.GetNumberingStartValue( nPara );
496 : }
497 : else
498 : {
499 : OSL_FAIL( "SvxOutlinerForwarder::GetNumberingStartValue)(), Invalid paragraph index");
500 0 : return -1;
501 : }
502 : }
503 :
504 0 : void SvxOutlinerForwarder::SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue )
505 : {
506 0 : if( 0 <= nPara && nPara < GetParagraphCount() )
507 : {
508 0 : rOutliner.SetNumberingStartValue( nPara, nNumberingStartValue );
509 : }
510 : else
511 : {
512 : OSL_FAIL( "SvxOutlinerForwarder::SetNumberingStartValue)(), Invalid paragraph index");
513 : }
514 0 : }
515 :
516 10 : bool SvxOutlinerForwarder::IsParaIsNumberingRestart( sal_Int32 nPara )
517 : {
518 10 : if( 0 <= nPara && nPara < GetParagraphCount() )
519 : {
520 10 : return rOutliner.IsParaIsNumberingRestart( nPara );
521 : }
522 : else
523 : {
524 : OSL_FAIL( "SvxOutlinerForwarder::IsParaIsNumberingRestart)(), Invalid paragraph index");
525 0 : return false;
526 : }
527 : }
528 :
529 4 : void SvxOutlinerForwarder::SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart )
530 : {
531 4 : if( 0 <= nPara && nPara < GetParagraphCount() )
532 : {
533 4 : rOutliner.SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
534 : }
535 : else
536 : {
537 : OSL_FAIL( "SvxOutlinerForwarder::SetParaIsNumberingRestart)(), Invalid paragraph index");
538 : }
539 4 : }
540 :
541 621 : const SfxItemSet * SvxOutlinerForwarder::GetEmptyItemSetPtr()
542 : {
543 621 : EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
544 621 : return &rEditEngine.GetEmptyItemSet();
545 : }
546 :
547 153 : void SvxOutlinerForwarder::AppendParagraph()
548 : {
549 153 : EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
550 153 : rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), OUString() );
551 153 : }
552 :
553 468 : sal_Int32 SvxOutlinerForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ )
554 : {
555 468 : sal_Int32 nLen = 0;
556 :
557 468 : EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() );
558 468 : sal_Int32 nParaCount = rEditEngine.GetParagraphCount();
559 : DBG_ASSERT( 0 <= nPara && nPara < nParaCount, "paragraph index out of bounds" );
560 468 : if (0 <= nPara && nPara < nParaCount)
561 : {
562 468 : nLen = rEditEngine.GetTextLen( nPara );
563 468 : rEditEngine.QuickInsertText( rText, ESelection( nPara, nLen, nPara, nLen ) );
564 : }
565 :
566 468 : return nLen;
567 : }
568 :
569 0 : void SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource)
570 : {
571 0 : const SvxOutlinerForwarder* pSourceForwarder = dynamic_cast< const SvxOutlinerForwarder* >( &rSource );
572 0 : if( !pSourceForwarder )
573 0 : return;
574 0 : OutlinerParaObject* pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject();
575 0 : rOutliner.SetText( *pNewOutlinerParaObject );
576 0 : delete pNewOutlinerParaObject;
577 : }
578 :
579 :
580 :
581 :
582 0 : sal_Int32 SvxTextForwarder::GetNumberingStartValue( sal_Int32 )
583 : {
584 0 : return -1;
585 : }
586 :
587 0 : void SvxTextForwarder::SetNumberingStartValue( sal_Int32, sal_Int32 )
588 : {
589 0 : }
590 :
591 0 : bool SvxTextForwarder::IsParaIsNumberingRestart( sal_Int32 )
592 : {
593 0 : return false;
594 : }
595 :
596 0 : void SvxTextForwarder::SetParaIsNumberingRestart( sal_Int32, bool )
597 : {
598 0 : }
599 :
600 :
601 :
602 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|