UsedPropertiesList Class Reference

Provides a visible list of user attributes. More...

Inheritance diagram for UsedPropertiesList:

VisibleListWithEditableEntries VisibleList UserInterface Notifier List of all members.

Public Member Functions

 UsedPropertiesList ()
 ~UsedPropertiesList ()
 Makes sure the embedded objects are deleted.
virtual BOOL InsertEntry (VisibleListItem &EntryToInsert)
 Overrides the base class function to make sure the entries are unique.
virtual BOOL DeleteAllEntries ()
 Overrides the base class function to allow this UsePropertiesList to note which items have been deleted.
BOOL AddAvailableProperty (AvailableProperty &NewProperty)
 Overrides the base class so the UsedPropertiesList can make sure the entry hasn't changed into another duplicate entry.Adds an available property to this list (which is shown in the dialog as "Used Properties"Tells the user that what they've done is a no-no.When a user has changed a Used Property to something they shouldn't have this member is called to undo the changes.Adds an available property to this list (which is shown in the dialog as "Used Properties".
BOOL BuildFromEnumerator (RenderableNodeEnumerator &Enumerator)
 Builds this UsedPropertiesList by finding the attributes applied to the objects found in the given iterator (the selection or a node).
BOOL Commit (Operation &OpToApplyWith)
 Applies all the attributes in this UsedPropertiesList list to the node.
BOOL DeleteAttributes (String_128 AttrIDs[])
 Support function to delete the given AttributeIdentifiers from the objects in the selection.

Protected Member Functions

virtual BOOL DeleteEntryAtIndex (UINT32 Index)
 Overrides the base class function to allow this UsePropertiesList to note which items have been deleted.
String_128GetRemovedEntries ()
const AppliedAttribute ** GetOriginalEntries ()
BOOL NoteNewEntries ()
 Support function which takes all the entries in this list and marks them as original entries. When it comes to commiting the entries, i.e., applying them it then knows which ones to delete from the selection.
CommonAttrMultiSetFindCommonUserAttributes (RenderableNodeEnumerator &Enumerator)
 Support function to create a CommonAttrMultiSet using the given Enumerator.

Private Member Functions

 CC_DECLARE_MEMDUMP (UsedPropertiesList)

Private Attributes

const AppliedAttribute ** m_pOriginalEntries
String_128m_pRemovedEntries
UINT32 m_ArraysSize

Detailed Description

Provides a visible list of user attributes.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/10/96

Definition at line 355 of file tmpltdlg.cpp.


Constructor & Destructor Documentation

UsedPropertiesList::UsedPropertiesList  )  [inline]
 

Definition at line 360 of file tmpltdlg.cpp.

UsedPropertiesList::~UsedPropertiesList  ) 
 

Makes sure the embedded objects are deleted.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1295 of file tmpltdlg.cpp.

01296 {
01297     delete [] m_pOriginalEntries;
01298     m_pOriginalEntries = NULL;
01299 
01300     delete [] m_pRemovedEntries;
01301     m_pRemovedEntries = NULL;
01302 }


Member Function Documentation

BOOL UsedPropertiesList::AddAvailableProperty AvailableProperty NewProperty  ) 
 

Overrides the base class so the UsedPropertiesList can make sure the entry hasn't changed into another duplicate entry.Adds an available property to this list (which is shown in the dialog as "Used Properties"Tells the user that what they've done is a no-no.When a user has changed a Used Property to something they shouldn't have this member is called to undo the changes.Adds an available property to this list (which is shown in the dialog as "Used Properties".

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1580 of file tmpltdlg.cpp.

01581 {
01582     BOOL Success = TRUE;
01583 
01584     // Create a new AppliedAttribute
01585     AppliedAttribute* pNewListEntry = NewProperty.CreateUsedProperty();
01586     Success = (pNewListEntry != NULL);
01587 
01588     if (Success)
01589     {
01590         Success = InsertEntry(*pNewListEntry);
01591     }
01592 
01593     if (!Success)
01594     {
01595         if (pNewListEntry != NULL)
01596         {
01597             delete pNewListEntry;
01598             pNewListEntry = NULL;
01599         }
01600     }
01601 
01602     return Success;
01603 }

BOOL UsedPropertiesList::BuildFromEnumerator RenderableNodeEnumerator Enumerator  ) 
 

Builds this UsedPropertiesList by finding the attributes applied to the objects found in the given iterator (the selection or a node).

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from assorted dialog classes)
Date:
09/06/97
Parameters:
Enumerator,: This should return the collection of nodes for which this list [INPUTS] represents the applied attributes.

Definition at line 1620 of file tmpltdlg.cpp.

01621 {
01622     BOOL Ok = TRUE;
01623 
01624     // Build a set of applied attributes, deleting any old list before we do
01625 
01626     CommonAttrMultiSet* pAttrSet = FindCommonUserAttributes(Enumerator);
01627     Ok = (pAttrSet != NULL);
01628 
01629     // For each applied attribute create a visible version and add it to this list in reverse
01630     // order so they come out in the same order in which they're applied. (Each is added as 
01631     // the first entry)
01632     MultiCommonAttrItem* pCommonItem = NULL;
01633     if (Ok)
01634     {
01635         pCommonItem = pAttrSet->FindFirst();
01636     }
01637 
01638     while (pCommonItem != NULL && Ok)
01639     {
01640         AppliedAttribute* const pNewVisibleAppliedAttr = pCommonItem->CreateVisibleAppliedAttribute();
01641         Ok = (pNewVisibleAppliedAttr != NULL);
01642         if (Ok)
01643         {
01644             Ok = InsertEntry(*pNewVisibleAppliedAttr);
01645         }
01646 
01647         pCommonItem = pAttrSet->FindNext(pCommonItem);
01648     }
01649 
01650     delete pAttrSet;
01651 
01652     if (Ok)
01653     {
01654         Ok = NoteNewEntries();
01655     }
01656 
01657     return Ok;
01658 }

UsedPropertiesList::CC_DECLARE_MEMDUMP UsedPropertiesList   )  [private]
 

BOOL UsedPropertiesList::Commit Operation OpToApplyWith  ) 
 

Applies all the attributes in this UsedPropertiesList list to the node.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from assorted dialog classes)
Date:
09/06/97

Definition at line 1751 of file tmpltdlg.cpp.

01752 {
01753     BOOL Ok = TRUE;
01754 
01755     // Remove any attributes that were removed
01756     if (GetRemovedEntries() != NULL)
01757     {
01758         Ok = DeleteAttributes(GetRemovedEntries());
01759     }
01760 
01761     // and apply the new attributes in reverse order, because the OpApply...sticks them in 
01762     // nearest the Node
01763     VisibleListIterator Iterator = BeginOfEnd();
01764     while (Iterator != End() && Ok)
01765     {
01766         AppliedAttribute& Entry = (AppliedAttribute&)(*Iterator);
01767         Ok = Entry.ApplyAttribute(OpToApplyWith);
01768         --Iterator;
01769     }
01770 
01771     return Ok;
01772 }

BOOL UsedPropertiesList::DeleteAllEntries  )  [virtual]
 

Overrides the base class function to allow this UsePropertiesList to note which items have been deleted.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Notes: See base class for interface details. This is a bit yuck (no class for original entries, etc.)

Reimplemented from VisibleListWithEditableEntries.

Definition at line 1432 of file tmpltdlg.cpp.

01433 {
01434     BOOL Ok = TRUE;
01435 
01436     // Find the last entry in the removed array
01437     UINT32 RemovedEntriesIndex = 0;
01438     BOOL Found = FALSE;
01439 
01440     while (RemovedEntriesIndex < m_ArraysSize && !Found)
01441     {
01442         if (m_pRemovedEntries[RemovedEntriesIndex].IsEmpty())
01443         {
01444             Found = TRUE;
01445         }
01446         else
01447         {
01448             ++RemovedEntriesIndex;
01449         }
01450     }
01451 
01452     if (Found)
01453     {
01454         // Look through the original entries array to find any that haven't been removed
01455         UINT32 OriginalEntriesIndex = 0;
01456         while (OriginalEntriesIndex < m_ArraysSize)
01457         {
01458             if (m_pOriginalEntries[OriginalEntriesIndex] != NULL)
01459             {
01460                 AttributeIdentifier AttrID = m_pOriginalEntries[OriginalEntriesIndex]->GetAttrID();
01461                 
01462                 m_pRemovedEntries[RemovedEntriesIndex] = AttrID;
01463                 m_pOriginalEntries[OriginalEntriesIndex] = NULL;
01464 
01465                 ++RemovedEntriesIndex;
01466             }
01467             ++OriginalEntriesIndex;
01468         }
01469     }
01470 
01471 
01472     Ok = VisibleListWithEditableEntries::DeleteAllEntries();
01473 
01474     return Ok;
01475 }

