Shape Objects in Text
- Text Fields
- Indexes and Index Marks
- Reference Marks
- Footnotes and Endnotes
- Shape Objects in Text
Base Frames vs. Drawing Shapes
Shape objects are text contents that act independently of the ordinary text flow. The surrounding text may wrap around them. Shape objects can lie in front or behind text, and be anchored to paragraphs or characters in the text. Anchoring allows the shape objects to follow the paragraphs and characters while the user is writing. Currently, there are two different kinds of shape objects in Apache OpenOffice, base frames and drawing shapes.
The first group are shape objects that are com.sun.star.text.BaseFrames. The three services com.sun.star.text.TextFrame, com.sun.star.text.TextGraphicObject and com.sun.star.text.TextEmbeddedObject are all based on the service com.sun.star.text.BaseFrame. The
TextFrames contain an independent text area that can be positioned freely over ordinary text. The
TextGraphicObjects are bitmaps or vector oriented images in a format supported by Apache OpenOffice internally. The
TextEmbeddedObjects are areas containing a document type other than the document they are embedded in, such as charts, formulas, internal Apache OpenOffice documents (Calc/Draw/Impress), or OLE objects.
TextEmbeddedObjects in a text are supplied by their corresponding supplier interfaces at the document model:
These interfaces all have one single get method that supplies the respective Shape objects collection:
com::sun::star::container::XNameAccess getTextFrames() com::sun::star::container::XNameAccess getTextEmbeddedObjects() com::sun::star::container::XNameAccess getTextGraphicObjects()
getTextFrames() returns a com.sun.star.text.TextFrames collection,
getTextEmbeddedObjects() returns a com.sun.star.text.TextEmbeddedObjects collection and
getTextGraphicObjects() yields a com.sun.star.text.TextGraphicObjects collection. All of these collections support com.sun.star.container.XIndexAccess and com.sun.star.container.XNameAccess. The
TextFrames collection may (optional) support the com.sun.star.container.XContainer interface to broadcast an event when an
Element is added to the collection. However, the current implementation of the
TextFrames collection does not support this.
The service com.sun.star.text.BaseFrame defines the common properties and interfaces of text frames, graphic objects and embedded objects. It includes the services com.sun.star.text.BaseFrameProperties and com.sun.star.text.TextContent, and defines the following interfaces.
The position and size of a
BaseFrame is covered by com.sun.star.drawing.XShape. All
BaseFrame objects share a majority of the core implementation of drawing objects. Therefore, they have a position and size on the
The name of a
BaseFrame is set and read through com.sun.star.container.XNamed. The names of the frame objects have to be unique for text frames, graphic objects and embedded objects, respectively.
The com.sun.star.beans.XPropertySet has to be present, because many aspects of
BaseFrames are controlled through properties.
The interface com.sun.star.document.XEventsSupplier is not a part of the
BaseFrame service, but is available in text frames, graphic objects and embedded objects. This interface provides access to the event macros that may be attached to the object in the GUI.
The properties of
BaseFrames are those of the service com.sun.star.text.TextContent, as well there is a number of frame properties defined in the service com.sun.star.text.BaseFrameProperties:
|Properties of com.sun.star.text.BaseFrameProperties|
|AnchorFrame||com.sun.star.text.XTextFrame. Contains the text frame the current frame is anchored to.|
|BackGraphicLocation||Determines the position of the background graphic according to com.sun.star.style.GraphicLocation.|
|Surround||[deprecated]. Determines the type of the surrounding text.|
The second group of shape objects are the varied drawing shapes that can be inserted into text, such as rectangles and ellipses. They are based on com.sun.star.text.Shape. The service
text.Shape includes Shape, but adds a number of properties related to shapes in text (cf. Drawing Shapes below). In addition, drawing shapes support the interface com.sun.star.text.XTextContent so that they can be inserted into an XText.
There are no specialized supplier interfaces for drawing shapes. All the drawing shapes on the
DrawPage object are supplied by the document model's com.sun.star.drawing.XDrawPageSupplier and its single method:
|The DrawPage not only contains drawing shapes, but the BaseFrame shape objects too, if the document contains any.|
|Content on this page is licensed under the Public Documentation License (PDL).|