Ely Schoenfeld wrote:
First of all, thank you for taking the time to answer.
My answers appear later on.
2008/10/11 Andrew Douglas Pitonyak <[EMAIL PROTECTED]>
Ely Schoenfeld wrote:
Sorry, I forgot to add the question:
Does some one knows how to delete the links to other documents from a
macro/function/button?
Ely.
Do you mean in a Calc document?
Yes, I'm talking about the whole calc document.
Do you mean for a specific Sheet?
See previous answer.
If you call getLinkUrl() on the sheet in question, does it return
something?
Well, the first time it returned the current file url, I mean the file where
the tests where done, instead of the "remote" file. Then I closed and
opened again the document and now it's returning just the path to "My
documents" (very strange)
Better yet, if you call getLinkMode(), what value is returned?
It returns 0 (com.sun.star.sheet.SheetLinkMode.NONE)
What happens if you call
oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE)?
It just changes the result of getLinkMode(), nothing else. I think it
establishes the "mode" for future copy/paste procedures. (Am I right?)
I present the functions I used at the end of this message, just in case
someone else needs them.
While I was looking for a way to delete the links to other documents from a
macro, I found someone who wants to do the same: "DDE Refresh and clean up"
at
http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=4076&p=49673#p49673
Someone redirected him to "Programming actions, where macro recorder and API
fail" at
http://www.oooforum.org/forum/viewtopic.phtml?t=22845&postdays=0&postorder=asc&start=0
The author of the second thread says:
----- begin -------
The following describes a procedure to circumvent this problem. The basic
steps are
(1) Create a TopWindowListener
(2) execute the dispatch
(3) the dispatch opens a new top window
(4) the top window listener is called
(5) inside the top window listener, the accessibility interface is used to
execute the desired user interactions
(6) inside the top window listener, the dispatch dialog's OK Button is
pressed to terminate the dispatch
(7) the TopWindowListener is removed
------ end -------
That is a great thing to know. My problem is that I haven't been able to
understand the use of the api documentation enough, so I cant figure out
how to modify the examples presented there, to my benefit.
Um, you don't understand this method for the same reason that even
advanced macro programmers shutter when they think about using this
method to control OOo. I would describe this method as:
Write code that directly manipulates OOo's native Dialogs and controls.
Doing this requires a lot of information about these dialogs that is not
published anywhere. The discovery process is error prone and causes OOo
to lock.
In other words, this is not what you want to learn. This method is only
to be used as a last resort if you must solve a problem for which there
is no other solution. I consider this about the same as using OOo to
write a document with detailed instructions written on a piece of paper
because your computer has no monitor.
It is better if you are able to learn the native API. Unfortunately,
there are a few things that are not possible with the current API (such
as obtaining a list of available printers).
Based on your previous answers, I am pretty sure that I am not
understanding what it is that you desire to do. In other words, you have
not created a linked sheet, because clearly you do not have a linked
sheet. Your usage of the word link, mislead me (so to speak) :-)
Are you using external data links? I am not really sure what you are
doing at this point....
The examples contain:
dispatcher.executeDispatch(oFrame, ".uno:InsertObject", "", 0, Array())
or
dispatcher.executeDispatch(oFrame, ".uno:OptionsTreeDialog", "", 0, Array())
If I understand correctly, the "uno:InsertObject" and
"uno:OptionsTreeDialog" are the "names" of the objectes or windows to
interact with. Right?
How could I find the "name" of the "Modify links" window? (Menu Edit /
Links...)
And that is just the beginning.
Thank you very, very much for your help.
Ely.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
P.S. Here I put the functions I used for testing:
Function fTestLinkMode
Dim oSheet as Object
oSheet = ThisComponent.Sheets.getByIndex(0)
fTestLinkMode = "=> " & oSheet.Name & " **LinkMode: " &
oSheet.getLinkMode()
End function
Function fTestLinkUrl
Dim oSheet as Object
oSheet = ThisComponent.Sheets.getByIndex(0)
fTestLinkUrl = "=> " & oSheet.Name & " **LinkUrl: " &
oSheet.getLinkUrl()
End function
Function fTestSetLinkMode(pMode)
Dim oSheet as Object
oSheet = ThisComponent.Sheets.getByIndex(0)
'#oSheet.setLinkMode(com.sun.star.sheet.SheetLinkMode.NONE)
oSheet.setLinkMode(pMode)
fTestSetLinkMode = "=> " & "done"
End function
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]