aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMehdi Houshmand <mehdi@apache.org>2012-09-27 12:11:28 +0000
committerMehdi Houshmand <mehdi@apache.org>2012-09-27 12:11:28 +0000
commit8828aed0ed0e9bc49fe49e69892d663356e11359 (patch)
tree018b702322f2d45dc1466fff6718ff685f853759 /src
parentc9cbf7e0a418fb7735f6d4a42632b867f3dab36c (diff)
parenta1af0b2481adf1d4bdb1279972a9d4e51e381f6a (diff)
downloadxmlgraphics-fop-8828aed0ed0e9bc49fe49e69892d663356e11359.tar.gz
xmlgraphics-fop-8828aed0ed0e9bc49fe49e69892d663356e11359.zip
Merged trunk@1384277Temp_XGC_URI_Resolution
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_XGC_URI_Resolution@1390959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java33
-rw-r--r--src/java/org/apache/fop/fo/Constants.java5
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java6
-rw-r--r--src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java1
-rw-r--r--src/java/org/apache/fop/fo/extensions/InternalElementMapping.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/table/TableColumn.java12
-rw-r--r--src/java/org/apache/fop/fonts/CIDSet.java2
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java29
8 files changed, 72 insertions, 19 deletions
diff --git a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java
index 93b815d30..09a814ef5 100644
--- a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java
+++ b/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java
@@ -20,6 +20,7 @@
package org.apache.fop.accessibility.fo;
import java.util.Locale;
+import java.util.Stack;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -30,6 +31,7 @@ import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fo.flow.AbstractGraphics;
import org.apache.fop.fo.flow.BasicLink;
import org.apache.fop.fo.flow.Block;
@@ -70,6 +72,10 @@ class StructureTreeEventTrigger extends FOEventHandler {
private LayoutMasterSet layoutMasterSet;
+ private final Stack<Table> tables = new Stack<Table>();
+
+ private final Stack<Boolean> inTableHeader = new Stack<Boolean>();
+
public StructureTreeEventTrigger(StructureTreeEventHandler structureTreeEventHandler) {
this.structureTreeEventHandler = structureTreeEventHandler;
}
@@ -195,42 +201,51 @@ class StructureTreeEventTrigger extends FOEventHandler {
@Override
public void startTable(Table tbl) {
+ tables.push(tbl);
startElement(tbl);
}
@Override
public void endTable(Table tbl) {
endElement(tbl);
+ tables.pop();
}
@Override
public void startHeader(TableHeader header) {
+ inTableHeader.push(Boolean.TRUE);
startElement(header);
}
@Override
public void endHeader(TableHeader header) {
endElement(header);
+ inTableHeader.pop();
}
@Override
public void startFooter(TableFooter footer) {
+ // TODO Shouldn't it be true?
+ inTableHeader.push(Boolean.FALSE);
startElement(footer);
}
@Override
public void endFooter(TableFooter footer) {
endElement(footer);
+ inTableHeader.pop();
}
@Override
public void startBody(TableBody body) {
+ inTableHeader.push(Boolean.FALSE);
startElement(body);
}
@Override
public void endBody(TableBody body) {
endElement(body);
+ inTableHeader.pop();
}
@Override
@@ -248,6 +263,24 @@ class StructureTreeEventTrigger extends FOEventHandler {
AttributesImpl attributes = new AttributesImpl();
addSpanAttribute(attributes, "number-columns-spanned", tc.getNumberColumnsSpanned());
addSpanAttribute(attributes, "number-rows-spanned", tc.getNumberRowsSpanned());
+ boolean rowHeader = inTableHeader.peek();
+ boolean columnHeader = tables.peek().getColumn(tc.getColumnNumber() - 1).isHeader();
+ if (rowHeader || columnHeader) {
+ final String th = "TH";
+ String role = tc.getCommonAccessibility().getRole();
+ /* Do not override a custom role */
+ if (role == null) {
+ role = th;
+ addNoNamespaceAttribute(attributes, "role", th);
+ }
+ if (role.equals(th)) {
+ if (columnHeader) {
+ String scope = rowHeader ? "Both" : "Row";
+ addAttribute(attributes, InternalElementMapping.URI, InternalElementMapping.SCOPE,
+ InternalElementMapping.STANDARD_PREFIX, scope);
+ }
+ }
+ }
startElement(tc, attributes);
}
diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java
index 2d10dcdd9..6688042e2 100644
--- a/src/java/org/apache/fop/fo/Constants.java
+++ b/src/java/org/apache/fop/fo/Constants.java
@@ -785,8 +785,11 @@ public interface Constants {
*/
int PR_X_NUMBER_CONVERSION_FEATURES = 276;
+ /** Scope for table header */
+ int PR_X_HEADER_COLUMN = 277;
+
/** Number of property constants defined */
- int PROPERTY_COUNT = 276;
+ int PROPERTY_COUNT = 277;
// compound property constants
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index d0d13fc17..a92b71ef9 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -2513,6 +2513,12 @@ public final class FOPropertyMapping implements Constants {
m.setInherited(false);
m.setDefault("false");
addPropertyMaker("table-omit-header-at-break", m);
+
+ // fox:scope
+ m = new EnumProperty.Maker(PR_X_HEADER_COLUMN);
+ m.useGeneric(genericBoolean);
+ m.setDefault("false");
+ addPropertyMaker("fox:header", m);
}
private void createWritingModeProperties() {
diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
index f0e03399f..a040edf1a 100644
--- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
+++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
@@ -52,6 +52,7 @@ public class ExtensionElementMapping extends ElementMapping {
PROPERTY_ATTRIBUTES.add("disable-column-balancing");
//These are FOP's extension properties for accessibility
PROPERTY_ATTRIBUTES.add("alt-text");
+ PROPERTY_ATTRIBUTES.add("header");
}
/**
diff --git a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java
index 687952d25..f257dd79d 100644
--- a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java
+++ b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java
@@ -43,12 +43,15 @@ public class InternalElementMapping extends ElementMapping {
/** The "struct-ref" attribute, to refer to a structure tree element. */
public static final String STRUCT_REF = "struct-ref";
+ public static final String SCOPE = "scope";
+
private static final Set<String> PROPERTY_ATTRIBUTES = new java.util.HashSet<String>();
static {
//These are FOP's extension properties for accessibility
PROPERTY_ATTRIBUTES.add(STRUCT_ID);
PROPERTY_ATTRIBUTES.add(STRUCT_REF);
+ PROPERTY_ATTRIBUTES.add(SCOPE);
}
/**
diff --git a/src/java/org/apache/fop/fo/flow/table/TableColumn.java b/src/java/org/apache/fop/fo/flow/table/TableColumn.java
index 5047822da..33cbff884 100644
--- a/src/java/org/apache/fop/fo/flow/table/TableColumn.java
+++ b/src/java/org/apache/fop/fo/flow/table/TableColumn.java
@@ -24,6 +24,7 @@ import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -44,6 +45,7 @@ public class TableColumn extends TableFObj {
private Length columnWidth;
private int numberColumnsRepeated;
private int numberColumnsSpanned;
+ private boolean isHeader;
// Unused but valid items, commented out for performance:
// private int visibility;
// End of property values
@@ -120,6 +122,7 @@ public class TableColumn extends TableFObj {
if (!this.implicitColumn) {
this.pList = pList;
}
+ isHeader = (pList.get(Constants.PR_X_HEADER_COLUMN).getEnum() == Constants.EN_TRUE);
}
/** {@inheritDoc} */
@@ -263,4 +266,13 @@ public class TableColumn extends TableFObj {
this.pList = null;
}
+ /**
+ * Returns {@code true} if this column is made of header cells.
+ *
+ * @return {@code true} if cells in this column are like TH cells in HTML
+ */
+ public boolean isHeader() {
+ return isHeader;
+ }
+
}
diff --git a/src/java/org/apache/fop/fonts/CIDSet.java b/src/java/org/apache/fop/fonts/CIDSet.java
index 30d1a5ec5..7530ea6e7 100644
--- a/src/java/org/apache/fop/fonts/CIDSet.java
+++ b/src/java/org/apache/fop/fonts/CIDSet.java
@@ -38,7 +38,7 @@ public interface CIDSet {
/**
* Returns the Unicode value for a subset index (character selector). If there's no such
* Unicode value, the "NOT A CHARACTER" (0xFFFF) is returned.
- * @param subsetIndex the subset index (character selector)
+ * @param index the subset index (character selector)
* @return the Unicode value or "NOT A CHARACTER" (0xFFFF)
*/
char getUnicode(int index);
diff --git a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
index 0d4a6b7fb..031224ffb 100644
--- a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
+++ b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
@@ -30,6 +30,7 @@ import org.apache.fop.accessibility.StructureTreeElement;
import org.apache.fop.accessibility.StructureTreeEventHandler;
import org.apache.fop.events.EventBroadcaster;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.pdf.PDFFactory;
import org.apache.fop.pdf.PDFParentTree;
@@ -138,7 +139,7 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
PDFStructElem structElem = createStructureElement(parent, structureType);
setAttributes(structElem, attributes);
addKidToParent(structElem, parent, attributes);
- registerStructureElement(structElem, pdfFactory);
+ registerStructureElement(structElem, pdfFactory, attributes);
return structElem;
}
@@ -155,7 +156,8 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
parent.addKid(kid);
}
- protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory) {
+ protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory,
+ Attributes attributes) {
pdfFactory.getDocument().registerStructureElement(structureElement);
}
@@ -240,22 +242,15 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
}
@Override
- protected PDFStructElem createStructureElement(StructureHierarchyMember parent,
- StructureType structureType) {
- PDFStructElem grandParent = ((PDFStructElem) parent).getParentStructElem();
- //TODO What to do with cells from table-footer? Currently they are mapped on TD.
- if (grandParent.getStructureType() == StandardStructureTypes.Table.THEAD) {
- structureType = StandardStructureTypes.Table.TH;
- } else {
- structureType = StandardStructureTypes.Table.TD;
- }
- return super.createStructureElement(parent, structureType);
- }
-
- @Override
- protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory) {
+ protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory,
+ Attributes attributes) {
if (structureElement.getStructureType() == Table.TH) {
- pdfFactory.getDocument().registerStructureElement(structureElement, Scope.COLUMN);
+ String scopeAttribute = attributes.getValue(InternalElementMapping.URI,
+ InternalElementMapping.SCOPE);
+ Scope scope = (scopeAttribute == null)
+ ? Scope.COLUMN
+ : Scope.valueOf(scopeAttribute.toUpperCase(Locale.ENGLISH));
+ pdfFactory.getDocument().registerStructureElement(structureElement, scope);
} else {
pdfFactory.getDocument().registerStructureElement(structureElement);
}
/option> Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/l10n/oc/files.po
blob: e813363f706e40cb117efe8f986b3f171822a6cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416