Re: [dev] Saving Documents

2008-04-06 Thread Mathias Bauer
yaungmin wrote:

> Here is detail information about the project that I am working on.
> 
> I am using Java for this add-on program. This program is just for
> openoffice.org writer, so I will only working with .odt format. I have five
> buttons on the tool bar which are Login, New, Open, Save and Logout. After
> the user login to the system, they are allowed to create new document, open
> existing document, save current document and logout from the system.
> 
> What I have so far is when I click on New, it shows me a new blank document.
> I can type some text on the document but I wasn’t able to save it when I
> click on Save button. I will be saving the document to the database in
> future but just for testing purpose, I am saving the document to my desktop.

I saw the API calls in your other mail; I will have a look.

> Basically yes, I would like to replace the “Save/Save As” functionality of
> OOo, but my program will save to a given database instead of displaying a
> file dialog to specify the folder to save in. Yes, I would like to have my
> own function call to save the current document when user click on the save
> button.

OK, so at least later on you must implement a DispatchInterceptor and a
Job service to achieve that. For the moment you can concentrate on
getting the code working.

> My code will be added to openoffice.org as an extension.

If you are using Java perhaps our NetBeans pluging will make it easier
to create the extension, it has a lot of support for OOo extension creation.

> In additional to that, I tried to type some text in the document and tried
> to save the document again, but additional text that I just typed in weren’t
> saved. 

This is strange - but let's fix the problems one by one. Perhaps the
second problems goes away once the first one is fixed.

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.


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



Re: [dev] Saving Documents

2008-04-04 Thread Mikhail Voitenko

Hi Peter,

I would strongly advise not to use getCurrentFrame(), especially in this 
context.


The AddOn instance must use the own frame that is actually known. Yes, 
in most cases the current frame will be the frame the addon is related 
to, but not always.


Best regards,
Mikhail.

Peter Eberlein wrote:

Hi yaungmin,

yaungmin schrieb:

Hi Mikhail,

I did not get any exception when I tried to save the document. As you can
see in the saveDocument method, I was basically able to load a 
document and

save it as another document with a different name.
All I am trying to do is like say, I have an "Untitled1 document" 
opened and
I typed some text on the document. When I click on my Add-on Save 
button, I

want to save that document to a certain location. I want the text on the
document to be saved and the title of the document should change from
"Untitled1 document" to the name of the document. What I am trying to 
do is
probably exactly the same as the OOo build-in save function. Please 
advice.


Thanks,


If you want to save the "Active Document", you must instantiate the 
XDesktop Interface from the ServiceManager and then look for the 
currentFrame. Every frame as a controller and the controller has a model.


desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", 
xComponentContext);
XDesktop xDesktop = (XDesktop) 
UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, desktop);

XFrame xF = xDesktop.getCurrentFrame();
XController xC = xF.getController();
   
XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, 
xC.getModel());
XComponent xComponent = (XComponent) 
UnoRuntime.queryInterface(XComponent.class, xmodel);
XStorable xs = (XStorable) (UnoRuntime.queryInterface(XStorable.class, 
xComponent ));



Peter


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



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



Re: [dev] Saving Documents

2008-04-04 Thread Mikhail Voitenko

Hi,

Sorry, I was confused by the example. You have written that you can not 
save and have provided the source code. So I have assumed that you can 
not save using the source code.


I am still not sure that I understand your problem completely. You have 
written and addon that integrates a number of buttons into the document 
frame. One of the buttons should trigger the saving for the document in 
the frame. And the problem is to find the related document and to store 
it. Please correct me if I am wrong with my understanding.


The AddOn instance is integrated into a frame. The frame is provided to 
the ProtocolHandler service implementation of the AddOn on 
initialization ( XInitialization::initialize() method ). So the storing 
mechanics should use XFrame::getController() on the frame and 
XController::getModel() on the result controller to get the related 
model. After that the model can be used for the saving. Please see

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Framework_API
for details.

Best regards,
Mikhail.


yaungmin wrote:

Hi Mikhail,

I did not get any exception when I tried to save the document. As you can
see in the saveDocument method, I was basically able to load a document and
save it as another document with a different name. 


