1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _OUTLINER_HXX 24 #define _OUTLINER_HXX 25 26 #include <tools/gen.hxx> 27 #include <tools/string.hxx> 28 #include <tools/debug.hxx> 29 30 #include <svl/brdcst.hxx> 31 32 #include <editeng/editdata.hxx> 33 #include <i18npool/lang.h> 34 #include <tools/color.hxx> 35 #include <vcl/graph.hxx> 36 #include <tools/list.hxx> 37 #include <tools/link.hxx> 38 #include <rsc/rscsfx.hxx> 39 #include "editeng/editengdllapi.h" 40 41 #include <svtools/grfmgr.hxx> 42 43 #include <tools/rtti.hxx> // wegen typedef TypeId 44 #include <vector> 45 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 class OLUndoRemove; 58 class Window; 59 class KeyEvent; 60 class MouseEvent; 61 class Pointer; 62 class CommandEvent; 63 class MapMode; 64 class OutputDevice; 65 class PolyPolygon; 66 class SfxStyleSheetPool; 67 class SfxStyleSheet; 68 class SfxItemPool; 69 class SfxItemSet; 70 class SvxNumBulletItem; 71 class SvxNumberFormat; 72 class SvxLRSpaceItem; 73 class EditEngine; 74 class SvKeyValueIterator; 75 class SvxForbiddenCharactersTable; 76 77 namespace svl 78 { 79 class IUndoManager; 80 } 81 82 #include <com/sun/star/uno/Reference.h> 83 84 #include <vos/ref.hxx> 85 #include <editeng/svxfont.hxx> 86 #include <editeng/eedata.hxx> 87 #include <editeng/paragraphdata.hxx> 88 89 class SvxFieldData; 90 ////////////////////////////////////////////////////////////////////////////// 91 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; 99 } 100 101 namespace basegfx { class B2DPolyPolygon; } 102 103 // nur interner Gebrauch! 104 #define PARAFLAG_DROPTARGET 0x1000 105 #define PARAFLAG_DROPTARGET_EMPTY 0x2000 106 #define PARAFLAG_HOLDDEPTH 0x4000 107 #define PARAFLAG_SETBULLETTEXT 0x8000 108 #define PARAFLAG_ISPAGE 0x0100 109 110 // Undo-Action-Ids 111 #define OLUNDO_DEPTH EDITUNDO_USER 112 // #define OLUNDO_HEIGHT EDITUNDO_USER+1 113 #define OLUNDO_EXPAND EDITUNDO_USER+2 114 #define OLUNDO_COLLAPSE EDITUNDO_USER+3 115 // #define OLUNDO_REMOVE EDITUNDO_USER+4 116 #define OLUNDO_ATTR EDITUNDO_USER+5 117 #define OLUNDO_INSERT EDITUNDO_USER+6 118 // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7 119 #define OLUNDO_CHECKPARA EDITUNDO_USER+8 120 121 class Paragraph : protected ParagraphData 122 { 123 private: 124 friend class Outliner; 125 friend class ParagraphList; 126 friend class OutlinerView; 127 friend class OutlinerParaObject; 128 friend class OutlinerEditEng; 129 friend class OLUndoDepth; 130 friend class OutlinerUndoCheckPara; 131 friend class OutlinerUndoChangeParaFlags; 132 133 Paragraph& operator=(const Paragraph& rPara ); 134 135 sal_uInt16 nFlags; 136 XubString aBulText; 137 Size aBulSize; 138 sal_Bool bVisible; 139 140 sal_Bool IsVisible() const { return bVisible; } 141 void SetText( const XubString& rText ) { aBulText = rText; aBulSize.Width() = -1; } 142 void Invalidate() { aBulSize.Width() = -1; } 143 void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; } 144 const XubString& GetText() const { return aBulText; } 145 146 Paragraph( sal_Int16 nDepth ); 147 Paragraph( const Paragraph& ); 148 Paragraph( const ParagraphData& ); 149 ~Paragraph(); 150 151 sal_Int16 GetDepth() const { return nDepth; } 152 153 sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; } 154 void SetNumberingStartValue( sal_Int16 nNumberingStartValue ); 155 156 sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; } 157 void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart ); 158 159 void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; } 160 void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; } 161 bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; } 162 }; 163 164 struct ParaRange 165 { 166 sal_uInt16 nStartPara; 167 sal_uInt16 nEndPara; 168 169 ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; } 170 171 void Adjust(); 172 sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); } 173 }; 174 175 inline void ParaRange::Adjust() 176 { 177 if ( nStartPara > nEndPara ) 178 { 179 sal_uInt16 nTmp = nStartPara; 180 nStartPara = nEndPara; 181 nEndPara = nTmp; 182 } 183 } 184 185 #define OL_ROOTPARENT (Paragraph*)NULL 186 187 class EDITENG_DLLPUBLIC OutlinerView 188 { 189 friend class Outliner; 190 191 private: 192 193 Outliner* pOwner; 194 EditView* pEditView; 195 196 // Drag & Drop 197 sal_Bool bBeginDragAtMove_OLDMEMBER; 198 sal_Bool bInDragMode; 199 Point aDDStartPosRef; 200 Point aDDStartPosPix; 201 sal_uLong nDDStartPara; 202 sal_uLong nDDStartParaVisChildCount; 203 sal_uLong nDDCurPara; 204 sal_uInt16 nDDStartDepth; 205 sal_uInt16 nDDCurDepth; 206 sal_uInt16 nDDMaxDepth; 207 sal_Bool bDDChangingDepth; 208 sal_Bool bDDCursorVisible; 209 long* pHorTabArrDoc; 210 long nDDScrollLRBorderWidthWin; // Left Right 211 long nDDScrollTBBorderWidthWin; // Top Bottom 212 long nDDScrollLROffs; 213 long nDDScrollTDOffs; 214 215 void* pDummy; 216 sal_uLong nDummy; 217 218 enum MouseTarget { 219 MouseText = 0, 220 MouseBullet = 1, 221 MouseHypertext = 2, // ausserhalb OutputArea 222 MouseOutside = 3, // ausserhalb OutputArea 223 MouseDontKnow = 4 224 }; 225 MouseTarget OLD_ePrevMouseTarget; 226 227 #ifdef _OUTLINER_CXX 228 229 EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand ); 230 231 EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget); 232 EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara ); 233 EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds ); 234 EDITENG_DLLPRIVATE void ImpHideDDCursor(); 235 EDITENG_DLLPRIVATE void ImpShowDDCursor(); 236 EDITENG_DLLPRIVATE void ImpPaintDDCursor(); 237 238 EDITENG_DLLPRIVATE void ImpDragScroll( const Point& rPosPix ); 239 EDITENG_DLLPRIVATE void ImpScrollLeft(); 240 EDITENG_DLLPRIVATE void ImpScrollRight(); 241 EDITENG_DLLPRIVATE void ImpScrollUp(); 242 EDITENG_DLLPRIVATE void ImpScrollDown(); 243 244 EDITENG_DLLPRIVATE sal_uLong ImpGetInsertionPara( const Point& rPosPixel ); 245 EDITENG_DLLPRIVATE Point ImpGetDocPos( const Point& rPosPixel ); 246 EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget ); 247 EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart ); 248 EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize); 249 EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ); 250 EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages(); 251 252 #endif 253 254 public: 255 OutlinerView( Outliner* pOut, Window* pWindow ); 256 virtual ~OutlinerView(); 257 258 EditView& GetEditView() const { return *pEditView; } 259 260 void Scroll( long nHorzScroll, long nVertScroll ); 261 262 void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 ); 263 sal_Bool PostKeyEvent( const KeyEvent& rKEvt ); 264 sal_Bool MouseButtonDown( const MouseEvent& ); 265 sal_Bool MouseButtonUp( const MouseEvent& ); 266 sal_Bool MouseMove( const MouseEvent& ); 267 268 void ShowCursor( sal_Bool bGotoCursor = sal_True ); 269 void HideCursor(); 270 271 void SetOutliner( Outliner* pOutliner ); 272 Outliner* GetOutliner() const { return pOwner; } 273 274 void SetWindow( Window* pWindow ); 275 Window* GetWindow() const; 276 277 void SetReadOnly( sal_Bool bReadOnly ); 278 sal_Bool IsReadOnly() const; 279 280 void SetOutputArea( const Rectangle& rRect ); 281 Rectangle GetOutputArea() const; 282 283 Rectangle GetVisArea() const; 284 285 List* CreateSelectionList(); 286 287 // gibt Anzahl selektierter Absaetze zurueck 288 // MT 07/00: Who needs this? 289 sal_uLong Select( Paragraph* pParagraph, 290 sal_Bool bSelect=sal_True, 291 sal_Bool bWChilds=sal_True); 292 293 String GetSelected() const; 294 void SelectRange( sal_uLong nFirst, sal_uInt16 nCount ); 295 void SetAttribs( const SfxItemSet& ); 296 void Indent( short nDiff ); 297 void AdjustDepth( short nDX ); // Spaeter gegeb Indent ersetzen! 298 299 sal_Bool AdjustHeight( long nDY ); 300 void AdjustDepth( Paragraph* pPara, short nDX, 301 sal_Bool bWithChilds = sal_False ); 302 void AdjustHeight( Paragraph* pPara, long nDY, 303 sal_Bool bWithChilds=sal_False ); 304 305 sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); 306 sal_uLong Write( SvStream& rOutput, EETextFormat eFormat ); 307 308 void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); 309 void InsertText( const OutlinerParaObject& rParaObj ); 310 void Expand(); 311 void Collapse(); 312 void Expand( Paragraph* ); 313 void Collapse( Paragraph* ); 314 void ExpandAll(); 315 void CollapseAll(); 316 317 void SetBackgroundColor( const Color& rColor ); 318 Color GetBackgroundColor(); 319 320 SfxItemSet GetAttribs(); 321 322 void Cut(); 323 void Copy(); 324 void Paste(); 325 void PasteSpecial(); 326 void EnablePaste( sal_Bool bEnable ); 327 328 void Undo(); 329 void Redo(); 330 331 void SetStyleSheet( SfxStyleSheet* ); 332 SfxStyleSheet* GetStyleSheet() const; 333 334 void SetControlWord( sal_uLong nWord ); 335 sal_uLong GetControlWord() const; 336 337 void SetAnchorMode( EVAnchorMode eMode ); 338 EVAnchorMode GetAnchorMode() const; 339 340 Pointer GetPointer( const Point& rPosPixel ); 341 void Command( const CommandEvent& rCEvt ); 342 void RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich = 0 ); 343 344 void CompleteAutoCorrect(); 345 346 EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); 347 EESpellState StartThesaurus(); 348 sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); 349 350 // for text conversion 351 void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); 352 353 void TransliterateText( sal_Int32 nTransliterationMode ); 354 355 ESelection GetSelection(); 356 357 sal_uInt16 GetSelectedScriptType() const; 358 359 void SetVisArea( const Rectangle& rRec ); 360 void SetSelection( const ESelection& ); 361 362 void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False ); 363 void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ); 364 sal_Bool HasSelection() const; 365 366 void InsertField( const SvxFieldItem& rFld ); 367 const SvxFieldItem* GetFieldUnderMousePointer() const; 368 const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const; 369 const SvxFieldItem* GetFieldAtSelection() const; 370 371 /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off 372 or disables numbering for the selected paragraphs if the numbering of the first paragraph is on 373 */ 374 void ToggleBullets(); 375 376 /** enables numbering for the selected paragraphs that are not enabled and ignore all selected 377 paragraphs that already have numbering enabled. 378 */ 379 void EnableBullets(); 380 381 sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); 382 sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); 383 void SpellIgnoreWord(); 384 void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); 385 386 void SetInvalidateMore( sal_uInt16 nPixel ); 387 sal_uInt16 GetInvalidateMore() const; 388 389 String GetSurroundingText() const; 390 Selection GetSurroundingTextSelection() const; 391 }; 392 393 394 // some thesaurus functionality to avoid code duplication in different projects... 395 bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); 396 void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); 397 398 399 //#if 0 // _SOLAR__PRIVATE 400 DECLARE_LIST(ViewList,OutlinerView*) 401 //#else 402 //typedef List ViewList; 403 //#endif 404 405 class EDITENG_DLLPUBLIC DrawPortionInfo 406 { 407 public: 408 const Point& mrStartPos; 409 const String& mrText; 410 sal_uInt16 mnTextStart; 411 sal_uInt16 mnTextLen; 412 sal_uInt16 mnPara; 413 xub_StrLen mnIndex; 414 const SvxFont& mrFont; 415 const sal_Int32* mpDXArray; 416 417 const EEngineData::WrongSpellVector* mpWrongSpellVector; 418 const SvxFieldData* mpFieldData; 419 const ::com::sun::star::lang::Locale* mpLocale; 420 const Color maOverlineColor; 421 const Color maTextLineColor; 422 423 // #101498# BiDi level needs to be transported, too. 424 sal_uInt8 mnBiDiLevel; 425 426 // bitfield 427 unsigned mbEndOfLine : 1; 428 unsigned mbEndOfParagraph : 1; 429 unsigned mbEndOfBullet : 1; 430 431 sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } 432 sal_Bool IsRTL() const; 433 434 DrawPortionInfo( 435 const Point& rPos, 436 const String& rTxt, 437 sal_uInt16 nTxtStart, 438 sal_uInt16 nTxtLen, 439 const SvxFont& rFnt, 440 sal_uInt16 nPar, 441 xub_StrLen nIdx, 442 const sal_Int32* pDXArr, 443 const EEngineData::WrongSpellVector* pWrongSpellVector, 444 const SvxFieldData* pFieldData, 445 const ::com::sun::star::lang::Locale* pLocale, 446 const Color& rOverlineColor, 447 const Color& rTextLineColor, 448 sal_uInt8 nBiDiLevel, 449 bool bEndOfLine, 450 bool bEndOfParagraph, 451 bool bEndOfBullet) 452 : mrStartPos(rPos), 453 mrText(rTxt), 454 mnTextStart(nTxtStart), 455 mnTextLen(nTxtLen), 456 mnPara(nPar), 457 mnIndex(nIdx), 458 mrFont(rFnt), 459 mpDXArray(pDXArr), 460 mpWrongSpellVector(pWrongSpellVector), 461 mpFieldData(pFieldData), 462 mpLocale(pLocale), 463 maOverlineColor(rOverlineColor), 464 maTextLineColor(rTextLineColor), 465 mnBiDiLevel(nBiDiLevel), 466 mbEndOfLine(bEndOfLine), 467 mbEndOfParagraph(bEndOfParagraph), 468 mbEndOfBullet(bEndOfBullet) 469 {} 470 }; 471 472 class EDITENG_DLLPUBLIC DrawBulletInfo 473 { 474 public: 475 const GraphicObject maBulletGraphicObject; 476 Point maBulletPosition; 477 Size maBulletSize; 478 479 DrawBulletInfo( 480 const GraphicObject& rBulletGraphicObject, 481 const Point& rBulletPosition, 482 const Size& rBulletSize) 483 : maBulletGraphicObject(rBulletGraphicObject), 484 maBulletPosition(rBulletPosition), 485 maBulletSize(rBulletSize) 486 {} 487 }; 488 489 struct EDITENG_DLLPUBLIC PaintFirstLineInfo 490 { 491 sal_uInt16 mnPara; 492 const Point& mrStartPos; 493 long mnBaseLineY; 494 const Point& mrOrigin; 495 short mnOrientation; 496 OutputDevice* mpOutDev; 497 498 PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) 499 : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev ) 500 {} 501 }; 502 503 class SdrPage; 504 505 class EditFieldInfo 506 { 507 private: 508 Outliner* pOutliner; 509 const SvxFieldItem& rFldItem; 510 511 Color* pTxtColor; 512 Color* pFldColor; 513 514 String aRepresentation; 515 516 sal_uInt16 nPara; 517 xub_StrLen nPos; 518 sal_Bool bSimpleClick; 519 520 EditFieldInfo(); 521 EditFieldInfo( const EditFieldInfo& ); 522 523 SdrPage* mpSdrPage; 524 525 public: 526 EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo ) 527 : rFldItem( rFItem ) 528 { 529 pOutliner = pOutl; 530 nPara = nPa; nPos = nPo; 531 pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False; 532 mpSdrPage = 0; 533 } 534 ~EditFieldInfo() 535 { 536 delete pTxtColor; 537 delete pFldColor; 538 } 539 540 Outliner* GetOutliner() const { return pOutliner; } 541 542 const SvxFieldItem& GetField() const { return rFldItem; } 543 544 Color* GetTxtColor() const { return pTxtColor; } 545 void SetTxtColor( const Color& rColor ) 546 { delete pTxtColor; pTxtColor = new Color( rColor ); } 547 548 Color* GetFldColor() const { return pFldColor; } 549 void SetFldColor( const Color& rColor ) 550 { delete pFldColor; pFldColor = new Color( rColor ); } 551 void ClearFldColor() 552 { delete pFldColor; pFldColor = 0; } 553 554 sal_uInt16 GetPara() const { return nPara; } 555 xub_StrLen GetPos() const { return nPos; } 556 557 sal_Bool IsSimpleClick() const { return bSimpleClick; } 558 void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; } 559 560 const String& GetRepresentation() const { return aRepresentation; } 561 String& GetRepresentation() { return aRepresentation; } 562 void SetRepresentation( const String& rStr ) { aRepresentation = rStr; } 563 564 void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; } 565 SdrPage* GetSdrPage() const { return mpSdrPage; } 566 }; 567 568 struct EBulletInfo 569 { 570 sal_Bool bVisible; 571 sal_uInt16 nType; // see SvxNumberType 572 String aText; 573 SvxFont aFont; 574 Graphic aGraphic; 575 sal_uInt16 nParagraph; 576 Rectangle aBounds; 577 578 EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {} 579 }; 580 581 #define OUTLINERMODE_DONTKNOW 0x0000 582 #define OUTLINERMODE_TEXTOBJECT 0x0001 583 #define OUTLINERMODE_TITLEOBJECT 0x0002 584 #define OUTLINERMODE_OUTLINEOBJECT 0x0003 585 #define OUTLINERMODE_OUTLINEVIEW 0x0004 586 587 #define OUTLINERMODE_USERMASK 0x00FF 588 589 #define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT) 590 #define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT) 591 592 class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster 593 { 594 friend class OutlinerView; 595 friend class OutlinerEditEng; 596 friend class OutlinerParaObject; 597 friend class OLUndoExpand; 598 friend class OutlinerUndoChangeDepth; 599 friend class OutlinerUndoCheckPara; 600 friend class OutlinerUndoChangeParaFlags; 601 602 OutlinerEditEng* pEditEngine; 603 604 ParagraphList* pParaList; 605 ViewList aViewList; 606 607 Paragraph* pHdlParagraph; 608 sal_uLong mnFirstSelPage; 609 Link aDrawPortionHdl; 610 Link aDrawBulletHdl; 611 Link aExpandHdl; 612 Link aParaInsertedHdl; 613 Link aParaRemovingHdl; 614 Link aDepthChangedHdl; 615 Link aWidthArrReqHdl; 616 Link aBeginMovingHdl; 617 Link aEndMovingHdl; 618 Link aIndentingPagesHdl; 619 Link aRemovingPagesHdl; 620 Link aFieldClickedHdl; 621 Link aCalcFieldValueHdl; 622 Link maPaintFirstLineHdl; 623 Link maBeginPasteOrDropHdl; 624 Link maEndPasteOrDropHdl; 625 626 sal_Int16 nDepthChangedHdlPrevDepth; 627 sal_uInt16 mnDepthChangeHdlPrevFlags; 628 sal_Int16 nMaxDepth; 629 const sal_Int16 nMinDepth; 630 sal_uInt16 nFirstPage; 631 632 sal_uInt16 nOutlinerMode; 633 634 sal_Bool bIsExpanding; // Nur in Expand/Collaps-Hdl gueltig, mal umstellen 635 sal_Bool bFirstParaIsEmpty; 636 sal_Bool bBlockInsCallback; 637 sal_Bool bStrippingPortions; 638 sal_Bool bPasting; 639 640 sal_uLong nDummy; 641 642 #ifdef _OUTLINER_CXX 643 644 DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* ); 645 DECL_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo* ); 646 DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* ); 647 DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* ); 648 DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* ); 649 DECL_LINK( EditEngineNotifyHdl, EENotify* ); 650 void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd ); 651 sal_Bool ImplHasBullet( sal_uInt16 nPara ) const; 652 Size ImplGetBulletSize( sal_uInt16 nPara ); 653 sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt ); 654 void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChilds ); 655 String ImplGetBulletText( sal_uInt16 nPara ); 656 void ImplCheckNumBulletItem( sal_uInt16 nPara ); 657 void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False ); 658 void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL ); 659 660 void ImplBlockInsertionCallbacks( sal_Bool b ); 661 662 void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle ); 663 void ImpRecalcBulletIndent( sal_uLong nPara ); 664 665 const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& ); 666 void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara ); 667 bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 ); 668 669 void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ); 670 long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet ); 671 Font ImpCalcBulletFont( sal_uInt16 nPara ) const; 672 Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos ); 673 long ImpGetTextIndent( sal_uLong nPara ); 674 sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView ); 675 sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView ); 676 sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages ); 677 678 sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } 679 void ImplCheckDepth( sal_Int16& rnDepth ) const; 680 #endif 681 682 protected: 683 void ParagraphInserted( sal_uInt16 nParagraph ); 684 void ParagraphDeleted( sal_uInt16 nParagraph ); 685 void ParaAttribsChanged( sal_uInt16 nParagraph ); 686 687 virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); 688 689 void InvalidateBullet( Paragraph* pPara, sal_uLong nPara ); 690 void PaintBullet( sal_uInt16 nPara, const Point& rStartPos, 691 const Point& rOrigin, short nOrientation, 692 OutputDevice* pOutDev ); 693 694 // used by OutlinerEditEng. Allows Outliner objects to provide 695 // bullet access to the EditEngine. 696 virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const; 697 698 public: 699 700 Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode ); 701 virtual ~Outliner(); 702 703 void Init( sal_uInt16 nOutlinerMode ); 704 sal_uInt16 GetMode() const { return nOutlinerMode; } 705 706 void SetVertical( sal_Bool bVertical ); 707 sal_Bool IsVertical() const; 708 709 void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); 710 sal_Bool IsFixedCellHeight() const; 711 712 void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); 713 EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; 714 715 sal_uInt16 GetScriptType( const ESelection& rSelection ) const; 716 LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const; 717 718 void SetAsianCompressionMode( sal_uInt16 nCompressionMode ); 719 sal_uInt16 GetAsianCompressionMode() const; 720 721 void SetKernAsianPunctuation( sal_Bool bEnabled ); 722 sal_Bool IsKernAsianPunctuation() const; 723 724 void SetAddExtLeading( sal_Bool b ); 725 sal_Bool IsAddExtLeading() const; 726 727 sal_uLong InsertView( OutlinerView* pView, sal_uLong nIndex=LIST_APPEND); 728 OutlinerView* RemoveView( OutlinerView* pView ); 729 OutlinerView* RemoveView( sal_uLong nIndex ); 730 OutlinerView* GetView( sal_uLong nIndex ) const; 731 sal_uLong GetViewCount() const; 732 733 Paragraph* Insert( const String& rText, sal_uLong nAbsPos = LIST_APPEND, sal_Int16 nDepth = 0 ); 734 void SetText( const OutlinerParaObject& ); 735 void AddText( const OutlinerParaObject& ); 736 void SetText( const String& rText, Paragraph* pParagraph ); 737 String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const; 738 739 OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const; 740 741 const SfxItemSet& GetEmptyItemSet() const; 742 743 void SetRefMapMode( const MapMode& ); 744 MapMode GetRefMapMode() const; 745 746 void SetBackgroundColor( const Color& rColor ); 747 Color GetBackgroundColor() const; 748 749 sal_Int16 GetMinDepth() const { return -1; } 750 751 void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False ); 752 sal_Int16 GetMaxDepth() const { return nMaxDepth; } 753 754 void SetUpdateMode( sal_Bool bUpdate ); 755 sal_Bool GetUpdateMode() const; 756 757 void Clear(); 758 759 void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); 760 761 sal_uLong GetParagraphCount() const; 762 Paragraph* GetParagraph( sal_uLong nAbsPos ) const; 763 764 sal_Bool HasParent( Paragraph* pParagraph ) const; 765 sal_Bool HasChilds( Paragraph* pParagraph ) const; 766 sal_uLong GetChildCount( Paragraph* pParent ) const; 767 sal_Bool IsExpanded( Paragraph* pPara ) const; 768 // Paragraph* GetParagraph( Paragraph* pParent, sal_uLong nRelPos ) const; 769 Paragraph* GetParent( Paragraph* pParagraph ) const; 770 // sal_uLong GetRelPos( Paragraph* pParent, Paragraph* pPara ) const; 771 sal_uLong GetAbsPos( Paragraph* pPara ); 772 773 sal_Int16 GetDepth( sal_uLong nPara ) const; 774 void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth ); 775 776 void SetVisible( Paragraph* pPara, sal_Bool bVisible ); 777 sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); } 778 779 void EnableUndo( sal_Bool bEnable ); 780 sal_Bool IsUndoEnabled() const; 781 void UndoActionStart( sal_uInt16 nId ); 782 void UndoActionEnd( sal_uInt16 nId ); 783 void InsertUndo( EditUndo* pUndo ); 784 sal_Bool IsInUndo(); 785 786 void ClearModifyFlag(); 787 sal_Bool IsModified() const; 788 789 Paragraph* GetHdlParagraph() const { return pHdlParagraph; } 790 sal_Bool IsExpanding() const { return bIsExpanding; } 791 792 virtual void ExpandHdl(); 793 void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; } 794 Link GetExpandHdl() const { return aExpandHdl; } 795 796 virtual void ParagraphInsertedHdl(); 797 void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;} 798 Link GetParaInsertedHdl() const { return aParaInsertedHdl; } 799 800 virtual void ParagraphRemovingHdl(); 801 void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;} 802 Link GetParaRemovingHdl() const { return aParaRemovingHdl; } 803 804 virtual void DepthChangedHdl(); 805 void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;} 806 Link GetDepthChangedHdl() const { return aDepthChangedHdl; } 807 sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; } 808 sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } 809 810 virtual long RemovingPagesHdl( OutlinerView* ); 811 void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;} 812 Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; } 813 virtual long IndentingPagesHdl( OutlinerView* ); 814 void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;} 815 Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; } 816 // nur gueltig in den beiden oberen Handlern 817 sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } 818 // nur gueltig in den beiden oberen Handlern 819 sal_uLong GetFirstSelPage() const { return mnFirstSelPage; } 820 821 void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; } 822 Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; } 823 824 void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; } 825 Link GetFieldClickedHdl() const { return aFieldClickedHdl; } 826 827 void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;} 828 Link GetDrawPortionHdl() const { return aDrawPortionHdl; } 829 830 void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;} 831 Link GetDrawBulletHdl() const { return aDrawBulletHdl; } 832 833 void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; } 834 Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; } 835 836 void SetModifyHdl( const Link& rLink ); 837 Link GetModifyHdl() const; 838 839 void SetNotifyHdl( const Link& rLink ); 840 Link GetNotifyHdl() const; 841 842 void SetStatusEventHdl( const Link& rLink ); 843 Link GetStatusEventHdl() const; 844 845 void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect ); 846 void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos ); 847 void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); 848 849 const Size& GetPaperSize() const; 850 void SetPaperSize( const Size& rSize ); 851 852 void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; } 853 sal_uInt16 GetFirstPageNumber() const { return nFirstPage; } 854 855 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ); 856 void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); 857 void ClearPolygon(); 858 const PolyPolygon* GetPolygon(); 859 860 const Size& GetMinAutoPaperSize() const; 861 void SetMinAutoPaperSize( const Size& rSz ); 862 863 const Size& GetMaxAutoPaperSize() const; 864 void SetMaxAutoPaperSize( const Size& rSz ); 865 866 void SetDefTab( sal_uInt16 nTab ); 867 sal_uInt16 GetDefTab() const; 868 869 sal_Bool IsFlatMode() const; 870 void SetFlatMode( sal_Bool bFlat ); 871 872 void EnableAutoColor( sal_Bool b ); 873 sal_Bool IsAutoColorEnabled() const; 874 875 void ForceAutoColor( sal_Bool b ); 876 sal_Bool IsForceAutoColor() const; 877 878 EBulletInfo GetBulletInfo( sal_uInt16 nPara ); 879 880 void SetWordDelimiters( const String& rDelimiters ); 881 String GetWordDelimiters() const; 882 String GetWord( sal_uInt16 nPara, xub_StrLen nIndex ); 883 884 void StripPortions(); 885 886 // #101498# 887 virtual void DrawingText( 888 const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, 889 const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, 890 const EEngineData::WrongSpellVector* pWrongSpellVector, 891 const SvxFieldData* pFieldData, 892 bool bEndOfLine, 893 bool bEndOfParagraph, 894 bool bEndOfBullet, 895 const ::com::sun::star::lang::Locale* pLocale, 896 const Color& rOverlineColor, 897 const Color& rTextLineColor); 898 899 Size CalcTextSize(); 900 901 Point GetDocPos( Paragraph* pPara ); 902 903 void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); 904 SfxStyleSheetPool* GetStyleSheetPool(); 905 906 sal_Bool IsInSelectionMode() const; 907 908 void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle ); 909 SfxStyleSheet* GetStyleSheet( sal_uLong nPara ); 910 911 void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& ); 912 SfxItemSet GetParaAttribs( sal_uInt16 nPara ); 913 914 void Remove( Paragraph* pPara, sal_uLong nParaCount ); 915 sal_Bool Expand( Paragraph* ); 916 sal_Bool Collapse( Paragraph* ); 917 918 void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); 919 void RemoveParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); 920 bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const; 921 922 // gibt ein Array mit den Bulletbreiten der n Einrueckebenen 923 // zurueck. Letzter Wert muss -1 sein. Wird vom Outliner geloescht. 924 Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; } 925 void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; } 926 927 void SetControlWord( sal_uLong nWord ); 928 sal_uLong GetControlWord() const; 929 930 Link GetBeginMovingHdl() const { return aBeginMovingHdl; } 931 void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;} 932 Link GetEndMovingHdl() const {return aEndMovingHdl;} 933 void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;} 934 935 sal_uLong GetLineCount( sal_uLong nParagraph ) const; 936 sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; 937 sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 ); 938 939 // nFormat muss ein Wert aus dem enum EETextFormat sein (wg.CLOOKS) 940 sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); 941 942 ::svl::IUndoManager& GetUndoManager(); 943 ::svl::IUndoManager* SetUndoManager(::svl::IUndoManager* pNew); 944 945 void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); 946 void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); 947 void QuickInsertLineBreak( const ESelection& rSel ); 948 949 // nur fuer EditEngine-Modus 950 void QuickInsertText( const String& rText, const ESelection& rSel ); 951 void QuickDelete( const ESelection& rSel ); 952 void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); 953 void QuickFormatDoc( sal_Bool bFull = sal_False ); 954 955 sal_Bool UpdateFields(); 956 void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL ); 957 958 virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); 959 virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); 960 virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); 961 962 void SetSpeller( ::com::sun::star::uno::Reference< 963 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller ); 964 ::com::sun::star::uno::Reference< 965 ::com::sun::star::linguistic2::XSpellChecker1 > 966 GetSpeller(); 967 ::com::sun::star::uno::Reference< 968 ::com::sun::star::linguistic2::XHyphenator > 969 GetHyphenator() const; 970 void SetHyphenator( ::com::sun::star::uno::Reference< 971 ::com::sun::star::linguistic2::XHyphenator >& xHyph ); 972 973 void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ); 974 vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const; 975 976 // Depricated 977 void SetDefaultLanguage( LanguageType eLang ); 978 LanguageType GetDefaultLanguage() const; 979 980 sal_Bool HasOnlineSpellErrors() const; 981 void CompleteOnlineSpelling(); 982 983 EESpellState HasSpellErrors(); 984 sal_Bool HasText( const SvxSearchItem& rSearchItem ); 985 virtual sal_Bool SpellNextDocument(); 986 987 // for text conversion 988 sal_Bool HasConvertibleTextPortion( LanguageType nLang ); 989 virtual sal_Bool ConvertNextDocument(); 990 991 void SetEditTextObjectPool( SfxItemPool* pPool ); 992 SfxItemPool* GetEditTextObjectPool() const; 993 994 void SetRefDevice( OutputDevice* pRefDev ); 995 OutputDevice* GetRefDevice() const; 996 997 sal_uInt16 GetFirstLineOffset( sal_uLong nParagraph ); 998 999 sal_uLong GetTextHeight() const; 1000 sal_uLong GetTextHeight( sal_uLong nParagraph ) const; 1001 Point GetDocPosTopLeft( sal_uLong nParagraph ); 1002 Point GetDocPos( const Point& rPaperPos ) const; 1003 sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 ); 1004 sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos ); 1005 1006 void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); 1007 void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ); 1008 void DoStretchChars( sal_uInt16 nX, sal_uInt16 nY ); 1009 void EraseVirtualDevice(); 1010 1011 void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ); 1012 sal_uInt16 GetBigTextObjectStart() const; 1013 sal_Bool ShouldCreateBigTextObject() const; 1014 1015 const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); } 1016 1017 // this is needed for StarOffice Api 1018 void SetLevelDependendStyleSheet( sal_uInt16 nPara ); 1019 1020 sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } 1021 1022 void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc); 1023 //spell and return a sentence 1024 bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ); 1025 // put spell position to start of current sentence 1026 void PutSpellingToSentenceStart( EditView& rEditView ); 1027 //applies a changed sentence 1028 void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ); 1029 void EndSpelling(); 1030 1031 /** sets a link that is called at the beginning of a drag operation at an edit view */ 1032 void SetBeginDropHdl( const Link& rLink ); 1033 Link GetBeginDropHdl() const; 1034 1035 /** sets a link that is called at the end of a drag operation at an edit view */ 1036 void SetEndDropHdl( const Link& rLink ); 1037 Link GetEndDropHdl() const; 1038 1039 /** sets a link that is called before a drop or paste operation. */ 1040 void SetBeginPasteOrDropHdl( const Link& rLink ); 1041 Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; } 1042 1043 /** sets a link that is called after a drop or paste operation. */ 1044 void SetEndPasteOrDropHdl( const Link& rLink ); 1045 Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; } 1046 1047 virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); 1048 virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); 1049 1050 virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara ); 1051 virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart ); 1052 }; 1053 1054 #endif 1055 1056