BOOL UsedPropertiesList::DeleteAttributes String_128  AttrIDs[]  ) 
 

Support function to delete the given AttributeIdentifiers from the objects in the selection.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from assorted dialog classes)
Date:
09/06/97
Notes: This isn't quite true 'cos it looks at the data members for size info (The array should be a class). We won't talk about the StringBase being an AttributeIdentifier.

Definition at line 1791 of file tmpltdlg.cpp.

01792 {
01793     BOOL Ok = TRUE;
01794 
01795     // Obtain a pointer to the op descriptor for the attribute operation 
01796     OpDescriptor* const pOpDesc = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(OpRemoveAttributeFromSelection));
01797     ENSURE_NOT_NULL(pOpDesc);
01798 
01799     UINT32 Index = 0;
01800     while (Index < m_ArraysSize && !AttrIDs[Index].IsEmpty() && Ok)
01801     {
01802         AttributeIdentifier AttrID = (AttributeIdentifier)AttrIDs[Index];
01803         // Invoke the operation, passing AttrID as a parameter
01804         pOpDesc->Invoke(&(OpParam&)RemoveAttributeParam(AttrID), TRUE); // do want undo
01805 
01806         // we've deleted that one so mark it as gone
01807         AttrIDs[Index] = NullString;
01808 
01809         ++Index;
01810     }
01811 
01812     return Ok;
01813 }

BOOL UsedPropertiesList::DeleteEntryAtIndex UINT32  Index  )  [protected, virtual]
 

Overrides the base class function to allow this UsePropertiesList to note which items have been deleted.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Notes: See base class for interface details. This is a bit yuck (no class for original entries, etc.)

Reimplemented from VisibleList.

Definition at line 1364 of file tmpltdlg.cpp.

01365 {
01366     BOOL Ok = TRUE;
01367 
01368     AppliedAttribute& Entry = (AppliedAttribute&)GetEntryAt(Index);
01369 
01370     UINT32 ArrayIndex = 0;
01371     BOOL Found = FALSE;
01372     while (ArrayIndex < m_ArraysSize && !Found)
01373     {
01374         if (m_pOriginalEntries[ArrayIndex] == &Entry)
01375         {
01376             Found = TRUE;
01377         }
01378         else
01379         {
01380             ++ArrayIndex;
01381         }
01382     }
01383 
01384     if (Found)
01385     {
01386         m_pOriginalEntries[ArrayIndex] = NULL;
01387     }
01388 
01389     // Find the last entry in the removed array
01390     ArrayIndex = 0;
01391     Found = FALSE;
01392     while (ArrayIndex < m_ArraysSize && !Found)
01393     {
01394         if (m_pRemovedEntries[ArrayIndex].IsEmpty())
01395         {
01396             Found = TRUE;
01397         }
01398         else
01399         {
01400             ++ArrayIndex;
01401         }
01402     }
01403 
01404     if (Found)
01405     {
01406         AttributeIdentifier AttrID = Entry.GetAttrID();
01407 
01408         m_pRemovedEntries[ArrayIndex] = AttrID;
01409     }
01410 
01411 
01412     Ok = VisibleListWithEditableEntries::DeleteEntryAtIndex(Index);
01413 
01414     return Ok;
01415 }

CommonAttrMultiSet * UsedPropertiesList::FindCommonUserAttributes RenderableNodeEnumerator Enumerator  )  [protected]
 

Support function to create a CommonAttrMultiSet using the given Enumerator.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97

Definition at line 1726 of file tmpltdlg.cpp.

