InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITableFrame.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jesse Jones (jejones)
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 __ITableFrame__
25 #define __ITableFrame__
26 
27 #include "PMRect.h"
28 #include "PMMatrix.h"
29 #include "TablesID.h"
30 #include "TableTypes.h"
31 #include "CellParcelIterator.h"
32 #include "K2SmartPtr.h"
33 #include "ParcelKey.h"
34 #include "ITableLayout.h"
35 
36 //-----------------------------------
37 // Forward References
38 //
39 class IParcel;
40 class IParcelList;
41 class ITableModel;
42 class ITextFrameColumn;
43 class TableLayout;
44 
45 // ===================================================================================
46 // class ITableFrame
47 // ===================================================================================
51 class ITableFrame : public IPMUnknown {
52 //-----------------------------------
53 // API
54 //
55 public:
56 
57  // ----- Constants -----
58  enum {kDefaultIID = IID_ITABLEFRAME};
60  enum ECellArea {
63  kContent = kParcel,
66  kInnerFrame = kInnerStroke,
69  kFrame = kPath,
72  kOuterFrame = kOuterStroke
73  };
74 
75  // ----- Model -----
79  virtual ITableModel* QueryModel() const = 0;
80 
85  virtual UIDRef GetModelRef() const = 0;
86 
92  virtual void SetModel(const ITableModel* table) = 0;
93 
94  //
95  // ----- Frame -----
96 
100  virtual bool16 IsFirstFrame(void) const = 0;
101 
105  virtual bool16 IsValid() const = 0;
106 
113  virtual PMRect GetStrokeBoundingBox() const = 0;
114 
120  virtual PMRect GetPathBoundingBox() const = 0;
121 
128  virtual PMRect GetInkBounds() const = 0;
129 
135  virtual bool16 Contains(const CellParcelAddr& element) const = 0;
136 
137 
141  virtual UIDRef GetFrameRef() const = 0;
142 
147  virtual ITextFrameColumn* QueryFrame() const = 0;
148 
151  virtual ParcelKey GetParcelKey() const = 0;
152 
157  virtual IParcel* QueryParcel() const = 0;
158 
162  virtual PMMatrix GetToParcelMatrix() const = 0;
163 
167  virtual PMMatrix GetToFrameMatrix() const = 0;
168 
172  virtual PMMatrix GetToPasteboardMatrix() const = 0;
173 
174  // ----- Cells -----
190  virtual PMRect GetCellBounds(const GridAddress& anchor, ECellArea area = kContent) const = 0;
191 
196  {
197  protected:
198  HitTestData();
199  HitTestData(const HitTestData&);
200  public:
201  virtual ~HitTestData() { }
202 
203  // cell corners
204  enum CNearestCorner
205  {
206  kTopLeft,
207  kBottomLeft,
208  kTopRight,
209  kBottomRight
210  };
211 
212  // -- accessors --
213  virtual CellParcelAddr GetCellParcelAddr() const = 0;
215  virtual GridAddress GetElementAddress() const = 0;
216  virtual CNearestCorner GetNearestCorner() const = 0;
217  virtual ITableLayout::const_row_iterator GetLayoutRowIter() const = 0;
218  virtual bool16 IsInternalCellHit() const= 0;
219  virtual bool16 IsTopCellHit() const= 0;
220  virtual bool16 IsBottomCellHit() const= 0;
221  virtual bool16 IsLeftCellHit() const= 0;
222  virtual bool16 IsRightCellHit() const= 0;
223  virtual bool16 IsTopLeftCellHit() const= 0;
224  virtual bool16 IsTopRightCellHit() const= 0;
225  virtual bool16 IsBottomLeftCellHit() const= 0;
226  virtual bool16 IsBottomRightCellHit() const= 0;
227  virtual bool16 IsElementHit() const = 0;
228  virtual bool16 IsTopCellStrokeHit() const = 0;
229  virtual bool16 IsBottomCellStrokeHit() const = 0;
230  virtual bool16 IsLeftCellStrokeHit() const = 0;
231  virtual bool16 IsRightCellStrokeHit() const = 0;
232  virtual bool16 IsTopLeftCellStrokeHit() const = 0;
233  virtual bool16 IsTopRightCellStrokeHit() const = 0;
234  virtual bool16 IsBottomLeftCellStrokeHit() const = 0;
235  virtual bool16 IsBottomRightCellStrokeHit() const = 0;
236  virtual bool16 IsInternalStrokeHit() const = 0;
237  virtual bool16 IsTopFrameSideHit() const = 0;
238  virtual bool16 IsBottomFrameSideHit() const = 0;
239  virtual bool16 IsLeftFrameSideHit() const = 0;
240  virtual bool16 IsRightFrameSideHit() const = 0;
241  virtual bool16 IsTopLeftFrameCornerHit() const = 0;
242  virtual bool16 IsTopRightFrameCornerHit() const = 0;
243  virtual bool16 IsBottomLeftFrameCornerHit() const = 0;
244  virtual bool16 IsBottomRightFrameCornerHit() const = 0;
245 
246  // where hit in cell
247  enum ECellHitArea { kNone = -1, kInCell, kTopStroke, kRightStroke, kBottomStroke,
248  kLeftStroke, kTopLeftStroke, kTopRightStroke,
249  kBottomLeftStroke, kBottomRightStroke };
250 
251  // sets location hit in cell, used by Frame/CellCallbackPolicy
252  virtual void SetCellHitArea(const ECellHitArea newCellLoc) = 0;
253 
254  // sets the nearest cell corner of the hit coordinate
255  virtual void SetNearestCorner(CNearestCorner nearCorner) = 0;
256 
257  };
258 
262  {
268  virtual void operator()(const PMPoint& pt, const ITableFrame* tableFrame, HitTestData* hitData) = 0;
269  };
270 
282  virtual HitTestData* HitTest(const PMPoint& pt, HitTestPolicyCallback* framePolicy, HitTestPolicyCallback* cellPolicy) const = 0;
283 
290  virtual bool16 IsRowTopClosed(const ITableLayout::Row& row) const = 0;
291 
298  virtual bool16 IsRowBottomClosed(const ITableLayout::Row& row) const = 0;
299 
304  virtual const ColRange GetColumns() const = 0;
305 
311  virtual bool16 ContainsColumn(const int32 col) const = 0;
312 
318  virtual bool16 ContainsRow(const ITableLayout::Row& row) const = 0;
319 
325  virtual bool16 ContainsModelRow(const GridCoord row) const = 0;
326 
332  virtual bool16 IntersectsModelArea(const GridArea& area) const = 0;
333 
339  virtual bool16 ContainsModelArea(const GridArea& area) const = 0;
340 
345  virtual const int32 GetNumRowsInFrame() const = 0;
346 
354  virtual const GridCoord GetFrameTopRowModelCoord() const = 0;
355 
363  virtual const GridCoord GetFrameBottomRowModelCoord() const = 0;
364 
369  virtual bool16 GetAreRowsInSameRange(GridCoord mR1, GridCoord mR2) const = 0;
370 
375  virtual K2Vector<GridArea>* CreateSectionAreasIntersectingFrame(const GridArea& area) const = 0;
376 
377 
380  virtual ParcelKey GetParcelInFrame(const GridAddress anchor) const = 0;
381 
382  //-------------------------------------------------------------------------------
384 
385 
388 
391  virtual const_parcel_iterator begin_parcel_iter() const = 0;
392 
396  virtual const_parcel_iterator end_parcel_iter() const = 0;
397 
398 
402 
407 
413  virtual const_frame_row_iterator begin_frame_row_iter_at(GridCoord modelRow) const = 0;
414 
417  virtual const_frame_row_iterator end_frame_row_iter() const = 0;
418 
423  virtual void ConvertFromAnna(TableLayout* layout) = 0;
424 
425 };
426 
427 #endif // __ITableFrame__