[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source
oox/source/core/xmlfilterbase.cxx | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) New commits: commit 6ac27e7d3deb8e137860d8b31f1c5eace616de53 Author: Ashod NakashianDate: Tue Mar 20 22:57:17 2018 -0400 oox: don't segfault when failing to open a custom fragment Change-Id: Ie05d1feea2e930b117b3754c6e0db86bdb85bc61 Reviewed-on: https://gerrit.libreoffice.org/51681 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit f82888653c853f236ab0035bb578a7129ec72fa5) Reviewed-on: https://gerrit.libreoffice.org/52227 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 7caf551c1836..8b8454d4202d 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -1119,13 +1119,16 @@ void XmlFilterBase::exportCustomFragments() addRelation(customFragmentTypes[j], customFragmentTargets[j]); const OUString aFilename = customFragmentTargets[j]; Reference xOutStream = openOutputStream(aFilename); -xOutStream->writeBytes(customFragments[j]); -uno::Reference xProps(xOutStream, uno::UNO_QUERY); -if (xProps.is()) +if (xOutStream.is()) { -const OUString aType = comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename); -const OUString aContentType = (aType.getLength() ? aType : OUString("application/octet-stream")); -xProps->setPropertyValue("MediaType", uno::makeAny(aContentType)); +xOutStream->writeBytes(customFragments[j]); +uno::Reference xProps(xOutStream, uno::UNO_QUERY); +if (xProps.is()) +{ +const OUString aType = comphelper::OFOPXMLHelper::GetContentTypeByName(aContentTypes, aFilename); +const OUString aContentType = (aType.getLength() ? aType : OUString("application/octet-stream")); +xProps->setPropertyValue("MediaType", uno::makeAny(aContentType)); +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 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 03a5a78a78808e1ec0c1cd4ee41c05cfa49143bd 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/51454 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx index 0173d3794105..8a2a2bff6521 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 7cfb05b3228a..9818801662aa 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -128,6 +128,8 @@ public: void testFontScale(); void testTdf115394(); void testTdf115394Zero(); +/// SmartArt animated elements +void testTdf104792(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -177,6 +179,7 @@ public: CPPUNIT_TEST(testFontScale); CPPUNIT_TEST(testTdf115394); CPPUNIT_TEST(testTdf115394Zero); +CPPUNIT_TEST(testTdf104792); CPPUNIT_TEST_SUITE_END(); @@ -1199,6 +1202,19 @@ void SdOOXMLExportTest2::testTdf115394Zero() xDocShRef->DoClose(); } +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 'distro/collabora/cp-5.3' - oox/source
oox/source/core/xmlfilterbase.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 8dde1396f7c9aed30590bc7c55d3ac0e2252381f Author: Jan HolesovskyDate: Thu Feb 22 13:01:55 2018 +0100 Fix build. Change-Id: I1048970fdfa431d20ff4f7861b7f1788aadedf4e Reviewed-on: https://gerrit.libreoffice.org/50173 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index c858bd707e16..00d23a377564 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -51,7 +51,6 @@ #include "oox/helper/zipstorage.hxx" #include #include -#include #include #include #include @@ -69,6 +68,7 @@ #include #include #include +#include using ::com::sun::star::xml::dom::DocumentBuilder; using ::com::sun::star::xml::dom::XDocument; @@ -1013,7 +1013,7 @@ void XmlFilterBase::importCustomFragments(css::uno::Reference xCustDoc = importFragment("customXml/item" + OUString::number(i) + ".xml"); Reference xCustDocProps = importFragment("customXml/itemProps" + OUString::number(i) + ".xml"); -if (xCustDoc && xCustDocProps) +if (xCustDoc.is() && xCustDocProps.is()) { aCustomXmlDomList.emplace_back(xCustDoc); aCustomXmlDomPropsList.emplace_back(xCustDocProps); @@ -1082,7 +1082,7 @@ void XmlFilterBase::exportCustomFragments() const OUString fragmentPath = "customXml/item" + OUString::number((j+1)) + ".xml"; if (customXmlDom.is()) { -addRelation(oox::getRelationship(Relationship::CUSTOMXML), "../" + fragmentPath); + addRelation("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml;, "../" + fragmentPath); uno::Reference serializer(customXmlDom, uno::UNO_QUERY); uno::Reference writer = xml::sax::Writer::create(comphelper::getProcessComponentContext()); @@ -1102,7 +1102,7 @@ void XmlFilterBase::exportCustomFragments() // Adding itemprops's relationship entry to item.xml.rels file addRelation(openFragmentStream(fragmentPath, "application/xml"), -oox::getRelationship(Relationship::CUSTOMXMLPROPS), + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps;, "itemProps"+OUString::number((j+1))+".xml"); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sd/qa
oox/source/export/shapes.cxx |2 +- sd/qa/unit/data/odp/group_rotation.odp |binary sd/qa/unit/export-tests-ooxml2.cxx | 15 +++ 3 files changed, 16 insertions(+), 1 deletion(-) New commits: commit b24c5ad7997de08b9da0c928f87df922b9f9797d Author: Paul TrojahnDate: Sat Sep 23 15:17:13 2017 +0200 PPTX Fix export of rotated group shapes The rotation is already applied to the child shapes and must not be added to the group. Reviewed-on: https://gerrit.libreoffice.org/42765 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 465092047d5fa6ec6dd369372e712d76554570ff) Change-Id: Ic564cbcf31a81a248878f0179fdd21144f076b61 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 871873c968b1..05502d693722 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -525,7 +525,7 @@ ShapeExport& ShapeExport::WriteGroupShape(const uno::Reference& // visual properties pFS->startElementNS(mnXmlNamespace, XML_grpSpPr, FSEND); -WriteShapeTransformation(xShape, XML_a); +WriteShapeTransformation(xShape, XML_a, false, false, true); pFS->endElementNS(mnXmlNamespace, XML_grpSpPr); uno::Reference xGroupShape(xShape, uno::UNO_QUERY_THROW); diff --git a/sd/qa/unit/data/odp/group_rotation.odp b/sd/qa/unit/data/odp/group_rotation.odp new file mode 100644 index ..92568c1500d9 Binary files /dev/null and b/sd/qa/unit/data/odp/group_rotation.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 38bf2980746a..3d1ad4f28b78 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -118,6 +118,7 @@ public: void testTdf112334(); void testTdf112647(); void testTdf112086(); +void testGroupRotation(); void testTdf104788(); void testSmartartRotation2(); void testGroupsPosition(); @@ -163,6 +164,7 @@ public: CPPUNIT_TEST(testTdf112334); CPPUNIT_TEST(testTdf112647); CPPUNIT_TEST(testTdf112086); +CPPUNIT_TEST(testGroupRotation); CPPUNIT_TEST(testTdf104788); CPPUNIT_TEST(testSmartartRotation2); CPPUNIT_TEST(testGroupsPosition); @@ -1115,6 +1117,19 @@ void SdOOXMLExportTest2::testTdf114848() assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d"); } +void SdOOXMLExportTest2::testGroupRotation() +{ +::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/group_rotation.odp"), ODP); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm", "rot"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot", "2040"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot", "2040"); +} + 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 'distro/collabora/cp-5.3' - oox/source
oox/source/ppt/pptimport.cxx | 18 ++ 1 file changed, 18 insertions(+) New commits: commit 867cbce9d2b272bd56e505d2a12762c8384ec7ea Author: Tamás ZolnaiDate: Thu Dec 21 05:44:04 2017 +0100 tdf#114613: Repair function does not work after opening PPTX file We need to disable undo handling during file import. Same is done for other file formats (e.g. PPT, XLSX). Change-Id: I1969c17b4a25b59b0d216ee847b3664e9c2207ca Reviewed-on: https://gerrit.libreoffice.org/46882 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit 02ea9bc36ab47d68940da55f5012677dfaf0a8b8) Reviewed-on: https://gerrit.libreoffice.org/46973 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index f76805235a88..9b68afe98974 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -94,6 +96,19 @@ bool PowerPointImport::importDocument() file:source/dump/pptxdumper.ini. */ OOX_DUMP_FILE( ::oox::dump::pptx::Dumper ); +uno::Reference< document::XUndoManagerSupplier > xUndoManagerSupplier (getModel(), UNO_QUERY ); +uno::Reference< util::XLockable > xUndoManager; +bool bWasUnLocked = true; +if(xUndoManagerSupplier.is()) +{ +xUndoManager = xUndoManagerSupplier->getUndoManager(); +if(xUndoManager.is()) +{ +bWasUnLocked = !xUndoManager->isLocked(); +xUndoManager->lock(); +} +} + importDocumentProperties(); OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" ); @@ -118,6 +133,9 @@ bool PowerPointImport::importDocument() pBox->Execute(); } +if(xUndoManager.is() && bWasUnLocked) +xUndoManager->unlock(); + return bRet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sw/qa
oox/source/export/vmlexport.cxx | 18 ++- oox/source/vml/vmlshape.cxx | 68 ++- sw/qa/extras/ooxmlexport/data/watermark.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx| 17 ++ 4 files changed, 101 insertions(+), 2 deletions(-) New commits: commit 3e4e3ee3dba7fa65263e71da0bc0091d4e950d33 Author: Szymon KÅosDate: Thu Nov 2 19:53:53 2017 +0100 tdf#113037 DOCX Watermark correct ratio Import and export Watermark with padding like MSO does. Shape is scaled to save correct ratio. Reviewed-on: https://gerrit.libreoffice.org/44319 Tested-by: Jenkins Reviewed-by: Szymon KÅos (cherry picked from commit a3a917748892a6a3194ebfc4db64cfd764cc054a) Change-Id: Iebd8eb5f168e0030320406d4fd6b287e451267bd Reviewed-on: https://gerrit.libreoffice.org/45995 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index cf6e5d6234f2..bc2f377f0fd5 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -19,6 +19,7 @@ #include #include "rtl/bootstrap.hxx" +#include #include #include @@ -393,7 +394,22 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect if ( m_nShapeType == ESCHER_ShpInst_Line ) AddLineDimensions( rRect ); else -AddRectangleDimensions( *m_pShapeStyle, rRect ); +{ +if ( IsWaterMarkShape( m_pSdrObject->GetName() ) ) +{ +// Watermark need some padding to be compatible with MSO +long nPaddingY = 0; +const SfxItemSet& rSet = m_pSdrObject->GetMergedItemSet(); +if ( const SdrMetricItem* pItem = static_cast( rSet.GetItem( SDRATTR_TEXT_UPPERDIST ) ) ) +nPaddingY += pItem->GetValue(); + +Rectangle aRect( rRect ); +aRect.setHeight( aRect.getHeight() + nPaddingY ); +AddRectangleDimensions( *m_pShapeStyle, aRect ); +} +else +AddRectangleDimensions( *m_pShapeStyle, rRect ); +} // properties bool bAlreadyWritten[ 0xFFF ]; diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 814835fae503..a9d31b26c82d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -66,6 +66,7 @@ #include #include #include +#include using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::uno::Any; @@ -1101,12 +1102,77 @@ CustomShape::CustomShape( Drawing& rDrawing ) : { } +static OUString lcl_getFontFamily( const oox::OptValue& rStyle ) +{ +OUString sFont = ""; + +if( rStyle.has() ) +{ +OUString aStyle = rStyle.get( OUString() ); + +sal_Int32 nIndex = 0; +while( nIndex >= 0 ) +{ +OUString aName; +if( ConversionHelper::separatePair( aName, sFont, aStyle.getToken( 0, ';', nIndex ), ':' ) ) +{ +if( aName == "font-family" ) +{ +// remove " (first, and last character) +if( sFont.getLength() > 2 ) +sFont = sFont.copy( 1, sFont.getLength() - 2 ); +} +} +} +} + +return sFont; +} + +/// modifies rShapeRect's height and returns difference +sal_Int32 lcl_correctWatermarkRect( awt::Rectangle& rShapeRect, const OUString& sFont, const OUString& sText ) +{ +sal_Int32 nPaddingY = 0; +double fRatio = 0; +OutputDevice* pOut = Application::GetDefaultDevice(); +vcl::Font aFont( pOut->GetFont() ); +aFont.SetFamilyName( sFont ); + +Rectangle aBoundingRect; +pOut->GetTextBoundRect( aBoundingRect, sText ); +if( aBoundingRect.GetWidth() ) +{ +fRatio = (double)aBoundingRect.GetHeight() / aBoundingRect.GetWidth(); + +sal_Int32 nNewHeight = fRatio * rShapeRect.Width; +nPaddingY = rShapeRect.Height - nNewHeight; +rShapeRect.Height = nNewHeight; +} + +return nPaddingY; +} + Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { +awt::Rectangle aShapeRect( rShapeRect ); + +// Add padding for Watermark like Word does +sal_Int32 nPaddingY = 0; +if( getShapeName().match( "PowerPlusWaterMarkObject" ) && maTypeModel.maTextpathModel.moString.has() ) +{ +OUString sText = maTypeModel.maTextpathModel.moString.get(); +OUString sFont = lcl_getFontFamily( maTypeModel.maTextpathModel.moStyle ); +nPaddingY = lcl_correctWatermarkRect( aShapeRect, sFont, sText ); +} + // try to create a custom shape -Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect ); +
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 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 20a5a0dc39d03eb91f03f64b597b58cf786e3451 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/44322 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 686c8b3c8549..aa9ba6a4dfac 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1278,11 +1278,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 (GetDocumentType() == DOCUMENT_DOCX && 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 ) @@ -1300,6 +1306,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 2b2235c621f0..e20aea47770d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -120,6 +120,8 @@ public: void testTdf112086(); void testTdf104788(); void testSmartartRotation2(); +void testGroupsPosition(); +void testGroupsRotatedPosition(); void testAccentColor(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -162,6 +164,8 @@ public: CPPUNIT_TEST(testTdf112086); CPPUNIT_TEST(testTdf104788); CPPUNIT_TEST(testSmartartRotation2); +CPPUNIT_TEST(testGroupsPosition); +CPPUNIT_TEST(testGroupsRotatedPosition); CPPUNIT_TEST(testAccentColor); CPPUNIT_TEST_SUITE_END(); @@ -1053,6 +1057,32 @@ void SdOOXMLExportTest2::testSmartartRotation2() assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/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:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "6796800"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4273920"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "4040640"); +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "4273920"); +} + +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
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sd/qa sd/source
oox/source/ppt/animvariantcontext.cxx | 32 -- oox/source/ppt/pptfilterhelpers.cxx |1 oox/source/ppt/timenodelistcontext.cxx| 14 ++--- sd/qa/unit/data/pptx/tdf112333.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx| 24 ++ sd/source/filter/eppt/pptexanimations.cxx | 11 ++ sd/source/filter/eppt/pptx-epptooxml.cxx | 12 +++ 7 files changed, 89 insertions(+), 5 deletions(-) New commits: commit ed8d2a45cb9745b8de1f287a2a6ce95e3ab6b07f Author: Szymon KÅosDate: Mon Sep 18 15:30:59 2017 +0200 tdf#112333 PPTX export fill.type & fill.on Change-Id: I2407d0227e10204354ee69fd9a2af9ca93077221 Reviewed-on: https://gerrit.libreoffice.org/42432 Tested-by: Jenkins Reviewed-by: Szymon KÅos Reviewed-on: https://gerrit.libreoffice.org/42526 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx index 1c879a6582ec..9cbfab2e0bb4 100644 --- a/oox/source/ppt/animvariantcontext.cxx +++ b/oox/source/ppt/animvariantcontext.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include "oox/helper/attributelist.hxx" @@ -140,6 +141,22 @@ namespace oox { namespace ppt { return bRet; } +bool convertFillStyle( const OUString& rString, css::drawing::FillStyle& rValue ) +{ +if( rString == "solid" ) +{ +rValue = css::drawing::FillStyle::FillStyle_SOLID; +return true; +} +else if( rString == "none" ) +{ +rValue = css::drawing::FillStyle::FillStyle_NONE; +return true; +} +else +return false; +} + AnimVariantContext::AnimVariantContext( FragmentHandler2& rParent, sal_Int32 aElement, Any & aValue ) : FragmentHandler2( rParent ) , mnElement( aElement ) @@ -187,8 +204,19 @@ namespace oox { namespace ppt { case PPT_TOKEN( strVal ): { OUString val = rAttribs.getString( XML_val, OUString() ); -convertMeasure( val ); // ignore success or failure if it fails, use as is -maValue = makeAny( val ); + +if( convertMeasure( val ) ) +{ +maValue <<= val; +} +else +{ +css::drawing::FillStyle eFillStyle; +if( convertFillStyle( val, eFillStyle ) ) +maValue <<= eFillStyle; +else +maValue <<= val; +} return this; } default: diff --git a/oox/source/ppt/pptfilterhelpers.cxx b/oox/source/ppt/pptfilterhelpers.cxx index 6496e9153e60..f117e2a1210d 100644 --- a/oox/source/ppt/pptfilterhelpers.cxx +++ b/oox/source/ppt/pptfilterhelpers.cxx @@ -38,6 +38,7 @@ namespace oox { namespace ppt { { MS_FILLCOLOR, "fillColor", "FillColor" }, { MS_FILLCOLOR, "fillcolor", "FillColor" }, { MS_FILLTYPE, "fill.type", "FillStyle" }, +{ MS_FILLTYPE, "fill.on", "FillOn" }, { MS_STROKECOLOR, "stroke.color", "LineColor" }, { MS_STROKEON, "stroke.on", "LineStyle" }, { MS_STYLECOLOR,"style.color", "CharColor" }, diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 287e67ebf066..fc890c8b97c2 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -189,9 +189,17 @@ namespace oox { namespace ppt { if( maTo >>= aString ) { OSL_TRACE( "Magic conversion %s", OUSTRING_TO_CSTR( aString ) ); -maTo = makeAny( aString == "visible" ); -if( !maTo.has() ) -OSL_TRACE( "conversion failed" ); + +if( aString == "visible" || aString == "true" ) +maTo <<= true; +else if( aString == "false" ) +maTo <<= false; + +if (!maTo.has()) +{ +SAL_WARN("oox.ppt", "conversion failed"); +maTo <<= false; +} } mpNode->setTo( maTo ); } diff --git a/sd/qa/unit/data/pptx/tdf112333.pptx b/sd/qa/unit/data/pptx/tdf112333.pptx new file mode 100755 index ..c381ed8b353e Binary files /dev/null and
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source
oox/source/ppt/timenodelistcontext.cxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit af282a9c7fe78a088fcd883012e31d5b962f4afe Author: Regina HenschelDate: Tue Feb 14 20:18:51 2017 +0100 tdf#99617 convert powerpoint angle to degree 1 powerpoint angle unit = 1/6 degree Roundtrip test not yet possible because of tdf#106002. Change-Id: I5854c4f9f013f1a2db7e9536fc9cf5198c7a02ed Reviewed-on: https://gerrit.libreoffice.org/34279 Tested-by: Jenkins Reviewed-by: Michael Stahl Reviewed-on: https://gerrit.libreoffice.org/42078 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index e795b6e8b129..287e67ebf066 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -711,18 +711,18 @@ namespace oox { namespace ppt { // sd/source/filter/ppt/pptinanimations.cxx if(attribs.hasAttribute( XML_by ) ) { -sal_Int32 nBy = attribs.getInteger( XML_by, 0 ); -pNode->setBy( makeAny( (double) nBy ) ); +double fBy = attribs.getDouble( XML_by, 0.0 ) / PER_DEGREE; //1 PowerPoint-angle-unit = 1/6 degree +pNode->setBy( makeAny( fBy ) ); } if(attribs.hasAttribute( XML_from ) ) { -sal_Int32 nFrom = attribs.getInteger( XML_from, 0 ); -pNode->setFrom( makeAny( (double) nFrom ) ); +double fFrom = attribs.getDouble( XML_from, 0.0 ) / PER_DEGREE; +pNode->setFrom( makeAny( fFrom ) ); } if(attribs.hasAttribute( XML_to ) ) { -sal_Int32 nTo = attribs.getInteger( XML_to, 0 ); -pNode->setTo( makeAny( (double) nTo ) ); +double fTo = attribs.getDouble( XML_to, 0.0 ) / PER_DEGREE; +pNode->setTo( makeAny( fTo ) ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source
oox/source/export/shapes.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 9d43654080fcc5942610f57cbfec9827b9da2102 Author: Paul TrojahnDate: Sat Jun 24 13:46:46 2017 +0200 Fix PageShape export to pptx The export code is not called, because the PageShape is actually of type presentation.PageShape and not drawing.PageShape. A PageShape has no text at all, which results in an empty p:txBody element that fails validation, so it needs to be checked first if the shape actually has text. Change-Id: I559f15c2396739c74d5c4f36eb952754bc040ce8 Reviewed-on: https://gerrit.libreoffice.org/38574 Tested-by: Jenkins Reviewed-by: Thorsten Behrens Reviewed-on: https://gerrit.libreoffice.org/42002 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 066a1ecf1021..c4edcf07f1bb 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1450,7 +1450,8 @@ ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, s } } -if( NonEmptyText( xIface ) ) +Reference< XText > xXText( xIface, UNO_QUERY ); +if( NonEmptyText( xIface ) && xXText.is() ) { FSHelperPtr pFS = GetFS(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 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 c902b7788191901cf4ec75052b98ca4cf0704d92 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 Reviewed-on: https://gerrit.libreoffice.org/41482 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx index ba3f880cde60..9ccf2726f68d 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 =
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sw/qa
oox/source/vml/vmlshape.cxx|8 sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 13 + 3 files changed, 21 insertions(+) New commits: commit e6d6d80bb75333c60d3d6163d1b40955546d125b Author: Szymon KÅosDate: Mon Aug 21 16:06:43 2017 +0200 VML, Watermark: detect shapetype from other subdocuments In some documents Watermark wasn't visible because shapetype wasn't detected. It was impossible to use shapetype defined in header1.xml in shape placed in the header2.xml. Change-Id: Ib406c8fc702968684ad46efd0857b768af2820f5 Reviewed-on: https://gerrit.libreoffice.org/41395 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit 87f1f7fdb34fe452ac540524224e1e808ce5d3a2) Reviewed-on: https://gerrit.libreoffice.org/41465 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index a22da262281d..11d08754c01a 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -282,6 +282,14 @@ void ShapeBase::finalizeFragmentImport() aType = aType.copy(1); if( const ShapeType* pShapeType = mrDrawing.getShapes().getShapeTypeById( aType, true ) ) maTypeModel.assignUsed( pShapeType->getTypeModel() ); +else { +// Temporary fix, shapetype not found if referenced from different substream +// FIXME: extend scope of ShapeContainer to store all shapetypes from the document +const OUString sShapeTypePrefix = "shapetype_"; +if (aType.startsWith(sShapeTypePrefix)) { +maTypeModel.moShapeType = aType.copy(sShapeTypePrefix.getLength()).toInt32(); +} +} } } diff --git a/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx b/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx new file mode 100755 index ..423f3cf7184f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index fd5b1716afe3..ccba14821d76 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -389,6 +389,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107684, "tdf107684.odt") assertXPath(pXmlDoc, "//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1); } +DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark-shapetype.docx") +{ +uno::Reference xShape1(getShape(1), uno::UNO_QUERY); +uno::Reference xPropertySet1(xShape1, uno::UNO_QUERY); +xShape1.is(); + +uno::Reference xShape2(getShape(2), uno::UNO_QUERY); +uno::Reference xPropertySet2(xShape2, uno::UNO_QUERY); +xShape2.is(); + + CPPUNIT_ASSERT_EQUAL(xPropertySet1->getPropertyValue("TextAutoGrowHeight"), xPropertySet2->getPropertyValue("TextAutoGrowHeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sd/source
oox/source/ppt/presentationfragmenthandler.cxx | 37 + sd/source/filter/eppt/epptooxml.hxx|3 ++ sd/source/filter/eppt/pptx-epptooxml.cxx | 35 ++- 3 files changed, 63 insertions(+), 12 deletions(-) New commits: commit b266d201d9ef5328f7d6f44b772ea936099a1fe4 Author: Jan HolesovskyDate: Wed Jul 19 16:35:10 2017 +0200 sd pptm: Preserve the VBA stream on export. This actually implements the reading of the VBA stream in Impress too, so the user will get a warning when opening such a file (that the it contains macros). Change-Id: I1638199529196ed217cbd9ebef88eb7c88f2179a Reviewed-on: https://gerrit.libreoffice.org/40197 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 6f5f690088c9..41a283a445d1 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -34,16 +35,18 @@ #include #include -#include "oox/drawingml/theme.hxx" -#include "oox/drawingml/drawingmltypes.hxx" -#include "oox/drawingml/themefragmenthandler.hxx" -#include "drawingml/textliststylecontext.hxx" +#include +#include +#include +#include #include -#include "oox/ppt/pptshape.hxx" -#include "oox/ppt/presentationfragmenthandler.hxx" -#include "oox/ppt/slidefragmenthandler.hxx" -#include "oox/ppt/layoutfragmenthandler.hxx" -#include "oox/ppt/pptimport.hxx" +#include +#include +#include +#include +#include +#include +#include #include #include @@ -398,8 +401,8 @@ void PresentationFragmentHandler::finalizeImport() StringRangeEnumerator aRangeEnumerator( aPageRange, 0, nPageCount - 1 ); StringRangeEnumerator::Iterator aIter = aRangeEnumerator.begin(); StringRangeEnumerator::Iterator aEnd = aRangeEnumerator.end(); -if(aIter!=aEnd) { - +if (aIter!=aEnd) +{ // todo: localized progress bar text const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() ); if ( rxStatusIndicator.is() ) @@ -431,6 +434,18 @@ void PresentationFragmentHandler::finalizeImport() if ( rxStatusIndicator.is() ) rxStatusIndicator->end(); } + +// open the VBA project storage +OUString aVbaFragmentPath = getFragmentPathFromFirstType(CREATE_MSOFFICE_RELATION_TYPE("vbaProject")); +if (!aVbaFragmentPath.isEmpty()) +{ +uno::Reference xInStrm = getFilter().openInputStream(aVbaFragmentPath); +if (xInStrm.is()) +{ +StorageRef xPrjStrg(new oox::ole::OleStorage(getFilter().getComponentContext(), xInStrm, false)); +getFilter().getVbaProject().importVbaProject(*xPrjStrg); +} +} } // CT_Presentation diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index 4a794e6e4d33..1134daf6cb7a 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -159,6 +159,9 @@ private: AuthorsMap maAuthors; void WriteAuthors(); + +/// If this is PPTM, output the VBA stream. +void WriteVBA(); }; } diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 2319b431ee8a..68b8372f2777 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -27,12 +27,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -53,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +69,7 @@ #include #include +#include // presentation namespaces #define PNMSS FSNS(XML_xmlns, XML_a), "http://schemas.openxmlformats.org/drawingml/2006/main;, \ @@ -395,6 +399,8 @@ bool PowerPointExport::exportDocument() throw (css::uno::RuntimeException, std:: WriteAuthors(); +WriteVBA(); + mPresentationFS->endElementNS( XML_p, XML_presentation ); mPresentationFS.reset(); // Free all FSHelperPtr, to flush data before committing storage @@ -1437,7 +1443,8 @@ void PowerPointExport::WriteAuthors() sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex ) { -if ( maAuthors.count( sAuthor ) <= 0 ) { +if (maAuthors.count(sAuthor) <= 0) +{ struct AuthorComments aAuthorComments; aAuthorComments.nId = maAuthors.size(); @@ -1511,6 +1518,32 @@ bool PowerPointExport::WriteComments( sal_uInt32 nPageNum ) return false; } +void PowerPointExport::WriteVBA() +{ +if (!mbPptm) +return; + +uno::Reference
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source
oox/source/core/filterdetect.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit de2d6e773212c983dc190d1d29d005de87df6ffd Author: Miklos VajnaDate: Tue Jun 6 11:32:02 2017 +0200 Related: tdf#108269 oox: ignore case when checking .docm extension Also check for ".docm", not "docm" as a suffix. Change-Id: Ib9d3474cfe3139ee1ea51210a5606cd52243fee5 Reviewed-on: https://gerrit.libreoffice.org/38430 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 1c768b975827c74e58944b8b12ab254891389edc) Reviewed-on: https://gerrit.libreoffice.org/38557 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 50590f0469a6..8812e0c30c25 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -172,10 +172,19 @@ void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs ) OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ) { -if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !rFileName.endsWith("docm") ) +bool bDocm = false; +OUString aDocmExtension = ".docm"; +if (rFileName.getLength() >= aDocmExtension.getLength()) +{ +OUString aExtension = rFileName.copy(rFileName.getLength() - aDocmExtension.getLength()); +// The file name ends with .docm, ignoring case. +bDocm = aExtension.equalsIgnoreAsciiCase(aDocmExtension); +} + +if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !bDocm ) return OUString( "writer_MS_Word_2007" ); -if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || rFileName.endsWith("docm") ) +if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || bDocm ) return OUString( "writer_MS_Word_2007_VBA" ); if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" || ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sc/qa
oox/source/drawingml/textcharacterproperties.cxx |1 oox/source/export/drawingml.cxx | 30 +-- sc/qa/unit/data/xlsx/underlineColor.xlsx |binary sc/qa/unit/subsequent_export-test.cxx| 18 + 4 files changed, 32 insertions(+), 17 deletions(-) New commits: commit edf5dcda53e9af586e9f9f28d29bd0c3c778b474 Author: Bartosz KosiorekDate: Wed May 24 01:13:26 2017 +0200 tdf#104219 Don't export color information when color is automatic In LibreOffice and MS Office, there are two types of colors: - Automatic (which is taken from settings) and Fixed (which is set by RGB value). OOXML is setting automatic color by default, by not providing any RGB color. To preserve automatic color we need to not export RGB color during OOXML export. Change-Id: I8895230c4fffc9d8741f3eff37e64c4823d71da8 Reviewed-on: https://gerrit.libreoffice.org/37970 Tested-by: Jenkins Reviewed-by: Markus Mohrhard Reviewed-on: https://gerrit.libreoffice.org/38276 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index d45e59ddc9c7..71046841c60c 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -152,6 +152,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharUnderlineHasColor, true); rPropMap.setProperty( PROP_CharUnderlineColor, maUnderlineColor.getColor( rFilter.getGraphicHelper() )); } +// TODO If bUnderlineFillFollowText uFillTx (CT_TextUnderlineFillFollowText) is set, fill color of the underline should be the same color as the text } void pushToGrabBag( PropertySet& rPropSet, const std::vector& aVectorOfProperyValues ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index d9bc62d5f8f0..c8d148aeb1c2 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1398,24 +1398,30 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool sal_uInt32 color = *o3tl::doAccess(mAny); SAL_INFO("oox.shape", "run color: " << color << " auto: " << COL_AUTO); -if( color == COL_AUTO ) // nCharColor depends to the background color +// tdf#104219 In LibreOffice and MS Office, there are two types of colors: +// Automatic and Fixed. OOXML is setting automatic color, by not providing color. +if( color != COL_AUTO ) { -color = mbIsBackgroundDark ? 0xff : 0x00; +color &= 0xff; +// TODO: special handle embossed/engraved +WriteSolidFill( color ); } -color &= 0xff; - -// TODO: special handle embossed/engraved - -WriteSolidFill( color ); } -if( CGETAD( CharUnderlineColor ) ) +if( ( underline != nullptr ) && CGETAD( CharUnderlineColor ) ) { sal_uInt32 color = *o3tl::doAccess(mAny); - -mpFS->startElementNS( XML_a, XML_uFill,FSEND); -WriteSolidFill( color ); -mpFS->endElementNS( XML_a, XML_uFill ); +// if color is automatic, then we shouldn't write information about color but to take color from character +if( color != COL_AUTO ) +{ +mpFS->startElementNS( XML_a, XML_uFill, FSEND); +WriteSolidFill( color ); +mpFS->endElementNS( XML_a, XML_uFill ); +} +else +{ +mpFS->singleElementNS( XML_a, XML_uFillTx, FSEND ); +} } if( GETA( CharFontName ) ) diff --git a/sc/qa/unit/data/xlsx/underlineColor.xlsx b/sc/qa/unit/data/xlsx/underlineColor.xlsx index 30346ce733db..124391b3bc11 100644 Binary files a/sc/qa/unit/data/xlsx/underlineColor.xlsx and b/sc/qa/unit/data/xlsx/underlineColor.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index e6e1e87f710b..9deb04ba8be0 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3428,16 +3428,24 @@ void ScExportTest::testSheetCondensedCharacterSpace() void ScExportTest::testTextUnderlineColor() { - ScDocShellRef xDocSh = loadDoc("underlineColor.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.Is()); xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); -OUString color = getXPath(pDoc, - "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/a:solidFill/a:srgbClr", "val"); -// make sure that the underline color is RED -