CIObjectAccess

The CIObjectAccess interface provides methods for retrieving information on all the objects within a PageMaker publication.

If you need to iterate through a publication and act on certain text or graphics objects, CIObjectAccess provides a much faster way than using similar commands and queries.


CIObjectAccess methods

PMBool IsObject(PMOBJ_REC* pObjRec);

Determines whether or not pObjRec is a valid object. You should make this test after receiving an object record from other methods. A PMOBJ_REC is an opaque cookie used by the other methods in the CIObjectAccess interface.

PMErr GetFirstObject(PMOBJACCFLAGTYPE wantFlags, PMOBJ_REC* pObjRec, short pageNum = -1, char *masterPageName = NULL);

This method returns the object record for the next object on page specified in the call to GetFirstObject, using the PMOBJACCFLAGTYPE flags also specified in GetFirstObject. If there are no more objects of the given PMOBJACCFLAGTYPE, a CQ_OBJACC_OBJ_NOT_FOUND will be returned as a return code and the fields of the PMOBJ_REC will be zero'ed out.

Regular page numbers may be specified. Alternatively, a master page may be specified by using -3 or -4 for left master page and right master page, respectively, in the pageNum parameter, and the name of the master page in the masterPageName parameter. In either case, if the pub has two page facing spreads, objects will be returned for each page. For example, if the pub has a two-page spread and pages 2 and 3 are facing pages, asking for the objects on page 2 will return all the objects on pages 2 and 3. And then, asking for the objects on page 3 will return all those same objects again.

To get the objects on the current page, specify pageNum as -1 (or leave the argument off, since that is the default).

When specifying kIncludeInlines, GetFirstObject/GetNextObject will only return "valid" inlines those that have not been moved or will not be affected by pending text composition.

WARNING: Calling GetFirstObject and GetNextObject will cause PageMaker to turn the page (either to a master page or to the specified regular page) in order to look at the objects on the page. It is very important that the caller DOES NOT turn the page until they have finished calling GetNextObject for a given page. Once finished, the current page can be restored to its previous setting by calling RestorePage, below.

PMErr GetNextObject(PMOBJ_REC* pObjRec);

This method returns the object record for the next object on page specified in the call to GetFirstObject, using the PMOBJACCFLAGTYPE flags also specified in GetFirstObject. If there are no more objects of the given PMOBJACCFLAGTYPE, a CQ_OBJACC_OBJ_NOT_FOUND will be returned as a return code and the fields of the PMOBJ_REC will be zero'ed out.

PMErr RestorePage();

Returns to the page that was selected before the GetFirstObject/GetNextObject calls were made.


Getting object info

Methods for getting info for a given object. Note: The following methods may be called at any time and WILL NOT AFFECT the current state information used for the GetFirstObject/GetNextObject loop!

PMErr GetPMObjRecFromObjID(unsigned long objID, PMOBJ_REC* pObjRec);

Given on object ID this method returns the object record. You should verify this object with the IsObject call before

PMErr GetObjID(PMOBJ_REC* pObjRec, unsigned long *objID);

When passed a PMOBJ_REC, this method returns the object ID for the given object

PMErr GetObjAttr(PMOBJ_REC* pObjRec, PMObjAttr* pAttr);

When passed a PMOBJ_REC, this method returns attribute information for given object

The object attributes are returned in a PMObjAttr structure, which contains the objects type, state flags, location and size, layer name, and master page number and name.

PMErr GetObjFillAndLineInfo(PMOBJ_REC* pObjRec, PMFillAndLineInfo * pFillAndLineInfo);

When passed a PMOBJ_REC, this method returns fill and line information for lines, boxes, ovals, polygons and frames. The fill and stroke information is returned in a PMFillAndLineInfo structure.

typedef struct _fillAndLineInfo {
int cFillStyle;
char sFillColor[32];
int bFillOverprint;
int cLineStyle;
int bReverse;
short dLineWeight;
int bOpaque;
char sLineColor[32];
int bLineOverprint;
short nFillTint;
short nLineTint;
} PMFillAndLineInfo;

PMErr GetObjTransformInfo(PMOBJ_REC* pObjRec, PMTransformInfo * pTransformInfo);

When passed a PMOBJ_REC, this method returns transformation information for given object. The transformation information is stored in a PMTransformInfo structure, which includes rotation, skew, and position fields.

PMErr GetObjLinkInfo(PMOBJ_REC* pObjRec, PMLinkInfo* pLinkInfo);

When passed a PMOBJ_REC, this method returns information on an imported objects link to the file that was imported. The PMLinkInfo structure provides eight fields including the link's filename, link type, size, modification date/time, and the date/time the link was placed.

PMErr GetObjLinkTimeInfo(PMOBJ_REC* pObjRec, PMLinkTimeInfo* pLinkTimeInfo);

Returns the link information for the imported object, with the time information expressed as binary information rather than strings.

This call provides information identical to GetObjLinkInfo, but the date/time stamp information is in binary format with this interface, and as ASCII text in GetObjLinkInfo.

PMErr GetObjILGInfo(PMOBJ_REC* pILGObjRec, PMILGInfo* pILGInfo);

When passed a PMOBJ_REC, this method returns information about the specified inline graphic object. The PMILGInfo structure contains three fields, a story ID, the character position of the graphic within the story, and a boolean flag indicating whether the graphic's position is on the current page.

PMErr GetObjFilterPrefMem(PMOBJ_REC* pObjRec, void **ppPrefMem, unsigned long *pdwPrefMemSize);

When passed a PMOBJ_REC, this method returns the preference memory used by the filter that imported this object.

WARNING: Plug-ins must call FreeObjFilterPrefMem when finished with the memory block.

Returns the preference memory used by the filter that imported this object. The format of the information will vary from filter to filter and is typically only useful to the filter that imported the object.

void **ppPrefMem

Memory location that contains the preferences from the filter.

unsigned long *pdwPrefMemSize

The size of the memory block (in bytes) that ppPrefMem points to.

PMErr FreeObjFilterPrefMem();

Return an IAdobeVector OLE Interface for the given object

PMErr OleQueryInterface(PMOBJ_REC* pObjRec, REFIID riid, void** ppInterface);

When passed a PMOBJ_REC, this method returns the IAdobeVector interface for the object, if the IAdobeVector interface is implemented for that object. Currently the IAdobeVector interface is only available for EPS graphics that are placed into PageMaker.

PMOBJ_REC *pObjRec

The object record.

void *riid

If the call is successful, this contains the reference interface's IID. This is an ID that is used by the OLE IUnknown interface.

void **ppInterface

A pointer to the IAdobeVector interface for the specified object.

Note: If the IAdobeVector interface is not supported for this object, a CQ_INTF_NOTIMPLEMENTED error is returned. For more information on the IAdobeVector interface, see the topic IAdobeVector interface.

PMErr GetObjLinkTimeInfo(PMOBJ_REC* pObjRec, PMLinkTimeInfo* pLinkTimeInfo);


Known Issues with CIObjectAccess

Pasteboard objects get deselected if GetFirstObject or GetNextObject is called for a page other than the current page.

The page number returned for objects in a frame is incorrect. (Get the page number from the frame.)


Comments or suggestions? Contact Adobe Developer Support

Copyright © 1997 - 2001 Adobe Systems Incorporated. All rights reserved.
Legal notices and trademark attributions