| PdfArray.h | | PdfArray.h | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| | | | |
| /** Create an empty array | | /** Create an empty array | |
| */ | | */ | |
| PdfArray(); | | PdfArray(); | |
| | | | |
| /** Create an array and add one value to it. | | /** Create an array and add one value to it. | |
| * The value is copied. | | * The value is copied. | |
| * | | * | |
| * \param var add this object to the array. | | * \param var add this object to the array. | |
| */ | | */ | |
|
| PdfArray( const PdfObject & var ); | | explicit PdfArray( const PdfObject & var ); | |
| | | | |
| /** Deep copy an existing PdfArray | | /** Deep copy an existing PdfArray | |
| * | | * | |
| * \param rhs the array to copy | | * \param rhs the array to copy | |
| */ | | */ | |
| PdfArray( const PdfArray & rhs ); | | PdfArray( const PdfArray & rhs ); | |
| | | | |
| virtual ~PdfArray(); | | virtual ~PdfArray(); | |
| | | | |
|
| | | /** assignment operator | |
| | | * | |
| | | * \param rhs the array to assign | |
| | | */ | |
| | | PdfArray& operator=(const PdfArray& rhs); | |
| | | | |
| /** | | /** | |
| * \returns the size of the array | | * \returns the size of the array | |
| */ | | */ | |
| inline size_t GetSize() const; | | inline size_t GetSize() const; | |
| | | | |
| /** Remove all elements from the array | | /** Remove all elements from the array | |
| */ | | */ | |
| inline void Clear(); | | inline void Clear(); | |
| | | | |
| /** Write the array to an output device. | | /** Write the array to an output device. | |
| * This is an overloaded member function. | | * This is an overloaded member function. | |
| * | | * | |
| * \param pDevice write the object to this device | | * \param pDevice write the object to this device | |
|
| | | * \param eWriteMode additional options for writing this object | |
| * \param pEncrypt an encryption object which is used to encrypt this
object | | * \param pEncrypt an encryption object which is used to encrypt this
object | |
| * or NULL to not encrypt this object | | * or NULL to not encrypt this object | |
| */ | | */ | |
|
| void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NULL | | virtual void Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode, | |
| ) const; | | const PdfEncrypt* pEncrypt = NULL ) const; | |
| | | | |
| /** Utility method to determine if the array contains | | /** Utility method to determine if the array contains | |
| * contains any objects of ePdfDataType_String whose | | * contains any objects of ePdfDataType_String whose | |
| * value is the passed string. | | * value is the passed string. | |
| * \param cmpString the string to compare against | | * \param cmpString the string to compare against | |
| * \returns true if success, false if not | | * \returns true if success, false if not | |
| */ | | */ | |
| bool ContainsString( const std::string& cmpString ) const; | | bool ContainsString( const std::string& cmpString ) const; | |
| | | | |
| /** Utility method to return the actual index in the | | /** Utility method to return the actual index in the | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 192 | |
| */ | | */ | |
| inline reverse_iterator rend(); | | inline reverse_iterator rend(); | |
| | | | |
| /** | | /** | |
| * Returns a read-only (constant) reverse iterator that points | | * Returns a read-only (constant) reverse iterator that points | |
| * to one before the first element in the array. Iteration | | * to one before the first element in the array. Iteration | |
| * is done in reverse element order. | | * is done in reverse element order. | |
| */ | | */ | |
| inline const_reverse_iterator rend() const; | | inline const_reverse_iterator rend() const; | |
| | | | |
|
| #if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround templa
te-error in Visualstudio 6 | | #if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround template-error
in Visualstudio 6 | |
| inline void insert(iterator __position, | | inline void insert(iterator __position, | |
|
| iterator __first, | | iterator __first, | |
| iterator __last); | | iterator __last); | |
| #else | | #else | |
| template<typename _InputIterator> | | template<typename _InputIterator> | |
|
| void insert(iterator __position, | | void insert(const iterator& __position, | |
| _InputIterator __first, | | const _InputIterator& __first, | |
| _InputIterator __last); | | const _InputIterator& __last); | |
| #endif | | #endif | |
| | | | |
|
| inline PdfArray::iterator insert(iterator __position, const PdfObject &
val ); | | inline PdfArray::iterator insert(const iterator& __position, const PdfO
bject & val ); | |
| | | | |
|
| inline void erase( iterator pos ); | | inline void erase( const iterator& pos ); | |
| inline void erase( iterator first, iterator last ); | | inline void erase( const iterator& first, const iterator& last ); | |
| | | | |
| inline void reserve(size_type __n); | | inline void reserve(size_type __n); | |
| | | | |
| /** | | /** | |
| * \returns a read/write reference to the data at the first | | * \returns a read/write reference to the data at the first | |
| * element of the array. | | * element of the array. | |
| */ | | */ | |
| inline reference front(); | | inline reference front(); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 387 | | skipping to change at line 395 | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| PdfArray::const_reverse_iterator PdfArray::rend() const | | PdfArray::const_reverse_iterator PdfArray::rend() const | |
| { | | { | |
| return PdfArrayBaseClass::rend(); | | return PdfArrayBaseClass::rend(); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| #if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround templa
te-error in Visualstudio 6 | | #if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround template-e
rror in Visualstudio 6 | |
| void PdfArray::insert(PdfArray::iterator __position, | | void PdfArray::insert(PdfArray::iterator __position, | |
| PdfArray::iterator __first, | | PdfArray::iterator __first, | |
| PdfArray::iterator __last) | | PdfArray::iterator __last) | |
| #else | | #else | |
| template<typename _InputIterator> | | template<typename _InputIterator> | |
|
| void PdfArray::insert(PdfArray::iterator __position, | | void PdfArray::insert(const PdfArray::iterator& __position, | |
| _InputIterator __first, | | const _InputIterator& __first, | |
| _InputIterator __last) | | const _InputIterator& __last) | |
| #endif | | #endif | |
| { | | { | |
| AssertMutable(); | | AssertMutable(); | |
| | | | |
| PdfArrayBaseClass::insert( __position, __first, __last ); | | PdfArrayBaseClass::insert( __position, __first, __last ); | |
| m_bDirty = true; | | m_bDirty = true; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| PdfArray::iterator PdfArray::insert(PdfArray::iterator __position, const Pd
fObject & val ) | | PdfArray::iterator PdfArray::insert(const iterator& __position, const PdfOb
ject & val ) | |
| { | | { | |
| AssertMutable(); | | AssertMutable(); | |
| | | | |
| m_bDirty = true; | | m_bDirty = true; | |
| return PdfArrayBaseClass::insert( __position, val ); | | return PdfArrayBaseClass::insert( __position, val ); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| void PdfArray::erase( iterator pos ) | | void PdfArray::erase( const iterator& pos ) | |
| { | | { | |
| AssertMutable(); | | AssertMutable(); | |
| | | | |
| PdfArrayBaseClass::erase( pos ); | | PdfArrayBaseClass::erase( pos ); | |
| m_bDirty = true; | | m_bDirty = true; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| void PdfArray::erase( iterator first, iterator last ) | | void PdfArray::erase( const iterator& first, const iterator& last ) | |
| { | | { | |
| AssertMutable(); | | AssertMutable(); | |
| | | | |
| PdfArrayBaseClass::erase( first, last ); | | PdfArrayBaseClass::erase( first, last ); | |
| m_bDirty = true; | | m_bDirty = true; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| | | | |
| skipping to change at line 482 | | skipping to change at line 490 | |
| const PdfObject & PdfArray::back() const | | const PdfObject & PdfArray::back() const | |
| { | | { | |
| return PdfArrayBaseClass::back(); | | return PdfArrayBaseClass::back(); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| bool PdfArray::operator==( const PdfArray & rhs ) const | | bool PdfArray::operator==( const PdfArray & rhs ) const | |
| { | | { | |
|
| | | //TODO: This operator does not check for m_bDirty. Add comparison or ad
d explanation why it should not be there | |
| return (static_cast< PdfArrayBaseClass >(*this) == static_cast< PdfArra
yBaseClass >(rhs) ); | | return (static_cast< PdfArrayBaseClass >(*this) == static_cast< PdfArra
yBaseClass >(rhs) ); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| bool PdfArray::operator!=( const PdfArray & rhs ) const | | bool PdfArray::operator!=( const PdfArray & rhs ) const | |
| { | | { | |
|
| | | //TODO: This operator does not check for m_bDirty. Add comparison or ad
d explanation why it should not be there | |
| return (static_cast< PdfArrayBaseClass >(*this) != static_cast< PdfArra
yBaseClass >(rhs) ); | | return (static_cast< PdfArrayBaseClass >(*this) != static_cast< PdfArra
yBaseClass >(rhs) ); | |
| } | | } | |
| | | | |
| typedef PdfArray TVariantList; | | typedef PdfArray TVariantList; | |
| typedef PdfArray::iterator TIVariantList; | | typedef PdfArray::iterator TIVariantList; | |
| typedef PdfArray::const_iterator TCIVariantList; | | typedef PdfArray::const_iterator TCIVariantList; | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // _PDF_ARRAY_H_ | | #endif // _PDF_ARRAY_H_ | |
| | | | |
End of changes. 16 change blocks. |
| 19 lines changed or deleted | | 28 lines changed or added | |
|
| PdfColor.h | | PdfColor.h | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| public: | | public: | |
| /** Create a PdfColor object that is RGB black. | | /** Create a PdfColor object that is RGB black. | |
| */ | | */ | |
| PdfColor(); | | PdfColor(); | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a grayscale value. | | * a grayscale value. | |
| * | | * | |
| * \param dGray a grayscalue value between 0.0 and 1.0 | | * \param dGray a grayscalue value between 0.0 and 1.0 | |
| */ | | */ | |
|
| PdfColor( double dGray ); | | explicit PdfColor( double dGray ); | |
| | | | |
|
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a RGB color | | * a RGB color | |
| * | | * | |
| * \param dRed the value of the red component, must be between 0.0 and
1.0 | | * \param dRed the value of the red component, must be between 0.0 and
1.0 | |
| * \param dGreen the value of the green component, must be between 0.0
and 1.0 | | * \param dGreen the value of the green component, must be between 0.0
and 1.0 | |
| * \param dBlue the value of the blue component, must be between 0.0 a
nd 1.0 | | * \param dBlue the value of the blue component, must be between 0.0 a
nd 1.0 | |
| */ | | */ | |
| PdfColor( double dRed, double dGreen, double dBlue ); | | PdfColor( double dRed, double dGreen, double dBlue ); | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a CMYK color | | * a CMYK color | |
| * | | * | |
| * \param dCyan the value of the cyan component, must be between 0.0 a
nd 1.0 | | * \param dCyan the value of the cyan component, must be between 0.0 a
nd 1.0 | |
| * \param dMagenta the value of the magenta component, must be between
0.0 and 1.0 | | * \param dMagenta the value of the magenta component, must be between
0.0 and 1.0 | |
| * \param dYellow the value of the yellow component, must be between 0
.0 and 1.0 | | * \param dYellow the value of the yellow component, must be between 0
.0 and 1.0 | |
| * \param dBlack the value of the black component, must be between 0.0
and 1.0 | | * \param dBlack the value of the black component, must be between 0.0
and 1.0 | |
| */ | | */ | |
| PdfColor( double dCyan, double dMagenta, double dYellow, double dBlack
); | | PdfColor( double dCyan, double dMagenta, double dYellow, double dBlack
); | |
| | | | |
|
| /** Copy constructor | | /** Copy constructor | |
| * | | * | |
| * \param rhs copy rhs into this object | | * \param rhs copy rhs into this object | |
| */ | | */ | |
|
| inline PdfColor( const PdfColor & rhs ); | | PdfColor( const PdfColor & rhs ); | |
| | | | |
| | | /** Destructor | |
| | | */ | |
| | | virtual ~PdfColor(); | |
| | | | |
| /** Assignment operator | | /** Assignment operator | |
| * | | * | |
| * \param rhs copy rhs into this object | | * \param rhs copy rhs into this object | |
| * | | * | |
| * \returns a reference to this color object | | * \returns a reference to this color object | |
| */ | | */ | |
| const PdfColor & operator=( const PdfColor & rhs ); | | const PdfColor & operator=( const PdfColor & rhs ); | |
| | | | |
| /** Test for equality of colors. | | /** Test for equality of colors. | |
| * | | * | |
| * \param rhs color to compare ro | | * \param rhs color to compare ro | |
|
| * | | * | |
| * \returns true if object color is equal to rhs | | * \returns true if object color is equal to rhs | |
| */ | | */ | |
| inline bool operator==( const PdfColor & rhs ) const; | | inline bool operator==( const PdfColor & rhs ) const; | |
| | | | |
| /** Test for inequality of colors. | | /** Test for inequality of colors. | |
| * | | * | |
| * \param rhs color to compare ro | | * \param rhs color to compare ro | |
|
| * | | * | |
| * \returns true if object color is not equal to rhs | | * \returns true if object color is not equal to rhs | |
| */ | | */ | |
| inline bool operator!=( const PdfColor & rhs ) const; | | inline bool operator!=( const PdfColor & rhs ) const; | |
| | | | |
| /** Test if this is a grayscale color. | | /** Test if this is a grayscale color. | |
| * | | * | |
| * \returns true if this is a grayscale PdfColor object | | * \returns true if this is a grayscale PdfColor object | |
| */ | | */ | |
| inline bool IsGrayScale() const; | | inline bool IsGrayScale() const; | |
| | | | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 138 | |
| * \returns true if this is a separation PdfColor object | | * \returns true if this is a separation PdfColor object | |
| */ | | */ | |
| inline bool IsSeparation() const; | | inline bool IsSeparation() const; | |
| | | | |
| /** Test if this is a CIE-Lab color. | | /** Test if this is a CIE-Lab color. | |
| * | | * | |
| * \returns true if this is a lab Color object | | * \returns true if this is a lab Color object | |
| */ | | */ | |
| inline bool IsCieLab() const; | | inline bool IsCieLab() const; | |
| | | | |
|
| /** Get the colorspace of this PdfColor object | | /** Get the colorspace of this PdfColor object | |
| * | | * | |
| * \returns the colorspace of this PdfColor object | | * \returns the colorspace of this PdfColor object | |
| */ | | */ | |
| inline EPdfColorSpace GetColorSpace() const; | | inline EPdfColorSpace GetColorSpace() const; | |
| | | | |
|
| /** Get the alternate colorspace of this PdfColor object | | /** Get the alternate colorspace of this PdfColor object | |
| * | | * | |
| * \returns the colorspace of this PdfColor object (must be separation
) | | * \returns the colorspace of this PdfColor object (must be separation
) | |
| */ | | */ | |
| inline EPdfColorSpace GetAlternateColorSpace() const; | | inline EPdfColorSpace GetAlternateColorSpace() const; | |
| | | | |
|
| /** Get the grayscale color value | | /** Get the grayscale color value | |
| * of this object. | | * of this object. | |
| * | | * | |
| * Throws an exception if this is no grayscale color object. | | * Throws an exception if this is no grayscale color object. | |
| * | | * | |
| * \returns the grayscale color value of this object (between 0.0 and
1.0) | | * \returns the grayscale color value of this object (between 0.0 and
1.0) | |
| * | | * | |
| * \see IsGrayScale | | * \see IsGrayScale | |
| */ | | */ | |
| inline double GetGrayScale() const; | | inline double GetGrayScale() const; | |
| | | | |
| | | | |
| skipping to change at line 242 | | skipping to change at line 246 | |
| inline double GetBlack() const; | | inline double GetBlack() const; | |
| | | | |
| /** Get the separation name of this object. | | /** Get the separation name of this object. | |
| * | | * | |
| * Throws an exception if this is no separation color object. | | * Throws an exception if this is no separation color object. | |
| * | | * | |
| * \returns the name of this object | | * \returns the name of this object | |
| * | | * | |
| * \see IsSeparation | | * \see IsSeparation | |
| */ | | */ | |
|
| inline const std::string GetName() const; | | inline const std::string GetName() const; | |
| | | | |
| /** Get the density color value | | /** Get the density color value | |
| * of this object. | | * of this object. | |
| * | | * | |
| * Throws an exception if this is no separation color object. | | * Throws an exception if this is no separation color object. | |
| * | | * | |
| * \returns the density value of this object (between 0.0 and 1.0) | | * \returns the density value of this object (between 0.0 and 1.0) | |
| * | | * | |
| * \see IsSeparation | | * \see IsSeparation | |
| */ | | */ | |
| inline double GetDensity() const; | | inline double GetDensity() const; | |
| | | | |
|
| /** Get the L color value | | /** Get the L color value | |
| * of this object. | | * of this object. | |
| * | | * | |
| * Throws an exception if this is no CIE-Lab color object. | | * Throws an exception if this is no CIE-Lab color object. | |
| * | | * | |
| * \returns the L color value of this object (between 0.0 and 100.0) | | * \returns the L color value of this object (between 0.0 and 100.0) | |
| * | | * | |
| * \see IsCieLab | | * \see IsCieLab | |
| */ | | */ | |
| inline double GetCieL() const; | | inline double GetCieL() const; | |
| | | | |
| | | | |
| skipping to change at line 288 | | skipping to change at line 292 | |
| * of this object. | | * of this object. | |
| * | | * | |
| * Throws an exception if this is no CIE-Lab color object. | | * Throws an exception if this is no CIE-Lab color object. | |
| * | | * | |
| * \returns the B color value of this object (between -128.0 and 127.0
) | | * \returns the B color value of this object (between -128.0 and 127.0
) | |
| * | | * | |
| * \see IsCieLab | | * \see IsCieLab | |
| */ | | */ | |
| inline double GetCieB() const; | | inline double GetCieB() const; | |
| | | | |
|
| /** Converts the color object into a grayscale | | /** Converts the color object into a grayscale | |
| * color object. | | * color object. | |
| * | | * | |
| * This is only a convinience function. It might be useful | | * This is only a convinience function. It might be useful | |
| * for on screen display but is in NO WAY suitable to | | * for on screen display but is in NO WAY suitable to | |
| * professional printing! | | * professional printing! | |
| * | | * | |
| * \returns a grayscale color object | | * \returns a grayscale color object | |
| * \see IsGrayScale() | | * \see IsGrayScale() | |
| */ | | */ | |
| PdfColor ConvertToGrayScale() const; | | PdfColor ConvertToGrayScale() const; | |
| | | | |
| skipping to change at line 357 | | skipping to change at line 361 | |
| * \param rArray an array that must be a color PdfArray | | * \param rArray an array that must be a color PdfArray | |
| * \returns a PdfColor object | | * \returns a PdfColor object | |
| */ | | */ | |
| static PdfColor FromArray( const PdfArray & rArray ); | | static PdfColor FromArray( const PdfArray & rArray ); | |
| | | | |
| /** Creates a colorspace object from a color to insert into resources. | | /** Creates a colorspace object from a color to insert into resources. | |
| * | | * | |
| * \param pOwner a pointer to the owner of the generated object | | * \param pOwner a pointer to the owner of the generated object | |
| * \returns a PdfObject pointer, which can be insert into resources, N
ULL if not needed | | * \returns a PdfObject pointer, which can be insert into resources, N
ULL if not needed | |
| */ | | */ | |
|
| PdfObject* BuildColorSpace( PdfVecObjects* pOwner ) const; | | PdfObject* BuildColorSpace( PdfVecObjects* pOwner ) const; | |
| | | | |
| protected: | | protected: | |
| union { | | union { | |
| double cmyk[4]; | | double cmyk[4]; | |
| double rgb[3]; | | double rgb[3]; | |
| double lab[3]; | | double lab[3]; | |
| double gray; | | double gray; | |
| } m_uColor; | | } m_uColor; | |
|
| std::string m_separationName; | | std::string m_separationName; | |
| double m_separationDensity; | | double m_separationDensity; | |
| EPdfColorSpace m_eColorSpace; | | EPdfColorSpace m_eColorSpace; | |
| EPdfColorSpace m_eAlternateColorSpace; | | EPdfColorSpace m_eAlternateColorSpace; | |
|
| | | | |
| | | private: | |
| | | static const unsigned int* const m_hexDigitMap; ///< Mapping of hex seq | |
| | | uences to int value | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorGray : public PdfColor { | | class PODOFO_API PdfColorGray : public PdfColor { | |
| public: | | public: | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a grayscale value. | | * a grayscale value. | |
| * | | * | |
| * \param dGray a grayscalue value between 0.0 and 1.0 | | * \param dGray a grayscalue value between 0.0 and 1.0 | |
| */ | | */ | |
|
| PdfColorGray( double dGray ); | | explicit PdfColorGray( double dGray ); | |
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorGray(); | |
| | | | |
| | | private: | |
| | | /** Default constructor, not implemented | |
| | | */ | |
| | | PdfColorGray(); | |
| | | | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorGray(const PdfColorGray& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorGray& operator=(const PdfColorGray&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorRGB : public PdfColor { | | class PODOFO_API PdfColorRGB : public PdfColor { | |
| public: | | public: | |
|
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a RGB color | | * a RGB color | |
| * | | * | |
| * \param dRed the value of the red component, must be between 0.0 and
1.0 | | * \param dRed the value of the red component, must be between 0.0 and
1.0 | |
| * \param dGreen the value of the green component, must be between 0.0
and 1.0 | | * \param dGreen the value of the green component, must be between 0.0
and 1.0 | |
| * \param dBlue the value of the blue component, must be between 0.0 a
nd 1.0 | | * \param dBlue the value of the blue component, must be between 0.0 a
nd 1.0 | |
| */ | | */ | |
| PdfColorRGB( double dRed, double dGreen, double dBlue ); | | PdfColorRGB( double dRed, double dGreen, double dBlue ); | |
|
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorRGB(); | |
| | | | |
| | | private: | |
| | | /** Default constructor, not implemented | |
| | | */ | |
| | | PdfColorRGB(); | |
| | | | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorRGB(const PdfColorRGB& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorRGB& operator=(const PdfColorRGB&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorCMYK : public PdfColor { | | class PODOFO_API PdfColorCMYK : public PdfColor { | |
| public: | | public: | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a CMYK color | | * a CMYK color | |
| * | | * | |
| * \param dCyan the value of the cyan component, must be between 0.0 a
nd 1.0 | | * \param dCyan the value of the cyan component, must be between 0.0 a
nd 1.0 | |
| * \param dMagenta the value of the magenta component, must be between
0.0 and 1.0 | | * \param dMagenta the value of the magenta component, must be between
0.0 and 1.0 | |
| * \param dYellow the value of the yellow component, must be between 0
.0 and 1.0 | | * \param dYellow the value of the yellow component, must be between 0
.0 and 1.0 | |
| * \param dBlack the value of the black component, must be between 0.0
and 1.0 | | * \param dBlack the value of the black component, must be between 0.0
and 1.0 | |
| */ | | */ | |
| PdfColorCMYK( double dCyan, double dMagenta, double dYellow, double dBl
ack ); | | PdfColorCMYK( double dCyan, double dMagenta, double dYellow, double dBl
ack ); | |
|
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorCMYK(); | |
| | | | |
| | | private: | |
| | | /** Default constructor, not implemented | |
| | | */ | |
| | | PdfColorCMYK(); | |
| | | | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorCMYK(const PdfColorCMYK& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorCMYK& operator=(const PdfColorCMYK&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorSeparationAll : public PdfColor { | | class PODOFO_API PdfColorSeparationAll : public PdfColor { | |
| public: | | public: | |
| | | | |
|
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * Separation color All. | | * Separation color All. | |
| * | | * | |
| */ | | */ | |
| PdfColorSeparationAll(); | | PdfColorSeparationAll(); | |
|
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorSeparationAll(); | |
| | | | |
| | | private: | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorSeparationAll(const PdfColorSeparationAll& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorSeparationAll& operator=(const PdfColorSeparationAll&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorSeparationNone : public PdfColor { | | class PODOFO_API PdfColorSeparationNone : public PdfColor { | |
| public: | | public: | |
| | | | |
|
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * Separation color None. | | * Separation color None. | |
| * | | * | |
| */ | | */ | |
| PdfColorSeparationNone(); | | PdfColorSeparationNone(); | |
|
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorSeparationNone(); | |
| | | | |
| | | private: | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorSeparationNone(const PdfColorSeparationNone& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorSeparationNone& operator=(const PdfColorSeparationNone&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorSeparation : public PdfColor { | | class PODOFO_API PdfColorSeparation : public PdfColor { | |
| public: | | public: | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a separation-name and an equivalent color | | * a separation-name and an equivalent color | |
| * | | * | |
| * \param sName Name of the separation color | | * \param sName Name of the separation color | |
|
| * \param sDensity the density value of the separation color | | * \param sDensity the density value of the separation color | |
| * \param alternateColor the alternate color, must be of typ gray, rgb
, cmyk or cie | | * \param alternateColor the alternate color, must be of typ gray, rgb
, cmyk or cie | |
| */ | | */ | |
|
| PdfColorSeparation( const std::string & sName, double dDensity, cons | | PdfColorSeparation( const std::string & sName, double dDensity, const P | |
| t PdfColor & alternateColor ); | | dfColor & alternateColor ); | |
| | | | |
| | | /** Class destructor. | |
| | | */ | |
| | | virtual ~PdfColorSeparation(); | |
| | | | |
| | | private: | |
| | | /** Default constructor, not implemented | |
| | | */ | |
| | | PdfColorSeparation(); | |
| | | | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorSeparation(const PdfColorSeparation& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorSeparation& operator=(const PdfColorSeparation&); | |
| }; | | }; | |
| | | | |
| class PODOFO_API PdfColorCieLab : public PdfColor { | | class PODOFO_API PdfColorCieLab : public PdfColor { | |
| public: | | public: | |
| | | | |
| /** Create a new PdfColor object with | | /** Create a new PdfColor object with | |
| * a CIE-LAB-values | | * a CIE-LAB-values | |
| * | | * | |
| * \param dCieL the value of the L component, must be between 0.0 and
100.0 | | * \param dCieL the value of the L component, must be between 0.0 and
100.0 | |
| * \param dCieA the value of the A component, must be between -128.0 a
nd 127.0 | | * \param dCieA the value of the A component, must be between -128.0 a
nd 127.0 | |
| * \param dCieB the value of the B component, must be between -128.0 a
nd 127.0 | | * \param dCieB the value of the B component, must be between -128.0 a
nd 127.0 | |
| */ | | */ | |
|
| PdfColorCieLab( double dCieL, double dCieA, double dCieB ); | | PdfColorCieLab( double dCieL, double dCieA, double dCieB ); | |
| }; | | | |
| | | | |
|
| // ----------------------------------------------------- | | /** Class destructor. | |
| // | | */ | |
| // ----------------------------------------------------- | | virtual ~PdfColorCieLab(); | |
| PdfColor::PdfColor( const PdfColor & rhs ) | | | |
| { | | private: | |
| this->operator=( rhs ); | | /** Default constructor, not implemented | |
| } | | */ | |
| | | PdfColorCieLab(); | |
| | | | |
| | | /** Copy constructor, not implemented | |
| | | */ | |
| | | PdfColorCieLab(const PdfColorCieLab& ); | |
| | | | |
| | | /** Copy assignment operator, not implemented | |
| | | */ | |
| | | PdfColorCieLab& operator=(const PdfColorCieLab&); | |
| | | }; | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| inline bool PdfColor::operator==( const PdfColor & rhs ) const | | inline bool PdfColor::operator==( const PdfColor & rhs ) const | |
| { | | { | |
|
| if ( m_eColorSpace == rhs.m_eColorSpace ) | | if ( m_eColorSpace == rhs.m_eColorSpace ) | |
| { | | { | |
| if ( | | if ( | |
| m_eColorSpace == ePdfColorSpace_DeviceGray | | (m_eColorSpace == ePdfColorSpace_DeviceGray) && | |
| && | | (m_uColor.gray == rhs.m_uColor.gray) | |
| m_uColor.gray == rhs.m_uColor.gray | | ) | |
| ) | | return true; | |
| return true; | | | |
| | | if ( | |
| if ( | | (m_eColorSpace == ePdfColorSpace_DeviceRGB) && | |
| m_eColorSpace == ePdfColorSpace_DeviceRGB | | (m_uColor.rgb[0] == rhs.m_uColor.rgb[0]) && | |
| && | | (m_uColor.rgb[1] == rhs.m_uColor.rgb[1]) && | |
| m_uColor.rgb[0] == rhs.m_uColor.rgb[0] | | (m_uColor.rgb[2] == rhs.m_uColor.rgb[2]) | |
| && | | ) | |
| m_uColor.rgb[1] == rhs.m_uColor.rgb[1] | | return true; | |
| && | | | |
| m_uColor.rgb[2] == rhs.m_uColor.rgb[2] | | if ( | |
| ) | | (m_eColorSpace == ePdfColorSpace_DeviceCMYK) && | |
| return true; | | (m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0]) && | |
| | | (m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1]) && | |
| if ( | | (m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2]) && | |
| m_eColorSpace == ePdfColorSpace_DeviceCMYK | | (m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3]) | |
| && | | ) | |
| m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0] | | return true; | |
| && | | | |
| m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1] | | if ( | |
| && | | (m_eColorSpace == ePdfColorSpace_CieLab) && | |
| m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2] | | (m_uColor.lab[0] == rhs.m_uColor.lab[0]) && | |
| && | | (m_uColor.lab[1] == rhs.m_uColor.lab[1]) && | |
| m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3] | | (m_uColor.lab[2] == rhs.m_uColor.lab[2]) | |
| ) | | ) | |
| return true; | | return true; | |
| | | | |
| if ( | | if ( | |
| m_eColorSpace == ePdfColorSpace_CieLab | | (m_eColorSpace == ePdfColorSpace_Separation) && | |
| && | | (m_separationDensity == rhs.m_separationDensity) && | |
| m_uColor.lab[0] == rhs.m_uColor.lab[0] | | (m_separationName == rhs.m_separationName) && | |
| && | | (m_eAlternateColorSpace == rhs.m_eAlternateColorSpace) && | |
| m_uColor.lab[1] == rhs.m_uColor.lab[1] | | ( | |
| && | | ( | |
| m_uColor.lab[2] == rhs.m_uColor.lab[2] | | (m_eAlternateColorSpace == ePdfColorSpace_DeviceGray) && | |
| ) | | (m_uColor.gray == rhs.m_uColor.gray) | |
| return true; | | ) || | |
| | | ( | |
| if ( | | (m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB) && | |
| m_eColorSpace == ePdfColorSpace_Separation | | (m_uColor.rgb[0] == rhs.m_uColor.rgb[0]) && | |
| && | | (m_uColor.rgb[1] == rhs.m_uColor.rgb[1]) && | |
| m_separationDensity == rhs.m_separationDensity | | (m_uColor.rgb[2] == rhs.m_uColor.rgb[2]) | |
| && | | ) || | |
| m_separationName == rhs.m_separationName | | ( | |
| && | | (m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK) && | |
| m_eAlternateColorSpace == rhs.m_eAlternateColorSpace | | (m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0]) && | |
| && | | (m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1]) && | |
| ( | | (m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2]) && | |
| ( | | (m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3]) | |
| m_eAlternateColorSpace == ePdfColorSpace_DeviceGra | | ) || | |
| y && | | ( | |
| m_uColor.gray == rhs.m_uColor.gray | | (m_eAlternateColorSpace == ePdfColorSpace_CieLab) && | |
| ) | | (m_uColor.lab[0] == rhs.m_uColor.lab[0]) && | |
| || | | (m_uColor.lab[1] == rhs.m_uColor.lab[1]) && | |
| ( | | (m_uColor.lab[2] == rhs.m_uColor.lab[2]) | |
| m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB | | ) | |
| && | | ) | |
| m_uColor.rgb[0] == rhs.m_uColor.rgb[0] | | ) | |
| && | | return true; | |
| m_uColor.rgb[1] == rhs.m_uColor.rgb[1] | | | |
| && | | | |
| m_uColor.rgb[2] == rhs.m_uColor.rgb[2] | | | |
| ) | | | |
| || | | | |
| ( | | | |
| m_eAlternateColorSpace == ePdfColorSpace_DeviceCMY | | | |
| K && | | | |
| m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0] | | | |
| && | | | |
| m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1] | | | |
| && | | | |
| m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2] | | | |
| && | | | |
| m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3] | | | |
| ) | | | |
| || | | | |
| ( | | | |
| m_eAlternateColorSpace == ePdfColorSpace_CieLab | | | |
| && | | | |
| m_uColor.lab[0] == rhs.m_uColor.lab[0] | | | |
| && | | | |
| m_uColor.lab[1] == rhs.m_uColor.lab[1] | | | |
| && | | | |
| m_uColor.lab[2] == rhs.m_uColor.lab[2] | | | |
| ) | | | |
| ) | | | |
| ) | | | |
| return true; | | | |
| | | | |
|
| } | | } | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| inline bool PdfColor::operator!=( const PdfColor & rhs ) const | | inline bool PdfColor::operator!=( const PdfColor & rhs ) const | |
| { | | { | |
|
| return ! (*this == rhs); | | return ! (*this == rhs); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| bool PdfColor::IsGrayScale() const | | bool PdfColor::IsGrayScale() const | |
| { | | { | |
| return (m_eColorSpace == ePdfColorSpace_DeviceGray); | | return (m_eColorSpace == ePdfColorSpace_DeviceGray); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 608 | | skipping to change at line 718 | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetAlternateCo
lorSpace cannot be called on non separation color objects!"); | | PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetAlternateCo
lorSpace cannot be called on non separation color objects!"); | |
| return m_eAlternateColorSpace; | | return m_eAlternateColorSpace; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetGrayScale() const | | double PdfColor::GetGrayScale() const | |
| { | | { | |
|
| PODOFO_RAISE_LOGIC_IF( !this->IsGrayScale() && | | PODOFO_RAISE_LOGIC_IF( !this->IsGrayScale() && | |
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceGray), | | orSpace == ePdfColorSpace_DeviceGray)), | |
| "PdfColor::GetGrayScale c | | "PdfColor::GetGrayScale cannot be called on non | |
| annot be called on non grayscale color objects!"); | | grayscale color objects!"); | |
| | | | |
| return m_uColor.gray; | | return m_uColor.gray; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetRed() const | | double PdfColor::GetRed() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | | PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB), | | orSpace == ePdfColorSpace_DeviceRGB)), | |
| "PdfColor::GetRed cannot | | "PdfColor::GetRed cannot be called on non RGB co | |
| be called on non RGB color objects!"); | | lor objects!"); | |
| | | | |
| return m_uColor.rgb[0]; | | return m_uColor.rgb[0]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetGreen() const | | double PdfColor::GetGreen() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | | PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB), | | orSpace == ePdfColorSpace_DeviceRGB)), | |
| "PdfColor::GetGreen canno | | "PdfColor::GetGreen cannot be called on non RGB | |
| t be called on non RGB color objects!"); | | color objects!"); | |
| | | | |
| return m_uColor.rgb[1]; | | return m_uColor.rgb[1]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetBlue() const | | double PdfColor::GetBlue() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | | PODOFO_RAISE_LOGIC_IF( !this->IsRGB() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB), | | orSpace == ePdfColorSpace_DeviceRGB)), | |
| "PdfColor::GetBlue cannot | | "PdfColor::GetBlue cannot be called on non RGB c | |
| be called on non RGB color objects!"); | | olor objects!"); | |
| | | | |
| return m_uColor.rgb[2]; | | return m_uColor.rgb[2]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetCyan() const | | double PdfColor::GetCyan() const | |
| { | | { | |
|
| PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | |
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK), | | orSpace == ePdfColorSpace_DeviceCMYK)), | |
| "PdfColor::GetCyan cannot | | "PdfColor::GetCyan cannot be called on non CMYK | |
| be called on non CMYK color objects!"); | | color objects!"); | |
| | | | |
| return m_uColor.cmyk[0]; | | return m_uColor.cmyk[0]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetMagenta() const | | double PdfColor::GetMagenta() const | |
| { | | { | |
|
| PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | |
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK), | | orSpace == ePdfColorSpace_DeviceCMYK)), | |
| "PdfColor::GetMagenta can | | "PdfColor::GetMagenta cannot be called on non CM | |
| not be called on non CMYK color objects!"); | | YK color objects!"); | |
| | | | |
| return m_uColor.cmyk[1]; | | return m_uColor.cmyk[1]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetYellow() const | | double PdfColor::GetYellow() const | |
| { | | { | |
|
| PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | |
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK), | | orSpace == ePdfColorSpace_DeviceCMYK)), | |
| "PdfColor::GetYellow cann | | "PdfColor::GetYellow cannot be called on non CMY | |
| ot be called on non CMYK color objects!"); | | K color objects!"); | |
| | | | |
| return m_uColor.cmyk[2]; | | return m_uColor.cmyk[2]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetBlack() const | | double PdfColor::GetBlack() const | |
| { | | { | |
|
| PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() && | |
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK), | | orSpace == ePdfColorSpace_DeviceCMYK)), | |
| "PdfColor::GetBlack canno | | "PdfColor::GetBlack cannot be called on non CMYK | |
| t be called on non CMYK color objects!"); | | color objects!"); | |
| | | | |
| return m_uColor.cmyk[3]; | | return m_uColor.cmyk[3]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| const std::string PdfColor::GetName() const | | const std::string PdfColor::GetName() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetName cannot
be called on non separation color objects!"); | | PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetName cannot
be called on non separation color objects!"); | |
| | | | |
| skipping to change at line 725 | | skipping to change at line 835 | |
| | | | |
| return m_separationDensity; | | return m_separationDensity; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetCieL() const | | double PdfColor::GetCieL() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_CieLab), | | orSpace == ePdfColorSpace_CieLab)), | |
| "PdfColor::GetCieL cannot | | "PdfColor::GetCieL cannot be called on non CIE-L | |
| be called on non CIE-Lab color objects!"); | | ab color objects!"); | |
| | | | |
| return m_uColor.lab[0]; | | return m_uColor.lab[0]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetCieA() const | | double PdfColor::GetCieA() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_CieLab), | | orSpace == ePdfColorSpace_CieLab)), | |
| "PdfColor::GetCieA cannot | | "PdfColor::GetCieA cannot be called on non CIE-L | |
| be called on non CIE-Lab color objects!"); | | ab color objects!"); | |
| | | | |
| return m_uColor.lab[1]; | | return m_uColor.lab[1]; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| double PdfColor::GetCieB() const | | double PdfColor::GetCieB() const | |
| { | | { | |
| PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | | PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() && | |
|
| !(this->IsSeparation() && | | !(this->IsSeparation() && (this->m_eAlternateCol | |
| this->m_eAlternateColorSpace == ePdfColorSpace_CieLab), | | orSpace == ePdfColorSpace_CieLab)), | |
| "PdfColor::GetCieB cannot | | "PdfColor::GetCieB cannot be called on non CIE-L | |
| be called on non CIE-Lab color objects!"); | | ab color objects!"); | |
| | | | |
| return m_uColor.lab[2]; | | return m_uColor.lab[2]; | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // _PDF_COLOR_H_ | | #endif // _PDF_COLOR_H_ | |
| | | | |
End of changes. 41 change blocks. |
| 177 lines changed or deleted | | 259 lines changed or added | |
|
| PdfDocument.h | | PdfDocument.h | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 71 | |
| */ | | */ | |
| class PODOFO_API PdfDocument { | | class PODOFO_API PdfDocument { | |
| friend class PdfWriter; | | friend class PdfWriter; | |
| friend class PdfElement; | | friend class PdfElement; | |
| | | | |
| public: | | public: | |
| /** Close down/destruct the PdfDocument | | /** Close down/destruct the PdfDocument | |
| */ | | */ | |
| virtual ~PdfDocument(); | | virtual ~PdfDocument(); | |
| | | | |
|
| | | /** Get the write mode used for wirting the PDF | |
| | | * \returns the write mode | |
| | | */ | |
| | | virtual EPdfWriteMode GetWriteMode() const = 0; | |
| | | | |
| /** Get the PDF version of the document | | /** Get the PDF version of the document | |
| * \returns EPdfVersion version of the pdf document | | * \returns EPdfVersion version of the pdf document | |
| */ | | */ | |
| virtual EPdfVersion GetPdfVersion() const = 0; | | virtual EPdfVersion GetPdfVersion() const = 0; | |
| | | | |
| /** Returns wether this PDF document is linearized, aka | | /** Returns wether this PDF document is linearized, aka | |
| * weboptimized | | * weboptimized | |
| * \returns true if the PDF document is linearized | | * \returns true if the PDF document is linearized | |
| */ | | */ | |
| virtual bool IsLinearized() const = 0; | | virtual bool IsLinearized() const = 0; | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 148 | |
| * | | * | |
| * \param nIndex which page (0-based) | | * \param nIndex which page (0-based) | |
| * \returns a pointer to a PdfPage for the requested page. | | * \returns a pointer to a PdfPage for the requested page. | |
| * The returned object is owned by the PdfDocument. | | * The returned object is owned by the PdfDocument. | |
| */ | | */ | |
| PdfPage* GetPage( int nIndex ) const; | | PdfPage* GetPage( int nIndex ) const; | |
| | | | |
| /** Creates a PdfFont object | | /** Creates a PdfFont object | |
| * \param pszFontName name of the font as it is known to the system | | * \param pszFontName name of the font as it is known to the system | |
| * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | | * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | |
|
| | | * \param eFontCreationFlags special flag to specify how fonts should
be created | |
| * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | | * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | |
| * Embedding fonts is usually a good idea. | | * Embedding fonts is usually a good idea. | |
| * | | * | |
| * \returns PdfFont* a pointer to a new PdfFont object. | | * \returns PdfFont* a pointer to a new PdfFont object. | |
| * The returned object is owned by the PdfDocument. | | * The returned object is owned by the PdfDocument. | |
| */ | | */ | |
|
| PdfFont* CreateFont( const char* pszFontName, const PdfEncoding * const | | PdfFont* CreateFont( const char* pszFontName, | |
| pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), | | const PdfEncoding * const pEncoding = PdfEncodingF | |
| | | actory::GlobalWinAnsiEncodingInstance(), | |
| | | PdfFontCache::EFontCreationFlags eFontCreationFlag | |
| | | s = PdfFontCache::eFontCreationFlags_AutoSelectBase14, | |
| bool bEmbedd = true ); | | bool bEmbedd = true ); | |
| | | | |
| /** Creates a PdfFont object | | /** Creates a PdfFont object | |
| * \param pszFontName name of the font as it is known to the system | | * \param pszFontName name of the font as it is known to the system | |
| * \param bBold if true search for a bold font | | * \param bBold if true search for a bold font | |
| * \param bItalic if true search for an italic font | | * \param bItalic if true search for an italic font | |
| * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | | * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | |
|
| | | * \param eFontCreationFlags special flag to specify how fonts should
be created | |
| * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | | * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | |
| * Embedding fonts is usually a good idea. | | * Embedding fonts is usually a good idea. | |
| * \param optional: pszFileName path to a valid font file | | * \param optional: pszFileName path to a valid font file | |
| * | | * | |
| * \returns PdfFont* a pointer to a new PdfFont object. | | * \returns PdfFont* a pointer to a new PdfFont object. | |
| */ | | */ | |
| PdfFont* CreateFont( const char* pszFontName, bool bBold, bool bItalic, | | PdfFont* CreateFont( const char* pszFontName, bool bBold, bool bItalic, | |
| const PdfEncoding * const pEncoding = PdfEncodingF
actory::GlobalWinAnsiEncodingInstance(), | | const PdfEncoding * const pEncoding = PdfEncodingF
actory::GlobalWinAnsiEncodingInstance(), | |
|
| | | PdfFontCache::EFontCreationFlags eFontCreationFlag
s = PdfFontCache::eFontCreationFlags_AutoSelectBase14, | |
| bool bEmbedd = true, const char* pszFileName = NUL
L ); | | bool bEmbedd = true, const char* pszFileName = NUL
L ); | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| /** Creates a PdfFont object | | /** Creates a PdfFont object | |
| * \param pszFontName name of the font as it is known to the system | | * \param pszFontName name of the font as it is known to the system | |
| * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | | * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | |
| * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | | * \param bEmbedd specifies whether this font should be embedded in th
e PDF file. | |
| * Embedding fonts is usually a good idea. | | * Embedding fonts is usually a good idea. | |
| * | | * | |
| * \returns PdfFont* a pointer to a new PdfFont object. | | * \returns PdfFont* a pointer to a new PdfFont object. | |
| | | | |
| skipping to change at line 266 | | skipping to change at line 276 | |
| const PdfEncoding * const = PdfEncodingFactor
y::GlobalWinAnsiEncodingInstance() ); | | const PdfEncoding * const = PdfEncodingFactor
y::GlobalWinAnsiEncodingInstance() ); | |
| #endif // _WIN32 | | #endif // _WIN32 | |
| | | | |
| // Peter Petrov 26 April 2008 | | // Peter Petrov 26 April 2008 | |
| /** Returns the font library from font cache | | /** Returns the font library from font cache | |
| * | | * | |
| * \returns the internal handle to the freetype library | | * \returns the internal handle to the freetype library | |
| */ | | */ | |
| inline FT_Library GetFontLibrary() const; | | inline FT_Library GetFontLibrary() const; | |
| | | | |
|
| | | /** Embeds all pending subset-fonts, is automatically done on Write(). | |
| | | * Just call explicit in case PdfDocument is needed as XObject | |
| | | * | |
| | | */ | |
| | | void EmbedSubsetFonts(); | |
| | | | |
| /** Creates a new page object and inserts it into the internal | | /** Creates a new page object and inserts it into the internal | |
| * page tree. | | * page tree. | |
| * The returned page is owned by the PdfDocument | | * The returned page is owned by the PdfDocument | |
| * and will get deleted along with it! | | * and will get deleted along with it! | |
| * | | * | |
| * \param rSize a PdfRect spezifying the size of the page (i.e the /Me
diaBox key) in 1/1000th mm | | * \param rSize a PdfRect spezifying the size of the page (i.e the /Me
diaBox key) in 1/1000th mm | |
| * \returns a pointer to a PdfPage object | | * \returns a pointer to a PdfPage object | |
| */ | | */ | |
| PdfPage* CreatePage( const PdfRect & rSize ); | | PdfPage* CreatePage( const PdfRect & rSize ); | |
| | | | |
| | | | |
| skipping to change at line 287 | | skipping to change at line 303 | |
| * \param rDoc the document to append | | * \param rDoc the document to append | |
| * \param bAppendAll specifies whether pages and outlines are appended
too | | * \param bAppendAll specifies whether pages and outlines are appended
too | |
| * \returns this document | | * \returns this document | |
| */ | | */ | |
| const PdfDocument & Append( const PdfMemDocument & rDoc, bool bAppendAl
l = true ); | | const PdfDocument & Append( const PdfMemDocument & rDoc, bool bAppendAl
l = true ); | |
| | | | |
| /** Fill an existing empty XObject from a page of another document | | /** Fill an existing empty XObject from a page of another document | |
| * \param pXObj pointer to the XOject | | * \param pXObj pointer to the XOject | |
| * \param rDoc the document to embedd into XObject | | * \param rDoc the document to embedd into XObject | |
| * \param nPage page-number to embedd into XObject | | * \param nPage page-number to embedd into XObject | |
|
| | | * \param bUseTrimBox if true try to use trimbox for size of xo
bject | |
| * \returns the bounding box | | * \returns the bounding box | |
| */ | | */ | |
|
| PdfRect FillXObjectFromDocumentPage( PdfXObject * pXObj, const PdfMemDo
cument & rDoc, int nPage ); | | PdfRect FillXObjectFromDocumentPage( PdfXObject * pXObj, const PdfMemDo
cument & rDoc, int nPage, bool bUseTrimBox ); | |
| | | | |
| /** Attach a file to the document. | | /** Attach a file to the document. | |
| * \param rFileSpec a file specification | | * \param rFileSpec a file specification | |
| */ | | */ | |
| void AttachFile( const PdfFileSpec & rFileSpec ); | | void AttachFile( const PdfFileSpec & rFileSpec ); | |
| | | | |
| /** Adds a PdfDestination into the global Names tree | | /** Adds a PdfDestination into the global Names tree | |
| * with the specified name, optionally replacing one of the same name | | * with the specified name, optionally replacing one of the same name | |
| * \param rDest the destination to be assigned | | * \param rDest the destination to be assigned | |
| * \param rsName the name for the destination | | * \param rsName the name for the destination | |
| | | | |
End of changes. 8 change blocks. |
| 3 lines changed or deleted | | 21 lines changed or added | |
|
| PdfEncrypt.h | | PdfEncrypt.h | |
| | | | |
| skipping to change at line 235 | | skipping to change at line 235 | |
| /** | | /** | |
| * Tries to authenticate a user using either the user or owner password | | * Tries to authenticate a user using either the user or owner password | |
| * | | * | |
| * \param password owner or user password | | * \param password owner or user password | |
| * \param documentId the documentId of the PDF file | | * \param documentId the documentId of the PDF file | |
| * | | * | |
| * \returns true if either the owner or user password matches password | | * \returns true if either the owner or user password matches password | |
| */ | | */ | |
| bool Authenticate( const std::string & password, const PdfString & docu
mentId ); | | bool Authenticate( const std::string & password, const PdfString & docu
mentId ); | |
| | | | |
|
| | | /** Get the encryption algorithm of this object. | |
| | | * \returns the EPdfEncryptAlgorithm of this object | |
| | | */ | |
| | | inline EPdfEncryptAlgorithm GetEncryptAlgorithm() const; | |
| | | | |
| /** Checks if printing this document is allowed. | | /** Checks if printing this document is allowed. | |
| * Every PDF consuming applications has to adhere this value! | | * Every PDF consuming applications has to adhere this value! | |
| * | | * | |
| * \returns true if you are allowed to print this document | | * \returns true if you are allowed to print this document | |
| * | | * | |
| * \see PdfEncrypt to set own document permissions. | | * \see PdfEncrypt to set own document permissions. | |
| */ | | */ | |
| inline bool IsPrintAllowed() const; | | inline bool IsPrintAllowed() const; | |
| | | | |
| /** Checks if modifiying this document (besides annotations, form field
s or changing pages) is allowed. | | /** Checks if modifiying this document (besides annotations, form field
s or changing pages) is allowed. | |
| | | | |
| skipping to change at line 311 | | skipping to change at line 316 | |
| * \returns true if you are allowed to print a high quality version of
this document | | * \returns true if you are allowed to print a high quality version of
this document | |
| * | | * | |
| * \see PdfEncrypt to set own document permissions. | | * \see PdfEncrypt to set own document permissions. | |
| */ | | */ | |
| inline bool IsHighPrintAllowed() const; | | inline bool IsHighPrintAllowed() const; | |
| | | | |
| bool Authenticate(const std::string & documentID, const std::string & p
assword, | | bool Authenticate(const std::string & documentID, const std::string & p
assword, | |
| const std::string & uValue, const std::string & oValu
e, | | const std::string & uValue, const std::string & oValu
e, | |
| int pValue, int lengthValue, int rValue); | | int pValue, int lengthValue, int rValue); | |
| | | | |
|
| /// Get the U object value (user) | | /// Get the U object value (user) | |
| const unsigned char* GetUValue() const { return m_uValue; } | | const unsigned char* GetUValue() const { return m_uValue; } | |
| | | | |
| | | /// Get the O object value (owner) | |
| | | const unsigned char* GetOValue() const { return m_oValue; } | |
| | | | |
| | | /// Get the P object value (protection) | |
| | | int GetPValue() const { return m_pValue; } | |
| | | | |
| | | /// Get the revision number of the encryption method | |
| | | int GetRevision() const { return m_rValue; } | |
| | | | |
| | | /// Get the key length of the encryption key in bits | |
| | | int GetKeyLength() const { return m_keyLength*8; } | |
| | | | |
| | | /// Encrypt a wxString | |
| | | void Encrypt( std::string & str, pdf_long inputLen ) const; | |
| | | | |
|
| /// Get the O object value (owner) | | /// Encrypt a character string | |
| const unsigned char* GetOValue() const { return m_oValue; } | | virtual void Encrypt(unsigned char* str, pdf_long len) const = 0; | |
| | | | |
|
| /// Get the P object value (protection) | | /// Calculate stream size | |
| int GetPValue() const { return m_pValue; } | | virtual pdf_long CalculateStreamLength(pdf_long length) const; | |
| | | | |
|
| /// Get the revision number of the encryption method | | /// Calculate stream offset | |
| int GetRevision() const { return m_rValue; } | | virtual pdf_long CalculateStreamOffset() const; | |
| | | | |
| /// Get the key length of the encryption key in bits | | /** Create a PdfString of MD5 data generated from a buffer in memory. | |
| int GetKeyLength() const { return m_keyLength*8; } | | * \param pBuffer the buffer of which to calculate the MD5 sum | |
| | | * \param nLength the length of the buffer | |
| /// Encrypt a wxString | | * | |
| void Encrypt( std::string & str, pdf_long inputLen ) const; | | * \returns an MD5 sum as PdfString | |
| | | */ | |
| /// Encrypt a character string | | static PdfString GetMD5String( const unsigned char* pBuffer, int nLengt | |
| virtual void Encrypt(unsigned char* str, pdf_long len) const = 0; | | h ); | |
| | | | |
| /// Calculate stream size | | /** Set the reference of the object that is currently encrypted. | |
| virtual pdf_long CalculateStreamLength(pdf_long length) const; | | * | |
| | | * This value will be used in following calls of Encrypt | |
| /// Calculate stream offset | | * to encrypt the object. | |
| virtual pdf_long CalculateStreamOffset() const; | | * | |
| | | * \see Encrypt | |
| /** Create a PdfString of MD5 data generated from a buffer in memory. | | */ | |
| * \param pBuffer the buffer of which to calculate the MD5 sum | | inline void SetCurrentReference( const PdfReference & rRef ); | |
| * \param nLength the length of the buffer | | | |
| * | | | |
| * \returns an MD5 sum as PdfString | | | |
| */ | | | |
| static PdfString GetMD5String( const unsigned char* pBuffer, int nLength | | | |
| ); | | | |
| | | | |
| /** Set the reference of the object that is currently encrypted. | | | |
| * | | | |
| * This value will be used in following calls of Encrypt | | | |
| * to encrypt the object. | | | |
| * | | | |
| * \see Encrypt | | | |
| */ | | | |
| inline void SetCurrentReference( const PdfReference & rRef ); | | | |
| | | | |
| protected: | | protected: | |
|
| PdfEncrypt() {}; | | PdfEncrypt() {}; | |
| | | | |
|
| // copy constructor | | // copy constructor | |
| PdfEncrypt( const PdfEncrypt & rhs ); | | PdfEncrypt( const PdfEncrypt & rhs ); | |
| | | | |
|
| /// Pad a password to 32 characters | | /// Pad a password to 32 characters | |
| void PadPassword(const std::string& password, unsigned char pswd[32]); | | void PadPassword(const std::string& password, unsigned char pswd[32]); | |
| | | | |
|
| /// Compute owner key | | /// Compute owner key | |
| void ComputeOwnerKey(unsigned char userPad[32], unsigned char ownerPad[32 | | void ComputeOwnerKey(unsigned char userPad[32], unsigned char ownerPad[ | |
| ], | | 32], | |
| int keylength, int revision, bool authenticate, | | int keylength, int revision, bool authenticate, | |
| unsigned char ownerKey[32]); | | unsigned char ownerKey[32]); | |
| | | | |
| /// Compute encryption key and user key | | | |
| void ComputeEncryptionKey(const std::string & documentID, | | | |
| unsigned char userPad[32], unsigned char ownerK | | | |
| ey[32], | | | |
| int pValue, int keyLength, int revision, | | | |
| unsigned char userKey[32]); | | | |
| | | | |
|
| /// Check two keys for equality | | /// Compute encryption key and user key | |
| bool CheckKey(unsigned char key1[32], unsigned char key2[32]); | | void ComputeEncryptionKey(const std::string & documentID, | |
| | | unsigned char userPad[32], unsigned char owne | |
| | | rKey[32], | |
| | | int pValue, int keyLength, int revision, | |
| | | unsigned char userKey[32]); | |
| | | | |
|
| /// RC4 encryption | | /// Check two keys for equality | |
| void RC4(unsigned char* key, int keylen, | | bool CheckKey(unsigned char key1[32], unsigned char key2[32]); | |
| unsigned char* textin, pdf_long textlen, | | | |
| unsigned char* textout); | | /// RC4 encryption | |
| | | void RC4(unsigned char* key, int keylen, | |
| | | unsigned char* textin, pdf_long textlen, | |
| | | unsigned char* textout); | |
| | | | |
|
| /// Calculate the binary MD5 message digest of the given data | | /// Calculate the binary MD5 message digest of the given data | |
| static void GetMD5Binary(const unsigned char* data, int length, unsigned | | static void GetMD5Binary(const unsigned char* data, int length, unsigne | |
| char* digest); | | d char* digest); | |
| | | | |
|
| /// Generate initial vector | | /// Generate initial vector | |
| void GenerateInitialVector(unsigned char iv[16]); | | void GenerateInitialVector(unsigned char iv[16]); | |
| | | | |
| | | /** Create the encryption key for the current object. | |
| | | * | |
| | | * \param pObjkey pointer to an array of at least MD5_HASHBYTES (=16) | |
| | | bytes length | |
| | | * \param pnKeyLen pointer to an integer where the actual keylength is | |
| | | stored. | |
| | | */ | |
| | | void CreateObjKey( unsigned char objkey[16], int* pnKeyLen ) const; | |
| | | | |
|
| /** Create the encryption key for the current object. | | EPdfEncryptAlgorithm m_eAlgorithm; ///< The used encryption algorith | |
| * | | m | |
| * \param pObjkey pointer to an array of at least MD5_HASHBYTES (=16) by | | int m_keyLength; ///< Length of encryption key | |
| tes length | | int m_rValue; ///< Revision | |
| * \param pnKeyLen pointer to an integer where the actual keylength is s | | int m_pValue; ///< P entry in pdf document | |
| tored. | | EPdfKeyLength m_eKeyLength; ///< The key length | |
| */ | | std::string m_userPass; ///< User password | |
| void CreateObjKey( unsigned char objkey[16], int* pnKeyLen ) const; | | std::string m_ownerPass; ///< Owner password | |
| | | unsigned char m_rc4key[16]; ///< last RC4 key | |
| EPdfEncryptAlgorithm m_eAlgorithm; ///< The used encryption algorithm | | unsigned char m_rc4last[256]; ///< last RC4 state table | |
| int m_keyLength; ///< Length of encryption key | | unsigned char m_uValue[32]; ///< U entry in pdf document | |
| int m_rValue; ///< Revision | | unsigned char m_oValue[32]; ///< O entry in pdf document | |
| int m_pValue; ///< P entry in pdf document | | | |
| EPdfKeyLength m_eKeyLength; ///< The key length | | | |
| std::string m_userPass; ///< User password | | | |
| std::string m_ownerPass; ///< Owner password | | | |
| unsigned char m_rc4key[16]; ///< last RC4 key | | | |
| unsigned char m_rc4last[256]; ///< last RC4 state table | | | |
| unsigned char m_uValue[32]; ///< U entry in pdf document | | | |
| unsigned char m_oValue[32]; ///< O entry in pdf document | | | |
| | | | |
| private: | | private: | |
|
| static int s_nEnabledEncryptionAlgorithms; ///< Or'ed int containing
the enabled encryption algorithms | | static int s_nEnabledEncryptionAlgorithms; ///< Or'ed int containin
g the enabled encryption algorithms | |
| | | | |
|
| unsigned char m_encryptionKey[16]; ///< Encryption key | | unsigned char m_encryptionKey[16]; ///< Encryption key | |
| | | | |
|
| PdfReference m_curReference; ///< Reference of the current PdfObj
ect | | PdfReference m_curReference; ///< Reference of the current PdfO
bject | |
| | | | |
|
| std::string m_documentId; ///< DocumentID of the current docum
ent | | std::string m_documentId; ///< DocumentID of the current doc
ument | |
| }; | | }; | |
| | | | |
| /** A class that is used to encrypt a PDF file (AES-128) | | /** A class that is used to encrypt a PDF file (AES-128) | |
| * | | * | |
| * Client code is working only with PdfEncrypt class and knows nothing | | * Client code is working only with PdfEncrypt class and knows nothing | |
| * about PdfEncryptAES, it is created through CreatePdfEncrypt factory
method | | * about PdfEncryptAES, it is created through CreatePdfEncrypt factory
method | |
| * | | * | |
| */ | | */ | |
| | | | |
| class PdfEncryptAES : public PdfEncrypt { | | class PdfEncryptAES : public PdfEncrypt { | |
| | | | |
| skipping to change at line 510 | | skipping to change at line 515 | |
| | | | |
| PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS
tream ); | | PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS
tream ); | |
| PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut
putStream ); | | PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut
putStream ); | |
| | | | |
| void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const
; | | void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const
; | |
| }; | | }; | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| | | PdfEncrypt::EPdfEncryptAlgorithm PdfEncrypt::GetEncryptAlgorithm() const | |
| | | { | |
| | | return m_eAlgorithm; | |
| | | } | |
| | | | |
| | | // ----------------------------------------------------- | |
| | | // | |
| | | // ----------------------------------------------------- | |
| void PdfEncrypt::SetCurrentReference( const PdfReference & rRef ) | | void PdfEncrypt::SetCurrentReference( const PdfReference & rRef ) | |
| { | | { | |
| m_curReference = rRef; | | m_curReference = rRef; | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| bool PdfEncrypt::IsPrintAllowed() const | | bool PdfEncrypt::IsPrintAllowed() const | |
| { | | { | |
| | | | |
End of changes. 19 change blocks. |
| 93 lines changed or deleted | | 107 lines changed or added | |
|
| PdfFontCache.h | | PdfFontCache.h | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| class PODOFO_API PdfFontCache { | | class PODOFO_API PdfFontCache { | |
| typedef std::vector<TFontCacheElement> TSortedFontList; | | typedef std::vector<TFontCacheElement> TSortedFontList; | |
| typedef TSortedFontList::iterator TISortedFontList; | | typedef TSortedFontList::iterator TISortedFontList; | |
| typedef TSortedFontList::const_iterator TCISortedFontList; | | typedef TSortedFontList::const_iterator TCISortedFontList; | |
| | | | |
| #if defined(PODOFO_HAVE_FONTCONFIG) | | #if defined(PODOFO_HAVE_FONTCONFIG) | |
| static Util::PdfMutex m_FcMutex; | | static Util::PdfMutex m_FcMutex; | |
| #endif | | #endif | |
| | | | |
| public: | | public: | |
|
| | | enum EFontCreationFlags { | |
| | | eFontCreationFlags_None = 0, ///< No spec | |
| | | ial settings | |
| | | eFontCreationFlags_AutoSelectBase14 = 1, ///< Create automati | |
| | | cally a base14 font if the fontname matches one of them | |
| | | eFontCreationFlags_Type1Subsetting = 2 ///< Create subsette | |
| | | d type1-font, which includes only used characters | |
| | | }; | |
| | | | |
| /** Create an empty font cache | | /** Create an empty font cache | |
| * | | * | |
| * \param pParent a PdfVecObjects which is required | | * \param pParent a PdfVecObjects which is required | |
| * to create new font objects | | * to create new font objects | |
| */ | | */ | |
| PdfFontCache( PdfVecObjects* pParent ); | | PdfFontCache( PdfVecObjects* pParent ); | |
| | | | |
| /** Destroy and empty the font cache | | /** Destroy and empty the font cache | |
| */ | | */ | |
| ~PdfFontCache(); | | ~PdfFontCache(); | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 180 | |
| PdfFont* GetFont( PdfObject* pObject ); | | PdfFont* GetFont( PdfObject* pObject ); | |
| | | | |
| /** Get a font from the cache. If the font does not yet | | /** Get a font from the cache. If the font does not yet | |
| * exist, add it to the cache. | | * exist, add it to the cache. | |
| * | | * | |
| * \param pszFontName a valid fontname | | * \param pszFontName a valid fontname | |
| * \param bBold if true search for a bold font | | * \param bBold if true search for a bold font | |
| * \param bItalic if true search for an italic font | | * \param bItalic if true search for an italic font | |
| * \param bEmbedd if true a font for embedding into | | * \param bEmbedd if true a font for embedding into | |
| * PDF will be created | | * PDF will be created | |
|
| | | * \param eFontCreationFlags special flag to specify how fonts should
be created | |
| * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | | * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | |
| * \param optional: pszFileName path to a valid font file | | * \param optional: pszFileName path to a valid font file | |
| * | | * | |
| * \returns a PdfFont object or NULL if the font could | | * \returns a PdfFont object or NULL if the font could | |
| * not be created or found. | | * not be created or found. | |
| */ | | */ | |
| PdfFont* GetFont( const char* pszFontName, bool bBold, bool bItalic, | | PdfFont* GetFont( const char* pszFontName, bool bBold, bool bItalic, | |
|
| bool bEmbedd, | | bool bEmbedd, EFontCreationFlags eFontCreationFlags =
eFontCreationFlags_AutoSelectBase14, | |
| const PdfEncoding * const = PdfEncodingFactory::Globa
lWinAnsiEncodingInstance(), | | const PdfEncoding * const = PdfEncodingFactory::Globa
lWinAnsiEncodingInstance(), | |
| const char* pszFileName = NULL ); | | const char* pszFileName = NULL ); | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| /** Get a font from the cache. If the font does not yet | | /** Get a font from the cache. If the font does not yet | |
| * exist, add it to the cache. | | * exist, add it to the cache. | |
| * | | * | |
| * \param pszFontName a valid fontname | | * \param pszFontName a valid fontname | |
| * \param bBold if true search for a bold font | | * \param bBold if true search for a bold font | |
| * \param bItalic if true search for an italic font | | * \param bItalic if true search for an italic font | |
| | | | |
| skipping to change at line 249 | | skipping to change at line 256 | |
| * The font will not take ownership of this object. | | * The font will not take ownership of this object. | |
| * \param optional: pszFileName path to a valid font file | | * \param optional: pszFileName path to a valid font file | |
| * | | * | |
| * \returns a PdfFont object or NULL if the font could | | * \returns a PdfFont object or NULL if the font could | |
| * not be created or found. | | * not be created or found. | |
| */ | | */ | |
| PdfFont* GetFontSubset( const char* pszFontName, bool bBold, bool bItal
ic, | | PdfFont* GetFontSubset( const char* pszFontName, bool bBold, bool bItal
ic, | |
| const PdfEncoding * const = PdfEncodingFactory::
GlobalWinAnsiEncodingInstance(), | | const PdfEncoding * const = PdfEncodingFactory::
GlobalWinAnsiEncodingInstance(), | |
| const char* pszFileName = NULL); | | const char* pszFileName = NULL); | |
| | | | |
|
| | | /** Embeds all pending subset-fonts | |
| | | * | |
| | | */ | |
| | | void EmbedSubsetFonts(); | |
| | | | |
| #if defined(PODOFO_HAVE_FONTCONFIG) | | #if defined(PODOFO_HAVE_FONTCONFIG) | |
| /** Get the path of a font file on a Unix system using fontconfig | | /** Get the path of a font file on a Unix system using fontconfig | |
| * | | * | |
| * This method is only available if PoDoFo was compiled with | | * This method is only available if PoDoFo was compiled with | |
| * fontconfig support. | | * fontconfig support. | |
| * | | * | |
| * \param pConfig a handle to an initialized fontconfig library | | * \param pConfig a handle to an initialized fontconfig library | |
| * \param pszFontName name of the requested font | | * \param pszFontName name of the requested font | |
| * \param bBold if true find a bold font | | * \param bBold if true find a bold font | |
| * \param bItalic if true find an italic font | | * \param bItalic if true find an italic font | |
| | | | |
| skipping to change at line 294 | | skipping to change at line 306 | |
| * | | * | |
| * \param itSorted iterator pointing to a location in vecContainer | | * \param itSorted iterator pointing to a location in vecContainer | |
| * where a sorted insert can be made | | * where a sorted insert can be made | |
| * \param vecContainer container where the font object should be added | | * \param vecContainer container where the font object should be added | |
| * \param pMetrics a font metrics | | * \param pMetrics a font metrics | |
| * \param bEmbedd if true the font will be embedded in the pdf file | | * \param bEmbedd if true the font will be embedded in the pdf file | |
| * \param bBold if true this font will be treated as bold font | | * \param bBold if true this font will be treated as bold font | |
| * \param bItalic if true this font will be treated as italic font | | * \param bItalic if true this font will be treated as italic font | |
| * \param pszFontName a font name for debug output | | * \param pszFontName a font name for debug output | |
| * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | | * \param pEncoding the encoding of the font. The font will not take o
wnership of this object. | |
|
| | | * \param bSubsetting if true the font will be subsetted in the pdf fi
le | |
| * | | * | |
| * \returns a font handle or NULL in case of error | | * \returns a font handle or NULL in case of error | |
| */ | | */ | |
| PdfFont* CreateFontObject( TISortedFontList itSorted, TSortedFontList &
vecContainer, | | PdfFont* CreateFontObject( TISortedFontList itSorted, TSortedFontList &
vecContainer, | |
| PdfFontMetrics* pMetrics, bool bEmbedd, bool
bBold, | | PdfFontMetrics* pMetrics, bool bEmbedd, bool
bBold, | |
|
| bool bItalic, const char* pszFontName, const | | bool bItalic, const char* pszFontName, const | |
| PdfEncoding * const pEncoding ); | | PdfEncoding * const pEncoding, | |
| | | bool bSubsetting | |
| | | = false ); | |
| | | | |
| /** Create a font subset. | | /** Create a font subset. | |
| * \param pMetrics a font metrics | | * \param pMetrics a font metrics | |
| * \param pszFontName a font name for debug output | | * \param pszFontName a font name for debug output | |
| * \param bBold if true this font will be treated as bold font | | * \param bBold if true this font will be treated as bold font | |
| * \param bItalic if true this font will be treated as italic font | | * \param bItalic if true this font will be treated as italic font | |
| * \param vecCharacters a list of Unicode character indeces that shoul
d be embedded in the subset | | * \param vecCharacters a list of Unicode character indeces that shoul
d be embedded in the subset | |
| * | | * | |
| * \returns a font handle or NULL in case of error | | * \returns a font handle or NULL in case of error | |
| */ | | */ | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 21 lines changed or added | |
|
| PdfStreamedDocument.h | | PdfStreamedDocument.h | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| * All data is written to an output device | | * All data is written to an output device | |
| * immediately. | | * immediately. | |
| * | | * | |
| * \param pDevice an output device | | * \param pDevice an output device | |
| * \param eVersion the PDF version of the document to write. | | * \param eVersion the PDF version of the document to write. | |
| * The PDF version can only be set in the constructor | | * The PDF version can only be set in the constructor | |
| * as it is the first item written to the document on
disk. | | * as it is the first item written to the document on
disk. | |
| * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | | * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | |
| * the PdfEncrypt object will be copied and used to en
crypt the | | * the PdfEncrypt object will be copied and used to en
crypt the | |
| * created document. | | * created document. | |
|
| | | * \param eWriteMode additional options for writing the pdf | |
| */ | | */ | |
|
| PdfStreamedDocument( PdfOutputDevice* pDevice, EPdfVersion eVersion = e
PdfVersion_Default, PdfEncrypt* pEncrypt = NULL ); | | PdfStreamedDocument( PdfOutputDevice* pDevice, EPdfVersion eVersion = e
PdfVersion_Default, PdfEncrypt* pEncrypt = NULL, EPdfWriteMode eWriteMode =
ePdfWriteMode_Default ); | |
| | | | |
| /** Create a new PdfStreamedDocument. | | /** Create a new PdfStreamedDocument. | |
| * All data is written to a file immediately. | | * All data is written to a file immediately. | |
| * | | * | |
| * \param pszFilename resulting PDF file | | * \param pszFilename resulting PDF file | |
| * \param eVersion the PDF version of the document to write. | | * \param eVersion the PDF version of the document to write. | |
| * The PDF version can only be set in the constructor | | * The PDF version can only be set in the constructor | |
| * as it is the first item written to the document on
disk. | | * as it is the first item written to the document on
disk. | |
| * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | | * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | |
| * the PdfEncrypt object will be copied and used to en
crypt the | | * the PdfEncrypt object will be copied and used to en
crypt the | |
| * created document. | | * created document. | |
|
| | | * \param eWriteMode additional options for writing the pdf | |
| */ | | */ | |
|
| PdfStreamedDocument( const char* pszFilename, EPdfVersion eVersion = eP
dfVersion_Default, PdfEncrypt* pEncrypt = NULL ); | | PdfStreamedDocument( const char* pszFilename, EPdfVersion eVersion = eP
dfVersion_Default, PdfEncrypt* pEncrypt = NULL, EPdfWriteMode eWriteMode =
ePdfWriteMode_Default ); | |
| | | | |
| #ifdef _WIN32 | | #ifdef _WIN32 | |
| /** Create a new PdfStreamedDocument. | | /** Create a new PdfStreamedDocument. | |
| * All data is written to a file immediately. | | * All data is written to a file immediately. | |
| * | | * | |
| * \param pszFilename resulting PDF file | | * \param pszFilename resulting PDF file | |
| * \param eVersion the PDF version of the document to write. | | * \param eVersion the PDF version of the document to write. | |
| * The PDF version can only be set in the constructor | | * The PDF version can only be set in the constructor | |
| * as it is the first item written to the document on
disk. | | * as it is the first item written to the document on
disk. | |
| * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | | * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | |
| * the PdfEncrypt object will be copied and used to en
crypt the | | * the PdfEncrypt object will be copied and used to en
crypt the | |
| * created document. | | * created document. | |
|
| | | * \param eWriteMode additional options for writing the pdf | |
| * | | * | |
| * This is an overloaded member function to allow working | | * This is an overloaded member function to allow working | |
| * with unicode characters. On Unix systes you can also path | | * with unicode characters. On Unix systes you can also path | |
| * UTF-8 to the const char* overload. | | * UTF-8 to the const char* overload. | |
| */ | | */ | |
|
| PdfStreamedDocument( const wchar_t* pszFilename, EPdfVersion eVersion =
ePdfVersion_Default, PdfEncrypt* pEncrypt = NULL ); | | PdfStreamedDocument( const wchar_t* pszFilename, EPdfVersion eVersion =
ePdfVersion_Default, PdfEncrypt* pEncrypt = NULL, EPdfWriteMode eWriteMode
= ePdfWriteMode_Default ); | |
| #endif // _WIN32 | | #endif // _WIN32 | |
| | | | |
| ~PdfStreamedDocument(); | | ~PdfStreamedDocument(); | |
| | | | |
| /** Close the document. The PDF file on disk is finished. | | /** Close the document. The PDF file on disk is finished. | |
| * No other member function of this class maybe called | | * No other member function of this class maybe called | |
| * after calling this function. | | * after calling this function. | |
| */ | | */ | |
| void Close(); | | void Close(); | |
| | | | |
|
| | | /** Get the write mode used for wirting the PDF | |
| | | * \returns the write mode | |
| | | */ | |
| | | inline virtual EPdfWriteMode GetWriteMode() const; | |
| | | | |
| /** Get the PDF version of the document | | /** Get the PDF version of the document | |
| * \returns EPdfVersion version of the pdf document | | * \returns EPdfVersion version of the pdf document | |
| */ | | */ | |
| inline virtual EPdfVersion GetPdfVersion() const; | | inline virtual EPdfVersion GetPdfVersion() const; | |
| | | | |
| /** Returns wether this PDF document is linearized, aka | | /** Returns wether this PDF document is linearized, aka | |
| * weboptimized | | * weboptimized | |
| * \returns true if the PDF document is linearized | | * \returns true if the PDF document is linearized | |
| */ | | */ | |
| inline virtual bool IsLinearized() const; | | inline virtual bool IsLinearized() const; | |
| | | | |
| skipping to change at line 216 | | skipping to change at line 224 | |
| | | | |
| private: | | private: | |
| /** Initialize the PdfStreamedDocument with an output device | | /** Initialize the PdfStreamedDocument with an output device | |
| * \param pDevice write to this device | | * \param pDevice write to this device | |
| * \param eVersion the PDF version of the document to write. | | * \param eVersion the PDF version of the document to write. | |
| * The PDF version can only be set in the constructor | | * The PDF version can only be set in the constructor | |
| * as it is the first item written to the document on
disk. | | * as it is the first item written to the document on
disk. | |
| * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | | * \param pEncrypt pointer to an encryption object or NULL. If not NUL
L | |
| * the PdfEncrypt object will be copied and used to en
crypt the | | * the PdfEncrypt object will be copied and used to en
crypt the | |
| * created document. | | * created document. | |
|
| | | * \param eWriteMode additional options for writing the pdf | |
| */ | | */ | |
|
| void Init( PdfOutputDevice* pDevice, EPdfVersion eVersion = ePdfVersion
_Default, PdfEncrypt* pEncrypt = NULL ); | | void Init( PdfOutputDevice* pDevice, EPdfVersion eVersion = ePdfVersion
_Default, PdfEncrypt* pEncrypt = NULL, EPdfWriteMode eWriteMode = ePdfWrite
Mode_Default ); | |
| | | | |
| private: | | private: | |
| PdfImmediateWriter* m_pWriter; | | PdfImmediateWriter* m_pWriter; | |
| PdfOutputDevice* m_pDevice; | | PdfOutputDevice* m_pDevice; | |
| | | | |
| PdfEncrypt* m_pEncrypt; | | PdfEncrypt* m_pEncrypt; | |
| | | | |
| bool m_bOwnDevice; ///< If true m_pDevice is owned by th
is object and has to be deleted | | bool m_bOwnDevice; ///< If true m_pDevice is owned by th
is object and has to be deleted | |
| }; | | }; | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
|
| | | EPdfWriteMode PdfStreamedDocument::GetWriteMode() const | |
| | | { | |
| | | return m_pWriter->GetWriteMode(); | |
| | | } | |
| | | | |
| | | // ----------------------------------------------------- | |
| | | // | |
| | | // ----------------------------------------------------- | |
| EPdfVersion PdfStreamedDocument::GetPdfVersion() const | | EPdfVersion PdfStreamedDocument::GetPdfVersion() const | |
| { | | { | |
| return m_pWriter->GetPdfVersion(); | | return m_pWriter->GetPdfVersion(); | |
| } | | } | |
| | | | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| // | | // | |
| // ----------------------------------------------------- | | // ----------------------------------------------------- | |
| bool PdfStreamedDocument::IsLinearized() const | | bool PdfStreamedDocument::IsLinearized() const | |
| { | | { | |
| | | | |
End of changes. 10 change blocks. |
| 4 lines changed or deleted | | 21 lines changed or added | |
|