pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r992248 [2/4] - in /pdfbox/trunk: fontbox/src/main/site/resources/images/ pdfbox/src/main/java/org/apache/pdfbox/filter/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchan...
Date Fri, 03 Sep 2010 09:57:27 GMT
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java
Fri Sep  3 09:57:26 2010
@@ -1,266 +1,266 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
-
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement;
-
-/**
- * An Export Format attribute object.
- * 
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- */
-public class PDExportFormatAttributeObject extends PDLayoutAttributeObject
-{
-
-    /**
-     *  standard attribute owner: XML-1.00
-     */
-    public static final String OWNER_XML_1_00 = "XML-1.00";
-    /**
-     *  standard attribute owner: HTML-3.2
-     */
-    public static final String OWNER_HTML_3_20 = "HTML-3.2";
-    /**
-     *  standard attribute owner: HTML-4.01
-     */
-    public static final String OWNER_HTML_4_01 = "HTML-4.01";
-    /**
-     *  standard attribute owner: OEB-1.00
-     */
-    public static final String OWNER_OEB_1_00 = "OEB-1.00";
-    /**
-     *  standard attribute owner: RTF-1.05
-     */
-    public static final String OWNER_RTF_1_05 = "RTF-1.05";
-    /**
-     *  standard attribute owner: CSS-1.00
-     */
-    public static final String OWNER_CSS_1_00 = "CSS-1.00";
-    /**
-     *  standard attribute owner: CSS-2.00
-     */
-    public static final String OWNER_CSS_2_00 = "CSS-2.00";
-
-
-    /**
-     * Default constructor.
-     */
-    public PDExportFormatAttributeObject(String owner)
-    {
-        this.setOwner(owner);
-    }
-
-    /**
-     * Creates a new ExportFormat attribute object with a given dictionary.
-     * 
-     * @param dictionary the dictionary
-     */
-    public PDExportFormatAttributeObject(COSDictionary dictionary)
-    {
-        super(dictionary);
-    }
-
-
-    /**
-     * Gets the list numbering (ListNumbering). The default value is
-     * {@link #LIST_NUMBERING_NONE}.
-     * 
-     * @return the list numbering
-     */
-    public String getListNumbering()
-    {
-        return this.getName(PDListAttributeObject.LIST_NUMBERING,
-            PDListAttributeObject.LIST_NUMBERING_NONE);
-    }
-
-    /**
-     * Sets the list numbering (ListNumbering). The value shall be one of the
-     * following:
-     * <ul>
-     *   <li>{@link #LIST_NUMBERING_NONE},</li>
-     *   <li>{@link #LIST_NUMBERING_DISC},</li>
-     *   <li>{@link #LIST_NUMBERING_CIRCLE},</li>
-     *   <li>{@link #LIST_NUMBERING_SQUARE},</li>
-     *   <li>{@link #LIST_NUMBERING_DECIMAL},</li>
-     *   <li>{@link #LIST_NUMBERING_UPPER_ROMAN},</li>
-     *   <li>{@link #LIST_NUMBERING_LOWER_ROMAN},</li>
-     *   <li>{@link #LIST_NUMBERING_UPPER_ALPHA},</li>
-     *   <li>{@link #LIST_NUMBERING_LOWER_ALPHA}.</li>
-     * </ul>
-     * 
-     * @param listNumbering the list numbering
-     */
-    public void setListNumbering(String listNumbering)
-    {
-        this.setName(PDListAttributeObject.LIST_NUMBERING, listNumbering);
-    }
-
-    /**
-     * Gets the number of rows in the enclosing table that shall be spanned by
-     * the cell (RowSpan). The default value is 1.
-     * 
-     * @return the row span
-     */
-    public int getRowSpan()
-    {
-        return this.getInteger(PDTableAttributeObject.ROW_SPAN, 1);
-    }
-
-    /**
-     * Sets the number of rows in the enclosing table that shall be spanned by
-     * the cell (RowSpan).
-     * 
-     * @param rowSpan the row span
-     */
-    public void setRowSpan(int rowSpan)
-    {
-        this.setInteger(PDTableAttributeObject.ROW_SPAN, rowSpan);
-    }
-
-    /**
-     * Gets the number of columns in the enclosing table that shall be spanned
-     * by the cell (ColSpan). The default value is 1.
-     * 
-     * @return the column span
-     */
-    public int getColSpan()
-    {
-        return this.getInteger(PDTableAttributeObject.COL_SPAN, 1);
-    }
-
-    /**
-     * Sets the number of columns in the enclosing table that shall be spanned
-     * by the cell (ColSpan).
-     * 
-     * @param colSpan the column span
-     */
-    public void setColSpan(int colSpan)
-    {
-        this.setInteger(PDTableAttributeObject.COL_SPAN, colSpan);
-    }
-
-    /**
-     * Gets the headers (Headers). An array of byte strings, where each string
-     * shall be the element identifier (see the
-     * {@link PDStructureElement#getElementIdentifier()}) for a TH structure
-     * element that shall be used as a header associated with this cell.
-     * 
-     * @return the headers.
-     */
-    public String[] getHeaders()
-    {
-        return this.getArrayOfString(PDTableAttributeObject.HEADERS);
-    }
-
-    /**
-     * Sets the headers (Headers). An array of byte strings, where each string
-     * shall be the element identifier (see the
-     * {@link PDStructureElement#getElementIdentifier()}) for a TH structure
-     * element that shall be used as a header associated with this cell.
-     * 
-     * @param headers the headers
-     */
-    public void setHeaders(String[] headers)
-    {
-        this.setArrayOfString(PDTableAttributeObject.HEADERS, headers);
-    }
-
-    /**
-     * Gets the scope (Scope). It shall reflect whether the header cell applies
-     * to the rest of the cells in the row that contains it, the column that
-     * contains it, or both the row and the column that contain it.
-     * 
-     * @return the scope
-     */
-    public String getScope()
-    {
-        return this.getName(PDTableAttributeObject.SCOPE);
-    }
-
-    /**
-     * Sets the scope (Scope). It shall reflect whether the header cell applies
-     * to the rest of the cells in the row that contains it, the column that
-     * contains it, or both the row and the column that contain it. The value
-     * shall be one of the following:
-     * <ul>
-     *   <li>{@link #SCOPE_ROW},</li>
-     *   <li>{@link #SCOPE_COLUMN}, or</li>
-     *   <li>{@link #SCOPE_BOTH}.</li>
-     * </ul>
-     * 
-     * @param scope the scope
-     */
-    public void setScope(String scope)
-    {
-        this.setName(PDTableAttributeObject.SCOPE, scope);
-    }
-
-    /**
-     * Gets the summary of the table’s purpose and structure.
-     * 
-     * @return the summary
-     */
-    public String getSummary()
-    {
-        return this.getString(PDTableAttributeObject.SUMMARY);
-    }
-
-    /**
-     * Sets the summary of the table’s purpose and structure.
-     * 
-     * @param summary the summary
-     */
-    public void setSummary(String summary)
-    {
-        this.setString(PDTableAttributeObject.SUMMARY, summary);
-    }
-
-
-    @Override
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder().append(super.toString());
-        if (this.isSpecified(PDListAttributeObject.LIST_NUMBERING))
-        {
-            sb.append(", ListNumbering=").append(this.getListNumbering());
-        }
-        if (this.isSpecified(PDTableAttributeObject.ROW_SPAN))
-        {
-            sb.append(", RowSpan=").append(String.valueOf(this.getRowSpan()));
-        }
-        if (this.isSpecified(PDTableAttributeObject.COL_SPAN))
-        {
-            sb.append(", ColSpan=").append(String.valueOf(this.getColSpan()));
-        }
-        if (this.isSpecified(PDTableAttributeObject.HEADERS))
-        {
-            sb.append(", Headers=").append(arrayToString(this.getHeaders()));
-        }
-        if (this.isSpecified(PDTableAttributeObject.SCOPE))
-        {
-            sb.append(", Scope=").append(this.getScope());
-        }
-        if (this.isSpecified(PDTableAttributeObject.SUMMARY))
-        {
-            sb.append(", Summary=").append(this.getSummary());
-        }
-        return sb.toString();
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
+
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement;
+
+/**
+ * An Export Format attribute object.
+ * 
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ */
+public class PDExportFormatAttributeObject extends PDLayoutAttributeObject
+{
+
+    /**
+     *  standard attribute owner: XML-1.00
+     */
+    public static final String OWNER_XML_1_00 = "XML-1.00";
+    /**
+     *  standard attribute owner: HTML-3.2
+     */
+    public static final String OWNER_HTML_3_20 = "HTML-3.2";
+    /**
+     *  standard attribute owner: HTML-4.01
+     */
+    public static final String OWNER_HTML_4_01 = "HTML-4.01";
+    /**
+     *  standard attribute owner: OEB-1.00
+     */
+    public static final String OWNER_OEB_1_00 = "OEB-1.00";
+    /**
+     *  standard attribute owner: RTF-1.05
+     */
+    public static final String OWNER_RTF_1_05 = "RTF-1.05";
+    /**
+     *  standard attribute owner: CSS-1.00
+     */
+    public static final String OWNER_CSS_1_00 = "CSS-1.00";
+    /**
+     *  standard attribute owner: CSS-2.00
+     */
+    public static final String OWNER_CSS_2_00 = "CSS-2.00";
+
+
+    /**
+     * Default constructor.
+     */
+    public PDExportFormatAttributeObject(String owner)
+    {
+        this.setOwner(owner);
+    }
+
+    /**
+     * Creates a new ExportFormat attribute object with a given dictionary.
+     * 
+     * @param dictionary the dictionary
+     */
+    public PDExportFormatAttributeObject(COSDictionary dictionary)
+    {
+        super(dictionary);
+    }
+
+
+    /**
+     * Gets the list numbering (ListNumbering). The default value is
+     * {@link #LIST_NUMBERING_NONE}.
+     * 
+     * @return the list numbering
+     */
+    public String getListNumbering()
+    {
+        return this.getName(PDListAttributeObject.LIST_NUMBERING,
+            PDListAttributeObject.LIST_NUMBERING_NONE);
+    }
+
+    /**
+     * Sets the list numbering (ListNumbering). The value shall be one of the
+     * following:
+     * <ul>
+     *   <li>{@link #LIST_NUMBERING_NONE},</li>
+     *   <li>{@link #LIST_NUMBERING_DISC},</li>
+     *   <li>{@link #LIST_NUMBERING_CIRCLE},</li>
+     *   <li>{@link #LIST_NUMBERING_SQUARE},</li>
+     *   <li>{@link #LIST_NUMBERING_DECIMAL},</li>
+     *   <li>{@link #LIST_NUMBERING_UPPER_ROMAN},</li>
+     *   <li>{@link #LIST_NUMBERING_LOWER_ROMAN},</li>
+     *   <li>{@link #LIST_NUMBERING_UPPER_ALPHA},</li>
+     *   <li>{@link #LIST_NUMBERING_LOWER_ALPHA}.</li>
+     * </ul>
+     * 
+     * @param listNumbering the list numbering
+     */
+    public void setListNumbering(String listNumbering)
+    {
+        this.setName(PDListAttributeObject.LIST_NUMBERING, listNumbering);
+    }
+
+    /**
+     * Gets the number of rows in the enclosing table that shall be spanned by
+     * the cell (RowSpan). The default value is 1.
+     * 
+     * @return the row span
+     */
+    public int getRowSpan()
+    {
+        return this.getInteger(PDTableAttributeObject.ROW_SPAN, 1);
+    }
+
+    /**
+     * Sets the number of rows in the enclosing table that shall be spanned by
+     * the cell (RowSpan).
+     * 
+     * @param rowSpan the row span
+     */
+    public void setRowSpan(int rowSpan)
+    {
+        this.setInteger(PDTableAttributeObject.ROW_SPAN, rowSpan);
+    }
+
+    /**
+     * Gets the number of columns in the enclosing table that shall be spanned
+     * by the cell (ColSpan). The default value is 1.
+     * 
+     * @return the column span
+     */
+    public int getColSpan()
+    {
+        return this.getInteger(PDTableAttributeObject.COL_SPAN, 1);
+    }
+
+    /**
+     * Sets the number of columns in the enclosing table that shall be spanned
+     * by the cell (ColSpan).
+     * 
+     * @param colSpan the column span
+     */
+    public void setColSpan(int colSpan)
+    {
+        this.setInteger(PDTableAttributeObject.COL_SPAN, colSpan);
+    }
+
+    /**
+     * Gets the headers (Headers). An array of byte strings, where each string
+     * shall be the element identifier (see the
+     * {@link PDStructureElement#getElementIdentifier()}) for a TH structure
+     * element that shall be used as a header associated with this cell.
+     * 
+     * @return the headers.
+     */
+    public String[] getHeaders()
+    {
+        return this.getArrayOfString(PDTableAttributeObject.HEADERS);
+    }
+
+    /**
+     * Sets the headers (Headers). An array of byte strings, where each string
+     * shall be the element identifier (see the
+     * {@link PDStructureElement#getElementIdentifier()}) for a TH structure
+     * element that shall be used as a header associated with this cell.
+     * 
+     * @param headers the headers
+     */
+    public void setHeaders(String[] headers)
+    {
+        this.setArrayOfString(PDTableAttributeObject.HEADERS, headers);
+    }
+
+    /**
+     * Gets the scope (Scope). It shall reflect whether the header cell applies
+     * to the rest of the cells in the row that contains it, the column that
+     * contains it, or both the row and the column that contain it.
+     * 
+     * @return the scope
+     */
+    public String getScope()
+    {
+        return this.getName(PDTableAttributeObject.SCOPE);
+    }
+
+    /**
+     * Sets the scope (Scope). It shall reflect whether the header cell applies
+     * to the rest of the cells in the row that contains it, the column that
+     * contains it, or both the row and the column that contain it. The value
+     * shall be one of the following:
+     * <ul>
+     *   <li>{@link #SCOPE_ROW},</li>
+     *   <li>{@link #SCOPE_COLUMN}, or</li>
+     *   <li>{@link #SCOPE_BOTH}.</li>
+     * </ul>
+     * 
+     * @param scope the scope
+     */
+    public void setScope(String scope)
+    {
+        this.setName(PDTableAttributeObject.SCOPE, scope);
+    }
+
+    /**
+     * Gets the summary of the table’s purpose and structure.
+     * 
+     * @return the summary
+     */
+    public String getSummary()
+    {
+        return this.getString(PDTableAttributeObject.SUMMARY);
+    }
+
+    /**
+     * Sets the summary of the table’s purpose and structure.
+     * 
+     * @param summary the summary
+     */
+    public void setSummary(String summary)
+    {
+        this.setString(PDTableAttributeObject.SUMMARY, summary);
+    }
+
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder().append(super.toString());
+        if (this.isSpecified(PDListAttributeObject.LIST_NUMBERING))
+        {
+            sb.append(", ListNumbering=").append(this.getListNumbering());
+        }
+        if (this.isSpecified(PDTableAttributeObject.ROW_SPAN))
+        {
+            sb.append(", RowSpan=").append(String.valueOf(this.getRowSpan()));
+        }
+        if (this.isSpecified(PDTableAttributeObject.COL_SPAN))
+        {
+            sb.append(", ColSpan=").append(String.valueOf(this.getColSpan()));
+        }
+        if (this.isSpecified(PDTableAttributeObject.HEADERS))
+        {
+            sb.append(", Headers=").append(arrayToString(this.getHeaders()));
+        }
+        if (this.isSpecified(PDTableAttributeObject.SCOPE))
+        {
+            sb.append(", Scope=").append(this.getScope());
+        }
+        if (this.isSpecified(PDTableAttributeObject.SUMMARY))
+        {
+            sb.append(", Summary=").append(this.getSummary());
+        }
+        return sb.toString();
+    }
+
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java
Fri Sep  3 09:57:26 2010
@@ -1,186 +1,186 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
-
-import org.apache.pdfbox.cos.COSArray;
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSNull;
-import org.apache.pdfbox.pdmodel.common.COSObjectable;
-import org.apache.pdfbox.pdmodel.graphics.color.PDGamma;
-
-/**
- * An object for four colours.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- */
-public class PDFourColours implements COSObjectable
-{
-
-    private COSArray array;
-
-    public PDFourColours()
-    {
-        this.array = new COSArray();
-        this.array.add(COSNull.NULL);
-        this.array.add(COSNull.NULL);
-        this.array.add(COSNull.NULL);
-        this.array.add(COSNull.NULL);
-    }
-
-    public PDFourColours(COSArray array)
-    {
-        this.array = array;
-        // ensure that array has 4 items
-        if (this.array.size() < 4)
-        {
-            for (int i = (this.array.size() - 1); i < 4; i++)
-            {
-                this.array.add(COSNull.NULL);
-            }
-        }
-    }
-
-
-    /**
-     * Gets the colour for the before edge.
-     * 
-     * @return the colour for the before edge
-     */
-    public PDGamma getBeforeColour()
-    {
-        return this.getColourByIndex(0);
-    }
-
-    /**
-     * Sets the colour for the before edge.
-     * 
-     * @param colour the colour for the before edge
-     */
-    public void setBeforeColour(PDGamma colour)
-    {
-        this.setColourByIndex(0, colour);
-    }
-
-    /**
-     * Gets the colour for the after edge.
-     * 
-     * @return the colour for the after edge
-     */
-    public PDGamma getAfterColour()
-    {
-        return this.getColourByIndex(1);
-    }
-
-    /**
-     * Sets the colour for the after edge.
-     * 
-     * @param colour the colour for the after edge
-     */
-    public void setAfterColour(PDGamma colour)
-    {
-        this.setColourByIndex(1, colour);
-    }
-
-    /**
-     * Gets the colour for the start edge.
-     * 
-     * @return the colour for the start edge
-     */
-    public PDGamma getStartColour()
-    {
-        return this.getColourByIndex(2);
-    }
-
-    /**
-     * Sets the colour for the start edge.
-     * 
-     * @param colour the colour for the start edge
-     */
-    public void setStartColour(PDGamma colour)
-    {
-        this.setColourByIndex(2, colour);
-    }
-
-    /**
-     * Gets the colour for the end edge.
-     * 
-     * @return the colour for the end edge
-     */
-    public PDGamma getEndColour()
-    {
-        return this.getColourByIndex(3);
-    }
-
-    /**
-     * Sets the colour for the end edge.
-     * 
-     * @param colour the colour for the end edge
-     */
-    public void setEndColour(PDGamma colour)
-    {
-        this.setColourByIndex(3, colour);
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public COSBase getCOSObject()
-    {
-        return this.array;
-    }
-
-
-    /**
-     * Gets the colour by edge index.
-     * 
-     * @param index edge index
-     * @return the colour
-     */
-    private PDGamma getColourByIndex(int index)
-    {
-        PDGamma retval = null;
-        COSBase item = this.array.getObject(index);
-        if (item instanceof COSArray)
-        {
-            retval = new PDGamma((COSArray) item);
-        }
-        return retval;
-    }
-
-    /**
-     * Sets the colour by edge index.
-     * 
-     * @param index the edge index
-     * @param colour the colour
-     */
-    private void setColourByIndex(int index, PDGamma colour)
-    {
-        COSBase base;
-        if (colour == null)
-        {
-            base = COSNull.NULL;
-        }
-        else
-        {
-            base = colour.getCOSArray();
-        }
-        this.array.set(index, base);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSNull;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
+import org.apache.pdfbox.pdmodel.graphics.color.PDGamma;
+
+/**
+ * An object for four colours.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ */
+public class PDFourColours implements COSObjectable
+{
+
+    private COSArray array;
+
+    public PDFourColours()
+    {
+        this.array = new COSArray();
+        this.array.add(COSNull.NULL);
+        this.array.add(COSNull.NULL);
+        this.array.add(COSNull.NULL);
+        this.array.add(COSNull.NULL);
+    }
+
+    public PDFourColours(COSArray array)
+    {
+        this.array = array;
+        // ensure that array has 4 items
+        if (this.array.size() < 4)
+        {
+            for (int i = (this.array.size() - 1); i < 4; i++)
+            {
+                this.array.add(COSNull.NULL);
+            }
+        }
+    }
+
+
+    /**
+     * Gets the colour for the before edge.
+     * 
+     * @return the colour for the before edge
+     */
+    public PDGamma getBeforeColour()
+    {
+        return this.getColourByIndex(0);
+    }
+
+    /**
+     * Sets the colour for the before edge.
+     * 
+     * @param colour the colour for the before edge
+     */
+    public void setBeforeColour(PDGamma colour)
+    {
+        this.setColourByIndex(0, colour);
+    }
+
+    /**
+     * Gets the colour for the after edge.
+     * 
+     * @return the colour for the after edge
+     */
+    public PDGamma getAfterColour()
+    {
+        return this.getColourByIndex(1);
+    }
+
+    /**
+     * Sets the colour for the after edge.
+     * 
+     * @param colour the colour for the after edge
+     */
+    public void setAfterColour(PDGamma colour)
+    {
+        this.setColourByIndex(1, colour);
+    }
+
+    /**
+     * Gets the colour for the start edge.
+     * 
+     * @return the colour for the start edge
+     */
+    public PDGamma getStartColour()
+    {
+        return this.getColourByIndex(2);
+    }
+
+    /**
+     * Sets the colour for the start edge.
+     * 
+     * @param colour the colour for the start edge
+     */
+    public void setStartColour(PDGamma colour)
+    {
+        this.setColourByIndex(2, colour);
+    }
+
+    /**
+     * Gets the colour for the end edge.
+     * 
+     * @return the colour for the end edge
+     */
+    public PDGamma getEndColour()
+    {
+        return this.getColourByIndex(3);
+    }
+
+    /**
+     * Sets the colour for the end edge.
+     * 
+     * @param colour the colour for the end edge
+     */
+    public void setEndColour(PDGamma colour)
+    {
+        this.setColourByIndex(3, colour);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public COSBase getCOSObject()
+    {
+        return this.array;
+    }
+
+
+    /**
+     * Gets the colour by edge index.
+     * 
+     * @param index edge index
+     * @return the colour
+     */
+    private PDGamma getColourByIndex(int index)
+    {
+        PDGamma retval = null;
+        COSBase item = this.array.getObject(index);
+        if (item instanceof COSArray)
+        {
+            retval = new PDGamma((COSArray) item);
+        }
+        return retval;
+    }
+
+    /**
+     * Sets the colour by edge index.
+     * 
+     * @param index the edge index
+     * @param colour the colour
+     */
+    private void setColourByIndex(int index, PDGamma colour)
+    {
+        COSBase base;
+        if (colour == null)
+        {
+            base = COSNull.NULL;
+        }
+        else
+        {
+            base = colour.getCOSArray();
+        }
+        this.array.set(index, base);
+    }
+
+}

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message