Page 1 of 1

Is it simple to update an Add-on which no longer works?

Posted: Mon Dec 22, 2014 2:46 pm
by John_Ha
This Writer post Readability Report has been read nearly 700 times suggesting there is a lot of interest in the Readability Report Add-on. A post says:
As near as I can discern, it appears that the author, "neiln," sold the code to Microsoft for MS Office 2010 and stopped OpenOffice development, making this "abandonware."

As we still have access to the oxt file, how difficult would it be to get it working with AOO 4.1.1? Is it simply a case of updating a field "Works with ..." to include 4.1.1 and see it it does indeed work with 4.1.1? Or it more complicated than that?

Re: Is it simple to update an Add-on which no longer works?

Posted: Mon Dec 22, 2014 3:31 pm
by RoryOF
I've recently looked at an extension which was written in Java; the Java source was available, and I was eventually able to modify it and compile it to run on OO 4.1.1 (a miracle, as I don't know any Java!). Readability Report (from memory) was written in Java, but would need to be decompiled which takes a lot of work (experience years ago with CP/M 3).

Much of the logic behind Readability Report is published in some academic papers by the author.

Re: Is it simple to update an Add-on which no longer works?

Posted: Mon Dec 22, 2014 8:46 pm
by Villeroy
viewtopic.php?f=7&t=65420
markinapub wrote:I'm not getting any errors from the extension manager; it says it's installed fine but I cannot locate it anywhere in the program.
The devs changed the XML configuration of menu entries and toolbar buttons. Either you modify the add-on configuration accordingly (no, I don't know how) or you find out the service URL which triggers some action. The URL should be mentioned in the Addon.xcu. It starts with protocol service:[/url]
Copy this URL into a document, turn it into a hyperlink and click it. If it pops up some dialog or something, you can use it in a Basic macro like this:

Code: Select all

Sub Start_MyExtension()
srv = createUnoService("some.path.MyExtension.StartDialog")
srv.trigger("")
End Sub
and add some custom toolbar, menu, keyboard shortcut triggering that macro.
See also viewtopic.php?t=37989&p=183658#p183658 with my "SpecialCells" add-on and a macro trigger.

Re: Is it simple to update an Add-on which no longer works?

Posted: Mon Dec 22, 2014 11:59 pm
by John_Ha
Villeroy wrote:... or you find out the service URL which triggers some action. The URL should be mentioned in the Addon.xcu. It starts with protocol service:[/url]

Villeroy

Thanks. I am stumbling a bit in the dark here, as I don't really understand HTML, but I couldn't find anything which looked like that in Addons.xcu which I have copied below ...

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>

<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
  <node oor:name="AddonUI">

    <node oor:name="OfficeToolBar">
      <node oor:name="surrey.readabilityreport" oor:op="replace">
      <node oor:name="m1" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Readability</value>
        </prop>
        <prop oor:name="ImageIdentifier" oor:type="xs:string">
          <value/>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value/>
          <value xml:lang="en">Readability Report</value>
        </prop>
      </node>
      <node oor:name="m2" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:BrainOverload</value>
        </prop>
        <prop oor:name="ImageIdentifier" oor:type="xs:string">
          <value/>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value/>
          <value xml:lang="en">Brain Overload Report</value>
        </prop>
      </node>
      <node oor:name="m3" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Coherence</value>
        </prop>
        <prop oor:name="ImageIdentifier" oor:type="xs:string">
          <value/>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value/>
          <value xml:lang="en">Coherence Report</value>
        </prop>
      </node>
      <node oor:name="m4" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Detailed</value>
        </prop>
        <prop oor:name="ImageIdentifier" oor:type="xs:string">
          <value/>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.text.TextDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value/>
          <value xml:lang="en">Detailed Report</value>
        </prop>
      </node>
      </node>
    </node>
    <node oor:name="Images">
      <node oor:name="com.surrey.readabilityreport.readability.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Readability</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/syntax2.jpg</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.overload.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:BrainOverload</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/brain3.PNG</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.coherence.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Coherence</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/coherence2.JPG</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.detailed.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Detailed</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/syntax3.jpg</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      </node>
  </node>
</oor:component-data>

Re: Is it simple to update an Add-on which no longer works?

Posted: Tue Dec 23, 2014 12:37 am
by John_Ha
I have been doing some more digging and came across Extensions and Apache OpenOffice 4.0 which gives an example of an AOO v3 Addons.xcu and the changes needed to make it work under AOO v4. I am trying to work my way through it ...

Re: Is it simple to update an Add-on which no longer works?

Posted: Wed Dec 24, 2014 11:32 pm
by Villeroy
Try this macro:

Code: Select all

Sub openReadabilityReport()
srv = createUnoService("com.surrey.readabilityreport:Readability")
srv.trigger()
End Sub
If it works as expected, create your own customized UI for it.

Re: Is it simple to update an Add-on which no longer works?

Posted: Thu Dec 25, 2014 12:15 am
by John_Ha
Villeroy

Thank you. I had previously installed the Readability Report add on, so I placed the macro in my macro library and Tools > Macros > Run macro > and ran it. Unfortunately it stopped at the srv.trigger() line with the error message "Basic run-time error. Object variable not set".

AOO 4.1.1 under W7.

Re: Is it simple to update an Add-on which no longer works?

Posted: Thu Dec 25, 2014 5:07 am
by hanya
Replace older Addons.xcu file with this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data oor:name="Addons" oor:package="org.openoffice.Office" 
xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <node oor:name="AddonUI">
    <node oor:name="OfficeToolBar">
      <node oor:name="surrey.readabilityreport" oor:op="replace">
          <prop oor:name="Title" oor:type="xs:string">
            <value xml:lang="en-US">Readability Report</value>
          </prop>
        <node oor:name="ToolBarItems">
          <node oor:name="m1" oor:op="replace">
            <prop oor:name="URL" oor:type="xs:string">
              <value>com.surrey.readabilityreport:Readability</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.text.TextDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value/>
              <value xml:lang="en">Readability Report</value>
            </prop>
          </node>
          <node oor:name="m2" oor:op="replace">
            <prop oor:name="URL" oor:type="xs:string">
              <value>com.surrey.readabilityreport:BrainOverload</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.text.TextDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value/>
              <value xml:lang="en">Brain Overload Report</value>
            </prop>
          </node>
          <node oor:name="m3" oor:op="replace">
            <prop oor:name="URL" oor:type="xs:string">
              <value>com.surrey.readabilityreport:Coherence</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.text.TextDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value/>
              <value xml:lang="en">Coherence Report</value>
            </prop>
          </node>
          <node oor:name="m4" oor:op="replace">
            <prop oor:name="URL" oor:type="xs:string">
              <value>com.surrey.readabilityreport:Detailed</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.text.TextDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value/>
              <value xml:lang="en">Detailed Report</value>
            </prop>
          </node>
        </node>
      </node>
    </node>
    <node oor:name="Images">
      <node oor:name="com.surrey.readabilityreport.readability.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Readability</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/syntax2.jpg</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.overload.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:BrainOverload</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/brain3.PNG</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.coherence.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Coherence</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/coherence2.JPG</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
      <node oor:name="com.surrey.readabilityreport.detailed.images" oor:op="replace">
        <prop oor:name="URL" oor:type="xs:string">
          <value>com.surrey.readabilityreport:Detailed</value>
        </prop>
        <node oor:name="UserDefinedImages">
          <prop oor:name="ImageSmallURL">
            <value>%origin%/../../../../../images/syntax3.jpg</value>
          </prop>
          <prop oor:name="ImageBigURL">
            <value/>
          </prop>
          <prop oor:name="ImageSmallHCURL">
            <value/>
          </prop>
          <prop oor:name="ImageBigHCURL">
            <value/>
          </prop>
        </node>
      </node>
    </node>
  </node>
</oor:component-data>
 Edit: Title was placed in the wrong node.

I made conversion tool: https://dl.dropboxusercontent.com/u/917 ... uconv.html 

Re: Is it simple to update an Add-on which no longer works?

Posted: Thu Dec 25, 2014 5:03 pm
by Villeroy
Hanya,
Thank you for helping out with add-in configuration again.
John_Ha wrote:Is it simple to update an Add-on which no longer works?
As you can see it is far from simple. In theory it is very easy to do when you have the right text editors to edit well formed XML with some hierarchical view and syntax highlight. Let me outline the relevant nodes and properties from your original xcu file:

Code: Select all

Addons
    AddonUI
        OfficeToolBar
            surrey.readabilityreport
                m1
                    URL
                    Imageidentifier
                    Target
                    Context
                    Title
                m2
                m3
                m4
        Images
There is one Addons node with one AddonUI having one OfficeToolBar and Images. OfficeToolBar has one surrey.readabilityreport having 4 buttons m1,m2,m3 and m4 each one having 5 properties URL, Imageidentifier, Target, Context and Title.

Hanya changed it to this structure:

Code: Select all

Addons
    AddonUI
        OfficeToolBar
            surrey.readabilityreport
                ToolBarItems
                    Title
                    m1
                        URL
                        Imageidentifier
                        Target
                        Context
                        Title
                    m2
                    m3
                    m4
        Images
where surrey.readabilityreport has one note of ToolBarItems with one Title property and the 4 toolbar buttons m1,m2,m3 and m4.

I can not test this configuration because I could not find this addon on the internet.

Since 1 hour I try to adjust the Addon.xcu of my own "SpecialCells" add-on for Calc but I never see any toolbar whereas the trigger macros do work.

Re: Is it simple to update an Add-on which no longer works?

Posted: Thu Dec 25, 2014 6:44 pm
by hanya
where surrey.readabilityreport has one note of ToolBarItems with one Title property and the 4 toolbar buttons m1,m2,m3 and m4.
Sorry, this was wrong. Title property should be placed with the same level of the ToolBarItems. I fixed in the above code. But even the Title property is placed in the ToolBarItems node, the toolbar should be shown.
I can not test this configuration because I could not find this addon on the internet.
I could obtain from here: http://extensions.openoffice.org/en/pro ... report-204
It says the package is OS dependent but it seems it works well on Linux environment.
Since 1 hour I try to adjust the Addon.xcu of my own "SpecialCells" add-on for Calc but I never see any toolbar whereas the trigger macros do work.
This looks working well on AOO 4.1.1:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
  <node oor:name="AddonUI">
    <node oor:name="AddonMenu">
      <node oor:name="name.AndreasSaeger.SpecialCells" oor:op="replace">
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.sheet.SpreadsheetDocument</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value xml:lang="en">SpecialCells</value>
        </prop>
        <prop oor:name="URL" oor:type="xs:string">
          <value/>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_self</value>
        </prop>
        <node oor:name="Submenu">
          <node oor:name="menu01" oor:op="replace">
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.sheet.SpreadsheetDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value xml:lang="en">Formatting ...</value>
              <value xml:lang="fr">Formatage ...</value>
              <value xml:lang="de">Formatierung ...</value>
            </prop>
            <prop oor:name="URL" oor:type="xs:string">
              <value>service:name.AndreasSaeger.SpecialCells.DialogCellFormatRanges?menu</value>
              <value>_self</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
          </node>
          <node oor:name="menu02" oor:op="replace">
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.sheet.SpreadsheetDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value xml:lang="en">Contents...</value>
              <value xml:lang="fr">Contenu...</value>
              <value xml:lang="de">Inhalte...</value>
            </prop>
            <prop oor:name="URL" oor:type="xs:string">
              <value>service:name.AndreasSaeger.SpecialCells.DialogCellContents?menu</value>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
          </node>
        </node>
      </node>
    </node>
    <node oor:name="OfficeToolBar">
      <node oor:name="name.AndreasSaeger.SpecialCells" oor:op="replace">
        <prop oor:name="Title" oor:type="xs:string">
          <value xml:lang="en-US">Special Cells</value>
        </prop>
        <node oor:name="ToolBarItems">
          <node oor:name="btn01" oor:op="replace">
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.sheet.SpreadsheetDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value xml:lang="en">Format</value>
              <value xml:lang="fr">Formatage</value>
              <value xml:lang="de">Formate</value>
            </prop>
            <prop oor:name="URL" oor:type="xs:string">
              <value>service:name.AndreasSaeger.SpecialCells.DialogCellFormatRanges?button</value>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
          </node>
          <node oor:name="btn02" oor:op="replace">
            <prop oor:name="Context" oor:type="xs:string">
              <value>com.sun.star.sheet.SpreadsheetDocument</value>
            </prop>
            <prop oor:name="Title" oor:type="xs:string">
              <value xml:lang="en">Contents</value>
              <value xml:lang="fr">Contenu</value>
              <value xml:lang="de">Inhalte</value>
            </prop>
            <prop oor:name="URL" oor:type="xs:string">
              <value>service:name.AndreasSaeger.SpecialCells.DialogCellContents?button</value>
            </prop>
            <prop oor:name="Target" oor:type="xs:string">
              <value>_self</value>
            </prop>
            <prop oor:name="ImageIdentifier" oor:type="xs:string">
              <value/>
            </prop>
          </node>
        </node>
      </node>
    </node>
    <node oor:name="OfficeHelp">
      <node oor:name="name.AndreasSaeger.SpecialCells" oor:op="replace">
        <prop oor:name="Context" oor:type="xs:string">
          <value>com.sun.star.sheet.SpreadsheetDocument</value>
        </prop>
        <prop oor:name="URL" oor:type="xs:string">
            <value>service:name.AndreasSaeger.SpecialCells.ConfigProvider?#_TOP</value>
        </prop>
        <prop oor:name="Title" oor:type="xs:string">
          <value xml:lang="en">SpecialCells Reference Manual</value>
          <value xml:lang="de">SpecialCells Anleitung</value>
        </prop>
        <prop oor:name="Target" oor:type="xs:string">
          <value>_top</value>
        </prop>
      </node>
    </node>
  </node>
</oor:component-data>
If you have the title settings in CalcWindowState configuration, remove it as follows to make your title shown specified in the Addons.xcu file:

Code: Select all

Sub RemoveAddonsUISettings
  sNodeName = "private:resource/toolbar/addon_" & "name.AndreasSaeger.SpecialCells"
  cp = CreateUnoService("com.sun.star.configuration.ConfigurationProvider")
  p = CreateUnoStruct("com.sun.star.beans.PropertyValue")
  p.Name = "nodepath"
  p.Value = "/org.openoffice.Office.UI.CalcWindowState"
  node = cp.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", Array(p))
  if node.UIElements.States.hasByName(sNodeName) then
    node.UIElements.States.removeByName(sNodeName)
    node.commitChanges()
  end if
End Sub

Re: Is it simple to update an Add-on which no longer works?

Posted: Thu Dec 25, 2014 7:43 pm
by Villeroy
Thank you very much for the online conversion tool, for the SpecialCells Addons.xcu and for Sub RemoveAddonsUISettings. Before running RemoveAddonsUISettings, I could not remove my add-on. The new version of SpecialCells with your Addons.xcu can be removed and installed flawlessly.
Now I'm going to add some version info, description and icons so it can be uploaded to the extensions site.
Next version will be moved from the dialog to the side bar.

This is the simplified transcription of the valid toolbar structure:

Code: Select all

Addons
    AddonUI
        OfficeToolBar
            surrey.readabilityreport
                Title
                ToolBarItems
                    m1
                        URL
                        Imageidentifier
                        Target
                        Context
                        Title
                    m2
                    m3
                    m4
        Images
surrey.readabilityreport has one Title and a collection of ToolbarItems with 4 members.