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
00021 #ifndef AV_VIEW_H
00022 #define AV_VIEW_H
00023
00024
00025
00026
00027
00028 #ifndef UT_TYPES_H
00029 #include "ut_types.h"
00030 #endif
00031 #include "ut_misc.h"
00032 #include "ut_vector.h"
00033 #include "ut_debugmsg.h"
00034
00035 #include "ev_EditBits.h"
00036
00037 #include "xav_Listener.h"
00038
00039 class GR_Graphics;
00040
00041 class XAP_App;
00042
00043
00044
00045 enum AV_Focus
00046 {
00047 AV_FOCUS_HERE,
00048 AV_FOCUS_NEARBY,
00049 AV_FOCUS_NONE,
00050 AV_FOCUS_MODELESS
00051 };
00052
00053 typedef enum _AV_ScrollCmd
00054 {
00055 AV_SCROLLCMD_PAGEUP,
00056 AV_SCROLLCMD_PAGEDOWN,
00057 AV_SCROLLCMD_LINEUP,
00058 AV_SCROLLCMD_LINEDOWN,
00059 AV_SCROLLCMD_PAGERIGHT,
00060 AV_SCROLLCMD_PAGELEFT,
00061 AV_SCROLLCMD_LINERIGHT,
00062 AV_SCROLLCMD_LINELEFT,
00063 AV_SCROLLCMD_TOTOP,
00064 AV_SCROLLCMD_TOBOTTOM,
00065 AV_SCROLLCMD_TOPOSITION
00066 } AV_ScrollCmd;
00067
00068 class ABI_EXPORT AV_ScrollObj
00069 {
00070 public:
00071 AV_ScrollObj(void * pData,
00072 void (*pfnX)(void *,UT_sint32,UT_sint32),
00073 void (*pfnY)(void *,UT_sint32,UT_sint32))
00074 : m_pData(pData), m_pfnX(pfnX), m_pfnY(pfnY)
00075 { };
00076
00077 void* m_pData;
00078 void (*m_pfnX)(void *, UT_sint32 xoff, UT_sint32 xlimit);
00079 void (*m_pfnY)(void *, UT_sint32 yoff, UT_sint32 ylimit);
00080 };
00081
00082 class ABI_EXPORT AV_View
00083 {
00084 public:
00085 AV_View(XAP_App * pApp, void*);
00086 virtual ~AV_View();
00087
00088 virtual void focusChange(AV_Focus focus)=0;
00089 AV_Focus getFocus(){ return m_focus; }
00090 void setFocus(AV_Focus focus){ m_focus=focus; }
00091
00092 void* getParentData() const;
00093
00094 void setInsertMode(bool bInsert);
00095
00096 virtual void setPoint(UT_uint32 pt) = 0;
00097
00099 void setWindowSize(UT_sint32, UT_sint32);
00100 virtual void setXScrollOffset(UT_sint32) = 0;
00101 virtual void setYScrollOffset(UT_sint32) = 0;
00102 UT_uint32 getTick(void) const;
00103 void incTick(void);
00104 inline XAP_App * getApp(void) const { return m_pApp; };
00105 virtual void setCursorToContext(void) =0;
00106
00108 UT_sint32 getWindowWidth(void) const;
00109 UT_sint32 getWindowHeight(void) const;
00110 inline UT_sint32 getXScrollOffset(void) const { return m_xScrollOffset; }
00111 inline UT_sint32 getYScrollOffset(void) const { return m_yScrollOffset; }
00112
00113 virtual void draw(const UT_Rect* pRect=static_cast<UT_Rect*>(NULL)) = 0;
00114 virtual void updateScreen(bool bDirtyRunsOnly=true) = 0;
00115 virtual GR_Graphics * getGraphics(void) const = 0;
00116 virtual void updateLayout(void) = 0;
00117 virtual void rebuildLayout(void) = 0;
00118 virtual void remeasureCharsWithoutRebuild() = 0;
00119 virtual void fontMetricsChange() = 0;
00120
00121 virtual void cmdScroll(AV_ScrollCmd cmd, UT_uint32 iPos = 0) = 0;
00122 void addScrollListener(AV_ScrollObj*);
00123 void removeScrollListener(AV_ScrollObj*);
00125 void sendVerticalScrollEvent(UT_sint32 yoff, UT_sint32 ylimit = -1);
00126 void sendHorizontalScrollEvent(UT_sint32 xoff, UT_sint32 xlimit = -1);
00127
00128 bool couldBeActive(void) const
00129 { return m_bCouldBeActive;}
00130 bool addListener(AV_Listener * pListener, AV_ListenerId * pListenerId);
00131 bool removeListener(AV_ListenerId listenerId);
00132
00134 virtual bool isActive(void) const = 0;
00135 void setActivityMask(bool bActive);
00136 virtual bool notifyListeners(const AV_ChangeMask hint, void * pPrivateData = NULL);
00137 virtual bool isDocumentPresent(void) const = 0;
00138 virtual bool canDo(bool bUndo) const = 0;
00139 virtual void cmdUndo(UT_uint32 count) = 0;
00140 virtual void cmdRedo(UT_uint32 count) = 0;
00141 virtual UT_Error cmdSave(void) = 0;
00142 virtual UT_Error cmdSaveAs(const char * szFilename, int ieft) = 0;
00143 virtual UT_Error cmdSaveAs(const char * szFilename, int ieft, bool cpy) = 0;
00144
00145 virtual EV_EditMouseContext getMouseContext(UT_sint32 xPos, UT_sint32 yPos) = 0;
00146 virtual bool isSelectionEmpty(void) const = 0;
00147
00148 virtual void cmdCopy(bool bToClipboard = true) = 0;
00149 virtual void cmdCut(void) = 0;
00150 virtual void cmdPaste(bool bHonorFormatting = true) = 0;
00151 virtual void cmdPasteSelectionAt(UT_sint32 xPos, UT_sint32 yPos) = 0;
00152
00153
00154 void setVisualSelectionEnabled(bool bActive)
00155 {
00156 m_VisualSelectionActive = bActive;
00157 }
00158 bool getVisualSelectionEnabled(void) const
00159 {
00160 return m_VisualSelectionActive;
00161 }
00162
00163
00164
00165
00166 virtual void cmdUnselectSelection(void) {UT_DEBUGMSG(("Just saved a segfault! \n"));}
00167
00168 virtual UT_uint32 calculateZoomPercentForPageWidth() const = 0;
00169 virtual UT_uint32 calculateZoomPercentForPageHeight() const = 0;
00170 virtual UT_uint32 calculateZoomPercentForWholePage() const = 0;
00171 void setLayoutIsFilling(bool bFill) { m_bIsLayoutFilling = bFill;}
00172 bool isLayoutFilling(void) const {return m_bIsLayoutFilling;}
00173 virtual UT_uint32 getPoint(void) const =0;
00174 virtual void setCursorWait(void) = 0;
00175 virtual void clearCursorWait(void) = 0;
00176 bool isConfigureChanged(void)
00177 { return m_bConfigureChanged;}
00178 void setConfigure(bool b)
00179 { m_bConfigureChanged = b;}
00180
00181 protected:
00182 XAP_App * m_pApp;
00183 void* m_pParentData;
00184
00185 UT_sint32 m_xScrollOffset;
00186 UT_sint32 m_yScrollOffset;
00187 AV_Focus m_focus;
00188 UT_uint32 m_iTick;
00189 bool m_bInsertMode;
00190 bool m_VisualSelectionActive;
00191
00192 UT_GenericVector<AV_ScrollObj*> m_scrollListeners;
00193 UT_GenericVector<AV_Listener*> m_vecListeners;
00194
00195 private:
00196 AV_View(const AV_View&);
00197 void operator=(AV_View&);
00198 bool m_bIsLayoutFilling;
00199
00200 UT_sint32 m_iWindowHeight;
00201 UT_sint32 m_iWindowWidth;
00202 double m_dOneTDU;
00203 bool m_bCouldBeActive;
00204 bool m_bConfigureChanged;
00205 };
00206
00207 #endif
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222