All I am trying to do is like say, I have an "Untitled1 document" opened and
I typed some text on the document. When I click on my Add-on Save button, I
want to save that document to a certain location. I want the text on the
document to be saved and the title of the document should change from
"Untitled1 document" to the name of the document. What I am trying to do is
probably exactly the same as the OOo build-in save function. Please advice.

Thanks,
Min


Mikhail Voitenko wrote:

Hi,

By API I mean the OOo API in my question, in this case it is 
XStorable::storeAsURL() method. If this method is not able to store a 
document it should throw an exception. Which exception is thrown in this 
case?


Best regards,
Mikhail.

yaungmin wrote:

Hi,

I don't quite understand your question. I am using Netbeans IDE to write
my
programs. I don't pass any arguments to my saveDocument method. See below
for the method that I have so far. I am sure that the method just load a
document from a given location and save it to a different location, which
is
not what I wanted to do. I would like to get the current active document
and
save it to a given location.

Thanks,
Min

private void saveDocument(){
String loadpath = "C:/Users/min/Desktop/test.odt";

String storepath = "C:/Users/min/Desktop/savetest.odt";
com.sun.star.uno.XComponentContext xContext = gui.m_xContext;
try {
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();

Object oDesktop = xMCF.createInstanceWithContext(

"com.sun.star.frame.Desktop", xContext);

com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
 UnoRuntime.queryInterface(
 com.sun.star.frame.XComponentLoader.class,
oDesktop);

java.io.File sourceFile = new java.io.File(loadpath);

StringBuffer sLoadUrl = new StringBuffer("file:///");
sLoadUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

sourceFile = new java.io.File(storepath);
StringBuffer sSaveUrl = new StringBuffer("file:///");
sSaveUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

com.sun.star.beans.PropertyValue[] propertyValue =

new com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new Boolean(true);

Object oDocToStore = xCompLoader.loadComponentFromURL(

sLoadUrl.toString(), "_default", 0, propertyValue );

com.sun.star.frame.XStorable xStorable =

(com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class, oDocToStore );

propertyValue = new com.sun.star.beans.PropertyValue[ 2 ];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Overwrite";
propertyValue[0].Value = new Boolean(true);
propertyValue[1] = new com.sun.star.beans.PropertyValue();
propertyValue[1].Name = "FilterName";
propertyValue[1].Value = "StarOffice XML (Writer)";
xStorable.storeAsURL( sSaveUrl.toString(), propertyValue );

System.out.println("\nDocument \"" + sLoadUrl + "\" saved
under
\"" +
   sSaveUrl + "\"\n");
}
catch( Exception e ) {
e.print

Re: [dev] Saving Documents

2008-04-03 Thread Peter Eberlein

Hi yaungmin,

yaungmin schrieb:

Hi Mikhail,

I did not get any exception when I tried to save the document. As you can
see in the saveDocument method, I was basically able to load a document and
save it as another document with a different name. 


All I am trying to do is like say, I have an "Untitled1 document" opened and
I typed some text on the document. When I click on my Add-on Save button, I
want to save that document to a certain location. I want the text on the
document to be saved and the title of the document should change from
"Untitled1 document" to the name of the document. What I am trying to do is
probably exactly the same as the OOo build-in save function. Please advice.

Thanks,


If you want to save the "Active Document", you must instantiate the 
XDesktop Interface from the ServiceManager and then look for the 
currentFrame. Every frame as a controller and the controller has a model.


desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", 
xComponentContext);
XDesktop xDesktop = (XDesktop) 
UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, desktop);

XFrame xF = xDesktop.getCurrentFrame();
XController xC = xF.getController();

XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, 
xC.getModel());
XComponent xComponent = (XComponent) 
UnoRuntime.queryInterface(XComponent.class, xmodel);
XStorable xs = (XStorable) (UnoRuntime.queryInterface(XStorable.class, 
xComponent ));



Peter


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



Re: [dev] Saving Documents

2008-04-03 Thread yaungmin

Hi Mikhail,

I did not get any exception when I tried to save the document. As you can
see in the saveDocument method, I was basically able to load a document and
save it as another document with a different name. 

All I am trying to do is like say, I have an "Untitled1 document" opened and
I typed some text on the document. When I click on my Add-on Save button, I
want to save that document to a certain location. I want the text on the
document to be saved and the title of the document should change from
"Untitled1 document" to the name of the document. What I am trying to do is
probably exactly the same as the OOo build-in save function. Please advice.

