InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IMetaDataAccess.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Burbidge
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 __IMetaDataAccess_h__
25 #define __IMetaDataAccess_h__
26 
27 // ----- Interfaces -----
28 #include "IPMUnknown.h"
29 
30 // ----- Includes -----
31 #include "MetaDataTypes.h"
32 
33 // ----- ID.h files -----
34 #include "MetaDataID.h"
35 
36 
37 class IPMStream;
38 class IMetaDataIterator;
39 
40 
41 //========================================================================================
42 // CLASS IMetaDataAccess
43 //========================================================================================
44 
45 
47 typedef enum
48 {
50  metadata_alt,
51 
53  metadata_bag,
54 
56  metadata_seq,
57 
59  metadata_sct_unknown
60 } MetaDataStructContainerType;
61 
71 {
72 public:
73  enum { kDefaultIID = IID_IMETADATAACCESS };
74 
76  typedef enum
77  {
79  kIterJustChildren = 0x0100UL,
80 
82  kIterJustLeafNodes = 0x0200UL,
83 
85  kIterJustLeafName = 0x0400UL,
86 
90 
94  typedef enum
95  {
97  kIterSkipSubtree = 0x0001UL,
98 
100  kIterSkipSiblings = 0x0002UL
101  } SkipOptions;
112  virtual void Package(const bool16& package = kTrue) = 0;
113 
118  virtual bool16 IsPackaged() const = 0;
119 
128  virtual void AllowInPlaceModification(const bool16& inPlaceModification = kTrue) = 0;
129 
134  virtual bool16 CanModifyInPlace() const = 0;
135 
142  virtual void Expandable(const bool16& expandable = kTrue) = 0;
143 
148  virtual bool16 IsExpandable() const = 0;
149 
150 
159  virtual bool16 LoadFromStream(IPMStream* stream, int32 numOfBytes = -1) = 0;
160 
170  virtual bool16 SaveToStream(IPMStream* stream, const bool16& package = kTrue,
171  const bool16& allowInPlaceModification = kTrue,
172  const bool16& expandable = kTrue,
173  const bool16& packetDisabled = kFalse) const = 0;
174 
182  virtual bool16 AppendFromStream(IPMStream* stream, const bool16 replaceOld, const bool16 treatAllAsExternal = kFalse) = 0;
183 
184 
201  virtual IMetaDataIterator* Enumerate(const PMString& ns, const PMString& subPath, const IMetaDataAccess::IteratorOptions& options = IMetaDataAccess::kIterJustChildren) const = 0;
208  virtual IMetaDataIterator* Enumerate() const = 0;
218  virtual bool16 Get(const PMString& ns, const PMString& path, PMString& value, metadata::PropertyOptions* options = 0) const = 0;
219 
227  virtual void Set(const PMString& ns, const PMString& path,
228  const PMString& value, const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
229 
235  virtual void Remove(const PMString& ns, const PMString& path) = 0;
236 
243  virtual size_t Count(const PMString& ns, const PMString& path) const = 0;
244 
251  virtual bool16 PropertyExists(const PMString& ns, const PMString& path) const = 0;
252 
262  virtual void AppendArrayItem(const PMString& ns, const PMString& arrayName,
263  const PMString& value, const MetaDataStructContainerType type,
264  const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
265 
275  virtual void SetArrayItem(const PMString& ns, const PMString& arrayName,
276  int32 index, const PMString& value,
277  const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
278 
289  virtual bool16 GetArrayItem(const PMString& ns, const PMString& arrayName,
290  int32 index, PMString& value,
291  metadata::PropertyOptions* options = 0) const = 0;
292 
300  virtual void DeleteArrayItem(const PMString& ns, const PMString& arrayName, int32 index) = 0;
301 
312  virtual void SetStructField(const PMString& ns, const PMString& structName,
313  const PMString& fieldNs, const PMString& fieldName, const PMString& value,
314  const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
315 
326  virtual bool16 GetStructField(const PMString& ns, const PMString& structName,
327  const PMString& fieldNs, const PMString& fieldName, PMString& value,
328  const metadata::PropertyOptions* options = 0) const = 0;
329 
337  virtual void DeleteStructField(const PMString& ns, const PMString& structName,
338  const PMString& fieldNs, const PMString& fieldName) = 0;
339 
352  virtual void SetLocalizedText(const PMString& ns, const PMString& arrayName,
353  const PMString& genericLang, const PMString& specificLang, const PMString& value,
354  const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
355 
369  virtual bool16 GetLocalizedText(const PMString& ns, const PMString& arrayName,
370  const PMString& genericLang, const PMString& specificLang,
371  PMString& actualLang, PMString& value,
372  const metadata::PropertyOptions* options = 0) const = 0;
373 
385  virtual void ComposeArrayItemPath(const PMString& schemaNs, const PMString& arrayName, int32 index, PMString& path) const = 0;
386 
395  virtual void ComposeStructFieldPath(const PMString& schemaNs, const PMString& structName, const PMString& fieldNs, const PMString& fieldName, PMString& path) const = 0;
396 
404  virtual void ComposeLangSelector(const PMString& schemaNs, const PMString& arrayName, const PMString& langName, PMString& path) const = 0;
405 
414  virtual void SetBoolean(const PMString& ns, const PMString& path, const bool16& value) = 0;
415 
423  virtual bool16 GetBoolean(const PMString& ns, const PMString& path, bool16& value) const = 0;
424 
431  virtual void SetDateTime(const PMString& ns, const PMString& path, const XMP_DateTime& value) = 0;
432 
440  virtual bool16 GetDateTime(const PMString& ns, const PMString& path, XMP_DateTime& value) const = 0;
441 
448  virtual void SetResourceRef(const PMString& ns, const PMString& path, const metadata::ResourceRef& resource) = 0;
449 
457  virtual bool16 GetResourceRef(const PMString& ns, const PMString& path, metadata::ResourceRef& resource) const = 0;
458 
463  virtual void SetInstanceID(const PMString& instanceID) = 0;
464 
469  virtual PMString GetInstanceID() const = 0;
470 
475  virtual PMString GenerateUniqueID() const = 0;
476 
485  virtual bool16 RegisterNamespace(const PMString& ns, const PMString& suggestedPrefix, PMString& registeredPrefix) = 0;
486 
493  virtual bool16 GetNamespacePrefix(const PMString& ns, PMString& prefix) const = 0;
494 
501  virtual bool16 GetNamespace(const PMString& prefix, PMString& ns) const = 0;
502 
507  virtual void DeleteNamespace(const PMString& ns) = 0;
508 
509 
515  virtual void ClearAllProperties() = 0;
516 
530  virtual bool16 DuplicateSubtree(PMString const &srcNS, PMString const &srcPath, PMString const &destNS, PMString const &destPath) = 0;
531 //
532 // Wrappers on XMP Document Operations Utilities
533 //
534 // Calls SXMPDocOps::NewXMP. -- FOR INTERNAL USE ONLY
535  virtual void NewXMP() = 0;
536 
537 // Calls SXMPDocOps::PrepareForSave -- FOR INTERNAL USE ONLY
538  virtual void PrepareForSave(bool16 bIncludePantry = kFalse) = 0;
539 
540 // Calls SXMPDocOps::NoteChange -- FOR INTERNAL USE ONLY
541  virtual void NoteChange(PMString const &changeStr) = 0;
542 
543 // Calls SXMPDocOps::NoteChange with "/metadata" -- FOR INTERNAL USE ONLY
544  virtual void NoteMetaDataChanged() = 0;
545 
546 // Calls SXMPDocOps::OpenXMP -- FOR INTERNAL USE ONLY
547  virtual void OpenXMP() = 0;
548 
549 // Calls SXMPDocOps::BranchXMP -- FOR INTERNAL USE ONLY
550  virtual void BranchXMP() = 0;
551 
552 // Tells whether NewXMP or OpenXMP have been called -- FOR INTERNAL USE ONLY
553  virtual bool16 XMPDocOpsReady() = 0;
554 
555 // Adds an Ingredients List / Pantry entry for a linked file -- FOR INTERNAL USE ONLY
556  virtual void AddIngredientXMP(
557  std::string* filepath, // pass nil to omit pantry entry
558  const PMString& in_toPart, // (Text) The destination "part".
559  const PMString& in_fromPart, // (Text) The source "part".
560  const PMString& in_linkForm,
561  const PMString& in_linkCategory,
562  const PMString& in_filePath,
563  const PMString& in_alternatePaths,
564  const PMString& in_fileModTime,
565  const PMString& in_placedXResolution,
566  const PMString& in_placedYResolution,
567  const PMString& in_placedResolutionUnit) = 0;
568 
569 // Remove an ingredient
570  virtual void RemoveIngredientXMP(int nth) = 0;
571 
572 // Clear the Ingredients list
573  virtual void ClearIngredientsXMP() = 0;
574 
585  virtual void SetStructField(const PMString& ns, const PMString& structName,
586  const PMString& fieldNs, const PMString& fieldName, const std::string& value,
587  const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
588 
599  virtual bool16 GetStructField(const PMString& ns, const PMString& structName,
600  const PMString& fieldNs, const PMString& fieldName, std::string& value,
601  const metadata::PropertyOptions* options = 0) const = 0;
602 
610  virtual void Set(const PMString& ns, const PMString& path,
611  const std::string& value, const metadata::PropertyOptions options = metadata::kNoOptions) = 0;
612 
622  virtual bool16 Get(const PMString& ns, const PMString& path, std::string& value, metadata::PropertyOptions* options = 0) const = 0;
623 
628  virtual PMString GenerateDocumentID() const = 0;
629 
630 };
631 
632 
633 #endif // __IMetaDataAccess_h__