Bug 71886 - FILEOPEN, FILESAVE, docx: flip attribute not imported/exported
Summary: FILEOPEN, FILESAVE, docx: flip attribute not imported/exported
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: interoperability
Keywords: filter:docx
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
 
Reported: 2013-11-21 17:40 UTC by Jacobo Aragunde Pérez
Modified: 2018-06-11 12:59 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test case (19.71 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-11-21 17:40 UTC, Jacobo Aragunde Pérez
Details
dmapper xml file generated from the testcase (139.92 KB, text/xml)
2015-12-20 13:52 UTC, pasqual milvaques
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jacobo Aragunde Pérez 2013-11-21 17:40:56 UTC
Created attachment 89599 [details]
Test case

When a document contains a flipped image, it is imported as non-flipped into LibreOffice. When you save the document back, the flip attribute is removed.

Steps to reproduce:

1. Open the attached file. LibO logo should be flipped right-to-left but it isn't.
2. Save the document back to docx. If you open it with Word the logo is not flipped any more.
Comment 1 Jacobo Aragunde Pérez 2013-11-21 17:42:07 UTC
CCing Bob Miller who reported this issue in first place in a comment at #70457.
Comment 2 Greg 2013-11-25 03:11:55 UTC
Marked as new.

Successfully replicated using Jacobo's attachment and replication steps.

Version: 4.2.0.0alpha0+
Build ID: adb759b304ff19dac3800d3fe007a863220e22ef
Platform: x86 Ubuntu
Comment 3 Jacobo Aragunde Pérez 2014-06-11 17:49:07 UTC
Object oox::drawingml::Shape contains the members mbFlipH and mbFlipV which contain the correct values of flip read from the document. At Shape::createAndInsert, these members are used to apply a transformation matrix to the shape but it seems not to work on GraphicObjectShape objects; on the other hand, CustomShape objects have two properties that control horizontal and vertical flipping and they are filled with the corresponding values later at Shape::createAndInsert. Flipping works properly for the latter kind of objects.

I can't find which are the properties of GraphicObjectShape that control flipping, maybe there aren't such properties and flipping is implemented applying a transformation to the bitmap directly...
Comment 4 Stephanie Miller 2014-06-11 18:05:27 UTC
Jacobo:

Did you need more info from me as the initial reporter or is the needs info for someone else on the project?
Comment 5 Jacobo Aragunde Pérez 2014-06-11 18:24:18 UTC
(In reply to comment #4)
> Jacobo:
> 
> Did you need more info from me as the initial reporter or is the needs info
> for someone else on the project?

I meant I needed some additional info from people with better knowledge about how flipped images are implemented; I will ping #libreoffice-dev for some help.
Comment 6 Jacobo Aragunde Pérez 2014-07-01 11:34:52 UTC
I was studying another bug and I found the cause of this one; at GraphicImport::createGraphicObject there are two ifs like:

  if(m_pImpl->bHoriFlip)
    // enable horizontal flip on graphic

  if( m_pImpl->bVertFlip )
    // enable vertical flip on graphic

Why is it not working? Because bHoriFlip and bVertFlip are never initialized. The values read from the document never arrive here.

Notice this is run later than Shape::createAndInsert; we should preserve the values of oox::drawingml::Shape.mbFlipH and mbFlipV until this point of the code.
Comment 7 QA Administrators 2015-07-18 17:43:46 UTC Comment hidden (obsolete)
Comment 8 Jacobo Aragunde Pérez 2015-08-11 18:15:43 UTC
Still reproducible:

Version: 5.1.0.0.alpha1+
Build ID: 0f4b3cb7d3d68906de316a64dcec281da2a641bd
Comment 9 pasqual milvaques 2015-12-20 13:52:09 UTC
Created attachment 121439 [details]
dmapper xml file generated from the testcase

I'm taking a look to the bug, it seems that the flipping attributes are not arriving to dmapper. The attached file has been generated launching LibreOffice with the order: ./instdir/program/soffice -env:DEBUG_WRITERFILTER=1

Flipping attributes must be defined with CT_Transform2D_flipH and CT_Transform2D_flipV and those values doesn't appear in the xml file
Comment 10 Telesto 2016-12-03 17:34:18 UTC
Still reproducible with:
Version: 5.4.0.0.alpha0+
Build ID: 33f5bc54aaa7fe7aa9335726e30f9c349155e04d
CPU Threads: 4; OS Version: Windows 6.2; UI Render: default; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2016-12-01_23:21:05
Locale: nl-NL (nl_NL); Calc: CL

also found in:
Versie 4.0.0.3 (Bouw-id: 7545bee9c2a0782548772a21bc84a9dcc583b89)

and in:
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 11 Xisco Faulí 2017-07-13 10:03:44 UTC
Setting Assignee back to default. Please assign it back to yourself if you're still working on this issue
Comment 12 [REDACTED] 2018-05-10 23:18:36 UTC
This bug is not reproduced anymore on LibreOffice 6.0.2.1, ie image is flipped correctly when file is opened in LibreOffice, and after roundtrip in MS Office too.