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

void wxPdfDocument::WriteXml ( const wxString &  str )

Prints a string containing simple XML markup.

Output starts at the current position.

Parameters:
strstring containing text with simple XML markup
See also:
Styling text using a simple markup language

Definition at line 1260 of file pdfxml.cpp.

References GetFontSize(), GetLineHeight(), GetPageWidth(), GetRightMargin(), GetScaleFactor(), GetX(), GetY(), PrepareXmlCell(), SetLineHeight(), SetXY(), and WriteXmlCell().

{
  if (GetLineHeight() == 0)
  {
    SetLineHeight(GetFontSize()*1.25 / GetScaleFactor());
  }
  wxStringInputStream xmlStream(_T("<xml>")+xmlString+_T("</xml>"));
  wxXmlDocument xmlDocument;
  bool loaded = xmlDocument.Load(xmlStream);
  if (loaded)
  {
    if (xmlDocument.IsOk())
    {
      wxXmlNode* root = xmlDocument.GetRoot();
      double maxWidth = GetPageWidth() - GetRightMargin() - GetX();
      wxPdfCellContext context(maxWidth, wxPDF_ALIGN_LEFT);
      double saveX = GetX();
      double saveY = GetY();
      PrepareXmlCell(root, context);
      SetXY(saveX, saveY);
      WriteXmlCell(root, context);
    }
    else
    {
      wxLogDebug(_T("wxPdfDocument::WriteXml: Markup invalid."));
      return /* false */;
    }
  }
  else
  {
    // TODO: Error handling
    wxLogDebug(_T("wxPdfDocument::WriteXml: Unable to load markup string."));
  }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index