diff options
author | Behrend Cornelius <bc@openoffice.org> | 2002-10-16 09:34:10 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2002-10-16 09:34:10 +0000 |
commit | 815de4b23e5b9beffa0cb7e85ffb34555497d55d (patch) | |
tree | eb6c47f6f2d4350ebcfdadfcd47d4eaadb871a2f /wizards/source/tools/Misc.xba | |
parent | f13b1b61efdee23824fce005e5a195a4401000cd (diff) |
#104114# New Function 'CreateNewDocument' added
Diffstat (limited to 'wizards/source/tools/Misc.xba')
-rw-r--r-- | wizards/source/tools/Misc.xba | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba index 5bca3caa4b61..60d09cb6d587 100644 --- a/wizards/source/tools/Misc.xba +++ b/wizards/source/tools/Misc.xba @@ -141,7 +141,7 @@ Dim oComponent as Object If Not IsMissing(bDisposable) Then bDisposable = True End If - OpenDocument() = StarDesktop.LoadComponentFromURL(DocPath,"_blank",0,Args()) + OpenDocument() = StarDesktop.LoadComponentFromURL(DocPath,"_default",0,Args()) End Function @@ -719,4 +719,44 @@ Function isHighContrast(oPeer as Object) isHighContrast = false If myLuminance <= 25 Then isHighContrast = true End Function + + +Function CreateNewDocument(sType as String, Optional sAddMsg as String) as Object +Dim NoArgs() as new com.sun.star.beans.PropertyValue +Dim oDocument as Object +Dim sUrl as String +Dim ErrMsg as String + On Local Error Goto NOMODULEINSTALLED + sUrl = "private:factory/" & sType + oDocument = StarDesktop.LoadComponentFromURL(sUrl,"_default",0, NoArgs()) +NOMODULEINSTALLED: + If (Err <> 0) OR IsNull(oDocument) Then + If InitResources("", "com") Then + Select Case sType + Case "swriter" + ErrMsg = GetResText(1001) + Case "scalc" + ErrMsg = GetResText(1002) + Case "simpress" + ErrMsg = GetResText(1003) + Case "sdraw" + ErrMsg = GetResText(1004) + Case "smath" + ErrMsg = GetResText(1005) + Case Else + ErrMsg = "Invalid Document Type!" + End Select + ErrMsg = ReplaceString(ErrMsg, chr(13), "<BR>") + If Not IsMissing(sAddMsg) Then + ErrMsg = ErrMsg & chr(13) & sAddMsg + End If + Msgbox(ErrMsg, 48, GetProductName()) + End If + If Err <> 0 Then + Resume GOON + End If + End If +GOON: + CreateNewDocument = oDocument +End Function </script:module>
\ No newline at end of file |