API-CHANGE - dropping string properties which use vnd.sun.star.GraphicObject URL

sos sos at pmg.be
Tue Mar 13 13:13:37 UTC 2018


On 13/03/2018 13:23, Tomaž Vajngerl wrote:
> Hi,
>
> On Tue, Mar 13, 2018 at 8:54 PM, sos <sos at pmg.be> wrote:
>> Hallo Tomaž,
>> We are heavy users off the Image API so lots off code repair ahead :-)
>> Reading your blog comments, it is not clear for me where the Original
>> ImageURL (URL adress on a server) could been stored.
>> Can you add a aditional propterty to the graphicobject or to the graphic ?
>> We mostly uses a lowres images for the editing work,  the Images are not
>> "linked" but stays  in the document, and then just before printing we
>> replace the lowres images with Highres Images.
>> Sill we (miss) use  the graphicobject "title" property to store the Orginal
>> image URL's. needed to replace lowres with highres images.
> Yes' I'll add a way to expose the URL that is contained inside the
> XGraphic or add a new interface for that so it will be possible in the
> new code to do that. Currently only VCL Graphic object has this so I
> just convert XGraphic to Graphic in filters, but that's not possible
> to do in extensions :)
Tomaž,
Fine, you will complete our API with a tool to go from XGraphic to 
Graphic  !
Can you also made something less complex for translating a storedimage 
to Xgraphic , now it can been done using the GraphicProvider (storing to 
a Tempimage) and even more complicated when use streams.

How make a Xgraphic from stored Orginal Image.

function MakeXGraphic(originalPath,B,H)
  sfile = converttoURL(originalPath)
  graphic =  getGraphicFromUrl(sFile)
  storeGraphicToURL(graphic,B,H,converttoURL("C:\" & susername & 
"temp\GridGraphic.jpg"))
  xgraphic =  getGraphicFromUrl(converttoURL("C:\" & susername & 
"temp\GridGraphic.jpg"))
  MakeXGraphic = xgraphic
end function

function getGraphicFromUrl(sFileUrl as String) as Object
   oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
   Dim oPropsIN(1)as new com.sun.star.beans.PropertyValue
   oPropsIN(0).Name  = "URL"
   oPropsIN(0).Value = sFileUrl
   oPropsIN(1).Name  = "FilterData"
   oPropsIN(1).Value = aFilterData()
   getGraphicFromUrl = oProvider.queryGraphic(oPropsIN())
end function

sub storeGraphicToURL(xgraphic,B,H,exportURL)
gProvider = createUnoService("com.sun.star.graphic.GraphicProvider")
Dim bArgs(2) as new com.sun.star.beans.PropertyValue
'creating filter data
     Dim aFilterData (3) as new com.sun.star.beans.PropertyValue
'properties valid for all filters
aFilterData(0).Name  = "PixelWidth"        '
aFilterData(0).Value = B
aFilterData(1).Name  = "PixelHeight"
aFilterData(1).Value = H

'filter data for the image/jpeg MediaType
aFilterData(2).Name  ="Quality"
aFilterData(2).Value = 90
aFilterData(3).Name  ="ColorMode"
aFilterData(3).Value = 0

       bArgs(0).Name = "URL"
       bArgs(0).Value = exportURL
       bArgs(1).Name = "MimeType"
       bArgs(1).Value = "image/jpeg"
       bArgs(2).Name = "FilterData"
       bArgs(2).Value = aFilterdata
       gProvider.storeGraphic(xgraphic,bArgs())
end sub

>
>> Greetz
>>
>> Fenand
> Regards, Tomaž



More information about the LibreOffice mailing list