Mobile API Reference  MicroStrategy 2019
FormatInfo.h
Go to the documentation of this file.
1 /*
2  * FormatInfo.h
3  * IPhoneChart
4  *
5  * Created by dong shi on 5/19/10.
6  * Copyright 2010 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #ifndef MSICHART_FORMATINFO_H
11 #define MSICHART_FORMATINFO_H
12 #include "Base/Base/BaseString.h"
13 #include "../Common.h"
14 #include "map"
15 #include "vector"
16 #include "PropertyPackage.h"
17 class CComVariant;
18 
19 namespace MsiChart
20 {
23  const Int32 gKeySpecialSection = 3; //including closing '\0'
24 
25  typedef enum
26  {
28  FONT_BOLD = 1,
31  }FONTSTYLE;
32 
33  typedef enum
34  {
35  EXTR_BEGIN = -1,
41 
42  typedef enum
43  {
48 
49  //class: Format Info
50  //typedef std::map<_GridProperty, CComVariant*> GridPropertyMap;
51  typedef std::vector<CComVariant*> GridPropertyMap;
52  typedef std::map<MBase::String, std::vector<MBase::String> > FontBuckets; //FontFamily --> FontStyle
53  typedef std::map<MBase::String, std::vector<std::string> > FontBuckets_N; //N for narrow character.
54 
55 #ifndef _VE_CE
56  class ChartAdvFormat;
57 #else
58  struct ChartAdvFormat;
59 #endif
60  class FormatInfo
61  {
62  public:
63  typedef FormatInfo* Ptr;
64 
65  FormatInfo();
66  ~FormatInfo();
67 
68  static void Initialize();
69 
70  void Clear();
71  void Copy(FormatInfo::Ptr iInfo);
72  void Merge(FormatInfo::Ptr iInfo);
73  void Merge(FormatInfo::Ptr iMajor, FormatInfo::Ptr iMinor);
74 
75  bool GetBoolValue(Int32 iPropertyId);
76  bool GetBoolValue(_GridProperty iPropertyId);
77  Int32 GetIntValue(Int32 iPropertyId);
78  Int32 GetIntValue(_GridProperty iPropertyId);
79  double GetDoubleValue(Int32 iPropertyId);
80  double GetDoubleValue(_GridProperty iPropertyId);
81  MBase::String GetStringValue(Int32 iPropertyId);
83 
84  std::string GetCStringValue(Int32 iPropertyId);
85  std::string GetCStringValue(_GridProperty iPropertyId);
86 
87  bool GetCStringValue(std::string& orValue, _GridProperty iPropertyId); //this one is customized for grid rendering, it only supports two properties :_numberFormat _currencySymbol
88  void Update();
89 
90  bool Find(_GridProperty iPropertyId, bool iIncludeAllMaps = false);
91 
92  void DebugOneProperty(Int32 iPropertyId);
93 
94 
95  //getter
96  CComVariant* GetProperty(Int32 iPropertyId);
98 
99 
100  void GetFontName(std::string& orResult);
101  void GetFontName(MBase::String& iFontFamily, int iStyle, std::string& orResult);
102 
104  MBase::String GetFontName(MBase::String& iFontFamily, FONTSTYLE iStyle);
105 
106  bool IsUseDefault(Int32 iPropertyId);
107  bool IsUseDefault(_GridProperty iPropertyId);
108 
109  //setter
110  void SetProperty(Int32 iPropertyId, CComVariant* ipAddress);
111  void SetProperty(_GridProperty iPropertyId, CComVariant* ipAddress);
112 
113  //transfer to CharAdvFormat
114  bool ToChartAdvFormat(ChartAdvFormat& orChartAdvFormat);
115 
116  //Special handling for drillable
117  void SetDrillable(bool iIsDrillable);
118  bool GetDrillable();
119 
120  //handle key
121  void GetKey(std::string& orKey);
122  void SetKey(const std::string& irKey);
123  void InitKey(Int32 iMaxIndex);
124 
125  //for easy debug
126  void PrintOneProperty(Int32 iPropertyId);
127  void PrintOneProperty(_GridProperty iPropertyId);
128 
129  void UpdateExtraProperties(const std::vector<CComVariant>& irExtraProperties);
130  void UpdateScaledProperties(int iPropertyUnion = 0x07);
131 
132  bool HasParsedCellFormat() const;
133  void SetParsedCellFormat(bool iHasParsedCellFmt);
134 
135  //memory estimation
137 
138  public://dark theme support.
139  bool mHasThreshold; //used in grid, if the corresponding grid has a threshold defined.
140  //peformance
141  bool mFontBold;
143 
144  public://static members
145  static std::map<MBase::String, Int32> msFontFamily;
146  static std::map<CComVariant*, bool> msDefaultAddressPool;
151 
152  private://private methods
153  void hInit();
154  CComVariant* hGetSupportFontFamily();
155  double hConvertBSTRToDouble(CComVariant* ipVariant, int iType);
156  void hDumpVariant(CComVariant* ipVariant);
157 
158  private://private data members
159  GridPropertyMap mPropertyMap;
160  bool mIsDrillable;
161  bool mHasParsedCellFormat; //has cell format and it is already parsed.
162  //key stuff.
163  std::string mKey; //impl1. use string fully
164  Int32 mKeyLen;
165 
166  //for performance.
167  std::string mCurrencySymbol;
168  std::string mNumberFormatString;
169  bool mHasCurrencySymbolDefined;
170  bool mHasNumberFormatStringDefined;
171 
172  private:
173  std::vector<CComVariant*> mExtraProperties; //For scaled factor related.
174  };
175  typedef std::map<GUID, FormatInfo::Ptr>* FormatPoolPtr;
176  typedef std::map<GUID, FormatInfo::Ptr> FormatPool;
177 
178  inline bool FormatInfo::GetDrillable() {return mIsDrillable;}
179  inline void FormatInfo::SetDrillable(bool iIsDrillable = true) {mIsDrillable = iIsDrillable;}
180 
181  inline void FormatInfo::GetKey(std::string& orKey){orKey = mKey;}
182  inline void FormatInfo::SetKey(const std::string& irKey){mKey = irKey;}
183 
184  inline bool FormatInfo::HasParsedCellFormat() const { return mHasParsedCellFormat;}
185  inline void FormatInfo::SetParsedCellFormat(bool iHasParsedCellFmt) {mHasParsedCellFormat = iHasParsedCellFmt;}
186 
187 }
188 
189 #endif
void Copy(FormatInfo::Ptr iInfo)
bool IsUseDefault(Int32 iPropertyId)
bool mFontBold
Definition: FormatInfo.h:141
Definition: FormatInfo.h:28
Definition: FormatInfo.h:46
Definition: FormatInfo.h:27
static std::map< MBase::String, Int32 > msFontFamily
Definition: FormatInfo.h:145
static PropertyPackage mPropertyPackage
Definition: FormatInfo.h:149
static void Initialize()
void SetDrillable(bool iIsDrillable)
Definition: FormatInfo.h:179
std::vector< CComVariant * > GridPropertyMap
Definition: FormatInfo.h:51
CComVariant * GetProperty(Int32 iPropertyId)
This struct is from ChartCtrl.h.
Definition: NumberObject.h:38
static CComVariant msDefaultFontFamily
Definition: FormatInfo.h:150
Definition: FormatInfo.h:29
void InitKey(Int32 iMaxIndex)
bool HasParsedCellFormat() const
Definition: FormatInfo.h:184
void SetKey(const std::string &irKey)
Definition: FormatInfo.h:182
Definition: FormatInfo.h:45
bool mFontItalic
Definition: FormatInfo.h:142
bool GetBoolValue(Int32 iPropertyId)
bool GetDrillable()
Definition: FormatInfo.h:178
bool ToChartAdvFormat(ChartAdvFormat &orChartAdvFormat)
EXTRA_FMT_PROPERTIES
Definition: FormatInfo.h:33
Definition: FormatInfo.h:35
void Merge(FormatInfo::Ptr iInfo)
FormatInfo * Ptr
Definition: FormatInfo.h:63
Definition: PropertyPackage.h:332
Definition: FormatInfo.h:37
Definition: FormatInfo.h:36
MBase::String GetFontName()
#define Int32
Definition: BasicTypes.h:20
Int32 GetIntValue(Int32 iPropertyId)
std::map< GUID, FormatInfo::Ptr > FormatPool
Definition: FormatInfo.h:176
static FontBuckets_N msFontBuckets_N
Definition: FormatInfo.h:148
Definition: FormatInfo.h:39
double GetDoubleValue(Int32 iPropertyId)
MBase::String GetStringValue(Int32 iPropertyId)
bool mHasThreshold
Definition: FormatInfo.h:139
std::map< GUID, FormatInfo::Ptr > * FormatPoolPtr
Definition: FormatInfo.h:175
void SetProperty(Int32 iPropertyId, CComVariant *ipAddress)
const Int32 gKeySpecialSection
Definition: FormatInfo.h:23
std::basic_string< WCHAR, std::char_traits< WCHAR >, Allocator< WCHAR > > String
Definition: BaseString.h:26
Definition: ABLPlot.h:21
void DebugOneProperty(Int32 iPropertyId)
Definition: FormatInfo.h:38
void PrintOneProperty(Int32 iPropertyId)
void UpdateScaledProperties(int iPropertyUnion=0x07)
Definition: FormatInfo.h:30
_GridProperty
Definition: PropertyPackage.h:23
Definition: Msi_ccomvariant.h:24
const Int32 gKeyBandingIndexOffset
Definition: FormatInfo.h:21
static FontBuckets msFontBuckets
Definition: FormatInfo.h:147
std::string GetCStringValue(Int32 iPropertyId)
std::map< MBase::String, std::vector< std::string > > FontBuckets_N
Definition: FormatInfo.h:53
bool Find(_GridProperty iPropertyId, bool iIncludeAllMaps=false)
Int32 GetMemoryUsageEstimation()
void SetParsedCellFormat(bool iHasParsedCellFmt)
Definition: FormatInfo.h:185
Definition: FormatInfo.h:44
EXTRA_IDX_PROPERTIES
Definition: FormatInfo.h:42
const Int32 gKeySubtotalIndexOffset
Definition: FormatInfo.h:22
std::map< MBase::String, std::vector< MBase::String > > FontBuckets
Definition: FormatInfo.h:52
void UpdateExtraProperties(const std::vector< CComVariant > &irExtraProperties)
void GetKey(std::string &orKey)
Definition: FormatInfo.h:181
static std::map< CComVariant *, bool > msDefaultAddressPool
Definition: FormatInfo.h:146
FONTSTYLE
Definition: FormatInfo.h:25
Definition: FormatInfo.h:60