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

ap_Dialog_Border_Shading.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  * Copyright (c) 2010 Maleesh Prasan
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef AP_DIALOG_BORDER_SHADING_H
00024 #define AP_DIALOG_BORDER_SHADING_H
00025 
00026 #include "ut_types.h"
00027 #include "ut_misc.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_Dialog_Border_Shading *  m_pBorderShading;
00073 protected:
00074 
00075 };
00076 
00077 class ABI_EXPORT AP_Dialog_Border_Shading : public XAP_Dialog_Modeless
00078 {
00079 public:
00080     AP_Dialog_Border_Shading(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00081     virtual ~AP_Dialog_Border_Shading(void);
00082 
00083     virtual void                    runModeless(XAP_Frame * pFrame) = 0;
00084 
00085     enum tAnswer {
00086           a_OK,
00087           a_CLOSE
00088         };
00089     enum toggle_button {
00090           toggle_left,
00091           toggle_right,
00092           toggle_top,
00093           toggle_bottom
00094         };
00095 
00096     AP_Dialog_Border_Shading::tAnswer   getAnswer(void) const;
00097     virtual void                        startUpdater(void);
00098     virtual void                        stopUpdater(void);
00099     static void                         autoUpdateMC(UT_Worker * pTimer);
00100 
00101     virtual void                        setSensitivity(bool bSens) = 0;
00102     virtual void                        setActiveFrame(XAP_Frame *pFrame);
00103     void                                ConstructWindowName(void);
00104     void                                event_update(void);
00105     void                                finalize(void);
00106     void                                setAllSensitivities(void);
00107     void                                setCurBlockProps(void);
00108     void                                applyChanges(void);
00109     void                                toggleLineType(toggle_button btn, bool enabled);
00110 
00111     void                                setBorderColor(const UT_RGBColor & clr);
00112     void                                setBorderThickness(const std::string & sThick);
00113     void                                setBorderStyle(const std::string & sStyle);
00114     void                                setShadingColor(const UT_RGBColor & clr);
00115     void                                setShadingPattern(const std::string & sPattern);
00116     void                                setShadingOffset(const std::string & sOffset);
00117 
00118     virtual void                        setBorderStyleInGUI(const std::string & sStyle) = 0;
00119     virtual void                        setBorderThicknessInGUI(const std::string & sThick) = 0;
00120     virtual void                        setBorderColorInGUI(const UT_RGBColor & clr) = 0;
00121     virtual void                        setShadingColorInGUI(const UT_RGBColor & clr) = 0;
00122     virtual void                        setShadingPatternInGUI(const std::string & sPattern) = 0;
00123     virtual void                        setShadingOffsetInGUI(const std::string & sOffset) = 0;
00124 
00125     void                                _createPreviewFromGC(GR_Graphics * gc,
00126                                                              UT_uint32 width,
00127                                                              UT_uint32 height);
00128     PP_PropertyVector &                 getPropVector()
00129         { return m_vecProps; }
00130     const PP_PropertyVector &           getPropVector() const
00131         { return m_vecProps; }
00132 
00133     bool                                getTopToggled() const;
00134     bool                                getBottomToggled() const;
00135     bool                                getRightToggled() const;
00136     bool                                getLeftToggled() const;
00137 
00138 protected:
00139     guint                               _findClosestThickness(const char *) const;
00140     guint                               _findClosestOffset(const char *) const;
00141     AP_Dialog_Border_Shading::tAnswer   m_answer;
00142     char                                m_WindowName[100];
00143     AP_Border_Shading_preview           *m_pBorderShadingPreview;
00144     AP_Border_Shading_preview_drawer    m_previewDrawer;
00145 
00146     UT_RGBColor                         m_borderColor;
00147     UT_sint32                           m_lineStyle;
00148     gchar *                             m_bgFillStyle;
00149     PP_PropertyVector                       m_vecProps;
00150     std::string                       m_sBorderThickness;
00151 
00152     double                              m_dThickness[BORDER_SHADING_NUMTHICKNESS];
00153     double                              m_dShadingOffset[BORDER_SHADING_NUMOFFSETS];
00154 
00155 private:
00156     bool                                _getToggleButtonStatus(const char * lineStyle) const;
00157 
00158     bool                                m_bSettingsChanged;
00159     PT_DocPosition                      m_iOldPos;
00160     std::string                         m_sDefaultStyle;
00161 
00162     UT_Timer *                          m_pAutoUpdaterMC;
00163 
00164     // Handshake variables
00165     bool m_bDestroy_says_stopupdating;
00166     bool m_bAutoUpdate_happening_now;
00167 };
00168 
00169 #endif /* AP_DIALOG_BORDER_SHADING_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1