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 #ifndef INC_VIEW
00102 #define INC_VIEW
00103
00104 #include "listitem.h"
00105 #include "quality.h"
00106 #include "matrix.h"
00107 #include "docrect.h"
00108 #include "rendtype.h"
00109 #include "oilrect.h"
00110 #include "rndrgn.h"
00111 #include "colcarry.h"
00112 #include "colmodel.h"
00113
00114
00115 class CCamView;
00116 class ViewState;
00117 class Document;
00118 class wxDC;
00119 class RenderRegion;
00120 class ScanningRenderRegion;
00121 class Spread;
00122 class PaperRenderRegion;
00123 class Node;
00124 class PrintControl;
00125
00126 #ifndef WEBSTER
00127 class CCPrintInfo;
00128 #endif //webster
00129 class ColourPlate;
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 class ProgressDisplay
00145 {
00146 public:
00147 ProgressDisplay();
00148
00149
00150 void SetUp(RenderRegion *pRender, ScanningRenderRegion* pScanner);
00151 BOOL IncProgress(INT32 NumNodes = 1);
00152 BOOL FirstStageDone();
00153 BOOL SecondStageDone();
00154 void AllStagesDone();
00155 void StartBitmapPhase(INT32 NumBands);
00156 void StartBitmapPhaseBand(INT32 TotalNumScanlines);
00157 BOOL BitmapPhaseBandRenderedTo(INT32 ScanlinesRendered);
00158 BOOL EndBitmapPhaseBand();
00159
00160
00161
00162 void SetUpOptimal(RenderRegion *pRender, ScanningRenderRegion* pScanner);
00163 BOOL SetNodesRendered(INT32 NumNodes);
00164
00165 protected:
00166
00167 BOOL DoProgressDisplay;
00168 BOOL IsPrinting;
00169 INT32 NumNodesRendered;
00170 INT32 LastProgressUpdate;
00171
00172
00173 INT32 ProgressInterval;
00174 INT32 FirstStageCount;
00175 INT32 SecondStageCount;
00176 INT32 ThirdStageCount;
00177
00178
00179 INT32 BandSize;
00180 INT32 BandHeight;
00181 INT32 BandOffset;
00182 INT32 BandIncrement;
00183
00184
00185 INT32 TotalNodes;
00186
00187 #ifndef WEBSTER
00188
00189 CCPrintInfo *pPrintInfo;
00190 #endif //webster
00191
00192 INT32 ProgressScaleFactor;
00193 };
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204 enum RenderViewResult
00205 {
00206 RENDERVIEW_SUCCESS,
00207 RENDERVIEW_NOTNEEDED,
00208 RENDERVIEW_FAILURE,
00209 RENDERVIEW_USERABORT
00210 };
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 class View : public ListItem
00229 {
00230 CC_DECLARE_DYNAMIC(View);
00231
00232 public:
00233 View();
00234 virtual ~View();
00235 static void Deinit();
00236
00238
00239
00240 protected:
00241 CCamView* pViewWindow;
00242 Document* pDoc;
00243 ViewState* pVState;
00244
00245 public:
00246 BOOL ConnectToOilView(CCamView*);
00247
00248 Document* GetDoc() const;
00249 CCamView* GetConnectionToOilView() const;
00250 PrintControl *GetPrintControl();
00251
00252 virtual void SetViewState(ViewState*);
00253 virtual BOOL ViewStateChanged() = 0;
00254
00255
00257
00258
00259 protected:
00260 static View* Current;
00261
00262 public:
00263 static View* GetCurrent();
00264 BOOL SetCurrent();
00265 static void SetNoCurrent();
00266
00267 virtual void SetViewPixelSize() = 0;
00268
00270
00271
00272 public:
00273 void OnDraw(wxDC*, OilRect);
00274 virtual void ContinueRenderView(RenderRegion*, Spread*,
00275 BOOL fRenderPaper = TRUE,
00276 BOOL fDeleteRegionAfter = TRUE,
00277 BOOL bForceImmediate = FALSE) = 0;
00278 virtual wxDC* GetRenderDC() = 0;
00279 virtual void AllocateDC();
00280 virtual void DoneWithDC();
00281 virtual BOOL RenderTreeCallback(Node* pNode, RenderRegion* pRender) {return TRUE;}
00282
00283 Quality RenderQuality;
00284
00285
00286
00287 RenderViewResult RenderOptimalView(RenderRegion*r, Matrix&, Spread*, BOOL);
00288 SlowJobResult RenderOptimalBitmapPhase(DocRect& ClipRect, Matrix&, Spread*, RenderRegion*, Node*, Node*,
00289 BOOL RenderAllObjects, BOOL bPrintPaper, INT32&, ProgressDisplay* pProgress, INT32 TotalProgress);
00290
00291 virtual RenderViewResult RenderSimpleView(RenderRegion*, Matrix&, Spread*, BOOL);
00292 SlowJobResult RenderBitmapPhase(DocRect& ClipRect, Matrix&, Spread*, RenderRegion*, Node*, Node*,
00293 BOOL bRenderAll, BOOL bPrintPaper, ProgressDisplay& Progress);
00294
00295 static void DeInitOnTopRegion();
00296 static BOOL IsPrintableNodeSelected(Node *);
00297
00298 virtual void RenderPaper(Spread*, DocRect, wxDC*, Matrix&);
00299 virtual BOOL RenderPageMarks(RenderRegion*, Matrix&, DocRect&, Spread*);
00300
00301 protected:
00302 virtual void RenderPaper(RenderRegion*, Spread*);
00303
00304 SlowJobResult RenderSimpleNodes(Node *pNode, RenderRegion *pRender,
00305 ProgressDisplay& Progress, Node *pLastComplexNode = NULL);
00306 SlowJobResult RenderSimpleNodesUnclipped(Node *pNode, RenderRegion *pRender,
00307 ProgressDisplay& Progress, Node *pLastComplexNode = NULL);
00308
00309 private:
00310 static PaperRenderRegion* pPaperRegion;
00311
00312
00313 static PaperRenderRegion* pOnTopRegion;
00314
00315
00316
00317
00318 public:
00319 virtual BOOL GetForeBackMode() = 0;
00320 virtual void SetForeBackMode(BOOL) = 0;
00321
00322 virtual Matrix ConstructRenderingMatrix(Spread *pSpread);
00323
00324 virtual Matrix ConstructScaledRenderingMatrix(Spread *pSpread, double ScaleFactor);
00325
00326 protected:
00327 RenderRegion *NewRenderRegion(DocRect InvalidRect, Matrix& ViewMatrix,
00328 wxDC* pDevContext, Spread* pSpread, RenderType rType,
00329 bool fOwned = false );
00330
00331
00332 virtual void MakeNewRenderRegion(Spread *, DocRect, wxDC *, RenderType, BOOL PaintPaper = FALSE, Node* pInvalidNode = NULL);
00333
00334 public:
00335
00336 FIXED16 GetPixelWidth();
00337 FIXED16 GetPixelHeight();
00338 void GetPixelSize(FIXED16 *PixelWidth, FIXED16 *PixelHeight);
00339 virtual void SetPixelSize(FIXED16 PixelWidth, FIXED16 PixelHeight);
00340
00341 FIXED16 GetScaledPixelWidth();
00342 FIXED16 GetScaledPixelHeight();
00343 void GetScaledPixelSize(FIXED16 *PixelWidth, FIXED16 *PixelHeight);
00344 virtual void SetScaledPixelSize(FIXED16 PixelWidth, FIXED16 PixelHeight);
00345
00346 virtual double GetConvertToEditableShapesDPI();
00347
00348 protected:
00349
00350 FIXED16 PixelWidth,
00351 PixelHeight;
00352
00353
00354 FIXED16 ScaledPixelWidth,
00355 ScaledPixelHeight;
00356
00357
00358 public:
00359 ColourContext *GetColourContext(ColourModel Model, BOOL ReturnNULLIfNone = FALSE);
00360
00361
00362 ColourPlate *GetColourPlate(void);
00363
00364
00365 void SetColourPlate(ColourPlate *NewPlate, BOOL bSendContextChanged = TRUE);
00366
00367
00368
00369 void SetColourContext(ColourModel Model, ColourContext *NewContext = NULL);
00370
00371
00372
00373
00374 BOOL GetForceDefaultColourContexts(void) { return(ForceDefaultColourContexts); }
00375
00376 BOOL SetForceDefaultColourContexts(BOOL bForceDefault = TRUE)
00377 {
00378 BOOL bOldForce = ForceDefaultColourContexts;
00379 ForceDefaultColourContexts = bForceDefault;
00380 return(bOldForce);
00381 }
00382
00383 protected:
00384 ColourPlate *ColPlate;
00385 ColourContextArray ColourContexts;
00386 BOOL ShouldDeleteContext[16];
00387
00388 BOOL ForceDefaultColourContexts;
00389
00390
00391
00392
00393
00394
00396
00397
00398 protected:
00399 FIXED16 Scale;
00400 DocRect PhysExtent;
00401
00402 public:
00403 WorkCoord GetScrollOffsets() const;
00404 virtual BOOL SetScrollOffsets(WorkCoord, BOOL RedrawNeeded = TRUE);
00405
00406 FIXED16 GetViewScale() const;
00407 virtual BOOL SetViewScale(FIXED16);
00408
00409 virtual DocRect GetDocViewRect(Spread*) = 0;
00410 virtual void SetExtent(DocCoord, DocCoord) = 0;
00411 virtual WorkRect GetViewRect() = 0;
00412
00413
00415
00416
00417 protected:
00418 BOOL m_bSolidDrag;
00419
00420 };
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443 class ScopedFlagSetter
00444 {
00445 public:
00446 ScopedFlagSetter(BOOL& bTarget, BOOL bNewVal)
00447 {
00448
00449 m_pbTarget = &bTarget;
00450 m_bOldVal = bTarget;
00451
00452 bTarget = bNewVal;
00453 }
00454
00455 ~ScopedFlagSetter()
00456 {
00457
00458 *m_pbTarget = m_bOldVal;
00459 }
00460 BOOL m_bOldVal;
00461 BOOL* m_pbTarget;
00462 };
00463
00464
00465
00466 #endif // INC_VIEW