InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDocFileHandler.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Roey Horns
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 // Purpose: Interface for the handler of file related actions for an open document.
24 //
25 //========================================================================================
26 
27 #ifndef __IDOCFILEHANDLER__
28 #define __IDOCFILEHANDLER__
29 
30 #include "DocumentID.h"
31 #include "IPMUnknown.h"
32 
33 
35 {
36  public:
37  enum { kDefaultIID = IID_IDOCFILEHANDLER };
38  // To Identify multiple save/open workflows for CDP launch.
39  enum SaveType{
40  //To Make it unified with the CloseAll functional and UXPCdoClientHelper functionalite we have taken default as 0
41  //The Range of enums here can range till 1000
42  kNone=0, // Default --> clear prefs
43  kClosing, // single doc is closing
44  kSaving, // single doc is saving
45  kAppQuit, // on application quit
46  kSaveAndClose, //single doc is saving while closing.
47  kSaveAndCloseAll,//multiple doc gets saved while close all is called
48  kSaveViaCDP,
49  kOpenAndLoad, //loading data from a document on open cloud doc
50  kSaveAsCopy, // save a copy of the file
51  kSaveAsCloudDoc, // save as of a cloud document
52  kSaveAsNative // save as native document.
53  };
54 
55  //Depicts save dialog button pressed state i.e cancel/save/default
56  enum SaveDialogButtonState {
57  kNoButtonPressed = 0,
58  kSavePressed = 1,
59  kCancelPressed = 2
60  };
61  // Should return kTrue if the document is modified or unsaved.
62  virtual bool8 CanSave(const UIDRef& doc) = 0;
63  // Save the document.
64  // If it is unsaved Save should call SaveAs
65  virtual void Save(const UIDRef& doc, UIFlags uiFlags = kFullUI) = 0;
66 
67  // Can save as.
68  virtual bool8 CanSaveAs(const UIDRef& doc) = 0;
69  // Save the doc as destFile.
70  // If destFile is nil SaveAs should ask the user (if uiFlags allow) or fail.
71  // The asStationery flag should be considered as Mac only and will only be honored
72  // if destFile is not nil.
73  virtual void SaveAs(const UIDRef& doc, const IDFile *destFile = nil,
74  UIFlags uiFlags = kFullUI,
75  bool8 asStationery = kFalse,
76  FileTypeInfoID fileTypeID = kInvalidFileTypeInfoID,SaveType saveType = kSaveAsNative) = 0;
77 
78  // Can save a copy.
79  virtual bool8 CanSaveACopy(const UIDRef& doc) = 0;
80  // Save a copy of the doc as destFile.
81  // If destFile is nil SaveACopy should ask the user (if uiFlags allow) or fail.
82  // The asStationery flag should be considered as Mac only and will only be honored
83  // if destFile is not nil.
84  virtual void SaveACopy(const UIDRef& doc, const IDFile *destFile = nil,
85  UIFlags uiFlags = kFullUI,
86  bool8 asStationery = kFalse,
87  FileTypeInfoID fileTypeID = kInvalidFileTypeInfoID) = 0;
88 
89  // Can revert should return kFalse if the doc is unmodified or unsaved.
90  virtual bool8 CanRevert(const UIDRef& doc) = 0;
91  // Revert should ask the user (if uiFlags allow).
92  virtual void Revert(const UIDRef& doc, UIFlags uiFlags = kFullUI) = 0;
93 
94  // Can close.
95  virtual bool8 CanClose(const UIDRef& doc) = 0;
96  // Close should close any open window and finaly the document.
97  // If uiFlags allow the user should get a chance to save a modified document.
98 
99  enum CloseCmdMode { kProcess, kSchedule, kPreProcessAndProcess };
100  virtual void Close(const UIDRef& doc, UIFlags uiFlags = kFullUI, bool8 allowCancel = kTrue, CloseCmdMode cmdMode = kSchedule) = 0;
101 
102 
103  // Methods implemented in a standard way by the default DocFileHandler. Other handlers
104  // should call these to insure consistent behavior.
105 
106  // Check to see if the file is dirty on close and, if so, ask the user whether
107  // it should be saved.
108  enum CloseOptions { kSave, kDontSave, kCancel, kSaveVersion, kJustSaveVersion, kCacelAndLaunchCDP };
109  virtual CloseOptions CheckOnClose(const UIDRef& doc, UIFlags uiFlags, bool8 allowCancel) = 0;
110  // Get the appropriate default SaveAs file name.
111  virtual void GetCopyDefaultName(const UIDRef& doc, IDFile *name, bool16& useSystemDefaultDir) = 0;
112 
113  // FOR INTERNAL USE ONLY! Very Similar to SaveAs method.
114  // Instead of destfile, pass in a filename, that will be shown pre-populated in the SaveAs dialog.
115  virtual void SaveAs2(const UIDRef& doc, const PMString& fileName, UIFlags uiFlags = kFullUI,
116  bool8 asStationery = kFalse, FileTypeInfoID fileTypeID = kInvalidFileTypeInfoID) = 0;
117  // Saves the document as a cloud doc (.inddc)
118  // assetPath is the path of the asset in adobe cloud. ex: /Cloud-content/*
119  virtual void SaveAsCloudDoc(const UIDRef& doc, const std::string & assetPath) = 0;
120 
121 };
122 
123 #endif //__IDOCFILEHANDLER__