summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ww8export/ww8export3.cxx
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-09-01 19:26:40 +0200
committerRegina Henschel <rb.henschel@t-online.de>2019-09-05 12:36:56 +0200
commit57c9bdab377a00649299d1a4c9ed2f9e5e03b84e (patch)
tree680bb89ff0c2d11745702e1fdca149fe0ea3f20f /sw/qa/extras/ww8export/ww8export3.cxx
parent8590de9d8c3f155f23155d7500fd805c0e21a26b (diff)
tdf#127166, tdf#123903 improve import/export of line styles
I have added import and export of prstDash line styles, for OOXML and for binary MS Office formats. This includes: Corrected Dot <--> Dash confusion, corrected some wrong defaults, added support for hairlines tdf#127267, take care of treating length 0 as 100%. tdf#108064 has introduced some mapping from our standard line styles to OOXML prstDash. I have removed that and implemented to export our styles as custDash and recover them back on import. That way the dashing looks initially the same in MS Office. I have removed the now wrong test. Binary MS Office formats have no custom dash styles AFAIK, therefore I have not changed the export of our styles there, but only added support for prstDash styles. Change-Id: Ia8cc8f90df6fdbe42adfc0236cc52becc670b333 Reviewed-on: https://gerrit.libreoffice.org/78372 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sw/qa/extras/ww8export/ww8export3.cxx')
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index b8a6d4056d13..36d525f22d15 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -13,6 +13,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/text/XFormField.hpp>
#include <com/sun/star/text/XTextTable.hpp>
@@ -308,6 +309,41 @@ DECLARE_WW8EXPORT_TEST(testBtlrFrame, "btlr-frame.odt")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(9000), getProperty<sal_Int32>(xFrame, "RotateAngle"));
}
+DECLARE_WW8EXPORT_TEST(testPresetDash, "tdf127166_prstDash_Word97.doc")
+{
+ // Error was, that the 'sys' preset dash styles were neither imported not
+ // exported, the mixed styles had wrong dash-dot order, they were imported
+ // with absolute values.
+ const drawing::LineDash dashParams[] =
+ {
+ {drawing::DashStyle_RECTRELATIVE, 1, 400, 0, 0, 300}, // dash
+ {drawing::DashStyle_RECTRELATIVE, 1, 400, 1, 100, 300}, // dashDot
+ {drawing::DashStyle_RECTRELATIVE, 1, 100, 0, 0, 300}, // dot
+ {drawing::DashStyle_RECTRELATIVE, 1, 800, 0, 0, 300}, // lgDash
+ {drawing::DashStyle_RECTRELATIVE, 1, 800, 1, 100, 300}, // lgDashDot
+ {drawing::DashStyle_RECTRELATIVE, 1, 800, 2, 100, 300}, // lgDashDotDot
+ {drawing::DashStyle_RECTRELATIVE, 1, 300, 0, 0, 100}, // sysDash
+ {drawing::DashStyle_RECTRELATIVE, 1, 300, 1, 100, 100}, // sysDashDot
+ {drawing::DashStyle_RECTRELATIVE, 1, 300, 2, 100, 100}, // sysDashDotDot
+ {drawing::DashStyle_RECTRELATIVE, 1, 100, 0, 0, 100} // sysDot
+ };
+ drawing::LineDash aPresetLineDash;
+ drawing::LineDash aShapeLineDash;
+ for (sal_uInt16 i = 0; i < 10; i++)
+ {
+ aPresetLineDash = dashParams[i];
+ uno::Reference<drawing::XShape> xShape = getShape(i+1);
+ aShapeLineDash = getProperty<drawing::LineDash>(xShape, "LineDash");
+ bool bIsEqual = aPresetLineDash.Style == aShapeLineDash.Style
+ && aPresetLineDash.Dots == aShapeLineDash.Dots
+ && aPresetLineDash.DotLen == aShapeLineDash.DotLen
+ && aPresetLineDash.Dashes == aShapeLineDash.Dashes
+ && aPresetLineDash.DashLen == aShapeLineDash.DashLen
+ && aPresetLineDash.Distance == aShapeLineDash.Distance;
+ CPPUNIT_ASSERT_MESSAGE("LineDash differ", bIsEqual);
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */