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

void wxPdfDocument::SetTemplateBBox ( int  templateId,
double  x,
double  y,
double  width,
double  height 
)

Sets the bounding box of a template.

As long as a template hasn't been used it is possible to change the bounding box of the template. This may be useful for pages imported from an external PDF document allowing to set the visible portion of the template. Note: Setting the bounding box influences only the visible area of the template, not the real size it occupies.

Parameters:
templateIdA valid template ID
xThe x coordinate of the lower left corner
yThe y coordinate of the lower left corner
widthThe width of the template
heightThe height of the template
See also:
GetTemplateBBox(), BeginTemplate(), ImportPage()

Definition at line 221 of file pdftemplate.cpp.

References wxPdfTemplate::m_h, wxPdfTemplate::m_used, wxPdfTemplate::m_w, wxPdfTemplate::m_x, and wxPdfTemplate::m_y.

{
  wxPdfTemplate* tpl;
  wxPdfTemplatesMap::iterator templateIter = (*m_templates).find(templateId);
  if (templateIter != (*m_templates).end())
  {
    tpl = templateIter->second;
    if (!tpl->m_used)
    {
      if (!tpl->m_used && w > 0 && h > 0)
      {
        tpl->m_x = x;
        tpl->m_y = y;
        tpl->m_w = w;
        tpl->m_h = h;
      }
      else
      {
        wxLogWarning(_("wxPdfDocument::SetTemplateBBox: Invalid width and/or height, BBox not changed for template %d!"), templateId);
      }
    }
    else
    {
      wxLogWarning(_("wxPdfDocument::SetTemplateBBox: Template %d has already been used, BBox can't be changed!"), templateId);
    }
  }
  else
  {
    wxLogWarning(_("wxPdfDocument::SetTemplateBBox: Template %d does not exist!"), templateId);
  }
}

Generated by  Doxygen 1.6.0   Back to index