• 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., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
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 // PD_Style is the representation for an individual style.
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     // lazily-bound attribute caches to speed lookups
00091     // hence their mutability
00092     mutable PD_Style *          m_pBasedOn;
00093     mutable PD_Style *          m_pFollowedBy;
00094 };
00095 
00096 
00098 // PD_BuiltinStyle
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;  // the builtin one
00110 };
00111 
00112 #endif /* PD_STYLE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1