Thanks,
Min


Mikhail Voitenko wrote:
> 
> Hi,
> 
> By API I mean the OOo API in my question, in this case it is 
> XStorable::storeAsURL() method. If this method is not able to store a 
> document it should throw an exception. Which exception is thrown in this 
> case?
> 
> Best regards,
> Mikhail.
> 
> yaungmin wrote:
>> Hi,
>> 
>> I don't quite understand your question. I am using Netbeans IDE to write
>> my
>> programs. I don't pass any arguments to my saveDocument method. See below
>> for the method that I have so far. I am sure that the method just load a
>> document from a given location and save it to a different location, which
>> is
>> not what I wanted to do. I would like to get the current active document
>> and
>> save it to a given location.
>> 
>> Thanks,
>> Min
>> 
>> private void saveDocument(){
>> String loadpath = "C:/Users/min/Desktop/test.odt";
>> String storepath = "C:/Users/min/Desktop/savetest.odt";
>> com.sun.star.uno.XComponentContext xContext = gui.m_xContext;
>> try {
>> com.sun.star.lang.XMultiComponentFactory xMCF =
>> xContext.getServiceManager();
>> 
>> Object oDesktop = xMCF.createInstanceWithContext(
>> "com.sun.star.frame.Desktop", xContext);
>> 
>> com.sun.star.frame.XComponentLoader xCompLoader =
>> (com.sun.star.frame.XComponentLoader)
>>  UnoRuntime.queryInterface(
>>  com.sun.star.frame.XComponentLoader.class,
>> oDesktop);
>> 
>> java.io.File sourceFile = new java.io.File(loadpath);
>> StringBuffer sLoadUrl = new StringBuffer("file:///");
>> sLoadUrl.append(sourceFile.getCanonicalPath().replace('\\',
>> '/'));
>> 
>> sourceFile = new java.io.File(storepath);
>> StringBuffer sSaveUrl = new StringBuffer("file:///");
>> sSaveUrl.append(sourceFile.getCanonicalPath().replace('\\',
>> '/'));
>> 
>> com.sun.star.beans.PropertyValue[] propertyValue =
>> new com.sun.star.beans.PropertyValue[1];
>> propertyValue[0] = new com.sun.star.beans.PropertyValue();
>> propertyValue[0].Name = "Hidden";
>> propertyValue[0].Value = new Boolean(true);
>> 
>> Object oDocToStore = xCompLoader.loadComponentFromURL(
>> sLoadUrl.toString(), "_default", 0, propertyValue );
>> 
>> com.sun.star.frame.XStorable xStorable =
>> (com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
>> com.sun.star.frame.XStorable.class, oDocToStore );
>> 
>> propertyValue = new com.sun.star.beans.PropertyValue[ 2 ];
>> propertyValue[0] = new com.sun.star.beans.PropertyValue();
>> propertyValue[0].Name = "Overwrite";
>> propertyValue[0].Value = new Boolean(true);
>> propertyValue[1] = new com.sun.star.beans.PropertyValue();
>> propertyValue[1].Name = "FilterName";
>> propertyValue[1].Value = "StarOffice XML (Writer)";
>> xStorable.storeAsURL( sSaveUrl.toString(), propertyValue );
>> 
>> System.out.println("\nDocument \"" + sLoadUrl + "\" saved
>> under
>> \"" +
>>sSaveUrl + "\"\n");
>> }
>> catch( Exception e ) {
>> e.printStackTrace(System.err);
>> System.exit(1);
>> }
>> }
>> 
>> 
>> Mikhail Voitenko wrote:
>>> Hi,
>>>
>>> Which API are you using currently to let the document be saved? Please 
>>> describe the arguments you provide to the API ( if any ) as well.
>>>
>>> Best regards,
>>> Mikhail.
>>>
>>> yaungmin wrote:
 Here is detail information about the project that I am working on.

 I am using Java for this add-on program. This program is just for
 openoffice.org writer, so I will only working with .odt format. I have
 five
 buttons on the tool bar which are Login, New, Open, Save and Logout.
 After
 the user login to the system, they are allowed to create new document,
 open
 existing document, save current document and logout from the system.

 What I have so far is when I click on New

Re: [dev] Saving Documents

