From 9107771ab60c67b83b382e80a95e22118a55596f Mon Sep 17 00:00:00 2001 From: Jean-Pierre Ledure Date: Sat, 14 Mar 2015 15:54:55 +0100 Subject: Access2Base - Better window type recognition Add'l BuiltIn i.o. Builtin (cfr. MSAccess property) Change-Id: Idb539a8e259f76e96224526fd9e2b7a54effec1d --- wizards/source/access2base/Application.xba | 19 +++++++++---------- wizards/source/access2base/CommandBar.xba | 10 +++++----- wizards/source/access2base/CommandBarControl.xba | 10 +++++----- wizards/source/access2base/DoCmd.xba | 4 ++++ wizards/source/access2base/PropertiesGet.xba | 12 ++++++------ wizards/source/access2base/acConstants.xba | 1 + 6 files changed, 30 insertions(+), 26 deletions(-) (limited to 'wizards') diff --git a/wizards/source/access2base/Application.xba b/wizards/source/access2base/Application.xba index f5cb6c933f63..70c98db9b192 100644 --- a/wizards/source/access2base/Application.xba +++ b/wizards/source/access2base/Application.xba @@ -430,7 +430,6 @@ Dim oWindow As Object, iWindowType As Integer Dim i As Integer, j As Integer, k As Integer, bFound As Boolean Dim sSupportedModules() As Variant, vModules() As Variant, oModuleUI As Object Dim oToolbar As Object, sToolbarName As String, vUIElements() As Variant, sToolbarFullName As String, iBuiltin As Integer -Dim sFileSuffix As String Const cstCustom = "CUSTOM" @@ -443,7 +442,7 @@ Const cstCustom = "CUSTOM" bFound = False iBuiltin = 1 ' Default = builtin - Set oWindow = _SelectWindow + Set oWindow = _SelectWindow() If IsNull(oWindow.Frame) Then Goto Trace_WindowError ' List of 21 modules @@ -460,14 +459,12 @@ Const cstCustom = "CUSTOM" Case acReport sSupportedModules = Array( "com.sun.star.sdb.TextReportDesign" ) Case acDocument - sFileSuffix = "" - If Len(oWindow._Name) > 4 Then sFileSuffix = LCase(Right(oWindow._Name, 4)) - Select Case sFileSuffix - Case ".ods" : sSupportedModules = Array( "com.sun.star.sheet.SpreadsheetDocument" ) - Case ".odt", ".odm" : sSupportedModules = Array( "com.sun.star.text.TextDocument" ) - Case ".odp" : sSupportedModules = Array( "com.sun.star.presentation.PresentationDocument" ) - Case ".odg" : sSupportedModules = Array( "com.sun.star.drawing.DrawingDocument" ) - Case ".odf" : sSupportedModules = Array( "com.sun.star.formula.FormulaProperties" ) + Select Case oWindow.DocumentType + Case docCalc : sSupportedModules = Array( "com.sun.star.sheet.SpreadsheetDocument" ) + Case docWriter : sSupportedModules = Array( "com.sun.star.text.TextDocument" ) + Case docImpress : sSupportedModules = Array( "com.sun.star.presentation.PresentationDocument" ) + Case docDraw : sSupportedModules = Array( "com.sun.star.drawing.DrawingDocument" ) + Case docMath : sSupportedModules = Array( "com.sun.star.formula.FormulaProperties" ) Case Else : sSupportedModules = Array() End Select Case acTable, acQuery @@ -476,6 +473,8 @@ Const cstCustom = "CUSTOM" ) Case acDiagram sSupportedModules = Array( "com.sun.star.sdb.RelationDesign" ) + Case acWelcome + sSupportedModules = Array( "com.sun.star.frame.StartModule" ) Case Else sSupportedModules = Array() End Select diff --git a/wizards/source/access2base/CommandBar.xba b/wizards/source/access2base/CommandBar.xba index 95e27cf0a421..93bc884383e1 100644 --- a/wizards/source/access2base/CommandBar.xba +++ b/wizards/source/access2base/CommandBar.xba @@ -53,9 +53,9 @@ REM --- CLASS GET/LET/SET PROPERTIES --- REM ----------------------------------------------------------------------------------------------------------------------- REM ----------------------------------------------------------------------------------------------------------------------- -Property Get Builtin() As Boolean - Builtin = _PropertyGet("Builtin") -End Property ' Builtin (get) +Property Get BuiltIn() As Boolean + BuiltIn = _PropertyGet("BuiltIn") +End Property ' BuiltIn (get) REM ----------------------------------------------------------------------------------------------------------------------- Property Get Name() As String @@ -278,7 +278,7 @@ End Function REM ----------------------------------------------------------------------------------------------------------------------- Private Function _PropertiesList() As Variant - _PropertiesList = Array("Builtin", "Name", "ObjectType", "Visible") + _PropertiesList = Array("BuiltIn", "Name", "ObjectType", "Visible") End Function ' _PropertiesList REM ----------------------------------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ Dim cstThisSub As String Dim oLayout As Object, iElementIndex As Integer Select Case UCase(psProperty) - Case UCase("Builtin") + Case UCase("BuiltIn") _PropertyGet = ( _BarBuiltin = 1 ) Case UCase("Name") _PropertyGet = _Name diff --git a/wizards/source/access2base/CommandBarControl.xba b/wizards/source/access2base/CommandBarControl.xba index e47ebe835d69..a6bdcbc577e6 100644 --- a/wizards/source/access2base/CommandBarControl.xba +++ b/wizards/source/access2base/CommandBarControl.xba @@ -58,9 +58,9 @@ Property Get BeginGroup() As Boolean End Property ' BeginGroup (get) REM ----------------------------------------------------------------------------------------------------------------------- -Property Get Builtin() As Boolean - Builtin = _PropertyGet("Builtin") -End Property ' Builtin (get) +Property Get BuiltIn() As Boolean + BuiltIn = _PropertyGet("BuiltIn") +End Property ' BuiltIn (get) REM ----------------------------------------------------------------------------------------------------------------------- Property Get Caption() As Variant @@ -199,7 +199,7 @@ REM ---------------------------------------------------------------------------- REM ----------------------------------------------------------------------------------------------------------------------- Private Function _PropertiesList() As Variant - _PropertiesList = Array("BeginGroup", "Builtin", "Caption", "Index" _ + _PropertiesList = Array("BeginGroup", "BuiltIn", "Caption", "Index" _ , "ObjectType", "OnAction", "Parent" _ , "TooltipText", "Type", "Visible" _ ) @@ -222,7 +222,7 @@ Const cstUnoPrefix = ".uno:" Select Case UCase(psProperty) Case UCase("BeginGroup") _PropertyGet = _BeginGroup - Case UCase("Builtin") + Case UCase("BuiltIn") sValue = _GetPropertyValue(_Element, "CommandURL", "") _PropertyGet = ( _IsLeft(sValue, cstUnoPrefix) ) Case UCase("Caption") diff --git a/wizards/source/access2base/DoCmd.xba b/wizards/source/access2base/DoCmd.xba index 89684050b5ee..0cc2605b14b5 100644 --- a/wizards/source/access2base/DoCmd.xba +++ b/wizards/source/access2base/DoCmd.xba @@ -2257,6 +2257,10 @@ Dim oWindow As _Window Set oFrame = oComp.Frame iType = acDiagram sName = "" + Case "com.sun.star.comp.sfx2.BackingComp" ' Welcome screen + Set oFrame = oComp.Frame + iType = acWelcome + sName = "" Case Else ' Other Calc, ..., whatever documents If Utils._hasUNOProperty(oComp, "Location") Then vLocation = Split(oComp.getLocation(), "/") diff --git a/wizards/source/access2base/PropertiesGet.xba b/wizards/source/access2base/PropertiesGet.xba index a0c702f1853e..273617ca9ab8 100644 --- a/wizards/source/access2base/PropertiesGet.xba +++ b/wizards/source/access2base/PropertiesGet.xba @@ -74,10 +74,10 @@ Public Function getBorderStyle(Optional pvObject As Variant) As Variant End Function ' getBorderStyle REM ----------------------------------------------------------------------------------------------------------------------- -Public Function getBuiltin(Optional pvObject As Variant) As Boolean - If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments("getBuiltin") - getBuiltin = PropertiesGet._getProperty(pvObject, "Builtin") -End Function ' getBuiltin +Public Function getBuiltIn(Optional pvObject As Variant) As Boolean + If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments("getBuiltIn") + getBuiltIn = PropertiesGet._getProperty(pvObject, "BuiltIn") +End Function ' getBuiltIn REM ----------------------------------------------------------------------------------------------------------------------- Public Function getButtonLeft(Optional pvObject As Variant) As Boolean @@ -798,9 +798,9 @@ Public Function _getProperty(pvItem As Variant, ByVal psProperty As String, ByVa Case UCase("BorderStyle") If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function _getProperty = pvItem.BorderStyle - Case UCase("Builtin") + Case UCase("BuiltIn") If Not Utils._CheckArgument(pvItem, 1, Array(OBJCOMMANDBAR, OBJCOMMANDBARCONTROL)) Then Goto Exit_Function - _getProperty = pvItem.Builtin + _getProperty = pvItem.BuiltIn Case UCase("ButtonLeft") If Not Utils._CheckArgument(pvItem, 1, OBJEVENT) Then Goto Exit_Function _getProperty = pvItem.ButtonLeft diff --git a/wizards/source/access2base/acConstants.xba b/wizards/source/access2base/acConstants.xba index 21deeaa422aa..919f4736f2e3 100644 --- a/wizards/source/access2base/acConstants.xba +++ b/wizards/source/access2base/acConstants.xba @@ -53,6 +53,7 @@ Global Const acTable = 0 Global Const acBasicIDE = 101 Global Const acDatabaseWindow = 102 Global Const acDocument = 111 +Global Const acWelcome = 112 ' Subtype if acDocument Global Const docWriter = "Writer" Global Const docCalc = "Calc" -- cgit