Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef AP_DIALOG_LISTS_H
00021 #define AP_DIALOG_LISTS_H
00022
00023 #include <string>
00024
00025 #include "xap_Frame.h"
00026 #include "xap_Dialog.h"
00027 #include "ap_Dialog_Modeless.h"
00028 #include "xav_View.h"
00029 #include "fl_BlockLayout.h"
00030 #include "fl_AutoNum.h"
00031 #include "fl_AutoLists.h"
00032 #include "pt_Types.h"
00033 #include "xap_Preview.h"
00034
00035 class FV_View;
00036 class fl_BlockLayout;
00037 class AP_Preview_Paragraph;
00038 class AP_Dialog_Lists;
00039
00040
00041 class ABI_EXPORT AP_Lists_preview : public XAP_Preview
00042 {
00043 public:
00044
00045 AP_Lists_preview(GR_Graphics * gc, AP_Dialog_Lists * pLists );
00046 virtual ~AP_Lists_preview(void);
00047
00048
00049 void draw(const UT_Rect *clip=NULL);
00050 AP_Dialog_Lists* getLists(void);
00051 void setData(const gchar * pszFont,float fAlign,float fIndent);
00052 void setData(const std::string & font, float fAlign,
00053 float fIndent)
00054 {
00055 setData(font.c_str(), fAlign, fIndent);
00056 }
00057
00058 protected:
00059
00060 AP_Dialog_Lists* m_pLists;
00061 GR_Font* m_pFont;
00062 float m_fAlign;
00063 float m_fIndent;
00064 UT_sint32 m_iLine_pos[8];
00065 UT_sint32 m_iLine_height;
00066 bool m_bFirst;
00067 };
00068
00069 class ABI_EXPORT AP_Dialog_Lists : public AP_Dialog_Modeless
00070 {
00071 protected:
00072 virtual XAP_String_Id getWindowTitleStringId();
00073
00074 public:
00075 AP_Dialog_Lists(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00076 virtual ~AP_Dialog_Lists(void);
00077
00078
00079
00080 typedef enum {
00081 a_OK,
00082 a_QUIT,
00083 a_CLOSE
00084 } tAnswer;
00085
00086 AP_Dialog_Lists::tAnswer getAnswer(void) const;
00087 void setAnswer(AP_Dialog_Lists::tAnswer ans ) {m_Answer = ans;}
00088 void StartList(void);
00089 void StopList(void);
00090 void Apply(void);
00091 void fillDialogFromBlock(void);
00092 void fillDialogFromVector(UT_GenericVector<const gchar*> * inVec);
00093 void PopulateDialogData(void);
00094 void fillFakeLabels(void);
00095 bool isLastOnLevel(void);
00096 gchar * getListStyleString( UT_uint32 iListType);
00097 UT_uint32 decodeListType(char * listformat);
00098 UT_sint32 findVecItem(UT_GenericVector<const gchar*> * v, const char * key);
00100 static UT_sint32 findVecItem(const PP_PropertyVector & v, const char * key);
00101 void fillUncustomizedValues(void);
00102 UT_uint32 getID(void);
00103 UT_uint32 getStoredID(void) { return m_iID;}
00104 fl_AutoNumPtr getAutoNum(void) const;
00105 fl_BlockLayout * getBlock(void) const;
00106 UT_uint32 getTick(void);
00107 const UT_Vector * getOutProps(void) const { return &m_OutProps;}
00108 void setTick(UT_uint32 iTick);
00109 bool isDirty(void) const {return m_bDirty;}
00110 void setDirty(void) {m_bDirty = true;}
00111 void clearDirty(void) {m_bDirty = false;}
00112
00113 AV_View * getAvView(void);
00114 void generateFakeLabels(void);
00115 UT_UCSChar * getListLabel(UT_sint32 itemNo);
00116 virtual void event_PreviewAreaExposed();
00117 virtual void _createPreviewFromGC(GR_Graphics * gc, UT_uint32 width, UT_uint32 height);
00118 void setModal(void) {m_bIsModal = true;}
00119 bool isModal(void) const { return m_bIsModal;}
00120
00121 protected:
00122
00123
00124
00125
00126 #define SET_GATHER(a, u) inline u get##a(void) const {return m_##a;} \
00127 inline void set##a(u p##a) {m_##a = p##a;}
00128
00129 SET_GATHER(iLocalTick, UT_uint32);
00130 SET_GATHER(iStartValue, UT_uint32);
00131 SET_GATHER(newStartValue, UT_uint32);
00132 SET_GATHER(fAlign, float);
00133 SET_GATHER(fIndent, float);
00134 SET_GATHER(bStartNewList, bool);
00135 SET_GATHER(bApplyToCurrent, bool);
00136 SET_GATHER(bResumeList, bool);
00137 SET_GATHER(bisCustomized, bool);
00138 SET_GATHER(isListAtPoint, bool);
00139 SET_GATHER(bguiChanged, bool);
00140 SET_GATHER(NewListType, FL_ListType);
00141 SET_GATHER(DocListType, FL_ListType);
00142 SET_GATHER(iLevel, UT_uint32);
00143 SET_GATHER(pView, FV_View *);
00144
00145
00146 #undef SET_GATHER
00147
00148 void copyCharToDelim(const std::string & pszDelim)
00149 {
00150 m_pszDelim = pszDelim;
00151 }
00152 const std::string & getDelim(void) const
00153 {
00154 return m_pszDelim;
00155 }
00156 void copyCharToDecimal(const std::string & pszDecimal)
00157 {
00158 m_pszDecimal = pszDecimal;
00159 }
00160 const std::string & getDecimal( void) const
00161 {
00162 return m_pszDecimal;
00163 }
00164 void copyCharToFont(const std::string & pszFont)
00165 {
00166 m_pszFont = pszFont;
00167 }
00168 const std::string & getFont(void)
00169 {
00170 return m_pszFont;
00171 }
00172 void copyCharToWindowName(const char* pszName);
00173 const char * getWindowName() const;
00174 AP_Lists_preview* getListsPreview() { return m_pListsPreview; }
00175 void setCurrentFold(UT_sint32 iLevel)
00176 { m_iCurrentLevel = iLevel;}
00177 UT_sint32 getCurrentFold(void)
00178 { return m_iCurrentLevel;}
00179 virtual void setFoldLevelInGUI(void) = 0;
00180 virtual bool isPageLists(void) = 0;
00181 void setFoldingLevelChanged(bool b)
00182 { m_bFoldingLevelChanged = b;}
00183 private:
00184
00185
00186
00187
00188
00189 FV_View* m_pView;
00190
00191
00192
00193
00194
00195 tAnswer m_Answer;
00196 bool m_isListAtPoint;
00197 bool m_previousListExistsAtPoint;
00198 UT_UCSChar m_curListLabel[100];
00199 UT_UCSChar m_newListLabel[100];
00200 FL_ListType m_NewListType;
00201 std::string m_pszDelim;
00202 std::string m_pszDecimal;
00203 std::string m_pszFont;
00204 float m_fAlign;
00205 float m_fIndent;
00206 UT_uint32 m_iLevel;
00207 UT_uint32 m_iStartValue;
00208
00209 UT_uint32 m_iWidth;
00210 UT_uint32 m_iHeight;
00211 UT_uint32 m_iLocalTick;
00212 UT_uint32 m_curStartValue;
00213 UT_uint32 m_newStartValue;
00214 UT_uint32 m_curListLevel;
00215 UT_uint32 m_newListLevel;
00216 UT_uint32 m_iID;
00217 FL_ListType m_DocListType;
00218
00219 bool m_bStartList;
00220
00221 bool m_bStartNewList;
00222 bool m_bApplyToCurrent;
00223 bool m_bResumeList;
00224 bool m_bisCustomized;
00225 bool m_bguiChanged;
00226
00227 AP_Preview_Paragraph* m_paragraphPreview;
00228 AP_Lists_preview* m_pListsPreview;
00229
00230 fl_Layout* m_pFakeLayout[4];
00231 pf_Frag_Strux* m_pFakeSdh[4];
00232 fl_AutoNumPtr m_pFakeAuto;
00233 PD_Document * m_pFakeDoc;
00234 bool m_bDirty;
00235 bool m_bIsModal;
00236 UT_sint32 m_iCurrentLevel;
00237 UT_Vector m_OutProps;
00238 UT_String m_Output[5];
00239 bool m_bFoldingLevelChanged;
00240 };
00241
00242
00243 #endif