#ifndef DOC_TEMPLATE_H
#define DOC_TEMPLATE_H
#include <vector>
#include <string>
#include "DocOutput.h"
#include "Utilities.h"
enum DocItemType
{
DIT_Defaults,
DIT_Background,
DIT_Label,
DIT_Image,
DIT_Line,
DIT_Box,
DIT_Circle,
DIT_Ellipse,
DIT_Polygon,
DIT_Spline,
DIT_Shape,
DIT_Unknown
};
enum PenStyle
{
PS_Solid,
PS_Dashed
};
enum Align
{
AL_Left = 0x01,
AL_HCenter = 0x02,
AL_Right = 0x04,
AL_Top = 0x08,
AL_VCenter = 0x10,
AL_Bottom = 0x20
};
struct Point
{
float x, y;
};
struct DocTemplateItem
{
DocItemType m_type;
unsigned int m_bgColor; // flat color only at the moment
Point m_pos;
Point m_size;
std::string m_font;
float m_fontSize;
unsigned int m_fontColor;
unsigned int m_fillColor;
unsigned int m_penColor;
float m_penWidth;
PenStyle m_penStyle;
Align m_alignment;
// really just need a union of these 3 below, but can't do that easily so just use up a bit of extra space here
std::string m_text;
std::vector<Point> m_shape;
std::string m_imageFile;
};
class DocTemplate
{
public:
DocTemplate();
~DocTemplate();
void ReadTemplateFile(const char* a_fileName);
void WriteTemplateFile(const char* a_fileName);
void Apply(DocOutputPage& page);
static void LogMessage(yqLogLevel a_level, const char* a_msg, ...);
private:
DocTemplateItem m_defaults;
std::vector<DocTemplateItem> m_items;
static std::string m_currentFile;
static unsigned int m_currentLine;
};
#endif // DOC_TEMPLATE_H