' ' Change Fonts Script v1.0 ' ' WARNING: ' ' This script does not check state / activity diagrams ' in nested classes. ' ' copyright (c) 2000, Michael Moors ' ' Author: Michael Moors (mmoors@rational.com) ' ' Date: 18-May-2000 ' Option Explicit ' Set the font for all the item views Sub SetFont (ItemViews As ItemViewCollection) Dim k As Long Dim Font As View_Font For k = 1 To ItemViews.Count Set Font = ItemViews.GetAt(k).Font Font.FaceName = "Courier New" Font.Size = 12 Font.Bold = True Next k End Sub 'Get all class diagrams of a model Function GetAllClassDiagrams (theModel As Model) As ClassDiagramCollection Dim x As Long Dim y As Long Dim UCs As UseCaseCollection Dim Cats As CategoryCollection Dim Diags As ClassDiagramCollection Set Diags = New ClassDiagramCollection Set Cats = theModel.GetAllCategories For x = 1 To Cats.Count Diags.AddCollection Cats.getat(x).ClassDiagrams Set UCs = Cats.getat(x).UseCases For y = 1 To UCs.count Diags.AddCollection UCs.getat(y).ClassDiagrams Next y Next x Set GetAllClassDiagrams = Diags End Function 'Get all Scenario diagrams of a model Function GetAllScenarioDiagrams (theModel As Model) As ScenarioDiagramCollection Dim x As Long Dim y As Long Dim UCs As UseCaseCollection Dim Cats As CategoryCollection Dim Diags As ScenarioDiagramCollection Set Diags = New ScenarioDiagramCollection Set Cats = theModel.GetAllCategories For x = 1 To Cats.Count Diags.AddCollection Cats.getat(x).ScenarioDiagrams Set UCs = Cats.getat(x).UseCases For y = 1 To UCs.count Diags.AddCollection UCs.getat(y).ScenarioDiagrams Next y Next x Set GetAllScenarioDiagrams = Diags End Function 'Get all State diagrams of a model Function GetAllStateDiagrams (theModel As Model) As StateDiagramCollection Dim Cat As Categorycollection Dim Use As UseCaseCollection Dim Cls As ClassCollection Set Cat = RoseApp.CurrentModel.GetAllCategories Set Use = RoseApp.CurrentModel.GetAllUseCases Set Cls = RoseApp.CurrentModel.GetAllClasses '(Cls does not contain the nested classes) ' Loop through each of these collections and get the statemachines Dim Machs As New StateMachineCollection Dim x As Long For x = 1 To Cls.count Machs.addcollection cls.getat(x).statemachineowner.statemachines Next x For x = 1 To Use.count Machs.addcollection use.getat(x).statemachineowner.statemachines Next x For x = 1 To Cat.count Machs.addcollection cat.getat(x).statemachineowner.statemachines Next x ' Loop through statemachines and get all diagrams Dim Diags As New StateDiagramCollection For x = 1 To machs.count Diags.AddCollection machs.getat(x).diagrams Next x Set GetAllStateDiagrams = Diags End Function 'Get all Module diagrams of a model Function GetAllModuleDiagrams (theModel As Model) As ModuleDiagramCollection Dim x As Long Dim Subs As SubSystemCollection Dim Diags As ModuleDiagramCollection Set Diags = New ModuleDiagramCollection Set Subs = theModel.GetAllSubSystems For x = 1 To Subs.Count Diags.AddCollection Subs.getat(x).ModuleDiagrams Next x Set GetAllModuleDiagrams = Diags End Function 'Main Diagram that applies the font update to all diagrams Sub Main Dim j As Long Dim theModel As Model Set theModel = RoseApp.CurrentModel Dim ClassDiagrams As ClassDiagramCollection Set ClassDiagrams = GetAllClassDiagrams(theModel) For j = 1 To ClassDiagrams.count SetFont ClassDiagrams.getat(j).ItemViews Next j Dim ScenarioDiagrams As ScenarioDiagramCollection Set ScenarioDiagrams = GetAllScenarioDiagrams(theModel) For j = 1 To ScenarioDiagrams.count SetFont ScenarioDiagrams.getat(j).ItemViews Next j Dim StateDiagrams As StateDiagramCollection Set StateDiagrams = GetAllStateDiagrams(theModel) For j = 1 To StateDiagrams.count SetFont StateDiagrams.getat(j).ItemViews Next j Dim ModuleDiagrams As ModuleDiagramCollection Set ModuleDiagrams = GetAllModuleDiagrams(theModel) For j = 1 To ModuleDiagrams.count SetFont ModuleDiagrams.getat(j).ItemViews Next j SetFont theModel.DeploymentDiagram.ItemViews End Sub