01727 {
01728     CommonAttrMultiSet* pCommonAttrs = new CommonAttrMultiSet();    // return this
01729 
01730     if (pCommonAttrs != NULL)
01731     {
01732         UserAttributeAgglomerator AttrAgglr;
01733         AttrAgglr.FindCommonAttributes(Enumerator, pCommonAttrs);
01734     }
01735 
01736     return pCommonAttrs;
01737 }

const AppliedAttribute** UsedPropertiesList::GetOriginalEntries  )  [inline, protected]
 

Definition at line 386 of file tmpltdlg.cpp.

00386 {   return m_pOriginalEntries;  }

String_128* UsedPropertiesList::GetRemovedEntries  )  [inline, protected]
 

Definition at line 385 of file tmpltdlg.cpp.

00385 {   return m_pRemovedEntries;   }

BOOL UsedPropertiesList::InsertEntry VisibleListItem EntryToInsert  )  [virtual]
 

Overrides the base class function to make sure the entries are unique.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/97
Notes: See base class for interface details.

Reimplemented from VisibleList.

Definition at line 1317 of file tmpltdlg.cpp.

01318 {
01319     ENSURE_KIND((&EntryToInsert), AppliedAttribute);
01320 
01321     BOOL Ok = TRUE;
01322 
01323     AppliedAttribute& AppliedAttributeToInsert = (AppliedAttribute&)EntryToInsert;
01324 
01325     // We don't want the user to think they can apply WizOps of the same class so
01326     // go through the VisibleList looking for one with a duplicate AttributeIdentifier
01327     VisibleListIterator Iterator = Begin();
01328     while (Iterator != End() && Ok)
01329     {
01330         AppliedAttribute& UsedProperty = (AppliedAttribute&)*Iterator;
01331         if (UsedProperty.GetAttrID() == AppliedAttributeToInsert.GetAttrID())
01332         {
01333             Ok = FALSE;
01334         }
01335         else
01336         {
01337             ++Iterator;
01338         }
01339     }
01340 
01341     if (Ok)
01342     {
01343         Ok = VisibleListWithEditableEntries::InsertEntry(EntryToInsert);
01344     }
01345 
01346     return Ok;
01347 }

BOOL UsedPropertiesList::NoteNewEntries  )  [protected]
 

Support function which takes all the entries in this list and marks them as original entries. When it comes to commiting the entries, i.e., applying them it then knows which ones to delete from the selection.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> (from assorted dialog classes)
Date:
09/06/97
Returns:
TRUE if it worked, FALSE if it didn't

Definition at line 1675 of file tmpltdlg.cpp.

01676 {
01677     BOOL Ok = TRUE;
01678 
01679     delete [] m_pOriginalEntries;
01680     m_pOriginalEntries = NULL;
01681 
01682     delete [] m_pRemovedEntries;
01683     m_pRemovedEntries = NULL;
01684 
01685     m_ArraysSize = GetContainer().GetCount();
01686 
01687     if (m_ArraysSize != 0)
01688     {
01689         m_pOriginalEntries  = new const AppliedAttribute*[m_ArraysSize];
01690         m_pRemovedEntries   = new String_128[m_ArraysSize];
01691     }
01692 
01693     Ok = (m_pOriginalEntries != NULL && m_pRemovedEntries != NULL);
01694 
01695     if (Ok)
01696     {
01697         UINT32 Index = 0;
01698         VisibleListIterator Iterator = Begin();
01699         while (Iterator != End())
01700         {
01701             AppliedAttribute& ListEntry = (AppliedAttribute&)*Iterator;
01702 
01703             m_pOriginalEntries[Index]   = &ListEntry;
01704             m_pRemovedEntries[Index]    = NullString;
01705 
01706             ++Iterator;
01707             ++Index;
01708         }
01709     }
01710 
01711     return Ok;
01712 }


Member Data Documentation

UINT32 UsedPropertiesList::m_ArraysSize [private]
 

Definition at line 396 of file tmpltdlg.cpp.

const AppliedAttribute** UsedPropertiesList::m_pOriginalEntries [private]
 

Definition at line 394 of file tmpltdlg.cpp.

String_128* UsedPropertiesList::m_pRemovedEntries [private]
 

Definition at line 395 of file tmpltdlg.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 04:02:44 2007 for Camelot by  doxygen 1.4.4