[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/ppt/animationspersist.cxx| 10 -- sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 16 3 files changed, 24 insertions(+), 2 deletions(-) New commits: commit c33ec20ebadcc957b4fbbaf0267bed17efda97cd Author: Szymon KłosDate: Tue Mar 13 20:57:52 2018 +0100 tdf#104792 Double check for target shape Change-Id: Ibe23377c7752d9ce97c7b100af4b2759b3ce946f Reviewed-on: https://gerrit.libreoffice.org/51241 Tested-by: Jenkins Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/51410 Reviewed-by: Andras Timar diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx index 94cdd9672e39..ac93174bc4ac 100644 --- a/oox/source/ppt/animationspersist.cxx +++ b/oox/source/ppt/animationspersist.cxx @@ -141,8 +141,14 @@ namespace oox { namespace ppt { sShapeName = maShapeTarget.msSubShapeId; Any rTarget; -::oox::drawingml::ShapePtr pShape = pSlide->getShape(sShapeName); -SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape"); +::oox::drawingml::ShapePtr pShape = pSlide->getShape( sShapeName ); +SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape" ); + +if( !pShape && maShapeTarget.mnType == XML_dgm ) +{ +pShape = pSlide->getShape( msValue ); +} + if( pShape ) { Reference< XShape > xShape( pShape->getXShape() ); diff --git a/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx b/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx new file mode 100644 index ..ac72639efd77 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index c998c45c6709..14cb434926a7 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -111,6 +111,8 @@ public: void testGroupsRotatedPosition(); void testAccentColor(); void testTdf114848(); +/// SmartArt animated elements +void testTdf104792(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -143,6 +145,7 @@ public: CPPUNIT_TEST(testGroupsRotatedPosition); CPPUNIT_TEST(testAccentColor); CPPUNIT_TEST(testTdf114848); +CPPUNIT_TEST(testTdf104792); CPPUNIT_TEST_SUITE_END(); @@ -908,6 +911,19 @@ void SdOOXMLExportTest2::testTdf114848() assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d"); } +void SdOOXMLExportTest2::testTdf104792() +{ +::sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); + +xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:set/p:cBhvr/p:tgtEl/p:spTgt", 1); + +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/drawingml/chart/seriesconverter.cxx | 34 - sd/qa/unit/data/pptx/tdf114821.pptx|binary sd/qa/unit/import-tests.cxx| 49 + 3 files changed, 73 insertions(+), 10 deletions(-) New commits: commit 326c9766281e6f80abc042420f1d4be3a27b8aa9 Author: Szymon KłosDate: Wed Jan 3 13:24:32 2018 +0100 tdf#114821 calculate better label position Positioning hack was improved. It calculates position depending on direct chart size factor. Preffered label positions are: top - vertical, and center - horizontal Change-Id: Ic25f08cd0bc3105fe34841dbc3f8aacacb694d43 Reviewed-on: https://gerrit.libreoffice.org/48909 Tested-by: Jenkins Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/48928 Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index a1f2cb737c7f..c2a183363a21 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -54,13 +54,30 @@ using namespace ::com::sun::star::uno; namespace { -/** nested-up sgn function - employs some gratuity around 0 - values - smaller than 0.33 are clamped to 0 +/** Function to get vertical position of label from chart height factor. +Value can be negative, prefer top placement. */ -int lclSgn( double nVal ) +int lclGetPositionY( double nVal ) { -const int intVal=nVal*3; -return intVal == 0 ? 0 : (intVal < 0 ? -1 : 1); +if( nVal <= 0.1 ) +return -1; +else if( nVal <= 0.6 ) +return 0; +else +return 1; +} + +/** Function to get horizontal position of label from chart width factor. +Value can be negative, prefer center placement. +*/ +int lclGetPositionX( double nVal ) +{ +if( nVal <= -0.2 ) +return -1; +else if( nVal <= 0.2 ) +return 0; +else +return 1; } Reference< XLabeledDataSequence > lclCreateLabeledDataSequence( @@ -236,11 +253,8 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat csscd::LEFT,csscd::CENTER, csscd::RIGHT, csscd::BOTTOM_LEFT, csscd::BOTTOM, csscd::BOTTOM_RIGHT }; -const double nMax=std::max( -fabs(mrModel.mxLayout->mfX), -fabs(mrModel.mxLayout->mfY)); -const int simplifiedX=lclSgn(mrModel.mxLayout->mfX/nMax); -const int simplifiedY=lclSgn(mrModel.mxLayout->mfY/nMax); +const int simplifiedX = lclGetPositionX(mrModel.mxLayout->mfX); +const int simplifiedY = lclGetPositionY(mrModel.mxLayout->mfY); aPropSet.setProperty( PROP_LabelPlacement, aPositionsLookupTable[ simplifiedX+1 + 3*(simplifiedY+1) ] ); } diff --git a/sd/qa/unit/data/pptx/tdf114821.pptx b/sd/qa/unit/data/pptx/tdf114821.pptx new file mode 100644 index ..3813b0607903 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf114821.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index fd3b5721af27..2ab15a7763eb 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,7 @@ public: void testTdf109223(); void testActiveXCheckbox(); void testTdf108926(); +void testTdf114821(); bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector& rExpected); void testPatternImport(); @@ -237,6 +239,7 @@ public: CPPUNIT_TEST(testTdf109223); CPPUNIT_TEST(testActiveXCheckbox); CPPUNIT_TEST(testTdf108926); +CPPUNIT_TEST(testTdf114821); CPPUNIT_TEST_SUITE_END(); }; @@ -2313,6 +2316,52 @@ void SdImportTest::testTdf108926() xDocShRef->DoClose(); } +void SdImportTest::testTdf114821() +{ +css::uno::Any aAny; +sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "/sd/qa/unit/data/pptx/tdf114821.pptx" ), PPTX ); + +uno::Reference< beans::XPropertySet > xPropSet( getShapeFromPage( 0, 0, xDocShRef ) ); +aAny = xPropSet->getPropertyValue( "Model" ); +CPPUNIT_ASSERT_MESSAGE( "The shape doesn't have the property", aAny.hasValue() ); + +uno::Reference< chart::XChartDocument > xChartDoc; +aAny >>= xChartDoc; +CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChartDoc.is() ); +uno::Reference< chart2::XChartDocument > xChart2Doc( xChartDoc, uno::UNO_QUERY ); +CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart2Doc.is() ); + +uno::Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( xChart2Doc->getFirstDiagram(), uno::UNO_QUERY ); +uno::Sequence< uno::Reference<
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/export/drawingml.cxx | 17 + sd/qa/unit/data/pptx/group-rot.pptx |binary sd/qa/unit/data/pptx/group.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 30 ++ 4 files changed, 47 insertions(+) New commits: commit 25470a3cf04c0244a1bcda46d7064a7c727ae65f Author: Szymon KÅosDate: Tue Oct 24 22:39:08 2017 +0200 PPTX export: correct position of rotated groups * added testcase for tdf#113263 Change-Id: I7abf68d8fb4ffd8b883cfbf4d69916912add8182 Reviewed-on: https://gerrit.libreoffice.org/43794 Tested-by: Jenkins Reviewed-by: Szymon KÅos Reviewed-on: https://gerrit.libreoffice.org/43990 Reviewed-by: Andras Timar diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index badd82c9b319..fef1316517b4 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1186,11 +1186,17 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa awt::Point aPos = rXShape->getPosition(); awt::Size aSize = rXShape->getSize(); +bool bPositiveY = true; +bool bPositiveX = true; + if (m_xParent.is()) { awt::Point aParentPos = m_xParent->getPosition(); aPos.X -= aParentPos.X; aPos.Y -= aParentPos.Y; + +bPositiveX = aParentPos.X > 0; +bPositiveY = aParentPos.Y > 0; } if ( aSize.Width < 0 ) @@ -1208,6 +1214,17 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2; } +else if(nRotation == 18000) +{ +if (!bFlipV && bPositiveX) +{ +aPos.X -= aSize.Width; +} +if (!bFlipH && bPositiveY) +{ +aPos.Y -= aSize.Height; +} +} // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here. uno::Reference xPropertySet(rXShape, uno::UNO_QUERY); diff --git a/sd/qa/unit/data/pptx/group-rot.pptx b/sd/qa/unit/data/pptx/group-rot.pptx new file mode 100755 index ..11b2d6367da0 Binary files /dev/null and b/sd/qa/unit/data/pptx/group-rot.pptx differ diff --git a/sd/qa/unit/data/pptx/group.pptx b/sd/qa/unit/data/pptx/group.pptx new file mode 100755 index ..8895fe2a2203 Binary files /dev/null and b/sd/qa/unit/data/pptx/group.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index ef4b5f90aebf..9722d2de9b36 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -107,6 +107,8 @@ public: void testTdf112557(); void testTdf112647(); void testSmartartRotation2(); +void testGroupsPosition(); +void testGroupsRotatedPosition(); void testAccentColor(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -136,6 +138,8 @@ public: CPPUNIT_TEST(testTdf112557); CPPUNIT_TEST(testTdf112647); CPPUNIT_TEST(testSmartartRotation2); +CPPUNIT_TEST(testGroupsPosition); +CPPUNIT_TEST(testGroupsRotatedPosition); CPPUNIT_TEST(testAccentColor); CPPUNIT_TEST_SUITE_END(); @@ -846,6 +850,32 @@ void SdOOXMLExportTest2::testSmartartRotation2() assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr", "rot", "1080"); } +void SdOOXMLExportTest2::testGroupsPosition() +{ +::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "4817880"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "1810440"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "457200"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "1798560"); +} + +void SdOOXMLExportTest2::testGroupsRotatedPosition() +{ +::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group-rot.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDocContent,
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/export/drawingml.cxx | 14 ++ sd/qa/unit/data/pptx/tdf112633.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 30 ++ 3 files changed, 40 insertions(+), 4 deletions(-) New commits: commit 3e250d0a392c37e9e610bd83017a3045c4c02638 Author: Jacobo Aragunde PérezDate: Thu Oct 12 13:30:47 2017 +0200 tdf#112633 oox: Save backup images to proper path in document Artistic effects on bitmap images in OOXML files create a backup file with the original image. These were not being saved into the proper path for PPTX files because the `/word` directory was hardcoded in the export code. The path saved to the relations file was incorrect too because it was not taking into account that the relations file is saved to a subdir in PPTX and XLSX documents. Finally, added a unit test. Reviewed-on: https://gerrit.libreoffice.org/43338 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 55641f5572f3168c09e096eb89ca563652889758) Change-Id: I3e880ce763dc10dbc86ccf0e00871be5d36f6d88 Reviewed-on: https://gerrit.libreoffice.org/43600 Reviewed-by: Michael Stahl Tested-by: Michael Stahl diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4b327f63d76f..48720d923144 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3448,16 +3448,22 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 ); OUString sFileName = "media/hdphoto" + OUString::number( mnWdpImageCounter++ ) + ".wdp"; -uno::Reference< io::XOutputStream > xOutStream = -mpFB->openFragmentStream( "word/" + sFileName, - "image/vnd.ms-photo" ); +Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer() + .appendAscii( GetComponentDir() ) + .append( "/" ) + .append( sFileName ) + .makeStringAndClear(), + "image/vnd.ms-photo" ); OUString sId; xOutStream->writeBytes( rPictureData ); xOutStream->closeOutput(); sId = mpFB->addRelation( mpFS->getOutputStream(), oox::getRelationship(Relationship::HDPHOTO), - sFileName ); + OUStringBuffer() + .appendAscii( GetRelationCompPrefix() ) + .append( sFileName ) + .makeStringAndClear() ); maWdpCache[rFileId] = sId; return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); diff --git a/sd/qa/unit/data/pptx/tdf112633.pptx b/sd/qa/unit/data/pptx/tdf112633.pptx new file mode 100644 index ..b9e062967132 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112633.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index ab59ffe226b1..11f8598cedff 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -104,6 +104,7 @@ public: void testBulletCharAndFont(); void testBulletMarginAndIndentation(); void testParaMarginAndindentation(); +void testTdf112633(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -131,6 +132,7 @@ public: CPPUNIT_TEST(testBulletCharAndFont); CPPUNIT_TEST(testBulletMarginAndIndentation); CPPUNIT_TEST(testParaMarginAndindentation); +CPPUNIT_TEST(testTdf112633); CPPUNIT_TEST_SUITE_END(); @@ -779,6 +781,34 @@ void SdOOXMLExportTest1::testTableCellBorder() xDocShRef->DoClose(); } +void SdOOXMLExportTest1::testTdf112633() +{ +// Load document and export it to a temporary file +::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112633.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); +xmlDocPtr pRelsDoc = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + +// Check image with artistic effect exists in the slide +assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/" +"a14:imgLayer/a14:imgEffect/a14:artisticPencilGrayscale", +"pencilSize", "80"); + +// Check there is a relation with the .wdp file
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/core/fragmenthandler2.cxx |1 oox/source/ole/axcontrolfragment.cxx | 19 ++ oox/source/vml/vmlshapecontext.cxx |4 ++- sd/qa/unit/data/pptx/activex_checkbox.pptx |binary sd/qa/unit/import-tests.cxx| 37 + 5 files changed, 60 insertions(+), 1 deletion(-) New commits: commit ceb23063726a938caa691aa73a9dd9c773e35134 Author: Tamás ZolnaiDate: Sun Aug 13 18:39:32 2017 +0200 tdf#111548: PPTX: ActiveX checkbox control appear as picture Make ActiveX controls import working again (PPTX / XLSX) It used to work earlier, but there were an issue with the shape id and so controls were not find. Also in PPTX import the persistStorage attribute was handled only for parent controls and not for other kind of controls. Reviewed-on: https://gerrit.libreoffice.org/40751 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit c8e3633a352c2fda3aebb9781288a926e7a88c42) tdf#111548: Better fix for PPTX / XLSX import of ActiveX controls Follow up fix for: c8e3633a352c2fda3aebb9781288a926e7a88c42 Revert part of it and fix the real issue: shapid was messed up. Reviewed-on: https://gerrit.libreoffice.org/40929 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 286c27e805c4501451857abff19c23b3719146a3) Change-Id: I9784166b65407b79b6dfed8a38087b55b1b69835 Reviewed-on: https://gerrit.libreoffice.org/41117 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx index 4bd32f4e7a77..76ef5ec1e32c 100644 --- a/oox/source/core/fragmenthandler2.cxx +++ b/oox/source/core/fragmenthandler2.cxx @@ -77,6 +77,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis "p14", "p15", "x12ac", +"v", }; if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end()) diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx index 4a76adc9e2f6..b6503a7b0651 100644 --- a/oox/source/ole/axcontrolfragment.cxx +++ b/oox/source/ole/axcontrolfragment.cxx @@ -130,11 +130,30 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath ); if( xStrgStrm.is() ) { +// Try to import as a parent control +bool bImportedAsParent = false; OleStorage aStorage( getFilter().getComponentContext(), xStrgStrm, false ); BinaryXInputStream aInStrm( aStorage.openInputStream( "f" ), true ); if( !aInStrm.isEof() ) +{ if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModelFromGuid( aClassId ) ) ) +{ pModel->importBinaryModel( aInStrm ); +bImportedAsParent = true; +} +} +// Import it as a non-parent control +if(!bImportedAsParent) +{ +BinaryXInputStream aInStrm2(aStorage.openInputStream("contents"), true); +if (!aInStrm2.isEof()) +{ +if (ControlModelBase* pModel = mrControl.createModelFromGuid(aClassId)) +{ +pModel->importBinaryModel(aInStrm2); +} +} +} } } } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 02cf06e51429..9311351601d5 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -282,10 +282,12 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r { mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() ); // get ShapeType and ShapeId from name for compatibility -mrTypeModel.maShapeId = mrTypeModel.maShapeName; static const OUString sShapeTypePrefix = "shapetype_"; if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) ) +{ +
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/drawingml/lineproperties.cxx | 32 + sd/qa/unit/data/tdf100491.pptx |binary sd/qa/unit/data/xml/fdo47434_0.xml | 52 +- sd/qa/unit/data/xml/tdf100491_0.xml | 563 sd/qa/unit/import-tests.cxx |1 5 files changed, 618 insertions(+), 30 deletions(-) New commits: commit 235f16a7c50de9908ce32fd6f1347c7b888bc1b7 Author: Vasily MelenchukDate: Fri Jul 21 18:40:20 2017 +0300 tdf#100491 fix DOCX import shape line with arrow marker Line shape with arrow end markers was rendering rather thick arrow, not connected to main line. Moreover, arrow width should depend on actual line width. Change-Id: I8d9a6e7f5d89a1645dcc5939ecc592e86e6fe34f Reviewed-on: https://gerrit.libreoffice.org/40286 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens (cherry picked from commit 2d3b7a07c02c90d2d64a630ab84886ef3096edfc) Reviewed-on: https://gerrit.libreoffice.org/40437 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index dabe5d71356b..43495e709561 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -205,14 +205,19 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, if( !aBuffer.isEmpty() ) { +bool bIsArrow = nArrowType == XML_arrow; sal_Int32 nLength = lclGetArrowSize( rArrowProps.moArrowLength.get( XML_med ) ); sal_Int32 nWidth = lclGetArrowSize( rArrowProps.moArrowWidth.get( XML_med ) ); sal_Int32 nNameIndex = nWidth * 3 + nLength + 1; aBuffer.append( ' ' ).append( nNameIndex ); +if (bIsArrow) +{ +// Arrow marker form depends also on line width +aBuffer.append(' ').append(nLineWidth); +} OUString aMarkerName = aBuffer.makeStringAndClear(); -bool bIsArrow = nArrowType == XML_arrow; double fArrowLength = 1.0; switch( nLength ) { @@ -229,7 +234,7 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, } // set arrow width relative to line width sal_Int32 nBaseLineWidth = ::std::max< sal_Int32 >( nLineWidth, 70 ); -nMarkerWidth = static_cast< sal_Int32 >( fArrowWidth * nBaseLineWidth ); +nMarkerWidth = static_cast( fArrowWidth * nBaseLineWidth ); /* Test if the marker already exists in the marker table, do not create it again in this case. If markers are inserted explicitly @@ -238,7 +243,11 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, if( !rPropMap.hasNamedLineMarkerInTable( aMarkerName ) ) { // pass X and Y as percentage to OOX_ARROW_POINT -#define OOX_ARROW_POINT( x, y ) awt::Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) ) +#define OOX_ARROW_POINT( x, y ) awt::Point( static_cast< sal_Int32 >( fArrowWidth * ( x ) ), static_cast< sal_Int32 >( fArrowLength * ( y ) ) ) +// tdf#100491 Arrow line marker, unlike other markers, depends on line width. +// So calculate width of half line (more convinient during drawing) taking into account +// further conversions/scaling done in OOX_ARROW_POINT macro and scaling to nMarkerWidth. +const double fArrowLineHalfWidth = ::std::max< double >( 100.0 * 0.5 * nLineWidth / nMarkerWidth, 1 ); ::std::vector< awt::Point > aPoints; OSL_ASSERT((rArrowProps.moArrowType.get() & sal_Int32(0x))==0); @@ -251,13 +260,16 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap, aPoints.push_back( OOX_ARROW_POINT( 50, 0 ) ); break; case XML_arrow: -aPoints.push_back( OOX_ARROW_POINT( 50, 0 ) ); -aPoints.push_back( OOX_ARROW_POINT( 100, 91 ) ); -aPoints.push_back( OOX_ARROW_POINT( 85, 100 ) ); -aPoints.push_back( OOX_ARROW_POINT( 50, 36 ) ); -aPoints.push_back( OOX_ARROW_POINT( 15, 100 ) ); -aPoints.push_back( OOX_ARROW_POINT( 0, 91 ) ); -aPoints.push_back( OOX_ARROW_POINT( 50, 0 ) ); +aPoints.push_back( OOX_ARROW_POINT( 50, 0 ) ); +aPoints.push_back( OOX_ARROW_POINT( 100, 100 - fArrowLineHalfWidth * 1.5) ); +aPoints.push_back( OOX_ARROW_POINT( 100 - fArrowLineHalfWidth * 1.5, 100 ) ); +aPoints.push_back( OOX_ARROW_POINT( 50.0 + fArrowLineHalfWidth, 5.5 * fArrowLineHalfWidth) ); +aPoints.push_back( OOX_ARROW_POINT(
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sd/qa
oox/source/ppt/presentationfragmenthandler.cxx |4 ++-- sd/qa/unit/data/pptx/tdf89064.pptx |binary sd/qa/unit/import-tests.cxx| 13 + 3 files changed, 15 insertions(+), 2 deletions(-) New commits: commit 814dbf3624b9e8608882b003d96dfb51fa3634fc Author: Paul TrojahnDate: Tue Jun 6 23:05:10 2017 +0200 tdf#89064 Fix import of pages with comments and notes importSlide removes the shapes on the page. It was used to import the comments and authors, which resulted in an empty notes page. Change-Id: I7d68085b482e5497d46e92328c413c87440714a0 Reviewed-on: https://gerrit.libreoffice.org/38648 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit c2da33ead8b093b12ebb9a0ea9c06d156c41a3e6) Reviewed-on: https://gerrit.libreoffice.org/39043 Reviewed-by: Paul Trojahn diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 8dc1392bed81..30f9af5e1301 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -301,7 +301,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage pCommentAuthorsPersistPtr, Slide ) ); -importSlide( xCommentAuthorsFragmentHandler, pCommentAuthorsPersistPtr ); +getFilter().importFragment( xCommentAuthorsFragmentHandler ); maAuthorList.setValues( pCommentAuthorsPersistPtr->getCommentAuthors() ); } if( !aCommentFragmentPath.isEmpty() ) @@ -323,7 +323,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage pCommentsPersistPtr, Slide ) ); pCommentsPersistPtr->getCommentsList().cmLst.clear(); -importSlide( xCommentsFragmentHandler, pCommentsPersistPtr ); +getFilter().importFragment( xCommentsFragmentHandler ); if (!pCommentsPersistPtr->getCommentsList().cmLst.empty()) { diff --git a/sd/qa/unit/data/pptx/tdf89064.pptx b/sd/qa/unit/data/pptx/tdf89064.pptx new file mode 100644 index ..312496f79ad0 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf89064.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index d52eda84d41a..da02f49c6946 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -158,6 +159,7 @@ public: void testTdf105150(); void testTdf105150PPT(); void testTdf100926(); +void testTdf89064(); bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector& rExpected); void testPatternImport(); @@ -225,6 +227,7 @@ public: CPPUNIT_TEST(testTdf105150PPT); CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testPatternImport); +CPPUNIT_TEST(testTdf89064); CPPUNIT_TEST_SUITE_END(); }; @@ -2183,6 +2186,16 @@ void SdImportTest::testTdf100926() xDocShRef->DoClose(); } +void SdImportTest::testTdf89064() +{ +sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf89064.pptx"), PPTX); +uno::Reference< presentation::XPresentationPage > xPage (getPage(0, xDocShRef), uno::UNO_QUERY_THROW); +uno::Reference< drawing::XDrawPage > xNotesPage (xPage->getNotesPage(), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(static_cast(1), xNotesPage->getCount()); + +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits