fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / editeng / outliner.hxx
blob2568b5f773919281b5836ce5df32bf34b56c9cce
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 _OUTLINER_HXX
20 #define _OUTLINER_HXX
22 #include <tools/gen.hxx>
23 #include <tools/string.hxx>
25 #include <svl/brdcst.hxx>
27 #include <editeng/editdata.hxx>
28 #include <editeng/numitem.hxx>
29 #include <i18nlangtag/lang.h>
30 #include <tools/color.hxx>
31 #include <tools/contnr.hxx>
32 #include <vcl/graph.hxx>
33 #include <tools/link.hxx>
34 #include <rsc/rscsfx.hxx>
35 #include "editeng/editengdllapi.h"
36 #include <com/sun/star/lang/Locale.hpp>
38 #include <svtools/grfmgr.hxx>
40 #include <tools/rtti.hxx> // due to typedef TypeId
41 #include <vector>
43 class OutlinerEditEng;
44 class Outliner;
45 class EditView;
46 class EditUndo;
47 class ParagraphList;
48 class OutlinerParaObject;
49 class SvStream;
50 class SvxBulletItem;
51 class SvxFont;
52 class SvxSearchItem;
53 class SvxFieldItem;
54 class Window;
55 class KeyEvent;
56 class MouseEvent;
57 class Pointer;
58 class CommandEvent;
59 class MapMode;
60 class OutputDevice;
61 class PolyPolygon;
62 class SfxStyleSheetPool;
63 class SfxStyleSheet;
64 class SfxItemPool;
65 class SfxItemSet;
66 class SvxNumBulletItem;
67 class SvxNumberFormat;
68 class SvxLRSpaceItem;
69 class EditEngine;
70 class SvKeyValueIterator;
71 class SvxForbiddenCharactersTable;
73 namespace svl
75 class IUndoManager;
78 #include <com/sun/star/uno/Reference.h>
80 #include <rtl/ref.hxx>
81 #include <editeng/svxfont.hxx>
82 #include <editeng/eedata.hxx>
83 #include <editeng/paragraphdata.hxx>
85 class SvxFieldData;
86 //////////////////////////////////////////////////////////////////////////////
88 namespace com { namespace sun { namespace star { namespace linguistic2 {
89 class XSpellChecker1;
90 class XHyphenator;
91 }}}}
92 namespace svx{
93 struct SpellPortion;
94 typedef std::vector<SpellPortion> SpellPortions;
97 namespace basegfx { class B2DPolyPolygon; }
99 // internal use only!
100 #define PARAFLAG_DROPTARGET 0x1000
101 #define PARAFLAG_DROPTARGET_EMPTY 0x2000
102 #define PARAFLAG_HOLDDEPTH 0x4000
103 #define PARAFLAG_SETBULLETTEXT 0x8000
104 #define PARAFLAG_ISPAGE 0x0100
106 // Undo-Action-Ids
107 #define OLUNDO_DEPTH EDITUNDO_USER
108 // #define OLUNDO_HEIGHT EDITUNDO_USER+1
109 #define OLUNDO_EXPAND EDITUNDO_USER+2
110 #define OLUNDO_COLLAPSE EDITUNDO_USER+3
111 // #define OLUNDO_REMOVE EDITUNDO_USER+4
112 #define OLUNDO_ATTR EDITUNDO_USER+5
113 #define OLUNDO_INSERT EDITUNDO_USER+6
114 // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
115 #define OLUNDO_CHECKPARA EDITUNDO_USER+8
117 class Paragraph : protected ParagraphData
119 private:
120 friend class Outliner;
121 friend class ParagraphList;
122 friend class OutlinerView;
123 friend class OutlinerParaObject;
124 friend class OutlinerEditEng;
125 friend class OutlinerUndoCheckPara;
126 friend class OutlinerUndoChangeParaFlags;
128 Paragraph& operator=(const Paragraph& rPara );
130 sal_uInt16 nFlags;
131 OUString aBulText;
132 Size aBulSize;
133 sal_Bool bVisible;
135 sal_Bool IsVisible() const { return bVisible; }
136 void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
137 void Invalidate() { aBulSize.Width() = -1; }
138 void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
139 const OUString& GetText() const { return aBulText; }
141 Paragraph( sal_Int16 nDepth );
142 Paragraph( const Paragraph& );
143 Paragraph( const ParagraphData& );
144 ~Paragraph();
146 sal_Int16 GetDepth() const { return nDepth; }
148 sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
149 void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
151 sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
152 void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
154 void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; }
155 void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; }
156 bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; }
159 struct ParaRange
161 sal_Int32 nStartPara;
162 sal_Int32 nEndPara;
164 ParaRange( sal_Int32 nS, sal_Int32 nE ) { nStartPara = nS, nEndPara = nE; }
166 void Adjust();
167 sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
170 inline void ParaRange::Adjust()
172 if ( nStartPara > nEndPara )
174 sal_Int32 nTmp = nStartPara;
175 nStartPara = nEndPara;
176 nEndPara = nTmp;
180 class EDITENG_DLLPUBLIC OutlinerView
182 friend class Outliner;
184 private:
186 Outliner* pOwner;
187 EditView* pEditView;
189 // Drag & Drop
190 sal_Bool bBeginDragAtMove_OLDMEMBER;
191 sal_Bool bInDragMode;
192 Point aDDStartPosRef;
193 Point aDDStartPosPix;
194 sal_Int32 nDDStartPara;
195 sal_Int32 nDDStartParaVisChildCount;
196 sal_Int32 nDDCurPara;
197 sal_uInt16 nDDStartDepth;
198 sal_uInt16 nDDCurDepth;
199 sal_uInt16 nDDMaxDepth;
200 sal_Bool bDDChangingDepth;
201 sal_Bool bDDCursorVisible;
202 long* pHorTabArrDoc;
203 long nDDScrollLRBorderWidthWin; // Left Right
204 long nDDScrollTBBorderWidthWin; // Top Bottom
205 long nDDScrollLROffs;
206 long nDDScrollTDOffs;
208 void* pDummy;
209 sal_uLong nDummy;
211 enum MouseTarget {
212 MouseText = 0,
213 MouseBullet = 1,
214 MouseHypertext = 2, // Outside OutputArea
215 MouseOutside = 3, // Outside OutputArea
216 MouseDontKnow = 4
218 MouseTarget OLD_ePrevMouseTarget;
220 EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, sal_Bool bExpand );
222 EDITENG_DLLPRIVATE sal_Int32 ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
223 EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
224 EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren );
226 EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
227 EDITENG_DLLPRIVATE sal_Int32 ImpInitPaste( sal_Int32& rStart );
228 EDITENG_DLLPRIVATE void ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize);
229 EDITENG_DLLPRIVATE sal_Int32 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected );
230 EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages();
232 public:
233 OutlinerView( Outliner* pOut, Window* pWindow );
234 virtual ~OutlinerView();
236 EditView& GetEditView() const { return *pEditView; }
238 void Scroll( long nHorzScroll, long nVertScroll );
240 void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
241 sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
242 sal_Bool MouseButtonDown( const MouseEvent& );
243 sal_Bool MouseButtonUp( const MouseEvent& );
244 sal_Bool MouseMove( const MouseEvent& );
246 void ShowCursor( sal_Bool bGotoCursor = sal_True );
247 void HideCursor();
249 Outliner* GetOutliner() const { return pOwner; }
251 void SetWindow( Window* pWindow );
252 Window* GetWindow() const;
254 void SetReadOnly( sal_Bool bReadOnly );
255 sal_Bool IsReadOnly() const;
257 void SetOutputArea( const Rectangle& rRect );
258 Rectangle GetOutputArea() const;
260 Rectangle GetVisArea() const;
262 void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
264 // Retruns the number of selected paragraphs
265 sal_Int32 Select( Paragraph* pParagraph,
266 sal_Bool bSelect=sal_True,
267 sal_Bool bWChildren=sal_True);
269 String GetSelected() const;
270 void SelectRange( sal_Int32 nFirst, sal_Int32 nCount );
271 void SetAttribs( const SfxItemSet& );
272 void Indent( short nDiff );
273 void AdjustDepth( short nDX ); // Later replace with Indent!
275 sal_Bool AdjustHeight( long nDY );
277 sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
279 void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
280 void InsertText( const OutlinerParaObject& rParaObj );
281 void Expand();
282 void Collapse();
283 void ExpandAll();
284 void CollapseAll();
286 void SetBackgroundColor( const Color& rColor );
287 Color GetBackgroundColor();
289 SfxItemSet GetAttribs();
291 void Cut();
292 void Copy();
293 void Paste();
294 void PasteSpecial();
296 const SfxStyleSheet* GetStyleSheet() const;
297 SfxStyleSheet* GetStyleSheet();
299 void SetControlWord( sal_uLong nWord );
300 sal_uLong GetControlWord() const;
302 void SetAnchorMode( EVAnchorMode eMode );
303 EVAnchorMode GetAnchorMode() const;
305 Pointer GetPointer( const Point& rPosPixel );
306 void Command( const CommandEvent& rCEvt );
308 EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
309 EESpellState StartThesaurus();
310 sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
312 // for text conversion
313 void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
315 void TransliterateText( sal_Int32 nTransliterationMode );
317 ESelection GetSelection();
319 sal_uInt16 GetSelectedScriptType() const;
321 void SetVisArea( const Rectangle& rRect );
322 void SetSelection( const ESelection& );
324 void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False );
325 void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs );
326 sal_Bool HasSelection() const;
328 void InsertField( const SvxFieldItem& rFld );
329 const SvxFieldItem* GetFieldUnderMousePointer() const;
330 const SvxFieldItem* GetFieldAtSelection() const;
332 /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off
333 or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on
335 void ToggleBullets();
337 void ToggleBulletsNumbering(
338 const bool bToggle,
339 const bool bHandleBullets,
340 const SvxNumRule* pNumRule = NULL );
342 /** apply bullets/numbering for paragraphs
344 @param boolean bHandleBullets
345 true: handle bullets
346 false: handle numbering
348 @param pNewNumRule
349 numbering rule which needs to be applied. can be 0.
351 @param boolean bAtSelection
352 true: apply bullets/numbering at selected paragraphs
353 false: apply bullets/numbering at all paragraphs
355 void ApplyBulletsNumbering(
356 const bool bHandleBullets,
357 const SvxNumRule* pNewNumRule,
358 const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
359 const bool bAtSelection = false );
361 /** switch off bullets/numbering for paragraphs
363 @param boolean bAtSelection
364 true: switch off bullets/numbering at selected paragraphs
365 false: switch off bullets/numbering at all paragraphs
367 void SwitchOffBulletsNumbering(
368 const bool bAtSelection = false );
370 /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
371 paragraphs that already have numbering enabled.
373 void EnableBullets();
375 sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
376 sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
377 void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
379 void SetInvalidateMore( sal_uInt16 nPixel );
380 sal_uInt16 GetInvalidateMore() const;
382 String GetSurroundingText() const;
383 Selection GetSurroundingTextSelection() const;
387 // some thesaurus functionality to avoid code duplication in different projects...
388 bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView );
389 void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText );
391 typedef ::std::vector< OutlinerView* > ViewList;
393 class EDITENG_DLLPUBLIC DrawPortionInfo
395 public:
396 const Point& mrStartPos;
397 const String& mrText;
398 sal_uInt16 mnTextStart;
399 sal_uInt16 mnTextLen;
400 sal_Int32 mnPara;
401 xub_StrLen mnIndex;
402 const SvxFont& mrFont;
403 const sal_Int32* mpDXArray;
405 const EEngineData::WrongSpellVector* mpWrongSpellVector;
406 const SvxFieldData* mpFieldData;
407 const ::com::sun::star::lang::Locale* mpLocale;
408 const Color maOverlineColor;
409 const Color maTextLineColor;
411 sal_uInt8 mnBiDiLevel;
413 bool mbFilled;
414 long mnWidthToFill;
416 // bitfield
417 unsigned mbEndOfLine : 1;
418 unsigned mbEndOfParagraph : 1;
419 unsigned mbEndOfBullet : 1;
421 sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
422 sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; }
424 DrawPortionInfo(
425 const Point& rPos,
426 const String& rTxt,
427 sal_uInt16 nTxtStart,
428 sal_uInt16 nTxtLen,
429 const SvxFont& rFnt,
430 sal_Int32 nPar,
431 xub_StrLen nIdx,
432 const sal_Int32* pDXArr,
433 const EEngineData::WrongSpellVector* pWrongSpellVector,
434 const SvxFieldData* pFieldData,
435 const ::com::sun::star::lang::Locale* pLocale,
436 const Color& rOverlineColor,
437 const Color& rTextLineColor,
438 sal_uInt8 nBiDiLevel,
439 bool bFilled,
440 long nWidthToFill,
441 bool bEndOfLine,
442 bool bEndOfParagraph,
443 bool bEndOfBullet)
444 : mrStartPos(rPos),
445 mrText(rTxt),
446 mnTextStart(nTxtStart),
447 mnTextLen(nTxtLen),
448 mnPara(nPar),
449 mnIndex(nIdx),
450 mrFont(rFnt),
451 mpDXArray(pDXArr),
452 mpWrongSpellVector(pWrongSpellVector),
453 mpFieldData(pFieldData),
454 mpLocale(pLocale),
455 maOverlineColor(rOverlineColor),
456 maTextLineColor(rTextLineColor),
457 mnBiDiLevel(nBiDiLevel),
458 mbFilled( bFilled ),
459 mnWidthToFill( nWidthToFill ),
460 mbEndOfLine(bEndOfLine),
461 mbEndOfParagraph(bEndOfParagraph),
462 mbEndOfBullet(bEndOfBullet)
466 class EDITENG_DLLPUBLIC DrawBulletInfo
468 public:
469 const GraphicObject maBulletGraphicObject;
470 Point maBulletPosition;
471 Size maBulletSize;
473 DrawBulletInfo(
474 const GraphicObject& rBulletGraphicObject,
475 const Point& rBulletPosition,
476 const Size& rBulletSize)
477 : maBulletGraphicObject(rBulletGraphicObject),
478 maBulletPosition(rBulletPosition),
479 maBulletSize(rBulletSize)
483 struct EDITENG_DLLPUBLIC PaintFirstLineInfo
485 sal_Int32 mnPara;
486 const Point& mrStartPos;
487 long mnBaseLineY;
488 const Point& mrOrigin;
489 short mnOrientation;
490 OutputDevice* mpOutDev;
492 PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
493 : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
497 class SdrPage;
499 class EditFieldInfo
501 private:
502 Outliner* pOutliner;
503 const SvxFieldItem& rFldItem;
505 Color* pTxtColor;
506 Color* pFldColor;
508 String aRepresentation;
510 sal_Int32 nPara;
511 xub_StrLen nPos;
512 sal_Bool bSimpleClick;
514 EditFieldInfo();
515 EditFieldInfo( const EditFieldInfo& );
517 SdrPage* mpSdrPage;
519 public:
520 EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_Int32 nPa, xub_StrLen nPo )
521 : rFldItem( rFItem )
523 pOutliner = pOutl;
524 nPara = nPa; nPos = nPo;
525 pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False;
526 mpSdrPage = 0;
528 ~EditFieldInfo()
530 delete pTxtColor;
531 delete pFldColor;
534 Outliner* GetOutliner() const { return pOutliner; }
536 const SvxFieldItem& GetField() const { return rFldItem; }
538 Color* GetTxtColor() const { return pTxtColor; }
539 void SetTxtColor( const Color& rColor )
540 { delete pTxtColor; pTxtColor = new Color( rColor ); }
542 Color* GetFldColor() const { return pFldColor; }
543 void SetFldColor( const Color& rColor )
544 { delete pFldColor; pFldColor = new Color( rColor ); }
545 void ClearFldColor()
546 { delete pFldColor; pFldColor = 0; }
548 sal_Int32 GetPara() const { return nPara; }
549 xub_StrLen GetPos() const { return nPos; }
551 sal_Bool IsSimpleClick() const { return bSimpleClick; }
552 void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; }
554 const String& GetRepresentation() const { return aRepresentation; }
555 String& GetRepresentation() { return aRepresentation; }
556 void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
558 void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
559 SdrPage* GetSdrPage() const { return mpSdrPage; }
562 struct EBulletInfo
564 sal_Bool bVisible;
565 sal_uInt16 nType; // see SvxNumberType
566 String aText;
567 SvxFont aFont;
568 Graphic aGraphic;
569 sal_Int32 nParagraph;
570 Rectangle aBounds;
572 EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
575 #define OUTLINERMODE_DONTKNOW 0x0000
576 #define OUTLINERMODE_TEXTOBJECT 0x0001
577 #define OUTLINERMODE_TITLEOBJECT 0x0002
578 #define OUTLINERMODE_OUTLINEOBJECT 0x0003
579 #define OUTLINERMODE_OUTLINEVIEW 0x0004
581 #define OUTLINERMODE_USERMASK 0x00FF
583 #define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
584 #define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
586 class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
588 friend class OutlinerView;
589 friend class OutlinerEditEng;
590 friend class OutlinerParaObject;
591 friend class OLUndoExpand;
592 friend class OutlinerUndoChangeDepth;
593 friend class OutlinerUndoCheckPara;
594 friend class OutlinerUndoChangeParaFlags;
596 OutlinerEditEng* pEditEngine;
598 ParagraphList* pParaList;
599 ViewList aViewList;
601 Paragraph* pHdlParagraph;
602 sal_Int32 mnFirstSelPage;
603 Link aDrawPortionHdl;
604 Link aDrawBulletHdl;
605 Link aExpandHdl;
606 Link aParaInsertedHdl;
607 Link aParaRemovingHdl;
608 Link aDepthChangedHdl;
609 Link aWidthArrReqHdl;
610 Link aBeginMovingHdl;
611 Link aEndMovingHdl;
612 Link aIndentingPagesHdl;
613 Link aRemovingPagesHdl;
614 Link aFieldClickedHdl;
615 Link aCalcFieldValueHdl;
616 Link maPaintFirstLineHdl;
617 Link maBeginPasteOrDropHdl;
618 Link maEndPasteOrDropHdl;
620 sal_Int32 nDepthChangedHdlPrevDepth;
621 sal_uInt16 mnDepthChangeHdlPrevFlags;
622 sal_Int16 nMaxDepth;
623 const sal_Int16 nMinDepth;
624 sal_Int32 nFirstPage;
626 sal_uInt16 nOutlinerMode;
628 sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
629 sal_Bool bFirstParaIsEmpty;
630 sal_Bool bBlockInsCallback;
631 sal_Bool bStrippingPortions;
632 sal_Bool bPasting;
634 sal_uLong nDummy;
636 DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
637 DECL_LINK( BeginMovingParagraphsHdl, void* );
638 DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
639 DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
640 DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
641 DECL_LINK( EditEngineNotifyHdl, EENotify* );
642 void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd );
643 bool ImplHasNumberFormat( sal_Int32 nPara ) const;
644 Size ImplGetBulletSize( sal_Int32 nPara );
645 sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt );
646 void ImplCalcBulletText( sal_Int32 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
647 String ImplGetBulletText( sal_Int32 nPara );
648 void ImplCheckNumBulletItem( sal_Int32 nPara );
649 void ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
650 void ImplSetLevelDependendStyleSheet( sal_Int32 nPara, SfxStyleSheet* pLevelStyle = NULL );
652 void ImplBlockInsertionCallbacks( sal_Bool b );
654 void ImplCheckStyleSheet( sal_Int32 nPara, sal_Bool bReplaceExistingStyle );
655 void ImpRecalcBulletIndent( sal_Int32 nPara );
657 const SvxBulletItem& ImpGetBullet( sal_Int32 nPara, sal_uInt16& );
658 void ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara );
659 bool ImpConvertEdtToOut( sal_Int32 nPara, EditView* pView = 0 );
661 void ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount );
662 long ImpCalcMaxBulletWidth( sal_Int32 nPara, const SvxBulletItem& rBullet );
663 Font ImpCalcBulletFont( sal_Int32 nPara ) const;
664 Rectangle ImpCalcBulletArea( sal_Int32 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos );
665 long ImpGetTextIndent( sal_Int32 nPara );
666 sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
667 sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
668 sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 nFirstPage, sal_Int32 nPages );
670 sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
671 void ImplCheckDepth( sal_Int16& rnDepth ) const;
673 protected:
674 void ParagraphInserted( sal_Int32 nParagraph );
675 void ParagraphDeleted( sal_Int32 nParagraph );
676 void ParaAttribsChanged( sal_Int32 nParagraph );
678 virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
680 void InvalidateBullet( Paragraph* pPara, sal_Int32 nPara );
681 void PaintBullet( sal_Int32 nPara, const Point& rStartPos,
682 const Point& rOrigin, short nOrientation,
683 OutputDevice* pOutDev );
685 // used by OutlinerEditEng. Allows Outliner objects to provide
686 // bullet access to the EditEngine.
687 virtual const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const;
689 public:
691 Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
692 virtual ~Outliner();
694 void Init( sal_uInt16 nOutlinerMode );
695 sal_uInt16 GetMode() const { return nOutlinerMode; }
697 void SetVertical( sal_Bool bVertical );
698 sal_Bool IsVertical() const;
700 void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
702 void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
703 EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
705 sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
706 LanguageType GetLanguage( sal_Int32 nPara, sal_uInt16 nPos ) const;
708 void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
710 void SetKernAsianPunctuation( sal_Bool bEnabled );
712 void SetAddExtLeading( sal_Bool b );
714 size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
715 OutlinerView* RemoveView( OutlinerView* pView );
716 OutlinerView* RemoveView( size_t nIndex );
717 OutlinerView* GetView( size_t nIndex ) const;
718 size_t GetViewCount() const;
720 Paragraph* Insert( const String& rText, sal_Int32 nAbsPos = EE_PARA_APPEND, sal_Int16 nDepth = 0 );
721 void SetText( const OutlinerParaObject& );
722 void AddText( const OutlinerParaObject& );
723 void SetText( const String& rText, Paragraph* pParagraph );
724 String GetText( Paragraph* pPara, sal_Int32 nParaCount=1 ) const;
726 OutlinerParaObject* CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const;
728 const SfxItemSet& GetEmptyItemSet() const;
730 void SetRefMapMode( const MapMode& );
731 MapMode GetRefMapMode() const;
733 void SetBackgroundColor( const Color& rColor );
734 Color GetBackgroundColor() const;
736 sal_Int16 GetMinDepth() const { return -1; }
738 void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False );
739 sal_Int16 GetMaxDepth() const { return nMaxDepth; }
741 void SetUpdateMode( sal_Bool bUpdate );
742 sal_Bool GetUpdateMode() const;
744 void Clear();
746 void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
748 sal_Int32 GetParagraphCount() const;
749 Paragraph* GetParagraph( sal_Int32 nAbsPos ) const;
751 sal_Bool HasParent( Paragraph* pParagraph ) const;
752 sal_Bool HasChildren( Paragraph* pParagraph ) const;
753 sal_Int32 GetChildCount( Paragraph* pParent ) const;
754 sal_Bool IsExpanded( Paragraph* pPara ) const;
755 Paragraph* GetParent( Paragraph* pParagraph ) const;
756 sal_Int32 GetAbsPos( Paragraph* pPara );
758 sal_Int16 GetDepth( sal_Int32 nPara ) const;
759 void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
761 sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
763 void EnableUndo( sal_Bool bEnable );
764 sal_Bool IsUndoEnabled() const;
765 void UndoActionStart( sal_uInt16 nId );
766 void UndoActionEnd( sal_uInt16 nId );
767 void InsertUndo( EditUndo* pUndo );
768 sal_Bool IsInUndo();
770 void ClearModifyFlag();
771 sal_Bool IsModified() const;
773 Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
774 sal_Bool IsExpanding() const { return bIsExpanding; }
776 virtual void ExpandHdl();
777 void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
778 Link GetExpandHdl() const { return aExpandHdl; }
780 virtual void ParagraphInsertedHdl();
781 void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
782 Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
784 virtual void ParagraphRemovingHdl();
785 void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
786 Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
788 virtual void DepthChangedHdl();
789 void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
790 Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
791 sal_Int16 GetPrevDepth() const { return static_cast<sal_Int16>(nDepthChangedHdlPrevDepth); }
792 sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
794 virtual long RemovingPagesHdl( OutlinerView* );
795 void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
796 Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
797 virtual long IndentingPagesHdl( OutlinerView* );
798 void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
799 Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
800 // valid only in the two upper handlers
801 sal_Int32 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
803 // valid only in the two upper handlers
804 sal_Int32 GetFirstSelPage() const { return mnFirstSelPage; }
806 void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
807 Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
809 void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
810 Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
812 void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
813 Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
815 void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
816 Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
818 void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
819 Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
821 void SetModifyHdl( const Link& rLink );
822 Link GetModifyHdl() const;
824 void SetNotifyHdl( const Link& rLink );
826 void SetStatusEventHdl( const Link& rLink );
827 Link GetStatusEventHdl() const;
829 void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
830 void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
832 const Size& GetPaperSize() const;
833 void SetPaperSize( const Size& rSize );
835 void SetFirstPageNumber( sal_Int32 n ) { nFirstPage = n; }
836 sal_Int32 GetFirstPageNumber() const { return nFirstPage; }
838 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
839 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
840 void ClearPolygon();
842 const Size& GetMinAutoPaperSize() const;
843 void SetMinAutoPaperSize( const Size& rSz );
845 const Size& GetMaxAutoPaperSize() const;
846 void SetMaxAutoPaperSize( const Size& rSz );
848 void SetDefTab( sal_uInt16 nTab );
850 sal_Bool IsFlatMode() const;
851 void SetFlatMode( sal_Bool bFlat );
853 void EnableAutoColor( sal_Bool b );
855 void ForceAutoColor( sal_Bool b );
856 sal_Bool IsForceAutoColor() const;
858 EBulletInfo GetBulletInfo( sal_Int32 nPara );
860 void SetWordDelimiters( const String& rDelimiters );
861 String GetWordDelimiters() const;
862 String GetWord( sal_Int32 nPara, xub_StrLen nIndex );
864 void StripPortions();
866 virtual void DrawingText(
867 const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen,
868 const sal_Int32* pDXArray, const SvxFont& rFont, sal_Int32 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
869 const EEngineData::WrongSpellVector* pWrongSpellVector,
870 const SvxFieldData* pFieldData,
871 bool bEndOfLine,
872 bool bEndOfParagraph,
873 bool bEndOfBullet,
874 const ::com::sun::star::lang::Locale* pLocale,
875 const Color& rOverlineColor,
876 const Color& rTextLineColor);
878 virtual void DrawingTab(
879 const Point& rStartPos, long nWidth, const String& rChar,
880 const SvxFont& rFont, sal_Int32 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
881 bool bEndOfLine,
882 bool bEndOfParagraph,
883 const Color& rOverlineColor,
884 const Color& rTextLineColor);
886 Size CalcTextSize();
887 Size CalcTextSizeNTP();
889 void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
890 SfxStyleSheetPool* GetStyleSheetPool();
892 sal_Bool IsInSelectionMode() const;
894 void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle );
895 SfxStyleSheet* GetStyleSheet( sal_Int32 nPara );
897 void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& );
898 SfxItemSet GetParaAttribs( sal_Int32 nPara );
900 void Remove( Paragraph* pPara, sal_Int32 nParaCount );
901 sal_Bool Expand( Paragraph* );
902 sal_Bool Collapse( Paragraph* );
904 void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
905 bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
907 // Returns an array containing the widths of the Bullet Indentations
908 // Last value must be -1. Is deleted by the outliner.
909 Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
910 void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
912 void SetControlWord( sal_uLong nWord );
913 sal_uLong GetControlWord() const;
915 Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
916 void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
917 Link GetEndMovingHdl() const {return aEndMovingHdl;}
918 void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
920 sal_uLong GetLineCount( sal_Int32 nParagraph ) const;
921 sal_uInt16 GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const;
922 sal_uLong GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine = 0 );
924 sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
926 ::svl::IUndoManager&
927 GetUndoManager();
929 void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
930 void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
931 void QuickInsertLineBreak( const ESelection& rSel );
933 // Only for EditEngine mode
934 void QuickInsertText( const String& rText, const ESelection& rSel );
935 void QuickDelete( const ESelection& rSel );
936 void QuickRemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0 );
937 void QuickFormatDoc( sal_Bool bFull = sal_False );
939 sal_Bool UpdateFields();
940 void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
942 virtual void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos );
943 virtual void FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos );
944 virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
946 void SetSpeller( ::com::sun::star::uno::Reference<
947 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
948 ::com::sun::star::uno::Reference<
949 ::com::sun::star::linguistic2::XSpellChecker1 >
950 GetSpeller();
951 void SetHyphenator( ::com::sun::star::uno::Reference<
952 ::com::sun::star::linguistic2::XHyphenator >& xHyph );
954 void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
956 // Depricated
957 void SetDefaultLanguage( LanguageType eLang );
958 LanguageType GetDefaultLanguage() const;
960 void CompleteOnlineSpelling();
962 EESpellState HasSpellErrors();
963 sal_Bool HasText( const SvxSearchItem& rSearchItem );
964 virtual sal_Bool SpellNextDocument();
966 // for text conversion
967 sal_Bool HasConvertibleTextPortion( LanguageType nLang );
968 virtual sal_Bool ConvertNextDocument();
970 void SetEditTextObjectPool( SfxItemPool* pPool );
971 SfxItemPool* GetEditTextObjectPool() const;
973 void SetRefDevice( OutputDevice* pRefDev );
974 OutputDevice* GetRefDevice() const;
976 sal_uLong GetTextHeight() const;
977 sal_uLong GetTextHeight( sal_Int32 nParagraph ) const;
978 Point GetDocPosTopLeft( sal_Int32 nParagraph );
979 Point GetDocPos( const Point& rPaperPos ) const;
980 sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
981 sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos );
983 void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
984 void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
985 void EraseVirtualDevice();
987 sal_Bool ShouldCreateBigTextObject() const;
989 const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
991 // this is needed for StarOffice Api
992 void SetLevelDependendStyleSheet( sal_Int32 nPara );
994 sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
996 void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
997 // spell and return a sentence
998 bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
999 // put spell position to start of current sentence
1000 void PutSpellingToSentenceStart( EditView& rEditView );
1001 // applies a changed sentence
1002 void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
1004 /** sets a link that is called at the beginning of a drag operation at an edit view */
1005 void SetBeginDropHdl( const Link& rLink );
1007 /** sets a link that is called at the end of a drag operation at an edit view */
1008 void SetEndDropHdl( const Link& rLink );
1010 /** sets a link that is called before a drop or paste operation. */
1011 void SetBeginPasteOrDropHdl( const Link& rLink );
1012 Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
1014 /** sets a link that is called after a drop or paste operation. */
1015 void SetEndPasteOrDropHdl( const Link& rLink );
1016 Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
1018 virtual sal_Int16 GetNumberingStartValue( sal_Int32 nPara );
1019 virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue );
1021 virtual sal_Bool IsParaIsNumberingRestart( sal_Int32 nPara );
1022 virtual void SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumberingRestart );
1024 /** determine the bullets/numbering status of the given paragraphs
1026 @param nParaStart
1027 index of paragraph at which the check starts
1029 @param nParaEnd
1030 index of paragraph at which the check ends
1032 @returns
1033 0 : all paragraphs have bullets
1034 1 : all paragraphs have numbering
1035 2 : otherwise
1037 sal_Int32 GetBulletsNumberingStatus(
1038 const sal_Int32 nParaStart,
1039 const sal_Int32 nParaEnd ) const;
1041 // convenient method to determine the bullets/numbering status for all paragraphs
1042 sal_Int32 GetBulletsNumberingStatus() const;
1045 #endif
1047 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */