#ifndef DOC_STYLE_H
#define DOC_STYLE_H
#include <string>
#include "DocOutput.h"
enum TextRole
{
NormalRole,
StrongRole,
EmphasisRole,
StrongEmphasisRole,
ParagraphRole,
Heading5Role,
Heading4Role,
Heading3Role,
Heading2Role,
Heading1Role,
ListItemLevel1Role,
ListItemLevel2Role,
ListItemLevel3Role,
ListItemLevel4Role,
NumberedListItemLevel1Role,
NumberedListItemLevel2Role,
NumberedListItemLevel3Role,
NumberedListItemLevel4Role,
StrikethroughRole,
UnderlineRole,
QuoteRole,
BlockQuoteRole,
CodeRole,
LinkRole,
//EmailAddressRole,
//ImageRole,
//OtherRole,
Last = LinkRole
};
enum TextAlignment
{
TA_Left,
TA_Center,
TA_Right,
TA_Justified,
TA_Last = TA_Justified
};
enum BulletType
{
BT_None,
BT_Circle,
BT_Dot,
BT_Dash,
BT_Point,
BT_Number,
BT_NumberDot,
BT_NumberBracket,
BT_NumberSlash,
BT_Last = BT_NumberSlash
};
enum FontStyle
{
FS_Normal,
FS_Italics,
FS_Bold,
FS_BoldItalics,
FS_StrikeThrough,
FS_Underline,
FS_Light,
FS_LightItalics,
FS_Medium,
FS_MediumItalics,
FS_FixedWidth,
FS_Last = FS_FixedWidth
};
struct TextRoleProperties
{
// Display name of the role
std::string m_displayName;
std::string m_fontName;
FontStyle m_fontStyle;
float m_fontSize; // Font size relative to normal, so if in a heading and have italics, will work
int m_foregroundColorIndex;
int m_backgroundColorIndex;
float m_textIndent;
TextAlignment m_textAlignment;
float m_bulletIndent;
BulletType m_bulletType;
float m_lineSpacing;
float m_spacing;
// Legacy
// These are cached after looking up from the palette
float m_foregoundColor[4];
float m_backgoundColor[4];
};
class DocStyle
{
public:
DocStyle();
virtual ~DocStyle();
std::string name();
void setName(const std::string&);
void readStyleFile(const char* a_fileName);
void writeStyleFile(const char* a_fileName);
std::vector<std::string> paletteList(); // For populating the ui combo
std::string selectedPalette(); // For setting the ui on the selected one
uint32_t palette(const std::string& a_palette); // For display of the colors of the given palette
void selectPalette(const std::string& a_palette); // For changing which one is the selected one
void addPalette(const std::string& a_palette, uint32_t value); // For adding a new entry to the list
void editPalette(const std::string& a_palette, uint32_t value); // For changing the palette colors
void removePalette(const std::string& a_palette); // For removing a palette entry from the list
TextRoleProperties textProperties(TextRole a_role);
void setTextProperties(TextRole a_role, TextRoleProperties a_properties);
void font(TextRole a_role, std::string& a_fontName, float& a_fontSize);
void foregroundColor(TextRole a_role, float& a_red, float& a_green, float& a_blue, float& a_alpha);
void backgroundColor(TextRole a_role, float& a_red, float& a_green, float& a_blue, float& a_alpha);
void adornNewPage(DocOutputPage& page);
void adornOldPage(DocOutputPage& page);
private:
struct Pimpl;
std::unique_ptr<Pimpl> m_pimpl;
};
#endif // DOC_STYLE_H