Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -602,16 +602,28 @@ class TableToTableDocument {

private def Element transform(FootnoteInfo footnote) {
val it = doc.createElement("Footnote")
val footNoteType = doc.createElement(footnote.type.toString)
footNoteType.attributeNode = createFootnoteAttribute(footnote.index)
val footNoteType = doc.createElement(
footnote.changedInCompare &&
footnote.removedInMain ? 'REMOVED_COMPARE_FOOTNOTE' : footnote.
type.toString)
footNoteType.attributeNode = createFootnoteNumberAttribute(
footnote.index)
if (footnote.changedInCompare) {
it.attributeNode = createFootnoteCompareAttribute()
}
footNoteType.textContent = footnote.toText
appendChild(footNoteType)
return it
}

private def Attr createFootnoteAttribute(Integer number) {
private def Attr createFootnoteNumberAttribute(Integer number) {
val footnoteAttr = doc.createAttribute("footnote-number")
footnoteAttr.value = Integer.toString(number)
return footnoteAttr
}

private def Attr createFootnoteCompareAttribute() {
val footnoteAttr = doc.createAttribute("footnote-changed-in-compare")
return footnoteAttr
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,30 @@ public void updateFootnotes(final Table table) {
final String text = footnote.toReferenceText();
lines.add(text);

final StyleRange styleRange = new StyleRange(startOffset,
text.length(), null, null);
switch (footnote.type) {
case NEW_FOOTNOTE:
styles.add(new StyleRange(startOffset, text.length(),
new Color(255, 0, 0), null));
styleRange.foreground = new Color(255, 0, 0);
break;
case OLD_FOOTNOTE:
final StyleRange styleRange = new StyleRange(startOffset,
text.length(), null, new Color(255, 255, 0));
styleRange.background = new Color(255, 255, 0);
styleRange.strikeout = true;
styles.add(styleRange);

break;
case COMMON_FOOTNOTE:
default:
break;
}
startOffset += text.length() + 1;
if (footnote.changedInCompare) {
styleRange.borderStyle = SWT.BORDER_SOLID;
styleRange.borderColor = new Color(0, 0, 255);
// add some artificial padding to left and right border of
lines.set(lines.size() - 1, " " + text + " "); //$NON-NLS-1$ //$NON-NLS-2$
Comment thread
mariusheine marked this conversation as resolved.
styleRange.length += 2;
}
styles.add(styleRange);
startOffset += styleRange.length + 1;

}
setVisible(!lines.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,37 +268,45 @@ http://www.eclipse.org/legal/epl-v20.html
</xsl:template>

<xsl:template match="Footnote">
<xsl:apply-templates />
<fo:block text-align="left">
<xsl:if test="boolean(@footnote-changed-in-compare)">
<xsl:attribute name="margin-top">0.5mm</xsl:attribute>
<xsl:attribute name="margin-bottom">0.5mm</xsl:attribute>
<xsl:attribute name="border">
<xsl:value-of select="$compare-content-border-style" />
</xsl:attribute>
<xsl:attribute name="padding">0.5mm</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</fo:block>
</xsl:template>

<xsl:template match="COMMON_FOOTNOTE">
<fo:block text-align="left">
<xsl:text>*</xsl:text>
<xsl:value-of select="@footnote-number" />
<xsl:text>: </xsl:text>
<xsl:value-of select="." />
</xsl:template>
<xsl:template match="NEW_FOOTNOTE">
<fo:inline color="#cd0000">
<xsl:text>*</xsl:text>
<xsl:value-of select="@footnote-number" />
<xsl:text>: </xsl:text>
<xsl:value-of select="." />
</fo:block>
</xsl:template>
<xsl:template match="NEW_FOOTNOTE">
<fo:block text-align="left">
<fo:inline color="#cd0000">
<xsl:text>*</xsl:text>
<xsl:value-of select="@footnote-number" />
<xsl:text>: </xsl:text>
<xsl:value-of select="." />
</fo:inline>
</fo:block>
</fo:inline>
</xsl:template>

<xsl:template match="OLD_FOOTNOTE">
<fo:block text-align="left">
<fo:inline background-color="yellow" text-decoration="line-through">
<xsl:text>*</xsl:text>
<xsl:value-of select="@footnote-number" />
<xsl:text>: </xsl:text>
<xsl:value-of select="." />
</fo:inline>
</fo:block>
<fo:inline background-color="yellow" text-decoration="line-through">
<xsl:text>*</xsl:text>
<xsl:value-of select="@footnote-number" />
<xsl:text>: </xsl:text>
<xsl:value-of select="." />
</fo:inline>
</xsl:template>

<xsl:template match="REMOVED_COMPARE_FOOTNOTE">
<fo:character character="&#160;"/>
</xsl:template>

<xsl:variable name="compare-content-border-style" select="'0.5mm solid #0066FF'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ Bundle-SymbolicName: org.eclipse.set.model.tablemodel.extensions.test
Bundle-Version: 2.7.0.qualifier
Fragment-Host: org.eclipse.set.model.tablemodel.extensions;bundle-version="0.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.hamcrest.core
Import-Package: org.junit.jupiter.api,
Require-Bundle: org.hamcrest.core,
org.hamcrest,
org.mockito.mockito-core
Import-Package: net.bytebuddy,
net.bytebuddy.agent,
org.eclipse.emf.ecore,
org.junit.jupiter.api,
org.junit.jupiter.api.function,
org.junit.jupiter.params,
org.junit.jupiter.params.provider
Expand Down
Loading
Loading