Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

pdfform.h

Go to the documentation of this file.
///////////////////////////////////////////////////////////////////////////////
// Name:        pdfform.h
// Purpose:     
// Author:      Ulrich Telle
// Modified by:
// Created:     2006-01-18
// Copyright:   (c) Ulrich Telle
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

/// \file pdfform.h Interface of the wxPdfDocument form field handling

#ifndef _PDFFORM_H_
#define _PDFFORM_H_

// wxWidgets headers
#include "wx/pdfdocdef.h"

/// Object types
00020 enum wxPdfObjectType
{
  wxPDF_OBJECT_INDIRECT,
  wxPDF_OBJECT_RADIOGROUP,

  wxPDF_OBJECT_ANNOTATION,
  wxPDF_OBJECT_TEXTANNOTATION,

  wxPDF_OBJECT_WIDGET,
  wxPDF_OBJECT_WIDGET_CHECKBOX,
  wxPDF_OBJECT_WIDGET_COMBOBOX,
  wxPDF_OBJECT_WIDGET_PUSHBUTTON,
  wxPDF_OBJECT_WIDGET_RADIOBUTTON,
  wxPDF_OBJECT_WIDGET_TEXTFIELD
};

/// Base class for indirect PDF objects (For internal use only)
00037 class WXDLLIMPEXP_PDFDOC wxPdfIndirectObject
{
public:
  /// Constructor
  wxPdfIndirectObject(int objectId, int generationId);

  /// Destructor
  virtual ~wxPdfIndirectObject();

  /// Get type of this object
00047   wxPdfObjectType GetType() { return m_type; }

  /// Set type of object
00050   void SetType(wxPdfObjectType type) { m_type = type; }

  /// Get identifier of this object
00053   int GetObjectId() { return m_objectId; }

  /// Get generation identifier of this object
00056   int GetGenerationId() { return m_generationId; }

private:
00059   wxPdfObjectType m_type;          ///< type of object
00060   int             m_objectId;      ///< object identifier
00061   int             m_generationId;  ///< generation identifier
};

/// Base class for annotation objects (For internal use only)
00065 class wxPdfAnnotationObject : public wxPdfIndirectObject
{
public:
  wxPdfAnnotationObject(int objectId, int generationId);
  
  ~wxPdfAnnotationObject();

  /// Set the associated rectangular area
  void SetRectangle(double x, double y, double width, double height);

  /// Get the X offset
00076   double GetX() { return m_x; }

  /// Get the Y offset
00079   double GetY() { return m_y; }

  /// Get the width
00082   double GetWidth() { return m_w; }

  /// Get the height
00085   double GetHeight() { return m_h; }

private:
00088   double m_x;   ///< X offset of associated area
00089   double m_y;   ///< Y offset of associated area
00090   double m_w;   ///< Width of associated area
00091   double m_h;   ///< Height of associated area
};

/// Base class for PDF form fields (For internal use only)
00095 class wxPdfAnnotationWidget : public wxPdfAnnotationObject
{
public:
  /// Constructor
  wxPdfAnnotationWidget(int objectId, int generationId = 0);
  
  /// Destructor
  virtual ~wxPdfAnnotationWidget();

  /// Set form field name
00105   void SetName(const wxString& name) { m_name = name; }
  
  /// Get form field name
00108   wxString GetName() { return m_name; }

  /// Set border color representation of form field
00111   void SetBorderColor(const wxString& borderColor) { m_borderColor = borderColor; }
  
  /// Get border color representation of form field
00114   wxString GetBorderColor() { return m_borderColor; }

  /// Set background color representation of form field
00117   void SetBackgroundColor(const wxString& backgroundColor) { m_backgroundColor = backgroundColor; }
  
  /// Get background color representation of form field
00120   wxString GetBackgroundColor() { return m_backgroundColor; }

  /// Set text color representation of form field
00123   void SetTextColor(const wxString& textColor) { m_textColor = textColor; }
  
  /// Get text color representation of form field
00126   wxString GetTextColor() { return m_textColor; }

  /// Set border style of form field
00129   void SetBorderStyle(const wxString& borderStyle) { m_borderStyle = borderStyle; }
  
  /// Get border style of form field
00132   wxString GetBorderStyle() { return m_borderStyle; }

  /// Set border width of form field
00135   void SetBorderWidth(double borderWidth) { m_borderWidth = borderWidth; }

  /// Get border width of form field
00138   double GetBorderWidth() { return m_borderWidth; }

private:
00141   wxString m_name;             ///< name of form field
00142   wxString m_borderColor;      ///< border color representation
00143   wxString m_backgroundColor;  ///< background color representation
00144   wxString m_textColor;        ///< text color representation
00145   double   m_borderWidth;      ///< border width in points
00146   wxString m_borderStyle;      ///< border style
};

/// Class representing check box form fields (For internal use only)
00150 class wxPdfCheckBox : public wxPdfAnnotationWidget
{
public:
  /// Constructor
  wxPdfCheckBox(int objectId, int generationId = 0);

  /// Destructor
  virtual ~wxPdfCheckBox();

  /// Set status of form field (checked/unchecked)
00160   void SetValue(bool checked) { m_checked = checked; }
  
  /// Get status of form field (checked/unchecked)
00163   bool GetValue() { return m_checked; }

private:
00166   bool m_checked;  ///< status of check box
};

