Positioning of floating screen objects

without considering its wrapping styles

MS-Interoperability

Document - ID	Specification Owner	Last Change	Status
	Oliver-Rainer Düsterhöft	2004-05-27	Final
Conforms to	
Applies to	OpenOffice Writer
Task ID(s)	IssueZilla 27349
Category	Feature

Abstract

Due to meet the requirements of MS-Interoperability the positioning of floating screen objects has to be adjusted in such a way, that its own wrapping style and the wrapping styles of the other floating screen objects isn't considered. Simply spoken, a floating screen object will get the same position it would have, if its wrapping style is 'Through'.

i-Team Members (The specification owner is part of the i-Team)

	Name	E-mail Address
User Experience	Frank Loehmann (FL)	frank.loehmann@sun.com
Development	Oliver-Rainer Düsterhöft (OD)	oliver-rainer.duesterhoeft@sun.com
Quality Assurance	Michael Rüß (MRU)	michael.ruess@sun.com
Documentation	Uwe Fischer (UFI)	uwe.fischer@sun.com

Approved for Implementation

	Approved by	Date
User Experience	Frank Loehmann (FL)	2004-02-24
Development	Oliver Specht (OS)	2004-02-23
Quality Assurance	Michael Rüß	2004-03-26
Documentation	Uwe Fischer (UFI)	2004-02-23
String Review	Elizabeth Matthis (EM)	2004-04-01

Document Change History

Rev. Level	Change	Initials	Date
1.0/1.1	Initial version	OD	2004-02-12
1.2	Major adjustment due to how the adjusted object positioning process is applied.	OD	2004-02-23
1.3	Adjust option string Add approval of OS, FL and UFI	OD	2004-02-03
1.4	Add approval of MRU	OD	2004-03-26
1.5	Include EM's string adjustment and her approval	OD	2004-04-02
1.6	Minor adjustments of internal used strings	OD	2004-05-04
1.7	Add special case for the positioning of floating screen objects in columned section with evenly distributed content	OD	2004-05-27
1.8	Minor adjustment of internal used strings	OD	2004-07-08

Contents

Glossary	1

1	Motivation	1

2	User Scenarios	1

3	Goals	1

4	Requirements and Dependencies	2

4.1	Requirements	2

4.2	Technical Dependencies	2

5	Competitive Analyses	2

6	Detailed Specification	2

6.1	Writer vs. MS Word positioning of floating screen objects	2

6.2	Compatibility option	3

6.3	Floating screen object attribute	4

6.4	Default value of the attribute	4

6.5	Impact on the user interface	4

6.6	Impact on the file format and the API	5

6.7	Impact on the MS Word filter	5

6.8	Implementation details	6

6.9	G11n	6

6.10	Error Conditions	6

6.11	Migration	6

7	Future Tasks	6

8	Notes	6

9	References	6

Glossary

Term	Description
floating screen object	This term denotes the objects 'Writer fly frame' and 'drawing object' in Writer and the objects 'text box', 'graphic', 'frame', 'picture' etc. in MS Word.
Writer fly frame	A floating screen object containing normal Writer content (text, tables, sections, columns, etc.), graphics, or OLE content.
drawing object	A floating screen object from the draw application – e.g. rectangles, circles, lines, arrows, etc.
anchor [of a floating screen object]	Content the floating screen object is connected to. In Writer this could be a paragraph, a character, a page, or a Writer fly frame. In MS Word this is always a character.

Motivation

MS Word and Writer have different approaches on positioning floating screen objects in documents. To enhance interoperability in between these products as well as to lower the threshold for users to migrate to Writer it is mandatory to adapt certain behaviour from MS Word and integrate them into Writer. Introducing a positioning of floating screen objects without considering its wrapping style and the wrapping styles of the other objects addresses one of these differences.

User Scenarios

A user receives a complex MS Word document from a business contact and opens it in Writer. Her business contact made extensive use of floating screen objects in his MS Word document, such as text boxes, graphics and the like.

Since such floating screen objects heavily affect the document layout a proper positioning of these objects is mandatory for an acceptable result.

With the feature covered by this specification the user will receive a document layout, that is closer to a 1:1 copy of the document layout of the imported document in MS Word.

Goals

Provide the possibility to control the positioning of floating screen objects in such a way, that a floating screen object got the same position, as it would get, if its wrapping style and the wrapping styles of the other floating screen objects is 'Through'.

Requirements and Dependencies

Requirements

The following features have to be implemented in advance:

Negative positions for Writer fly frames, specification found at http://specs.openoffice.org/writer/compatibility/negative_positions_for_Writer_fly_frames.sxw

Follow text flow vs. leaving layout environment for Writer fly frames, specification found at http://specs.openoffice.org/writer/compatibility/follow_text_flow_vs_leaving_environment.sxw

