Author: acumiskey
Date: Tue Jun 23 13:12:46 2009
New Revision: 787665

URL: http://svn.apache.org/viewvc?rev=787665&view=rev
Log:
Extracted DummyPercentBaseContext from FOPRtfAttributes and made universally 
available.

Added:
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/DummyPercentBaseContext.java
Modified:
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java

Added: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/DummyPercentBaseContext.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/DummyPercentBaseContext.java?rev=787665&view=auto
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/DummyPercentBaseContext.java
 (added)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/DummyPercentBaseContext.java
 Tue Jun 23 13:12:46 2009
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render;
+
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.fo.FObj;
+
+/**
+ * A dummy implementation of PercentBaseContext
+ */
+public final class DummyPercentBaseContext implements PercentBaseContext {
+
+    private static DummyPercentBaseContext singleton = new 
DummyPercentBaseContext();
+
+    private DummyPercentBaseContext() {
+    }
+
+    /**
+     * Returns an instance of this dummy implementation
+     * @return an instance of this dummy implementation
+     */
+    public static DummyPercentBaseContext getInstance() {
+        return singleton;
+    }
+    
+    /** {...@inheritdoc} */
+    public int getBaseLength(int lengthBase, FObj fo) {
+        return 0;
+    }
+}
\ No newline at end of file

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java?rev=787665&r1=787664&r2=787665&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java 
Tue Jun 23 13:12:46 2009
@@ -21,8 +21,7 @@
 
 import java.awt.Color;
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.PercentBaseContext;
-import org.apache.fop.fo.FObj;
+import org.apache.fop.render.DummyPercentBaseContext;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable;
 
@@ -62,7 +61,7 @@
      */
     public RtfAttributes setHalfPoints(String name, Length value) {
         //Convert millipoints to half-points
-        set(name, value.getValue(DummyPercentBaseContext.singleton) / (1000 / 
2));
+        set(name, value.getValue(DummyPercentBaseContext.getInstance()) / 
(1000 / 2));
         return this;
     }
 
@@ -82,17 +81,4 @@
         return this;
     }
 
-    private static class DummyPercentBaseContext implements PercentBaseContext 
{
-
-        static DummyPercentBaseContext singleton = new 
DummyPercentBaseContext();
-
-        private DummyPercentBaseContext() {
-            // noop
-        }
-
-        public int getBaseLength(int lengthBase, FObj fo) {
-            return 0;
-        }
-    }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to