You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ju...@apache.org on 2010/09/03 11:57:27 UTC
svn commit: r992248 [1/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...
Author: jukka
Date: Fri Sep 3 09:57:26 2010
New Revision: 992248
URL: http://svn.apache.org/viewvc?rev=992248&view=rev
Log:
Add missing svn:eol-style settings
Modified:
pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDExportFormatAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDFourColours.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDLayoutAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDListAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDPrintFieldAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDStandardAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDTableAttributeObject.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java (contents, props changed)
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/package.html (contents, props changed)
Modified: pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg (original)
+++ pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg Fri Sep 3 09:57:26 2010
@@ -1,82 +1,82 @@
-<?xml version="1.0" standalone="no"?>
-<!--
- 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.
--->
-
-<!--
- SVG Anteater logo
-
-To get started with SVG, I'd recommend getting the Adobe SVG plugin, and the
-xml-batik CVS module. Then have a look at the xml-batik/samples files. Use the
-SVG spec (http://www.w3.org/TR/SVG/) as a reference.
--->
-
-<!-- See Forrest Issue: FOR-229
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
-"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
-[
- <!ATTLIST svg xmlns:for CDATA #FIXED "http://apache.org/forrest">
- <!ENTITY % textExt "|for:group-name">
- <!ELEMENT for:group-name (#PCDATA)>
-]>
--->
-<svg xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xsl:version="1.0"
- xmlns:for="http://apache.org/forrest"
- width="220" height="65" >
- <title>Anteater logo</title>
-
- <defs>
-
- <!--
- <radialGradient id="radialGradient">
- <stop style="stop-color:gold" offset="0"/>
- <stop style="stop-color:orange" offset=".5"/>
- <stop style="stop-color:crimson" offset="1"/>
- </radialGradient>
- <linearGradient id="linearGradient">
- <stop style="stop-color:gold" offset="0"/>
- <stop style="stop-color:orange" offset=".5"/>
- <stop style="stop-color:crimson" offset="1"/>
- </linearGradient>
- -->
-
- <linearGradient id="gradient" x1="0" y1="0" x2="0" y2="1">
- <stop style="stop-color:white" offset="0"/>
- <stop style="stop-color:lightgreen" offset="1"/>
- </linearGradient>
-
- <filter id="shadowFilter" filterUnits="objectBoundingBox">
- <!-- Takes the alpha channel (black outline of the text), blurs it and saves as 'blur' -->
- <feGaussianBlur in="SourceAlpha" stdDeviation="2 2" result="blur"/>
- <!-- Takes saved 'blur' and offsets it by 4 pixels, saves as 'offsetBlur' -->
- <feOffset in="blur" dx="4" dy="4" result="offsetBlur"/>
- <!-- Merges SourceGraphic (original image) and 'offsetBlur', putting the
- former 'over' the latter, and using the merged result as the finished
- image -->
- <feComposite in="SourceGraphic" in2="offsetBlur" operator="over"/>
- </filter>
-
- </defs>
-
- <g filter="url(#shadowFilter)" fill="url(#gradient)">
- <text x="40%" y="60%" style="font-size:24pt; font-family:Verdana ; text-anchor: middle">
- <for:group-name />
- </text>
- </g>
-</svg>
+<?xml version="1.0" standalone="no"?>
+<!--
+ 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.
+-->
+
+<!--
+ SVG Anteater logo
+
+To get started with SVG, I'd recommend getting the Adobe SVG plugin, and the
+xml-batik CVS module. Then have a look at the xml-batik/samples files. Use the
+SVG spec (http://www.w3.org/TR/SVG/) as a reference.
+-->
+
+<!-- See Forrest Issue: FOR-229
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
+[
+ <!ATTLIST svg xmlns:for CDATA #FIXED "http://apache.org/forrest">
+ <!ENTITY % textExt "|for:group-name">
+ <!ELEMENT for:group-name (#PCDATA)>
+]>
+-->
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xsl:version="1.0"
+ xmlns:for="http://apache.org/forrest"
+ width="220" height="65" >
+ <title>Anteater logo</title>
+
+ <defs>
+
+ <!--
+ <radialGradient id="radialGradient">
+ <stop style="stop-color:gold" offset="0"/>
+ <stop style="stop-color:orange" offset=".5"/>
+ <stop style="stop-color:crimson" offset="1"/>
+ </radialGradient>
+ <linearGradient id="linearGradient">
+ <stop style="stop-color:gold" offset="0"/>
+ <stop style="stop-color:orange" offset=".5"/>
+ <stop style="stop-color:crimson" offset="1"/>
+ </linearGradient>
+ -->
+
+ <linearGradient id="gradient" x1="0" y1="0" x2="0" y2="1">
+ <stop style="stop-color:white" offset="0"/>
+ <stop style="stop-color:lightgreen" offset="1"/>
+ </linearGradient>
+
+ <filter id="shadowFilter" filterUnits="objectBoundingBox">
+ <!-- Takes the alpha channel (black outline of the text), blurs it and saves as 'blur' -->
+ <feGaussianBlur in="SourceAlpha" stdDeviation="2 2" result="blur"/>
+ <!-- Takes saved 'blur' and offsets it by 4 pixels, saves as 'offsetBlur' -->
+ <feOffset in="blur" dx="4" dy="4" result="offsetBlur"/>
+ <!-- Merges SourceGraphic (original image) and 'offsetBlur', putting the
+ former 'over' the latter, and using the merged result as the finished
+ image -->
+ <feComposite in="SourceGraphic" in2="offsetBlur" operator="over"/>
+ </filter>
+
+ </defs>
+
+ <g filter="url(#shadowFilter)" fill="url(#gradient)">
+ <text x="40%" y="60%" style="font-size:24pt; font-family:Verdana ; text-anchor: middle">
+ <for:group-name />
+ </text>
+ </g>
+</svg>
Propchange: pdfbox/trunk/fontbox/src/main/site/resources/images/group.svg
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java Fri Sep 3 09:57:26 2010
@@ -1,68 +1,68 @@
-/*
- * 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.filter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-
-/**
- *
- * @author adam.nichols
- */
-public class CryptFilter implements Filter
-{
- /**
- * {@inheritDoc}
- */
- public void decode( InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex )
- throws IOException
- {
- COSName encryptionName = (COSName)options.getDictionaryObject(COSName.NAME);
- if(encryptionName == null || encryptionName.equals(COSName.IDENTITY))
- {
- // currently the only supported implementation is the Identity crypt filter
- Filter identityFilter = new IdentityFilter();
- identityFilter.decode(compressedData, result, options, filterIndex);
- }
- else
- {
- throw new IOException("Unsupported crypt filter "+encryptionName.getName());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
- throws IOException
- {
- COSName encryptionName = (COSName)options.getDictionaryObject(COSName.NAME);
- if(encryptionName == null || encryptionName.equals(COSName.IDENTITY))
- {
- // currently the only supported implementation is the Identity crypt filter
- Filter identityFilter = new IdentityFilter();
- identityFilter.encode(rawData, result, options, filterIndex);
- }
- else
- {
- throw new IOException("Unsupported crypt filter "+encryptionName.getName());
- }
- }
-}
+/*
+ * 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.filter;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+
+/**
+ *
+ * @author adam.nichols
+ */
+public class CryptFilter implements Filter
+{
+ /**
+ * {@inheritDoc}
+ */
+ public void decode( InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex )
+ throws IOException
+ {
+ COSName encryptionName = (COSName)options.getDictionaryObject(COSName.NAME);
+ if(encryptionName == null || encryptionName.equals(COSName.IDENTITY))
+ {
+ // currently the only supported implementation is the Identity crypt filter
+ Filter identityFilter = new IdentityFilter();
+ identityFilter.decode(compressedData, result, options, filterIndex);
+ }
+ else
+ {
+ throw new IOException("Unsupported crypt filter "+encryptionName.getName());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
+ throws IOException
+ {
+ COSName encryptionName = (COSName)options.getDictionaryObject(COSName.NAME);
+ if(encryptionName == null || encryptionName.equals(COSName.IDENTITY))
+ {
+ // currently the only supported implementation is the Identity crypt filter
+ Filter identityFilter = new IdentityFilter();
+ identityFilter.encode(rawData, result, options, filterIndex);
+ }
+ else
+ {
+ throw new IOException("Unsupported crypt filter "+encryptionName.getName());
+ }
+ }
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CryptFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java Fri Sep 3 09:57:26 2010
@@ -1,64 +1,64 @@
-/*
- * 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.filter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.apache.pdfbox.cos.COSDictionary;
-
-/**
- * The IdentityFilter filter just passes the data through without any modifications.
- * This is defined in section 7.6.5 of the PDF 1.7 spec and also stated in table
- * 26.
- *
- * @author adam.nichols
- */
-public class IdentityFilter implements Filter
-{
- private static final int BUFFER_SIZE = 1024;
-
- /**
- * {@inheritDoc}
- */
- public void decode( InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex )
- throws IOException
- {
- byte[] buffer = new byte[BUFFER_SIZE];
- int amountRead = 0;
- while( (amountRead = compressedData.read( buffer, 0, BUFFER_SIZE )) != -1 )
- {
- result.write( buffer, 0, amountRead );
- }
- result.flush();
- }
-
- /**
- * {@inheritDoc}
- */
- public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
- throws IOException
- {
- byte[] buffer = new byte[BUFFER_SIZE];
- int amountRead = 0;
- while( (amountRead = rawData.read( buffer, 0, BUFFER_SIZE )) != -1 )
- {
- result.write( buffer, 0, amountRead );
- }
- result.flush();
- }
-}
+/*
+ * 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.filter;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import org.apache.pdfbox.cos.COSDictionary;
+
+/**
+ * The IdentityFilter filter just passes the data through without any modifications.
+ * This is defined in section 7.6.5 of the PDF 1.7 spec and also stated in table
+ * 26.
+ *
+ * @author adam.nichols
+ */
+public class IdentityFilter implements Filter
+{
+ private static final int BUFFER_SIZE = 1024;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void decode( InputStream compressedData, OutputStream result, COSDictionary options, int filterIndex )
+ throws IOException
+ {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ int amountRead = 0;
+ while( (amountRead = compressedData.read( buffer, 0, BUFFER_SIZE )) != -1 )
+ {
+ result.write( buffer, 0, amountRead );
+ }
+ result.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void encode( InputStream rawData, OutputStream result, COSDictionary options, int filterIndex )
+ throws IOException
+ {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ int amountRead = 0;
+ while( (amountRead = rawData.read( buffer, 0, BUFFER_SIZE )) != -1 )
+ {
+ result.write( buffer, 0, amountRead );
+ }
+ result.flush();
+ }
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/IdentityFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java Fri Sep 3 09:57:26 2010
@@ -1,92 +1,92 @@
-/*
- * 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.common;
-
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSDictionary;
-
-/**
- * A wrapper for a COS dictionary.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- *
- */
-public class PDDictionaryWrapper implements COSObjectable
-{
-
- private final COSDictionary dictionary;
-
- /**
- * Default constructor
- */
- public PDDictionaryWrapper()
- {
- this.dictionary = new COSDictionary();
- }
-
- /**
- * Creates a new instance with a given COS dictionary.
- *
- * @param dictionary the dictionary
- */
- public PDDictionaryWrapper(COSDictionary dictionary)
- {
- this.dictionary = dictionary;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public COSBase getCOSObject()
- {
- return this.dictionary;
- }
-
- /**
- * Gets the COS dictionary.
- *
- * @return the COS dictionary
- */
- protected COSDictionary getCOSDictionary()
- {
- return this.dictionary;
- }
-
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj instanceof PDDictionaryWrapper)
- {
- return this.dictionary.equals(((PDDictionaryWrapper) obj).dictionary);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return this.dictionary.hashCode();
- }
-
-}
+/*
+ * 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.common;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSDictionary;
+
+/**
+ * A wrapper for a COS dictionary.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ *
+ */
+public class PDDictionaryWrapper implements COSObjectable
+{
+
+ private final COSDictionary dictionary;
+
+ /**
+ * Default constructor
+ */
+ public PDDictionaryWrapper()
+ {
+ this.dictionary = new COSDictionary();
+ }
+
+ /**
+ * Creates a new instance with a given COS dictionary.
+ *
+ * @param dictionary the dictionary
+ */
+ public PDDictionaryWrapper(COSDictionary dictionary)
+ {
+ this.dictionary = dictionary;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public COSBase getCOSObject()
+ {
+ return this.dictionary;
+ }
+
+ /**
+ * Gets the COS dictionary.
+ *
+ * @return the COS dictionary
+ */
+ protected COSDictionary getCOSDictionary()
+ {
+ return this.dictionary;
+ }
+
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj instanceof PDDictionaryWrapper)
+ {
+ return this.dictionary.equals(((PDDictionaryWrapper) obj).dictionary);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return this.dictionary.hashCode();
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDDictionaryWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java Fri Sep 3 09:57:26 2010
@@ -1,66 +1,66 @@
-/*
- * 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.common;
-
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-
-/**
- * A wrapper for a COS dictionary including Type information.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- *
- */
-public class PDTypedDictionaryWrapper extends PDDictionaryWrapper
-{
-
- /**
- * Creates a new instance with a given type.
- *
- * @param type the type (Type)
- */
- public PDTypedDictionaryWrapper(String type)
- {
- super();
- this.getCOSDictionary().setName(COSName.TYPE, type);
- }
-
- /**
- * Creates a new instance with a given COS dictionary.
- *
- * @param dictionary the dictionary
- */
- public PDTypedDictionaryWrapper(COSDictionary dictionary)
- {
- super(dictionary);
- }
-
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType()
- {
- return this.getCOSDictionary().getNameAsString(COSName.TYPE);
- }
-
- // There is no setType(String) method because changing the Type would most
- // probably also change the type of PD object.
-}
+/*
+ * 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.common;
+
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+
+/**
+ * A wrapper for a COS dictionary including Type information.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ *
+ */
+public class PDTypedDictionaryWrapper extends PDDictionaryWrapper
+{
+
+ /**
+ * Creates a new instance with a given type.
+ *
+ * @param type the type (Type)
+ */
+ public PDTypedDictionaryWrapper(String type)
+ {
+ super();
+ this.getCOSDictionary().setName(COSName.TYPE, type);
+ }
+
+ /**
+ * Creates a new instance with a given COS dictionary.
+ *
+ * @param dictionary the dictionary
+ */
+ public PDTypedDictionaryWrapper(COSDictionary dictionary)
+ {
+ super(dictionary);
+ }
+
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType()
+ {
+ return this.getCOSDictionary().getNameAsString(COSName.TYPE);
+ }
+
+ // There is no setType(String) method because changing the Type would most
+ // probably also change the type of PD object.
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDTypedDictionaryWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java Fri Sep 3 09:57:26 2010
@@ -1,248 +1,248 @@
-/*
- * 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.logicalstructure;
-
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper;
-import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDExportFormatAttributeObject;
-import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDLayoutAttributeObject;
-import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDListAttributeObject;
-import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDPrintFieldAttributeObject;
-import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDTableAttributeObject;
-
-/**
- * An attribute object.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- *
- */
-public abstract class PDAttributeObject extends PDDictionaryWrapper
-{
-
- /**
- * Creates an attribute object.
- *
- * @param dictionary the dictionary
- * @return the attribute object
- */
- public static PDAttributeObject create(COSDictionary dictionary)
- {
- String owner = dictionary.getNameAsString(COSName.O);
- if (PDUserAttributeObject.OWNER_USER_PROPERTIES.equals(owner))
- {
- return new PDUserAttributeObject(dictionary);
- }
- else if (PDListAttributeObject.OWNER_LIST.equals(owner))
- {
- return new PDListAttributeObject(dictionary);
- }
- else if (PDPrintFieldAttributeObject.OWNER_PRINT_FIELD.equals(owner))
- {
- return new PDPrintFieldAttributeObject(dictionary);
- }
- else if (PDTableAttributeObject.OWNER_TABLE.equals(owner))
- {
- return new PDTableAttributeObject(dictionary);
- }
- else if (PDLayoutAttributeObject.OWNER_LAYOUT.equals(owner))
- {
- return new PDLayoutAttributeObject(dictionary);
- }
- else if (PDExportFormatAttributeObject.OWNER_XML_1_00.equals(owner)
- || PDExportFormatAttributeObject.OWNER_HTML_3_20.equals(owner)
- || PDExportFormatAttributeObject.OWNER_HTML_4_01.equals(owner)
- || PDExportFormatAttributeObject.OWNER_OEB_1_00.equals(owner)
- || PDExportFormatAttributeObject.OWNER_RTF_1_05.equals(owner)
- || PDExportFormatAttributeObject.OWNER_CSS_1_00.equals(owner)
- || PDExportFormatAttributeObject.OWNER_CSS_2_00.equals(owner))
- {
- return new PDExportFormatAttributeObject(dictionary);
- }
- return new PDDefaultAttributeObject(dictionary);
- }
-
- private PDStructureElement structureElement;
-
- /**
- * Gets the structure element.
- *
- * @return the structure element
- */
- private PDStructureElement getStructureElement()
- {
- return this.structureElement;
- }
-
- /**
- * Sets the structure element.
- *
- * @param structureElement the structure element
- */
- protected void setStructureElement(PDStructureElement structureElement)
- {
- this.structureElement = structureElement;
- }
-
-
- /**
- * Default constructor.
- */
- public PDAttributeObject()
- {
- }
-
- /**
- * Creates a new attribute object with a given dictionary.
- *
- * @param dictionary the dictionary
- */
- public PDAttributeObject(COSDictionary dictionary)
- {
- super(dictionary);
- }
-
-
- /**
- * Returns the owner of the attributes.
- *
- * @return the owner of the attributes
- */
- public String getOwner()
- {
- return this.getCOSDictionary().getNameAsString(COSName.O);
- }
-
- /**
- * Sets the owner of the attributes.
- *
- * @param owner the owner of the attributes
- */
- protected void setOwner(String owner)
- {
- this.getCOSDictionary().setName(COSName.O, owner);
- }
-
- /**
- * Detects whether there are no properties in the attribute object.
- *
- * @return <code>true</code> if the attribute object is empty,
- * <code>false</code> otherwise
- */
- public boolean isEmpty()
- {
- // only entry is the owner?
- return (this.getCOSDictionary().size() == 1) && (this.getOwner() != null);
- }
-
-
- /**
- * Notifies the attribute object change listeners if the attribute is changed.
- *
- * @param oldBase old value
- * @param newBase new value
- */
- protected void potentiallyNotifyChanged(COSBase oldBase, COSBase newBase)
- {
- if (this.isValueChanged(oldBase, newBase))
- {
- this.notifyChanged();
- }
- }
-
- /**
- * Is the value changed?
- *
- * @param oldValue old value
- * @param newValue new value
- * @return <code>true</code> if the value is changed, <code>false</code>
- * otherwise
- */
- private boolean isValueChanged(COSBase oldValue, COSBase newValue)
- {
- if (oldValue == null)
- {
- if (newValue == null)
- {
- return false;
- }
- return true;
- }
- return !oldValue.equals(newValue);
- }
-
- /**
- * Notifies the attribute object change listeners about a change in this
- * attribute object.
- */
- protected void notifyChanged()
- {
- if (this.getStructureElement() != null)
- {
- this.getStructureElement().attributeChanged(this);
- }
- }
-
- @Override
- public String toString()
- {
- return new StringBuilder("O=").append(this.getOwner()).toString();
- }
-
- /**
- * Creates a String representation of an Object array.
- *
- * @param array the Object array
- * @return the String representation
- */
- protected static String arrayToString(Object[] array)
- {
- StringBuilder sb = new StringBuilder("[");
- for (int i = 0; i < array.length; i++)
- {
- if (i > 0)
- {
- sb.append(", ");
- }
- sb.append(array[i]);
- }
- return sb.append(']').toString();
- }
-
- /**
- * Creates a String representation of a float array.
- *
- * @param array the float array
- * @return the String representation
- */
- protected static String arrayToString(float[] array)
- {
- StringBuilder sb = new StringBuilder("[");
- for (int i = 0; i < array.length; i++)
- {
- if (i > 0)
- {
- sb.append(", ");
- }
- sb.append(array[i]);
- }
- return sb.append(']').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.logicalstructure;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper;
+import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDExportFormatAttributeObject;
+import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDLayoutAttributeObject;
+import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDListAttributeObject;
+import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDPrintFieldAttributeObject;
+import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDTableAttributeObject;
+
+/**
+ * An attribute object.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ *
+ */
+public abstract class PDAttributeObject extends PDDictionaryWrapper
+{
+
+ /**
+ * Creates an attribute object.
+ *
+ * @param dictionary the dictionary
+ * @return the attribute object
+ */
+ public static PDAttributeObject create(COSDictionary dictionary)
+ {
+ String owner = dictionary.getNameAsString(COSName.O);
+ if (PDUserAttributeObject.OWNER_USER_PROPERTIES.equals(owner))
+ {
+ return new PDUserAttributeObject(dictionary);
+ }
+ else if (PDListAttributeObject.OWNER_LIST.equals(owner))
+ {
+ return new PDListAttributeObject(dictionary);
+ }
+ else if (PDPrintFieldAttributeObject.OWNER_PRINT_FIELD.equals(owner))
+ {
+ return new PDPrintFieldAttributeObject(dictionary);
+ }
+ else if (PDTableAttributeObject.OWNER_TABLE.equals(owner))
+ {
+ return new PDTableAttributeObject(dictionary);
+ }
+ else if (PDLayoutAttributeObject.OWNER_LAYOUT.equals(owner))
+ {
+ return new PDLayoutAttributeObject(dictionary);
+ }
+ else if (PDExportFormatAttributeObject.OWNER_XML_1_00.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_HTML_3_20.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_HTML_4_01.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_OEB_1_00.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_RTF_1_05.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_CSS_1_00.equals(owner)
+ || PDExportFormatAttributeObject.OWNER_CSS_2_00.equals(owner))
+ {
+ return new PDExportFormatAttributeObject(dictionary);
+ }
+ return new PDDefaultAttributeObject(dictionary);
+ }
+
+ private PDStructureElement structureElement;
+
+ /**
+ * Gets the structure element.
+ *
+ * @return the structure element
+ */
+ private PDStructureElement getStructureElement()
+ {
+ return this.structureElement;
+ }
+
+ /**
+ * Sets the structure element.
+ *
+ * @param structureElement the structure element
+ */
+ protected void setStructureElement(PDStructureElement structureElement)
+ {
+ this.structureElement = structureElement;
+ }
+
+
+ /**
+ * Default constructor.
+ */
+ public PDAttributeObject()
+ {
+ }
+
+ /**
+ * Creates a new attribute object with a given dictionary.
+ *
+ * @param dictionary the dictionary
+ */
+ public PDAttributeObject(COSDictionary dictionary)
+ {
+ super(dictionary);
+ }
+
+
+ /**
+ * Returns the owner of the attributes.
+ *
+ * @return the owner of the attributes
+ */
+ public String getOwner()
+ {
+ return this.getCOSDictionary().getNameAsString(COSName.O);
+ }
+
+ /**
+ * Sets the owner of the attributes.
+ *
+ * @param owner the owner of the attributes
+ */
+ protected void setOwner(String owner)
+ {
+ this.getCOSDictionary().setName(COSName.O, owner);
+ }
+
+ /**
+ * Detects whether there are no properties in the attribute object.
+ *
+ * @return <code>true</code> if the attribute object is empty,
+ * <code>false</code> otherwise
+ */
+ public boolean isEmpty()
+ {
+ // only entry is the owner?
+ return (this.getCOSDictionary().size() == 1) && (this.getOwner() != null);
+ }
+
+
+ /**
+ * Notifies the attribute object change listeners if the attribute is changed.
+ *
+ * @param oldBase old value
+ * @param newBase new value
+ */
+ protected void potentiallyNotifyChanged(COSBase oldBase, COSBase newBase)
+ {
+ if (this.isValueChanged(oldBase, newBase))
+ {
+ this.notifyChanged();
+ }
+ }
+
+ /**
+ * Is the value changed?
+ *
+ * @param oldValue old value
+ * @param newValue new value
+ * @return <code>true</code> if the value is changed, <code>false</code>
+ * otherwise
+ */
+ private boolean isValueChanged(COSBase oldValue, COSBase newValue)
+ {
+ if (oldValue == null)
+ {
+ if (newValue == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ return !oldValue.equals(newValue);
+ }
+
+ /**
+ * Notifies the attribute object change listeners about a change in this
+ * attribute object.
+ */
+ protected void notifyChanged()
+ {
+ if (this.getStructureElement() != null)
+ {
+ this.getStructureElement().attributeChanged(this);
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return new StringBuilder("O=").append(this.getOwner()).toString();
+ }
+
+ /**
+ * Creates a String representation of an Object array.
+ *
+ * @param array the Object array
+ * @return the String representation
+ */
+ protected static String arrayToString(Object[] array)
+ {
+ StringBuilder sb = new StringBuilder("[");
+ for (int i = 0; i < array.length; i++)
+ {
+ if (i > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(array[i]);
+ }
+ return sb.append(']').toString();
+ }
+
+ /**
+ * Creates a String representation of a float array.
+ *
+ * @param array the float array
+ * @return the String representation
+ */
+ protected static String arrayToString(float[] array)
+ {
+ StringBuilder sb = new StringBuilder("[");
+ for (int i = 0; i < array.length; i++)
+ {
+ if (i > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(array[i]);
+ }
+ return sb.append(']').toString();
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java Fri Sep 3 09:57:26 2010
@@ -1,133 +1,133 @@
-/*
- * 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.logicalstructure;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-
-/**
- * A default attribute object.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- */
-public class PDDefaultAttributeObject extends PDAttributeObject
-{
-
- /**
- * Default constructor.
- */
- public PDDefaultAttributeObject()
- {
- }
-
- /**
- * Creates a default attribute object with a given dictionary.
- *
- * @param dictionary the dictionary
- */
- public PDDefaultAttributeObject(COSDictionary dictionary)
- {
- super(dictionary);
- }
-
-
- /**
- * Gets the attribute names.
- *
- * @return the attribute names
- */
- public List<String> getAttributeNames()
- {
- List<String> attrNames = new ArrayList<String>();
- for (Entry<COSName, COSBase> entry : this.getCOSDictionary().entrySet())
- {
- COSName key = entry.getKey();
- if (!COSName.O.equals(key))
- {
- attrNames.add(key.getName());
- }
- }
- return attrNames;
- }
-
- /**
- * Gets the attribute value for a given name.
- *
- * @param attrName the given attribute name
- * @return the attribute value for a given name
- */
- public COSBase getAttributeValue(String attrName)
- {
- return this.getCOSDictionary().getDictionaryObject(attrName);
- }
-
- /**
- * Gets the attribute value for a given name.
- *
- * @param attrName the given attribute name
- * @param defaultValue the default value
- * @return the attribute value for a given name
- */
- protected COSBase getAttributeValue(String attrName, COSBase defaultValue)
- {
- COSBase value = this.getCOSDictionary().getDictionaryObject(attrName);
- if (value == null)
- {
- return defaultValue;
- }
- return value;
- }
-
- /**
- * Sets an attribute.
- *
- * @param attrName the attribute name
- * @param attrValue the attribute value
- */
- public void setAttribute(String attrName, COSBase attrValue)
- {
- COSBase old = this.getAttributeValue(attrName);
- this.getCOSDictionary().setItem(COSName.getPDFName(attrName), attrValue);
- this.potentiallyNotifyChanged(old, attrValue);
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder().append(super.toString())
- .append(", attributes={");
- Iterator<String> it = this.getAttributeNames().iterator();
- while (it.hasNext())
- {
- String name = it.next();
- sb.append(name).append('=').append(this.getAttributeValue(name));
- if (it.hasNext())
- {
- sb.append(", ");
- }
- }
- return sb.append('}').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.logicalstructure;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+
+/**
+ * A default attribute object.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ */
+public class PDDefaultAttributeObject extends PDAttributeObject
+{
+
+ /**
+ * Default constructor.
+ */
+ public PDDefaultAttributeObject()
+ {
+ }
+
+ /**
+ * Creates a default attribute object with a given dictionary.
+ *
+ * @param dictionary the dictionary
+ */
+ public PDDefaultAttributeObject(COSDictionary dictionary)
+ {
+ super(dictionary);
+ }
+
+
+ /**
+ * Gets the attribute names.
+ *
+ * @return the attribute names
+ */
+ public List<String> getAttributeNames()
+ {
+ List<String> attrNames = new ArrayList<String>();
+ for (Entry<COSName, COSBase> entry : this.getCOSDictionary().entrySet())
+ {
+ COSName key = entry.getKey();
+ if (!COSName.O.equals(key))
+ {
+ attrNames.add(key.getName());
+ }
+ }
+ return attrNames;
+ }
+
+ /**
+ * Gets the attribute value for a given name.
+ *
+ * @param attrName the given attribute name
+ * @return the attribute value for a given name
+ */
+ public COSBase getAttributeValue(String attrName)
+ {
+ return this.getCOSDictionary().getDictionaryObject(attrName);
+ }
+
+ /**
+ * Gets the attribute value for a given name.
+ *
+ * @param attrName the given attribute name
+ * @param defaultValue the default value
+ * @return the attribute value for a given name
+ */
+ protected COSBase getAttributeValue(String attrName, COSBase defaultValue)
+ {
+ COSBase value = this.getCOSDictionary().getDictionaryObject(attrName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+ return value;
+ }
+
+ /**
+ * Sets an attribute.
+ *
+ * @param attrName the attribute name
+ * @param attrValue the attribute value
+ */
+ public void setAttribute(String attrName, COSBase attrValue)
+ {
+ COSBase old = this.getAttributeValue(attrName);
+ this.getCOSDictionary().setItem(COSName.getPDFName(attrName), attrValue);
+ this.potentiallyNotifyChanged(old, attrValue);
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder().append(super.toString())
+ .append(", attributes={");
+ Iterator<String> it = this.getAttributeNames().iterator();
+ while (it.hasNext())
+ {
+ String name = it.next();
+ sb.append(name).append('=').append(this.getAttributeValue(name));
+ if (it.hasNext())
+ {
+ sb.append(", ");
+ }
+ }
+ return sb.append('}').toString();
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDDefaultAttributeObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java Fri Sep 3 09:57:26 2010
@@ -1,135 +1,135 @@
-/*
- * 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.logicalstructure;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.pdfbox.cos.COSArray;
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-
-/**
- * A User attribute object.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- */
-public class PDUserAttributeObject extends PDAttributeObject
-{
-
- /**
- * Attribute owner for user properties
- */
- public static final String OWNER_USER_PROPERTIES = "UserProperties";
-
-
- /**
- * Default constructor
- */
- public PDUserAttributeObject()
- {
- this.setOwner(OWNER_USER_PROPERTIES);
- }
-
- /**
- *
- * @param dictionary the dictionary
- */
- public PDUserAttributeObject(COSDictionary dictionary)
- {
- super(dictionary);
- }
-
-
- /**
- * Returns the user properties.
- *
- * @return the user properties
- */
- public List<PDUserProperty> getOwnerUserProperties()
- {
- COSArray p = (COSArray) this.getCOSDictionary()
- .getDictionaryObject(COSName.P);
- List<PDUserProperty> properties = new ArrayList<PDUserProperty>(p.size());
- for (int i = 0; i < p.size(); i++)
- {
- properties.add(
- new PDUserProperty((COSDictionary) p.getObject(i), this));
- }
- return properties;
- }
-
- /**
- * Sets the user properties.
- *
- * @param userProperties the user properties
- */
- public void setUserProperties(List<PDUserProperty> userProperties)
- {
- COSArray p = new COSArray();
- for (PDUserProperty userProperty : userProperties)
- {
- p.add(userProperty);
- }
- this.getCOSDictionary().setItem(COSName.P, p);
- }
-
- /**
- * Adds a user property.
- *
- * @param userProperty the user property
- */
- public void addUserProperty(PDUserProperty userProperty)
- {
- COSArray p = (COSArray) this.getCOSDictionary()
- .getDictionaryObject(COSName.P);
- p.add(userProperty);
- this.notifyChanged();
- }
-
- /**
- * Removes a user property.
- *
- * @param userProperty the user property
- */
- public void removeUserProperty(PDUserProperty userProperty)
- {
- if (userProperty == null)
- {
- return;
- }
- COSArray p = (COSArray) this.getCOSDictionary()
- .getDictionaryObject(COSName.P);
- p.remove(userProperty.getCOSObject());
- this.notifyChanged();
- }
-
- public void userPropertyChanged(PDUserProperty userProperty)
- {
-
- }
-
- @Override
- public String toString()
- {
- return new StringBuilder().append(super.toString())
- .append(", userProperties=")
- .append(this.getOwnerUserProperties()).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.logicalstructure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+
+/**
+ * A User attribute object.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ */
+public class PDUserAttributeObject extends PDAttributeObject
+{
+
+ /**
+ * Attribute owner for user properties
+ */
+ public static final String OWNER_USER_PROPERTIES = "UserProperties";
+
+
+ /**
+ * Default constructor
+ */
+ public PDUserAttributeObject()
+ {
+ this.setOwner(OWNER_USER_PROPERTIES);
+ }
+
+ /**
+ *
+ * @param dictionary the dictionary
+ */
+ public PDUserAttributeObject(COSDictionary dictionary)
+ {
+ super(dictionary);
+ }
+
+
+ /**
+ * Returns the user properties.
+ *
+ * @return the user properties
+ */
+ public List<PDUserProperty> getOwnerUserProperties()
+ {
+ COSArray p = (COSArray) this.getCOSDictionary()
+ .getDictionaryObject(COSName.P);
+ List<PDUserProperty> properties = new ArrayList<PDUserProperty>(p.size());
+ for (int i = 0; i < p.size(); i++)
+ {
+ properties.add(
+ new PDUserProperty((COSDictionary) p.getObject(i), this));
+ }
+ return properties;
+ }
+
+ /**
+ * Sets the user properties.
+ *
+ * @param userProperties the user properties
+ */
+ public void setUserProperties(List<PDUserProperty> userProperties)
+ {
+ COSArray p = new COSArray();
+ for (PDUserProperty userProperty : userProperties)
+ {
+ p.add(userProperty);
+ }
+ this.getCOSDictionary().setItem(COSName.P, p);
+ }
+
+ /**
+ * Adds a user property.
+ *
+ * @param userProperty the user property
+ */
+ public void addUserProperty(PDUserProperty userProperty)
+ {
+ COSArray p = (COSArray) this.getCOSDictionary()
+ .getDictionaryObject(COSName.P);
+ p.add(userProperty);
+ this.notifyChanged();
+ }
+
+ /**
+ * Removes a user property.
+ *
+ * @param userProperty the user property
+ */
+ public void removeUserProperty(PDUserProperty userProperty)
+ {
+ if (userProperty == null)
+ {
+ return;
+ }
+ COSArray p = (COSArray) this.getCOSDictionary()
+ .getDictionaryObject(COSName.P);
+ p.remove(userProperty.getCOSObject());
+ this.notifyChanged();
+ }
+
+ public void userPropertyChanged(PDUserProperty userProperty)
+ {
+
+ }
+
+ @Override
+ public String toString()
+ {
+ return new StringBuilder().append(super.toString())
+ .append(", userProperties=")
+ .append(this.getOwnerUserProperties()).toString();
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java Fri Sep 3 09:57:26 2010
@@ -1,191 +1,191 @@
-/*
- * 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.logicalstructure;
-
-import org.apache.pdfbox.cos.COSBase;
-import org.apache.pdfbox.cos.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper;
-
-/**
- * A user property.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- */
-public class PDUserProperty extends PDDictionaryWrapper
-{
-
- private final PDUserAttributeObject userAttributeObject;
-
- /**
- * Creates a new user property.
- *
- * @param the user attribute object
- */
- public PDUserProperty(PDUserAttributeObject userAttributeObject)
- {
- this.userAttributeObject = userAttributeObject;
- }
-
- /**
- * Creates a user property with a given dictionary.
- *
- * @param dictionary the dictionary
- * @param the user attribute object
- */
- public PDUserProperty(COSDictionary dictionary,
- PDUserAttributeObject userAttributeObject)
- {
- super(dictionary);
- this.userAttributeObject = userAttributeObject;
- }
-
-
- /**
- * Returns the property name.
- *
- * @return the property name
- */
- public String getName()
- {
- return this.getCOSDictionary().getNameAsString(COSName.N);
- }
-
- /**
- * Sets the property name.
- *
- * @param name the property name
- */
- public void setName(String name)
- {
- this.potentiallyNotifyChanged(this.getName(), name);
- this.getCOSDictionary().setName(COSName.N, name);
- }
-
- /**
- * Returns the property value.
- *
- * @return the property value
- */
- public COSBase getValue()
- {
- return this.getCOSDictionary().getDictionaryObject(COSName.V);
- }
-
- /**
- * Sets the property value.
- *
- * @param value the property value
- */
- public void setValue(COSBase value)
- {
- this.potentiallyNotifyChanged(this.getValue(), value);
- this.getCOSDictionary().setItem(COSName.V, value);
- }
-
- /**
- * Returns the string for the property value.
- *
- * @return the string for the property value
- */
- public String getFormattedValue()
- {
- return this.getCOSDictionary().getString(COSName.F);
- }
-
- /**
- * Sets the string for the property value.
- *
- * @param formattedValue the string for the property value
- */
- public void setFormattedValue(String formattedValue)
- {
- this.potentiallyNotifyChanged(this.getFormattedValue(), formattedValue);
- this.getCOSDictionary().setString(COSName.F, formattedValue);
- }
-
- /**
- * Shall the property be hidden?
- *
- * @return <code>true</code> if the property shall be hidden,
- * <code>false</code> otherwise
- */
- public boolean isHidden()
- {
- return this.getCOSDictionary().getBoolean(COSName.H, false);
- }
-
- /**
- * Specifies whether the property shall be hidden.
- *
- * @param hidden <code>true</code> if the property shall be hidden,
- * <code>false</code> otherwise
- */
- public void setHidden(boolean hidden)
- {
- this.potentiallyNotifyChanged(this.isHidden(), hidden);
- this.getCOSDictionary().setBoolean(COSName.H, hidden);
- }
-
-
- @Override
- public String toString()
- {
- return new StringBuilder("Name=").append(this.getName())
- .append(", Value=").append(this.getValue())
- .append(", FormattedValue=").append(this.getFormattedValue())
- .append(", Hidden=").append(this.isHidden()).toString();
- }
-
-
- /**
- * Notifies the user attribute object if the user property is changed.
- *
- * @param oldEntry old entry
- * @param newEntry new entry
- */
- private void potentiallyNotifyChanged(Object oldEntry, Object newEntry)
- {
- if (this.isEntryChanged(oldEntry, newEntry))
- {
- this.userAttributeObject.userPropertyChanged(this);
- }
- }
-
- /**
- * Is the value changed?
- *
- * @param oldEntry old entry
- * @param newEntry new entry
- * @return <code>true</code> if the entry is changed, <code>false</code>
- * otherwise
- */
- private boolean isEntryChanged(Object oldEntry, Object newEntry)
- {
- if (oldEntry == null)
- {
- if (newEntry == null)
- {
- return false;
- }
- return true;
- }
- return !oldEntry.equals(newEntry);
- }
-
-}
+/*
+ * 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.logicalstructure;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.common.PDDictionaryWrapper;
+
+/**
+ * A user property.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ */
+public class PDUserProperty extends PDDictionaryWrapper
+{
+
+ private final PDUserAttributeObject userAttributeObject;
+
+ /**
+ * Creates a new user property.
+ *
+ * @param the user attribute object
+ */
+ public PDUserProperty(PDUserAttributeObject userAttributeObject)
+ {
+ this.userAttributeObject = userAttributeObject;
+ }
+
+ /**
+ * Creates a user property with a given dictionary.
+ *
+ * @param dictionary the dictionary
+ * @param the user attribute object
+ */
+ public PDUserProperty(COSDictionary dictionary,
+ PDUserAttributeObject userAttributeObject)
+ {
+ super(dictionary);
+ this.userAttributeObject = userAttributeObject;
+ }
+
+
+ /**
+ * Returns the property name.
+ *
+ * @return the property name
+ */
+ public String getName()
+ {
+ return this.getCOSDictionary().getNameAsString(COSName.N);
+ }
+
+ /**
+ * Sets the property name.
+ *
+ * @param name the property name
+ */
+ public void setName(String name)
+ {
+ this.potentiallyNotifyChanged(this.getName(), name);
+ this.getCOSDictionary().setName(COSName.N, name);
+ }
+
+ /**
+ * Returns the property value.
+ *
+ * @return the property value
+ */
+ public COSBase getValue()
+ {
+ return this.getCOSDictionary().getDictionaryObject(COSName.V);
+ }
+
+ /**
+ * Sets the property value.
+ *
+ * @param value the property value
+ */
+ public void setValue(COSBase value)
+ {
+ this.potentiallyNotifyChanged(this.getValue(), value);
+ this.getCOSDictionary().setItem(COSName.V, value);
+ }
+
+ /**
+ * Returns the string for the property value.
+ *
+ * @return the string for the property value
+ */
+ public String getFormattedValue()
+ {
+ return this.getCOSDictionary().getString(COSName.F);
+ }
+
+ /**
+ * Sets the string for the property value.
+ *
+ * @param formattedValue the string for the property value
+ */
+ public void setFormattedValue(String formattedValue)
+ {
+ this.potentiallyNotifyChanged(this.getFormattedValue(), formattedValue);
+ this.getCOSDictionary().setString(COSName.F, formattedValue);
+ }
+
+ /**
+ * Shall the property be hidden?
+ *
+ * @return <code>true</code> if the property shall be hidden,
+ * <code>false</code> otherwise
+ */
+ public boolean isHidden()
+ {
+ return this.getCOSDictionary().getBoolean(COSName.H, false);
+ }
+
+ /**
+ * Specifies whether the property shall be hidden.
+ *
+ * @param hidden <code>true</code> if the property shall be hidden,
+ * <code>false</code> otherwise
+ */
+ public void setHidden(boolean hidden)
+ {
+ this.potentiallyNotifyChanged(this.isHidden(), hidden);
+ this.getCOSDictionary().setBoolean(COSName.H, hidden);
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return new StringBuilder("Name=").append(this.getName())
+ .append(", Value=").append(this.getValue())
+ .append(", FormattedValue=").append(this.getFormattedValue())
+ .append(", Hidden=").append(this.isHidden()).toString();
+ }
+
+
+ /**
+ * Notifies the user attribute object if the user property is changed.
+ *
+ * @param oldEntry old entry
+ * @param newEntry new entry
+ */
+ private void potentiallyNotifyChanged(Object oldEntry, Object newEntry)
+ {
+ if (this.isEntryChanged(oldEntry, newEntry))
+ {
+ this.userAttributeObject.userPropertyChanged(this);
+ }
+ }
+
+ /**
+ * Is the value changed?
+ *
+ * @param oldEntry old entry
+ * @param newEntry new entry
+ * @return <code>true</code> if the entry is changed, <code>false</code>
+ * otherwise
+ */
+ private boolean isEntryChanged(Object oldEntry, Object newEntry)
+ {
+ if (oldEntry == null)
+ {
+ if (newEntry == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ return !oldEntry.equals(newEntry);
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java?rev=992248&r1=992247&r2=992248&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java Fri Sep 3 09:57:26 2010
@@ -1,147 +1,147 @@
-/*
- * 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.COSDictionary;
-import org.apache.pdfbox.cos.COSName;
-import org.apache.pdfbox.pdmodel.common.PDRectangle;
-import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent;
-
-/**
- * An artifact marked content.
- *
- * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
- * @version $Revision: $
- *
- */
-public class PDArtifactMarkedContent extends PDMarkedContent
-{
-
- public PDArtifactMarkedContent(COSDictionary properties)
- {
- super(COSName.ARTIFACT, properties);
- }
-
-
- /**
- * Gets the type (Type).
- *
- * @return the type
- */
- public String getType()
- {
- return this.getProperties().getNameAsString(COSName.TYPE);
- }
-
- /**
- * Gets the artifact's bounding box (BBox).
- *
- * @return the artifact's bounding box
- */
- public PDRectangle getBBox()
- {
- PDRectangle retval = null;
- COSArray a = (COSArray) this.getProperties().getDictionaryObject(
- COSName.BBOX);
- if (a != null)
- {
- retval = new PDRectangle(a);
- }
- return retval;
- }
-
- /**
- * Is the artifact attached to the top edge?
- *
- * @return <code>true</code> if the artifact is attached to the top edge,
- * <code>false</code> otherwise
- */
- public boolean isTopAttached()
- {
- return this.isAttached("Top");
- }
-
- /**
- * Is the artifact attached to the bottom edge?
- *
- * @return <code>true</code> if the artifact is attached to the bottom edge,
- * <code>false</code> otherwise
- */
- public boolean isBottomAttached()
- {
- return this.isAttached("Bottom");
- }
-
- /**
- * Is the artifact attached to the left edge?
- *
- * @return <code>true</code> if the artifact is attached to the left edge,
- * <code>false</code> otherwise
- */
- public boolean isLeftAttached()
- {
- return this.isAttached("Left");
- }
-
- /**
- * Is the artifact attached to the right edge?
- *
- * @return <code>true</code> if the artifact is attached to the right edge,
- * <code>false</code> otherwise
- */
- public boolean isRightAttached()
- {
- return this.isAttached("Right");
- }
-
- /**
- * Gets the subtype (Subtype).
- *
- * @return the subtype
- */
- public String getSubtype()
- {
- return this.getProperties().getNameAsString(COSName.SUBTYPE);
- }
-
-
- /**
- * Is the artifact attached to the given edge?
- *
- * @param edge the edge
- * @return <code>true</code> if the artifact is attached to the given edge,
- * <code>false</code> otherwise
- */
- private boolean isAttached(String edge)
- {
- COSArray a = (COSArray) this.getProperties().getDictionaryObject(
- COSName.ATTACHED);
- if (a != null)
- {
- for (int i = 0; i < a.size(); i++)
- {
- if (edge.equals(a.getName(i)))
- {
- return true;
- }
- }
- }
- return false;
- }
-
-}
+/*
+ * 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.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.common.PDRectangle;
+import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent;
+
+/**
+ * An artifact marked content.
+ *
+ * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
+ * @version $Revision: $
+ *
+ */
+public class PDArtifactMarkedContent extends PDMarkedContent
+{
+
+ public PDArtifactMarkedContent(COSDictionary properties)
+ {
+ super(COSName.ARTIFACT, properties);
+ }
+
+
+ /**
+ * Gets the type (Type).
+ *
+ * @return the type
+ */
+ public String getType()
+ {
+ return this.getProperties().getNameAsString(COSName.TYPE);
+ }
+
+ /**
+ * Gets the artifact's bounding box (BBox).
+ *
+ * @return the artifact's bounding box
+ */
+ public PDRectangle getBBox()
+ {
+ PDRectangle retval = null;
+ COSArray a = (COSArray) this.getProperties().getDictionaryObject(
+ COSName.BBOX);
+ if (a != null)
+ {
+ retval = new PDRectangle(a);
+ }
+ return retval;
+ }
+
+ /**
+ * Is the artifact attached to the top edge?
+ *
+ * @return <code>true</code> if the artifact is attached to the top edge,
+ * <code>false</code> otherwise
+ */
+ public boolean isTopAttached()
+ {
+ return this.isAttached("Top");
+ }
+
+ /**
+ * Is the artifact attached to the bottom edge?
+ *
+ * @return <code>true</code> if the artifact is attached to the bottom edge,
+ * <code>false</code> otherwise
+ */
+ public boolean isBottomAttached()
+ {
+ return this.isAttached("Bottom");
+ }
+
+ /**
+ * Is the artifact attached to the left edge?
+ *
+ * @return <code>true</code> if the artifact is attached to the left edge,
+ * <code>false</code> otherwise
+ */
+ public boolean isLeftAttached()
+ {
+ return this.isAttached("Left");
+ }
+
+ /**
+ * Is the artifact attached to the right edge?
+ *
+ * @return <code>true</code> if the artifact is attached to the right edge,
+ * <code>false</code> otherwise
+ */
+ public boolean isRightAttached()
+ {
+ return this.isAttached("Right");
+ }
+
+ /**
+ * Gets the subtype (Subtype).
+ *
+ * @return the subtype
+ */
+ public String getSubtype()
+ {
+ return this.getProperties().getNameAsString(COSName.SUBTYPE);
+ }
+
+
+ /**
+ * Is the artifact attached to the given edge?
+ *
+ * @param edge the edge
+ * @return <code>true</code> if the artifact is attached to the given edge,
+ * <code>false</code> otherwise
+ */
+ private boolean isAttached(String edge)
+ {
+ COSArray a = (COSArray) this.getProperties().getDictionaryObject(
+ COSName.ATTACHED);
+ if (a != null)
+ {
+ for (int i = 0; i < a.size(); i++)
+ {
+ if (edge.equals(a.getName(i)))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/PDArtifactMarkedContent.java
------------------------------------------------------------------------------
svn:eol-style = native