Vertical alignments at page areas for Writer fly frames, specification found at http://specs.openoffice.org/writer/compatibility/vertical_alignment_at_page_areas.sxw

Vertical alignment 'Line of text' for to character anchored Writer fly frames, specification found at http://specs.openoffice.org/writer/compatibility/vertical_alignment_to_text_line.sxw

Unification of positioning of Writer fly frames and drawing objects, specification in progress found at http://specs.openoffice.org/writer/compatibility/unification_of_object_positioning.sxw

Technical Dependencies

Not known.

Competitive Analyses

The competitive analyses will consider MS Word only since this specification is about MS interoperability. Since the Detailed Specification is based on a direct comparison that need to be implemented a competitive analyses is not needed.

Detailed Specification

The positioning of floating screen objects will be adjusted. A new compatibility option will be introduced to control, what kind of positioning is applied. Additionally a new attribute for floating screen objects is needed to decide, how the floating screen object is positioned in the adjusted positioning.

Writer vs. MS Word positioning of floating screen objects

Current positioning in Writer

In the current Writer (OpenOffice.org 1.1 resp. StarOffice 7) the position of a floating screen object, which is anchored to paragraph resp. to character, is determined in an iterative process. This process is named iterative positioning process in the following:

Format the anchor paragraph resp. the paragraph, the anchor character of the floating screen object is in – this paragraph is named A in the following.
Depending on the given attributes (positioning and alignment) of the floating screen object the position of the floating screen object is invalidated. E.g.: If the horizontal position of the floating screen object has to be determined by the position of the anchor character and the position of the anchor character has changed by the format of paragraph A, the position of the floating screen object is invalidated in order to force a re-calculation of its position.

Calculate and set the position of the floating screen object in dependence to its anchor.
Depending on the calculated position and the given wrapping style of the floating screen object paragraph A is invalidated. E.g.: If due to the calculated position of the floating screen object it overlaps with the content of paragraph A and its wrapping style is 'Parallel/Page wrap', paragraph A is invalidated in order to force a re-format of its content, because it has to wrap around the floating screen object.

Back to step (1) as long as paragraph A and/or the position of the floating screen object aren't valid.

Continue with the formatting of the next content (paragraph, table or section) following paragraph A.

It can happen that this iterative process never ends (e.g. position of floating screen object overlaps the anchor character, but its wrapping style is 'Parallel/Page wrap'). In this situation the iterative process is stopped and by changing the attributes of the floating screen object (wrapping style and/or positioning) the situation is cleared.

Positioning analyzing MS Word

In contrast MS Word doesn't use such an iterative process to position the floating screen objects. We figured out, that the process is something like this. This process is named straightforward positioning process in the following:

Format a paragraph, named B in the following.

If floating screen objects of type 'frame' are anchored at a character of paragraph B, calculate and position each of it. After each calculation and position of one of these floating screen objects, all invalid paragraphs, including paragraph B are re-formatted.

Calculate and position all other floating screen objects ('text boxes', 'graphics', etc.), which are anchored to a character in paragraph B and have a wrapping style set.

Re-Format all invalid paragraphs, including the paragraph B.

Calculate and position the rest of the floating screen objects, which are anchored to a character in paragraph B.

Format next paragraph.

A special case is also handled by the described process: If a paragraph respectively one of the anchor characters moves to the next page during its format in step (2) or (4), the process is re-started with this paragraph, the complete paragraph is moved to the next page and it is assured that the paragraph doesn't move back again.

Another special case are columned sections with evenly distributed content. In this case the section is formatted without evenly distribute its content and during this format the straightforward positioning process is applied and the positions of the floating screen objects with a set wrapping style is determined. Afterwards the content of the columned section is evenly distributed.

The result of described MS Word process could be surprising and often doesn't fit to the given positioning and alignment attributes of the floating screen objects, but it avoids layout loops.

Conclusion

To meet the requirements of MS-Interoperability the positioning of floating screen objects will be adjusted.

A new compatibility option will be introduced – proposed name 'Consider wrapping style when positioning objects'. The value of this compatibility option controls, if the iterative positioning process or the straightforward positioning process for the positioning of floating screen objects is applied.

A new attribute for floating screen objects will be introduced – proposed name 'influence of wrapping style on positioning'. This attribute describes the influence of the wrapping style of the floating screen object on its positioning, if the straightforward positioning process is applied.

Compatibility option

A new document compatibility option will be introduced. By the value of this new compatibility option it's assured that for former created Writer documents the positioning of floating screen objects doesn't change and that for imported MS Word documents the positioning of floating screen objects in Writer equals the object positioning in MS Word.

The proposed name of the option will be 'Consider wrapping style when positioning objects'.

If the new option is OFF, the 'iterative positioning process' for the positioning floating screen objects is applied. If the new option is ON, the 'straightforward positioning process' for the positioning of floating screen objects will be applied.

Default value

The default value of the option for new documents will be OFF. The value is saved in the document. For open documents the value is taken from the document file. If no saved value is found in the document file – in general for documents from previous versions of OpenOffice.org/StarOffice – the default value is taken.

Floating screen object attribute

The new floating screen object attribute 'influence of wrapping style on positioning' has to have two values with the following meanings:

None, successive positioned – on the positioning of the floating screen object its wrapping style isn't considered and it's successive positioned. Floating screen objects, which have this attribute value set, will be of named ObjType 1 in the following.

None, concurrent positioned – on the positioning of the floating screen object its wrapping style isn't considered and it's concurrent positioned. Floating screen objects, which have this attribute value set, will be of named ObjType 2 in the following.

The value of the attribute will be used in the straightforward positioning process to decide how the floating screen object is positioned. Floating screen objects of ObjType 1 are positioned in step (2) and floating screen objects of ObjType 2 are positioned in step (3).

The attribute value is only relevant and is only evaluated for the positioning of the floating screen object, if its wrapping style is set to 'None', 'Before', 'After', 'Parallel' or 'Optimal'.

Default value of the attribute

The default value of the new attribute will be 'None, concurrent positioned'. The default value will be saved in the document.

For open documents the default value is taken from the document file. If no saved value is found in the document file – in general for documents from previous versions of OpenOffice.org/StarOffice – the default value is taken.

Impact on the user interface

The compatibility option – introduced in a previous chapter – will be accessible by the user in the 'Compatibility' tab page, found under menu Tools – Option – Text document – Compatibility via a checkbox. See following string list for the changed string of the checkbox.

String list

Item	English	German	Comments
Checkbox	Consider wrapping style when positioning objects	Umbruchart bei der Positionierung von Objekten berücksichtigen	New checkbox on tab page 'Compatibility', found under menu 'Tools - Options – Text Document - Compatibility'

Consider wrapping style when positioning objects Figure 1 Extended tab page 'Compatibility' Note that the options dialog and this tab page is subject to changes – see specifications 'Option dialog' (found at http://specs.openoffice.org/appwide/separate_modules/OptionsDialog.sxw) and 'Writer Compatibility Page' (found at http://specs.openoffice.org/writer/compatibility/compatibility.sxw)

Impact on the file format and the API

Compatibility option

The value of the new document compatibility option 'Consider wrapping style when positioning objects' will be saved in the file format as a <config:config-item> tag with the attributes config:name='ConsiderTextWrapOnObjPos' and config:type=”boolean” in the <config:config-item-set config-name=”configuration-settings”> tag. The tag can provide the values true or false.

If no value for the new document compatibility option is provided in the file format – as it is for former created Writer documents –, it's value is set to OFF.

The access to the value of the new document compatibility option via API will be provided by the service com::sun::star::text::DocumentSettings via the new optional property ConsiderTextWrapOnObjPos.

Attribute

The value of the new attribute 'influence of wrapping style on positioning' will saved in the file format as the new attribute draw:wrap-influence-on-position=”none-successive-positioned”|”none-concurrent-positioned” of the <style:properties> tag.

The new attribute can be accessed via the API by the new optional property WrapInfluenceOnPosition of the service com::sun::star::text::BaseFrameProperties for Writer fly frames and of the service com::sun::star::Text::Shape for drawing objects. The two values will be NONE_SUCCESSIVE_POSITIONED and NONE_CONCURRENT_POSITIONED..

Impact on the MS Word filter

On importing MS Word documents the value of the compatibility option 'Consider wrapping style when positioning objects' is set to ON and the new attribute 'influence of wrapping style on positioning' for a floating screen object as to be set in dependence of its type. For MS Word floating screen object of type 'frame' it has to be set to None, successive positioned, for all other objects it has to be set to None, concurrent positioned.

Exporting documents to MS Word file format will result in a loss of information for floating screen objects, if the value of the compatibility option 'Consider wrapping style when positioning objects' is OFF, because MS Word doesn't support something like the iterative positioning process for floating screen objects.

Implementation details

Order between to paragraph and to character anchored floating screen objects

Floating screen objects ObjType 1, which are anchored to paragraph, are processed before floating screen objects ObjType 1, which are anchored to character, in step (2) of the straightforward positioning process.

Collecting order of floating screen objects in the MS Word import filter

The order of the floating screen objects, which are anchored at the same character respectively the same paragraph, have to be collected during the import of a MS Word document.

Saving order of floating screen objects in the file format

The order of the floating screen objects is reflected in the file format by the order of its appearance in the file format.

G11n

Nothing.

Error Conditions

Not known.

Migration

Not known.

Future Tasks

Notes

References

Positioning of floating screen objects without considering its wrapping styles

Page 4

http://specs.openoffice.org/writer/compatibility/obj-pos-without-wrapping.sxw

Oliver-Rainer Düsterhöft

2004-02-06T13:47:23