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

ap_Dialog_FormatTable.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  * Copyright (C) 2003 Marc Maurer
00004  * Copyright (c) 2009 Hubert Figuiere
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_FORMATTABLE_H
00022 #define AP_DIALOG_FORMATTABLE_H
00023 
00024 #include "ut_types.h"
00025 #include "ut_misc.h"
00026 #include "ut_PropVector.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     /*void          set(UT_uint32 iColumns, bool bLines)
00064                     {
00065                         m_iColumns = iColumns;
00066                         m_bLineBetween = bLines;
00067                         draw();
00068                     }*/
00069 private:
00070     AP_FormatTable_preview_drawer   m_previewDrawer;
00071     AP_Dialog_FormatTable *  m_pFormatTable;
00072 protected:
00073 
00074 };
00075 
00076 class ABI_EXPORT AP_Dialog_FormatTable : public XAP_Dialog_Modeless
00077 {
00078 public:
00079     AP_Dialog_FormatTable(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00080     virtual ~AP_Dialog_FormatTable(void);
00081 
00082     virtual void                    runModeless(XAP_Frame * pFrame) = 0;
00083 
00084     typedef enum { a_OK, a_CLOSE } tAnswer;
00085     typedef enum { toggle_left, toggle_right, toggle_top, toggle_bottom } toggle_button;
00086 
00087     AP_Dialog_FormatTable::tAnswer      getAnswer(void) const;
00088     virtual void                        startUpdater(void);
00089     virtual void                        stopUpdater(void);
00090     static void                         autoUpdateMC(UT_Worker * pTimer);
00091 
00092     virtual void                        setSensitivity(bool bSens) = 0;
00093     virtual void                        setActiveFrame(XAP_Frame *pFrame);
00094     void                                ConstructWindowName(void);
00095     void                                event_update(void);
00096     void                                finalize(void);
00097 
00098     void                                setAllSensitivities(void);
00099     void                                setCurCellProps(void);
00100     void                                setApplyFormatTo(FormatTable applyTo);
00101     void                                applyChanges(void);
00102     void                                toggleLineType(toggle_button btn, bool enabled);
00103     void                                setBorderColor(UT_RGBColor clr);
00104     void                                setBackgroundColor(UT_RGBColor clr);
00105     virtual void                        setBackgroundColorInGUI(UT_RGBColor clr) = 0;
00106     void                                setBorderThickness(UT_UTF8String & sThick);
00107     virtual void                        setBorderThicknessInGUI(UT_UTF8String & sThick) = 0;
00108     void                                clearImage(void);
00109     void                                askForGraphicPathName(void);
00110     void                                ShowErrorBox(UT_String & sFile, UT_Error errorCode);
00111     void                                _createPreviewFromGC(GR_Graphics * gc,
00112                                                              UT_uint32 width,
00113                                                              UT_uint32 height);
00114     UT_PropVector &                     getPropVector() { return m_vecProps; }
00115 
00116     /* We use this in Win32 to know the status of line and to set the push button using this value*/
00117     bool                                getTopToggled();
00118     bool                                getBottomToggled();
00119     bool                                getRightToggled();
00120     bool                                getLeftToggled();
00121     GR_Image *                          getImage(void) { return m_pImage;}
00122     FG_Graphic *                        getGraphic(void) { return m_pGraphic;}
00123 
00124     UT_RGBColor                         m_borderColor;
00125     UT_sint32                           m_lineStyle;
00126     gchar *                         m_bgFillStyle;
00127     UT_PropVector                           m_vecProps;
00128     UT_UTF8String                           m_sBorderThickness;
00129 protected:
00130     guint                               _findClosestThickness(const char *) const;
00131     AP_Dialog_FormatTable::tAnswer      m_answer;
00132     char                                m_WindowName[100];
00133     AP_FormatTable_preview              *m_pFormatTablePreview;
00134     AP_FormatTable_preview_drawer       m_previewDrawer;
00135     double      m_dThickness[FORMAT_TABLE_NUMTHICKNESS];
00136 
00137 private:
00138     bool                                _getToggleButtonStatus(const char * lineStyle);
00139 
00140     bool                                m_bSettingsChanged;
00141 
00142     UT_PropVector                           m_vecPropsAdjRight;
00143     UT_PropVector                           m_vecPropsAdjBottom;
00144 
00145     UT_Timer *                          m_pAutoUpdaterMC;
00146 
00147     bool                                m_borderToggled;
00148 
00149     FormatTable                         m_ApplyTo;
00150 
00151     // Handshake variables
00152     bool m_bDestroy_says_stopupdating;
00153     bool m_bAutoUpdate_happening_now;
00154 
00155     PT_DocPosition                      m_iOldPos;
00156     UT_String                           m_sImagePath;
00157     IEGraphicFileType                   m_iGraphicType;
00158     GR_Image *                          m_pImage;
00159     FG_Graphic *                        m_pGraphic;
00160 };
00161 
00162 #endif /* AP_DIALOG_FORMATTABLE_H */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1