InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
XRefBuildingBlock.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jianlan Song
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 
25 // ----- Interfaces -----
26 #include "IPMStream.h"
27 #include "ITextModel.h"
28 
29 // ----- Includes -----
30 #include <map>
31 #include "EscapeTable.h"
32 
33 #ifdef PUBLIC_BUILD
34 #endif
35 
42 {
43 public:
44  typedef object_type data_type;
45 
49  {
50  kInvalidXRefBBType = -1,
51  kXRefBBCustomString = 0,
52  kXRefBBFileName,
53  kXRefBBChapterNumber,
54  kXRefBBPageNumber,
55  kXRefBBFullParagraph,
56  kXRefBBParagraphNumber,
57  kXRefBBParagraphText,
58  kXRefBBBookmarkName,
59  kMaxXRefBBType,
60  } ;
61 
62  XRefBuildingBlock() : fType(kInvalidXRefBBType), fCharStyleUID(kInvalidUID), fCustomText(), fIncludeDelim(kFalse) {}
63 
64  XRefBuildingBlock(XRefBuildingBlockType type) : fType(type), fCharStyleUID(kInvalidUID), fIncludeDelim(kFalse) {}
65  XRefBuildingBlock(XRefBuildingBlockType type, UID charStyle) : fType(type), fCharStyleUID(charStyle), fIncludeDelim(kFalse) {}
67 
68  ~XRefBuildingBlock() {}
69 
70  XRefBuildingBlock& operator = (const XRefBuildingBlock &copy);
71  bool16 operator==(const XRefBuildingBlock &other) const;
72  bool16 operator != (const XRefBuildingBlock &other) const
73  { return !(*this == other); }
74 
78  XRefBuildingBlockType GetType() const { return fType; }
82  void SetType(XRefBuildingBlockType type);
83 
87  UID GetCharacterStyle() const { return fCharStyleUID; }
91  void SetCharacterStyle(UID charStyle);
92 
98  void SetCustomText(const PMString& customText);
102  PMString GetCustomText() const { return fCustomText; }
103 
109  void SetDelimiter(const UTF32TextChar& delim, bool16 includeDelim);
110  void SetDelimiter(const UTF32TextChar& delim) { fDelim = delim; }
111  void SetIncludeDelim(bool16 includeDelim) { fIncludeDelim = includeDelim; }
115  UTF32TextChar GetDelimiter() const { return fDelim; }
121  bool16 IncludeDelimiter() const { return fIncludeDelim; }
122 
135  PMString GenerateSourceString(const ITextModel* textModel, TextIndex destIndex, bool16 externDest,
136  std::map<TextIndex, WideString>* variableLocations, std::map<TextIndex, TextIndex>* inlineLocations) const;
137 
138  void ReadWrite(IPMStream *s);
139 
140  static bool NeedToStripForParaNum(const UTF32TextChar& c);
141 
142 private:
143  XRefBuildingBlockType fType;
144  UID fCharStyleUID;
145  PMString fCustomText;
146  UTF32TextChar fDelim;
147  bool16 fIncludeDelim;
148 };
149