create a new page, using OOoBasic/Form/Memo as a template.
Front page
Search
掲示板
Reload
Help
Browse Log
掲示板の使い方
OOo 掲示板3
OOo 掲示板2
OOo 掲示板
掲示板
雑談掲示板
New
List of pages
Recent changes
Backup
簡単ヘルプ
整形ルール
Start:
*メモ [#a53be209]
フォーム関連メモ。行き先が決まれば移動されるかもしれませ...
#contents
**タブっぽくコントロールの表示切り替え [#pcfecb73]
フォームにタブコントロールはありません。ボタンを押してコ...
コントロールの表示/非表示を切り替えるにはフォームコントロ...
&ref(TabLike_Form-1.odt);
ボタンを配置してそれぞれのボタンをページ切り替えとして利...
また、ドキュメントを開いたときなどのイベントにあるページ...
-コントロールが重なっているため、フォーム編集時にはフォー...
-フォームが完成するまではコントロールをずらして作成するべ...
あとは
-グリッドを表示したままだった。
-ページを切り替えたときにフォーカスを移すとか…。
-ボタンの色がいまいち。
-グループボックスにタイトルを設定してみたが…。
**タブっぽくコントロールの表示切り替え2 [#e91a149c]
[[Simulating tabs in a form.>http://user.services.openoff...
ではセクションの切り替えでタブ風にしているようです。こっ...
セクションは取り扱いが面倒、ということでフレームにセクシ...
書いてみたマクロが上記のコードとほとんど同じだったので上...
**フォームコントロールからのコピー [#id4cc213]
一行もののフォームコントロールの内容を、ボタンなどを押す...
ボタンなどに下記を割り当てます。ボタンを押すと TextBox の...
Sub CopyButtonPush( ev )
oForm = ev.Source.getModel().getParent()
oTextBox = oForm.getByName("TextBox")
oDoc = oForm.getParent().getParent()
oController = oDoc.getCurrentController()
oControl = oController.getControl(oTextBox)
oAccControl = oControl.getAccessibleContext()
nCount = oAccControl.getCharacterCount()
oAccControl.copyText(0, nCount)
End Sub
**ボタンを押す [#e9980366]
フォーム上に配置したボタンを押します (押したのと同じ状態...
PushButton1 をマウスでクリックしたときの動作を起こします。
Sub ButtonPushed( ev )
oForm = ev.Source.getModel().getParent()
oButton = oForm.getByName("PushButton1")
oDoc = oForm.getParent().getParent()
oController = oDoc.getCurrentController()
oControl = oController.getControl(oButton)
oAccControl = oControl.getAccessibleContext()
oAccControl.doAccessibleAction(0)
End Sub
押したときに実行されるプロシージャを呼び出せばいいじゃな...
** 画像サイズに合わせてイメージコントロールのサイズを変更...
画像のサイズに合わせてイメージコントロールのサイズを変更...
コントロールの XControlModel からシェープを探し出す必要が...
#code(ob){{
Sub Main
oDoc = ThisComponent
oDrawPage = oDoc.getDrawpage()
oController = oDoc.getCurrentController()
oForm = oDrawPage.getForms().getByIndex(0)
oImageCtrl = oForm.getByName("ImageControl")
oGraphic = oImageCtrl.Graphic
oShape = FindShape( oDrawPage, oImageCtrl )
aBaseSize = oShape.Size
aSize = CalculateSize( aBaseSize, oGraphic.Size )
oShape.Size = aSize
End Sub
Function FindShape( oContainer As Object, oModel ) As Obj...
Dim oFound As Object
For i = 0 To oContainer.getCount() -1 step 1
oShape = oContainer.getByIndex(i)
If oShape.supportsService("com.sun.star.drawing.Contr...
If EqualUNOObjects( oShape.Control, oModel ) Then
oFound = oShape
Exit For
End If
End If
Next
FindShape = oFound
End Function
Function CalculateSize( aShapeSize, aGraphicSize )
Dim aSize As New com.sun.star.awt.Size
aSize.Width = aShapeSize.Height * ( aGraphicSize.Width ...
aSize.Height = aShapeSize.Height
CalculateSize = aSize
End Function
}}
** フォームコントロールを MRI で簡単に開く [#tbaa11d0]
実行するとドキュメント中にあるフォームコントロール一覧の...
#code(basic){{
'Dim oTree As Object
Dim oDoc As Object
Dim oForms As Object
Dim oDialog As Object
Sub Main
oDoc = ThisComponent
If oDoc.supportsService("com.sun.star.text.TextDocument...
oForms = oDoc.getDrawPage().getForms()
ElseIf oDoc.supportsService("com.sun.star.sheet.Spreads...
' Spreadsheet needs problem about active sheet changing
oForms = oDoc.getCurrentController().getActiveSheet()...
ElseIf oDoc.supportsService("com.sun.star.drawing.Drawi...
oForms = oDoc.getCurrentController().getCurrentPage()...
Else
Exit Sub
End If
' create dialog
oDialog = CreateUnoService("com.sun.star.awt.UnoControl...
oDialogModel = CreateUnoService("com.sun.star.awt.UnoCo...
oDialogModel.setPropertyValues( _
Array("Height", "PositionX", "PositionY", "Width"), _
Array(200, 50, 50, 130) )
oDialog.setModel(oDialogModel)
' AutoClose check box
oCheckModel = oDialogModel.createInstance("com.sun.star...
oCheckModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "Auto Close", 1, 187, 1, 40))
oDialogModel.insertByName("AutoClose", oCheckModel)
' Close Button
oCloseBtnModel = oDialogModel.createInstance("com.sun.s...
oCloseBtnModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "~Close", 94, 187, com.sun.star.awt.PushB...
oDialogModel.insertByName("CloseBtn", oCloseBtnModel)
' MRI Button
oMRIBtnModel = oDialogModel.createInstance("com.sun.sta...
oMRIBtnModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "~MRI", 58, 187, com.sun.star.awt.PushBut...
oDialogModel.insertByName("MRIBtn", oMRIBtnModel)
' create tree control
oTreeModel = oDialogModel.createInstance("com.sun.star....
oTreeModel.setPropertyValues( _
Array("Height", "PositionX", "PositionY", "Selectio...
Array(186, 1, 1, com.sun.star.view.SelectionType.SI...
oDialogModel.insertByName("Tree", oTreeModel)
oTree = oDialog.getControl("Tree")
oTreeDataModel = CreateUnoService("com.sun.star.awt.tre...
' make new tree model structure
oTreeDataModel = CreateUnoService( _
"com.sun.star.awt.tree.MutableTreeDataModel")
' top node
oRootNode = oTreeDataModel.createNode("Forms", true)
oRootNode.setCollapsedGraphicURL("private:graphicreposi...
oRootNode.setExpandedGraphicURL("private:graphicreposit...
' set data to the root
oTreeDataModel.setRoot(oRootNode)
oTreeModel.DataModel = oTreeDataModel
AddChildren(oForms, oTreeDataModel, oRootNode)
oDialog.setVisible(True)
oButtonListener = CreateUnoListener("ButtonPush_", "com...
oMRIBtn = oDialog.getControl("MRIBtn")
oMRIBtn.addActionListener(oButtonListener)
oTree.expandNode(oRootNode) ' expand after dialog visible
ExpandAllNodes(oTree, oRootNode)
oMouseListener = CreateUnoListener("Mouse_", "com.sun.s...
oTree.addMouseListener(oMouseListener)
oDialog.execute()
oTree.removeMouseListener(oMouseListener)
oMRIBtn.removeActionListener(oButtonListener)
'oDialog.getControl("MRIBtn").removeActionListener(oBut...
'oDialog.dispose()
End Sub
Sub CloseDialog()
If oDialog.getControl("AutoClose").State = 1 Then oDial...
End Sub
Function GetFormControl(oForms As Object, oNode As Object...
Dim oControl As Object
Dim sNames() As String
While NOT IsNull(oNode)
n = UBound(sNames) +1
ReDim Preserve sNames(n)
sNames(n) = CStr(oNode.getDisplayValue())
oNode = oNode.getParent()
WEnd
' find control
oControl = oForms
For i = UBound(sNames) -1 to 0 step -1
oControl = oControl.getByName(sNames(i))
Next
GetFormControl = oControl
End Function
Sub SelectControl(oForms As Object, oNode As Object) As O...
oControl = GetFormControl(oForms, oNode)
If IsNull(oControl) Then Exit Sub
oDoc.getCurrentController().select(oControl)
End Sub
Sub OpenWithMRI(oForms As Object, oControl As Object)
oControl = GetFormControl(oForms, oControl)
If IsNull(oControl) Then Exit Sub
oController = ThisComponent.getCurrentController().getC...
Globalscope.BasicLibraries.loadLibrary("MRILib")
MRILib.Mri(oController)
End Sub
Sub Mouse_mousePressed(oEv As com.sun.star.awt.MouseEvent)
If oEv.Buttons = com.sun.star.awt.MouseButton.RIGHT Then
oTree = oEv.Source.getContext().getControl("Tree")
oNearNode = oTree.getClosestNodeForLocation(oEv.X,oEv...
If IsNull(oNearNode) Then Exit Sub
aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
aRect.X = oEv.X + oTree.PosSize.X
aRect.Y = oEv.Y + oTree.PosSize.Y
oPopup = CreateUnoService("stardiv.vcl.PopupMenu")'"c...
oPopup.insertItem(1, "Select", 0, 0)
oPopup.insertItem(2, "MRI", 0, 1)
oPopup.setCommand(1, "select")
oPopup.setCommand(2, "mri")
n = oPopup.execute(oTree.getContext().getPeer(), aRec...
com.sun.star.awt.PopupMenuDirection.EXECUTE_DEFAULT)
If n > 0 Then
sCommand = oPopup.getCommand(n)
Select Case sCommand
Case "select"
SelectControl(oForms, oNearNode)
Case "mri"
OpenWithMRI(oForms, oNearNode)
End Select
'oEv.Source.getContext().endExecute() ' close dialog
CloseDialog()
End If
End If
End Sub
Sub Mouse_mouseReleased(oEv)
If oEv.Buttons = com.sun.star.awt.MouseButton.LEFT and ...
oTree = oEv.Source.getContext().getControl("Tree")
oNearNode = oTree.getClosestNodeForLocation(oEv.X,oEv...
If IsNull(oNearNode) Then Exit Sub
OpenWithMRI(oForms, oNearNode)
CloseDialog
End If
End Sub
Sub Mouse_mouseEntered(ev)
End Sub
Sub Mouse_mouseExited(ev)
End Sub
Sub Mouse_disposing(ev)
End Sub
Sub ButtonPush_actionPerformed(oEv As com.sun.star.awt.Ac...
' get selected item
Dim oSelected() As Object
oTree = oEv.Source.getContext().getControl("Tree")
oSelected = oTree.getSelection()
If IsArray(oSelected) Then
Exit Sub
Else
OpenWithMRI(oForms, oSelected(0))
CloseDialog
End If
End Sub
Sub ButtonPush_dispose(oEv)
End Sub
Sub AddChildren( oContainer As Object, oDataModel As Obje...
' index is better about their order in the tree
'sNames = oContainer.getElementNames()
'For i = 0 To UBound(sNames) step 1
'sName = sNames(i)
For i = 0 To oContainer.getCount() - 1 step 1
'If oContainer.hasByName(sName) Then
'oModel = oContainer.getByName(sName)
oModel = oContainer.getByIndex(i)
sName = oModel.getName()
sImageURL = GetImageURL(oModel.getServiceName())
If HasUnoInterfaces(oModel, _
"com.sun.star.container.XContainer") Then
oChild = oDataModel.createNode(sName, true)
AddChildren(oContainer.getByName(sName), oDataMod...
Else
oChild = oDataModel.createNode(sName, false)
End If
oChild.setExpandedGraphicURL(sImageURL)
oChild.setCollapsedGraphicURL(sImageURL)
oParent.appendChild(oChild)
'End If
Next
End Sub
Sub ExpandAllNodes(oTree As Object, oParent)
For i = 0 To oParent.getChildCount() - 1 step 1
oChild = oParent.getChildAt(i)
oTree.expandNode(oChild)
If oChild.getChildCount() > 0 Then
ExpandAllNodes(oTree, oChild)
End If
Next
End Sub
Function GetImageURL(sServiceName As String) As String
Dim sName As String
sControlService = Mid(sServiceName, 28) 'stardiv.one.fo...
sServices = Array(_
"CheckBox", "ComboBox", "CommandButton", _
"CurrencyField", "DateField", "Edit", "FileControl", _
"FixedText", "Form", "FormattedField", _
"Grid", "GroupBox", "HiddenControl", _
"ImageButton", "ImageControl", "ListBox", _
"NumericField", "PatternField", "RadioButton", _
"TextField", "TimeField", _
".NavigationToolBar", ".SpinButton", ".ScrollBar")
sNames = Array(_
"sx10596", "sx10601", "sx10594", _
"sx10707", "sx10704", "sx10599", "sx10605", _
"sx10597", "sx10593", "sx10728", _
"sx10603", "sx10598", "sx18022", _
"sx10604", "sx10710", "sx10600", _
"sx10706", "sx10708", "sx10595", _
"sx10599", "sx10705", _
"sx10607", "sx10769", "sx10768")
For i = 0 To UBound(sServices) step 1
If sServices(i) = sControlService Then
sName = sNames(i)
Exit For
End If
Next
GetImageURL = "private:graphicrepository/res/" & sName ...
End Function
}}
以前 MRI を使うツール公開していいか?ってメールがきてアイ...
色々機能を付け加えてウィンドウに変更してフォームナビゲー...
End:
*メモ [#a53be209]
フォーム関連メモ。行き先が決まれば移動されるかもしれませ...
#contents
**タブっぽくコントロールの表示切り替え [#pcfecb73]
フォームにタブコントロールはありません。ボタンを押してコ...
コントロールの表示/非表示を切り替えるにはフォームコントロ...
&ref(TabLike_Form-1.odt);
ボタンを配置してそれぞれのボタンをページ切り替えとして利...
また、ドキュメントを開いたときなどのイベントにあるページ...
-コントロールが重なっているため、フォーム編集時にはフォー...
-フォームが完成するまではコントロールをずらして作成するべ...
あとは
-グリッドを表示したままだった。
-ページを切り替えたときにフォーカスを移すとか…。
-ボタンの色がいまいち。
-グループボックスにタイトルを設定してみたが…。
**タブっぽくコントロールの表示切り替え2 [#e91a149c]
[[Simulating tabs in a form.>http://user.services.openoff...
ではセクションの切り替えでタブ風にしているようです。こっ...
セクションは取り扱いが面倒、ということでフレームにセクシ...
書いてみたマクロが上記のコードとほとんど同じだったので上...
**フォームコントロールからのコピー [#id4cc213]
一行もののフォームコントロールの内容を、ボタンなどを押す...
ボタンなどに下記を割り当てます。ボタンを押すと TextBox の...
Sub CopyButtonPush( ev )
oForm = ev.Source.getModel().getParent()
oTextBox = oForm.getByName("TextBox")
oDoc = oForm.getParent().getParent()
oController = oDoc.getCurrentController()
oControl = oController.getControl(oTextBox)
oAccControl = oControl.getAccessibleContext()
nCount = oAccControl.getCharacterCount()
oAccControl.copyText(0, nCount)
End Sub
**ボタンを押す [#e9980366]
フォーム上に配置したボタンを押します (押したのと同じ状態...
PushButton1 をマウスでクリックしたときの動作を起こします。
Sub ButtonPushed( ev )
oForm = ev.Source.getModel().getParent()
oButton = oForm.getByName("PushButton1")
oDoc = oForm.getParent().getParent()
oController = oDoc.getCurrentController()
oControl = oController.getControl(oButton)
oAccControl = oControl.getAccessibleContext()
oAccControl.doAccessibleAction(0)
End Sub
押したときに実行されるプロシージャを呼び出せばいいじゃな...
** 画像サイズに合わせてイメージコントロールのサイズを変更...
画像のサイズに合わせてイメージコントロールのサイズを変更...
コントロールの XControlModel からシェープを探し出す必要が...
#code(ob){{
Sub Main
oDoc = ThisComponent
oDrawPage = oDoc.getDrawpage()
oController = oDoc.getCurrentController()
oForm = oDrawPage.getForms().getByIndex(0)
oImageCtrl = oForm.getByName("ImageControl")
oGraphic = oImageCtrl.Graphic
oShape = FindShape( oDrawPage, oImageCtrl )
aBaseSize = oShape.Size
aSize = CalculateSize( aBaseSize, oGraphic.Size )
oShape.Size = aSize
End Sub
Function FindShape( oContainer As Object, oModel ) As Obj...
Dim oFound As Object
For i = 0 To oContainer.getCount() -1 step 1
oShape = oContainer.getByIndex(i)
If oShape.supportsService("com.sun.star.drawing.Contr...
If EqualUNOObjects( oShape.Control, oModel ) Then
oFound = oShape
Exit For
End If
End If
Next
FindShape = oFound
End Function
Function CalculateSize( aShapeSize, aGraphicSize )
Dim aSize As New com.sun.star.awt.Size
aSize.Width = aShapeSize.Height * ( aGraphicSize.Width ...
aSize.Height = aShapeSize.Height
CalculateSize = aSize
End Function
}}
** フォームコントロールを MRI で簡単に開く [#tbaa11d0]
実行するとドキュメント中にあるフォームコントロール一覧の...
#code(basic){{
'Dim oTree As Object
Dim oDoc As Object
Dim oForms As Object
Dim oDialog As Object
Sub Main
oDoc = ThisComponent
If oDoc.supportsService("com.sun.star.text.TextDocument...
oForms = oDoc.getDrawPage().getForms()
ElseIf oDoc.supportsService("com.sun.star.sheet.Spreads...
' Spreadsheet needs problem about active sheet changing
oForms = oDoc.getCurrentController().getActiveSheet()...
ElseIf oDoc.supportsService("com.sun.star.drawing.Drawi...
oForms = oDoc.getCurrentController().getCurrentPage()...
Else
Exit Sub
End If
' create dialog
oDialog = CreateUnoService("com.sun.star.awt.UnoControl...
oDialogModel = CreateUnoService("com.sun.star.awt.UnoCo...
oDialogModel.setPropertyValues( _
Array("Height", "PositionX", "PositionY", "Width"), _
Array(200, 50, 50, 130) )
oDialog.setModel(oDialogModel)
' AutoClose check box
oCheckModel = oDialogModel.createInstance("com.sun.star...
oCheckModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "Auto Close", 1, 187, 1, 40))
oDialogModel.insertByName("AutoClose", oCheckModel)
' Close Button
oCloseBtnModel = oDialogModel.createInstance("com.sun.s...
oCloseBtnModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "~Close", 94, 187, com.sun.star.awt.PushB...
oDialogModel.insertByName("CloseBtn", oCloseBtnModel)
' MRI Button
oMRIBtnModel = oDialogModel.createInstance("com.sun.sta...
oMRIBtnModel.setPropertyValues(_
Array("Height", "Label", "PositionX", "PositionY", ...
Array(13, "~MRI", 58, 187, com.sun.star.awt.PushBut...
oDialogModel.insertByName("MRIBtn", oMRIBtnModel)
' create tree control
oTreeModel = oDialogModel.createInstance("com.sun.star....
oTreeModel.setPropertyValues( _
Array("Height", "PositionX", "PositionY", "Selectio...
Array(186, 1, 1, com.sun.star.view.SelectionType.SI...
oDialogModel.insertByName("Tree", oTreeModel)
oTree = oDialog.getControl("Tree")
oTreeDataModel = CreateUnoService("com.sun.star.awt.tre...
' make new tree model structure
oTreeDataModel = CreateUnoService( _
"com.sun.star.awt.tree.MutableTreeDataModel")
' top node
oRootNode = oTreeDataModel.createNode("Forms", true)
oRootNode.setCollapsedGraphicURL("private:graphicreposi...
oRootNode.setExpandedGraphicURL("private:graphicreposit...
' set data to the root
oTreeDataModel.setRoot(oRootNode)
oTreeModel.DataModel = oTreeDataModel
AddChildren(oForms, oTreeDataModel, oRootNode)
oDialog.setVisible(True)
oButtonListener = CreateUnoListener("ButtonPush_", "com...
oMRIBtn = oDialog.getControl("MRIBtn")
oMRIBtn.addActionListener(oButtonListener)
oTree.expandNode(oRootNode) ' expand after dialog visible
ExpandAllNodes(oTree, oRootNode)
oMouseListener = CreateUnoListener("Mouse_", "com.sun.s...
oTree.addMouseListener(oMouseListener)
oDialog.execute()
oTree.removeMouseListener(oMouseListener)
oMRIBtn.removeActionListener(oButtonListener)
'oDialog.getControl("MRIBtn").removeActionListener(oBut...
'oDialog.dispose()
End Sub
Sub CloseDialog()
If oDialog.getControl("AutoClose").State = 1 Then oDial...
End Sub
Function GetFormControl(oForms As Object, oNode As Object...
Dim oControl As Object
Dim sNames() As String
While NOT IsNull(oNode)
n = UBound(sNames) +1
ReDim Preserve sNames(n)
sNames(n) = CStr(oNode.getDisplayValue())
oNode = oNode.getParent()
WEnd
' find control
oControl = oForms
For i = UBound(sNames) -1 to 0 step -1
oControl = oControl.getByName(sNames(i))
Next
GetFormControl = oControl
End Function
Sub SelectControl(oForms As Object, oNode As Object) As O...
oControl = GetFormControl(oForms, oNode)
If IsNull(oControl) Then Exit Sub
oDoc.getCurrentController().select(oControl)
End Sub
Sub OpenWithMRI(oForms As Object, oControl As Object)
oControl = GetFormControl(oForms, oControl)
If IsNull(oControl) Then Exit Sub
oController = ThisComponent.getCurrentController().getC...
Globalscope.BasicLibraries.loadLibrary("MRILib")
MRILib.Mri(oController)
End Sub
Sub Mouse_mousePressed(oEv As com.sun.star.awt.MouseEvent)
If oEv.Buttons = com.sun.star.awt.MouseButton.RIGHT Then
oTree = oEv.Source.getContext().getControl("Tree")
oNearNode = oTree.getClosestNodeForLocation(oEv.X,oEv...
If IsNull(oNearNode) Then Exit Sub
aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
aRect.X = oEv.X + oTree.PosSize.X
aRect.Y = oEv.Y + oTree.PosSize.Y
oPopup = CreateUnoService("stardiv.vcl.PopupMenu")'"c...
oPopup.insertItem(1, "Select", 0, 0)
oPopup.insertItem(2, "MRI", 0, 1)
oPopup.setCommand(1, "select")
oPopup.setCommand(2, "mri")
n = oPopup.execute(oTree.getContext().getPeer(), aRec...
com.sun.star.awt.PopupMenuDirection.EXECUTE_DEFAULT)
If n > 0 Then
sCommand = oPopup.getCommand(n)
Select Case sCommand
Case "select"
SelectControl(oForms, oNearNode)
Case "mri"
OpenWithMRI(oForms, oNearNode)
End Select
'oEv.Source.getContext().endExecute() ' close dialog
CloseDialog()
End If
End If
End Sub
Sub Mouse_mouseReleased(oEv)
If oEv.Buttons = com.sun.star.awt.MouseButton.LEFT and ...
oTree = oEv.Source.getContext().getControl("Tree")
oNearNode = oTree.getClosestNodeForLocation(oEv.X,oEv...
If IsNull(oNearNode) Then Exit Sub
OpenWithMRI(oForms, oNearNode)
CloseDialog
End If
End Sub
Sub Mouse_mouseEntered(ev)
End Sub
Sub Mouse_mouseExited(ev)
End Sub
Sub Mouse_disposing(ev)
End Sub
Sub ButtonPush_actionPerformed(oEv As com.sun.star.awt.Ac...
' get selected item
Dim oSelected() As Object
oTree = oEv.Source.getContext().getControl("Tree")
oSelected = oTree.getSelection()
If IsArray(oSelected) Then
Exit Sub
Else
OpenWithMRI(oForms, oSelected(0))
CloseDialog
End If
End Sub
Sub ButtonPush_dispose(oEv)
End Sub
Sub AddChildren( oContainer As Object, oDataModel As Obje...
' index is better about their order in the tree
'sNames = oContainer.getElementNames()
'For i = 0 To UBound(sNames) step 1
'sName = sNames(i)
For i = 0 To oContainer.getCount() - 1 step 1
'If oContainer.hasByName(sName) Then
'oModel = oContainer.getByName(sName)
oModel = oContainer.getByIndex(i)
sName = oModel.getName()
sImageURL = GetImageURL(oModel.getServiceName())
If HasUnoInterfaces(oModel, _
"com.sun.star.container.XContainer") Then
oChild = oDataModel.createNode(sName, true)
AddChildren(oContainer.getByName(sName), oDataMod...
Else
oChild = oDataModel.createNode(sName, false)
End If
oChild.setExpandedGraphicURL(sImageURL)
oChild.setCollapsedGraphicURL(sImageURL)
oParent.appendChild(oChild)
'End If
Next
End Sub
Sub ExpandAllNodes(oTree As Object, oParent)
For i = 0 To oParent.getChildCount() - 1 step 1
oChild = oParent.getChildAt(i)
oTree.expandNode(oChild)
If oChild.getChildCount() > 0 Then
ExpandAllNodes(oTree, oChild)
End If
Next
End Sub
Function GetImageURL(sServiceName As String) As String
Dim sName As String
sControlService = Mid(sServiceName, 28) 'stardiv.one.fo...
sServices = Array(_
"CheckBox", "ComboBox", "CommandButton", _
"CurrencyField", "DateField", "Edit", "FileControl", _
"FixedText", "Form", "FormattedField", _
"Grid", "GroupBox", "HiddenControl", _
"ImageButton", "ImageControl", "ListBox", _
"NumericField", "PatternField", "RadioButton", _
"TextField", "TimeField", _
".NavigationToolBar", ".SpinButton", ".ScrollBar")
sNames = Array(_
"sx10596", "sx10601", "sx10594", _
"sx10707", "sx10704", "sx10599", "sx10605", _
"sx10597", "sx10593", "sx10728", _
"sx10603", "sx10598", "sx18022", _
"sx10604", "sx10710", "sx10600", _
"sx10706", "sx10708", "sx10595", _
"sx10599", "sx10705", _
"sx10607", "sx10769", "sx10768")
For i = 0 To UBound(sServices) step 1
If sServices(i) = sControlService Then
sName = sNames(i)
Exit For
End If
Next
GetImageURL = "private:graphicrepository/res/" & sName ...
End Function
}}
以前 MRI を使うツール公開していいか?ってメールがきてアイ...
色々機能を付け加えてウィンドウに変更してフォームナビゲー...
Page: