• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

pl_Listener.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 
00021 #ifndef PL_LISTENER_H
00022 #define PL_LISTENER_H
00023 
00024 #include "ut_types.h"
00025 #include "pt_Types.h"
00026 
00027 class PX_ChangeRecord;
00028 class pf_Frag_Strux;
00029 class fl_ContainerLayout;
00030 
00031 #ifdef __sgi
00032 // <sys/signal.h> may #define signal, leaving PL_Listener::signal() pure
00033 // virtual if subclasses don't include the same header files.
00034 // Please keep the "/**/" to stop MSVC dependency generator complaining.
00035 #include  <sys/signal.h>
00036 #endif
00037 
00038 // PL_Listener -- A layout registers a listener with the
00039 //                PD_Document in order to be notified of
00040 //                any changes to the document as they
00041 //                occur.  The document will notify each
00042 //                registered listener (in an undefined
00043 //                order).  When the listener registers,
00044 //                it is provided an ID which may be used
00045 //                later to refer to it.
00046 
00047 class ABI_EXPORT PL_Listener
00048 {
00049 public:
00050     // when a listener is installed, the document calls the listener
00051     // for each fragment in the document.  this allows the layout to
00052     // fully populate its representation of the formatting/layout of
00053     // the document.
00054     //
00055     // when the document changes (due to editing), the document
00056     // will call each listener and notify them.  the (fmt) structure
00057     // handle passed represents the either the structure being
00058     // modified or the containing structure block.  if the change
00059     // is an insertStrux, the listener is given a function it must
00060     // call to return a handle for the new structure.
00061     //
00062     // the change notification occurs after the document has
00063     // been updated and in a stable state.  (for an editing operation
00064     // that breaks down into multiple change records, the listeners
00065     // will be called after each step.)
00066     //
00067     // sdh represents a handle to either the structure or the
00068     // containing structure block (opaque document instance data).
00069     //
00070     // pcr contains a change record to indicate what was done to
00071     // the document (in the case of editing).  pcr contains a faked-up
00072     // change record describing a fragment of the document (when part
00073     // of the listener installation sequence).
00074     //
00075     // sfh,psfh refer to a layout handle (opaque layout instance data)
00076     // to correspond with sdh.
00077     //
00078     // insertStrux() is a special form of change() which allows
00079     // instance data to be exchanged for a new strux.  in this case,
00080     // sfh refers to the strux preceeding the new one.
00081 
00082     virtual ~PL_Listener(){};
00083 
00084     virtual bool        populate(fl_ContainerLayout* sfh,
00085                                  const PX_ChangeRecord * pcr) = 0;
00086 
00087     virtual bool        populateStrux(pf_Frag_Strux* sdh,
00088                                       const PX_ChangeRecord * pcr,
00089                                       fl_ContainerLayout* * psfh) = 0;
00090 
00091     virtual bool        change(fl_ContainerLayout* sfh,
00092                                const PX_ChangeRecord * pcr) = 0;
00093 
00094     virtual void        deferNotifications(void)  { }
00095 
00096     virtual void        processDeferredNotifications(void) { }
00097 
00098     virtual bool        insertStrux(fl_ContainerLayout* sfh,
00099                                     const PX_ChangeRecord * pcr,
00100                                     pf_Frag_Strux* sdhNew,
00101                                     PL_ListenerId lid,
00102                                     void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00103                                                             PL_ListenerId lid,
00104                                                             fl_ContainerLayout* sfhNew)) = 0;
00105 
00106     virtual bool        signal(UT_uint32 iSignal) = 0;
00107     virtual PLListenerType getType() const
00108         {
00109             return PTL_UNKNOWN;
00110         }
00111 };
00112 
00116 class ABI_EXPORT PL_DocChangeListener : public PL_Listener
00117 {
00118 public:
00119  virtual         ~PL_DocChangeListener(){};
00120  virtual void    setNewDocument(PD_Document * pDoc) =0;
00121  virtual void    removeDocument(void) = 0;
00122 };
00123 
00124 
00125 
00126 #endif /* PL_LISTENER_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1