InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FileLinkResourceHandler.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Easter
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 // Description:
24 //
25 //========================================================================================
26 
27 #ifndef __FileLinkResourceHandler__
28 #define __FileLinkResourceHandler__
29 
30 // ----- Includes -----
31 #include "CPMUnknown.h"
32 #include "ILinkResourceHandler.h"
33 
34 
42 class FileLinkResourceHandler : public CPMUnknown<ILinkResourceHandler>
43 {
44 public:
46  typedef object_type data_type;
47 
49  virtual ~FileLinkResourceHandler();
50 
51  virtual bool Init(const UIDRef& ref, const URI& uri);
52 
53  virtual bool IsResourceURIValid(const UIDRef& ref, const URI& uri) const;
54  virtual bool AreResourceIdsEquivalent(const ILinkResource::ResourceId& id1, const ILinkResource::ResourceId& id2) const;
55  virtual FileTypeInfo GetResourceDataType(const UIDRef& ref, const URI& uri) const;
56 
57  virtual WideString GetShortResourceName(const UIDRef& ref, const URI& uri, bool bUIName) const;
58  virtual WideString GetLongResourceName(const UIDRef& ref, const URI& uri, bool bUIName) const;
59 
60  virtual PMString GetResourceStateInfo(const UIDRef& ref, const URI& uri, ILinkResource::ResourceState state, ILinkResource::ResourceStoreState storeState) const { return PMString(); }
61 
62  virtual bool AreStampsEquivalent(const WideString& stamp1, const WideString& stamp2) const;
63 
64  virtual bool CanReadResource(const UIDRef& ref, const URI& uri) const;
65  virtual bool CanWriteResource(const UIDRef& ref, const URI& uri) const;
66  virtual bool CanReadWriteResource(const UIDRef& ref, const URI& uri) const;
67 
68  virtual bool CanCreateResourceStream(const UIDRef& ref, const URI& uri, ILinkResource::AccessMode mode) const;
69  virtual IPMStream* CreateResourceReadStream(const UIDRef& ref, const URI& uri) const;
70  virtual IPMStream* CreateResourceWriteStream(const UIDRef& ref, const URI& uri) const;
71  virtual IPMStream* CreateResourceReadWriteStream(const UIDRef& ref, const URI& uri) const;
72 
73  virtual bool CanCacheResource(const UIDRef& ref, const URI& uri) const { return true; }
74  virtual bool CanEmbedResource(const UIDRef& ref, const URI& uri) const { return true; }
75  virtual bool CanUnembedResource(const UIDRef& ref, const URI& uri) const { return true; }
76 
77  virtual bool CanCopyToFile(const UIDRef& ref, const URI& uri) const;
78  virtual ErrorCode CopyToFile(const UIDRef& ref, const URI& uri, IDFile& file) const;
79 
80  virtual bool CanEditResource(const UIDRef& ref, const URI& uri) const;
81  virtual ErrorCode EditResource(const UIDRef& ref, const URI& uri, const AppInfo& appInfo, PMString* errorString) const;
82 
83  virtual bool CanRevealResource(const UIDRef& ref, const URI& uri) const;
84  virtual ErrorCode RevealResource(const UIDRef& ref, const URI& uri) const;
85  virtual bool CanRevealResourceInBridge(const UIDRef& ref, const URI& uri) const;
86  virtual ErrorCode RevealResourceInBridge(const UIDRef& ref, const URI& uri) const;
87 
88  virtual bool CanRevealResourceInCloudLibraries(const UIDRef& ref, const URI& uri) const { return false; }
89  virtual ErrorCode RevealResourceInCloudLibraries(const UIDRef& ref, const URI& uri) const { ASSERT_UNIMPLEMENTED(); return kFailure; }
90 
91  // XMP info functions
92  virtual bool GetXMPPacketInfo(const UIDRef& resourceRef, const URI& uri, std::string& packet) const;
93  virtual bool CanGetXMPPacketInfo(const UIDRef& ref, const URI& uri) const;
94 
95  //FPO related workflow functions
96  virtual bool CanReplaceFPOWithOriginalResource(const UIDRef& ref, const URI& uri) const;
97  virtual bool CanDownloadOriginalResource(const UIDRef& ref, const URI& uri) const;
98  virtual ErrorCode DownloadOriginalResource(const UIDRef& ref, const URI& uri) const;
99  virtual ErrorCode AsyncDownloadOriginalResource(const UIDRef& ref, const URI& uri, ILinkResource::DownloadCompletionFunction completionFunction) const;
100  virtual ILinkResource::ResourceDownloadState GetResourceDownloadProgress(const UIDRef& ref, const URI& uri,PMReal& progress) const { ASSERT_UNIMPLEMENTED(); return ILinkResource::kNotStarted; };
101 
102  virtual bool CanProvideFile(const UIDRef& ref, const URI& uri) const;
103  virtual ErrorCode GetFile(const UIDRef& ref, const URI& uri, IDFile& idFile) const;
104  virtual bool canGetInstanceName() const { return false; }
105  virtual ErrorCode GetInstanceName(PMString &uri) const { return kFailure; }
106 protected:
111  bool fbInited;
112 
117 
123 
130  mutable WideString fShortUINameCache;
131  mutable WideString fLongNameCache;
132  mutable WideString fLongUINameCache;
133 
134 
135 private:
136  // Prevent copy construction and assignment.
139 };
140 
141 #endif // __FileLinkResourceHandler__