oox/source/drawingml/textcharacterpropertiescontext.cxx | 40 +++++++ sw/qa/extras/ooxmlexport/data/tdf123351_UnderlineGroupSapeText.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 54 ++++++++++ sysui/CustomTarget_share.mk | 5 4 files changed, 96 insertions(+), 3 deletions(-)
New commits: commit 63860b3652ade32bee1902b02f2da51a52e60bea Author: Szabolcs <[email protected]> AuthorDate: Wed Apr 1 09:17:17 2020 +0200 Commit: László Németh <[email protected]> CommitDate: Thu Apr 2 14:47:28 2020 +0200 tdf#123351 DOCX DrawingML shape import: fix missing underline in shape texts. Handling of 18 underline types in DrawingML shape objects, i.e. in grouped shapes did not exist. Note: Underline type "words" imported as "single" temporarily. Also testing of dashLong is missing, because it is exported as dashLongHeavy in DOCX. Co-Authors: Balázs Regényi, Tibor Nagy Change-Id: I620d919da6b85eaed211e5cbdd5c1a55e60436d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91461 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index a126c258cd11..b7bb876044cf 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -162,6 +162,46 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl mrTextCharacterProperties.maAsianThemeFont.setAttributes(rAttribs.getString(W_TOKEN(eastAsiaTheme), OUString())); } break; + case W_TOKEN( u ): + { + // If you add here, check if it is in drawingmltypes.cxx 113. + auto attrib = rAttribs.getString(W_TOKEN( val ), OUString()); + if (attrib == "single" || attrib == "words") // TODO: implement words properly. Now it is a single line. + mrTextCharacterProperties.moUnderline = XML_sng; + else if (attrib == "wavyHeavy") + mrTextCharacterProperties.moUnderline = XML_wavyHeavy; + else if (attrib == "wavyDouble") + mrTextCharacterProperties.moUnderline = XML_wavyDbl; + else if (attrib == "wave") + mrTextCharacterProperties.moUnderline = XML_wavy; + else if (attrib == "thick") + mrTextCharacterProperties.moUnderline = XML_heavy; + else if (attrib == "dottedHeavy") + mrTextCharacterProperties.moUnderline = XML_dottedHeavy; + else if (attrib == "dotted") + mrTextCharacterProperties.moUnderline = XML_dotted; + else if (attrib == "dashDotDotHeavy") + mrTextCharacterProperties.moUnderline = XML_dotDotDashHeavy; + else if (attrib == "dotDotDash") + mrTextCharacterProperties.moUnderline = XML_dotDotDash; + else if (attrib == "dashDotHeavy") + mrTextCharacterProperties.moUnderline = XML_dotDashHeavy; + else if (attrib == "dotDash") + mrTextCharacterProperties.moUnderline = XML_dotDash; + else if (attrib == "double") + mrTextCharacterProperties.moUnderline = XML_dbl; + else if (attrib == "dashLongHeavy") + mrTextCharacterProperties.moUnderline = XML_dashLongHeavy; + else if (attrib == "dashLong") + mrTextCharacterProperties.moUnderline = XML_dashLong; + else if (attrib == "dashedHeavy") + mrTextCharacterProperties.moUnderline = XML_dashHeavy; + else if (attrib == "dash") + mrTextCharacterProperties.moUnderline = XML_dash; + else if (attrib == "none") + mrTextCharacterProperties.moUnderline = XML_none; + break; + } case W_TOKEN( b ): mrTextCharacterProperties.moBold = rAttribs.getBool(W_TOKEN( val ), true); break; diff --git a/sw/qa/extras/ooxmlexport/data/tdf123351_UnderlineGroupSapeText.docx b/sw/qa/extras/ooxmlexport/data/tdf123351_UnderlineGroupSapeText.docx new file mode 100644 index 000000000000..8726f7ee6f72 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123351_UnderlineGroupSapeText.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index aa4c902d6765..91acdfe299ec 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1144,6 +1144,60 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDocxTablePosition, "floating-table-posit assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "4611"); } +DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupSapeText.docx") +{ + // tdf#123351: Check if correct underline is used. + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "single"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "double"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "thick"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dotted"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dottedHeavy"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dash"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dashedHeavy"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[5]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r[1]/w:rPr/w:u", "val", "dashLongHeavy"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[5]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dotDash"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dashDotHeavy"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dotDotDash"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "dashDotDotHeavy"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "wave"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "wavyHeavy"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "wavyDouble"); + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[32]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "none"); + + // TODO: Import of "words". + // This must fail when import of "words" is implemented. This is a temporary solution, we read "words" as "single". + assertXPath(pXmlDocument, "/w:document/w:body/w:p[32]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor" + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "single"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 009db597027890ade07d31674c740ae0fc432f87 Author: Stephan Bergmann <[email protected]> AuthorDate: Thu Apr 2 13:48:48 2020 +0200 Commit: Stephan Bergmann <[email protected]> CommitDate: Thu Apr 2 14:47:19 2020 +0200 Only process with brand.pl the *.keys and *.desktop files ...and not also whatever other prerequisites those two rules might have (e.g., instdir/program/python.bin). Before 01344a8ca57636ac87108c22f777a02fe6d963d5 "convert sysui to gbuild and add to tail_build", the corresponding dmake code in sysui/desktop/share/makefile.mk had been > $(COMMONMISC)$/{$(PRODUCTLIST)}$/openoffice.keys : ../mimetypes/openoffice.mime brand.pl translate.pl ../productversion.mk $(ULFDIR)$/documents.ulf > $(COMMONMISC)$/{$(PRODUCTLIST)}$/openoffice.keys : ../mimetypes/{$(MIMELIST)}.keys [...] > @$(PERL) brand.pl -p $(PRODUCTNAME.$(@:d:d:f)) -u $(UNIXFILENAME.$(@:d:d:f)) --iconprefix '$(ICONPREFIX.$(@:d:d:f))-' $< $(MISC)/$(@:d:d:f) [...] and > $(LAUNCHERFLAGFILE) : ../productversion.mk brand.pl translate.pl $(ULFDIR)$/launcher_name.ulf $(ULFDIR)$/launcher_comment.ulf $(ULFDIR)/launcher_genericname.ulf $(ULFDIR)/launcher_unityquicklist.ulf > $(LAUNCHERFLAGFILE) : $(LAUNCHERDEPN) [...] > @$(PERL) brand.pl -p '$${{PRODUCTNAME}} $${{PRODUCTVERSION}}' -u $(UNIXWRAPPERNAME) --iconprefix '$${{UNIXBASISROOTNAME}}-' $< $(@:db).$(INPATH).$(@:f) [...] where Dmake's $< denotes "the list of prerequisites specified in the current rule" (<https://www.openoffice.org/tools/dmake/dmake_4.11.html>, section "RUNTIME MACROS"), whereas GNU Make's $^ denotes all prerequisites. Change-Id: Ie6efc5d9512408711db32502e0959b32ec232603 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91566 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk index 7402dddf46b4..f4c38f813a09 100644 --- a/sysui/CustomTarget_share.mk +++ b/sysui/CustomTarget_share.mk @@ -139,7 +139,6 @@ $(share_WORKDIR)/%/openoffice.org.xml: $(share_WORKDIR)/documents.ulf $(MIMEDESK $(PERL) $(share_SRCDIR)/share/create_mime_xml.pl $< > $@ $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL) - $(share_WORKDIR)/%/openoffice.keys: \ $(share_SRCDIR)/mimetypes/openoffice.mime $(MIMEKEYS) $(share_SRCDIR)/share/brand.pl \ $(share_TRANSLATE) $(share_WORKDIR)/documents.ulf \ @@ -148,7 +147,7 @@ $(share_WORKDIR)/%/openoffice.keys: \ $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1) $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL) $(PERL) $(share_SRCDIR)/share/brand.pl -p $* -u $(UNIXFILENAME.$*) \ - --iconprefix $(UNIXFILENAME.$*)- $^ $(share_WORKDIR)/$* + --iconprefix $(UNIXFILENAME.$*)- $(MIMEKEYS) $(share_WORKDIR)/$* $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) \ -p $* -d $(share_WORKDIR)/$* \ --ext "keys" --key "description" $(share_WORKDIR)/documents.ulf @@ -244,7 +243,7 @@ $(share_WORKDIR)/%/build.flag: $(share_SRCDIR)/share/brand.pl $(LAUNCHERS) \ $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL) $(PERL) $(share_SRCDIR)/share/brand.pl -p '$${PRODUCTNAME} $${PRODUCTVERSION}' -u $(UNIXFILENAME.$*) \ $(brand_URIPARAM) \ - --iconprefix '$${UNIXBASISROOTNAME}-' $^ $(share_WORKDIR)/$* + --iconprefix '$${UNIXBASISROOTNAME}-' $(LAUNCHERS) $(share_WORKDIR)/$* $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \ --ext "desktop" --key "Comment" $(share_WORKDIR)/launcher_comment.ulf $(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