2008-04-03 Thread Mikhail Voitenko

Hi,

By API I mean the OOo API in my question, in this case it is 
XStorable::storeAsURL() method. If this method is not able to store a 
document it should throw an exception. Which exception is thrown in this 
case?


Best regards,
Mikhail.

yaungmin wrote:

Hi,

I don't quite understand your question. I am using Netbeans IDE to write my
programs. I don't pass any arguments to my saveDocument method. See below
for the method that I have so far. I am sure that the method just load a
document from a given location and save it to a different location, which is
not what I wanted to do. I would like to get the current active document and
save it to a given location.

Thanks,
Min

private void saveDocument(){
String loadpath = "C:/Users/min/Desktop/test.odt";

String storepath = "C:/Users/min/Desktop/savetest.odt";
com.sun.star.uno.XComponentContext xContext = gui.m_xContext;
try {
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();

Object oDesktop = xMCF.createInstanceWithContext(

"com.sun.star.frame.Desktop", xContext);

com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
 UnoRuntime.queryInterface(
 com.sun.star.frame.XComponentLoader.class,
oDesktop);

java.io.File sourceFile = new java.io.File(loadpath);

StringBuffer sLoadUrl = new StringBuffer("file:///");
sLoadUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

sourceFile = new java.io.File(storepath);
StringBuffer sSaveUrl = new StringBuffer("file:///");
sSaveUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

com.sun.star.beans.PropertyValue[] propertyValue =

new com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new Boolean(true);

Object oDocToStore = xCompLoader.loadComponentFromURL(

sLoadUrl.toString(), "_default", 0, propertyValue );

com.sun.star.frame.XStorable xStorable =

(com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class, oDocToStore );

propertyValue = new com.sun.star.beans.PropertyValue[ 2 ];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Overwrite";
propertyValue[0].Value = new Boolean(true);
propertyValue[1] = new com.sun.star.beans.PropertyValue();
propertyValue[1].Name = "FilterName";
propertyValue[1].Value = "StarOffice XML (Writer)";
xStorable.storeAsURL( sSaveUrl.toString(), propertyValue );

System.out.println("\nDocument \"" + sLoadUrl + "\" saved under
\"" +
   sSaveUrl + "\"\n");
}
catch( Exception e ) {
e.printStackTrace(System.err);
System.exit(1);
}
}


Mikhail Voitenko wrote:

Hi,

Which API are you using currently to let the document be saved? Please 
describe the arguments you provide to the API ( if any ) as well.


Best regards,
Mikhail.

yaungmin wrote:

Here is detail information about the project that I am working on.

I am using Java for this add-on program. This program is just for
openoffice.org writer, so I will only working with .odt format. I have
five
buttons on the tool bar which are Login, New, Open, Save and Logout.
After
the user login to the system, they are allowed to create new document,
open
existing document, save current document and logout from the system.

What I have so far is when I click on New, it shows me a new blank
document.
I can type some text on the document but I wasn’t able to save it when I
click on Save button. I will be saving the document to the database in
future but just for testing purpose, I am saving the document to my
desktop.

The format that I would like to save is odt (openoffice.org writer)
format.

Basically yes, I would like to replace the “Save/Save As” functionality
of
OOo, but my program will save to a given database instead of displaying a
file dialog to specify the folder to save in. Yes, I would like to have
my
own function call to save the current document when user click on the
save
button.

My code will be added to openoffice.org as an extension.

I tried to create a separate test program which creates a blank document
and
I saved it right after I created the document. The document was saved to
my
desktop as I specified but the title of the document is still “Untitled 2
–
Openoffice.org Writer” instead of the name of the document that I given.

In additional to that, I tried to t

Re: [dev] Saving Documents

2008-04-02 Thread yaungmin

Hi,

I don't quite understand your question. I am using Netbeans IDE to write my
programs. I don't pass any arguments to my saveDocument method. See below
for the method that I have so far. I am sure that the method just load a
document from a given location and save it to a different location, which is
not what I wanted to do. I would like to get the current active document and
save it to a given location.

Thanks,
Min

