InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IEndnoteSettings.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Susmita Singh
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // ADOBE CONFIDENTIAL
16 //
17 // Copyright 2017 Adobe
18 // All Rights Reserved.
19 //
20 // NOTICE: Adobe permits you to use, modify, and distribute this file in
21 // accordance with the terms of the Adobe license agreement accompanying
22 // it. If you have received this file from a source other than Adobe,
23 // then your use, modification, or distribution of it requires the prior
24 // written permission of Adobe.
25 //
26 //========================================================================================
27 
28 #ifndef __IEndnoteSettings__
29 #define __IEndnoteSettings__
30 
32 #define kMinStartingFootnoteNumber 1
33 
35 #define kMaxStartingFootnoteNumber 100000
36 
37 #ifndef __ODFRC__ // when used for core resource compilation, provide just the parameter range constants
38 
39 #include "IPMUnknown.h"
40 #include "TextID.h"
41 #include "CTextEnum.h"
42 #include "ITextAttrStrokeType.h"
43 #include "IWorkspace.h"
44 #include "ISwatchList.h"
45 #include "IStyleNameTable.h"
46 #include "IEndnoteSettings.h"
47 #include "IStyleGroupManager.h"
48 #include "UIDRef.h"
49 #include "PMReal.h"
50 #include "WideString.h"
51 
52 #include "ILayoutUIUtils.h"
53 #include "LocaleSetting.h"
54 
55 #include "TextID.h"
56 #include "InstStrokeFillID.h"
57 
58 enum EndnotePageScope {
59  kAtEndOfStory = 0,
60  kAtEndOfSection,
61  kAtEndOfDocument,
62  kAtEndOfBook,
63 };
64 
69 {
70 public:
71  enum { kDefaultIID = IID_IENDNOTESETTINGS };
72 
75  typedef enum { kContinuous, kRestartEveryStory, kUnknown } RestartNumberingOptions;
76 
79  typedef enum {kStory, kDocument} Scope;
80 
83  typedef enum {kPlacegun, kNewPage} Place;
84 
87  typedef enum { kPrefixSuffixNone, kPrefixSuffixReference, kPrefixSuffixMarker, kPrefixSuffixBoth } SuffixPrefixUsageOptions;
88 
91  typedef enum { kPositionNormal, kPositionSuperscript, kPositionSubscript, kPositionRuby } MarkerPositionOptions;
92 
95  virtual WideString GetTitle() const = 0;
96 
99  virtual void SetTitle(WideString title) = 0;
100 
103  virtual UID GetHeaderParaStyle() const = 0;
104 
107  virtual void SetHeaderParaStyle(UID styleID) = 0;
108 
111  virtual RestartNumberingOptions GetRestartOption() const = 0;
114  virtual void SetRestartOption(RestartNumberingOptions option) = 0;
115 
118  virtual int32 GetStartingNumber() const = 0;
121  virtual void SetStartingNumber(int32 n) = 0;
122 
125  virtual ClassID GetNumberingMethod() const = 0;
128  virtual void SetNumberingMethod(ClassID whichMethod) = 0;
129 
132  virtual MarkerPositionOptions GetMarkerPositioning() const = 0;
133 
136  virtual void SetMarkerPositioning(MarkerPositionOptions option) = 0;
137 
140  virtual UID GetMarkerStyle() const = 0;
141 
144  virtual void SetMarkerStyle(UID styleID) = 0;
145 
148  virtual UID GetEndnoteParagraphStyle() const = 0;
151  virtual void SetEndnoteParagraphStyle(UID s) = 0;
152 
155  virtual const WideString& GetEndnoteSeparator() const = 0;
158  virtual void SetEndnoteSeparator(const WideString& sep) = 0;
159 
162  virtual Scope GetScope() const = 0;
165  virtual void SetScope(Scope scope) = 0;
166 
169  virtual Place GetPlace() const = 0;
172  virtual void SetPlace(Place place) = 0;
173 
176  virtual const WideString& GetMarkerPrefix() const = 0;
179  virtual void SetMarkerPrefix(const WideString& pre) = 0;
180 
183  virtual const WideString& GetMarkerSuffix() const = 0;
186  virtual void SetMarkerSuffix(const WideString& suf) = 0;
187 
193  virtual void SetPrefixSuffixUsage(SuffixPrefixUsageOptions option) = 0;
194 
197  virtual void CopyFrom(IEndnoteSettings* settings) = 0;
198 
201  virtual const UIDRef& GetDocument() = 0;
202 
205  virtual bool16 GetHasSettings() const = 0;
206 
207  struct EndnotePrefs {
208  EndnotePrefs() {
209  bool16 isCCJK = (LocaleSetting::GetLocale().GetLanguageFS() == kJapaneseLanguageFS);
210  bool16 isCCKOnly = (isCCJK && (LocaleSetting::GetLocale().GetUserInterfaceId() == k_zhCN // simplified
211  || LocaleSetting::GetLocale().GetUserInterfaceId() == k_zhTW // traditional
212  || LocaleSetting::GetLocale().GetUserInterfaceId() == k_koKR)); // Korean
213 
214  PMString titleText("ES Title Text", PMString::kTranslateDuringCall);
215  fTitle = WideString(titleText);
216  fHeaderStyle = kInvalidUID;
217  fNumberingMethod = kArabicFootnoteNumberingBoss;
218  fStartingNumber = 1;
219  fRestartOption = IEndnoteSettings::kContinuous;
220  fMarkerPositioning = (!isCCJK || isCCKOnly) ? IEndnoteSettings::kPositionSuperscript: IEndnoteSettings::kPositionRuby;
221  fMarkerStyle = kInvalidUID;
222  fEndnoteStyle = kInvalidUID;
223  fSeparator = WideString("");
224  fSeparator.Append(isCCJK ? kTextChar_IdeographicSpace : kTextChar_Tab);
225  fScope = IEndnoteSettings::kDocument;
226  fPlace = IEndnoteSettings::kNewPage;
227  fPrefixSuffixUsage = IEndnoteSettings::kPrefixSuffixNone;
228  fMarkerPrefix = WideString("");
229  fMarkerSuffix = WideString("");
230  }
231  EndnotePrefs(const EndnotePrefs &other) {
232  fTitle = other.fTitle;
233  fHeaderStyle = other.fHeaderStyle;
234  fNumberingMethod = other.fNumberingMethod;
235  fStartingNumber = other.fStartingNumber;
236  fRestartOption = other.fRestartOption;
237  fMarkerPositioning = other.fMarkerPositioning;
238  fMarkerStyle = other.fMarkerStyle;
239  fEndnoteStyle = other.fEndnoteStyle;
240  fSeparator = other.fSeparator;
241  fScope = other.fScope;
242  fPlace = other.fPlace;
243  fPrefixSuffixUsage = other.fPrefixSuffixUsage;
244  fMarkerPrefix = other.fMarkerPrefix;
245  fMarkerSuffix = other.fMarkerSuffix;
246  }
247  EndnotePrefs(IEndnoteSettings * settings) {
248  fTitle = settings->GetTitle();
249  fHeaderStyle = settings->GetHeaderParaStyle();
250  fNumberingMethod = settings->GetNumberingMethod();
251  fStartingNumber = settings->GetStartingNumber();
252  fRestartOption = settings->GetRestartOption();
253  fMarkerPositioning = settings->GetMarkerPositioning();
254  fMarkerStyle = settings->GetMarkerStyle();
255  fEndnoteStyle = settings->GetEndnoteParagraphStyle();
256  fSeparator = settings->GetEndnoteSeparator();
257  fScope = settings->GetScope();
258  fPlace = settings->GetPlace();
259  fPrefixSuffixUsage = settings->GetPrefixSuffixUsage();
260  fMarkerPrefix = settings->GetMarkerPrefix();
261  fMarkerSuffix = settings->GetMarkerSuffix();
262  }
263 
264  void InitializeStyles(IWorkspace* workspace)
265  {
266  // Para style - go find the "NormalParagraphStyle"
267  InterfacePtr<IStyleGroupManager> paraStyleNameTable(workspace, IID_IPARASTYLEGROUPMANAGER);
268  UID defaultStyleUID = paraStyleNameTable->FindByName("NormalParagraphStyle");
269  if (defaultStyleUID == kInvalidUID)
270  defaultStyleUID = paraStyleNameTable->GetDefaultStyleUID();
271 
272  fHeaderStyle = defaultStyleUID;
273  fEndnoteStyle = defaultStyleUID;
274 
275  // Char style - get the default (root) style.
276  InterfacePtr<IStyleGroupManager> charStyleNameTable(workspace, IID_ICHARSTYLEGROUPMANAGER);
277  defaultStyleUID = charStyleNameTable->GetRootStyleUID();
278 
279  fMarkerStyle = defaultStyleUID;
280  }
281 
282  WideString fTitle;
283  UID fHeaderStyle; //Paragraph style
284  ClassID fNumberingMethod;
285  int32 fStartingNumber;
287  IEndnoteSettings::MarkerPositionOptions fMarkerPositioning;
288  UID fMarkerStyle; //Character style
289  UID fEndnoteStyle; //Paragraph style
290  WideString fSeparator;
294  WideString fMarkerSuffix, fMarkerPrefix;
295  };
296 
299  virtual void Set(const EndnotePrefs* prefs, const UIDRef& doc) = 0;
300 };
301 
302 #endif // __ODFRC__
303 
304 #endif
305 // __IEndnoteSettings__