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 "ut_types.h"
00027 #include "pt_Types.h"
00028 #include "ut_xml.h"
00029 #include "pp_Property.h"
00030
00031 class pt_PieceTable;
00032
00034
00035
00036 class ABI_EXPORT PD_Style
00037 {
00038 public:
00039 PD_Style(pt_PieceTable * pPT, PT_AttrPropIndex indexAP, const char * szName = NULL, bool bDisplayed = true);
00040 virtual ~PD_Style();
00041
00042 inline PT_AttrPropIndex getIndexAP(void) const { return m_indexAP; };
00043 bool setIndexAP(PT_AttrPropIndex indexAP);
00044
00045 bool getProperty(const gchar * szName, const gchar *& szValue) const;
00046 const PP_PropertyType * getPropertyType(const gchar * szName, tProperty_type Type) const;
00047 bool getAttribute(const gchar * szName, const gchar *& szValue) const;
00048 bool getPropertyExpand(const gchar * szName, const gchar *& szValue) const;
00049 bool getAttributeExpand(const gchar * szName, const gchar *& szValue);
00050
00051 PD_Style * getBasedOn(void) const;
00052 PD_Style * getFollowedBy(void) const;
00053
00054 virtual bool isUserDefined(void) const { return true; };
00055 void used(UT_sint32 count);
00056 bool isUsed(void) const;
00057 bool isCharStyle(void) const;
00058 bool isList(void) const;
00059 bool isDisplayed(void) const { return m_bDisplayed; }
00060
00061 bool addProperty(const gchar * szName, const gchar * szValue);
00062 bool addProperties(const gchar ** pProperties);
00063 bool setAllAttributes(const gchar ** pAtts);
00064 bool addAttributes(const gchar ** pAtts);
00065 bool getAllProperties( UT_Vector * vProps, UT_sint32 depth);
00066 bool getAllAttributes( UT_Vector * vAttribs, UT_sint32 depth);
00067 size_t getPropertyCount(void) const;
00068 size_t getAttributeCount(void) const;
00069 bool getNthProperty (int ndx, const gchar *&szName,
00070 const gchar *&szValue) const;
00071 bool getNthAttribute (int ndx, const gchar *&szName,
00072 const gchar *&szValue) const;
00073
00074 inline const char * getName (void) const {return m_szName;}
00075
00076 protected:
00077 bool _getPropertyExpand(const gchar * szName, const gchar *& szValue, UT_sint32 iDepth);
00078 bool _getAttributeExpand(const gchar * szName, const gchar *& szValue, UT_sint32 iDepth);
00079
00080 pt_PieceTable * m_pPT;
00081 PT_AttrPropIndex m_indexAP;
00082
00083 char * m_szName;
00084 bool m_bDisplayed;
00085 UT_sint32 m_iUsed;
00086
00087
00088
00089 mutable PD_Style * m_pBasedOn;
00090 mutable PD_Style * m_pFollowedBy;
00091 };
00092
00093
00095
00096
00097 class ABI_EXPORT PD_BuiltinStyle : public PD_Style
00098 {
00099 public:
00100 PD_BuiltinStyle(pt_PieceTable * pPT, PT_AttrPropIndex indexAP, const char * szName, bool bDisplayed);
00101 virtual ~PD_BuiltinStyle();
00102
00103 virtual bool isUserDefined(void) const { return (m_indexAP != m_indexAPOrig); };
00104
00105 protected:
00106 PT_AttrPropIndex m_indexAPOrig;
00107 };
00108
00109 #endif