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