InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CXMLImportMatchMaker.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Will Lin
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 // A default implementation of ISAXContentHandler. This provides an empty implementation
24 // of each method so that clients can only override those that they really care about.
25 //
26 //========================================================================================
27 
28 #ifndef __CXMLImportMatchMaker_h__
29 #define __CXMLImportMatchMaker_h__
30 
31 
32 #include "CPMUnknown.h"
33 #include "IXMLImportMatchMaker.h"
34 #include "IXMLImportMatchRecorder.h"
35 
36 
44 class CXMLImportMatchMaker : public CPMUnknown<IXMLImportMatchMaker>
45 {
46 public:
48  virtual ~CXMLImportMatchMaker();
49 
52  virtual void Register(IPMUnknown *xmlImporter);
53  virtual ErrorCode MatchDocument(const IDXMLDOMGraph& leftGraph, IXMLImportMatchRecorder *matchRecorder);
54  virtual ErrorCode PostMatchDocument(const IDXMLDOMGraph& leftGraph, IXMLImportMatchRecorder *matchRecorder);
55  virtual ErrorCode Match(const IDXMLDOMGraph& leftGraph, const IDXMLDOMStructureOnlyIterator& leftIter, const IDXMLDOMStructureOnlyIterator& leftIterEnd, const XMLReferenceGraph& rightGraph, const XMLOutEdgeIterator& rightIter, const XMLOutEdgeIterator& rightIterEnd, IXMLImportMatchRecorder *matchRecorder);
56  virtual ErrorCode PostMatch(const IDXMLDOMGraph& leftGraph, const IDXMLDOMStructureOnlyIterator& leftIter, const IDXMLDOMStructureOnlyIterator& leftIterEnd, const XMLReferenceGraph& rightGraph, const XMLOutEdgeIterator& rightIter, const XMLOutEdgeIterator& rightIterEnd, IXMLImportMatchRecorder *matchRecorder);
57  virtual ErrorCode NoMatchMade(const IDXMLDOMGraph& leftGraph, const IDXMLDOMStructureOnlyIterator& leftIter, const IDXMLDOMStructureOnlyIterator& leftIterEnd, const XMLReferenceGraph& rightGraph, const XMLOutEdgeIterator& rightIter, const XMLOutEdgeIterator& rightIterEnd, IXMLImportMatchRecorder *matchRecorder);
58  virtual ErrorCode MatchPhaseComplete(const IDXMLDOMGraph& leftGraph, const XMLReferenceGraph& rightGraph, IXMLImportMatchRecorder *matchRecorder);
59  virtual ErrorCode NoMatchMadeOnRoot(const IDXMLDOMGraph& leftGraph, const IDXMLDOMStructureOnlyIterator& leftIter, const IDXMLDOMStructureOnlyIterator& leftIterEnd, const XMLReference& importIntoXMLRef, XMLReference& elementToMatch);
60 
61 protected:
63  enum ElementType {
64  kElementType_Normal = 0,
68  };
69 
70  enum CellType {
71  kUnknown = 0,
72  kHeader,
75  };
76 
78  ErrorCode GetTagUID(const IIDXMLDOMNode *leftNode, const UIDRef& tagList, UID& tagUID) const;
79 
81  ElementType GetElementType(const IIDXMLDOMNode *leftNode) const;
82 
84  ElementType GetElementType(const IIDXMLElement *rightElement) const;
85 
87  bool16 MatchType(IIDXMLDOMNode *leftNode, IIDXMLElement* rightElement, IXMLImportMatchRecorder *matchRecorder) const;
88 
90  bool16 IsElementNew(const IIDXMLElement *element, const IXMLImportMatchRecorder *matchRecorder) const;
91 
92  /* Check if the left node's children can be matched to a grid (when bCheckGrid is kTrue) or a cell (when bCheckGrid is kFalse). */
93  bool16 CheckTableNode(IIDXMLDOMNode *node, bool16 bCheckGrid) const;
94 
97  CellType GetCellType(const IIDXMLDOMNode *leftNode) const;
98 
100  CellType GetCellType(const IIDXMLElement *rightElement) const;
101 
105 
106  // Static member used to avoid initializing a WideString all over
107  WideString fURI;
108 };
109 
110 #endif // __CXMLImportMatchMaker_h__
111 
112