usrfillpat.h

Go to the documentation of this file.
00001 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined USER_FILL_PATTERN_HEADER
00019 #define USER_FILL_PATTERN_HEADER
00020 
00024 
00025 #include "whiptk/whipcore.h"
00026 #include "whiptk/pattern_scale.h"
00027 #include "dwfcore/CountedObject.h"
00036 
00037 class WHIPTK_API WT_User_Fill_Pattern : public WT_Attribute
00038 {
00039     friend class WT_Pattern_Scale;
00040         friend class WT_Rendition;
00041         friend class WT_W2D_Class_Factory;
00042         friend class WT_Opcode;
00043 
00044 public:
00046 
00047 
00048 
00049     class Fill_Pattern : public DWFCore::DWFCountedObject
00050     {
00051     public:
00053         static Fill_Pattern* Construct (
00054             WT_Unsigned_Integer16    rows, 
00055             WT_Unsigned_Integer16    columns, 
00056             WT_Unsigned_Integer32    data_size = 0, 
00057             WT_Byte const *          data = WD_Null) 
00059         { return DWFCORE_ALLOC_OBJECT (Fill_Pattern(rows,columns,data_size,data)); }
00061         WHIPTK_API WT_Unsigned_Integer16 rows() const
00062         {   return m_rows;  }
00064         WHIPTK_API WT_Unsigned_Integer16 columns() const
00065         {   return m_columns;  }
00067         WHIPTK_API WT_Unsigned_Integer32 data_size() const
00068         {   return m_data_size; }
00070         WHIPTK_API const WT_Byte * data() const
00071         {   return m_data; }
00073         WHIPTK_API WT_Boolean operator == ( Fill_Pattern const &  ) const;
00075         WHIPTK_API WT_Boolean operator != ( Fill_Pattern const &  pattern)
00076         {   return !(operator==(pattern));  }
00077 
00078     protected:
00080         WHIPTK_API Fill_Pattern( WT_Unsigned_Integer16    rows, 
00081                       WT_Unsigned_Integer16    columns, 
00082                       WT_Unsigned_Integer32    data_size, 
00083                       WT_Byte const *          data) throw() ; 
00084 
00085         WHIPTK_API virtual ~Fill_Pattern() throw()
00086         {
00087             if (m_data != WD_Null)
00088                 delete[] m_data;
00089         }
00090     private:
00092         Fill_Pattern(Fill_Pattern const & );
00093         Fill_Pattern const & operator=(Fill_Pattern const & );
00094 
00096         WT_Unsigned_Integer16   m_rows;
00097         WT_Unsigned_Integer16   m_columns;
00098         WT_Unsigned_Integer32   m_data_size;
00099         WT_Byte *               m_data;
00100     };
00102 
00103 public:
00105 
00107     WT_User_Fill_Pattern()
00108     : m_pattern_num(-1)  // important: -1 means "does not exist", which is the default state
00109     , m_is_scale_used(WD_False)
00110     , m_fill_pattern(WD_Null)
00111     {}
00113     WT_User_Fill_Pattern (WT_Integer16 pattern_num)
00114     : m_pattern_num(pattern_num)
00115     , m_is_scale_used(WD_False)
00116     , m_fill_pattern(WD_Null)
00117     {}
00118     
00120     WT_User_Fill_Pattern (
00121             WT_Integer16    pattern_num, 
00122             WT_Unsigned_Integer16    rows, 
00123             WT_Unsigned_Integer16    columns, 
00124                         WT_Unsigned_Integer32    data_size, 
00125             WT_Byte const *          data); 
00129 
00130     WT_User_Fill_Pattern (
00131             WT_Integer16    pattern_num, 
00132             Fill_Pattern * fill_pattern
00133             );
00134  
00136     WT_User_Fill_Pattern(WT_User_Fill_Pattern const &);
00137     
00139     virtual ~WT_User_Fill_Pattern();
00140 
00142 public:
00143    
00145     WT_User_Fill_Pattern const & operator =(WT_User_Fill_Pattern const &); 
00147 
00148     WT_Integer16 const& pattern_number() const
00149     {   return m_pattern_num; }
00150     WT_Integer16& pattern_number()
00151     {   return m_pattern_num; }
00152     WT_Boolean const& is_scale_used() const
00153     {   return m_is_scale_used; }
00154     WT_Boolean& is_scale_used() 
00155     {   return m_is_scale_used; }
00157     WT_Pattern_Scale const & pattern_scale() const 
00158     {  return m_pattern_scale; }
00160     WT_Pattern_Scale& pattern_scale() 
00161     {  m_is_scale_used = WD_True;  return m_pattern_scale; }
00163     const Fill_Pattern* fill_pattern() const
00164     { return m_fill_pattern; } 
00165     Fill_Pattern*& fill_pattern()
00166     {   return m_fill_pattern;  }
00168 
00170     WT_ID            object_id() const;
00171     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00172     WT_Result        process(WT_File & file);
00173     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00174     WT_Result        serialize (WT_File & file) const;
00175     WT_Result        sync (WT_File & file) const;
00176     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00178     
00180 
00181     WT_Boolean operator== (WT_User_Fill_Pattern const & pattern) const;
00183     WT_Boolean operator!= (WT_User_Fill_Pattern const & pattern) const
00184     {   return !(operator==(pattern));  }
00186     
00188 
00190     static WT_Result default_process(
00191         WT_User_Fill_Pattern & item, 
00192         WT_File & file 
00193         );
00194 
00195 private:
00197     WT_Integer16            m_pattern_num;
00198     WT_Pattern_Scale        m_pattern_scale;
00199     WT_Boolean              m_is_scale_used;
00200     Fill_Pattern*           m_fill_pattern;
00201     
00203     struct WHIPTK_API WT_User_Fill_Pattern_Option_Code
00204     : public WT_Optioncode
00205     {   enum WT_Fill_Pattern_Option_ID
00206         {   Unknown_Option, 
00207             Pattern_Scale_Option 
00208         };
00210         int option_id_from_optioncode();
00211     } m_optioncode;
00212 };
00213 
00215 
00216 #endif // SET_FILL_PATTERN_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5