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