Download Adobe InDesign 2 Programming Guide

Transcript
Adobe InDesign Programming Guide
13.5. Frequently asked questions(FAQ)
451
13.5.37. Can I get called when stories are created and deleted?
Yes. To be called when a story is created implement a new story signal
responder (IResponder) boss class. The ServiceID is
kNewStorySignalResponderService and the API provides a default
implemention for the required
IK2ServiceProvider(kNewStorySignalRespServiceImpl). To be called when a
story is deleted implement a delete story responder. The ServiceID is
kDeleteStoryRespService and the API provides a default implemention for the
required IK2ServiceProvider(kDeleteStoryRespServiceImpl).
13.5.38. Can I lock a story?
The short answer is "no". The long answer is "kind of " and depends on the
application, InCopy or InDesign. Simply stated support for story locking is
currently inadequate. Under InCopy most changes (but not all) to a story can
be locked out. Under InDesign alone story locking is not really supported.
Interface ITextLockData was originally added to kTextStoryBoss for InCopy.
The methods the interface supports are listed in figure 13.5.38.a.
figure 13.5.38.a. ITextLockData methods
virtual
virtual
virtual
virtual
void SetInsertLock(bool8 lock) = 0;
bool8 GetInsertLock() = 0;
void SetAttributeLock(bool8 lock) = 0;
bool8 GetAttributeLock() = 0;
The InCopyShared plug-in provides a command
(kSetStoryLockStateCmdBoss) to set the lock state of a list of stories. If
InCopyShared is not present you could write your own command. However we
advise you to do this with caution because ITextLockData doesn't lock out as much
as you would like. There are gaps in the support for story lock state. Known gaps
include, but are not limited to:
• Changing the text model through ITextModel methods other than
ReplaceCmd, DeleteCmd, UserApplyCmd, UserApplyCmdRegularUndo, PasteCmd,
TypeTextCmd. The methods named will return nil for the command if the
story is locked.
• Changing the text model through commands such as kReplaceTextCmdBoss,
kDeleteTextCmdBoss, kInsertTextCmdBoss.
• Other plug-ins or scripts that make direct changes to the text model.