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_REGSHAPETOOL
00101 #define INC_REGSHAPETOOL
00102
00103
00104
00105 #include "nodershp.h"
00106 #include "shapeops.h"
00107
00108
00109
00110 #include "dragtool.h"
00111
00112 class Cursor;
00113 class Spread;
00114 class QuickShapeBaseInfoBarOp;
00115 class EditRegularShapeParam;
00116
00117 const INT32 MAX_EDIT_FIELD_LENGTH = 5;
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 class CCAPI QuickShapeBase : public DragTool
00131 {
00132 CC_DECLARE_MEMDUMP(QuickShapeBase);
00133
00134 public:
00135 QuickShapeBase();
00136 ~QuickShapeBase();
00137
00138
00139 BOOL Init();
00140
00141
00142 void SelectChange(BOOL isSelected);
00143 void OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00144 void OnMouseMove(DocCoord PointerPos,Spread* pSpread, ClickModifiers ClickMods);
00145 BOOL GetStatusLineText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00146
00147
00148 QuickShapeBaseInfoBarOp* GetInfoBar() { return pQuickShapeBaseInfoBarOp; }
00149
00150 enum EditModeIDS {EDITF_CENTRE, EDITF_MAJOR, EDITF_STELLATION, EDITF_CURVE, EDITF_SIZE, EDITF_ROT};
00151 EditModeIDS EditFieldMode;
00152 EditModeIDS EditFieldOptions[MAX_EDIT_FIELD_LENGTH];
00153
00154
00155 virtual INT32 GetNumSides() = 0;
00156 virtual INT32 GetCreationMode() = 0;
00157 virtual BOOL GetPolygon() = 0;
00158 virtual BOOL GetStellation() = 0;
00159 virtual BOOL GetCurved() = 0;
00160 virtual void SetNumSides(INT32 NewValue) = 0;
00161 virtual void SetCreationMode(INT32 NewValue) = 0;
00162 virtual void SetPolygon(BOOL NewValue) = 0;
00163 virtual void SetStellation(BOOL NewValue) = 0;
00164 virtual void SetCurved(BOOL NewValue) = 0;
00165
00166 virtual BOOL ForcePolygonToGrey() = 0;
00167 virtual BOOL ForceEllipseToGrey() = 0;
00168 virtual BOOL ForceStellationToGrey() = 0;
00169 virtual BOOL ForceCurvatureToGrey() = 0;
00170 virtual BOOL ForceNumSidesToGrey() = 0;
00171 virtual BOOL IsInterestingShape(NodeRegularShape* pShape) = 0;
00172 virtual INT32 GetShapesToAffect() =0;
00173 virtual BOOL DoesPolygonExist() = 0;
00174 virtual BOOL DoesEllipseExist() = 0;
00175 virtual BOOL DoesStellationExist() = 0;
00176 virtual BOOL DoesCurvatureExist() = 0;
00177 virtual BOOL DoesReformSidesExist() = 0;
00178 virtual BOOL DoesNumSidesExist() = 0;
00179 virtual INT32 GetCursorID() = 0;
00180 virtual INT32 GetShapeID() = 0;
00181 virtual INT32 GetShapesID() = 0;
00182 virtual BOOL CanReformEdges() {return FALSE;};
00183
00184 virtual BOOL IsEllipse() {return FALSE;};
00185 virtual BOOL IsRectangle() {return FALSE;};
00186
00187 protected:
00188 void DisplayStatusBarHelp(DocCoord DocPos, Spread* pSpread, ClickModifiers ClickMods);
00189 void GetCurrentStatusLineText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
00190 ShapeClickEffect DetermineClickEffect(DocCoord PointerPos, Spread* pSpread, NodeRegularShape** ReturnShape = NULL);
00191 void ExpandShapeString(StringBase* pString, INT32 StringID, BOOL Singular);
00192
00193 QuickShapeBaseInfoBarOp* pQuickShapeBaseInfoBarOp;
00194
00195 BOOL CreateCursors();
00196 void DestroyCursors();
00197
00198 Cursor* pcNormalCursor;
00199 Cursor* pcBlobCursor;
00200 Cursor* pcEdgeCursor;
00201 Cursor* pcCurrentCursor;
00202 INT32 CurrentCursorID;
00203
00204
00205 DocCoord OldDeterminePos;
00206 Spread* OldDetermineSpread;
00207 NodeRegularShape* OldDetermineShape;
00208 ShapeClickEffect OldDetermineResult;
00209 };
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 class QuickShapeBaseInfoBarOp : public InformationBarOp
00223 {
00224 CC_DECLARE_DYNCREATE( QuickShapeBaseInfoBarOp )
00225
00226 public:
00227 QuickShapeBaseInfoBarOp( QuickShapeBase *pTool = NULL, ResourceID r=_R(IDD_REGSHAPETOOLBAR) )
00228 {
00229 DlgResID = r;
00230 pQuickShapeBase = pTool;
00231 ChangeMode = FALSE;
00232 CurrentSpread = NULL;
00233 BumpAmount = 0;
00234 PreviousCurvature = FALSE;
00235 PreviousStellation = FALSE;
00236 PreviousCircular = FALSE;
00237 };
00238
00239 MsgResult Message(Msg* Msg);
00240 MsgResult DialogMessage(DialogMsg* Msg);
00241 BOOL InitialiseInfobar();
00242 BOOL SetBarFromSelection();
00243
00244
00245 INT32 GetCreationMode();
00246 void SetCreationMode(INT32 NewMode);
00247
00248
00249 BOOL IsPolygonCreate();
00250 void SetPolygonCreate(BOOL PolygonCreate);
00251
00252
00253 BOOL IsStellationCreate();
00254 void SetStellationCreate(BOOL StellationCreate);
00255
00256
00257 BOOL IsCurvedCreate();
00258 void SetCurvedCreate(BOOL CurvedCreate);
00259
00260
00261 INT32 GetNumSides(BOOL Error);
00262 void SetNumSides(INT32 NumberSides);
00263
00264
00265 BOOL AreShapesSelected();
00266 void SetToolMode();
00267 void UpdateInfobar();
00268 void BuildEditMenu(BOOL UpdateImmediate = FALSE);
00269 void UpdateEditFields(NodeRegularShape* ShapeToShow = NULL, Spread* ShapeSpread = NULL);
00270 BOOL SetEdit(CGadgetID gid, INT32 nValue, BOOL PaintNow);
00271 BOOL SetEditPosition(CGadgetID gidX, CGadgetID gidY, DocCoord loc, Spread* pSpread, BOOL PaintNow);
00272 BOOL EditCommit(BOOL UpperCommit);
00273 BOOL GetFieldCoord(DocCoord* pCoord, Spread* pSpread);
00274 BOOL BumpLeft();
00275 BOOL BumpRight();
00276 BOOL BumpUp();
00277 BOOL BumpDown();
00278 void SetHelp();
00279 BOOL IsEnabled(CGadgetID gid);
00280
00281 BOOL EditCommitCentre(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00282 BOOL EditCommitSizeAndRotation(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00283 BOOL EditCommitStellation(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00284 BOOL EditCommitCurvature(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00285 BOOL EditCommitWidthAndHeight(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00286 BOOL EditCommitRotation(BOOL UpperCommit, EditRegularShapeParam* ChangeData);
00287
00288 double RestrictAngleZero360(double Current);
00289 double RestrictAngleMinus180(double Current);
00290
00291
00292 QuickShapeBase* pQuickShapeBase;
00293 BOOL ChangeMode;
00294 Spread* CurrentSpread;
00295 INT32 BumpAmount;
00296 BOOL PreviousCurvature;
00297 BOOL PreviousStellation;
00298 BOOL PreviousCircular;
00299 };
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 class QuickShapeBaseInfoBarOpCreate : public BarCreate
00313 {
00314 public:
00315 DialogBarOp* Create() { return (new QuickShapeBaseInfoBarOp); }
00316 };
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 class CCAPI QuickShapeTool : public QuickShapeBase
00329 {
00330 CC_DECLARE_MEMDUMP(QuickShapeTool);
00331
00332 public:
00333 QuickShapeTool();
00334 ~QuickShapeTool();
00335
00336 BOOL Init();
00337 void Describe(void* InfoPtr);
00338 UINT32 GetID() { return TOOLID_REGSHAPE; };
00339
00340
00341 INT32 GetNumSides() {return NumSides;};
00342 INT32 GetCreationMode() {return CreationMode;};
00343 BOOL GetPolygon() {return CreatePolygons;};
00344 BOOL GetStellation() {return CreateStellated;};
00345 BOOL GetCurved() {return CreateCurved;};
00346 void SetNumSides(INT32 NewValue);
00347 void SetCreationMode(INT32 NewValue);
00348 void SetPolygon(BOOL NewValue);
00349 void SetStellation(BOOL NewValue);
00350 void SetCurved(BOOL NewValue);
00351 BOOL ForcePolygonToGrey() {return FALSE;};
00352 BOOL ForceEllipseToGrey() {return FALSE;};
00353 BOOL ForceStellationToGrey() {return FALSE;};
00354 BOOL ForceCurvatureToGrey() {return FALSE;};
00355 BOOL ForceNumSidesToGrey() {return FALSE;};
00356 BOOL DoesPolygonExist() {return TRUE;};
00357 BOOL DoesEllipseExist() {return TRUE;};
00358 BOOL DoesStellationExist() {return TRUE;};
00359 BOOL DoesCurvatureExist() {return TRUE;};
00360 BOOL DoesReformSidesExist() {return TRUE;};
00361 BOOL DoesNumSidesExist() {return TRUE;};
00362 BOOL IsInterestingShape(NodeRegularShape* pShape);
00363 INT32 GetShapesToAffect() {return EditRegularShapeParam::AFFECT_ALL;};
00364 INT32 GetCursorID() {return _R(IDC_REGSHAPETOOLCURSOR);};
00365 INT32 GetShapeID() {return _R(IDS_REGSHAPE_SINGULAR);};
00366 INT32 GetShapesID() {return _R(IDS_REGSHAPE_PLURAL);};
00367 BOOL CanReformEdges() {return TRUE;};
00368
00369
00370 private:
00371
00372
00373 static INT32 CreationMode;
00374 static INT32 NumSides;
00375 static BOOL CreatePolygons;
00376 static BOOL CreateStellated;
00377 static BOOL CreateCurved;
00378
00379
00380 static TCHAR* FamilyName;
00381 static TCHAR* ToolName;
00382 static TCHAR* Purpose;
00383 static TCHAR* Author;
00384 };
00385
00386
00387
00388 #endif // INC_REGSHAPETOOL
00389
00390
00391
00392