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

ap_Dialog_FormatTable.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) 2003 Marc Maurer
00005  * Copyright (c) 2009-2016 Hubert Figuiere
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_FORMATTABLE_H
00023 #define AP_DIALOG_FORMATTABLE_H
00024 
00025 #include "ut_types.h"
00026 #include "ut_misc.h"
00027 #include "xap_Frame.h"
00028 #include "xap_Dialog.h"
00029 #include "xav_View.h"
00030 #include "pt_Types.h"
00031 #include "xap_Preview.h"
00032 #include "fv_View.h"
00033 #include "ie_imp.h"
00034 #include "ie_impGraphic.h"
00035 #include "ie_exp.h"
00036 #include "ie_types.h"
00037 #include "fg_Graphic.h"
00038 #include "xap_Dlg_FileOpenSaveAs.h"
00039 #define FORMAT_TABLE_NUMTHICKNESS 9
00040 
00041 class UT_Timer;
00042 class XAP_Frame;
00043 class fp_TableContainer;
00044 class AP_Dialog_FormatTable;
00045 
00046 class ABI_EXPORT AP_FormatTable_preview_drawer
00047 {
00048 public:
00049 
00050     void            draw(GR_Graphics *gc, UT_Rect &rect);
00051 };
00052 
00053 class ABI_EXPORT AP_FormatTable_preview : public XAP_Preview
00054 {
00055 public:
00056 
00057     AP_FormatTable_preview(GR_Graphics * gc, AP_Dialog_FormatTable * pFormatTable);
00058     virtual ~AP_FormatTable_preview(void);
00059 
00060     // data twiddlers
00061     void            draw(const UT_Rect *clip=NULL);
00062     GR_Graphics *   getGraphics(void) const { return m_gc;}
00063 private:
00064     AP_Dialog_FormatTable *  m_pFormatTable;
00065 protected:
00066 
00067 };
00068 
00069 class ABI_EXPORT AP_Dialog_FormatTable : public XAP_Dialog_Modeless
00070 {
00071 public:
00072     AP_Dialog_FormatTable(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00073     virtual ~AP_Dialog_FormatTable(void);
00074 
00075     virtual void                    runModeless(XAP_Frame * pFrame) = 0;
00076 
00077     enum tAnswer {
00078         a_OK,
00079         a_CLOSE
00080     };
00081     enum toggle_button {
00082         toggle_left,
00083         toggle_right,
00084         toggle_top,
00085         toggle_bottom
00086     };
00087 
00088     AP_Dialog_FormatTable::tAnswer      getAnswer(void) const;
00089     virtual void                        startUpdater(void);
00090     virtual void                        stopUpdater(void);
00091     static void                         autoUpdateMC(UT_Worker * pTimer);
00092 
00093     virtual void                        setSensitivity(bool bSens) = 0;
00094     virtual void                        setActiveFrame(XAP_Frame *pFrame);
00095     void                                ConstructWindowName(void);
00096     void                                event_update(void);
00097     void                                finalize(void);
00098 
00099     void                                setAllSensitivities(void);
00100     void                                setCurCellProps(void);
00101     void                                setApplyFormatTo(FormatTable applyTo);
00102     void                                applyChanges(void);
00103     void                                toggleLineType(toggle_button btn, bool enabled);
00104     void                                setBorderColor(const UT_RGBColor & clr);
00105     void                                setBackgroundColor(const UT_RGBColor & clr);
00106     virtual void                        setBackgroundColorInGUI(UT_RGBColor clr) = 0;
00107     void                                setBorderThickness(const UT_UTF8String & sThick);
00108     virtual void                        setBorderThicknessInGUI(UT_UTF8String & sThick) = 0;
00109     void                                clearImage(void);
00110     void                                askForGraphicPathName(void);
00111     void                                ShowErrorBox(UT_String & sFile, UT_Error errorCode);
00112     void                                _createPreviewFromGC(GR_Graphics * gc,
00113                                                              UT_uint32 width,
00114                                                              UT_uint32 height);
00115     PP_PropertyVector &                 getPropVector() { return m_vecProps; }
00116     const PP_PropertyVector &           getPropVector() const { return m_vecProps; }
00117 
00118     /* We use this in Win32 to know the status of line and to set the push button using this value*/
00119     bool                                getTopToggled() const;
00120     bool                                getBottomToggled() const;
00121     bool                                getRightToggled() const;
00122     bool                                getLeftToggled() const;
00123     GR_Image *                          getImage(void) const { return m_pImage;}
00124     const FG_ConstGraphicPtr &          getGraphic(void) const { return m_pGraphic;}
00125 
00126     UT_RGBColor                         m_borderColor;
00127     UT_sint32                           m_lineStyle;
00128     gchar *                         m_bgFillStyle;
00129     PP_PropertyVector                   m_vecProps;
00130     UT_UTF8String                       m_sBorderThickness;
00131 protected:
00132     guint                               _findClosestThickness(const char *) const;
00133     AP_Dialog_FormatTable::tAnswer      m_answer;
00134     char                                m_WindowName[100];
00135     AP_FormatTable_preview              *m_pFormatTablePreview;
00136     AP_FormatTable_preview_drawer       m_previewDrawer;
00137     double      m_dThickness[FORMAT_TABLE_NUMTHICKNESS];
00138 
00139 private:
00140     bool                                _getToggleButtonStatus(const char * lineStyle) const;
00141 
00142     bool                                m_bSettingsChanged;
00143 
00144     PP_PropertyVector                   m_vecPropsAdjRight;
00145     PP_PropertyVector                   m_vecPropsAdjBottom;
00146 
00147     UT_Timer *                          m_pAutoUpdaterMC;
00148 
00149     bool                                m_borderToggled;
00150 
00151     FormatTable                         m_ApplyTo;
00152 
00153     // Handshake variables
00154     bool m_bDestroy_says_stopupdating;
00155     bool m_bAutoUpdate_happening_now;
00156 
00157     PT_DocPosition                      m_iOldPos;
00158     UT_String                           m_sImagePath;
00159     IEGraphicFileType                   m_iGraphicType;
00160     GR_Image *                          m_pImage;
00161     FG_ConstGraphicPtr                  m_pGraphic;
00162 };
00163 
00164 #endif /* AP_DIALOG_FORMATTABLE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1