{
if (isTagged)
{
if (element instanceof JRPrintFrame)
{
JRPrintFrame frame = (JRPrintFrame) element;
boolean isCellContentsFrame =
frame.getPropertiesMap().hasProperties()
&& frame.getPropertiesMap().getProperty(JRCellContents.PROPERTY_TYPE) != null;
if (crtCrosstabRowY >= 0) //crosstab already started
{
//frame depth must be incremented for all frame, when inside a crosstab
crosstabFrameDepth++;
if (isCellContentsFrame)
{
if (JRCellContents.TYPE_DATA.equals(frame.getPropertiesMap().getProperty(JRCellContents.PROPERTY_TYPE)))
{
isDataCellPrinted = true;
}
if (crtCrosstabRowY != frame.getY())
{
//this is the first cell on a new row
//end the current row
pdfContentByte.endMarkedContentSequence();
tagStack.pop();
if (
isDataCellPrinted
&& (JRCellContents.TYPE_CROSSTAB_HEADER.equals(frame.getPropertiesMap().getProperty(JRCellContents.PROPERTY_TYPE))
|| JRCellContents.TYPE_COLUMN_HEADER.equals(frame.getPropertiesMap().getProperty(JRCellContents.PROPERTY_TYPE)))
)
{
//end the table
pdfContentByte.endMarkedContentSequence();
tagStack.pop();
//start table
createTableStartTag();
//start crosstab
isDataCellPrinted = false;
}
//start the new row
createTrStartTag();
//keep crosstab open, but mark new row position and frame depth
crtCrosstabRowY = frame.getY();
}
}
else
{
if (crosstabFrameDepth == 1)
{
//normal frame outside crosstab
//end the current row
pdfContentByte.endMarkedContentSequence();
tagStack.pop();
//end the table
pdfContentByte.endMarkedContentSequence();
tagStack.pop();
//end crosstab
crtCrosstabRowY = -1;
//make depth zero because it will not be decremented after frame export
// due to crosstab being ended here
crosstabFrameDepth = 0;
}
}
}
else
{
if (isCellContentsFrame)
{
//start table and firts row
createTableStartTag();
createTrStartTag();
//start crosstab
crtCrosstabRowY = frame.getY();
crosstabFrameDepth++;
isDataCellPrinted = false;
}
// else
// {