InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BulletGlyph.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Anurag Wahi
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 __BULLETGLYPH_H__
25 #define __BULLETGLYPH_H__
26 
27 #include <vector>
28 
29 #include "IPMStream.h"
30 #include "ITextAttrBulletCharacter.h"
31 
33 {
34  // Enumeration indicating type of glyph -
35  // Add dialog will always use kGlyphWithFont while reading, and specific value while writing
36  // Main dialog will use bullet character specific value always.
38 
39  // Glyph ID or Unicode value, depending on bullet character type
40  int32 f_BulletCharacterValue;
41 
42  // For bullets that remember their fonts, the font UID, style and MM Axes information.
43  // Warning: Giving the wrong fontUID could negatively affect the Bullets feature
44  // in certain cases.
45  UID f_FontUID;
46  PMString f_FontFace;
47  std::vector<Fixed> f_Axes;
48 
49  BulletGlyph()
50  : f_BulletCharacterType(ITextAttrBulletCharacter::kUnicodeWithFont)
51  , f_BulletCharacterValue(0)
52  , f_FontUID(kInvalidUID)
53  {
54  }
55 
57  const int32 bulletChar,
58  const UID fontUID = kInvalidUID,
59  const PMString &fontFace = "",
60  const std::vector<Fixed> *axes = 0)
61  : f_BulletCharacterType(bulletType)
62  , f_BulletCharacterValue(bulletChar)
63  , f_FontUID(fontUID)
64  , f_FontFace(fontFace)
65  {
66  if (axes)
67  f_Axes = *axes;
68  }
69 
70  bool16 operator==(const BulletGlyph &other) const
71  {
72  if (f_BulletCharacterType != other.f_BulletCharacterType ||
73  f_BulletCharacterValue != other.f_BulletCharacterValue)
74  return kFalse;
75 
76  if (f_BulletCharacterType == ITextAttrBulletCharacter::kGlyphWithFont ||
77  f_BulletCharacterType == ITextAttrBulletCharacter::kUnicodeWithFont)
78  {
79  if (f_FontUID != other.f_FontUID ||
80  !f_FontFace.IsEqual(other.f_FontFace) ||
81  f_Axes != other.f_Axes)
82  return kFalse;
83  }
84 
85  return kTrue;
86  }
87 
88  void ReadWrite(IPMStream *s)
89  {
90  XFER_ENUM(s, f_BulletCharacterType);
91  s->XferInt32(f_BulletCharacterValue);
92  s->XferReference(f_FontUID);
93  f_FontFace.ReadWrite(s);
94  uchar na = uchar((int8)f_Axes.size());
95  int32 numAxes = (int8)s->XferByte(na);
96 
97  if (s->IsReading())
98  f_Axes.resize(numAxes);
99 
100  if (numAxes > 0)
101  {
102  for (int32 i = 0; i < numAxes; ++i)
103  s->XferInt32(f_Axes[i]);
104  }
105  }
106 };
107 
108 typedef std::vector<BulletGlyph> BulletGlyphSet;
109 
110 #endif // __BULLETGLYPH_H__