2)I want to migrate from Microsoft Visio to OpenOffice Draw.(From Window 10 to Ubuntu 18)
3)In Visio I have some macros.
4.0)It is doing some work like on image.
4.1) When value was changed in Shape1, macros change value in Shape2 and ShapeN.
4.2) When value was changed in Shape2, macros change value in Shape1 and ShapeN.
4.3)Value of shape: Id#SomeText. When "Some text" was changed all shapes with Id are change.
No parent shapes, no children shapes.
5.0)Question1:Is it possible realize it in OpenOffice Draw with OpenOffice macros?
5.1)Question2: Is it possible realize it in OpenOffice Draw without macros?(I think it is not possible, but I must ask it)
5.2)Question3:Can someone direct me which way I must choose in OpenOffice Draw?(Get shape properties, Event "shape was changed" and etc)
6)Sorry for my poor English, I hope someone undestand me.
7.)Thanks for any help.
Below macros for realize it in Microsoft Visio.
Code: Select all
Option Explicit
Private mEventSink As clsEventSink
Dim vsoDocumentEvents As Visio.EventList
Dim vsoTextChangedEvent As Visio.Event
'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000
Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
'// This procedure runs when a Visio document is
'// opened.
Call MsgBox("Document_DocumentOpened")
'Create an instance of the clsEventSink class
'to pass to the AddAdvise method.
Set mEventSink = New clsEventSink
'Get the EventList collection of the active document.
Set vsoDocumentEvents = ActiveDocument.EventList
Set vsoTextChangedEvent = vsoDocumentEvents.AddAdvise( _
visEvtMod + visEvtText, mEventSink, "", "Text changed...")
'Create an instance of the clsEventSink class
'to pass to the AddAdvise method.
Set mEventSink = New clsEventSink
'Get the EventList collection of the active document.
Set vsoDocumentEvents = ActiveDocument.EventList
Set vsoTextChangedEvent = vsoDocumentEvents.AddAdvise( _
visEvtMod + visEvtText, mEventSink, "", "Text changed...")
End Sub
Implements Visio.IVisEventProc
'Declare visEvtAdd as a 2-byte value
'to avoid a run-time overflow error
Private Const visEvtAdd% = &H8000
Private Function IVisEventProc_VisEventProc( _
ByVal nEventCode As Integer, _
ByVal pSourceObj As Object, _
ByVal nEventID As Long, _
ByVal nEventSeqNum As Long, _
ByVal pSubjectObj As Object, _
ByVal vMoreInfo As Variant) As Variant
Dim strMessage As String
Dim marker As String
'Find out which event fired
Select Case nEventCode
Case (visEvtMod + visEvtText)
strMessage = "TextChanged (" & nEventCode & ")"
'Debug.Print "pSourceObj.Name " & pSourceObj.Name
'Debug.Print "pSubjectObj.Name " & pSubjectObj.Name
'Debug.Print "pSubjectObj.Text " & pSubjectObj.Text
'Find and check command in string
If pSubjectObj.Text Like "*#*" Then
'Debug.Print "pSubjectObj.Text conteint #"
'if command found
Dim commands() As String
commands = Split(pSubjectObj.Text, "#")
'marker made
marker = commands(0) & "#"
'Debug.Print "marker " & marker
'Now find marker in shapes if has found shapes.name like a another name
Dim intCounter As Integer
Dim intShapeCount As Integer
Dim vsoShapes As Visio.Shapes
Set vsoShapes = Visio.ActivePage.PageSheet.Shapes
'Debug.Print "Shapes in document: "; ActiveDocument.Name
'Debug.Print "On page: "; Visio.ActivePage.PageSheet.Name
intShapeCount = vsoShapes.Count
If intShapeCount > 0 Then
For intCounter = 1 To intShapeCount
'Debug.Print "shape text " & vsoShapes.Item(intCounter).Text
If InStr(1, vsoShapes.Item(intCounter).Text, marker) = 1 Then
'Debug.Print "Shape have marker and name shape"
If vsoShapes.Item(intCounter).Name = pSubjectObj.Name Then
Else
If vsoShapes.Item(intCounter).Text = pSubjectObj.Text Then
Else
vsoShapes.Item(intCounter).Text = pSubjectObj.Text
End If
End If
End If
Next intCounter
Else
Debug.Print "No Shapes On Page"
End If
'then find continuing
End If
Case Else
strMessage = "Other (" & nEventCode & ")"
End Select
'Display the event name and the event code
'Debug.Print strMessage
End Function