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

ap_Dialog_Stylist.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2003 Dom Lachowicz
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 #ifndef AP_DIALOG_STYLIST_H
00021 #define AP_DIALOG_STYLIST_H
00022 
00023 #include "ut_types.h"
00024 #include "xap_Frame.h"
00025 #include "xap_Dialog.h"
00026 #include "xav_View.h"
00027 #include "ut_vector.h"
00028 #include "ut_string_class.h"
00029 
00030 class UT_Timer;
00031 class XAP_Frame;
00032 class PD_Document;
00033 class PD_Style;
00034 
00035 class ABI_EXPORT Stylist_row
00036 {
00037 public:
00038     Stylist_row(void);
00039     virtual ~Stylist_row(void);
00040     void       addStyle(const std::string & sStyle);
00041     void       setRowName(const std::string & sRowname);
00042     void       getRowName(std::string & sRowname) const;
00043     UT_sint32  getNumCols(void) const;
00044     bool       findStyle(UT_UTF8String & sStyleName, UT_sint32 & col);
00045     bool       getStyle(UT_UTF8String & sStyleName, UT_sint32 col);
00046 private:
00047     UT_GenericVector<UT_UTF8String *> m_vecStyles;
00048     std::string  m_sRowName;
00049 };
00050 
00051 class ABI_EXPORT Stylist_tree
00052 {
00053 public:
00054     Stylist_tree(PD_Document * pDoc);
00055     virtual ~Stylist_tree(void);
00056     bool             findStyle(UT_UTF8String & sStyleName,UT_sint32 & row, UT_sint32 & col);
00057     bool             getStyleAtRowCol(UT_UTF8String & sStyle, UT_sint32 row, UT_sint32 col);
00058     UT_sint32        getNumRows(void) const;
00059     UT_sint32        getNumCols(UT_sint32 row) const;
00060     void             buildStyles(PD_Document * pDoc);
00061     UT_sint32        getNumStyles(void) const;
00062     bool             getNameOfRow(std::string &sName, UT_sint32 row) const;
00063     bool             isHeading(const PD_Style * pStyle, UT_sint32 iDepth=10) const;
00064     bool             isList(const PD_Style * pStyle, UT_sint32 iDepth=10) const;
00065     bool             isFootnote(const PD_Style * pStyle,UT_sint32 iDepth=10) const;
00066     bool             isUser(const PD_Style *pStyle) const;
00067 private:
00068     UT_GenericVector<const PD_Style *>    m_vecAllStyles;
00069     UT_GenericVector<Stylist_row *> m_vecStyleRows;
00070 };
00071 
00072 
00073 class ABI_EXPORT AP_Dialog_Stylist : public XAP_Dialog_Modeless
00074 {
00075 public:
00076     AP_Dialog_Stylist(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00077     virtual ~AP_Dialog_Stylist(void);
00078 
00079     virtual void runModeless(XAP_Frame * pFrame) = 0;
00080     virtual void runModal(XAP_Frame * pFrame) = 0;
00081 
00082     bool              isStyleValid(void)
00083         { return  m_bStyleValid;}
00084     void              startUpdater(void);
00085     void              stopUpdater(void);
00086     // I am gonna be nice and make this an empty implementation instead of pure virtual
00087     virtual void      setSensitivity(bool /*bSens*/) {};
00088     void              setActiveFrame(XAP_Frame *pFrame);
00089     void              event_update(void);
00090     void              finalize(void);
00091     Stylist_tree *  getStyleTree(void) const
00092         { return m_pStyleTree;}
00093     const UT_UTF8String *   getCurStyle(void) const
00094         { return &m_sCurStyle;}
00095     UT_UTF8String     getSelectedStyle(void) const
00096         { return m_sCurStyle;}
00097     void              setCurStyle(UT_UTF8String & sStyle)
00098         { m_sCurStyle = sStyle;}
00099     void              Apply(void);
00100     virtual void      setStyleInGUI(void) = 0;
00101     static void       autoUpdate(UT_Worker * pTimer);
00102     void              updateDialog(void);
00103     bool              isStyleChanged(void) const
00104         { return m_bStyleChanged;}
00105     bool              isStyleTreeChanged(void) const
00106         { return m_bStyleTreeChanged;}
00107     UT_sint32         getNumStyles(void) const;
00108     void              setStyleTreeChanged(bool b)
00109         { m_bStyleTreeChanged = b;}
00110     void              setStyleChanged(bool b)
00111         { m_bStyleChanged = b;}
00112     void              setStyleValid(bool bValid)
00113         { m_bStyleValid = bValid;}
00114 protected:
00115     // call to ensure the dialog is enabled/disabled on overall
00116     void setAllSensitivities();
00117     bool                  m_bIsModal;
00118 private:
00119     PD_Document *         m_pDoc;
00120     UT_Timer *            m_pAutoUpdater;
00121     UT_uint32             m_iTick;
00122     UT_UTF8String         m_sCurStyle;
00123     Stylist_tree *        m_pStyleTree;
00124     bool                  m_bStyleTreeChanged;
00125     bool                  m_bStyleChanged;
00126     bool                  m_bStyleValid;
00127 };
00128 
00129 #endif /* AP_DIALOG_STYLIST_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1