update emoji autocorrect entries from po-files
[LibreOffice.git] / include / editeng / outliner.hxx
blob5a2dbe9f8cf94553b489d387fbeb2f2f6ac45254
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 .
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 <tools/rtti.hxx>
42 #define LOK_USE_UNSTABLE_API
43 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
44 #include <vector>
46 class OutlinerEditEng;
47 class Outliner;
48 class EditView;
49 class EditUndo;
50 class ParagraphList;
51 class OutlinerParaObject;
52 class SvStream;
53 class SvxBulletItem;
54 class SvxFont;
55 class SvxSearchItem;
56 class SvxFieldItem;
57 namespace vcl { class Window; }
58 class KeyEvent;
59 class MouseEvent;
60 class Pointer;
61 class CommandEvent;
62 class MapMode;
63 class OutputDevice;
64 namespace tools { class PolyPolygon; }
65 class SfxStyleSheetPool;
66 class SfxStyleSheet;
67 class SfxItemPool;
68 class SfxItemSet;
69 class SvxNumBulletItem;
70 class SvxNumberFormat;
71 class SvxLRSpaceItem;
72 class EditEngine;
73 class SvKeyValueIterator;
74 class SvxForbiddenCharactersTable;
76 namespace svl
78 class IUndoManager;
81 #include <com/sun/star/uno/Reference.h>
83 #include <rtl/ref.hxx>
84 #include <editeng/svxfont.hxx>
85 #include <editeng/eedata.hxx>
86 #include <editeng/paragraphdata.hxx>
87 #include <o3tl/typed_flags_set.hxx>
89 class SvxFieldData;
92 namespace com { namespace sun { namespace star { namespace linguistic2 {
93 class XSpellChecker1;
94 class XHyphenator;
95 }}}}
96 namespace svx{
97 struct SpellPortion;
98 typedef std::vector<SpellPortion> SpellPortions;
101 namespace basegfx { class B2DPolyPolygon; }
103 // internal use only!
104 enum class ParaFlag
106 NONE = 0x0000,
107 HOLDDEPTH = 0x4000,
108 SETBULLETTEXT = 0x8000,
109 ISPAGE = 0x0100,
111 namespace o3tl
113 template<> struct typed_flags<ParaFlag> : is_typed_flags<ParaFlag, 0xc100> {};
116 // Undo-Action-Ids
117 #define OLUNDO_DEPTH EDITUNDO_USER
118 // #define OLUNDO_HEIGHT EDITUNDO_USER+1
119 #define OLUNDO_EXPAND EDITUNDO_USER+2
120 #define OLUNDO_COLLAPSE EDITUNDO_USER+3
121 // #define OLUNDO_REMOVE EDITUNDO_USER+4
122 #define OLUNDO_ATTR EDITUNDO_USER+5
123 #define OLUNDO_INSERT EDITUNDO_USER+6
124 // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
126 class Paragraph : protected ParagraphData
128 private:
129 friend class Outliner;
130 friend class ParagraphList;
131 friend class OutlinerView;
132 friend class OutlinerParaObject;
133 friend class OutlinerEditEng;
134 friend class OutlinerUndoCheckPara;
135 friend class OutlinerUndoChangeParaFlags;
137 Paragraph& operator=(const Paragraph& rPara ) SAL_DELETED_FUNCTION;
139 ParaFlag nFlags;
140 OUString aBulText;
141 Size aBulSize;
142 bool bVisible;
144 bool IsVisible() const { return bVisible; }
145 void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
146 void Invalidate() { aBulSize.Width() = -1; }
147 void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
148 const OUString& GetText() const { return aBulText; }
150 Paragraph( sal_Int16 nDepth );
151 Paragraph( const Paragraph& ) SAL_DELETED_FUNCTION;
152 Paragraph( const ParagraphData& );
153 ~Paragraph();
155 sal_Int16 GetDepth() const { return nDepth; }
157 sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
158 void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
160 bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
161 void SetParaIsNumberingRestart( bool bParaIsNumberingRestart );
163 void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; }
164 void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; }
165 bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); }
168 struct ParaRange
170 sal_Int32 nStartPara;
171 sal_Int32 nEndPara;
173 ParaRange( sal_Int32 nS, sal_Int32 nE ) { nStartPara = nS, nEndPara = nE; }
175 void Adjust();
176 sal_Int32 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
179 inline void ParaRange::Adjust()
181 if ( nStartPara > nEndPara )
183 sal_Int32 nTmp = nStartPara;
184 nStartPara = nEndPara;
185 nEndPara = nTmp;
189 class EDITENG_DLLPUBLIC OutlinerView
191 friend class Outliner;
193 private:
195 Outliner* pOwner;
196 EditView* pEditView;
198 enum class MouseTarget {
199 Text = 0,
200 Bullet = 1,
201 Hypertext = 2, // Outside OutputArea
202 Outside = 3, // Outside OutputArea
203 DontKnow = 4
206 EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand );
208 EDITENG_DLLPRIVATE sal_Int32 ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
209 EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
210 EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( bool bIncludeHiddenChildren );
212 EDITENG_DLLPRIVATE sal_Int32 ImpInitPaste( sal_Int32& rStart );
213 EDITENG_DLLPRIVATE void ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize);
214 EDITENG_DLLPRIVATE sal_Int32 ImpCalcSelectedPages( bool bIncludeFirstSelected );
216 public:
217 OutlinerView( Outliner* pOut, vcl::Window* pWindow );
218 virtual ~OutlinerView();
220 EditView& GetEditView() const { return *pEditView; }
222 void Scroll( long nHorzScroll, long nVertScroll );
224 void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
225 bool PostKeyEvent( const KeyEvent& rKEvt, vcl::Window* pFrameWin = NULL );
226 bool MouseButtonDown( const MouseEvent& );
227 bool MouseButtonUp( const MouseEvent& );
228 void ReleaseMouse();
229 bool MouseMove( const MouseEvent& );
231 void ShowCursor( bool bGotoCursor = true );
232 void HideCursor();
234 Outliner* GetOutliner() const { return pOwner; }
236 void SetWindow( vcl::Window* pWindow );
237 vcl::Window* GetWindow() const;
239 void SetReadOnly( bool bReadOnly );
240 bool IsReadOnly() const;
242 void SetOutputArea( const Rectangle& rRect );
243 Rectangle GetOutputArea() const;
245 Rectangle GetVisArea() const;
247 void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
249 // Retruns the number of selected paragraphs
250 sal_Int32 Select( Paragraph* pParagraph,
251 bool bSelect = true,
252 bool bWChildren = true);
254 OUString GetSelected() const;
255 void SelectRange( sal_Int32 nFirst, sal_Int32 nCount );
256 void SetAttribs( const SfxItemSet& );
257 void Indent( short nDiff );
258 void AdjustDepth( short nDX ); // Later replace with Indent!
260 bool AdjustHeight( long nDY );
262 sal_uLong Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, bool bSelect = false, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
264 void InsertText( const OUString& rNew, bool bSelect = false );
265 void InsertText( const OutlinerParaObject& rParaObj );
266 void Expand();
267 void Collapse();
268 void ExpandAll();
269 void CollapseAll();
271 void SetBackgroundColor( const Color& rColor );
272 Color GetBackgroundColor();
274 /// Set if we are doing tiled rendering.
275 void setTiledRendering(bool bTiledRendering);
276 /// @see vcl::ITiledRenderable::registerCallback().
277 void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
279 SfxItemSet GetAttribs();
281 void Cut();
282 void Copy();
283 void Paste();
284 void PasteSpecial();
286 const SfxStyleSheet* GetStyleSheet() const;
287 SfxStyleSheet* GetStyleSheet();
289 void SetControlWord( EVControlBits nWord );
290 EVControlBits GetControlWord() const;
292 void SetAnchorMode( EVAnchorMode eMode );
293 EVAnchorMode GetAnchorMode() const;
295 Pointer GetPointer( const Point& rPosPixel );
296 void Command( const CommandEvent& rCEvt );
298 EESpellState StartSpeller( bool bMultipleDoc = false );
299 EESpellState StartThesaurus();
300 sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
302 // for text conversion
303 void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc );
305 void TransliterateText( sal_Int32 nTransliterationMode );
307 ESelection GetSelection();
309 SvtScriptType GetSelectedScriptType() const;
311 void SetVisArea( const Rectangle& rRect );
312 void SetSelection( const ESelection& );
314 void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0, 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(
328 const bool bToggle,
329 const bool bHandleBullets,
330 const SvxNumRule* pNumRule = NULL );
332 /** apply bullets/numbering for paragraphs
334 @param boolean bHandleBullets
335 true: handle bullets
336 false: handle numbering
338 @param pNewNumRule
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( bool bMarkIfWrong = false );
366 bool IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong = false );
367 void ExecuteSpellPopup( const Point& rPosPixel, Link<>* pCallBack = 0 );
369 void SetInvalidateMore( sal_uInt16 nPixel );
370 sal_uInt16 GetInvalidateMore() const;
372 OUString GetSurroundingText() const;
373 Selection GetSurroundingTextSelection() const;
377 // some thesaurus functionality to avoid code duplication in different projects...
378 bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView );
379 void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const OUString &rSynonmText );
381 typedef ::std::vector< OutlinerView* > ViewList;
383 class EDITENG_DLLPUBLIC DrawPortionInfo
385 public:
386 const Point& mrStartPos;
387 const OUString maText;
388 sal_Int32 mnTextStart;
389 sal_Int32 mnTextLen;
390 sal_Int32 mnPara;
391 sal_Int32 mnIndex;
392 const SvxFont& mrFont;
393 const long* mpDXArray;
395 const EEngineData::WrongSpellVector* mpWrongSpellVector;
396 const SvxFieldData* mpFieldData;
397 const ::com::sun::star::lang::Locale* mpLocale;
398 const Color maOverlineColor;
399 const Color maTextLineColor;
401 sal_uInt8 mnBiDiLevel;
403 bool mbFilled;
404 long mnWidthToFill;
406 // bitfield
407 bool mbEndOfLine : 1;
408 bool mbEndOfParagraph : 1;
409 bool mbEndOfBullet : 1;
411 sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
412 bool IsRTL() const { return mnBiDiLevel % 2 == 1; }
414 DrawPortionInfo(
415 const Point& rPos,
416 const OUString& rTxt,
417 sal_Int32 nTxtStart,
418 sal_Int32 nTxtLen,
419 const SvxFont& rFnt,
420 sal_Int32 nPar,
421 sal_Int32 nIdx,
422 const long* pDXArr,
423 const EEngineData::WrongSpellVector* pWrongSpellVector,
424 const SvxFieldData* pFieldData,
425 const ::com::sun::star::lang::Locale* pLocale,
426 const Color& rOverlineColor,
427 const Color& rTextLineColor,
428 sal_uInt8 nBiDiLevel,
429 bool bFilled,
430 long nWidthToFill,
431 bool bEndOfLine,
432 bool bEndOfParagraph,
433 bool bEndOfBullet)
434 : mrStartPos(rPos),
435 maText(rTxt),
436 mnTextStart(nTxtStart),
437 mnTextLen(nTxtLen),
438 mnPara(nPar),
439 mnIndex(nIdx),
440 mrFont(rFnt),
441 mpDXArray(pDXArr),
442 mpWrongSpellVector(pWrongSpellVector),
443 mpFieldData(pFieldData),
444 mpLocale(pLocale),
445 maOverlineColor(rOverlineColor),
446 maTextLineColor(rTextLineColor),
447 mnBiDiLevel(nBiDiLevel),
448 mbFilled( bFilled ),
449 mnWidthToFill( nWidthToFill ),
450 mbEndOfLine(bEndOfLine),
451 mbEndOfParagraph(bEndOfParagraph),
452 mbEndOfBullet(bEndOfBullet)
456 class EDITENG_DLLPUBLIC DrawBulletInfo
458 public:
459 const GraphicObject maBulletGraphicObject;
460 Point maBulletPosition;
461 Size maBulletSize;
463 DrawBulletInfo(
464 const GraphicObject& rBulletGraphicObject,
465 const Point& rBulletPosition,
466 const Size& rBulletSize)
467 : maBulletGraphicObject(rBulletGraphicObject),
468 maBulletPosition(rBulletPosition),
469 maBulletSize(rBulletSize)
473 struct EDITENG_DLLPUBLIC PaintFirstLineInfo
475 sal_Int32 mnPara;
476 const Point& mrStartPos;
477 long mnBaseLineY;
478 const Point& mrOrigin;
479 short mnOrientation;
480 VclPtr<OutputDevice> mpOutDev;
482 PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
483 : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
487 class SdrPage;
489 class EditFieldInfo
491 private:
492 Outliner* pOutliner;
493 const SvxFieldItem& rFldItem;
495 Color* pTxtColor;
496 Color* pFldColor;
498 OUString aRepresentation;
500 sal_Int32 nPara;
501 sal_Int32 nPos;
502 bool bSimpleClick;
504 EditFieldInfo( const EditFieldInfo& ) SAL_DELETED_FUNCTION;
506 SdrPage* mpSdrPage;
508 public:
509 EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_Int32 nPa, sal_Int32 nPo )
510 : rFldItem( rFItem )
512 pOutliner = pOutl;
513 nPara = nPa; nPos = nPo;
514 pTxtColor = 0; pFldColor = 0; bSimpleClick = false;
515 mpSdrPage = 0;
517 ~EditFieldInfo()
519 delete pTxtColor;
520 delete pFldColor;
523 Outliner* GetOutliner() const { return pOutliner; }
525 const SvxFieldItem& GetField() const { return rFldItem; }
527 Color* GetTextColor() const { return pTxtColor; }
528 void SetTextColor( const Color& rColor )
529 { delete pTxtColor; pTxtColor = new Color( rColor ); }
531 Color* GetFieldColor() const { return pFldColor; }
532 void SetFieldColor( const Color& rColor )
533 { delete pFldColor; pFldColor = new Color( rColor ); }
534 void ClearFieldColor()
535 { delete pFldColor; pFldColor = 0; }
537 sal_Int32 GetPara() const { return nPara; }
538 sal_Int32 GetPos() const { return nPos; }
540 bool IsSimpleClick() const { return bSimpleClick; }
541 void SetSimpleClick( bool bSimple ) { bSimpleClick = bSimple; }
543 const OUString& GetRepresentation() const { return aRepresentation; }
544 OUString& GetRepresentation() { return aRepresentation; }
545 void SetRepresentation( const OUString& rStr ){ aRepresentation = rStr; }
547 void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
548 SdrPage* GetSdrPage() const { return mpSdrPage; }
551 struct EBulletInfo
553 bool bVisible;
554 sal_uInt16 nType; // see SvxNumberType
555 OUString aText;
556 SvxFont aFont;
557 Graphic aGraphic;
558 sal_Int32 nParagraph;
559 Rectangle aBounds;
561 EBulletInfo() : bVisible( false ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
564 #define OUTLINERMODE_DONTKNOW 0x0000
565 #define OUTLINERMODE_TEXTOBJECT 0x0001
566 #define OUTLINERMODE_TITLEOBJECT 0x0002
567 #define OUTLINERMODE_OUTLINEOBJECT 0x0003
568 #define OUTLINERMODE_OUTLINEVIEW 0x0004
570 #define OUTLINERMODE_USERMASK 0x00FF
572 #define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
573 #define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
575 class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
577 friend class OutlinerView;
578 friend class OutlinerEditEng;
579 friend class OutlinerParaObject;
580 friend class OLUndoExpand;
581 friend class OutlinerUndoChangeDepth;
582 friend class OutlinerUndoCheckPara;
583 friend class OutlinerUndoChangeParaFlags;
585 OutlinerEditEng* pEditEngine;
587 ParagraphList* pParaList;
588 ViewList aViewList;
590 Paragraph* pHdlParagraph;
591 sal_Int32 mnFirstSelPage;
592 Link<> aDrawPortionHdl;
593 Link<> aDrawBulletHdl;
594 Link<> aExpandHdl;
595 Link<> aParaInsertedHdl;
596 Link<> aParaRemovingHdl;
597 Link<> aDepthChangedHdl;
598 Link<> aWidthArrReqHdl;
599 Link<> aBeginMovingHdl;
600 Link<> aEndMovingHdl;
601 Link<> aIndentingPagesHdl;
602 Link<> aRemovingPagesHdl;
603 Link<> aFieldClickedHdl;
604 Link<> aCalcFieldValueHdl;
605 Link<> maPaintFirstLineHdl;
606 Link<> maBeginPasteOrDropHdl;
607 Link<> maEndPasteOrDropHdl;
609 sal_Int32 nDepthChangedHdlPrevDepth;
610 ParaFlag mnDepthChangeHdlPrevFlags;
611 sal_Int16 nMaxDepth;
612 const sal_Int16 nMinDepth;
613 sal_Int32 nFirstPage;
615 sal_uInt16 nOutlinerMode;
617 bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
618 bool bFirstParaIsEmpty;
619 sal_uInt8 nBlockInsCallback;
620 bool bStrippingPortions;
621 bool bPasting;
623 sal_uLong nDummy;
625 DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
626 DECL_LINK( BeginMovingParagraphsHdl, void* );
627 DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
628 DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
629 DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
630 DECL_LINK( EditEngineNotifyHdl, EENotify* );
631 void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd );
632 bool ImplHasNumberFormat( sal_Int32 nPara ) const;
633 Size ImplGetBulletSize( sal_Int32 nPara );
634 sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt );
635 void ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRecalcChildren );
636 OUString ImplGetBulletText( sal_Int32 nPara );
637 void ImplCheckNumBulletItem( sal_Int32 nPara );
638 void ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUndo, bool bUndoAction = false );
639 void ImplSetLevelDependendStyleSheet( sal_Int32 nPara, SfxStyleSheet* pLevelStyle = NULL );
641 void ImplBlockInsertionCallbacks( bool b );
643 void ImplCheckStyleSheet( sal_Int32 nPara, bool bReplaceExistingStyle );
644 void ImpRecalcBulletIndent( sal_Int32 nPara );
646 const SvxBulletItem& ImpGetBullet( sal_Int32 nPara, sal_uInt16& );
647 void ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara );
648 bool ImpConvertEdtToOut( sal_Int32 nPara, EditView* pView = 0 );
650 void ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount );
651 long ImpCalcMaxBulletWidth( sal_Int32 nPara, const SvxBulletItem& rBullet );
652 vcl::Font ImpCalcBulletFont( sal_Int32 nPara ) const;
653 Rectangle ImpCalcBulletArea( sal_Int32 nPara, bool bAdjust, bool bReturnPaperPos );
654 long ImpGetTextIndent( sal_Int32 nPara );
655 bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
656 bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
657 bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 nFirstPage, sal_Int32 nPages );
659 sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
660 void ImplCheckDepth( sal_Int16& rnDepth ) const;
662 protected:
663 void ParagraphInserted( sal_Int32 nParagraph );
664 void ParagraphDeleted( sal_Int32 nParagraph );
665 void ParaAttribsChanged( sal_Int32 nParagraph );
667 void StyleSheetChanged( SfxStyleSheet* pStyle );
669 void InvalidateBullet(sal_Int32 nPara);
670 void PaintBullet( sal_Int32 nPara, const Point& rStartPos,
671 const Point& rOrigin, short nOrientation,
672 OutputDevice* pOutDev );
674 // used by OutlinerEditEng. Allows Outliner objects to provide
675 // bullet access to the EditEngine.
676 const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const;
678 public:
680 Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
681 virtual ~Outliner();
683 void Init( sal_uInt16 nOutlinerMode );
684 sal_uInt16 GetMode() const { return nOutlinerMode; }
686 void SetVertical( bool bVertical );
687 bool IsVertical() const;
689 void SetFixedCellHeight( bool bUseFixedCellHeight );
691 void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
692 EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
694 SvtScriptType GetScriptType( const ESelection& rSelection ) const;
695 LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
697 void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
699 void SetKernAsianPunctuation( bool bEnabled );
701 void SetAddExtLeading( bool b );
703 size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
704 OutlinerView* RemoveView( OutlinerView* pView );
705 OutlinerView* RemoveView( size_t nIndex );
706 OutlinerView* GetView( size_t nIndex ) const;
707 size_t GetViewCount() const;
709 Paragraph* Insert( const OUString& rText, sal_Int32 nAbsPos = EE_PARA_APPEND, sal_Int16 nDepth = 0 );
710 void SetText( const OutlinerParaObject& );
711 void AddText( const OutlinerParaObject& );
712 void SetText( const OUString& rText, Paragraph* pParagraph );
713 OUString GetText( Paragraph* pPara, sal_Int32 nParaCount=1 ) const;
715 OutlinerParaObject* CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const;
717 const SfxItemSet& GetEmptyItemSet() const;
719 void SetRefMapMode( const MapMode& );
720 MapMode GetRefMapMode() const;
722 void SetBackgroundColor( const Color& rColor );
723 Color GetBackgroundColor() const;
725 void SetMaxDepth( sal_Int16 nDepth, bool bCheckParas = false );
726 sal_Int16 GetMaxDepth() const { return nMaxDepth; }
728 void SetUpdateMode( bool bUpdate );
729 bool GetUpdateMode() const;
731 void Clear();
733 void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich );
735 sal_Int32 GetParagraphCount() const;
736 Paragraph* GetParagraph( sal_Int32 nAbsPos ) const;
738 bool HasParent( Paragraph* pParagraph ) const;
739 bool HasChildren( Paragraph* pParagraph ) const;
740 sal_Int32 GetChildCount( Paragraph* pParent ) const;
741 bool IsExpanded( Paragraph* pPara ) const;
742 Paragraph* GetParent( Paragraph* pParagraph ) const;
743 sal_Int32 GetAbsPos( Paragraph* pPara );
745 sal_Int16 GetDepth( sal_Int32 nPara ) const;
746 void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
748 static bool IsVisible( Paragraph* pPara ) { return pPara->IsVisible(); }
750 void EnableUndo( bool bEnable );
751 bool IsUndoEnabled() const;
752 void UndoActionStart( sal_uInt16 nId );
753 void UndoActionEnd( sal_uInt16 nId );
754 void InsertUndo( EditUndo* pUndo );
755 bool IsInUndo();
757 void ClearModifyFlag();
758 bool IsModified() const;
760 Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
761 bool IsExpanding() const { return bIsExpanding; }
763 void ExpandHdl();
764 void SetExpandHdl( const Link<>& rLink ) { aExpandHdl = rLink; }
765 Link<> GetExpandHdl() const { return aExpandHdl; }
767 void ParagraphInsertedHdl();
768 void SetParaInsertedHdl(const Link<>& rLink){aParaInsertedHdl=rLink;}
769 Link<> GetParaInsertedHdl() const { return aParaInsertedHdl; }
771 void ParagraphRemovingHdl();
772 void SetParaRemovingHdl(const Link<>& rLink){aParaRemovingHdl=rLink;}
773 Link<> GetParaRemovingHdl() const { return aParaRemovingHdl; }
775 void DepthChangedHdl();
776 void SetDepthChangedHdl(const Link<>& rLink){aDepthChangedHdl=rLink;}
777 Link<> GetDepthChangedHdl() const { return aDepthChangedHdl; }
778 sal_Int16 GetPrevDepth() const { return static_cast<sal_Int16>(nDepthChangedHdlPrevDepth); }
779 ParaFlag GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
781 bool RemovingPagesHdl( OutlinerView* );
782 void SetRemovingPagesHdl(const Link<>& rLink){aRemovingPagesHdl=rLink;}
783 Link<> GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
784 long IndentingPagesHdl( OutlinerView* );
785 void SetIndentingPagesHdl(const Link<>& rLink){aIndentingPagesHdl=rLink;}
786 Link<> GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
787 // valid only in the two upper handlers
788 sal_Int32 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
790 // valid only in the two upper handlers
791 sal_Int32 GetFirstSelPage() const { return mnFirstSelPage; }
793 void SetCalcFieldValueHdl(const Link<>& rLink ) { aCalcFieldValueHdl= rLink; }
794 Link<> GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
796 void SetFieldClickedHdl(const Link<>& rLink ) { aFieldClickedHdl= rLink; }
797 Link<> GetFieldClickedHdl() const { return aFieldClickedHdl; }
799 void SetDrawPortionHdl(const Link<>& rLink){aDrawPortionHdl=rLink;}
800 Link<> GetDrawPortionHdl() const { return aDrawPortionHdl; }
802 void SetDrawBulletHdl(const Link<>& rLink){aDrawBulletHdl=rLink;}
803 Link<> GetDrawBulletHdl() const { return aDrawBulletHdl; }
805 void SetPaintFirstLineHdl(const Link<>& rLink) { maPaintFirstLineHdl = rLink; }
806 Link<> GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
808 void SetModifyHdl( const Link<>& rLink );
809 Link<> GetModifyHdl() const;
811 void SetNotifyHdl( const Link<>& rLink );
813 void SetStatusEventHdl( const Link<>& rLink );
814 Link<> GetStatusEventHdl() const;
816 void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
817 void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
819 const Size& GetPaperSize() const;
820 void SetPaperSize( const Size& rSize );
822 void SetFirstPageNumber( sal_Int32 n ) { nFirstPage = n; }
823 sal_Int32 GetFirstPageNumber() const { return nFirstPage; }
825 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
826 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
827 void ClearPolygon();
829 const Size& GetMinAutoPaperSize() const;
830 void SetMinAutoPaperSize( const Size& rSz );
832 const Size& GetMaxAutoPaperSize() const;
833 void SetMaxAutoPaperSize( const Size& rSz );
835 void SetDefTab( sal_uInt16 nTab );
837 bool IsFlatMode() const;
838 void SetFlatMode( bool bFlat );
840 void EnableAutoColor( bool b );
842 void ForceAutoColor( bool b );
843 bool IsForceAutoColor() const;
845 EBulletInfo GetBulletInfo( sal_Int32 nPara );
847 void SetWordDelimiters( const OUString& rDelimiters );
848 OUString GetWordDelimiters() const;
849 OUString GetWord( sal_Int32 nPara, sal_Int32 nIndex );
851 void StripPortions();
853 void DrawingText( const Point& rStartPos, const OUString& rText,
854 sal_Int32 nTextStart, sal_Int32 nTextLen,
855 const long* pDXArray, const SvxFont& rFont,
856 sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
857 const EEngineData::WrongSpellVector* pWrongSpellVector,
858 const SvxFieldData* pFieldData,
859 bool bEndOfLine,
860 bool bEndOfParagraph,
861 bool bEndOfBullet,
862 const ::com::sun::star::lang::Locale* pLocale,
863 const Color& rOverlineColor,
864 const Color& rTextLineColor);
866 void DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar,
867 const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
868 bool bEndOfLine,
869 bool bEndOfParagraph,
870 const Color& rOverlineColor,
871 const Color& rTextLineColor);
873 Size CalcTextSize();
874 Size CalcTextSizeNTP();
876 void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
877 SfxStyleSheetPool* GetStyleSheetPool();
879 bool IsInSelectionMode() const;
881 void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle );
882 SfxStyleSheet* GetStyleSheet( sal_Int32 nPara );
884 void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& );
885 SfxItemSet GetParaAttribs( sal_Int32 nPara );
887 void Remove( Paragraph* pPara, sal_Int32 nParaCount );
888 bool Expand( Paragraph* );
889 bool Collapse( Paragraph* );
891 void SetParaFlag( Paragraph* pPara, ParaFlag nFlag );
892 static bool HasParaFlag( const Paragraph* pPara, ParaFlag nFlag );
894 // Returns an array containing the widths of the Bullet Indentations
895 // Last value must be -1. Is deleted by the outliner.
896 Link<> GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
897 void SetWidthArrReqHdl(const Link<>& rLink){aWidthArrReqHdl=rLink; }
899 void SetControlWord( EEControlBits nWord );
900 EEControlBits GetControlWord() const;
902 Link<> GetBeginMovingHdl() const { return aBeginMovingHdl; }
903 void SetBeginMovingHdl(const Link<>& rLink) {aBeginMovingHdl=rLink;}
904 Link<> GetEndMovingHdl() const {return aEndMovingHdl;}
905 void SetEndMovingHdl( const Link<>& rLink){aEndMovingHdl=rLink;}
907 sal_uLong GetLineCount( sal_Int32 nParagraph ) const;
908 sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const;
909 sal_uLong GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine = 0 );
911 sal_uLong Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
913 ::svl::IUndoManager& GetUndoManager();
914 ::svl::IUndoManager* SetUndoManager(::svl::IUndoManager* pNew);
916 void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
917 void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
918 void QuickInsertLineBreak( const ESelection& rSel );
920 // Only for EditEngine mode
921 void QuickInsertText( const OUString& rText, const ESelection& rSel );
922 void QuickDelete( const ESelection& rSel );
923 void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0 );
924 void QuickFormatDoc( bool bFull = false );
926 bool UpdateFields();
927 void RemoveFields( bool bKeepFieldText, TypeId aType = NULL );
929 void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos );
930 void FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos );
931 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor );
933 void SetSpeller( ::com::sun::star::uno::Reference<
934 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
935 ::com::sun::star::uno::Reference<
936 ::com::sun::star::linguistic2::XSpellChecker1 >
937 GetSpeller();
938 void SetHyphenator( ::com::sun::star::uno::Reference<
939 ::com::sun::star::linguistic2::XHyphenator >& xHyph );
941 static void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
943 // Deprecated
944 void SetDefaultLanguage( LanguageType eLang );
945 LanguageType GetDefaultLanguage() const;
947 void CompleteOnlineSpelling();
949 EESpellState HasSpellErrors();
950 bool HasText( const SvxSearchItem& rSearchItem );
951 virtual bool SpellNextDocument();
953 // for text conversion
954 bool HasConvertibleTextPortion( LanguageType nLang );
955 virtual bool ConvertNextDocument();
957 void SetEditTextObjectPool( SfxItemPool* pPool );
958 SfxItemPool* GetEditTextObjectPool() const;
960 void SetRefDevice( OutputDevice* pRefDev );
961 OutputDevice* GetRefDevice() const;
963 sal_uLong GetTextHeight() const;
964 sal_uLong GetTextHeight( sal_Int32 nParagraph ) const;
965 Point GetDocPosTopLeft( sal_Int32 nParagraph );
966 Point GetDocPos( const Point& rPaperPos ) const;
967 bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
968 bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBulletPos );
970 void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
971 void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
972 void EraseVirtualDevice();
974 bool ShouldCreateBigTextObject() const;
976 const EditEngine& GetEditEngine() const;
978 // this is needed for StarOffice Api
979 void SetLevelDependendStyleSheet( sal_Int32 nPara );
981 sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
983 void StartSpelling(EditView& rEditView, bool bMultipleDoc);
984 // spell and return a sentence
985 bool SpellSentence(EditView& rEditView, svx::SpellPortions& rToFill, bool bIsGrammarChecking );
986 // put spell position to start of current sentence
987 void PutSpellingToSentenceStart( EditView& rEditView );
988 // applies a changed sentence
989 void ApplyChangedSentence(EditView& rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck );
991 /** sets a link that is called at the beginning of a drag operation at an edit view */
992 void SetBeginDropHdl( const Link<>& rLink );
994 /** sets a link that is called at the end of a drag operation at an edit view */
995 void SetEndDropHdl( const Link<>& rLink );
997 /** sets a link that is called before a drop or paste operation. */
998 void SetBeginPasteOrDropHdl( const Link<>& rLink );
999 Link<> GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
1001 /** sets a link that is called after a drop or paste operation. */
1002 void SetEndPasteOrDropHdl( const Link<>& rLink );
1003 Link<> GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
1005 sal_Int16 GetNumberingStartValue( sal_Int32 nPara );
1006 void SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue );
1008 bool IsParaIsNumberingRestart( sal_Int32 nPara );
1009 void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart );
1011 /** determine the bullets/numbering status of the given paragraphs
1013 @param nParaStart
1014 index of paragraph at which the check starts
1016 @param nParaEnd
1017 index of paragraph at which the check ends
1019 @returns
1020 0 : all paragraphs have bullets
1021 1 : all paragraphs have numbering
1022 2 : otherwise
1024 sal_Int32 GetBulletsNumberingStatus(
1025 const sal_Int32 nParaStart,
1026 const sal_Int32 nParaEnd ) const;
1028 // convenient method to determine the bullets/numbering status for all paragraphs
1029 sal_Int32 GetBulletsNumberingStatus() const;
1032 #endif
1034 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */