InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CInCopyStoryExportSuite.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Ben Park
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 __CInCopyStoryExportSuite__
25 #define __CInCopyStoryExportSuite__
26 
27 #include "CPMUnknown.h"
28 #include "CExportProvider.h"
29 
30 class ITextModel;
31 
32 //================================================================================================
33 // CInCopyStoryExportSuite
34 //
35 // This class provides InCopy story specific export functionality.
36 //
37 // This will do the majority of the work. The only real thing the CSB Specific Implementations need to do is get the correct Stories to be exported.
38 // NOTE: The selection architecture will not handle the layer export method.
39 //
40 //================================================================================================
42 {
43  public:
44 
45  //----------------------------------------------------------------------------------------
46  // Construction/Destruction
47  //----------------------------------------------------------------------------------------
48 
49  //----------------------------------------------------------------------------------------
50  // Constructor
51  //----------------------------------------------------------------------------------------
53  IPMUnknown* boss
54  );
55 
56  //----------------------------------------------------------------------------------------
57  // Destructor
58  //----------------------------------------------------------------------------------------
60 
61  //----------------------------------------------------------------------------------------
62  // Public Member Functions
63  //----------------------------------------------------------------------------------------
64 
65  //----------------------------------------------------------------------------------------
66  // CanExportToFile
67  //
68  // Always return kTrue
69  //----------------------------------------------------------------------------------------
70  virtual bool16 CanExportToFile() const
71  {
72  return kTrue;
73  }
74 
75  //----------------------------------------------------------------------------------------
76  // CanExportThisFormat
77  //
78  // Returns false for exporting the design format to fool the Export dialog into NOT
79  // displaying InCopy design documents as an export type.
80  // Users of the InCopyStoryExportProvider will need to assume that the provider can export
81  // the design if they can acquire the format name "InCopy Design".
82  //
83  //----------------------------------------------------------------------------------------
84  virtual bool16 CanExportThisFormat(
85  IDocument* doc,
86  IPMUnknown* targetboss,
87  const PMString& formatName
88  );
89 
90  //----------------------------------------------------------------------------------------
91  // GetNthFormatName
92  //----------------------------------------------------------------------------------------
93  virtual PMString GetNthFormatName(
94  int32 n
95  );
96 
97  //----------------------------------------------------------------------------------------
98  // CountFormats
99  //----------------------------------------------------------------------------------------
100  virtual int32 CountFormats()
101  { return 2L; }
102 
103  //----------------------------------------------------------------------------------------
104  // GetExtensionForFormatName
105  //----------------------------------------------------------------------------------------
107  const PMString& formatName
108  );
109 
110  //----------------------------------------------------------------------------------------
111  // GetScriptIDForFormatName
112  //----------------------------------------------------------------------------------------
113  virtual ScriptID GetScriptIDForFormatName(const PMString& formatName, const ScriptInfo::RequestContext& context) ;
114 
115  //----------------------------------------------------------------------------------------
116  // Export the current selection to a file using the given filename. Generate the specified file
117  // format. The calling code verifies that the file does not exist. Note: Some export providers
118  // may display UI and may export more than just the current selection (i.e. PDF export, EPS export, etc.)
119  //----------------------------------------------------------------------------------------
120  virtual void ExportToFile(
121  const IDFile& sysFile,
122  IDocument* doc,
123  IPMUnknown* targetboss,
124  const PMString& formatName,
125  UIFlags uiFlags = kFullUI
126  );
127 
128  //----------------------------------------------------------------------------------------
129  // Export the current selection to a stream. Note: Some export providers may display UI
130  // and may export more than just the current selection (i.e. PDF export, EPS export, etc.)
131  //----------------------------------------------------------------------------------------
132  virtual void ExportToStream(
133  IPMStream* stream,
134  IDocument* doc,
135  IPMUnknown* targetboss,
136  const PMString& formatName,
137  UIFlags uiFlags = kFullUI
138  );
139 
140  // --- Clipboard/DragDrop Export:
141 
142  // The provider indicates whether it can do normal filebased exports.
143  virtual bool16 CanExportForExternalize() const
144  { return kFalse; }
145 
146  // For Clip/Drag operations, what internal flavor does this exporter operate on?
147  virtual PMFlavor GetInternalFlavor() const
148  { return kNoFlavor; }
149 
150  // For Clip/Drag operations, what external flavors can this exporter produce?
151  virtual int32 CountExternalFlavors() const
152  { return 0; }
153 
154  virtual ExternalPMFlavor GetExternalFlavor(
155  int32 n
156  ) const
157  { return kNoExternalFlavor; }
158 
159  // For Clip/Drag operations, what format type, if any, would be used to produce the desired external flavor?
160  virtual bool16 CanExportThisFlavor(
161  const ExternalPMFlavor& flavor,
162  PMString& outFormatName
163  ) const
164  { return kFalse; }
165 
166  // Externalize the given data to a stream.
167  virtual ErrorCode ExportForExternalize(
168  IDataExchangeHandler *handler,
169  const ExternalPMFlavor toWhichFlavor,
170  IPMStream* stream
171  )
172  { return kFailure; }
173 
174  protected:
175 
176  // The only function that really needs to be overriden....
177  virtual UIDList GetExportableItemList(
178  IPMUnknown* targetboss
179  ) const;
180 
181  virtual bool16 ExportingForCollaboration() const
182  { return kFalse; }
183 
184 
185  private:
186  //----------------------------------------------------------------------------------------
187  // Private Member Functions
188  //----------------------------------------------------------------------------------------
189 
190  typedef CExportProvider Inherited;
191 
192  void DoExportSequence( IPMUnknown* targetBoss, IPMStream* writeStream, const IDFile& sysFile, UIFlags uiFlags, const FileTypeInfoID& fileTypeID ) const;
193 
194  // export the given stories to the provided files using multiple threads.
195  void DoMTExportInCopyStories(const UIDList& exportableList, const K2Vector<IDFile>& sysFiles, const FileTypeInfoID& fileTypeID, UIFlags uiFlags) const;
196 
204  bool16 IsInCopyFileLocked( const IDFile& sysFile, const UIDRef& itemRef, UIFlags uiFlags, bool16& isManaged ) const;
205 
211  bool16 IsItemInUse( const IDFile& sysFile, IDataBase *db, UIFlags uiFlags ) const;
212 
213  //----------------------------------------------------------------------------------------
214  // Private Data Members
215  //----------------------------------------------------------------------------------------
216  const ConstCString fInCopyInterchangeString;
217  const ConstCString fInCopyMarkupString;
218 
219  mutable K2Vector<PMString> fListOfUsedFilenames;
220 
221 };
222 
223 
224 #endif // __CInCopyStoryExportSuite__
225