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_INK
00102 #define INC_INK
00103
00104 #include "node.h"
00105 #include "clikmods.h"
00106 #include "binds.h"
00107 #include "bitmap.h"
00108
00109 class Spread;
00110 class RenderRegion;
00111 class BaseDocument;
00112 class Cursor;
00113 class ContextMenu;
00114 class CCAttrMap;
00115 class BlendNodeParam;
00116 class AttrFillGeometry;
00117 class AttrBrushType;
00118 class AttrStrokeType;
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 class NodeRenderableInk: public NodeRenderableBounded
00140 {
00141 CC_DECLARE_DYNAMIC( NodeRenderableInk )
00142
00143 public:
00144
00145 static BOOL Init();
00146
00147 NodeRenderableInk();
00148
00149 NodeRenderableInk(Node* ContextNode,
00150 AttachNodeDirection Direction,
00151 BOOL Locked=FALSE,
00152 BOOL Mangled=FALSE,
00153 BOOL Marked=FALSE,
00154 BOOL Selected=FALSE);
00155
00156 virtual BOOL IsAnObject() const;
00157 virtual BOOL IsSetCandidate() const;
00158 virtual BOOL IsRenderedAsInk() const {return TRUE;}
00159
00160
00161
00162
00163 virtual BOOL CanTransform();
00164
00165
00166 virtual BOOL ExportRender ( RenderRegion *pRender );
00167
00168
00169
00170 virtual void RenderAppliedFillBlobs(RenderRegion* pRender);
00171 virtual void RenderArtisticBlobs(RenderRegion* pRender);
00172 virtual void RenderEorDrag( RenderRegion* );
00173 virtual void RenderEffectBlobs(RenderRegion* pRender);
00174
00175
00176 virtual void RenderEorDragChildren(RenderRegion * pRender);
00177
00178
00179 virtual BOOL ChildrenAreEorDragRenderedByMe() { return FALSE; }
00180
00181 virtual void ClearSubSelection( BOOL ReDraw );
00182 virtual BOOL CanSelectAsCompoundParent();
00183 virtual BOOL CanSelectAsSimple();
00184
00185
00186 virtual BOOL OnClick(DocCoord, ClickType, ClickModifiers, Spread*);
00187 virtual BOOL OnMouseMove(const DocCoord&, Spread*, ClickModifiers);
00188 virtual BOOL GetStatusInfo(String_256** ppStatusText, Cursor** ppStatusCursor);
00189 virtual BOOL OnBlobPopUp(Spread*, DocCoord, ContextMenu*);
00190 virtual BOOL OnNodePopUp(Spread*, DocCoord, ContextMenu*);
00191
00192
00193
00194
00195 enum SelStateAction { CLEAR, SET, TOGGLE };
00196
00197
00198 static void DeselectAll(BOOL RenderBlobs = TRUE, BOOL InformImmediate = TRUE);
00199 virtual void SelectInRect(const DocRect& Rect, SelStateAction st);
00200
00201
00202 static void DeselectAllOnLayer(Layer* Layer);
00203 static void SelectAllInRect( DocRect, Spread*, SelStateAction st = SET );
00204
00205
00206 void RedrawObject();
00207
00208
00209 void ApplyAttributeToObject(NodeAttribute* Attribute, BOOL Redraw);
00210 BOOL ApplyAttributes(CCAttrMap* pAttribMap,BOOL RequiredAttrsOnly = FALSE);
00211
00212
00213 virtual BOOL RequiresAttrib(CCRuntimeClass* AttribClass, BOOL Search = FALSE);
00214
00215
00216 virtual BOOL RequiresAttrib(NodeAttribute* pAttrib, BOOL Search = FALSE);
00217
00218
00219 virtual BOOL CanAttrBeAppliedToMe(CCRuntimeClass* AttrType);
00220
00221
00222 virtual NodeRenderableInk* GetObjectToApplyTo(CCRuntimeClass* AttrType);
00223
00224
00225 virtual CCRuntimeClass* GetCurrentAttribGroup();
00226
00227 NodeAttribute* GetChildAttrOfType(CCRuntimeClass* ReqdAttrib);
00228 BOOL HasAttrTypesOn(NodeRenderableInk* Object);
00229
00230 BOOL CopyChildrenAsShapes(Node* pDestin);
00231
00232
00233 virtual BOOL ReadPostChildrenWeb(BaseCamelotFilter* pFilter);
00234 virtual BOOL ReadPostChildrenNative(BaseCamelotFilter* pFilter);
00235
00236 virtual BOOL WriteBeginChildRecordsWeb(BaseCamelotFilter* pFilter);
00237 virtual BOOL WriteBeginChildRecordsNative(BaseCamelotFilter* pFilter);
00238 virtual BOOL WriteEndChildRecordsWeb(BaseCamelotFilter* pFilter);
00239 virtual BOOL WriteEndChildRecordsNative(BaseCamelotFilter* pFilter);
00240
00241 virtual BOOL WriteBoundsRecord(BaseCamelotFilter* pFilter);
00242 virtual BOOL WillWriteBounds(BaseCamelotFilter* pFilter);
00243
00244
00245 virtual BOOL AreYouSafeToRender();
00246
00247
00248
00249
00250
00251 AttrBrushType* GetAppliedBrushAttribute();
00252
00253 AttrStrokeType* GetActiveStroke();
00254
00255 virtual NodePath* GetVariableWidthStrokePath();
00256 virtual NodePath* GetSmoothVariableWidthStrokePath();
00257
00258 virtual BOOL GetAreaDetails(XLONG* pxlArea, XLONG* pXLPerimeter) {return FALSE;}
00259
00260 virtual BOOL CanSupplyDirectBitmap() {return FALSE;}
00261 virtual BOOL GetDirectBitmap(RenderRegion* pRender, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect, Matrix* pMat, double* pdRes) {return FALSE;}
00262 virtual BOOL RenderDirectBitmapState(RenderRegion* pRender) {return FALSE;}
00263
00264 private:
00265 BOOL SafeToRender;
00266
00267 protected:
00268
00269 BOOL CalculatePathBoundingRect(Path& BoundPath, BOOL DontUseAttrs, DocRect* pRect);
00270
00271 virtual Node* SimpleCopy(void);
00272
00274
00275
00276 public:
00277
00278
00279 static NodeRenderableInk* FindSimpleAtPoint(Spread* pSpread,
00280 DocCoord dcPoint,
00281 Node* pHighNode = NULL,
00282 Node** ppInterruptNode = NULL);
00283
00284 static NodeRenderableInk* FindSimpleAtPointForColourPicker(Spread* pSpread,
00285 DocCoord dcPoint,
00286 Pixel32bpp& Pix,
00287 Node* pHighNode = NULL,
00288 Node** ppInterruptNode = NULL);
00289
00290
00291 static NodeRenderableInk* FindColourForNodeRenderableAtPoint (Spread* pSpread,
00292 DocCoord dcPoint,
00293 Pixel32bpp& Pix,
00294 Node* pThisNode,
00295 AttrFillGeometry* pThisFill);
00296
00297 static NodeRenderableInk* FindCompoundAtPoint(Spread* pSpread, DocCoord dcPoint, Node* pHighNode = NULL);
00298
00299
00300 static NodeRenderableInk* FindCompoundFromSimple(NodeRenderableInk* pSimpleNode,
00301 Node* pSiblingNode = NULL);
00302
00303
00304
00305 static NodeRenderableInk* FindInnerCompound(Node* pLowNode, Node* pHighNode);
00306
00307
00308
00309 BOOL FindAppliedAttributes(CCAttrMap* pAttribMap,
00310 INT32 nMax = 5000,
00311 INT32* nFound = NULL,
00312 BOOL ExcludeIndirectlyAppliedGLAs = FALSE,
00313 BOOL bStrictEffectStatus = TRUE) const;
00314
00315 BOOL FindAppliedAttribute(CCRuntimeClass* AttribType, NodeAttribute** pAttrFound, BOOL bStrict = TRUE);
00316 NodeAttribute* FindAppliedAttribute(CCRuntimeClass* AttribType, BOOL bExcludeChildAttrs = FALSE, BOOL bStrict = TRUE);
00317
00318
00319 virtual BOOL IsValidEffectAttr(NodeAttribute* pAttr) const {return FALSE;}
00320
00321
00322
00323 void DeleteAppliedAttributes();
00324
00326
00327 BOOL AddChildAttrTypesToSet(AttrTypeSet* pAttrTypeSet);
00328
00329
00330
00331
00332 static void ClearAttribMap();
00333
00334
00335 virtual NodeRenderableInk* FindNodeAtPointHelper(const Spread* pSpread, const DocCoord dcPoint) {return this;}
00336
00337 private:
00338
00339
00340 static BOOL bUseSmartClicks;
00341 static BOOL AverageHitColour;
00342
00343 static CCAttrMap* pAttribMap;
00344 static INT32 nFoundAttributes;
00345 static INT32 nMaxAttributes;
00346
00347 void RenderAppliedAttributes(RenderRegion* pRegion) const;
00348 void RenderAppliedClipAttributes(RenderRegion* pRender) const;
00349
00350 static Node* FindFirstHitTest(Spread* pStartSpread,
00351 const DocRect& drClickRect,
00352 CCAttrMap* pAttribMap,
00353 BOOL bExcludeLayers,
00354 Node* pHighNode = NULL );
00355
00356 static Node* FindNextHitTest(Node* pNode,
00357 const DocRect& drClickRect,
00358 CCAttrMap* pAttribMap,
00359 BOOL bExcludeLayers,
00360 BOOL bSkipChildren = FALSE);
00361
00362 static BOOL HitTestChildren(Node* pNode,
00363 const DocRect& drClickRect,
00364 BOOL bExcludeLayers);
00365
00366
00368
00369
00370 public:
00371
00372 BOOL MakeAttributeComplete(Node* Root = NULL,
00373 BOOL CheckForDuplicates = TRUE,
00374 AttrTypeSet* pAffectedAttrTypes = NULL,
00375 BOOL IncludeDefaults = FALSE,
00376 BOOL bIncludeEffectAttrs = FALSE);
00377
00378 void NormaliseAttributes();
00379
00380 BOOL FactorOutCommonChildAttributes(BOOL Global = FALSE,
00381 AttrTypeSet* pAffectedAttrTypes = NULL);
00382
00383 BOOL LocaliseCommonAttributes(BOOL CheckForDuplicates = FALSE,
00384 BOOL Global = FALSE,
00385 AttrTypeSet* pAffectedAttrTypes = NULL,
00386 BOOL RecursiveDownwards = FALSE);
00387
00388 public:
00389
00390
00391
00392 virtual BOOL BeginBlendStep(BlendNodeParam * pParam) { return TRUE; }
00393
00394
00395 virtual BOOL EndBlendStep(BlendNodeParam * pParam) { return TRUE; }
00396
00397 private:
00398 BOOL FactorOutCommonChildAttrHelper(BOOL Global,
00399 AttrTypeSet* pAffectedAttrTypes);
00400
00401 BOOL LocaliseCommonAttrHelper(BOOL CheckForDuplicates,
00402 BOOL Global,
00403 AttrTypeSet* pAffectedAttrTypes,
00404 BOOL RecursiveDownwards = FALSE);
00405
00406
00407 void DeleteLocalisedAttributes(BOOL Global = FALSE,
00408 AttrTypeSet* pAffectedAttrTypes = NULL);
00409
00410 void DeleteFactoredOutAttribs(BOOL Global = FALSE,
00411 AttrTypeSet* pAffectedAttrTypes = NULL);
00412
00413
00414
00415
00416
00417
00418
00419
00420 BOOL FindReqdAttribs(List* ReqdAttribList);
00421 void RemoveSuperfluousAttribs();
00422
00423
00424 BOOL FindCommonAttributesToFactorOut(CommonAttrSet* CommonAttributeSet);
00425
00426 public:
00427 virtual BOOL SetParentLayerAsEdited();
00428
00429 public:
00430 virtual BOOL IsSeeThrough(BOOL CheckIndirectAttrs);
00431 };
00432
00433 #endif