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

#include <IBookUtils.h>

Inheritance diagram for IBookUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IBOOKUTILS }
 
enum  GatherPagesError { kGatherPagesSuccess, kGatherPagesNoEvenPages, kGatherPagesNoOddPages }
 

Public Member Functions

virtual BookContentStatus::State GetBookContentStatus (IBookContent *iBookContent)=0
 
virtual IDocumentFindDocFromContentUID (IDataBase *db, UID content, IDFile &sysFile, bool16 &isMissingPlugins, bool16 bShowAlert=kFalse)=0
 
virtual ICommandCreateOpenDocCmd (IDFile sysFile)=0
 
virtual ErrorCode ProcessModifySectionCmd (bool16 bDefaultSection, ISection *iSection, int32 newStartPageNum, const PMString *existingName, const PMString *existingMarker, ClassID existingStyleID, bool16 bPageNumIncludeSectionPrefix, bool16 doNotify=kFalse)=0
 
virtual IDataBase::DBResultCode BookDBCallback (int32 stepsDone, int32 stepCount)=0
 
virtual bool16 IsBookContent (IDocument *iDoc, IBook *iBook, int32 &position)=0
 
virtual void GetOversetState (IDocument *doc, K2Vector< bool16 > &state)=0
 
virtual void AlertMessageAboutDocument (IDFile sysFile, PMString alertMsg)=0
 
virtual void AlertMessageAboutDocument (PMString *docFullName, PMString alertMsg)=0
 
virtual ErrorCode ProcessRepagination (const PMString &bookName, const ISetRepaginationCmdOptions::UpdateOptionsEnum updateOptions=ISetRepaginationCmdOptions::kUpdatePageNumbers, const int32 &position=-1, const bool16 &bAutoConvertDocuments=kFalse)=0
 
virtual int32 GetStyleGroupNameIndex (const PMString &groupName)=0
 
virtual PMString GetStyleGroupName (int32 index)=0
 
virtual ErrorCode OpenBookWithUI (const IDFile &sysFile, UIDRef *openedBook=nil)=0
 
virtual bool16 GetActiveBookName (PMString &bookName)=0
 
virtual IDocumentOpenDocAtBackground (const IDFile &sysFile, bool16 &originalOpen, bool16 &isMissingPlugins)=0
 
virtual int32 GetBookRepaginateStartIndex (const PMString &bookName)=0
 
virtual int32 GetPageRange (IDocument *doc, PMString &pageRange)=0
 
virtual int32 GetNonHiddenStartPageNum (IDocument *doc)=0
 
virtual ErrorCode CanDocBeAddedToBook (IDFile &sysFile, int32 *firstPageNum, PMString &pageRangeString)=0
 
virtual void DisplayAlertString (PMString &alertString, IDFile &sysFile)=0
 
virtual ErrorCode ReplaceBookContentWithNewDocument (const UIDRef &bookContentRef, const IDFile &docFile, const IDFile &bookFile)=0
 
virtual bool16 IsMissingCriticalOrDefaultPlugins (IDocument *doc)=0
 
virtual ErrorCode SetAutoConvertDocument (const UIDRef &bookRef, const bool16 &bAutoConvertFlag, const bool16 &bSpecialHandlingBookModifyFlag=kFalse)=0
 
virtual ErrorCode SetMergeLayersFlag (const UIDRef &bookRef, const bool16 &mergeLayersFlag)=0
 
virtual bool16 IsBookCreatedInPreviousVersion (IBook *iBook)=0
 
virtual bool16 IsSourceDocumentAlreadyOpen (const IDFile &sourceFile, int32 &fileIndex)=0
 
virtual IBookIsDocumentWithinCurrentBook (IDocument *doc)=0
 
virtual void CloseDocumentsInBook (OriginallyCloseDocInfo &docInfo)=0
 
virtual ErrorCode OpenOneDocument (IDataBase *bookDB, const UID bookContentUID, UIDRef &docRef, OriginallyCloseDocInfo &docInfo)=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

Utility interface with methods relating to the model side of books (kBookBoss).

See Also
kUtilsBoss

Member Function Documentation

virtual void IBookUtils::AlertMessageAboutDocument (IDFile sysFile,
PMString alertMsg 
)
pure virtual

Bring up warning alert related to the the given document and alert message.

Parameters
sysFileIN the file that serves as a parameter in the alert message.
alertMsgIN the alert message appears in the warning alert.
virtual void IBookUtils::AlertMessageAboutDocument (PMStringdocFullName,
PMString alertMsg 
)
pure virtual

Bring up warning alert related to the the given document and alert message.

Parameters
docFullNameIN the document full name(with path) that serves as a parameter in the alert message.
alertMsgIN the alert message appears in the warning alert.
virtual IDataBase::DBResultCode IBookUtils::BookDBCallback (int32 stepsDone,
int32 stepCount 
)
pure virtual

A callback to check if user hits cancel or not in the progress bar during open book action. We use stepsDone and stepCount to determine the progress of open action. This function is copied from DocumentUtils::DocDBCallback().

Parameters
stepsDoneIN a variable to quantify how much we have done.
stepCountIN a variable to quantify how much total we should complete.
Returns
IDataBase::DBResultCode kUserCanceled means user cancel the open action, otherwise return kNoError.
virtual ErrorCode IBookUtils::CanDocBeAddedToBook (IDFilesysFile,
int32 * firstPageNum,
PMStringpageRangeString 
)
pure virtual

Check if the give document/chapter can be added to a book or not.

Parameters
sysFileIN the given document/chapter that is going to be added in a book.
firstPageNumOUT the integer value for the first page number of the document.
pageRangeStringOUT the string that represents the page range of the document.
Returns
ErrorCode kSuccess means the document/chapter can be added to book, otherwise means it can not be added to book.
virtual void IBookUtils::CloseDocumentsInBook (OriginallyCloseDocInfodocInfo)
pure virtual

Close the given documents (currentOpenedDocumentList) in the book.

Parameters
currentOpenedDocumentListIN the given document list.
closeDocUndoStateListIN the corresponding undo state list for the given opened document list.
virtual ICommand* IBookUtils::CreateOpenDocCmd (IDFile sysFile)
pure virtual

With the given document's SysFile, create an open document command without a layout window.

Parameters
sysFileIN the file of the document to be open.
Returns
ICommand* the command created.
virtual void IBookUtils::DisplayAlertString (PMStringalertString,
IDFilesysFile 
)
pure virtual

Display the alert dialog with the given alert message and file name.

Parameters
alertStringIN the given alert message.
sysFileIN the file name that is used as a parameter in the alert message.
virtual IDocument* IBookUtils::FindDocFromContentUID (IDataBasedb,
UID content,
IDFilesysFile,
bool16 & isMissingPlugins,
bool16 bShowAlert = kFalse 
)
pure virtual

Find the corresponding document in the open document list with the given book content's UID and book's database.

Parameters
dbIN the database of book
contentIN the UID of document/chapter in book database
sysFileOUT the document
isMissingPluginsOUT flag indicates if there is missing plugins in the document or not.
bShowAlertIN flag indicates if we should show the alert related to missing plugins or not.
Returns
IDocument* the corresponding document in the document list, if it returns nil means we can't find it.
virtual bool16 IBookUtils::GetActiveBookName (PMStringbookName)
pure virtual

Get the current active book in this session. If there is an active book, book name will be passed out.

Parameters
bookNameOUT the name of the active book.
Returns
bool16 kTrue means there is active book in this session, otherwise, return kFalse.
virtual BookContentStatus::State IBookUtils::GetBookContentStatus (IBookContentiBookContent)
pure virtual

Get the status (normal, missing, out of data, in use or open) of the document/chapter in the book.

Parameters
iBookContentIN the document/chapter in the book.
Returns
BookContentStatus::State
virtual int32 IBookUtils::GetBookRepaginateStartIndex (const PMStringbookName)
pure virtual

Get the position of document/chapter within the given book that from which we should start to do repagination.

Parameters
bookNameIN the name of the given book.
Returns
int32 the index of document/chapter within the given book. If it returns -1, it means the given book does not exist.
virtual int32 IBookUtils::GetNonHiddenStartPageNum (IDocumentdoc)
pure virtual

Get the first non hidden page number and page range of the given document.

Parameters
docIN the given document we will get page information from.
Returns
int32 the first non hidden page number of the given document.
virtual void IBookUtils::GetOversetState (IDocumentdoc,
K2Vector< bool16 > & state 
)
pure virtual

Get the status of overset for each story in the given document.

Parameters
docIN the given document.
statea list of bool16 data corresponding to the overset status for individual stories in the document.
virtual int32 IBookUtils::GetPageRange (IDocumentdoc,
PMStringpageRange 
)
pure virtual

Get the first page number and page range of the given document.

Parameters
docIN the given document we will get page information from.
pageRangeOUT the string representation of the page range like (3-10)
Returns
int32 the first page number of the given document.
virtual PMString IBookUtils::GetStyleGroupName (int32 index)
pure virtual

Get the group name of the synchronization styles with the given index. Currently, we only support two groups: General Styles and CJK Styles.

Parameters
indexIN the passed index.
Returns
PMString the name of the group.
virtual int32 IBookUtils::GetStyleGroupNameIndex (const PMStringgroupName)
pure virtual

Get the group index of synchronization styles with the give group name.

Parameters
groupNameIN the group name.
Returns
int32 the index with the groups.
virtual bool16 IBookUtils::IsBookContent (IDocumentiDoc,
IBookiBook,
int32 & position 
)
pure virtual

Check if the given document is a book chapter or not. If it is, we will pass out the chapter's position in the book through param position; if it is not, we will set param position as -1.

Parameters
iDocIN the given document to check.
iBookIN the given book.
positionOUT the position of the chapter in the book.
Returns
bool16 the flag indicates if the given document is book chapter or not, kTrue means it is; kFalse means it is not.
virtual bool16 IBookUtils::IsBookCreatedInPreviousVersion (IBookiBook)
pure virtual

Check if the given book is created in previous version or not.

Parameters
iBookIN the book to check.
Returns
bool16 kTrue means the book is created in previous version, kFalse means it is not.
virtual IBook* IBookUtils::IsDocumentWithinCurrentBook (IDocumentdoc)
pure virtual

Check if the given document is within current open book or not.

Parameters
docIN the given document.
Returns
IBook the current active book.
virtual bool16 IBookUtils::IsMissingCriticalOrDefaultPlugins (IDocumentdoc)
pure virtual

Check if the document has any critical or default plugins missing.

Parameters
docIN the given document to check.
Returns
bool16 kTrue means there is one or more critical or default plugins missing; kFalse means there is not.
virtual bool16 IBookUtils::IsSourceDocumentAlreadyOpen (const IDFilesourceFile,
int32 & fileIndex 
)
pure virtual

Check if the given source file is already open or not.

Parameters
sourceFileIN the given file to check
fileIndexOUT the index within the documentList. If file is not open, fileIndex will be -1.
Returns
bool16 kTrue means the file is open already, kFalse means not open.
virtual ErrorCode IBookUtils::OpenBookWithUI (const IDFilesysFile,
UIDRefopenedBook = nil 
)
pure virtual

Open a book file with a book panel as the UI representation.

Parameters
sysFileIN the book file to open.
openedBookOUT the UIDRef of the opened book.
Returns
ErrorCode kSuccess means successfully opened, otherwise return kFailure or kCancel.
virtual IDocument* IBookUtils::OpenDocAtBackground (const IDFilesysFile,
bool16 & originalOpen,
bool16 & isMissingPlugins 
)
pure virtual

Open the document without a layout window and bring up alert if document has data from missing plugins.

Parameters
sysFileIN the given document file.
originalOpenOUT flag indicates if document is originally opened or not.
isMissingPluginsOUT flag indicates if document has missing plugin data or not.
Returns
IDocument* the interface pointer to the opened document.
virtual ErrorCode IBookUtils::OpenOneDocument (IDataBasebookDB,
const UID bookContentUID,
UIDRefdocRef,
OriginallyCloseDocInfodocInfo 
)
pure virtual
    Open the document corresponding to the given book content. If there are 

    no available database, we will have to close the given opened document and update the undo state list.

Parameters
bookDBIN the given book database.
bookContentUIDIN the given book content UID within book database.
currentOpenedDocumentListIN the given opened document list.
closeDocUndoStateListIN the corresponding undo state list for the given opened document lsit.
Returns
ErrorCode return kSuccess if we succeed in opening the document; other return kFailuare.
virtual ErrorCode IBookUtils::ProcessModifySectionCmd (bool16 bDefaultSection,
ISectioniSection,
int32 newStartPageNum,
const PMStringexistingName,
const PMStringexistingMarker,
ClassID existingStyleID,
bool16 bPageNumIncludeSectionPrefix,
bool16 doNotify = kFalse 
)
pure virtual

Modify the given section with the new section's attributes(start page number, name, marker and style).

Parameters
bDefaultSectionIN flag indicates if this is a default section or not.
iSectionIN the section that is going to be modified.
newStartPageNumIN the new start page number for the section.
existingNameIN the new name for the section.
existingMarkerIN the new marker for the section.
existingStyleIDIN the new style for the section.
bPageNumIncludeSectionPrefixIN the flag indicates if we should include section prefix when do page numbering.
doNotifyIN the flag indicates if we should do notification when command is done.
Returns
ErrorCode the result of the command.
virtual ErrorCode IBookUtils::ProcessRepagination (const PMStringbookName,
const ISetRepaginationCmdOptions::UpdateOptionsEnum updateOptions = ISetRepaginationCmdOptions::kUpdatePageNumbers,
const int32 & position = -1,
const bool16 & bAutoConvertDocuments = kFalse 
)
pure virtual

Do repagination starting from the given document/chapter position within the book. By default, we do repagination from the first document/chapter in the book.

Parameters
bookNameIN the book where we do the repagination.
updateOptionsIN operations to be done e.g. Repagination, Update Chapter and Paragrapgh Numbering, All
See Also
ISetRepaginationCmdOptions
Parameters
positionIN from which the repagination action start.
bAutoConvertDocumentsIN flag indicates if we should save the originally closed documents when close it.
Returns
ErrorCode the result of repagination.
virtual ErrorCode IBookUtils::ReplaceBookContentWithNewDocument (const UIDRefbookContentRef,
const IDFiledocFile,
const IDFilebookFile 
)
pure virtual

Replace the given book content(UIDRef in the book database) with a new document/chapter.

Parameters
bookContentRefIN the given book content to be replaced with.
docFileIN the document/chapter to be replace by.
bookFileIN the given book.
Returns
ErrorCode the result for the replace action.
virtual ErrorCode IBookUtils::SetAutoConvertDocument (const UIDRefbookRef,
const bool16 & bAutoConvertFlag,
const bool16 & bSpecialHandlingBookModifyFlag = kFalse 
)
pure virtual

Set auto conversion flag in the book.

Parameters
bookRefIN the book that we want to alter
bAutoConvertFlagIN the new flag(either kTrue or kFalse) for auto conversion in book.
bSpecialHandlingBookModifyFlagIN kTrue = we should do special handling of book modification flag when the auto convert setting is set; otherwise (kFalse) indicates don't any special handling.
Returns
ErrorCode the result of this action.
virtual ErrorCode IBookUtils::SetMergeLayersFlag (const UIDRefbookRef,
const bool16 & mergeLayersFlag 
)
pure virtual

Set merge layers flag in the book.

Parameters
bookRefIN the book that we want to alter
mergeLayersFlagIN the new flag(either kTrue or kFalse) for merging identical layers in book when exporting.
Returns
ErrorCode the result of this action.