Answered
Need to extend TextLayoutImporter (importing XML with InlineGraphicElements)
I had an email from someone asking a way to re-import TLF XML
that contains InlineGraphicElements that are not using an external
image file.
For example, an instance of MyBoxClass, or MySmileyElement. A user may add a bunch of these to a TextFlow, and when you export the XML you get the standard toString() of that class in the source="" attribute, for example:
<flow:TextFlow whiteSpaceCollapse="preserve" xmlns:flow=" http://ns.adobe.com/textLayout/2008">
<flow:p fontSize="24">
<flow:span>Lorem</flow:span>
<flow:img height="50" width="50" source="[object MySmileyElement]"/>
<flow:span>Ipsum</flow:span>
</flow:p>
</flow:TextFlow>
So one idea is to simply override the toString() method in my custom graphic class to provide enough info to reconstruct my smiley as it was, but even so, the TLF's standard layout importer needs to know how to instantiate these custom graphic classes so...
After digging through the code and placing some breakpoints, I see that we actually need to extend the TextLayoutImporter class, as that is one of the classes that implements ITextImporter. But this is an internal class (I believe?) and so we can't. On top of that, we'd need to have a way to instruct the TextFilter class to use our customised ITextImporter.
Is this something that will be planned. I can't see how people can build editors with custom graphic elements without being able to export/import their TextFlow's from disk/DB?
Thanks in advance for any suggestions.
Richard
For example, an instance of MyBoxClass, or MySmileyElement. A user may add a bunch of these to a TextFlow, and when you export the XML you get the standard toString() of that class in the source="" attribute, for example:
<flow:TextFlow whiteSpaceCollapse="preserve" xmlns:flow=" http://ns.adobe.com/textLayout/2008">
<flow:p fontSize="24">
<flow:span>Lorem</flow:span>
<flow:img height="50" width="50" source="[object MySmileyElement]"/>
<flow:span>Ipsum</flow:span>
</flow:p>
</flow:TextFlow>
So one idea is to simply override the toString() method in my custom graphic class to provide enough info to reconstruct my smiley as it was, but even so, the TLF's standard layout importer needs to know how to instantiate these custom graphic classes so...
After digging through the code and placing some breakpoints, I see that we actually need to extend the TextLayoutImporter class, as that is one of the classes that implements ITextImporter. But this is an internal class (I believe?) and so we can't. On top of that, we'd need to have a way to instruct the TextFilter class to use our customised ITextImporter.
Is this something that will be planned. I can't see how people can build editors with custom graphic elements without being able to export/import their TextFlow's from disk/DB?
Thanks in advance for any suggestions.
Richard
