Wolfgang Schaible wrote:

hi Andrew, hi Frank
Am Mittwoch 02 November 2005 05.10 schrieb Andrew Douglas Pitonyak:
Frank Schönheit - Sun Microsystems Germany wrote:
Hi Andrew,

I tried
oTables = oCon.getTables()
oTables.refresh()

This did not work....
This is surprising, since it's exactly what the Controller does
with its own connection when you dispatch the URL ...

Ciao
Frank
Initially, adding a table worked with oTables.refresh(), but
delete did not. I performed a couple of iterations and then
adding worked sometimes, and sometimes not. Using the dispatch
ALWAYS
a strong word (in SW only used by inveterate optimists) :-)

worked. All of the code that I use is found in this document:
http://www.pitonyak.org/database/OOoBaseBinaryFields.odt
You start on the top of a DB, when do you think we see the bottom?

There is a section titled: "Using SQL statements to modify
tables". I show the code that I currently use to refresh the
database document, and then the code that I use to remove and add
tables... Not that it probably matters. Working hard to document
things so that I will know how to do things that I think are
cool! :-)
Your macros 'RefreshTables' and 'FindComponentWithURL' are as usual helpfully, but -how perfidy- if you start OOo 'Help' just before you start 'RefreshTables' , the 'oDocs.hasLocation' calls out 'Property or method not found'
No idea how to prevent...

Wolfgang
I had never run this with the help open... I have not tested this code at all, but it is my guess what I really need to have!

Function FindComponentWithURL(sURL As String, bLoadIfNotFound As Boolean)
 Dim oDocs   ' Enumeration of the loaded components.
 Dim oDoc    ' A single enumerated component.
 Dim sSt$    ' XStorable interface name.
 Dim sODoc   ' Office document service name.

 sSt$  = "com.sun.star.frame.XStorable"
 sODoc = "com.sun.star.document.OfficeDocument"
 oDocs = StarDesktop.getComponents().createEnumeration()
 Do While oDocs.hasMoreElements()
   oDoc = oDocs.nextElement()
   If NOT HasUNOInterfaces(oDoc, sSt) Then
     REM This test filters out the Help system nad makes certain
     REM That the document supports "hasLocation"
   ElseIf NOT oDoc.supportsService(sODoc) Then
     REM Filter out the Basic IDE, which supports the
     REM com.sun.star.script.BasicIDE service, but not
     REM the office document service. Probably does not
     REM matter, but I do it because I want to.
   ElseIf NOT oDoc.hasLocation() Then
     REM This document has never been saved, so there is not URL
     REM to compare against.
   ElseIf oDoc.getURL() = sURL Then
     FindComponentWithURL = oDoc
     Exit Function
   End If
 Loop

 REM In OOo version 1.x, loadComponentFromURL() returned NULL
 REM if the document did not exist. Starting with version 2.x,
 REM an illegal argument exception is thrown instead.
 If bLoadIfNotFound AND FileExists(sURL) Then
   oDoc = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, Array())
   FindComponentWithURL = oDoc
 'Else
 '  FindComponentWithURL = NULL
 End If
End Function

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
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]

Reply via email to