InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IFootnoteSettingsCmdData.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner:
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 __IFootnoteSettingsCmdData__
25 #define __IFootnoteSettingsCmdData__
26 
27 #include "IPMUnknown.h"
28 #include "ITextAttrStrokeType.h"
29 #include "IWorkspace.h"
30 #include "ISwatchList.h"
31 #include "IStyleNameTable.h"
32 #include "IFootnoteSettings.h"
33 #include "IStyleGroupManager.h"
34 #include "UIDRef.h"
35 #include "PMReal.h"
36 #include "WideString.h"
37 
38 #include "ILayoutUIUtils.h"
39 #include "LocaleSetting.h"
40 
41 #include "TextID.h"
42 #include "InstStrokeFillID.h"
43 
50 {
51 public:
52  enum { kDefaultIID = IID_IFOOTNOTESETTINGSCMDDATA };
53 
56  virtual void GetWhichSettings(bool16* settings, bool16* separator, bool16* continuing) const = 0;
57 
58  // Settings
70  virtual int32 GetStartingNumber() const = 0;
73  virtual ClassID GetNumberingMethod() const = 0;
76  virtual UID GetFootnoteMarkerStyle() const = 0;
79  virtual UID GetFootnoteParagraphStyle() const = 0;
82  virtual PMReal GetSpaceBetween() const = 0;
85  virtual PMReal GetSpacerHeight() const = 0;
88  virtual Text::FirstLineOffsetMetric GetFirstLineOffset() const = 0;
91  virtual PMReal GetMinFirstLineOffset() const = 0;
94  virtual bool16 GetEndOfStoryPlacement() const = 0;
97  virtual bool16 GetNoSplitting() const = 0;
100  virtual const WideString& GetMarkerPrefix() const = 0;
103  virtual const WideString& GetMarkerSuffix() const = 0;
106  virtual const WideString& GetFootnoteSeparator() const = 0;
107 
108  // separator, continuing Rule
111  virtual bool16 GetSeparatorLineOn(IFootnoteSettings::FootnoteRuleKind k) const = 0;
135  virtual bool16 GetOverprintStroke(IFootnoteSettings::FootnoteRuleKind k) const = 0;
144  virtual bool16 GetOverprintGap(IFootnoteSettings::FootnoteRuleKind k) const = 0;
145 
148  virtual const UIDRef& GetDocument() = 0;
151  virtual bool16 GetStraddlingInfo() const = 0;
152 
156  {
157  FootnotePrefs()
158  {
159  bool16 isCCJK = (LocaleSetting::GetLocale().GetLanguageFS() == kJapaneseLanguageFS);
160  bool16 isCCKOnly = (isCCJK && (LocaleSetting::GetLocale().GetUserInterfaceId() == k_zhCN // simplified
161  || LocaleSetting::GetLocale().GetUserInterfaceId() == k_zhTW // traditional
162  || LocaleSetting::GetLocale().GetUserInterfaceId() == k_koKR )); // Korean
163 
164  fPrefixSuffixUsage = IFootnoteSettings::kPrefixSuffixNone;
165  fSeparator.Append(isCCJK ? kTextChar_IdeographicSpace : kTextChar_Tab);
166 
167  fMarkerStyle = kInvalidUID;
168  fFootnoteStyle = kInvalidUID;
169 
170  fNumberingMethod = kArabicFootnoteNumberingBoss;
171 
172  fStartingNumber = 1;
173  fRestartOption = IFootnoteSettings::kDontRestart;
174 
175  fMarkerPositioning = (!isCCJK || isCCKOnly) ? IFootnoteSettings::kPositionSuperscript
176  : IFootnoteSettings::kPositionRuby;
177  fGutterHeight = 0.0;
178  fSpacerHeight = 0.0;
179  fMinFirstLineOffset = 0.0;
180 
181  // ##: Last minute change - make J match R. See bug #1101932
182  fFirstLineOffset = Text::kFLOLeading; // NOTE: All other cases (tables, columns) do Ascent
183 
184  fEndOfStoryPlacement = kFalse;
185  fNoSplitting = kFalse;
186  fEnableStraddling = kTrue;
187  }
188 
189  FootnotePrefs(const IFootnoteSettings* target)
190  {
191  fPrefixSuffixUsage = target->GetPrefixSuffixUsage();
192  fMarkerSuffix = target->GetMarkerSuffix();
193  fMarkerPrefix = target->GetMarkerPrefix();
194  fSeparator = target->GetFootnoteSeparator();
195 
196  fMarkerStyle = target->GetFootnoteMarkerStyle();
197  fFootnoteStyle = target->GetFootnoteParagraphStyle();
198 
199  fNumberingMethod = target->GetNumberingMethod();
200 
201  fStartingNumber = target->GetStartingNumber();
202  fRestartOption = target->GetRestartOption();
203 
204  fMarkerPositioning = target->GetMarkerPositioning();
205 
206  fGutterHeight = target->GetSpaceBetween();
207  fSpacerHeight = target->GetSpacerHeight();
208 
209  fFirstLineOffset = target->GetFirstLineOffset();
210  fMinFirstLineOffset = target->GetMinFirstLineOffset();
211 
212  fEndOfStoryPlacement = target->GetEndOfStoryPlacement();
213  fNoSplitting = target->GetNoSplitting();
214  fEnableStraddling = target->GetStraddlingInfo();
215  }
216 
217  FootnotePrefs(const FootnotePrefs& other)
218  {
219  fPrefixSuffixUsage = other.fPrefixSuffixUsage;
220  fMarkerSuffix = other.fMarkerSuffix;
221  fMarkerPrefix = other.fMarkerPrefix;
222  fSeparator = other.fSeparator;
223 
224  fMarkerStyle = other.fMarkerStyle;
225  fFootnoteStyle = other.fFootnoteStyle;
226 
227  fNumberingMethod = other.fNumberingMethod;
228 
229  fStartingNumber = other.fStartingNumber;
230  fRestartOption = other.fRestartOption;
231 
232  fMarkerPositioning = other.fMarkerPositioning;
233 
234  fGutterHeight = other.fGutterHeight;
235  fSpacerHeight = other.fSpacerHeight;
236 
237  fFirstLineOffset = other.fFirstLineOffset;
238  fMinFirstLineOffset = other.fMinFirstLineOffset;
239 
240  fEndOfStoryPlacement = other.fEndOfStoryPlacement;
241  fNoSplitting = other.fNoSplitting;
242  fEnableStraddling = other.fEnableStraddling;
243  }
244 
245  void InitializeStyles(IWorkspace* workspace)
246  {
247  // Para style - go find the "NormalParagraphStyle"
248  InterfacePtr<IStyleGroupManager> paraStyleNameTable(workspace, IID_IPARASTYLEGROUPMANAGER);
249  UID defaultStyleUID = paraStyleNameTable->FindByName("NormalParagraphStyle");
250  if (defaultStyleUID == kInvalidUID)
251  defaultStyleUID = paraStyleNameTable->GetDefaultStyleUID();
252 
253  fFootnoteStyle = defaultStyleUID;
254 
255  // Char style - get the default (root) style.
256  InterfacePtr<IStyleGroupManager> charStyleNameTable(workspace, IID_ICHARSTYLEGROUPMANAGER);
257  defaultStyleUID = charStyleNameTable->GetRootStyleUID();
258 
259  fMarkerStyle = defaultStyleUID;
260  }
261 
262  WideString fMarkerSuffix, fMarkerPrefix;
263  WideString fSeparator;
264  UID fMarkerStyle;
265  UID fFootnoteStyle;
266 
267  ClassID fNumberingMethod;
268 
269  int32 fStartingNumber;
270  PMReal fGutterHeight;
271  PMReal fSpacerHeight;
272  PMReal fMinFirstLineOffset;
273  Text::FirstLineOffsetMetric fFirstLineOffset;
276  IFootnoteSettings::MarkerPositionOptions fMarkerPositioning;
277 
278  bool16 fEndOfStoryPlacement;
279  bool16 fNoSplitting;
280  bool16 fEnableStraddling;
281  };
282 
287  {
289  {
290  fStrokeType = ICompositionStyle::StrokeType(kSolidPathStrokerBoss, kInvalidUID);
291 
292  fColorStroke = kInvalidUID;
293  fColorGap = kInvalidUID;
294  fSeparatorLineOn = kTrue;
295  fIndentLeft = 0.;
296  fWidth = 0.; // This is typically overridden by constructor, since each rule has different default.
297  fOffset = 0.;
298  fWeightStroke = 1.;
299  fOverprintStroke = kFalse;
300  fOverprintGap = kFalse;
301  fTintStroke = 100;
302  fTintGap = 100;
303  }
305  {
306  fStrokeType = target->GetStrokeType(k);
307  fColorStroke = target->GetColorStroke(k);
308  fColorGap = target->GetColorGap(k);
309  fSeparatorLineOn = target->GetSeparatorLineOn(k);
310  fIndentLeft = target->GetIndentLeft(k);
311  fWidth = target->GetWidth(k);
312  fOffset = target->GetOffset(k);
313  fWeightStroke = target->GetWeightStroke(k);
314  fTintStroke = target->GetTintStroke(k);
315  fOverprintStroke = target->GetOverprintStroke(k);
316  fTintGap = target->GetTintGap(k);
317  fOverprintGap = target->GetOverprintGap(k);
318  }
320  {
321  fStrokeType = other.fStrokeType;
322  fColorStroke = other.fColorStroke;
323  fColorGap = other.fColorGap;
324  fSeparatorLineOn = other.fSeparatorLineOn;
325  fIndentLeft = other.fIndentLeft;
326  fWidth = other.fWidth;
327  fOffset = other.fOffset;
328  fWeightStroke = other.fWeightStroke;
329  fTintStroke = other.fTintStroke;
330  fOverprintStroke = other.fOverprintStroke;
331  fTintGap = other.fTintGap;
332  fOverprintGap = other.fOverprintGap;
333  }
334 
335  void InitializeColors(IWorkspace* workspace)
336  {
337  InterfacePtr<ISwatchList> swatchList(workspace, UseDefaultIID());
338  UID blackSwatchUID(swatchList->GetBlackSwatchUID());
339  UID noneSwatchUID(swatchList->GetNoneSwatchUID());
340 
341  fColorStroke = blackSwatchUID;
342  fColorGap = noneSwatchUID;
343  }
344 
345  bool16 fSeparatorLineOn;
346 
347  ICompositionStyle::StrokeType fStrokeType;
348  UID fColorStroke;
349  UID fColorGap;
350 
351  PMReal fIndentLeft;
352  PMReal fWidth;
353  PMReal fOffset;
354 
355  PMReal fWeightStroke;
356  PMReal fTintStroke;
357  bool16 fOverprintStroke;
358 
359  PMReal fTintGap;
360  bool16 fOverprintGap;
361  };
362 
366  virtual void Set(const IFootnoteSettingsCmdData::FootnotePrefs* settings, const IFootnoteSettingsCmdData::FootnoteLinePrefs* separator,
367  const IFootnoteSettingsCmdData::FootnoteLinePrefs* continuing, const UIDRef& doc) = 0;
368 };
369 
370 #endif // __IFootnoteSettingsCmdData__