https://bugs.documentfoundation.org/show_bug.cgi?id=73547

--- Comment #4 from Jorendc <[email protected]> ---
(In reply to Jacobo Aragunde Pérez from comment #3)
> The exported file has slightly changed, this is the diff of the files
> before/after roundtrip:
>   <                             <a:ds d="105000" sp="35000" />
>   ---
>   >                             <a:ds d="100000" sp="100000" />

This is due patch
http://cgit.freedesktop.org/libreoffice/core/commit/?id=2211a67cc5e577f8abdcc96c9c63865be5fb988d

We now always read or convert the 'd' and 'sp' to 1000th of a %.
As you can see here:
http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/lineproperties.cxx#114

+        nConvertedLen      = aIt->first  / 1000 / 100;
+        nConvertedDistance = aIt->second / 1000 / 100;

we not only divide by 1000, also we now divide by 100 extra.

105000 / 1000 / 100 = rounded to 1
35000 / 1000 / 100 = rounded to 0, but maxed later to 1

Those values are multiplied by the nLineWidth at
http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/lineproperties.cxx#387
which is maxed to 35 (first it was 32).

aLineDash.DotLen = 1*35 now
aLineDash.Distance = 1*35 now

At export:
+ XML_d , write1000thOfAPercent( aLineDash.DashLen  > 0 ? aLineDash.DashLen  /
nLineWidth * 100 : 100 ),
+ XML_sp, write1000thOfAPercent( aLineDash.Distance > 0 ? aLineDash.Distance /
nLineWidth * 100 : 100 ),

d = sp = (35 / 32 * 100) * 1000 = 100000

Following patch exports the right values, but countereffect is that now the
line is not shown correctly in LibreOffice (length and distance is factor 100
bigger):

diff --git a/oox/source/drawingml/lineproperties.cxx
b/oox/source/drawingml/lineproperties.cxx
index efa1ab8..281fa57 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -111,8 +111,8 @@ void lclConvertCustomDash( LineDash& orLineDash, const
LineProperties::DashStopV
     for( LineProperties::DashStopVector::const_iterator aIt =
rCustomDash.begin(), aEnd = rCustomDash.end(); aIt != aEnd; ++aIt )
     {
         // Get from "1000th of percent" ==> percent ==> multiplier
-        nConvertedLen      = aIt->first  / 1000 / 100;
-        nConvertedDistance = aIt->second / 1000 / 100;
+        nConvertedLen      = aIt->first  / 1000;
+        nConvertedDistance = aIt->second / 1000;

         // Check if it is a dot (100% = dot)
         if( nConvertedLen == 1 )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 484c90b..3c8b1ee 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -692,8 +692,8 @@ void DrawingML::WriteOutline( Reference<XPropertySet>
rXPropSet )
                     for( i = 0; i < aLineDash.Dashes; i ++ )
                     {
                         mpFS->singleElementNS( XML_a , XML_ds,
-                                               XML_d , write1000thOfAPercent(
aLineDash.DashLen  > 0 ? aLineDash.DashLen  / nLineWidth * 100 :
-                                               XML_sp, write1000thOfAPercent(
aLineDash.Distance > 0 ? aLineDash.Distance / nLineWidth * 100 :
+                                               XML_d , write1000thOfAPercent(
aLineDash.DashLen  > 0 ? aLineDash.DashLen  / ::std::max< sal_Int32 >(
nLineWidth, 35 ) : 100 ),
+                                               XML_sp, write1000thOfAPercent(
aLineDash.Distance > 0 ? aLineDash.Distance / ::std::max< sal_Int32 >(
nLineWidth, 35 ) : 100 ),
                                                FSEND );
                     }
                 }


How to get around this incorrect display in LibreOffice?
(I can't find the correct location where these values are handled in the
drawing-backend of LibreOffice).
I see 2 options:
1) devide or factor everything related to this DashLen with 100, so it'll be
displayed correctly
2) store these very tiny dots or dashes whom are rounded incorrectly in a kind
of grab-bag and call them on export again.

Can someone please help me out and show me the right direction :)?

Thanks!
Joren

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to