InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IFocusCache.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: eric_menninga
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 // This is an interface that assumes that it has access to an ITextFocus
24 // interface. It's purpose is to cache every value for every text attribute
25 // and style that is in the range described by the ITextFocus.
26 // The cache, once built, is time stamped so that the system can tell
27 // if the cache has changed.
28 //
29 //========================================================================================
30 
31 #ifndef __IFocusCache__
32 #define __IFocusCache__
33 
34 
35 #include "IPMUnknown.h"
36 #include "IPMFont.h"
37 #include "TextID.h"
38 #include "TextAttrID.h"
39 
40 class PMString;
41 class AttributeBossList;
42 class ITextModel;
43 class IAttrReport;
44 
45 //--------------------------------------------------
46 
50 struct PMFontData
51 {
52  typedef object_type data_type;
53  PMFontData() : fNumAxes(0), fIncorrectFace(0), fFamilyUID(kInvalidUID), fAxes(nil)
54  {}
55  ~PMFontData(){
56  if(fAxes)
57  delete [] fAxes;
58  fAxes = nil;
59  }
60 
65  int operator==(const PMFontData& other) const
66  { if (fName != other.fName || fNumAxes != other.fNumAxes)
67  return kFalse;
68  else
69  return (std::memcmp(fAxes, other.fAxes, fNumAxes * sizeof(Fixed)) == 0);
70  }
71 
72  PMString fName;
73  PMString fFaceName;
74  UID fFamilyUID;
75  Fixed *fAxes;
76  int16 fNumAxes;
77  bool16 fIncorrectFace;
78 };
79 
80 
87 class IFocusCache : public IPMUnknown
88 {
89  public:
90  enum { kDefaultIID = IID_IFOCUSCACHE };
91 
92  //-------------------------------------------------------------------------------------
95  virtual int32 CountParagraphStyles() const = 0;
98  virtual int32 CountCharacterStyles() const = 0;
101  virtual int32 CountCharacterStylesFromRunIns() const = 0;
102 
106  virtual UID GetNthParagraphStyle(int32 n) const = 0;
110  virtual UID GetNthCharacterStyle(int32 n) const = 0;
114  virtual UID GetNthCharacterStyleFromRunIn(int32 n) const = 0;
115 
120  virtual bool16 IsStyleOverridden(UID style) const = 0;
121 
122  //-------------------------------------------------------------------------------------
125  virtual int32 CountSelectedRuns() const = 0;
126 
130  virtual int32 CountAttributes(const ClassID& attr) const = 0;
131 
137  virtual const IPMUnknown* QueryAttributeN(int32 which, const ClassID& attr, const PMIID& interfaceID) const = 0;
138 
139  //-------------------------------------------------------------------------------------
144  virtual int32 CountFonts(ClassID fontUIDBoss = kTextAttrFontUIDBoss) const = 0;
145 
151  virtual UID GetNthFamilyUIDAndFace(int32 nthFont, PMString *faceName, ClassID fontUIDBoss = kTextAttrFontUIDBoss) const = 0;
152 
160  virtual const PMString& GetNthFont(int32 nthFont, bool16 *incorrectFace = nil, ClassID fontUIDBoss = kTextAttrFontUIDBoss) const = 0;
161 
166  virtual const Fixed* GetNthMMAxes(int32 nthFont, int32 *numaxes) const = 0;
167 
172  virtual bool16 GetOverrideList(K2Vector<PMString>& overrideStrings, bool16 getForParaStyle) const = 0;
173 
174 
175  //-------------------------------------------------------------------------------------
177  virtual void InvalidateCache() = 0;
180  virtual void ResetCache_NoNotify() = 0;
184  virtual void Inserted(TextIndex where, int32 howmuch) = 0;
188  virtual void Deleted(TextIndex where, int32 howmuch) = 0;
195  virtual void FocusWasMoved(const ITextModel * model, TextIndex start, TextIndex end, bool16 excludeCacheEnd = kTrue) = 0;
196 
198  virtual bool16 CacheAlreadyBuilt() const = 0;
200  virtual uint32 GetTimeStamp() const = 0;
201 
205  virtual void CopyToAttributeLists(AttributeBossList *attrList, AttributeBossList *mixedList = nil) const = 0;
206 
209  virtual bool16 IsRubyApplied() const = 0;
210 };
211 
212 #endif
213  // __IFocusCache__
214