Apache OpenOffice (AOO) Bugzilla – Issue 121982
Loading with "private:stream" ignores filter settings on the media descriptor
Last modified: 2013-07-09 14:23:19 UTC
Loading a component using the URL "private:stream" seems to ignore the "FilterName", and loads always as plain text in Writer. Example code: REM ***** BASIC ***** Option Explicit Sub Main Dim sContent$ sContent = "<?xml version=""1.0"" encoding=""UTF-8""?>" + Chr(13) + _ "<svg xmlns=""http://www.w3.org/2000/svg"" version=""1.1"">" + Chr(13) + _ "<circle cx=""100"" cy=""50"" r=""40"" stroke=""black"" stroke-width=""2"" fill=""red"" />" + Chr(13) + _ "</svg>" Dim nLen% nLen = Len(sContent) Dim aBytes%(nLen-1) Dim n% For n = 0 To nLen-1 aBytes(n) = Asc(Mid(sContent,n+1,1)) Next Dim oTempFile as Object oTempFile = CreateUnoService("com.sun.star.io.TempFile") Dim oOut as Object oOut = oTempFile.getOutputStream() oOut.writeBytes(aBytes) oOut.flush() oOut.closeOutput() Dim oIn as Object oIn = oTempFile.getInputStream() Dim oMediaDesc(1) as new com.sun.star.beans.PropertyValue oMediaDesc(0).Name = "InputStream" oMediaDesc(0).Value = oIn oMediaDesc(1).Name = "FilterName" oMediaDesc(1).Value = "SVG - Scalable Vector Graphics" Dim oDoc oDoc = StarDesktop.loadComponentFromURL("private:stream","_blank",0,oMediaDesc) End Sub
.
another strange private:stream bug: https://issues.apache.org/ooo/show_bug.cgi?id=119935 private:stream - load component from ByteArray crashes aoo
(In reply to comment #2) > another strange private:stream bug: > https://issues.apache.org/ooo/show_bug.cgi?id=119935 > private:stream - load component from ByteArray crashes aoo I did a Basic version of the Java code, and does not crash; strage. Ill attach the example on the other bug.
In LoadEnv::impl_detectTypeAndFilter method, type detection is started by calling the following method: XTypeDetection xDetect->queryTypeByDescriptor(lDescriptor, sal_True) The second parameter specifies to detect deeply, so always deep detection is chosen. First, the filter name passed is used to get internal file type. But the mode is always deep detection, so the additional detection is proceeded. Type detection component for svg file is com.sun.star.comp.draw.FormatDetector. In SdFilterDetect::detect method, if URL (private:stream in this case) is not starting with "private:factory/", SfxMedium is initialized with the passed URL. And the passed input stream is not used. So the problem is the stream is ignored in this case.
> SfxMedium is initialized with > the passed URL. And the passed input stream is not used. > So the problem is the stream is ignored in this case. This is wrong, it is initialized with transformed values.