Bug 135464 - ODF export: text:anchor-type="page" + style:horizontal-rel="paragraph" etc. invalid combinations
Summary: ODF export: text:anchor-type="page" + style:horizontal-rel="paragraph" etc. i...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: odf target:7.1.0 target:7.0.1
Keywords:
: 109172 (view as bug list)
Depends on:
Blocks: ODF-export-invalid
  Show dependency treegraph
 
Reported: 2020-08-05 13:13 UTC by Michael Stahl (allotropia)
Modified: 2021-02-09 14:29 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test case for "paragraph-content" that differs in CalcClipRect (8.67 KB, application/vnd.oasis.opendocument.text)
2020-08-05 14:53 UTC, Michael Stahl (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Stahl (allotropia) 2020-08-05 13:13:58 UTC
Writer can produce documents with combinations of anchor-type and horizontal-rel that are invalid according to ODF 1.3, 20.298 style:horizontal-pos.

for "page" anchor, "paragraph", "paragraph-content", "paragraph-end-margin", "paragraph-start-margin", "char" are invalid.

to create such a document:
1. insert a shape (or image/frame/ole, 2 different implementations of it)
2. use context menu "Anchor->To Page"

now the Properties dialog will show Page (because the actual value "Paragraph area" isn't valid) but when you save the file it actually writes "paragraph".

it looks like if the anchor is FLY_AT_PAGE, the anchor frame is always going to be SwPageFrame, and there is only one difference in the layout code that i can find where things are different between the horizontal-rel values:

flylay.cxx: CalcClipRect() has this:

            if( rH.GetHoriOrient() != text::HoriOrientation::NONE &&
                rH.GetRelationOrient() == text::RelOrientation::PRINT_AREA )
            {
                aRectFnSet.SetLeft( rRect, aRectFnSet.GetPrtLeft(*pClip) );
                aRectFnSet.SetRight(rRect, aRectFnSet.GetPrtRight(*pClip));
            }

but no corresponding case for PAGE_PRINT_AREA.

so i hope we might be able to easily fix this on ODF import for 3 of the 4 invalid cases.
Comment 1 Michael Stahl (allotropia) 2020-08-05 14:53:05 UTC
Created attachment 163974 [details]
test case for "paragraph-content" that differs in CalcClipRect
Comment 2 Commit Notification 2020-08-06 09:26:22 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/12645900dece0a9aa0661fee796c27f672217977

tdf#135464 sw: ODT->DOCX: fix positioning of at-page shapes and frames

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2020-08-06 09:26:32 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1de2b0d3234462b488db54d36ebc17e2b579b0f0

tdf#135464 sw: avoid invalid combinations of HoriOrientRelation and FLY_AT_PAGE

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2020-08-06 22:41:24 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/0de435962fc2ffbbcf3dc4a9bac13894372dfd5e

tdf#135464 sw: avoid invalid combinations of HoriOrientRelation and FLY_AT_PAGE

It will be available in 7.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2020-08-06 22:42:35 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/56e1c88a7b2fc31682a239f59ec319f93ba61a25

tdf#135464 sw: ODT->DOCX: fix positioning of at-page shapes and frames

It will be available in 7.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 NISZ LibreOffice Team 2020-08-31 12:09:19 UTC
*** Bug 109172 has been marked as a duplicate of this bug. ***
Comment 7 Xisco Faulí 2021-02-09 14:29:03 UTC
I guess we can close this issue now...

@Michael stahl, thanks for fixing this issue!!