private void saveDocument(){
String loadpath = "C:/Users/min/Desktop/test.odt";
String storepath = "C:/Users/min/Desktop/savetest.odt";
com.sun.star.uno.XComponentContext xContext = gui.m_xContext;
try {
com.sun.star.lang.XMultiComponentFactory xMCF =
xContext.getServiceManager();

Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext);

com.sun.star.frame.XComponentLoader xCompLoader =
(com.sun.star.frame.XComponentLoader)
 UnoRuntime.queryInterface(
 com.sun.star.frame.XComponentLoader.class,
oDesktop);

java.io.File sourceFile = new java.io.File(loadpath);
StringBuffer sLoadUrl = new StringBuffer("file:///");
sLoadUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

sourceFile = new java.io.File(storepath);
StringBuffer sSaveUrl = new StringBuffer("file:///");
sSaveUrl.append(sourceFile.getCanonicalPath().replace('\\',
'/'));

com.sun.star.beans.PropertyValue[] propertyValue =
new com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new Boolean(true);

Object oDocToStore = xCompLoader.loadComponentFromURL(
sLoadUrl.toString(), "_default", 0, propertyValue );

com.sun.star.frame.XStorable xStorable =
(com.sun.star.frame.XStorable)UnoRuntime.queryInterface(
com.sun.star.frame.XStorable.class, oDocToStore );

propertyValue = new com.sun.star.beans.PropertyValue[ 2 ];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Overwrite";
propertyValue[0].Value = new Boolean(true);
propertyValue[1] = new com.sun.star.beans.PropertyValue();
propertyValue[1].Name = "FilterName";
propertyValue[1].Value = "StarOffice XML (Writer)";
xStorable.storeAsURL( sSaveUrl.toString(), propertyValue );

System.out.println("\nDocument \"" + sLoadUrl + "\" saved under
\"" +
   sSaveUrl + "\"\n");
}
catch( Exception e ) {
e.printStackTrace(System.err);
System.exit(1);
}
}


Mikhail Voitenko wrote:
> 
> Hi,
> 
> Which API are you using currently to let the document be saved? Please 
> describe the arguments you provide to the API ( if any ) as well.
> 
> Best regards,
> Mikhail.
> 
> yaungmin wrote:
>> Here is detail information about the project that I am working on.
>> 
>> I am using Java for this add-on program. This program is just for
>> openoffice.org writer, so I will only working with .odt format. I have
>> five
>> buttons on the tool bar which are Login, New, Open, Save and Logout.
>> After
>> the user login to the system, they are allowed to create new document,
>> open
>> existing document, save current document and logout from the system.
>> 
>> What I have so far is when I click on New, it shows me a new blank
>> document.
>> I can type some text on the document but I wasn’t able to save it when I
>> click on Save button. I will be saving the document to the database in
>> future but just for testing purpose, I am saving the document to my
>> desktop.
>> 
>> The format that I would like to save is odt (openoffice.org writer)
>> format.
>> 
>> Basically yes, I would like to replace the “Save/Save As” functionality
>> of
>> OOo, but my program will save to a given database instead of displaying a
>> file dialog to specify the folder to save in. Yes, I would like to have
>> my
>> own function call to save the current document when user click on the
>> save
>> button.
>> 
>> My code will be added to openoffice.org as an extension.
>> 
>> I tried to create a separate test program which creates a blank document
>> and
>> I saved it right after I created the document. The document was saved to
>> my
>> desktop as I specified but the title of the document is still “Untitled 2
>> –
>> Openoffice.org Writer” instead of the name of the document that I given.
>> 
>> In additional to that, I tried to type some text in the document and
>> tried
>> to save the document again, but additional text that I just typed in
>> weren’t

Re: [dev] Saving Documents

2008-04-02 Thread Mikhail Voitenko

Hi,

Which API are you using currently to let the document be saved? Please 
describe the arguments you provide to the API ( if any ) as well.


Best regards,
Mikhail.

yaungmin wrote:

Here is detail information about the project that I am working on.

I am using Java for this add-on program. This program is just for
openoffice.org writer, so I will only working with .odt format. I have five
buttons on the tool bar which are Login, New, Open, Save and Logout. After
the user login to the system, they are allowed to create new document, open
existing document, save current document and logout from the system.

What I have so far is when I click on New, it shows me a new blank document.
I can type some text on the document but I wasn’t able to save it when I
click on Save button. I will be saving the document to the database in
future but just for testing purpose, I am saving the document to my desktop.

