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_ATTRAGGL
00101 #define INC_ATTRAGGL
00102
00103
00104
00105 class CommonAttrMultiSet;
00106 class NodeAttribute;
00107 class MultiCommonAttrItem;
00108
00109
00110
00111 inline BOOL CompareElements(const StringBase** pElement1, const StringBase** pElement2)
00112 {
00113 const StringBase* const pString1 = *pElement1;
00114 const StringBase* const pString2 = *pElement2;
00115
00116 return (*pString1 == *pString2);
00117 }
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 class CommonAttrMap : public CMap<const StringBase*, const StringBase*, MultiCommonAttrItem*, MultiCommonAttrItem*>
00128 {
00129 public:
00130 CommonAttrMap(INT32 nBlockSize = 10) : CMap<const StringBase*, const StringBase*, MultiCommonAttrItem*, MultiCommonAttrItem*>(nBlockSize) {}
00131
00132
00133 };
00134
00135
00136 class NodePointer : public ListItem
00137 {
00138
00139 CC_DECLARE_MEMDUMP(NodePointer);
00140 public:
00141 NodePointer(NodeAttribute& AttributeNode, AttributeIdentifier AttrID) :
00142 m_AttrID(AttrID),
00143 m_AttributeNode(AttributeNode)
00144 {}
00145
00146 AttributeIdentifier GetAttrID() const { return m_AttrID; }
00147 NodeAttribute& GetNode() const { return m_AttributeNode; }
00148
00149 private:
00150 AttributeIdentifier m_AttrID;
00151 NodeAttribute& m_AttributeNode;
00152 };
00153
00154
00155 class CCUserAttrMap : public CMap<const StringBase*, const StringBase*, NodeAttribute*, NodeAttribute*>
00156 {
00157 typedef CMap<const StringBase*, const StringBase*, NodeAttribute*, NodeAttribute*> BaseMap;
00158 public:
00159 CCUserAttrMap(INT32 nBlockSize = 10) :
00160 BaseMap(nBlockSize)
00161 {}
00162
00163 virtual ~CCUserAttrMap();
00164
00165 BOOL SetAt(const StringBase* key, NodeAttribute* pNewAttributeNode);
00166 void RemoveAll();
00167
00168 NodePointer* FindFirst() const;
00169 NodePointer* FindNext(const NodePointer* const pPrevious) const;
00170
00171 private:
00172 List m_NodeAttributes;
00173 };
00174
00175
00176 extern String_8 NonConstNullString;
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 class RenderableNodeEnumerator : public CC_CLASS_MEMDUMP
00188 {
00189
00190 CC_DECLARE_MEMDUMP(RenderableNodeEnumerator);
00191
00192 public:
00193 virtual ~RenderableNodeEnumerator() { }
00194 virtual NodeRenderable* FindFirst() const = 0;
00195 virtual NodeRenderable* FindNext(NodeRenderable* const pPrevious) const = 0;
00196 };
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 class RangeEnumerator : public RenderableNodeEnumerator
00211 {
00212
00213 CC_DECLARE_MEMDUMP(RangeEnumerator);
00214
00215 public:
00216 RangeEnumerator(Range* const pRange) : m_pRange(pRange) {}
00217
00218
00219 virtual NodeRenderable* FindFirst() const { return (NodeRenderable*)m_pRange->FindFirst(); }
00220 virtual NodeRenderable* FindNext(NodeRenderable* const pPrevious) const { return (NodeRenderable*)m_pRange->FindNext((Node*)pPrevious); }
00221
00222 private:
00223 Range* m_pRange;
00224 };
00225
00226 class DocPseudoEnumerator : public RenderableNodeEnumerator
00227 {
00228
00229 CC_DECLARE_MEMDUMP(DocPseudoEnumerator);
00230
00231 public:
00232 DocPseudoEnumerator(Document* const pDocument) : m_pDocument(pDocument) {}
00233
00234
00235 virtual NodeRenderable* FindFirst() const;
00236 virtual NodeRenderable* FindNext(NodeRenderable* const pPrevious) const { return NULL; }
00237
00238 private:
00239 Document* m_pDocument;
00240 };
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 class AttributeAgglomerator : public CC_CLASS_MEMDUMP
00259 {
00260 CC_DECLARE_MEMDUMP(AttributeAgglomerator);
00261
00262 public:
00263 virtual ~AttributeAgglomerator() { }
00264 BOOL FindCommonAttributes( RenderableNodeEnumerator& Enumerator,
00265 CommonAttrMultiSet* const pCommonAttributeSet);
00266
00267 static const UINT32 MaxAttributes;
00268
00269 protected:
00270 virtual AttributeIdentifier GetAttributeType(NodeAttribute* const pAttrib) const = 0;
00271 virtual BOOL FindAppliedAttributes(Node* const pNode, CCUserAttrMap* const pAttribMap) const;
00272
00273 };
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290 class UserAttributeAgglomerator : public AttributeAgglomerator
00291 {
00292 CC_DECLARE_MEMDUMP(UserAttributeAgglomerator);
00293
00294 public:
00295
00296 protected:
00297 virtual AttributeIdentifier GetAttributeType(NodeAttribute* const pAttrib) const;
00298 };
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 class AppliedAttribute : public VisibleListItem
00314 {
00315 CC_DECLARE_MEMDUMP(AppliedAttribute);
00316 public:
00317
00318
00319
00320
00321 virtual BOOL operator > (const VisibleListItem& OtherItem) const;
00322 virtual AttributeIdentifier GetAttrID() const = 0;
00323 virtual BOOL ApplyAttribute(Operation& OpToApplyWith) = 0;
00324 virtual VisibleAttribute* GetVisibleAttribute() = 0;
00325 };
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 class SingletonAppliedAttribute : public AppliedAttribute
00340 {
00341
00342 CC_DECLARE_MEMDUMP(SingletonAppliedAttribute);
00343
00344 public:
00345 SingletonAppliedAttribute(NodeAttribute& TheAttribute);
00346 SingletonAppliedAttribute(VisibleAttribute& TheVisibleAttribute);
00347 SingletonAppliedAttribute(const SingletonAppliedAttribute& Other) : m_AttrID(NonConstNullString)
00348 { TRACE( wxT("SingletonAppliedAttribute copy constructor not implemented\n") ); }
00349
00350 virtual ~SingletonAppliedAttribute();
00351
00352
00353
00354 virtual BOOL Display(DialogOp& Dialog);
00355
00356 virtual void Hide();
00357
00358
00359 virtual StringBase& GetText(StringBase& Description) const;
00360
00361
00362 virtual AttributeIdentifier GetAttrID() const { return m_AttrID; }
00363 virtual BOOL ApplyAttribute(Operation& OpToApplyWith);
00364 virtual VisibleAttribute* GetVisibleAttribute() { return m_pVisibleAttribute; }
00365
00366 private:
00367
00368 VisibleAttribute* m_pVisibleAttribute;
00369 String_128 m_AttrID;
00370 DialogOp* m_pDialog;
00371 };
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 class CommonAppliedAttribute : public AppliedAttribute
00386 {
00387
00388 CC_DECLARE_MEMDUMP(CommonAppliedAttribute);
00389
00390 public:
00391 CommonAppliedAttribute(NodeAttribute& AttrInstance);
00392 virtual ~CommonAppliedAttribute();
00393 CommonAppliedAttribute(const CommonAppliedAttribute& Other) : m_AttrID(NullString)
00394 { TRACE( wxT("CommonAppliedAttribute copy constructor not implemented\n") ); }
00395
00396
00397
00398 virtual BOOL Display(DialogOp& Dialog);
00399 virtual void Hide();
00400
00401
00402 virtual StringBase& GetText(StringBase& Description) const;
00403
00404
00405 virtual AttributeIdentifier GetAttrID() const { return m_AttrID; }
00406 virtual BOOL ApplyAttribute(Operation& OpToApplyWith);
00407 virtual VisibleAttribute* GetVisibleAttribute() { return m_pVisibleAttribute; }
00408
00409 private:
00410
00411 VisibleAttribute* m_pVisibleAttribute;
00412 AttributeIdentifier m_AttrID;
00413 };
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427 class MultiAppliedAttribute : public AppliedAttribute
00428 {
00429
00430 CC_DECLARE_MEMDUMP(MultiAppliedAttribute);
00431
00432 public:
00433 MultiAppliedAttribute(NodeAttribute& AttrInstance);
00434
00435
00436 virtual BOOL Display(DialogOp& Dialog);
00437 virtual void Hide();
00438
00439
00440 virtual StringBase& GetText(StringBase& Description) const;
00441
00442
00443 virtual AttributeIdentifier GetAttrID() const { return m_AttrID; }
00444 virtual BOOL ApplyAttribute(Operation& OpToApplyWith) { return TRUE; }
00445 virtual VisibleAttribute* GetVisibleAttribute() { return NULL; }
00446
00447 protected:
00448 const StringBase& GetAttributeDescription() const;
00449
00450 private:
00451 String_64 m_AttributeDescription;
00452 AttributeIdentifier m_AttrID;
00453 };
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 class MultiCommonAttrItem : public ListItem
00467 {
00468
00469 CC_DECLARE_MEMDUMP(MultiCommonAttrItem);
00470
00471 public:
00472 MultiCommonAttrItem(AttributeIdentifier AttrType, NodeAttribute* const pAttr = NULL);
00473 ~MultiCommonAttrItem();
00474
00475 void ClearResults();
00476
00477 enum CAResult { AA_INVALID = 0,
00478 AA_NONE = 1,
00479 AA_SINGLE,
00480 AA_COMMON,
00481 AA_MANY
00482 };
00483
00484 AttributeIdentifier GetAttrID() const { return m_AttrType; }
00485 const CAResult& GetStatus() const { return m_Status; }
00486 NodeAttribute* GetNode() const { return m_pAttr; }
00487
00488 void SetStatus(const CAResult& Status) { m_Status = Status; }
00489 void SetNode(NodeAttribute* const pAttr) { m_pAttr = pAttr; }
00490
00491 AppliedAttribute* CreateVisibleAppliedAttribute() const;
00492
00493 private:
00494 CAResult m_Status;
00495 AttributeIdentifier m_AttrType;
00496 NodeAttribute* m_pAttr;
00497
00498 BOOL m_AttrIsCopy;
00499
00500
00501 };
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517 class CommonAttrMultiSet : public CommonAttrMap
00518 {
00519 public:
00520 virtual ~CommonAttrMultiSet();
00521
00522 void ClearResults();
00523
00524
00525 virtual BOOL AddTypeToSet(AttributeIdentifier AttrType, NodeAttribute* const pAttr);
00526
00527
00528 MultiCommonAttrItem* FindAttrItem(AttributeIdentifier AttrType);
00529 MultiCommonAttrItem* FindFirst() const;
00530 MultiCommonAttrItem* FindNext(const MultiCommonAttrItem* const pPrevious) const;
00531
00532 protected:
00533 private:
00534 List m_CommonAttrList;
00535 };
00536
00537
00538 #endif // INC_ATTRAGGL