1 /* AbiWord 2 * Copyright (C) 2001 AbiSource, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 #ifndef XAP_DIALOG_IMAGE_H 21 #define XAP_DIALOG_IMAGE_H 22 23 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 24 * so even if it's commented out in-file that's still a lot of work for 25 * the preprocessor to do... 26 */ 27 #ifndef UT_TYPES_H 28 #include "ut_types.h" 29 #endif 30 31 #include "xap_Frame.h" 32 #include "xap_Dialog.h" 33 34 typedef enum _WRAPPING_TYPE 35 { 36 WRAP_INLINE, 37 WRAP_TEXTRIGHT, 38 WRAP_TEXTLEFT, 39 WRAP_TEXTBOTH, 40 WRAP_NONE 41 } WRAPPING_TYPE; 42 43 44 typedef enum _POSITION_TO 45 { 46 POSITION_TO_PARAGRAPH, 47 POSITION_TO_COLUMN, 48 POSITION_TO_PAGE 49 } POSITION_TO; 50 51 /* #include "xav_View.h" */ 52 53 54 class ABI_EXPORT XAP_Dialog_Image : public XAP_Dialog_NonPersistent 55 { 56 public: 57 58 typedef enum { a_OK, a_Cancel } tAnswer; 59 60 XAP_Dialog_Image(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 61 virtual ~XAP_Dialog_Image(void); 62 63 virtual void runModal(XAP_Frame * pFrame) = 0; 64 65 void setWrapping(WRAPPING_TYPE iWrap); 66 void setPositionTo(POSITION_TO iPos); 67 bool isInHdrFtr(void); setInHdrFtr(bool b)68 void setInHdrFtr(bool b) 69 { m_bInHdrFtr = b;} 70 getWrapping(void)71 WRAPPING_TYPE getWrapping(void) const 72 { return m_iWrappingType;} getPositionTo(void)73 POSITION_TO getPositionTo(void) const 74 { return m_iPositionTo;} 75 76 getWidth()77 double getWidth () const { return m_width; } getHeight()78 double getHeight () const { return m_height; } getPreserveAspect()79 bool getPreserveAspect() const { return m_bAspect; } 80 81 // needed to set the initial width & height setWidth(double w)82 void setWidth (double w) { setWidth(w,false); } setHeight(double h)83 void setHeight (double h) { setHeight(h,false); } setPreserveAspect(bool b)84 void setPreserveAspect( bool b ) { m_bAspect = b; } 85 86 87 // needed to set the initial width & height 88 void setWidth (UT_sint32 w); 89 void setHeight (UT_sint32 h); 90 setMaxHeight(double h)91 void setMaxHeight ( double h ) { m_maxHeight = h; } setMaxWidth(double w)92 void setMaxWidth ( double w ) { m_maxWidth = w; } 93 getMaxWidth()94 double getMaxWidth () const { return m_maxWidth; } getMaxHeight()95 double getMaxHeight () const { return m_maxHeight; } 96 getAnswer()97 tAnswer getAnswer () const { return m_answer; } 98 const char * getHeightString(void); 99 const char * getWidthString(void); 100 double getIncrement(const char * sz); 101 void incrementHeight(bool bIncrement); 102 void incrementWidth(bool bIncrement); 103 void setHeight(const char * szHeight); 104 void setWidth(const char * szWidth); 105 UT_Dimension getPreferedUnits(void); 106 void setPreferedUnits(UT_Dimension dim); setTightWrap(bool bTight)107 void setTightWrap(bool bTight) 108 { m_bTightWrap = bTight;} isTightWrap(void)109 bool isTightWrap(void) 110 { return m_bTightWrap;} setTitle(const UT_UTF8String & title)111 void setTitle(const UT_UTF8String & title) { 112 m_title = title; 113 } 114 getTitle()115 const UT_UTF8String & getTitle() const { 116 return m_title; 117 } 118 setDescription(const UT_UTF8String & description)119 void setDescription(const UT_UTF8String & description) { 120 m_description = description; 121 } 122 getDescription()123 const UT_UTF8String & getDescription() const { 124 return m_description; 125 } 126 127 128 protected: setAnswer(tAnswer ans)129 void setAnswer ( tAnswer ans ) { m_answer = ans; } 130 void _convertToPreferredUnits(const char *sz, UT_String & pRet); 131 132 private: 133 bool m_bAspect; 134 double m_width; 135 double m_height; 136 double m_maxWidth; 137 double m_maxHeight; 138 tAnswer m_answer; 139 UT_String m_HeightString; 140 UT_String m_WidthString; 141 bool m_bHeightChanged; 142 bool m_bWidthChanged; 143 UT_Dimension m_PreferedUnits; 144 145 UT_UTF8String m_title; 146 UT_UTF8String m_description; 147 148 void setWidth (double w, bool checkaspect); 149 void setHeight (double h, bool checkaspect); 150 void setWidthAndHeight (double wh, bool iswidth); 151 152 WRAPPING_TYPE m_iWrappingType; 153 POSITION_TO m_iPositionTo; 154 bool m_bInHdrFtr; 155 bool m_bTightWrap; 156 }; 157 158 #endif /* XAP_DIALOG_IMAGE_H */ 159