Archive for November 3rd, 2009

Building a Font Setting Plug-in – Part 3


This may well be the last post in this series. I have a basically working plug-in, after finding a few things (which I will cover in more detail below):

  1. couple of interesting features,
  2. something which needs to be implemented (overridden),
  3. a useful tool for looking under the covers at a .net assembly,
  4. a very useful fragment of code for XML escaping a text string,
  5. and brushing up my skills with WinForms.

Interesting Features

  1. The text inserted by the plug-in is not spelling checked. This for me makes the plug-in next door to useless. Not sure if I can work a way around this feature. I’ll have a bit of an explore I think I’ve seen checking switch on for other inserted content (yes the code window below is spelling checking). So, this may not be the last in the series. Time for some more digging into the Writer API.
  2. The Settings property is an interesting beast. The setting are persisted directly, which makes it interesting getting cancel buttons to ignore what has been happening. I’ve ended up passing Font and Color objects around, and only persisting the values out of them when I have an OK which gets the program to to main (plug-in) level.

Override Required

The GenerateEditorHTML needs to be overridden. This is the method which gets called in the content in the side bar is changed.

public override string GenerateEditorHtml(ISmartContent content, IPublishingContext publishingContext)
   return BuildHTML(content, publishingContext);

Useful Tool – IDLASM

This is one which I found when trying to sort out the GIF file not found problem. The big feature for me at that time was dumping (into a window) the manifest on the assembly. There are bound to be lots of other reasons to pull this tool out.

XML Escaping.

This one is courtesy of the post on Stack Overflow – string escape into XML. A very simple to get all those &lt an the like into your string (which is going to be html (or xml).


, , , ,

Leave a comment

%d bloggers like this: