Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Piet ,
Thanks works like a charm !

Belg of Hollander ?

Groeten

Fernand

find working code (adapted from Bernard Marcely) below:
 Makes a Gridcontrol in a dialog with a graphic in the first cell

Sub Main
 xgraphic  =  GetGraphFromHexString(GetPicHexString)
 makegrid(xgraphic)
End Sub

function GetGraphFromHexString(sHex as String) as Any
    oStorageFac = createUnoService("com.sun.star.embed.StorageFactory")
    oStorage    = oStorageFac.createInstance
oStream = oStorage.openStreamElement("ms777", com.sun.star.embed.ElementModes.READWRITE)

oDataOutputStream = createUNOService ("com.sun.star.io.DataOutputStream")
    oDataOutputStream.setOutputStream(oStream)
    for k=0 to len(sHex)/2-1
      i = CInt("&H" & Mid(sHex, 2*k+1,2))
      if i >=128 then i = i-256
      oDataOutputStream.writeByte(i)
      next k

    oDataOutputStream.flush
    oDataOutputStream.closeOutput

    oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
    Dim oProps(0)as new com.sun.star.beans.PropertyValue
    oProps(0).Name  = "InputStream"
    oProps(0).Value = oStream
    GetGraphFromHexString = oProvider.queryGraphic(oProps())
end function


function GetPicHexString() as String

    s =        "47494638396114001400E72700000000"
    s = s & "01010102020203030304040405050506"
    s = s & "06060707070808080909090A0A0A0B0B"
    s = s & "0B0C0C0C0D0D0D0E0E0E0F0F0F101010"
    s = s & "11111112121213131314141415151516"
    s = s & "16161717171818181919191A1A1A1B1B"
    s = s & "1B1C1C1C1D1D1D1E1E1E1F1F1F202020"
    s = s & "21212122222223232324242425252526"
    s = s & "26262727272828282929292A2A2A2B2B"
    s = s & "2B2C2C2C2D2D2D2E2E2E2F2F2F303030"
    s = s & "31313132323233333334343435353536"
    s = s & "36363737373838383939393A3A3A3B3B"
    s = s & "3B3C3C3C3D3D3D3E3E3E3F3F3F404040"
    s = s & "41414142424243434344444445454546"
    s = s & "46464747474848484949494A4A4A4B4B"
    s = s & "4B4C4C4C4D4D4D4E4E4E4F4F4F505050"
    s = s & "51515152525253535354545455555556"
    s = s & "56565757575858585959595A5A5A5B5B"
    s = s & "5B5C5C5C5D5D5D5E5E5E5F5F5F606060"
    s = s & "61616162626263636364646465656566"
    s = s & "66666767676868686969696A6A6A6B6B"
    s = s & "6B6C6C6C6D6D6D6E6E6E6F6F6F707070"
    s = s & "71717172727273737374747475757576"
    s = s & "76767777777878787979797A7A7A7B7B"
    s = s & "7B7C7C7C7D7D7D7E7E7E7F7F7F808080"
    s = s & "81818182828283838384848485858586"
    s = s & "86868787878888888989898A8A8A8B8B"
    s = s & "8B8C8C8C8D8D8D8E8E8E8F8F8F909090"
    s = s & "91919192929293939394949495959596"
    s = s & "96969797979898989999999A9A9A9B9B"
    s = s & "9B9C9C9C9D9D9D9E9E9E9F9F9FA0A0A0"
    s = s & "A1A1A1A2A2A2A3A3A3A4A4A4A5A5A5A6"
    s = s & "A6A6A7A7A7A8A8A8A9A9A9AAAAAAABAB"
    s = s & "ABACACACADADADAEAEAEAFAFAFB0B0B0"
    s = s & "B1B1B1B2B2B2B3B3B3B4B4B4B5B5B5B6"
    s = s & "B6B6B7B7B7B8B8B8B9B9B9BABABABBBB"
    s = s & "BBBCBCBCBDBDBDBEBEBEBFBFBFC0C0C0"
    s = s & "C1C1C1C2C2C2C3C3C3C4C4C4C5C5C5C6"
    s = s & "C6C6C7C7C7C8C8C8C9C9C9CACACACBCB"
    s = s & "CBCCCCCCCDCDCDCECECECFCFCFD0D0D0"
    s = s & "D1D1D1D2D2D2D3D3D3D4D4D4D5D5D5D6"
    s = s & "D6D6D7D7D7D8D8D8D9D9D9DADADADBDB"
    s = s & "DBDCDCDCDDDDDDDEDEDEDFDFDFE0E0E0"
    s = s & "E1E1E1E2E2E2E3E3E3E4E4E4E5E5E5E6"
    s = s & "E6E6E7E7E7E8E8E8E9E9E9EAEAEAEBEB"
    s = s & "EBECECECEDEDEDEEEEEEEFEFEFF0F0F0"
    s = s & "F1F1F1F2F2F2F3F3F3F4F4F4F5F5F5F6"
    s = s & "F6F6F7F7F7F8F8F8F9F9F9FAFAFAFBFB"
    s = s & "FBFCFCFCFDFDFDFEFEFEFFFFFF21FE03"
    s = s & "42616A002C000000001400140000085C"
    s = s & "0001081C48B0A0C183080D9A5BC8B0A1"
    s = s & "4373041F36242801E240890F2500B028"
    s = s & "1063C38A1B237A34571122C78D1E4B9A"
    s = s & "14295125C3842C275E9488D261CC8934"
    s = s & "673EAC29B323CD9C3E7702E58973A74E"
    s = s & "9B4331125D08B3A9D3840101003B"

    GetPicHexString = s

end function

Sub makegrid(xgraphic)
Dim dlg As Object, km As Object
Dim gdatam As Object, gcolm As Object, uneColonne As Object

DialogLibraries.loadLibrary("Standard")
dlg = CreateUnoDialog(DialogLibraries.getByName("Standard").getByName("Dialog1"))

gcolm = CreateUnoService("com.sun.star.awt.grid.DefaultGridColumnModel")
uneColonne = CreateUnoService("com.sun.star.awt.grid.GridColumn")
uneColonne.Title = "Production"
gcolm.addColumn(uneColonne)
uneColonne = CreateUnoService("com.sun.star.awt.grid.GridColumn")
uneColonne.Title = "Info"
gcolm.addColumn(uneColonne)
uneColonne = CreateUnoService("com.sun.star.awt.grid.GridColumn")
uneColonne.Title = "Result"
gcolm.addColumn(uneColonne)

gdatam = CreateUnoService("com.sun.star.awt.grid.DefaultGridDataModel")
dim ass() as variant

gdatam.addRow("France", array(xgraphic,"aaaa", -217))
gdatam.addRow("Germany", Array(xgraphic,"bbbb", 1234))
gdatam.addRow("Sweden", Array(xgraphic,"cccc", 951.23))
'gdatam.RowHeaderWidth = 30


km = dlg.Model.createInstance("com.sun.star.awt.grid.UnoControlGridModel")
km.PositionX = 15
km.PositionY = 15
km.Width = 200
km.Height = 150
km.Name = "Grid1"
km.GridDataModel = gdatam
km.ColumnModel = gcolm
km.GridLineColor = RGB(0, 0, 0)
km.TextColor =     RGB(0,0,150)
km.ShowColumnHeader = True
km.ShowRowHeader = True
km.HeaderBackgroundColor = RGB(255, 255, 0)

dlg.Model.insertByName(km.Name, km)

dlg.execute
dlg.dispose
End Sub



Fernand Vanrie wrote:

  > Hello,
  >
  > on a Openoffice wiki page i found some JAVA code to add a image into a
  > GridControl Row
  > what i need is how to make a "Object array" in BASIC who supports
  > graphics and octher data
  >
  > thanks for any hint
  >
  > Fernand
  >

I think new  Object[]{xGraphic,"1,2",1.3}) translates to
Array(xGraphic,"1,2",1.3)


--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.