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