1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
42 using namespace ::com::sun::star::uno
;
43 using namespace ::com::sun::star::linguistic2
;
46 // ====================== Simple pass-through =======================
49 void Outliner::SetUpdateMode( bool bUpdate
)
51 pEditEngine
->SetUpdateMode( bUpdate
);
55 bool Outliner::GetUpdateMode() const
57 return pEditEngine
->GetUpdateMode();
60 const SfxItemSet
& Outliner::GetEmptyItemSet() const
62 return pEditEngine
->GetEmptyItemSet();
65 void Outliner::EnableUndo( bool bEnable
)
67 pEditEngine
->EnableUndo( bEnable
);
70 bool Outliner::IsUndoEnabled() const
72 return pEditEngine
->IsUndoEnabled();
75 MapMode
Outliner::GetRefMapMode() const
77 return pEditEngine
->GetRefMapMode();
80 void Outliner::SetRefMapMode( const MapMode
& rMMode
)
82 pEditEngine
->SetRefMapMode( rMMode
);
85 void Outliner::SetBackgroundColor( const Color
& rColor
)
87 pEditEngine
->SetBackgroundColor( rColor
);
90 Color
Outliner::GetBackgroundColor() const
92 return pEditEngine
->GetBackgroundColor();
96 void Outliner::ClearModifyFlag()
98 pEditEngine
->ClearModifyFlag();
101 bool Outliner::IsModified() const
103 return pEditEngine
->IsModified();
106 sal_uLong
Outliner::GetTextHeight() const
108 return pEditEngine
->GetTextHeight();
111 void Outliner::SetModifyHdl( const Link
<>& rLink
)
113 pEditEngine
->SetModifyHdl( rLink
);
116 Link
<> Outliner::GetModifyHdl() const
118 return pEditEngine
->GetModifyHdl();
121 void Outliner::SetNotifyHdl( const Link
<>& rLink
)
123 pEditEngine
->aOutlinerNotifyHdl
= rLink
;
126 pEditEngine
->SetNotifyHdl( LINK( this, Outliner
, EditEngineNotifyHdl
) );
128 pEditEngine
->SetNotifyHdl( Link
<>() );
132 void Outliner::SetStatusEventHdl( const Link
<>& rLink
)
134 pEditEngine
->SetStatusEventHdl( rLink
);
137 Link
<> Outliner::GetStatusEventHdl() const
139 return pEditEngine
->GetStatusEventHdl();
142 void Outliner::SetDefTab( sal_uInt16 nTab
)
144 pEditEngine
->SetDefTab( nTab
);
147 bool Outliner::IsFlatMode() const
149 return pEditEngine
->IsFlatMode();
152 bool Outliner::UpdateFields()
154 return pEditEngine
->UpdateFields();
157 void Outliner::RemoveFields( bool bKeepFieldText
, TypeId aType
)
159 pEditEngine
->RemoveFields( bKeepFieldText
, aType
);
162 void Outliner::SetWordDelimiters( const OUString
& rDelimiters
)
164 pEditEngine
->SetWordDelimiters( rDelimiters
);
167 OUString
Outliner::GetWordDelimiters() const
169 return pEditEngine
->GetWordDelimiters();
172 OUString
Outliner::GetWord( sal_Int32 nPara
, sal_Int32 nIndex
)
174 return pEditEngine
->GetWord( nPara
, nIndex
);
177 void Outliner::Draw( OutputDevice
* pOutDev
, const Rectangle
& rOutRect
)
179 pEditEngine
->Draw( pOutDev
, rOutRect
);
182 void Outliner::Draw( OutputDevice
* pOutDev
, const Point
& rStartPos
, short nOrientation
)
184 pEditEngine
->Draw( pOutDev
, rStartPos
, nOrientation
);
187 void Outliner::SetPaperSize( const Size
& rSize
)
189 pEditEngine
->SetPaperSize( rSize
);
192 const Size
& Outliner::GetPaperSize() const
194 return pEditEngine
->GetPaperSize();
197 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon
& rPolyPolygon
)
199 pEditEngine
->SetPolygon( rPolyPolygon
);
202 void Outliner::SetPolygon( const basegfx::B2DPolyPolygon
& rPolyPolygon
, const basegfx::B2DPolyPolygon
* pLinePolyPolygon
)
204 pEditEngine
->SetPolygon( rPolyPolygon
, pLinePolyPolygon
);
207 void Outliner::ClearPolygon()
209 pEditEngine
->ClearPolygon();
212 const Size
& Outliner::GetMinAutoPaperSize() const
214 return pEditEngine
->GetMinAutoPaperSize();
217 void Outliner::SetMinAutoPaperSize( const Size
& rSz
)
219 pEditEngine
->SetMinAutoPaperSize( rSz
);
222 const Size
& Outliner::GetMaxAutoPaperSize() const
224 return pEditEngine
->GetMaxAutoPaperSize();
227 void Outliner::SetMaxAutoPaperSize( const Size
& rSz
)
229 pEditEngine
->SetMaxAutoPaperSize( rSz
);
232 bool Outliner::IsExpanded( Paragraph
* pPara
) const
234 return pParaList
->HasVisibleChildren( pPara
);
237 Paragraph
* Outliner::GetParent( Paragraph
* pParagraph
) const
239 return pParaList
->GetParent( pParagraph
);
242 sal_Int32
Outliner::GetChildCount( Paragraph
* pParent
) const
244 return pParaList
->GetChildCount( pParent
);
247 Size
Outliner::CalcTextSize()
249 return Size(pEditEngine
->CalcTextWidth(),pEditEngine
->GetTextHeight());
252 Size
Outliner::CalcTextSizeNTP()
254 return Size(pEditEngine
->CalcTextWidth(),pEditEngine
->GetTextHeightNTP());
257 void Outliner::SetStyleSheetPool( SfxStyleSheetPool
* pSPool
)
259 pEditEngine
->SetStyleSheetPool( pSPool
);
262 SfxStyleSheetPool
* Outliner::GetStyleSheetPool()
264 return pEditEngine
->GetStyleSheetPool();
267 SfxStyleSheet
* Outliner::GetStyleSheet( sal_Int32 nPara
)
269 return pEditEngine
->GetStyleSheet( nPara
);
272 bool Outliner::IsInSelectionMode() const
274 return pEditEngine
->IsInSelectionMode();
277 void Outliner::SetControlWord( EEControlBits nWord
)
279 pEditEngine
->SetControlWord( nWord
);
282 EEControlBits
Outliner::GetControlWord() const
284 return pEditEngine
->GetControlWord();
287 void Outliner::SetAsianCompressionMode( sal_uInt16 n
)
289 pEditEngine
->SetAsianCompressionMode( n
);
292 void Outliner::SetKernAsianPunctuation( bool b
)
294 pEditEngine
->SetKernAsianPunctuation( b
);
297 void Outliner::SetAddExtLeading( bool bExtLeading
)
299 pEditEngine
->SetAddExtLeading( bExtLeading
);
302 void Outliner::UndoActionStart( sal_uInt16 nId
)
304 pEditEngine
->UndoActionStart( nId
);
307 void Outliner::UndoActionEnd( sal_uInt16 nId
)
309 pEditEngine
->UndoActionEnd( nId
);
312 void Outliner::InsertUndo( EditUndo
* pUndo
)
314 pEditEngine
->GetUndoManager().AddUndoAction( pUndo
, false );
317 bool Outliner::IsInUndo()
319 return pEditEngine
->IsInUndo();
322 sal_uLong
Outliner::GetLineCount( sal_Int32 nParagraph
) const
324 return pEditEngine
->GetLineCount( nParagraph
);
327 sal_Int32
Outliner::GetLineLen( sal_Int32 nParagraph
, sal_Int32 nLine
) const
329 return pEditEngine
->GetLineLen( nParagraph
, nLine
);
332 sal_uLong
Outliner::GetLineHeight( sal_Int32 nParagraph
, sal_Int32 nLine
)
334 return pEditEngine
->GetLineHeight( nParagraph
, nLine
);
337 void Outliner::RemoveCharAttribs( sal_Int32 nPara
, sal_uInt16 nWhich
)
339 pEditEngine
->RemoveCharAttribs( nPara
, nWhich
);
342 EESpellState
Outliner::HasSpellErrors()
344 return pEditEngine
->HasSpellErrors();
347 bool Outliner::HasConvertibleTextPortion( LanguageType nLang
)
349 return pEditEngine
->HasConvertibleTextPortion( nLang
);
352 bool Outliner::ConvertNextDocument()
357 void Outliner::SetDefaultLanguage( LanguageType eLang
)
359 pEditEngine
->SetDefaultLanguage( eLang
);
362 LanguageType
Outliner::GetDefaultLanguage() const
364 return pEditEngine
->GetDefaultLanguage();
367 void Outliner::CompleteOnlineSpelling()
369 pEditEngine
->CompleteOnlineSpelling();
372 bool Outliner::HasText( const SvxSearchItem
& rSearchItem
)
374 return pEditEngine
->HasText( rSearchItem
);
377 void Outliner::SetEditTextObjectPool( SfxItemPool
* pPool
)
379 pEditEngine
->SetEditTextObjectPool( pPool
);
382 SfxItemPool
* Outliner::GetEditTextObjectPool() const
384 return pEditEngine
->GetEditTextObjectPool();
387 bool Outliner::SpellNextDocument()
393 void Outliner::SetSpeller( Reference
< XSpellChecker1
> &xSpeller
)
395 pEditEngine
->SetSpeller( xSpeller
);
397 Reference
< XSpellChecker1
> Outliner::GetSpeller()
399 return pEditEngine
->GetSpeller();
402 void Outliner::SetForbiddenCharsTable( rtl::Reference
<SvxForbiddenCharactersTable
> xForbiddenChars
)
404 EditEngine::SetForbiddenCharsTable( xForbiddenChars
);
407 void Outliner::SetHyphenator( Reference
< XHyphenator
>& xHyph
)
409 pEditEngine
->SetHyphenator( xHyph
);
412 OutputDevice
* Outliner::GetRefDevice() const
414 return pEditEngine
->GetRefDevice();
417 sal_uLong
Outliner::GetTextHeight( sal_Int32 nParagraph
) const
419 return pEditEngine
->GetTextHeight(nParagraph
);
422 Point
Outliner::GetDocPos( const Point
& rPaperPos
) const
424 return pEditEngine
->GetDocPos( rPaperPos
);
427 Point
Outliner::GetDocPosTopLeft( sal_Int32 nParagraph
)
429 return pEditEngine
->GetDocPosTopLeft( nParagraph
);
432 bool Outliner::IsTextPos( const Point
& rPaperPos
, sal_uInt16 nBorder
)
434 return IsTextPos( rPaperPos
, nBorder
, NULL
);
437 bool Outliner::IsTextPos( const Point
& rPaperPos
, sal_uInt16 nBorder
, bool* pbBullet
)
441 bool bTextPos
= pEditEngine
->IsTextPos( rPaperPos
, nBorder
);
444 Point aDocPos
= GetDocPos( rPaperPos
);
445 sal_Int32 nPara
= pEditEngine
->FindParagraph( aDocPos
.Y() );
446 if ( ( nPara
!= EE_PARA_NOT_FOUND
) && ImplHasNumberFormat( nPara
) )
448 Rectangle aBulArea
= ImpCalcBulletArea( nPara
, true, true );
449 if ( aBulArea
.IsInside( rPaperPos
) )
461 void Outliner::QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
)
463 pEditEngine
->QuickSetAttribs( rSet
, rSel
);
466 void Outliner::QuickInsertText( const OUString
& rText
, const ESelection
& rSel
)
468 bFirstParaIsEmpty
= false;
469 pEditEngine
->QuickInsertText( rText
, rSel
);
472 void Outliner::QuickDelete( const ESelection
& rSel
)
474 bFirstParaIsEmpty
= false;
475 pEditEngine
->QuickDelete( rSel
);
478 void Outliner::QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
)
480 bFirstParaIsEmpty
= false;
481 pEditEngine
->QuickInsertField( rFld
, rSel
);
484 void Outliner::QuickInsertLineBreak( const ESelection
& rSel
)
486 bFirstParaIsEmpty
= false;
487 pEditEngine
->QuickInsertLineBreak( rSel
);
490 void Outliner::QuickFormatDoc( bool bFull
)
492 pEditEngine
->QuickFormatDoc( bFull
);
495 void Outliner::SetGlobalCharStretching( sal_uInt16 nX
, sal_uInt16 nY
)
499 sal_Int32 nParagraphs
= pParaList
->GetParagraphCount();
500 for ( sal_Int32 nPara
= 0; nPara
< nParagraphs
; nPara
++ )
502 Paragraph
* pPara
= pParaList
->GetParagraph( nPara
);
504 pPara
->aBulSize
.Width() = -1;
507 pEditEngine
->SetGlobalCharStretching( nX
, nY
);
510 void Outliner::GetGlobalCharStretching( sal_uInt16
& rX
, sal_uInt16
& rY
) const
512 pEditEngine
->GetGlobalCharStretching( rX
, rY
);
515 void Outliner::EraseVirtualDevice()
517 pEditEngine
->EraseVirtualDevice();
520 bool Outliner::ShouldCreateBigTextObject() const
522 return pEditEngine
->ShouldCreateBigTextObject();
525 const EditEngine
& Outliner::GetEditEngine() const
530 void Outliner::SetVertical( bool b
)
532 pEditEngine
->SetVertical( b
);
535 bool Outliner::IsVertical() const
537 return pEditEngine
->IsVertical();
540 void Outliner::SetFixedCellHeight( bool bUseFixedCellHeight
)
542 pEditEngine
->SetFixedCellHeight( bUseFixedCellHeight
);
545 void Outliner::SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir
)
547 pEditEngine
->SetDefaultHorizontalTextDirection( eHTextDir
);
550 EEHorizontalTextDirection
Outliner::GetDefaultHorizontalTextDirection() const
552 return pEditEngine
->GetDefaultHorizontalTextDirection();
555 SvtScriptType
Outliner::GetScriptType( const ESelection
& rSelection
) const
557 return pEditEngine
->GetScriptType( rSelection
);
560 LanguageType
Outliner::GetLanguage( sal_Int32 nPara
, sal_Int32 nPos
) const
562 return pEditEngine
->GetLanguage( nPara
, nPos
);
565 void Outliner::RemoveAttribs( const ESelection
& rSelection
, bool bRemoveParaAttribs
, sal_uInt16 nWhich
)
567 pEditEngine
->RemoveAttribs( rSelection
, bRemoveParaAttribs
, nWhich
);
570 void Outliner::EnableAutoColor( bool b
)
572 pEditEngine
->EnableAutoColor( b
);
575 void Outliner::ForceAutoColor( bool b
)
577 pEditEngine
->ForceAutoColor( b
);
580 bool Outliner::IsForceAutoColor() const
582 return pEditEngine
->IsForceAutoColor();
585 void Outliner::StartSpelling(EditView
& rEditView
, bool bMultipleDoc
)
587 pEditEngine
->StartSpelling(rEditView
, bMultipleDoc
);
590 bool Outliner::SpellSentence(EditView
& rEditView
, svx::SpellPortions
& rToFill
, bool bIsGrammarChecking
)
592 return pEditEngine
->SpellSentence(rEditView
, rToFill
, bIsGrammarChecking
);
595 void Outliner::PutSpellingToSentenceStart( EditView
& rEditView
)
597 pEditEngine
->PutSpellingToSentenceStart( rEditView
);
600 void Outliner::ApplyChangedSentence(EditView
& rEditView
, const svx::SpellPortions
& rNewPortions
, bool bRecheck
)
602 pEditEngine
->ApplyChangedSentence( rEditView
, rNewPortions
, bRecheck
);
605 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */