Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PD_STYLE_H
00024 #define PD_STYLE_H
00025
00026 #include <memory>
00027
00028 #include "ut_types.h"
00029 #include "ut_vector.h"
00030 #include "pt_Types.h"
00031 #include "ut_xml.h"
00032 #include "pp_Property.h"
00033
00034 class pt_PieceTable;
00035
00037
00038
00039 class ABI_EXPORT PD_Style
00040 {
00041 public:
00042 PD_Style(pt_PieceTable * pPT, PT_AttrPropIndex indexAP, const char * szName = NULL, bool bDisplayed = true);
00043 virtual ~PD_Style();
00044
00045 inline PT_AttrPropIndex getIndexAP(void) const { return m_indexAP; };
00046 bool setIndexAP(PT_AttrPropIndex indexAP);
00047
00048 bool getProperty(const gchar * szName, const gchar *& szValue) const;
00049 std::unique_ptr<PP_PropertyType> getPropertyType(const gchar * szName, tProperty_type Type) const;
00050 bool getAttribute(const gchar * szName, const gchar *& szValue) const;
00051 bool getPropertyExpand(const gchar * szName, const gchar *& szValue) const;
00052 bool getAttributeExpand(const gchar * szName, const gchar *& szValue) const;
00053
00054 PD_Style * getBasedOn(void) const;
00055 PD_Style * getFollowedBy(void) const;
00056
00057 virtual bool isUserDefined(void) const { return true; };
00058 void used(UT_sint32 count);
00059 bool isUsed(void) const;
00060 bool isCharStyle(void) const;
00061 bool isList(void) const;
00062 bool isDisplayed(void) const { return m_bDisplayed; }
00063
00064 bool addProperty(const gchar * szName, const gchar * szValue);
00065 bool addProperties(const PP_PropertyVector & pProperties);
00066 bool setAllAttributes(const PP_PropertyVector & atts);
00067 bool addAttributes(const PP_PropertyVector & pAtts);
00068 bool getAllProperties( UT_Vector * vProps, UT_sint32 depth) const;
00069 bool getAllAttributes( UT_Vector * vAttribs, UT_sint32 depth) const;
00070 size_t getPropertyCount(void) const;
00071 size_t getAttributeCount(void) const;
00072 bool getNthProperty (int ndx, const gchar *&szName,
00073 const gchar *&szValue) const;
00074 bool getNthAttribute (int ndx, const gchar *&szName,
00075 const gchar *&szValue) const;
00076
00077 inline const char * getName (void) const {return m_szName;}
00078
00079 protected:
00080 bool _getPropertyExpand(const gchar * szName, const gchar *& szValue, UT_sint32 iDepth) const;
00081 bool _getAttributeExpand(const gchar * szName, const gchar *& szValue, UT_sint32 iDepth) const;
00082
00083 pt_PieceTable * m_pPT;
00084 PT_AttrPropIndex m_indexAP;
00085
00086 char * m_szName;
00087 bool m_bDisplayed;
00088 UT_sint32 m_iUsed;
00089
00090
00091
00092 mutable PD_Style * m_pBasedOn;
00093 mutable PD_Style * m_pFollowedBy;
00094 };
00095
00096
00098
00099
00100 class ABI_EXPORT PD_BuiltinStyle : public PD_Style
00101 {
00102 public:
00103 PD_BuiltinStyle(pt_PieceTable * pPT, PT_AttrPropIndex indexAP, const char * szName, bool bDisplayed);
00104 virtual ~PD_BuiltinStyle();
00105
00106 virtual bool isUserDefined(void) const { return (m_indexAP != m_indexAPOrig); };
00107
00108 protected:
00109 PT_AttrPropIndex m_indexAPOrig;
00110 };
00111
00112 #endif