Hey everyone!
I have written to program a Java AddOn (extension) in Netbeans 8.0.2 with Java (1.8) for OpenOffice Writer. I already downloaded the Apache OpenOffice Plugin for Netbeans8.2 and I have created a AddOn but I want to call this addOn before save event Pragmatically.
[Solved] OpenOffice Plugin call before save event
[Solved] OpenOffice Plugin call before save event
Last edited by Rushna on Thu Jul 13, 2017 11:25 am, edited 1 time in total.
OpenOffice 4.3.1 on Windows 7
Re: OpenOffice Plugin call before save event
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: OpenOffice Plugin call before save event
Hi Villeroy,
thanks for your response ! i have updated my code based on your recommended link but i am still missing something. could you please provide me an example about how to call my plugin before save event to the OpenOffice Writer ?
thanks for your response ! i have updated my code based on your recommended link but i am still missing something. could you please provide me an example about how to call my plugin before save event to the OpenOffice Writer ?
OpenOffice 4.3.1 on Windows 7
Re: OpenOffice Plugin call before save event
Hi All...,
I am using ag.ion.noa_2.2.3 (noa) jar file to call plugin before save event and there is a AbstractDocument class in which onSave() ,onSaveAs() but don't know how to call
in my plugin code.
Please help me out.
my code to create plugin:
I am using ag.ion.noa_2.2.3 (noa) jar file to call plugin before save event and there is a AbstractDocument class in which onSave() ,onSaveAs() but don't know how to call
in my plugin code.
Please help me out.
my code to create plugin:
Code: Select all
public final class Test1AddOn extends WeakBase
implements com.sun.star.frame.XDispatchProvider,
com.sun.star.frame.XDispatch,
com.sun.star.lang.XServiceInfo,
com.sun.star.lang.XInitialization
{
private final XComponentContext m_xContext;
private com.sun.star.frame.XFrame m_xFrame;
private static final String m_implementationName = Test1AddOn.class.getName();
private static final String m_implementationName1="Rushna World!";
private static final String[] m_serviceNames = {
"com.sun.star.frame.ProtocolHandler" };
private Object xStorable;
public Test1AddOn( XComponentContext context )
{
m_xContext = context;
System.out.println("Hello Test");
};
public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
XSingleComponentFactory xFactory = null;
if ( sImplementationName.equals( m_implementationName ) )
xFactory = Factory.createComponentFactory(Test1AddOn.class, m_serviceNames);
return xFactory;
}
public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {
System.out.println("Hello writeRegistryService");
return Factory.writeRegistryServiceInfo(m_implementationName,
m_serviceNames,
xRegistryKey);
}
// com.sun.star.frame.XDispatchProvider:
public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,
String sTargetFrameName,
int iSearchFlags )
{
if ( aURL.Protocol.compareTo("com.example.test1addon:") == 0 )
{
if ( aURL.Path.compareTo("Rushna") == 0 )
return this;
}
return null;
}
// com.sun.star.frame.XDispatchProvider:
public com.sun.star.frame.XDispatch[] queryDispatches(
com.sun.star.frame.DispatchDescriptor[] seqDescriptors )
{
int nCount = seqDescriptors.length;
com.sun.star.frame.XDispatch[] seqDispatcher =
new com.sun.star.frame.XDispatch[seqDescriptors.length];
for( int i=0; i < nCount; ++i )
{
seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,
seqDescriptors[i].FrameName,
seqDescriptors[i].SearchFlags );
}
return seqDispatcher;
}
// com.sun.star.frame.XDispatch:
public void dispatch( com.sun.star.util.URL aURL,
com.sun.star.beans.PropertyValue[] aArguments )
{
if ( aURL.Protocol.compareTo("com.example.test1addon:") == 0 )
{
if ( aURL.Path.compareTo("Rushna") == 0 )
{
Main_Form r=new Main_Form();
r.setVisible(true);
XTextDocument xDoc = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, m_xFrame.getController().getModel());
//xDoc.getText().setString(“Hello World”);
xDoc.getText().setString(m_implementationName1);
return;
}
}//create a text file in D drive.
}
public void addStatusListener( com.sun.star.frame.XStatusListener xControl,
com.sun.star.util.URL aURL )
{
// add your own code here
}
public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,
com.sun.star.util.URL aURL )
{
// add your own code here
}
// com.sun.star.lang.XServiceInfo:
public String getImplementationName() {
return m_implementationName;
}
public boolean supportsService( String sService ) {
int len = m_serviceNames.length;
for( int i=0; i < len; i++) {
if (sService.equals(m_serviceNames[i]))
return true;
}
return false;
}
public String[] getSupportedServiceNames() {
System.out.println("Hello Support");
return m_serviceNames;
}
// com.sun.star.lang.XInitialization:
public void initialize( Object[] object )
throws com.sun.star.uno.Exception
{
if ( object.length > 0 )
{
m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface(
com.sun.star.frame.XFrame.class, object[0]);
}
}
}
OpenOffice 4.3.1 on Windows 7
Re: OpenOffice Plugin call before save event
This is too sophisticated to be discussed on this forum, I think. You should write to developers mailing list for LibreOffice or OpenOffice.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: OpenOffice Plugin call before save event
please share with me email id of OpenOffice or LibreOffice developers.
OpenOffice 4.3.1 on Windows 7
Re: OpenOffice Plugin call before save event
Starting points; https://openoffice.apache.org/mailing-lists.html and https://www.libreoffice.org/get-help/mailing-lists
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: [Solved] OpenOffice Plugin call before save event
Hi All,
"OnSave" and "OnSaveAs" should be delivered before the document is saved, and "OnSaveDone " and "OnSaveAsDone" after it is saved.
But I am getting the same result "OnSaveAs" and "OnSaveAsDone" it's delivered after the save in both cases.
please help.
"OnSave" and "OnSaveAs" should be delivered before the document is saved, and "OnSaveDone " and "OnSaveAsDone" after it is saved.
But I am getting the same result "OnSaveAs" and "OnSaveAsDone" it's delivered after the save in both cases.
please help.
OpenOffice 4.3.1 on Windows 7