incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devin Han <>
Subject Re: Visibility of Simple API Frame class initialization methods
Date Mon, 07 Nov 2011 09:50:26 GMT
2011/11/5 Oliver Rau <>

> Hi everybody,
> while continuing the development on my application I needed a way to
> insert in image into an Document at any paragraph.
> According to the way how OOo does it, this is accomplished by adding a
> draw:frame into the paragraph. That frame will then contain the
> draw:image.
> Based on that assumption I stumbled upon the setImage method of the
> Simple APIs Frame class (org.odftoolkit.simple.draw.Frame) which seems
> to do exactly that.
> The problem I'm facing now is that I'm not able to instantiate that
> class due to it's visibility modifiers all being set to protected. The
> only extending class is TextBox, which in my case doesn't seem to be
> the right choice.
> Is there any reason why to keep the Frame class with an protected
> modifier for the constructor and the getInstanceof / newFrame methods
> rather than making them public?

For OpenOffice and Symphony, if there is nothing content in a Frame,
e.g.image, text box, the Frame can't be seen by user.
So, construct a single Frame object doesn't make sense. Simple ODF is a
high level API, its end user no need to care it. That's why we set Frame
class as protected.

> BTW: does the way I described above to add an image make sense or is
> there a better way?
Simple ODF can add image to text document, presentation and spreadsheet.
For your application, please reference the following code:

            // new image in text document
            TextDocument doc = TextDocument.newTextDocument();
            Paragraph para = doc.addParagraph("");
            Image image = Image.newImage(para, "image_list_item.png");
            image.setName("this image");
            image.setHyperlink(new URI(""));

            // new image in presentation
            PresentationDocument pDoc =
            Slide slide = pDoc.newSlide(0, "test",
            Textbox box =

            // new image in a table
            TextDocument sDoc = TextDocument.newTextDocument();
            Table table1 = sDoc.addTable(2, 2);
            Cell cell1 = table1.getCellByPosition(0, 0);
            Image image3 = cell1.setImage("image_list_item.png");
            image3.setHyperlink(new URI(""));

            SpreadsheetDocument sheet =
            Table table2 = sheet.getTableList().get(0);
            Cell cell2 = table2.getCellByPosition(1, 1);
            Image image4 = cell2.setImage("image_list_item.png");
            Image aImage4 = cell2.getImage();

> Regards
> Oliver


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message