Bump version to 24.04.3.4
[LibreOffice.git] / editeng / source / outliner / outlin2.cxx
blob268c194652c4084b201e9703c0ca82c4eb385583
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 bool Outliner::SetUpdateLayout( bool bUpdate )
46 return pEditEngine->SetUpdateLayout( bUpdate );
50 bool Outliner::IsUpdateLayout() const
52 return pEditEngine->IsUpdateLayout();
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_uInt32 Outliner::GetTextHeight() const
103 return pEditEngine->GetTextHeight();
106 void Outliner::SetModifyHdl( const Link<LinkParamNone*,void>& rLink )
108 pEditEngine->SetModifyHdl( rLink );
111 void Outliner::SetNotifyHdl( const Link<EENotify&,void>& rLink )
113 pEditEngine->aOutlinerNotifyHdl = rLink;
115 if ( rLink.IsSet() )
116 pEditEngine->SetNotifyHdl( LINK( this, Outliner, EditEngineNotifyHdl ) );
117 else
118 pEditEngine->SetNotifyHdl( Link<EENotify&,void>() );
121 void Outliner::SetStatusEventHdl( const Link<EditStatus&, void>& rLink )
123 pEditEngine->SetStatusEventHdl( rLink );
126 Link<EditStatus&, void> const & Outliner::GetStatusEventHdl() const
128 return pEditEngine->GetStatusEventHdl();
131 void Outliner::SetDefTab( sal_uInt16 nTab )
133 pEditEngine->SetDefTab( nTab );
136 bool Outliner::IsFlatMode() const
138 return pEditEngine->IsFlatMode();
141 bool Outliner::UpdateFields()
143 return pEditEngine->UpdateFields();
146 void Outliner::RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData )
148 pEditEngine->RemoveFields( isFieldData );
151 void Outliner::SetWordDelimiters( const OUString& rDelimiters )
153 pEditEngine->SetWordDelimiters( rDelimiters );
156 OUString const & Outliner::GetWordDelimiters() const
158 return pEditEngine->GetWordDelimiters();
161 OUString Outliner::GetWord( sal_Int32 nPara, sal_Int32 nIndex )
163 return pEditEngine->GetWord( nPara, nIndex );
166 void Outliner::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect )
168 pEditEngine->Draw( rOutDev, rOutRect );
171 void Outliner::Draw( OutputDevice& rOutDev, const Point& rStartPos )
173 pEditEngine->Draw( rOutDev, rStartPos );
176 void Outliner::SetPaperSize( const Size& rSize )
178 pEditEngine->SetPaperSize( rSize );
181 const Size& Outliner::GetPaperSize() const
183 return pEditEngine->GetPaperSize();
186 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon )
188 pEditEngine->SetPolygon( rPolyPolygon );
191 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon)
193 pEditEngine->SetPolygon( rPolyPolygon, pLinePolyPolygon);
196 void Outliner::ClearPolygon()
198 pEditEngine->ClearPolygon();
201 const Size& Outliner::GetMinAutoPaperSize() const
203 return pEditEngine->GetMinAutoPaperSize();
206 void Outliner::SetMinAutoPaperSize( const Size& rSz )
208 pEditEngine->SetMinAutoPaperSize( rSz );
211 const Size& Outliner::GetMaxAutoPaperSize() const
213 return pEditEngine->GetMaxAutoPaperSize();
216 void Outliner::SetMaxAutoPaperSize( const Size& rSz )
218 pEditEngine->SetMaxAutoPaperSize( rSz );
221 void Outliner::SetMinColumnWrapHeight(tools::Long nVal)
223 pEditEngine->SetMinColumnWrapHeight(nVal);
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_uInt32 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_uInt32 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.Contains( 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 ScalingParameters Outliner::getScalingParameters() const
482 return pEditEngine->getScalingParameters();
485 void Outliner::setScalingParameters(ScalingParameters const& rScalingParameters)
487 // reset bullet size
488 sal_Int32 nParagraphs = pParaList->GetParagraphCount();
489 for ( sal_Int32 nPara = 0; nPara < nParagraphs; nPara++ )
491 Paragraph* pPara = pParaList->GetParagraph( nPara );
492 if ( pPara )
493 pPara->aBulSize.setWidth( -1 );
496 pEditEngine->setScalingParameters(rScalingParameters);
499 void Outliner::setRoundFontSizeToPt(bool bRound) const
501 pEditEngine->setRoundFontSizeToPt(bRound);
504 void Outliner::EraseVirtualDevice()
506 pEditEngine->EraseVirtualDevice();
509 bool Outliner::ShouldCreateBigTextObject() const
511 return pEditEngine->ShouldCreateBigTextObject();
514 const EditEngine& Outliner::GetEditEngine() const
516 return *pEditEngine;
519 void Outliner::SetVertical(bool bVertical)
521 pEditEngine->SetVertical(bVertical);
524 void Outliner::SetRotation(TextRotation nRotation)
526 pEditEngine->SetRotation(nRotation);
529 bool Outliner::IsVertical() const
531 return pEditEngine->IsEffectivelyVertical();
534 bool Outliner::IsTopToBottom() const
536 return pEditEngine->IsTopToBottom();
539 void Outliner::SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
541 pEditEngine->SetTextColumns(nColumns, nSpacing);
544 void Outliner::SetFixedCellHeight( bool bUseFixedCellHeight )
546 pEditEngine->SetFixedCellHeight( bUseFixedCellHeight );
549 void Outliner::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir )
551 pEditEngine->SetDefaultHorizontalTextDirection( eHTextDir );
554 EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const
556 return pEditEngine->GetDefaultHorizontalTextDirection();
559 LanguageType Outliner::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
561 return pEditEngine->GetLanguage( nPara, nPos ).nLang;
564 void Outliner::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich )
566 pEditEngine->RemoveAttribs( rSelection, bRemoveParaAttribs, nWhich );
569 void Outliner::EnableAutoColor( bool b )
571 pEditEngine->EnableAutoColor( b );
574 void Outliner::ForceAutoColor( bool b )
576 pEditEngine->ForceAutoColor( b );
579 bool Outliner::IsForceAutoColor() const
581 return pEditEngine->IsForceAutoColor();
584 bool Outliner::SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill )
586 return pEditEngine->SpellSentence(rEditView, rToFill );
589 void Outliner::PutSpellingToSentenceStart( EditView const & rEditView )
591 pEditEngine->PutSpellingToSentenceStart( rEditView );
594 void Outliner::ApplyChangedSentence(EditView const & rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck )
596 pEditEngine->ApplyChangedSentence( rEditView, rNewPortions, bRecheck );
599 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */