A multitude of character, paragraph and other properties are available for text in OpenOffice.org. However, the objects implemented in the writer do not provide properties that support com.sun.star.beans.XPropertyChangeListener or com.sun.star.beans.XVetoableChangeListener yet.
Character and paragraph properties are available in the following services:
The character properties are described in the services com.sun.star.style.CharacterProperties, com.sun.star.style.CharacterPropertiesAsian and com.sun.star.style.CharacterPropertiesComplex.
com.sun.star.style.CharacterProperties describes common character properties for all language zones and character properties in Western text. The following table provides possible values.
|Properties of com.sun.star.style.CharacterProperties
string - This property specifies the name of the font in western text.
string - This property contains the name of the font style.
short - This property contains font family that is specified in com.sun.star.awt.FontFamily. Possible values are: DONTKNOW, DECORATIVE, MODERN, ROMAN, SCRIPT, SWISS, and SYSTEM.
short - This property contains the text encoding of the font that is specified in com.sun.star.awt.CharSet. Possible values are: DONTKNOW, ANSI MAC, IBMPC_437, IBMPC_850, IBMPC_860, IBMPC_861, IBMPC_863, IBMPC_865, and SYSTEM SYMBOL.
short - This property contains the font pitch that is specified in com.sun.star.awt.FontPitch. The word font pitch refers to characters per inch, but the possible values are DONTKNOW, FIXED and VARIABLE. VARIABLE points to the difference between proportional and unproportional fonts.
long - This property contains the value of the text color in ARGB notation. ARGB has four bytes denoting alpha, red, green and blue. In hex notation, this can be used conveniently:
0xAARRGGBB. The AA (Alpha) can be 00 or left out.
[optional] short - Property which contains the relative value of the raisement or lowerment of characters for superscript or subscript styling. Would typically be a positive value for superscript, and a negative value for subscript.
float - This value contains the height of the characters in point.
short - This property contains the value for the character underline that is specified in com.sun.star.awt.FontUnderline. A lot of underline types are available. Some possible values are SINGLE, DOUBLE, and DOTTED.
float - This property contains the value of the font weight, cf. [com.sun.star.awt.FontWeight. A lot of weights are possible. The common ones are BOLD and NORMAL.
long - This property contains the posture of the font as defined in com.sun.star.awt.FontSlant. The most common values are ITALIC and NONE.
[optional] boolean - Property to determine whether the kerning tables from the current font are used.
[optional] long - Property which contains the text background color in
[optional] boolean - Determines if the text background color is set to transparent.
[optional] short - Property which contains the value of the case-mapping of the text for formatting and displaying. Possible CaseMaps are NONE, UPPERCASE, LOWERCASE, TITLE, and SMALLCAPS as defined in the constants group com.sun.star.style.CaseMap. (optional)
[optional] boolean - This property is true if the characters are crossed out.
[optional] boolean - If this optional property is true , then the characters are flashing
[optional] short - Determines the type of the strikethrough of the character as defined in com.sun.star.awt.FontStrikeout. Values are NONE, SINGLE, DOUBLE, DONTKNOW, BOLD, and SLASH X.
[optional] boolean - If this property is true , the underline and strike-through properties are not applied to white spaces.
[optional] short - Property which contains the value of the kerning of the characters.
struct com.sun.star.lang.Locale. Contains the locale (language and country) of the characters.
[optional] boolean - Property which marks a range of characters to prevent it from being broken into two lines.
[optional] boolean - Property which marks a range of characters to ignore a line break in this area.
[optional] boolean - True if the characters are formatted and displayed with a shadow effect. (optional)
[optional] short - Property which specifies the fundamental technology of the font as specified in com.sun.star.awt.FontType. Possible values are DONTKNOW, RASTER, DEVICE, and SCALABLE.
[optional] string - Specifies the name of the style of the font.
[optional] boolean - True if the characters are formatted and displayed with a contour effect.
[optional] boolean - True if text is formatted in two lines.
[optional] string - Contains the prefix string (usually parenthesis) before text that is formatted in two lines.
[optional] string - Contains the suffix string (usually parenthesis) after text that is formatted in two lines.
[optional] short - Contains the font emphasis value com.sun.star.text.FontEmphasis.
[optional] short - Contains the relief value as FontRelief.
[optional] string - Contains the text that is set as ruby.
[optional] short - Determines the adjustment of the ruby text as RubyAdjust.
[optional] string - Contains the name of the character style that is applied to RubyText (optional).
[optional] boolean - Determines whether the ruby text is printed above/left or below/right of the text (optional) .
[optional] short - Determines the rotation of a character in degree.
[optional] short - Determines whether the text formatting tries to fit rotated text into the surrounded line height.
[optional] short - Determines the percentage value of scaling of characters.
[optional] string - contains the URL of a hyperlink if the URL is set.
[optional] string - contains the name of the target for a hyperlink if the target is set.
[optional] string - contains the name of the hyperlink if the name is set.
[optional] string - Contains the character style name for visited hyperlinks.
[optional] string - Contains the character style name for unvisited hyperlinks.
[optional] byte - This is the relative height of subscript or superscript characters in units of percent. A value of 100 would be the original height of the characters.
[optional] boolean - True if the word can be hyphenated at the character.
||Color - Gives the color of the underline for that character.
boolean - True if the CharunderlineColor is used for an underline
[optional] sequence<string> - specifies the names of the all styles applied to the font.
[optional] boolean - True if the characters are invisible
[optional] XNameContainer - This property stores xml attributes. They will be saved to and restored from automatic styles inside xml files.
com.sun.star.style.CharacterPropertiesAsian describes properties used in Asian text. All of these properties have a counterpart in
CharacterProperties. They apply as soon as a text is recognized as Asian by the employed Unicode character subset.
The complex properties com.sun.star.style.CharacterPropertiesComplex refer to the same character settings as in
CharacterPropertiesAsian, only they have the suffix "Complex" instead of "Asian".
com.sun.star.style.ParagraphProperties comprises paragraph properties.
|Properties of com.sun.star.style.ParagraphProperties
long - Determines the adjustment of a paragraph.
[optional] struct com.sun.star.style.LineSpacing - Determines the line spacing of a paragraph.
[optional] long - Contains the paragraph background color.
[optional] boolean - This value is true if the paragraph background color is set to transparent.
[optional] string - Contains the value of a link for the background graphic of a paragraph.
[optional] string - Contains the name of the graphic filter for the background graphic of a paragraph.
[optional] long - Contains the value for the position of a background graphic according to com.sun.star.style.GraphicLocation.
short - Determines the adjustment of the last line.
[optional] boolean - Determines if single words are stretched.
long - Determines the left margin of the paragraph in 1/100 mm.
long - Determines the right margin of the paragraph in 1/100 mm.
long - Determines the top margin of the paragraph in 1/100 mm.
long - Determines the bottom margin of the paragraph in 1/100 mm.
[optional] boolean - Determines if the paragraph is included in the line numbering.
[optional] boolean - Contains the start value for the line numbering.
[optional] boolean - Prevents the paragraph from getting hyphenated.
[optional] string - If this property is set, it creates a page break before the paragraph it belongs to and assigns the value as the name of the new page style sheet to use.
[optional] short - If a page break property is set at a paragraph, this property contains the new value for the page number.
[optional] string - Contains the page style name.
[optional] boolean - Determines if the register mode is applied to a paragraph.
[optional] sequence < com.sun.star.style.TabStop >. Specifies the positions and kinds of the tab stops within this paragraph.
[optional] string - Contains the name of the current paragraph style.
[optional] struct com.sun.star.style.DropCapFormat specifies whether the first characters of the paragraph are displayed in capital letters and how they are formatted.
[optional] boolean - Specifies if the property
DropCapFormat is applied to the whole first word.
[optional] boolean - Setting this property to true prevents page or column breaks between this and the following paragraph.
[optional] boolean - Setting this property to false prevents the paragraph from getting split into two pages or columns.
[optional] short - Specifies the numbering level of the paragraph.
||com.sun.star.container.XIndexReplace. Contains the numbering rules applied to this paragraph.
[optional] short - Specifies the start value for numbering if a new numbering starts at this paragraph.
[optional] boolean - Determines if the numbering rules restart, counting at the current paragraph.
[optional] string - Specifies the name of the style for the numbering.
[optional] byte - Specifies the minimum number of lines of the paragraph that have to be at bottom of a page if the paragraph is spread over more than one page.
[optional] byte - Specifies the minimum number of lines of the paragraph that have to be at top of a page if the paragraph is spread over more than one page.
[optional] struct com.sun.star.table.ShadowFormat. Determines the type, color, and size of the shadow.
[optional] boolean - Determines if hanging punctuation is allowed.
[optional] boolean - Determines if a distance between Asian text, western text or complex text is set.
[optional] boolean - Determines if the the rules for forbidden characters at the start or end of text lines are considered.
com.sun.star.style.ParagraphPropertiesAsian describes some further properties used in Asian text.
Objects supporting these properties support com.sun.star.beans.XPropertySet, as well. To change the properties, use the method
/** This snippet shows the necessary steps to set a property at the
current position of a given text cursor mxDocCursor
// query the XPropertySet interface
XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, mxDocCursor);
// call setPropertyValue, passing in a Float object
xCursorProps.setPropertyValue("CharWeight", new Float ( com.sun.star.awt.FontWeight.BOLD));
The same procedure is used for all properties. The more complex properties are described here.
If a change of the page style is required the paragraph property
PageDescName has to be set using an existing page style name. This forces a page break at the cursor position and the new inserted page uses the requested page style. The property
PageNumberOffset has to be set to start with a new page count. If inserting an additional paragraph should be avoided, the cursor must be placed at the beginning of the first paragraph before inserting it.
If a page break (or a column break) without a change in the used style is required, the property
BreakType is set using the values of com.sun.star.style.BreakType:
||Page or column break as described in com.sun.star.style.BreakType. Possible values are NONE, COLUMN_BEFORE, COLUMN_AFTER, COLUMN_BOTH, PAGE_BEFORE, PAGE_AFTER, and PAGE_BOTH. Setting the property forces a page or column break at the current text cursor position, paragraph or text table.
ParaLineNumberCount is used to include a paragraph in the line numbering. The setting of the line numbering options is done using the property set provided by the com.sun.star.text.XLineNumberingProperties interface implemented at the text document model.
To create a hyperlink these properties are set at the current cursor position or the current com.sun.star.text.Paragraph service.
Issue 641 [WRONG ISSUE] Hyperlink properties are not specified for paragraphs in the API reference.
string - Contains the URL.
string - Contains the name of the target frame and can be left blank.
string - The name of the hyperlink can be left blank.
string - The names of the character styles used to emphasize visited or not visited links. If left blank, the default character styles Internet Link/Visited Internet Link are applied automatically.
|Events attached to the hyperlink. The names of the events are OnClick, OnMouseOver, and OnMouseOut. Each returned event is a sequence of com.sun.star.beans.PropertyValue, with three elements named EventType, MacroName and Library. All elements contain string values. The EventType contains the value "StarBasic" for [PRODUCTNAME] Basic macros . The macro name contains the path to the macro, for example, Standard.Module1.Main. The library contains the name of the library.
Some properties are connected with each other. There may be side effects or dependencies between the following properties:
|Interdependencies between Properties