RE: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-07 Thread FAouzi Abderrahman
Exact, i want to get a notification when the document is closed: my main
purpose is to save the document in my database after updating.

The first solution is the best for me because i like to save the document in
my database when the document will be closed

Have you a reference of code or functions that can help me?

Best regard

-Message d'origine-
De : Mathias Bauer [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 6 février 2006 19:16
À : dev@openoffice.org
Cc : [EMAIL PROTECTED]
Objet : Re: [dev] OpenOffice: question : how i can manipulate openoffice
writer document event: close/save...

FAouzi Abderrahman wrote:

>   // I search the equivalent to this line : (remark this line is not
> operational) 
> 
>   fDocument.OnClose := CloseDocument // CloseDocument is a procedure
> will be called when I close the document

OK, so you want to get a notification when the document is closed?

In general there are three kinds of notifications that can handle this:

(1) Listening for document events

You can get a notification *before* the dialog asking for saving the
document (if necessary) will appear and another notification immediately
before the closing will happen. In both cases the document is still
complete and you can do anything with it you like to do. But you can't
intercept the closing procedure, it's only a passive notification.
So this way of notification is useful if you don't want to intercept but
still want to do something with the document when it is going to be closed.

(2) Listening for disposal of the document

When the document is closed successfully and before it can be removed
from memory it sends a notification to all interested listeners that it
is going to die and that all listeners must release their references to
it. At that time you can't use any API of the document anymore, you will
always produce a runtime exception when doing so.
So this notification is useful when you just want to know that a
document will vanish but don't need to intercept the closing procedure
and don't need to do anything with the closing document.

(3) Listening for close events

OOo documents can be closed by calling their close() method. Here
listeners can prevent the closing by throwing a suitable exception. This
notification gives you the full control over the document, but are are
not allowed to use any GUI elements in your listener.
Unfortunately you can't do that because you are using the Automation
Bridge that does not support exceptions. We are planning to offer a
workaround for this in OOo2.0. Then you can install a "locking" service
that prevents locking of a document as long as you tell it to do so.

I hope that this gives you some hints about the direction you can go.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.




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



Re: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-07 Thread Laurent Godard

Hi


Have you a reference of code or functions that can help me?



Here is an example for onNew and onLoad

sub ConfigureDemarre(SetOrNot)


dim monEvent(0 to 1) as new com.sun.star.beans.PropertyValue
monEvent(0).name = "EventType"
monEvent(0).value="Basic"
monEvent(1).name = "Script"
if SetOrNot = 1 then
monEvent(1).value="macro:///myLib.myModule.mySub()"
else
monEvent(1).value=""
endif

'for only bind to the document
'lesEvents = thisComponent.events
'lesEvents.replaceByName("OnStartApp", monEvent())

GlobalEvent = createUnoservice("com.sun.star.frame.GlobalEventBroadcaster")
GlobalEvent.Events.ReplaceByName("OnNew", monEvent())
GlobalEvent.Events.ReplaceByName("OnLoad", monEvent())

end sub

--
Laurent Godard <[EMAIL PROTECTED]> - Ingénierie OpenOffice.org
Indesko >> http://www.indesko.com
Nuxeo CPS >> http://www.nuxeo.com - http://www.cps-project.org
Livre "Programmation OpenOffice.org", Eyrolles 2004

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



Re: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-06 Thread Mathias Bauer
FAouzi Abderrahman wrote:

>   // I search the equivalent to this line : (remark this line is not
> operational) 
> 
>   fDocument.OnClose := CloseDocument // CloseDocument is a procedure
> will be called when I close the document

OK, so you want to get a notification when the document is closed?

In general there are three kinds of notifications that can handle this:

(1) Listening for document events

You can get a notification *before* the dialog asking for saving the
document (if necessary) will appear and another notification immediately
before the closing will happen. In both cases the document is still
complete and you can do anything with it you like to do. But you can't
intercept the closing procedure, it's only a passive notification.
So this way of notification is useful if you don't want to intercept but
still want to do something with the document when it is going to be closed.

(2) Listening for disposal of the document

When the document is closed successfully and before it can be removed
from memory it sends a notification to all interested listeners that it
is going to die and that all listeners must release their references to
it. At that time you can't use any API of the document anymore, you will
always produce a runtime exception when doing so.
So this notification is useful when you just want to know that a
document will vanish but don't need to intercept the closing procedure
and don't need to do anything with the closing document.

(3) Listening for close events

OOo documents can be closed by calling their close() method. Here
listeners can prevent the closing by throwing a suitable exception. This
notification gives you the full control over the document, but are are
not allowed to use any GUI elements in your listener.
Unfortunately you can't do that because you are using the Automation
Bridge that does not support exceptions. We are planning to offer a
workaround for this in OOo2.0. Then you can install a "locking" service
that prevents locking of a document as long as you tell it to do so.

I hope that this gives you some hints about the direction you can go.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.


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



Re: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-06 Thread Charles-H.Schulz
Hello Faouzi,

