diff options
author | Behrend Cornelius <bc@openoffice.org> | 2001-10-01 14:41:55 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2001-10-01 14:41:55 +0000 |
commit | 9030ca8eb80b1627fc543c269583d96a9077ac06 (patch) | |
tree | 21b0d27a00c7488a1264e8c5ff35e5ea66b6177f /wizards/source | |
parent | 28c4b12a54fbd424958b728b06dbf11a7eb181b0 (diff) |
#91427# Sub GetDocumentType now with exception handling
Diffstat (limited to 'wizards/source')
-rw-r--r-- | wizards/source/tools/Debug.xba | 27 | ||||
-rw-r--r-- | wizards/source/tools/Misc.xba | 7 | ||||
-rw-r--r-- | wizards/source/tools/ModuleControls.xba | 4 |
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("Sorry, No 'QueryCommands' - Property attached to the object", 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 = "scalc" 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( "Do you want to protect all sheets of this document?",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("com.sun.star.sheet.SpreadsheetDocument") Then GetDocumentType() = "scalc" ElseIf oDocument.SupportsService("com.sun.star.text.TextDocument") Then @@ -425,6 +426,12 @@ Function GetDocumentType(oDocument) ElseIf oDocument.SupportsService("com.sun.star.formula.FormulaProperties") Then GetDocumentType() = "smath" End If + NODOCUMENTTYPE: + If Err <> 0 Then + GetDocumentType = "" + 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 |