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.
CCing Bob Miller who reported this issue in first place in a comment at #70457.
Marked as new. Successfully replicated using Jacobo's attachment and replication steps. Version: 4.2.0.0alpha0+ Build ID: adb759b304ff19dac3800d3fe007a863220e22ef Platform: x86 Ubuntu
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...
Jacobo: Did you need more info from me as the initial reporter or is the needs info for someone else on the project?
(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.
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.