Created attachment 105568 [details] example files Draw seems to be incompatible with some values of svg:viewBox and svg:d in the draw:connector element. It seems to assume that all values are thousandths of a centimetre. All other values don't work. I'm working on a converter that creates odg files. While doing that, I've come across the problem, that calligra flow and libre office don't display all files equally, even though they both create odg files. One problem is that when you create a file in calligra flow with a connector that is only connected on one end or not connected at all. These files are not displayed correctly when opened in libre office draw. I've attached a file created with calligra flow with a connector that is not connected on one of its ends (calligra_created.odg). In libre office connections like this always end near the top left corner. I've unpacked a libre office draw file and noticed that is uses thousandths of a centimetre in svg:viewBox and svg:d of draw:connector. Draw seems to rely on that. This can be seen when you devide all values by 10. I deleted the last digit for all numbers. Of course this is not an exact divions but it should be almost the same curve as the values are very big. Then libre office draw diplays the open end of the connection near the top left corner. In calligra flow both files look the same. Created by draw (draw_created_original.odg): <draw:connector draw:style-name="gr2" draw:text-style-name="P1" draw:layer="layout" svg:x1="9.8cm" svg:y1="11.4cm" svg:x2="5.829cm" svg:y2="20.362cm" draw:start-shape="id1" svg:d="M9800 11400v4732h-3971v4230" svg:viewBox="0 0 3972 8963"> After removing one digit (draw_created_modified.odg): <draw:connector draw:style-name="gr2" draw:text-style-name="P1" draw:layer="layout" svg:x1="9.8cm" svg:y1="11.4cm" svg:x2="5.829cm" svg:y2="20.362cm" draw:start-shape="id1" svg:d="M980 1140v473h-397v423" svg:viewBox="0 0 397 896"> -------------- This is a big problem for my converter that creates a lot of half-connected connectors and also causes compatibility issues between calligra flow and draw. Help would be very appreciated.
(In reply to t_d_l_c from comment #0) > I've attached a > file created with calligra flow with a connector that is not connected on > one of its ends (calligra_created.odg). In libre office connections like > this always end near the top left corner. Reproduced. Win 7 64-bit Version: 4.4.0.0.alpha2+ Build ID: b021b5983c62e266b82d9f0c5c6d8d8900553827 TinderBox: Win-x86@39, Branch:master, Time: 2014-11-12_01:10:08
Conversion of svg:x2 and svg:y2 in Converter::convertMeasure is correct during import from SdXMLConnectorShapeContext::processAttribute, but the svg:d seems to make trouble - if removing it, it looks good. Not sure how the file *should* look like. A screenshot would have been nice. This way, just to see how it should look like, I have to install Calligra...
Managed to create a sample in calligra which behaves as described. On 1st look it just seems as if the end pos is correct, but the path added is not. When leaving out the path all is good. A simple test for the path being valid would e.g. be to check last point/end point and first point/start point for being equal. It is not equal in the examples, thus may be simply an error in calligra to write a path at all with wrong content
Checked with what Office does, for Connectors StartPosition and EndPosition are always written, these are equal with the connector path's start and end points, independent of the start/end points being connected to objects. For the Caligra part only non-connected points get written, and a path who's start and end points seem to have nothing in common with the connector's start/end points - why ever this is done. Thus it would be good to check for these points and Calligra as producer, checking if this is possible...
Checked that indeed Office always writes the connector Start/End redundant in the paths data as 1st/last points, independent from connector being connected on one end or not. Writing the path of the connector is used as 'buffering' the connector layout calculations and to make reading ODF easier for other formats. Based on that it makes sense to flush this buffered data when inconsistencies between the start/end point coordinates and the path data exists. Trying that...
Created attachment 124715 [details] Screenshots for the example files I add some screeshots for the example files. Using Libre Office Version: 4.1.6.22.0+ Build-ID: 368 . This might be our own build (city of munich). Calligra Flow Version: Version 2.7.1 in KDE 4.12.0
Armin Le Grand committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=de7d596d116b5231bff000a57be3fae481744bab tdf#83360 avoid inconsistent connector path data It will be available in 5.3.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Re-checked if the import could correc t a connector from the example files that is connected on one end and free on the other by taking the included svg:d and scaling it to start/end point. This is not possible, since the connected end has no coordinates at connector input yet- the connectors are connected at end of page loading using a helper class. This means that not all data needed to scale-correct the svg:d is given at that point - the connected point is missing. Setting the connection resets the user-defined path and the polygon - for good reason. The defining values are the connector, the svg:d is redundant, convenience information. So this can (and should not) be done - if connector functionality is wanted, the connector has to be resetted it's svg:d and be re-layoutable from that moment on. Of course it would look better/closer to the source when the correct type of connector would be used which is not the case.
Works as intended, no better tings to do here