summaryrefslogtreecommitdiff
path: root/wizards/source/access2base/DoCmd.xba
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source/access2base/DoCmd.xba')
-rw-r--r--wizards/source/access2base/DoCmd.xba28
1 files changed, 20 insertions, 8 deletions
diff --git a/wizards/source/access2base/DoCmd.xba b/wizards/source/access2base/DoCmd.xba
index a93973d476ea..89684050b5ee 100644
--- a/wizards/source/access2base/DoCmd.xba
+++ b/wizards/source/access2base/DoCmd.xba
@@ -31,6 +31,7 @@ Type _Window
Frame As Object ' com.sun.star.comp.framework.Frame
_Name As String ' Object Name
WindowType As Integer ' One of the object types
+ DocumentType As String ' Writer, Calc, ... - Only if WindowType = acDocument
End Type
REM VBA allows call to actions with missing arguments e.g. OpenForm("aaa",,"[field]=2")
@@ -2160,7 +2161,7 @@ Public Function _SelectWindow(Optional ByVal piWindowType As Integer, Optional B
' Return a _Window object type describing the found window
Dim oEnum As Object, oDesk As Object, oComp As Object, oFrame As Object, i As Integer
-Dim bFound As Boolean, bActive As Boolean, bName As Boolean, sName As String, iType As Integer
+Dim bFound As Boolean, bActive As Boolean, sName As String, iType As Integer, sDocumentType As String
Dim sImplementation As String, vLocation() As Variant
Dim oWindow As _Window
@@ -2169,8 +2170,9 @@ Dim oWindow As _Window
bActive = IsMissing(piWindowType)
If IsMissing(psWindow) Then psWindow = ""
Set oWindow.Frame = Nothing
+ oWindow.DocumentType = ""
If bActive Then
- oWindow.WindowType = -1
+ oWindow.WindowType = acDefault
oWindow._Name = ""
Else
oWindow.WindowType = piWindowType
@@ -2179,7 +2181,8 @@ Dim oWindow As _Window
Case Else : oWindow._Name = psWindow
End Select
End If
-
+ iType = acDefault
+ sDocumentType = ""
Set oDesk = CreateUnoService("com.sun.star.frame.Desktop")
Set oEnum = oDesk.Components().createEnumeration
@@ -2196,7 +2199,6 @@ Dim oWindow As _Window
iType = acDatabaseWindow
sName = ""
Case "SwXTextDocument"
- bName = False
If HasUnoInterfaces(oComp, "com.sun.star.frame.XModule") Then
Select Case oComp.Identifier
Case "com.sun.star.sdb.FormDesign" ' Form
@@ -2205,11 +2207,11 @@ Dim oWindow As _Window
iType = acReport
Case "com.sun.star.text.TextDocument" ' Writer
vLocation = Split(oComp.getLocation(), "/")
- sName = Join(Split(vLocation(UBound(vLocation)), "%20"), " ")
- bName = True
+ If UBound(vLocation) >= 0 Then sName = Join(Split(vLocation(UBound(vLocation)), "%20"), " ") Else sName = ""
iType = acDocument
+ sDocumentType = docWriter
End Select
- If Not bName Then ' Identify Form or Report name
+ If iType = acForm Or iType = acReport Then ' Identify Form or Report name
For i = 0 To UBound(oComp.Args())
If oComp.Args(i).Name = "DocumentTitle" Then
sName = oComp.Args(i).Value
@@ -2258,8 +2260,17 @@ Dim oWindow As _Window
Case Else ' Other Calc, ..., whatever documents
If Utils._hasUNOProperty(oComp, "Location") Then
vLocation = Split(oComp.getLocation(), "/")
- sName = Join(Split(vLocation(UBound(vLocation)), "%20"), " ")
+ If UBound(vLocation) >= 0 Then sName = Join(Split(vLocation(UBound(vLocation)), "%20"), " ") Else sName = ""
iType = acDocument
+ If Utils._hasUNOProperty(oComp, "Identifier") Then
+ Select Case oComp.Identifier
+ Case "com.sun.star.sheet.SpreadsheetDocument" : sDocumentType = docCalc
+ Case "com.sun.star.presentation.PresentationDocument" : sDocumentType = docImpress
+ Case "com.sun.star.drawing.DrawingDocument" : sDocumentType = docDraw
+ Case "com.sun.star.formula.FormulaProperties" : sDocumentType = docMath
+ Case Else : sDocumentType = ""
+ End Select
+ End If
Set oFrame = oComp.CurrentController.Frame
End If
End Select
@@ -2278,6 +2289,7 @@ Dim oWindow As _Window
Set oWindow.Frame = oFrame
oWindow._Name = sName
oWindow.WindowType = iType
+ oWindow.DocumentType = sDocumentType
Else
Set oWindow.Frame = Nothing
End If