home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2002 November / VPR0211A.ISO / OPENOFFICE / f_0138 / develop.xba < prev    next >
Extensible Markup Language  |  2001-12-18  |  17KB  |  530 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="develop" script:language="StarBasic">REM  *****  BASIC  *****
  4. Option Explicit
  5.  
  6. Public oDBShapeList() as Object
  7. Public oTCShapeList() as Object
  8. Public oDBModelList() as Object
  9. Public oGroupShapeList() as Object
  10.  
  11. Public oGridShape as Object
  12. Public a as Integer
  13. Public StartA as Integer
  14. Public bIsFirstRun as Boolean
  15. Public bIsVeryFirstRun as Boolean
  16. Public bControlsareCreated as Boolean
  17. Public nDBRefHeight as Long
  18. Public nXTCPos&, nYTCPos&, nXDBPos&, nYDBPos&, nTCHeight&, nTCWidth&, nDBHeight&, nDBWidth&
  19.  
  20. Dim iReduceWidth as Integer
  21.  
  22. Function PositionControls(Maxindex as Integer)
  23. Dim oTCModel as Object
  24. Dim oDBModel as Object
  25. Dim i as Integer
  26.     InitializePosSizes()
  27.     bIsFirstRun = True
  28.     bIsVeryFirstRun = True
  29.     a = 0
  30.     StartA = 0
  31.     nMaxRowY = 0
  32.     nSecMaxRowY = 0
  33.     If CurArrangement = cLeftJustified Or cTopJustified Then
  34.         oDialogModel.optAlign0.State = 1
  35.     End If
  36.     For i = 0 To MaxIndex
  37.         GetCurrentMetaValues(i)
  38.         oTCModel = InsertTextControl(i)
  39.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  40.             InsertTimeStampShape(i)            
  41.         Else        
  42.             InsertDBControl(i)
  43.             bIsVeryFirstRun = False
  44.             oDBModelList(i).LabelControl = oTCModel
  45.         End If
  46.         GetLabelDiffHeight(i+1)
  47.         ResetPosSizes(i)
  48.         oProgressbar.Value = i
  49.     Next i
  50.     ControlCaptionstoStandardLayout()
  51.     bControlsareCreated = True
  52. End Function
  53.  
  54.  
  55. Sub ResetPosSizes(LastIndex as Integer)
  56.     Select Case CurArrangement
  57.         Case cColumnarLeft
  58.             nYDBPos = nYDBPos  + nDBHeight + cVertDistance
  59.             If (nYDBPos > cYOffset + nFormHeight) Or (LastIndex = MaxIndex) Then
  60.                 RepositionColumnarLeftControls(LastIndex)
  61.                 nXTCPos = nMaxColRightX + 2 * cHoriDistance
  62.                 nXDBPos = nXTCPos + cHoriDistance + nMaxTCWidth
  63.                 nYDBPos = cYOffset
  64.                 bIsFirstRun = True
  65.                 StartA = LastIndex + 1
  66.                 a = 0
  67.             Else
  68.                 a = a + 1
  69.             End If
  70.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  71.         Case cColumnarTop
  72.             nYTCPos = nYDBPos + nDBHeight + cVertDistance
  73.             If nYTCPos > cYOffset + nFormHeight Then
  74.                 nXDBPos = nMaxColRightX + cHoriDistance
  75.                 nXTCPos = nXDBPos
  76.                 nYDBPos = cYOffset + nTCHeight + cVertDistance
  77.                 nYTCPos = cYOffset
  78.                 bIsFirstRun = True
  79.                 StartA = LastIndex + 1
  80.                 a = 0
  81.             Else
  82.                 a = a + 1
  83.             End If
  84.         Case cLeftJustified,cTopJustified
  85.             If nMaxColRightX > cXOffset + nFormWidth Then
  86.                 Dim nOldYTCPos as Long
  87.                 nOldYTCPos = nYTCPos
  88.                 CheckJustifiedPosition()
  89.             Else
  90.                 nXTCPos = nMaxColRightX + CHoriDistance
  91.                 If CurArrangement = cLeftJustified Then
  92.                     nYTCPos = nYDBPos + LabelDiffHeight
  93.                 End If
  94.             End If
  95.             a = a + 1                
  96.     End Select
  97. End Sub
  98.  
  99.  
  100. Sub    RepositionColumnarLeftControls(LastIndex as Integer)
  101. Dim aSize As New com.sun.star.awt.Size
  102. Dim aPoint As New com.sun.star.awt.Point
  103. Dim i as Integer
  104.     aSize = GetSize(nMaxTCWidth, nTCHeight)
  105.     bIsFirstRun = True
  106.     For i = StartA To LastIndex
  107.         oLocTextShape.Size = aSize
  108.         If i = StartA Then
  109.             nXTCPos = oTCShapeList(i).Position.X
  110.             nXDBPos = nXTCPos + nMaxTCWidth  + cHoriDistance
  111.         End If
  112.         ResetDBShape(oDBShapeList(i), nXDBPos)
  113.         CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  114.     Next i
  115. End Sub
  116.  
  117.  
  118. Sub ResetDBShape(oLocDBShape as Object, iXPos as Long)
  119. Dim aSize As New com.sun.star.awt.Size
  120. Dim aPoint As New com.sun.star.awt.Point
  121.     nYDBPos = oLocDBShape.Position.Y
  122.     nDBWidth = oLocDBShape.Size.Width
  123.     nDBHeight = oLocDBShape.Size.Height
  124.     aPoint = GetPoint(iXPos,nYDBPos)
  125.     oLocDBShape.SetPosition(aPoint)
  126. End Sub
  127.  
  128.  
  129. Sub InitializePosSizes()
  130.     nXTCPos = cXOffset
  131.     nTCWidth = 2000
  132.     nDBWidth = 2000
  133.     nDBHeight = nDBRefHeight
  134.     iReduceWidth = 0
  135.     Select Case CurArrangement
  136.         Case cColumnarLeft, cLeftJustified
  137.             GetLabelDiffHeight(0)
  138.             nYTCPos = cYOffset + LABELDIFFHEIGHT
  139.             nXDBPos = cXOffset + 3050
  140.             nYDBPos = cYOffset
  141.         Case cColumnarTop, cTopJustified
  142.             nXDBPos = cXOffset
  143.             nYTCPos = cYOffset
  144.     End Select
  145. End Sub
  146.  
  147.  
  148. Function InsertTextControl(i as Integer) as Object
  149. Dim oShape as Object
  150. Dim oModel as Object
  151. Dim aPoint as New com.sun.star.awt.Point
  152. Dim aSize As New com.sun.star.awt.Size
  153.     If bControlsareCreated Then
  154.         Set oShape = oTCShapeList(i)
  155.         Set oModel = oShape.GetControl
  156.         If CurArrangement = cLeftJustified Then
  157.             nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
  158.         Else
  159.             nTCWidth = oShape.Size.Width
  160.         End If
  161.         oShape.Position = GetPoint(nXTCPos, nYTCPos)
  162.         If CurArrangement = cColumnarTop Then
  163.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  164.         End If
  165.     Else
  166.         oModel = CreateUnoService(oModelService(cLabel))
  167. ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  168. ' own. therefor the model should be inserted before the shape
  169. '        oDBForm.InsertByName(oModel.Name, oModel)
  170.         aPoint = GetPoint(nXTCPos, nYTCPos)
  171.         aSize = GetSize(nTCWidth,nTCHeight)
  172.         Set oShape = InsertControl(oDrawPage, oModel, aPoint, aSize)
  173.         Set oTCShapeList(i)= oShape
  174.         If bIsVeryFirstRun Then
  175.             If CurArrangement = cColumnarTop Then
  176.                 nYDBPos = nYTCPos + nTCHeight
  177.             End If
  178.         End If
  179.         nTCWidth = GetPreferredWidth(oModel, True, CurFieldName)
  180.     End If
  181.     If CurArrangement = cColumnarLeft Then
  182.         ' Note This If Sequence must be called before retrieving the outer Points
  183.         If bIsFirstRun Then
  184.             nMaxTCWidth = nTCWidth
  185.             bIsFirstRun = False
  186.         ElseIf nTCWidth > nMaxTCWidth Then
  187.             nMaxTCWidth = nTCWidth
  188.         End If
  189.     End If
  190.     CheckOuterPoints(oShape.Position.X, nTCWidth, nYTCPos, nTCHeight, False)
  191.     Select Case CurArrangement
  192.         Case cLeftJustified
  193.             nXDBPos = nMaxColRightX
  194.         Case cColumnarTop,cTopJustified
  195.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  196.             nXDBPos = nXTCPos
  197.             nYDBPos = nYTCPos + nTCHeight
  198.             If CurFieldLength = 20 And nDBWidth > 2 * nTCWidth Then
  199.                 iReduceWidth = iReduceWidth + 1
  200.             End If 
  201.     End Select    
  202.     oShape.SetSize(GetSize(nTCWidth,nTCHeight))
  203.     If CurHelpText <> "" Then
  204.         oModel.HelpText = CurHelptext
  205.     End If
  206.     InsertTextControl = oModel
  207. End Function
  208.  
  209.  
  210. Sub InsertDBControl(i as Integer)
  211. Dim aPoint as New com.sun.star.awt.Point
  212. Dim aSize As New com.sun.star.awt.Size
  213. Dim oControl as Object
  214. Dim iColRightX as Long
  215.  
  216.     aPoint = GetPoint(nXDBPos, nYDBPos)
  217.     If bControlsAreCreated Then
  218.         oDBShapeList(i).Position = aPoint
  219.     Else
  220.         oDBModelList(i) = CreateUnoService(oModelService(CurControlType))
  221.         oDBShapeList(i) = InsertControl(oDrawPage, oDBModelList(i), aPoint, aSize)        
  222.         SetNumerics(oDBModelList(i), CurFieldType)
  223.         If CurControlType = cCheckBox Then
  224.             oDBModelList(i).Label = ""
  225.         End If
  226.         ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  227.         ' own. therefor the model should be inserted before the shape
  228.         ' oDBForm.InsertByName(oDBModel.Name, oDBModel)
  229.         oDBModelList(i).DataField = CurFieldName
  230.     End If
  231.     nDBHeight = GetDBHeight(oDBModelList(i))
  232.     nDBWidth = GetPreferredWidth(oDBModelList(i),True)
  233.     aSize = GetSize(nDBWidth,nDBHeight)
  234.     oDBShapeList(i).SetSize(aSize)
  235.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  236. End Sub
  237.  
  238.  
  239. Function InsertTimeStampShape(i as Integer) as Object
  240. Dim oDateModel as Object
  241. Dim oTimeModel as Object
  242. Dim oDateShape as Object
  243. Dim oTimeShape as Object
  244. Dim oDateTimeShape as Object
  245. Dim aPoint as New com.sun.star.awt.Point
  246. Dim aSize as New com.sun.star.awt.Size
  247. Dim nDateWidth as Long
  248. Dim nTimeWidth as Long
  249. Dim oGroupShape as Object
  250.     aPoint = GetPoint(nXDBPos, nYDBPos)
  251.     If bControlsAreCreated Then
  252.         oDBShapeList(i).Position = aPoint
  253.         nDBWidth = oDBShapeList(i).Size.Width
  254.         nDBHeight = oDBShapeList(i).Size.Height
  255.     Else        
  256.         oGroupShape = oDocument.CreateInstance("com.sun.star.drawing.GroupShape")
  257.         oGroupShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  258.         oDrawPage.Add(oGroupShape)
  259.         CurFieldType = com.sun.star.sdbc.DataType.DATE
  260.         oDateModel = CreateUnoService("com.sun.star.form.component.DateField")
  261.         oDateModel.DataField = CurFieldName
  262.         oDateShape = InsertControl(oGroupShape, oDateModel, aPoint, aSize)
  263.         SetNumerics(oDateModel, CurFieldType)
  264.         nDBHeight = GetDBHeight(oDateModel)
  265.         nDateWidth = GetPreferredWidth(oDateModel,True)
  266.         aSize = GetSize(nDateWidth,nDBHeight)
  267.         oDateShape.SetSize(aSize)
  268.  
  269.         CurFieldType = com.sun.star.sdbc.DataType.TIME
  270.         oTimeModel = CreateUnoService("com.sun.star.form.component.TimeField")
  271.         oTimeModel.DataField = CurFieldName
  272.         oTimeShape = InsertControl(oGroupShape, oTimeModel, aPoint, aSize)
  273.         oTimeShape.Position = GetPoint(nXDBPos + 10 + nDateWidth,nYDBPos)
  274.         nTimeWidth = GetPreferredWidth(oTimeModel)
  275.         aSize = GetSize(nTimeWidth,nDBHeight)
  276.         oTimeShape.SetSize(aSize)
  277.         nDBWidth = nDateWidth + nTimeWidth + 10
  278.         oGroupShape.Position = aPoint
  279.         oGroupShape.Size = GetSize(nDBWidth + 10 + nTimeWidth, nDBHeight)
  280.         Set oDBShapeList(i)= oGroupShape
  281.     End If
  282.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  283.     InsertTimeStampShape() = oDBShapeList(i)    
  284. End Function
  285.  
  286.  
  287. ' Note on all Controls except for the checkbox the Label has to be set
  288. ' a bit under the DBControl because its Height is also smaller 
  289. Sub GetLabelDiffHeight(Index as Integer)
  290.     If (CurArrangement = cLeftJustified) Or (CurArrangement = cColumnarLeft) Then
  291.         If Index <= Ubound(FieldMetaValues()) Then
  292.             If FieldMetaValues(Index,2) = cCheckBox Then
  293.                 LabelDiffHeight = 0
  294.             Else
  295.                 LabelDiffHeight = BasicLabelDiffHeight
  296.             End If
  297.         End If
  298.     End If
  299. End Sub
  300.  
  301.  
  302. Sub CheckJustifiedPosition()
  303. Dim nLeftDist as Long
  304. Dim nRightDist as Long
  305. Dim oLocDBShape as Object
  306. Dim oLocTextShape as Object
  307. Dim nBaseWidth as Long
  308.     nBaseWidth = nFormWidth + cXOffset
  309.     nLeftDist = nMaxColRightX - nBaseWidth
  310.     nRightDist = nBaseWidth - nXTCPos + cHoriDistance
  311.     If nLeftDist < 0.5 * nRightDist and iReduceWidth > 2 Then
  312.         ' Fieldwidths in the line can be made smaller
  313.         AdjustLineWidth(StartA, a, nLeftDist, - 1)
  314.         If CurArrangement = cLeftjustified Then
  315.             nYDBPos = nMaxRowY + cVertDistance
  316.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  317.             nXTCPos = cXOffset
  318.         Else
  319.             nYTCPos = nMaxRowY + cVertDistance
  320.             nYDBPos = nYTCPos + nTCHeight
  321.             nXTCPos = cXOffset
  322.             nXDBPos = cXOffset
  323.         End If
  324.         bIsFirstRun = True
  325.         StartA = a + 1
  326.     Else
  327.         Set oLocDBShape = oDBShapeList(a)
  328.         Set oLocTextShape = oTCShapeList(a)
  329.         If CurArrangement = cLeftJustified Then
  330.             If nYDBPos + nDBHeight = nMaxRowY Then
  331.                 ' The last Control was the highes in the row
  332.                 nYDBPos = nSecMaxRowY + cVertDistance
  333.             Else
  334.                 nYDBPos = nMaxRowY + cVertDistance
  335.             End If
  336.             nYTCPos = nYDBPos + LABELDIFFHEIGHT
  337.             nXDBPos = cXOffset + nTCWidth
  338.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  339.             oLocDBShape.Position = GetPoint(nXDBPos, nYDBPos)
  340.             ' PosSizes for the next two Controls
  341.             nXTCPos = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  342.             bIsFirstRun = True
  343.             CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  344.             nXDBPos = nMaxColRightX + cHoriDistance
  345.         Else        ' cTopJustified
  346.             If nYDBPos + nDBHeight = nMaxRowY Then
  347.                 ' The last Control was the highest in the row
  348.                 nYTCPos = nSecMaxRowY + cVertDistance
  349.             Else
  350.                 nYTCPos = nMaxRowY + cVertDistance
  351.             End If
  352.             nYDBPos = nYTCPOS + nTCHeight
  353.             nXDBPos = cXOffset
  354.             nXTCPos = cXOffset
  355.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  356.             oLocDBShape.Position = GetPoint(cXOffset, nYDBPos)
  357.             bIsFirstRun = True
  358.             If nDBWidth > nTCWidth Then
  359.                 CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  360.             Else
  361.                 CheckOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, True)
  362.             End If
  363.             nXTCPos = nMaxColRightX + cHoriDistance
  364.             nXDBPos = nXTCPos
  365.         End If
  366.         AdjustLineWidth(StartA, a-1, nRightDist, 1)
  367.         StartA = a
  368.      End If
  369.      iReduceWidth = 0
  370. End Sub
  371.  
  372.  
  373. Sub AdjustLineWidth(StartIndex as Integer, EndIndex as Integer, nDist as Long, Widthfactor as Integer)
  374. Dim i as Integer
  375. Dim oLocDBShape as Object
  376. Dim oLocTCShape as Object
  377. Dim CorrWidth as Integer
  378. Dim bAdjustPos as Boolean
  379. Dim iLocTCPosX as Long
  380. Dim iLocDBPosX as Long
  381. Dim ShapeCount as Integer
  382.     If WidthFactor > 0 Then
  383.         ShapeCount = EndIndex-StartIndex + 1
  384.     Else
  385.         ShapeCount = iReduceWidth
  386.     End If
  387.     CorrWidth = (nDist)/ShapeCount  
  388.     bAdjustPos = False
  389.     iLocTCPosX = cXOffset
  390.     For i = StartIndex To EndIndex
  391.         Set oLocDBShape = oDBShapeList(i)
  392.         Set oLocTCShape = oTCShapeList(i)
  393.         If bAdjustPos Then
  394.             oLocTCShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y)
  395.             If CurArrangement = cLeftJustified Then
  396.                 iLocDBPosX = oLocTCShape.Position.X + oLocTCShape.Size.Width
  397.                 oLocDBShape.Position = GetPoint(iLocDBPosX, oLocDBShape.Position.Y)
  398.             Else
  399.                 oLocDBShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y + nTCHeight)
  400.             End If
  401.         Else
  402.             bAdjustPos = True
  403.         End If
  404.         If CDbl(FieldMetaValues(i,1)) > 20 or WidthFactor > 0 Then
  405.             oLocDBShape.Size = GetSize(oLocDBShape.Size.Width + WidthFactor * CorrWidth, oLocDBShape.Size.Height)
  406.         End If
  407.         iLocTCPosX = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  408.         If CurArrangement = cTopJustified Then
  409.             If oLocTCShape.Size.Width > oLocDBShape.Size.Width Then
  410.                 iLocTCPosX = oLocDBShape.Position.X + oLocTCShape.Size.Width + cHoriDistance
  411.             End If
  412.         End If
  413.     Next i
  414. End Sub
  415.  
  416.  
  417. Sub CheckOuterPoints(nXPos, nWidth, nYPos, nHeight, bIsDBField as Boolean)
  418. Dim nColRightX as Long
  419. Dim nRowY as Long
  420. Dim nOldMaxRowY as Long
  421.     If CurArrangement = cLeftJustified Or CurArrangement = cTopJustified Then
  422.         If bIsDBField Then
  423.             ' Only at DBControls you can measure the Value of nMaxRowY
  424.             If bIsFirstRun Then
  425.                 nMaxRowY = nYPos + nHeight
  426.                 nSecMaxRowY = nMaxRowY
  427.             Else
  428.                 nRowY = nYPos + nHeight
  429.                 If nRowY >= nMaxRowY Then
  430.                     nOldMaxRowY = nMaxRowY
  431.                     nSecMaxRowY = nOldMaxRowY
  432.                     nMaxRowY = nRowY
  433.                 End If
  434.             End If
  435.         End If 
  436.     End If
  437.     ' Find the outer right point
  438.     If bIsFirstRun Then
  439.         nMaxColRightX = nXPos + nWidth
  440.         bIsFirstRun = False
  441.     Else
  442.         nColRightX = nXPos + nWidth
  443.         If nColRightX > nMaxColRightX Then
  444.             nMaxColRightX = nColRightX
  445.         End If
  446.     End If
  447. End Sub
  448.  
  449.  
  450. Function PositionGridControl(MaxIndex as Integer)
  451. Dim oControl as Object
  452. Dim n as Integer
  453. Dim oColumn as Object
  454. Dim aPoint as New com.sun.star.awt.Point
  455. Dim aSize as New com.sun.star.awt.Size
  456.     If bControlsareCreated Then
  457.         ShapesToNirwana()
  458.     End If
  459.     oGridModel = CreateUnoService(oModelService(cGridControl))
  460.     oGridModel.Name = "Grid1"
  461.     aPoint = GetPoint(cXOffset, cYOffset)
  462.     aSize = GetSize(nFormWidth, nFormHeight)
  463.     oDBForm.InsertByName (oGridModel.Name, oGridModel)
  464.     oGridShape = InsertControl(oDrawPage, oGridModel, aPoint, aSize)
  465.     For n = 0 to MaxIndex
  466.         GetCurrentMetaValues(n)
  467.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  468.             oColumn = SetupGridColumn(oGridModel,"DateField", False, com.sun.star.sdbc.DataType.DATE, CurFieldName & " " & sDateAppendix)
  469.             oColumn = SetupGridColumn(oGridModel,"TimeField", False, com.sun.star.sdbc.DataType.TIME, CurFieldName & " " & sTimeAppendix)
  470.         Else
  471.             If CurControlType = cImageControl Then
  472.                 oColumn = SetupGridColumn(oGridModel,"TextField", True, CurFieldType, CurFieldName)
  473.             Else
  474.                 oColumn = SetupGridColumn(oGridModel, CurControlName, False, CurFieldType, CurFieldName)
  475.             End If
  476.         End If
  477.         oProgressbar.Value = n
  478.     next n
  479. End Function
  480.  
  481.  
  482. Function SetupGridColumn(oGridModel as Object, ControlName as String, bHidden as Boolean, iLocFieldType as Integer, ColName as String) as Object
  483. Dim oColumn as Object
  484.     CurControlName = ControlName
  485.     oColumn = oGridModel.CreateColumn(CurControlName)
  486.     oColumn.Name = CalcUniqueContentName(oGridModel, CurControlName)
  487.     oColumn.Hidden = bHidden
  488.     SetNumerics(oColumn, iLocFieldType)
  489.     oColumn.DataField = CurFieldName
  490.     oColumn.Label = ColName 
  491.     oColumn.Width = 0     ' Width of column is adjusted to Columname
  492.     oGridModel.insertByName(oColumn.Name, oColumn)
  493. End Function        
  494.  
  495.  
  496. Sub ControlCaptionstoStandardLayout()
  497. Dim i as Integer
  498. Dim iBorderType as Integer
  499. Dim oCurModel as Object
  500. Dim oStyle as Object
  501. Dim iStandardColor as Long
  502.     If CurArrangement <> cTabled Then
  503.         oStyle = oDocument.StyleFamilies.GetByName("ParagraphStyles").GetByName("Standard")
  504.         iStandardColor = oStyle.CharColor
  505.         For i = 0 To MaxIndex
  506.             oCurModel = oTCShapeList(i).GetControl
  507.             If i = 0 Then
  508.                 If oCurModel.TextColor = iStandardColor Then
  509.                     Exit Sub
  510.                 End If
  511.             End If
  512.             oCurModel.TextColor = iStandardColor
  513.         Next i
  514.     End If
  515. End Sub
  516.  
  517.  
  518. Sub GroupShapesTogether()
  519. Dim i as Integer
  520.     If CurArrangement <> cTabled Then
  521.         For i = 0 To MaxIndex
  522.             oGroupShapeList(i) = CreateUnoService("com.sun.star.drawing.ShapeCollection")
  523.             oGroupShapeList(i).Add(oTCShapeList(i))
  524.             oGroupShapeList(i).Add(oDBShapeList(i))
  525.             oDrawPage.Group(oGroupShapeList(i))
  526.         Next i
  527.     Else
  528.         RemoveNirwanaShapes()
  529.     End If
  530. End Sub</script:module>