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

ap_Dialog_Styles.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  * Copyright (C) 2009 Hubert Figuiere
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018  * 02111-1307, USA.
00019  */
00020 
00021 #ifndef AP_Dialog_Styles_H
00022 #define AP_Dialog_Styles_H
00023 
00024 #include <string>
00025 #include <map>
00026 
00027 #include "xap_Frame.h"
00028 #include "xap_Dialog.h"
00029 #include "fv_View.h"
00030 #include "xap_Dlg_FontChooser.h"
00031 #include "ut_string_class.h"
00032 #include "ap_Preview_Abi.h"
00033 class XAP_Frame;
00034 
00035 #include "xap_Preview.h"
00036 #include "ap_Preview_Paragraph.h"
00037 
00038 class ABI_EXPORT AP_Dialog_Styles : public XAP_Dialog_NonPersistent
00039 {
00040  public:
00041     typedef std::map<std::string,std::string> PropMap;
00042 
00043     AP_Dialog_Styles(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00044     virtual ~AP_Dialog_Styles(void);
00045 
00046     virtual void              runModal(XAP_Frame * pFrame) = 0;
00047 
00048     typedef enum { a_OK, a_CANCEL }   tAnswer;
00049     AP_Dialog_Styles::tAnswer     getAnswer(void) const;
00050 
00051     // wish that this could be protected
00052     void _tabCallback(const char *, const char *);
00053 
00054  protected:
00055     void event_paraPreviewUpdated (const gchar * pageLeftMargin,
00056                        const gchar * pageRightMargin,
00057                        const gchar * align,
00058                        const gchar * firstLineIndent,
00059                        const gchar * leftIndent,
00060                        const gchar * rightIndent,
00061                        const gchar * beforeSpacing,
00062                        const gchar * afterSpacing,
00063                        const gchar * lineSpacing) const;
00064     virtual void event_charPreviewUpdated (void) const;
00065 
00066     virtual const char * getCurrentStyle (void) const = 0;
00067     virtual void setDescription (const char * desc) const = 0;
00068     virtual void setModifyDescription (const char * desc) = 0;
00069     virtual void _populatePreviews(bool isModify);
00070     FV_View * getLView(void) const;
00071     PD_Document * getLDoc(void) const;
00072     void drawLocal(void);
00073     void destroyAbiPreview(void);
00074     void removeVecProp(const gchar * pszProp);
00075     void addOrReplaceVecProp(const gchar * pszProp,  const gchar * pszVal);
00076     void addOrReplaceVecAttribs(const gchar * pszProp,  const gchar * pszVal);
00077     void fillVecWithProps(const gchar * szStyle, bool bReplaceAttributes);
00078     void fillVecFromCurrentPoint(void);
00079     const gchar * getAttsVal(const gchar * szProp) const;
00080     const std::string getPropsVal(const gchar * szProp) const;
00081     const gchar * getVecVal(const UT_Vector * v, const gchar * szProp) const;
00082     void ModifyLists(void);
00083     void ModifyFont(void);
00084     void ModifyParagraph(void);
00085     void ModifyTabs(void);
00086     void ModifyLang(void);
00087 
00088     void updateCurrentStyle(void);
00089     bool createNewStyle(const gchar * szName);
00090     bool applyModifiedStyleToDoc(void);
00091     void setDoc(PD_Document * pDoc);
00092     void setFrame(XAP_Frame * pFrame);
00093     void setView(FV_View * pView);
00094     FV_View * getView(void) const;
00095     PD_Document * getDoc(void) const;
00096     XAP_Frame * getFrame(void) const;
00097 
00098 protected:
00099 
00100     void                  _createParaPreviewFromGC(GR_Graphics * gc,  UT_uint32 width,  UT_uint32 height);
00101 
00102     void                  _createCharPreviewFromGC(GR_Graphics * gc,  UT_uint32 width, UT_uint32 height);
00103     void                  _createAbiPreviewFromGC(GR_Graphics * gc,  UT_uint32 width, UT_uint32 height);
00104     void                  _populateAbiPreview(bool isNew);
00105     AP_Dialog_Styles::tAnswer     m_answer;
00106     PD_Style *                    m_pCurStyle;
00107     char *                        m_pszCurStyleName;
00108     UT_String                     m_curStyleDesc;
00109     AP_Preview_Paragraph  *       m_pParaPreview;
00110     XAP_Preview_FontPreview *     m_pCharPreview;
00111     AP_Preview_Abi *              m_pAbiPreview;
00112     UT_GenericVector<const gchar*> m_vecAllProps;
00113     UT_GenericVector<const gchar*> m_vecAllAttribs;
00114 
00115 private:
00116     XAP_Frame *                   m_pFrame;
00117     FV_View *                     m_pView;
00118     PD_Document *                 m_pDoc;
00119     PT_DocPosition                m_posBefore;
00120     PT_DocPosition                m_posFocus;
00121     PT_DocPosition                m_posAfter;
00122     PropMap                       m_mapCharProps;
00123     UT_String                     m_ListProps[8];
00124 };
00125 
00126 #endif /* AP_Dialog_Styles_H */
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1