/// Class representing combo box form field (For internal use only)
00170 class wxPdfComboBox : public wxPdfAnnotationWidget
{
public:
  /// Constructor
  wxPdfComboBox(int objectId, 
                int fontindex, double fontsize, 
                int generationId = 0);

  /// Destructor
  virtual ~wxPdfComboBox();

  /// Set value list of combo box
00182   void SetValue(const wxArrayString& values) { m_values = values; }
  
  /// Get value list of combo box
00185   wxArrayString GetValue() { return m_values; }

  /// Get object index of font used for displaying the value list
00188   int GetFontIndex() { return m_fontindex; }
  
  /// Get size of font used for displaying the value list
00191   double GetFontSize() { return m_fontsize; }

private:
00194   int           m_fontindex;  ///< index of combo box font
00195   double        m_fontsize;   ///< size of combo box font
00196   wxArrayString m_values;     ///< array of combo box values
};

/// Class representing push button form field (For internal use only)
00200 class wxPdfPushButton : public wxPdfAnnotationWidget
{
public:
  /// Constructor
  wxPdfPushButton(int objectId,
                  int fontindex, double fontsize, 
                  int generationId = 0);

  /// Destructor
  virtual ~wxPdfPushButton();

  /// Set caption string of button
00212   void SetCaption(const wxString& caption) { m_caption = caption; }
  
  /// Get caption string of button
00215   wxString GetCaption() { return m_caption; }
  
  /// Set JavaScript action  associated with the button
00218   void SetAction(const wxString& action) { m_action = action; }
  
  /// Get JavaScript action  associated with the button
00221   wxString GetAction() { return m_action; }

  /// Get object index of font used for displaying the value list
00224   int GetFontIndex() { return m_fontindex; }
  
  /// Get size of font used for displaying the value list
00227   double GetFontSize() { return m_fontsize; }

private:
00230   int      m_fontindex;  ///< index of combo box font
00231   double   m_fontsize;   ///< size of combo box font
00232   wxString m_caption;    ///< caption string
00233   wxString m_action;     ///< JavaScript action
};

// Forward declaration of radio button group
class wxPdfRadioGroup;

/// Class representing radio button form field (For internal use only)
00240 class wxPdfRadioButton : public wxPdfAnnotationWidget
{
public:
  /// Constructor
  wxPdfRadioButton(int objectId, int index, int generationId = 0);
  
  /// Destructor
  virtual ~wxPdfRadioButton();

  /// Set parent (radio button group) of this button
00250   void SetParent(wxPdfRadioGroup* parent) { m_parent = parent; }
  
  /// Get parent (radio button group) of this button
00253   wxPdfRadioGroup* GetParent() { return m_parent; }
  
  /// Get index of this button within the radio button group
00256   int GetIndex() { return m_index; }

private:
00259   wxPdfRadioGroup* m_parent;  ///< pointer to parent group
00260   int              m_index;   ///< index within button group
};

/// Class representing radio button groups (For internal use only)
00264 class wxPdfRadioGroup : public wxPdfIndirectObject
{
public:
  /// Constructor
  wxPdfRadioGroup(int objectId, const wxString& groupName, int generationId = 0);
  
  /// Destructor
  virtual ~wxPdfRadioGroup();

  /// Add a button to the group
  void Add(wxPdfRadioButton* radio);

  /// Get name of the button group
00277   wxString GetName() { return m_groupName; }

  /// Get the number of buttons in the group
00280   int GetCount() { return m_radios.GetCount(); }
  
  /// Get the array of buttons in the group
00283   wxArrayPtrVoid GetKids() { return m_radios; }

private:
00286   wxString       m_groupName;  ///< name of the radio button group
  wxArrayPtrVoid m_radios;     //< array of all radio buttons in this group
};

/// Class representing text form fields (For internal use only)
00291 class wxPdfTextField : public wxPdfAnnotationWidget
{
public:
  /// Constructor
  wxPdfTextField(int objectId,
                 int fontindex, double fontsize, 
                 const wxString& value, int generation_id = 0);

  /// Destructor
  virtual ~wxPdfTextField();

  /// Set default value of the text field
00303   void SetValue(const wxString& value) { m_value = value; }

  /// Get default value of the text field
00306   wxString GetValue() { return m_value; }

  /// Set multi line property of the text field
00309   void SetMultiLine(bool multiline) { m_multiline = multiline; }

  /// Get multi line property of the text field
00312   bool GetMultiLine() { return m_multiline; }

  /// Get object index of font used for displaying the value list
00315   int GetFontIndex() { return m_fontindex; }
  
  /// Get size of font used for displaying the value list
00318   double GetFontSize() { return m_fontsize; }

private:
00321   int      m_fontindex;  ///< index of text field font
00322   double   m_fontsize;   ///< size of text field font
00323   wxString m_value;      ///< default value of text field
00324   bool     m_multiline;  ///< multi line property of text field
};

#endif

Generated by  Doxygen 1.6.0   Back to index