InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDocumentCommands.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: chris parrish
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 // Functions to aid in InCopy Document file actions
24 //
25 //========================================================================================
26 
27 #ifndef __IDocumentCommands__
28 #define __IDocumentCommands__
29 
30 #include "IPMUnknown.h"
31 #include "IDocument.h"
32 #include "IOpenFileCmdData.h"
33 #include "IPageSetupPrefs.h"
34 
35 #include "PMPageSize.h"
36 
37 #include "DocFrameworkID.h"
38 
40 {
41 public:
42  enum {kDefaultIID = IID_IDOCUMENTCOMMANDS};
43 
44  enum DocSizePreset
45  {
46  kInvalidPreset = -1,
47  kCustomPreset,
48  kLetterPortrait,
49  kA4Portrait,
50  kA4Landscape,
51  kWebLandscape,
52  kWebCommonLandscape,
53  kiPhone5Portrait,
54  kiPhone6Portrait,
55  kiPhone6PlusPortrait,
56  kiPadPortrait,
57  kiPadLandscape,
58  kTabloidPortrait,
59  kBusinessCardLandscape,
60  kAndroidLandscape,
61  kSurfacePro3Landscape,
62  };
63 
65  {
67  :
68  fPageSize(kPMPageSizeEmpty),
69  fWideOrientation(kFalse),
70  fDocIntent(kUnchangedIntent),
71  fFacingPage(kFalse),
72  fPrimaryTextFrame(kFalse)
73  {}
74 
75  PMPageSize fPageSize;
76  bool16 fWideOrientation;
77  DocumentIntent fDocIntent;
78  bool16 fFacingPage;
79  bool16 fPrimaryTextFrame;
80  };
81 
82  //----- Creation
83  //
84  // Any code looking to issue a document related command needs
85  // to use this interface
86 
87  // Execute (process) the appropriate commands depending on the product
88  virtual ErrorCode New(UIDRef *result, UIFlags uiFlags = kFullUI, PMString* styleToUse = nil,
89  IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
90  virtual ErrorCode Open(UIDRef *result, const IDFile &file, UIFlags uiFlags = kFullUI,
91  IOpenFileCmdData::OpenFlags openFlags = IOpenFileCmdData::kOpenDefault,
92  IOpenFileCmdData::LockFlags lockFlags = IOpenFileCmdData::kUseLockFile,
93  bool16 showInWindow = kTrue,
94  IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
95  virtual ErrorCode Save(const UIDRef& doc, UIFlags uiFlags = kFullUI) = 0;
96  virtual ErrorCode SaveAs(const UIDRef& doc, const IDFile& destFile, UIFlags uiFlags = kFullUI) = 0;
97  virtual ErrorCode Close(const UIDRef& doc, UIFlags uiFlags = kFullUI) = 0;
98 
99  // Return the appropriate commands depending on the product
100  virtual ICommand* CreateOpenCommand(const IDFile &file, UIFlags uiFlags = kFullUI,
101  IOpenFileCmdData::OpenFlags openFlags = IOpenFileCmdData::kOpenDefault,
102  IOpenFileCmdData::LockFlags lockFlags = IOpenFileCmdData::kUseLockFile,
103  bool16 showInWindow = kTrue,
104  IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
105  virtual ICommand* CreateNewCommand(UIFlags flags = kFullUI, PMString* styleToUse = nil, IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
106  virtual ICommand* CreateSaveCommand(const UIDRef& docToClose, UIFlags uiFlags = kFullUI) = 0;
107  virtual ICommand* CreateSaveAsCommand(void) = 0;
108  virtual ICommand* CreateSaveACopyCommand(void) = 0;
109  virtual ICommand* CreateCloseCommand(const UIDRef& doc, UIFlags uiFlags = kFullUI) = 0;
110  virtual ICommand* CreateRecoverCommand(IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
111  virtual ICommand* CreateOpenRevertedCommand(void) = 0;
112  virtual ICommand* CreatePreRevertCommand(void)= 0;
113  virtual ICommand* CreateVerifierRecoverCommand(IDocument::UndoSupport undoSupport = IDocument::kFullUndoSupport) = 0;
114 
115  //----- Identification
116  //
117  // Any code looking to take an action based on the type of a document command
118  // (Observers, responders, ...) should pass the commandID
119  // here and use the result to determine how to respond
120  // This is necessary for allowing SI's to replace these commands
121  // with their own versions that may have a different ID
122  //
123  // SI's are free to reimplement this methods as necessary for their workflows
124 
125  // Currently only identify InDesign commands. InCopy 2.0 did not
126  // modify observers to look for InCopy commands. If necessary
127  // this can be modified for the 3.0 products.
128 
129  virtual bool8 IsOpenCommand(ClassID commandID) = 0;
130  virtual bool8 IsNewCommand(ClassID commandID) = 0;
131  virtual bool8 IsSaveCommand(ClassID commandID) = 0;
132  virtual bool8 IsSaveAsCommand(ClassID commandID) = 0;
133  virtual bool8 IsSaveACopyCommand(ClassID commandID) = 0;
134  virtual bool8 IsCloseCommand(ClassID commandID) = 0;
135  virtual bool8 IsRecoverCommand(ClassID commandID) = 0;
136  virtual bool8 IsPreRevertCommand(ClassID commandID) = 0;
137  virtual bool8 IsOpenRevertedCommand(ClassID commandID) = 0;
138 
139  // Return the appropriate commands depending on the product
140  virtual ICommand* CreateNewCommandUsingPreset(DocSizePreset preset, const DocSizePresetSettings &customSettings = DocSizePresetSettings()) = 0;
141 };
142 
143 #endif //__IDocumentCommands__