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

ap_Dialog_Columns.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 #ifndef AP_Dialog_Columns_H
00021 #define AP_Dialog_Columns_H
00022 
00023 #include "xap_Frame.h"
00024 #include "xap_Dialog.h"
00025 #include "fv_View.h"
00026 #include "pd_Document.h"
00027 
00028 
00029 class XAP_Frame;
00030 class AP_Dialog_Columns;
00031 
00032 #include "xap_Preview.h"
00033 
00034 // this is needed to get the ruler units.
00035 #include "ap_StatusBar.h"
00036 #include "ut_units.h"
00037 
00038 
00039 class ABI_EXPORT AP_Columns_preview_drawer
00040 {
00041 public:
00042 
00043     void            draw(GR_Graphics *gc, UT_Rect &rect, UT_sint32 iColumns, bool bLines, double maxHeightPercent, double SpaceAfterPercent);
00044 };
00045 
00046 class ABI_EXPORT AP_Columns_preview : public XAP_Preview
00047 {
00048 public:
00049 
00050     AP_Columns_preview(GR_Graphics * gc, AP_Dialog_Columns * pColumns);
00051     virtual ~AP_Columns_preview(void);
00052 
00053     // data twiddlers
00054     void            draw(const UT_Rect *clip=NULL);
00055 
00056     void            set(UT_uint32 iColumns, bool bLines)
00057                     {
00058                         m_iColumns = iColumns;
00059                         m_bLineBetween = bLines;
00060                         draw();
00061                     }
00062 
00063 private:
00064     AP_Columns_preview_drawer   m_previewDrawer;
00065     AP_Dialog_Columns *  m_pColumns;
00066 protected:
00067 
00068     UT_uint32       m_iColumns;
00069     bool            m_bLineBetween;
00070 
00071 };
00072 
00073 class ABI_EXPORT AP_Dialog_Columns : public XAP_Dialog_NonPersistent
00074 {
00075 public:
00076     AP_Dialog_Columns(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00077     virtual ~AP_Dialog_Columns(void);
00078 
00079     virtual void                    runModal(XAP_Frame * pFrame) = 0;
00080     virtual void                    enableLineBetweenControl(bool bState = true) = 0;
00081 
00082 
00083     void                            setColumns(UT_uint32 iColumns);
00084 
00085     typedef enum { a_OK, a_CANCEL } tAnswer;
00086     AP_Dialog_Columns::tAnswer getAnswer(void) const;
00087     UT_uint32          getColumns(void) const {return m_iColumns;}
00088 
00089     void               setLineBetween(bool bState);
00090     bool               getLineBetween(void) const { return m_bLineBetween;}
00091     double             getMaxHeightPercent(void);
00092     double             getSpaceAfterPercent(void);
00093     void               setColumnOrder(UT_uint32 iOrder);
00094     UT_uint32          getColumnOrder(void) const {return m_iColumnOrder;}
00095     const char *       getHeightString(void);
00096     const char *       getSpaceAfterString(void);
00097     bool               isSpaceAfterChanged(void) const {return m_bSpaceAfterChanged;}
00098     bool               isMaxHeightChanged(void) const {return m_bMaxHeightChanged;}
00099 
00100 protected:
00101     void               _createPreviewFromGC(GR_Graphics * gc,
00102                             UT_uint32 width,
00103                             UT_uint32 height);
00104     void               _drawColumnButton(GR_Graphics *gc, UT_Rect rect, UT_uint32 iColumns);
00105     void            _convertToPreferredUnits(XAP_Frame * pFrame,const
00106     char *sz, gchar * pRet);
00107     AP_Dialog_Columns::tAnswer m_answer;
00108     AP_Columns_preview *       m_pColumnsPreview;
00109     AP_Columns_preview_drawer  m_previewDrawer;
00110     void                       incrementMaxHeight(bool bIncrement);
00111     void                       incrementSpaceAfter(bool bIncrement);
00112     double                     getIncrement(const char * sz);
00113     void                       setViewAndDoc(XAP_Frame * pFrame);
00114     double                     getPageWidth(void);
00115     double                     getPageHeight(void);
00116     void                       setMaxHeight( const char * szHeight);
00117     void                       setSpaceAfter( const char * szAfter);
00118 private:
00119 
00120     UT_uint32                  m_iColumns;
00121     bool                       m_bLineBetween;
00122     UT_uint32                  m_iColumnOrder;
00123     UT_String                  m_HeightString;
00124     UT_String                  m_SpaceAfterString;
00125     PD_Document *              m_pDoc;
00126     FV_View *                  m_pView;
00127     bool                       m_bSpaceAfterChanged;
00128     bool                       m_bMaxHeightChanged;
00129     double                     m_dMarginTop;
00130     double                     m_dMarginBottom;
00131     double                     m_dMarginLeft;
00132     double                     m_dMarginRight;
00133 };
00134 
00135 #endif /* AP_Dialog_Columns_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1