InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PstLstReferenceConverter Class Reference
Inheritance diagram for PstLstReferenceConverter:
CReferenceConverterCPMUnknown< IReferenceConverter >IReferenceConverterIPMUnknown

Public Types

typedef CReferenceConverter inherited
 

Public Member Functions

 PstLstReferenceConverter (IPMUnknown *boss)
 
virtual ~PstLstReferenceConverter ()
 
virtual bool16 CanConvert (ClassID clsID)
 
virtual UID ConvertReference (IDataBase *sourceDB, UID convertThis, IDataBase *targetDB, IPMUnknown *pmobject)
 
virtual bool16 ConvertAlways (void) const
 
virtual UID GetReference (IDataBase *sourceDB, UID convertThis, IDataBase *targetDB) const
 
- Public Member Functions inherited from CReferenceConverter
 CReferenceConverter (IPMUnknown *boss)
 
virtual bool16 IsMappingReference (IDataBase *, UID, IDataBase *) const
 
virtual UID MapReference (IDataBase *, UID, IDataBase *, IPMUnknown *)
 
virtual UID GetMappedReference (IDataBase *, UID, IDataBase *)
 
- Public Member Functions inherited from CPMUnknown< IReferenceConverter >
IPMUnknownQueryInterface (PMIID interfaceID) const
 
void AddRef () const
 
void Release () const
 
void PreDirty (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
void PreDirtyNoMessage (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
 CPMUnknown (const CPMUnknown &)=delete
 
CPMUnknownoperator= (const CPMUnknown &)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from CPMUnknown< IReferenceConverter >
 CPMUnknown (IPMUnknown *boss)
 
- Protected Attributes inherited from CPMUnknown< IReferenceConverter >
HelperInterface fHelperInterface
 

Detailed Description

Implements a reference converter, IReferenceConverter, that controls how objects of ClassID kPstLstDataBoss get copied.

For example, say a page item has two associated kPstLstDataBoss objects with UID's UID1, UID2 and the selected object is UID2 (see interface IPstLstUIDList). When this page item is copied a new page item is created and distinct copies of the kPstLstDataBoss objects are made. The new page item's associated kPstLstDataBoss objects are UID1', UID2' and the selected object is UID2'. UID1' contains a copy of the data held by the object UID1. UID2' contains a copy of the data held by the object UID2.

When the copy happens, a persistent implementation's ReadWrite function gets called to write itself out into the copy stream. When the ReadWrite function calls IPMStream::XferReference on the UID, the copy stream tries to copy the UID. First it checks to see if the UID has already been copied previously in the copy session(see IXReferenceUID). If it hasn't, then it looks for a reference converter which can copy the UID for it. If it finds a reference converter, it calls it to make a copy of the UID. The reference converter returns the UID of the copy. If there is no reference converter, then the copy stream just returns kInvalidUID. When the ReadWrite function calls IPMStream::XferObject the same process is run through with the additional final step of simply streaming the data for the object via ReadWrite if no reference converter is available.

If a reference converter is not provided for a persistent boss class then calls to IPMStream::XferReference for UID's of that ClassID return kInvalidUID (as was the case before this reference converter was added to this plug-in). When PstLstUIDList::ReadWrite was called during copy operations its data member (fSelectedUID) was copied with a value of kInvalidUID. PstLstUIDList::ReadWrite was updating fSelectedUID when this happened and calling Dirty to mask this problem. The ReadWrite method of a persistent implementation should never call Dirty. Adding the reference converter maintains fSelectedUID across the copy to be the UID of the selected kPstLstDataBoss object, see PstLstUIDList::ReadWrite. This removed the need to dirty the object during ReadWrite.

Constructor & Destructor Documentation

PstLstReferenceConverter::PstLstReferenceConverter (IPMUnknownboss)

Constructor.

Parameters
bossIN interface ptr from boss object on which this interface is aggregated.
PstLstReferenceConverter::~PstLstReferenceConverter ()
virtual

Destructor.

Member Function Documentation

bool16 PstLstReferenceConverter::CanConvert (ClassID clsID)
virtual

Return kTrue if clsID is kPstLstDataBoss, kFalse otherwise.

Parameters
clsIDobjects boss class
Returns
kTrue if clsID is kPstLstDataBoss, kFalse otherwise.

Reimplemented from CReferenceConverter.

bool16 PstLstReferenceConverter::ConvertAlways (void ) const
virtual

Return kFalse to indicate that if another reference to an object that has already been converted is encountered the application can simply reuse the result of the previous conversion.

Returns
kFalse.

Reimplemented from CReferenceConverter.

UID PstLstReferenceConverter::ConvertReference (IDataBasesourceDB,
UID convertThis,
IDataBasetargetDB,
IPMUnknownpmobject 
)
virtual

Return UID of converted object in target database, IScrapUtils::CopyObject is used to make the conversion.

Parameters
sourceDBdatabase containing the source object.
convertThisrefers to the object to be converted.
targetDBdatabase containing the converted object.
pmobject
Returns
UID of converted object in target database.

Reimplemented from CReferenceConverter.

UID PstLstReferenceConverter::GetReference (IDataBasesourceDB,
UID convertThis,
IDataBasetargetDB 
) const
virtual

Return kInvalidUID. If the method could find an existing object in the target database that convertThis should be converted to, it could return it. Since kPstLstDataBoss objects have no special rules that allow such matching, this method returns kInvalidUID.

Parameters
sourceDBdatabase containing the source object.
convertThisrefers to the object to be converted.
targetDBdatabase containing the converted object (this method should never create new objects in the target database).
Returns
kInvalidUID.

Reimplemented from CReferenceConverter.