Bug 71886 - FILEOPEN, FILESAVE, docx: flip attribute not imported/exported
Summary: FILEOPEN, FILESAVE, docx: flip attribute not imported/exported
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version: 4.2.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Jacobo Aragunde Pérez
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-21 17:40 UTC by Jacobo Aragunde Pérez
Modified: 2014-07-01 11:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Test case (19.71 KB, application/vnd.oasis.opendocument.text)
2013-11-21 17:40 UTC, Jacobo Aragunde Pérez
Details

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 Bob 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.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.