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 #ifndef INC_XPFRGN
00100 #define INC_XPFRGN
00101
00102
00103
00104
00105 class PluginNativeFilter;
00106 class CapabilityTree;
00107 class TextStory;
00108 class TextLine;
00109 class FormatRegion;
00110 class CommonTransInfo;
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 class XPFRenderRegion : public RenderRegion
00123 {
00124
00125 CC_DECLARE_DYNAMIC(XPFRenderRegion);
00126
00127
00128 XPFRenderRegion(PluginNativeFilter* pFilter, CapabilityTree* pPlugCaps, CommonTransInfo* pTransInfo = NULL);
00129 ~XPFRenderRegion();
00130
00131 virtual BOOL AttachDevice(View*, CNativeDC*, Spread* SpreadToAttach = NULL);
00132
00133
00134 virtual BOOL StartRender();
00135 virtual BOOL StopRender();
00136
00137
00138 virtual void DrawPathToOutputDevice(Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH);
00139 virtual void DrawRect(DocRect *RectToRender);
00140 virtual void DrawLine(const DocCoord &StartPoint, const DocCoord &EndPoint);
00141 virtual void DrawPixel(const DocCoord &Point);
00142
00143
00144 virtual void DrawBitmap(const DocCoord &Point, KernelBitmap* pBitmap);
00145 virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = NULL);
00146 virtual BOOL DrawTransformedBitmap(NodeBitmap *pNodeBitmap);
00147
00148
00149 virtual void DrawDragRect(DocRect *RectToRender);
00150 virtual void DrawBlob(DocCoord p, BlobType type);
00151 virtual void DrawCross(const DocCoord &Point, const UINT32 Size);
00152 virtual void DrawBitmapBlob(const DocCoord &Point, KernelBitmap* BlobShape);
00153 virtual void DrawBitmapBlob(const DocCoord &Point, ResourceID resID);
00154
00155
00156
00157 virtual void InitClipping();
00158 virtual void InitAttributes();
00159 virtual void SetLineAttributes();
00160 virtual void SetOSDrawingMode();
00161 virtual void SetQualityLevel();
00162 virtual MILLIPOINT CalcPixelWidth();
00163 virtual MILLIPOINT CalcScaledPixelWidth();
00164
00165
00166
00167 virtual double GetPixelsPerInch() { return(m_PixelsPerInch); }
00168
00169
00170 virtual BOOL CheckOffscreenBounds() { return(FALSE); }
00171
00172
00173 virtual void GetRenderRegionCaps(RRCaps* pCaps);
00174
00175
00176 virtual BOOL RenderPaperAsInk() { return(TRUE); }
00177
00178 protected:
00179 PluginNativeFilter* m_pFilter;
00180 double m_PixelsPerInch;
00181 CommonTransInfo* m_pTransInfo;
00182 };
00183
00184
00185 class CommonTransInfo
00186 {
00187 public:
00188 CommonTransInfo();
00189
00190 BOOL IsCommonType() { return(m_bCommonType); }
00191 void UpdateCommonType(UINT32 Type);
00192 UINT32 GetCommonType();
00193 BOOL UsesNonAlpha() { return(m_bUsesNonAlpha); }
00194
00195 protected:
00196 BOOL m_bCommonType;
00197 UINT32 m_CommonType;
00198 BOOL m_bUsesNonAlpha;
00199 };
00200
00201
00202 class SpanListItem : public ListItem
00203 {
00204 public:
00205 CC_DECLARE_DYNAMIC( SpanListItem )
00206 SpanListItem(Node* pFirstNode = NULL, Node* pLastNode = NULL, BOOL bNonAlpha = FALSE)
00207 {
00208 m_pFirstNode = pFirstNode;
00209 m_pLastNode = pLastNode ? pLastNode : pFirstNode;
00210 m_bNonAlphaTrans = bNonAlpha;
00211 }
00212
00213 Node* m_pFirstNode;
00214 Node* m_pLastNode;
00215 BOOL m_bNonAlphaTrans;
00216 };
00217
00218
00219 class NodeThreeBoolListItem : public ListItem
00220 {
00221 public:
00222 CC_DECLARE_DYNAMIC( NodeThreeBoolListItem )
00223
00224 NodeThreeBoolListItem(Node* pNode = NULL, BOOL bFirst = FALSE, BOOL bSecond = FALSE, BOOL bThird = FALSE)
00225 {
00226 m_pNode = pNode;
00227 m_bFirst = bFirst;
00228 m_bSecond = bSecond;
00229 m_bThird = bThird;
00230 }
00231
00232 Node* m_pNode;
00233 BOOL m_bFirst;
00234 BOOL m_bSecond;
00235 BOOL m_bThird;
00236 };
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250 class XPFRenderCallback : public RenderCallback
00251 {
00252 public:
00253 XPFRenderCallback(PluginNativeFilter* pFilter, XPFRenderRegion* pXPFRegion, CapabilityTree* pCapTree, INT32 ConvertPass);
00254 ~XPFRenderCallback();
00255
00256 virtual BOOL BeforeNode(RenderRegion* pRegion, Node* pNode);
00257 virtual BOOL BeforeSubtree(RenderRegion* pRegion, Node* pNode, Node** ppNextNode, BOOL bClip, SubtreeRenderState* pState);
00258
00259
00260 public:
00261 Spread* GetNewSpread() { return(m_pNewSpread); }
00262 void SetAttachContext(Node* pContext, AttachNodeDirection Direction)
00263 {
00264 m_pContextNode = pContext;
00265 m_Direction = Direction;
00266 }
00267
00268 BOOL ConvertNodes();
00269
00270 protected:
00271 BOOL ConvertNodesForPass2();
00272 BOOL ConvertNodesForPass3();
00273 BOOL ConvertNodesForPass4();
00274 BOOL ConvertNodesForPass5();
00275
00276 void RemoveChildAttrs(Node* pNode, CCRuntimeClass* pClass);
00277 NodeAttribute* FindChildAttr(Node* pNode, CCRuntimeClass* pClass);
00278
00279 Node* RenderNodesToBitmap(Node* pFirstNode, Node* pLastNode, BOOL bNonAlphaTrans);
00280 KernelBitmap* RenderFillToBitmap(Node* pNode, DocRect& BoundsRect);
00281 KernelBitmap* RenderTransToBitmap(Node* pNode, DocRect& BoundsRect, UINT32* pTransType);
00282 KernelBitmap* RenderFillAndTransToBitmap(Node* pNode, DocRect& BoundsRect);
00283
00284 TextStory* ReformatTextStory(TextStory* pStory);
00285 Node* ReformatTextLine(TextLine* pLineNode, FormatRegion* pFormatRegion);
00286 BOOL CopyAttributesFromNode(Node* pDestNode, Node* pSrcNode);
00287
00288 BOOL DoesNodeUseNonAlphaTrans(Node* pRootNode);
00289 BOOL FindCommonTransTypeToApply(Node* pFirstNode, Node* pLastNode, UINT32* pCommonType);
00290
00291 private:
00292 INT32 m_ConvertPass;
00293 PluginNativeFilter* m_pFilter;
00294 XPFRenderRegion* m_pXPFRegion;
00295 CapabilityTree* m_pCapTree;
00296 Spread* m_pNewSpread;
00297 Node* m_pContextNode;
00298 AttachNodeDirection m_Direction;
00299 Node* m_pSpanParent;
00300 List m_ConvertList;
00301 List m_ParentList;
00302 };
00303
00304
00305
00306 class XPFSpanRenderCallback : public RenderCallback
00307 {
00308 public:
00309 typedef enum
00310 {
00311 RS_BEFORESPAN = 0,
00312 RS_INSPAN,
00313 RS_AFTERSPAN,
00314 } RenderStateType;
00315
00316 XPFSpanRenderCallback(Node* pFirst, Node* pLast, BOOL bBackground)
00317 {
00318 m_pFirstNode = pFirst;
00319 m_pLastNode = pLast;
00320 m_bBackground = bBackground;
00321 m_RenderState = RS_BEFORESPAN;
00322 }
00323
00324 virtual BOOL BeforeNode(RenderRegion* pRegion, Node* pNode);
00325 virtual BOOL BeforeSubtree(RenderRegion* pRegion, Node* pNode, Node** ppNextNode, BOOL bClip, SubtreeRenderState* pState);
00326 virtual BOOL AfterSubtree(RenderRegion* pRegion, Node* pNode);
00327
00328 protected:
00329 Node* m_pFirstNode;
00330 Node* m_pLastNode;
00331 BOOL m_bBackground;
00332 RenderStateType m_RenderState;
00333 };
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 class XPFView : public View
00350 {
00351 CC_DECLARE_DYNAMIC(XPFView);
00352 public:
00353 virtual ~XPFView();
00354 BOOL Init(double DPI);
00355
00356 public:
00357 virtual BOOL ViewStateChanged();
00358
00359 public:
00360 virtual void SetViewPixelSize();
00361
00362 public:
00363 virtual void ContinueRenderView(RenderRegion*, Spread*, BOOL = TRUE, BOOL = TRUE,
00364 BOOL bForceImmediate = FALSE);
00365 virtual CNativeDC *GetRenderDC();
00366
00367 public:
00368 virtual BOOL GetForeBackMode();
00369 virtual void SetForeBackMode(BOOL);
00370 virtual double GetConvertToEditableShapesDPI();
00371
00372 public:
00373 virtual DocRect GetDocViewRect(Spread*);
00374 virtual void SetExtent(DocCoord, DocCoord);
00375 virtual WorkRect GetViewRect();
00376
00377 protected:
00378 double m_DPI;
00379 };
00380
00381
00382
00383 #endif // INC_XPFRGN