update credits
[LibreOffice.git] / editeng / source / outliner / outlin2.cxx
bloba5251a1c5d468cf651ae197ed9a251fc964e676e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svl/intitem.hxx>
22 #include <editeng/editeng.hxx>
23 #include <editeng/editview.hxx>
24 #include <editeng/editdata.hxx>
25 #include <editeng/eerdll.hxx>
26 #include <editeng/lrspitem.hxx>
27 #include <editeng/fhgtitem.hxx>
28 #include <svl/style.hxx>
29 #include <vcl/mapmod.hxx>
31 #include <editeng/forbiddencharacterstable.hxx>
33 #include <editeng/outliner.hxx>
34 #include <paralist.hxx>
35 #include <editeng/outlobj.hxx>
36 #include <outleeng.hxx>
37 #include <outlundo.hxx>
38 #include <editeng/eeitem.hxx>
39 #include <editeng/editstat.hxx>
41 DBG_NAMEEX(Outliner)
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::linguistic2;
46 // ======================================================================
47 // ====================== Simple pass-through =======================
48 // ======================================================================
50 void Outliner::SetUpdateMode( sal_Bool bUpdate )
52 DBG_CHKTHIS(Outliner,0);
53 pEditEngine->SetUpdateMode( bUpdate );
57 sal_Bool Outliner::GetUpdateMode() const
59 DBG_CHKTHIS(Outliner,0);
60 return pEditEngine->GetUpdateMode();
63 const SfxItemSet& Outliner::GetEmptyItemSet() const
65 DBG_CHKTHIS(Outliner,0);
66 return pEditEngine->GetEmptyItemSet();
69 void Outliner::EnableUndo( sal_Bool bEnable )
71 DBG_CHKTHIS(Outliner,0);
72 pEditEngine->EnableUndo( bEnable );
75 sal_Bool Outliner::IsUndoEnabled() const
77 DBG_CHKTHIS(Outliner,0);
78 return pEditEngine->IsUndoEnabled();
81 MapMode Outliner::GetRefMapMode() const
83 DBG_CHKTHIS(Outliner,0);
84 return pEditEngine->GetRefMapMode();
87 void Outliner::SetRefMapMode( const MapMode& rMMode )
89 DBG_CHKTHIS(Outliner,0);
90 pEditEngine->SetRefMapMode( rMMode );
93 void Outliner::SetBackgroundColor( const Color& rColor )
95 DBG_CHKTHIS(Outliner,0);
96 pEditEngine->SetBackgroundColor( rColor );
99 Color Outliner::GetBackgroundColor() const
101 DBG_CHKTHIS(Outliner,0);
102 return pEditEngine->GetBackgroundColor();
106 void Outliner::ClearModifyFlag()
108 DBG_CHKTHIS(Outliner,0);
109 pEditEngine->ClearModifyFlag();
112 sal_Bool Outliner::IsModified() const
114 DBG_CHKTHIS(Outliner,0);
115 return pEditEngine->IsModified();
118 sal_uLong Outliner::GetTextHeight() const
120 DBG_CHKTHIS(Outliner,0);
121 return pEditEngine->GetTextHeight();
124 void Outliner::SetModifyHdl( const Link& rLink )
126 DBG_CHKTHIS(Outliner,0);
127 pEditEngine->SetModifyHdl( rLink );
130 Link Outliner::GetModifyHdl() const
132 DBG_CHKTHIS(Outliner,0);
133 return pEditEngine->GetModifyHdl();
136 void Outliner::SetNotifyHdl( const Link& rLink )
138 DBG_CHKTHIS(Outliner,0);
139 pEditEngine->aOutlinerNotifyHdl = rLink;
141 if ( rLink.IsSet() )
142 pEditEngine->SetNotifyHdl( LINK( this, Outliner, EditEngineNotifyHdl ) );
143 else
144 pEditEngine->SetNotifyHdl( Link() );
148 void Outliner::SetStatusEventHdl( const Link& rLink )
150 DBG_CHKTHIS(Outliner,0);
151 pEditEngine->SetStatusEventHdl( rLink );
154 Link Outliner::GetStatusEventHdl() const
156 DBG_CHKTHIS(Outliner,0);
157 return pEditEngine->GetStatusEventHdl();
160 void Outliner::SetDefTab( sal_uInt16 nTab )
162 DBG_CHKTHIS(Outliner,0);
163 pEditEngine->SetDefTab( nTab );
166 sal_Bool Outliner::IsFlatMode() const
168 DBG_CHKTHIS(Outliner,0);
169 return pEditEngine->IsFlatMode();
172 sal_Bool Outliner::UpdateFields()
174 DBG_CHKTHIS(Outliner,0);
175 return pEditEngine->UpdateFields();
178 void Outliner::RemoveFields( sal_Bool bKeepFieldText, TypeId aType )
180 DBG_CHKTHIS(Outliner,0);
181 pEditEngine->RemoveFields( bKeepFieldText, aType );
184 void Outliner::SetWordDelimiters( const String& rDelimiters )
186 DBG_CHKTHIS(Outliner,0);
187 pEditEngine->SetWordDelimiters( rDelimiters );
190 String Outliner::GetWordDelimiters() const
192 DBG_CHKTHIS(Outliner,0);
193 return pEditEngine->GetWordDelimiters();
196 String Outliner::GetWord( sal_Int32 nPara, sal_uInt16 nIndex )
198 DBG_CHKTHIS(Outliner,0);
199 return pEditEngine->GetWord( nPara, nIndex );
202 void Outliner::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect )
204 DBG_CHKTHIS(Outliner,0);
205 pEditEngine->Draw( pOutDev, rOutRect );
208 void Outliner::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation )
210 DBG_CHKTHIS(Outliner,0);
211 pEditEngine->Draw( pOutDev, rStartPos, nOrientation );
214 void Outliner::SetPaperSize( const Size& rSize )
216 DBG_CHKTHIS(Outliner,0);
217 pEditEngine->SetPaperSize( rSize );
220 const Size& Outliner::GetPaperSize() const
222 DBG_CHKTHIS(Outliner,0);
223 return pEditEngine->GetPaperSize();
226 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
228 DBG_CHKTHIS( Outliner, 0 );
229 pEditEngine->SetPolygon( rPolyPolygon );
232 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
234 DBG_CHKTHIS( Outliner, 0 );
235 pEditEngine->SetPolygon( rPolyPolygon, pLinePolyPolygon);
238 void Outliner::ClearPolygon()
240 DBG_CHKTHIS( Outliner, 0 );
241 pEditEngine->ClearPolygon();
244 const Size& Outliner::GetMinAutoPaperSize() const
246 DBG_CHKTHIS(Outliner,0);
247 return pEditEngine->GetMinAutoPaperSize();
250 void Outliner::SetMinAutoPaperSize( const Size& rSz )
252 DBG_CHKTHIS(Outliner,0);
253 pEditEngine->SetMinAutoPaperSize( rSz );
256 const Size& Outliner::GetMaxAutoPaperSize() const
258 DBG_CHKTHIS(Outliner,0);
259 return pEditEngine->GetMaxAutoPaperSize();
262 void Outliner::SetMaxAutoPaperSize( const Size& rSz )
264 DBG_CHKTHIS(Outliner,0);
265 pEditEngine->SetMaxAutoPaperSize( rSz );
268 sal_Bool Outliner::IsExpanded( Paragraph* pPara ) const
270 DBG_CHKTHIS(Outliner,0);
271 return pParaList->HasVisibleChildren( pPara );
274 Paragraph* Outliner::GetParent( Paragraph* pParagraph ) const
276 DBG_CHKTHIS(Outliner,0);
277 return pParaList->GetParent( pParagraph );
280 sal_Int32 Outliner::GetChildCount( Paragraph* pParent ) const
282 DBG_CHKTHIS(Outliner,0);
283 return pParaList->GetChildCount( pParent );
286 Size Outliner::CalcTextSize()
288 DBG_CHKTHIS(Outliner,0);
289 return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeight());
292 Size Outliner::CalcTextSizeNTP()
294 DBG_CHKTHIS(Outliner,0);
295 return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeightNTP());
298 void Outliner::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
300 DBG_CHKTHIS(Outliner,0);
301 pEditEngine->SetStyleSheetPool( pSPool );
304 SfxStyleSheetPool* Outliner::GetStyleSheetPool()
306 DBG_CHKTHIS(Outliner,0);
307 return pEditEngine->GetStyleSheetPool();
310 SfxStyleSheet* Outliner::GetStyleSheet( sal_Int32 nPara )
312 DBG_CHKTHIS(Outliner,0);
313 return pEditEngine->GetStyleSheet( nPara );
316 sal_Bool Outliner::IsInSelectionMode() const
318 DBG_CHKTHIS(Outliner,0);
319 return pEditEngine->IsInSelectionMode();
322 void Outliner::SetControlWord( sal_uLong nWord )
324 DBG_CHKTHIS(Outliner,0);
325 pEditEngine->SetControlWord( nWord );
328 sal_uLong Outliner::GetControlWord() const
330 DBG_CHKTHIS(Outliner,0);
331 return pEditEngine->GetControlWord();
334 void Outliner::SetAsianCompressionMode( sal_uInt16 n )
336 DBG_CHKTHIS(Outliner,0);
337 pEditEngine->SetAsianCompressionMode( n );
340 void Outliner::SetKernAsianPunctuation( sal_Bool b )
342 DBG_CHKTHIS(Outliner,0);
343 pEditEngine->SetKernAsianPunctuation( b );
346 void Outliner::SetAddExtLeading( sal_Bool bExtLeading )
348 DBG_CHKTHIS(Outliner,0);
349 pEditEngine->SetAddExtLeading( bExtLeading );
352 void Outliner::UndoActionStart( sal_uInt16 nId )
354 DBG_CHKTHIS(Outliner,0);
355 pEditEngine->UndoActionStart( nId );
358 void Outliner::UndoActionEnd( sal_uInt16 nId )
360 DBG_CHKTHIS(Outliner,0);
361 pEditEngine->UndoActionEnd( nId );
364 void Outliner::InsertUndo( EditUndo* pUndo )
366 DBG_CHKTHIS(Outliner,0);
367 pEditEngine->GetUndoManager().AddUndoAction( pUndo, sal_False );
370 sal_Bool Outliner::IsInUndo()
372 DBG_CHKTHIS(Outliner,0);
373 return pEditEngine->IsInUndo();
376 sal_uLong Outliner::GetLineCount( sal_Int32 nParagraph ) const
378 DBG_CHKTHIS(Outliner,0);
379 return pEditEngine->GetLineCount( nParagraph );
382 sal_uInt16 Outliner::GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const
384 DBG_CHKTHIS(Outliner,0);
385 return pEditEngine->GetLineLen( nParagraph, nLine );
388 sal_uLong Outliner::GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine )
390 DBG_CHKTHIS(Outliner,0);
391 return pEditEngine->GetLineHeight( nParagraph, nLine );
394 void Outliner::QuickRemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich )
396 DBG_CHKTHIS(Outliner,0);
397 pEditEngine->QuickRemoveCharAttribs( nPara, nWhich );
400 EESpellState Outliner::HasSpellErrors()
402 DBG_CHKTHIS(Outliner,0);
403 return pEditEngine->HasSpellErrors();
406 sal_Bool Outliner::HasConvertibleTextPortion( LanguageType nLang )
408 DBG_CHKTHIS(Outliner,0);
409 return pEditEngine->HasConvertibleTextPortion( nLang );
412 sal_Bool Outliner::ConvertNextDocument()
414 DBG_CHKTHIS(Outliner,0);
415 return sal_False;
418 void Outliner::SetDefaultLanguage( LanguageType eLang )
420 DBG_CHKTHIS(Outliner,0);
421 pEditEngine->SetDefaultLanguage( eLang );
424 LanguageType Outliner::GetDefaultLanguage() const
426 DBG_CHKTHIS(Outliner,0);
427 return pEditEngine->GetDefaultLanguage();
430 void Outliner::CompleteOnlineSpelling()
432 DBG_CHKTHIS(Outliner,0);
433 pEditEngine->CompleteOnlineSpelling();
436 sal_Bool Outliner::HasText( const SvxSearchItem& rSearchItem )
438 DBG_CHKTHIS(Outliner,0);
439 return pEditEngine->HasText( rSearchItem );
442 void Outliner::SetEditTextObjectPool( SfxItemPool* pPool )
444 DBG_CHKTHIS(Outliner,0);
445 pEditEngine->SetEditTextObjectPool( pPool );
448 SfxItemPool* Outliner::GetEditTextObjectPool() const
450 DBG_CHKTHIS(Outliner,0);
451 return pEditEngine->GetEditTextObjectPool();
454 sal_Bool Outliner::SpellNextDocument()
456 DBG_CHKTHIS(Outliner,0);
457 return sal_False;
461 void Outliner::SetSpeller( Reference< XSpellChecker1 > &xSpeller )
463 DBG_CHKTHIS(Outliner,0);
464 pEditEngine->SetSpeller( xSpeller );
466 Reference< XSpellChecker1 > Outliner::GetSpeller()
468 DBG_CHKTHIS(Outliner,0);
469 return pEditEngine->GetSpeller();
472 void Outliner::SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars )
474 DBG_CHKTHIS(Outliner,0);
475 pEditEngine->SetForbiddenCharsTable( xForbiddenChars );
478 void Outliner::SetHyphenator( Reference< XHyphenator >& xHyph )
480 DBG_CHKTHIS(Outliner,0);
481 pEditEngine->SetHyphenator( xHyph );
484 OutputDevice* Outliner::GetRefDevice() const
486 DBG_CHKTHIS(Outliner,0);
487 return pEditEngine->GetRefDevice();
490 sal_uLong Outliner::GetTextHeight( sal_Int32 nParagraph ) const
492 DBG_CHKTHIS(Outliner,0);
493 return pEditEngine->GetTextHeight(nParagraph );
496 Point Outliner::GetDocPos( const Point& rPaperPos ) const
498 DBG_CHKTHIS(Outliner,0);
499 return pEditEngine->GetDocPos( rPaperPos );
502 Point Outliner::GetDocPosTopLeft( sal_Int32 nParagraph )
504 DBG_CHKTHIS(Outliner,0);
505 return pEditEngine->GetDocPosTopLeft( nParagraph );
508 sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
510 return IsTextPos( rPaperPos, nBorder, NULL );
513 sal_Bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBullet )
515 DBG_CHKTHIS(Outliner,0);
516 if ( pbBullet)
517 *pbBullet = sal_False;
518 sal_Bool bTextPos = pEditEngine->IsTextPos( rPaperPos, nBorder );
519 if ( !bTextPos )
521 Point aDocPos = GetDocPos( rPaperPos );
522 sal_Int32 nPara = pEditEngine->FindParagraph( aDocPos.Y() );
523 if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasNumberFormat( nPara ) )
525 Rectangle aBulArea = ImpCalcBulletArea( nPara, sal_True, sal_True );
526 if ( aBulArea.IsInside( rPaperPos ) )
528 bTextPos = sal_True;
529 if ( pbBullet)
530 *pbBullet = sal_True;
535 return bTextPos;
538 void Outliner::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
540 DBG_CHKTHIS(Outliner,0);
541 pEditEngine->QuickSetAttribs( rSet, rSel );
544 void Outliner::QuickInsertText( const XubString& rText, const ESelection& rSel )
546 bFirstParaIsEmpty = sal_False;
547 pEditEngine->QuickInsertText( rText, rSel );
550 void Outliner::QuickDelete( const ESelection& rSel )
552 bFirstParaIsEmpty = sal_False;
553 pEditEngine->QuickDelete( rSel );
556 void Outliner::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
558 DBG_CHKTHIS(Outliner,0);
559 bFirstParaIsEmpty = sal_False;
560 pEditEngine->QuickInsertField( rFld, rSel );
563 void Outliner::QuickInsertLineBreak( const ESelection& rSel )
565 DBG_CHKTHIS(Outliner,0);
566 bFirstParaIsEmpty = sal_False;
567 pEditEngine->QuickInsertLineBreak( rSel );
570 void Outliner::QuickFormatDoc( sal_Bool bFull )
572 DBG_CHKTHIS(Outliner,0);
573 pEditEngine->QuickFormatDoc( bFull );
576 void Outliner::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
578 DBG_CHKTHIS(Outliner,0);
580 // reset bullet size
581 sal_Int32 nParagraphs = pParaList->GetParagraphCount();
582 for ( sal_Int32 nPara = 0; nPara < nParagraphs; nPara++ )
584 Paragraph* pPara = pParaList->GetParagraph( nPara );
585 if ( pPara )
586 pPara->aBulSize.Width() = -1;
589 pEditEngine->SetGlobalCharStretching( nX, nY );
592 void Outliner::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const
594 DBG_CHKTHIS(Outliner,0);
595 pEditEngine->GetGlobalCharStretching( rX, rY );
598 void Outliner::EraseVirtualDevice()
600 DBG_CHKTHIS(Outliner,0);
601 pEditEngine->EraseVirtualDevice();
604 sal_Bool Outliner::ShouldCreateBigTextObject() const
606 DBG_CHKTHIS(Outliner,0);
607 return pEditEngine->ShouldCreateBigTextObject();
610 void Outliner::SetVertical( sal_Bool b )
612 DBG_CHKTHIS(Outliner,0);
613 pEditEngine->SetVertical( b );
616 sal_Bool Outliner::IsVertical() const
618 DBG_CHKTHIS(Outliner,0);
619 return pEditEngine->IsVertical();
622 void Outliner::SetFixedCellHeight( sal_Bool bUseFixedCellHeight )
624 DBG_CHKTHIS(Outliner,0);
625 pEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
628 void Outliner::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
630 DBG_CHKTHIS(Outliner,0);
631 pEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
634 EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const
636 return pEditEngine->GetDefaultHorizontalTextDirection();
639 sal_uInt16 Outliner::GetScriptType( const ESelection& rSelection ) const
641 DBG_CHKTHIS(Outliner,0);
642 return pEditEngine->GetScriptType( rSelection );
645 LanguageType Outliner::GetLanguage( sal_Int32 nPara, sal_uInt16 nPos ) const
647 DBG_CHKTHIS(Outliner,0);
648 return pEditEngine->GetLanguage( nPara, nPos );
651 void Outliner::RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich )
653 DBG_CHKTHIS(Outliner,0);
654 pEditEngine->RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
657 void Outliner::EnableAutoColor( sal_Bool b )
659 DBG_CHKTHIS(Outliner,0);
660 pEditEngine->EnableAutoColor( b );
663 void Outliner::ForceAutoColor( sal_Bool b )
665 DBG_CHKTHIS(Outliner,0);
666 pEditEngine->ForceAutoColor( b );
669 sal_Bool Outliner::IsForceAutoColor() const
671 DBG_CHKTHIS(Outliner,0);
672 return pEditEngine->IsForceAutoColor();
675 void Outliner::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
677 pEditEngine->StartSpelling(rEditView, bMultipleDoc);
680 bool Outliner::SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking )
682 return pEditEngine->SpellSentence(rEditView, rToFill, bIsGrammarChecking );
685 void Outliner::PutSpellingToSentenceStart( EditView& rEditView )
687 pEditEngine->PutSpellingToSentenceStart( rEditView );
690 void Outliner::ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck )
692 pEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck );
695 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */