summaryrefslogtreecommitdiff
path: root/wizards/source
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-10-01 14:41:55 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-10-01 14:41:55 +0000
commit9030ca8eb80b1627fc543c269583d96a9077ac06 (patch)
tree21b0d27a00c7488a1264e8c5ff35e5ea66b6177f /wizards/source
parent28c4b12a54fbd424958b728b06dbf11a7eb181b0 (diff)
#91427# Sub GetDocumentType now with exception handling
Diffstat (limited to 'wizards/source')
-rw-r--r--wizards/source/tools/Debug.xba27
-rw-r--r--wizards/source/tools/Misc.xba7
-rw-r--r--wizards/source/tools/ModuleControls.xba4
3 files changed, 35 insertions, 3 deletions
diff --git a/wizards/source/tools/Debug.xba b/wizards/source/tools/Debug.xba
index ea03e82e967a..eea9c5ef5fff 100644
--- a/wizards/source/tools/Debug.xba
+++ b/wizards/source/tools/Debug.xba
@@ -174,4 +174,31 @@ Sub ShowCommands(oLocObject as Object)
Msgbox(&quot;Sorry, No &apos;QueryCommands&apos; - Property attached to the object&quot;, 16, GetProductName())
Resume LEAVEPROC
LEAVEPROC:
+End Sub
+
+
+Sub ProtectCurrentSheets()
+Dim oDocument as Object
+Dim sDocType as String
+Dim iResult as Integer
+Dim oSheets as Object
+Dim i as Integer
+Dim bDoProtect as Boolean
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ sDocType = GetDocumentType(oDocument)
+ If sDocType = &quot;scalc&quot; Then
+ oSheets = oDocument.Sheets
+ bDoProtect = False
+ For i = 0 To oSheets.Count-1
+ If Not oSheets(i).IsProtected Then
+ bDoProtect = True
+ End If
+ Next i
+ If bDoProtect Then
+ iResult = Msgbox( &quot;Do you want to protect all sheets of this document?&quot;,35, GetProductName())
+ If iResult = 6 Then
+ ProtectSheets(oDocument.Sheets)
+ End If
+ End If
+ End If
End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
index b9e4848c2bf4..e7b87f16bbab 100644
--- a/wizards/source/tools/Misc.xba
+++ b/wizards/source/tools/Misc.xba
@@ -416,6 +416,7 @@ End Sub
Function GetDocumentType(oDocument)
+ On Local Error GoTo NODOCUMENTTYPE
If oDocument.SupportsService(&quot;com.sun.star.sheet.SpreadsheetDocument&quot;) Then
GetDocumentType() = &quot;scalc&quot;
ElseIf oDocument.SupportsService(&quot;com.sun.star.text.TextDocument&quot;) Then
@@ -425,6 +426,12 @@ Function GetDocumentType(oDocument)
ElseIf oDocument.SupportsService(&quot;com.sun.star.formula.FormulaProperties&quot;) Then
GetDocumentType() = &quot;smath&quot;
End If
+ NODOCUMENTTYPE:
+ If Err &lt;&gt; 0 Then
+ GetDocumentType = &quot;&quot;
+ Resume GOON
+ GOON:
+ End If
End Function
diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba
index 49db6b5b786f..be12ef7525df 100644
--- a/wizards/source/tools/ModuleControls.xba
+++ b/wizards/source/tools/ModuleControls.xba
@@ -265,6 +265,4 @@ Dim sProdName as String
oDialog.AppendFilter(FilterNames(i,0), FilterNames(i,1))
Next i
oDialog.SetCurrentFilter(FilterNames(0,0)
-End Sub
-
-</script:module> \ No newline at end of file
+End Sub</script:module> \ No newline at end of file