Created attachment 58591 [details] two arrows in the left are incorrectly shifted to the left The attached file is created with PowerPoint. Some arrows are incorrectly shifted to the left, please see screenshots in next comments. [REPRODUCIBLE] with 3.5.0 RC 2 / WinXP [NOT REPRODUCIBLE] with 3.4.4 / WinXP So regression.
Created attachment 58592 [details] screenshot in powerpoint 2007
Created attachment 58593 [details] screenshot in libo3.4.4, expected
Created attachment 58594 [details] screenshot in libo3.5.0 rc2 - regression
bibisect log: git bisect start # bad: [4c30602f43475389f81b1d981ce8ee9a3410b9d9] source-hash-85c6244b85b29c1d2bb9d89b62e9512dd65378b5 git bisect bad 4c30602f43475389f81b1d981ce8ee9a3410b9d9 # good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932 git bisect good 65fd30f5cb4cdd37995a33420ed8273c0a29bf00 # good: [2faf4bc12ab490370d2196dedbc8091f9b09d0a5] source-hash-418a35f4861e863feb39eec73f4a39a87fbcb1f3 git bisect good 2faf4bc12ab490370d2196dedbc8091f9b09d0a5 # good: [b6fca7e58854bc617c5fc9a75d1c1720b0d7e1a4] source-hash-ce60138d339a5eb2a174a5d27063249acf2cac42 git bisect good b6fca7e58854bc617c5fc9a75d1c1720b0d7e1a4 # good: [216e447cb0a457985f20d4db481fa9c73b0bb775] source-hash-55c5ea43a59e505297fb6fa20b77aaa28f7c67bc git bisect good 216e447cb0a457985f20d4db481fa9c73b0bb775 # good: [569ab0259fc5fcc3190d9ae9c44e1e28570bc8bd] source-hash-817bf1d41bb07aeb3ed7649d25c2b44ee4acb1fe git bisect good 569ab0259fc5fcc3190d9ae9c44e1e28570bc8bd # good: [cfad378ec3c0de9f19525a2eef4cef9bc056e3f6] source-hash-10f977981d2cfb6ba0ccd0185ccb12e212010bc2 git bisect good cfad378ec3c0de9f19525a2eef4cef9bc056e3f6 # bad: [a4c1bd2fe1dccc0fa192cc5cf9ebd2967c6a9920] source-hash-558b5ea32a99654dcb63526f107726f7aec4747f git bisect bad a4c1bd2fe1dccc0fa192cc5cf9ebd2967c6a9920
And the commit range to look is http://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=10f977981d..558b5ea32 IIUC :)
There is only one commit in the range mentioned in comment 5 which touch oox/ http://cgit.freedesktop.org/libreoffice/core/commit/?id=30b052e7b65434d2a78ab36d8f4475abe0c86a2a Muthu, could you please have a look? Thanks. Sorry if I am incorrect.
thank you. seems like a problem...will look at it...
Correctly assign to Muthu :)
I guess, a duplicate of bug 43752 ?
(In reply to comment #9) > I guess, a duplicate of bug 43752 ? Unfortunately, no. Bug 43752 is solved in 3.5.3 RC1, but this bug is not.
Looking into OOXML structure, ppt/slides/slide1.xml, I found that the main difference between "Straight Arrow Connector 5" (correct arrow displayed) and "Straight Arrow Connector 7" (incorrect, arrow shifted to the left) is: "Straight Arrow Connector 5" has attribute flipH="1" in element <a:xfrm flipH="1">, but "Straight Arrow Connector 7" doesn't have this attribute. Following is the result of diff -u (pretty-printed, of course) <p:cxnSp> <p:nvCxnSpPr> - <p:cNvPr id="6" name="Straight Arrow Connector 5"/> + <p:cNvPr id="8" name="Straight Arrow Connector 7"/> <p:cNvCxnSpPr/> <p:nvPr/> </p:nvCxnSpPr> <p:spPr> - <a:xfrm flipH="1"> - <a:off x="4800600" y="2362200"/> - <a:ext cx="2209800" cy="0"/> + <a:xfrm> + <a:off x="1572490" y="2438400"/> + <a:ext cx="2743200" cy="0"/> </a:xfrm> <a:prstGeom prst="straightConnector1"> <a:avLst/> So, I tried adding flipH="1" to the "Straight Arrow Connector 7", and it displayed correctly. By "correctly" I mean it position is correct, and it points to the left as expected. IOW, it is same as in PowerPoint. Hope this helps :)
Created attachment 61541 [details] arrow name (only number shown) in ooxml structure
Created attachment 61542 [details] new case - manually edited ooxml I've created new files in PowerPoint 2007. It consists of two arrows, one horizontally flipped, one not. With some investigation, I found that: * The arrow *without* flip attribute in <a:xfrm> will *not* show correctly if "cy" attribute in <a:ext> less than 180, else it will show correctly. * The arrow with flip attribute <a:xfrm flipH="1"> will show correctly regardless of value of "cy". In other words: * <a:xfrm flipH="1"> - correct * <a:xfrm> with <a:ext cx="??" cy="180"/> or larger - correct * <a:xfrm> with <a:ext cx="??" cy="179"/> or lower - incorrect The attachment contains 2 manually edited ooxml files. I edited ppt/slides/slide1.xml to have cy=179 and cy=180 in both arrows in the same file. Speaking of the number 180, I am thinking of the angle / rotation stuff ... but I may be wrong Note: If I understand correctly, "cy" should be the width of the shape. <http://www.schemacentral.com/sc/ooxml/e-a_ext-2.html>
With sample file in attachment 61542 [details], I debugged it a bit and found that in function EnhancedCustomShapeEngine::render() at http://opengrok.libreoffice.org/xref/core/svx/source/customshapes/EnhancedCustomShapeEngine.cxx#246 I tested the value of mxShape->getSize() and result was as follows: * In buggy file (cy=179) : width = 5555, height = -37926 * In non-bug file (cy=180) : width = 5555, height = 1 I'm not sure if I got through a right way or not. If yes, could you please give me some hints how should I continue? Thanks!
its really nice to see you get into the code... It would be interesting to know why height is negative and if that is what is causing the problem...
Thanks Muthu! A short update on this: Line 551 in http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/shape.cxx#551 > PropertySet( xSet ).setProperties( aShapeProps ); Makes mxShape's Height to be negative value, comparing before this line and also with non-buggy file.
*If I understand correctly*, from line 551 > PropertySet( xSet ).setProperties( aShapeProps ); we're setting aShapeProps into xSet, which is properties of mxShape from line 459: > Reference< XPropertySet > xSet( mxShape, UNO_QUERY ); And this is why mxShape's Height be negative after line 551. Next, line 538 > aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr ); push aLineProperties into aShapeProps. So, we have to see how aLineProperties is constructed. Line 492 is where aLineProperties declared. > LineProperties aLineProperties; I'm now at this point. PS. If I understood anything incorrectly, please feel free to tell :) Thanks!
I'm currently lost now, wondered how aLineProperties affects mxShape. Could you please help? Thanks very much! :)
aLineProperties are created while reading the xml. Somewhere like http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/shape.cxx#242 http://opengrok.libreoffice.org/search?q=mpLinePropertiesPtr&project=core and modified while the shape's properties are read. This might help you as well: http://opengrok.libreoffice.org/search?q=mbFlipH&project=core (and mpFlipV)
Thanks and sorry for the late reply. I've been busy last week, so I could not do the full debugging session. Anyway, I tried this: If it's an arrow and height < 0, set height = 1. I inserted this code after the line 551: > PropertySet( xSet ).setProperties( aShapeProps ); And, yes!, it rendered correctly. So, I think next step is to find what cause the height to be negative.
@Korrawit: Cool! I think you should be able to solve this now! Do assign it to yourself, if required.
Just a sorry note: I still don't have time to do a full debugging session.
Sorry for the delay. Now I'm looking at this: (line number might change because my source is old) #0 Rectangle::Rectangle (this=0xbfff89a0, rLT=..., rSize=...) at /home/tux/libo/solver/unxlngi6/inc/tools/gen.hxx:487 #1 0xab6051db in SdrObjCustomShape::TRSetBaseGeometry (this=0x8bc9938, rMatrix=...) at /home/tux/libo/svx/source/svdraw/svdoashp.cxx:3029 #2 0xab78fab3 in SvxShape::setPropertyValueImpl (this=0x89643c0, pProperty=0x8b26a20, rValue= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/svx/source/unodraw/unoshape.cxx:2227 #3 0xab797a44 in SvxShapeText::setPropertyValueImpl (this=0x89643c0, rName="Transformation", pProperty=0x8b26a20, rValue= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/svx/source/unodraw/unoshape.cxx:4198 #4 0xab78deee in SvxShape::_setPropertyValue (this=0x89643c0, rPropertyName="Transformation", rVal= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/svx/source/unodraw/unoshape.cxx:1710 #5 0xaa3b151f in SdXShape::setPropertyValue (this=0x8bc8f28, aPropertyName="Transformation", aValue= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/sd/source/ui/unoidl/unoobj.cxx:701 #6 0xab78dce8 in SvxShape::setPropertyValue (this=0x89643c0, rPropertyName="Transformation", rVal= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/svx/source/unodraw/unoshape.cxx:1680 #7 0xab779d05 in SvxCustomShape::setPropertyValue (this=0x89643c0, aPropertyName="Transformation", aValue= uno::Any {Line1 = {Column1 = 5556.2888888888892, Column2 = 0, Column3 = 5357.7611111111109}, Line2 = {Column1 = 0, Column2 = 0.49722222222222223, Column3 = 4365.5888888888894}, Line3 = {Column1 = 0, Column2 = 0, Column3 = 1}}) at /home/tux/libo/svx/source/unodraw/unoshap2.cxx:1914 #8 0xab78e9ac in SvxShape::setPropertyValues (this=0x89643c0, aPropertyNames=uno::Sequence of length 17 = {...}, aValues=uno::Sequence of length 17 = {...}) at /home/tux/libo/svx/source/unodraw/unoshape.cxx:1899 #9 0xac4068b0 in oox::PropertySet::setProperties (this=0xbfff98c0, rPropNames=uno::Sequence of length 17 = {...}, rValues=uno::Sequence of length 17 = {...}) at /home/tux/libo/oox/source/helper/propertyset.cxx:96 #10 0xac406aab in oox::PropertySet::setProperties (this=0xbfff98c0, rPropertyMap=...) at /home/tux/libo/oox/source/helper/propertyset.cxx:125 #11 0xac317ec3 in oox::drawingml::Shape::createAndInsert (this=0x8bd3588, rFilterBase=..., rServiceName="com.sun.star.drawing.CustomShape", pTheme=0x89a9340, rxShapes= Note that the line: > PropertySet( xSet ).setProperties( aShapeProps ); mentioned in comment 20 is at frame #11. The problem is the number 0.49722222222222223 returned when calling aScale.getY(). And FRound(0.49722222222222223) returns 0, not 1. So, > Size aSize(FRound(aScale.getX()), FRound(aScale.getY())); gets aSize = {5556, 0}. Then, calling > Rectangle aBaseRect(aPoint, aSize); which in turn calls > inline Rectangle::Rectangle( const Point& rLT, const Size& rSize ) > { > nLeft = rLT.X(); > nTop = rLT.Y(); > nRight = rSize.Width() ? nLeft+rSize.Width()-1 : RECT_EMPTY; > nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY; > } get nBottom = RECT_EMPTY. And RECT_EMPTY = -32767.
Comparing with the correct-rendering file, its aScale.getY() returns 0.5, which FRound(0.5) = 1. I'm not sure if this is a floating-point problem or not, I'll look a bit more where 0.49722222222222223 come from.
OK, 179/360 = 0.49722222222222223. It comes from line 386 in oox/source/drawingml/shape.cxx : > aTransformation.scale(1/360.0, 1/360.0); Before this line, aTransformation.get(1,1) = 179 = maSize.Height = cy in ooxml (see comment 13 and 14) and aTransformation.get(0,0) = 2000264 = maSize.Width = cx in ooxml After this line, we divide them with 360, so we get 0.497222... And this explains: when cy >= 180, it rendered correctly. This is because cy/360 >= 0.5, and FRound gives >= 1. But when cy < 180, cy/360 < 0.5, FRound gives 0, which triggers comment 23. Using git annotate, this line of code come from http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb67c85eca1fdbe56c9dd24c3358bac833fd6a0 @Muthu, Now the problem is: I have no idea why we have to divide 360. Could you please help? Thanks very much!
@Korrawit: Cool! That's nice progress! I am confused with this 179 :( Since Radek seems to be familiar with this code, I am CC'ing him - he should be able to guide you. @Radek: Thanks!
FYI: I have started looking at this in depth.
Created attachment 65028 [details] Patch
@Korrawit: After a quick debugging, I felt checking and setting the width should be fine. This is because a valid rectangle is required for the transformation and zero isn't intended. Thank you so much for all the hard work... @Radek: A review here would help, please...Thanks!
Marking this fixed.
Muthu Subramanian committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=e3acf19c0502b0758359b56abda81e504d167630 fdo#47434: Zero rect. size causing wrong line positions.
Muthu Subramanian committed a patch related to this issue. It has been pushed to "libreoffice-3-5": http://cgit.freedesktop.org/libreoffice/core/commit/?id=6cbb9602e15794b4d39d2482a40c22d3fd0328f9&g=libreoffice-3-5 fdo#47434: Zero rect. size causing wrong line positions. It will be available in LibreOffice 3.5.7.
Muthu Subramanian committed a patch related to this issue. It has been pushed to "libreoffice-3-6": http://cgit.freedesktop.org/libreoffice/core/commit/?id=9b1f4aac63e0f1e5453485f8b4c36c9020bbea03&g=libreoffice-3-6 fdo#47434: Zero rect. size causing wrong line positions. It will be available in LibreOffice 3.6.2.
Muthu Subramanian committed a patch related to this issue. It has been pushed to "libreoffice-3-6-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=350d9f972e00a05ff61140eafc078188252cc2de&g=libreoffice-3-6-1 fdo#47434: Zero rect. size causing wrong line positions. It will be available already in LibreOffice 3.6.1.
Korrawit Pruegsanusak committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=affa362c8dcd8e9eada5dbf6967cd278565abf4e fdo#47434 testcase