Sample parts are provided as a starting point for subclassing. OpenDoc part handlers are created by subclassing from the ODPart class and implementing some or all of its methods. In order to interact properly with OpenDoc, all OpenDoc parts are required to override a subset of ODPart methods whether or not they implement these methods. The parts must implement the ODPart methods for certain protocols to allow all the parts in an OpenDoc document to share OpenDoc resources effectively and to implement additional methods that provide new features. See "OpenDoc Protocols" for details about both the required and the optional ODPart methods for OpenDoc protocols.
The set of protocols your part will participate in depends on the nature of the part. For example, some parts are container parts that allow other parts to be embedded within them. Container parts should allow the embedded parts to be manipulated as intrinsic content and will participate in more protocols than a non-container part would. A part developer can create a part from scratch by subclassing from ODPart or by subclassing from another part to take advantage of code reuse. The following samples are provided:
A minimal set of OpenDoc protocols is represented within the SimplePart sample. Parts which will not contain other parts can be subclassed from SimplePart where they will inherit basic activation, imaging, and storage protocols. The SimplePart methods are described in "Methods Defined in SimplePart Class".
The BaseContainer sample provides the ability to embed other OpenDoc parts. Subclasses of the BaseContainer part will automatically be able to embed, move, resize, cut, copy, paste, delete, and drag other OpenDoc parts. The BaseContainer methods are described in "Creating a Part from BaseContainer Part".
The PartMeister developer utility provides a front-end mechanism to subclass from another part. It helps you create new parts based on templates. See "Creating a Part with PartMeister" for more information on the PartMeister utility.
Note:
The generated source code from the PartMeister utility may vary slightly from the sample parts. Both versions are correct.