nss: upgrade to release 3.73
[LibreOffice.git] / editeng / source / outliner / outlin2.cxx
blobff3d1583a5f1156d164545aa3376589c544d6e9c
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 <editeng/editeng.hxx>
22 #include <editeng/editview.hxx>
23 #include <editeng/editdata.hxx>
24 #include <editeng/editund2.hxx>
26 #include <svl/style.hxx>
27 #include <vcl/mapmod.hxx>
29 #include <editeng/forbiddencharacterstable.hxx>
31 #include <editeng/outliner.hxx>
32 #include "paralist.hxx"
33 #include "outleeng.hxx"
34 #include <editeng/editstat.hxx>
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::linguistic2;
41 // ====================== Simple pass-through =======================
44 void Outliner::SetUpdateMode( bool bUpdate )
46 pEditEngine->SetUpdateMode( bUpdate );
50 bool Outliner::GetUpdateMode() const
52 return pEditEngine->GetUpdateMode();
55 const SfxItemSet& Outliner::GetEmptyItemSet() const
57 return pEditEngine->GetEmptyItemSet();
60 void Outliner::EnableUndo( bool bEnable )
62 pEditEngine->EnableUndo( bEnable );
65 bool Outliner::IsUndoEnabled() const
67 return pEditEngine->IsUndoEnabled();
70 MapMode const & Outliner::GetRefMapMode() const
72 return pEditEngine->GetRefMapMode();
75 void Outliner::SetRefMapMode( const MapMode& rMMode )
77 pEditEngine->SetRefMapMode( rMMode );
80 void Outliner::SetBackgroundColor( const Color& rColor )
82 pEditEngine->SetBackgroundColor( rColor );
85 Color const & Outliner::GetBackgroundColor() const
87 return pEditEngine->GetBackgroundColor();
91 void Outliner::ClearModifyFlag()
93 pEditEngine->ClearModifyFlag();
96 bool Outliner::IsModified() const
98 return pEditEngine->IsModified();
101 sal_uLong Outliner::GetTextHeight() const
103 return pEditEngine->GetTextHeight();
106 void Outliner::SetModifyHdl( const Link<LinkParamNone*,void>& rLink )
108 pEditEngine->SetModifyHdl( rLink );
111 Link<LinkParamNone*,void> const & Outliner::GetModifyHdl() const
113 return pEditEngine->GetModifyHdl();
116 void Outliner::SetNotifyHdl( const Link<EENotify&,void>& rLink )
118 pEditEngine->aOutlinerNotifyHdl = rLink;
120 if ( rLink.IsSet() )
121 pEditEngine->SetNotifyHdl( LINK( this, Outliner, EditEngineNotifyHdl ) );
122 else
123 pEditEngine->SetNotifyHdl( Link<EENotify&,void>() );
126 void Outliner::SetStatusEventHdl( const Link<EditStatus&, void>& rLink )
128 pEditEngine->SetStatusEventHdl( rLink );
131 Link<EditStatus&, void> const & Outliner::GetStatusEventHdl() const
133 return pEditEngine->GetStatusEventHdl();
136 void Outliner::SetDefTab( sal_uInt16 nTab )
138 pEditEngine->SetDefTab( nTab );
141 bool Outliner::IsFlatMode() const
143 return pEditEngine->IsFlatMode();
146 bool Outliner::UpdateFields()
148 return pEditEngine->UpdateFields();
151 void Outliner::RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData )
153 pEditEngine->RemoveFields( isFieldData );
156 void Outliner::SetWordDelimiters( const OUString& rDelimiters )
158 pEditEngine->SetWordDelimiters( rDelimiters );
161 OUString const & Outliner::GetWordDelimiters() const
163 return pEditEngine->GetWordDelimiters();
166 OUString Outliner::GetWord( sal_Int32 nPara, sal_Int32 nIndex )
168 return pEditEngine->GetWord( nPara, nIndex );
171 void Outliner::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect )
173 pEditEngine->Draw( pOutDev, rOutRect );
176 void Outliner::Draw( OutputDevice* pOutDev, const Point& rStartPos )
178 pEditEngine->Draw( pOutDev, rStartPos );
181 void Outliner::SetPaperSize( const Size& rSize )
183 pEditEngine->SetPaperSize( rSize );
186 const Size& Outliner::GetPaperSize() const
188 return pEditEngine->GetPaperSize();
191 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
193 pEditEngine->SetPolygon( rPolyPolygon );
196 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
198 pEditEngine->SetPolygon( rPolyPolygon, pLinePolyPolygon);
201 void Outliner::ClearPolygon()
203 pEditEngine->ClearPolygon();
206 const Size& Outliner::GetMinAutoPaperSize() const
208 return pEditEngine->GetMinAutoPaperSize();
211 void Outliner::SetMinAutoPaperSize( const Size& rSz )
213 pEditEngine->SetMinAutoPaperSize( rSz );
216 const Size& Outliner::GetMaxAutoPaperSize() const
218 return pEditEngine->GetMaxAutoPaperSize();
221 void Outliner::SetMaxAutoPaperSize( const Size& rSz )
223 pEditEngine->SetMaxAutoPaperSize( rSz );
226 bool Outliner::IsExpanded( Paragraph const * pPara ) const
228 return pParaList->HasVisibleChildren( pPara );
231 Paragraph* Outliner::GetParent( Paragraph const * pParagraph ) const
233 return pParaList->GetParent( pParagraph );
236 sal_Int32 Outliner::GetChildCount( Paragraph const * pParent ) const
238 return pParaList->GetChildCount( pParent );
241 Size Outliner::CalcTextSize()
243 return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeight());
246 Size Outliner::CalcTextSizeNTP()
248 return Size(pEditEngine->CalcTextWidth(),pEditEngine->GetTextHeightNTP());
251 void Outliner::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
253 pEditEngine->SetStyleSheetPool( pSPool );
256 SfxStyleSheetPool* Outliner::GetStyleSheetPool()
258 return pEditEngine->GetStyleSheetPool();
261 SfxStyleSheet* Outliner::GetStyleSheet( sal_Int32 nPara )
263 return pEditEngine->GetStyleSheet( nPara );
266 bool Outliner::IsInSelectionMode() const
268 return pEditEngine->IsInSelectionMode();
271 void Outliner::SetControlWord( EEControlBits nWord )
273 pEditEngine->SetControlWord( nWord );
276 EEControlBits Outliner::GetControlWord() const
278 return pEditEngine->GetControlWord();
281 void Outliner::SetAsianCompressionMode( CharCompressType n )
283 pEditEngine->SetAsianCompressionMode( n );
286 void Outliner::SetKernAsianPunctuation( bool b )
288 pEditEngine->SetKernAsianPunctuation( b );
291 void Outliner::SetAddExtLeading( bool bExtLeading )
293 pEditEngine->SetAddExtLeading( bExtLeading );
296 void Outliner::UndoActionStart( sal_uInt16 nId )
298 pEditEngine->UndoActionStart( nId );
301 void Outliner::UndoActionEnd()
303 pEditEngine->UndoActionEnd();
306 void Outliner::InsertUndo( std::unique_ptr<EditUndo> pUndo )
308 pEditEngine->GetUndoManager().AddUndoAction( std::move(pUndo) );
311 bool Outliner::IsInUndo() const
313 return pEditEngine->IsInUndo();
316 sal_uLong Outliner::GetLineCount( sal_Int32 nParagraph ) const
318 return pEditEngine->GetLineCount( nParagraph );
321 sal_Int32 Outliner::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const
323 return pEditEngine->GetLineLen( nParagraph, nLine );
326 sal_uLong Outliner::GetLineHeight( sal_Int32 nParagraph )
328 return pEditEngine->GetLineHeight( nParagraph );
331 void Outliner::RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich )
333 pEditEngine->RemoveCharAttribs( nPara, nWhich );
336 EESpellState Outliner::HasSpellErrors()
338 return pEditEngine->HasSpellErrors();
341 bool Outliner::HasConvertibleTextPortion( LanguageType nLang )
343 return pEditEngine->HasConvertibleTextPortion( nLang );
346 bool Outliner::ConvertNextDocument()
348 return false;
351 void Outliner::SetDefaultLanguage( LanguageType eLang )
353 pEditEngine->SetDefaultLanguage( eLang );
356 void Outliner::CompleteOnlineSpelling()
358 pEditEngine->CompleteOnlineSpelling();
361 bool Outliner::HasText( const SvxSearchItem& rSearchItem )
363 return pEditEngine->HasText( rSearchItem );
366 void Outliner::SetEditTextObjectPool( SfxItemPool* pPool )
368 pEditEngine->SetEditTextObjectPool( pPool );
371 SfxItemPool* Outliner::GetEditTextObjectPool() const
373 return pEditEngine->GetEditTextObjectPool();
376 bool Outliner::SpellNextDocument()
378 return false;
382 void Outliner::SetSpeller( Reference< XSpellChecker1 > const &xSpeller )
384 pEditEngine->SetSpeller( xSpeller );
387 Reference< XSpellChecker1 > const & Outliner::GetSpeller()
389 return pEditEngine->GetSpeller();
392 void Outliner::SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars)
394 EditEngine::SetForbiddenCharsTable(xForbiddenChars);
397 void Outliner::SetHyphenator( Reference< XHyphenator > const & xHyph )
399 pEditEngine->SetHyphenator( xHyph );
402 OutputDevice* Outliner::GetRefDevice() const
404 return pEditEngine->GetRefDevice();
407 tools::Rectangle Outliner::GetParaBounds( sal_Int32 nParagraph ) const
409 return pEditEngine->GetParaBounds(nParagraph );
412 Point Outliner::GetDocPos( const Point& rPaperPos ) const
414 return pEditEngine->GetDocPos( rPaperPos );
417 bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder )
419 return IsTextPos( rPaperPos, nBorder, nullptr );
422 bool Outliner::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBullet )
424 if ( pbBullet)
425 *pbBullet = false;
426 bool bTextPos = pEditEngine->IsTextPos( rPaperPos, nBorder );
427 if ( !bTextPos )
429 Point aDocPos = GetDocPos( rPaperPos );
430 sal_Int32 nPara = pEditEngine->FindParagraph( aDocPos.Y() );
431 if ( ( nPara != EE_PARA_NOT_FOUND ) && ImplHasNumberFormat( nPara ) )
433 tools::Rectangle aBulArea = ImpCalcBulletArea( nPara, true, true );
434 if ( aBulArea.IsInside( rPaperPos ) )
436 bTextPos = true;
437 if ( pbBullet)
438 *pbBullet = true;
443 return bTextPos;
446 void Outliner::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
448 pEditEngine->QuickSetAttribs( rSet, rSel );
451 void Outliner::QuickInsertText( const OUString& rText, const ESelection& rSel )
453 bFirstParaIsEmpty = false;
454 pEditEngine->QuickInsertText( rText, rSel );
457 void Outliner::QuickDelete( const ESelection& rSel )
459 bFirstParaIsEmpty = false;
460 pEditEngine->QuickDelete( rSel );
463 void Outliner::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
465 bFirstParaIsEmpty = false;
466 pEditEngine->QuickInsertField( rFld, rSel );
469 void Outliner::QuickInsertLineBreak( const ESelection& rSel )
471 bFirstParaIsEmpty = false;
472 pEditEngine->QuickInsertLineBreak( rSel );
475 void Outliner::QuickFormatDoc()
477 pEditEngine->QuickFormatDoc();
480 void Outliner::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
483 // reset bullet size
484 sal_Int32 nParagraphs = pParaList->GetParagraphCount();
485 for ( sal_Int32 nPara = 0; nPara < nParagraphs; nPara++ )
487 Paragraph* pPara = pParaList->GetParagraph( nPara );
488 if ( pPara )
489 pPara->aBulSize.setWidth( -1 );
492 pEditEngine->SetGlobalCharStretching( nX, nY );
495 void Outliner::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const
497 pEditEngine->GetGlobalCharStretching( rX, rY );
500 void Outliner::EraseVirtualDevice()
502 pEditEngine->EraseVirtualDevice();
505 bool Outliner::ShouldCreateBigTextObject() const
507 return pEditEngine->ShouldCreateBigTextObject();
510 const EditEngine& Outliner::GetEditEngine() const
512 return *pEditEngine;
515 void Outliner::SetVertical(bool bVertical)
517 pEditEngine->SetVertical(bVertical);
520 void Outliner::SetRotation(TextRotation nRotation)
522 pEditEngine->SetRotation(nRotation);
525 bool Outliner::IsVertical() const
527 return pEditEngine->IsVertical();
530 bool Outliner::IsTopToBottom() const
532 return pEditEngine->IsTopToBottom();
535 void Outliner::SetFixedCellHeight( bool bUseFixedCellHeight )
537 pEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
540 void Outliner::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
542 pEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
545 EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const
547 return pEditEngine->GetDefaultHorizontalTextDirection();
550 LanguageType Outliner::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
552 return pEditEngine->GetLanguage( nPara, nPos );
555 void Outliner::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich )
557 pEditEngine->RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
560 void Outliner::EnableAutoColor( bool b )
562 pEditEngine->EnableAutoColor( b );
565 void Outliner::ForceAutoColor( bool b )
567 pEditEngine->ForceAutoColor( b );
570 bool Outliner::IsForceAutoColor() const
572 return pEditEngine->IsForceAutoColor();
575 bool Outliner::SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill )
577 return pEditEngine->SpellSentence(rEditView, rToFill );
580 void Outliner::PutSpellingToSentenceStart( EditView const & rEditView )
582 pEditEngine->PutSpellingToSentenceStart( rEditView );
585 void Outliner::ApplyChangedSentence(EditView const & rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck )
587 pEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck );
590 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */