[Libreoffice-commits] core.git: wizards/source
Jean-Pierre Ledure
jp at ledure.be
Fri Jan 2 03:29:11 PST 2015
wizards/source/access2base/DoCmd.xba | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
New commits:
commit 4e9b6450bf0ca916fa313a577d3af878efa90955
Author: Jean-Pierre Ledure <jp at ledure.be>
Date: Fri Jan 2 12:24:26 2015 +0100
Access2Base - handle ".uno:" prefix
Isolate _DispatchCommand sub
diff --git a/wizards/source/access2base/DoCmd.xba b/wizards/source/access2base/DoCmd.xba
index 75112e2..cb40f22 100644
--- a/wizards/source/access2base/DoCmd.xba
+++ b/wizards/source/access2base/DoCmd.xba
@@ -1402,15 +1402,23 @@ Public Function RunCommand(Optional pvCommand As Variant) As Boolean
' Execute command via DispatchHelper
If _ErrorHandler() Then On Local Error Goto Exit_Function ' Avoid any abort
- Utils._SetCalledSub("RunCommand")
+Const cstThisSub = "RunCommand"
+ Utils._SetCalledSub(cstThisSub)
Dim iVBACommand As Integer, sOOCommand As String, sDispatch As String
If IsMissing(pvCommand) Then Call _TraceArguments()
If Not ( Utils._CheckArgument(pvCommand, 1, Utils._AddNumeric(vbString)) ) Then Goto Exit_Function
+Const cstUnoPrefix = ".uno:"
If VarType(pvCommand) = vbString Then
sOOCommand = pvCommand
iVBACommand = -1
+ If Len(sOOCommand) > Len(cstUnoPrefix) Then
+ If Left(sOOCommand, Len(cstUnoPrefix)) = cstUnoPrefix Then
+ Call _DispatchCommand(sOOCommand)
+ Goto Exit_Function
+ End If
+ End If
Else
sOOCommand = ""
iVBACommand = pvCommand
@@ -1596,19 +1604,14 @@ Dim iVBACommand As Integer, sOOCommand As String, sDispatch As String
sDispatch = pvCommand
End Select
-Dim oDocument As Object, oDispatcher As Object, oArgs() As new com.sun.star.beans.PropertyValue, sTargetFrameName As String
-Dim oResult As Variant
- oDocument = _SelectWindow().Frame
- oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
- sTargetFrameName = ""
- oResult = oDispatcher.executeDispatch(oDocument, ".uno:" & sDispatch, sTargetFrameName, 0, oArgs())
+ Call _DispatchCommand(cstUnoPrefix & sDispatch)
Exit_Function:
RunCommand = True
- Utils._ResetCalledSub("RunCommand")
+ Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
- TraceError(TRACEABORT, Err, "RunCommand", Erl)
+ TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
GoTo Exit_Function
End Function ' RunCommand V0.7.0
@@ -1995,7 +1998,19 @@ Trace_SubFormNotFound:
Goto Exit_Function
End Function ' _DatabaseForm V1.2.0
+REM -----------------------------------------------------------------------------------------------------------------------
+Private Sub _DispatchCommand(ByVal psCommand As String)
+' Execute command given as argument - ".uno:" is presumed already present
+Dim oDocument As Object, oDispatcher As Object, oArgs() As new com.sun.star.beans.PropertyValue, sTargetFrameName As String
+Dim oResult As Variant
+Dim sCommand As String
+
+ Set oDocument = _SelectWindow().Frame
+ Set oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+ sTargetFrameName = ""
+ oResult = oDispatcher.executeDispatch(oDocument, psCommand, sTargetFrameName, 0, oArgs())
+End Sub ' _DispatchCommand V1.3.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _getTempDirectoryURL() As String
More information about the Libreoffice-commits
mailing list