InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IInCopyDocUtils Class Referenceabstract

#include <IInCopyDocUtils.h>

Inheritance diagram for IInCopyDocUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IINCOPYDOCUTILS }
 

Public Member Functions

virtual void DoSave (const UIDRef &textModel, UIFlags uiFlags=kFullUI)=0
 
virtual void DoSaveAll (const UIDRef &doc, UIFlags uiFlags=kFullUI)=0
 
virtual void DoSaveAs (const UIDRef &doc, bool16 copy=kFalse, const IDFile *destFile=nil, UIFlags uiFlags=kFullUI, bool8 asStationary=kFalse, FileTypeInfoID fileTypeID=kInvalidFileTypeInfoID)=0
 
virtual UIDRef DoOpen (const IDFile &filesToOpen, IOpenFileCmdData::OpenFlags flags, bool16 showWindow=kTrue, IDocument::UndoSupport undoSupport=IDocument::kFullUndoSupport, UIFlags=kFullUI)=0
 
virtual UIDRef DoNew (bool16 openWin=kTrue, IDocument::UndoSupport undoSupport=IDocument::kFullUndoSupport)=0
 
virtual void DoRevert (const UIDRef &doc, UIFlags uiFlags=kFullUI)=0
 
virtual void DoUpdateDesign (const UIDRef &docRef, UIFlags uiFlags=kFullUI)=0
 
virtual void DoNewWindow (const UIDRef &doc)=0
 
virtual void DoClose (const UIDRef &doc, UIFlags uiFlags, bool16 allowCancel, IDocFileHandler::CloseCmdMode cmdMode)=0
 
virtual IDocFileHandlerQueryDocFileHandler ()=0
 
virtual bool16 ShouldDoSaveAs (IDocument *doc)=0
 
virtual bool16 CanDoSave (const UIDRef &doc)=0
 
virtual bool16 CanDoSaveAll (const UIDRef &doc)=0
 
virtual bool16 CanDoRevert (const UIDRef &doc)=0
 
virtual bool16 CanDoUpdateDesign (const UIDRef &doc)=0
 
virtual bool16 IsReadOnly (IDocument *iDoc)=0
 
virtual void ExportAllLinkedStories (IDocument *doc, const FileTypeInfoID &fileTypeID, UIFlags uiFlags=kFullUI)=0
 
virtual void ExportStoryAndCreateLink (const UIDRef &story, const IDFile &file, const FileTypeInfoID &fileTypeID)=0
 
virtual ErrorCode ExportLinkedStory (const UIDRef &story, const FileTypeInfoID &fileTypeID)=0
 
virtual void ImportAllLinkedStories (IDocument *doc, const FileTypeInfoID &fileTypeID, IInCopyImportOptions *options)=0
 
virtual ErrorCode ImportStoryAndCreateLink (const UIDRef &story, IPMStream *stream, IInCopyImportOptions *options, const FileTypeInfoID &fileTypeID, bool16 createLink=kTrue, UIDRef *importedItem=nil)=0
 
virtual ErrorCode ImportLinkedStory (const UIDRef &story, const FileTypeInfoID &fileTypeID, IInCopyImportOptions *options=nil)=0
 
virtual UIDRef GetFirstUserStory (IDocument *doc)=0
 
virtual void GetLinkedStories (IDocument *doc, UIDList *stories, UIDList *links, IDataBase *db=nil)=0
 
virtual UIDRef CreateDefaultTextFrame (IDocument *doc)=0
 
virtual UIDRef CreateDefaultGraphicFrame (IDocument *doc)=0
 
virtual
IDocFileHandler::CloseOptions 
CheckOnClose (const UIDRef &doc, UIFlags uiFlags, bool8 allowCancel)=0
 
virtual bool16 CheckOnRevertStory (const UIDRef &storyRef)=0
 
virtual bool16 IsFileAlreadyOpen (const IDFile &file, UIDRef *doc, UIDRef *foundStory=nil)=0
 
virtual void GetCopyDefaultName (const UIDRef &doc, IDFile *name, bool16 &useSystemDefaultDir)=0
 
virtual bool16 GetOpenFileType (const IDFile &sysFile, SysOSType &type)=0
 
virtual bool16 GetStreamFileType (IPMStream *stream, SysOSType &type)=0
 
virtual void SetInCopyUserFile (IDocument *doc, const IDFile &newFile)=0
 
virtual void LockNonInCopyStories (const UIDRef &doc)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

