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

ap_Dialog_Border_Shading.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  * Copyright (c) 2010 Maleesh Prasan
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., 59 Temple Place - Suite 330, Boston, MA  
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef AP_DIALOG_BORDER_SHADING_H
00023 #define AP_DIALOG_BORDER_SHADING_H
00024 
00025 #include "ut_types.h"
00026 #include "ut_misc.h"
00027 #include "ut_PropVector.h"
00028 #include "xap_Frame.h"
00029 #include "xap_Dialog.h"
00030 #include "xav_View.h"
00031 #include "pt_Types.h"
00032 #include "xap_Preview.h"
00033 #include "fv_View.h"
00034 #include "ie_imp.h"
00035 #include "ie_impGraphic.h"
00036 #include "ie_exp.h"
00037 #include "ie_types.h"
00038 #include "fg_Graphic.h"
00039 #include "xap_Dlg_FileOpenSaveAs.h"
00040 
00041 #define BORDER_SHADING_NUMTHICKNESS 9
00042 #define BORDER_SHADING_NUMOFFSETS 9
00043 #define BORDER_SHADING_NUMOFSTYLES 4
00044 
00045 #define BORDER_SHADING_SHADING_DISABLE  "0"
00046 #define BORDER_SHADING_SHADING_ENABLE   "1"
00047 
00048 class UT_Timer;
00049 class XAP_Frame;
00050 class fp_TableContainer;
00051 class AP_Dialog_Border_Shading;
00052 
00053 class ABI_EXPORT AP_Border_Shading_preview_drawer
00054 {
00055 public:
00056 
00057     void            draw(GR_Graphics *gc, UT_Rect &rect);
00058 };
00059 
00060 class ABI_EXPORT AP_Border_Shading_preview : public XAP_Preview
00061 {
00062 public:
00063 
00064     AP_Border_Shading_preview(GR_Graphics * gc, AP_Dialog_Border_Shading * pFormatTable);
00065     virtual ~AP_Border_Shading_preview(void);
00066 
00067     // data twiddlers
00068     void            draw(const UT_Rect *clip=NULL);
00069     GR_Graphics *   getGraphics(void) const { return m_gc;} 
00070 
00071 private:
00072     AP_Border_Shading_preview_drawer    m_previewDrawer;
00073     AP_Dialog_Border_Shading *  m_pBorderShading;
00074 protected:
00075 
00076 };
00077 
00078 class ABI_EXPORT AP_Dialog_Border_Shading : public XAP_Dialog_Modeless
00079 {
00080 public:
00081     AP_Dialog_Border_Shading(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00082     virtual ~AP_Dialog_Border_Shading(void);
00083 
00084     virtual void                    runModeless(XAP_Frame * pFrame) = 0;
00085 
00086     typedef enum { a_OK, a_CLOSE } tAnswer;
00087     typedef enum { toggle_left, toggle_right, toggle_top, toggle_bottom } toggle_button;
00088     
00089     AP_Dialog_Border_Shading::tAnswer   getAnswer(void) const;
00090     virtual void                        startUpdater(void);
00091     virtual void                        stopUpdater(void);
00092     static void                         autoUpdateMC(UT_Worker * pTimer);
00093 
00094     virtual void                        setSensitivity(bool bSens) = 0;
00095     virtual void                        setActiveFrame(XAP_Frame *pFrame);
00096     void                                ConstructWindowName(void);
00097     void                                event_update(void);
00098     void                                finalize(void);
00099     void                                setAllSensitivities(void);
00100     void                                setCurBlockProps(void); 
00101     void                                applyChanges(void);
00102     void                                toggleLineType(toggle_button btn, bool enabled);
00103 
00104     void                                setBorderColor(UT_RGBColor clr);
00105     void                                setBorderThickness(UT_UTF8String & sThick);
00106     void                                setBorderStyle(UT_UTF8String & sStyle);
00107     void                                setShadingColor(UT_RGBColor clr);
00108     void                                setShadingPattern(UT_UTF8String & sPattern);
00109     void                                setShadingOffset(UT_UTF8String & sOffset);
00110 
00111     virtual void                        setBorderStyleInGUI(UT_UTF8String & sStyle) = 0;
00112     virtual void                        setBorderThicknessInGUI(UT_UTF8String & sThick) = 0;
00113     virtual void                        setBorderColorInGUI(UT_RGBColor clr) = 0;
00114     virtual void                        setShadingColorInGUI(UT_RGBColor clr) = 0;  
00115     virtual void                        setShadingPatternInGUI(UT_UTF8String & sPattern) = 0;   
00116     virtual void                        setShadingOffsetInGUI(UT_UTF8String & sOffset) = 0; 
00117 
00118     void                                _createPreviewFromGC(GR_Graphics * gc,
00119                                                              UT_uint32 width,
00120                                                              UT_uint32 height);
00121     UT_PropVector &                     getPropVector() { return m_vecProps; }
00122     const UT_PropVector &                       getPropVector() const { return m_vecProps; }
00123 
00124     bool                                getTopToggled() const;
00125     bool                                getBottomToggled() const;
00126     bool                                getRightToggled() const;
00127     bool                                getLeftToggled() const;
00128 
00129 protected:
00130     guint                               _findClosestThickness(const char *) const;
00131     guint                               _findClosestOffset(const char *) const;
00132     AP_Dialog_Border_Shading::tAnswer   m_answer;
00133     char                                m_WindowName[100];
00134     AP_Border_Shading_preview           *m_pBorderShadingPreview;
00135     AP_Border_Shading_preview_drawer    m_previewDrawer;
00136 
00137     UT_RGBColor                         m_borderColor;
00138     UT_sint32                           m_lineStyle;
00139     gchar *                             m_bgFillStyle;
00140     UT_PropVector                       m_vecProps;
00141     UT_UTF8String                       m_sBorderThickness;
00142 
00143     double                              m_dThickness[BORDER_SHADING_NUMTHICKNESS];
00144     double                              m_dShadingOffset[BORDER_SHADING_NUMOFFSETS];
00145         
00146 private:
00147     bool                                _getToggleButtonStatus(const char * lineStyle) const;
00148 
00149     bool                                m_bSettingsChanged;
00150     PT_DocPosition                      m_iOldPos;
00151     UT_String                           m_sDefaultStyle;
00152 
00153 //  UT_PropVector                       m_vecPropsAdjRight;
00154 //  UT_PropVector                       m_vecPropsAdjBottom;
00155     UT_Timer *                          m_pAutoUpdaterMC;
00156 
00157     // Handshake variables
00158     bool m_bDestroy_says_stopupdating;
00159     bool m_bAutoUpdate_happening_now;
00160 };
00161 
00162 #endif /* AP_DIALOG_BORDER_SHADING_H */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1