InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TableTagData.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 // Purpose:
24 // Data to indicate which tags to use when tagging tables
25 //
26 //========================================================================================
27 
28 #ifndef __TableTagData__
29 #define __TableTagData__
30 
31 #include <vector>
32 
38 {
39 public:
43  TableTagData(IDataBase *db = nil);
44 
48  void Initialize(IDataBase *db);
49 
54  bool16 IsInitialized(void) const;
55 
59  void SetTableTag(const WideString &name) {return SetTagName(kTable, name);}
60 
61 
65  void SetHeaderTag(const WideString& name) { return SetTagName(kHeader, name); }
66 
70  void SetBodyTag(const WideString& name) { return SetTagName(kBody, name); }
71 
75  void SetFooterTag(const WideString& name) { return SetTagName(kFooter, name); }
76 
80  void SetRowTag(const WideString &name) {return SetTagName(kRow, name);}
81 
85  void SetCellTag(const WideString &name) {return SetTagName(kCell, name);}
86 
90  void SetTableTag(const UID &uid) {return SetTagUID(kTable, uid);}
91 
95  void SetHeaderTag(UID uid) { return SetTagUID(kHeader, uid); }
96 
100  void SetBodyTag(UID uid) { return SetTagUID(kBody, uid); }
101 
105  void SetFooterTag(UID uid) { return SetTagUID(kFooter, uid); }
106 
110  void SetRowTag(const UID &uid) {return SetTagUID(kRow, uid);}
111 
115  void SetCellTag(const UID &uid) {return SetTagUID(kCell, uid);}
116 
126  UID GetTableTag(bool16 lwProcessing = kFalse) const {return GetTagUID(kTable, lwProcessing);}
127 
131  bool16 HasTableTag(void) const { return HasTag(kTable); }
132 
142  UID GetHeaderTag(bool16 lwProcessing = kFalse) const { return GetTagUID(kHeader, lwProcessing); }
143 
147  bool16 HasHeaderTag(void) const { return HasTag(kHeader); }
148 
158  UID GetBodyTag(bool16 lwProcessing = kFalse) const { return GetTagUID(kBody, lwProcessing); }
159 
163  bool16 HasBodyTag(void) const { return HasTag(kBody); }
164 
174  UID GetFooterTag(bool16 lwProcessing = kFalse) const { return GetTagUID(kFooter, lwProcessing); }
175 
179  bool16 HasFooterTag(void) const { return HasTag(kFooter); }
180 
190  UID GetRowTag(bool16 lwProcessing = kFalse) const {return GetTagUID(kRow, lwProcessing);}
191 
195  bool16 HasRowTag(void) const { return HasTag(kRow); }
196 
206  UID GetCellTag(bool16 lwProcessing = kFalse) const {return GetTagUID(kCell, lwProcessing);}
207 
211  bool16 HasCellTag(void) const { return HasTag(kCell); }
212 
213 private:
214  // this enum is used to indicate which tag you care about. Please don't add
215  // any values after kEnd because that is used to indicate the end of the list
216  // programatically
217  enum WhichTag {kTable = 0, kHeader, kBody, kFooter, kRow, kCell, kEnd /* Don't insert anything after kEnd */};
218 
219  // This is an internal method that is used to set the tag name for a given
220  // part of the table. It sets the entire data structure up to know that the
221  // tag has been set by name
222  void SetTagName(WhichTag which, const WideString &name, UID colorUID = kInvalidUID);
223 
224  // This is an internal method that is used to set the tag UID for a given
225  // part of the table. It sets the entire data structure up to know that the
226  // tag has been set by UID
227  void SetTagUID(WhichTag which, const UID &uid);
228 
229  // This is an internal method that is used to get the tag UID for a given
230  // part of the table. If the tag information was set via name this method
231  // will create a new tag if one doesn't already exist.
232  UID GetTagUID(WhichTag which, bool16 lwProcessing) const ;
233 
234  // This is an internal method that is used to retrieve whether a particular tag type was
235  // specified/stored in this
236  bool16 HasTag(WhichTag which) const;
237 
238  // This is a struct for holding all of the required information about a
239  // tag for a particular part of the table.
240  struct TagData {
241  TagData() : fColorUID(kInvalidUID),
242  fReceivedName(kFalse),
243  fNameProcessed(kFalse),
244  fTagUID(kInvalidUID)
245  {}
246 
247  WideString fTagName;
248  UID fColorUID;
249  bool16 fReceivedName;
250  mutable bool16 fNameProcessed;
251  mutable UID fTagUID;
252  };
253 
254  IDataBase *fDB;
255  std::vector<TagData> fTagData;
256  bool16 fInitialized;
257 };
258 
259 #endif
260