The InCopy Document Utilities are designed to provide third parties the hooks necessary to replace InCopy files with whatever storage mechanisms they want to use, most often some form of database. Third parties are expected to implement and replace the default which ships with the InCopyFileActions plug-in.

Member Function Documentation

virtual bool16 IInCopyDocUtils::CanDoRevert (const UIDRefdoc)
pure virtual

CanDoRevert determines whether to enable the Revert menu item.

Parameters
doc- The document to save.
Returns
- Whether or not the menu item should be enabled.
virtual bool16 IInCopyDocUtils::CanDoSave (const UIDRefdoc)
pure virtual

CanDoSave determines whether to enable to Save menu item.

Parameters
doc- The document to save.
Returns
- Whether or not the menu item should be enabled.
virtual bool16 IInCopyDocUtils::CanDoSaveAll (const UIDRefdoc)
pure virtual

CanDoSaveAll determines whether to enable to the Save All menu item.

Parameters
doc- The document to save.
Returns
- Whether or not the menu item should be enabled.
virtual bool16 IInCopyDocUtils::CanDoUpdateDesign (const UIDRefdoc)
pure virtual

CanDoUpdateDesign determines whether to enable the Update Design menu item.

Parameters
doc- The document to save.
Returns
- Whether or not the menu item should be enabled.
virtual IDocFileHandler::CloseOptions IInCopyDocUtils::CheckOnClose (const UIDRefdoc,
UIFlags uiFlags,
bool8 allowCancel 
)
pure virtual

CheckOnClose puts up the "Do you want to save?" dialog if the document has been modified.

Parameters
doc- The document.
uiFlags- Whether to present UI to the user or not.
allowCancel- Determines if the user is allowed to cancel the close operation.
Returns
- description
virtual bool16 IInCopyDocUtils::CheckOnRevertStory (const UIDRefstoryRef)
pure virtual

CheckOnRevertStory asks the user if they want to revert a story.

Parameters
storyRef- The story to revert.
Returns
- Whether or not they want to revert it.
virtual UIDRef IInCopyDocUtils::CreateDefaultGraphicFrame (IDocumentdoc)
pure virtual

CreateDefaultGraphicFrame makes a full page graphic frame for a standalone document.

Parameters
doc- The document.
Returns
- The UIDRef of the graphic frame.
virtual UIDRef IInCopyDocUtils::CreateDefaultTextFrame (IDocumentdoc)
pure virtual

CreateDefaultTextFrame makes a full page text frame for a standalone document.

Parameters
doc- The document.
Returns
- The UIDRef of the new text frame.
virtual void IInCopyDocUtils::DoClose (const UIDRefdoc,
UIFlags uiFlags,
bool16 allowCancel,
IDocFileHandler::CloseCmdMode cmdMode 
)
pure virtual

DoClose closes a document, offering the user a chance to save.

Parameters
doc- The document to close.
uiFlags- Whether to show UI (default is full UI).
allowCancel- Whether to allow the user the opportunity to cancel the close.
cmdMode- Whether to process or schedule the close command. Processing it causes the close to occur immediately while scheduling it causes it to close after current commands are done processing.
virtual UIDRef IInCopyDocUtils::DoNew (bool16 openWin = kTrue,
IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport 
)
pure virtual

DoNew creates a new document with a single story frame in it.

Parameters
openWin- Whether to open a window or not (default is true).
undoSupport- Indicates whether commands that change the document (if this is an InDesign/InCopy document) will appear on the undo menu (default=IDocument::kFullUndoSupport).
Returns
- A UIDRef for the new document.
virtual void IInCopyDocUtils::DoNewWindow (const UIDRefdoc)
pure virtual

DoNewWindow creates a new window for an existing document.

Parameters
doc- The document to open a new view from.
virtual UIDRef IInCopyDocUtils::DoOpen (const IDFilefilesToOpen,
IOpenFileCmdData::OpenFlags flags,
bool16 showWindow = kTrue,
IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport,
UIFlags  = kFullUI 
)
pure virtual

DoOpen opens one or more story files in InCopy. If a story is already open, bring its window to the front and place a text insertion point in the story.

Parameters
filesToOpen- A list of files to open.
flags- Flags indicating the desired open options.
showWindow- Whether or not to show a window (default is true).
undoSupport- Indicates whether commands that change the document (if this is an InDesign/InCopy document) will appear on the undo menu (default=IDocument::kFullUndoSupport).
uiFlags- Whether to show UI (default is full UI).
Returns
- A UIDRef for the opened document.
virtual void IInCopyDocUtils::DoRevert (const UIDRefdoc,
UIFlags uiFlags = kFullUI 
)
pure virtual

