if (getDesignTemplate().getPageHeaderOn())
{
// copy all Section information from Page Header to our Header
try
{
XSection xForeignSection = getDesignTemplate().getPageHeader();
if (xForeignSection != null)
{
getReportDefinition().setPageHeaderOn(true);
XSection xSection = getReportDefinition().getPageHeader();
// copy Sections
copySection(xForeignSection, xSection);
}
}
catch (Exception e)
{
Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
{
// we won't a page header
// getReportDefinition().setPageHeaderOn(true);
getReportDefinition().setPageHeaderOn(false);
}
}
else
{
if (getReportDefinition() == null)
{
return;
}
// there is no foreign report definition
// TODO: #i86902# rpt:Title() out of the document
// TODO: #i86902# rpt:Author() can't set with something like rpt:author()
// TODO: #i86902# more fieldnames need.
final String sTitleTitle = getResource().getResText(UIConsts.RID_REPORT + 86); // "Title:"
final String sTitle = getTableName(); // "Default title, this is a first draft report generated by the new report wizard.";
final String sAuthorTitle = getResource().getResText(UIConsts.RID_REPORT + 87); // "Author:"
final String sAuthor = getUserNameFromConfiguration(); // "You"; // rpt:fieldvalue();
final String sDateTitle = getResource().getResText(UIConsts.RID_REPORT + 88); // "Date:"
// TODO: #i86911# Date: we need to set the style of the date.
final String sDate = "rpt:now()"; // getDateString("EEE, d MMM yyyy HH:mm:ss zzzz");
try
{
getReportDefinition().setPageHeaderOn(true);
XSection xSection = null;
xSection = getReportDefinition().getPageHeader();
Rectangle aRect = new Rectangle();
aRect.X = getLeftPageIndent();
SectionObject aSOLabel = SectionEmptyObject.create();
aSOLabel.setFontToBold();
aRect.Y = aSOLabel.getHeight(LayoutConstants.LabelHeight);
final int nWidth = 3000;
aRect = insertLabel(xSection, sTitleTitle, aRect, nWidth, aSOLabel);
final int nTitleWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - 3000;
// aRect = insertFormattedField(xSection, "rpt:Title()", aRect, nTitleWidth);
aRect = insertLabel(xSection, sTitle, aRect, nTitleWidth, aSOLabel);
aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight;
aRect.X = getLeftPageIndent();
aRect = insertLabel(xSection, sAuthorTitle, aRect, nWidth, aSOLabel);
// aRect = insertFormattedField(xSection, "rpt:Author()", aRect, nWidth);
aRect = insertLabel(xSection, sAuthor, aRect, nTitleWidth, aSOLabel);
aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight);
aRect.X = getLeftPageIndent();
aRect = insertLabel(xSection, sDateTitle, aRect, nWidth, aSOLabel);
// aRect = insertFormattedField(xSection, "rpt:Date()", aRect, nWidth);
aRect = insertFormattedField(xSection, sDate, aRect, nTitleWidth, aSOLabel);
aRect.Y += aSOLabel.getHeight(LayoutConstants.FormattedFieldHeight) + LayoutConstants.LineHeight;
// draw a line under the label/formattedfield
aRect.X = getLeftPageIndent();
final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
final int nLineHeight = LayoutConstants.LineHeight;
insertHorizontalLine(xSection, aRect, nLineWidth, nLineHeight);
aRect.Y += nLineHeight;
xSection.setHeight(aRect.Y);
}
catch (com.sun.star.uno.Exception e)
{
Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}