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

ap_Dialog_Styles.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4;  indent-tabs-mode: t -*- */
00002 /* AbiWord
00003  * Copyright (C) 1998 AbiSource, Inc.
00004  * Copyright (C) 2009 Hubert Figuiere
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 #ifndef AP_Dialog_Styles_H
00023 #define AP_Dialog_Styles_H
00024 
00025 #include <string>
00026 #include <map>
00027 
00028 #include "xap_Frame.h"
00029 #include "xap_Dialog.h"
00030 #include "fv_View.h"
00031 #include "xap_Dlg_FontChooser.h"
00032 #include "ap_Preview_Abi.h"
00033 
00034 class XAP_Frame;
00035 
00036 #include "xap_Preview.h"
00037 #include "ap_Preview_Paragraph.h"
00038 
00039 class ABI_EXPORT AP_Dialog_Styles : public XAP_Dialog_NonPersistent
00040 {
00041  public:
00042     typedef std::map<std::string,std::string> PropMap;
00043 
00044     AP_Dialog_Styles(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00045     virtual ~AP_Dialog_Styles(void);
00046 
00047     virtual void              runModal(XAP_Frame * pFrame) = 0;
00048 
00049     typedef enum { a_OK, a_CANCEL }   tAnswer;
00050     AP_Dialog_Styles::tAnswer     getAnswer(void) const;
00051 
00052     // wish that this could be protected
00053     void _tabCallback(const char *, const char *);
00054 
00055  protected:
00056     void event_paraPreviewUpdated (const gchar * pageLeftMargin,
00057                        const gchar * pageRightMargin,
00058                        const gchar * align,
00059                        const gchar * firstLineIndent,
00060                        const gchar * leftIndent,
00061                        const gchar * rightIndent,
00062                        const gchar * beforeSpacing,
00063                        const gchar * afterSpacing,
00064                        const gchar * lineSpacing) const;
00065     virtual void event_charPreviewUpdated (void) const;
00066 
00067     virtual const char * getCurrentStyle (void) const = 0;
00068     virtual void setDescription (const char * desc) const = 0;
00069     virtual void setModifyDescription (const char * desc) = 0;
00070     virtual void _populatePreviews(bool isModify);
00071     FV_View * getLView(void) const;
00072     PD_Document * getLDoc(void) const;
00073     void drawLocal(void);
00074     void destroyAbiPreview(void);
00075     void fillVecWithProps(const gchar * szStyle, bool bReplaceAttributes);
00076     void fillVecFromCurrentPoint(void);
00077     const gchar * getVecVal(const UT_Vector * v, const gchar * szProp) const;
00078     void ModifyLists(void);
00079     void ModifyFont(void);
00080     void ModifyParagraph(void);
00081     void ModifyTabs(void);
00082     void ModifyLang(void);
00083 
00084     void updateCurrentStyle(void);
00085     bool createNewStyle(const gchar * szName);
00086     bool applyModifiedStyleToDoc(void);
00087     void setDoc(PD_Document * pDoc);
00088     void setFrame(XAP_Frame * pFrame);
00089     void setView(FV_View * pView);
00090     FV_View * getView(void) const;
00091     PD_Document * getDoc(void) const;
00092     XAP_Frame * getFrame(void) const;
00093 
00094 protected:
00095 
00096     void                  _createParaPreviewFromGC(GR_Graphics * gc,  UT_uint32 width,  UT_uint32 height);
00097 
00098     void                  _createCharPreviewFromGC(GR_Graphics * gc,  UT_uint32 width, UT_uint32 height);
00099     void                  _createAbiPreviewFromGC(GR_Graphics * gc,  UT_uint32 width, UT_uint32 height);
00100     void                  _populateAbiPreview(bool isNew);
00101     AP_Dialog_Styles::tAnswer     m_answer;
00102     PD_Style *                    m_pCurStyle;
00103     char *                        m_pszCurStyleName;
00104     std::string                       m_curStyleDesc;
00105     AP_Preview_Paragraph  *       m_pParaPreview;
00106     XAP_Preview_FontPreview *     m_pCharPreview;
00107     AP_Preview_Abi *              m_pAbiPreview;
00108     PP_PropertyVector             m_vecAllProps;
00109     PP_PropertyVector             m_vecAllAttribs;
00110 
00111 private:
00112     XAP_Frame *                   m_pFrame;
00113     FV_View *                     m_pView;
00114     PD_Document *                 m_pDoc;
00115     PT_DocPosition                m_posBefore;
00116     PT_DocPosition                m_posFocus;
00117     PT_DocPosition                m_posAfter;
00118     PropMap                       m_mapCharProps;
00119     std::string                   m_ListProps[8];
00120 };
00121 
00122 #endif /* AP_Dialog_Styles_H */
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1