summaryrefslogtreecommitdiff
path: root/wizards/source/tools
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-10-12 14:23:43 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-10-12 14:23:43 +0000
commit552c5fef04b1730dce28df8d2f0485774fbe189c (patch)
tree9ada136c86b162f459310241c65eeebb6c1d6c20 /wizards/source/tools
parent1b06eaa397078bf5f016f517f171a2e3ce5427d5 (diff)
#93098# StoreDocument now with errorhandling
Diffstat (limited to 'wizards/source/tools')
-rw-r--r--wizards/source/tools/ModuleControls.xba10
-rw-r--r--wizards/source/tools/UCB.xba15
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 = &quot;&quot; Then
+ &apos; 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 = &quot;FilterName&quot;
@@ -248,6 +250,14 @@ Dim FilterIndex as Integer
End If
End If
StoreDocument() = sPath
+ Exit Function
+NOSAVING:
+ If Err &lt;&gt; 0 Then
+&apos; Msgbox(&quot;Document cannot be saved under &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos;&quot;, 48, GetProductName())
+ sPath = &quot;&quot;
+ 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, &quot;-&quot;)
sLanguage = sLocaleList(0)
sHelpUrl = &quot;vnd.sun.star.help://&quot; &amp; sDocType &amp; &quot;/&quot; &amp; HelpID &amp; &quot;?Language=&quot; &amp; sLanguage &amp; &quot;&amp;System=&quot; &amp; sSystem
- oLogDocument = StarDesktop.LoadComponentFromURL( &quot;private:factory/swriter&quot;,&quot;_blank&quot;,0,NoArgs())
- oLogText = oLogDocument.Text
- oCursor = oLogText.createTextCursor()
- oCursor.SetString(sHelpUrl)
StarDesktop.LoadComponentfromUrl(sHelpUrl, &quot;OFFICE_HELP&quot;, 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 &gt; MaxIndex Then
MaxIndex = MaxIndex + 10
- Redim Preserve DataList(MaxIndex) as String
+ Redim Preserve DataList(MaxIndex)
End If
DataList(i) = oInputStream.ReadLine
Wend
If i &gt; -1 And i &lt;&gt; MaxIndex Then
- Redim Preserve DataList(i) as String
+ Redim Preserve DataList(i)
End If
LoadDataFromFile() = True
oOutputStream.CloseInput()