Mobile API Reference  MicroStrategy 2019
FormatFont.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : FormatFont.h
3 // AUTHOR : Fangyao Ma
4 // CREATION : 2008-09-28
5 // Copyright (C) MicroStrategy Incorporated 2008
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MsiChart_FormatFont_h
9 #define MsiChart_FormatFont_h
10 
11 #include "PDCHeader/PDCvector"
12 #include "Base/Base/BaseString.h"
13 #include "Synch/Defines/SmartPtr.h"
14 #include "CEModuleMain.h"
15 #include "RGBColor.h"
16 #include "Point2D.h"
17 #ifndef _VE_CE
18 #include "CoreText/CTFont.h"
19 #include "CoreText/CoreText.h"
20 #include "CoreFoundation/CFAttributedString.h"
21 #endif
22 
23 class CComVariant;
24 
25 namespace MsiChart
26 {
27  class FontKey;
29  typedef enum
30  {
37  }EnumBoxStyle;
38 
40  typedef enum
41  {
46 
48  typedef enum
49  {
50  FS_NORMAL = 0,
54  FS_UNDERLINE = 0x04,
56  FS_FILLSTROKE = 0x0c,
58 
60  typedef enum
61  {
62  FR_NORMAL = 0, // Use the same number as EnumDSSGraphFontRotation
63  FR_45 = 5,
64  FR_90 = 2,
65  FR_180 = 3,
66  FR_270 = 4,
67  FR_315 = 6,
69 
70  typedef enum{
80 
81  class ChartContext;
82 
86  class FormatFont
87  {
88  public:
97  mFontColor(0,0,0),
98  mStrokeColor(255,255,255),
99  mFontAlpha(255),
100  mFontName(L"Arial"),
101  mFontSize(15),
102  mClassMemberMap(0)
103  {
104  }
105 
106  ~FormatFont();
107 
113  void ApplyFontFormat(ChartContext* ipChartContext, bool iIsOnlyForExtent);
114 
119  void GetFontExtent(Int32& orLineHeight);
120 
127  void GetStringExtent(const MBase::String& irString,
128  Int32& orWidth,Int32& orHeight);
129 
136  void GetStringExtent(const MBase::String& irString, float& orWidth, float& orHeight);
137 
138  double GetRadian() const;
139 
140  bool GetOptions(Int32 iPropertyId, CComVariant* opValue) const;
141 
146  bool IsVertical() const;
151  bool IsHorizontal() const;
152  inline void SetResolvedInDataSet(const bool iFlag ,const EnumFormatFontMembers iMember);
153  inline bool IsResolvedInDataSet(const EnumFormatFontMembers iMember) const;
154  FormatFont* Clone() const;
155 
156 #ifndef _VE_CE
157  //void DrawAtPosition(CGContextRef iCGContextRef, const char* ipString, float iX, float iY) const;
158 
159  CTLineRef CreateCTLine(const MBase::String& irString);
160 
161  //void DrawLine(CTLineRef iStringRef, CTFontRef iFontRef, CGContextRef iContextRef);
162 
163  static CTFontRef CreateFont(CFStringRef iFamilyName, CGFloat iSize, CTFontSymbolicTraits iTraits, CTFontSymbolicTraits iTraitMasks);
164  static void* CreateUIFont(const char* iFontName, CGFloat iSize, bool iIsBold, bool iIsItalic);
165 
166  //static CTFontRef CreateFont(CTFontDescriptorRef iFontDescriptor, CGFloat iSize);
167 #endif
168  unsigned char mFontAlignment;
169  unsigned char mFontStyle;
170  unsigned char mFontRotation;
171  unsigned char mFontBox;
174  unsigned char mFontAlpha;
178  //void* mFontRef;
179  };
180 
181  inline bool FormatFont::IsVertical() const
182  {
183  return mFontRotation == FR_90 || mFontRotation == FR_270;
184  }
185 
186  inline bool FormatFont::IsHorizontal() const
187  {
189  }
190  inline void FormatFont::SetResolvedInDataSet(const bool iFlag ,const EnumFormatFontMembers iMember)
191  {
192  mClassMemberMap ^= iFlag << iMember;
193  }
195  {
196  return (mClassMemberMap & 1 << iMember) != 0;
197  }
198 }
199 #endif
EnumFontRotation
Enumeration for Font Rotation, use the same value as EnumDSSGraphFontRotation.
Definition: FormatFont.h:60
unsigned char mFontAlignment
EnumFontAlignment: 3 options.
Definition: FormatFont.h:168
FormatFont * Clone() const
Definition: FormatFont.h:78
Definition: FormatFont.h:52
Definition: FormatFont.h:32
Definition: FormatFont.h:62
Definition: FormatFont.h:34
EnumFormatFontMembers
Definition: FormatFont.h:70
Definition: FormatFont.h:44
Definition: FormatFont.h:75
Definition: FormatFont.h:43
Definition: FormatFont.h:76
Definition: FormatFont.h:65
FormatFont()
Definition: FormatFont.h:93
MBase::String mFontName
Font name.
Definition: FormatFont.h:175
Int32 mFontSize
Font size.
Definition: FormatFont.h:176
Definition: FormatFont.h:77
Definition: FormatFont.h:42
Definition: FormatFont.h:36
Definition: FormatFont.h:71
CTLineRef CreateCTLine(const MBase::String &irString)
Definition: FormatFont.h:63
Definition: FormatFont.h:35
Definition: FormatFont.h:67
Definition: FormatFont.h:31
#define Int32
Definition: BasicTypes.h:20
Definition: FormatFont.h:50
static void * CreateUIFont(const char *iFontName, CGFloat iSize, bool iIsBold, bool iIsItalic)
MSynch::SmartPtr< FormatFont > Ptr
Definition: FormatFont.h:89
Definition: FormatFont.h:72
unsigned char mFontRotation
EnumFontRotation: 5 options.
Definition: FormatFont.h:170
Definition: FormatFont.h:66
Definition: FormatFont.h:53
static CTFontRef CreateFont(CFStringRef iFamilyName, CGFloat iSize, CTFontSymbolicTraits iTraits, CTFontSymbolicTraits iTraitMasks)
Definition: FormatFont.h:33
EnumFontStyle
Enumeration for Font Style.
Definition: FormatFont.h:48
Definition: ChartContext.h:542
Definition: FormatFont.h:73
std::basic_string< WCHAR, std::char_traits< WCHAR >, Allocator< WCHAR > > String
Definition: BaseString.h:26
bool IsHorizontal() const
Definition: FormatFont.h:186
Definition: FormatFont.h:54
EnumFontAlignment
Enumeration for Font Alignment.
Definition: FormatFont.h:40
Definition: ABLPlot.h:21
unsigned char mFontBox
EnumBoxStyle: 5 options.
Definition: FormatFont.h:171
void GetFontExtent(Int32 &orLineHeight)
void SetResolvedInDataSet(const bool iFlag, const EnumFormatFontMembers iMember)
Definition: FormatFont.h:190
double GetRadian() const
Definition: FormatFont.h:64
unsigned char mFontAlpha
Font Alpha [0,255].
Definition: FormatFont.h:174
Definition: Msi_ccomvariant.h:24
Definition: FormatFont.h:55
Definition: FormatFont.h:74
unsigned char mFontStyle
EnumFontStyle: 4 options.
Definition: FormatFont.h:169
Int32 mClassMemberMap
Definition: FormatFont.h:177
EnumBoxStyle
Enumeration for TextObject&#39;s Box Style.
Definition: FormatFont.h:29
RGBColor mStrokeColor
Text Stroke Color.
Definition: FormatFont.h:173
Definition: FormatFont.h:56
Definition: RGBColor.h:21
bool IsVertical() const
Definition: FormatFont.h:181
RGBColor mFontColor
Font Color.
Definition: FormatFont.h:172
void GetStringExtent(const MBase::String &irString, Int32 &orWidth, Int32 &orHeight)
bool IsResolvedInDataSet(const EnumFormatFontMembers iMember) const
Definition: FormatFont.h:194
Definition: FormatFont.h:51
bool GetOptions(Int32 iPropertyId, CComVariant *opValue) const
void ApplyFontFormat(ChartContext *ipChartContext, bool iIsOnlyForExtent)
Definition: FormatFont.h:86