Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

Publisher.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2005 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #ifndef _DWFTK_PUBLISHER_H
00020 #define _DWFTK_PUBLISHER_H
00021 
00022 
00027 
00028 #ifndef DWFTK_READ_ONLY
00029 
00030 #include "dwfcore/STL.h"
00031 #include "dwfcore/Iterator.h"
00032 #include "dwfcore/Exception.h"
00033 using namespace DWFCore;
00034 
00035 #include "dwf/Toolkit.h"
00036 #include "dwf/package/Property.h"
00037 #include "dwf/package/utility/PropertyContainer.h"
00038 #include "dwf/publisher/EmbeddedFont.h"
00039 #include "dwf/publisher/PublishedObject.h"
00040 
00041 
00042 
00043 namespace DWFToolkit
00044 {
00045 
00055 class DWFPublishable
00056 {
00057 
00058 public:
00059 
00065     _DWFTK_API
00066     virtual ~DWFPublishable() {;}
00067 
00074     _DWFTK_API
00075     virtual const DWFString& getMIMEType()
00076         throw( DWFException ) = 0;
00077 
00085     _DWFTK_API
00086     virtual DWFInputStream* getInputStream()
00087         throw( DWFException ) = 0;
00088 
00089 protected:
00090 
00096     _DWFTK_API
00097     DWFPublishable() {;}
00098 };
00099 
00107 class DWFPublishableResource : public DWFToolkitMemory
00108                              , public DWFPublishable
00109 {
00110 
00111 public:
00112 
00116     typedef vector<DWFPublishableResource*> tList;
00117 
00118 public:
00119 
00125     _DWFTK_API
00126     virtual ~DWFPublishableResource() {;}
00127 
00128 protected:
00129 
00135     _DWFTK_API
00136     DWFPublishableResource() {;}
00137 };
00138 
00139 
00140 //
00141 // fwd decl
00142 //
00143 class DWFPublisher;
00144 
00145 
00146 
00154 class DWFPublishableSection : public DWFPublishable
00155 {
00156 
00157 public:
00158 
00164     _DWFTK_API
00165     virtual ~DWFPublishableSection() {;}
00166 
00173     _DWFTK_API
00174     virtual void publish( DWFPublisher& rPublisher )
00175         throw( DWFException ) = 0;
00176 
00184     _DWFTK_API
00185     virtual void embedFont( DWFEmbeddedFont* pFont )
00186         throw( DWFException )
00187     {
00188         (void)pFont;
00189         _DWFCORE_THROW( DWFNotImplementedException, L"Font embedding not supported by this object" );
00190     }
00191 
00201     _DWFTK_API
00202     virtual void addResource( DWFPublishableResource* pResource )
00203         throw( DWFException )
00204     {
00205         (void)pResource;
00206         _DWFCORE_THROW( DWFNotImplementedException, L"Additional resources are not supported by this object" );
00207     }
00208 
00217     _DWFTK_API
00218     virtual DWFIterator<DWFPublishableResource*>* getResources()
00219         throw( DWFException )
00220     {
00221         _DWFCORE_THROW( DWFNotImplementedException, L"Additional resources are not supported by this object" );
00222     }
00223 
00224 protected:
00225 
00231     _DWFTK_API
00232     DWFPublishableSection() {;}
00233 };
00234 
00243 class DWFPropertyVisitor
00244 {
00245 
00246 public:
00247 
00253     _DWFTK_API
00254     virtual ~DWFPropertyVisitor()
00255         throw()
00256     {;}
00257 
00265     _DWFTK_API
00266     virtual void visitProperty( DWFProperty& rProperty )
00267         throw( DWFException )
00268     {
00269         if (_pComposite)
00270         {
00271             _pComposite->visitProperty( rProperty );
00272         }
00273     }
00274 
00282     _DWFTK_API
00283     virtual void visitPropertyContainer( DWFPropertyContainer& rPropertyContainer )
00284         throw( DWFException )
00285     {
00286         if (_pComposite)
00287         {
00288             _pComposite->visitPropertyContainer( rPropertyContainer );
00289         }
00290     }
00291 
00292 protected:
00293 
00301     _DWFTK_API
00302     DWFPropertyVisitor( DWFPropertyVisitor* pComposite = NULL )
00303         throw()
00304         : _pComposite( pComposite )
00305     {;}
00306 
00307 private:
00308 
00309     DWFPropertyVisitor( const DWFPropertyVisitor& );
00310     DWFPropertyVisitor& operator=( const DWFPropertyVisitor& );
00311 
00312 private:
00313 
00314     DWFPropertyVisitor* _pComposite;
00315 };
00316 
00325 class DWFEmbeddedFontVisitor
00326 {
00327 
00328 public:
00329 
00335     _DWFTK_API
00336     virtual ~DWFEmbeddedFontVisitor()
00337         throw()
00338     {;}
00339 
00347     _DWFTK_API
00348     virtual void visitEmbeddedFont( const DWFEmbeddedFont& rFont )
00349         throw( DWFException )
00350     {
00351         if (_pComposite)
00352         {
00353             _pComposite->visitEmbeddedFont( rFont );
00354         }
00355     }
00356 
00357 protected:
00358 
00366     _DWFTK_API
00367     DWFEmbeddedFontVisitor( DWFEmbeddedFontVisitor* pComposite = NULL )
00368         throw()
00369         : _pComposite( pComposite )
00370     {;}
00371 
00372 private:
00373 
00374     DWFEmbeddedFontVisitor( const DWFEmbeddedFontVisitor& );
00375     DWFEmbeddedFontVisitor& operator=( const DWFEmbeddedFontVisitor& );
00376 
00377 private:
00378 
00379     DWFEmbeddedFontVisitor* _pComposite;
00380 };
00381 
00382 
00413 class DWFPublisher
00414 {
00415 
00416 public:
00417 
00423     _DWFTK_API
00424     DWFPublisher()
00425         throw()
00426         : _pPublishedObjectVisitor( NULL )
00427         , _pPropertyVisitor( NULL )
00428         , _pEmbeddedFontVisitor( NULL )
00429     {;}
00430 
00436     _DWFTK_API
00437     virtual ~DWFPublisher()
00438         throw()
00439     {;}
00440 
00446     _DWFTK_API
00447     virtual void publish()
00448         throw( DWFException )
00449     {;}
00450 
00458     _DWFTK_API
00459     virtual DWFPublishedObject::Visitor* getPublishedObjectVisitor()
00460         throw( DWFException )
00461     {
00462         return _pPublishedObjectVisitor;
00463     }
00464 
00473     _DWFTK_API
00474     void setPublishedObjectVisitor( DWFPublishedObject::Visitor* pVisitor )
00475         throw()
00476     {
00477         _pPublishedObjectVisitor = pVisitor;
00478     }
00479 
00486     _DWFTK_API
00487     virtual DWFPropertyVisitor* getPropertyVisitor()
00488         throw( DWFException )
00489     {
00490         return _pPropertyVisitor;
00491     }
00492 
00500     _DWFTK_API
00501     void setPropertyVisitor( DWFPropertyVisitor* pVisitor )
00502         throw()
00503     {
00504         _pPropertyVisitor = pVisitor;
00505     }
00506 
00513     _DWFTK_API
00514     virtual DWFEmbeddedFontVisitor* getEmbeddedFontVisitor()
00515         throw( DWFException )
00516     {
00517         return _pEmbeddedFontVisitor;
00518     }
00519 
00527     _DWFTK_API
00528     void setEmbeddedFontVisitor( DWFEmbeddedFontVisitor* pVisitor )
00529         throw()
00530     {
00531         _pEmbeddedFontVisitor = pVisitor;
00532     }
00533 
00542     _DWFTK_API
00543     virtual void preprocess( DWFPublishable* pPublishable )
00544         throw( DWFException )
00545     {
00546         (void)pPublishable;
00547     }
00548 
00557     _DWFTK_API
00558     virtual void postprocess( DWFPublishable* pPublishable )
00559         throw( DWFException )
00560     {
00561         (void)pPublishable;
00562     }
00563 
00564 private:
00565 
00566     DWFPublishedObject::Visitor*    _pPublishedObjectVisitor;
00567     DWFPropertyVisitor*             _pPropertyVisitor;
00568     DWFEmbeddedFontVisitor*         _pEmbeddedFontVisitor;
00569 
00570 private:
00571 
00572     DWFPublisher( const DWFPublisher& );
00573     DWFPublisher& operator=( const DWFPublisher& );
00574 };
00575 
00576 
00577 }
00578 
00579 
00580 #endif  
00581 #endif
00582 

Generated on Tue May 17 12:38:51 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1