InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TextDrawInfo.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 __TEXT_DRAW_INFO__
25 #define __TEXT_DRAW_INFO__
26 
27 #include "IWaxRenderData.h"
28 #include "IPMFont.h"
29 #include "GraphicsData.h"
30 
31 class IParcelShape;
32 class IPMFont;
33 
35 {
36 public:
37  TextDrawInfo();
38  ~TextDrawInfo();
39 
40  void StartTextFrameShapeDraw(const GraphicsData* gd, const IParcelShape* parcel);
41  void EndTextFrameShapeDraw (const GraphicsData* gd, const IParcelShape* parcel);
42 
43  void StartTableFrameShapeDraw();
44  void EndTableFrameShapeDraw ();
45 
46  // Accessors
47  UID GetNoneSwatchUID() const { return fNoneSwatchUID; }
48  bool16 IsCreatingOutlines() const { return fIsCreatingOutlines; }
49  IPMFont* QueryFont() const;
50 
51  bool16 IsColorInfoSame(const IWaxRenderData* currentRun, IDataBase* db) const;
52  bool16 IsFontInfoSame(const IWaxRenderData* currentRun) const;
53 
54 
55  // Two kinds of run based optimization are currently supported.
56  // 1. Avoid reinstalling rendeing objects for each text run.
57  // 2. Avoid QueryFont from IWaxRenderData for each run.
58  // EOptimization lets you choose from these.
59  // eColorAndFont => 1. & 2. // currently used for drawing text
60  // eFontOnly => 2. // currently used for greeking text
61  enum EOptimize { eColorAndFont, eFontOnly };
62  void NotifyRunDrawn(EOptimize optimize, const IWaxRenderData* justDrawn, IPMFont* justDrawnFont);
63 
64  // This call has an implicit meaning of eFontOnly. eg missing font & missing glyph adornments
65  // Any color optimizations are maintained
66  void NotifyRunFont(const IWaxRenderData* run, IPMFont* font);
67 
68  // Clears color & font optimization.
69  void ClearRunDrawn();
70 
71  // Clears color optimization (rendering object installed)
72  // Font optimization if any will be maintained.
73  void ClearRunRenderInfo();
74 
75 
76 private:
77  // Not specific to a parcel or thread but to all text
78  bool16 fNonParcelDataInitialized;
79  bool16 fIsCreatingOutlines;
80  UID fNoneSwatchUID;
81 
82  // Specific to each run
83  InterfacePtr<const IWaxRenderData> fColorRenderData;
84  InterfacePtr<const IWaxRenderData> fFontRenderData;
86 };
87 
89 {
90  public:
91  AutoTextFrameDrawNotify(const GraphicsData* gd, const IParcelShape* parcel) :
92  fGD(gd),
93  fParcel(parcel)
94  {
95  gd->GetTextDrawInfo()->StartTextFrameShapeDraw(fGD, fParcel);
96  }
98  {
99  fGD->GetTextDrawInfo()->EndTextFrameShapeDraw(fGD, fParcel);
100  }
101  private:
102  const GraphicsData* fGD;
103  const IParcelShape* fParcel;
104 };
105 
107 {
108  public:
109  explicit AutoTableFrameDrawNotify(const GraphicsData* gd) :
110  fGD(gd)
111  {
112  fGD->GetTextDrawInfo()->StartTableFrameShapeDraw();
113  }
115  {
116  fGD->GetTextDrawInfo()->EndTableFrameShapeDraw();
117  }
118  private:
119  const GraphicsData* fGD;
120 };
121 
122 #endif //__TEXT_DRAW_INFO__