]> granicus.if.org Git - docbook-dsssl/commitdiff
Added modifications so that the new callout.icon.size parameter is taken into account...
authorMauritz Jeanson <mj@johanneberg.com>
Thu, 19 Jul 2007 17:07:39 +0000 (17:07 +0000)
committerMauritz Jeanson <mj@johanneberg.com>
Thu, 19 Jul 2007 17:07:39 +0000 (17:07 +0000)
parameter is used for FO output (where SVG now is the default graphics format for callouts).

xsl-java/saxon65/src/com/nwalsh/saxon/FormatGraphicCallout.java
xsl-java/saxon65/src/com/nwalsh/saxon/Verbatim.java
xsl-java/xalan27/src/com/nwalsh/xalan/FormatGraphicCallout.java
xsl-java/xalan27/src/com/nwalsh/xalan/Verbatim.java

index c72b9bf53b377d502cded164bc13fd8d91b68352..1ea084217343a643fa8c5578125e600aad2ccd72 100644 (file)
@@ -36,12 +36,14 @@ public class FormatGraphicCallout extends FormatCallout {
   String graphicsPath = "";
   String graphicsExt = "";
   int graphicsMax = 0;
+  String iconSize = "";
 
-  public FormatGraphicCallout(NamePool nPool, String path, String ext, int max, boolean fo) {
+  public FormatGraphicCallout(NamePool nPool, String path, String ext, int max, String size, boolean fo) {
     super(nPool, fo);
     graphicsPath = path;
     graphicsExt = ext;
     graphicsMax = max;
+    iconSize = size;
   }
 
   public void formatCallout(Emitter rtfEmitter,
@@ -68,6 +70,8 @@ public class FormatGraphicCallout extends FormatCallout {
          imgAttr.addAttribute("", "", "src", "CDATA", "url(" +          
                               graphicsPath + num + graphicsExt + ")"); 
          imgAttr.addAttribute("", "", "id", "CDATA", id);
+         imgAttr.addAttribute("", "", "content-width", "CDATA", iconSize);
+         imgAttr.addAttribute("", "", "width", "CDATA", iconSize);
          
          // HTML
        } else {
index 2bff9a02e019ef844d20d2565e839d00a9f26a61..9470f8acffa1192f4e94604291360a2a109a0719 100644 (file)
@@ -78,6 +78,8 @@ public class Verbatim {
   private static String graphicsExt = null;
   /** The largest callout number that can be represented graphically. */
   private static int graphicsMax = 10;
+  /** The size of the callout icon. */
+  private static String iconSize = null;
 
   /** The FormatCallout object to use for formatting callouts. */
   private static FormatCallout fCallout = null;
@@ -317,7 +319,7 @@ public class Verbatim {
 
     int unicodeStart = 49;
     int unicodeMax = 0;
-
+   
     String unicodeFont = "";
 
     // Hardcoded defaults
@@ -325,6 +327,7 @@ public class Verbatim {
     graphicsPath = null;
     graphicsExt = null;
     graphicsMax = 0;
+    iconSize = "7pt";
     foStylesheet = false;
     calloutsSetup = true;
 
@@ -371,10 +374,15 @@ public class Verbatim {
        graphicsMax = 0;
       }
 
+      // Get the callout icon size
+      varString = getVariable(context, "callout.icon.size");
+      iconSize = varString;
+      
       fCallout = new FormatGraphicCallout(namePool,
                                          graphicsPath,
                                          graphicsExt,
                                          graphicsMax,
+                                         iconSize,
                                          foStylesheet);
     } else if (useUnicode) {
       // Get the starting character
index bdbf35b01f0a4676eacc75f15bd36fe681ad0aaa..33f41240599bfb3ffac743ccb88fd39d4936ab5a 100644 (file)
@@ -32,12 +32,17 @@ public class FormatGraphicCallout extends FormatCallout {
   String graphicsPath = "";
   String graphicsExt = "";
   int graphicsMax = 0;
+  String iconSize = "";
 
-  public FormatGraphicCallout(String path, String ext, int max, boolean fo) {
+  public FormatGraphicCallout(String path, String ext, int max, String size, boolean fo) {
     graphicsPath = path;
     graphicsExt = ext;
     graphicsMax = max;
     stylesheetFO = fo;
+    iconSize = size;
+
+    //System.out.println("Size: " + size);
+
   }
 
   public void formatCallout(DOMBuilder rtf,
@@ -61,6 +66,8 @@ public class FormatGraphicCallout extends FormatCallout {
          imgAttr.addAttribute("", "src", "src", "CDATA", "url(" +
                               graphicsPath + num + graphicsExt + ")");
          imgAttr.addAttribute("", "id", "id", "ID", id);
+         imgAttr.addAttribute("", "content-width", "content-width", "CDATA", iconSize);
+         imgAttr.addAttribute("", "width", "width", "CDATA", iconSize);
 
        } else {
          ns = "";
index 51f369b5f4a505d7ba3723775be4ee1205336560..8b868ea7041d24377bad26226c8ba8c33aea3e86 100644 (file)
@@ -94,6 +94,8 @@ public class Verbatim {
   private String graphicsExt = null;
   /** The largest callout number that can be represented graphically. */
   private int graphicsMax = 10;
+ /** The size of the callout icon. */
+  private static String iconSize = null;
   /** Should graphic callouts use fo:external-graphics or imgs. */
   private boolean graphicsFO = false;
 
@@ -440,9 +442,10 @@ public class Verbatim {
       String gPath = Params.getString(context, "callout.graphics.path");
       String gExt = Params.getString(context, "callout.graphics.extension");
       int gMax = Params.getInt(context, "callout.graphics.number.limit");
+      String gSize = Params.getString(context, "callout.icon.size");
     
       return insertGraphicCallouts(areaspecNodeSet, xalanNI, defaultColumn,
-                                  gPath, gExt, gMax, useFO);
+                                  gPath, gExt, gMax, gSize, useFO);
 
     } else if (Params.getBoolean(context, "callout.unicode")) {
       int uStart = Params.getInt(context, "callout.unicode.start.character");
@@ -469,8 +472,9 @@ public class Verbatim {
                                                 String gPath,
                                                 String gExt,
                                                 int gMax,
+                                                String gSize,
                                                 boolean useFO) {
-    FormatGraphicCallout fgc = new FormatGraphicCallout(gPath,gExt,gMax,useFO);
+    FormatGraphicCallout fgc = new FormatGraphicCallout(gPath,gExt,gMax, gSize, useFO);
     return insertCallouts(areaspecNodeSet, xalanNI, defaultColumn, fgc);
   }