DoRevert closes a document without saving and reopens its original (typically from a file).

Parameters
doc- The document to revert.
uiFlags- Whether to show UI (default is full UI).
virtual void IInCopyDocUtils::DoSave (const UIDReftextModel,
UIFlags uiFlags = kFullUI 
)
pure virtual

DoSave write the InCopy story to whatever storage is desired, normally a file. If story is not saved yet, it will invoke DoSaveAs behavior. Starting in CS5, it will carried out save as background task if story is already saved.

Parameters
textModel- The story to write.
uiFlags- Whether to provide UI or not.
virtual void IInCopyDocUtils::DoSaveAll (const UIDRefdoc,
UIFlags uiFlags = kFullUI 
)
pure virtual

DoSaveAll saves all InCopy stories in a document.

Parameters
doc- The document.
uiFlags- Whether to provide UI or not.
virtual void IInCopyDocUtils::DoSaveAs (const UIDRefdoc,
bool16 copy = kFalse,
const IDFiledestFile = nil,
UIFlags uiFlags = kFullUI,
bool8 asStationary = kFalse,
FileTypeInfoID fileTypeID = kInvalidFileTypeInfoID 
)
pure virtual

DoSaveAs saves an InCopy story to a new file.

Parameters
doc- The document containing the story.
copy- Whether to save a copy or not. Default is false.
destFile- A pointer to an IDFile to store into (default is unspecifed).
uiFlags- Whether or not to show UI (default is full UI).
asStationary- Whether or not to save stationery (default is false).
fileTypeID- What file type to use (default is kInvalidFileTypeInfoID).
virtual void IInCopyDocUtils::DoUpdateDesign (const UIDRefdocRef,
UIFlags uiFlags = kFullUI 
)
pure virtual

DoUpdateDesign closes and reopens a document, typically when a newer version becomes available.

Parameters
docRef- The document to update.
uiFlags- Whether to show UI (default is full UI).
virtual void IInCopyDocUtils::ExportAllLinkedStories (IDocumentdoc,
const FileTypeInfoIDfileTypeID,
UIFlags uiFlags = kFullUI 
)
pure virtual

ExportAllLinkedStories iterates through all the InCopy stories in a document and exports them. Stories are stored in the file specified by their datalink and the datalink is marked as up to date. This must be called from within a command or other database transaction.

Parameters
doc- The document
fileTypeID- unused
uiFlags- Whether to present UI while exporting.
virtual ErrorCode IInCopyDocUtils::ExportLinkedStory (const UIDRefstory,
const FileTypeInfoIDfileTypeID 
)
pure virtual

ExportLinkedStory exports a story which already has a datalink on it. This method does not update the datalink or modify the database.

Parameters
story- The UIDRef of the ITextModel to export.
fileTypeID- kInCopyXMLInterchangeFileTypeInfoID or kInCopyXMLMarkupFileTypeInfoID or kInCopyTemplateFileTypeInfoID
Returns
- An error code or kSuccess.
virtual void IInCopyDocUtils::ExportStoryAndCreateLink (const UIDRefstory,
const IDFilefile,
const FileTypeInfoIDfileTypeID 
)
pure virtual

ExportStoryAndCreateLink exports a story and creates a datalink for it. This must be called from within a command or other database transaction.

Parameters
story- The UIDRef of the ITextModel to export.
file- The IDFile to write the story into.
fileTypeID- kInCopyXMLInterchangeFileTypeInfoID or kInCopyXMLMarkupFileTypeInfoID or kInCopyTemplateFileTypeInfoID
virtual void IInCopyDocUtils::GetCopyDefaultName (const UIDRefdoc,
IDFilename,
bool16 & useSystemDefaultDir 
)
pure virtual

GetCopyDefaultName generates a "save a copy" name and path using the first story in the document.

Parameters
doc- The document.
name- The returned document name and location.
useSystemDefaultDir- If false on return, then the name is a full specification. If true, then only the name is specified and the caller will need to determine the directory.
virtual UIDRef IInCopyDocUtils::GetFirstUserStory (IDocumentdoc)
pure virtual

GetFirstUserStory finds the first user accessible story in a document.

Parameters
doc- The document to search.
Returns
- The UIDRef of the first story.
virtual void IInCopyDocUtils::GetLinkedStories (IDocumentdoc,
UIDListstories,
UIDListlinks,
IDataBasedb = nil 
)
pure virtual

