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 PL_LISTENERCOUPLECLOSER_H
00021 #define PL_LISTENERCOUPLECLOSER_H
00022
00023 #include "ut_types.h"
00024 #include "pt_Types.h"
00025 class PX_ChangeRecord;
00026 #include "pl_Listener.h"
00027
00028 #include <list>
00029 #include <string>
00030
00031 class fl_ContainerLayout;
00032
00039 struct ABI_EXPORT PL_FinishingListener : public PL_Listener
00040 {
00041 virtual bool isFinished() = 0;
00042
00043 virtual bool change(fl_ContainerLayout* ,
00044 const PX_ChangeRecord * )
00045 {return true;}
00046 virtual bool insertStrux(fl_ContainerLayout* ,
00047 const PX_ChangeRecord * ,
00048 pf_Frag_Strux* ,
00049 PL_ListenerId ,
00050 void (* )(pf_Frag_Strux* sdhNew,
00051 PL_ListenerId lid,
00052 fl_ContainerLayout* sfhNew))
00053 { return true;}
00054 virtual bool signal(UT_uint32 )
00055 { return true;}
00056 };
00057
00058
00124 class ABI_EXPORT PL_ListenerCoupleCloser : public PL_Listener
00125 {
00126 protected:
00127 PD_Document* m_pDocument;
00128 PL_Listener* m_delegate;
00129 typedef std::list< std::string > stringlist_t;
00130 stringlist_t m_rdfUnclosedAnchorStack;
00131 stringlist_t m_rdfUnopenedAnchorStack;
00132 stringlist_t m_bookmarkUnclosedStack;
00133 stringlist_t m_bookmarkUnopenedStack;
00134
00135 bool shouldClose( const std::string& id, bool isEnd, stringlist_t& sl );
00136 bool shouldOpen( const std::string& id, bool isEnd, stringlist_t& sl );
00137 void trackOpenClose( const std::string& id, bool isEnd,
00138 stringlist_t& unclosed, stringlist_t& unopened );
00139
00140
00141 struct ABI_EXPORT AfterContentListener : public PL_FinishingListener
00142 {
00143 PL_ListenerCoupleCloser* m_self;
00144 AfterContentListener( PL_ListenerCoupleCloser* self )
00145 : m_self(self)
00146 {}
00147
00148 virtual bool isFinished();
00149 virtual bool populate( fl_ContainerLayout* sfh,
00150 const PX_ChangeRecord * pcr );
00151 virtual bool populateStrux( pf_Frag_Strux* sdh,
00152 const PX_ChangeRecord * pcr,
00153 fl_ContainerLayout* * psfh);
00154 };
00155 AfterContentListener m_AfterContentListener;
00156
00157 struct ABI_EXPORT BeforeContentListener : public PL_FinishingListener
00158 {
00159 PL_ListenerCoupleCloser* m_self;
00160 BeforeContentListener( PL_ListenerCoupleCloser* self )
00161 : m_self(self)
00162 {}
00163
00164 virtual bool isFinished();
00165 virtual bool populate( fl_ContainerLayout* sfh,
00166 const PX_ChangeRecord * pcr );
00167 virtual bool populateStrux( pf_Frag_Strux* sdh,
00168 const PX_ChangeRecord * pcr,
00169 fl_ContainerLayout* * psfh);
00170 };
00171 BeforeContentListener m_BeforeContentListener;
00172
00173 struct ABI_EXPORT NullContentListener : public PL_FinishingListener
00174 {
00175 PL_ListenerCoupleCloser* m_self;
00176 NullContentListener( PL_ListenerCoupleCloser* self )
00177 : m_self(self)
00178 {}
00179
00180 virtual bool isFinished()
00181 {
00182 return true;
00183 }
00184 virtual bool populate( fl_ContainerLayout*,
00185 const PX_ChangeRecord* )
00186 {
00187 return false;
00188 }
00189 virtual bool populateStrux( pf_Frag_Strux*,
00190 const PX_ChangeRecord*,
00191 fl_ContainerLayout**)
00192 {
00193 return false;
00194 }
00195 };
00196 NullContentListener m_NullContentListener;
00197
00198
00199 public:
00200 PL_ListenerCoupleCloser();
00201 virtual ~PL_ListenerCoupleCloser();
00202 void setDelegate( PL_Listener* delegate );
00203 PD_Document* getDocument(void);
00204 void setDocument(PD_Document * pDoc);
00205 void reset();
00206
00207 virtual bool populate( fl_ContainerLayout* sfh,
00208 const PX_ChangeRecord * pcr );
00209 virtual bool populateStrux( pf_Frag_Strux* sdh,
00210 const PX_ChangeRecord * pcr,
00211 fl_ContainerLayout* * psfh);
00212
00213 PL_FinishingListener* getAfterContentListener();
00214 PL_FinishingListener* getBeforeContentListener();
00215 PL_FinishingListener* getNullContentListener();
00216
00217
00218 virtual bool change(fl_ContainerLayout* ,
00219 const PX_ChangeRecord * )
00220 {return true;}
00221
00222 virtual bool insertStrux(fl_ContainerLayout* ,
00223 const PX_ChangeRecord * ,
00224 pf_Frag_Strux* ,
00225 PL_ListenerId ,
00226 void (* )(pf_Frag_Strux* sdhNew,
00227 PL_ListenerId lid,
00228 fl_ContainerLayout* sfhNew))
00229 { return true;}
00230
00231 virtual bool signal(UT_uint32 )
00232 { return true;}
00233
00234 private:
00235
00236 virtual bool populateAfter( fl_ContainerLayout* sfh,
00237 const PX_ChangeRecord * pcr );
00238 virtual bool populateStruxAfter( pf_Frag_Strux* sdh,
00239 const PX_ChangeRecord * pcr,
00240 fl_ContainerLayout* * psfh);
00241
00242
00243 virtual bool populateBefore( fl_ContainerLayout* sfh,
00244 const PX_ChangeRecord * pcr );
00245 virtual bool populateStruxBefore( pf_Frag_Strux* sdh,
00246 const PX_ChangeRecord * pcr,
00247 fl_ContainerLayout* * psfh);
00248
00249
00250
00251 };
00252
00253 #endif