[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source
oox/source/ole/vbacontrol.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit d98cfa4df4e6f7391b7790c625c1f8a650514e88 Author: Caolán McNamaraDate: Mon Mar 26 09:32:14 2018 +0100 forcepoint #31 survive missing control model Change-Id: I37e4af560b46b4f6d9e0b87fe58493818f366d3c Reviewed-on: https://gerrit.libreoffice.org/51878 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index eb7a54b94b9c..7beb23cfe58f 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -431,7 +431,13 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla for ( ; it != it_end; ++it ) { -if ( (*it)->mxCtrlModel->getControlType() == API_CONTROL_PAGE ) +auto& elem = (*it)->mxCtrlModel; +if (!elem) +{ +SAL_WARN("oox", "empty control model"); +continue; +} +if (elem->getControlType() == API_CONTROL_PAGE) { VbaSiteModelRef xPageSiteRef = (*it)->mxSiteModel; if ( xPageSiteRef.get() ) @@ -439,7 +445,7 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla } else { -AxTabStripModel* pTabStrip = static_cast ( (*it)->mxCtrlModel.get() ); +AxTabStripModel* pTabStrip = static_cast (elem.get()); sCaptions = pTabStrip->maItems; pMultiPage->mnActiveTab = pTabStrip->mnListIndex; pMultiPage->mnTabStyle = pTabStrip->mnTabStyle; ___ 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/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
oox/source/export/chartexport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eca80d17b9a7d2d8e15c74965de0c78674b00502 Author: Markus MohrhardDate: Mon Dec 18 22:14:59 2017 +0100 don't export category info to bubble charts, tdf#103988 Change-Id: Ic2ecd959841172db3f4016b4a1ba667238c6c508 Reviewed-on: https://gerrit.libreoffice.org/46749 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit 1252f32496193e8ed532de744db31413768b8efa) Reviewed-on: https://gerrit.libreoffice.org/46815 Reviewed-by: Eike Rathke diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index e95835ccffbb..2ffb03fa7ba4 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -2122,7 +2122,7 @@ void ChartExport::exportSeries( const Reference& xChartType, } // export categories -if( eChartType != chart::TYPEID_SCATTER && mxCategoriesValues.is() ) +if( eChartType != chart::TYPEID_SCATTER && eChartType != chart::TYPEID_BUBBLE && mxCategoriesValues.is() ) exportSeriesCategory( mxCategoriesValues ); if( (eChartType == chart::TYPEID_SCATTER) ___ 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
oox/source/export/chartexport.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 64844082ef29963b8d8c1cd47992d989dafb4ced Author: Markus MohrhardDate: Mon Dec 18 01:35:01 2017 +0100 fix validation error in lineChart export, related tdf#57832 Change-Id: I282a6f476830d688837a9731234aaba37a13de16 Reviewed-on: https://gerrit.libreoffice.org/46673 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit 70f9eb96ce3346e24d11ece1b2a75798cbb3c476) Reviewed-on: https://gerrit.libreoffice.org/46767 Reviewed-by: Eike Rathke diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index a3a1e957a76f..e95835ccffbb 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1691,9 +1691,9 @@ void ChartExport::exportLineChart( const Reference< chart2::XChartType >& xChart pFS->startElement( FSNS( XML_c, nTypeId ), FSEND ); -exportVaryColors(xChartType); - exportGrouping( ); + +exportVaryColors(xChartType); // TODO: show marker symbol in series? bool bPrimaryAxes = true; exportSeries(xChartType, *itr, bPrimaryAxes); ___ 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
oox/source/crypto/CryptTools.cxx | 10 ++ 1 file changed, 10 insertions(+) New commits: commit 4e35c16ac29468ac8467da70cbe3c3a2685165ce Author: Caolán McNamaraDate: Wed Jan 3 20:13:28 2018 + ofz#4929 ensure min input len for openssl ciphers openssl is not the default backend Change-Id: Id7bd77c1a12a15c0ebb4e7d758362c7778bfc2fd Reviewed-on: https://gerrit.libreoffice.org/47351 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index a80eaad63689..f1d4e9a8bf77 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -122,10 +122,20 @@ Decrypt::Decrypt(std::vector& key, std::vector& iv, Crypto const EVP_CIPHER* cipher = getCipher(type); +const size_t nMinKeySize = EVP_CIPHER_key_length(cipher); +if (key.size() < nMinKeySize) +key.resize(nMinKeySize, 0); + if (iv.empty()) EVP_DecryptInit_ex(, cipher, nullptr, key.data(), 0); else +{ +const size_t nMinIVSize = EVP_CIPHER_iv_length(cipher); +if (iv.size() < nMinIVSize) +iv.resize(nMinIVSize, 0); + EVP_DecryptInit_ex(, cipher, nullptr, key.data(), iv.data()); +} EVP_CIPHER_CTX_set_padding(, 0); #endif ___ 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
oox/source/drawingml/table/tableproperties.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 7f81a748d2860968c3843984da24426e9806e436 Author: Caolán McNamaraDate: Fri Dec 1 09:02:04 2017 + ofz: check col/row bounds Change-Id: Idaa38f400873372330dd06c14800c4a5018c79db Reviewed-on: https://gerrit.libreoffice.org/45641 Reviewed-by: Christian Lohmaier Tested-by: Christian Lohmaier diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index d4c5bdc56d39..a692ea3682c1 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -58,7 +58,8 @@ void CreateTableRows( const uno::Reference< XTableRows >& xTableRows, const std: xTableRows->insertByIndex( 0, rvTableRows.size() - 1 ); std::vector< TableRow >::const_iterator aTableRowIter( rvTableRows.begin() ); uno::Reference< container::XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW ); -for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) +sal_Int32 nCols = std::min(xIndexAccess->getCount(), rvTableRows.size()); +for (sal_Int32 n = 0; n < nCols; ++n) { Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); xPropSet->setPropertyValue( "Height", Any( static_cast< sal_Int32 >( aTableRowIter->getHeight() / 360 ) ) ); @@ -72,7 +73,8 @@ void CreateTableColumns( const Reference< XTableColumns >& xTableColumns, const xTableColumns->insertByIndex( 0, rvTableGrid.size() - 1 ); std::vector< sal_Int32 >::const_iterator aTableGridIter( rvTableGrid.begin() ); uno::Reference< container::XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW ); -for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) +sal_Int32 nCols = std::min(xIndexAccess->getCount(), rvTableGrid.size()); +for (sal_Int32 n = 0; n < nCols; ++n) { Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); xPropSet->setPropertyValue( "Width", Any( static_cast< sal_Int32 >( *aTableGridIter++ / 360 ) ) ); ___ 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
oox/source/drawingml/textbody.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit d100a7c38bbf300b6aa7689b8252d187e24d7117 Author: Caolán McNamaraDate: Thu Nov 30 14:43:29 2017 + ofz: handle empty paragraphs case Change-Id: I4c928f55881c1f9147eec1018381b3d3064c58ee Reviewed-on: https://gerrit.libreoffice.org/45594 Reviewed-by: Michael Stahl Tested-by: Michael Stahl diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx index 8efb70d1cdd0..ad90a5dbf9d5 100644 --- a/oox/source/drawingml/textbody.cxx +++ b/oox/source/drawingml/textbody.cxx @@ -96,6 +96,9 @@ void TextBody::ApplyStyleEmpty( { assert(isEmpty()); +if (maParagraphs.empty()) +return; + // Apply character properties TextListStyle aCombinedTextStyle; aCombinedTextStyle.apply( *pMasterTextListStylePtr ); ___ 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
oox/source/drawingml/customshapegeometry.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit ffe8c1aa9ea678e6fa4bfde07014d0b000fe6b2f Author: Caolán McNamaraDate: Wed Nov 29 16:42:13 2017 + ofz#4481: move Path2DContext body to onEndElement Change-Id: Ic06fb71c679e87069afda391e598d360b4b59cc2 Reviewed-on: https://gerrit.libreoffice.org/45535 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index 4f515fd2ab65..fd8db417bf3a 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -929,7 +929,7 @@ class Path2DContext : public ContextHandler2 { public: Path2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< css::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ); -virtual ~Path2DContext() override; +virtual void onEndElement() override; virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) override; @@ -952,7 +952,7 @@ Path2DContext::Path2DContext( ContextHandler2Helper& rParent, const AttributeLis rPath2D.extrusionOk = rAttribs.getBool( XML_extrusionOk, true ); } -Path2DContext::~Path2DContext() +void Path2DContext::onEndElement() { EnhancedCustomShapeSegment aNewSegment; switch ( mrPath2D.fill ) ___ 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
oox/source/crypto/CryptTools.cxx | 12 +--- oox/source/crypto/Standard2007Engine.cxx |2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) New commits: commit 0498b983cc62bc37dacd246ed6480563ede470b1 Author: Caolán McNamaraDate: Wed Nov 29 16:15:04 2017 + ofz: handle bad key len and subsequent PK11_ImportSymKey failure Change-Id: Ied93745f924cbcbc674b5c9a78545aa1f79fc61e Reviewed-on: https://gerrit.libreoffice.org/45515 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index b23d3ebbf57b..a80eaad63689 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -34,9 +34,12 @@ Crypto::~Crypto() EVP_CIPHER_CTX_cleanup( ); #endif #if USE_TLS_NSS -PK11_DestroyContext( mContext, PR_TRUE ); -PK11_FreeSymKey( mSymKey ); -SECITEM_FreeItem( mSecParam, PR_TRUE ); +if (mContext) +PK11_DestroyContext(mContext, PR_TRUE); +if (mSymKey) +PK11_FreeSymKey(mSymKey); +if (mSecParam) +SECITEM_FreeItem(mSecParam, PR_TRUE); #endif } @@ -101,6 +104,9 @@ void Crypto::setupContext(std::vector& key, std::vector& i keyItem.len = key.size(); mSymKey = PK11_ImportSymKey(pSlot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT, , nullptr); +if (!mSymKey) +throw css::uno::RuntimeException("NSS SymKey failure", css::uno::Reference()); + mSecParam = PK11_ParamFromIV(mechanism, pIvItem); mContext = PK11_CreateContextBySymKey(mechanism, operation, mSymKey, mSecParam); } diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index b9c259fa02ac..aabb7ed3027a 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -113,6 +113,8 @@ bool Standard2007Engine::calculateEncryptionKey(const OUString& rPassword) buffer[i] ^= hash[i]; hash = comphelper::Hash::calculateHash(buffer.data(), buffer.size(), comphelper::HashType::SHA1); +if (mKey.size() > hash.size()) +return false; std::copy(hash.begin(), hash.begin() + mKey.size(), mKey.begin()); return true; ___ 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
oox/source/crypto/AgileEngine.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 86207ca7eed9677f8ffe2d0bcfb7cf8c68b703d4 Author: Caolán McNamaraDate: Wed Nov 29 11:51:15 2017 + ofz: avoid invalid short hashValues Change-Id: Ib7cd63351f4e5ed053e55fe9c5875ad92c81d762 Reviewed-on: https://gerrit.libreoffice.org/45492 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx index 72539509c965..b12e8d344c6b 100644 --- a/oox/source/crypto/AgileEngine.cxx +++ b/oox/source/crypto/AgileEngine.cxx @@ -130,7 +130,7 @@ bool AgileEngine::generateEncryptionKey(const OUString& rPassword) std::vector hash(mInfo.hashSize, 0); hashCalc(hash, hashInput, mInfo.hashAlgorithm); -if (std::equal (hash.begin(), hash.end(), hashValue.begin()) ) +if (hash.size() <= hashValue.size() && std::equal(hash.begin(), hash.end(), hashValue.begin())) { std::vector& encryptedKeyValue = mInfo.encryptedKeyValue; calculateBlock(constBlock3, hashFinal, encryptedKeyValue, mKey); ___ 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
oox/source/vml/vmlformatting.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit e3dc0612e1e75e53c0483755c6dc2d47db938c91 Author: Caolán McNamaraDate: Tue Nov 28 09:06:02 2017 + ofz: ensure aCoordList has required elements Change-Id: I6687f7e499907f2f44ade2b05b35e40570dabc6b Reviewed-on: https://gerrit.libreoffice.org/45391 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 2cbb4ca24fca..a5d75346284d 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -311,7 +311,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r { switch ( state ) { -case MOVE_REL: // 2* params -> param count reset +case MOVE_REL: +aCoordList.resize(2, 0); // 2* params -> param count reset if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 ) { rPointLists.push_back( ::std::vector< Point >() ); @@ -323,18 +324,20 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 2; break; -case MOVE_ABS: // 2 params -> no param count reset +case MOVE_ABS: +aCoordList.resize(2, 0); // 2 params -> no param count reset if ( rPointLists.size() > 0 && rPointLists.back().size() > 0 ) { rPointLists.push_back( ::std::vector< Point >() ); rFlagLists.push_back( ::std::vector< PolygonFlags >() ); } -rPointLists.back().push_back( Point( (aCoordList[ 0 ]), (aCoordList.size() > 1 ? aCoordList[ 1 ] : 0) ) ); +rPointLists.back().push_back( Point( (aCoordList[ 0 ]), aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); aCurrentPoint = rPointLists.back().back(); break; -case BEZIER_REL: // 6* params -> param count reset +case BEZIER_REL: +aCoordList.resize(6, 0); // 6* params -> param count reset rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 0 ], aCurrentPoint.Y + aCoordList[ 1 ] ) ); rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 2 ], @@ -348,7 +351,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 6; break; -case BEZIER_ABS: // 6* params -> param count reset +case BEZIER_ABS: +aCoordList.resize(6, 0); // 6* params -> param count reset rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) ); rPointLists.back().push_back( Point( aCoordList[ 2 ], aCoordList[ 3 ] ) ); rPointLists.back().push_back( Point( aCoordList[ 4 ], aCoordList[ 5 ] ) ); @@ -359,7 +363,8 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 6; break; -case LINE_REL: // 2* params -> param count reset +case LINE_REL: +aCoordList.resize(2, 0); // 2* params -> param count reset rPointLists.back().push_back( Point( aCurrentPoint.X + aCoordList[ 0 ], aCurrentPoint.Y + aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); @@ -367,8 +372,9 @@ void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& r nParamCount = 2; break; -case LINE_ABS: // 2* params -> param count reset -rPointLists.back().push_back( Point( aCoordList[ 0 ], (aCoordList.size() > 1 ? aCoordList[ 1 ] : 0) ) ); +case LINE_ABS: +aCoordList.resize(2, 0); // 2* params -> param count reset +rPointLists.back().push_back( Point( aCoordList[ 0 ], aCoordList[ 1 ] ) ); rFlagLists.back().push_back( PolygonFlags_NORMAL ); aCurrentPoint = rPointLists.back().back(); nParamCount = 2; ___ 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/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 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 9778e5765ad26457da779493edde8a061266c7e3 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/42349 Tested-by: Jenkins diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index c89b5ece1934..45e7e40ab831 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -284,6 +284,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 a22ab5d7e13f..c964aba9d43b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -655,6 +655,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109184, "tdf109184.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0xff), getProperty(xCell3, "BackColor")); } +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 '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 sc/qa
oox/source/drawingml/shapegroupcontext.cxx |2 +- sc/qa/unit/data/xlsx/tdf110440.xlsx|binary sc/qa/unit/subsequent_filters-test.cxx | 21 + 3 files changed, 22 insertions(+), 1 deletion(-) New commits: commit db47b53bcd758a5e403d31642f7574f441ca739e Author: Miklos VajnaDate: Mon Aug 7 21:28:30 2017 +0200 tdf#110440 drawingML import: fix handling of group shape properties The handler for nvGrpSpPr is "this class", not "no class". (cherry picked from commit a3c695c12386c2708a0c06ec0ccd42ee2b8aeb98) Change-Id: I7fc40681d77f94b7473d2f677d813d2ae246f6ac Reviewed-on: https://gerrit.libreoffice.org/40863 Tested-by: Jenkins Reviewed-by: Christian Lohmaier diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index e7c39af3a619..c21a38995cc7 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -79,7 +79,7 @@ ContextHandlerRef ShapeGroupContext::onCreateContext( sal_Int32 aElementToken, c case XML_grpSpPr: return new ShapePropertiesContext( *this, *mpGroupShapePtr ); case XML_nvGrpSpPr: -return nullptr; +return this; case XML_spPr: return new ShapePropertiesContext( *this, *mpGroupShapePtr ); /* diff --git a/sc/qa/unit/data/xlsx/tdf110440.xlsx b/sc/qa/unit/data/xlsx/tdf110440.xlsx new file mode 100644 index ..da849d0bd310 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf110440.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 7ca68d89f6e8..6ba489456805 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -239,6 +239,7 @@ public: void testTdf100458(); void testTdf100709XLSX(); void testTdf97598XLSX(); +void testTdf110440XLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -359,6 +360,7 @@ public: CPPUNIT_TEST(testTdf100458); CPPUNIT_TEST(testTdf100709XLSX); CPPUNIT_TEST(testTdf97598XLSX); +CPPUNIT_TEST(testTdf110440XLSX); CPPUNIT_TEST_SUITE_END(); @@ -3763,6 +3765,25 @@ void ScFiltersTest::testColumnStyle2XLSX() xDocSh->DoClose(); } +void ScFiltersTest::testTdf110440XLSX() +{ +ScDocShellRef xDocSh = loadDoc("tdf110440.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is()); + +uno::Reference xModel = xDocSh->GetModel(); +uno::Reference xDoc(xModel, uno::UNO_QUERY_THROW); +uno::Reference xIA(xDoc->getSheets(), uno::UNO_QUERY_THROW); +uno::Reference xDrawPageSupplier(xIA->getByIndex(0), uno::UNO_QUERY_THROW); +xIA.set(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW); +uno::Reference xShape(xIA->getByIndex(0), uno::UNO_QUERY_THROW); +bool bVisible = true; +xShape->getPropertyValue("Visible") >>= bVisible; +// This failed: group shape's hidden property was lost on import. +CPPUNIT_ASSERT(!bVisible); + +xDocSh->DoClose(); +} + void ScFiltersTest::testBnc762542() { ScDocShellRef xDocSh = loadDoc("bnc762542.", FORMAT_XLSX); ___ 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/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
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source
oox/source/export/vmlexport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f804cce00ec00cb2a97be0ca8c0bab4e953773b0 Author: Caolán McNamaraDate: Sat Jun 10 14:39:29 2017 +0100 coverity#1412145 Result is not floating point Change-Id: Ia2b4c4f14f5a59dd5d24c0d0749922e0d190f53a Reviewed-on: https://gerrit.libreoffice.org/38635 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/38919 diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index a7420b560beb..5196edbe74ec 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -815,7 +815,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& sal_uInt32 nSize; if (rProps.GetOpt(ESCHER_Prop_gtextSize, nSize)) { -float nSizeF = (sal_Int32)nSize / 65536; +float nSizeF = (sal_Int32)nSize / 65536.0; OUString aSize = OUString::number(nSizeF); aStyle += ";font-size:" + aSize + "pt"; } ___ 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
oox/source/core/filterdetect.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit 81451bb88855e575fc9a2f5c1e91254c15f07cb9 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/38459 Reviewed-by: Christian Lohmaier diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 226668dfc767..ed94ca5a5770 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -163,10 +163,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 'libreoffice-5-4' - oox/source sw/qa sw/source
oox/source/export/vmlexport.cxx |4 +++- oox/source/vml/vmlshapecontext.cxx| 11 +-- sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |4 sw/qa/extras/uiwriter/data/watermark.docx |binary sw/qa/extras/uiwriter/uiwriter.cxx| 23 +++ sw/source/core/edit/edfcol.cxx| 17 +++-- 6 files changed, 50 insertions(+), 9 deletions(-) New commits: commit a406d5c22793fd2d43a0876f897a16b11a367ec7 Author: Szymon KÅosDate: Wed May 24 00:15:15 2017 +0200 Watermark: docx interoperability Before patch: Document created in MS Word: Imported to LO and exported: Then again imported to MS Word and exported: In this moment LO after import had shape in the navigator but it wasn't visible. Patch: * vmshapecontext.cxx is changed to read ShapeType from id instead of o:spt when o:spid is present. * vmlexport.cxx added o:spid for Word to identify inserted watermark * edfxol.cxx changed name of shape to "PowerPlusWaterMarkObject" for Word * tests Change-Id: I25322628838a98c45cbeed64144d04977b2ea9ba Reviewed-on: https://gerrit.libreoffice.org/37969 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 271094ad8f9e334d17176744b90b35e80528bcb2) Reviewed-on: https://gerrit.libreoffice.org/38381 Reviewed-by: Szymon KÅos diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index ef400be64f7c..623beaaa88ec 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -190,8 +190,10 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn } else { -// A watermark object - store the optional shape ID also ('o:spid') +// A watermark object - store the optional shape ID m_pShapeAttrList->add( XML_id, OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) ); +// also ('o:spid') +m_pShapeAttrList->addNS( XML_o, XML_spid, ShapeIdString( nShapeId ) ); } } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index dc654223aca6..ed369ae1c7d9 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -275,11 +275,18 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) : XML_id, OUString() ); mrTypeModel.maLegacyId = rAttribs.getString( XML_id, OUString() ); OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(), "ShapeTypeContext::ShapeTypeContext - missing shape identifier" ); +// builtin shape type identifier +mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) ); // if the o:spid attribute exists, the id attribute contains the user-defined shape name if( bHasOspid ) +{ mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() ); -// builtin shape type identifier -mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) ); +// get ShapeType and ShapeId from name for compatibility +mrTypeModel.maShapeId = mrTypeModel.maShapeName; +static const OUString sShapeTypePrefix = "shapetype_"; +if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) ) +mrTypeModel.moShapeType = mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32(); +} // coordinate system position/size, CSS style mrTypeModel.moCoordPos = lclDecodeInt32Pair( rAttribs, XML_coordorigin ); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index b538e9f990da..e7f24005cd92 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -106,6 +106,10 @@ DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx") return; assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id","PowerPlusWaterMarkObject93701316"); + +//The second problem was that Word uses also "o:spid" +const OUString& sSpid = getXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","spid"); +CPPUNIT_ASSERT(!sSpid.isEmpty()); } DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx") diff --git a/sw/qa/extras/uiwriter/data/watermark.docx b/sw/qa/extras/uiwriter/data/watermark.docx new file mode 100644 index ..0b26d4442e98 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/watermark.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 30ce2e4c442d..7eccab668c7d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - 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 0b0cc6a3306a03798fdbe766976480160d0d5c22 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 (cherry picked from commit 8129ad7b22dceeb2fef13741aa509c2229cf03de) Reviewed-on: https://gerrit.libreoffice.org/38285 Reviewed-by: Katarina Behrens 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 94c70ffdb642..1b05c1d8fb2a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1410,24 +1410,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 253134d5d29f..fb4d496243bf 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3452,16 +3452,24 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX() void ScExportTest::testTextUnderlineColorXLSX() { - 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 -