Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Position.hh

Go to the documentation of this file.
00001 /*
00002     libpdf++: a C++ Free library to generate PDF file
00003     Copyright (C) 2002 Nestal Wan
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00026 #ifndef __PDF_TEXT_POSITION_HEADER_INCLUDED__
00027 #define __PDF_TEXT_POSITION_HEADER_INCLUDED__
00028 
00029 #include <iosfwd>
00030 
00031 namespace pdf { namespace text {
00032 
00041 class CPosition
00042 {
00043 public :
00044     virtual ~CPosition( ) ;
00045     virtual CPosition* Dup( ) const = 0 ;
00046     virtual std::ostream& Write( std::ostream& os, double leading ) const = 0 ;
00047 } ;
00048 
00055 class CNullPos : public CPosition
00056 {
00057 public :
00058     CPosition* Dup( ) const { return new CNullPos ; }
00059     std::ostream& Write( std::ostream& os, double ) const { return os ; }
00060 } ;
00061 
00067 class COffsetPos : public CPosition
00068 {
00069 private :
00071 
00072     double m_offset_x, m_offset_y ;
00074 
00075 public :
00077     COffsetPos( double offset_x, double offset_y )
00078         : m_offset_x( offset_x ), m_offset_y( offset_y ) { }
00079 
00080     double X( ) const { return m_offset_x ; }
00081     double Y( ) const { return m_offset_y ; }
00082     
00083     std::ostream& Write( std::ostream& os, double leading ) const ;
00084     
00085     CPosition* Dup( ) const { return new COffsetPos( *this ) ; }
00086 } ;
00087 
00093 class CAbsolutePos : public CPosition
00094 {
00095 private :
00097 
00098     double m_pos_x, m_pos_y ;
00100 
00101 public :
00102     CAbsolutePos( double pos_x, double pos_y )
00103         : m_pos_x( pos_x ), m_pos_y( pos_y ) { }
00104 
00105     double X( ) const { return m_pos_x ; }
00106     double Y( ) const { return m_pos_y ; }
00107     
00108     std::ostream& Write( std::ostream& os, double leading ) const ;
00109 
00110     CPosition* Dup( ) const { return new CAbsolutePos( *this ) ; }
00111 } ;
00112 
00113 } } // end of namespace
00114 
00115 #endif

Generated on Sun Feb 2 09:16:05 2003 for libpdf++ by doxygen1.2.16