00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 #ifndef INC_RNDRGN
00106 #define INC_RNDRGN
00107
00108 #include "listitem.h"
00109 #include "handles.h"
00110 #include "docrect.h"
00111 #include "rndstack.h"
00112 #include "quality.h"
00113 #include "attr.h"
00114 #include "pathtype.h"
00115 #include "gradtype.h"
00116 #include "matrix.h"
00117 #include "txtattr.h"
00118 #include "slowjob.h"
00119
00120 #include "pathshap.h"
00121
00122 #include "winrect.h"
00123 #include "bitmapcache.h"
00124 #include "capturemanager.h"
00125 #include "genstack.h"
00126
00127
00128
00129
00130
00131 #define FORMAT_TOP 0x00000000
00132 #define FORMAT_LEFT 0x00000000
00133 #define FORMAT_CENTER 0x00000001
00134 #define FORMAT_RIGHT 0x00000002
00135 #define FORMAT_VCENTER 0x00000004
00136 #define FORMAT_BOTTOM 0x00000008
00137 #define FORMAT_WORDBREAK 0x00000010
00138 #define FORMAT_SINGLELINE 0x00000020
00139 #define FORMAT_EXPANFORMATABS 0x00000040
00140 #define FORMAT_TABSTOP 0x00000080
00141 #define FORMAT_NOCLIP 0x00000100
00142 #define FORMAT_EXTERNALLEADING 0x00000200
00143 #define FORMAT_CALCRECT 0x00000400
00144 #define FORMAT_NOPREFIX 0x00000800
00145 #define FORMAT_INTERNAL 0x00001000
00146 #define DEFAULT_TEXT_FORMATTING FORMAT_SINGLELINE | FORMAT_NOPREFIX | FORMAT_VCENTER
00147
00148
00149 class Node;
00150 class Matrix;
00151 class Spread;
00152 class Path;
00153 class AttributeValue;
00154 class AttributeEntry;
00155 class View;
00156 class KernelBitmap;
00157 class RRCaps;
00158 class MaskedRenderRegion;
00159 class NodeBitmap;
00160 class DocColour;
00161 class ColourContext;
00162 class StrokeColourAttribute;
00163 class StrokeTranspAttribute;
00164 class StrokeTypeAttrValue;
00165 class ColourFillAttribute;
00166 class FillMappingAttribute;
00167 class FillEffectAttribute;
00168 class TranspFillAttribute;
00169 class TranspFillMappingAttribute;
00170 class LineWidthAttribute;
00171 class VariableWidthAttrValue;
00172 class StartCapAttribute;
00173 class EndCapAttribute;
00174 class StartArrowAttribute;
00175 class EndArrowAttribute;
00176 class JoinTypeAttribute;
00177 class MitreLimitAttribute;
00178 class DashPatternAttribute;
00179 class WindingRuleAttribute;
00180 class DrawingModeAttribute;
00181 class QualityAttribute;
00182 class BitmapFillAttribute;
00183 class WebAddressAttribute;
00184 class MouldAttribute;
00185 class TxtFontTypefaceAttribute;
00186 class TxtBoldAttribute;
00187 class TxtUnderlineAttribute;
00188 class TxtItalicAttribute;
00189 class TxtAspectRatioAttribute;
00190 class TxtJustificationAttribute;
00191 class TxtTrackingAttribute;
00192 class TxtTrackingAttribute;
00193 class TxtFontSizeAttribute;
00194 class TxtScriptAttribute;
00195 class TxtBaseLineAttribute;
00196 class TxtLineSpaceAttribute;
00197 class TxtLeftMarginAttribute;
00198 class TxtRightMarginAttribute;
00199 class TxtFirstIndentAttribute;
00200 class TxtRulerAttribute;
00201 class OverprintLineAttrValue;
00202 class OverprintFillAttrValue;
00203 class PrintOnAllPlatesAttrValue;
00204 class ProgressDisplay;
00205 class PathProcessor;
00206 class OffscreenAttrValue;
00207 class ClipRegionAttribute;
00208 class CaptureManager;
00209 class RenderCallback;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 typedef enum
00224 {
00225 CHANGEATTR_ALL = -1,
00226 CHANGEATTR_GEOMETRY = 0,
00227 CHANGEATTR_EFFECT,
00228 CHANGEATTR_MAPPING,
00229 CHANGEATTR_TRANSP_GEOMETRY,
00230 CHANGEATTR_TRANSP_EFFECT,
00231 CHANGEATTR_TRANSP_MAPPING,
00232 CHANGEATTR_WINDING_RULE
00233 } ChangeAttrType;
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247 typedef enum
00248 {
00249 CHANGELINEATTR_ALL = -1,
00250 CHANGEATTR_STROKECOL = 0,
00251 CHANGEATTR_STROKETRANSP,
00252 CHANGEATTR_LINEWIDTH,
00253 CHANGEATTR_JOINTYPE,
00254 CHANGEATTR_DASHPATTERN,
00255 CHANGEATTR_LINECAP,
00256 CHANGEATTR_STARTARROW,
00257 CHANGEATTR_ENDARROW,
00258 CHANGEATTR_MITRELIMIT
00259 } ChangeLineAttrType;
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 typedef enum
00274 {
00275 CHANGEFILLATTR_ALL = -1,
00276 CHANGEATTR_FONT = 0,
00277 CHANGEATTR_BOLD,
00278 CHANGEATTR_ITALIC,
00279 CHANGEATTR_UNDERLINE,
00280 CHANGEATTR_ASPECT,
00281 CHANGEATTR_TRACKING,
00282 CHANGEATTR_SIZE,
00283 CHANGEATTR_JUSTIFY,
00284 CHANGEATTR_SCRIPT,
00285 CHANGEATTR_BASELINE,
00286 CHANGEATTR_LINESPACE,
00287 CHANGEATTR_LEFTMARGIN,
00288 CHANGEATTR_RIGHTMARGIN,
00289 CHANGEATTR_FIRSTINDENT,
00290 CHANGEATTR_RULER
00291 } ChangeFillAttrType;
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 class SubRenderContext : public CCObject
00313 {
00314 CC_DECLARE_DYNAMIC(SubRenderContext);
00315
00316 SubRenderContext() {renderstate = SUBTREE_ROOTONLY;}
00317
00318 public:
00319 SubtreeRenderState renderstate;
00320 };
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 class SubTreeRenderContext : public SubRenderContext
00336 {
00337 CC_DECLARE_DYNAMIC(SubTreeRenderContext);
00338
00339 SubTreeRenderContext() {renderstate = SUBTREE_NORENDER;}
00340 };
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 class CCAPI RenderRegion : public ListItem
00374 {
00375
00376 CC_DECLARE_DYNAMIC( RenderRegion )
00377
00378 public:
00379
00380 RenderRegion();
00381 RenderRegion(DocRect ClipRect, Matrix ConvertMatrix, FIXED16 ViewScale);
00382 RenderRegion(const RenderRegion &other);
00383 virtual ~RenderRegion();
00384
00385 static BOOL Init();
00386
00387
00388 virtual BOOL CopyRenderInfo( const RenderRegion &Other);
00389
00390 virtual BOOL AttachDevice(View *, CNativeDC *, Spread *SpreadToAttach = NULL, bool fOwned = false );
00391 virtual BOOL AttachDevice(View *, CCDC *, Spread *SpreadToAttach = NULL, bool fOwned = false );
00392 virtual BOOL InitDevice();
00393
00394 virtual BOOL ImmediateRender();
00395
00396
00397
00398 virtual Node* GetBackmostChangedNode() { return m_pBackmostChangedNode; }
00399 virtual void SetBackmostChangedNode(Node* pInvalidNode);
00400 virtual void ClearBackmostChangedNode(Node* pNode);
00401
00402 virtual BOOL RenderBits(LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits, DocRect rect, BOOL bForceNoTransp = TRUE, Node* pEffectsOwner = NULL);
00403 virtual BOOL RenderBits(LPBITMAPINFO lpBitmapInfo, LPBYTE lpBits, DocCoord* pCoords, INT32 numcoords, BOOL bForceNoTransp = TRUE, Node* pEffectsOwner = NULL);
00404 virtual BOOL RenderBits(KernelBitmap* pkBitmap, DocCoord* pCoords, INT32 numcoords, BOOL bForceNoTransp, Node* pEffectsOwner);
00405
00406 virtual INT64 GetTotalCount() {return m_countTotal;}
00407 virtual INT64 GetStoredCount() {return m_countStored;}
00408 virtual void SetStoredCount(INT64 llcount) {m_countStored = llcount;}
00409
00410
00411 virtual void SetMatrix( Matrix& );
00412 Matrix GetMatrix() { return RenderMatrix; }
00413 virtual Matrix ConcatenateMatrix( Matrix& );
00414
00415
00416 static BOOL InitPrefs();
00417
00418 virtual BOOL StartRender();
00419 virtual BOOL StopRender() = 0;
00420 virtual void SetClean(BOOL bResetChangedBounds, BOOL FillWhite);
00421 virtual BOOL IsClean() {return FALSE;}
00422
00423 virtual BOOL CloseDown ();
00424 virtual void ConditionalSuicide ( void );
00425
00426 Node* GetRenderState();
00427 void SetRenderState(Node *RenderState) { CurrentRenderState = RenderState; }
00428
00429
00430
00431
00432
00433 SubRenderContext* GetSubRenderState()
00434 { return CurrentSubRenderState; }
00435 void SetSubRenderState(SubRenderContext *SubRenderState)
00436 {
00437 ERROR3IF(SubRenderStateLocked && SubRenderState != NULL, "Oi! No!");
00438 CurrentSubRenderState = SubRenderState;
00439 if (SubRenderState == NULL)
00440 SubRenderStateLocked = FALSE;
00441 }
00442 BOOL IsSubRenderStateLocked(void) const { return(SubRenderStateLocked); };
00443 void LockSubRenderState(BOOL Lock) { SubRenderStateLocked = Lock; };
00444
00445
00446 CNativeDC *GetRenderDC() { return RenderDC; }
00447 INT32 GetTimeslice() const { return Timeslice; }
00448
00449 void DefaultRender(BOOL bForceImmediate = FALSE);
00450
00451 View* GetRenderView() { return RenderView; }
00452 Spread* GetRenderSpread() { return RenderSpread; }
00453 BOOL IsPrinting() { return RenderFlags.Printing; }
00454 BOOL IsRendering() { return RenderFlags.Rendering; }
00455
00456 BOOL IsVeryMono() { return RenderFlags.VeryMono; }
00457 BOOL IsHitDetect() const { return RenderFlags.VeryMono || RenderFlags.HitDetect; }
00458
00459 BOOL IsUsingSmoothedBitmaps() { return RenderFlags.SmoothedBitmaps; }
00460 void SetUsingSmoothedBitmaps(BOOL set) { RenderFlags.SmoothedBitmaps = set; }
00461
00462 void SaveContext();
00463 void RestoreContext();
00464
00465 #ifdef _DEBUG
00466 BOOL m_TraceOutContextLevels;
00467 INT32 m_CurrentContextLevel;
00468 virtual void DebugTrace();
00469 #endif
00470
00471
00472 virtual BOOL SaveAttribute(UINT32 Index, AttributeValue *pAttr, BOOL Temp);
00473 void RestoreAttribute(UINT32 Index, AttributeValue *pAttr, BOOL Temp);
00474
00475
00476 virtual BOOL WantsGrids();
00477
00478
00479 void SetBackgroundColour ( DocColour &Colour );
00480
00481
00482 virtual void DrawPath(Path *PathToRender, PathProcessor *pCaller = NULL, PathShape psThis=PATHSHAPE_PATH);
00483
00484
00485 PathProcessor *GetFirstPathProcessor(void) { return(PathProcessorStack); };
00486 void PushPathProcessor(PathProcessor *pProcessor);
00487 void PopPathProcessor(void);
00488
00489
00490 void EnableAllBrushPathProcessors(BOOL Enable);
00491
00492 virtual void DrawPathToOutputDevice(Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH) = 0;
00493
00494
00495
00496 virtual void DrawRect(DocRect *RectToRender) = 0;
00497 virtual void DrawDragRect(DocRect *RectToRender) = 0;
00498 virtual void DrawDragBounds(DocRect *RectToRender);
00499 virtual void DrawDashLine(const DocCoord &StartPoint, const DocCoord &EndPoint);
00500 virtual void DrawLine(const DocCoord &StartPoint, const DocCoord &EndPoint) = 0;
00501 virtual void DrawPixel(const DocCoord &Point) = 0;
00502 virtual void DrawBlob(DocCoord p, BlobType type) = 0;
00503 virtual void DrawCross(const DocCoord &Point, const UINT32 Size) = 0;
00504
00505 virtual void DrawBitmap(const DocCoord &Point, KernelBitmap* pBitmap) = 0;
00506 virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = 0) = 0;
00507 virtual BOOL DrawTransformedBitmap(NodeBitmap *pNodeBitmap);
00508
00509 virtual void DrawBitmapBlob(const DocCoord &Point, KernelBitmap* BlobShape) = 0;
00510 virtual void DrawBitmapBlob(const DocCoord &Point, ResourceID resID ) = 0;
00511
00512 virtual SlowJobResult DrawMaskedBitmap(const DocRect &Rect, KernelBitmap* pBitmap,
00513 MaskedRenderRegion* pMask, ProgressDisplay *Progress);
00514
00515 virtual void DrawFixedSystemText(StringBase *TheText, DocRect &BoundsRect, UINT32 uFormat = DEFAULT_TEXT_FORMATTING);
00516 virtual void SetFixedSystemTextColours(DocColour *TextCol, DocColour *Background);
00517 virtual void GetFixedSystemTextSize(StringBase *TheText, DocRect *BoundsRect, double* atDpi = NULL);
00518
00519 DrawModeType DrawingMode;
00520
00521
00522 virtual BOOL DrawPathArrowHeads(DocCoord* Coords, PathVerb* Verbs, INT32 NumCoords);
00523 virtual BOOL DrawArrowHead(ArrowRec &ArrowToDraw, DocCoord &Centre, DocCoord &Direction,
00524 DocCoord * RetnCentre = NULL);
00525
00526
00527
00528
00529 virtual void DrawPixelRect(DocRect *RectToRender);
00530 virtual void DrawPixelLine(const DocCoord &StartPoint, const DocCoord &EndPoint);
00531
00532
00533 virtual void SetLineColour (StrokeColourAttribute *, BOOL Temp);
00534 virtual void SetLineOverprint(OverprintLineAttrValue *, BOOL Temp);
00535 virtual void SetLineTransp (StrokeTranspAttribute *, BOOL Temp);
00536
00537 virtual void SetStrokeType (StrokeTypeAttrValue *, BOOL Temp);
00538 virtual void SetVariableWidth(VariableWidthAttrValue *, BOOL Temp);
00539
00540 virtual void SetFillGeometry(ColourFillAttribute *, BOOL Temp);
00541 virtual void SetFillMapping (FillMappingAttribute *, BOOL Temp);
00542 virtual void SetFillEffect (FillEffectAttribute *, BOOL Temp);
00543 virtual void SetFillOverprint(OverprintFillAttrValue *, BOOL Temp);
00544
00545 virtual void SetTranspFillGeometry(TranspFillAttribute *, BOOL Temp);
00546 virtual void SetTranspFillMapping (TranspFillMappingAttribute *, BOOL Temp);
00547
00548 virtual void SetPrintOnAllPlates(PrintOnAllPlatesAttrValue *, BOOL Temp);
00549
00550 virtual void SetLineWidth (LineWidthAttribute *, BOOL Temp);
00551
00552 virtual void SetStartCap (StartCapAttribute *, BOOL Temp);
00553 virtual void SetStartArrow (StartArrowAttribute *, BOOL Temp);
00554 virtual void SetEndArrow (EndArrowAttribute *, BOOL Temp);
00555 virtual void SetJoinType (JoinTypeAttribute *, BOOL Temp);
00556 virtual void SetMitreLimit (MitreLimitAttribute *, BOOL Temp);
00557 virtual void SetDashPattern (DashPatternAttribute *, BOOL Temp);
00558 virtual void SetWindingRule (WindingRuleAttribute *, BOOL Temp);
00559 virtual void SetDrawingMode (DrawingModeAttribute *, BOOL Temp);
00560 virtual void SetQuality (QualityAttribute *, BOOL Temp);
00561
00562 virtual void SetWebAddress (WebAddressAttribute *, BOOL Temp);
00563
00564 virtual void SetTxtFontTypeface (TxtFontTypefaceAttribute *, BOOL Temp);
00565 virtual void SetTxtBold (TxtBoldAttribute *, BOOL Temp);
00566 virtual void SetTxtUnderline (TxtUnderlineAttribute *, BOOL Temp);
00567 virtual void SetTxtItalic (TxtItalicAttribute *, BOOL Temp);
00568 virtual void SetTxtAspectRatio (TxtAspectRatioAttribute *, BOOL Temp);
00569 virtual void SetTxtJustification (TxtJustificationAttribute *, BOOL Temp);
00570 virtual void SetTxtTracking (TxtTrackingAttribute *, BOOL Temp);
00571 virtual void SetTxtFontSize (TxtFontSizeAttribute *, BOOL Temp);
00572 virtual void SetTxtScript (TxtScriptAttribute *, BOOL Temp);
00573 virtual void SetTxtBaseLine (TxtBaseLineAttribute *, BOOL Temp);
00574 virtual void SetTxtLineSpace (TxtLineSpaceAttribute *, BOOL Temp);
00575 virtual void SetTxtLeftMargin (TxtLeftMarginAttribute *, BOOL Temp);
00576 virtual void SetTxtRightMargin (TxtRightMarginAttribute *, BOOL Temp);
00577 virtual void SetTxtFirstIndent (TxtFirstIndentAttribute *, BOOL Temp);
00578 virtual void SetTxtRuler (TxtRulerAttribute *, BOOL Temp);
00579
00580 virtual void SetSolidColours(BOOL SetSolid) {}
00581
00582 void SetLineColour(DocColour &NewLineColour);
00583 void SetLineColour(StockColour NewLineColour);
00584 void SetFillColour(DocColour &NewFillColour);
00585 void SetFillColour(StockColour NewFillColour);
00586 void SetLineWidth(MILLIPOINT NewLineWidth);
00587 void SetStartCap(LineCapType NewStartCap);
00588 void SetStartArrow(StockArrow NewStartArrow);
00589 void SetEndArrow(StockArrow NewEndArrow);
00590 void SetStartArrow(ArrowRec &NewStartArrow);
00591 void SetEndArrow(ArrowRec &NewEndArrow);
00592 void SetJoinType(JointType NewJoinType);
00593 void SetMitreLimit(MILLIPOINT NewMitreLimit);
00594 void SetDashPattern(DashRec &NewDashPattern);
00595 void SetDashPattern(StockDash NewDashPattern);
00596 void SetWindingRule(WindingType NewWindingRule);
00597 void SetDrawingMode(DrawModeType NewDrawingType);
00598 void SetDefaultQuality();
00599
00600 void SetDeviceDashPattern(DashRec &NewDashPattern);
00601 void SetDeviceDashPattern(StockDash NewDashPattern);
00602
00603 virtual void SetOffscreen(OffscreenAttrValue* pAttr);
00604 virtual void SetClipRegion(ClipRegionAttribute *, BOOL Temp);
00605 virtual CCachedBitmap GrabBitmap(DocRect rectGrab) {return CCachedBitmap();}
00606
00607
00608 virtual void RestoreLineColour (StrokeColourAttribute *, BOOL);
00609 virtual void RestoreLineOverprint(OverprintLineAttrValue *, BOOL);
00610 virtual void RestoreLineTransp (StrokeTranspAttribute *, BOOL);
00611
00612 virtual void RestoreStrokeType (StrokeTypeAttrValue *, BOOL);
00613 virtual void RestoreVariableWidth(VariableWidthAttrValue *, BOOL);
00614
00615 virtual void RestoreFillGeometry(ColourFillAttribute *, BOOL);
00616 virtual void RestoreFillMapping (FillMappingAttribute *, BOOL);
00617 virtual void RestoreFillOverprint(OverprintFillAttrValue *, BOOL);
00618
00619 virtual void RestoreTranspFillGeometry(TranspFillAttribute *, BOOL);
00620 virtual void RestoreTranspFillMapping (TranspFillMappingAttribute *, BOOL);
00621
00622 virtual void RestoreFillEffect (FillEffectAttribute *, BOOL);
00623 virtual void RestoreLineWidth (LineWidthAttribute *, BOOL);
00624 virtual void RestoreDrawingMode (DrawingModeAttribute *, BOOL);
00625 virtual void RestoreWindingRule (WindingRuleAttribute *, BOOL);
00626 virtual void RestoreStartCap (StartCapAttribute *, BOOL);
00627 virtual void RestoreJoinType (JoinTypeAttribute *, BOOL);
00628 virtual void RestoreQuality (QualityAttribute *, BOOL);
00629 virtual void RestoreDashPattern (DashPatternAttribute *, BOOL);
00630 virtual void RestoreStartArrow (StartArrowAttribute *, BOOL);
00631 virtual void RestoreEndArrow (EndArrowAttribute *, BOOL);
00632 virtual void RestoreMitreLimit (MitreLimitAttribute *, BOOL);
00633
00634 virtual void RestoreWebAddress (WebAddressAttribute *, BOOL);
00635
00636 virtual void RestorePrintOnAllPlates(PrintOnAllPlatesAttrValue *, BOOL);
00637
00638 void RestoreTxtFontTypeface (TxtFontTypefaceAttribute *, BOOL);
00639 void RestoreTxtBold (TxtBoldAttribute *, BOOL);
00640 void RestoreTxtUnderline (TxtUnderlineAttribute *, BOOL);
00641 void RestoreTxtItalic (TxtItalicAttribute *, BOOL);
00642 void RestoreTxtAspectRatio (TxtAspectRatioAttribute *, BOOL);
00643 void RestoreTxtJustification (TxtJustificationAttribute *, BOOL);
00644 void RestoreTxtTracking (TxtTrackingAttribute *, BOOL);
00645 void RestoreTxtFontSize (TxtFontSizeAttribute *, BOOL);
00646 void RestoreTxtScript (TxtScriptAttribute *, BOOL);
00647 void RestoreTxtBaseLine (TxtBaseLineAttribute *, BOOL);
00648 void RestoreTxtLineSpace (TxtLineSpaceAttribute *, BOOL);
00649 void RestoreTxtLeftMargin (TxtLeftMarginAttribute *, BOOL);
00650 void RestoreTxtRightMargin (TxtRightMarginAttribute *, BOOL);
00651 void RestoreTxtFirstIndent (TxtFirstIndentAttribute *, BOOL);
00652 void RestoreTxtRuler (TxtRulerAttribute *, BOOL);
00653
00654 virtual void RestoreOffscreen(OffscreenAttrValue*);
00655 virtual void RestoreClipRegion (ClipRegionAttribute *, BOOL);
00656
00657 AttributeValue *GetCurrentAttribute(UINT32 Index);
00658 OffscreenAttrValue* GetCurrentOffscreenAttr() { return(CurrentOffscreenAttr); }
00659
00660 virtual BOOL CheckOffscreenBounds() { return(TRUE); }
00661
00662
00663 void SetClipRect(DocRect &NewClipRect, BOOL ReCalcContextNode = FALSE);
00664 DocRect GetClipRect();
00665
00666
00667 MILLIPOINT GetPixelWidth() { return PixelWidth; }
00668 MILLIPOINT GetScaledPixelWidth() { return ScaledPixelWidth; }
00669 virtual double GetPixelsPerInch() { return 72000.0/ScaledPixelWidth; }
00670
00671
00672 virtual void GetRenderRegionCaps(RRCaps* pCaps);
00673 BOOL SetRenderComplexShapes(BOOL NewState);
00674
00675
00676 BOOL TestForComplexShape(RRCaps* pCaps);
00677
00678
00679 EFFECTTYPE GetFillEffect();
00680
00681
00682 void SetFilter(Filter* pFilter) {m_pFilter = pFilter;}
00683 Filter* GetFilter() {return m_pFilter;}
00684
00685
00686 virtual void ResizeRegion(DocRect &NewClipRect);
00687
00688
00689 virtual void ResetRegion(DocRect &NewClipRect);
00690 virtual BOOL SetFirstBand();
00691 virtual BOOL GetNextBand();
00692 DocRect GetRegionRect();
00693 BOOL IsBanded();
00694 BOOL CanBeMerged();
00695 BOOL ResetColourContext();
00696 ColourContext* GetColourContext();
00697
00698 virtual void ResetRender();
00699
00700 virtual BOOL RenderChar(WCHAR ch, Matrix* pMatrix);
00701 virtual BOOL WriteNewLine ( void );
00702
00703 Path* CreateCharPath(WCHAR ch, Matrix* pMatrix=NULL);
00704 BOOL GetAttrdCharBounds(DocRect* pRect, WCHAR ch);
00705 BOOL GetCharAttributeMatrix(Matrix* pAttrMatrix);
00706
00707 void ColourCorrectBitmap(BitmapFillAttribute* Fill, BITMAPINFO *Info, RGBQUAD **Palette);
00708
00709
00710 BOOL RenderTree(Node* pRoot,
00711 BOOL bTimeSlice = TRUE,
00712 BOOL bClip = TRUE,
00713 RenderCallback* pCallback = NULL);
00714 BOOL RenderTreeCanContinue();
00715 BOOL RenderTreeNoCache(Node* pRoot);
00716
00717 virtual BOOL IsWrappedRender() const {return FALSE;}
00718 virtual BOOL TranspTypeIsRGBTCompatible(UINT32 ttype) const {return TRUE;}
00719 virtual BOOL SetSmoothingFlags(FillGeometryAttribute *Fill) {return TRUE;}
00720
00721
00722 virtual BOOL RenderPaperAsInk() { return(FALSE); }
00723
00724
00725
00726
00727
00728 void SetImmediateRender(BOOL SetVal) {RenderFlags.bImmediateRender = SetVal;}
00729 BOOL GetImmediateRender() const {return RenderFlags.bImmediateRender;}
00730
00731 void SetForceMixTransparency(BOOL bForceMix) { m_bForceMix = bForceMix; }
00732
00734
00735
00736
00737 public:
00738 virtual Capture* StartCapture(CCObject* pOwner,
00739 DocRect CaptureRect,
00740 CAPTUREINFO cinfo,
00741 BOOL bTransparent = TRUE,
00742 BOOL bCaptureBackground = FALSE,
00743 double mpPixelWidth = 0,
00744 NodeRenderableInk* pDirectSupplier = NULL
00745 );
00746 virtual BOOL StopCapture(CCObject* pOwner,
00747 BOOL bRender = TRUE,
00748 BOOL bReleaseBitmap = FALSE,
00749 LPBITMAPINFO* plpBitmapInfo = NULL,
00750 LPBYTE* plpBits = NULL,
00751 DocRect* pCaptureRect = NULL,
00752 Matrix* pmatTransform = NULL,
00753 double* pdResolution = NULL
00754 );
00755 virtual BOOL ChangeCapture(CAPTUREINFO cinfo,
00756 BOOL bTransparent = TRUE,
00757 BOOL bCaptureBackground = FALSE
00758 );
00759 virtual INT32 GetCaptureDepth() {return m_CaptureStack.Size();}
00760 virtual BOOL MasterCaptureIsCurrent() const {return (!m_CaptureStack.Empty() && GetTopCapture() && GetTopCapture()->IsMaster());}
00761 virtual Capture* GetTopCapture() const {return m_CaptureStack.Empty() ? NULL : m_CaptureStack.Top();}
00762 virtual Capture* GetMasterCapture() const {return m_CaptureStack.Empty() ? NULL : m_CaptureStack.Bottom();}
00763 virtual BOOL LockedTransparentCaptures() const;
00764
00765 protected:
00766 virtual BOOL SetRenderToCapture(Capture* pCapture, BOOL ApplyClipRegion, BOOL bSetBitmap) {return TRUE;}
00767
00768
00769 protected:
00770 StackT<Capture*> m_CaptureStack;
00771
00772
00774
00775 public:
00776
00777 BOOL IsWaitingForRAM;
00778 BOOL IsLastBand;
00779
00780
00781
00782 BOOL NeedsOSPaper;
00783
00784
00785 BOOL RenderOSPaper;
00786
00787
00788 BOOL IsPaperRendered;
00789 BOOL IsInkRenderStarted;
00790 Quality RRQuality;
00791
00792
00793 BOOL m_DoCompression;
00794
00795 protected:
00796 DocColour mBackgroundColour;
00797 StrokeColourAttribute *PrepareLineColour(StrokeColourAttribute *SourceAttr = NULL);
00798 ColourFillAttribute *PrepareFillGeometry(ColourFillAttribute *SourceAttr = NULL);
00799
00800
00801
00802 virtual void InitClipping() = 0;
00803 virtual void InitAttributes() = 0;
00804 virtual void SetLineAttributes(ChangeLineAttrType = CHANGELINEATTR_ALL);
00805 virtual void SetFillAttributes(ChangeAttrType Type = CHANGEATTR_ALL);
00806 virtual void SetTextAttributes(ChangeFillAttrType Type = CHANGEFILLATTR_ALL);
00807 virtual BOOL RenderNode(Node* pNode, Node* pRunToNode, RenderCallback* pCallback);
00808
00809 virtual void SetOSDrawingMode() = 0;
00810
00811 virtual void SetQualityLevel();
00812
00813 virtual MILLIPOINT CalcPixelWidth() = 0;
00814 virtual MILLIPOINT CalcScaledPixelWidth() = 0;
00815
00816
00817 BOOL TryToFuzzyClip(Path* pPath, DocCoord** pNewCoords, PathVerb** pNewVerbs, UINT32 *NewNumCoords);
00818 void SetupFuzzyClipRects();
00819
00820
00821 DocRect InnerRect;
00822 DocRect OuterRect;
00823
00824
00825 BOOL RenderComplexShapes;
00826
00827
00828 INT64 m_countTotal;
00829 INT64 m_countStored;
00830
00831 struct CCAPI FlagBlock
00832 {
00833 BOOL Printing : 1;
00834 BOOL Rendering : 1;
00835 BOOL StackClaimed : 1;
00836 BOOL ValidDevice : 1;
00837 BOOL bImmediateRender : 1;
00838 BOOL VeryMono : 1;
00839 BOOL SmoothedBitmaps : 1;
00840 BOOL HitDetect : 1;
00841 } RenderFlags;
00842
00843 struct _StrokeFlags
00844 {
00845 BOOL ValidStrokeColour : 1;
00846 BOOL ValidStrokeTransp : 1;
00847 BOOL ValidLineWidth : 1;
00848 BOOL ValidJoinType : 1;
00849 BOOL ValidDashPattern : 1;
00850 BOOL ValidLineCap : 1;
00851 BOOL ValidStartArrow : 1;
00852 BOOL ValidEndArrow : 1;
00853 BOOL ValidMitreLimit : 1;
00854 } StrokeFlags;
00855
00856 struct _FillFlags
00857 {
00858 BOOL ValidGeometry : 1;
00859 BOOL ValidEffect : 1;
00860 BOOL ValidMapping : 1;
00861 BOOL ValidTransGeometry : 1;
00862 BOOL ValidTransEffect : 1;
00863 BOOL ValidTransMapping : 1;
00864 BOOL ValidWindingRule : 1;
00865 } FillFlags;
00866
00867 struct _TextFlags
00868 {
00869 BOOL ValidFont : 1;
00870 BOOL ValidBold : 1;
00871 BOOL ValidItalic : 1;
00872 BOOL ValidUnderline : 1;
00873 BOOL ValidAspect : 1;
00874 BOOL ValidTracking : 1;
00875 BOOL ValidFontSize : 1;
00876 BOOL ValidJustify : 1;
00877 BOOL ValidScript : 1;
00878 BOOL ValidBaseLine : 1;
00879 BOOL ValidLineSpace : 1;
00880 BOOL ValidLeftMargin : 1;
00881 BOOL ValidRightMargin : 1;
00882 BOOL ValidFirstIndent : 1;
00883 BOOL ValidRuler : 1;
00884
00885 } TextFlags;
00886
00887
00888 Matrix RenderMatrix;
00889 DocRect CurrentClipRect;
00890 ColourContext *CurrentColContext;
00891
00892 View *RenderView;
00893 CNativeDC *RenderDC;
00894 Spread *RenderSpread;
00895 bool m_fOwned;
00896
00897 Node* CurrentRenderState;
00898 SubRenderContext* CurrentSubRenderState;
00899 BOOL SubRenderStateLocked;
00900
00901 FIXED16 ScaleFactor;
00902
00903
00904 AttributeEntry *CurrentAttrs;
00905 INT32 NumCurrentAttrs;
00906
00907
00908
00909
00910
00911 OffscreenAttrValue* CurrentOffscreenAttr;
00912
00913 BOOL CopyCurrentAttributes(const RenderRegion &);
00914
00915
00916 INT32 Timeslice;
00917 BOOL m_bRenderTreeTimeSlice;
00918 MonotonicTime m_timeRenderTreeStartTime;
00919
00920
00921
00922 static UINT32 SelectedBlobSize;
00923 static UINT32 UnSelectedBlobSize;
00924 static UINT32 MultiStageSelectedBlobSize;
00925 static UINT32 MultiStageUnSelectedBlobSize;
00926
00927
00928
00929 static UINT32 ClipViewBlobSize;
00930
00931
00932 MILLIPOINT PixelWidth;
00933 MILLIPOINT ScaledPixelWidth;
00934
00935 RenderStack TheStack;
00936
00937
00938 DocRect RegionRect;
00939 BOOL IsRegionBanded;
00940 BOOL CanRegionBeMerged;
00941
00942
00943
00944
00945
00946
00947 Node* m_pBackmostChangedNode;
00948
00949
00950
00951
00952
00953 BOOL IsBeingReset;
00954
00955
00956 Filter* m_pFilter;
00957
00958
00959 BOOL m_bForceMix;
00960
00961
00962
00963
00964 private:
00965 PathProcessor *PathProcessorStack;
00966 };
00967
00968
00969
00970
00971 #define RR_STROKECOLOUR() (((StrokeColourAttribute *) CurrentAttrs[ATTR_STROKECOLOUR].pAttr)->Colour)
00972 #define RR_FILLCOLOUR() (((ColourFillAttribute *) CurrentAttrs[ATTR_FILLGEOMETRY].pAttr)->Colour)
00973 #define RR_LINEWIDTH() (((LineWidthAttribute *) CurrentAttrs[ATTR_LINEWIDTH ].pAttr)->LineWidth)
00974 #define RR_WINDINGRULE() (((WindingRuleAttribute *) CurrentAttrs[ATTR_WINDINGRULE ].pAttr)->WindingRule)
00975 #define RR_STARTCAP() (((StartCapAttribute *) CurrentAttrs[ATTR_STARTCAP ].pAttr)->StartCap)
00976 #define RR_JOINTYPE() (((JoinTypeAttribute *) CurrentAttrs[ATTR_JOINTYPE ].pAttr)->JoinType)
00977 #define RR_QUALITY() (((QualityAttribute *) CurrentAttrs[ATTR_QUALITY ].pAttr)->Quality)
00978 #define RR_STARTARROW() (((StartArrowAttribute *) CurrentAttrs[ATTR_STARTARROW ].pAttr)->StartArrow)
00979 #define RR_ENDARROW() (((EndArrowAttribute *) CurrentAttrs[ATTR_ENDARROW ].pAttr)->EndArrow)
00980 #define RR_MITRELIMIT() (((MitreLimitAttribute *) CurrentAttrs[ATTR_MITRELIMIT ].pAttr)->MitreLimit)
00981 #define RR_DASHPATTERN() (((DashPatternAttribute *) CurrentAttrs[ATTR_DASHPATTERN ].pAttr)->DashPattern)
00982
00983 #define RR_FILLTRANSP() ((TranspFillAttribute*)CurrentAttrs[ATTR_TRANSPFILLGEOMETRY].pAttr)
00984 #define RR_FILLEFFECT() ((FillEffectAttribute*)CurrentAttrs[ATTR_FILLEFFECT].pAttr)
00985 #define RR_FILLMAPPING() ((FillMappingAttribute*)CurrentAttrs[ATTR_FILLMAPPING].pAttr)
00986 #define RR_TRANSPFILLMAPPING() ((FillTranspMappingAttribute*)CurrentAttrs[ATTR_TRANSPFILLMAPPING].pAttr)
00987 #define RR_STROKETRANSP() ((StrokeTranspAttribute*)CurrentAttrs[ATTR_STROKETRANSP].pAttr)
00988
00989 #define RR_TXTFONTTYPEFACE() (((TxtFontTypefaceAttribute *) CurrentAttrs[ATTR_TXTFONTTYPEFACE ].pAttr)->HTypeface)
00990
00991 #define RR_TXTBOLD() (((TxtBoldAttribute *) CurrentAttrs[ATTR_TXTBOLD ].pAttr)->BoldOn \
00992 ||((TxtFontTypefaceAttribute *) CurrentAttrs[ATTR_TXTFONTTYPEFACE ].pAttr)->IsBold)
00993
00994 #define RR_TXTITALIC() (((TxtItalicAttribute *) CurrentAttrs[ATTR_TXTITALIC ].pAttr)->ItalicOn \
00995 ||((TxtFontTypefaceAttribute *) CurrentAttrs[ATTR_TXTFONTTYPEFACE ].pAttr)->IsItalic)
00996
00997 #define RR_TXTASPECTRATIO() (((TxtAspectRatioAttribute *) CurrentAttrs[ATTR_TXTASPECTRATIO ].pAttr)->AspectRatio)
00998 #define RR_TXTJUSTIFICATION() (((TxtJustificationAttribute *) CurrentAttrs[ATTR_TXTJUSTIFICATION ].pAttr)->justification)
00999 #define RR_TXTTRACKING() (((TxtTrackingAttribute *) CurrentAttrs[ATTR_TXTTRACKING ].pAttr)->Tracking)
01000 #define RR_TXTUNDERLINE() (((TxtUnderlineAttribute *) CurrentAttrs[ATTR_TXTUNDERLINE ].pAttr)->Underlined)
01001 #define RR_TXTFONTSIZE() (((TxtFontSizeAttribute *) CurrentAttrs[ATTR_TXTFONTSIZE ].pAttr)->FontSize)
01002 #define RR_TXTSCRIPT() ((TxtScriptAttribute *) CurrentAttrs[ATTR_TXTSCRIPT ].pAttr)
01003 #define RR_TXTBASELINE() (((TxtBaseLineAttribute *) CurrentAttrs[ATTR_TXTBASELINE ].pAttr)->Value)
01004 #define RR_TXTLINESPACE() (((TxtLineSpaceAttribute *) CurrentAttrs[ATTR_TXTLINESPACE ].pAttr)->Value)
01005 #define RR_TXTLEFTMARGIN() (((TxtLeftMarginAttribute *) CurrentAttrs[ATTR_TXTLEFTMARGIN ].pAttr)->Value)
01006 #define RR_TXTRIGHTMARGIN() (((TxtRightMarginAttribute *) CurrentAttrs[ATTR_TXTRIGHTMARGIN ].pAttr)->Value)
01007 #define RR_TXTFIRSTINDENT() (((TxtFirstIndentAttribute *) CurrentAttrs[ATTR_TXTFIRSTINDENT ].pAttr)->Value)
01008 #define RR_TXTRULER() (((TxtRulerAttribute *) CurrentAttrs[ATTR_TXTRULER ].pAttr)->Value)
01009
01010 #define RR_CLIPREGION() ((ClipRegionAttribute*)CurrentAttrs[ATTR_CLIPREGION].pAttr)
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037 class RenderCallback : public CCObject
01038 {
01039 public:
01040 virtual BOOL BeforeNode( RenderRegion* pRegion,
01041 Node* pNode) {return TRUE;}
01042
01043 virtual BOOL BeforeSubtree( RenderRegion* pRegion,
01044 Node* pNode,
01045 Node** ppNextNode,
01046 BOOL bClip,
01047 SubtreeRenderState* pState) {return FALSE;}
01048
01049 virtual BOOL AfterSubtree( RenderRegion* pRegion,
01050 Node* pNode) {return FALSE;}
01051 };
01052
01053
01054 #endif