diff options
author | Behrend Cornelius <bc@openoffice.org> | 2001-10-12 14:23:43 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2001-10-12 14:23:43 +0000 |
commit | 552c5fef04b1730dce28df8d2f0485774fbe189c (patch) | |
tree | 9ada136c86b162f459310241c65eeebb6c1d6c20 /wizards/source/tools | |
parent | 1b06eaa397078bf5f016f517f171a2e3ce5427d5 (diff) |
#93098# StoreDocument now with errorhandling
Diffstat (limited to 'wizards/source/tools')
-rw-r--r-- | wizards/source/tools/ModuleControls.xba | 10 | ||||
-rw-r--r-- | wizards/source/tools/UCB.xba | 15 |
2 files changed, 15 insertions, 10 deletions
diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba index be12ef7525df..617685a16296 100644 --- a/wizards/source/tools/ModuleControls.xba +++ b/wizards/source/tools/ModuleControls.xba @@ -239,7 +239,9 @@ Dim FilterIndex as Integer UIFilterName = oStoreDialog.GetCurrentFilter() FilterIndex = IndexInArray(UIFilterName, FilterNames()) FilterName = FilterNames(FilterIndex,2) + On Local Error Goto NOSAVING If FilterName = "" Then + ' Todo: Den Fall abfangen, wenn ein zu überschreibendes Dokument schreibgeschützt ist (weil es z.B. gerade geöffnet ist) oDocument.StoreAsUrl(sPath, NoArgs()) Else oStoreProperties(0).Name = "FilterName" @@ -248,6 +250,14 @@ Dim FilterIndex as Integer End If End If StoreDocument() = sPath + Exit Function +NOSAVING: + If Err <> 0 Then +' Msgbox("Document cannot be saved under '" & ConvertFromUrl(sPath) & "'", 48, GetProductName()) + sPath = "" + Resume NOERROR + NOERROR: + End If End Function diff --git a/wizards/source/tools/UCB.xba b/wizards/source/tools/UCB.xba index f69524186942..26edd1bf2d3d 100644 --- a/wizards/source/tools/UCB.xba +++ b/wizards/source/tools/UCB.xba @@ -178,7 +178,6 @@ Sub ShowHelperDialog(aEvent) Dim oSystemNode as Object Dim sSystem as String Dim oLanguageNode as Object -Dim oLocDocument as Object Dim sLocale as String Dim sLocaleList() as String Dim sLanguage as String @@ -194,15 +193,11 @@ Dim sDocType as String sLocaleList() = ArrayoutofString(sLocale, "-") sLanguage = sLocaleList(0) sHelpUrl = "vnd.sun.star.help://" & sDocType & "/" & HelpID & "?Language=" & sLanguage & "&System=" & sSystem - oLogDocument = StarDesktop.LoadComponentFromURL( "private:factory/swriter","_blank",0,NoArgs()) - oLogText = oLogDocument.Text - oCursor = oLogText.createTextCursor() - oCursor.SetString(sHelpUrl) StarDesktop.LoadComponentfromUrl(sHelpUrl, "OFFICE_HELP", 63, NoArgs()) End Sub -Sub SaveDataToFile(FilePath as String, DataList() as String) +Sub SaveDataToFile(FilePath as String, DataList()) Dim FileChannel as Integer Dim i as Integer Dim oFile as Object @@ -226,7 +221,7 @@ Dim sCRLF as String End Sub -Function LoadDataFromFile(FilePath as String, DataList() as String) as Boolean +Function LoadDataFromFile(FilePath as String, DataList()) as Boolean Dim oInputStream as Object Dim i as Integer Dim oUcb as Object @@ -239,17 +234,17 @@ Dim MaxIndex as Integer oFile = oUcb.OpenFileReadWrite(FilePath) oInputStream.SetInputStream(oFile.GetInputStream) i = -1 - Redim Preserve DataList(MaxIndex) as String + Redim Preserve DataList(MaxIndex) While Not oInputStream.IsEOF i = i + 1 If i > MaxIndex Then MaxIndex = MaxIndex + 10 - Redim Preserve DataList(MaxIndex) as String + Redim Preserve DataList(MaxIndex) End If DataList(i) = oInputStream.ReadLine Wend If i > -1 And i <> MaxIndex Then - Redim Preserve DataList(i) as String + Redim Preserve DataList(i) End If LoadDataFromFile() = True oOutputStream.CloseInput() |