• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

pd_Style.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019  * 02111-1307, USA.
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 // PD_Style is the representation for an individual style.
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) const;
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) const;
00066     bool                    getAllAttributes( UT_Vector * vAttribs, UT_sint32 depth) const;
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) const;
00078     bool                    _getAttributeExpand(const gchar * szName, const gchar *& szValue, UT_sint32 iDepth) const;
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     // lazily-bound attribute caches to speed lookups
00088     // hence their mutability
00089     mutable PD_Style *          m_pBasedOn;
00090     mutable PD_Style *          m_pFollowedBy;
00091 };
00092 
00093 
00095 // PD_BuiltinStyle
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;  // the builtin one
00107 };
00108 
00109 #endif /* PD_STYLE_H */

Generated on Mon May 28 2012 for AbiWord by  doxygen 1.7.1