You are on the right list for your question. I noticed however that you
must be francophone. In this case, I can only advise you to visit
http://fr.openoffice.org, and subscribe to prog@fr.openoffice.org . The
francophone community is a very helpful and friendly one.
Thanks Matthias for handling this question.

Hope this helps,
Charles.

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



RE: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-06 Thread FAouzi Abderrahman
Thank you very good idee

-Message d'origine-
De : Charles-H.Schulz [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 6 février 2006 15:33
À : dev@openoffice.org
Objet : Re: [dev] OpenOffice: question : how i can manipulate openoffice
writer document event: close/save...

Hello Faouzi,

You are on the right list for your question. I noticed however that you
must be francophone. In this case, I can only advise you to visit
http://fr.openoffice.org, and subscribe to prog@fr.openoffice.org . The
francophone community is a very helpful and friendly one.
Thanks Matthias for handling this question.

Hope this helps,
Charles.

-
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] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-06 Thread FAouzi Abderrahman
Sample of my procedure:

 

OpenDocument(Filename: string): boolean; 

var 

   wProperties : Variant; 

fOpenOffice : Variant; 

fDocument : Variant; 

fDesktop : Variant;

begin 

   

 

   fDesktop := fOpenOffice.createInstance('com.sun.star.frame.Desktop'); 

 

   wProperties := VarArrayCreate([0, 0], varVariant); 

   wProperties[0] := MakePropertyValue('Hidden', False); 

 

   fDocument := fDesktop.loadComponentFromURL(  'file:///'+
stripString(FileName, ['\'], '/') , '_blank', 0, wProperties); 

  

  // I search the equivalent to this line : (remark this line is not
operational) 

  fDocument.OnClose := CloseDocument // CloseDocument is a procedure
will be called when I close the document

 

   fDocumentOpened := not (VarIsEmpty(fDocument) or VarIsNull(fDocument)); 

   result := fDocumentOpened; 

end;

 

-Message d'origine-
De : Mathias Bauer [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 3 février 2006 00:50
À : dev@openoffice.org
Objet : Re: [dev] OpenOffice: question : how i can manipulate openoffice
writer document event: close/save...

 

Hi,

 

FAouzi Abderrahman wrote:

 

> I have a little problem when i like to manipulate the event close doc
writer

> with open office.

> 

> I try to use a oleautmoation to manipulate all the events

> (close/save/open..) document.

> 

> With openoffice I didn't find a solution to manipulate event off writer

> document.

 

Instead of reposting your question you should try to explain better what

you want to achieve (and BTW should be a little bit more patient waiting

for answers). I don't understand what kind of manipulation you intend to

apply to OOo.

 

Best regards,

Mathias

 

-- 

Mathias Bauer - OpenOffice.org Application Framework Project Lead

Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

 

-

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 



RE: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-03 Thread FAouzi Abderrahman
I arrived to open a oowriter with oleautomation.

When i used oleautomation to open à oowriter document, my problem is : when
I close the document after updating, oleautomation cant detect the close
event and the confirm message to save the document is not visuals.


-Message d'origine-
De : Mathias Bauer [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 3 février 2006 00:50
À : dev@openoffice.org
Objet : Re: [dev] OpenOffice: question : how i can manipulate openoffice
writer document event: close/save...

Hi,

FAouzi Abderrahman wrote:

> I have a little problem when i like to manipulate the event close doc
writer
> with open office.
> 
> I try to use a oleautmoation to manipulate all the events
> (close/save/open..) document.
> 
> With openoffice I didn't find a solution to manipulate event off writer
> document.

Instead of reposting your question you should try to explain better what
you want to achieve (and BTW should be a little bit more patient waiting
for answers). I don't understand what kind of manipulation you intend to
apply to OOo.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

-
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] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-02 Thread Mathias Bauer
Hi,

FAouzi Abderrahman wrote:

> I have a little problem when i like to manipulate the event close doc writer
> with open office.
> 
> I try to use a oleautmoation to manipulate all the events
> (close/save/open..) document.
> 
> With openoffice I didn't find a solution to manipulate event off writer
> document.

Instead of reposting your question you should try to explain better what
you want to achieve (and BTW should be a little bit more patient waiting
for answers). I don't understand what kind of manipulation you intend to
apply to OOo.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



RE: [dev] OpenOffice: question : how i can manipulate openoffice writer document event: close/save...

2006-02-02 Thread FAouzi Abderrahman


-Message d'origine-
De : FAouzi Abderrahman [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 2 février 2006 13:42
À : dev@openoffice.org
Objet : [dev] OpenOffice: question : how i can manipulate openoffice writer
document event: close/save...

Hello,

 

I have a little problem when i like to manipulate the event close doc writer
with open office.

 

I try to use a oleautmoation to manipulate all the events
(close/save/open..) document.

 

With openoffice I didn't find a solution to manipulate event off writer
document.

 

The language used is Delphi 5

 

Thank you for help 

 



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