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

void wxPdfDocument::GetTemplateSize ( int  templateId,
double &  width,
double &  height 
)

Get the calculated size of a template.

Retrieves the size of a template.

Parameters:
templateIdA valid template ID
widthThe width of the template
heightThe height of the template
See also:
BeginTemplate(), EndTemplate(), UseTemplate(), ImportPage()

Attention: The width and/or height parameters have to be set to a value <= 0 prior to calling this method, otherwise they will not be calculated. If one dimension, i.e. width, is passed with a value > 0, the other one, i.e. height, is calculated accordingly.

Definition at line 168 of file pdftemplate.cpp.

References wxPdfTemplate::GetHeight(), and wxPdfTemplate::GetWidth().

Referenced by UseTemplate().

{
  wxPdfTemplate* tpl;
  wxPdfTemplatesMap::iterator templateIter = (*m_templates).find(templateId);
  if (templateIter != (*m_templates).end())
  {
    tpl = templateIter->second;
    if (w <= 0 && h <= 0)
    {
      w = tpl->GetWidth();
      h = tpl->GetHeight();
    }
    if (w <= 0)
    {
      w = h * tpl->GetWidth() / tpl->GetHeight();
    }
    if (h <= 0)
    {
      h = w * tpl->GetHeight() / tpl->GetWidth();
    }
  }
  else
  {
    wxLogWarning(_("wxPdfDocument::UseTemplate: Template %d does not exist!"), templateId);
    w = 0;
    h = 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index