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 28 29 #ifndef NODE_HXX 30 #define NODE_HXX 31 32 33 #include <vector> 34 35 #include "parse.hxx" 36 #include "types.hxx" 37 #include "rect.hxx" 38 #include "format.hxx" 39 40 41 #define ATTR_BOLD 0x0001 42 #define ATTR_ITALIC 0x0002 43 44 #define FNTSIZ_ABSOLUT 1 45 #define FNTSIZ_PLUS 2 46 #define FNTSIZ_MINUS 3 47 #define FNTSIZ_MULTIPLY 4 48 #define FNTSIZ_DIVIDE 5 49 50 // flags to interdict respective status changes 51 #define FLG_FONT 0x0001 52 #define FLG_SIZE 0x0002 53 #define FLG_BOLD 0x0004 54 #define FLG_ITALIC 0x0008 55 #define FLG_COLOR 0x0010 56 #define FLG_VISIBLE 0x0020 57 #define FLG_HORALIGN 0x0040 58 59 60 extern SmFormat *pActiveFormat; 61 62 class SmDocShell; 63 class SmNode; 64 class SmStructureNode; 65 66 typedef std::vector< SmNode * > SmNodeArray; 67 typedef std::vector< SmStructureNode * > SmStructureNodeArray; 68 69 70 //////////////////////////////////////////////////////////////////////////////// 71 72 enum SmScaleMode { SCALE_NONE, SCALE_WIDTH, SCALE_HEIGHT }; 73 74 enum SmNodeType 75 { 76 NTABLE, NBRACE, NBRACEBODY, NOPER, NALIGN, 77 NATTRIBUT, NFONT, NUNHOR, NBINHOR, NBINVER, 78 NBINDIAGONAL, NSUBSUP, NMATRIX, NPLACE, NTEXT, 79 NSPECIAL, NGLYPH_SPECIAL, NMATH, NBLANK, NERROR, 80 NLINE, NEXPRESSION, NPOLYLINE, NROOT, NROOTSYMBOL, 81 NRECTANGLE, NVERTICAL_BRACE 82 }; 83 84 85 //////////////////////////////////////////////////////////////////////////////// 86 87 88 class SmNode : public SmRect 89 { 90 SmFace aFace; 91 92 SmToken aNodeToken; 93 SmNodeType eType; 94 SmScaleMode eScaleMode; 95 RectHorAlign eRectHorAlign; 96 sal_uInt16 nFlags, 97 nAttributes; 98 sal_Bool bIsPhantom, 99 bIsDebug; 100 protected: 101 SmNode(SmNodeType eNodeType, const SmToken &rNodeToken); 102 103 // index in accessible text -1 if not (yet) applicable 104 sal_Int32 nAccIndex; 105 106 public: 107 virtual ~SmNode(); 108 109 virtual sal_Bool IsVisible() const; 110 111 virtual sal_uInt16 GetNumSubNodes() const; 112 virtual SmNode * GetSubNode(sal_uInt16 nIndex); 113 const SmNode * GetSubNode(sal_uInt16 nIndex) const 114 { 115 return ((SmNode *) this)->GetSubNode(nIndex); 116 } 117 118 virtual SmNode * GetLeftMost(); 119 const SmNode * GetLeftMost() const 120 { 121 return ((SmNode *) this)->GetLeftMost(); 122 } 123 124 sal_uInt16 & Flags() { return nFlags; } 125 sal_uInt16 & Attributes() { return nAttributes; } 126 127 sal_Bool IsDebug() const { return bIsDebug; } 128 sal_Bool IsPhantom() const { return bIsPhantom; } 129 void SetPhantom(sal_Bool bIsPhantom); 130 void SetColor(const Color &rColor); 131 132 void SetAttribut(sal_uInt16 nAttrib); 133 void ClearAttribut(sal_uInt16 nAttrib); 134 135 const SmFace & GetFont() const { return aFace; }; 136 SmFace & GetFont() { return aFace; }; 137 138 void SetFont(const SmFace &rFace); 139 void SetFontSize(const Fraction &rRelSize, sal_uInt16 nType); 140 void SetSize(const Fraction &rScale); 141 142 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 143 virtual void PrepareAttributes(); 144 145 #if OSL_DEBUG_LEVEL 146 void ToggleDebug() const; 147 #endif 148 149 void SetRectHorAlign(RectHorAlign eHorAlign, sal_Bool bApplyToSubTree = sal_True ); 150 RectHorAlign GetRectHorAlign() const { return eRectHorAlign; } 151 152 const SmRect & GetRect() const { return *this; } 153 SmRect & GetRect() { return *this; } 154 155 virtual void Move(const Point &rPosition); 156 void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); } 157 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 158 virtual void CreateTextFromNode(String &rText); 159 160 #ifdef SM_RECT_DEBUG 161 using SmRect::Draw; 162 #endif 163 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 164 165 virtual void GetAccessibleText( String &rText ) const; 166 sal_Int32 GetAccessibleIndex() const { return nAccIndex; } 167 const SmNode * FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const; 168 169 sal_uInt16 GetRow() const { return (sal_uInt16)aNodeToken.nRow; } 170 sal_uInt16 GetColumn() const { return (sal_uInt16)aNodeToken.nCol; } 171 172 SmScaleMode GetScaleMode() const { return eScaleMode; } 173 void SetScaleMode(SmScaleMode eMode) { eScaleMode = eMode; } 174 175 virtual void AdaptToX(const OutputDevice &rDev, sal_uLong nWidth); 176 virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight); 177 178 SmNodeType GetType() const { return eType; } 179 const SmToken & GetToken() const { return aNodeToken; } 180 181 const SmNode * FindTokenAt(sal_uInt16 nRow, sal_uInt16 nCol) const; 182 const SmNode * FindRectClosestTo(const Point &rPoint) const; 183 184 // --> 4.7.2010 #i972# 185 virtual long GetFormulaBaseline() const; 186 // <-- 187 }; 188 189 190 //////////////////////////////////////////////////////////////////////////////// 191 192 193 class SmStructureNode : public SmNode 194 { 195 SmNodeArray aSubNodes; 196 197 protected: 198 SmStructureNode(SmNodeType eNodeType, const SmToken &rNodeToken) 199 : SmNode(eNodeType, rNodeToken) 200 {} 201 202 public: 203 SmStructureNode( const SmStructureNode &rNode ); 204 virtual ~SmStructureNode(); 205 206 virtual sal_Bool IsVisible() const; 207 208 virtual sal_uInt16 GetNumSubNodes() const; 209 void SetNumSubNodes(sal_uInt16 nSize) { aSubNodes.resize(nSize); } 210 211 using SmNode::GetSubNode; 212 virtual SmNode * GetSubNode(sal_uInt16 nIndex); 213 void SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird = NULL); 214 void SetSubNodes(const SmNodeArray &rNodeArray); 215 216 virtual SmStructureNode & operator = ( const SmStructureNode &rNode ); 217 218 virtual void GetAccessibleText( String &rText ) const; 219 }; 220 221 222 //////////////////////////////////////////////////////////////////////////////// 223 224 225 class SmVisibleNode : public SmNode 226 { 227 protected: 228 SmVisibleNode(SmNodeType eNodeType, const SmToken &rNodeToken) 229 : SmNode(eNodeType, rNodeToken) 230 {} 231 232 public: 233 234 virtual sal_Bool IsVisible() const; 235 virtual sal_uInt16 GetNumSubNodes() const; 236 using SmNode::GetSubNode; 237 virtual SmNode * GetSubNode(sal_uInt16 nIndex); 238 }; 239 240 241 //////////////////////////////////////////////////////////////////////////////// 242 243 244 class SmGraphicNode : public SmVisibleNode 245 { 246 protected: 247 SmGraphicNode(SmNodeType eNodeType, const SmToken &rNodeToken) 248 : SmVisibleNode(eNodeType, rNodeToken) 249 {} 250 251 public: 252 253 virtual void GetAccessibleText( String &rText ) const; 254 }; 255 256 257 //////////////////////////////////////////////////////////////////////////////// 258 259 260 class SmRectangleNode : public SmGraphicNode 261 { 262 Size aToSize; 263 264 public: 265 SmRectangleNode(const SmToken &rNodeToken) 266 : SmGraphicNode(NRECTANGLE, rNodeToken) 267 {} 268 269 virtual void AdaptToX(const OutputDevice &rDev, sal_uLong nWidth); 270 virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight); 271 272 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 273 274 #ifdef SM_RECT_DEBUG 275 using SmRect::Draw; 276 #endif 277 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 278 279 void CreateTextFromNode(String &rText); 280 }; 281 282 283 //////////////////////////////////////////////////////////////////////////////// 284 285 286 class SmPolyLineNode : public SmGraphicNode 287 { 288 Polygon aPoly; 289 Size aToSize; 290 long nWidth; 291 292 public: 293 SmPolyLineNode(const SmToken &rNodeToken); 294 295 long GetWidth() const { return nWidth; } 296 297 virtual void AdaptToX(const OutputDevice &rDev, sal_uLong nWidth); 298 virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight); 299 300 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 301 302 #ifdef SM_RECT_DEBUG 303 using SmRect::Draw; 304 #endif 305 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 306 }; 307 308 309 //////////////////////////////////////////////////////////////////////////////// 310 311 312 class SmTextNode : public SmVisibleNode 313 { 314 XubString aText; 315 sal_uInt16 nFontDesc; 316 317 protected: 318 SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, sal_uInt16 nFontDescP ); 319 320 public: 321 SmTextNode(const SmToken &rNodeToken, sal_uInt16 nFontDescP ); 322 323 sal_uInt16 GetFontDesc() const { return nFontDesc; } 324 void SetText(const XubString &rText) { aText = rText; } 325 const XubString & GetText() const { return aText; } 326 327 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 328 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 329 virtual void CreateTextFromNode(String &rText); 330 331 #ifdef SM_RECT_DEBUG 332 using SmRect::Draw; 333 #endif 334 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 335 336 virtual void GetAccessibleText( String &rText ) const; 337 }; 338 339 340 //////////////////////////////////////////////////////////////////////////////// 341 342 343 class SmSpecialNode : public SmTextNode 344 { 345 bool bIsFromGreekSymbolSet; 346 347 protected: 348 SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, sal_uInt16 _nFontDesc); 349 350 public: 351 SmSpecialNode(const SmToken &rNodeToken); 352 353 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 354 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 355 356 #ifdef SM_RECT_DEBUG 357 using SmRect::Draw; 358 #endif 359 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 360 }; 361 362 363 //////////////////////////////////////////////////////////////////////////////// 364 365 366 class SmGlyphSpecialNode : public SmSpecialNode 367 { 368 public: 369 SmGlyphSpecialNode(const SmToken &rNodeToken) 370 : SmSpecialNode(NGLYPH_SPECIAL, rNodeToken, FNT_MATH) 371 {} 372 373 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 374 }; 375 376 377 //////////////////////////////////////////////////////////////////////////////// 378 379 380 class SmMathSymbolNode : public SmSpecialNode 381 { 382 protected: 383 SmMathSymbolNode(SmNodeType eNodeType, const SmToken &rNodeToken) 384 : SmSpecialNode(eNodeType, rNodeToken, FNT_MATH) 385 { 386 xub_Unicode cChar = GetToken().cMathChar; 387 if ((xub_Unicode) '\0' != cChar) 388 SetText( cChar ); 389 } 390 391 public: 392 SmMathSymbolNode(const SmToken &rNodeToken); 393 394 virtual void AdaptToX(const OutputDevice &rDev, sal_uLong nWidth); 395 virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight); 396 397 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 398 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 399 void CreateTextFromNode(String &rText); 400 }; 401 402 403 //////////////////////////////////////////////////////////////////////////////// 404 405 406 class SmRootSymbolNode : public SmMathSymbolNode 407 { 408 sal_uLong nBodyWidth; // width of body (argument) of root sign 409 410 public: 411 SmRootSymbolNode(const SmToken &rNodeToken) 412 : SmMathSymbolNode(NROOTSYMBOL, rNodeToken) 413 {} 414 415 virtual void AdaptToX(const OutputDevice &rDev, sal_uLong nWidth); 416 virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight); 417 418 #ifdef SM_RECT_DEBUG 419 using SmRect::Draw; 420 #endif 421 virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; 422 }; 423 424 425 //////////////////////////////////////////////////////////////////////////////// 426 427 428 class SmPlaceNode : public SmMathSymbolNode 429 { 430 public: 431 SmPlaceNode(const SmToken &rNodeToken) 432 : SmMathSymbolNode(NPLACE, rNodeToken) 433 { 434 } 435 436 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 437 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 438 }; 439 440 441 //////////////////////////////////////////////////////////////////////////////// 442 443 444 class SmErrorNode : public SmMathSymbolNode 445 { 446 public: 447 SmErrorNode(SmParseError /*eError*/, const SmToken &rNodeToken) 448 : SmMathSymbolNode(NERROR, rNodeToken) 449 { 450 SetText((xub_Unicode) MS_ERROR); 451 } 452 453 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 454 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 455 }; 456 457 458 //////////////////////////////////////////////////////////////////////////////// 459 460 461 class SmTableNode : public SmStructureNode 462 { 463 // --> 4.7.2010 #i972# 464 long nFormulaBaseline; 465 // <-- 466 public: 467 SmTableNode(const SmToken &rNodeToken) 468 : SmStructureNode(NTABLE, rNodeToken) 469 {} 470 471 using SmNode::GetLeftMost; 472 virtual SmNode * GetLeftMost(); 473 474 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 475 virtual long GetFormulaBaseline() const; 476 }; 477 478 479 //////////////////////////////////////////////////////////////////////////////// 480 481 482 class SmLineNode : public SmStructureNode 483 { 484 sal_Bool bUseExtraSpaces; 485 486 protected: 487 SmLineNode(SmNodeType eNodeType, const SmToken &rNodeToken) 488 : SmStructureNode(eNodeType, rNodeToken) 489 { 490 bUseExtraSpaces = sal_True; 491 } 492 493 public: 494 SmLineNode(const SmToken &rNodeToken) 495 : SmStructureNode(NLINE, rNodeToken) 496 { 497 bUseExtraSpaces = sal_True; 498 } 499 500 void SetUseExtraSpaces(sal_Bool bVal) { bUseExtraSpaces = bVal; } 501 sal_Bool IsUseExtraSpaces() const { return bUseExtraSpaces; }; 502 503 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 504 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 505 }; 506 507 508 //////////////////////////////////////////////////////////////////////////////// 509 510 511 class SmExpressionNode : public SmLineNode 512 { 513 public: 514 SmExpressionNode(const SmToken &rNodeToken) 515 : SmLineNode(NEXPRESSION, rNodeToken) 516 {} 517 518 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 519 void CreateTextFromNode(String &rText); 520 }; 521 522 523 //////////////////////////////////////////////////////////////////////////////// 524 525 526 class SmUnHorNode : public SmStructureNode 527 { 528 public: 529 SmUnHorNode(const SmToken &rNodeToken) 530 : SmStructureNode(NUNHOR, rNodeToken) 531 { 532 SetNumSubNodes(2); 533 } 534 535 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 536 }; 537 538 539 //////////////////////////////////////////////////////////////////////////////// 540 541 542 class SmRootNode : public SmStructureNode 543 { 544 protected: 545 void GetHeightVerOffset(const SmRect &rRect, 546 long &rHeight, long &rVerOffset) const; 547 Point GetExtraPos(const SmRect &rRootSymbol, const SmRect &rExtra) const; 548 549 public: 550 SmRootNode(const SmToken &rNodeToken) 551 : SmStructureNode(NROOT, rNodeToken) 552 { 553 SetNumSubNodes(3); 554 } 555 556 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 557 void CreateTextFromNode(String &rText); 558 }; 559 560 561 //////////////////////////////////////////////////////////////////////////////// 562 563 564 class SmBinHorNode : public SmStructureNode 565 { 566 public: 567 SmBinHorNode(const SmToken &rNodeToken) 568 : SmStructureNode(NBINHOR, rNodeToken) 569 { 570 SetNumSubNodes(3); 571 } 572 573 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 574 }; 575 576 577 //////////////////////////////////////////////////////////////////////////////// 578 579 580 class SmBinVerNode : public SmStructureNode 581 { 582 public: 583 SmBinVerNode(const SmToken &rNodeToken) 584 : SmStructureNode(NBINVER, rNodeToken) 585 { 586 SetNumSubNodes(3); 587 } 588 589 using SmNode::GetLeftMost; 590 virtual SmNode * GetLeftMost(); 591 592 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 593 void CreateTextFromNode(String &rText); 594 }; 595 596 597 //////////////////////////////////////////////////////////////////////////////// 598 599 600 class SmBinDiagonalNode : public SmStructureNode 601 { 602 sal_Bool bAscending; 603 604 void GetOperPosSize(Point &rPos, Size &rSize, 605 const Point &rDiagPoint, double fAngleDeg) const; 606 607 public: 608 SmBinDiagonalNode(const SmToken &rNodeToken); 609 610 sal_Bool IsAscending() const { return bAscending; } 611 void SetAscending(sal_Bool bVal) { bAscending = bVal; } 612 613 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 614 }; 615 616 617 //////////////////////////////////////////////////////////////////////////////// 618 619 620 // enums used to index sub-/supscripts in the 'aSubNodes' array 621 // in 'SmSubSupNode' 622 // See graphic for positions at char: 623 // 624 // CSUP 625 // 626 // LSUP H H RSUP 627 // H H 628 // HHHH 629 // H H 630 // LSUB H H RSUB 631 // 632 // CSUB 633 // 634 enum SmSubSup 635 { CSUB, CSUP, RSUB, RSUP, LSUB, LSUP 636 }; 637 638 // numbers of entries in the above enum (that is: the number of possible 639 // sub-/supscripts) 640 #define SUBSUP_NUM_ENTRIES 6 641 642 643 class SmSubSupNode : public SmStructureNode 644 { 645 sal_Bool bUseLimits; 646 647 public: 648 SmSubSupNode(const SmToken &rNodeToken) 649 : SmStructureNode(NSUBSUP, rNodeToken) 650 { 651 SetNumSubNodes(1 + SUBSUP_NUM_ENTRIES); 652 bUseLimits = sal_False; 653 } 654 655 SmNode * GetBody() { return GetSubNode(0); } 656 const SmNode * GetBody() const 657 { 658 return ((SmSubSupNode *) this)->GetBody(); 659 } 660 661 void SetUseLimits(sal_Bool bVal) { bUseLimits = bVal; } 662 sal_Bool IsUseLimits() const { return bUseLimits; }; 663 664 SmNode * GetSubSup(SmSubSup eSubSup) { return GetSubNode( sal::static_int_cast< sal_uInt16 >(1 + eSubSup) ); }; 665 666 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 667 void CreateTextFromNode(String &rText); 668 669 }; 670 671 672 //////////////////////////////////////////////////////////////////////////////// 673 674 675 class SmBraceNode : public SmStructureNode 676 { 677 public: 678 SmBraceNode(const SmToken &rNodeToken) 679 : SmStructureNode(NBRACE, rNodeToken) 680 { 681 SetNumSubNodes(3); 682 } 683 684 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 685 void CreateTextFromNode(String &rText); 686 }; 687 688 689 //////////////////////////////////////////////////////////////////////////////// 690 691 692 class SmBracebodyNode : public SmStructureNode 693 { 694 long nBodyHeight; 695 696 public: 697 inline SmBracebodyNode(const SmToken &rNodeToken); 698 699 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 700 long GetBodyHeight() const { return nBodyHeight; } 701 }; 702 703 704 inline SmBracebodyNode::SmBracebodyNode(const SmToken &rNodeToken) : 705 SmStructureNode(NBRACEBODY, rNodeToken) 706 { 707 nBodyHeight = 0; 708 } 709 710 711 //////////////////////////////////////////////////////////////////////////////// 712 713 714 class SmVerticalBraceNode : public SmStructureNode 715 { 716 public: 717 inline SmVerticalBraceNode(const SmToken &rNodeToken); 718 719 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 720 }; 721 722 723 inline SmVerticalBraceNode::SmVerticalBraceNode(const SmToken &rNodeToken) : 724 SmStructureNode(NVERTICAL_BRACE, rNodeToken) 725 { 726 SetNumSubNodes(3); 727 } 728 729 730 //////////////////////////////////////////////////////////////////////////////// 731 732 733 class SmOperNode : public SmStructureNode 734 { 735 public: 736 SmOperNode(const SmToken &rNodeToken) 737 : SmStructureNode(NOPER, rNodeToken) 738 { 739 SetNumSubNodes(2); 740 } 741 742 SmNode * GetSymbol(); 743 const SmNode * GetSymbol() const 744 { 745 return ((SmOperNode *) this)->GetSymbol(); 746 } 747 748 long CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const; 749 750 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 751 }; 752 753 754 //////////////////////////////////////////////////////////////////////////////// 755 756 757 class SmAlignNode : public SmStructureNode 758 { 759 public: 760 SmAlignNode(const SmToken &rNodeToken) 761 : SmStructureNode(NALIGN, rNodeToken) 762 {} 763 764 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 765 }; 766 767 768 //////////////////////////////////////////////////////////////////////////////// 769 770 771 class SmAttributNode : public SmStructureNode 772 { 773 public: 774 SmAttributNode(const SmToken &rNodeToken) 775 : SmStructureNode(NATTRIBUT, rNodeToken) 776 {} 777 778 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 779 void CreateTextFromNode(String &rText); 780 }; 781 782 783 //////////////////////////////////////////////////////////////////////////////// 784 785 786 class SmFontNode : public SmStructureNode 787 { 788 sal_uInt16 nSizeType; 789 Fraction aFontSize; 790 791 public: 792 SmFontNode(const SmToken &rNodeToken) 793 : SmStructureNode(NFONT, rNodeToken) 794 { 795 nSizeType = FNTSIZ_MULTIPLY; 796 aFontSize = Fraction(1L); 797 } 798 799 void SetSizeParameter(const Fraction &rValue, sal_uInt16 nType); 800 const Fraction & GetSizeParameter() const {return aFontSize;} 801 const sal_uInt16& GetSizeType() const {return nSizeType;} 802 803 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 804 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 805 void CreateTextFromNode(String &rText); 806 }; 807 808 809 //////////////////////////////////////////////////////////////////////////////// 810 811 812 class SmMatrixNode : public SmStructureNode 813 { 814 sal_uInt16 nNumRows, 815 nNumCols; 816 817 public: 818 SmMatrixNode(const SmToken &rNodeToken) 819 : SmStructureNode(NMATRIX, rNodeToken) 820 { 821 nNumRows = nNumCols = 0; 822 } 823 824 sal_uInt16 GetNumRows() const {return nNumRows;} 825 sal_uInt16 GetNumCols() const {return nNumCols;} 826 void SetRowCol(sal_uInt16 nMatrixRows, sal_uInt16 nMatrixCols); 827 828 using SmNode::GetLeftMost; 829 virtual SmNode * GetLeftMost(); 830 831 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 832 void CreateTextFromNode(String &rText); 833 }; 834 835 836 //////////////////////////////////////////////////////////////////////////////// 837 838 839 class SmBlankNode : public SmGraphicNode 840 { 841 sal_uInt16 nNum; 842 843 public: 844 SmBlankNode(const SmToken &rNodeToken) 845 : SmGraphicNode(NBLANK, rNodeToken) 846 { 847 nNum = 0; 848 } 849 850 void IncreaseBy(const SmToken &rToken); 851 void Clear() { nNum = 0; } 852 853 virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); 854 virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); 855 }; 856 857 858 //////////////////////////////////////////////////////////////////////////////// 859 860 #endif 861 862 863