[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/export.cxx|4 oox/source/export/ThemeExport.cxx | 156 +++--- oox/source/export/drawingml.cxx | 24 ++--- oox/source/export/vmlexport.cxx |2 oox/source/mathml/importutils.cxx |8 - 5 files changed, 97 insertions(+), 97 deletions(-) New commits: commit f20425e6de89411ec1d63d04d8d51e1710a6f375 Author: Stephan Bergmann AuthorDate: Wed Nov 29 16:41:18 2023 +0100 Commit: Stephan Bergmann CommitDate: Thu Nov 30 09:53:07 2023 +0100 Extended loplugin:ostr: oox Change-Id: Ie6db1edbad5305e4935a9fdc03dab36861bf2c8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160112 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 91954daa7db7..4df8aaa8f587 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -980,7 +980,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkThemeColor) // shape with 'lighter' sElement = "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/" - "a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/"; + "a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/"_ostr; // Make sure the fallback in has correct values assertXPath(pXmlDoc, sElement + "w:color", "val"_ostr, "558ED5"); @@ -1310,7 +1310,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val"_ostr, "35000"); // Make sure a:alpha is written for characters and fill color is a schemeClr. -sElement = "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/"; +sElement = "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/"_ostr; assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val"_ostr, "accent4"); assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val"_ostr, "75000"); assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val"_ostr, "2"); diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index fc1c1387d462..6e0efb341ae2 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -356,13 +356,13 @@ void ThemeExport::writeGradientFill(model::GradientFill const& rGradientFill) switch (rGradientFill.meGradientType) { case model::GradientType::Circle: -sPathType = "circle"; +sPathType = "circle"_ostr; break; case model::GradientType::Rectangle: -sPathType = "rect"; +sPathType = "rect"_ostr; break; case model::GradientType::Shape: -sPathType = "shape"; +sPathType = "shape"_ostr; break; default: break; @@ -385,166 +385,166 @@ void ThemeExport::writePatternFill(model::PatternFill const& rPatternFill) switch (rPatternFill.mePatternPreset) { case model::PatternPreset::Percent_5: -sPresetType = "pct5"; +sPresetType = "pct5"_ostr; break; case model::PatternPreset::Percent_10: -sPresetType = "pct10"; +sPresetType = "pct10"_ostr; break; case model::PatternPreset::Percent_20: -sPresetType = "pct20"; +sPresetType = "pct20"_ostr; break; case model::PatternPreset::Percent_25: -sPresetType = "pct25"; +sPresetType = "pct25"_ostr; break; case model::PatternPreset::Percent_30: -sPresetType = "pct30"; +sPresetType = "pct30"_ostr; break; case model::PatternPreset::Percent_40: -sPresetType = "pct40"; +sPresetType = "pct40"_ostr; break; case model::PatternPreset::Percent_50: -sPresetType = "pct50"; +sPresetType = "pct50"_ostr; break; case model::PatternPreset::Percent_60: -sPresetType = "pct60"; +sPresetType = "pct60"_ostr; break; case model::PatternPreset::Percent_70: -sPresetType = "pct70"; +sPresetType = "pct70"_ostr; break; case model::PatternPreset::Percent_75: -sPresetType = "pct75"; +sPresetType = "pct75"_ostr; break; case model::PatternPreset::Percent_80: -sPresetType = "pct80"; +sPresetType = "pct80"_ostr; break; case model::PatternPreset::Percent_90: -sPresetType = "pct90"; +sPresetType = "pct90"_ostr; break; case model::PatternPreset::Horizontal: -sPresetType = "horz"; +sPresetType = "horz"_ostr;
[Libreoffice-commits] core.git: oox/qa writerfilter/source
oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx |binary oox/qa/unit/wpc_drawing_canvas.cxx | 32 ++- writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|4 - 3 files changed, 33 insertions(+), 3 deletions(-) New commits: commit bf6350ef7f9856abc4d6a085bd2d2f95d6b0c84e Author: Regina Henschel AuthorDate: Mon Nov 27 02:22:29 2023 +0100 Commit: Regina Henschel CommitDate: Tue Nov 28 14:07:30 2023 +0100 tdf#158348 Treat wordprocessing canvas like group shape getFullWPGSupport() is always false for mrShapeContext in case of a shape on wordprocessing canvas in table cell. On the other hand we do not need the test, because a wordprocessing canvas only occurs in docx and thus the replacement group always has FullWPGSupport. Change-Id: I0e7a9cf1c1c91a893ad7411fda7607947f053e05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159979 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx b/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx new file mode 100644 index ..e8f2cf73d3d5 Binary files /dev/null and b/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx differ diff --git a/oox/qa/unit/wpc_drawing_canvas.cxx b/oox/qa/unit/wpc_drawing_canvas.cxx index 1d00123e14a1..d1fde534034c 100644 --- a/oox/qa/unit/wpc_drawing_canvas.cxx +++ b/oox/qa/unit/wpc_drawing_canvas.cxx @@ -20,9 +20,11 @@ #include #include #include +#include #include +#include +#include #include -#include #include using namespace ::com::sun::star; @@ -276,6 +278,34 @@ CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf158339_shape_text_in_group) CPPUNIT_ASSERT(xTextFrame.is()); CPPUNIT_ASSERT_EQUAL(OUString("Group"), xTextFrame->getText()->getString()); } + +CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf158348_shape_text_in_table_cell) +{ +// The document has a shape with text on a drawing canvas in a table cell. +// Without fix the text of the shape becomes part of the paragraph of the table cell. +loadFromURL(u"WPC_tdf158348_shape_text_in_table_cell.docx"); + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +// Get the shape and make sure it has text. +uno::Reference xCanvas(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShapeProps(xCanvas->getByIndex(1), uno::UNO_QUERY); +uno::Reference xTextFrame; +xShapeProps->getPropertyValue(u"TextBoxContent"_ustr) >>= xTextFrame; +CPPUNIT_ASSERT(xTextFrame.is()); +// The string was empty without fix. +CPPUNIT_ASSERT_EQUAL(u"Inside shape"_ustr, xTextFrame->getText()->getString()); + +// Get the table and make sure the cell has only its own text. +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTextTable( +xTablesSupplier->getTextTables()->getByName(u"Table1"_ustr), uno::UNO_QUERY); +uno::Reference xCellA1(xTextTable->getCellByName("A1"), uno::UNO_QUERY); +// The string had started with "Inside shape" without fix. +CPPUNIT_ASSERT(xCellA1->getString().startsWith("Inside table")); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 30ed3a70e63c..cbc75c14070a 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -1840,8 +1840,8 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element ) bool OOXMLFastContextHandlerShape::isDMLGroupShape() const { -return (mrShapeContext->getFullWPGSupport() - && (mrShapeContext->isWordProcessingGroupShape() || mrShapeContext->isWordprocessingCanvas())); +return (mrShapeContext->getFullWPGSupport() && mrShapeContext->isWordProcessingGroupShape()) +|| mrShapeContext->isWordprocessingCanvas(); }; void OOXMLFastContextHandlerShape::lcl_endFastElement
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/WPC_tdf158339_shape_text_in_group.docx |binary oox/qa/unit/wpc_drawing_canvas.cxx | 24 oox/source/shape/WordprocessingCanvasContext.cxx|6 +++- 3 files changed, 29 insertions(+), 1 deletion(-) New commits: commit 63ecd577f5fe95feda0d1d8577a7d3b493999d78 Author: Regina Henschel AuthorDate: Fri Nov 24 01:18:22 2023 +0100 Commit: Regina Henschel CommitDate: Fri Nov 24 15:15:41 2023 +0100 tdf#158339 setFullWPGSupport to group shape in wpc otherwise the group will create no wps shapes but draw shapes and those cannot be connected to text frames. The text frames were then located separate outside the drawing canvas instead of being bound to the shape. Change-Id: I525fac157c08c60d43ff9420775e2cbb9d891d23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159885 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/WPC_tdf158339_shape_text_in_group.docx b/oox/qa/unit/data/WPC_tdf158339_shape_text_in_group.docx new file mode 100644 index ..b34071cd99d2 Binary files /dev/null and b/oox/qa/unit/data/WPC_tdf158339_shape_text_in_group.docx differ diff --git a/oox/qa/unit/wpc_drawing_canvas.cxx b/oox/qa/unit/wpc_drawing_canvas.cxx index 0857eb8099cf..1d00123e14a1 100644 --- a/oox/qa/unit/wpc_drawing_canvas.cxx +++ b/oox/qa/unit/wpc_drawing_canvas.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -252,6 +253,29 @@ CPPUNIT_TEST_FIXTURE(TestWPC, WPC_Shadow) xShapeProps->getPropertyValue(UNO_NAME_SHADOWCOLOR) >>= nColor; CPPUNIT_ASSERT_EQUAL(Color(0x808080), nColor); } + +CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf158339_shape_text_in_group) +{ +// The document has a group of two shapes with text. This group is child of a drawing canvas. +// Without fix the text of the shapes were imported as separate text boxes. +loadFromURL(u"WPC_tdf158339_shape_text_in_group.docx"); + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +// Make sure there is only one object on that page. Without fix there were three objects. +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); +// Get the group which represents the drawing canvas and the group object inside. +uno::Reference xCanvas(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xGroup(xCanvas->getByIndex(1), uno::UNO_QUERY); +// Get the properties of the second shape inside the group +uno::Reference xShapeProps(xGroup->getByIndex(1), uno::UNO_QUERY); +// and make sure the shape has text. +uno::Reference xTextFrame; +xShapeProps->getPropertyValue(u"TextBoxContent"_ustr) >>= xTextFrame; +CPPUNIT_ASSERT(xTextFrame.is()); +CPPUNIT_ASSERT_EQUAL(OUString("Group"), xTextFrame->getText()->getString()); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/shape/WordprocessingCanvasContext.cxx b/oox/source/shape/WordprocessingCanvasContext.cxx index 7273a8d23ea6..9365e387f5e3 100644 --- a/oox/source/shape/WordprocessingCanvasContext.cxx +++ b/oox/source/shape/WordprocessingCanvasContext.cxx @@ -88,7 +88,11 @@ WordprocessingCanvasContext::onCreateContext(sal_Int32 nElementToken, << getBaseToken(nElementToken)); break; case XML_wgp: // CT_WordprocessingGroup -return new oox::shape::WpgContext(*this, mpShapePtr); +{ +rtl::Reference pWPGContext = new oox::shape::WpgContext(*this, mpShapePtr); +pWPGContext->setFullWPGSupport(m_bFullWPGSupport); +return pWPGContext; +} default: // includes case XML_contentPart // Word uses this for Ink, as for example. Thereby rId4 is
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/CryptoTest.cxx|6 oox/qa/unit/export.cxx| 677 +++--- oox/qa/unit/mcgr.cxx | 48 +- oox/source/crypto/AgileEngine.cxx |8 oox/source/export/ThemeExport.cxx | 28 - oox/source/export/shapes.cxx | 18 - 6 files changed, 396 insertions(+), 389 deletions(-) New commits: commit f53172a1141f7bb3c0950f1fe00800b633846ec4 Author: Stephan Bergmann AuthorDate: Sun Nov 19 18:27:38 2023 +0100 Commit: Stephan Bergmann CommitDate: Sun Nov 19 22:04:26 2023 +0100 Extended loplugin:ostr: oox Change-Id: Ic3ee80433571767dba9de1ecfb00d2d96beae4db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159690 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/oox/qa/unit/CryptoTest.cxx b/oox/qa/unit/CryptoTest.cxx index 290fce38eb4b..be04c928045e 100644 --- a/oox/qa/unit/CryptoTest.cxx +++ b/oox/qa/unit/CryptoTest.cxx @@ -74,7 +74,7 @@ CryptoTest::~CryptoTest() void CryptoTest::testCryptoHash() { // Check examples from Wikipedia (https://en.wikipedia.org/wiki/HMAC) -OString aContentString("The quick brown fox jumps over the lazy dog"); +OString aContentString("The quick brown fox jumps over the lazy dog"_ostr); std::vector aContent(aContentString.getStr(), aContentString.getStr() + aContentString.getLength()); std::vector aKey = { 'k', 'e', 'y' }; @@ -145,7 +145,7 @@ void CryptoTest::testStandard2007() SvMemoryStream aUnencryptedInput; SvMemoryStream aEncryptedStream; -OString aTestString = "1234567890ABCDEFG"; +OString aTestString = "1234567890ABCDEFG"_ostr; aUnencryptedInput.WriteBytes(aTestString.getStr(), aTestString.getLength() + 1); aUnencryptedInput.Seek(STREAM_SEEK_TO_BEGIN); @@ -418,7 +418,7 @@ void CryptoTest::testAgileEncryptingAndDecrypting() SvMemoryStream aEncryptionInfo; SvMemoryStream aEncryptedStream; -OString aTestString = "1234567890ABCDEFGH"; +OString aTestString = "1234567890ABCDEFGH"_ostr; { oox::crypto::AgileEngine aEngine; diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 75d89a07e970..91954daa7db7 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -37,14 +37,14 @@ CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) // to group instead of being relative to anchor. That was missing for polyline and // connector. // Polyline: Without fix it would have failed with expected: 0, actual: 1800360 -assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "x", "0"); +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "x"_ostr, "0"); // ... failed with expected: 509400, actual: 1229400 -assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "y", "509400"); +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, "509400"); // Connector: Without fix it would have failed with expected: 763200, actual: 2563560 -assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "x", "763200"); +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off"_ostr, "x"_ostr, "763200"); // ... failed with expected: 0, actual: 72 -assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "y", "0"); +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, "0"); // Polyline and connector were shifted 1800360EMU right, 72EMU down. } @@ -67,7 +67,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) // DrawingML::WriteShapeTransformation(), but was missing. // Without fix it would have failed with expected: 469440, actual: 92160 // The shape was about 1cm shifted up and partly outside its group. -assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "y", "469440"); +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, "469440"); } CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) @@ -84,11 +84,11 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) // Then make sure that the group shape, the group shape's child size and the child shape's size // match: xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); -assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:ext", "cx", "5328360"); +assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:ext"_ostr, "cx"_ostr, "5328360"); // Without the accompanying fix in place, this test would have failed, the element was // not written. -assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:chExt", "cx", "5328360"); -assertXPath(pXmlDoc, "//wps:spPr/a:xfrm/a:ext", "cx", "5328360"); +assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:chExt"_ostr, "cx"_ostr, "5328360"); +assertXPath(pXmlDoc, "//wps:spPr/a:xfrm/a:ext"_ostr, "cx"_ostr, "5328360"); } CPPUNIT_TEST_FIXTURE(Test,
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/wpc_drawing_canvas.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 6527c4f75f574105f61561d629f2c8d051483d65 Author: Andrea Gelmini AuthorDate: Wed Nov 15 12:50:00 2023 +0100 Commit: Julien Nabet CommitDate: Wed Nov 15 23:49:49 2023 +0100 Fix typo Change-Id: Ifc1b536a003194de5271b348c363bf4bd9b9a9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159437 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/wpc_drawing_canvas.cxx b/oox/qa/unit/wpc_drawing_canvas.cxx index a141776c9d6d..0857eb8099cf 100644 --- a/oox/qa/unit/wpc_drawing_canvas.cxx +++ b/oox/qa/unit/wpc_drawing_canvas.cxx @@ -132,7 +132,7 @@ CPPUNIT_TEST_FIXTURE(TestWPC, WPC_Glow) CPPUNIT_TEST_FIXTURE(TestWPC, WPC_BentConnector) { -// The document has two shapes connected with a bentConnecor on a drawing canvas. +// The document has two shapes connected with a bentConnector on a drawing canvas. loadFromURL(u"WPC_BentConnector.docx"); // VML has no information about the target shapes of the connector. The connector was imported as @@ -214,7 +214,7 @@ CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf104671_Cloud) // The document has 'cloud' shape on a drawing canvas. loadFromURL(u"WPC_tdf104671_Cloud.docx"); -// MS Office writes the 'cloud' shape without type to the VML fallback. Thus the VML import uses +// MS Office writes the 'cloud' shape without type to the VML fallback. Thus the VLM import uses // ClosedBezierShape with several closed polygons. That produces holes because of the even-odd // rule, and inner lines. The fix uses the mc:Choice alternative which provides the type for a // custom shape.
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/wpc_drawing_canvas.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e562fc75dcf1582ea2201ae91e9c5ac3c99848a7 Author: Andrea Gelmini AuthorDate: Wed Nov 15 12:53:17 2023 +0100 Commit: Julien Nabet CommitDate: Wed Nov 15 23:48:09 2023 +0100 Fix typo Change-Id: I912f5e5a035d00e7640d489b1ff1c7a3c0315b9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159442 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/wpc_drawing_canvas.cxx b/oox/qa/unit/wpc_drawing_canvas.cxx index 7e1af1273d1e..a141776c9d6d 100644 --- a/oox/qa/unit/wpc_drawing_canvas.cxx +++ b/oox/qa/unit/wpc_drawing_canvas.cxx @@ -214,7 +214,7 @@ CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf104671_Cloud) // The document has 'cloud' shape on a drawing canvas. loadFromURL(u"WPC_tdf104671_Cloud.docx"); -// MS Office writes the 'cloud' shape without type to the VML fallback. Thus the VLM import uses +// MS Office writes the 'cloud' shape without type to the VML fallback. Thus the VML import uses // ClosedBezierShape with several closed polygons. That produces holes because of the even-odd // rule, and inner lines. The fix uses the mc:Choice alternative which provides the type for a // custom shape.
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/shape.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 3d0a8020f932c0e39a69e555ca4cc4ba7084d2cd Author: khushishikhu AuthorDate: Fri Oct 13 18:03:34 2023 +0530 Commit: Ilmari Lauhakangas CommitDate: Sat Oct 14 08:29:55 2023 +0200 tdf#141908 change sal_Int32 to Color Change-Id: I0f9b0bd18fd90c05de67525222be41ef6cd8723c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157935 Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 5033ed660e30..54ea52cce19c 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -309,12 +309,12 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf54095_SmartArtThemeTextColor) uno::UNO_QUERY); uno::Reference xPortion(xPara->createEnumeration()->nextElement(), uno::UNO_QUERY); -sal_Int32 nActualColor{ 0 }; +Color nActualColor{ 0 }; xPortion->getPropertyValue("CharColor") >>= nActualColor; // Without fix the test would have failed with: -// - Expected: 2050429 (0x1F497D) -// - Actual : 16777215 (0xFF), that is text was white -CPPUNIT_ASSERT_EQUAL(sal_Int32(0x1F497D), nActualColor); +// - Expected: rgba[1f497dff] +// - Actual : rgba[], that is text was white +CPPUNIT_ASSERT_EQUAL(Color(0x1F497D), nActualColor); // clrScheme. For map between name in docx and index from CharComplexColor see // oox::drawingml::Color::getSchemeColorIndex()
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf156902_GlowOnGroup.docx |binary oox/qa/unit/shape.cxx | 12 oox/source/drawingml/shape.cxx |3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit e84ae94270f0f0037fa2662a5f2765b37a50c33e Author: Regina Henschel AuthorDate: Sat Oct 7 17:37:46 2023 +0200 Commit: Regina Henschel CommitDate: Sat Oct 7 21:52:48 2023 +0200 tdf#156902 Do not set glow on group shape in import Currently a group is not able to use glow. But in MS Office it is possible. When we try to set glow at the group, we produce an exception and no children are imported. So for now the patch prevents setting glow. Change-Id: Ifa7245ebf3c38f8685239c2b62eefccd35aab870 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157679 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf156902_GlowOnGroup.docx b/oox/qa/unit/data/tdf156902_GlowOnGroup.docx new file mode 100644 index ..0c176eefa025 Binary files /dev/null and b/oox/qa/unit/data/tdf156902_GlowOnGroup.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 565ac39b52ad..5033ed660e30 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -817,6 +817,18 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWordArtDefaultColor) CPPUNIT_ASSERT_EQUAL(uno::Any(Color(3, 74, 144)), xShapeProps->getPropertyValue(u"FillColor"_ustr)); } + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testGlowOnGroup) +{ +// The document contains a group of two shapes. A glow-effect is set on the group. +// Without the fix, the children of the group were not imported at all. +loadFromURL(u"tdf156902_GlowOnGroup.docx"); +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroup->getCount()); +} CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 03a22dc441b4..f48b4d856a4a 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1914,7 +1914,8 @@ Reference< XShape > const & Shape::createAndInsert( } // Set glow effect properties -if ( aEffectProperties.maGlow.moGlowRad.has_value() ) +if (aEffectProperties.maGlow.moGlowRad.has_value() +&& aServiceName != "com.sun.star.drawing.GroupShape") { uno::Reference propertySet (mxShape, uno::UNO_QUERY); propertySet->setPropertyValue("GlowEffectRadius", Any(convertEmuToHmm(aEffectProperties.maGlow.moGlowRad.value(;
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf157289_circularArrow_export.fodp | 816 +++ oox/qa/unit/export.cxx | 14 oox/source/export/drawingml.cxx |4 3 files changed, 832 insertions(+), 2 deletions(-) New commits: commit 10c7bc0c824697b92c22bddacd739de9127dc80e Author: Regina Henschel AuthorDate: Tue Oct 3 21:16:59 2023 +0200 Commit: Regina Henschel CommitDate: Wed Oct 4 09:56:18 2023 +0200 tdf#157289 normalize ellipse bounding box in oox export The predefined geometry of a circular arrow shape has bottom-right vertex first and then top-left vertex of the bounding box of the ellipse. We now use the normalized rectangle to calculate the radii of the ellipse. Before this patch the calculation had resulted in negative radii. Because the ODF standard only states, '(x1, y1) and (x2, y2) define the bounding box of an ellipse.', but not which vertices to use, the fix is not made in changing the geometry of the circular arrow. Instead the export is changed to use the normalized rectangle. That is more general and will cover other shape types too. Especially non-primivite shapes might use other vertices than top-left and bottom-right to determine the ellipse. Change-Id: Ica859c9adc508a6517e30f111cd54518ec9929a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157526 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf157289_circularArrow_export.fodp b/oox/qa/unit/data/tdf157289_circularArrow_export.fodp new file mode 100644 index ..5a60c12f0d51 --- /dev/null +++ b/oox/qa/unit/data/tdf157289_circularArrow_export.fodp @@ -0,0 +1,816 @@ + + +http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns :css3t="http://www.w3.org/TR/css3-text/; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.presentation"> + Regina Henschel2023-10-03T19:35:53.891002023-10-03T19:51:14.40300Regina HenschelPT8M25S2LODev_27_Sep/24.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/2902ab24ecc5ffbf4907ea83b2028508b9de6364 + + + -7708 + -7628 + 25739 + 15092 + + + view1 + false + false + false + true + true + true + false + true + true + 1500 + false + Hw== + Hw== + + false + true + true + 0 + 0 + false + true + true + 4 + 0 + -7708 + -7628 + 42774 + 31152 + 1000 + 1000 + 200 + 200 + 1000 + 5 + 1000 + 5 + false + 1500 + false + false + false + false + false + + + + + true + 1250 + EPSON6FC99C (WP-4025 Series) +
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/mcgr.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 424e537b9f02aadef60c9b0c29f27503f7d7d51a Author: Andrea Gelmini AuthorDate: Mon Jun 26 14:50:01 2023 +0200 Commit: Julien Nabet CommitDate: Mon Jun 26 15:45:14 2023 +0200 Fix typo Change-Id: Ic071259d68e0fa9d7a2541e32d30c11bb0f21d2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153612 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/mcgr.cxx b/oox/qa/unit/mcgr.cxx index cc9efa6bc4ba..1fb06bb3f1f1 100644 --- a/oox/qa/unit/mcgr.cxx +++ b/oox/qa/unit/mcgr.cxx @@ -86,7 +86,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount) xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); // Without the fix the colors in the sections were wrong. And when opening a file with StepCount -// and saving it immedialtly to pptx, a continues gradient might be produced. +// and saving it immediately to pptx, a continuous gradient might be produced. const OString sPath = "//a:gradFill/a:gsLst/"; // The default way of load and save would have produced 2 stops, but we need start stop, end stop
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf155827_MCGR_AxialColorLinearTrans.fodp | 644 + oox/qa/unit/mcgr.cxx | 27 oox/source/export/drawingml.cxx| 75 - 3 files changed, 702 insertions(+), 44 deletions(-) New commits: commit b08ceed6e82e58089e58d15e5ac694b8517349be Author: Regina Henschel AuthorDate: Fri Jun 16 22:12:39 2023 +0200 Commit: Regina Henschel CommitDate: Tue Jun 20 11:29:41 2023 +0200 tdf#155827 MCGR: Axial to linear in oox export, apply... ... separately for color and transparency gradient. The current solution had the change from axial to linear applied to color and transparency gradient at the same time. That resulted in wrong gradient if only one of them was axial. Because changing axial to linear changes the number of stops, it has to be applied before color and transparency gradients are synchronized. As now color and transparency are both linear already after they are synchronized, the switch can be replaced with a simple if. Change-Id: I75e6b495782bc8a9fe94504426efadec2f60b61f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153197 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf155827_MCGR_AxialColorLinearTrans.fodp b/oox/qa/unit/data/tdf155827_MCGR_AxialColorLinearTrans.fodp new file mode 100644 index ..f55669998068 --- /dev/null +++ b/oox/qa/unit/data/tdf155827_MCGR_AxialColorLinearTrans.fodp @@ -0,0 +1,644 @@ + + +http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns :css3t="http://www.w3.org/TR/css3-text/; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.presentation"> + 2023-06-16T14:29:43.2850024x16impressPT33M34S4LODev_13_Jun/24.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/d4ee93a54e790acab470667591d61d424831e665Regina Henschel2023-06-16T15:25:09.01600Regina Henschel + + + -235 + -6182 + 36454 + 16497 + + + view1 + false + false + true + true + true + true + false + false + true + 1500 + false + Hw== + Hw== + + false + true + false + 0 + 0 + false + true + true + 4 + 0 + -235 + -6182 + 36455 + 16498 + 2000 + 2000 + 500 + 500 + 2000 + 4 + 2000 + 4 + false + 1500 + true + false + true + false + false + + + + + true + 1250 + EPSON6FC99C (WP-4025 Series) + + + de + DE + + + + + +
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf155412_typeface.pptx |binary oox/qa/unit/export.cxx | 16 oox/source/export/ThemeExport.cxx|3 +++ 3 files changed, 19 insertions(+) New commits: commit 58926cc60c7868785c8db126fc199f6731269b86 Author: Regina Henschel AuthorDate: Sat May 20 19:26:26 2023 +0200 Commit: Regina Henschel CommitDate: Sun May 21 13:48:47 2023 +0200 tdf#155412 ooxml export typeface attribute is mandatory The attribute 'typeface' is required for , and elements, see CT_TextFont in ISO/IEC 29500-1:2016. Its value may be the empty string. Change-Id: I7c9316fa40ad6d1aabccb4191fee11be553c453b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152024 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf155412_typeface.pptx b/oox/qa/unit/data/tdf155412_typeface.pptx new file mode 100644 index ..30a486e70fff Binary files /dev/null and b/oox/qa/unit/data/tdf155412_typeface.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 6992f6378a76..8a17f352716b 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1316,6 +1316,22 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", "75000"); assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", "2"); } + +CPPUNIT_TEST_FIXTURE(Test, testThemeFontTypeface) +{ +// Saving the document had produced a file which PowerPoint wants to repair. The mandatory +// attribute 'typeface' was missing in the elements. + +loadFromURL(u"tdf155412_typeface.pptx"); + +save("Impress Office Open XML"); +xmlDocUniquePtr pXmlDoc = parseExport("ppt/theme/theme1.xml"); + +// Make sure typeface is written. +OString sElement = "/a:theme/a:themeElements/a:fontScheme/"; +assertXPath(pXmlDoc, sElement + "a:majorFont/a:ea", "typeface", ""); +assertXPath(pXmlDoc, sElement + "a:minorFont/a:ea", "typeface", ""); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index 511647ee1fc3..f09f9012e246 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -81,7 +81,10 @@ void fillAttrList(rtl::Reference const& pAttr model::ThemeFont const& rThemeFont) { if (rThemeFont.maTypeface.isEmpty()) +{ +pAttrList->add(XML_typeface, ""); // 'typeface' attribute is mandatory return; +} pAttrList->add(XML_typeface, rThemeFont.maTypeface);
[Libreoffice-commits] core.git: oox/qa
dev/null |binary oox/qa/unit/data/ReferenceShapeFill.fodp | 838 + oox/qa/unit/data/tdf51195_Fontwork_ThemeColor.fodt | 475 +++ oox/qa/unit/data/tdf51195_Fontwork_axialGradient.fodt | 462 +++ oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.fodt | 728 +++ oox/qa/unit/data/tdf51195_Fontwork_linearGradient.fodt | 416 ++ oox/qa/unit/data/tdf51195_Fontwork_radialGradient.fodt | 395 ++ oox/qa/unit/data/tdf51195_Fontwork_rectGradient.fodt | 493 +++ oox/qa/unit/data/tdf51195_Fontwork_squareGradient.fodt | 488 +++ oox/qa/unit/export.cxx | 16 10 files changed, 4303 insertions(+), 8 deletions(-) New commits: commit f0dbebc76b819adebf228fbdb0f25a6ee14187c9 Author: Tomaž Vajngerl AuthorDate: Sun May 21 18:09:12 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Sun May 21 13:00:39 2023 +0200 oox: convert odp documents to fodp so it is easiert to change Mainly to change the non yet fixed theme ODF format. Change-Id: Iad51de7b4f9a721e566fe12266e633534c15bb54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152052 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/oox/qa/unit/data/ReferenceShapeFill.fodp b/oox/qa/unit/data/ReferenceShapeFill.fodp new file mode 100644 index ..6d406c32 --- /dev/null +++ b/oox/qa/unit/data/ReferenceShapeFill.fodp @@ -0,0 +1,838 @@ + + +http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://ope noffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office; xmlns:table="urn:oasis:names:tc:opendocument:x mlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.presentation"> + PowerPoint Presentationquikeequikee12023-01-01T23:48:392023-01-01T23:48:54P0DLibreOfficeDev/7.6.0.0.alpha1$Linux_X86_64 LibreOffice_project/d7984b1f13530624080dca2068c2cfa08d5341fa16.Widescreen1 + + + -2187 + -513 + 34909 + 23435 + + + view1 + false + false + true + true + true + true + false + false + true + 1500 + false + Hw== + Hw== + + false + true + false + 0 + 0 + false + true + true + 4 + 0 + -2703 + -512 + 34880 + 24439 + 2000 + 2000 + 500 + 500 + 2000 + 4 + 2000 + 4 + false + 1500 + true + false + true + false + false + + + + + 6 + false + false + false + false + false + 0 + false + false + true + true + true + true + false + true + $(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soe + true + true +
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf155327_WordArtDefaultColor.pptx |binary oox/qa/unit/shape.cxx | 17 + oox/source/drawingml/shape.cxx |5 + 3 files changed, 22 insertions(+) New commits: commit 04ae198019cf2c6593023f9ef630e4e99f65defe Author: Regina Henschel AuthorDate: Tue May 16 20:46:28 2023 +0200 Commit: Regina Henschel CommitDate: Tue May 16 21:57:28 2023 +0200 tdf#155327 Detect default color in WordArt It is possible to not set the character color explicitely in a WordArt shape. In such case MS Office uses the scheme color 'tx1' from current active scheme. The import of the character properties does not set this color in the fill properties. The patch adds it, when the character fill properties are converted to shape fill properties. Change-Id: Ic72fd9f55bac1e2874cbf701ffa692ca4fbc9435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151851 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf155327_WordArtDefaultColor.pptx b/oox/qa/unit/data/tdf155327_WordArtDefaultColor.pptx new file mode 100644 index ..a813f4a329a6 Binary files /dev/null and b/oox/qa/unit/data/tdf155327_WordArtDefaultColor.pptx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 722d7d6d644b..68ce372335df 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -795,6 +795,23 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWordArtBitmapFill) CPPUNIT_ASSERT_EQUAL(sal_Int32(1592), aSize100thMM.Width); CPPUNIT_ASSERT_EQUAL(sal_Int32(1592), aSize100thMM.Height); } + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWordArtDefaultColor) +{ +// The document has a WordArt shape for which the text color is not explicitly set. In such cases +// MS Office uses the scheme color 'tx1'. Without fix it was imported as 'fill none'. The shape +// existed but was not visible on screen. +loadFromURL(u"tdf155327_WordArtDefaultColor.pptx"); + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShapeProps(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(drawing::FillStyle_SOLID), + xShapeProps->getPropertyValue(u"FillStyle")); + +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(3, 74, 144)), xShapeProps->getPropertyValue(u"FillColor")); +} CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 69f3bf5a4d60..9417551b0f86 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -728,7 +728,12 @@ static void lcl_copyCharPropsToShape(const uno::Reference& xSha // Fill // ToDo: Replace flip and rotate constants in parameters with actual values. +// tdf#155327 If color is not explicitly set, MS Office uses scheme color 'tx1'. oox::drawingml::ShapePropertyMap aFillShapeProps(rFilter.getModelObjectHelper()); +if (!rCharProps.maFillProperties.moFillType.has_value()) +rCharProps.maFillProperties.moFillType = XML_solidFill; +if (!rCharProps.maFillProperties.maFillColor.isUsed()) +rCharProps.maFillProperties.maFillColor.setSchemeClr(XML_tx1); rCharProps.maFillProperties.pushToPropMap(aFillShapeProps, rFilter.getGraphicHelper(), /*nShapeRotation*/ 0, /*nPhClr*/ API_RGB_TRANSPARENT,
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/drawingml.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit 2f48aae12ae949056654cb172873f4025104af67 Author: Tomaž Vajngerl AuthorDate: Mon Apr 24 22:50:02 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Apr 25 04:22:59 2023 +0200 oox: Harden the testTdf142605_CurveSize Test with extra checks Even if it is likely that we fail, it's important that we check that we are checking thr correct shape and not some other shape. As there is only one shape we could assume that in the case that something goes wrong and we wouldn't be able to read the shape, we would end up with 0 shapes, but in case of an empty page we inject placeholder shapes into the page, so we end up comparing the size of a placeholder shape. In this case the test assert gets confusing as we obviously get wrong sizes, which suggest that something is wrong with the shape and not that the shape we expect to assert against is missing and we compare against a different (placeholder) shape. This adds more asserts, which make sure we actually have the expected shape first and also preven crashes if something would go wrong. Change-Id: I435f87d7e634c5135a376ad084373f8d5053555e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150942 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index c468fd126584..09ab7121d8c8 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -327,10 +327,16 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf142605_CurveSize) saveAndReload("Impress Office Open XML"); uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); -uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), - uno::UNO_QUERY); +auto xPage = xDrawPagesSupplier->getDrawPages()->getByIndex(0); +uno::Reference xDrawPage(xPage, uno::UNO_QUERY); uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT(xShape.is()); uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +CPPUNIT_ASSERT(xShapeProps.is()); +uno::Reference xShapeNamed(xShape, uno::UNO_QUERY); +CPPUNIT_ASSERT(xShapeNamed.is()); +CPPUNIT_ASSERT_EQUAL(OUString(u"Bézier curve 1"), xShapeNamed->getName()); + css::awt::Rectangle aBoundRect; xShapeProps->getPropertyValue("BoundRect") >>= aBoundRect; // Without fix, size was 6262 x 3509, and position was 10037|6790.
[Libreoffice-commits] core.git: oox/qa oox/source sd/qa
oox/qa/unit/data/tdf139618_ImportWordArtGradient.pptx |binary oox/qa/unit/data/tdf139618_ThemeColorTransparency.pptx |binary oox/qa/unit/data/tdf139618_WordArtBitmapFill.pptx |binary oox/qa/unit/export.cxx | 26 +++ oox/qa/unit/shape.cxx | 130 oox/source/drawingml/shape.cxx | 43 +++-- oox/source/drawingml/textcharacterpropertiescontext.cxx |1 oox/source/export/drawingml.cxx | 12 + sd/qa/unit/export-tests-ooxml3.cxx |5 9 files changed, 199 insertions(+), 18 deletions(-) New commits: commit 260735ff98631b94ae8737cf1cead3e20bade618 Author: Regina Henschel AuthorDate: Sat Mar 11 18:39:06 2023 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 14 07:40:00 2023 + tdf#139618 Add WordArt fill types in pptx import This fix uses a similar approach as in WpsContext::onEndElement, only that here moTextOutlineProperties and maFillProperties are still available whereas in WpsContext the properties need to be collected from CharInteropGrabBag. I have adapted unit test testTdf125573_FontworkScaleX because now the gradient is imported, see comment in former version of the test. Change-Id: I989ee475867c97b9f93c7e65cd25483611eec7bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148687 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/data/tdf139618_ImportWordArtGradient.pptx b/oox/qa/unit/data/tdf139618_ImportWordArtGradient.pptx new file mode 100644 index ..8fd4bcc181f0 Binary files /dev/null and b/oox/qa/unit/data/tdf139618_ImportWordArtGradient.pptx differ diff --git a/oox/qa/unit/data/tdf139618_ThemeColorTransparency.pptx b/oox/qa/unit/data/tdf139618_ThemeColorTransparency.pptx new file mode 100644 index ..405135783e16 Binary files /dev/null and b/oox/qa/unit/data/tdf139618_ThemeColorTransparency.pptx differ diff --git a/oox/qa/unit/data/tdf139618_WordArtBitmapFill.pptx b/oox/qa/unit/data/tdf139618_WordArtBitmapFill.pptx new file mode 100644 index ..5da52ceb3c15 Binary files /dev/null and b/oox/qa/unit/data/tdf139618_WordArtBitmapFill.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 0e2a2669ee79..a98eaa5ce93f 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1297,6 +1297,32 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkRectGradient) assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:lumOff", "val", "6"); assertXPath(pXmlDoc, sElement + "w14:gs[3]/w14:schemeClr/w14:alpha", "val", "7"); } + +CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) +{ +// The document has first a Fontwork shape with solid fill theme color with transparency and +// outline transparency and second a textbox with character transparency. +// Without fix the transparency was not written to file. +loadFromURL(u"tdf139618_ThemeColorTransparency.pptx"); + +save("Impress Office Open XML"); +xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); + +// Make sure a:alpha is written for line color and for fill color. +// Make sure fill color is a schemeClr. +OString sElement = "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/"; +assertXPath(pXmlDoc, sElement + "a:ln/a:solidFill/a:srgbClr/a:alpha", "val", "25000"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val", "accent1"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", "6"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumOff", "val", "4"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", "35000"); + +// Make sure a:alpha is written for characters and fill color is a schemeClr. +sElement = "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/"; +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr", "val", "accent4"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:lumMod", "val", "75000"); +assertXPath(pXmlDoc, sElement + "a:solidFill/a:schemeClr/a:alpha", "val", "2"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index b5a3fe8b1113..523003ee351a 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -16,7 +16,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -585,6 +588,133 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontworkDarkenTransparency) CPPUNIT_ASSERT_EQUAL(uno::Any(Color(208, 175, 114)), xShapeProps->getPropertyValue(u"FillColor")); } + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) +{ +
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/export.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8013fce4c98e0e85e3fbc7d435d49217cf188258 Author: Andrea Gelmini AuthorDate: Thu Mar 9 13:57:03 2023 +0100 Commit: Julien Nabet CommitDate: Sat Mar 11 05:34:10 2023 + Fix typo Change-Id: I37f1f41b93f1ec2a428e71fbbaa64437214d565e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148542 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 5a90126bfbe1..0e2a2669ee79 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1065,7 +1065,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkLinGradientRGBColor) CPPUNIT_TEST_FIXTURE(Test, testFontworkAxialGradientTransparency) { -// The document has a Fontwork shape with UI settings: solid fill theme color Accen3 25% darker, +// The document has a Fontwork shape with UI settings: solid fill theme color Accent3 25% darker, // Transparency gradient Type Axial with Angle 160deg, Transition start 40%, // Start value 5%, End value 90% // Without fix the gradient was not exported at all.
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf51195_Fontwork_axialGradient.odt |binary oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.odt |binary oox/qa/unit/data/tdf51195_Fontwork_linearGradient.odt |binary oox/qa/unit/data/tdf51195_Fontwork_radialGradient.odt |binary oox/qa/unit/data/tdf51195_Fontwork_rectGradient.odt |binary oox/qa/unit/data/tdf51195_Fontwork_squareGradient.odt |binary oox/qa/unit/export.cxx| 282 + oox/source/drawingml/fontworkhelpers.cxx | 434 +- 8 files changed, 704 insertions(+), 12 deletions(-) New commits: commit d95a09c1fca70d658207b8c48761af32dd2df213 Author: Regina Henschel AuthorDate: Mon Mar 6 16:45:35 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Mar 9 08:25:51 2023 + tdf#51195 add docx export of gradient fill of Fontwork shapes FillGradient, which is a awt::Gradient, has many features which cannot be represented in the element in docx. Therefore often only workarounds are possible. ELLIPTICAL and RADIAL are exported to 'circle', SQUARE and RECT to 'rect'. 'Angle' is ignored. A focus point is used instead of a focus line. LINEAR and AXIAL are exported to 'lin'. AXIAL is done be compress and mirroring the color stops. Using Words feature of reflecting a gradient would prevent detecting 'axial' in the current import filter. 'Border' is exported by introducing additional color stops. 'StepCount' is ignored. A workaround using additional color stops is possible, but would require a simultaneous change of the import filter. 'StartIntensity' and 'EndIntensity' are exported as 'lumMod'. Theme colors are considered where they can currently occur. But tdf#151882 is yet not fixed, so Word will not render them because of missing Theme folder. To allow 'lumMod' and theme color and RGB color as well, the color of a color stop is hold in a struct. In case of two color stops, the color stop at position 0% is doubled. That way Word uses the same linear color transition as LO and not its quadratic one. AXIAL too introduces two color stops at position 50%. Emulating 'StepCount' would produce two color stops at same position too. Therefore a std::multimap is used for the color stops. The implementation has a lot local parts. If they should be useful for Fontwork shapes in Impress/Draw, they can be moved and adapted later. The implementation separates the calculation of the required color stops from the generation of the markup, so using parts in Impress/Draw is likely possible. Change-Id: I1032ab8d37b6f112d66f85a30210ebda3ae54486 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148354 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.odt new file mode 100644 index ..99fe4d8a49da Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_axialGradient.odt differ diff --git a/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.odt new file mode 100644 index ..c036e13953c6 Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_ellipticalGradient.odt differ diff --git a/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.odt new file mode 100644 index ..bc821db884d9 Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_linearGradient.odt differ diff --git a/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.odt new file mode 100644 index ..746b60b4d31d Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_radialGradient.odt differ diff --git a/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.odt new file mode 100644 index ..d4daee9632d6 Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_rectGradient.odt differ diff --git a/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.odt b/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.odt new file mode 100644 index ..86e71ba6ae41 Binary files /dev/null and b/oox/qa/unit/data/tdf51195_Fontwork_squareGradient.odt differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 645ffe386dd1..5a90126bfbe1 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1015,6 +1015,288 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkDistance) "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", { { "lIns", "0" }, { "rIns", "0" }, { "tIns", "0" }, { "bIns", "0" } }); } + +CPPUNIT_TEST_FIXTURE(Test, testFontworkLinGradientRGBColor) +{ +// The document has a
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/drawingml.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit df28c5ac2d4883706556772462933f70151fa379 Author: Vinit Agarwal AuthorDate: Mon Mar 6 13:22:10 2023 +0530 Commit: Xisco Fauli CommitDate: Wed Mar 8 08:34:49 2023 + tdf#141908 - CppUnittests: replace usage of sal_Int32 with colors modified: oox/qa/unit/drawingml.cxx Line number 168 Changed from sal_Int32 to Color which was declared on Line 162 Line number 290 Changed from sal_Int32 to Color which was declared on Line 288 Change-Id: If19b31c54639f1796d5e6375350bec91ec3f79d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148296 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 3355b66e79f6..994006e76113 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -159,13 +159,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testChartDataLabelCharColor) xDataPoint->getPropertyValue("CustomLabelFields") >>= aLabels; uno::Reference xLabel = aLabels[0]; -sal_Int32 nCharColor = 0; +Color nCharColor; xLabel->getPropertyValue("CharColor") >>= nCharColor; // Without the accompanying fix in place, this test would have failed with: // - Expected: 16777215 // - Actual : -1 // i.e. the data label had no explicit (white) color. -CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nCharColor); +CPPUNIT_ASSERT_EQUAL(COL_WHITE, nCharColor); } CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency) @@ -285,9 +285,9 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); CPPUNIT_ASSERT(bShadow); -sal_Int32 nColor = 0; +Color nColor; CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); -CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nColor); +CPPUNIT_ASSERT_EQUAL(Color(0xff), nColor); }; loadFromURL(u"table-shadow.pptx"); // Without the accompanying fix in place, this test would have failed, because shadow on a table
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf153246_VML_export_Fontwork_Adjustment.odt |binary oox/qa/unit/export.cxx| 27 ++ oox/source/export/vmlexport.cxx | 26 + 3 files changed, 53 insertions(+) New commits: commit a834bbad8295cba0ca88a91a524aad48640271ec Author: Regina Henschel AuthorDate: Thu Feb 2 23:24:01 2023 +0100 Commit: Regina Henschel CommitDate: Fri Feb 3 01:17:48 2023 + tdf#153246 VML export write adj attribute for Fontwork The fix for tdf#153296 has introduced correct shapetype markup for Fontwork shapes so that handles are moveable in Word. But the actual adjustment value of the handle was not exported. This patch adds the missing 'adj' attribute to the element. The fix is restricted to the preset Fontwork types because for other shapetypes the VML export is not yet suitable in regard to handles. Change-Id: I7ecda9e63d50ab7d8c1fda3e09f7383546ddaf5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146537 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf153246_VML_export_Fontwork_Adjustment.odt b/oox/qa/unit/data/tdf153246_VML_export_Fontwork_Adjustment.odt new file mode 100644 index ..1a26191821cf Binary files /dev/null and b/oox/qa/unit/data/tdf153246_VML_export_Fontwork_Adjustment.odt differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 64c97b56a24d..50c953135623 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -883,6 +883,33 @@ CPPUNIT_TEST_FIXTURE(Test, testVMLFontworkArchUp) // ..., but a element with subelement assertXPath(pXmlDoc, "//v:shapetype/v:textpath", 1); } + +CPPUNIT_TEST_FIXTURE(Test, testVMLAdjustmentExport) +{ +// The document has a Fontwork shape type 'textCirclePour' (150). When exporting to docx, the +// adjustment values were not exported at all. +loadFromURL(u"tdf153246_VML_export_Fontwork_Adjustment.odt"); + +// FIXME: tdf#153183 validation error in OOXML export: Errors: 1 +// Attribute 'ID' is not allowed to appear in element 'v:shape'. +skipValidation(); + +// Save to DOCX: +save("Office Open XML Text"); + +// Examine the saved markup. +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + +// Make sure an "adj" attribute exists +assertXPath(pXmlDoc, "//v:shape[@adj]", 1); +// ... and has the correct values +OUString sAdjustments = getXPath(pXmlDoc, "//v:shape", "adj"); +sal_Int32 nTokenStart = 0; +OUString sAngle = sAdjustments.getToken(0, ',', nTokenStart); +CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(-7341733), sAngle.toInt32(), 2); +OUString sRadius = sAdjustments.copy(nTokenStart); +CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(5296), sRadius.toInt32(), 2); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 82d92536b226..3a7fb417f2fc 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -1010,6 +1010,32 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& bAlreadyWritten[ESCHER_Prop_gtextFont] = true; } break; +case DFF_Prop_adjustValue: +case DFF_Prop_adjust2Value: +{ +// FIXME: tdf#153296: The currently exported markup for is based on +// OOXML presets and unusable in regard to handles. Fontwork shapes use dedicated +// own markup, see FontworkHelpers::GetVMLFontworkShapetypeMarkup. +// Thus this is restricted to preset Fontwork shapes. Such have maximal two +// adjustment values. +if ((mso_sptTextSimple <= m_nShapeType && m_nShapeType <= mso_sptTextOnRing) +|| (mso_sptTextPlainText <= m_nShapeType && m_nShapeType <= mso_sptTextCanDown)) +{ +sal_uInt32 nValue; +OString sAdj; +if (rProps.GetOpt(DFF_Prop_adjustValue, nValue)) +{ +sAdj = OString::number(static_cast(nValue)); +if (rProps.GetOpt(DFF_Prop_adjust2Value, nValue)) +sAdj += "," + OString::number(static_cast(nValue)); +} +if (!sAdj.isEmpty()) +m_pShapeAttrList->add(XML_adj, sAdj); +bAlreadyWritten[DFF_Prop_adjustValue] = true; +bAlreadyWritten[DFF_Prop_adjust2Value] = true; +} +} +break; case ESCHER_Prop_Rotation: { // The higher half of the variable contains the angle.
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf153258_VML_import_WordArt_detection.docx |binary oox/qa/unit/vml.cxx | 18 +++ oox/source/vml/vmlshape.cxx |7 ++-- 3 files changed, 22 insertions(+), 3 deletions(-) New commits: commit 2598f40521c6a8dee6d59ca41c3e58e65a98b17f Author: Regina Henschel AuthorDate: Thu Feb 2 15:22:52 2023 +0100 Commit: Regina Henschel CommitDate: Thu Feb 2 16:53:49 2023 + tdf#153258 VML import improve WordArt detection There exists WordArt types whose internal name do not start with 'fontwork', e.g. mso_sptTextDeflateInflateDeflate has 'mso-spt167'. The fix uses the MSO_SPT enum directly. Change-Id: Idb32b3ef9957bef5d948e1d86507d71fef006e91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146503 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf153258_VML_import_WordArt_detection.docx b/oox/qa/unit/data/tdf153258_VML_import_WordArt_detection.docx new file mode 100644 index ..15944490e9ed Binary files /dev/null and b/oox/qa/unit/data/tdf153258_VML_import_WordArt_detection.docx differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index be99a281af04..c46475efe418 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -224,6 +224,24 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWriterFontworkTrimTrue) CPPUNIT_ASSERT_DOUBLES_EQUAL(4999, aSize.Height, 2); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testVMLDetectWordArtOnImport) +{ +// The document contains a WordArt shape with type other than "fontwork-foo". Error was that +// WordArt was not detected and thus shrinking shape to text content was not prevented. +loadFromURL(u"tdf153258_VML_import_WordArt_detection.docx"); + +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xShape(xDrawPageSupplier->getDrawPage()->getByIndex(0), + uno::UNO_QUERY); + +// Make sure the shape width and height is not changed. +awt::Size aSize = xShape->getSize(); +// Without the fix the test would have failed with expected 7514 actual 1453. +CPPUNIT_ASSERT_DOUBLES_EQUAL(7514, aSize.Width, 2); +// Without the fix the test would have failed with expected 4540 actual 309. +CPPUNIT_ASSERT_DOUBLES_EQUAL(4540, aSize.Height, 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index abbf4fd7f9d6..bdbea0c86fc4 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -63,7 +63,7 @@ #include #include #include -#include +#include #include #include #include @@ -716,10 +716,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes SdrObject* pShape = SdrObject::getSdrObjectFromXShape(xShape); if( pShape && getShapeType() >= 0 ) { -OUString aShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >(getShapeType()) ); //The resize autoshape to fit text attr of FontWork/Word-Art should always be false //for the fallback geometry. -if(aShapeType.startsWith("fontwork")) +sal_Int32 nType = getShapeType(); +if((mso_sptTextSimple <= nType && nType <= mso_sptTextOnRing) +|| (mso_sptTextPlainText <= nType && nType <= mso_sptTextCanDown)) { pShape->SetMergedItem(makeSdrTextAutoGrowHeightItem(false)); pShape->SetMergedItem(makeSdrTextAutoGrowWidthItem(false));
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf153260_VML_trim_export.odt |binary oox/qa/unit/vml.cxx| 23 +++ oox/source/export/vmlexport.cxx|6 -- 3 files changed, 27 insertions(+), 2 deletions(-) New commits: commit fc5ab71bd2b4af535c2bdd2c9ea48be378b66a19 Author: Regina Henschel AuthorDate: Mon Jan 30 15:32:54 2023 +0100 Commit: Regina Henschel CommitDate: Mon Jan 30 20:20:53 2023 + tdf#153260 VML export write trim value true in any case LO renders Fontwork shapes always so as if trim=true is set. But the default value for trim attribute is 'false'. Therefore always write out 'true'. Otherwise the import will treat it as 'false' and apply the shape height reducing workaround. Change-Id: I626c5a84627f16011198a9a4e35d8fedf1fd1b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146361 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf153260_VML_trim_export.odt b/oox/qa/unit/data/tdf153260_VML_trim_export.odt new file mode 100644 index ..407a27fff254 Binary files /dev/null and b/oox/qa/unit/data/tdf153260_VML_trim_export.odt differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 6a8eab8098ab..be99a281af04 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -201,6 +202,28 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWatermark) CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, eMode); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWriterFontworkTrimTrue) +{ +// The document contains a shape, that will be exported as VML shape to docx. Error was that the +// attribute trim was not written out and thus import had treated it as the default 'false' and +// had reduced the shape height. +loadFromURL(u"tdf153260_VML_trim_export.odt"); + +// FIXME: tdf#153183 validation error in OOXML export: Errors: 1 +// Attribute 'ID' is not allowed to appear in element 'v:shape'. +skipValidation(); +saveAndReload("Office Open XML Text"); + +uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xShape(xDrawPageSupplier->getDrawPage()->getByIndex(0), + uno::UNO_QUERY); + +// Make sure the shape height is not changed. +// Without the fix the test would have failed with expected 4999 actual 1732. +awt::Size aSize = xShape->getSize(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(4999, aSize.Height, 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 62b102a8fa2d..ebe30bce0223 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -997,8 +997,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if (!aStyle.isEmpty()) pAttrList->add(XML_style, aStyle); -if (IsWaterMarkShape(m_pSdrObject->GetName())) -pAttrList->add(XML_trim, "t"); +// tdf#153260. LO renders all Fontwork shapes as if trim="t" is set. Default +// value is "f". So always write out "t", otherwise import will reduce the +// shape height as workaround for "f". +pAttrList->add(XML_trim, "t"); m_pSerializer->singleElementNS(XML_v, XML_textpath, pAttrList); }
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf128568_FontworkFontProperties.odt |binary oox/qa/unit/export.cxx| 34 + oox/source/export/vmlexport.cxx | 36 +- 3 files changed, 68 insertions(+), 2 deletions(-) New commits: commit a6bbf5db743583e21a2af3ef5b5a608f7bd46502 Author: Regina Henschel AuthorDate: Wed Jan 25 21:32:29 2023 +0100 Commit: Regina Henschel CommitDate: Thu Jan 26 13:00:36 2023 + tdf#128568 more font properties in VML Fontwork export When export a Fontwork shape to VML then currently only font name and size is exported. The patch adds style 'italic', weight 'bold' and the special properties 'Character spacing' and 'SameLetterHeights' of Fontwork shapes. Change-Id: Ifb7b42ab6c63e12f5f672e670a3bde5bcf20b1aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146148 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf128568_FontworkFontProperties.odt b/oox/qa/unit/data/tdf128568_FontworkFontProperties.odt new file mode 100644 index ..549d0fb029cc Binary files /dev/null and b/oox/qa/unit/data/tdf128568_FontworkFontProperties.odt differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 7c312798270a..f25bf4493b17 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -798,6 +798,40 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkBitmapFill) // in VML export. assertXPath(pXmlDoc, "//v:shape/v:fill", "type", "frame"); } + +CPPUNIT_TEST_FIXTURE(Test, testFontworkFontProperties) +{ +// The document has five Fontwork shapes. They have bitmap fill and thus are exported to VML. +// They differ in font properties e.g. font weight and character spacing. +loadFromURL(u"tdf128568_FontworkFontProperties.odt"); + +// FIXME: tdf#153183 validation error in OOXML export: Errors: 1 +// Attribute 'ID' is not allowed to appear in element 'v:shape'. +skipValidation(); + +// Save to DOCX: +save("Office Open XML Text"); + +// Make sure the style attribute of the textpath element has the needed items. Without fix only +// font-family and font-size were written. +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); +OUString sStyle; +// bold +sStyle = getXPath(pXmlDoc, "(//v:shape)[1]/v:textpath", "style"); +CPPUNIT_ASSERT(sStyle.indexOf("font-weight:bold") > -1); +// italic +sStyle = getXPath(pXmlDoc, "(//v:shape)[2]/v:textpath", "style"); +CPPUNIT_ASSERT(sStyle.indexOf("font-style:italic") > -1); +// character spacing 'very loose', 150 * 655, see escherex.cxx +sStyle = getXPath(pXmlDoc, "(//v:shape)[3]/v:textpath", "style"); +CPPUNIT_ASSERT(sStyle.indexOf("v-text-spacing:98250f") > -1); +// character spacing 'tight', 90 * 655, see escherex.cxx +sStyle = getXPath(pXmlDoc, "(//v:shape)[4]/v:textpath", "style"); +CPPUNIT_ASSERT(sStyle.indexOf("v-text-spacing:58950f") > -1); +// same letter heights +sStyle = getXPath(pXmlDoc, "(//v:shape)[5]/v:textpath", "style"); +CPPUNIT_ASSERT(sStyle.indexOf("v-same-letter-heights:t") > -1); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 6da57bdd8be8..62b102a8fa2d 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -401,6 +402,9 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } // properties +// The numbers of defines ESCHER_Prop_foo and DFF_Prop_foo correspond to the PIDs in +// 'Microsoft Office Drawing 97-2007 Binary Format Specification'. +// The property values are set by EscherPropertyContainer::CreateCustomShapeProperties() method. bool bAlreadyWritten[ 0xFFF ] = {}; const EscherProperties = rProps.GetOpts(); for (auto const& opt : rOpts) @@ -964,11 +968,38 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& OUString aSize = OUString::number(nSizeF); aStyle += ";font-size:" + aSize + "pt"; } -if (IsWaterMarkShape(m_pSdrObject->GetName())) -pAttrList->add(XML_trim, "t"); + +sal_uInt32 nGtextFlags; +if (rProps.GetOpt(DFF_Prop_gtextFStrikethrough /*255*/, nGtextFlags)) +{ +// The property is in fact a collection of flags. Two bytes contain the +// fUsegtextF* flags and the other two bytes at same place the associated +// On/Off flags. See '2.3.22.10 Geometry Text Boolean Properties' section +// in [MS-ODRAW]. +if
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/drawingml.cxx | 21 - oox/source/drawingml/fillproperties.cxx |2 +- 2 files changed, 13 insertions(+), 10 deletions(-) New commits: commit 79ad3e73907d15c4e234e2a32de8173273f5ac16 Author: Tomaž Vajngerl AuthorDate: Fri Jan 6 00:08:17 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Jan 13 14:37:44 2023 + oox: also allow tint and shade for fill color This was an obsolete limitation that is not needed anymore. Change-Id: Ie9610516996fc16197f8611843ff621b8a83ebdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145084 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 2faf2b28e909..f47853e3b5f7 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -444,8 +444,6 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) // Given a document with a table style, using theme color with tinting in the A2 cell: loadFromURL(u"theme-tint.pptx"); -// Then make sure that we only import theming info to the doc model if the effects are limited -// to lum mod / off that we can handle (i.e. no tint/shade): uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); @@ -453,6 +451,7 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) uno::Reference xTable; CPPUNIT_ASSERT(xShape->getPropertyValue("Model") >>= xTable); uno::Reference xA1(xTable->getCellByPosition(0, 0), uno::UNO_QUERY); + // check theme color { uno::Reference xThemeColor; @@ -460,8 +459,11 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) CPPUNIT_ASSERT(xThemeColor.is()); model::ThemeColor aThemeColor; model::theme::setFromXThemeColor(aThemeColor, xThemeColor); -// This is OK, no problematic effects: CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aThemeColor.getType()); +{ +auto const& rTrans = aThemeColor.getTransformations(); +CPPUNIT_ASSERT_EQUAL(size_t(0), rTrans.size()); +} } { @@ -471,12 +473,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) CPPUNIT_ASSERT(xThemeColor.is()); model::ThemeColor aThemeColor; model::theme::setFromXThemeColor(aThemeColor, xThemeColor); -// Without the accompanying fix in place, this test would have failed with: -// - Expected: -1 -// - Actual : 4 -// i.e. we remembered the theme index, without being able to remember the tint effect, leading -// to a bad background color. -CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Unknown, aThemeColor.getType()); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aThemeColor.getType()); +{ +auto const& rTrans = aThemeColor.getTransformations(); +CPPUNIT_ASSERT_EQUAL(size_t(1), rTrans.size()); +CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTrans[0].meType); +CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTrans[0].mnValue); +} } } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 99fbfa41e990..d193653d7189 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -455,7 +455,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, aThemeColor.setType(model::convertToThemeColorType(nPhClrTheme)); rPropMap.setProperty(PROP_FillColorThemeReference, model::theme::createXThemeColor(aThemeColor)); } -else if (maFillColor.getTintOrShade() == 0) +else { aThemeColor.setType(model::convertToThemeColorType(maFillColor.getSchemeColorIndex())); if (maFillColor.getLumMod() != 1)
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf152896_WordArt_color_darken.docx |binary oox/qa/unit/shape.cxx| 21 +++ oox/source/shape/WpsContext.cxx | 106 ++- 3 files changed, 79 insertions(+), 48 deletions(-) New commits: commit 81e6d47635656297cdddc9030f4422c0bcc203f9 Author: Regina Henschel AuthorDate: Fri Jan 6 16:02:31 2023 +0100 Commit: Regina Henschel CommitDate: Fri Jan 6 17:53:01 2023 + tdf#152896 do not apply color shading twice If a character theme color is shaded, Word writes this as w:themeShade attribute of the w:color element. If the character also has transparency, Word writes an additional w14:textFill element with a w14:lumMod child element. In such cases the w14:textFill element supersedes the w:color element. The initial implementation of Fontwork import in commit cbf30153a5c776e6d1ee26f2f83c8f77503eceb9 does it wrong. It replaces the color itself but not the color transformation, so that the shading was applied twice, once from w:themeShade attribute and the other time from w14:lumMod. The solution here is to reverse the order so that w:color is only evaluated if w14:textFill is not present. Another solution would have been to clear the color transformation vector before adding the values from w14:textFill. I use reverse order here because it more clearly reflects that w14:textFill supersedes w:color. Change-Id: I3e700795167a34238ea619b9c4a691c10da357f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145150 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf152896_WordArt_color_darken.docx b/oox/qa/unit/data/tdf152896_WordArt_color_darken.docx new file mode 100644 index ..1f8f8e4e0edf Binary files /dev/null and b/oox/qa/unit/data/tdf152896_WordArt_color_darken.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 89a6da6905d2..b03266b553f6 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -559,6 +559,27 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterShapeFillNonAccentColor) uno::Reference xShape3Props(xDrawPage->getByIndex(3), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(2)), xShape3Props->getPropertyValue(u"FillColorTheme")); } + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontworkDarkenTransparency) +{ +loadFromURL(u"tdf152896_WordArt_color_darken.docx"); +// The file contains a WordArt shape with theme colors "Background 2", shading mode "Darken 25%" +// and "20% Transparency". Word writes this as w:color element with additional w14:textFill +// element. In such case the w14:textFill element supersedes the w:color element. Error was, that +// the darkening was applied twice, once from w:color and the other time from w14:textFill. + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +uno::Reference xShapeProps(xDrawPage->getByIndex(0), uno::UNO_QUERY); +// Without the fix in place the test would have failed with +// Expected: 13676402 (= 0xD0AF72 = rgb(208, 175, 114) => luminance 63.14%) +// Actual: 11897660 (= 0xB58B3C = rgb(181, 139, 60) => luminance 47.25% ) +// The original "Background 2" is 0xEBDDC3 = rgb(235, 221, 195) => luminance 84.31% +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(208, 175, 114)), + xShapeProps->getPropertyValue(u"FillColor")); +} CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 767f3807607f..9fb3812923b2 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -381,62 +381,72 @@ lcl_generateFillPropertiesFromTextProps(const comphelper::SequenceAsHashMap& rTe { oox::drawingml::FillProperties aFillProperties; aFillProperties.moFillType = oox::XML_solidFill; // default -sal_Int32 aCharColor = 0; -if (rTextPropMap.getValue(u"CharColor") >>= aCharColor) -aFillProperties.maFillColor.setSrgbClr(aCharColor); -else -aFillProperties.maFillColor.setUnused(); - -// Theme color superseds direct color. textFill superseds theme color. Theme color and textfill -// are in CharInteropGrabBag +// Theme color supersedes direct color. textFill supersedes theme color. Theme color and textFill +// are in CharInteropGrabBag. uno::Sequence aCharInteropGrabBagSeq; -if (!((rTextPropMap.getValue(u"CharInteropGrabBag") >>= aCharInteropGrabBagSeq) - && aCharInteropGrabBagSeq.hasElements())) -return aFillProperties; -comphelper::SequenceAsHashMap aCharInteropGrabBagMap(aCharInteropGrabBagSeq); - -// Handle theme color, tint and shade. -
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/shape.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 5eda5ef2530e0e2d4f9e7f33f1ab1a8fa933fe7f Author: Andrea Gelmini AuthorDate: Thu Jan 5 11:15:10 2023 +0100 Commit: Julien Nabet CommitDate: Thu Jan 5 13:00:20 2023 + Fix typo Change-Id: Icde32c862bb498af0908399b388973db4d7f8b02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145074 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 3997494eb21c..89a6da6905d2 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -510,7 +510,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontworkNonAccentColor) uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); -// The ID for the theme colors is not yet in API, but definied in enum PredefinedClrSchemeID +// The ID for the theme colors is not yet in API, but defined in enum PredefinedClrSchemeID // in drawingml/clrscheme.hxx. Without fix the ID was -1 meaning no theme is used, and the color // was Black (=0). @@ -548,7 +548,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterShapeFillNonAccentColor) uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); -// The ID for the theme colors is not yet in API, but definied in enum PredefinedClrSchemeID +// The ID for the theme colors is not yet in API, but defined in enum PredefinedClrSchemeID // in drawingml/clrscheme.hxx. Without fix the ID was -1 meaning no theme is used. uno::Reference xShape0Props(xDrawPage->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(3)), xShape0Props->getPropertyValue(u"FillColorTheme"));
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf152840_WordArt_non_accent_color.docx |binary oox/qa/unit/data/tdf152840_theme_color_non_accent.docx |binary oox/qa/unit/shape.cxx| 59 +++ oox/source/drawingml/clrscheme.cxx | 10 ++ oox/source/drawingml/color.cxx |6 + 5 files changed, 74 insertions(+), 1 deletion(-) New commits: commit f4a568fc0553603fbf05477e0942af4e8466fba0 Author: Regina Henschel AuthorDate: Tue Jan 3 20:13:12 2023 +0100 Commit: Regina Henschel CommitDate: Thu Jan 5 09:13:37 2023 + tdf#152840 add ST_ThemeColor values to ClrScheme::getColor ... and Color::getSchemeColorIndex(). Without the fix it was not in all cases detected, that a theme color was used, so the FillColorTheme or the CharColorTheme property had got value '-1'. In case of WordArt in docx import, the color could not be determined and the text was black. Change-Id: I81cdb22d6b3c30bf9923b9069ba2e384ac5b3a1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145021 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf152840_WordArt_non_accent_color.docx b/oox/qa/unit/data/tdf152840_WordArt_non_accent_color.docx new file mode 100644 index ..877722037206 Binary files /dev/null and b/oox/qa/unit/data/tdf152840_WordArt_non_accent_color.docx differ diff --git a/oox/qa/unit/data/tdf152840_theme_color_non_accent.docx b/oox/qa/unit/data/tdf152840_theme_color_non_accent.docx new file mode 100644 index ..2bb4e1340e51 Binary files /dev/null and b/oox/qa/unit/data/tdf152840_theme_color_non_accent.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 094687ffe1df..3997494eb21c 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -500,6 +500,65 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3) } } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontworkNonAccentColor) +{ +loadFromURL(u"tdf152840_WordArt_non_accent_color.docx"); +// The file contains WordArt which uses the theme colors "Background 1", "Text 1", "Background 2" +// and "Text 2". + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +// The ID for the theme colors is not yet in API, but definied in enum PredefinedClrSchemeID +// in drawingml/clrscheme.hxx. Without fix the ID was -1 meaning no theme is used, and the color +// was Black (=0). + +// background 1 = lt1 = ID 1 +uno::Reference xShape0Props(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(1)), xShape0Props->getPropertyValue(u"FillColorTheme")); +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(255, 204, 153)), + xShape0Props->getPropertyValue(u"FillColor")); + +// text 1 = dk1 = ID 0 +uno::Reference xShape1Props(xDrawPage->getByIndex(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(0)), xShape1Props->getPropertyValue(u"FillColorTheme")); +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(255, 0, 0)), xShape1Props->getPropertyValue(u"FillColor")); + +// background 2 = lt2 = ID 3 +uno::Reference xShape2Props(xDrawPage->getByIndex(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(3)), xShape2Props->getPropertyValue(u"FillColorTheme")); +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(235, 221, 195)), + xShape2Props->getPropertyValue(u"FillColor")); + +// text 2 = dk2 = ID 2 +uno::Reference xShape3Props(xDrawPage->getByIndex(3), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(2)), xShape3Props->getPropertyValue(u"FillColorTheme")); +CPPUNIT_ASSERT_EQUAL(uno::Any(Color(119, 95, 85)), + xShape3Props->getPropertyValue(u"FillColor")); +} + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterShapeFillNonAccentColor) +{ +loadFromURL(u"tdf152840_theme_color_non_accent.docx"); +// The file contains shapes which uses the theme colors "bg2", "bg1", "tx1" and "tx2" in this +// order as fill color. + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +// The ID for the theme colors is not yet in API, but definied in enum PredefinedClrSchemeID +// in drawingml/clrscheme.hxx. Without fix the ID was -1 meaning no theme is used. +uno::Reference xShape0Props(xDrawPage->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(3)), xShape0Props->getPropertyValue(u"FillColorTheme")); +uno::Reference xShape1Props(xDrawPage->getByIndex(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(1)),
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/shape.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 1ce6ae04f7faa84d98b10b67f2ef5f24ac1b0129 Author: Stephan Bergmann AuthorDate: Mon Jan 2 13:18:33 2023 +0100 Commit: Stephan Bergmann CommitDate: Tue Jan 3 07:13:11 2023 + -Werror=maybe-uninitialized (Adding just CPPUNIT_ASSERT wasn't enough to silence the warnings at least for my GCC 13 trunk build, so also added the redundant initializations.) Change-Id: I8ec9e097d4725d22dd90e9278a37768a749e292d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144943 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 19b9f739ad60..094687ffe1df 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -336,8 +336,8 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork) uno::Reference xShapeProps(xDrawPage->getByIndex(0), uno::UNO_QUERY); // Is it a Fontwork? -bool bTextBox; -xShapeProps->getPropertyValue(u"TextBox") >>= bTextBox; +bool bTextBox = bool(); +CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"TextBox") >>= bTextBox); CPPUNIT_ASSERT(!bTextBox); uno::Reference xTextFrame; @@ -354,8 +354,8 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork) CPPUNIT_ASSERT(aTextPathSeq.getLength() > 0); comphelper::SequenceAsHashMap aTextPathPropMap(aTextPathSeq); -bool bTextPathOn; -aTextPathPropMap.getValue(u"TextPath") >>= bTextPathOn; +bool bTextPathOn = bool(); +CPPUNIT_ASSERT(aTextPathPropMap.getValue(u"TextPath") >>= bTextPathOn); CPPUNIT_ASSERT(bTextPathOn); // Is it the correct kind of Fontwork?
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/shape.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 75b8f7693ceb2d78acc066c4ea92a9d085a9d7d6 Author: Andrea Gelmini AuthorDate: Mon Jan 2 14:48:35 2023 +0100 Commit: Julien Nabet CommitDate: Mon Jan 2 14:13:05 2023 + Fix typo Change-Id: I06b51dc7435c1c534c9f9d9b67ea2c54c7f5f1c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144953 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index bc341faf9683..19b9f739ad60 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -326,7 +326,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf54095_SmartArtThemeTextColor) CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork) { loadFromURL(u"tdf125885_WordArt.docx"); -// Without the patch WordArt in text document was imported as rectangular custome shape with +// Without the patch WordArt in text document was imported as rectangular custom shape with // attached frame. So there was no artistic text at all. Now it is imported as Fontwork. // This test covers some basic properties. @@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork) CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork2) { loadFromURL(u"tdf125885_WordArt2.docx"); -// Without the patch WordArt in text document was imported as rectangular custome shape with +// Without the patch WordArt in text document was imported as rectangular custom shape with // attached frame. So there was no artistic text at all. Now it is imported as Fontwork. // This test covers whether theme color properties are correctly converted on import. @@ -446,7 +446,7 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork2) CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3) { loadFromURL(u"tdf125885_WordArt3.docx"); -// Without the patch WordArt in text document was imported as rectangular custome shape with +// Without the patch WordArt in text document was imported as rectangular custom shape with // attached frame. So there was no artistic text at all. Now it is imported as Fontwork. // This test covers some aspects of import of gradient fill.
[Libreoffice-commits] core.git: oox/qa oox/source sd/qa
oox/qa/unit/data/tdf125085_WordArtFontText.pptx |binary oox/qa/unit/data/tdf125085_WordArtFontTheme.pptx |binary oox/qa/unit/drawingml.cxx| 47 ++ oox/source/drawingml/shape.cxx | 405 +++ sd/qa/unit/export-tests-ooxml3.cxx | 15 5 files changed, 329 insertions(+), 138 deletions(-) New commits: commit bd7f1270cf58eba7600d1b4c6c8ca9a901a04f66 Author: Regina Henschel AuthorDate: Tue Nov 8 10:28:08 2022 +0100 Commit: Regina Henschel CommitDate: Sat Nov 12 12:45:03 2022 +0100 tdf#125085 PPTX WordArt import: get shape font from run PPTX uses the settings at the run for the text in a WordArt shape. LO uses the settings of the shape. The patch copies the run font and language properties to the shape. In addition I have split the old method lcl_createPresetShape and renamed the parts. Now the method lcl_putCustomShapeIntoTextPathMode contains the geometry changes to put a CustomShape into text path mode and to adapt the OOXML values to the values needed for our preset Fontwork shapes, which are based on binary MS Office. MS Office has the style of the characters of a WordArt as properties of the run. LibreOffice ignores most of the properties specified in the style of a span element, when the text is displayed as Fontwork. Instead LO uses the properties defined for the shape for styling the text. Copying the text properties to the shape is now done in method lcl_copyCharPropsToShape. The values in testTdf125573_FontWorkScaleX depend on the used Font. Since on creation time wrong Fonts were used and now correct Fonts are imported, the values have to be updated. Import of fill and stroke of the characters is still missing, only a rudimentary import of color for solid fill exists. Change-Id: I6f31fe07fb0656b2ce8581e7123265fa598ac9c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142421 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf125085_WordArtFontText.pptx b/oox/qa/unit/data/tdf125085_WordArtFontText.pptx new file mode 100644 index ..a9dab6d1ccf8 Binary files /dev/null and b/oox/qa/unit/data/tdf125085_WordArtFontText.pptx differ diff --git a/oox/qa/unit/data/tdf125085_WordArtFontTheme.pptx b/oox/qa/unit/data/tdf125085_WordArtFontTheme.pptx new file mode 100644 index ..f4c37692afcd Binary files /dev/null and b/oox/qa/unit/data/tdf125085_WordArtFontTheme.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 5c0b17e192f6..e25d980f09cb 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -549,6 +550,52 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf113187ConstantArcTo) CPPUNIT_ASSERT_EQUAL(sal_Int32(360), aViewBox.Height); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf125085WordArtFontTheme) +{ +// The font info for the shape is in the theme, the text run has no font settings. +loadFromURL(u"tdf125085_WordArtFontTheme.pptx"); + +// Get shape and its properties +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); + +// Make sure shape has correct font and local. +// Without the fix some application defaults were used. +OUString sFontName; +xShapeProps->getPropertyValue("CharFontNameComplex") >>= sFontName; +CPPUNIT_ASSERT_EQUAL(OUString(u"Noto Serif Hebrew"), sFontName); +css::lang::Locale aLocal; +xShapeProps->getPropertyValue("CharLocaleComplex") >>= aLocal; +CPPUNIT_ASSERT_EQUAL(OUString(u"IL"), aLocal.Country); +CPPUNIT_ASSERT_EQUAL(OUString(u"he"), aLocal.Language); +} + +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf125085WordArtFontText) +{ +// The font info for the shape is in the text run inside the shape. +loadFromURL(u"tdf125085_WordArtFontText.pptx"); + +// Get shape and its properties +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); + +// Make sure shape has correct font and local. +// Without the fix some application defaults were used. +OUString sFontName; +xShapeProps->getPropertyValue("CharFontNameComplex") >>= sFontName; +CPPUNIT_ASSERT_EQUAL(OUString(u"Noto Serif Hebrew"), sFontName); +
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf151518_SmartArtTextLocation.docx |binary oox/qa/unit/shape.cxx| 54 +++ oox/source/drawingml/shape.cxx | 11 +++ 3 files changed, 63 insertions(+), 2 deletions(-) New commits: commit 2969900b75e288e8c626a34277250aa233dc944c Author: Regina Henschel AuthorDate: Sat Oct 15 01:25:49 2022 +0200 Commit: Regina Henschel CommitDate: Tue Oct 18 16:22:58 2022 +0200 tdf#151518 Do not tweak text area distances in Writer The fix for tdf#148321 has introduced tweaks to the upper and lower text distances for the case, that their sum is larger than the text area height. That works well in import from PowerPoint but conflicts with import of SmartArt shapes from Word. Reason of the problem is not only the missing Twip to Hmm conversion in TextBodyProperties::readjustTextDistances(). But I have not found which detail in the tweak produces the wrong text location. For now I have disabled the tweak for import from Word. Maybe someone finds a better solution in future. Because the user cannot insert such large distances in Word and SmartArt shapes do not use such distances anyway, I think it does not harm to disable the method for text documents. Import from Excel cannot be tested because of tdf#83671. Change-Id: I2e133f6864bba4419ad96e94d88aec86fe97d0fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141414 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins diff --git a/oox/qa/unit/data/tdf151518_SmartArtTextLocation.docx b/oox/qa/unit/data/tdf151518_SmartArtTextLocation.docx new file mode 100644 index ..ec99be6bff09 Binary files /dev/null and b/oox/qa/unit/data/tdf151518_SmartArtTextLocation.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index c741ff84d4da..ec3fa9453b2c 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -20,6 +20,8 @@ #include #include #include + +#include #include #include @@ -233,6 +235,58 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf151008VertAnchor) } } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf151518VertAnchor) +{ +// Make sure SmartArt is loaded as group shape +bool bUseGroup = officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::get(); +if (!bUseGroup) +{ +std::shared_ptr pChange( +comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(true, pChange); +pChange->commit(); +} + +// The document contains SmartArt with shapes with not default text area. Without fix the +// text was shifted up because of wrong values in TextLowerDistance and TextUpperDistance. +load(u"tdf151518_SmartArtTextLocation.docx"); + +struct TextDistance +{ +OUString sShapeName; +sal_Int16 nSubShapeIndex; +sal_Int32 nLowerDistance; +sal_Int32 nUpperDistance; +}; +TextDistance aExpected[4] = { { u"Diagram Target List", 2, 2979, 201 }, + { u"Diagram Nested Target", 1, 3203, 127 }, + { u"Diagram Stacked Venn", 1, 3112, -302 }, + { u"Diagram Grouped List", 1, 4106, 196 } }; +// without the fix the observed distances were +// {4434, -464}, {4674, -751}, {4620, -1399}, {6152, -744} +for (size_t i = 0; i < 4; ++i) +{ +uno::Reference xDiagramShape(getShapeByName(aExpected[i].sShapeName), + uno::UNO_QUERY); +uno::Reference xShapeProps( +xDiagramShape->getByIndex(aExpected[i].nSubShapeIndex), uno::UNO_QUERY); +sal_Int32 nLower; +sal_Int32 nUpper; +CPPUNIT_ASSERT(xShapeProps->getPropertyValue("TextLowerDistance") >>= nLower); +CPPUNIT_ASSERT(xShapeProps->getPropertyValue("TextUpperDistance") >>= nUpper); +CPPUNIT_ASSERT_EQUAL(aExpected[i].nLowerDistance, nLower); +CPPUNIT_ASSERT_EQUAL(aExpected[i].nUpperDistance, nUpper); +} + +if (!bUseGroup) +{ +std::shared_ptr pChange( +comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::SmartArtToShapes::set(false, pChange); +pChange->commit(); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index e1a81c99631c..e43b6b9ed5b0 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -99,6 +99,7 @@ #include #include #include +#include #include #include #include @@ -1892,9 +1893,15 @@ Reference< XShape > const & Shape::createAndInsert( finalizeXShape( rFilterBase, rxShapes ); if (mpTextBody) -
[Libreoffice-commits] core.git: oox/qa oox/source sd/qa
oox/qa/unit/vml.cxx | 15 +-- oox/source/drawingml/graphicshapecontext.cxx |3 ++- oox/source/drawingml/shape.cxx | 17 + sd/qa/unit/data/pptx/ole.pptx|binary sd/qa/unit/export-tests-ooxml3.cxx | 21 + 5 files changed, 45 insertions(+), 11 deletions(-) New commits: commit adc042f95d3dbd65b778260025d59283146916e5 Author: Tünde Tóth AuthorDate: Tue Sep 13 10:29:03 2022 +0200 Commit: László Németh CommitDate: Wed Sep 28 14:16:50 2022 +0200 tdf#124333 PPTX import: fix Z-order of embedded OLE objects Choose mc:Choice in a:graphicData element if the selected p:oleObj element has a shape id to avoid of shape duplication which created also bad layout/overlapping because of the different Z-order of the duplicated shape. Change-Id: Idecff4903c2d637bc82353f13352cac72413cec1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140041 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 9dcaaef83cc4..61730c744220 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -192,18 +192,13 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke) uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); -uno::Reference xShape; -for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i) -{ -uno::Reference xInfo(xDrawPage->getByIndex(i), uno::UNO_QUERY); -if (!xInfo->supportsService("com.sun.star.drawing.GraphicObjectShape")) -{ -continue; -} +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); +uno::Reference xShape; +uno::Reference xInfo(xDrawPage->getByIndex(0), uno::UNO_QUERY); +if (xInfo->supportsService("com.sun.star.drawing.OLE2Shape")) xShape.set(xInfo, uno::UNO_QUERY); -break; -} + CPPUNIT_ASSERT(xShape.is()); drawing::LineStyle eLineStyle{}; diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 6e4379c2e1ed..0f96d0a92d63 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -256,7 +256,8 @@ void OleObjectGraphicDataContext::onEndElement() { if( getCurrentElement() == PPT_TOKEN( oleObj ) && !isMCEStateEmpty() ) { -if( getMCEState() == MCE_STATE::FoundChoice && !mrOleObjectInfo.mbHasPicture ) +if (getMCEState() == MCE_STATE::FoundChoice && !mrOleObjectInfo.mbHasPicture +&& mrOleObjectInfo.maShapeId.isEmpty()) setMCEState( MCE_STATE::Started ); } } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 2a46f93a440e..0369f5ff732c 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1868,6 +1868,23 @@ Reference< XShape > const & Shape::createAndInsert( propertySet->setPropertyValue( "SoftEdgeRadius", Any(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.value(; } + +// Set the stroke and fill-color properties of the OLE shape +if (aServiceName == "com.sun.star.drawing.OLE2Shape" && mxOleObjectInfo +&& !mxOleObjectInfo->maShapeId.isEmpty()) +if (::oox::vml::Drawing* pVmlDrawing = rFilterBase.getVmlDrawing()) +if (const ::oox::vml::ShapeBase* pVmlShape += pVmlDrawing->getShapes().getShapeById(mxOleObjectInfo->maShapeId)) +{ +// Apply stroke props from the type model of the related VML shape. +ShapePropertyMap aPropMap(rFilterBase.getModelObjectHelper()); +pVmlShape->getTypeModel().maStrokeModel.pushToPropMap( +aPropMap, rFilterBase.getGraphicHelper()); +// And, fill-color properties as well... +pVmlShape->getTypeModel().maFillModel.pushToPropMap( +aPropMap, rFilterBase.getGraphicHelper()); +PropertySet(xSet).setProperties(aPropMap); +} } if (mxShape.is()) diff --git a/sd/qa/unit/data/pptx/ole.pptx b/sd/qa/unit/data/pptx/ole.pptx new file mode 100644 index ..b998e79e0d66 Binary files /dev/null and b/sd/qa/unit/data/pptx/ole.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index c12a1f0ec4bd..e2ef6928104f 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -122,6 +122,7 @@ public: void testTdf149551_tbrl90(); void testTdf149551_btlr(); void testTdf94122_autoColor(); +void testTdf124333(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -209,6 +210,7 @@ public:
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf151008_eaVertAnchor.pptx |binary oox/qa/unit/export.cxx | 30 oox/qa/unit/shape.cxx | 58 +++ oox/source/drawingml/textbodypropertiescontext.cxx | 46 ++-- oox/source/export/drawingml.cxx| 78 ++--- 5 files changed, 165 insertions(+), 47 deletions(-) New commits: commit 439eaa8efdd8179f93f7aaf44d25ceced6ab1665 Author: Regina Henschel AuthorDate: Sun Sep 18 14:41:32 2022 +0200 Commit: Regina Henschel CommitDate: Mon Sep 19 10:38:30 2022 +0200 tdf#151008 adapt anchor for eaVert and mongolianVert MS Office and LibreOffice act different whether anchor positions are rotated for vertical writing modes eaVert and mongolianVert. The patch converts the position on import and export. Currently shapes are not able to render mongolianVert. Nevertheless it is included so that the text block has already the correct position and the original position is restored on export. LibreOffice has vertical anchor alignments BOTTOM, that would require a third horizontal position in MS Office, which does not exist. It is mapped to anchorCtr='1' instead. Such does not occur in pptx-LO-pptx round-trip. Change-Id: I1b0e42a39ce3aba12cdb271b2aa8023dacb9c53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140118 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf151008_eaVertAnchor.pptx b/oox/qa/unit/data/tdf151008_eaVertAnchor.pptx new file mode 100644 index ..999cd220408c Binary files /dev/null and b/oox/qa/unit/data/tdf151008_eaVertAnchor.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 09cf5cb5ef48..64e1cfaa47e7 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -808,6 +808,36 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "upright", "1"); assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "rot"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf151008VertAnchor) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf151008_eaVertAnchor.pptx"; +loadAndSave(aURL, "Impress Office Open XML"); +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +// The order of the shapes in the file is by name "Right", "Center", "Left", "RightMiddle", +// "CenterMiddle" and "LeftMiddle". I access the shapes here by index, because the XPath is +// easier then. +// As of Sep 2022 LibreOffice does not write the default anchorCtr="0" +// Right +assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr", "anchor", "t"); +assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[1]/p:txBody/a:bodyPr", "anchorCtr"); +// Center +assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", "ctr"); +assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchorCtr"); +// Left +assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr", "anchor", "b"); +assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp[3]/p:txBody/a:bodyPr", "anchorCtr"); +// RightMiddle +assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr", "anchor", "t"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:txBody/a:bodyPr", "anchorCtr", "1"); +// CenterMiddle +assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr", "anchor", "ctr"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[5]/p:txBody/a:bodyPr", "anchorCtr", "1"); +// LeftMiddle +assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchor", "b"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[6]/p:txBody/a:bodyPr", "anchorCtr", "1"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 345ebb215ad6..c741ff84d4da 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -55,6 +56,7 @@ public: void tearDown() override; uno::Reference& getComponent() { return mxComponent; } void load(std::u16string_view rURL); +uno::Reference getShapeByName(std::u16string_view aName); }; void OoxShapeTest::setUp() @@ -78,6 +80,26 @@ void OoxShapeTest::load(std::u16string_view rFileName) mxComponent = loadFromDesktop(aURL); } +uno::Reference OoxShapeTest::getShapeByName(std::u16string_view aName) +{ +uno::Reference xRet; + +uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i) +{ +
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/export.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 96648fa4b38a77cb86ed03962db2676916a8a97c Author: Andrea Gelmini AuthorDate: Sun Jul 24 17:45:00 2022 +0200 Commit: Julien Nabet CommitDate: Sun Jul 24 18:19:44 2022 +0200 Fix typo Change-Id: Ia6c5e8615cc1438664f2208b6b1fc5f0383840ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137392 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 1bc71da5e039..09cf5cb5ef48 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -796,7 +796,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551VertPadding) CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) { // The document has a shape with attribute upright="1" in the bodyPr element. On import it is -// emulatated by rotating the text area rectangle. On export there should be an upright="1" +// emulated by rotating the text area rectangle. On export there should be an upright="1" // attribute but no 'rot' attribute. Without the fix the 'rot' attribute with values from // the emulation was written out. OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf149538_upright.pptx";
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf149538_upright.pptx |binary oox/qa/unit/export.cxx | 16 oox/source/export/drawingml.cxx | 30 +- 3 files changed, 37 insertions(+), 9 deletions(-) New commits: commit 3ade0a5fb1d39360b76c7d62eebee5a18d3f4196 Author: Regina Henschel AuthorDate: Fri Jul 22 17:54:02 2022 +0200 Commit: Regina Henschel CommitDate: Sat Jul 23 14:33:13 2022 +0200 tdf#149538 no text area rotation if upright exported This is a followup to commit 7e23cbdb. With that commit the attribute 'upright' is correctly emulated by a rotation of the text area rectangle. But I forgot to remove this rotation when the 'upright' attribute is used on export. Change-Id: I46d0f421be8ef6b44537134c73dc1e4326ba7e1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137368 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf149538_upright.pptx b/oox/qa/unit/data/tdf149538_upright.pptx new file mode 100644 index ..a477b3b1215e Binary files /dev/null and b/oox/qa/unit/data/tdf149538_upright.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index be4fb81fa0bf..1bc71da5e039 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -792,6 +792,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149551VertPadding) assertXPathNoAttribute(pXmlDoc, sElement, "rot"); } } + +CPPUNIT_TEST_FIXTURE(Test, testTdf149538upright) +{ +// The document has a shape with attribute upright="1" in the bodyPr element. On import it is +// emulatated by rotating the text area rectangle. On export there should be an upright="1" +// attribute but no 'rot' attribute. Without the fix the 'rot' attribute with values from +// the emulation was written out. +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf149538_upright.pptx"; +loadAndSave(aURL, "Impress Office Open XML"); + +// Verify the markup. The values must be the same as in the original file. +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +assertXPath(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "upright", "1"); +assertXPathNoAttribute(pXmlDoc, "//p:spTree/p:sp/p:txBody/a:bodyPr", "rot"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 392ce6f4d6aa..e4d0ed7ddc4e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3452,7 +3452,6 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo && ( sPresetWarp == "textArchDown" || sPresetWarp == "textArchUp" || sPresetWarp == "textButton" || sPresetWarp == "textCircle"); - if (bUpright) { Degree100 nShapeRotateAngleDeg100(0_deg100); @@ -3460,24 +3459,37 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo nShapeRotateAngleDeg100 = Degree100(mAny.get()); // Depending on shape rotation, the import has made 90deg changes to properties // "TextPreRotateAngle" and "TextRotateAngle". Revert it. -if ((nShapeRotateAngleDeg100 > 4500_deg100 && nShapeRotateAngleDeg100 <= 13500_deg100) -|| (nShapeRotateAngleDeg100 > 22500_deg100 && nShapeRotateAngleDeg100 <= 31500_deg100)) +bool bWasAngleChanged += (nShapeRotateAngleDeg100 > 4500_deg100 && nShapeRotateAngleDeg100 <= 13500_deg100) + || (nShapeRotateAngleDeg100 > 22500_deg100 + && nShapeRotateAngleDeg100 <= 31500_deg100); +if (bWasAngleChanged) { nTextRotateAngleDeg100 = nTextRotateAngleDeg100.value_or(0_deg100) + 9000_deg100; nTextPreRotateAngle -= 90; } // If text is no longer upright, user has changed something. Do not write 'upright' then. +// This try to detect the case assumes, that the text area rotation was 0 in the original +// MS Office document. That is likely because MS Office has no UI to set it and the +// predefined SmartArt shapes, which use it, do not use 'upright'. Degree100 nAngleSum = nShapeRotateAngleDeg100 + nTextRotateAngleDeg100.value_or(0_deg100); -if (abs(NormAngle18000(nAngleSum)) >= 100_deg100) // consider inaccuracy from rounding +if (abs(NormAngle18000(nAngleSum)) < 100_deg100) // consider inaccuracy from rounding +{ +nTextRotateAngleDeg100.reset(); // 'upright' does not overrule text area rotation. +} +else { +// User changes. Keep current angles. isUpright.reset(); +if (bWasAngleChanged) +{ +nTextPreRotateAngle += 90; +nTextRotateAngleDeg100 =
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/refer-to-theme-shape-fill.odp |binary oox/qa/unit/export.cxx |5 + oox/source/export/drawingml.cxx| 20 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) New commits: commit 109debb0ca0c864296ad7f557cfbc2b05c9ec3c2 Author: Miklos Vajna AuthorDate: Wed May 11 20:17:16 2022 +0200 Commit: Miklos Vajna CommitDate: Thu May 12 08:07:30 2022 +0200 tdf#148961 sd theme: add PPTX export for shape fill color effects Which allows taking the fill color theme index from the model even in case there are effects. Previously effects meant reading from the grab-bag, and only the no-effect case read the color theme index from the doc model. Change-Id: Ib50c3128b971a388f14ad721ed7f73043916a736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134208 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/data/refer-to-theme-shape-fill.odp b/oox/qa/unit/data/refer-to-theme-shape-fill.odp index b12772e111e3..3a32aa71690a 100644 Binary files a/oox/qa/unit/data/refer-to-theme-shape-fill.odp and b/oox/qa/unit/data/refer-to-theme-shape-fill.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 4c6c013dcb81..90089a994fa2 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -413,6 +413,11 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill) std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr", "val", "accent1"); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod' number of nodes is incorrect +// i.e. the effects of the themed color were lost. +assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod", "val", "4"); +assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumOff", "val", "6"); } CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 1c5d34ac3e4a..eb588076e213 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -563,7 +563,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) else if ( nFillColor != nOriginalColor ) { // the user has set a different color for the shape -if (aTransformations.hasElements() || !WriteFillColor(rXPropSet)) +if (!WriteFillColor(rXPropSet)) { WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xff), nAlpha); } @@ -598,7 +598,23 @@ bool DrawingML::WriteFillColor(const uno::Reference& xPrope const char* pColorName = g_aPredefinedClrNames[nFillColorTheme]; mpFS->startElementNS(XML_a, XML_solidFill); -mpFS->singleElementNS(XML_a, XML_schemeClr, XML_val, pColorName); +mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, pColorName); + +sal_Int32 nFillColorLumMod{}; +xPropertySet->getPropertyValue("FillColorLumMod") >>= nFillColorLumMod; +if (nFillColorLumMod != 1) +{ +mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, OString::number(nFillColorLumMod * 10)); +} + +sal_Int32 nFillColorLumOff{}; +xPropertySet->getPropertyValue("FillColorLumOff") >>= nFillColorLumOff; +if (nFillColorLumOff != 0) +{ +mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, OString::number(nFillColorLumOff * 10)); +} + +mpFS->endElementNS(XML_a, XML_schemeClr); mpFS->endElementNS(XML_a, XML_solidFill); return true;
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/FaultyPathStart.odp |binary oox/qa/unit/export.cxx | 20 oox/source/export/drawingml.cxx | 25 +++-- 3 files changed, 39 insertions(+), 6 deletions(-) New commits: commit 3d7466b92a450d7ca4f45fef9a664143fbb3c386 Author: Regina Henschel AuthorDate: Sat Apr 23 21:52:29 2022 +0200 Commit: Regina Henschel CommitDate: Sun Apr 24 13:37:54 2022 +0200 Do not start a:path with lnTo in export to OOXML This is a follow up to commit 2029b2f6dd0109c5892e5ac5640022b31fe42fd2 The commands A, W, T or L of a draw:enhanced-path draw a line from current point to start of the arc or end of line, respectivly. If there is no current point the path is faulty and behavior is not defined in ODF. LibreOffice is tolerant and makes a move to the start point of the arc or to the end point of the line. With this patch we do the same now in export to OOXML, so the user gets the same shape geometry as in LO. If a path starts with lnTo, MS Office will show nothing. I wouldn't care about user-created faulty paths, but LO produces such faulty path when an EllipseRibbon shape from binary MS Office is imported. Even when that will be fixed, we need the fix here, because the faulty path had been written to document markup and will be used when such document is opened. Change-Id: Ic52ec3bc78231b26efb592ddadee2e3042fdc065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133349 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/FaultyPathStart.odp b/oox/qa/unit/data/FaultyPathStart.odp new file mode 100644 index ..219795ffa58b Binary files /dev/null and b/oox/qa/unit/data/FaultyPathStart.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index b4eebc537250..7a1bda7cb5bd 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -632,6 +632,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109169_OctagonBevel) assertXPath(pXmlDoc, "//a:pathLst/a:path[5]", "fill", "lightenLess"); assertXPath(pXmlDoc, "//a:pathLst/a:path[6]", "fill", "lighten"); } + +CPPUNIT_TEST_FIXTURE(Test, testFaultyPathCommandsAWT) +{ +// The odp file contains shapes whose path starts with command A, W, T or L. That is a faulty +// path. LO is tolerant and renders it so that is makes a moveTo to the start point of the arc or +// the end of the line respectively. Export to OOXML does the same now and writes a moveTo +// instead of the normally used lnTo. If a lnTo is written, MS Office shows nothing of the shape. +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "FaultyPathStart.odp"; + +loadAndSave(aURL, "Impress Office Open XML"); + +// Verify the markup: +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +// First child of a:path should be a moveTo in all four shapes. +assertXPath(pXmlDoc, "//p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); +assertXPath(pXmlDoc, "//p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 327b567c4c40..78eac3d00f60 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4218,10 +4218,21 @@ bool DrawingML::WriteCustomGeometrySegment( { if (rnPairIndex >= rPairs.getLength()) return false; - -mpFS->startElementNS(XML_a, XML_lnTo); -WriteCustomGeometryPoint(rPairs[rnPairIndex], rCustomShape2d); -mpFS->endElementNS(XML_a, XML_lnTo); +// LINETO without valid current point is a faulty path. LO is tolerant and makes a +// moveTo instead. Do the same on export. MS OFFICE requires a current point for lnTo, +// otherwise it shows nothing of the shape. +if (rbCurrentValid) +{ +mpFS->startElementNS(XML_a, XML_lnTo); +WriteCustomGeometryPoint(rPairs[rnPairIndex], rCustomShape2d); +mpFS->endElementNS(XML_a, XML_lnTo); +} +else +{ +mpFS->startElementNS(XML_a, XML_moveTo); +WriteCustomGeometryPoint(rPairs[rnPairIndex], rCustomShape2d); +mpFS->endElementNS(XML_a, XML_moveTo); +} rCustomShape2d.GetParameter(rfCurrentX, rPairs[rnPairIndex].First, false, false); rCustomShape2d.GetParameter(rfCurrentY, rPairs[rnPairIndex].Second, false, false); rbCurrentValid =
[Libreoffice-commits] core.git: oox/qa
0 files changed New commits: commit d48b472372f3d0b04338455ea8615f9af6e29169 Author: Andrea Gelmini AuthorDate: Mon Apr 4 22:53:38 2022 +0200 Commit: Julien Nabet CommitDate: Tue Apr 5 07:05:34 2022 +0200 Removed execution bits on odp file Change-Id: I32aa1660f4b83b349fd6e231fd08eac36d342973 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132534 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/data/tdf100391_TextAreaRect.odp b/oox/qa/unit/data/tdf100391_TextAreaRect.odp old mode 100755 new mode 100644
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf100391_TextAreaRect.odp |binary oox/qa/unit/export.cxx | 21 ++ oox/source/export/drawingml.cxx | 98 +++- 3 files changed, 116 insertions(+), 3 deletions(-) New commits: commit 1ad58c77352e418124387b804b18da2aeea22c8b Author: Regina Henschel AuthorDate: Mon Apr 4 01:55:29 2022 +0200 Commit: Regina Henschel CommitDate: Mon Apr 4 20:21:14 2022 +0200 tdf#100391 calculate true textarea rect for custGeom Without the fix the attributes for were set to 'l', 't', 'r' and 'b'. That means that the textarea rectangle equals the shape rectangle. That is the default and works for many shapes. But 'Puzzle' has a smaller textarea rectangle, for example. Because the values in draw:text-areas are relative to the internal coordinate system given by draw:viewBox in ODF, but the values in are relative to the shape coordinate system in OOXML, we cannot simple write the current absolute values but need to calculate them depending on actual width and height. For that we need guides. The patch introduces a guide list. Currently the list contains only the guides for the textarea rectangle, but it can be extended when export of handles will be implemented one day. Change-Id: I1050627ef6459ab5f8fafa939d7905122870c903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132489 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf100391_TextAreaRect.odp b/oox/qa/unit/data/tdf100391_TextAreaRect.odp new file mode 100755 index ..b9b9e5b39e4a Binary files /dev/null and b/oox/qa/unit/data/tdf100391_TextAreaRect.odp differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 60e20e2d933a..91b8d7608c24 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -590,6 +590,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf147978_subpath) assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "w", "80"); assertXPath(pXmlDoc, "//a:pathLst/a:path[4]", "h", "80"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf100391TextAreaRect) +{ +// The document has a custom shape of type "non-primitive" to trigger the custGeom export +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf100391_TextAreaRect.odp"; +// When saving to PPTX the textarea rect was set to default instead of using the actual area +loadAndSave(aURL, "Impress Office Open XML"); + +// Verify the markup. Without fix the values were l="l", t="t", r="r", b="b" +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +assertXPath(pXmlDoc, "//a:custGeom/a:rect", "l", "textAreaLeft"); +assertXPath(pXmlDoc, "//a:custGeom/a:rect", "t", "textAreaTop"); +assertXPath(pXmlDoc, "//a:custGeom/a:rect", "r", "textAreaRight"); +assertXPath(pXmlDoc, "//a:custGeom/a:rect", "b", "textAreaBottom"); +// The values are calculated in guides, for example +assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]", "name", "textAreaLeft"); +assertXPath(pXmlDoc, "//a:custGeom/a:gdLst/a:gd[1]", "fmla", "*/ 144 w 288"); +// The test reflects the state of Apr 2022. It needs to be adapted when export of handles and +// guides is implemented. +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 54f94278d782..1d2d601a40f0 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3857,6 +3857,83 @@ sal_Int32 GetCustomGeometryPointValue(const css::drawing::EnhancedCustomShapePar return nValue; } + +struct TextAreaRect +{ +OString left; +OString top; +OString right; +OString bottom; +}; + +struct Guide +{ +OString sName; +OString sFormula; +}; + +void prepareTextArea(const EnhancedCustomShape2d& rEnhancedCustomShape2d, +std::vector& rGuideList, TextAreaRect& rTextAreaRect) +{ +tools::Rectangle aTextAreaLO(rEnhancedCustomShape2d.GetTextRect()); +tools::Rectangle aLogicRectLO(rEnhancedCustomShape2d.GetLogicRect()); +if (aTextAreaLO == aLogicRectLO) +{ +rTextAreaRect.left = "l"; +rTextAreaRect.top = "t"; +rTextAreaRect.right = "r"; +rTextAreaRect.bottom = "b"; +return; +} +// Flip aTextAreaLO if shape is flipped +if (rEnhancedCustomShape2d.IsFlipHorz()) +aTextAreaLO.Move((aLogicRectLO.Center().X() - aTextAreaLO.Center().X()) * 2, 0); +if (rEnhancedCustomShape2d.IsFlipVert()) +aTextAreaLO.Move(0, (aLogicRectLO.Center().Y() - aTextAreaLO.Center().Y()) * 2); + +Guide aGuide; +// horizontal +const sal_Int32 nWidth = aLogicRectLO.Right() - aLogicRectLO.Left(); +const OString sWidth = OString::number(oox::drawingml::convertHmmToEmu(nWidth)); + +// left +
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/export.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9633cad413960a4bd2963a3ace25ad52d5747929 Author: Sarper Akdemir AuthorDate: Wed Mar 23 09:54:22 2022 +0300 Commit: Sarper Akdemir CommitDate: Wed Mar 23 09:28:51 2022 +0100 correct misleading comment Corrects copy/paste residue with the correct content Change-Id: Ie10a4db728de154ebbdaf6c7902b28c71c815456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131957 Tested-by: Jenkins Reviewed-by: Sarper Akdemir diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 24090b8e3cb3..8876d507dd9c 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -407,7 +407,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSi std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); -// Then make sure the shape text color is a scheme color: +// Make sure the text size is exported correctly: // Without the accompanying fix in place, this test would have failed with: // - Expected: 500 // - Actual : 1800
[Libreoffice-commits] core.git: oox/qa sw/qa
0 files changed New commits: commit e2b4b08549ee95288fe4cb6e8f71bc75574e0414 Author: Andrea Gelmini AuthorDate: Mon Feb 21 17:44:27 2022 +0100 Commit: Julien Nabet CommitDate: Tue Feb 22 07:04:45 2022 +0100 Removed executable bits on data files Change-Id: Ifcdae0106380de978c608f46e82155c6c9eed20b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130292 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/data/endParaRPr-newline-textsize.pptx b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx old mode 100755 new mode 100644 diff --git a/sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx b/sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx old mode 100755 new mode 100644
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/endParaRPr-newline-textsize.pptx |binary oox/qa/unit/export.cxx| 21 + oox/source/export/drawingml.cxx |4 3 files changed, 25 insertions(+) New commits: commit c92aa69bc63ffb2dddbde0bfb3fe80c7de67a06f Author: Sarper Akdemir AuthorDate: Tue Jan 11 02:06:52 2022 +0300 Commit: Andras Timar CommitDate: Sun Feb 20 13:48:34 2022 +0100 tdf#146690: pptx export: fix endParaRPr size value for empty paragraphs Fixes paragraphs made from a single new line, not getting the correct sz(text size) value in EndParagraphRunProperties on pptx export Change-Id: I31ebb5735ad392e081aa2f43b0b60a845e4de9c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128265 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/oox/qa/unit/data/endParaRPr-newline-textsize.pptx b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx new file mode 100755 index ..109f818ec8a7 Binary files /dev/null and b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 86656a0f8f68..24090b8e3cb3 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -395,6 +395,27 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) "75000"); assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) +{ +// Given a PPTX file that contains references to a theme: +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "endParaRPr-newline-textsize.pptx"; + +// When saving that document: +loadAndSave(aURL, "Impress Office Open XML"); + +std::unique_ptr pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); +// Then make sure the shape text color is a scheme color: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 500 +// - Actual : 1800 +// i.e. the endParaRPr 'size' wasn't exported correctly +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[1]/a:endParaRPr", "sz", "500"); +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[2]/a:endParaRPr", "sz", "500"); +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[3]/a:endParaRPr", "sz", "500"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 87bbe81bd88a..cb5383104a61 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3142,7 +3142,11 @@ void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph, Reference< XPropertySet > xFirstRunPropSet (run, UNO_QUERY); Reference< XPropertySetInfo > xFirstRunPropSetInfo = xFirstRunPropSet->getPropertySetInfo(); if( xFirstRunPropSetInfo->hasPropertyByName("CharHeight") ) +{ fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get(); +rnCharHeight = 100 * fFirstCharHeight; +rbOverridingCharHeight = true; +} WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_pPr); bPropertiesWritten = true; }
[Libreoffice-commits] core.git: oox/qa
0 files changed New commits: commit 310c14b75cd4a755b905dea4373c9c979370f493 Author: Andrea Gelmini AuthorDate: Tue Feb 15 18:59:07 2022 +0100 Commit: Julien Nabet CommitDate: Tue Feb 15 23:48:18 2022 +0100 Removed executable bits on pptx file Change-Id: Ib14e5357830b587921b633fb57fa74b1314aa1e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129975 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/data/testTdf132557_footerCustomShapes.pptx b/oox/qa/unit/data/testTdf132557_footerCustomShapes.pptx old mode 100755 new mode 100644
[Libreoffice-commits] core.git: oox/qa
0 files changed New commits: commit ea545653e17e687c9069543897975b3726dc6a2b Author: Andrea Gelmini AuthorDate: Wed Jan 5 18:32:52 2022 +0100 Commit: Julien Nabet CommitDate: Thu Jan 6 07:13:34 2022 +0100 Removed executable permission on pptx file Change-Id: I6a571f12f2e194a6d72a457622505cca72bd8eb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128021 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx b/oox/qa/unit/data/camera-rotation-revolution-nonwps.pptx old mode 100755 new mode 100644
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/refer-to-theme.pptx |binary oox/qa/unit/export.cxx | 25 - oox/source/export/drawingml.cxx | 24 ++-- 3 files changed, 42 insertions(+), 7 deletions(-) New commits: commit 51c3d8d7f6a2a3b95e97b9a151df0e63ff09cb74 Author: Miklos Vajna AuthorDate: Mon Dec 6 08:53:50 2021 +0100 Commit: Miklos Vajna CommitDate: Mon Dec 6 10:10:59 2021 +0100 PPTX export: handle theme color of shape text with effects Handle luminance modulation and offset (lighter and darker colors in PowerPoint); not handling tinting/shading for now, as that seems to be not used in DrawingML (only in WordprocessingML), and this code is for shape text only at the moment. Change-Id: I5e97f890d3072c7ef282ed4fb971362b3ddaaa4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126400 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/refer-to-theme.pptx b/oox/qa/unit/data/refer-to-theme.pptx index 9a45799ab977..9f05bf7b07e5 100644 Binary files a/oox/qa/unit/data/refer-to-theme.pptx and b/oox/qa/unit/data/refer-to-theme.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index fee130d77971..950a1559f621 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -343,7 +343,30 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) // - Actual : 0 // - XPath '//p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect // i.e. the element was not written. -assertXPath(pXmlDoc, "//p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", "accent1"); +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", +"accent1"); +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", 0); +assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); + +// Second shape: lighter color: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +// - XPath '//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect +// i.e. the effects case did not write scheme colors. +assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", +"accent1"); +assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", +"4"); +assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", "val", +"6"); + +// Third shape, darker color: +assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", +"accent1"); +assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", +"75000"); +assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0c8235a3a1da..249c897740a9 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -431,19 +431,31 @@ bool DrawingML::WriteCharColor(const css::uno::ReferencegetPropertyValue("CharColorLumMod") >>= nCharColorLumMod; -sal_Int32 nCharColorLumOff{}; -xPropertySet->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff; sal_Int32 nCharColorTintOrShade{}; xPropertySet->getPropertyValue("CharColorTintOrShade") >>= nCharColorTintOrShade; -if (nCharColorLumMod != 1 || nCharColorLumOff != 0 || nCharColorTintOrShade != 0) +if (nCharColorTintOrShade != 0) { return false; } mpFS->startElementNS(XML_a, XML_solidFill); -mpFS->singleElementNS(XML_a, XML_schemeClr, XML_val, pColorName); +mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, pColorName); + +sal_Int32 nCharColorLumMod{}; +xPropertySet->getPropertyValue("CharColorLumMod") >>= nCharColorLumMod; +if (nCharColorLumMod != 1) +{ +mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, OString::number(nCharColorLumMod * 10)); +} + +sal_Int32 nCharColorLumOff{}; +xPropertySet->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff; +if (nCharColorLumOff != 0) +{ +mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, OString::number(nCharColorLumOff * 10)); +} + +mpFS->endElementNS(XML_a, XML_schemeClr); mpFS->endElementNS(XML_a, XML_solidFill); return true;
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/chart-theme-override.pptx |binary oox/qa/unit/drawingml.cxx | 29 + oox/source/drawingml/shape.cxx | 22 ++ 3 files changed, 47 insertions(+), 4 deletions(-) New commits: commit e6968f0485cfb2f6c941d11c438386e14a47095d Author: Miklos Vajna AuthorDate: Mon Nov 15 09:23:20 2021 +0100 Commit: Miklos Vajna CommitDate: Mon Nov 15 10:41:16 2021 +0100 PPTX import: fix handling of theme overrides in the chart import A problem since commit 08818d8a45e034ad825c7fafbb76766f106f1d1d (bnc#882383: Do not ignore themeOverride for charts in .pptx, 2014-07-04), an override for one chart should not affect later drawingML objects. Change-Id: I22b70c8c82e8e8520179c628f566d7f6663c887f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125218 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/chart-theme-override.pptx b/oox/qa/unit/data/chart-theme-override.pptx new file mode 100644 index ..85243b678bdf Binary files /dev/null and b/oox/qa/unit/data/chart-theme-override.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index c7ba5ac61730..57e02545eb62 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -368,6 +369,34 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf142605_CurveSize) CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(5699), aBoundRect.Y, 1); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testChartThemeOverride) +{ +// Given a document with 2 slides, slide1 has a chart with a theme override and slide2 has a +// shape: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "chart-theme-override.pptx"; + +// When loading that document: +load(aURL); + +// Then make sure that the slide 2 shape's text color is blue, not red: +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(1), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xText(xShape->getText(), uno::UNO_QUERY); +uno::Reference xPara(xText->createEnumeration()->nextElement(), +uno::UNO_QUERY); +uno::Reference xPortion(xPara->createEnumeration()->nextElement(), + uno::UNO_QUERY); +sal_Int32 nActual{ 0 }; +xPortion->getPropertyValue("CharColor") >>= nActual; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 4485828 (0x4472c4) +// - Actual : 16711680 (0xff) +// i.e. the text color was red, not blue. +CPPUNIT_ASSERT_EQUAL(static_cast(0x4472C4), nActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index bc72e01dead6..69bf775ee5da 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1921,14 +1921,22 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rFilter.importFragment( pChartSpaceFragment ); ::oox::ppt::PowerPointImport *pPowerPointImport = dynamic_cast< ::oox::ppt::PowerPointImport* >(); + +// The original theme. +ThemePtr pTheme; + if (!aThemeOverrideFragmentPath.isEmpty() && pPowerPointImport) { +// Handle theme override. uno::Reference< xml::sax::XFastSAXSerializable > xDoc( rFilter.importFragment(aThemeOverrideFragmentPath), uno::UNO_QUERY_THROW); -ThemePtr pTheme = pPowerPointImport->getActualSlidePersist()->getTheme(); -rFilter.importFragment(new ThemeOverrideFragmentHandler( -rFilter, aThemeOverrideFragmentPath, *pTheme), xDoc); - pPowerPointImport->getActualSlidePersist()->setTheme(pTheme); +pTheme = pPowerPointImport->getActualSlidePersist()->getTheme(); +auto pThemeOverride = std::make_shared(*pTheme); +rFilter.importFragment( +new ThemeOverrideFragmentHandler(rFilter, aThemeOverrideFragmentPath, + *pThemeOverride), +xDoc); + pPowerPointImport->getActualSlidePersist()->setTheme(pThemeOverride); } // convert imported chart model to chart document @@ -1952,6 +1960,12 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter,
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf142602_CustomShapeArrows.odt |binary oox/qa/unit/export.cxx | 190 oox/source/export/DMLPresetShapeExport.cxx | 352 +-- 3 files changed, 516 insertions(+), 26 deletions(-) New commits: commit 504808fb5c372a94c6299eec90a281655eef47e4 Author: Daniel Arato (NISZ) AuthorDate: Fri Sep 10 13:51:24 2021 +0200 Commit: László Németh CommitDate: Tue Sep 21 13:26:54 2021 +0200 tdf#142602 DOCX: export adjustment points of custom shape arrows When exporting custom shape arrows LO used to fall back to writing out their plain vertex coordinates, losing the customizability of the shape after loading from file. This commit changes the export of some of the most commonly used arrow custom shapes to proper adjustment value export. Follow-up to commit 63cd67e5e18f01aca303131e148c80398a181a41 "tdf#92525 tdf#142398: fix export of simple custom shapes". Change-Id: If248556764bdb7e00cfde4ebe5b32bb380b1fa19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121901 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/qa/unit/data/tdf142602_CustomShapeArrows.odt b/oox/qa/unit/data/tdf142602_CustomShapeArrows.odt new file mode 100644 index ..bc0357a1a867 Binary files /dev/null and b/oox/qa/unit/data/tdf142602_CustomShapeArrows.odt differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 0e597adb2854..b649d546ead9 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -154,6 +154,196 @@ CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) assertXPath(pXmlDoc, "//wpg:grpSpPr/a:xfrm/a:chExt", "cx", "5328360"); assertXPath(pXmlDoc, "//wps:spPr/a:xfrm/a:ext", "cx", "5328360"); } + +CPPUNIT_TEST_FIXTURE(Test, testCustomShapeArrowExport) +{ +// Given a document with a few different kinds of arrow shapes in it: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf142602_CustomShapeArrows.odt"; +// When saving that to DOCX: +loadAndSave(aURL, "Office Open XML Text"); + +// Then the shapes should retain their correct control values. +uno::Reference xNameAccess += packages::zip::ZipFileAccess::createWithURL(mxComponentContext, getTempFile().GetURL()); +uno::Reference xInputStream(xNameAccess->getByName("word/document.xml"), + uno::UNO_QUERY); +std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + +// Without the fix the output OOXML would have no tags in it. + +// Right arrow +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom", +"prst", "rightArrow"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", +"fmla", "val 5"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", +"fmla", "val 46321"); + +// Left arrow +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom", +"prst", "leftArrow"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", +"fmla", "val 5"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", +"fmla", "val 52939"); + +// Down arrow +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom", +"prst", "downArrow"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", +"fmla", "val 5"); +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +"a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[2]", +"fmla", "val 59399"); + +// Up arrow +assertXPath(pXmlDoc, + "//w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/a:graphic/" +
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/smartart-groupshape.pptx |binary oox/qa/unit/drawingml.cxx | 19 +++ oox/source/drawingml/shape.cxx| 17 - 3 files changed, 35 insertions(+), 1 deletion(-) New commits: commit 030cdbc7f8782eb196f09661bc2f116d790de9be Author: Miklos Vajna AuthorDate: Fri Aug 6 16:56:30 2021 +0200 Commit: Miklos Vajna CommitDate: Fri Aug 6 17:46:43 2021 +0200 tdf#132696 PPTX import: fix missing SmartArt when it's part of a group shape Regression from commit e9986153e44d7ec6ca9c5f1373971de74dcbacda (PPTX import: import SmartArt drawing into single GroupShape, 2019-03-14), the problem was that oox::ppt::PPTShape::addShape() and oox::drawingml::Shape::addShape() were not in sync. PPTShape unconditionally maps SmartArt to shapes, while the shared Shape class defaults to converting it to a non-editable metafile. The above commit changed the handling of in-groupshape SmartArts to go via Shape::addShape() instead of PPTShape::addShape(), which exposed the underlying problem that the convert-to-metafile mechanism is currently only working in the DOCX case. Fix the problem by again ignoring the convert-to-metafile flag for the PPTX import case. This also exposed a previously hidden problem: make -C oox -sr CppunitTest_oox_drawingml CPPUNIT_TEST_NAME="testGroupShapeSmartArt testTdf131082" started to make testTdf131082 fail. The tweak in Shape::createAndInsert() fixes the testcase failure, but likely there is a deeper problem there, unrelated to the regression. Change-Id: I4e1e9645eaa266d0d7560767c3c59ba9549ccdb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120122 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/smartart-groupshape.pptx b/oox/qa/unit/data/smartart-groupshape.pptx new file mode 100644 index ..81dcee1e52a3 Binary files /dev/null and b/oox/qa/unit/data/smartart-groupshape.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 92d08b5f0c8a..c8dc0d9cc1fb 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -326,6 +326,25 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) verify(getComponent()); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGroupShapeSmartArt) +{ +// Given a file with a smartart inside a group shape: +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "smartart-groupshape.pptx"; + +// When loading that file: +load(aURL); + +// Then make sure that the smartart is not just an empty group shape: +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xSmartArt(xGroup->getByIndex(0), uno::UNO_QUERY); +// Without the accompanying fix in place, this test would have failed, because we lost all +// children of the group shape representing the smartart. +CPPUNIT_ASSERT_GREATER(static_cast(0), xSmartArt->getCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 64878fc772f4..89555c9da637 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -296,7 +296,12 @@ void Shape::addShape( if( meFrameType == FRAMETYPE_DIAGRAM ) { keepDiagramCompatibilityInfo(); -if( !SvtFilterOptions::Get().IsSmartArt2Shape() ) + +// Check if this is the PPTX import, so far converting SmartArt to a non-editable +// metafile is only imlemented for DOCX. +bool bPowerPoint = dynamic_cast() != nullptr; + +if (!SvtFilterOptions::Get().IsSmartArt2Shape() && !bPowerPoint) convertSmartArtToMetafile( rFilterBase ); } @@ -973,7 +978,17 @@ Reference< XShape > const & Shape::createAndInsert( Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW ); if ( !mxShape.is() ) +{ mxShape.set( xServiceFact->createInstance( aServiceName ), UNO_QUERY_THROW ); +if (aServiceName == "com.sun.star.drawing.GroupShape") +{ +// TODO why is this necessary? A newly created group shape should have an empty +// grab-bag. +uno::Reference xPropertySet(mxShape, uno::UNO_QUERY); +beans::PropertyValues aVals; +xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aVals)); +} +} Reference< XPropertySet > xSet( mxShape, UNO_QUERY ); if (xSet.is())
[Libreoffice-commits] core.git: oox/qa oox/source sw/qa
oox/qa/unit/data/tdf141786_PolylineConnectorInGroup.odt |binary oox/qa/unit/data/tdf141786_RotatedShapeInGroup.odt |binary oox/qa/unit/export.cxx | 55 oox/source/export/drawingml.cxx | 14 oox/source/export/shapes.cxx| 17 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 13 +-- 6 files changed, 91 insertions(+), 8 deletions(-) New commits: commit b33634a5c07c8f7032967d8e939100a50e0152ae Author: Regina Henschel AuthorDate: Sun Jul 11 15:31:58 2021 +0200 Commit: Regina Henschel CommitDate: Tue Jul 13 10:56:31 2021 +0200 tdf#141786 correct position of child elements in group ...in export to docx. Rotated child elements need a correction to the position values, because LO uses left/top of snap rectangle as position, but Word uses left/top of unrotated shape. For the group itself it is done in DocxSdrExport::startDMLAnchorInline. But child elements' position is exported in DrawingML::WriteShapeTransformation. And there this correction was missing. Position is relative to anchor in Writer and relative to group in Word. The adaption is contained in WriteShapeTransformation. But PolyPolygon and Connector have no explicit rotation and therefore they do not use DrawingML::WriteShapeTransformation but call directly DrawingML::WriteTransformation. So they missed this adaption. I have added the adapation directly to these shapes. Unittest testDmlTextshapeB in sw-ooxmlexport6: I have adapted the values. The position of the connectors relative to the group is better now. You see this, if you compare it with a screenshot of the original file in Word. The handles of the connectors are still wrong and the whole group is still shifted. The patch does not fix the wrong position of rotated legacy ovals, because that error exists independent of groups. Change-Id: Iaf843dcf04bac596427dd35ccfa6cd20e3a4cdc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118748 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf141786_PolylineConnectorInGroup.odt b/oox/qa/unit/data/tdf141786_PolylineConnectorInGroup.odt new file mode 100644 index ..d40dccac8c5e Binary files /dev/null and b/oox/qa/unit/data/tdf141786_PolylineConnectorInGroup.odt differ diff --git a/oox/qa/unit/data/tdf141786_RotatedShapeInGroup.odt b/oox/qa/unit/data/tdf141786_RotatedShapeInGroup.odt new file mode 100644 index ..e932cf47b8dc Binary files /dev/null and b/oox/qa/unit/data/tdf141786_RotatedShapeInGroup.odt differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 20ae35c6b727..0e597adb2854 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -77,6 +77,61 @@ void Test::loadAndSave(const OUString& rURL, const OUString& rFilterName) constexpr OUStringLiteral DATA_DIRECTORY = u"/oox/qa/unit/data/"; +CPPUNIT_TEST_FIXTURE(Test, testPolylineConnectorPosition) +{ +// Given a document with a group shape and therein a polyline and a connector. +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf141786_PolylineConnectorInGroup.odt"; +// When saving that to DOCX: +loadAndSave(aURL, "Office Open XML Text"); + +// Then make sure polyline and connector have the correct position. +uno::Reference xNameAccess += packages::zip::ZipFileAccess::createWithURL(mxComponentContext, getTempFile().GetURL()); +uno::Reference xInputStream(xNameAccess->getByName("word/document.xml"), + uno::UNO_QUERY); +std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); +xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + +// For child elements of groups in Writer the position has to be adapted to be relative +// to group instead of being relative to anchor. That was missing for polyline and +// connector. +// Polyline: Without fix it would have failed with expected: 0, actual: 1800360 +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "x", "0"); +// ... failed with expected: 509400, actual: 1229400 +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off", "y", "509400"); + +// Connector: Without fix it would have failed with expected: 763200, actual: 2563560 +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "x", "763200"); +// ... failed with expected: 0, actual: 72 +assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[3]/wps:spPr/a:xfrm/a:off", "y", "0"); +// Polyline and connector were shifted 1800360EMU right, 72EMU down. +} + +CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) +{ +// Given a document with a group shape and therein a rotated custom shape. +OUString aURL +
[Libreoffice-commits] core.git: oox/qa sw/qa sw/source writerfilter/source
oox/qa/unit/shape.cxx |1 - sw/qa/extras/uiwriter/uiwriter2.cxx |1 - sw/source/core/doc/textboxhelper.cxx|2 +- writerfilter/source/rtftok/rtftokenizer.cxx |1 - 4 files changed, 1 insertion(+), 4 deletions(-) New commits: commit 4bb8c8c41f95383839a3d532e39c2353a3d8d275 Author: Miklos Vajna AuthorDate: Mon Jun 14 20:51:32 2021 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 15 09:05:02 2021 +0200 Remove some unused includes See tdf#42949 for motivation. Change-Id: I559eb3b41a5a0fdb37db6c45d73211ca223384fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117193 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index a6949ff4fec3..88f86d3bb30e 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index df8028649248..54a907c3e26e 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -67,7 +67,6 @@ #include #include #include -#include #include #include diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 984d28a64bfc..b8edbb9918cd 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx index d702b8dbd9c9..6e9580ed51e2 100644 --- a/writerfilter/source/rtftok/rtftokenizer.cxx +++ b/writerfilter/source/rtftok/rtftokenizer.cxx @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include "rtfskipdestination.hxx" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/vml.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 60b98189281524c85b559ee3b6adc1381b793b9d Author: Jan-Marek Glogowski AuthorDate: Wed May 26 14:31:27 2021 +0200 Commit: Xisco Fauli CommitDate: Wed May 26 17:13:39 2021 +0200 tdf137314 Add margin to CppunitTest assertions The test had multiple failures on Windows with: oox/qa/unit/vml.cxx(79) : error : Assertion Test name: tdf137314_vml_rotation_unit_fd::TestBody equality assertion failed - Expected: 1490 - Actual : 1491 So add a 1px margin to all value checks. Change-Id: I70298db253299a57cc37eed482c0816d902fbeab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116192 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 4045b0336c7f..d3b84712a459 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -76,9 +76,9 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, tdf137314_vml_rotation_unit_fd) // Without fix in place, the vector was -1441|1490. // [1] and [2] are Bezier-curve control points. sal_Int32 nDiffX = aPolygon[3].X - aPolygon[0].X; -CPPUNIT_ASSERT_EQUAL(sal_Int32(1490), nDiffX); +CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1490), nDiffX, 1); sal_Int32 nDiffY = aPolygon[3].Y - aPolygon[0].Y; -CPPUNIT_ASSERT_EQUAL(sal_Int32(1441), nDiffY); +CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1441), nDiffY, 1); } CPPUNIT_TEST_FIXTURE(OoxVmlTest, testSpt202ShapeType) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx |binary oox/qa/unit/vml.cxx | 23 +++ oox/source/vml/vmlshape.cxx |7 ++--- 3 files changed, 26 insertions(+), 4 deletions(-) New commits: commit a312837a1a4d0b9628d5c587c8ab5ec68179a051 Author: Regina Henschel AuthorDate: Mon May 24 23:25:58 2021 +0200 Commit: Regina Henschel CommitDate: Tue May 25 11:22:41 2021 +0200 tdf#137314 apply conversion from vml angle unit 'fd' Fixes wrong rotation in tdf#109129 and tdf#142432 too, but they have further, unrelated errors. Change-Id: I7bd56876bb42b261fe425f80cf9beb639c3ac276 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116078 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx b/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx new file mode 100644 index ..17c8cabc0ce9 Binary files /dev/null and b/oox/qa/unit/data/tdf137314_vml_rotation_unit_fd.docx differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 0306333adcb0..4045b0336c7f 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -58,6 +59,28 @@ void OoxVmlTest::load(std::u16string_view rFileName) mxComponent = loadFromDesktop(aURL); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, tdf137314_vml_rotation_unit_fd) +{ +// Load a document with a 30deg rotated arc on a drawing canvas. Rotation is given +// as 1966080fd. Error was, that the vml angle unit "fd" was not converted to Degree100. +load(u"tdf137314_vml_rotation_unit_fd.docx"); +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShape(xGroup->getByIndex(1), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords; +xShapeProps->getPropertyValue("PolyPolygonBezier") >>= aPolyPolygonBezierCoords; +drawing::PointSequence aPolygon = aPolyPolygonBezierCoords.Coordinates[1]; +// Without fix in place, the vector was -1441|1490. +// [1] and [2] are Bezier-curve control points. +sal_Int32 nDiffX = aPolygon[3].X - aPolygon[0].X; +CPPUNIT_ASSERT_EQUAL(sal_Int32(1490), nDiffX); +sal_Int32 nDiffY = aPolygon[3].Y - aPolygon[0].Y; +CPPUNIT_ASSERT_EQUAL(sal_Int32(1441), nDiffY); +} + CPPUNIT_TEST_FIXTURE(OoxVmlTest, testSpt202ShapeType) { // Load a document with a groupshape, 2nd child is a , its type has o:spt set to 202 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d5ad6963ff85..98481299e412 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1083,10 +1083,9 @@ namespace { if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape)) { -// -1 is required because the direction of MSO rotation is the opposite of ours -// 100 is required because in this part of the code the angle is in a hundredth of -// degrees. -Degree100 nAngle( static_cast(-1 * 100.0 * rTypeModel.maRotation.toDouble()) ); +// The needed factor -1 for opposite direction and factor 100 for Degree100 is +// contained in method decodeRotation(). +Degree100 nAngle(ConversionHelper::decodeRotation(rTypeModel.maRotation)); pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa svx/qa sw/qa vcl/source writerfilter/qa writerfilter/source xmlsecurity/qa xmlsecurity/source
oox/qa/unit/vml.cxx|1 - svx/qa/unit/svdraw.cxx |1 - sw/qa/extras/layout/layout2.cxx|1 - vcl/source/filter/ipdf/pdfread.cxx |2 -- writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx |3 --- writerfilter/source/rtftok/rtfsdrimport.cxx|1 - xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx |1 - xmlsecurity/source/helper/documentsignaturemanager.cxx |1 - xmlsecurity/source/helper/pdfsignaturehelper.cxx |1 - 9 files changed, 12 deletions(-) New commits: commit 2c2a03340fbbe6747d0ae46d42c97ecd7a3a3d89 Author: Miklos Vajna AuthorDate: Thu Mar 11 21:01:55 2021 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 12 09:06:20 2021 +0100 Drop some unused includes Change-Id: Ic79d81387867f028eb8dc9553fb87f5961d6c771 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112364 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 01c45b64f3ae..0306333adcb0 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -19,7 +19,6 @@ #include #include #include -#include using namespace ::com::sun::star; diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 95aaea7f659d..d6e43d6f9887 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 12eb3b77e9c0..ed0db4a81ee8 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index f2730dbfe811..a9b8b1b8630e 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -12,8 +12,6 @@ #include #if HAVE_FEATURE_PDFIUM -#include -#include #include #endif diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index f89779ff131a..88ba238fae29 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -13,9 +13,6 @@ #include #include #include -#include -#include -#include #include diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 56b586c9e7c5..2308fdaf54c7 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include "rtfreferenceproperties.hxx" #include diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index 27a094d70ad7..c612962f86e3 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -14,7 +14,6 @@ #include #include -#include #include #include #include diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index d0ac3d0fc11a..78c2b4d59afa 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx index 1ce8bf08cf41..39d0ea1e12a7 100644 --- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx +++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx @@ -31,7 +31,6 @@ #include #include #include -#include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/drawingml.cxx | 38 +++--- oox/source/export/drawingml.cxx | 13 - oox/source/export/shapes.cxx|4 +++- 3 files changed, 42 insertions(+), 13 deletions(-) New commits: commit 252cdd5f43d65095543e317d37e1a0ea4fd839e0 Author: Miklos Vajna AuthorDate: Wed Dec 16 14:19:16 2020 +0100 Commit: Miklos Vajna CommitDate: Thu Dec 17 09:08:18 2020 +0100 tdf#129961 oox: add PPTX export for table shadow as direct format Custom shapes export shadow as part of WriteShapeEffects(), so use the same for table shapes as well. This needs fixing the effect export up a bit, because table shapes have no interop grab-bag, glow or soft edge properties, but the rest of the code can be shared. Change-Id: Icf0b90c5b44e3d9c4115c9f3b0d56ba0852ab640 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107836 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index d666b3d332a7..c7e72d458194 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -293,21 +293,37 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution) CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) { +auto verify = [](const uno::Reference& xComponent) { +uno::Reference xDrawPagesSupplier(xComponent, uno::UNO_QUERY); +uno::Reference xDrawPage( +xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +bool bShadow = false; +CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); + +CPPUNIT_ASSERT(bShadow); +sal_Int32 nColor = 0; +CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); +CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nColor); +}; OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-shadow.pptx"; load(aURL); -uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); -uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), - uno::UNO_QUERY); -uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); -bool bShadow = false; -CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); - // Without the accompanying fix in place, this test would have failed, because shadow on a table // was lost on import. -CPPUNIT_ASSERT(bShadow); -sal_Int32 nColor = 0; -CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); -CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nColor); +verify(getComponent()); + +uno::Reference xStorable(getComponent(), uno::UNO_QUERY); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML"); +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); +xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); +getComponent()->dispose(); +validate(aTempFile.GetFileName(), test::OOXML); +getComponent() = loadFromDesktop(aTempFile.GetURL()); +// Without the accompanying fix in place, this test would have failed, because shadow on a table +// was lost on export. +verify(getComponent()); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index f291de8662ef..f073fd21f06e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4056,7 +4056,8 @@ static sal_Int32 lcl_CalculateDir(const double dX, const double dY) void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) { Sequence< PropertyValue > aGrabBag, aEffects, aOuterShdwProps; -if( GetProperty( rXPropSet, "InteropGrabBag" ) ) +bool bHasInteropGrabBag = rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"); +if (bHasInteropGrabBag && GetProperty(rXPropSet, "InteropGrabBag")) { mAny >>= aGrabBag; auto pProp = std::find_if(std::cbegin(aGrabBag), std::cend(aGrabBag), @@ -4206,6 +4207,11 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet) { +if (!rXPropSet->getPropertySetInfo()->hasPropertyByName("GlowEffectRadius")) +{ +return; +} + sal_Int32 nRad = 0; rXPropSet->getPropertyValue("GlowEffectRadius") >>= nRad; if (!nRad) @@ -4228,6 +4234,11 @@ void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet) void DrawingML::WriteSoftEdgeEffect(const css::uno::Reference& rXPropSet) { +if (!rXPropSet->getPropertySetInfo()->hasPropertyByName("SoftEdgeRadius")) +{ +return; +} + sal_Int32 nRad = 0;
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/CryptoTest.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 7d2b9e17c01b602a983e42d1e52e6f730f08c7d5 Author: Stephan Bergmann AuthorDate: Fri Dec 11 11:10:05 2020 +0100 Commit: Stephan Bergmann CommitDate: Fri Dec 11 13:26:40 2020 +0100 Drop some unnecessary OUStringToOString conversions Change-Id: I7535065d37a5d56ace0fec90c4f146ff4ce2d753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107586 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/oox/qa/unit/CryptoTest.cxx b/oox/qa/unit/CryptoTest.cxx index 15f9ae158dc4..94f1f765fc2b 100644 --- a/oox/qa/unit/CryptoTest.cxx +++ b/oox/qa/unit/CryptoTest.cxx @@ -123,7 +123,7 @@ void CryptoTest::testStandard2007() SvMemoryStream aUnencryptedInput; SvMemoryStream aEncryptedStream; -OString aTestString = OUStringToOString("1234567890ABCDEFG", RTL_TEXTENCODING_UTF8); +OString aTestString = "1234567890ABCDEFG"; aUnencryptedInput.WriteBytes(aTestString.getStr(), aTestString.getLength() + 1); aUnencryptedInput.Seek(STREAM_SEEK_TO_BEGIN); @@ -343,7 +343,7 @@ void CryptoTest::testAgileEncryptingAndDecrypting() SvMemoryStream aEncryptionInfo; SvMemoryStream aEncryptedStream; -OString aTestString = OUStringToOString("1234567890ABCDEFGH", RTL_TEXTENCODING_UTF8); +OString aTestString = "1234567890ABCDEFGH"; { oox::crypto::AgileEngine aEngine; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/table-shadow.pptx |binary oox/qa/unit/drawingml.cxx | 19 +++ oox/source/drawingml/table/tablecontext.cxx |5 + 3 files changed, 24 insertions(+) New commits: commit b273e82aaa916b0f6198097dc32740faced73741 Author: Miklos Vajna AuthorDate: Thu Dec 10 13:57:58 2020 +0100 Commit: Miklos Vajna CommitDate: Thu Dec 10 15:27:09 2020 +0100 tdf#129961 oox: add PPTX import for table shadow as direct format PPTX export and ODP filter is still missing. Change-Id: I451b334ada80d9d228b7d7f36b5f26473b575ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107529 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/table-shadow.pptx b/oox/qa/unit/data/table-shadow.pptx new file mode 100644 index ..3247404cbc48 Binary files /dev/null and b/oox/qa/unit/data/table-shadow.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 0dd0f0991154..d666b3d332a7 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -291,6 +291,25 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution) CPPUNIT_ASSERT_EQUAL(static_cast(27000), nRotateAngle1); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-shadow.pptx"; +load(aURL); +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +bool bShadow = false; +CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); + +// Without the accompanying fix in place, this test would have failed, because shadow on a table +// was lost on import. +CPPUNIT_ASSERT(bShadow); +sal_Int32 nColor = 0; +CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); +CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx index bbfc94845369..84e80dccd710 100644 --- a/oox/source/drawingml/table/tablecontext.cxx +++ b/oox/source/drawingml/table/tablecontext.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -66,6 +67,10 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r rTableStyle = std::make_shared(); return new TableStyleContext( *this, rAttribs, *rTableStyle ); } +case A_TOKEN( effectLst ): // CT_EffectList +{ +return new EffectPropertiesContext(*this, mpShapePtr->getEffectProperties()); +} case A_TOKEN( tableStyleId ): // ST_Guid return new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa sfx2/qa svx/qa sw/qa xmloff/qa
oox/qa/unit/drawingml.cxx |1 + sfx2/qa/cppunit/test_misc.cxx |1 + svx/qa/unit/customshapes.cxx |1 + sw/qa/extras/htmlexport/htmlexport.cxx |1 + xmloff/qa/unit/draw.cxx|1 + 5 files changed, 5 insertions(+) New commits: commit 33ee9829fee1f6b80eb21b7a3d0e5a0f15ddf6f2 Author: Andras Timar AuthorDate: Wed Nov 4 22:08:24 2020 +0100 Commit: Andras Timar CommitDate: Thu Nov 5 09:23:42 2020 +0100 clean up some temp files after running tests Change-Id: Ia28e96cf1f6ec476f202e99877fa80e93d691278 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105314 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 6a0415b257f2..0dd0f0991154 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -88,6 +88,7 @@ void OoxDrawingmlTest::loadAndReload(const OUString& rURL, const OUString& rFilt utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); mxComponent->dispose(); validate(aTempFile.GetFileName(), test::OOXML); diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index 4ed4ba1fb11a..99c5aa40a696 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -113,6 +113,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail) uno::Reference xStorable(xComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xStorable.is()); utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); uno::Sequence aProperties( comphelper::InitPropertySequence({ { "NoThumbnail", uno::makeAny(true) } })); osl::File::remove(aTempFile.GetURL()); diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 57f1b5170b16..9117183acd29 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -780,6 +780,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176) // Save and reload uno::Reference xStorable(mxComponent, uno::UNO_QUERY); utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("draw8"); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index c96c1c8215b1..2554e7d23a7b 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1072,6 +1072,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument", aLoadProperties); xStorable.set(mxComponent, uno::UNO_QUERY); utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); aStoreProperties = { comphelper::makePropertyValue("FilterName", OUString("writer8")), }; diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 73d9ee918d34..8365b463efc6 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -56,6 +56,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss) getComponent() = loadFromDesktop(aURL); uno::Reference xStorable(getComponent(), uno::UNO_QUERY); utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/customshape-position.docx |binary oox/qa/unit/shape.cxx | 23 +++ oox/source/shape/ShapeContextHandler.cxx |9 + 3 files changed, 32 insertions(+) New commits: commit 80aba00e4945b106a276acf4ea28309b16e7c088 Author: Miklos Vajna AuthorDate: Tue Nov 3 17:55:02 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Nov 3 21:30:48 2020 +0100 tdf#128877 DOCX import: fix lost position of image cropped to shape Regression from commit f4ba484183a1e7b9824f10580d633466c266828f (ooxml import: supprt cropping to shape, 2019-05-13), which changed the type of a cropped-to-shape image from drawing.GraphicObjectShape to drawing.CustomShape. drawing.GraphicObjectShape worked because GraphicImport::lcl_attribute() in writerfilter/ had a check for drawing.GraphicObjectShape and did an explicit setPosition(). Doing the same for bitmap-filled custom shapes would be an option, but it would be ugly: scaling/translation/rotation/mirroring can only work together if they are only applied once, and that should happen in oox/, that's why we already have a mechanism to send the position from writerfilter/ to oox/ for WPS shapes. ( contains the size, but not the position of the shape, so oox/ in itself could not know the position.) Fix the problem by improving ShapeContextHandler instead the pass the position from writerfilter/ to oox/ for as well, the same is done for already since commit 6c4f737ec88a4f4dc5da8b2295ca5e7de2d4c24f (DOCX drawingML shape import: fix position when CustomShapeGeometry is set, 2013-11-21). Change-Id: I74a60136d0ca8383e58948711b47858823f42437 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105263 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/customshape-position.docx b/oox/qa/unit/data/customshape-position.docx new file mode 100644 index ..227928f201e6 Binary files /dev/null and b/oox/qa/unit/data/customshape-position.docx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 3dc173b1ed87..a57c779d00fd 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -12,6 +12,9 @@ #include #include +#include + +#include using namespace ::com::sun::star; @@ -65,6 +68,26 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testMultipleGroupShapes) CPPUNIT_ASSERT_EQUAL(static_cast(2), xDrawPage->getCount()); } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testCustomshapePosition) +{ +load("customshape-position.docx"); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + +sal_Int32 nY{}; +xShape->getPropertyValue("VertOrientPosition") >>= nY; +// 581025 in the document. +sal_Int32 nExpected = rtl::math::round(581025.0 / 360); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 1614 +// - Actual : 0 +// i.e. the position of the shape was lost on import due to the rounded corners. +CPPUNIT_ASSERT_EQUAL(nExpected, nY); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index c1cc28129eb0..2368de0a3629 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -504,6 +504,15 @@ ShapeContextHandler::getShape() else if (mpShape) { basegfx::B2DHomMatrix aTransformation; + +if (maPosition.X != 0 || maPosition.Y != 0) +{ +// We got a position from writerfilter/, store that in the shape, otherwise the +// position won't be set. +mpShape->setWps(true); +mpShape->setPosition(maPosition); +} + mpShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aTransformation, mpShape->getFillProperties() ); xResult.set(mpShape->getXShape()); mxGraphicShapeContext.clear( ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/camera-rotation-revolution.docx |binary oox/qa/unit/drawingml.cxx| 25 + oox/source/drawingml/shape.cxx |7 +++-- oox/source/export/drawingml.cxx | 32 +-- 4 files changed, 60 insertions(+), 4 deletions(-) New commits: commit a9c5c0d814a266096483572b84c72875ef8efd77 Author: Daniel Arato (NISZ) AuthorDate: Tue Sep 29 16:37:41 2020 +0200 Commit: László Németh CommitDate: Fri Oct 9 10:12:35 2020 +0200 tdf#133037 OOXML shape import: camera rotation along Z Instead of implementing proper OOXML 3D rotation (which would be an entirely new feature if I understand correctly), I merely interpret attribute "rev" of the rotation element a:camera/a:rot as a directive to rotate the entire shape the usual 2D way. That is already implemented and works well. This isn't the same thing Word does, but it might be good enough for now. This is kind of a mock solution, but it will be very easy to revert if it turns out to cause problems. Note: the export worked well previously, too (moreover, reloading the first LO export fixed the import). Change-Id: I2a99c119880bbed1c5b6430c4638cfbd10b7ac06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103627 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/qa/unit/data/camera-rotation-revolution.docx b/oox/qa/unit/data/camera-rotation-revolution.docx new file mode 100644 index ..74054aa82b3f Binary files /dev/null and b/oox/qa/unit/data/camera-rotation-revolution.docx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 7fcee1756a6f..6a0415b257f2 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -265,6 +265,31 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAdjustLeft) CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust_BLOCK, eAdjust); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "camera-rotation-revolution.docx"; +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape0(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShape1(xDrawPage->getByIndex(1), uno::UNO_QUERY); +uno::Reference xShapeProps0(xShape0, uno::UNO_QUERY); +uno::Reference xShapeProps1(xShape1, uno::UNO_QUERY); +sal_Int32 nRotateAngle0; +sal_Int32 nRotateAngle1; +xShapeProps0->getPropertyValue("RotateAngle") >>= nRotateAngle0; +xShapeProps1->getPropertyValue("RotateAngle") >>= nRotateAngle1; + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 8000 +// - Actual : 0 +// so the camera rotation would not have been factored into how the shape is displayed +CPPUNIT_ASSERT_EQUAL(static_cast(8000), nRotateAngle0); +CPPUNIT_ASSERT_EQUAL(static_cast(27000), nRotateAngle1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index c9ade16f7a1d..95b608eadcc6 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1461,11 +1461,14 @@ Reference< XShape > const & Shape::createAndInsert( else if( getTextBody() ) getTextBody()->getTextProperties().pushVertSimulation(); +// tdf#133037: a bit hackish: force Shape to rotate in the opposite direction the camera would rotate +const sal_Int32 nCameraRotation = get3DProperties().maCameraRotation.mnRevolution.get(0); + PropertySet aPropertySet(mxShape); -if ( !bUseRotationTransform && mnRotation != 0 ) +if ( !bUseRotationTransform && (mnRotation != 0 || nCameraRotation != 0) ) { // use the same logic for rotation from VML exporter (SimpleShape::implConvertAndInsert at vmlshape.cxx) -aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( NormAngle36000( mnRotation / -600 ) ) ) ); +aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( NormAngle36000( (mnRotation - nCameraRotation) / -600 ) ) ) ); aPropertySet.setAnyProperty( PROP_HoriOrientPosition, makeAny( maPosition.X ) ); aPropertySet.setAnyProperty( PROP_VertOrientPosition, makeAny( maPosition.Y ) ); } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4a9ac9f69014..c19b030ad642 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1708,7 +1708,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa {
[Libreoffice-commits] core.git: oox/qa oox/source sd/qa
oox/qa/unit/data/shape-text-adjust-left.pptx |binary oox/qa/unit/drawingml.cxx | 19 +++ oox/source/drawingml/shape.cxx | 16 ++ oox/source/drawingml/textbodypropertiescontext.cxx |5 sd/qa/unit/data/xml/n762695_0.xml |6 - sd/qa/unit/data/xml/n762695_1.xml | 10 - sd/qa/unit/data/xml/n819614_0.xml | 114 ++--- sd/qa/unit/data/xml/n820786_0.xml | 102 +- sd/qa/unit/data/xml/tdf109317_0.xml| 12 +- sd/qa/unit/import-tests.cxx|7 - 10 files changed, 160 insertions(+), 131 deletions(-) New commits: commit dfa1856cdb4c69985ef1e809d33055427b6fbd76 Author: Miklos Vajna AuthorDate: Mon Oct 5 21:06:01 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Oct 6 09:20:57 2020 +0200 tdf#137023 PPTX import: fix unexpected center alignment of shape text, 2nd try Regression from commit 10bb02efd8afd42e633e370480104e2575546d8e (tdf#129685 PPTX import: fix unexpected centering of shape text, 2020-09-18), now the problem was that some text should be left aligned, but was centered. Fix the problem by reverting most of the above commit: XML changes, changes to SdImportTest::testTdf113198() (manual testing show that this change is not needed after all) and changes to the TextBodyPropertiesContext ctor in oox/ (but not the testcase itself). Fix tdf#113198 again, this time in Shape::createAndInsert(), which is meant to be closer to what the binary PPT import does. With this, all cases from tdf#104722, tdf#113198, tdf#129685 and tdf#137023 are meant to be handled correctly at the same time. Change-Id: Id785252c26fc407cd74c9cfb55624091798d7773 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103996 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/data/shape-text-adjust-left.pptx b/oox/qa/unit/data/shape-text-adjust-left.pptx new file mode 100644 index ..d197425b9703 Binary files /dev/null and b/oox/qa/unit/data/shape-text-adjust-left.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 43609435c468..7fcee1756a6f 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -246,6 +247,24 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAlignment) static_cast(nParaAdjust)); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAdjustLeft) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "shape-text-adjust-left.pptx"; +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +drawing::TextHorizontalAdjust eAdjust; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 3 (center) +// - Actual : 1 (block) +// i.e. text was center-adjusted, not default-adjusted (~left). +CPPUNIT_ASSERT(xShape->getPropertyValue("TextHorizontalAdjust") >>= eAdjust); +CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust_BLOCK, eAdjust); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 5af4d51cbfd4..f8f65d09f59f 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1494,6 +1494,22 @@ Reference< XShape > const & Shape::createAndInsert( xText->setString(""); Reference < XTextCursor > xAt = xText->createTextCursor(); getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle ); + +const TextParagraphVector& rParagraphs = getTextBody()->getParagraphs(); +if (!rParagraphs.empty()) +{ +const std::shared_ptr& pParagraph = rParagraphs[0]; +if (pParagraph->getProperties().getParaAdjust()) +{ +style::ParagraphAdjust eAdjust = *pParagraph->getProperties().getParaAdjust(); +if (eAdjust == style::ParagraphAdjust_CENTER) +{ +// If the first paragraph is centered, then set the para adjustment of +// the shape itself to centered as well. +aPropertySet.setAnyProperty(PROP_ParaAdjust, uno::makeAny(eAdjust)); +} +} +} } } else if
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/CryptoTest.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 9623845206e18c6e8c76402fe538aeda95cfab9d Author: Andrea Gelmini AuthorDate: Sat Sep 26 21:04:11 2020 +0200 Commit: Julien Nabet CommitDate: Sun Sep 27 09:52:54 2020 +0200 Fix typo in code Tested before split here: https://gerrit.libreoffice.org/c/core/+/103464 Change-Id: Iadc9dd49762ec63bd8b3edba322bcbf5d0f862a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103487 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/CryptoTest.cxx b/oox/qa/unit/CryptoTest.cxx index c4058619e5c9..15f9ae158dc4 100644 --- a/oox/qa/unit/CryptoTest.cxx +++ b/oox/qa/unit/CryptoTest.cxx @@ -29,7 +29,7 @@ public: void testRoundUp(); void testStandard2007(); void testAgileEncryptionVerifier(); -void testAgileEncrpytionInfoWritingAndParsing(); +void testAgileEncryptionInfoWritingAndParsing(); void testAgileDataIntegrityHmacKey(); void testAgileEncryptingAndDecrypting(); @@ -38,7 +38,7 @@ public: CPPUNIT_TEST(testRoundUp); CPPUNIT_TEST(testStandard2007); CPPUNIT_TEST(testAgileEncryptionVerifier); -CPPUNIT_TEST(testAgileEncrpytionInfoWritingAndParsing); +CPPUNIT_TEST(testAgileEncryptionInfoWritingAndParsing); CPPUNIT_TEST(testAgileDataIntegrityHmacKey); CPPUNIT_TEST(testAgileEncryptingAndDecrypting); CPPUNIT_TEST_SUITE_END(); @@ -192,7 +192,7 @@ void CryptoTest::testAgileEncryptionVerifier() CPPUNIT_ASSERT_EQUAL(true, aEngine.decryptAndCheckVerifierHash(aPassword)); } -void CryptoTest::testAgileEncrpytionInfoWritingAndParsing() +void CryptoTest::testAgileEncryptionInfoWritingAndParsing() { OUString aPassword("Password"); std::vector aKeyDataSalt; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source sd/qa
oox/qa/unit/data/shape-text-alignment.pptx |binary oox/qa/unit/drawingml.cxx | 20 +++ oox/source/drawingml/shape.cxx |3 oox/source/drawingml/textbodypropertiescontext.cxx |5 sd/qa/unit/data/xml/n762695_0.xml |6 - sd/qa/unit/data/xml/n762695_1.xml | 10 - sd/qa/unit/data/xml/n819614_0.xml | 114 ++--- sd/qa/unit/data/xml/n820786_0.xml | 102 +- sd/qa/unit/data/xml/tdf109317_0.xml| 12 +- sd/qa/unit/import-tests.cxx|7 - 10 files changed, 153 insertions(+), 126 deletions(-) New commits: commit 10bb02efd8afd42e633e370480104e2575546d8e Author: Miklos Vajna AuthorDate: Fri Sep 18 17:53:33 2020 +0200 Commit: Miklos Vajna CommitDate: Fri Sep 18 20:12:00 2020 +0200 tdf#129685 PPTX import: fix unexpected centering of shape text Regression from commit 89f0af144c18efafe2573801641689a1432c0cae (tdf#113198 set default shape paragraph alignment.., 2019-11-19), the old bugdoc had this markup: (centered) The new bugdoc has 2 shapes with text: (aligned to left) (should be centered) "anchor" is about vertical, "anchorCtr" is about horizontal centering of text. Checking what the binary filter does, it maps horizontal centering to TextHorizontalAdjust, so fix the original bug differently, by leaving ParaAdjust alone, and tweaking TextHorizontalAdjust intead: this keeps the old bugdoc working but fixes the new one. This caused a number of "change detector" XML-based tests to fail: all of them are unchanged visually, so the XML files are adapted to the new state. The tdf#113198 fix itself was fixing a regression from tdf#104722, and that commit had no testcase, I tested that we don't regress there, manually. Change-Id: I81a7b3e8c76bfbce5c5569d16d5238958ac20f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103012 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/shape-text-alignment.pptx b/oox/qa/unit/data/shape-text-alignment.pptx new file mode 100644 index ..ff4ff06f2fdf Binary files /dev/null and b/oox/qa/unit/data/shape-text-alignment.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index d88f91797304..43609435c468 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -226,6 +227,25 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency) CPPUNIT_ASSERT_EQUAL(static_cast(0xff), aTransparence.EndColor); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAlignment) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "shape-text-alignment.pptx"; +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +sal_Int16 nParaAdjust = -1; +CPPUNIT_ASSERT(xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 3 +// i.e. text which is meant to be left-aligned was centered at a paragraph level. +CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, + static_cast(nParaAdjust)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 99fa848741b3..90d9e5379dde 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -210,7 +210,8 @@ void Shape::setDefaults(bool bHeight) if (bHeight) maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< float >( 18.0 )); maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, TextVerticalAdjust_TOP); -maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< sal_Int16 >( ParagraphAdjust_CENTER )); +maDefaultShapeProperties.setProperty(PROP_ParaAdjust, + static_cast(ParagraphAdjust_LEFT)); } ::oox::vml::OleObjectInfo& Shape::setOleObjectType() diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index c70b50273b2f..b72fa194401a 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -116,6 +116,11 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons { mrTextBodyProp.meVA =
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/graphic-stroke.pptx |binary oox/qa/unit/vml.cxx | 32 +++ oox/source/drawingml/graphicshapecontext.cxx |2 + oox/source/vml/vmlshape.cxx | 15 4 files changed, 49 insertions(+) New commits: commit b2d834d6727626f070bb4dde3e1c65da1169f729 Author: Miklos Vajna AuthorDate: Tue Aug 18 17:43:57 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Aug 18 21:51:22 2020 +0200 tdf#132555 PPTX VML import: handle stroke properties of image shapes ComplexShape::implConvertAndInsert() returns early in the graphic object shape case, so stroke model is not applied at all. Also fix a problem in ShapeBase::finalizeFragmentImport(), where the shape type had no stroke, but the shape itself had, and the later should win. The warning in OleObjectGraphicDataContext::onCreateContext() now points out that is ignored as a child of , which probably should be addressed at some stage, but it's not required to fix the missing stroke. Change-Id: I4ab43b4c6d40d9f43caad22b85f5b885fa8b4ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100952 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/graphic-stroke.pptx b/oox/qa/unit/data/graphic-stroke.pptx new file mode 100644 index ..f4465476fcc6 Binary files /dev/null and b/oox/qa/unit/data/graphic-stroke.pptx differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 089d61085b74..d43d2d5645ae 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -11,8 +11,10 @@ #include #include +#include #include #include +#include #include using namespace ::com::sun::star; @@ -109,6 +111,36 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testShapeNonAutosizeWithText) CPPUNIT_ASSERT_EQUAL(static_cast(5398), xShape->getSize().Width); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke) +{ +load("graphic-stroke.pptx"); +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +uno::Reference xShape; +for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i) +{ +uno::Reference xInfo(xDrawPage->getByIndex(i), uno::UNO_QUERY); +if (!xInfo->supportsService("com.sun.star.drawing.GraphicObjectShape")) +{ +continue; +} + +xShape.set(xInfo, uno::UNO_QUERY); +break; +} +CPPUNIT_ASSERT(xShape.is()); + +drawing::LineStyle eLineStyle{}; +xShape->getPropertyValue("LineStyle") >>= eLineStyle; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +// i.e. line style was NONE, not SOLID. +CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, eLineStyle); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 39a090bf43c4..61d96b583c67 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -226,6 +226,8 @@ ContextHandlerRef OleObjectGraphicDataContext::onCreateContext( sal_Int32 nEleme return new GraphicShapeContext( *this, mpMasterShapePtr, mpShapePtr ); break; } +SAL_WARN("oox", "OleObjectGraphicDataContext::onCreateContext: unhandled element: " +<< getBaseToken(nElement)); return nullptr; } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index b6fe01b08347..f22a98576a16 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -292,7 +292,15 @@ void ShapeBase::finalizeFragmentImport() if (aType[ 0 ] == '#') aType = aType.copy(1); if( const ShapeType* pShapeType = mrDrawing.getShapes().getShapeTypeById( aType ) ) +{ +// Make sure that the stroke props from maTypeModel have priority over the stroke props from +// the shape type. +StrokeModel aMergedStrokeModel; + aMergedStrokeModel.assignUsed(pShapeType->getTypeModel().maStrokeModel); +aMergedStrokeModel.assignUsed(maTypeModel.maStrokeModel); maTypeModel.assignUsed( pShapeType->getTypeModel() ); +maTypeModel.maStrokeModel = aMergedStrokeModel; +} else { // Temporary fix, shapetype not found if referenced from different substream // FIXME: extend scope of ShapeContainer to store all shapetypes from the document @@ -1346,6 +1354,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes // AS_CHARACTER shape: vertical orientation default is bottom, MSO default is top. if ( maTypeModel.maPosition != "absolute" &&
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/gradient-multistep-transparency.pptx |binary oox/qa/unit/drawingml.cxx | 27 + oox/source/drawingml/fillproperties.cxx | 36 -- 3 files changed, 60 insertions(+), 3 deletions(-) New commits: commit 73993fdb5d4b507694cd0edf80887d19f7e2bf9a Author: Miklos Vajna AuthorDate: Thu Aug 6 12:31:35 2020 +0200 Commit: Miklos Vajna CommitDate: Thu Aug 6 13:25:19 2020 +0200 tdf#134183 PPTX: improve import of transparency in multi-step gradients Impress core only support a single step, improve the conversion from multi-step to single step to take transparency into account explicitly. Once we select the widest segment, look backwards and forward if there are other next segments which have the same RGB color, just different transparency and include them. This helps in general, because in case a 0% or 100% transparency is mishandled, that's very visible. Change-Id: I11d593c01a6a4b16149ce74c1408c2a39895e941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100231 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/gradient-multistep-transparency.pptx b/oox/qa/unit/data/gradient-multistep-transparency.pptx new file mode 100644 index ..83946c71b403 Binary files /dev/null and b/oox/qa/unit/data/gradient-multistep-transparency.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index ee5ae764af70..d88f91797304 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -10,7 +10,9 @@ #include #include +#include #include +#include #include #include #include @@ -199,6 +201,31 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testChartDataLabelCharColor) CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nCharColor); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency) +{ +// Load a document with a multi-step gradient. +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "gradient-multistep-transparency.pptx"; +load(aURL); + +// Check the end transparency of the gradient. +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("Rectangle 4"), xShape->getName()); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +awt::Gradient aTransparence; +xShapeProps->getPropertyValue("FillTransparenceGradient") >>= aTransparence; + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 16777215 (0xff) +// - Actual : 3487029 (0x353535) +// i.e. the end transparency was not 100%, but was 21%, leading to an unexpected visible line on +// the right of this shape. +CPPUNIT_ASSERT_EQUAL(static_cast(0xff), aTransparence.EndColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index f203e9e2823e..7082cbee0186 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -512,21 +512,51 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, // convert DrawingML angle (in 1/6 degrees) to API angle (in 1/10 degrees) aGradient.Angle = static_cast< sal_Int16 >( (8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 ); Color aStartColor, aEndColor; + +// Try to grow the widest segment backwards: if a previous segment has the same +// color, just different transparency, include it. +while (aWidestSegmentStart != aGradientStops.begin()) +{ +auto it = std::prev(aWidestSegmentStart); +if (it->second.getColor(rGraphicHelper, nPhClr) +!= aWidestSegmentStart->second.getColor(rGraphicHelper, nPhClr)) +{ +break; +} + +aWidestSegmentStart = it; +} + +auto aWidestSegmentEnd = std::next(aWidestSegmentStart); +// Try to grow the widest segment forward: if a neext segment has the same +// color, just different transparency, include it. +while (aWidestSegmentEnd != std::prev(aGradientStops.end())) +{ +auto it = std::next(aWidestSegmentEnd); +if (it->second.getColor(rGraphicHelper, nPhClr) +!=
[Libreoffice-commits] core.git: oox/qa oox/source xmloff/source
oox/qa/unit/data/chart-data-label-char-color.docx |binary oox/qa/unit/drawingml.cxx | 43 ++ oox/source/drawingml/chart/seriesconverter.cxx| 37 ++ xmloff/source/chart/SchXMLSeries2Context.cxx | 20 ++ 4 files changed, 100 insertions(+) New commits: commit 8a43bfeffab9009c9f373e883fef87af1a7b3843 Author: Miklos Vajna AuthorDate: Wed Jul 15 09:36:23 2020 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 15 10:53:17 2020 +0200 tdf#131175 oox chart import: fix char color of , inherited from There were two problems here: 1) Our chart model expects the char formatting of a data label as direct formatting, so in case has no such formatting, but has, oox has to explicitly inherit. 2) The data label char formatting is represented using chart::FormattedString, but the char format of it is not (yet) exported to ODF. Given that the char format of the series and the individual data labels is the same, restore the same formatting on import to please rendering. With these, finally the chart labels in the bugdoc are white, not black (and have a dark background, so they are readable). Change-Id: Iebac5ce0be31a59bafb0f9fe7636330585e33822 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98770 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/chart-data-label-char-color.docx b/oox/qa/unit/data/chart-data-label-char-color.docx new file mode 100644 index ..0e389f9237c4 Binary files /dev/null and b/oox/qa/unit/data/chart-data-label-char-color.docx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index e1400c7bfe0c..ee5ae764af70 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -17,6 +17,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -156,6 +161,44 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPresetAdjustValue) CPPUNIT_ASSERT_EQUAL(static_cast(11587), aAdjustmentSeq[0].Value.get()); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testChartDataLabelCharColor) +{ +OUString aURL += m_directories.getURLFromSrc(DATA_DIRECTORY) + "chart-data-label-char-color.docx"; +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xModel(xShape->getPropertyValue("Model"), + uno::UNO_QUERY); +uno::Reference xDiagram(xModel->getFirstDiagram(), + uno::UNO_QUERY); + +uno::Reference xCoordinateSystem( +xDiagram->getCoordinateSystems()[0], uno::UNO_QUERY); + +uno::Reference xChartType(xCoordinateSystem->getChartTypes()[0], +uno::UNO_QUERY); + +uno::Reference xDataSeries = xChartType->getDataSeries()[0]; + +uno::Reference xDataPoint = xDataSeries->getDataPointByIndex(0); + +uno::Sequence> aLabels; +xDataPoint->getPropertyValue("CustomLabelFields") >>= aLabels; +uno::Reference xLabel = aLabels[0]; + +sal_Int32 nCharColor = 0; +xLabel->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 16777215 +// - Actual : -1 +// i.e. the data label had no explicit (white) color. +CPPUNIT_ASSERT_EQUAL(static_cast(0xff), nCharColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 4124d83d3d55..b34bc355ca4d 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -359,6 +359,42 @@ DataLabelsConverter::~DataLabelsConverter() { } +namespace +{ +/// Inherit text props (if not set) from text props (if set). +void InheritFromDataLabelsTextProps(const DataLabelsModel& rLabels, const DataLabelModel& rLabel) +{ +// See if contains text properties to inherit. +if (!rLabels.mxTextProp.is() || rLabels.mxTextProp->getParagraphs().empty()) +{ +return; +} + +const std::shared_ptr& rLabelsParagraph = rLabels.mxTextProp->getParagraphs()[0]; + +// See if lacks text properties. +if (rLabel.mxTextProp.is()) +{ +return; +} + +if (!rLabel.mxText || !rLabel.mxText->mxTextBody +|| rLabel.mxText->mxTextBody->getParagraphs().empty()) +{ +return; +} + +const std::shared_ptr& rLabelParagraph +=
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/preset-adjust-value.pptx |binary oox/qa/unit/drawingml.cxx | 30 +++- oox/source/drawingml/customshapeproperties.cxx |6 oox/source/drawingml/shapepropertiescontext.cxx |5 4 files changed, 39 insertions(+), 2 deletions(-) New commits: commit 408ec7a4470741edbedbb034de07a2d776348593 Author: Miklos Vajna AuthorDate: Wed Jun 10 11:07:43 2020 +0200 Commit: Miklos Vajna CommitDate: Wed Jun 10 14:47:09 2020 +0200 PPTX import: handle adjust values from both the shape and its placeholder The direct problem is a crash in CustomShapeProperties::pushToPropSet(), the code just hoped that the input file doesn't have more adjust values than the # of adjust values we allocate based on the preset type. Fix the crash, but there is a deeper problem here... The shape can inherit custom shape properties from a placeholder, then later it can have its own custom shape properties. When it comes to adjust values specifically, we used to just append own adjust values to the end of the list. This way we got the double of expected adjust values. And later rendering took the N expected adjust values from the start of the 2N element list, so we used the adjust values of the placeholder, not of the actual shape. Fix this by clearing the custom shape geometry once we know we have our own preset geometry. Change-Id: I09f669bf59c33b552b906733d323eba7af5548e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95993 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/data/preset-adjust-value.pptx b/oox/qa/unit/data/preset-adjust-value.pptx new file mode 100644 index ..d1d570a19d0a Binary files /dev/null and b/oox/qa/unit/data/preset-adjust-value.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index bc2f910bec9b..e1400c7bfe0c 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,7 @@ public: void setUp() override; void tearDown() override; uno::Reference& getComponent() { return mxComponent; } +void load(const OUString& rURL); void loadAndReload(const OUString& rURL, const OUString& rFilterName); }; @@ -68,9 +70,11 @@ void OoxDrawingmlTest::tearDown() test::BootstrapFixture::tearDown(); } +void OoxDrawingmlTest::load(const OUString& rURL) { mxComponent = loadFromDesktop(rURL); } + void OoxDrawingmlTest::loadAndReload(const OUString& rURL, const OUString& rFilterName) { -mxComponent = loadFromDesktop(rURL); +load(rURL); uno::Reference xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; @@ -128,6 +132,30 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf131082) CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPresetAdjustValue) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "preset-adjust-value.pptx"; + +load(aURL); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +uno::Sequence aGeoPropSeq; +xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeoPropSeq; +comphelper::SequenceAsHashMap aGeoPropMap(aGeoPropSeq); +uno::Sequence aAdjustmentSeq; +aGeoPropMap.getValue("AdjustmentValues") >>= aAdjustmentSeq; +CPPUNIT_ASSERT_EQUAL(static_cast(1), aAdjustmentSeq.getLength()); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 11587 +// - Actual : 10813 +// i.e. the adjust value was set from the placeholder, not from the shape. +CPPUNIT_ASSERT_EQUAL(static_cast(11587), aAdjustmentSeq[0].Value.get()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 3b530bddfed6..00ecf33368ae 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -203,7 +203,11 @@ void CustomShapeProperties::pushToPropSet( aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32(); aAdjustmentVal.State = PropertyState_DIRECT_VALUE; aAdjustmentVal.Name = adjustmentGuide.maName; -aAdjustmentSeq[ nIndex++ ] = aAdjustmentVal; +
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/vba_encryption.cxx |3 +-- oox/source/drawingml/hyperlinkcontext.cxx| 12 oox/source/drawingml/shape.cxx | 18 ++ oox/source/drawingml/textparagraph.cxx |3 +-- oox/source/drawingml/textparagraphproperties.cxx |3 +-- oox/source/ppt/presentationfragmenthandler.cxx |6 ++ 6 files changed, 15 insertions(+), 30 deletions(-) New commits: commit 54e35feef17580cfcbf0a2db1272fb05c85e2348 Author: Stephan Bergmann AuthorDate: Thu Jun 4 13:57:23 2020 +0200 Commit: Stephan Bergmann CommitDate: Thu Jun 4 18:10:45 2020 +0200 Upcoming loplugin:elidestringvar: oox Change-Id: I74da8354fe58c2800a7aaa4145356f61b388dc58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95507 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/oox/qa/unit/vba_encryption.cxx b/oox/qa/unit/vba_encryption.cxx index 7e8a44cd9c20..326711cae9fc 100644 --- a/oox/qa/unit/vba_encryption.cxx +++ b/oox/qa/unit/vba_encryption.cxx @@ -73,8 +73,7 @@ void TestVbaEncryption::testSimple2() void TestVbaEncryption::testProjKey1() { -OUString const aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}"); -sal_uInt8 nProjKey = VBAEncryption::calculateProjKey(aProjectID); +sal_uInt8 nProjKey = VBAEncryption::calculateProjKey("{917DED54-440B-4FD1-A5C1-74ACF261E600}"); CPPUNIT_ASSERT_EQUAL(int(0xdf), static_cast(nProjKey)); } diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 3c19892815d4..d0a09b140dcf 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -85,9 +85,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, sal_Int32 nIndex = aPPAct.indexOf( '?' ); OUString aPPAction( nIndex > 0 ? aPPAct.copy( 0, nIndex ) : aPPAct ); -const OUString sHlinkshowjump( "hlinkshowjump" ); -const OUString sHlinksldjump( "hlinksldjump" ); -if ( aPPAction.match( sHlinkshowjump ) ) +if ( aPPAction.match( "hlinkshowjump" ) ) { const OUString sJump( "jump=" ); if ( aPPAct.match( sJump, nIndex + 1 ) ) @@ -96,7 +94,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, sURL += "#action?jump=" + aDestination; } } -else if ( aPPAction.match( sHlinksldjump ) ) +else if ( aPPAction.match( "hlinksldjump" ) ) { sURL.clear(); @@ -121,12 +119,10 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, sal_Int32 nPageNumber = sHref.copy( nIndex2, nLength ).toInt32(); if ( nPageNumber ) { -const OUString sSlide( "slide" ); -const OUString sNotesSlide( "notesSlide" ); const OUString aSlideType( sHref.copy( 0, nIndex2 ) ); -if ( aSlideType.match( sSlide ) ) +if ( aSlideType.match( "slide" ) ) sURL = "#Slide " + OUString::number( nPageNumber ); -else if ( aSlideType.match( sNotesSlide ) ) +else if ( aSlideType.match( "notesSlide" ) ) sURL = "#Notes " + OUString::number( nPageNumber ); // else: todo for other types such as notesMaster or slideMaster as they can't be referenced easily } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 3fedf4dbb761..1e9d2ea55a46 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -587,16 +587,13 @@ static void lcl_createPresetShape(const uno::Reference& xShape, aGeomPropSeq ); // Reset old properties -const OUString sCoordinateSize( "CoordinateSize" ); -const OUString sEquations( "Equations" ); -const OUString sPath( "Path" ); const OUString sTextPath( "TextPath" ); const OUString sAdjustmentValues( "AdjustmentValues" ); const OUString sPresetTextWarp( "PresetTextWarp" ); -lcl_resetPropertyValue( aGeomPropVec, sCoordinateSize ); -lcl_resetPropertyValue( aGeomPropVec, sEquations ); -lcl_resetPropertyValue( aGeomPropVec, sPath ); +lcl_resetPropertyValue( aGeomPropVec, "CoordinateSize" ); +lcl_resetPropertyValue( aGeomPropVec, "Equations" ); +lcl_resetPropertyValue( aGeomPropVec, "Path" ); lcl_resetPropertyValue( aGeomPropVec, sAdjustmentValues); bool bFromWordArt(false); @@ -899,8 +896,7 @@ Reference< XShape > const & Shape::createAndInsert( } if( !msDescription.isEmpty() ) { -const OUString sDescription( "Description" ); -
[Libreoffice-commits] core.git: oox/qa writerfilter/IwyuFilter_writerfilter.yaml
oox/qa/unit/drawingml.cxx |1 - writerfilter/IwyuFilter_writerfilter.yaml |4 2 files changed, 4 insertions(+), 1 deletion(-) New commits: commit 3f3fa1259888b55cb472546821d80da90dfd80e5 Author: Miklos Vajna AuthorDate: Wed Apr 1 08:15:37 2020 +0200 Commit: Miklos Vajna CommitDate: Wed Apr 1 09:31:17 2020 +0200 Remove unused include Change-Id: Ifa3b50b6b31b4a8e8babf7695339848f6730bf11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91458 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 618c6da40a22..bc2f910bec9b 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/writerfilter/IwyuFilter_writerfilter.yaml b/writerfilter/IwyuFilter_writerfilter.yaml index d333bf61a060..2dd4de4a4099 100644 --- a/writerfilter/IwyuFilter_writerfilter.yaml +++ b/writerfilter/IwyuFilter_writerfilter.yaml @@ -60,3 +60,7 @@ blacklist: writerfilter/source/rtftok/rtftokenizer.cxx: # Actually used - com/sun/star/task/XStatusIndicator.hpp +writerfilter/source/filter/RtfFilter.cxx: +- comphelper/scopeguard.hxx +writerfilter/source/filter/WriterFilter.cxx: +- comphelper/scopeguard.hxx ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/tdf131082.pptx |binary oox/qa/unit/drawingml.cxx | 42 oox/source/drawingml/shape.cxx |2 + 3 files changed, 44 insertions(+) New commits: commit 3b250f0c009476cfe7d35ebd1d8220ceac440791 Author: nd101 AuthorDate: Tue Mar 3 15:19:07 2020 +0800 Commit: Xisco Faulí CommitDate: Fri Mar 20 11:05:59 2020 +0100 tdf#131082 fix missing fill property of grouped shapes When shapes are grouped together, and fill property is specified at the group level in MSO, it fails to work in IMPRESS. This fix is to set the fill property when it is being imported. Change-Id: I89920e71fc558f54d49ef7b065c549a732bc2b10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89862 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/oox/qa/unit/data/tdf131082.pptx b/oox/qa/unit/data/tdf131082.pptx new file mode 100644 index ..dbe88126f9c4 Binary files /dev/null and b/oox/qa/unit/data/tdf131082.pptx differ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 145723436c99..618c6da40a22 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -12,6 +12,9 @@ #include #include +#include +#include +#include #include #include @@ -20,6 +23,24 @@ using namespace ::com::sun::star; +namespace +{ +/// Gets one child of xShape, which one is specified by nIndex. +uno::Reference getChildShape(const uno::Reference& xShape, + sal_Int32 nIndex) +{ +uno::Reference xGroup(xShape, uno::UNO_QUERY); +CPPUNIT_ASSERT(xGroup.is()); + +CPPUNIT_ASSERT(xGroup->getCount() > nIndex); + +uno::Reference xRet(xGroup->getByIndex(nIndex), uno::UNO_QUERY); +CPPUNIT_ASSERT(xRet.is()); + +return xRet; +} +} + /// oox drawingml tests. class OoxDrawingmlTest : public test::BootstrapFixture, public unotest::MacrosTest { @@ -87,6 +108,27 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTransparentText) CPPUNIT_ASSERT_EQUAL(static_cast(75), nTransparency); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf131082) +{ +OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf131082.pptx"; +loadAndReload(aURL, "Impress Office Open XML"); + +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + +uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference XPropSet(getChildShape(getChildShape(xShape, 0), 0), + uno::UNO_QUERY); + +drawing::FillStyle eFillStyle = drawing::FillStyle_NONE; +XPropSet->getPropertyValue("FillStyle") >>= eFillStyle; + +// Without the accompanying fix in place, this test would have failed with: +// with drawing::FillStyle_NONE - 0 +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 2b2cec3debbf..eceae6273d06 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1037,6 +1037,8 @@ Reference< XShape > const & Shape::createAndInsert( mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle ); FillProperties aFillProperties = getActualFillProperties(pTheme, ); +if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill) +getFillProperties().assignUsed(aFillProperties); if(!bIsCroppedGraphic) aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV ); LineProperties aLineProperties = getActualLineProperties(pTheme); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/data/shape-non-autosize-with-text.docx |binary oox/qa/unit/vml.cxx| 18 ++ oox/source/vml/vmlshape.cxx|6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) New commits: commit 4ee7ee1c4a515479bc174543af4dbc400035c0ba Author: Miklos Vajna AuthorDate: Mon Mar 16 21:18:25 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 17 09:00:24 2020 +0100 tdf#131118 VML import: fix size of non-autosize shapes containing text Regression from commit b92293b3943423324064a8513c2e114d18817179 (tdf#103983 VML import: handle , 2020-01-20), the problem was that in case we disable autosize too late, then the size will be already set during adding text to the shape. Do it before adding text, this way adding text won't change the shape size, so it'll be correct at the end of the import. Change-Id: I9410fc695c3edfa5089d845864bf237e71c533c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90592 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/data/shape-non-autosize-with-text.docx b/oox/qa/unit/data/shape-non-autosize-with-text.docx new file mode 100644 index ..b9ae501f4b93 Binary files /dev/null and b/oox/qa/unit/data/shape-non-autosize-with-text.docx differ diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index b27876426956..089d61085b74 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -91,6 +91,24 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testSpt202ShapeType) CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.TextShape"), xShape->getShapeType()); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testShapeNonAutosizeWithText) +{ +// Load a document which has a group shape, containing a single child. +// 17.78 cm is the full group shape width, 19431/64008 is the child shape's relative width inside +// that, so 5.3975 cm should be the shape width. +load("shape-non-autosize-with-text.docx"); +uno::Reference xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); +uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); +uno::Reference xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY); +uno::Reference xShape(xGroup->getByIndex(0), uno::UNO_QUERY); +// Without the accompanying fix in place, this test would have failed with: +// - Actual : 1115 +// - Expected: 5398 +// because the width was determined using its text size, not using the explicit size. +CPPUNIT_ASSERT_EQUAL(static_cast(5398), xShape->getSize().Width); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 3444c1cd2743..0e9770a6cdbb 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -783,6 +783,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes eTextVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM; PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, makeAny(eTextVerticalAdjust)); +PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight, + makeAny(maTypeModel.mbAutoHeight)); + if (getTextBox()) { getTextBox()->convert(xShape); @@ -796,9 +799,6 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes xShape->setSize(aSize); } } - -PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight, - makeAny(maTypeModel.mbAutoHeight)); } // Import Legacy Fragments (if any) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/shape.cxx | 10 -- 1 file changed, 10 deletions(-) New commits: commit a435d465c0140612a281c86e972763802b72f820 Author: Miklos Vajna AuthorDate: Wed Feb 5 21:09:09 2020 +0100 Commit: Miklos Vajna CommitDate: Thu Feb 6 09:55:27 2020 +0100 CppunitTest_oox_shape: remove unused includes Change-Id: I00f7b042779aa981a5a6390c02f6f4ede59f3c89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88061 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 27d26aa91b57..1391138b166b 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -10,20 +10,10 @@ #include #include -#include #include -#include #include -#include -#include -#include #include -#include -#include -#include -#include -#include using namespace ::com::sun::star; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/vml.cxx |8 1 file changed, 8 deletions(-) New commits: commit 49574f685a8f54cc0d060bebb745deb8b7577025 Author: Miklos Vajna AuthorDate: Tue Jan 7 21:13:45 2020 +0100 Commit: Miklos Vajna CommitDate: Wed Jan 8 09:16:42 2020 +0100 Remove some unused includes Change-Id: Icc451b72fd0b4181a082f2ee2b85b82765bd0c31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86385 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index ad4e9e229739..fa3701735ec1 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -12,18 +12,10 @@ #include #include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include using namespace ::com::sun::star; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/drawingml.cxx |5 - 1 file changed, 5 deletions(-) New commits: commit ffa83824886c325b7a75100ae403efd6e5e9bda7 Author: Miklos Vajna AuthorDate: Thu Dec 19 21:04:59 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Dec 20 12:33:40 2019 +0100 CppunitTest_oox_drawingml: remove unneeded includes Change-Id: I33c524a3991fc3de226ebee3cc98ced18fb74886 Reviewed-on: https://gerrit.libreoffice.org/85547 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index e3c455c04867..f7fa171ff1ab 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -12,15 +12,10 @@ #include #include -#include #include #include -#include #include -#include -#include -#include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa writerfilter/source
oox/qa/unit/mathml.cxx |5 - writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 -- 2 files changed, 7 deletions(-) New commits: commit 87156783e5bc89709a1933efbbde82817715d5dc Author: Miklos Vajna AuthorDate: Tue Nov 26 16:05:38 2019 +0100 Commit: Miklos Vajna CommitDate: Tue Nov 26 18:56:47 2019 +0100 Remove some unused includes Change-Id: Ia24c806f227570f7a000e85eece75c9d02d25a4b Reviewed-on: https://gerrit.libreoffice.org/83782 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/oox/qa/unit/mathml.cxx b/oox/qa/unit/mathml.cxx index 0352c7a84ec4..3a5f928dad06 100644 --- a/oox/qa/unit/mathml.cxx +++ b/oox/qa/unit/mathml.cxx @@ -11,14 +11,9 @@ #include #include -#include #include -#include #include -#include -#include -#include using namespace ::com::sun::star; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e4fdc1d755eb..af97169166ed 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -10,13 +10,11 @@ #include "rtfdocumentimpl.hxx" #include #include -#include #include #include #include #include #include -#include #include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa package/source sal/qa sax/source sax/test
oox/qa/unit/vba_compression.cxx |3 +-- package/source/zippackage/ZipPackage.cxx|3 +-- sal/qa/osl/process/osl_Thread.cxx |3 +-- sal/qa/osl/process/osl_process.cxx |3 +-- sal/qa/rtl/doublelock/rtl_doublelocking.cxx |4 ++-- sax/source/fastparser/legacyfastparser.cxx |5 ++--- sax/test/sax/testsax.cxx|3 +-- sax/test/saxdemo.cxx|6 +++--- 8 files changed, 12 insertions(+), 18 deletions(-) New commits: commit b9448acf3ce4c1c850a691fc33686fd5165b94d9 Author: Julien Nabet AuthorDate: Sun Nov 24 21:23:59 2019 +0100 Commit: Julien Nabet CommitDate: Sun Nov 24 22:46:19 2019 +0100 cppcheck: performing init in init list (oox, package, sal, sax) Change-Id: I77e28f02516ab25ff6680970dc13d52cfa90eac1 Reviewed-on: https://gerrit.libreoffice.org/83620 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 9299a3de9eaa..0ade756e363f 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -54,8 +54,7 @@ public: private: static OUString const & getDebugDirUrl() { struct DebugDirUrl { -DebugDirUrl() { -url = "$UserInstallation/debug/"; +DebugDirUrl() : url("$UserInstallation/debug/") { rtl::Bootstrap::expandMacros(url); //TODO: provide an OUString -> OUString expansion function, and which throws on // failure diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index a7e632472c67..7a0b8c1934ec 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1157,9 +1157,8 @@ namespace private: rtlRandomPool m_aRandomPool; public: -RandomPool() +RandomPool() : m_aRandomPool(rtl_random_createPool ()) { -m_aRandomPool = rtl_random_createPool (); } rtlRandomPool get() { diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index 3c9891b76e54..d551f471d989 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -263,9 +263,8 @@ class OCountThread : public Thread { ThreadSafeValue m_aFlag; public: -OCountThread() +OCountThread() : m_nWaitSec(0) { -m_nWaitSec = 0; t_print("new OCountThread thread %u!\n", static_cast(getIdentifier())); } sal_Int32 getValue() { return m_aFlag.getValue(); } diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index 104f9238eea6..4555a0d83394 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -161,10 +161,9 @@ public: // ctor Test_osl_executeProcess() : -env_param_(OUString("-env")) +env_param_(OUString("-env")), suCWD(getExecutablePath()) { parameters_[0] = env_param_.pData; -suCWD = getExecutablePath(); #if defined(_WIN32) suExecutableFileURL = suCWD + "/" "osl_process_child.exe"; diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx index 6f59e55e62cd..ef639423d774 100644 --- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx +++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx @@ -64,9 +64,9 @@ class OGetThread : public osl::Thread public: OGetThread() :m_nOK(0), - m_nFails(0) + m_nFails(0), + m_sConstStr(CONST_TEST_STRING) { -m_sConstStr = CONST_TEST_STRING; } sal_Int32 getOK() { osl::MutexGuard g(m_mutex); return m_nOK; } diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx index 2f355c956b4c..6399e5069a44 100644 --- a/sax/source/fastparser/legacyfastparser.cxx +++ b/sax/source/fastparser/legacyfastparser.cxx @@ -283,10 +283,9 @@ void SAL_CALL CallbackDocumentHandler::characters( const OUString& aChars ) m_xDocumentHandler->characters( aChars ); } -SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new NamespaceHandler ) +SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new NamespaceHandler ), + m_xParser(FastParser::create(::comphelper::getProcessComponentContext() )) { -m_xParser = FastParser::create( -::comphelper::getProcessComponentContext() ); m_xParser->setNamespaceHandler( m_aNamespaceHandler.get() ); } diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index 2ef67e9aae1f..06b0421c248b 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -236,9 +236,8 @@ class TestDocumentHandler : { public: TestDocumentHandler( const Reference < XMultiServiceFactory > , sal_Bool bPrint ) + : m_bPrint(bPrint),
[Libreoffice-commits] core.git: oox/qa oox/source
oox/qa/unit/CryptoTest.cxx |4 ++-- oox/source/crypto/Standard2007Engine.cxx |7 +-- 2 files changed, 7 insertions(+), 4 deletions(-) New commits: commit ce7fb7473bc72d8a672c4fdcd49474721c9a2784 Author: Tomaž Vajngerl Date: Wed Jul 4 21:41:17 2018 +0200 oox: Standard2007Engine - take size into account when decrypting Change-Id: I3a28344d28136c9785a9476b490d296143abfacf Reviewed-on: https://gerrit.libreoffice.org/56973 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/oox/qa/unit/CryptoTest.cxx b/oox/qa/unit/CryptoTest.cxx index c35fa2f7d9a0..0dead9dcec6e 100644 --- a/oox/qa/unit/CryptoTest.cxx +++ b/oox/qa/unit/CryptoTest.cxx @@ -115,7 +115,7 @@ void CryptoTest::testStandard2007() OString aTestString = OUStringToOString("1234567890ABCDEFG", RTL_TEXTENCODING_UTF8); -aUnencryptedInput.WriteOString(aTestString); +aUnencryptedInput.WriteBytes(aTestString.getStr(), aTestString.getLength() + 1); aUnencryptedInput.Seek(STREAM_SEEK_TO_BEGIN); { @@ -156,7 +156,7 @@ void CryptoTest::testStandard2007() const sal_Char* pData = static_cast(aUnencryptedOutput.GetData()); sal_uInt64 nSize = aUnencryptedOutput.GetSize(); -CPPUNIT_ASSERT_EQUAL(sal_uInt64(32), nSize); +CPPUNIT_ASSERT_EQUAL(sal_uInt64(18), nSize); OString aString(pData); diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index 6da188f514c5..d1d92269d96c 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -151,7 +151,7 @@ bool Standard2007Engine::generateEncryptionKey(const OUString& password) bool Standard2007Engine::decrypt(BinaryXInputStream& aInputStream, BinaryXOutputStream& aOutputStream) { -aInputStream.skip(4); // Document unencrypted size - 4 bytes +sal_uInt32 totalSize = aInputStream.readuInt32(); // Document unencrypted size - 4 bytes aInputStream.skip(4); // Reserved 4 Bytes std::vector iv; @@ -160,11 +160,14 @@ bool Standard2007Engine::decrypt(BinaryXInputStream& aInputStream, std::vector outputBuffer(4096); sal_uInt32 inputLength; sal_uInt32 outputLength; +sal_uInt32 remaining = totalSize; while ((inputLength = aInputStream.readMemory(inputBuffer.data(), inputBuffer.size())) > 0) { outputLength = aDecryptor.update(outputBuffer, inputBuffer, inputLength); -aOutputStream.writeMemory(outputBuffer.data(), outputLength); +sal_uInt32 writeLength = std::min(outputLength, remaining); +aOutputStream.writeMemory(outputBuffer.data(), writeLength); +remaining -= outputLength; } return true; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/vba_compression.cxx | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) New commits: commit e6aec5ad0a0db4f41f90b39971c296732372cadf Author: Stephan BergmannDate: Wed Nov 15 15:13:35 2017 +0100 Don't pollute /tmp with vba_debug* files ...put them at workdir/CppunitTest/oox_vba_compression.test.user/debug/ instead. Change-Id: I067a82c05e2f91969d70cb582d69c4c1de13951c diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 6541c8517411..2c083e8a8c95 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -10,8 +10,9 @@ #include #include #include - +#include #include +#include #include #include #include @@ -19,7 +20,6 @@ class TestVbaCompression : public CppUnit::TestFixture { public: - // just a sequence of bytes that should not be compressed at all void testSimple1(); @@ -52,6 +52,22 @@ public: CPPUNIT_TEST_SUITE_END(); private: +static OUString const & getDebugDirUrl() { +struct DebugDirUrl { +DebugDirUrl() { +url = "$UserInstallation/debug/"; +rtl::Bootstrap::expandMacros(url); +//TODO: provide an OUString -> OUString expansion function, and which throws on +// failure +auto e = osl::Directory::create(url); +CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e); +} +OUString url; +}; +static DebugDirUrl url; +return url.url; +} + test::Directories m_directories; }; @@ -86,7 +102,7 @@ void TestVbaCompression::testSimple1() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); ReadFiles(aTestFile, aReference, aOutputMemoryStream, -aReferenceMemoryStream, "/tmp/vba_debug.bin"); +aReferenceMemoryStream, getDebugDirUrl() + "vba_debug.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -108,7 +124,7 @@ void TestVbaCompression::testSimple2() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug2.bin"); +ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug2.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -130,7 +146,7 @@ void TestVbaCompression::testSimple3() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug3.bin"); +ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug3.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -152,7 +168,7 @@ void TestVbaCompression::testComplex1() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_complex1.bin"); +ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_complex1.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -174,7 +190,7 @@ void TestVbaCompression::testSpec321() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec321.bin"); +ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_spec321.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -196,7 +212,7 @@ void TestVbaCompression::testSpec322() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec322.bin"); +ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_spec322.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -218,7 +234,7 @@ void TestVbaCompression::testSpec323() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); -ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec323.bin"); +ReadFiles(aTestFile, aReference,
[Libreoffice-commits] core.git: oox/qa oox/source opencl/source package/source reportdesign/source sal/osl sal/textenc sax/source
oox/qa/unit/vba_encryption.cxx |2 +- oox/source/core/binarycodec.cxx|4 +--- oox/source/crypto/Standard2007Engine.cxx |3 +-- oox/source/drawingml/shape.cxx |5 + oox/source/export/ColorPropertySet.cxx |3 +-- oox/source/export/chartexport.cxx | 15 +-- oox/source/export/shapes.cxx |3 +-- oox/source/ole/olehelper.cxx |2 +- opencl/source/opencl_device.cxx|3 +-- package/source/xstor/xstorage.cxx |5 + package/source/zippackage/ZipPackage.cxx | 15 --- package/source/zippackage/ZipPackageFolder.cxx |4 +--- reportdesign/source/core/api/ReportDefinition.cxx | 12 +++- reportdesign/source/core/api/ReportEngineJFree.cxx |5 ++--- reportdesign/source/core/misc/reportformula.cxx|4 +--- reportdesign/source/ui/dlg/Navigator.cxx |3 +-- reportdesign/source/ui/report/ReportController.cxx |3 +-- reportdesign/source/ui/report/dlgedfunc.cxx|3 +-- sal/osl/all/filepath.cxx |3 +-- sal/osl/unx/file_misc.cxx |4 +--- sal/osl/unx/pipe.cxx |3 +-- sal/textenc/convertisciidevangari.cxx |2 +- sal/textenc/convertsinglebytetobmpunicode.cxx |3 +-- sax/source/expatwrap/saxwriter.cxx |6 ++ 24 files changed, 35 insertions(+), 80 deletions(-) New commits: commit 979c8c56b7d52fe9a5d4b1fbfdab0adaba04c470 Author: Noel GrandinDate: Sun Jun 25 18:20:04 2017 +0200 loplugin:oncevar in oox..sax Change-Id: I0fee8bcddaeea48335e3be05761d2ad2c45020e2 Reviewed-on: https://gerrit.libreoffice.org/39238 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/oox/qa/unit/vba_encryption.cxx b/oox/qa/unit/vba_encryption.cxx index 37dfeff636f4..60164cb4bc32 100644 --- a/oox/qa/unit/vba_encryption.cxx +++ b/oox/qa/unit/vba_encryption.cxx @@ -73,7 +73,7 @@ void TestVbaEncryption::testSimple2() void TestVbaEncryption::testProjKey1() { -OUString aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}"); +OUString const aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}"); sal_uInt8 nProjKey = VBAEncryption::calculateProjKey(aProjectID); CPPUNIT_ASSERT_EQUAL((int)0xdf, (int)nProjKey); } diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx index 72ae862a0f14..84660d6abb54 100644 --- a/oox/source/core/binarycodec.cxx +++ b/oox/source/core/binarycodec.cxx @@ -146,8 +146,6 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] ) for (sal_Int32 nIndex = nLen; nIndex < static_cast(sizeof(mpnKey)); ++nIndex, ++pnFillChar ) mpnKey[ nIndex ] = *pnFillChar; -size_t nRotateSize = 2; - // use little-endian base key to create key array sal_uInt8 pnBaseKeyLE[ 2 ]; pnBaseKeyLE[ 0 ] = static_cast< sal_uInt8 >( mnBaseKey ); @@ -156,7 +154,7 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] ) for (sal_Int32 nIndex = 0; nIndex < static_cast(sizeof(mpnKey)); ++nIndex, ++pnKeyChar ) { *pnKeyChar ^= pnBaseKeyLE[ nIndex & 1 ]; -lclRotateLeft( *pnKeyChar, nRotateSize ); +lclRotateLeft( *pnKeyChar, 2/*nRotateSize*/ ); } } diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index b9c259fa02ac..a11780fddc52 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -203,8 +203,7 @@ void Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu rStream.writeUnicodeArray(lclCspName); rStream.WriteUInt16(0); -sal_uInt32 encryptionVerifierSize = static_cast(sizeof(msfilter::EncryptionVerifierAES)); -rStream.writeMemory(, encryptionVerifierSize); +rStream.writeMemory(, sizeof(msfilter::EncryptionVerifierAES)); } void Standard2007Engine::encrypt(BinaryXInputStream& aInputStream, diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7d04518b5f25..a01fd47075d0 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1197,9 +1197,6 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase ) Reference < io::XStream > xStream( new utl::OStreamWrapper( aTempStream ) ); Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() ); -// Rendering format -OUString sFormat( "SVM" ); - // Size of the rendering awt::Size aActualSize = mxShape->getSize(); Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MapUnit::MapCM ) ); @@ -1221,7
[Libreoffice-commits] core.git: oox/qa ucb/qa
oox/qa/unit/vba_compression.cxx | 18 +++--- oox/qa/unit/vba_encryption.cxx | 17 + ucb/qa/cppunit/webdav/webdav_local_neon.cxx | 21 +++-- 3 files changed, 7 insertions(+), 49 deletions(-) New commits: commit 3d82b08bcea45408b1998934558e2e28721125df Author: Stephan BergmannDate: Thu Mar 10 11:06:29 2016 +0100 These tests can just derive from plain CppUnit::TestFixture ...and then no longer need to override any base class setUp/tearDown Change-Id: Iaea19dfb341325bb45062d0ac0b5fa1eed0d34e0 diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 5302c16..6541c85 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -7,17 +7,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - #include #include #include #include #include +#include #include -class TestVbaCompression : public test::BootstrapFixtureBase +class TestVbaCompression : public CppUnit::TestFixture { public: @@ -42,10 +41,6 @@ public: // section 3.2.3 void testSpec323(); -// avoid the BootstrapFixtureBase::setUp and tearDown -virtual void setUp() override; -virtual void tearDown() override; - CPPUNIT_TEST_SUITE(TestVbaCompression); CPPUNIT_TEST(testSimple1); CPPUNIT_TEST(testSimple2); @@ -57,6 +52,7 @@ public: CPPUNIT_TEST_SUITE_END(); private: +test::Directories m_directories; }; namespace { @@ -237,14 +233,6 @@ void TestVbaCompression::testSpec323() } } -void TestVbaCompression::setUp() -{ -} - -void TestVbaCompression::tearDown() -{ -} - CPPUNIT_TEST_SUITE_REGISTRATION(TestVbaCompression); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/qa/unit/vba_encryption.cxx b/oox/qa/unit/vba_encryption.cxx index 0e3c5ab..37dfeff 100644 --- a/oox/qa/unit/vba_encryption.cxx +++ b/oox/qa/unit/vba_encryption.cxx @@ -7,8 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include - #include #include #include @@ -16,7 +14,7 @@ #include #include -class TestVbaEncryption : public test::BootstrapFixtureBase +class TestVbaEncryption : public CppUnit::TestFixture { public: @@ -29,17 +27,11 @@ public: void testProjKey1(); -// avoid the BootstrapFixtureBase::setUp and tearDown -virtual void setUp() override; -virtual void tearDown() override; - CPPUNIT_TEST_SUITE(TestVbaEncryption); // CPPUNIT_TEST(testSimple1); // CPPUNIT_TEST(testSimple2); CPPUNIT_TEST(testProjKey1); CPPUNIT_TEST_SUITE_END(); - -private: }; #if 0 @@ -86,13 +78,6 @@ void TestVbaEncryption::testProjKey1() CPPUNIT_ASSERT_EQUAL((int)0xdf, (int)nProjKey); } -void TestVbaEncryption::setUp() -{ -} -void TestVbaEncryption::tearDown() -{ -} - CPPUNIT_TEST_SUITE_REGISTRATION(TestVbaEncryption); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx index d65e6f7..b509229 100644 --- a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx +++ b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx @@ -7,7 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include +#include #include #include "NeonUri.hxx" @@ -15,17 +16,10 @@ namespace { -class webdav_local_test: public test::BootstrapFixture +class webdav_local_test: public CppUnit::TestFixture { public: -webdav_local_test() : BootstrapFixture( true, true ) {} - -// initialise your test code values here. -void setUp( ) override; - -void tearDown( ) override; - void NeonUriTest(); // Change the following lines only, if you add, remove or rename @@ -37,15 +31,6 @@ namespace CPPUNIT_TEST_SUITE_END(); }; // class webdav_local_test -// initialise your test code values here. -void webdav_local_test::setUp() -{ -} - -void webdav_local_test::tearDown() -{ -} - void webdav_local_test::NeonUriTest() { //try URL decomposition ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/qa
oox/qa/unit/vba_compression.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 823150ff153a6e02781b1b2b09ea6eb528111d2e Author: Caolán McNamaraDate: Thu Sep 10 10:31:38 2015 +0100 include algorithm for std::min Change-Id: I7b57b8f1c86b3ed1e31467fc7c094b3520d4e74e diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 72b7bb2..3e36bd5 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -14,6 +14,7 @@ #include #include +#include class TestVbaCompression : public test::BootstrapFixtureBase { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits