Daniel Brunner wrote:
I am trying to get a reference to the forms related to a DataSource in
StarOffice 8.0. How ca I transpose the following code snippet to
StarBasic :
public static void openFormInDesignMode(XMultiServiceFactory
_rMSF) throws com.sun.star.uno.Exception
{
XNameAccess xNameAccess =
(XNameAccess)UnoRuntime.queryInterface(XNameAccess.class,
_rMSF.createInstance("com.sun.star.sdb.DatabaseContext"));
// we use the first datasource
XDataSource xDS = (XDataSource)UnoRuntime.queryInterface(
XDataSource.class, xNameAccess.getByName( "Bibliography" ));
XConnection con = xDS.getConnection("","");
XFormsSupplier xSup =
(XFormsSupplier)UnoRuntime.queryInterface(XFormsSupplier.class, xDS);
XNameAccess xForms = xSup.getFormDocuments();
if ( xForms.hasByName("Form1") ){
Object form = xForms.getByName("Form1"); // to
hold ref
{
XComponentLoader loader =
(XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,
xForms);
PropertyValue[] args = new
PropertyValue[]{PropertyValue("OpenMode",0,"openDesign")
,PropertyValue("ActiveConnection",0,con)};
XComponent formdocument =
loader.loadComponentFromURL("Form1","",0,args);
}
}
}
My idea was :
dbContext = CreateUnoService( "com.sun.star.sdb.DatabaseContext" )
xds= dbContext.getByName( "Bibliography" )
login = ""
password = ""
con = maSource.getConnection( login, password )
xForms = xds.getFormDocuments() Rem --- nok !!!
Thanks in advance for your help.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Download this document
http://www.pitonyak.org/database/AndrewBase.odt
And search for getFormDocuments().
Off hand, I do not think that you can get the form documents from a
database document, not from the database.
Sub InspectFormsInDB
Dim oContext
Dim oDB
Dim oForms
oContext = CreateUnoService( "com.sun.star.sdb.DatabaseContext" )
oDB = oContext.getByName( "Bibliography" )
oForms = oDB.DatabaseDocument.getFormDocuments()
End Sub
--
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]