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 #ifndef INC_GUIDES_H
00101 #define INC_GUIDES_H
00102
00103
00104
00105
00106 #include "snap.h"
00107
00108 #if !defined(EXCLUDE_FROM_RALPH)
00109 #include "optsgrid.h"
00110 #endif
00111
00112 class RenderRegion;
00113 class Spread;
00114 class ContextMenu;
00115 class KeyPress;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 class NodeGuideline : public NodeRenderableInk
00131 {
00132 CC_DECLARE_DYNAMIC( NodeGuideline )
00133
00134 public:
00135 NodeGuideline();
00136
00137 virtual String Describe(BOOL Plural, BOOL Verbose);
00138
00139 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00140 virtual void Render( RenderRegion* pRender );
00141 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00142 virtual BOOL OnClick( DocCoord PointerPos, ClickType Click, ClickModifiers ClickMods, Spread *pSpread );
00143 virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00144 virtual void SetSelected(BOOL Status);
00145 virtual void Transform( TransformBase& Trans );
00146
00147 virtual void PreExportRender(RenderRegion* pRegion);
00148 virtual BOOL ExportRender(RenderRegion* pRegion);
00149 virtual BOOL NeedsToExport(RenderRegion *pRender,BOOL VisibleLayersOnly = FALSE, BOOL CheckSelected = FALSE);
00150
00151 static DocRect GetRenderRect(MILLIPOINT Ordinate,GuidelineType Type,BOOL HitTest= FALSE, RenderRegion* pRender = NULL);
00152 DocRect GetRenderRect(BOOL HitTest = FALSE, RenderRegion* pRender = NULL);
00153
00154 #ifdef _DEBUG
00155 virtual void ShowDebugTreeDetails() const;
00156 #endif
00157
00158 virtual void GetDebugDetails(StringBase* Str);
00159
00160 virtual BOOL Snap(DocCoord* pDocCoord);
00161 virtual BOOL Snap(DocRect* pDocRect,const DocCoord& PrevCoord,const DocCoord& CurCoord);
00162
00163 void SetType(GuidelineType NewType) { Type = NewType; }
00164 GuidelineType GetType() { return Type; }
00165
00166 void MakeHorzGuideline() { Type = GUIDELINE_HORZ; }
00167 void MakeVertGuideline() { Type = GUIDELINE_VERT; }
00168
00169
00170 void SetOrdinate(MILLIPOINT NewOrdinate) { Ordinate = NewOrdinate; }
00171 MILLIPOINT GetOrdinate() { return Ordinate; }
00172
00173
00174 static MILLIPOINT ToSpreadOrdinate(Spread* pSpread,MILLIPOINT UserOrdinate,GuidelineType Type);
00175 static MILLIPOINT ToUserOrdinate(Spread* pSpread,MILLIPOINT SpreadOrdinate,GuidelineType Type);
00176
00177 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00178
00179
00180 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00181 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00182
00183 private:
00184 virtual Node* SimpleCopy();
00185 void CopyNodeContents(NodeGuideline* NodeCopy);
00186
00187 MILLIPOINT ExtractOrdinate(DocCoord* pDocCoord);
00188 void ReplaceOrdinate(DocCoord* pDocCoord,MILLIPOINT Ordinate);
00189 void TranslateRect(DocRect* pDocRect,MILLIPOINT Delta);
00190
00191 static MILLIPOINT GetScaledPixelWidth(RenderRegion* pRender = NULL);
00192
00193
00194
00195 GuidelineType Type;
00196 MILLIPOINT Ordinate;
00197 };
00198
00199
00200
00201
00202
00203 enum OpGuidelineOpMethod { GUIDELINEOPMETHOD_INVALID,
00204 GUIDELINEOPMETHOD_MOVE_DRAG,
00205 GUIDELINEOPMETHOD_NEW_DRAG,
00206 GUIDELINEOPMETHOD_MOVE_IMMEDIATE,
00207 GUIDELINEOPMETHOD_NEW_IMMEDIATE,
00208 GUIDELINEOPMETHOD_DELETE,
00209 GUIDELINEOPMETHOD_CREATE_GUIDE_LAYER
00210 };
00211
00212
00213
00214 #ifndef WEBSTER
00215 #if !defined(EXCLUDE_FROM_RALPH)
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 class OpGuidelineParam : public OpParam
00228 {
00229 CC_DECLARE_MEMDUMP(OpGuidelineParam)
00230
00231 public:
00232 OpGuidelineOpMethod Method;
00233
00234
00235 GuidelineType Type;
00236
00237
00238 NodeGuideline* pGuideline;
00239 MILLIPOINT NewOrdinate;
00240
00241
00242 NodeGuideline** pGuidelineList;
00243 };
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255 class OpGuideline : public UndoableOperation
00256 {
00257
00258 CC_DECLARE_DYNCREATE(OpGuideline);
00259
00260 public:
00261 #define OPTOKEN_GUIDELINE _T("Guideline")
00262
00263
00264 OpGuideline();
00265 ~OpGuideline();
00266
00267 virtual void DoWithParam(OpDescriptor* pOpDesc,OpParam* pParam);
00268
00269
00270 virtual BOOL DragKeyPress(KeyPress* pKeyPress, BOOL bSolidDrag);
00271 virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL bSolidDrag);
00272 virtual void DragFinished( DocCoord PointerPos,
00273 ClickModifiers ClickMods, Spread*,
00274 BOOL Success, BOOL bSolidDrag);
00275
00276 virtual BOOL Undo();
00277 virtual BOOL Redo();
00278
00279
00280 void RenderMyDragBlobs();
00281 void RenderDragBlobs(DocRect Rect,Spread* pSpread, BOOL bSolidDrag);
00282
00283
00284 static BOOL Init();
00285 static OpState GetState(String_256* Description, OpDescriptor*);
00286 void GetOpName(String_256* OpName);
00287
00288
00289
00290
00291 static BOOL IsMouseOverRuler();
00292
00293 protected:
00294
00295 void DoDrag(Spread* pSpread,DocCoord PointerPos);
00296
00297 void DoAddNewGuideline(Spread* pSpread,DocCoord PointerPos,GuidelineType Type);
00298 void DoMoveGuideline(Spread* pSpread,DocCoord PointerPos,NodeGuideline* pGuideline);
00299
00300 BOOL DoTranslateGuideline(NodeGuideline* pGuideline,MILLIPOINT Ordinate,NodeGuideline** ppNewGuideline = NULL);
00301 BOOL DoNewGuideline(Node* pContext,AttachNodeDirection AttachDir,GuidelineType Type,MILLIPOINT Ordinate,NodeGuideline** ppNewGuideline = NULL);
00302 BOOL DoDeleteGuideline(NodeGuideline* pGuideline,BOOL TryToLeaveCopy = FALSE);
00303 BOOL DoDeleteListOfGuidelines(NodeGuideline** pGuidelineList);
00304 Layer* DoCreateGuideLayer();
00305
00306 BOOL CanLeaveCopy();
00307
00308 void UpdateStatusLineAndPointer();
00309
00310 void BroadcastGuidelineChanges(NodeGuideline* pGuideline);
00311 void BroadcastGuidelineChanges(Layer* pLayer);
00312
00313 void SetOrdinate(DocCoord& PointerPos);
00314
00315 private:
00316 OpGuidelineOpMethod OpMethod;
00317
00318
00319 Spread* pSpread;
00320 NodeGuideline* pDraggedGuideline;
00321 MILLIPOINT Ordinate;
00322 GuidelineType Type;
00323 BOOL LeaveCopy;
00324 Cursor* pCursor;
00325 UINT32 CurrentStatusHelp;
00326 INT32 CursorStackID;
00327
00328
00329 Layer* pBroadcastLayer;
00330
00331 BOOL RenderOn;
00332
00333 protected:
00334
00335 UINT32 UndoIDS;
00336 };
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 class OpDeleteGuideline : public OpGuideline
00350 {
00351
00352 CC_DECLARE_DYNCREATE(OpDeleteGuideline);
00353
00354 public:
00355 #define OPTOKEN_DELETEGUIDELINE _T("DeleteGuideline")
00356
00357
00358 OpDeleteGuideline();
00359 ~OpDeleteGuideline();
00360
00361 virtual void Do(OpDescriptor* pOpDesc);
00362
00363
00364 static OpState GetState(String_256* Description, OpDescriptor*);
00365
00366 static void SetGuideline(NodeGuideline* pThisGuideline) { pGuideline = pThisGuideline; }
00367
00368 protected:
00369 static NodeGuideline* pGuideline;
00370 };
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 class OpDeleteAllGuidelines : public OpGuideline
00383 {
00384
00385 CC_DECLARE_DYNCREATE(OpDeleteAllGuidelines);
00386
00387 public:
00388 #define OPTOKEN_DELETEALLGUIDELINES _T("DeleteAllGuidelines")
00389
00390
00391 OpDeleteAllGuidelines();
00392 ~OpDeleteAllGuidelines();
00393
00394 virtual void Do(OpDescriptor* pOpDesc);
00395
00396
00397 static OpState GetState(String_256* Description, OpDescriptor*);
00398 };
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 class OpNewGuideline : public OpGuideline
00410 {
00411 CC_DECLARE_DYNCREATE(OpNewGuideline);
00412
00413 public:
00414 #define OPTOKEN_NEWGUIDELINE2 _T("NewGuideline")
00415
00416 OpNewGuideline();
00417 ~OpNewGuideline();
00418 static BOOL Init();
00419
00420 virtual void Do(OpDescriptor* pOpDesc);
00421
00422 static OpState GetState(String_256* pReasonGreyed, OpDescriptor* pOpDesc);
00423
00424 static void SetNewGuidelineParam(GuidelineType Type, MILLIPOINT pos);
00425
00426 protected:
00427 static OpGuidelineParam NewGuidelineParam;
00428 };
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439 class OpSpreadOrigin : public OpGridResize
00440 {
00441 CC_DECLARE_DYNCREATE(OpSpreadOrigin);
00442 #define OPTOKEN_SPREADORIGIN _T("SpreadOrigin")
00443
00444 public:
00445 OpSpreadOrigin();
00446 ~OpSpreadOrigin();
00447
00448 virtual void Do(OpDescriptor* pOpDesc);
00449
00450
00451 virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL bSolidDrag);
00452 virtual void DragFinished( DocCoord PointerPos,
00453 ClickModifiers ClickMods, Spread*,
00454 BOOL Success, BOOL bSolidDrag);
00455
00456
00457 void RenderMyDragBlobs();
00458 void RenderDragBlobs(DocRect Rect,Spread* pSpread, BOOL bSolidDrag);
00459
00460
00461 static BOOL Init();
00462 static OpState GetState(String_256* Description, OpDescriptor*);
00463
00464 protected:
00465
00466 void DoDrag(Spread* pSpread,DocCoord PointerPos);
00467 BOOL DoChangeOrigin(Spread* pSpread,DocCoord NewOrigin);
00468
00469 private:
00470
00471 Spread* pSpread;
00472 DocCoord CurrentOrigin;
00473 BOOL RenderOn;
00474 };
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485 class OpResetSpreadOrigin : public OpSpreadOrigin
00486 {
00487 CC_DECLARE_DYNCREATE(OpResetSpreadOrigin);
00488 #define OPTOKEN_RESETSPREADORIGIN _T("ResetSpreadOrigin")
00489
00490 public:
00491 OpResetSpreadOrigin();
00492 static BOOL Init();
00493
00494 virtual void Do(OpDescriptor* pOpDesc);
00495 static OpState GetState(String_256* pReasonGreyed, OpDescriptor* pOpDesc);
00496 };
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507 class GuidelinePropDlgParams
00508 {
00509 public:
00510 GuidelinePropDlgParams() { pGuideline = NULL; }
00511
00512 NodeGuideline* pGuideline;
00513
00514
00515 MILLIPOINT Ordinate;
00516 GuidelineType Type;
00517 };
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 class GuidelinePropDlg: public DialogOp
00529 {
00530 CC_DECLARE_DYNCREATE( GuidelinePropDlg )
00531 #define OPTOKEN_EDITGUIDELINEPROPDLG _T("EditGuidelinePropDlg")
00532 #define OPTOKEN_NEWGUIDELINEPROPDLG _T("NewGuidelinePropDlg")
00533
00534 public:
00535 GuidelinePropDlg();
00536 void Do(OpDescriptor*);
00537
00538 static const INT32 IDD;
00539 static const CDlgMode Mode;
00540
00541 static OpState GetState(String_256*, OpDescriptor*);
00542 static BOOL Init();
00543
00544 MsgResult Message(Msg* Message);
00545
00546 void ShowDetails();
00547 BOOL CommitValues();
00548
00549 static void SetNewGuidelineParams(GuidelineType type, MILLIPOINT pos);
00550 static void SetEditGuidelineParams(NodeGuideline* pGuide);
00551
00552 private:
00553 static GuidelinePropDlgParams Params;
00554 };
00555
00556 #endif
00557 #endif
00558 #endif