InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IParcelContainer.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: dwaterfa
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 __IParcelContainer__
25 #define __IParcelContainer__
26 
27 #include "IPMUnknown.h"
28 #include "ICompositionStyle.h"
29 #include "ITextColumnSizer.h"
30 
31 #include "ShuksanID.h"
32 #include "ParcelKey.h"
33 
34 class IParcelList;
35 
36 
38 {
39  public:
40  enum { kDefaultIID = IID_IPARCELCONTAINER };
41 
45  virtual IParcelList * QueryParcelList() const = 0;
46 
50  virtual PMRect GetBounds() const = 0;
51 
70  virtual bool16 GetIsRectangular(bool16 checkCornerRadius = kFalse) const = 0;
71 
75  virtual uint32 GetColumnCount() const = 0;
76 
79  virtual PMRect GetNthColumnBBox(uint32 n) const = 0;
80 
84  virtual uint32 GetParcelCount() const = 0;
85 
89  virtual ParcelKey GetNthParcelKey(uint32 containerIndex) const = 0;
90 
97  virtual int32 GetParcelIndex(ParcelKey key) const = 0;
98 
103  virtual ParcelKey GetFirstParcelKey() const = 0;
104 
109  virtual ParcelKey GetLastParcelKey() const = 0;
110 
115  {
116  public:
121  ParcelSpanData();
122 
126  ParcelSpanData(uint32 columnIndexStart) :
127  fSpanType(ICompositionStyle::kSingleColumn),
128  fPColIndexStart(columnIndexStart),
129  fPColIndexEnd(columnIndexStart + 1),
130  fDesiredSpan(1),
131  fSplitIndex(0),
132  fSplitCount(0),
133  fSplitInsideGutter(0.0),
134  fSplitOutsideGutter(0.0)
135  { }
136 
140  ParcelSpanData(uint32 columnIndexStart,
141  uint32 columnIndexEnd,
142  uint32 desiredSpan) :
143  fSpanType(ICompositionStyle::kSpanColumn),
144  fPColIndexStart(columnIndexStart),
145  fPColIndexEnd(columnIndexEnd),
146  fDesiredSpan(desiredSpan),
147  fSplitIndex(0),
148  fSplitCount(0),
149  fSplitInsideGutter(0.0),
150  fSplitOutsideGutter(0.0)
151  { }
152 
156  ParcelSpanData(uint32 columnIndexStart,
157  uint32 splitIndex,
158  uint32 splitCount,
159  PMReal splitInsideGutter,
160  PMReal splitOutsideGutter) :
161  fSpanType(ICompositionStyle::kSplitColumn),
162  fPColIndexStart(columnIndexStart),
163  fPColIndexEnd(columnIndexStart + 1),
164  fDesiredSpan(1),
165  fSplitIndex(splitIndex),
166  fSplitCount(splitCount),
167  fSplitInsideGutter(splitInsideGutter),
168  fSplitOutsideGutter(splitOutsideGutter)
169  { }
170 
175  fSpanType(other.fSpanType),
176  fPColIndexStart(other.fPColIndexStart),
177  fPColIndexEnd(other.fPColIndexEnd),
178  fDesiredSpan(other.fDesiredSpan),
179  fSplitIndex(other.fSplitIndex),
180  fSplitCount(other.fSplitCount),
181  fSplitInsideGutter(other.fSplitInsideGutter),
182  fSplitOutsideGutter(other.fSplitOutsideGutter)
183  { }
184 
190  bool operator==(const ParcelSpanData& other) const
191  {
192  //
193  // Non conforming bit is NOT part of the comparison.
194  //
195  if (fSpanType == ICompositionStyle::kSingleColumn)
196  {
197  return (other.fSpanType == fSpanType);
198  }
199  else if (fSpanType == ICompositionStyle::kSpanColumn)
200  {
201  return ((other.fSpanType == fSpanType) &&
203  }
204  else // kSplitColumn
205  {
206  return ((other.fSpanType == fSpanType) &&
207  (other.fSplitCount == fSplitCount) &&
208  (other.fSplitInsideGutter == fSplitInsideGutter) &&
209  (other.fSplitOutsideGutter == fSplitOutsideGutter));
210  }
211  }
212 
213  bool operator!=(const ParcelSpanData& other) const
214  { return !(*this == other); }
215 
216  ICompositionStyle::SpanColumnsTypeOptions GetColumnType() const
217  { return fSpanType; }
218 
222  bool16 GetIsSingleColumn() const
223  { return (fSpanType == ICompositionStyle::kSingleColumn); }
224 
228  bool16 GetSpansColumns() const
229  { return (fSpanType == ICompositionStyle::kSpanColumn); }
230 
234  bool16 GetSplitsColumn() const
235  { return (fSpanType == ICompositionStyle::kSplitColumn); }
236 
241  uint32 GetColumnIndexStart() const
242  { return fPColIndexStart; }
243 
250  uint32 GetColumnIndexEnd() const
251  { return fPColIndexEnd; }
252 
256  uint32 GetPhysicalColumnSpan() const
257  { return (fPColIndexEnd - fPColIndexStart); }
258 
274  uint32 GetDesiredColumnSpan() const
275  { return fDesiredSpan; }
276 
281  uint32 GetSplitIndex() const
282  {
283  if (fSpanType == ICompositionStyle::kSplitColumn)
284  return fSplitIndex;
285 
286  ASSERT_FAIL("Not a split");
287  return 0;
288  }
289 
295  uint32 GetSplitCount() const
296  {
297  if (fSpanType == ICompositionStyle::kSplitColumn)
298  return fSplitCount;
299 
300  ASSERT_FAIL("Not a split");
301  return 0;
302  }
303 
304  PMReal GetSplitInsideGutter() const
305  {
306  if (fSpanType == ICompositionStyle::kSplitColumn)
307  return fSplitInsideGutter;
308 
309  ASSERT_FAIL("Not a split");
310  return 0.0;
311  }
312 
313  PMReal GetSplitOutsideGutter() const
314  {
315  if (fSpanType == ICompositionStyle::kSplitColumn)
316  return fSplitOutsideGutter;
317 
318  ASSERT_FAIL("Not a split");
319  return 0.0;
320  }
321 
323  uint32 fPColIndexStart;
324  uint32 fPColIndexEnd;
325  uint32 fDesiredSpan;
326  uint32 fSplitIndex;
327  uint32 fSplitCount;
328  PMReal fSplitInsideGutter;
329  PMReal fSplitOutsideGutter;
330 
331  };
332 
333  virtual ParcelSpanData GetNthParcelSpanData(uint32 n) const = 0;
334 
342  virtual PMReal GetNthParcelEffectiveTopAdj(uint32 containerParcelIndex) const = 0;
343 
346  virtual void SetNthParcelEffectiveTopAdj(uint32 containerParcelIndex,
347  PMReal effectiveTopAdj) = 0;
348 
351  virtual PMReal GetNthParcelEffectiveBottomAdj(uint32 containerParcelIndex,
352  PMReal* pBalanceOffset) const = 0;
353 
356  virtual void SetNthParcelEffectiveBottomAdj(uint32 containerParcelIndex,
357  PMReal effectiveBottomAdj,
358  PMReal balanceOffset) = 0;
359 
376  virtual bool16 GetNthParcelIsNonConforming(int32 n) const = 0;
377 
381  {
382  typedef base_type data_type;
383 
384  ParcelAllData(); // does nothing
385 
387  const ParcelSpanData& spanData,
388  PMReal effectiveTopAdj,
389  PMReal effectiveBottomAdj,
390  PMReal effectiveBottomAdjBalanceOffset) :
391  fKey(key), fSpanData(spanData),
392  fEffectiveTopAdj(effectiveTopAdj),
393  fEffectiveBottomAdj(effectiveBottomAdj),
394  fEffectiveBottomAdjBalanceOffset(effectiveBottomAdjBalanceOffset)
395  { }
396 
397  ParcelKey fKey;
398  ParcelSpanData fSpanData;
399  PMReal fEffectiveTopAdj;
400  PMReal fEffectiveBottomAdj;
401  PMReal fEffectiveBottomAdjBalanceOffset;
402 
403  };
404 
405  virtual void GetAllParcelData(std::vector<ParcelAllData>& list) const = 0;
406 
411  virtual ParcelKey AppendParcel(const ParcelSpanData& spanData) = 0;
412 
417  virtual bool16 ChangeNthParcelTo(uint32 containerParcelIndex,
418  const ParcelSpanData& spanData) = 0;
419 
426  virtual void RemoveLastParcel() = 0;
427 
428 };
429 
430 #endif // __IParcelContainer__
431