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

xap_Dlg_Image.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2001 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 XAP_DIALOG_IMAGE_H
00021 #define XAP_DIALOG_IMAGE_H
00022 
00023 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00024  * so even if it's commented out in-file that's still a lot of work for
00025  * the preprocessor to do...
00026  */
00027 #ifndef UT_TYPES_H
00028 #include "ut_types.h"
00029 #endif
00030 
00031 #include "xap_Frame.h"
00032 #include "xap_Dialog.h"
00033 
00034 typedef enum _WRAPPING_TYPE
00035 {
00036     WRAP_INLINE,
00037     WRAP_TEXTRIGHT,
00038     WRAP_TEXTLEFT,
00039     WRAP_TEXTBOTH,
00040     WRAP_NONE
00041 } WRAPPING_TYPE;
00042 
00043 
00044 typedef enum _POSITION_TO
00045 {
00046     POSITION_TO_PARAGRAPH,
00047     POSITION_TO_COLUMN,
00048     POSITION_TO_PAGE
00049 } POSITION_TO;
00050 
00051 /* #include "xav_View.h" */
00052 
00053 
00054 class ABI_EXPORT XAP_Dialog_Image : public XAP_Dialog_NonPersistent
00055 {
00056 public:
00057 
00058   typedef enum { a_OK, a_Cancel } tAnswer;
00059 
00060     XAP_Dialog_Image(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00061     virtual ~XAP_Dialog_Image(void);
00062 
00063     virtual void  runModal(XAP_Frame * pFrame) = 0;
00064 
00065     void setWrapping(WRAPPING_TYPE iWrap);
00066     void setPositionTo(POSITION_TO iPos);
00067     bool isInHdrFtr(void);
00068     void setInHdrFtr(bool b)
00069       { m_bInHdrFtr = b;}
00070 
00071     WRAPPING_TYPE getWrapping(void) const
00072         { return m_iWrappingType;}
00073     POSITION_TO getPositionTo(void) const
00074         { return m_iPositionTo;}
00075 
00076 
00077     double getWidth () const { return m_width; }
00078     double getHeight () const { return m_height; }
00079     bool getPreserveAspect() const { return m_bAspect; }
00080 
00081     // needed to set the initial width & height
00082     void setWidth (double w) { setWidth(w,false); }
00083     void setHeight (double h) { setHeight(h,false); }
00084     void setPreserveAspect( bool b ) { m_bAspect = b; }
00085 
00086 
00087     // needed to set the initial width & height
00088     void setWidth (UT_sint32 w);
00089     void setHeight (UT_sint32 h);
00090 
00091     void setMaxHeight ( double h ) { m_maxHeight = h; }
00092     void setMaxWidth ( double w ) { m_maxWidth = w; }
00093 
00094     double getMaxWidth () const { return m_maxWidth; }
00095     double getMaxHeight () const { return m_maxHeight; }
00096 
00097     tAnswer getAnswer () const { return m_answer; }
00098     const char * getHeightString(void);
00099     const char * getWidthString(void);
00100     double getIncrement(const char * sz);
00101     void incrementHeight(bool bIncrement);
00102     void incrementWidth(bool bIncrement);
00103     void setHeight(const char * szHeight);
00104     void setWidth(const char * szWidth);
00105     UT_Dimension getPreferedUnits(void);
00106     void  setPreferedUnits(UT_Dimension dim);
00107     void setTightWrap(bool bTight)
00108       { m_bTightWrap = bTight;}
00109     bool isTightWrap(void)
00110       { return m_bTightWrap;}
00111     void setTitle(const UT_UTF8String & title) {
00112         m_title = title;
00113     }
00114 
00115     const UT_UTF8String & getTitle() const {
00116         return m_title;
00117     }
00118 
00119     void setDescription(const UT_UTF8String & description) {
00120         m_description = description;
00121     }
00122 
00123     const UT_UTF8String & getDescription() const {
00124         return m_description;
00125     }
00126 
00127 
00128  protected:
00129     void setAnswer ( tAnswer ans ) { m_answer = ans; }
00130     void _convertToPreferredUnits(const char *sz, UT_String & pRet);
00131 
00132  private:
00133     bool   m_bAspect;
00134     double m_width;
00135     double m_height;
00136     double m_maxWidth;
00137     double m_maxHeight;
00138     tAnswer m_answer;
00139     UT_String m_HeightString;
00140     UT_String m_WidthString;
00141     bool m_bHeightChanged;
00142     bool m_bWidthChanged;
00143     UT_Dimension m_PreferedUnits;
00144 
00145     UT_UTF8String m_title;
00146     UT_UTF8String m_description;
00147 
00148     void setWidth (double w, bool checkaspect);
00149     void setHeight (double h, bool checkaspect);
00150     void setWidthAndHeight (double wh, bool iswidth);
00151 
00152     WRAPPING_TYPE m_iWrappingType;
00153     POSITION_TO m_iPositionTo;
00154     bool m_bInHdrFtr;
00155     bool m_bTightWrap;
00156 };
00157 
00158 #endif /* XAP_DIALOG_IMAGE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1