InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IXMLUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: robin briggs
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 __IXMLUtils__
25 #define __IXMLUtils__
26 
27 #include "K2Vector.h"
28 #include "Utils.h"
29 #include "XMLID.h"
30 #include "TableTypes.h"
31 
32 class IDataBase;
33 class IDocument;
34 class IIDXMLElement;
35 class ITextModel;
36 class IXMLAccess;
37 class IXMLHandler;
38 class IXMLOutStream;
39 class IXMLReferenceData;
40 class IXMLStyleToTagMap;
41 class IXMLTagList;
42 class IXMLTagToStyleMap;
43 class UIDList;
45 class XMLReference;
46 
49 class IXMLUtils : public IPMUnknown
50 {
51  public:
52  enum {kDefaultIID = IID_IXMLUTILS};
53 
54  virtual UIDRef GetBackingStore(IDocument *doc) = 0;
55  virtual UIDRef GetBackingStore(IDataBase *db) = 0;
56 
61  virtual IIDXMLElement* QueryDocElement(IDocument* document) = 0;
62 
67  virtual IIDXMLElement* QueryDocElement(IDataBase* db) = 0;
68 
73  virtual IIDXMLElement* QueryRootElement(IIDXMLElement* xmlDocElement) = 0;
74 
75 
80  virtual IIDXMLElement* QueryRootElement(IDocument* document) = 0;
81 
86  virtual IIDXMLElement* QueryRootElement(IDataBase* db) = 0;
87 
88 
93  virtual IXMLTagList* QueryXMLTagList(IDataBase* db) = 0;
94 
100 
108 
115  virtual ITextModel* QueryTextModel(const IIDXMLElement* element) = 0;
116 
117 
131  virtual IXMLReferenceData* QueryXMLReferenceData(IPMUnknown* item, bool16 allowTOP = kFalse) = 0;
132 
138  virtual IXMLReferenceData* QueryXMLReferenceData(const UIDRef& item, bool16 allowTOP = kFalse) = 0;
139 
146  virtual IXMLReferenceData* QueryXMLReferenceData(const UIDRef& storyUIDRef, TextIndex textIndex, bool16 allowTOP = kFalse) = 0;
147 
154  virtual IXMLReferenceData* QueryXMLReferenceData(ITextModel *textModel, TextIndex textIndex, bool16 allowTOP = kFalse) = 0;
155 
162  virtual IXMLReferenceData* QueryXMLReferenceData(const XMLReference& xmlReference) = 0;
163 
173  virtual bool16 GetElementIndices(const IIDXMLElement* element, TextIndex* startPos, TextIndex* endPos) = 0;
174 
182  virtual void GetElementMarkerPositions(IIDXMLElement* element, TextIndex* startPos, TextIndex* endPos) = 0;
183 
193  virtual bool16 CalculateStartEndTextIndex(IIDXMLElement *element, int32 beforeChildIndex, TextIndex &startTextIndex, TextIndex &endTextIndex) = 0;
194 
202  virtual ErrorCode UpdateAutoAttrib(const XMLReference& ref) = 0;
203 
210  virtual XMLReference GetStoryXMLReference(const UIDRef& storyRef) = 0;
211 
217  virtual XMLReference GetStoryThreadXMLReference(const UIDRef& storyUIDRef, TextIndex textIndex) = 0;
218 
224  virtual XMLReference GetStoryThreadXMLReference(ITextModel *textModel, TextIndex textIndex) = 0;
225 
229  kSuccessCalc = 0,
230  kStartUnmatched = 1,
231  kEndUnmatched = 2,
232  kBothUnmatched = kStartUnmatched+kEndUnmatched
233  };
234 
265  virtual int32 CalcXMLParent(XMLReference& startParentXMLRef, int32& startIndexInParent, K2Vector<XMLReference>& childRefList,
266  XMLReference& endParentXMLRef, int32& endIndexInParent,
267  TextIndex startTextIndex, TextIndex endTextIndex, ITextModel* iTextModel, bool16 useReverseSearch = kTrue) = 0;
268 
281  virtual void CalcXMLElementsInTextRange(ITextModel *iTextModel, TextIndex startTextIndex, TextIndex endTextIndex, XMLReference& parentXMLRef, K2Vector<XMLReference>& childRefList) = 0;
282 
290  virtual ErrorCode AssignTagUID(const WideString& strTag, IDataBase* db, UID colorUID, UID& tagUID) = 0;
291 
307  virtual bool16 IsTagValid(const WideString& tag) = 0;
308 
314  virtual bool16 IsNmtoken(const PMString& token) = 0;
315 
321  virtual bool16 IsValidXMLComment(const PMString& comment) = 0;
322 
328  virtual bool16 IsValidXMLPITarget(const PMString& piTarget) = 0;
329 
335  virtual bool16 IsValidXMLPIData(const PMString& piData) = 0;
336 
344  virtual bool16 IsTaggablePageItem(IPMUnknown* item) = 0;
345 
351  virtual void FindUnusedTags(UIDList& unusedTag) = 0;
352 
365  virtual UID ImportHREF(IDataBase* db, const PMString& href, const IDFile* relativeTo, bool16& useFrame, UIFlags uiFlags = kFullUI ) = 0;
366 
371  virtual bool16 IsElementLocked( const IIDXMLElement* element ) = 0;
372 
378  virtual bool16 IsStoryLocked(const UIDRef& storyRef) = 0;
379 
383  virtual bool HasUnlockedStory (IDataBase *db) = 0;
384 
392  virtual bool16 LinkElementInTextRange(const UIDRef& storyUIDRef, TextIndex start, int32 numChars) = 0;
393 
401  virtual UID GetGraphicFrame(const UIDRef& contentUID) = 0;
402 
408  virtual bool16 IsElementAGraphic(IIDXMLElement* element) const = 0;
409 
426  virtual bool16 GetActualContent(UIDRef& contentRef) = 0;
427 
442  virtual void ValidateXML(const XMLReference& startXMLRef, K2Vector<XMLDTDValidationError>& errors, int32 maxErrors = 250, bool16 treatAsRoot = kFalse, bool16 checkHasDTD = kFalse) = 0;
443 
454  virtual ErrorCode ExportElement(IIDXMLElement *element, bool16 includeHeader, IXMLAccess* access,
455  IXMLHandler* exportHandler, const IDFile& sysFile, IDocument* doc, const PMString& formatName, UIFlags uiFlags) const = 0;
456 
462  virtual void ExportDTDToStream(const XMLReference& xmlRef, IXMLOutStream *s, bool16 internalSubsetOnly = kFalse) = 0;
463 
464 #ifdef DEBUG
465 
471  virtual void VerifyXMLStructure(IDocument* targetDocument) = 0;
472 #endif
473 
478  virtual bool16 IsExportableInCopyStory(const UIDRef& storyUIDRef) = 0;
479 
487  virtual bool16 FindMissingFile(PMString filename, IDFile& fileToImport) = 0;
488 
495  virtual XMLReference GetImportedRootXMLReference(IPMUnknown* importer) = 0;
496 
498  {
499  public:
500  typedef enum { kKeepIterating = 0, kSkipChildren, kStopIterating } ContinuationCode;
501 
508  virtual ContinuationCode Visit(IIDXMLElement *element) = 0;
509  };
510 
520  virtual void ForEachElement(IIDXMLElement* root, IXMLCallback *callback) = 0;
521 
529  virtual bool16 IsParentCellWithType(IIDXMLElement* childElement, CellType cellType) = 0;
530 
534  virtual ErrorCode SetShouldDeleteElementOnContentDeletion(const bool16 shouldDelete = kTrue) const = 0;
535 
540  virtual bool16 ShouldDeleteElementOnContentDeletion() const = 0;
541 
549  virtual ErrorCode SetLayoutTag(const UIDList& itemList, const UIDRef& tag, bool16 retag, bool16 allowPresetUI) = 0;
550 };
551 
552 #endif // __IXMLUtils__