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 .
19 #ifndef INCLUDED_EDITENG_OUTLINER_HXX
20 #define INCLUDED_EDITENG_OUTLINER_HXX
22 #include <editeng/editdata.hxx>
23 #include <editeng/editstat.hxx>
24 #include <editeng/numitem.hxx>
25 #include <i18nlangtag/lang.h>
26 #include <rtl/ustring.hxx>
27 #include <svl/SfxBroadcaster.hxx>
28 #include <svl/languageoptions.hxx>
29 #include <tools/gen.hxx>
30 #include <tools/color.hxx>
31 #include <tools/contnr.hxx>
32 #include <vcl/graph.hxx>
33 #include <vcl/outdev.hxx>
34 #include <tools/link.hxx>
35 #include <rsc/rscsfx.hxx>
36 #include <editeng/editengdllapi.h>
37 #include <com/sun/star/lang/Locale.hpp>
39 #include <svtools/grfmgr.hxx>
41 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
42 #include <com/sun/star/uno/Reference.h>
44 #include <rtl/ref.hxx>
45 #include <editeng/svxfont.hxx>
46 #include <editeng/eedata.hxx>
47 #include <editeng/paragraphdata.hxx>
48 #include <o3tl/typed_flags_set.hxx>
54 class OutlinerEditEng
;
59 class OutlinerParaObject
;
65 namespace vcl
{ class Window
; }
72 namespace tools
{ class PolyPolygon
; }
73 class SfxStyleSheetPool
;
77 class SvxNumBulletItem
;
78 class SvxNumberFormat
;
81 class SvKeyValueIterator
;
82 class SvxForbiddenCharactersTable
;
83 class OverflowingText
;
84 class NonOverflowingText
;
85 class OutlinerViewShell
;
95 namespace com
{ namespace sun
{ namespace star
{ namespace linguistic2
{
101 typedef std::vector
<SpellPortion
> SpellPortions
;
104 namespace basegfx
{ class B2DPolyPolygon
; }
106 // internal use only!
111 SETBULLETTEXT
= 0x8000,
116 template<> struct typed_flags
<ParaFlag
> : is_typed_flags
<ParaFlag
, 0xc100> {};
120 #define OLUNDO_DEPTH EDITUNDO_USER
121 // #define OLUNDO_HEIGHT EDITUNDO_USER+1
122 #define OLUNDO_EXPAND EDITUNDO_USER+2
123 #define OLUNDO_COLLAPSE EDITUNDO_USER+3
124 // #define OLUNDO_REMOVE EDITUNDO_USER+4
125 #define OLUNDO_ATTR EDITUNDO_USER+5
126 #define OLUNDO_INSERT EDITUNDO_USER+6
127 // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
129 class Paragraph
: protected ParagraphData
132 friend class Outliner
;
133 friend class ParagraphList
;
134 friend class OutlinerView
;
135 friend class OutlinerParaObject
;
136 friend class OutlinerEditEng
;
137 friend class OutlinerUndoCheckPara
;
138 friend class OutlinerUndoChangeParaFlags
;
140 Paragraph
& operator=(const Paragraph
& rPara
) = delete;
147 bool IsVisible() const { return bVisible
; }
148 void SetText( const OUString
& rText
) { aBulText
= rText
; aBulSize
.Width() = -1; }
149 void Invalidate() { aBulSize
.Width() = -1; }
150 void SetDepth( sal_Int16 nNewDepth
) { nDepth
= nNewDepth
; aBulSize
.Width() = -1; }
151 const OUString
& GetText() const { return aBulText
; }
153 Paragraph( sal_Int16 nDepth
);
154 Paragraph( const Paragraph
& ) = delete;
155 Paragraph( const ParagraphData
& );
158 sal_Int16
GetDepth() const { return nDepth
; }
160 sal_Int16
GetNumberingStartValue() const { return mnNumberingStartValue
; }
161 void SetNumberingStartValue( sal_Int16 nNumberingStartValue
);
163 bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart
; }
164 void SetParaIsNumberingRestart( bool bParaIsNumberingRestart
);
166 void SetFlag( ParaFlag nFlag
) { nFlags
|= nFlag
; }
167 void RemoveFlag( ParaFlag nFlag
) { nFlags
&= ~nFlag
; }
168 bool HasFlag( ParaFlag nFlag
) const { return bool(nFlags
& nFlag
); }
170 void dumpAsXml(struct _xmlTextWriter
* pWriter
) const;
175 sal_Int32 nStartPara
;
178 ParaRange( sal_Int32 nS
, sal_Int32 nE
) : nStartPara(nS
), nEndPara(nE
) {}
183 inline void ParaRange::Adjust()
185 if ( nStartPara
> nEndPara
)
187 std::swap(nStartPara
, nEndPara
);
191 class EDITENG_DLLPUBLIC OutlinerView final
193 friend class Outliner
;
200 enum class MouseTarget
{
203 Hypertext
= 2, // Outside OutputArea
204 Outside
= 3 // Outside OutputArea
207 EDITENG_DLLPRIVATE
void ImplExpandOrCollaps( sal_Int32 nStartPara
, sal_Int32 nEndPara
, bool bExpand
);
209 EDITENG_DLLPRIVATE sal_Int32
ImpCheckMousePos( const Point
& rPosPixel
, MouseTarget
& reTarget
);
210 EDITENG_DLLPRIVATE
void ImpToggleExpand( Paragraph
* pParentPara
);
211 EDITENG_DLLPRIVATE ParaRange
ImpGetSelectedParagraphs( bool bIncludeHiddenChildren
);
213 EDITENG_DLLPRIVATE sal_Int32
ImpInitPaste( sal_Int32
& rStart
);
214 EDITENG_DLLPRIVATE
void ImpPasted( sal_Int32 nStart
, sal_Int32 nPrevParaCount
, sal_Int32 nSize
);
215 EDITENG_DLLPRIVATE sal_Int32
ImpCalcSelectedPages( bool bIncludeFirstSelected
);
217 Link
<LinkParamNone
*,void> aEndCutPasteLink
;
220 OutlinerView( Outliner
* pOut
, vcl::Window
* pWindow
);
223 EditView
& GetEditView() const { return *pEditView
; }
225 void Scroll( long nHorzScroll
, long nVertScroll
);
227 void Paint( const Rectangle
& rRect
, OutputDevice
* pTargetDevice
= nullptr );
228 bool PostKeyEvent( const KeyEvent
& rKEvt
, vcl::Window
* pFrameWin
= nullptr );
229 bool MouseButtonDown( const MouseEvent
& );
230 bool MouseButtonUp( const MouseEvent
& );
232 bool MouseMove( const MouseEvent
& );
234 void ShowCursor( bool bGotoCursor
= true, bool bActivate
= false );
235 void HideCursor( bool bDeactivate
= false );
237 Outliner
* GetOutliner() const { return pOwner
; }
239 void SetWindow( vcl::Window
* pWindow
);
240 vcl::Window
* GetWindow() const;
242 void SetReadOnly( bool bReadOnly
);
243 bool IsReadOnly() const;
245 void SetOutputArea( const Rectangle
& rRect
);
246 Rectangle
GetOutputArea() const;
248 Rectangle
GetVisArea() const;
250 void CreateSelectionList (std::vector
<Paragraph
*> &aSelList
) ;
252 // Retruns the number of selected paragraphs
253 sal_Int32
Select( Paragraph
* pParagraph
, bool bSelect
= true);
255 OUString
GetSelected() const;
256 void SelectRange( sal_Int32 nFirst
, sal_Int32 nCount
);
257 void SetAttribs( const SfxItemSet
& );
258 void Indent( short nDiff
);
259 void AdjustDepth( short nDX
); // Later replace with Indent!
261 void AdjustHeight( long nDY
);
263 sal_uLong
Read( SvStream
& rInput
, const OUString
& rBaseURL
, EETextFormat eFormat
, SvKeyValueIterator
* pHTTPHeaderAttrs
);
265 void InsertText( const OUString
& rNew
, bool bSelect
= false );
266 void InsertText( const OutlinerParaObject
& rParaObj
);
272 void SetBackgroundColor( const Color
& rColor
);
273 Color
GetBackgroundColor();
275 /// Informs this edit view about which view shell contains it.
276 void RegisterViewShell(OutlinerViewShell
* pViewShell
);
278 SfxItemSet
GetAttribs();
285 const SfxStyleSheet
* GetStyleSheet() const;
286 SfxStyleSheet
* GetStyleSheet();
288 void SetControlWord( EVControlBits nWord
);
289 EVControlBits
GetControlWord() const;
291 void SetAnchorMode( EVAnchorMode eMode
);
292 EVAnchorMode
GetAnchorMode() const;
294 Pointer
GetPointer( const Point
& rPosPixel
);
295 void Command( const CommandEvent
& rCEvt
);
298 EESpellState
StartThesaurus();
299 sal_Int32
StartSearchAndReplace( const SvxSearchItem
& rSearchItem
);
301 // for text conversion
302 void StartTextConversion( LanguageType nSrcLang
, LanguageType nDestLang
, const vcl::Font
*pDestFont
, sal_Int32 nOptions
, bool bIsInteractive
, bool bMultipleDoc
);
304 void TransliterateText( sal_Int32 nTransliterationMode
);
306 ESelection
GetSelection();
308 SvtScriptType
GetSelectedScriptType() const;
310 void SetVisArea( const Rectangle
& rRect
);
311 void SetSelection( const ESelection
& );
312 void GetSelectionRectangles(std::vector
<Rectangle
>& rLogicRects
) const;
314 void RemoveAttribs( bool bRemoveParaAttribs
, bool bKeepLanguages
= false );
315 void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs
);
316 bool HasSelection() const;
318 void InsertField( const SvxFieldItem
& rFld
);
319 const SvxFieldItem
* GetFieldUnderMousePointer() const;
320 const SvxFieldItem
* GetFieldAtSelection() const;
322 /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
323 or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
325 void ToggleBullets();
327 void ToggleBulletsNumbering(
329 const bool bHandleBullets
,
330 const SvxNumRule
* pNumRule
);
332 /** apply bullets/numbering for paragraphs
334 @param boolean bHandleBullets
336 false: handle numbering
339 numbering rule which needs to be applied. can be 0.
341 @param boolean bAtSelection
342 true: apply bullets/numbering at selected paragraphs
343 false: apply bullets/numbering at all paragraphs
345 void ApplyBulletsNumbering(
346 const bool bHandleBullets
,
347 const SvxNumRule
* pNewNumRule
,
348 const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule
,
349 const bool bAtSelection
= false );
351 /** switch off bullets/numbering for paragraphs
353 @param boolean bAtSelection
354 true: switch off bullets/numbering at selected paragraphs
355 false: switch off bullets/numbering at all paragraphs
357 void SwitchOffBulletsNumbering(
358 const bool bAtSelection
= false );
360 /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
361 paragraphs that already have numbering enabled.
363 void EnableBullets();
365 bool IsCursorAtWrongSpelledWord();
366 bool IsWrongSpelledWordAtPos( const Point
& rPosPixel
, bool bMarkIfWrong
= false );
367 void ExecuteSpellPopup( const Point
& rPosPixel
, Link
<SpellCallbackInfo
&,void>* pCallBack
);
369 void SetInvalidateMore( sal_uInt16 nPixel
);
370 sal_uInt16
GetInvalidateMore() const;
372 OUString
GetSurroundingText() const;
373 Selection
GetSurroundingTextSelection() const;
375 void SetEndCutPasteLinkHdl(const Link
<LinkParamNone
*,void> &rLink
) { aEndCutPasteLink
= rLink
; }
378 /// Interface class to not depend on SfxViewShell in editeng.
379 class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell
382 virtual void libreOfficeKitViewCallback(int nType
, const char* pPayload
) const = 0;
383 virtual sal_uInt32
GetViewShellId() const = 0;
384 /// Wrapper around SfxLokHelper::notifyOtherViews().
385 virtual void NotifyOtherViews(int nType
, const OString
& rKey
, const OString
& rPayload
) = 0;
386 /// Wrapper around SfxLokHelper::notifyOtherView().
387 virtual void NotifyOtherView(OutlinerViewShell
* pOtherShell
, int nType
, const OString
& rKey
, const OString
& rPayload
) = 0;
388 virtual vcl::Window
* GetEditWindowForActiveOLEObj() const = 0;
391 ~OutlinerViewShell() throw () {}
394 // some thesaurus functionality to avoid code duplication in different projects...
395 bool EDITENG_DLLPUBLIC
GetStatusValueForThesaurusFromContext( OUString
&rStatusVal
, LanguageType
&rLang
, const EditView
&rEditView
);
396 void EDITENG_DLLPUBLIC
ReplaceTextWithSynonym( EditView
&rEditView
, const OUString
&rSynonmText
);
398 typedef ::std::vector
< OutlinerView
* > ViewList
;
400 class EDITENG_DLLPUBLIC DrawPortionInfo
403 const Point
& mrStartPos
;
404 const OUString maText
;
405 sal_Int32 mnTextStart
;
408 const SvxFont
& mrFont
;
409 const long* mpDXArray
;
411 const EEngineData::WrongSpellVector
* mpWrongSpellVector
;
412 const SvxFieldData
* mpFieldData
;
413 const css::lang::Locale
* mpLocale
;
414 const Color maOverlineColor
;
415 const Color maTextLineColor
;
417 sal_uInt8 mnBiDiLevel
;
422 bool mbEndOfLine
: 1;
423 bool mbEndOfParagraph
: 1;
424 bool mbEndOfBullet
: 1;
426 bool IsRTL() const { return mnBiDiLevel
% 2 == 1; }
430 const OUString
& rTxt
,
436 const EEngineData::WrongSpellVector
* pWrongSpellVector
,
437 const SvxFieldData
* pFieldData
,
438 const css::lang::Locale
* pLocale
,
439 const Color
& rOverlineColor
,
440 const Color
& rTextLineColor
,
441 sal_uInt8 nBiDiLevel
,
445 bool bEndOfParagraph
,
449 mnTextStart(nTxtStart
),
454 mpWrongSpellVector(pWrongSpellVector
),
455 mpFieldData(pFieldData
),
457 maOverlineColor(rOverlineColor
),
458 maTextLineColor(rTextLineColor
),
459 mnBiDiLevel(nBiDiLevel
),
461 mnWidthToFill( nWidthToFill
),
462 mbEndOfLine(bEndOfLine
),
463 mbEndOfParagraph(bEndOfParagraph
),
464 mbEndOfBullet(bEndOfBullet
)
468 class EDITENG_DLLPUBLIC DrawBulletInfo
471 const GraphicObject maBulletGraphicObject
;
472 Point maBulletPosition
;
476 const GraphicObject
& rBulletGraphicObject
,
477 const Point
& rBulletPosition
,
478 const Size
& rBulletSize
)
479 : maBulletGraphicObject(rBulletGraphicObject
),
480 maBulletPosition(rBulletPosition
),
481 maBulletSize(rBulletSize
)
485 struct EDITENG_DLLPUBLIC PaintFirstLineInfo
488 const Point
& mrStartPos
;
489 VclPtr
<OutputDevice
> mpOutDev
;
491 PaintFirstLineInfo( sal_Int32 nPara
, const Point
& rStartPos
, OutputDevice
* pOutDev
)
492 : mnPara( nPara
), mrStartPos( rStartPos
), mpOutDev( pOutDev
)
502 const SvxFieldItem
& rFldItem
;
507 OUString aRepresentation
;
513 EditFieldInfo( const EditFieldInfo
& ) = delete;
518 EditFieldInfo( Outliner
* pOutl
, const SvxFieldItem
& rFItem
, sal_Int32 nPa
, sal_Int32 nPo
)
522 nPara
= nPa
; nPos
= nPo
;
523 pTxtColor
= nullptr; pFldColor
= nullptr; bSimpleClick
= false;
532 Outliner
* GetOutliner() const { return pOutliner
; }
534 const SvxFieldItem
& GetField() const { return rFldItem
; }
536 Color
* GetTextColor() const { return pTxtColor
; }
537 void SetTextColor( const Color
& rColor
)
538 { delete pTxtColor
; pTxtColor
= new Color( rColor
); }
540 Color
* GetFieldColor() const { return pFldColor
; }
541 void SetFieldColor( const Color
& rColor
)
542 { delete pFldColor
; pFldColor
= new Color( rColor
); }
543 void ClearFieldColor()
544 { delete pFldColor
; pFldColor
= nullptr; }
546 sal_Int32
GetPara() const { return nPara
; }
547 sal_Int32
GetPos() const { return nPos
; }
549 void SetSimpleClick( bool bSimple
) { bSimpleClick
= bSimple
; }
551 const OUString
& GetRepresentation() const { return aRepresentation
; }
552 OUString
& GetRepresentation() { return aRepresentation
; }
553 void SetRepresentation( const OUString
& rStr
){ aRepresentation
= rStr
; }
555 void SetSdrPage( SdrPage
* pPage
) { mpSdrPage
= pPage
; }
556 SdrPage
* GetSdrPage() const { return mpSdrPage
; }
562 sal_uInt16 nType
; // see SvxNumberType
566 sal_Int32 nParagraph
;
569 EBulletInfo() : bVisible( false ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND
) {}
572 enum class OutlinerMode
{
575 TitleObject
= 0x0002,
576 OutlineObject
= 0x0003,
581 template<> struct typed_flags
<OutlinerMode
> : is_typed_flags
<OutlinerMode
, 0x000f> {};
584 class EDITENG_DLLPUBLIC Outliner
: public SfxBroadcaster
587 struct ParagraphHdlParam
{ Outliner
* pOutliner
; Paragraph
* pPara
; };
588 struct DepthChangeHdlParam
{ Outliner
* pOutliner
; Paragraph
* pPara
; ParaFlag nPrevFlags
; };
590 friend class OutlinerView
;
591 friend class OutlinerEditEng
;
592 friend class OutlinerParaObject
;
593 friend class OLUndoExpand
;
594 friend class OutlinerUndoChangeDepth
;
595 friend class OutlinerUndoCheckPara
;
596 friend class OutlinerUndoChangeParaFlags
;
598 friend class TextChainingUtils
;
600 OutlinerEditEng
* pEditEngine
;
602 ParagraphList
* pParaList
;
605 sal_Int32 mnFirstSelPage
;
606 Link
<DrawPortionInfo
*,void> aDrawPortionHdl
;
607 Link
<DrawBulletInfo
*,void> aDrawBulletHdl
;
608 Link
<ParagraphHdlParam
,void> aParaInsertedHdl
;
609 Link
<ParagraphHdlParam
,void> aParaRemovingHdl
;
610 Link
<DepthChangeHdlParam
,void> aDepthChangedHdl
;
611 Link
<Outliner
*,void> aBeginMovingHdl
;
612 Link
<Outliner
*,void> aEndMovingHdl
;
613 Link
<OutlinerView
*,bool> aIndentingPagesHdl
;
614 Link
<OutlinerView
*,bool> aRemovingPagesHdl
;
615 Link
<EditFieldInfo
*,void> aFieldClickedHdl
;
616 Link
<EditFieldInfo
*,void> aCalcFieldValueHdl
;
617 Link
<PaintFirstLineInfo
*,void> maPaintFirstLineHdl
;
618 Link
<PasteOrDropInfos
*,void> maBeginPasteOrDropHdl
;
619 Link
<PasteOrDropInfos
*,void> maEndPasteOrDropHdl
;
621 sal_Int32 nDepthChangedHdlPrevDepth
;
623 const sal_Int16 nMinDepth
;
624 sal_Int32 nFirstPage
;
626 OutlinerMode nOutlinerMode
;
628 bool bFirstParaIsEmpty
;
629 sal_uInt8 nBlockInsCallback
;
630 bool bStrippingPortions
;
633 DECL_LINK( ParaVisibleStateChangedHdl
, Paragraph
&, void );
634 DECL_LINK( BeginMovingParagraphsHdl
, MoveParagraphsInfo
&, void );
635 DECL_LINK( EndMovingParagraphsHdl
, MoveParagraphsInfo
&, void );
636 DECL_LINK( BeginPasteOrDropHdl
, PasteOrDropInfos
&, void );
637 DECL_LINK( EndPasteOrDropHdl
, PasteOrDropInfos
&, void );
638 DECL_LINK( EditEngineNotifyHdl
, EENotify
&, void );
639 void ImplCheckParagraphs( sal_Int32 nStart
, sal_Int32 nEnd
);
640 bool ImplHasNumberFormat( sal_Int32 nPara
) const;
641 Size
ImplGetBulletSize( sal_Int32 nPara
);
642 sal_uInt16
ImplGetNumbering( sal_Int32 nPara
, const SvxNumberFormat
* pParaFmt
);
643 void ImplCalcBulletText( sal_Int32 nPara
, bool bRecalcLevel
, bool bRecalcChildren
);
644 OUString
ImplGetBulletText( sal_Int32 nPara
);
645 void ImplCheckNumBulletItem( sal_Int32 nPara
);
646 void ImplInitDepth( sal_Int32 nPara
, sal_Int16 nDepth
, bool bCreateUndo
);
647 void ImplSetLevelDependendStyleSheet( sal_Int32 nPara
);
649 void ImplBlockInsertionCallbacks( bool b
);
651 void ImpFilterIndents( sal_Int32 nFirstPara
, sal_Int32 nLastPara
);
652 bool ImpConvertEdtToOut( sal_Int32 nPara
);
654 void ImpTextPasted( sal_Int32 nStartPara
, sal_Int32 nCount
);
655 vcl::Font
ImpCalcBulletFont( sal_Int32 nPara
) const;
656 Rectangle
ImpCalcBulletArea( sal_Int32 nPara
, bool bAdjust
, bool bReturnPaperPos
);
657 bool ImpCanIndentSelectedPages( OutlinerView
* pCurView
);
658 bool ImpCanDeleteSelectedPages( OutlinerView
* pCurView
);
659 bool ImpCanDeleteSelectedPages( OutlinerView
* pCurView
, sal_Int32 nFirstPage
, sal_Int32 nPages
);
661 OutlinerMode
ImplGetOutlinerMode() const { return nOutlinerMode
; }
662 void ImplCheckDepth( sal_Int16
& rnDepth
) const;
665 void ParagraphInserted( sal_Int32 nParagraph
);
666 void ParagraphDeleted( sal_Int32 nParagraph
);
667 void ParaAttribsChanged( sal_Int32 nParagraph
);
669 void StyleSheetChanged( SfxStyleSheet
* pStyle
);
671 void InvalidateBullet(sal_Int32 nPara
);
672 void PaintBullet( sal_Int32 nPara
, const Point
& rStartPos
,
673 const Point
& rOrigin
, short nOrientation
,
674 OutputDevice
* pOutDev
);
676 // used by OutlinerEditEng. Allows Outliner objects to provide
677 // bullet access to the EditEngine.
678 const SvxNumberFormat
* GetNumberFormat( sal_Int32 nPara
) const;
682 Outliner( SfxItemPool
* pPool
, OutlinerMode nOutlinerMode
);
683 virtual ~Outliner() override
;
685 void dumpAsXml(struct _xmlTextWriter
* pWriter
) const;
687 void Init( OutlinerMode nOutlinerMode
);
688 OutlinerMode
GetMode() const { return nOutlinerMode
; }
690 void SetVertical( bool bVertical
, bool bTopToBottom
= true);
691 bool IsVertical() const;
692 bool IsTopToBottom() const;
694 void SetFixedCellHeight( bool bUseFixedCellHeight
);
696 void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir
);
697 EEHorizontalTextDirection
GetDefaultHorizontalTextDirection() const;
699 LanguageType
GetLanguage( sal_Int32 nPara
, sal_Int32 nPos
) const;
701 void SetAsianCompressionMode( sal_uInt16 nCompressionMode
);
703 void SetKernAsianPunctuation( bool bEnabled
);
705 void SetAddExtLeading( bool b
);
707 size_t InsertView( OutlinerView
* pView
, size_t nIndex
= size_t(-1) );
708 void RemoveView( OutlinerView
* pView
);
709 OutlinerView
* RemoveView( size_t nIndex
);
710 OutlinerView
* GetView( size_t nIndex
) const;
711 size_t GetViewCount() const;
713 Paragraph
* Insert( const OUString
& rText
, sal_Int32 nAbsPos
= EE_PARA_APPEND
, sal_Int16 nDepth
= 0 );
714 void SetText( const OutlinerParaObject
& );
715 void AddText( const OutlinerParaObject
& );
716 void SetText( const OUString
& rText
, Paragraph
* pParagraph
);
717 OUString
GetText( Paragraph
* pPara
, sal_Int32 nParaCount
=1 ) const;
719 void SetToEmptyText();
721 OutlinerParaObject
* CreateParaObject( sal_Int32 nStartPara
= 0, sal_Int32 nParaCount
= EE_PARA_ALL
) const;
723 const SfxItemSet
& GetEmptyItemSet() const;
725 void SetRefMapMode( const MapMode
& );
726 MapMode
GetRefMapMode() const;
728 void SetBackgroundColor( const Color
& rColor
);
729 Color
GetBackgroundColor() const;
731 void SetMaxDepth( sal_Int16 nDepth
);
732 sal_Int16
GetMaxDepth() const { return nMaxDepth
; }
734 void SetUpdateMode( bool bUpdate
);
735 bool GetUpdateMode() const;
739 void RemoveAttribs( const ESelection
& rSelection
, bool bRemoveParaAttribs
, sal_uInt16 nWhich
);
741 sal_Int32
GetParagraphCount() const;
742 Paragraph
* GetParagraph( sal_Int32 nAbsPos
) const;
744 bool HasChildren( Paragraph
* pParagraph
) const;
745 sal_Int32
GetChildCount( Paragraph
* pParent
) const;
746 bool IsExpanded( Paragraph
* pPara
) const;
747 Paragraph
* GetParent( Paragraph
* pParagraph
) const;
748 sal_Int32
GetAbsPos( Paragraph
* pPara
);
750 sal_Int16
GetDepth( sal_Int32 nPara
) const;
751 void SetDepth( Paragraph
* pParagraph
, sal_Int16 nNewDepth
);
753 void EnableUndo( bool bEnable
);
754 bool IsUndoEnabled() const;
755 void UndoActionStart( sal_uInt16 nId
);
756 void UndoActionEnd( sal_uInt16 nId
);
757 void InsertUndo( EditUndo
* pUndo
);
760 void ClearModifyFlag();
761 bool IsModified() const;
763 void ParagraphInsertedHdl(Paragraph
*);
764 void SetParaInsertedHdl(const Link
<ParagraphHdlParam
,void>& rLink
){aParaInsertedHdl
=rLink
;}
765 const Link
<ParagraphHdlParam
,void>& GetParaInsertedHdl() const { return aParaInsertedHdl
; }
767 void SetParaRemovingHdl(const Link
<ParagraphHdlParam
,void>& rLink
){aParaRemovingHdl
=rLink
;}
768 const Link
<ParagraphHdlParam
,void>& GetParaRemovingHdl() const { return aParaRemovingHdl
; }
770 NonOverflowingText
*GetNonOverflowingText() const;
771 OverflowingText
*GetOverflowingText() const;
772 void ClearOverflowingParaNum();
773 bool IsPageOverflow();
775 OutlinerParaObject
*GetEmptyParaObject() const;
778 void DepthChangedHdl(Paragraph
*, ParaFlag nPrevFlags
);
779 void SetDepthChangedHdl(const Link
<DepthChangeHdlParam
,void>& rLink
){aDepthChangedHdl
=rLink
;}
780 const Link
<DepthChangeHdlParam
,void>& GetDepthChangedHdl() const { return aDepthChangedHdl
; }
781 sal_Int16
GetPrevDepth() const { return static_cast<sal_Int16
>(nDepthChangedHdlPrevDepth
); }
783 bool RemovingPagesHdl( OutlinerView
* );
784 void SetRemovingPagesHdl(const Link
<OutlinerView
*,bool>& rLink
){aRemovingPagesHdl
=rLink
;}
785 bool IndentingPagesHdl( OutlinerView
* );
786 void SetIndentingPagesHdl(const Link
<OutlinerView
*,bool>& rLink
){aIndentingPagesHdl
=rLink
;}
787 // valid only in the two upper handlers
788 sal_Int32
GetSelPageCount() const { return nDepthChangedHdlPrevDepth
; }
790 void SetCalcFieldValueHdl(const Link
<EditFieldInfo
*,void>& rLink
) { aCalcFieldValueHdl
= rLink
; }
791 const Link
<EditFieldInfo
*,void>& GetCalcFieldValueHdl() const { return aCalcFieldValueHdl
; }
793 void SetDrawPortionHdl(const Link
<DrawPortionInfo
*,void>& rLink
){aDrawPortionHdl
=rLink
;}
795 void SetDrawBulletHdl(const Link
<DrawBulletInfo
*,void>& rLink
){aDrawBulletHdl
=rLink
;}
797 void SetPaintFirstLineHdl(const Link
<PaintFirstLineInfo
*,void>& rLink
) { maPaintFirstLineHdl
= rLink
; }
799 void SetModifyHdl( const Link
<LinkParamNone
*,void>& rLink
);
800 Link
<LinkParamNone
*,void> GetModifyHdl() const;
802 void SetNotifyHdl( const Link
<EENotify
&,void>& rLink
);
804 void SetStatusEventHdl( const Link
<EditStatus
&, void>& rLink
);
805 Link
<EditStatus
&, void> GetStatusEventHdl() const;
807 void Draw( OutputDevice
* pOutDev
, const Rectangle
& rOutRect
);
808 void Draw( OutputDevice
* pOutDev
, const Point
& rStartPos
);
810 const Size
& GetPaperSize() const;
811 void SetPaperSize( const Size
& rSize
);
813 void SetFirstPageNumber( sal_Int32 n
) { nFirstPage
= n
; }
815 void SetPolygon( const basegfx::B2DPolyPolygon
& rPolyPolygon
);
816 void SetPolygon( const basegfx::B2DPolyPolygon
& rPolyPolygon
, const basegfx::B2DPolyPolygon
* pLinePolyPolygon
);
819 const Size
& GetMinAutoPaperSize() const;
820 void SetMinAutoPaperSize( const Size
& rSz
);
822 const Size
& GetMaxAutoPaperSize() const;
823 void SetMaxAutoPaperSize( const Size
& rSz
);
825 void SetDefTab( sal_uInt16 nTab
);
827 bool IsFlatMode() const;
828 void SetFlatMode( bool bFlat
);
830 void EnableAutoColor( bool b
);
832 void ForceAutoColor( bool b
);
833 bool IsForceAutoColor() const;
835 EBulletInfo
GetBulletInfo( sal_Int32 nPara
);
837 void SetWordDelimiters( const OUString
& rDelimiters
);
838 OUString
GetWordDelimiters() const;
839 OUString
GetWord( sal_Int32 nPara
, sal_Int32 nIndex
);
841 void StripPortions();
843 void DrawingText( const Point
& rStartPos
, const OUString
& rText
,
844 sal_Int32 nTextStart
, sal_Int32 nTextLen
,
845 const long* pDXArray
, const SvxFont
& rFont
,
846 sal_Int32 nPara
, sal_uInt8 nRightToLeft
,
847 const EEngineData::WrongSpellVector
* pWrongSpellVector
,
848 const SvxFieldData
* pFieldData
,
850 bool bEndOfParagraph
,
852 const css::lang::Locale
* pLocale
,
853 const Color
& rOverlineColor
,
854 const Color
& rTextLineColor
);
856 void DrawingTab( const Point
& rStartPos
, long nWidth
, const OUString
& rChar
,
857 const SvxFont
& rFont
, sal_Int32 nPara
, sal_uInt8 nRightToLeft
,
859 bool bEndOfParagraph
,
860 const Color
& rOverlineColor
,
861 const Color
& rTextLineColor
);
864 Size
CalcTextSizeNTP();
866 void SetStyleSheetPool( SfxStyleSheetPool
* pSPool
);
867 SfxStyleSheetPool
* GetStyleSheetPool();
869 bool IsInSelectionMode() const;
871 void SetStyleSheet( sal_Int32 nPara
, SfxStyleSheet
* pStyle
);
872 SfxStyleSheet
* GetStyleSheet( sal_Int32 nPara
);
874 void SetParaAttribs( sal_Int32 nPara
, const SfxItemSet
& );
875 SfxItemSet
GetParaAttribs( sal_Int32 nPara
);
877 void Remove( Paragraph
* pPara
, sal_Int32 nParaCount
);
878 bool Expand( Paragraph
* );
879 bool Collapse( Paragraph
* );
881 void SetParaFlag( Paragraph
* pPara
, ParaFlag nFlag
);
882 static bool HasParaFlag( const Paragraph
* pPara
, ParaFlag nFlag
);
885 void SetControlWord( EEControlBits nWord
);
886 EEControlBits
GetControlWord() const;
888 const Link
<Outliner
*,void>& GetBeginMovingHdl() const { return aBeginMovingHdl
; }
889 void SetBeginMovingHdl(const Link
<Outliner
*,void>& rLink
) {aBeginMovingHdl
=rLink
;}
890 const Link
<Outliner
*,void>& GetEndMovingHdl() const {return aEndMovingHdl
;}
891 void SetEndMovingHdl( const Link
<Outliner
*,void>& rLink
){aEndMovingHdl
=rLink
;}
893 sal_uLong
GetLineCount( sal_Int32 nParagraph
) const;
894 sal_Int32
GetLineLen( sal_Int32 nParagraph
, sal_Int32 nLine
) const;
895 sal_uLong
GetLineHeight( sal_Int32 nParagraph
);
897 sal_uLong
Read( SvStream
& rInput
, const OUString
& rBaseURL
, sal_uInt16
, SvKeyValueIterator
* pHTTPHeaderAttrs
= nullptr );
899 ::svl::IUndoManager
& GetUndoManager();
900 ::svl::IUndoManager
* SetUndoManager(::svl::IUndoManager
* pNew
);
902 void QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
);
903 void QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
);
904 void QuickInsertLineBreak( const ESelection
& rSel
);
906 // Only for EditEngine mode
907 void QuickInsertText( const OUString
& rText
, const ESelection
& rSel
);
908 void QuickDelete( const ESelection
& rSel
);
909 void RemoveCharAttribs( sal_Int32 nPara
, sal_uInt16 nWhich
= 0 );
910 void QuickFormatDoc();
913 void RemoveFields( const std::function
<bool ( const SvxFieldData
* )>& isFieldData
= [] (const SvxFieldData
* ){return true;} );
915 void FieldClicked( const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_Int32 nPos
);
916 virtual OUString
CalcFieldValue( const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_Int32 nPos
, Color
*& rTxtColor
, Color
*& rFldColor
);
918 void SetSpeller( css::uno::Reference
< css::linguistic2::XSpellChecker1
> &xSpeller
);
919 css::uno::Reference
< css::linguistic2::XSpellChecker1
>
921 void SetHyphenator( css::uno::Reference
< css::linguistic2::XHyphenator
>& xHyph
);
923 static void SetForbiddenCharsTable( const rtl::Reference
<SvxForbiddenCharactersTable
>& xForbiddenChars
);
926 void SetDefaultLanguage( LanguageType eLang
);
927 LanguageType
GetDefaultLanguage() const;
929 void CompleteOnlineSpelling();
931 EESpellState
HasSpellErrors();
932 bool HasText( const SvxSearchItem
& rSearchItem
);
933 virtual bool SpellNextDocument();
935 // for text conversion
936 bool HasConvertibleTextPortion( LanguageType nLang
);
937 virtual bool ConvertNextDocument();
939 void SetEditTextObjectPool( SfxItemPool
* pPool
);
940 SfxItemPool
* GetEditTextObjectPool() const;
942 void SetRefDevice( OutputDevice
* pRefDev
);
943 OutputDevice
* GetRefDevice() const;
945 sal_uLong
GetTextHeight() const;
946 sal_uLong
GetTextHeight( sal_Int32 nParagraph
) const;
947 Point
GetDocPosTopLeft( sal_Int32 nParagraph
);
948 Point
GetDocPos( const Point
& rPaperPos
) const;
949 bool IsTextPos( const Point
& rPaperPos
, sal_uInt16 nBorder
);
950 bool IsTextPos( const Point
& rPaperPos
, sal_uInt16 nBorder
, bool* pbBulletPos
);
952 void SetGlobalCharStretching( sal_uInt16 nX
= 100, sal_uInt16 nY
= 100 );
953 void GetGlobalCharStretching( sal_uInt16
& rX
, sal_uInt16
& rY
) const;
954 void EraseVirtualDevice();
956 bool ShouldCreateBigTextObject() const;
958 const EditEngine
& GetEditEngine() const;
960 // this is needed for StarOffice Api
961 void SetLevelDependendStyleSheet( sal_Int32 nPara
);
963 OutlinerMode
GetOutlinerMode() const { return nOutlinerMode
; }
965 // spell and return a sentence
966 bool SpellSentence(EditView
& rEditView
, svx::SpellPortions
& rToFill
, bool bIsGrammarChecking
);
967 // put spell position to start of current sentence
968 void PutSpellingToSentenceStart( EditView
& rEditView
);
969 // applies a changed sentence
970 void ApplyChangedSentence(EditView
& rEditView
, const svx::SpellPortions
& rNewPortions
, bool bRecheck
);
972 /** sets a link that is called at the beginning of a drag operation at an edit view */
973 void SetBeginDropHdl( const Link
<EditView
*,void>& rLink
);
975 /** sets a link that is called at the end of a drag operation at an edit view */
976 void SetEndDropHdl( const Link
<EditView
*,void>& rLink
);
978 /** sets a link that is called before a drop or paste operation. */
979 void SetBeginPasteOrDropHdl( const Link
<PasteOrDropInfos
*,void>& rLink
);
981 /** sets a link that is called after a drop or paste operation. */
982 void SetEndPasteOrDropHdl( const Link
<PasteOrDropInfos
*,void>& rLink
);
984 sal_Int16
GetNumberingStartValue( sal_Int32 nPara
);
985 void SetNumberingStartValue( sal_Int32 nPara
, sal_Int16 nNumberingStartValue
);
987 bool IsParaIsNumberingRestart( sal_Int32 nPara
);
988 void SetParaIsNumberingRestart( sal_Int32 nPara
, bool bParaIsNumberingRestart
);
990 /** determine the bullets/numbering status of the given paragraphs
993 index of paragraph at which the check starts
996 index of paragraph at which the check ends
999 0 : all paragraphs have bullets
1000 1 : all paragraphs have numbering
1003 sal_Int32
GetBulletsNumberingStatus(
1004 const sal_Int32 nParaStart
,
1005 const sal_Int32 nParaEnd
) const;
1007 // convenient method to determine the bullets/numbering status for all paragraphs
1008 sal_Int32
GetBulletsNumberingStatus() const;
1010 // tdf#115639 compatibility flag
1011 void SetHoriAlignIgnoreTrailingWhitespace(bool bEnabled
);
1012 bool IsHoriAlignIgnoreTrailingWhitespace() const;
1017 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */