InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IBookUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Yeming Liu, (Bernd Paradies: generalized from BookUtils.h).
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IBOOKUTILS__
25 #define __IBOOKUTILS__
26 
27 #include "BookID.h"
28 #include "IPMUnknown.h"
29 #include "IDataBase.h"
30 #include "ISetRepaginationCmdOptions.h"
31 #include "PMString.h"
32 #include "K2Vector.h"
33 #include "Utils.h"
34 
35 class IDocument;
36 class ISection;
37 class ICommand;
38 class IBook;
39 class IPanelControlData;
40 class UIDRef;
41 class IBookContent;
42 
43 
44 namespace BookContentStatus
45 {
46  typedef enum {
47  kDocNormal = 0,
48  kDocMising,
49  kDocOutofDate,
50  kDocInUse,
51  kDocOpen
52  } State;
53 }
54 
58 {
59  public:
60  typedef object_type data_type;
61 
65  fCurrentOpenedDocumentList()
66  {}
67 
73  fCurrentOpenedDocumentList(documentList)
74  {}
75 
80  bool16 operator==(const OriginallyCloseDocInfo& other) const
81  {
82  return fCurrentOpenedDocumentList == other.fCurrentOpenedDocumentList;
83  }
84 
85  void Clear()
86  {
87  fCurrentOpenedDocumentList.clear();
88  }
89 
90  K2Vector<UIDRef> fCurrentOpenedDocumentList;
91 };
92 
93 // The extra slop for the databases that can be opened at one session.
94 const int32 kOpenDatabasesBuffer = 5;
95 
100 class IBookUtils : public IPMUnknown
101 {
102 public:
103  enum { kDefaultIID = IID_IBOOKUTILS };
104 
105  enum GatherPagesError
106  {
107  kGatherPagesSuccess,
108  kGatherPagesNoEvenPages,
109  kGatherPagesNoOddPages
110  };
111 
116  virtual BookContentStatus::State GetBookContentStatus(IBookContent *iBookContent) = 0;
117 
126  virtual IDocument* FindDocFromContentUID(IDataBase* db, UID content, IDFile& sysFile, bool16& isMissingPlugins, bool16 bShowAlert = kFalse) = 0;
127 
132  virtual ICommand* CreateOpenDocCmd(IDFile sysFile) = 0;
133 
145  virtual ErrorCode ProcessModifySectionCmd
146  (
147  bool16 bDefaultSection,
148  ISection* iSection,
149  int32 newStartPageNum,
150  const PMString* existingName,
151  const PMString* existingMarker,
152  ClassID existingStyleID,
153  bool16 bPageNumIncludeSectionPrefix,
154  bool16 doNotify = kFalse
155  ) = 0;
156 
164  virtual IDataBase::DBResultCode BookDBCallback(int32 stepsDone, int32 stepCount) = 0;
165 
173  virtual bool16 IsBookContent(IDocument* iDoc, IBook* iBook, int32& position) = 0;
174 
179  virtual void GetOversetState(IDocument* doc, K2Vector<bool16>& state) = 0;
180 
185  virtual void AlertMessageAboutDocument(IDFile sysFile, PMString alertMsg) = 0;
186 
191  virtual void AlertMessageAboutDocument(PMString* docFullName, PMString alertMsg) = 0;
192 
201  virtual ErrorCode ProcessRepagination(const PMString& bookName, const ISetRepaginationCmdOptions::UpdateOptionsEnum updateOptions = ISetRepaginationCmdOptions::kUpdatePageNumbers, const int32& position = -1, const bool16& bAutoConvertDocuments = kFalse) = 0;
202 
203 
208  virtual int32 GetStyleGroupNameIndex(const PMString& groupName) = 0;
209 
214  virtual PMString GetStyleGroupName(int32 index) = 0;
215 
221  virtual ErrorCode OpenBookWithUI(const IDFile& sysFile, UIDRef *openedBook = nil) = 0;
222 
227  virtual bool16 GetActiveBookName(PMString& bookName) = 0;
228 
236  (
237  const IDFile& sysFile, // in
238  bool16& originalOpen, // out
239  bool16& isMissingPlugins // out
240  ) = 0;
241 
242 
247  virtual int32 GetBookRepaginateStartIndex(const PMString& bookName) = 0;
248 
254  virtual int32 GetPageRange(IDocument* doc, PMString &pageRange) = 0;
255 
260  virtual int32 GetNonHiddenStartPageNum(IDocument* doc) = 0;
261 
262 
269  virtual ErrorCode CanDocBeAddedToBook(IDFile &sysFile, int32 *firstPageNum, PMString &pageRangeString) = 0;
270 
275  virtual void DisplayAlertString(PMString& alertString, IDFile& sysFile) = 0;
276 
283  virtual ErrorCode ReplaceBookContentWithNewDocument(const UIDRef& bookContentRef, const IDFile& docFile, const IDFile& bookFile) = 0;
284 
289  virtual bool16 IsMissingCriticalOrDefaultPlugins(IDocument* doc) = 0;
290 
298  virtual ErrorCode SetAutoConvertDocument(const UIDRef& bookRef, const bool16& bAutoConvertFlag, const bool16& bSpecialHandlingBookModifyFlag = kFalse) = 0;
299 
305  virtual ErrorCode SetMergeLayersFlag(const UIDRef& bookRef, const bool16& mergeLayersFlag) = 0;
306 
311  virtual bool16 IsBookCreatedInPreviousVersion(IBook* iBook) = 0;
312 
318  virtual bool16 IsSourceDocumentAlreadyOpen(const IDFile& sourceFile, int32& fileIndex) = 0;
319 
324  virtual IBook* IsDocumentWithinCurrentBook(IDocument* doc) = 0;
325 
330  virtual void CloseDocumentsInBook(OriginallyCloseDocInfo& docInfo) = 0;
331 
340  virtual ErrorCode OpenOneDocument(IDataBase* bookDB, const UID bookContentUID, UIDRef& docRef, OriginallyCloseDocInfo& docInfo) = 0;
341 };
342 
343 
347 {
348  public:
349  typedef object_type data_type;
350 
353  inline BookContentInfo() {}
354 
358  const int32& position, // position in the list
359  const UID& content): // content
360  fPosition(position),
361  fContent(content) {}
362 
367  inline bool16 operator==(const BookContentInfo& other) const
368  {
369  return ( (fPosition == other.fPosition) &&
370  (fContent == other.fContent) );
371  }
372 
377  inline bool16 operator<(const BookContentInfo& other) const { return fPosition < other.fPosition; }
378 
381  int32 fPosition;
382 
386 };
387 
388 #endif // __IBOOKUTILS__