LibreOffice logo
BASEDOCUMENTER
The software tool for documenting your LibreOffice Base applications
 
Database file/home/jean-pierre/Documents/BaseDocumenter/www/databases/LODoc/Example_Mail_File_activate.odb
File actual save date2018-06-27 12:35:03
Scanning done on2018-06-27 12:30:11
Documentation generated on2018-07-29 18:19:09
Table of contents
Example_Mail_File_activate
Procedures by module
Library Module name Procedure name Language Used by Line number Number of code lines Procedure code
Standard Module1 File_activate Basic File_activate|button (Control) 3 18
SUB File_activate
DIM oDoc AS OBJECT
DIM oDrawpage AS OBJECT
DIM oForm AS OBJECT
DIM oField AS OBJECT
DIM oShell AS OBJECT
DIM stField AS STRING
oDoc = thisComponent
oDrawpage = oDoc.Drawpage
oForm = oDrawpage.Forms.getByName("form")
oField = oForm.getByName("fileselection")
REM Read the shown text of fileselection
stField = oField.Text
REM Activate file through url-connection
oShell = createUnoService("com.sun.star.system.SystemShellExecute")
stField = convertToUrl(stField)
oShell.execute(stField,,0)
END SUB
Standard Module1 Mail_activate Basic Mail_activate|button (Control) 22 33
SUB Mail_activate
REM Mail activate through mailto:address?subject=...&body=...&cc=...&bcc=...
REM Only mailto, subject and body are shown by the form
REM Attachments are not defined by "mailto". Sometime "attachment=" would still work.
DIM oDoc AS OBJECT
DIM oDrawpage AS OBJECT
DIM oForm AS OBJECT
DIM oField1 AS OBJECT
DIM oField2 AS OBJECT
DIM oField3 AS OBJECT
DIM oShell AS OBJECT
DIM stField1 AS STRING
DIM stField2 AS STRING
DIM stField3 AS STRING
oDoc = thisComponent
oDrawpage = oDoc.Drawpage
oForm = oDrawpage.Forms.getByName("form")
oField1 = oForm.getByName("mail_to")
oField2 = oForm.getByName("mail_subject")
oField3 = oForm.getByName("mail_body")
stField1 = oField1.Text
IF stField1 = "" THEN
msgbox "Missing email address." & CHR(13) & "Email program would not be activated" , 48, "Send Email"
EXIT SUB
END IF
REM Converting to url is required. Special characters and line break would destoy the code.
REM "file:///" will be cut after converting to url.
stField2 = Mid(ConvertToUrl(oField2.Text),9)
stField3 = Mid(ConvertToUrl(oField3.Text),9)
REM Activate program with all attached information
oShell = createUnoService("com.sun.star.system.SystemShellExecute")
oShell.execute("mailto:"+stField1+"?subject="+stField2+"&body="+stField3,,0)
END SUB
Standard Module1 Mouse_pointer Basic Mail_Website_activate_directly|url_mail (Control) 86 7
SUB	Mouse_pointer(oEvent As Object)
REM See also Standardlibraries: Tools → ModuleControls → SwitchMousePointer
DIM oPointer AS OBJECT
oPointer = createUnoService("com.sun.star.awt.Pointer")
oPointer.setType(27) 'Types see com.sun.star.awt.SystemPointer
oEvent.Source.Peer.SetPointer(oPointer)
END SUB
Standard Module1 Website_Mail_activate Basic Mail_Website_activate|button (Control)
Mail_Website_activate_directly|url_mail (Control)
56 29
SUB Website_Mail_activate
REM Activate browser with website or mailprogram with mailaddress
DIM oDoc AS OBJECT
DIM oDrawpage AS OBJECT
DIM oForm AS OBJECT
DIM oField AS OBJECT
DIM oShell AS OBJECT
DIM stField AS STRING
oDoc = thisComponent
oDrawpage = oDoc.Drawpage
oForm = oDrawpage.Forms.getByName("form")
oField = oForm.getByName("url_mail")
REM Read the shown text, if no text shown: exit
stField = oField.Text
IF stField = "" THEN
EXIT SUB
END IF
IF InStr(stField,"@") THEN
stField = "mailto:"+stField
ELSEIF InStr(stFeld,"http://") THEN
stField = convertToUrl(stField) 'convertToUrl realizes http:// as connection. file:/// would not be added.
ELSE
stField = "http://"+stField
stField = convertToUrl(stField) 'convertToUrl realizes http:// as connection. file:/// would not be added.
END IF
REM Activate file through url-connection
oShell = createUnoService("com.sun.star.system.SystemShellExecute")
oShell.execute(stField,,0)
END SUB