InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IndexHeaderGroup.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Bertrand Lechevalier
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 // comments: Data class to store one Header Group (Symbol, Numeric, Alphabet, Kana...).
24 //
25 //========================================================================================
26 
27 #ifndef __INDEXHEADERGROUP__
28 #define __INDEXHEADERGROUP__
29 
30 #include "IPMStream.h"
31 
32 #include "LanguageID.h"
33 #include "WideString.h"
34 #include "IndexSectionHeader.h"
35 #include "K2Vector.h"
36 
41 {
42  public:
43  typedef object_type data_type;
44 
48  fName(""),
49  fUIHeader(""),
50  fTextHeader(""),
51  fVisible(kFalse)
52  {}
53 
56  bool16 operator==(const IndexHeaderGroup& other) const
57  {
58  return ( (fUIHeader == other.fUIHeader) &&
59  (fName == other.fName) &&
60  (fTextHeader == other.fTextHeader) &&
61  (fVisible == other.fVisible) &&
62  (fSectionHeadersList == other.fSectionHeadersList));
63  }
64 
67  bool16 operator!=(const IndexHeaderGroup& other) const
68  {
69  return ( !(*this == other) );
70  }
71 
75  void AppendSectionHeader(const IndexSectionHeader& sectionHeader)
76  {
77  fSectionHeadersList.push_back(sectionHeader);
78  }
79 
85  {
86  ASSERT_MSG(i >= 0 && i < fSectionHeadersList.size(), "GetNthSectionHeader::IndexSectionHeadersSet: bad index");
87  return fSectionHeadersList[i];
88  }
89 
94  {
95  fName.ReadWrite(s);
96 
97  fUIHeader.ReadWrite(s);
98 
99  fTextHeader.ReadWrite(s);
100 
101  s->XferBool(fVisible);
102 
103  if (s->IsReading())
104  {
105  int32 numHeaders = fSectionHeadersList.size();
106 
107  s->XferInt32(numHeaders);
108 
109  fSectionHeadersList.clear();
110  fSectionHeadersList.reserve(numHeaders);
111 
112  int32 i;
113  for (i = 0; i < numHeaders; i++)
114  {
115  IndexSectionHeader sectionHeader;
116 
117  sectionHeader.ReadWrite(s);
118 
119  fSectionHeadersList.push_back(sectionHeader);
120  }
121  }
122  else
123  {
124  int32 numHeaders = fSectionHeadersList.size();
125 
126  s->XferInt32(numHeaders);
127  int32 i;
128  for (i = 0; i < numHeaders; i++)
129  fSectionHeadersList[i].ReadWrite(s);
130  }
131  }
132 
133  PMString fName; // Internal name
134  PMString fUIHeader; // String used to display the Group in the UI
135  WideString fTextHeader; // String used to display the Group in the Pub text
136  bool16 fVisible;
137  K2Vector<IndexSectionHeader> fSectionHeadersList; // List of the section headers
138 };
139 
140 #endif // __INDEXHEADERGROUP__