Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.1 KiB

  1. #ifndef DNINFO_DEFINED
  2. #define DNINFO_DEFINED
  3. #include "lsdnode.h"
  4. #include "lssubl.h"
  5. /* MACROS --------------------------------------------------------------------------*/
  6. #define IdObjFromDnode(p) (Assert((p)->klsdn == klsdnReal), (p)->u.real.lschp.idObj)
  7. #define PdobjFromDnode(p) (Assert((p)->klsdn == klsdnReal), (p)->u.real.pdobj)
  8. #define DupFromRealDnode(p) ((Assert((p)->klsdn == klsdnReal), \
  9. (p)->u.real.dup ))
  10. #define DurFromRealDnode(p) ((Assert((p)->klsdn == klsdnReal), \
  11. (p)->u.real.objdim.dur ))
  12. #define DvrFromRealDnode(p) (Assert((p)->klsdn == klsdnReal), \
  13. 0)
  14. #define DvpFromRealDnode(p) (Assert((p)->klsdn == klsdnReal), \
  15. 0)
  16. #define DupFromDnode(p) (((p)->klsdn == klsdnReal) ? \
  17. DupFromRealDnode(p) : \
  18. (Assert((p)->klsdn == klsdnPenBorder), (p)->u.pen.dup))
  19. #define DurFromDnode(p) (((p)->klsdn == klsdnReal) ? \
  20. DurFromRealDnode(p) : \
  21. (Assert((p)->klsdn == klsdnPenBorder), (p)->u.pen.dur))
  22. #define DvrFromDnode(p) (((p)->klsdn == klsdnReal) ? \
  23. DvrFromRealDnode(p) : \
  24. (Assert((p)->klsdn == klsdnPenBorder), (p)->u.pen.dvr))
  25. #define DvpFromDnode(p) (((p)->klsdn == klsdnReal) ? \
  26. DvpFromRealDnode(p) : \
  27. (Assert((p)->klsdn == klsdnPenBorder), (p)->u.pen.dvp))
  28. /* dnode is not in content if it either auto-decimal tab or was created as a part
  29. of autonumbering. In both these cases and only in them it's cpFirst is negative */
  30. #define FIsNotInContent(plsdn) (Assert(FIsLSDNODE(plsdn)), ((plsdn)->cpFirst < 0 ))
  31. #define SublineFromDnode(plsdn) ((plsdn)->plssubl)
  32. #define LstflowFromDnode(plsdn) (LstflowFromSubline(SublineFromDnode(plsdn)))
  33. /* dnode is first on line if it in content (not autonumber) and previous dnode either
  34. null or not in content or is opening border which has previous dnode satisfying two
  35. coditions above */
  36. #define FIsFirstOnLine(plsdn) ( \
  37. !FIsNotInContent(plsdn) \
  38. && \
  39. ( ((plsdn)->plsdnPrev == NULL) \
  40. || FIsNotInContent((plsdn)->plsdnPrev) \
  41. || ( FIsDnodeOpenBorder((plsdn)->plsdnPrev) \
  42. && ( ((plsdn)->plsdnPrev->plsdnPrev == NULL)\
  43. || FIsNotInContent((plsdn)->plsdnPrev->plsdnPrev) \
  44. ) \
  45. ) \
  46. ) \
  47. )
  48. #define FIsOutOfBoundary(plsdn, cpLim) \
  49. (((plsdn) == NULL) || \
  50. ((plsdn)->cpLimOriginal > (cpLim)) || \
  51. (FIsDnodeOpenBorder(plsdn) && ((plsdn)->cpLimOriginal == (cpLim))) \
  52. )
  53. #define FDnodeBeforeCpLim(plsdn, cpLim) \
  54. !FIsOutOfBoundary((plsdn), (cpLim))
  55. #define FDnodeAfterCpFirst(plsdn, cpF) \
  56. ( \
  57. ((plsdn) != NULL) \
  58. && ( \
  59. ((plsdn)->cpFirst > (cpF)) \
  60. || ( \
  61. ((plsdn)->cpFirst == (cpF)) \
  62. && (FIsDnodeReal(plsdn) || FIsDnodeOpenBorder(plsdn)) \
  63. ) \
  64. ) \
  65. )
  66. #define FDnodeHasBorder(plsdn) /* doesn't work properly for pens */ \
  67. (Assert(((plsdn) == NULL || !FIsDnodePen(plsdn))), \
  68. ((plsdn) == NULL ? fFalse : \
  69. ((FIsDnodeBorder(plsdn) ? fTrue : \
  70. (plsdn)->u.real.lschp.fBorder))) \
  71. )
  72. /* macros bellow handle dup in sync with dur during formatting */
  73. #define SetDnodeDurFmt(plsdn, durNew) \
  74. Assert(FIsDnodeReal(plsdn)); \
  75. (plsdn)->u.real.objdim.dur = (durNew); \
  76. if (!(plsdn)->fRigidDup) \
  77. (plsdn)->u.real.dup = (durNew);
  78. #define ModifyDnodeDurFmt(plsdn, ddur) \
  79. Assert(FIsDnodeReal(plsdn)); \
  80. (plsdn)->u.real.objdim.dur += (ddur); \
  81. if (!(plsdn)->fRigidDup) \
  82. (plsdn)->u.real.dup += (ddur);
  83. #define SetDnodeObjdimFmt(plsdn, objdimNew) \
  84. Assert(FIsDnodeReal(plsdn)); \
  85. (plsdn)->u.real.objdim = (objdimNew); \
  86. if (!(plsdn)->fRigidDup) \
  87. (plsdn)->u.real.dup = (objdimNew).dur;
  88. #define SetPenBorderDurFmt(plsdn, durNew) \
  89. Assert(!FIsDnodeReal(plsdn)); \
  90. (plsdn)->u.pen.dur = (durNew); \
  91. if (!(plsdn)->fRigidDup) \
  92. (plsdn)->u.pen.dup = (durNew);
  93. #define ModifyPenBorderDurFmt(plsdn, ddur) \
  94. Assert(!FIsDnodeReal(plsdn)); \
  95. (plsdn)->u.pen.dur += (ddur); \
  96. if (!(plsdn)->fRigidDup) \
  97. (plsdn)->u.pen.dup += (ddur);
  98. #endif /* DNINFO_DEFINED */