Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Access MediaDescriptor properties in loaded document

Hello all,

I have the below sub assigned to a button on a switchboard .odt document for my database. When clicked, it opens a document called "AddTransaction.odt", which contains some forms.

Sub OpenAddTransDoc_

Globalscope.BasicLibraries.LoadLibrary( "MRILib" )

REM Define properties for MediaDescriptor service
Dim DocProperties(2) As New com.sun.star.beans.PropertyValue
DocProperties(0).Name = "ReadOnly"
DocProperties(0).Value = True
DocProperties(1).Name = "Referer"
DocProperties(1).Value = ThisComponent.URL
DocProperties(2).Name = "MacroExecutionMode"
DocProperties(2).Value = 4

Dim DocURL As String
DocURL = ConvertToURL("F:\Mattias Durnez\Documents HDD\Business\Finances_database\frontend\forms\AddTransaction.odt")

ThisDoc = StarDesktop.loadComponentFromURL(DocURL,"_default",0,DocProperties)
MRI.InspectObj(ThisDoc)

End Sub

After opening the "AddTransaction.odt" document, I inspect its model using MRI. When I retrieve the .Args property of the model with getArgs() I can see the values that I set for MacroExecutionMode (4) and ReadOnly (True). However, I can't see the URL that I specified for the Referer property. I failed to locate the Referer URL even after manually stepping through all properties/methods using MRI.

My question is: how can I access the Referer property, if even possible at all?

Also, when I add the following additional property ...

DocProperties(3).Name = "DocumentTitle"
DocProperties(3).Value = "NewTestTitle"

... it appears correctly in .Args as "DocumentTitle" with value "NewTestTitle" BUT the actual title displayed in the loaded document has NOT changed. In fact, .Args contains another property called "Title" which contains the title displayed by the document. This seems odd behaviour or am I missing something?

Many thanks for any help/insights!