GetLinkedStories finds all stories with an InCopy format datalink.

Parameters
doc- The document to search.
stories- A returned list of found stories.
links- A returned list of links.
db- The document's database, which can be safely omitted since it defaults properly.
virtual bool16 IInCopyDocUtils::GetOpenFileType (const IDFilesysFile,
SysOSType & type 
)
pure virtual

GetOpenFileType returns the Macintosh file type of an open file.

Parameters
sysFile- The IDFile of the file in question.
type- The Macintosh file type of the open file.
Returns
- Whether or not the file type was recognized.
virtual bool16 IInCopyDocUtils::GetStreamFileType (IPMStreamstream,
SysOSType & type 
)
pure virtual

GetStreamFileType checks the stream for "magic bytes" that indicate its type.

Parameters
stream- The stream.
type- The type of the stream.
Returns
- Whether or not this is a known stream type.
virtual void IInCopyDocUtils::ImportAllLinkedStories (IDocumentdoc,
const FileTypeInfoIDfileTypeID,
IInCopyImportOptionsoptions 
)
pure virtual

ImportAllLinkedStories updates all InCopy stories in a document from their datalinked files.

Parameters
doc- The document.
fileTypeID- The file type of the containing document.
options- The import options to use for old incd file links.
virtual ErrorCode IInCopyDocUtils::ImportLinkedStory (const UIDRefstory,
const FileTypeInfoIDfileTypeID,
IInCopyImportOptionsoptions = nil 
)
pure virtual

ImportLinkedStory reads in a single linked InCopy story.

Parameters
story- The ITextModel UIDRef.
fileTypeID- The type of the imported file.
options- The import options to use (primarily for old incd files).
Returns
- An error code or kSuccess.
virtual ErrorCode IInCopyDocUtils::ImportStoryAndCreateLink (const UIDRefstory,
IPMStreamstream,
IInCopyImportOptionsoptions,
const FileTypeInfoIDfileTypeID,
bool16 createLink = kTrue,
UIDRefimportedItem = nil 
)
pure virtual

ImportStoryAndCreateLink reads in a story and optionally creates a link.

Parameters
story- The ITextModel UIDRef.
stream- The stream to read the new story from.
options- The import options to use (primarily for old incd files).
fileTypeID- The type of the imported file.
createLink- Whether to create a datalink or not.
importedItem- A UIDRef to the page item that was created.
Returns
- An error code or kSuccess.
virtual bool16 IInCopyDocUtils::IsFileAlreadyOpen (const IDFilefile,
UIDRefdoc,
UIDReffoundStory = nil 
)
pure virtual

IsFileAlreadyOpen determines if a story is already open, in either an InDesign document, an assignment or a standalone InCopy document.

Parameters
file- The story file.
doc- The UIDRef of the open document that contains the story.
foundStory- The UIDRef of the open story.
Returns
- Whether the story was found or not. If true, then doc and foundStory are valid.
virtual bool16 IInCopyDocUtils::IsReadOnly (IDocumentiDoc)
pure virtual

IsReadOnly determines if a document can be modified.

Parameters
iDoc- The document.
Returns
- Whether or not it can be modified.
virtual void IInCopyDocUtils::LockNonInCopyStories (const UIDRefdoc)
pure virtual

LockNonInCopyStories runs through all the stories in a document and locks the ones which are not InCopy stories (graphics or text). InCopy stories are locked or unlocked elsewhere based on their "checked out" state.

Parameters
doc- The document.
virtual IDocFileHandler* IInCopyDocUtils::QueryDocFileHandler ()
pure virtual

QueryDocFileHandler returns a refcounted InCopy IDocFileHandler.

Returns
- The reference counted IDocFileHandler pointer. Typically this should immediately land in an InterfacePtr.
virtual void IInCopyDocUtils::SetInCopyUserFile (IDocumentdoc,
const IDFilenewFile 
)
pure virtual

SetInCopyUserFile informs the document that it is actually an InCopy file instead of an InDesign database (even though it really is an InDesign database). This affects recovery in InCopy primarily.

Parameters
doc- The document.
newFile- The InCopy file associated with this document.
virtual bool16 IInCopyDocUtils::ShouldDoSaveAs (IDocumentdoc)
pure virtual

ShouldDoSaveAs determines if the document already has a place to save or if it needs a SaveAs operation.

Parameters
doc- The document to save.
Returns
- Whether or not SaveAs should be done.