dwfx/FixedPage.h

00001 //
00002 //  Copyright (c) 2006 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 //  $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.6/develop/global/src/dwf/dwfx/FixedPage.h#1 $
00019 //  $DateTime: 2008/02/20 08:38:28 $
00020 //  $Author: appacsviewers $
00021 //  $Change: 84992 $
00022 //  $Revision: #1 $
00023 //
00024 //
00025 
00026 #ifndef _DWFTK_DWFXFIXEDPAGE_H
00027 #define _DWFTK_DWFXFIXEDPAGE_H
00028 
00029 #include "dwf/xps/FixedPage.h"
00030 #include "dwf/dwfx/ResourcePart.h"
00031 #include "dwf/package/GraphicResource.h"
00032 
00033 namespace DWFToolkit
00034 {
00035 
00036 //
00037 // fwd declaration
00038 //
00039 class DWFSection;
00040 
00041 class DWFXFixedPage : public XPSFixedPage
00042 {
00043 
00044 public:
00045 
00046     _DWFTK_API
00047     DWFXFixedPage( DWFSection* pSection )
00048         throw(DWFException);
00049 
00050     _DWFTK_API
00051     virtual ~DWFXFixedPage()
00052         throw();
00053 
00054     _DWFTK_API
00055     DWFSection* section() const
00056         throw()
00057     {
00058         return _pSection;
00059     }
00060 
00071     _DWFTK_API
00072     void addGraphicResource( DWFGraphicResource* pResource )
00073         throw( DWFException );
00074 
00083     _DWFTK_API
00084     void removeGraphicResource( DWFGraphicResource* pResource )
00085         throw( DWFException );
00086 
00097     _DWFTK_API
00098     void addRasterPart( DWFXResourcePart* pPart )
00099         throw( DWFException );
00100 
00109     _DWFTK_API
00110     void removeRasterPart( DWFXResourcePart* pPart )
00111         throw( DWFException );
00112 
00119     _DWFTK_API
00120     void addRequiredResourcePart( DWFXResourcePart* pPart )
00121         throw( DWFException );
00122 
00123     _DWFTK_API
00124     void removeRequiredResourcePart( DWFXResourcePart* pPart )
00125         throw( DWFException );
00126 
00135     _DWFTK_API
00136     void setThumbnailResourcePart( DWFXResourcePart* pPart )
00137         throw( DWFException );
00138 
00139     _DWFTK_API
00140     void removeThumbnailResourcePart()
00141         throw( DWFException );
00142 
00143     _DWFTK_API
00144     void updateImplicitRelationships()
00145         throw();
00146 
00155     _DWFTK_API
00156     DWFGraphicResource::tIterator* graphicResources() const
00157         throw();
00158 
00167     _DWFTK_API
00168     DWFXResourcePart::tIterator* rasterParts() const
00169         throw();
00170 
00179     _DWFTK_API
00180     DWFGraphicResource::tIterator* allResources() const
00181         throw();
00182     
00183 
00184 #ifndef DWFTK_READ_ONLY
00185 
00186     _DWFTK_API
00187     virtual void serializeXML( DWFXMLSerializer& rSerializer )
00188         throw( DWFException );
00189 
00190 #endif
00191 
00192 private:
00193 
00194     //
00195     //  Typedef for a map of roles to a list of graphic resources
00196     //
00197     typedef _DWFTK_STD_MAP(DWFString, DWFGraphicResource::tList*)   _tRoleResourceListMap;
00198     //
00199     //  Typedef for a map of roles to a list of resource parts (for image resources)
00200     //
00201     typedef _DWFTK_STD_MAP(DWFString, DWFXResourcePart::tList*)     _tRolePartListMap;
00202     //
00203     //  Structure to pair up a resource list map part list map
00204     //
00205     typedef struct _tRoleMapPair
00206     {
00207         _tRoleResourceListMap   _oResources;
00208         _tRolePartListMap       _oParts;
00209 
00210         _tRoleMapPair()
00211             : _oResources()
00212             , _oParts()
00213         {
00214         };
00215     } _tRoleMapPair;
00216     //
00217     //  Typedef for a map from zOrder to a pair of the role maps
00218     //
00219     typedef _DWFTK_STD_MAP(int, _tRoleMapPair*)                      _tZOrderMap;
00220 
00221 private:
00222 
00223 #ifndef DWFTK_READ_ONLY
00224 
00225     //
00226     //  This is called to serialize the resources in the resource list map,
00227     //  that have the given role.
00228     //
00229     void _serializeGraphicResources( _tRoleResourceListMap& rResources,
00230                                      const DWFString& zRole, 
00231                                      DWFXMLSerializer& rSerializer )
00232         throw();
00233 
00234     //
00235     //  This is called to serialize the image brushes corresponding to the 
00236     //  raster image resources in the resource part map, that have the 
00237     //  given role.
00238     //
00239     void _serializeResourceParts( _tRolePartListMap& rParts,
00240                                   const DWFString& zRole, 
00241                                   DWFXMLSerializer& rSerializer )
00242         throw( DWFException );
00243 
00244     void _serializeToCanvas( DWFGraphicResource* pResource, 
00245                              DWFXMLSerializer& rSerializer )
00246         throw( DWFException );
00247 
00248     void _serializeToImageBrush( DWFXResourcePart* pPart, 
00249                                  DWFXMLSerializer& rSerializer )
00250         throw( DWFException );
00251 
00252     //
00253     //  This calculates the transform to apply in the XPS FixedPage from the 
00254     //  transform on the image resource, and also the corresponding viewport
00255     //  and viewbox to use in the serialization process.
00256     //
00257     void _getImagePositionInfo( DWFImageResource* pImage,
00258                                 double* adViewbox, 
00259                                 double* adViewport,
00260                                 double* adXPSTransform )
00261         throw( DWFException );
00262 
00263     //
00264     //  This takes the logical to DWF-paper transform from the graphics resource
00265     //  and converts to a logical to XPS-paper transform.
00266     void _getGraphicsTransform( DWFGraphicResource* pResource,
00267                                 double* adXPSTransform )
00268         throw( DWFException );
00269 
00270 #endif
00271 
00272 private:
00273 
00274     DWFSection*                 _pSection;
00275 
00276     _tRoleResourceListMap       _oRoleToResourceListMap;
00277     _tRolePartListMap           _oRoleToPartListMap;
00278     
00279     _tZOrderMap                 _oZOrderMap;
00280 
00281     DWFXResourcePart*           _pThumbnailResourcePart;
00282 
00283 private:
00284 
00285     //
00286     // Not implemented
00287     //
00288     DWFXFixedPage( const DWFXFixedPage& );
00289     DWFXFixedPage& operator=( const DWFXFixedPage& );
00290 
00291 };
00292 
00293 }
00294 
00295 #endif
00296 

Generated on Tue Jan 6 22:40:03 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5