InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITableLayout.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 __ITableLayout__
25 #define __ITableLayout__
26 
27 #include "TableTypes.h"
28 #include "TablesID.h"
29 #include "PMReal.h"
30 #include "ParcelKey.h"
31 #include "K2SmartPtr.h"
32 
33 class IParcelList;
34 class ITableFrame;
35 
36 
37 class ITableLayout : public IPMUnknown
38 {
39  public:
40  enum { kDefaultIID = IID_ITABLELAYOUT };
41 
46  class Parcel
47  {
48  protected:
49  Parcel();
50 
51  private:
52  Parcel(const Parcel& copy);
53  Parcel& operator=(const Parcel& copy);
54 
55  public:
56  virtual ~Parcel() { }
57 
60  virtual bool16 operator ==(const Parcel& other) const = 0;
62  virtual bool16 operator !=(const Parcel& other) const = 0;
63 
69  virtual GridAddress GetGridAddress() const = 0;
70 
75  virtual ParcelKey GetParcelKey() const = 0;
76 
78  enum Damage {
80  pdt_none = 0x00,
82  pdt_content = 0x01,
86  pdt_x_offset = 0x08,
88  pdt_structure = 0x10,
90 
91  pdt_all = 0x1b
92  };
93 
99  virtual Damage GetDamage() const = 0;
100 
105  virtual PMPoint GetXYOffset() const = 0;
106 
107  };
108 
109 
123  class Row
124  {
125  protected:
126  Row();
127 
128  private:
129  Row(const Row& copy);
130  Row& operator=(const Row& copy);
131 
132  public:
133  virtual ~Row() { }
134 
137  virtual bool16 operator ==(const Row& other) const = 0;
139  virtual bool16 operator !=(const Row& other) const = 0;
140 
142 
144  virtual GridCoord GetModelRowNum() const = 0;
145 
149  virtual bool16 GetIsBodyRow() const = 0;
150 
152  virtual bool16 GetIsFirstForRow() const = 0;
153 
155  virtual bool16 GetIsLastForRow() const = 0;
156 
161  virtual UID GetTableFrameUID() const = 0;
162 
164  enum Damage {
166  rdt_none = 0,
173  };
174 
185  virtual Damage GetDamage() const = 0;
186 
193  virtual bool16 GetIsKeepsDamaged() const = 0;
194 
199  virtual PMPoint GetPathXYOffset() const = 0;
200 
203  virtual PMReal GetPathHeight() const = 0;
204 
208  virtual PMRect GetInkBounds() const = 0;
209 
216  virtual int32 GetParcelCount() const = 0;
217  virtual Parcel* GetNthParcel(int32 n) const = 0;
218  virtual int32 GetParcelColIndex(GridCoord col) const = 0;
219 
223  virtual bool16 GetAreAnyParcelsDamaged() const = 0;
224 
230  virtual uint32 GetEffectiveSubHeaderLevel() const = 0;
231 
232  };
233 
235  class row_iterator;
236 
238 
244  virtual row_iterator begin_row_iterator(GridCoord row, bool16 skipSubHeaders = kTrue) const = 0;
248  virtual row_iterator begin_row_iterator(const row_iterator& iter) const = 0;
254  virtual row_iterator end_row_iterator(GridCoord row, bool16 skipSubHeaders = kTrue) const = 0;
255 
258  virtual row_iterator begin_row_iterator(UID tableFrameUID) const = 0;
260  virtual row_iterator begin_row_iterator(UID tableFrameUID, GridCoord row) const = 0;
262  virtual row_iterator end_row_iterator(UID tableFrameUID) const = 0;
264  virtual row_iterator end_row_iterator(UID tableFrameUID, GridCoord row) const = 0;
265 
267  class row_iterator_helper;
269  {
270  public:
271  typedef Row value_type;
272  typedef std::ptrdiff_t difference_type;
273  typedef const Row* pointer;
274  typedef const Row& reference;
275  typedef std::bidirectional_iterator_tag iterator_category;
276 
277  explicit row_iterator(row_iterator_helper* helper) :
278  fHelper(helper)
279  { }
280 
281  row_iterator(const row_iterator& copy) :
282  fHelper(copy.fHelper->copy())
283  { }
284 
285  row_iterator& operator=(const row_iterator& copy)
286  {
287  fHelper.reset(copy.fHelper->copy());
288  return *this;
289  }
290 
291  Row& operator*() const
292  { return *(fHelper->dereference()); }
293 
294  Row* operator->() const
295  { return fHelper->dereference(); }
296 
297  row_iterator& operator++()
298  {
299  fHelper->increment();
300  return *this;
301  }
302 
303  row_iterator operator++(int)
304  {
305  row_iterator tmp = *this;
306  fHelper->increment();
307  return tmp;
308  }
309 
310  row_iterator& operator--()
311  {
312  fHelper->decrement();
313  return *this;
314  }
315 
316  row_iterator operator--(int)
317  {
318  row_iterator tmp = *this;
319  fHelper->decrement();
320  return tmp;
321  }
322 
323  bool16 operator==(const row_iterator& rhs) const
324  { return fHelper->equal(rhs.fHelper.get()); }
325 
326  bool16 operator!=(const row_iterator& rhs) const
327  { return !(*this == rhs); }
328 
329  protected:
331 
332  };
333 
335 
337 
340  {
341  protected:
343  public:
344  virtual ~row_iterator_helper() { }
345  virtual Row* dereference() const = 0;
346  virtual bool16 equal(const row_iterator_helper* rhs) const = 0;
347  virtual void increment() = 0;
348  virtual void decrement() = 0;
349  virtual row_iterator_helper* copy() const = 0;
350 
351  };
352 
356  class Frame
357  {
358  protected:
359  Frame();
360 
361  private:
362  Frame(const Frame& copy);
363  Frame& operator=(const Frame& copy);
364 
365  public:
366  virtual ~Frame() { }
367 
369 
371  virtual bool16 operator ==(const Frame& other) const = 0;
373  virtual bool16 operator !=(const Frame& other) const = 0;
374 
376 
378  virtual UIDRef GetFrameRef() const = 0;
380  virtual ITableFrame* QueryFrame() const = 0;
381 
383 
384  //
385  virtual bool16 GetIsFirst() const = 0;
387  virtual bool16 GetIsLast() const = 0;
388 
390  enum Damage {
392  fdt_none = 0,
401  };
402 
406  virtual Damage GetDamage() const = 0;
407 
413  virtual RowRange GetHeaderRows() const = 0;
415  virtual bool16 GetHasAnySubHeaderRows() const = 0;
417  virtual bool16 GetIsASubHeaderRow(GridCoord mR) const = 0;
419  virtual RowRange GetBodyRows() const = 0;
421  virtual RowRange GetFooterRows() const = 0;
423  virtual bool16 GetAreRowsInSameRange(GridCoord mR1,
424  GridCoord mR2) const = 0;
425 
429  virtual ParcelKey GetParcelKey() const = 0;
430 
436  virtual PMPoint GetStrokeXYOffset() const = 0;
437 
440  virtual PMMatrix GetToParcelMatrix() const = 0;
441 
444  virtual PMMatrix GetToTextFrameMatrix() const = 0;
445 
448  virtual PMMatrix GetToPasteboardMatrix() const = 0;
449 
454  virtual PMRect GetStrokeBounds() const = 0;
455 
459  virtual PMRect GetPathBounds() const = 0;
460 
464  virtual PMRect GetInkBounds() const = 0;
465 
466  };
467 
471  class frame_iterator;
473  virtual frame_iterator begin_frame_iterator() const = 0;
475  virtual frame_iterator begin_frame_iterator(UID tableFrameUID) const = 0;
477  virtual frame_iterator end_frame_iterator() const = 0;
479  virtual frame_iterator end_frame_iterator(UID tableFrameUID) const = 0;
480 
482  class frame_iterator_helper;
484  {
485  public:
486  typedef Frame value_type;
487  typedef std::ptrdiff_t difference_type;
488  typedef const Frame* pointer;
489  typedef const Frame& reference;
490  typedef std::bidirectional_iterator_tag iterator_category;
491 
493  fHelper(helper)
494  { }
495 
496  frame_iterator(const frame_iterator& copy) :
497  fHelper(copy.fHelper->copy())
498  { }
499 
500  frame_iterator& operator=(const frame_iterator& copy)
501  {
502  fHelper.reset(copy.fHelper->copy());
503  return *this;
504  }
505 
506  Frame& operator*() const
507  { return *(fHelper->dereference()); }
508 
509  Frame* operator->() const
510  { return fHelper->dereference(); }
511 
512  frame_iterator& operator++()
513  {
514  fHelper->increment();
515  return *this;
516  }
517 
518  frame_iterator operator++(int)
519  {
520  frame_iterator tmp = *this;
521  fHelper->increment();
522  return tmp;
523  }
524 
525  frame_iterator& operator--()
526  {
527  fHelper->decrement();
528  return *this;
529  }
530 
531  frame_iterator operator--(int)
532  {
533  frame_iterator tmp = *this;
534  fHelper->decrement();
535  return tmp;
536  }
537 
538  bool16 operator==(const frame_iterator& rhs) const
539  { return fHelper->equal(rhs.fHelper.get()); }
540 
541  bool16 operator!=(const frame_iterator& rhs) const
542  { return !(*this == rhs); }
543 
544  protected:
546 
547  };
548 
550 
552 
555  {
556  protected:
558  public:
559  virtual ~frame_iterator_helper() { }
560  virtual Frame* dereference() const = 0;
561  virtual bool16 equal(const frame_iterator_helper* rhs) const = 0;
562  virtual void increment() = 0;
563  virtual void decrement() = 0;
564  virtual frame_iterator_helper* copy() const = 0;
565 
566  };
567 
569  virtual void RecomposeThruModelRow(const GridCoord modelRow) = 0;
570 
576  virtual PMReal GetRowHeight(GridCoord modelRow) const = 0;
577 
580  virtual GridCoord GetRowVMergeStart(GridCoord modelRow) const = 0;
582  virtual GridCoord GetRowVMergeLast(GridCoord modelRow) const = 0;
584  virtual GridCoord GetRowKeepsStart(GridCoord modelRow) const = 0;
586  virtual GridCoord GetRowKeepsLast(GridCoord modelRow) const = 0;
587 
589  virtual ParcelKey GetCellParcelKey(const GridAddress& ga,
590  UID tableFrameUID) const = 0;
591 
595  ParcelKey key) const = 0;
597  virtual PMRect GetCellParcelPathBounds(const GridAddress& ga,
598  ParcelKey key) const = 0;
600  virtual PMRect GetCellParcelInnerStrokeBounds(const GridAddress& ga,
601  ParcelKey key) const = 0;
602 
608  virtual UID GetParcelFrameUID(GridAddress ga,
609  ParcelKey key) const = 0;
610 
617  ParcelKey key) const = 0;
618 
620 
623  ParcelKey key) const = 0;
624 
631  ParcelKey key) const = 0;
632 
637  virtual bool16 GetParcelAcceptingInvals(GridAddress ga,
638  ParcelKey key) const = 0;
639 
645  virtual void AddParcelPendingInval(GridAddress ga, ParcelKey key,
646  const PMRect& invalRect) = 0;
647 
653  ParcelKey key,
654  bool16 isDamaged) = 0;
655 
662 
669  ParcelKey key) = 0;
673  virtual void PreNotifyCellTypeChanged(const GridArea& cells) = 0;
674 
678  virtual void NotifyCellTypeChanged(const GridArea& cells) = 0;
679 };
680 
681 #endif //__ITableLayout__
682