home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2002 #3 / K-CD_2002-03.iso / OpenOffice / f_0018 / develop.xba < prev    next >
Extensible Markup Language  |  2001-10-12  |  19KB  |  545 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 oGridShape as Object
  10. Public a as Integer
  11. Public StartA as Integer
  12. Public bIsFirstRun as Boolean
  13. Public bIsVeryFirstRun as Boolean
  14.  
  15. Public bIsVeryFirstValueField as Boolean
  16. ' This boolean variable refers to the following Controltypes: cTextBox, cCheckBox, cDateBox, cTimeBox, cNumericBox, cCurrencyBox
  17.  
  18. Public bControlsareCreated as Boolean
  19. Public nDBRefHeight as Long
  20. Public nXTCPos&, nYTCPos&, nXDBPos&, nYDBPos&, nTCHeight&, nTCWidth&, nDBHeight&, nDBWidth&
  21. Public CurControlType as Integer
  22. Public CurFieldlength as Double
  23. Public CurFieldType as Integer
  24. Public CurFieldName as String
  25. Public CurControlName as String
  26. Dim iReduceWidth as Integer
  27.  
  28. Function PositionControls(Maxindex as Integer)
  29. Dim oTCModel as Object
  30. Dim oDBModel as Object
  31. Dim i as Integer
  32.     InitializePosSizes()
  33.     bIsFirstRun = True
  34.     bIsVeryFirstRun = True
  35.     bIsVeryFirstValueField = True
  36.     a = 0
  37.     StartA = 0
  38.     nMaxRowY = 0
  39.     nSecMaxRowY = 0
  40.     If CurArrangement = cLeftJustified Or cTopJustified Then
  41.         oDialogModel.optAlign0.State = 1
  42.     End If
  43.     For i = 0 To MaxIndex
  44.         GetCurrentMetaValues(i)
  45.         oTCModel = InsertTextControl(i)
  46.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  47.             InsertTimeStampShape(i)            
  48.         Else        
  49.             InsertDBControl(i)
  50.             bIsVeryFirstRun = False
  51. '            oDBModel.LabelControl = oTCModel
  52.         End If
  53.         ResetPosSizes(i)
  54.         oProgressbar.Value = i
  55.     Next i
  56.     ControlCaptionstoStandardLayout()
  57.     bControlsareCreated = True
  58. End Function
  59.  
  60.  
  61. Sub ResetPosSizes(LastIndex as Integer)
  62.     Select Case CurArrangement
  63.         Case cColumnarLeft
  64.             nYDBPos = nYDBPos  + nDBHeight + cVertDistance
  65.             If (nYDBPos > cYOffset + nFormHeight) Or (LastIndex = MaxIndex) Then
  66.                 RepositionColumnarLeftControls(LastIndex)
  67.                 nXTCPos = nMaxColRightX + 2 * cHoriDistance
  68.                 nXDBPos = nXTCPos + cHoriDistance + nMaxTCWidth
  69.                 nYDBPos = cYOffset
  70.                 nYTCPos = cYOffset
  71.                 bIsFirstRun = True
  72.                 StartA = LastIndex + 1
  73.                 a = 0
  74.             Else
  75.                 a = a + 1
  76.             End If
  77.             nYTCPos = nYDBPos
  78.         Case cColumnarTop
  79.             nYTCPos = nYDBPos + nDBHeight + cVertDistance
  80.             If nYTCPos > cYOffset + nFormHeight Then
  81.                 nXDBPos = nMaxColRightX + cHoriDistance
  82.                 nXTCPos = nMaxColRightX + cHoriDistance
  83.                 nYDBPos = cYOffset + nTCHeight + cVertDistance
  84.                 nYTCPos = cYOffset
  85.                 bIsFirstRun = True
  86.                 StartA = LastIndex + 1
  87.                 a = 0
  88.             Else
  89.                 a = a + 1
  90.             End If
  91.         Case cLeftJustified,cTopJustified
  92. ' Todo: Ber├╝cksichtigen, wenn das Label eines Controls l├ñnger als das DB-Control ist
  93.             If nMaxColRightX > cXOffset + nFormWidth Then
  94.                 Dim nOldYTCPos as Long
  95.                 nOldYTCPos = nYTCPos
  96.                 CheckJustifiedPosition()
  97.             Else
  98.                 nXTCPos = nMaxColRightX + CHoriDistance
  99.             End If
  100.             a = a + 1                
  101.     End Select
  102. End Sub
  103.  
  104.  
  105. Sub    RepositionColumnarLeftControls(LastIndex as Integer)
  106. Dim aSize As New com.sun.star.awt.Size
  107. Dim aPoint As New com.sun.star.awt.Point
  108. Dim i as Integer
  109.     aSize = GetSize(nMaxTCWidth, nTCHeight)
  110.     bIsFirstRun = True
  111.     For i = StartA To LastIndex
  112.         oLocTextShape.Size = aSize
  113.         If i = StartA Then
  114.             nXTCPos = oTCShapeList(i).Position.X
  115.             nXDBPos = nXTCPos + nMaxTCWidth  + cHoriDistance
  116.         End If
  117. '        If oLocDBShape.SupportsService("com.sun.star.drawing.Shapes") Then
  118. '            ResetDBShape(oLocDBShape(0), nXDBPos)
  119. '            ResetDBShape(oLocDBShape(1), nXDBPos + oLocDBShape(0).Size.Width)
  120. '            printdbgInfo oLocDBShape
  121. '        Else
  122.             ResetDBShape(oDBShapeList(i), nXDBPos)
  123.             CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  124. '        End If
  125. '        GroupShapes(oDrawPage, oLocTextShape, oLocDBShape)
  126.     Next i
  127. End Sub
  128.  
  129.  
  130. Sub ResetDBShape(oLocDBShape as Object, iXPos as Long)
  131. Dim aSize As New com.sun.star.awt.Size
  132. Dim aPoint As New com.sun.star.awt.Point
  133.     nYDBPos = oLocDBShape.Position.Y
  134.     nDBWidth = oLocDBShape.Size.Width
  135.     nDBHeight = oLocDBShape.Size.Height
  136.     aPoint = GetPoint(iXPos,nYDBPos)
  137.     oLocDBShape.SetPosition(aPoint)
  138. End Sub
  139.  
  140.  
  141. Sub InitializePosSizes()
  142.     nXTCPos = cXOffset
  143.     nYTCPos = cYOffset
  144.     nTCWidth = 2000
  145.     nTCHeight = 560
  146.     nDBWidth = 2000
  147.     nDBHeight = 560
  148.     iReduceWidth = 0
  149.     Select Case CurArrangement
  150.         Case cColumnarLeft, cLeftJustified
  151.             nXDBPos = cXOffset + 3050
  152.             nYDBPos = cYOffset
  153.         Case cColumnarTop, cTopJustified
  154.             nXDBPos = cXOffset
  155.     End Select
  156. End Sub
  157.  
  158.  
  159. Function InsertTextControl(i as Integer) as Object
  160. Dim oShape as Object
  161. Dim oModel as Object
  162. Dim aPoint as New com.sun.star.awt.Point
  163. Dim aSize As New com.sun.star.awt.Size
  164.     If bControlsareCreated Then
  165.         Set oShape = oTCShapeList(i)
  166.         Set oModel = oShape.GetControl
  167.         If CurArrangement = cLeftJustified Then
  168.             nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
  169.         Else
  170.             nTCWidth = oShape.Size.Width
  171.         End If
  172.         nTCHeight = oShape.Size.Height
  173.         oShape.Position = GetPoint(nXTCPos, nYTCPos)
  174.         If CurArrangement = cColumnarTop Then
  175.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  176.         End If
  177.     Else
  178.         oModel = CreateUnoService(oModelService(cLabel))
  179. '        oModel.Label = CurFieldName ' + nFieldPostfixes(i) (Todo: Was ist ein fieldPostfix?)
  180. ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  181. ' own. therefor the model should be inserted before the shape
  182. '        oDBForm.InsertByName(oModel.Name, oModel)
  183.         aPoint = GetPoint(nXTCPos, nYTCPos)
  184.         aSize = GetSize(nTCWidth,nTCHeight)
  185.         Set oShape = InsertControl(oDrawPage, oModel, aPoint, aSize)
  186.         Set oTCShapeList(i)= oShape
  187.         If bIsVeryFirstRun Then
  188.             nTCHeight = GetPreferredHeight(oModel, CurFieldname)
  189.             If CurArrangement = cColumnarTop Then
  190.                 nYDBPos = nYTCPos + nTCHeight
  191.             End If
  192.         End If
  193.         nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
  194.     End If
  195.     If CurArrangement = cColumnarLeft Then
  196.         ' Note This If Sequence must be called before retrieving the outer Points
  197.         If bIsFirstRun Then
  198.             nMaxTCWidth = nTCWidth
  199.             bIsFirstRun = False
  200.         ElseIf nTCWidth > nMaxTCWidth Then
  201.             nMaxTCWidth = nTCWidth
  202.         End If
  203.     End If
  204.     CheckOuterPoints(oShape.Position.X, nTCWidth, nYTCPos, nTCHeight, False)
  205.     Select Case CurArrangement
  206.         Case cLeftJustified
  207.             nXDBPos = nMaxColRightX
  208.         Case cColumnarTop,cTopJustified
  209.             oModel.Align = com.sun.star.awt.TextAlign.LEFT
  210.             nXDBPos = nXTCPos
  211.             nYDBPos = nYTCPos + nTCHeight
  212.             If CurFieldLength = 20 And nDBWidth > 2 * nTCWidth Then
  213.                 iReduceWidth = iReduceWidth + 1
  214.             End If 
  215.     End Select    
  216.     oShape.SetSize(GetSize(nTCWidth,nTCHeight))
  217.     InsertTextControl = oModel
  218. End Function
  219.  
  220.  
  221. Sub InsertDBControl(i as Integer)
  222. Dim aPoint as New com.sun.star.awt.Point
  223. Dim aSize As New com.sun.star.awt.Size
  224. Dim oControl as Object
  225. Dim iColRightX as Long
  226.  
  227.     aPoint = GetPoint(nXDBPos, nYDBPos)
  228.     If bControlsAreCreated Then
  229. '        Set oDBModel = oDBModelList(i) 'oDBShapeList(i).GetControl
  230.         oDBShapeList(i).Position = aPoint
  231.     Else
  232.         oDBModelList(i) = CreateUnoService(oModelService(CurControlType))
  233.         oDBShapeList(i) = InsertControl(oDrawPage, oDBModelList(i), aPoint, aSize)        
  234.         SetNumerics(oDBModelList(i), CurFieldType)
  235.         ' Todo: According to FS this handling should be verified. I should not rely on the shape to create a model on its
  236.         ' own. therefor the model should be inserted before the shape
  237.         ' oDBForm.InsertByName(oDBModel.Name, oDBModel)
  238.         If CurControlType = cCheckBox Then
  239.             oDBModelList(i).Label = ""
  240.         End If
  241.     End If
  242.     nDBHeight = GetDBHeight(oDBModelList(i))
  243.     nDBWidth = GetPreferredWidth(oDBModelList(i),True)
  244.     aSize = GetSize(nDBWidth,nDBHeight)
  245.     oDBShapeList(i).SetSize(aSize)
  246.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  247.     oDBModelList(i).DataField = CurFieldName
  248. End Sub
  249.  
  250.  
  251. Function InsertTimeStampShape(i as Integer) as Object
  252. Dim oDateModel as Object
  253. Dim oTimeModel as Object
  254. Dim oDateShape as Object
  255. Dim oTimeShape as Object
  256. Dim oDateTimeShape as Object
  257. Dim aPoint as New com.sun.star.awt.Point
  258. Dim aSize as New com.sun.star.awt.Size
  259. Dim nDateWidth as Long
  260. Dim nTimeWidth as Long
  261. Dim oGroupShape as Object
  262.  
  263. '    aPoint = GetPoint(nXDBPos, nYDBPos)
  264.     oGroupShape = oDocument.CreateInstance("com.sun.star.drawing.GroupShape")
  265. '    aSize = GetSize(2000, 600)
  266. '    oGroupShape.Size = aSize
  267. '    oGroupShape.Position = (aPoint) 'oFirstShape.Position
  268. '    oGroupShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  269. '    aSize = GetSize(1000, 600)
  270. '    aPoint = GetPoint(0,0)
  271.  
  272.     CurFieldType = com.sun.star.sdbc.DataType.DATE
  273.     oDateModel = CreateUnoService("com.sun.star.form.component.DateField")
  274.     oDateModel.DataField = CurFieldName
  275.     oDateShape = InsertControl(oDrawPage, oDateModel, aPoint, aSize)
  276.     SetNumerics(oDateModel, CurFieldType)
  277.     nDBHeight = GetDBHeight(oDateModel)
  278.     nDateWidth = GetPreferredWidth(oDateModel,True)
  279.     aSize = GetSize(nDateWidth,nDBHeight)
  280.     oDateShape.SetSize(aSize)
  281.     aPoint = GetPoint(nXDBPos+nDateWidth, nYDBPos)
  282.  
  283.     CurFieldType = com.sun.star.sdbc.DataType.TIME
  284.     oTimeModel = CreateUnoService("com.sun.star.form.component.TimeField")
  285.     oTimeModel.DataField = CurFieldName
  286.     oTimeShape = InsertControl(oGroupShape, oTimeModel, aPoint, aSize)
  287.     nTimeWidth = GetPreferredWidth(oTimeModel)
  288.     aSize = GetSize(nTimeWidth,nDBHeight)
  289.     oTimeShape.SetSize(aSize)
  290.     Set oDBShapeList(i)= oDateTimeShape
  291.     oGroupShape.Add(oTimeShape)
  292.     nDBWidth = nDateWidth + nTimeWidth
  293.     CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  294.     InsertTimeStampShape() = oGroupShape    
  295. End Function
  296.  
  297.  
  298. Sub CheckJustifiedPosition()
  299. Dim nLeftDist as Long
  300. Dim nRightDist as Long
  301. Dim oLocDBShape as Object
  302. Dim oLocTextShape as Object
  303. Dim nBaseWidth as Long
  304.     nBaseWidth = nFormWidth + cXOffset
  305.     nLeftDist = nMaxColRightX - nBaseWidth
  306.     nRightDist = nBaseWidth - nXTCPos + cHoriDistance
  307.     If nLeftDist < 0.5 * nRightDist and iReduceWidth > 2 Then
  308.         ' Fieldwidths in the line can be made smaller
  309.         AdjustLineWidth(StartA, a, nLeftDist, - 1)
  310.         If CurArrangement = cLeftjustified Then
  311.             nYDBPos = nMaxRowY + cVertDistance
  312.             nYTCPos = nYDBPos + 5
  313.             nXTCPos = cXOffset
  314.         Else
  315.             nYTCPos = nMaxRowY + cVertDistance
  316.             nYDBPos = nYTCPos + nTCHeight
  317.             nXTCPos = cXOffset
  318.             nXDBPos = cXOffset
  319.         End If
  320.         bIsFirstRun = True
  321.         StartA = a + 1
  322.     Else
  323.         Set oLocDBShape = oDBShapeList(a)
  324.         Set oLocTextShape = oTCShapeList(a)
  325.         If CurArrangement = cLeftJustified Then
  326.             If nYDBPos + nDBHeight = nMaxRowY Then
  327.                 ' The last Control was the highes in the row
  328.                 nYTCPos = nSecMaxRowY + cVertDistance
  329.             Else
  330.                 nYTCPos = nMaxRowY + cVertDistance
  331.             End If
  332.             nYDBPos = nYTCPos
  333.             nXDBPos = cXOffset + nTCWidth
  334.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  335.             oLocDBShape.Position = GetPoint(nXDBPos, nYDBPos)
  336.             ' PosSizes for the next two Controls
  337.             nXTCPos = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  338.             bIsFirstRun = True
  339.             CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  340.             nXDBPos = nMaxColRightX + cHoriDistance
  341.         Else        ' cTopJustified
  342.             If nYDBPos + nDBHeight = nMaxRowY Then
  343.                 ' The last Control was the highest in the row
  344.                 nYTCPos = nSecMaxRowY + cVertDistance
  345.             Else
  346.                 nYTCPos = nMaxRowY + cVertDistance
  347.             End If
  348.             nYDBPos = nYTCPOS + nTCHeight
  349.             nXDBPos = cXOffset
  350.             nXTCPos = cXOffset
  351.             oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
  352.             oLocDBShape.Position = GetPoint(cXOffset, nYDBPos)
  353.             bIsFirstRun = True
  354.             If nDBWidth > nTCWidth Then
  355.                 CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
  356.             Else
  357.                 CheckOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, True)
  358.             End If
  359.             nXTCPos = nMaxColRightX + cHoriDistance
  360.             nXDBPos = nXTCPos
  361.         End If
  362.         AdjustLineWidth(StartA, a-1, nRightDist, 1)
  363.         StartA = a
  364.      End If
  365.      iReduceWidth = 0
  366. End Sub
  367.  
  368.  
  369. Sub AdjustLineWidth(StartIndex as Integer, EndIndex as Integer, nDist as Long, Widthfactor as Integer)
  370. Dim i as Integer
  371. Dim oLocDBShape as Object
  372. Dim oLocTCShape as Object
  373. Dim CorrWidth as Integer
  374. Dim bAdjustPos as Boolean
  375. Dim iLocTCPosX as Long
  376. Dim iLocDBPosX as Long
  377. Dim ShapeCount as Integer
  378. ' Todo: Hier muss ber├╝cksichtigt werden, dass gewisse Widths z.B f├╝r numerische Controls nicht pl├╢tzlich zu klein werden
  379. ' Am besten werden nur TextControls gestaucht, so dass vorher geschaut werden muss, ob ├╝berhaupt TextControls vorhanden
  380. ' sind
  381.     If WidthFactor > 0 Then
  382.         ShapeCount = EndIndex-StartIndex + 1
  383.     Else
  384.         ShapeCount = iReduceWidth
  385.     End If
  386.     CorrWidth = (nDist)/ShapeCount  
  387.     bAdjustPos = False
  388.     iLocTCPosX = cXOffset
  389.     For i = StartIndex To EndIndex
  390.         Set oLocDBShape = oDBShapeList(i)
  391.         Set oLocTCShape = oTCShapeList(i)
  392.         If bAdjustPos Then
  393.             oLocTCShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y)
  394.             If CurArrangement = cLeftJustified Then
  395.                 iLocDBPosX = oLocTCShape.Position.X + oLocTCShape.Size.Width
  396.                 oLocDBShape.Position = GetPoint(iLocDBPosX, oLocDBShape.Position.Y)
  397.             Else
  398.                 oLocDBShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y + nTCHeight)
  399.             End If
  400.         Else
  401.             bAdjustPos = True
  402.         End If
  403.         If CDbl(FieldMetaValues(i,1)) > 20 or WidthFactor > 0 Then
  404.             oLocDBShape.Size = GetSize(oLocDBShape.Size.Width + WidthFactor * CorrWidth, oLocDBShape.Size.Height)
  405.         End If
  406.         iLocTCPosX = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
  407.         If CurArrangement = cTopJustified Then
  408.             If oLocTCShape.Size.Width > oLocDBShape.Size.Width Then
  409.                 iLocTCPosX = oLocDBShape.Position.X + oLocTCShape.Size.Width + cHoriDistance
  410.             End If
  411.         End If
  412.     Next i
  413. End Sub
  414.  
  415.  
  416. Sub CheckOuterPoints(nXPos, nWidth, nYPos, nHeight, bIsDBField as Boolean)
  417. Dim nColRightX as Long
  418. Dim nRowY as Long
  419. Dim nOldMaxRowY as Long
  420.  
  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.         oDocument.LockControllers()
  458.         ShapesToNirwana()
  459.         oDocument.UnlockControllers()
  460.     End If
  461.     oGridModel = CreateUnoService(oModelService(cGridControl))
  462.     oGridModel.Name = "Grid1"
  463.     For n = 0 to MaxIndex
  464.         GetCurrentMetaValues(n)
  465.         If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
  466.             oColumn = SetupGridColumn(oGridModel,"DateField", False, com.sun.star.sdbc.DataType.DATE, CurFieldName & " " & sDateAppendix)
  467.             oColumn = SetupGridColumn(oGridModel,"TimeField", False, com.sun.star.sdbc.DataType.TIME, CurFieldName & " " & sTimeAppendix)
  468.         Else
  469.             If CurControlType = cImageControl Then
  470.                 oColumn = SetupGridColumn(oGridModel,"TextField", True, CurFieldType, CurFieldName)
  471.             Else
  472.                 oColumn = SetupGridColumn(oGridModel, CurControlName, False, CurFieldType, CurFieldName)
  473.             End If
  474.         End If
  475.         oProgressbar.Value = n
  476.     next n
  477.     aPoint = GetPoint(cXOffset, cYOffset)
  478.     ' Todo: Man m├╝sste die Gr├╢├ƒe und die Position der Controls von der Anzahl der 
  479.     ' Datenbankfelder abh├ñngig machen
  480.     aSize = GetSize(nFormWidth, nFormHeight)
  481.     oDBForm.InsertByName (oGridModel.Name, oGridModel)
  482.     oGridShape = InsertControl(oDrawPage, oGridModel, aPoint, aSize)
  483. End Function
  484.  
  485.  
  486.  
  487. Function SetupGridColumn(oGridModel as Object, ControlName as String, bHidden as Boolean, iLocFieldType as Integer, ColName as String) as Object
  488. Dim oColumn as Object
  489. 'Todo: Hier muss in der Hilfe vermittelt werden, dass Image Controls nicht dargestellt werden k├╢nnen
  490.     CurControlName = ControlName
  491.     oColumn = oGridModel.CreateColumn(CurControlName)
  492.     oColumn.Name = CalcUniqueContentName(oGridModel, CurControlName)
  493.     oColumn.Hidden = bHidden
  494.     SetNumerics(oColumn, iLocFieldType)
  495.     oColumn.DataField = CurFieldName
  496.     oColumn.Label = ColName  '+ nFieldPostfixes(n); Todo: Was hat das nFieldPostfix hier zu suchen?
  497.     oColumn.Width = 0     'Spaltenbreite richtet sich nach dem Feldnamen
  498.     oGridModel.insertByName(oColumn.Name, oColumn)
  499. End Function        
  500.  
  501.  
  502. Sub ControlCaptionstoStandardLayout()
  503. Dim i as Integer
  504. Dim iBorderType as Integer
  505. Dim oCurModel as Object
  506. Dim oStyle as Object
  507. Dim iStandardColor as Long
  508.     If CurArrangement <> cTabled Then
  509.         oStyle = oDocument.StyleFamilies.GetByName("ParagraphStyles").GetByName("Standard")
  510.         iStandardColor = oStyle.CharColor
  511.         For i = 0 To MaxIndex
  512.             oCurModel = oTCShapeList(i).GetControl
  513.             If i = 0 Then
  514.                 If oCurModel.TextColor = iStandardColor Then
  515.                     Exit Sub
  516.                 End If
  517.             End If
  518.             oCurModel.TextColor = iStandardColor
  519.         Next i
  520.     End If 
  521. End Sub
  522.  
  523.  
  524. 'Function CreateDateTimeShapeCollection(oDrawPage as Object, oFirstShape as Object, oSecShape as Object) as Object
  525. 'Dim oGroupShape as Object
  526. 'Dim aSize As New com.sun.star.awt.Size
  527. '    oGroupShape = oDocument.CreateInstance("com.sun.star.drawing.GroupShape")
  528. '    aSize = GetSize(oFirstShape.Size.Width + oSecShape.Size.Width, oFirstShape.Size.Height)
  529. '    oGroupShape.Size = aSize
  530. '    oGroupShape.Position = oFirstShape.Position
  531. '    oGroupShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
  532. '    oDrawPage.Add(oGroupShape)
  533. '    oGroupShape.Add(oFirstShape)
  534. '    oGroupShape.Add(oSecShape)
  535. '    CreateDateTimeShapeCollection() = oGroupShape
  536. 'End Function
  537.  
  538.  
  539. 'Sub GroupShapes(oDrawPage as Object, oLocTextShape as Object, oLocDBShape as Object)
  540. 'Dim oShapes as Object
  541. '    oShapes = createUnoService("com.sun.star.drawing.ShapeCollection")
  542. '    oShapes.Add(oLocTextShape)
  543. '    oShapes.Add(oLocDBShape)
  544. '    oDrawPage.Group(oShapes)
  545. 'End Sub</script:module>