Hi,

Thanks Terry for your response, those pointers helped me out.  The
versioning is handled by the source code repository rather than
anything internal to OpenOffice.  Here's the solution I am now using
happily:

---------8<-Macro -------------
sub CompareWithCommitted
  dim document   as object
  dim dispatcher as object
  document   = ThisComponent.CurrentController.Frame
  dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
 
  Shell("getLastRevision.sh", 2, ThisComponent.URL, true)
 
  dim args1(0) as new com.sun.star.beans.PropertyValue
  args1(0).Name = "ShowTrackedChanges"
  args1(0).Value = true
  dispatcher.executeDispatch(document, ".uno:ShowTrackedChanges", "", 0, 
args1())
 
  properties = []
  dim p(0) as new com.sun.star.beans.PropertyValue
  p(0).Name = "URL"
  p(0).Value = ThisComponent.URL + ".COMMITTED"
  dispatcher.executeDispatch(document, ".uno:CompareDocuments", "", 0, p())
end sub
---------8<--------------

I wrote the following shell script getLastRevision.sh and placed it in my path

---------8<--------------
url="$1"
if [ "${url:0:7}" == "file://" ]; then
    path="${url:7}"
    dir="${path%/*}"
    file="${path##*/}"
    if [ -d "$dir" ]; then
        cd "$dir"
        if [ -f ".svn/entries" ]; then
            svn cat -r COMMITTED "$file" >"${file}.COMMITTED"
        else
            xmessage "$file is not in SVN"
        fi
    else
        xmessage "Directory $dir does not exist"
    fi
else
    xmessage "URL $url not handled"
fi
---------8<--------------


Cheers,
Len.

-------------------------
Date: Sat, 02 Sep 2006 13:51:33 +1000
From: Terry <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Subject: [users] Compare Document with previous version retrieved from source 
contro


I take it that the compare function in File >Versions does not suit?

There are several threads in the forum including these:
http://www.oooforum.org/forum/viewtopic.phtml?t=18715
http://www.oooforum.org/forum/viewtopic.phtml?t=18801
http://www.oooforum.org/forum/viewtopic.phtml?t=21018

There is another service for searching source code: http://go-oo.org/lxr/

At Fri, 01 Sep 2006 16:04:02 +1200,
Len Trigg wrote:
> 
> 
> Hi all,
> 
> We have our specification documents stored in a source control
> repository.  Since usual source control diff commands don't work on OO
> docs, I would like to be able to compare the current document with a
> previous revision of the document from within OO.
> 
> Minimally, I would like some kind of menu entry that would: 
> 
> 1) invoke an external process with the name of the current
>    document. I'm thinking shell script, but maybe a java plugin or
>    something?
> 
> 2) external process would check out a previous version of the document
>    to a temporary location and return the name of the temp document.
> 
> 3) OO would run "Compare Document" on this temporary document.
> 
> 
> (The external process could do validation, ask for revision numbers
> etc under it's own steam).
> 
> Can anyone give me pointers to ideas/docs for how can I accomplish
> this: macros / UNO connection bridge / Java, etc.
> 
> 
> Cheers,
> Len.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to