diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2019-09-01 19:26:40 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2019-09-05 12:36:56 +0200 |
commit | 57c9bdab377a00649299d1a4c9ed2f9e5e03b84e (patch) | |
tree | 680bb89ff0c2d11745702e1fdca149fe0ea3f20f /sw | |
parent | 8590de9d8c3f155f23155d7500fd805c0e21a26b (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')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt | bin | 11876 -> 0 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 13 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc | bin | 0 -> 26624 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 36 |
4 files changed, 36 insertions, 13 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt b/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt Binary files differdeleted file mode 100644 index b9b8a79d46da..000000000000 --- a/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt +++ /dev/null diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 54e2002bd12d..70ee26bbd2f4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -944,19 +944,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf64264, "tdf64264.docx") parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()")); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLOPresetDashesConvert, "lo_preset_dashes.odt") -{ - // File asserting while saving in LO. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDot"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDash"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDot"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dot"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dash"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDashDotDot"); - assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDash"); -} - DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-table-header.docx") { // DOCX tables with more than 10 repeating header lines imported without repeating header lines diff --git a/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc Binary files differnew file mode 100644 index 000000000000..21cd47a4ced0 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127166_prstDash_Word97.doc 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: */ |