Mobile API Reference  MicroStrategy 2019
GridFormatting.h
Go to the documentation of this file.
1 //
2 // GridFormatting.h
3 // IPhoneChart
4 //
5 // Created by dong shi on 5/7/10.
6 // Copyright 2010 __MyCompanyName__. All rights reserved.
7 //
8 
9 #ifndef MsiChart_GridFormatting_h
10 #define MsiChart_GridFormatting_h
11 
12 #import "DatasetHelper.h"
13 #import "DSSTemplate.h"
14 #import "Common.h"
15 #import "FormatManager.h"
16 #import "DSSCustomGroup.h"
22 
23 class CComVariant;
24 class FormatManager;
25 class DSSFormat;
26 
27 namespace MsiChart
28 {
30  {
31  public:
33  BaseFormatting(GUID& iGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
34  virtual ~BaseFormatting();
35  //virtual FormatInfo::Ptr Resolve(FormatInfo::Ptr ipUpperLayerFormat);
36  virtual void Resolve(FormatInfo::Ptr& iopUpperLayerFormat);
37 
38  virtual std::map<GUID, FormatInfo::Ptr>* GetPool();
39  virtual std::map<GUID, FormatInfo::Ptr>* GetTitle();
40  virtual std::map<GUID, FormatInfo::Ptr>* GetHeader();
41  virtual std::map<GUID, FormatInfo::Ptr>* GetDataFormat();
42  virtual std::map<GUID, FormatInfo::Ptr>* GetSubtotalHeader(GUID& irID);
43  virtual std::map<GUID, FormatInfo::Ptr>* GetSubtotalTitle();
44  virtual std::map<GUID, FormatInfo::Ptr>* GetCornerFormat();
45 
46  void Update(GUID& irID, Int32 iCellType);
47  static void MergeFormatToFormatInfo(DSSFormat* ipFormat, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer);
48  protected:
53  virtual bool hIsApplicalbel();
54 
61  virtual bool hPrepareAndContinue(const std::vector<DSSFormat*>& irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr);
62 
63  //Update Format info
66  virtual void hGetFormats(GUID& irID, Int32 iCellType, std::vector<DSSFormat*>& orFormat);
67 
74  virtual FormatInfo::Ptr hUpdateOneFormat(GUID& irID, Int32 iCellType, FormatInfo::Ptr ipInfo);
75 
78  virtual void hGetFormatKey(const std::vector<DSSFormat*>& irFomatSet, FormatInfo::Ptr iUpperLayerInfoPtr, std::string& orResultKey);
79  void hGetFormatIndexAsText(DSSFormat* ipFormat, std::string& orKey);
80 
83  virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr);
84 
87  virtual void hUpdateOneFormat(DSSFormat* ipFormat, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer);
88  void hUpdateOneFormat(const std::vector<DSSFormat*>& irFomatSet, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer);
89 
90 
91  //Get Format from different layer
92  DSSFormat* hGetFormatFromType(DSSTemplateUnit* ipUnit, Int32 iFormatterType);
93  DSSFormat* hGetFormatFromType(DSSAxis* ipAxis, Int32 iFormatterType);
94  DSSFormat* hGetFormatFromType(DSSTemplate* ipUnit, Int32 iFormatterType);
95  DSSFormat* hGetFormatFromType(DSSMetric* ipMetric, Int32 iFormatterType); //Just for metric
96  DSSFormat* hGetFormatFromType(DSSTemplateMetric* ipTemplateMetric, Int32 iFormatterType); //Just for templatemetric
97 
98  protected: //Data Members:
103 
104  bool mIsUseResolved; //use resolved optimization from server.
105  std::map<std::string, FormatInfo::Ptr> mResolvedPool; //pool that hold format resolved from top layer to us.
106  };
107 
109  {
110  public:
111  TemplateFormatting(GUID& iGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
113 
114  std::map<GUID, FormatInfo::Ptr>* GetTitle();
115  std::map<GUID, FormatInfo::Ptr>* GetHeader();
116  std::map<GUID, FormatInfo::Ptr>* GetDataFormat();
117  std::map<GUID, FormatInfo::Ptr>* GetCornerFormat();
118 
119  protected:
120  virtual bool hIsApplicalbel();
121  virtual FormatInfo::Ptr hUpdateOneFormat(GUID& irID, Int32 iCellType, FormatInfo::Ptr ipInfo);
122  virtual void hGetFormats(GUID& irID, Int32 iCellType, std::vector<DSSFormat*>& orFormat);
123  virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr); //usually this will be the last layer. except when we have cell level.
124  virtual bool hPrepareAndContinue(const std::vector<DSSFormat*>& irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr);
125 
126  protected:
127  std::map<GUID, FormatInfo::Ptr> mTitleFormatPool; //Header in GUI.
128  std::map<GUID, FormatInfo::Ptr> mHeaderFormatPool; //Value in GUI.
129  std::map<GUID, FormatInfo::Ptr> mMetricDataFormatPool; //For each metric.
130  std::map<GUID, FormatInfo::Ptr> mCornerFormatPool; //Corner Case
131  };
132 
134  {
135  public:
136  SubTotalFormatting(GUID& iGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
138  //virtual void Resolve(FormatInfo::Ptr& ipUpperLayerFormat);
139 
140  std::map<GUID, FormatInfo::Ptr>* GetSubtotalHeader(GUID& irID);
141  std::map<GUID, FormatInfo::Ptr>* GetSubtotalTitle();
142 
145  protected:
146  virtual bool hPrepareAndContinue(const std::vector<DSSFormat*>& irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr);
147  virtual FormatInfo::Ptr hUpdateOneFormat(GUID& irID, Int32 iColIndex, FormatInfo::Ptr ipInfo);
148  virtual bool hIsApplicalbel();
149  void hMapToMetricID();
150  virtual void hGetFormatKey(const std::vector<DSSFormat*>& irFomatSet, FormatInfo::Ptr iUpperLayerInfoPtr, std::string& orResultKey);
151  virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr);
152  virtual void hGetFormats(GUID& irID, Int32 iCellType, std::vector<DSSFormat*>& orFormat);
153 
154 
155  protected:
156  std::map<GUID, FormatInfo::Ptr> mSubtotalTitleFormatPool; //Header in GUI.
157  std::map<GUID, std::map<GUID, FormatInfo::Ptr> > mSubtotalHeaderFormatPoolVec;
158 
159  private:
160  bool mShouldChangeNumberFormat;
161  bool mShouldChangeNumberCategory;
162  };
163 
165  //BandingFormatting by:Jeremiah
167  typedef enum
168  {
172  BG_G1_HD, //First group but in header,
173  BG_G2_HD //2nd group but in header
174  }BANDING_GROUP;
175 
176 
177  typedef struct _BandingPropertySet
178  {
179  bool _enabled;
181  bool _byRows;
187  string _rowHeader;
188  string _colHeader;
192 
193  static CComVariant gBandingBgColor1Variant;
194  static CComVariant gBandingBgColor2Variant;
195  static CComVariant gThemeBandingBgColor1Variant;
196  static CComVariant gThemeBandingBgColor2Variant;
197  static CComVariant gThemeBandingBgColor3Variant;
198  static CComVariant gThemeBandingBgColor4Variant;
199 
200 
202  {
203  private:
204  BandingPropertySet mBandingProperties;
205 
206  public:
207  BandingFormatting(GUID& iGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
209  virtual void Resolve(FormatInfo::Ptr& ipUpperLayerFormat);
210 
211  protected:
212  bool hParseBandingStr(CComVariant * ipBandingStrVariant);
213  Int32 hParseIntAt(string iSource, const char* iTag1, const char* iTag2);
214  string hParseStrAt(string iSource, const char* iTag1, const char* iTag2);
215  void hLoadGUID();
217  void hPopulateTheme();
218  };
221  {
222  public:
223  CustomGroupFormatting(GUID& iGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
225  //virtual FormatInfo::Ptr Resolve(FormatInfo::Ptr ipUpperLayerFormat);
226  static DSSFormat* hGetCustomGroupElementID(DSSBaseElementProxy * ipBaseElementProxy, bool iIsHeader);
227  protected:
228  FormatInfo::Ptr hFindinPool(const std::string iElementID, DSSFormat* ipFormat, bool iIsHeader);
229  private:
230  std::map<std::string, FormatInfo::Ptr> mCustomGroupElementPool;
231  std::map<std::string, FormatInfo::Ptr> mCustomGroupMetricPool;
232  };
233 
235  //ThresholdFormatting by:Roy
237 
239  {
240  public:
241  ThresholdFormatting(GUID& irGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
243  std::map<GUID, FormatInfo::Ptr>* GetDataFormat();
244 
245  protected:
246  virtual void hUpdateOneFormat(DSSFormat* ipFormat, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer);
247  FormatInfo::Ptr hUpdateOneFormat(GUID& irID, Int32 iCellType, FormatInfo::Ptr ipInfo);
248  virtual bool hIsApplicalbel();
249  virtual void hGetFormats(GUID& irID, Int32 iCellType, std::vector<DSSFormat*>& orFormat);
250 
251  protected:
252  std::map<GUID, FormatInfo::Ptr> mThresholdPool;
253  std::map<std::pair<Int32, Int32>, DSSThreshold*> mPositionToThreasholdMap;
254  private:
255  bool hGetThresholdPoolInfo(int iMetricIndex, DSSThresholds* &opThresholds);
256  };
257 
259  {
260  public:
261  ConsolidationFormatting(GUID& irGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
263  virtual void Resolve(FormatInfo::Ptr& ipUpperLayerFormat);
264  protected:
265  FormatInfo::Ptr hUpdateOneFormat(GUID& irID, Int32 iCellType, FormatInfo::Ptr ipInfo);
266  virtual bool hIsApplicalbel();
267 
268  void hGetFormatSetFromElements(const std::vector<DSSConsolidationElement*>& irElements, FORMAT_CATEGORY iType, std::vector<DSSFormat*>& iorFormatSet);
269 
270  void hGetFormatKey(const std::vector<DSSFormat*>& irFomatSet, std::string& orResultKey);
271 
272  private:
273 
274  std::map<std::string, FormatInfo::Ptr> mLocalResolvedPool;
275  std::map<GUID, FormatInfo::Ptr> mTitleFormatPool;
276  std::map<GUID, FormatInfo::Ptr> mGridFormatPool;
277  };
278 
280  //Derived Element
283  {
284  public:
285  DerivedElementFormatting(GUID& irGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
286  };
287 
288 
290  //Composite Layer. for CG and Consolidation, stone.
293  {//this class would work as a decorator
294  public:
295  CGAndConsolidationFormatting(GUID& irGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
297  virtual void Resolve(FormatInfo::Ptr& ipUpperLayerFormat);
298  protected:
299  FormatInfo::Ptr hUpdateOneFormat(const std::vector<FormatInfo::Ptr>& irFormatInfoSet, FormatInfo::Ptr ipInfo);
300  void hGetFormatSetFromElements(std::vector<std::pair<DSSConsolidationElement*, Int32> >* ipConsolidationElementSet,
301  std::vector<std::pair<DSSBaseElementProxy*, Int32> >* ipCGElementSet, std::vector<DSSFormat*>& iorFormatSet);
302  private:
303  BaseFormatting* mpCGFormatting;
304  BaseFormatting* mpConsolidationFormatting;
305  CustomGroupUnitInfo* mpCGInfo;
306  bool mHasCG;
307  bool mHasConsolidation;
308  bool mHasConsolidationOnRow;
309  bool mHasConsolidationOnCol;
310  std::map <DSSFormat*, FormatInfo::Ptr> mFormatPool;
311  };
312 
314  //Cell Layer. This is the very bottom layer with lowest priority, stone.
317  {
318  public:
319  CellLevelFormatting(GUID& irGUID, FORMAT_CATEGORY iCellType, FormatManager* ipManager);
321  virtual void Resolve(FormatInfo::Ptr& ipUpperLayerFormat);
322 
323  protected:
324  bool hIsApplicalbel();
325  std::map<GUID, FormatInfo::Ptr>* GetPool();
326 
327  void hGetFormats(GUID& irID, Int32 iCellType, std::vector<DSSFormat*>& orFormat);
328  void hGetCellFormatKey(FormatInfo::Ptr iUpperLayerInfoPtr, std::string& orResultKey);
329 
330  private:
331  double hGetScaleFactor(FormatInfo::Ptr ipInfo, bool& orHasScaleFactor);
332 
333  std::string hToDecimalWString(Int32 iValue) const;
334 
335  std::map <GUID, FormatInfo::Ptr> mFormatPool;
336 
337  void* mpGridCell;
338 
339  CComVariant mScaleFactor;
340  CComVariant mNumberCategory;
341  CComVariant mNumberFormatting;
342  };
343 
344 
345 
346 }
347 #endif
virtual void hUpdateOneFormat(DSSFormat *ipFormat, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer)
virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr)
Definition: GridFormatting.h:170
std::map< std::pair< Int32, Int32 >, DSSThreshold * > mPositionToThreasholdMap
Definition: GridFormatting.h:253
Definition: GridFormatting.h:173
Definition: GridFormatting.h:316
Definition: GridFormatting.h:282
virtual bool hPrepareAndContinue(const std::vector< DSSFormat *> &irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr)
std::map< GUID, FormatInfo::Ptr > * GetSubtotalTitle()
FORMAT_LAYER_INDEX
Definition: FormatManagerHelper.h:28
Definition: GridFormatting.h:29
BandingFormatting(GUID &iGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
Definition: GridFormatting.h:172
bool hParseBandingStr(CComVariant *ipBandingStrVariant)
CellLevelFormatting(GUID &irGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
Definition: DSSBaseElementProxy.h:16
void hGetFormatSetFromElements(const std::vector< DSSConsolidationElement *> &irElements, FORMAT_CATEGORY iType, std::vector< DSSFormat *> &iorFormatSet)
void hGetFormatKey(const std::vector< DSSFormat *> &irFomatSet, std::string &orResultKey)
virtual std::map< GUID, FormatInfo::Ptr > * GetCornerFormat()
FormatInfo::Ptr hUpdateOneFormat(GUID &irID, Int32 iCellType, FormatInfo::Ptr ipInfo)
Definition: DSSAxis.h:18
Definition: GridFormatting.h:169
FORMAT_LAYER_INDEX mLayerIndex
Definition: GridFormatting.h:102
CustomGroupFormatting(GUID &iGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
static DSSFormat * hGetCustomGroupElementID(DSSBaseElementProxy *ipBaseElementProxy, bool iIsHeader)
std::map< GUID, FormatInfo::Ptr > mHeaderFormatPool
Definition: GridFormatting.h:128
ConsolidationFormatting(GUID &irGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
bool _byHeaders
Definition: GridFormatting.h:184
Definition: DSSTemplateUnit.h:19
Definition: DSSThresholds.h:15
void Update(GUID &irID, Int32 iCellType)
static CComVariant gCountSubTotalNumberFormat
Definition: GridFormatting.h:144
std::map< GUID, FormatInfo::Ptr > mSubtotalTitleFormatPool
Definition: GridFormatting.h:156
virtual void hGetFormatKey(const std::vector< DSSFormat *> &irFomatSet, FormatInfo::Ptr iUpperLayerInfoPtr, std::string &orResultKey)
Definition: DSSThreshold.h:17
Definition: DatasetHelper.h:573
DerivedElementFormatting(GUID &irGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
Definition: DSSTemplate.h:29
std::map< GUID, FormatInfo::Ptr > * GetPool()
void hGetFormats(GUID &irID, Int32 iCellType, std::vector< DSSFormat *> &orFormat)
string hParseStrAt(string iSource, const char *iTag1, const char *iTag2)
Definition: GridFormatting.h:258
SubTotalFormatting(GUID &iGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
std::map< GUID, FormatInfo::Ptr > mMetricDataFormatPool
Definition: GridFormatting.h:129
bool _useDefaultColor2
Definition: GridFormatting.h:190
struct MsiChart::_BandingPropertySet BandingPropertySet
Definition: GridFormatting.h:133
virtual bool hPrepareAndContinue(const std::vector< DSSFormat *> &irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr)
std::map< GUID, FormatInfo::Ptr > * GetSubtotalHeader(GUID &irID)
Definition: GridFormatting.h:177
DSSFormat * hGetFormatFromType(DSSTemplateUnit *ipUnit, Int32 iFormatterType)
std::map< GUID, FormatInfo::Ptr > * GetDataFormat()
virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr)
Int32 _color2
Definition: GridFormatting.h:183
virtual FormatInfo::Ptr hUpdateOneFormat(GUID &irID, Int32 iCellType, FormatInfo::Ptr ipInfo)
GUID mGUID
Definition: GridFormatting.h:99
virtual bool hIsApplicalbel()
std::map< GUID, FormatInfo::Ptr > mTitleFormatPool
Definition: GridFormatting.h:127
virtual void hGetFormats(GUID &irID, Int32 iCellType, std::vector< DSSFormat *> &orFormat)
Int32 hParseIntAt(string iSource, const char *iTag1, const char *iTag2)
FormatInfo::Ptr hUpdateOneFormat(const std::vector< FormatInfo::Ptr > &irFormatInfoSet, FormatInfo::Ptr ipInfo)
#define Int32
Definition: BasicTypes.h:20
void hGetCellFormatKey(FormatInfo::Ptr iUpperLayerInfoPtr, std::string &orResultKey)
Definition: GridFormatting.h:220
std::map< GUID, FormatInfo::Ptr > * GetCornerFormat()
TemplateFormatting(GUID &iGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
BANDING_GROUP
Definition: GridFormatting.h:167
void hGetFormatIndexAsText(DSSFormat *ipFormat, std::string &orKey)
virtual void Resolve(FormatInfo::Ptr &ipUpperLayerFormat)
bool _useDefaultColor1
Definition: GridFormatting.h:189
static void MergeFormatToFormatInfo(DSSFormat *ipFormat, FormatInfo::Ptr iInfoPtr, bool iIsAtDefaultLayer)
std::map< GUID, FormatInfo::Ptr > * GetDataFormat()
CComVariant * hGetBandingResult()
virtual std::map< GUID, FormatInfo::Ptr > * GetSubtotalTitle()
virtual bool hPrepareAndContinue(const std::vector< DSSFormat *> &irCurrentLayerFormats, FormatInfo::Ptr iUpperLayerInfoPtr)
bool _byRows
Definition: GridFormatting.h:181
virtual void hGetFormats(GUID &irID, Int32 iCellType, std::vector< DSSFormat *> &orFormat)
virtual void Resolve(FormatInfo::Ptr &iopUpperLayerFormat)
virtual std::map< GUID, FormatInfo::Ptr > * GetDataFormat()
Int32 _group2
Definition: GridFormatting.h:186
Definition: DSSMetric.h:17
Definition: ABLPlot.h:21
virtual void Resolve(FormatInfo::Ptr &ipUpperLayerFormat)
virtual void hGetFormats(GUID &irID, Int32 iCellType, std::vector< DSSFormat *> &orFormat)
virtual void hGetFormats(GUID &irID, Int32 iCellType, std::vector< DSSFormat *> &orFormat)
FormatManager * mpManager
Definition: GridFormatting.h:101
virtual FormatInfo::Ptr hUpdateOneFormat(GUID &irID, Int32 iCellType, FormatInfo::Ptr ipInfo)
Definition: DSSTemplateMetric.h:20
bool _enabled
Definition: GridFormatting.h:179
Int32 _color1
Definition: GridFormatting.h:182
bool mIsUseResolved
Definition: GridFormatting.h:104
std::map< GUID, std::map< GUID, FormatInfo::Ptr > > mSubtotalHeaderFormatPoolVec
Definition: GridFormatting.h:157
virtual std::map< GUID, FormatInfo::Ptr > * GetHeader()
void hGetFormatSetFromElements(std::vector< std::pair< DSSConsolidationElement *, Int32 > > *ipConsolidationElementSet, std::vector< std::pair< DSSBaseElementProxy *, Int32 > > *ipCGElementSet, std::vector< DSSFormat *> &iorFormatSet)
std::map< GUID, FormatInfo::Ptr > mCornerFormatPool
Definition: GridFormatting.h:130
Definition: Msi_ccomvariant.h:24
Definition: GridFormatting.h:171
bool _includeHeaders
Definition: GridFormatting.h:180
static CComVariant gCountSubTotalNumberCategory
Definition: GridFormatting.h:143
CGAndConsolidationFormatting(GUID &irGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
virtual void Resolve(FormatInfo::Ptr &ipUpperLayerFormat)
FORMAT_CATEGORY mCellFormatCategory
Definition: GridFormatting.h:100
ThresholdFormatting(GUID &irGUID, FORMAT_CATEGORY iCellType, FormatManager *ipManager)
Int32 _group1
Definition: GridFormatting.h:185
string _rowHeader
Definition: GridFormatting.h:187
Definition: GridFormatting.h:201
Definition: GridFormatting.h:238
virtual void Resolve(FormatInfo::Ptr &ipUpperLayerFormat)
virtual std::map< GUID, FormatInfo::Ptr > * GetTitle()
FormatInfo::Ptr hFindinPool(const std::string iElementID, DSSFormat *ipFormat, bool iIsHeader)
string _colHeader
Definition: GridFormatting.h:188
std::map< GUID, FormatInfo::Ptr > mThresholdPool
Definition: GridFormatting.h:252
std::map< GUID, FormatInfo::Ptr > * GetHeader()
virtual void hGetFormatKey(const std::vector< DSSFormat *> &irFomatSet, FormatInfo::Ptr iUpperLayerInfoPtr, std::string &orResultKey)
Definition: GridFormatting.h:108
virtual std::map< GUID, FormatInfo::Ptr > * GetSubtotalHeader(GUID &irID)
virtual std::map< GUID, FormatInfo::Ptr > * GetPool()
Definition: Base/Base/GUID.h:32
virtual FormatInfo::Ptr hUpdateOneFormat(GUID &irID, Int32 iColIndex, FormatInfo::Ptr ipInfo)
std::map< GUID, FormatInfo::Ptr > * GetTitle()
virtual void hSpecialProperty(FormatInfo::Ptr iInfoPtr)
Definition: FormatInfo.h:60
std::map< std::string, FormatInfo::Ptr > mResolvedPool
Definition: GridFormatting.h:105
Definition: DSSFormat.h:35
Definition: GridFormatting.h:292
Definition: FormatManager.h:157
FORMAT_CATEGORY
Definition: FormatManagerHelper.h:9