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_AutoNum;
00037 class fl_BlockLayout;
00038 class AP_Preview_Paragraph;
00039 class AP_Dialog_Lists;
00040
00041
00042 class ABI_EXPORT AP_Lists_preview : public XAP_Preview
00043 {
00044 public:
00045
00046 AP_Lists_preview(GR_Graphics * gc, AP_Dialog_Lists * pLists );
00047 virtual ~AP_Lists_preview(void);
00048
00049
00050 void draw(const UT_Rect *clip=NULL);
00051 AP_Dialog_Lists* getLists(void);
00052 void setData(const gchar * pszFont,float fAlign,float fIndent);
00053 void setData(const std::string & font, float fAlign,
00054 float fIndent)
00055 {
00056 setData(font.c_str(), fAlign, fIndent);
00057 }
00058
00059 protected:
00060
00061 AP_Dialog_Lists* m_pLists;
00062 GR_Font* m_pFont;
00063 float m_fAlign;
00064 float m_fIndent;
00065 UT_sint32 m_iLine_pos[8];
00066 UT_sint32 m_iLine_height;
00067 bool m_bFirst;
00068 };
00069
00070 class ABI_EXPORT AP_Dialog_Lists : public AP_Dialog_Modeless
00071 {
00072 protected:
00073 virtual XAP_String_Id getWindowTitleStringId();
00074
00075 public:
00076 AP_Dialog_Lists(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00077 virtual ~AP_Dialog_Lists(void);
00078
00079
00080
00081 typedef enum {
00082 a_OK,
00083 a_QUIT,
00084 a_CLOSE
00085 } tAnswer;
00086
00087 AP_Dialog_Lists::tAnswer getAnswer(void) const;
00088 void setAnswer(AP_Dialog_Lists::tAnswer ans ) {m_Answer = ans;}
00089 void StartList(void);
00090 void StopList(void);
00091 void Apply(void);
00092 void fillDialogFromBlock(void);
00093 void fillDialogFromVector(UT_GenericVector<const gchar*> * inVec);
00094 void PopulateDialogData(void);
00095 void fillFakeLabels(void);
00096 bool isLastOnLevel(void);
00097 gchar * getListStyleString( UT_uint32 iListType);
00098 UT_uint32 decodeListType(char * listformat);
00099 UT_sint32 findVecItem(UT_GenericVector<const gchar*> * v, char * key);
00100 UT_sint32 findVecItem(UT_GenericVector<const gchar*> * v, const char * key);
00101 void fillUncustomizedValues(void);
00102 UT_uint32 getID(void);
00103 UT_uint32 getStoredID(void) { return m_iID;}
00104 fl_AutoNum * 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 virtual const gchar* _getDingbatsFontName() const;
00123
00124
00125
00126
00127 #define SET_GATHER(a, u) inline u get##a(void) const {return m_##a;} \
00128 inline void set##a(u p##a) {m_##a = p##a;}
00129
00130 SET_GATHER(iLocalTick, UT_uint32);
00131 SET_GATHER(iStartValue, UT_uint32);
00132 SET_GATHER(newStartValue, UT_uint32);
00133 SET_GATHER(fAlign, float);
00134 SET_GATHER(fIndent, float);
00135 SET_GATHER(bStartNewList, bool);
00136 SET_GATHER(bApplyToCurrent, bool);
00137 SET_GATHER(bResumeList, bool);
00138 SET_GATHER(bisCustomized, bool);
00139 SET_GATHER(isListAtPoint, bool);
00140 SET_GATHER(bguiChanged, bool);
00141 SET_GATHER(NewListType, FL_ListType);
00142 SET_GATHER(DocListType, FL_ListType);
00143 SET_GATHER(iLevel, UT_uint32);
00144 SET_GATHER(pView, FV_View *);
00145
00146
00147 #undef SET_GATHER
00148
00149 void copyCharToDelim(const std::string & pszDelim)
00150 {
00151 m_pszDelim = pszDelim;
00152 }
00153 const std::string & getDelim(void) const
00154 {
00155 return m_pszDelim;
00156 }
00157 void copyCharToDecimal(const std::string & pszDecimal)
00158 {
00159 m_pszDecimal = pszDecimal;
00160 }
00161 const std::string & getDecimal( void) const
00162 {
00163 return m_pszDecimal;
00164 }
00165 void copyCharToFont(const std::string & pszFont)
00166 {
00167 m_pszFont = pszFont;
00168 }
00169 const std::string & getFont(void)
00170 {
00171 return m_pszFont;
00172 }
00173 void copyCharToWindowName(const char* pszName);
00174 const char * getWindowName() const;
00175 AP_Lists_preview* getListsPreview() { return m_pListsPreview; }
00176 void setCurrentFold(UT_sint32 iLevel)
00177 { m_iCurrentLevel = iLevel;}
00178 UT_sint32 getCurrentFold(void)
00179 { return m_iCurrentLevel;}
00180 virtual void setFoldLevelInGUI(void) = 0;
00181 virtual bool isPageLists(void) = 0;
00182 void setFoldingLevelChanged(bool b)
00183 { m_bFoldingLevelChanged = b;}
00184 private:
00185
00186
00187
00188
00189
00190 FV_View* m_pView;
00191
00192
00193
00194
00195
00196 tAnswer m_Answer;
00197 bool m_isListAtPoint;
00198 bool m_previousListExistsAtPoint;
00199 UT_UCSChar m_curListLabel[100];
00200 UT_UCSChar m_newListLabel[100];
00201 FL_ListType m_NewListType;
00202 std::string m_pszDelim;
00203 std::string m_pszDecimal;
00204 std::string m_pszFont;
00205 float m_fAlign;
00206 float m_fIndent;
00207 UT_uint32 m_iLevel;
00208 UT_uint32 m_iStartValue;
00209
00210 UT_uint32 m_iWidth;
00211 UT_uint32 m_iHeight;
00212 UT_uint32 m_iLocalTick;
00213 UT_uint32 m_curStartValue;
00214 UT_uint32 m_newStartValue;
00215 UT_uint32 m_curListLevel;
00216 UT_uint32 m_newListLevel;
00217 UT_uint32 m_iID;
00218 FL_ListType m_DocListType;
00219
00220 bool m_bStartList;
00221
00222 bool m_bStartNewList;
00223 bool m_bApplyToCurrent;
00224 bool m_bResumeList;
00225 bool m_bisCustomized;
00226 bool m_bguiChanged;
00227
00228 AP_Preview_Paragraph* m_paragraphPreview;
00229 AP_Lists_preview* m_pListsPreview;
00230
00231 fl_Layout* m_pFakeLayout[4];
00232 pf_Frag_Strux* m_pFakeSdh[4];
00233 fl_AutoNum* m_pFakeAuto;
00234 PD_Document * m_pFakeDoc;
00235 bool m_bDirty;
00236 bool m_bIsModal;
00237 UT_sint32 m_iCurrentLevel;
00238 UT_Vector m_OutProps;
00239 UT_String m_Output[5];
00240 bool m_bFoldingLevelChanged;
00241 };
00242
00243
00244 #endif