The format that I would like to save is odt (openoffice.org writer) format.

Basically yes, I would like to replace the “Save/Save As” functionality of
OOo, but my program will save to a given database instead of displaying a
file dialog to specify the folder to save in. Yes, I would like to have my
own function call to save the current document when user click on the save
button.

My code will be added to openoffice.org as an extension.

I tried to create a separate test program which creates a blank document and
I saved it right after I created the document. The document was saved to my
desktop as I specified but the title of the document is still “Untitled 2 –
Openoffice.org Writer” instead of the name of the document that I given.

In additional to that, I tried to type some text in the document and tried
to save the document again, but additional text that I just typed in weren’t
saved. 


Thank you for your help in advance.

Min




Mathias Bauer wrote:

yaungmin wrote:


I am writing an Openoffice Add-on program which I need to write my own
save
function. Can someone please give me some advice on how to save an
Openoffice writer document which is active on the screen.

Thanks,
Min

With so little information it's close to impossible to give advice. So:

- do you want to have a file dialog to select a file name or folder to
save in?

- in which format or formats do you want to save the file?

- do you want to create a copy of the file or do you intend to replace
the "Save"/"SaveAs" functionality of OOo?

- if the answer to the last question is "yes", do you want your own
function called when the user selects the corresponding command in the
menu or toolbar?

- which programming language do you want to use?

- do you want to add your code to your own private build of OOo or do
you want to create an extension?

I'm sure I can present some more nice questions before I can give you a
*useful* advice, but let's start with those ones. :-9

Ciao,
Mathias

--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.


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







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



Re: [dev] Saving Documents

2008-04-01 Thread yaungmin

Here is detail information about the project that I am working on.

I am using Java for this add-on program. This program is just for
openoffice.org writer, so I will only working with .odt format. I have five
buttons on the tool bar which are Login, New, Open, Save and Logout. After
the user login to the system, they are allowed to create new document, open
existing document, save current document and logout from the system.

What I have so far is when I click on New, it shows me a new blank document.
I can type some text on the document but I wasn’t able to save it when I
click on Save button. I will be saving the document to the database in
future but just for testing purpose, I am saving the document to my desktop.

The format that I would like to save is odt (openoffice.org writer) format.

Basically yes, I would like to replace the “Save/Save As” functionality of
OOo, but my program will save to a given database instead of displaying a
file dialog to specify the folder to save in. Yes, I would like to have my
own function call to save the current document when user click on the save
button.

My code will be added to openoffice.org as an extension.

I tried to create a separate test program which creates a blank document and
I saved it right after I created the document. The document was saved to my
desktop as I specified but the title of the document is still “Untitled 2 –
Openoffice.org Writer” instead of the name of the document that I given.

In additional to that, I tried to type some text in the document and tried
to save the document again, but additional text that I just typed in weren’t
saved. 

Thank you for your help in advance.

Min




Mathias Bauer wrote:
> 
> yaungmin wrote:
> 
>> I am writing an Openoffice Add-on program which I need to write my own
>> save
>> function. Can someone please give me some advice on how to save an
>> Openoffice writer document which is active on the screen.
>> 
>> Thanks,
>> Min
> 
> With so little information it's close to impossible to give advice. So:
> 
> - do you want to have a file dialog to select a file name or folder to
> save in?
> 
> - in which format or formats do you want to save the file?
> 
> - do you want to create a copy of the file or do you intend to replace
> the "Save"/"SaveAs" functionality of OOo?
> 
> - if the answer to the last question is "yes", do you want your own
> function called when the user selects the corresponding command in the
> menu or toolbar?
> 
> - which programming language do you want to use?
> 
> - do you want to add your code to your own private build of OOo or do
> you want to create an extension?
> 
> I'm sure I can present some more nice questions before I can give you a
> *useful* advice, but let's start with those ones. :-9
> 
> Ciao,
> Mathias
> 
> -- 
> Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
> OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
> Please don't reply to "[EMAIL PROTECTED]".
> I use it for the OOo lists and only rarely read other mails sent to it.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Saving-Documents-tp16215871p16423219.html
Sent from the openoffice - dev mailing list archive at Nabble.com.


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



Re: [dev] Saving Documents

2008-03-26 Thread Mathias Bauer
yaungmin wrote:

> I am writing an Openoffice Add-on program which I need to write my own save
> function. Can someone please give me some advice on how to save an
> Openoffice writer document which is active on the screen.
> 
> Thanks,
> Min

With so little information it's close to impossible to give advice. So:

- do you want to have a file dialog to select a file name or folder to
save in?

- in which format or formats do you want to save the file?

- do you want to create a copy of the file or do you intend to replace
the "Save"/"SaveAs" functionality of OOo?

- if the answer to the last question is "yes", do you want your own
function called when the user selects the corresponding command in the
menu or toolbar?

- which programming language do you want to use?

- do you want to add your code to your own private build of OOo or do
you want to create an extension?

I'm sure I can present some more nice questions before I can give you a
*useful* advice, but let's start with those ones. :-9

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.


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



Re: [dev] Saving Documents

2008-03-25 Thread Bernd Eilers

Hi yaungmin,

You didn´t tell which programming langauage you are using.

Anyway here´s an java example:

http://codesnippets.services.openoffice.org/Office/Office.ConvertDocuments.snip

Kind regards,
Bernd Eilers

yaungmin wrote:

Hi Cor,

I am pretty new to openoffice. I visited the links that that you send me and
went thought the tutorial, but  I still wasn't able to save the document
that is displayed on the window. Please advice how to get it to save the
document on the active window or frame.

Thanks,
Min


Cor Nouws wrote:

Hi Min,

yaungmin wrote (22-3-2008 5:32)

I am writing an Openoffice Add-on program which I need to write my own
save

It will be helpfull to visit (and a bit more than that) these pages:
http://api.openoffice.org/
http://wiki.services.openoffice.org/wiki/Extensions_development
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide


function. Can someone please give me some advice on how to save an
Openoffice writer document which is active on the screen.

the third link, also leads to this one
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents

HTH,
Cor

--

"The Year of 3" -2008- "Het jaar van 3"

Cor Nouws
Arnhem - Netherlands - nl.OpenOffice.org - marketing contact


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







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



Re: [dev] Saving Documents

2008-03-23 Thread yaungmin

Hi Cor,

I am pretty new to openoffice. I visited the links that that you send me and
went thought the tutorial, but  I still wasn't able to save the document
that is displayed on the window. Please advice how to get it to save the
document on the active window or frame.

Thanks,
Min


Cor Nouws wrote:
> 
> Hi Min,
> 
> yaungmin wrote (22-3-2008 5:32)
>> I am writing an Openoffice Add-on program which I need to write my own
>> save
> 
> It will be helpfull to visit (and a bit more than that) these pages:
> http://api.openoffice.org/
> http://wiki.services.openoffice.org/wiki/Extensions_development
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide
> 
>> function. Can someone please give me some advice on how to save an
>> Openoffice writer document which is active on the screen.
> 
> the third link, also leads to this one
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents
> 
> HTH,
> Cor
> 
> -- 
> 
> "The Year of 3" -2008- "Het jaar van 3"
> 
> Cor Nouws
> Arnhem - Netherlands - nl.OpenOffice.org - marketing contact
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Saving-Documents-tp16215871p16241132.html
Sent from the openoffice - dev mailing list archive at Nabble.com.


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



Re: [dev] Saving Documents

2008-03-22 Thread Cor Nouws

Hi Min,

yaungmin wrote (22-3-2008 5:32)

I am writing an Openoffice Add-on program which I need to write my own save


It will be helpfull to visit (and a bit more than that) these pages:
http://api.openoffice.org/
http://wiki.services.openoffice.org/wiki/Extensions_development
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide


function. Can someone please give me some advice on how to save an
Openoffice writer document which is active on the screen.


the third link, also leads to this one
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents

HTH,
Cor

--

"The Year of 3" -2008- "Het jaar van 3"

Cor Nouws
Arnhem - Netherlands - nl.OpenOffice.org - marketing contact


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



[dev] Saving Documents

2008-03-21 Thread yaungmin

I am writing an Openoffice Add-on program which I need to write my own save
function. Can someone please give me some advice on how to save an
Openoffice writer document which is active on the screen.

Thanks,
Min
-- 
View this message in context: 
http://www.nabble.com/Saving-Documents-tp16215871p16215871.html
Sent from the openoffice - dev mailing list archive at Nabble.com.


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