chart2/qa/extras/chart2dump/chart2dump.cxx | 1 chart2/qa/extras/chart2dump/data/tdf118150.xlsx |binary chart2/qa/extras/chart2dump/reference/axislabeltest/tdf118150.txt | 216 ++++++++++ chart2/qa/extras/chart2import.cxx | 23 + chart2/qa/extras/data/pptx/tdf122765.pptx |binary chart2/source/view/main/ChartView.cxx | 4 include/oox/export/drawingml.hxx | 6 include/oox/ppt/presentationfragmenthandler.hxx | 2 oox/source/drawingml/chart/titleconverter.cxx | 1 oox/source/drawingml/fillproperties.cxx | 5 oox/source/export/drawingml.cxx | 52 +- oox/source/ppt/presentationfragmenthandler.cxx | 20 sd/qa/unit/data/odp/image_transparency.odp |binary sd/qa/unit/data/pptx/tdf125346.pptx |binary sd/qa/unit/data/pptx/tdf125346_2.pptx |binary sd/qa/unit/data/pptx/tdf125360.pptx |binary sd/qa/unit/data/pptx/tdf125360_1.pptx |binary sd/qa/unit/data/pptx/tdf125360_2.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 26 + sd/qa/unit/export-tests-ooxml2.cxx | 152 ++++++- sdext/source/minimizer/graphiccollector.cxx | 6 sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 27 + sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 2 sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc |binary sw/qa/extras/ww8export/ww8export3.cxx | 23 + sw/qa/extras/ww8import/ww8import.cxx | 16 sw/source/filter/ww8/wrtw8esh.cxx | 30 + sw/source/filter/ww8/ww8graf.cxx | 11 sw/source/filter/ww8/ww8par.cxx | 2 sw/source/filter/xml/xmlexp.cxx | 5 writerfilter/source/dmapper/DomainMapper.cxx | 23 + 35 files changed, 618 insertions(+), 35 deletions(-)
New commits: commit 4db76f9332641ed87ff1c5217a16167be4c6c353 Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Tue Apr 2 21:36:57 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:17:50 2019 +0200 tdf#118375, tdf#70838 correct position of rotated shape in doc Word relates the position to the unrotated shape in legacy doc format. Writer uses the rotated shape. The patch corrects the difference on import and export. Reviewed-on: https://gerrit.libreoffice.org/70152 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> (cherry picked from commit 421e6fc3cd2e6fe37afbef341e2d0ad7b8edde37) Change-Id: I25537123656e62d6ffae5118ee8d621a4b5c5be0 diff --git a/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc new file mode 100644 index 000000000000..99d15e20cea5 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118375_240degClockwise.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 84f9e2f2d6cf..32b4197452b1 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -106,6 +106,29 @@ DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(defaultStyle, "TopMargin")); } +DECLARE_WW8EXPORT_TEST(testTdf118375export, "tdf118375_240degClockwise.doc") +{ + // The input document has one custom shape, which is rotated 240deg. Check + // that it has the same position as in Word. + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier.is()); + uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages()); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is()); + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is()); + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is()); + sal_Int32 nPosX, nPosY; + xShapeProps->getPropertyValue("HoriOrientPosition") >>= nPosX; + xShapeProps->getPropertyValue("VertOrientPosition") >>= nPosY; + // Allow some tolerance because rounding errors through integer arithmethic + // in rotation. + CPPUNIT_ASSERT_DOUBLES_EQUAL(5200.0, static_cast<double>(nPosX), 1.0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1152.0, static_cast<double>(nPosY), 1.0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 0ae92a2aec2d..e1655946c80c 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -663,6 +663,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const WinwordAnchoring::ConvertPosition( rHOr, rVOr, rFormat ); Point aObjPos; + bool bHasHeightWidthSwapped(false); if (RES_FLYFRMFMT == rFormat.Which()) { SwRect aLayRect(rFormat.FindLayoutRect(false, &aObjPos)); @@ -698,6 +699,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const const long nHeight = aRect.getHeight(); aRect.setWidth( nHeight ); aRect.setHeight( nWidth ); + bHasHeightWidthSwapped = true; } } } @@ -759,6 +761,34 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const //Nasty swap for bidi if necessary rWrt.MiserableRTLFrameFormatHack(nLeft, nRight, rFrameFormat); + // tdf#70838. Word relates the position to the unrotated rectangle, + // Writer to the rotated one. Because the rotation is around center, + // the difference counts half. + if(pObj && pObj->GetRotateAngle()) + { + SwTwips nXOff; + SwTwips nYOff; + SwTwips nSnapWidth = pObj->GetSnapRect().getWidth(); + SwTwips nSnapHeight = pObj->GetSnapRect().getHeight(); + SwTwips nLogicWidth = pObj->GetLogicRect().getWidth(); + SwTwips nLogicHeight = pObj->GetLogicRect().getHeight(); + // +1 for to compensate integer arithmetic rounding errors + if(bHasHeightWidthSwapped) + { + nXOff = (nSnapWidth - nLogicHeight + 1) / 2; + nYOff = (nSnapHeight - nLogicWidth + 1) / 2; + } + else + { + nXOff = (nSnapWidth - nLogicWidth + 1) / 2; + nYOff = (nSnapHeight - nLogicHeight + 1) / 2; + } + nLeft += nXOff; + nRight += nXOff; + nTop += nYOff; + nBottom += nYOff; + } + //xaLeft/yaTop/xaRight/yaBottom - rel. to anchor //(most of) the border is outside the graphic is word, so //change dimensions to fit diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 870df79b9114..c675d9ed752c 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2504,6 +2504,17 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) return nullptr; } + // tdf#118375 Word relates position to the unrotated rectangle, + // Writer uses the rotated one. + if (pObject->GetRotateAngle()) + { + tools::Rectangle aObjSnapRect(pObject->GetSnapRect()); // recalculates the SnapRect + pF->nXaLeft = aObjSnapRect.Left(); + pF->nYaTop = aObjSnapRect.Top(); + pF->nXaRight = aObjSnapRect.Right(); + pF->nYaBottom = aObjSnapRect.Bottom(); + } + bool bDone = false; SdrObject* pOurNewObject = nullptr; bool bReplaceable = false; commit 2c53920bda4f8289d1cc083161a39923f6871cfa Author: Justin Luth <justin_l...@sil.org> AuthorDate: Fri Jan 11 13:01:26 2019 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:15:45 2019 +0200 tdf#120145 ww8import: ignoreCols if section is inserted Otherwise, the column setting is duplicated both in the section and in the page style. Change-Id: I14383c646e709a3653f1054f0d4170a2963529c1 Reviewed-on: https://gerrit.libreoffice.org/66151 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit 84fefd7c295fc05499ca222dff50c2fe4e0fb27e) Reviewed-on: https://gerrit.libreoffice.org/66217 Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 0e863f5529318e07f46568150e489cb0bef9b616) diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 31cfce841d3c..abbdedbea194 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -9,6 +9,7 @@ #include <swmodeltestbase.hxx> +#include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <ndtxt.hxx> #include <viscrs.hxx> @@ -33,12 +34,23 @@ DECLARE_WW8IMPORT_TEST(testFloatingTableSectionMargins, "floating-table-section- { sal_Int32 pageLeft = parseDump("/root/page[2]/infos/bounds", "left").toInt32(); sal_Int32 pageWidth = parseDump("/root/page[2]/infos/bounds", "width").toInt32(); - sal_Int32 tableLeft = parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds", "left").toInt32(); - sal_Int32 tableWidth = parseDump("/root/page[2]/body/column/body/section/column/body/txt[2]/anchored/fly/tab/infos/bounds", "width").toInt32(); + sal_Int32 tableLeft = parseDump("//tab/infos/bounds", "left").toInt32(); + sal_Int32 tableWidth = parseDump("//tab/infos/bounds", "width").toInt32(); CPPUNIT_ASSERT( pageWidth > 0 ); CPPUNIT_ASSERT( tableWidth > 0 ); // The table's resulting position should be roughly centered. CPPUNIT_ASSERT( abs(( pageLeft + pageWidth / 2 ) - ( tableLeft + tableWidth / 2 )) < 20 ); + + uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection"); + CPPUNIT_ASSERT(xTextSection.is()); + uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + OUString pageStyleName = getProperty<OUString>(getParagraph(2), "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(pageStyleName), uno::UNO_QUERY); + uno::Reference<text::XTextColumns> xPageColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns"); + + //either one or the other should get the column's, not both. + CPPUNIT_ASSERT( xTextColumns->getColumnCount() != xPageColumns->getColumnCount()); } DECLARE_WW8IMPORT_TEST(testN816593, "n816593.doc") diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b09cf7ded47f..ad340445d383 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4480,7 +4480,7 @@ void wwSectionManager::InsertSegments() descriptor. */ - bool bIgnoreCols = false; + bool bIgnoreCols = bInsertSection; bool bThisAndNextAreCompatible = (aNext == aEnd) || ((aIter->GetPageWidth() == aNext->GetPageWidth()) && (aIter->GetPageHeight() == aNext->GetPageHeight()) && commit e4ec7597954a17e714d2986832ec9a084bda88e5 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Apr 16 14:14:03 2019 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:15:41 2019 +0200 tdf#123636 writerfilter: handle deferred breaks on frames and... related tdf#123636 writerfilter: split newline also if PAGE_BREAK ...but only with old MSWord compat flag SplitPgBreakAndParaMark. All of the other cases (COLUMN_BREAK and non-empty runs) split the paragraph, so why not here? This document shows it is needed, but only for SplitPgBreakAndParaMark documents. Note: Word 2003 doesn't display "modern" docx well in this regard. It adds extra paragraphs where it shouldn't. There are already example unit tests that ensure that extra paragraphs aren't written for SplitPgBreakAndParaMark == false. The actual bug's document is not related to the compatibility flag. That will be handled in separate commit. Reviewed-on: https://gerrit.libreoffice.org/70835 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit 89e44da1ab450f6e2f4106103efd169227683f20) tdf#123636 writerfilter: handle deferred breaks on frames ...similar to handling breaks before shapes in lcl_startShape. Three different examples found to create/split a paragraph. Which one to use? (addDummy, m_bIsSplitPara, and lcl_startCharacterGroup). SplitPara is not good because the paragraph properties probably should not be copied to the dummy paragraph (like numbering for example). Slightly modified the lcl_startChar example to ensure that the dummy paragraph doesn't steal a part of the properties, but is only default properties plus page-break. This doesn't export very well, so roundtripping is very poor. Research Note: There exists a compat flag showBreaksInFrames (Display Page/Column Breaks Present in Frames) "This element specifies whether applications should honor the presence of page and/or column breaks which are present within the contents of paragraphs which have been defined as frames using the framePr element." --Currently, LO does nothing with this flag. Probably too exotic and irrelevant (word 2003 era?). No existing unit tests found that have isSet(pg_brk) frames. Reviewed-on: https://gerrit.libreoffice.org/71255 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit f6f53f76e15f5eecc5b6ce56e471c53cebfea8ad) Change-Id: I29f815355401c7af8b347a3ed9d0298bc9b27b93 diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx new file mode 100644 index 000000000000..6f7b4b144547 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx new file mode 100644 index 000000000000..a876bea84e02 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx new file mode 100644 index 000000000000..1bcc335fdc59 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx new file mode 100644 index 000000000000..3a9d86ee21e2 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index d5e98bebfde0..b8214f664e42 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -423,6 +423,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(24188), frameRect.Width); } +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak, "tdf123636_newlinePageBreak.docx") +{ + //MS Compatibility flag: SplitPgBreakAndParaMark + //special case: split first empty paragraph in a section. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak2, "tdf123636_newlinePageBreak2.docx") +{ + //WITHOUT SplitPgBreakAndParaMark: a following anchored shape should force a page break + //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2, ""), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePageBreak4.docx") +{ + //MS Compatibility flag: SplitPgBreakAndParaMark + //special case: an empty paragraph doesn't split (except if first paragraph). + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 3, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); + + xmlDocPtr pDump = parseLayoutDump(); + assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 155624839efd..bc404040def9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -938,6 +938,8 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx") sal_Int32 nX = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent", "cx").toInt32(); // This was negative. CPPUNIT_ASSERT(nX >= 0); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); } // part of tdf#93676, word gives the frame in the exported .docx a huge height, diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 499f402d8ad7..d116a8d2a0c3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2045,6 +2045,22 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); if( pContext.get() ) { + // If there is a deferred page break applied to this framed paragraph, + // create a dummy paragraph without extra properties, + // so that the anchored frame will be on the correct page (similar to shapes). + if (pContext->isSet(PROP_BREAK_TYPE)) + { + pContext->Erase(PROP_BREAK_TYPE); + + lcl_startParagraphGroup(); + m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); + lcl_startCharacterGroup(); + sal_uInt8 const sBreak[] = { 0xd }; + lcl_text(sBreak, 1); + lcl_endCharacterGroup(); + lcl_endParagraphGroup(); + } + ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() ); if (pParaContext) pParaContext->SetFrameMode(); @@ -3420,6 +3436,13 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { if (m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark()) { + if ( m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun() ) + { + m_pImpl->m_bIsSplitPara = true; + m_pImpl->finishParagraph( m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) ); + lcl_startParagraphGroup(); + } + pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); m_pImpl->clearDeferredBreaks(); } commit deb0e1e113256dfd0307e4b86c0c3f8394123e26 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue May 28 17:32:44 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:14:17 2019 +0200 tdf#122765: Legend interferes with pie chart after pptx import, second part Revert of: 2903c5f59d257b6ab94f32df64513f2edf94fb0b Reverting this commit does not lead to the original bug to come back, so we can revert it without a problem. Change-Id: I244a6b9451c47e1094db8a77c71b6696e0c464cc Reviewed-on: https://gerrit.libreoffice.org/73139 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 63d17d01da0f9e3a7554e4327244ee4457b7188d) Reviewed-on: https://gerrit.libreoffice.org/73160 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 49c598709280..ec2c62c823fc 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1619,7 +1619,6 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(nullptr); uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(nullptr); VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount); - bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram); {//create diagram aVDiagram.init(rParam.mxDiagramWithAxesShapes, m_xShapeFactory); aVDiagram.createShapes( @@ -1628,7 +1627,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion(); // It is preferable to use full size than minimum for pie charts - if (!bIsPieOrDonut && !rParam.mbUseFixedInnerSize) + if (!rParam.mbUseFixedInnerSize) aVDiagram.reduceToMimimumSize(); } @@ -1656,6 +1655,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D //use first coosys only so far; todo: calculate for more than one coosys if we have more in future //todo: this is just a workaround at the moment for pie and donut labels + bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram); if( !bIsPieOrDonut && (!rVCooSysList.empty()) ) { VCoordinateSystem* pVCooSys = rVCooSysList[0]; commit 2dc855ee4ec9c3e22683dd6963aba2f33a07590b Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue May 21 12:05:33 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:14:11 2019 +0200 Add unit test for tdf#118150. Change-Id: Icea2c8aacb36e843dad67a056d07d6495fbbb17a Reviewed-on: https://gerrit.libreoffice.org/72678 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit a703b4d8842261f55f489c28352df1f53a9b070a) Reviewed-on: https://gerrit.libreoffice.org/72766 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index c852446efe7e..90daeef87e1f 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -648,6 +648,7 @@ DECLARE_DUMP_TEST(AxisLabelTest, Chart2DumpTest, false) "rotated_axis_labels.odp", "formated_axis_labels.odp", "percent_stacked_column_chart.odp", + "tdf118150.xlsx", }; for (const OUString& sTestFile : aTestFiles) diff --git a/chart2/qa/extras/chart2dump/data/tdf118150.xlsx b/chart2/qa/extras/chart2dump/data/tdf118150.xlsx new file mode 100644 index 000000000000..f29b9a1c2e66 Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/tdf118150.xlsx differ diff --git a/chart2/qa/extras/chart2dump/reference/axislabeltest/tdf118150.txt b/chart2/qa/extras/chart2dump/reference/axislabeltest/tdf118150.txt new file mode 100644 index 000000000000..fabf4acac67b --- /dev/null +++ b/chart2/qa/extras/chart2dump/reference/axislabeltest/tdf118150.txt @@ -0,0 +1,216 @@ +/// CID/D=0:CS=0:Axis=0,0 +// nAxisLabelsCount +28 +// xLabel->getString() +Sep 2013 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Oct 2013 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Nov 2013 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Dec 2013 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jan 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Feb 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Mar 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Apr 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +May 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jun 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jul 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Aug 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Sep 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Oct 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Nov 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Dec 2014 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jan 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Feb 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Mar 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Apr 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +May 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jun 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Jul 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Aug 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Sep 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Oct 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Nov 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +Dec 2015 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +/// CID/D=0:CS=0:Axis=1,0 +// nAxisLabelsCount +7 +// xLabel->getString() +0.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +2.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +4.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +6.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +8.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +10.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 +// xLabel->getString() +12.00 +// static_cast<sal_Int32>(aLabelFontColor) +0 +// fLabelFontHeight +10 commit 092990aebdf510ce13e92487e692ef8f1826a9b6 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon May 20 18:27:33 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:14:05 2019 +0200 tdf#125360: PPTX: Shape fill transparency is not exported .. if the original shape fill is defined with a theme Override the alpha value with the current value get from FillTransparence API attirbute even if the color is defined with a style or a color scheme. Reviewed-on: https://gerrit.libreoffice.org/72596 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 259d01a34d27df2fbfd11c3bf6fe9dc508ff6ac2) Change-Id: I09d26238a9c2b501279e6749687dc535e614bbd6 Reviewed-on: https://gerrit.libreoffice.org/72617 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 5b7e9660ace1..360577aa5ceb 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -164,14 +164,14 @@ public: OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false); void WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT ); - void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); - void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); + void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); + void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor ); void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart ); void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); void WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT ); - void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations ); + void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT ); void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteGradientFill( css::awt::Gradient rGradient ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 8846baa8395d..0bc60021feb5 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -234,7 +234,7 @@ void DrawingML::WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha ) } } -void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< PropertyValue >& aTransformations ) +void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) { // prevent writing a tag with empty val attribute if( sColorSchemeName.isEmpty() ) @@ -245,7 +245,15 @@ void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< Pr mpFS->startElementNS( XML_a, XML_schemeClr, XML_val, USS( sColorSchemeName ), FSEND ); - WriteColorTransformations( aTransformations ); + WriteColorTransformations( aTransformations, nAlpha ); + mpFS->endElementNS( XML_a, XML_schemeClr ); + } + else if(nAlpha < MAX_PERCENT) + { + mpFS->startElementNS( XML_a, XML_schemeClr, + XML_val, USS( sColorSchemeName ), + FSEND ); + mpFS->singleElementNS(XML_a, XML_alpha, XML_val, OString::number(nAlpha), FSEND); mpFS->endElementNS( XML_a, XML_schemeClr ); } else @@ -256,15 +264,22 @@ void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< Pr } } -void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTransformations ) +void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) { for( sal_Int32 i = 0; i < aTransformations.getLength(); i++ ) { sal_Int32 nToken = Color::getColorTransformationToken( aTransformations[i].Name ); if( nToken != XML_TOKEN_INVALID && aTransformations[i].Value.hasValue() ) { - sal_Int32 nValue = aTransformations[i].Value.get<sal_Int32>(); - mpFS->singleElementNS( XML_a, nToken, XML_val, I32S( nValue ), FSEND ); + if(nToken == XML_alpha && nAlpha < MAX_PERCENT) + { + mpFS->singleElementNS(XML_a, nToken, XML_val, I32S(nAlpha), FSEND); + } + else + { + sal_Int32 nValue = aTransformations[i].Value.get<sal_Int32>(); + mpFS->singleElementNS( XML_a, nToken, XML_val, I32S( nValue ), FSEND ); + } } } } @@ -276,10 +291,10 @@ void DrawingML::WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha ) mpFS->endElementNS( XML_a, XML_solidFill ); } -void DrawingML::WriteSolidFill( const OUString& sSchemeName, const Sequence< PropertyValue >& aTransformations ) +void DrawingML::WriteSolidFill( const OUString& sSchemeName, const Sequence< PropertyValue >& aTransformations, sal_Int32 nAlpha ) { mpFS->startElementNS( XML_a, XML_solidFill, FSEND ); - WriteColor( sSchemeName, aTransformations ); + WriteColor( sSchemeName, aTransformations, nAlpha ); mpFS->endElementNS( XML_a, XML_solidFill ); } @@ -329,20 +344,33 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) else if ( !sColorFillScheme.isEmpty() ) { // the shape had a scheme color and the user didn't change it - WriteSolidFill( sColorFillScheme, aTransformations ); + WriteSolidFill( sColorFillScheme, aTransformations, nAlpha ); } else if ( aStyleProperties.hasElements() ) { sal_uInt32 nThemeColor = 0; + sal_Int32 nThemeAlpha = MAX_PERCENT; for( sal_Int32 i=0; i < aStyleProperties.getLength(); ++i ) { if( aStyleProperties[i].Name == "Color" ) { aStyleProperties[i].Value >>= nThemeColor; - break; + } + else if(aStyleProperties[i].Name == "Transformations" ) + { + Sequence< PropertyValue > aStyleTransformations; + aStyleProperties[i].Value >>= aStyleTransformations; + for( sal_Int32 j = 0; j < aStyleTransformations.getLength(); j++ ) + { + if (aStyleTransformations[j].Name == "alpha" ) + { + aStyleTransformations[j].Value >>= nThemeAlpha; + break; + } + } } } - if ( nFillColor != nThemeColor ) + if ( nFillColor != nThemeColor || nAlpha != nThemeAlpha ) // the shape contains a theme but it wasn't being used WriteSolidFill( nFillColor & 0xffffff, nAlpha ); // in case the shape used the style color and the user didn't change it, diff --git a/sd/qa/unit/data/pptx/tdf125360.pptx b/sd/qa/unit/data/pptx/tdf125360.pptx new file mode 100644 index 000000000000..c1a3045bc17b Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf125360_1.pptx b/sd/qa/unit/data/pptx/tdf125360_1.pptx new file mode 100644 index 000000000000..cfc5798369db Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360_1.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf125360_2.pptx b/sd/qa/unit/data/pptx/tdf125360_2.pptx new file mode 100644 index 000000000000..4f6b16455f71 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360_2.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 792824650251..63c62803233d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -145,6 +145,9 @@ public: void testOpenDocumentAsReadOnly(); void testTdf125346(); void testTdf125346_2(); + void testTdf125360(); + void testTdf125360_1(); + void testTdf125360_2(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -213,6 +216,9 @@ public: CPPUNIT_TEST(testOpenDocumentAsReadOnly); CPPUNIT_TEST(testTdf125346); CPPUNIT_TEST(testTdf125346_2); + CPPUNIT_TEST(testTdf125360); + CPPUNIT_TEST(testTdf125360_1); + CPPUNIT_TEST(testTdf125360_2); CPPUNIT_TEST_SUITE_END(); @@ -1805,6 +1811,76 @@ void SdOOXMLExportTest2::testTdf125346_2() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf125360() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by shape style + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf125360_1() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by color scheme + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_1.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf125360_2() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by color scheme with a transparency + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_2.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(82), nTransparence); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast<sal_Int32>(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(23), nTransparence); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); commit 46de25f7fe028810e174ea790270dac3110dcf27 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat May 18 15:21:11 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:14:00 2019 +0200 tdf#125346: PPTX export: Shape has wrong fill color comming from theme Write the correct theme path to the InteropGrabBag, the same path what is generated and checked in the export code. Reviewed-on: https://gerrit.libreoffice.org/72500 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit a8bba60e8b655167ad91edcd0c2d1723d525b546) Change-Id: I32617c1a11cf3bafb142f7c8839b498aaac49aa0 Reviewed-on: https://gerrit.libreoffice.org/72522 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx index 18dfe2c35fe1..91f34935e016 100644 --- a/include/oox/ppt/presentationfragmenthandler.hxx +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -50,7 +50,7 @@ private: void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, const oox::ppt::SlidePersistPtr& rPersist ); void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); - void saveThemeToGrabBag(oox::drawingml::ThemePtr pThemePtr, const OUString& sTheme); + void saveThemeToGrabBag(oox::drawingml::ThemePtr pThemePtr, sal_Int32 nThemeIdx); std::vector< OUString > maSlideMasterVector; std::vector< OUString > maSlidesVector; diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 3c4a3c109b78..6e0ebeb27661 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -159,7 +159,7 @@ void ResolveTextFields( XmlFilterBase const & rFilter ) } } -void PresentationFragmentHandler::saveThemeToGrabBag(oox::drawingml::ThemePtr pThemePtr, const OUString& sTheme) +void PresentationFragmentHandler::saveThemeToGrabBag(oox::drawingml::ThemePtr pThemePtr, sal_Int32 nThemeIdx) { if (!pThemePtr) return; @@ -197,8 +197,11 @@ void PresentationFragmentHandler::saveThemeToGrabBag(oox::drawingml::ThemePtr pT aCurrentTheme[nId].Value = rColor; } + // add new theme to the sequence - aTheme[0].Name = sTheme; + // Export code uses the master slide's index to find the right theme + // so use the same index in the grabbag. + aTheme[0].Name = "ppt/theme/theme" + OUString::number(nThemeIdx) + ".xml"; const uno::Any& rCurrentTheme = makeAny(aCurrentTheme); aTheme[0].Value = rCurrentTheme; @@ -274,10 +277,17 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW ); Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_QUERY_THROW ); + sal_Int32 nIndex; if( rFilter.getMasterPages().empty() ) - xMasterPages->getByIndex( 0 ) >>= xMasterPage; + { + nIndex = 0; + xMasterPages->getByIndex( nIndex ) >>= xMasterPage; + } else - xMasterPage = xMasterPages->insertNewByIndex( xMasterPages->getCount() ); + { + nIndex = xMasterPages->getCount(); + xMasterPage = xMasterPages->insertNewByIndex( nIndex ); + } pMasterPersistPtr = std::make_shared<SlidePersist>( rFilter, true, false, xMasterPage, ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpTextListStyle ); @@ -307,7 +317,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage UNO_QUERY_THROW)); rThemes[ aThemeFragmentPath ] = pThemePtr; pThemePtr->setFragment(xDoc); - saveThemeToGrabBag(pThemePtr, aThemeFragmentPath); + saveThemeToGrabBag(pThemePtr, nIndex + 1); } else { diff --git a/sd/qa/unit/data/pptx/tdf125346.pptx b/sd/qa/unit/data/pptx/tdf125346.pptx new file mode 100644 index 000000000000..32fbbdf52e96 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125346.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf125346_2.pptx b/sd/qa/unit/data/pptx/tdf125346_2.pptx new file mode 100644 index 000000000000..53225581026e Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125346_2.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index c1f15d7a5a05..792824650251 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -143,7 +143,8 @@ public: void testTdf104789(); void testTdf116350TextEffects(); void testOpenDocumentAsReadOnly(); - + void testTdf125346(); + void testTdf125346_2(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -210,6 +211,8 @@ public: CPPUNIT_TEST(testTdf104789); CPPUNIT_TEST(testTdf116350TextEffects); CPPUNIT_TEST(testOpenDocumentAsReadOnly); + CPPUNIT_TEST(testTdf125346); + CPPUNIT_TEST(testTdf125346_2); CPPUNIT_TEST_SUITE_END(); @@ -1731,6 +1734,77 @@ void SdOOXMLExportTest2::testOpenDocumentAsReadOnly() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf125346() +{ + // There are two themes in the test document, make sure we use the right theme + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW ); + + drawing::FillStyle aFillStyle( drawing::FillStyle_NONE ); + xPropSet->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle); + + sal_Int32 nFillColor; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf125346_2() +{ + // There are two themes in the test document, make sure we use the right theme + // Test more slides with different themes + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125346_2.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + { + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW ); + + drawing::FillStyle aFillStyle( drawing::FillStyle_NONE ); + xPropSet->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle); + + sal_Int32 nFillColor; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor); + } + + { + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 1, xDocShRef ) ); + uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW ); + + drawing::FillStyle aFillStyle( drawing::FillStyle_NONE ); + xPropSet->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle); + + sal_Int32 nFillColor; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x052F61), nFillColor); + } + + { + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 2, xDocShRef ) ); + uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_SET_THROW ); + + drawing::FillStyle aFillStyle( drawing::FillStyle_NONE ); + xPropSet->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, aFillStyle); + + sal_Int32 nFillColor; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90C226), nFillColor); + } + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); commit cae40f0de45796295574fd1cf3d6a2e283407e9a Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon May 13 15:56:52 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:13:54 2019 +0200 Presentation minimizer: Handle also presentation.GraphicObjectShape URL Change-Id: I326b2803bf2d98d440e14d7f3f75ca61c2c9e49a Reviewed-on: https://gerrit.libreoffice.org/72303 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit aa446591b7feb5bb667533ef7acdfc636105f9d9) Reviewed-on: https://gerrit.libreoffice.org/72357 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index d37945eeb542..e6dbd5ca581a 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -228,7 +228,8 @@ void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxMSF, cons continue; } - if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) + if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" || + sShapeType == "com.sun.star.presentation.GraphicObjectShape" ) ImpAddGraphicEntity( rxMSF, xShape, rGraphicSettings, rGraphicEntities ); // now check for a fillstyle @@ -348,7 +349,8 @@ void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const continue; } - if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) + if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" || + sShapeType == "com.sun.star.presentation.GraphicObjectShape" ) { rnGraphics++; } commit cb355767aab7d5746d8a8ba2da98bd5bc1d73384 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue May 7 21:39:40 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:13:48 2019 +0200 PPTX: Fix import / export of image transparency Reviewed-on: https://gerrit.libreoffice.org/71916 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit ae3aabdb951643af8d2f7aee9c9f900245e5b384) Change-Id: Ib07c606083b833389fcb82aac57ca8535d6e861f Reviewed-on: https://gerrit.libreoffice.org/71933 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 5e9d56b8ed8d..b521b3683a88 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -799,6 +799,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop); } } + + if ( maBlipProps.moAlphaModFix.has() ) + { + rPropMap.setProperty(PROP_Transparency, static_cast<sal_Int16>(100 - (maBlipProps.moAlphaModFix.get() / PER_PERCENT))); + } } rPropMap.setProperty(PROP_GraphicColorMode, eColorMode); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 78efe5275cfa..8846baa8395d 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1166,11 +1166,11 @@ OUString DrawingML::WriteBlip( const Reference< XPropertySet >& rXPropSet, const } sal_Int16 nBright = 0; sal_Int32 nContrast = 0; - sal_Int32 nTransparence = 0; + sal_Int16 nTransparence = 0; GET( nBright, AdjustLuminance ); GET( nContrast, AdjustContrast ); - GET( nTransparence, FillTransparence ); + GET( nTransparence, Transparency ); mpFS->startElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed), sRelId.toUtf8().getStr(), diff --git a/sd/qa/unit/data/odp/image_transparency.odp b/sd/qa/unit/data/odp/image_transparency.odp new file mode 100644 index 000000000000..6d3f6c232d91 Binary files /dev/null and b/sd/qa/unit/data/odp/image_transparency.odp differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 3e328682f310..07a1de91c7eb 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -103,6 +103,7 @@ public: void testTdf112633(); void testCustomXml(); void testTdf94238(); + void testPictureTransparency(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -134,6 +135,7 @@ public: CPPUNIT_TEST(testTdf112633); CPPUNIT_TEST(testCustomXml); CPPUNIT_TEST(testTdf94238); + CPPUNIT_TEST(testPictureTransparency); CPPUNIT_TEST_SUITE_END(); @@ -894,6 +896,30 @@ void SdOOXMLExportTest1::testTdf94238() xDocShRef->DoClose(); } +void SdOOXMLExportTest1::testPictureTransparency() +{ + // Load document and export it to a temporary file. + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/image_transparency.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + + uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xPage.is()); + + uno::Reference<beans::XPropertySet> xGraphicShape(getShape(0, xPage)); + CPPUNIT_ASSERT(xGraphicShape.is()); + + sal_Int16 nTransparency = 0; + CPPUNIT_ASSERT(xGraphicShape->getPropertyValue("Transparency") >>= nTransparency); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(51), nTransparency); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT(); commit f670f41a313fb99b1a91b3dca5065d01e0504a93 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue May 21 12:50:31 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 11:13:22 2019 +0200 tdf#122765: Legend interferes with pie chart after pptx import Revert the commit caused this regression: 0fc41c53dfbd21e526fb0ad68a6651693c4a2ecd The original issue does not come back with reverting this commit. Reviewed-on: https://gerrit.libreoffice.org/72679 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 10609749126ca76eaf12904d4cce9cc5a16d8405) Change-Id: I666c4f92e3b70b416ec6da7a704298d207451649 Reviewed-on: https://gerrit.libreoffice.org/72767 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 428f3f801a53..1de330ec62dc 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -110,6 +110,7 @@ public: void testTdf115107(); // import complex data point labels void testTdf115107_2(); // import complex data point labels in cobo charts with multiple data series void testTdf121205(); + void testTdf122765(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -174,6 +175,7 @@ public: CPPUNIT_TEST(testTdf115107); CPPUNIT_TEST(testTdf115107_2); CPPUNIT_TEST(testTdf121205); + CPPUNIT_TEST(testTdf122765); CPPUNIT_TEST_SUITE_END(); @@ -1583,6 +1585,27 @@ void Chart2ImportTest::testTdf121205() } +void Chart2ImportTest::testTdf122765() +{ + // The horizontal position of the slices was wrong. + load("/chart2/qa/extras/data/pptx/", "tdf122765.pptx"); + Reference<chart::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY); + Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); + Reference<drawing::XShape> xSeriesSlices(getShapeByName(xShapes, "CID/D=0:CS=0:CT=0:Series=0"), + UNO_SET_THROW); + + Reference<container::XIndexAccess> xIndexAccess(xSeriesSlices, UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), xIndexAccess->getCount()); + Reference<drawing::XShape> xSlice(xIndexAccess->getByIndex(0), UNO_QUERY_THROW); + + // Check position of the first slice, all slices move together, so enough to check only one. + // Wrong poisition was around 5856. + awt::Point aSlicePosition = xSlice->getPosition(); + CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/pptx/tdf122765.pptx b/chart2/qa/extras/data/pptx/tdf122765.pptx new file mode 100644 index 000000000000..948190c30b55 Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf122765.pptx differ diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index a4bb1ec70944..8109ca8a3235 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -238,7 +238,6 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) // manual size needs ChartLegendExpansion_CUSTOM and LegendPosition_CUSTOM (tdf#118150) if( aLayoutConv.convertFromModel( aPropSet ) ) { - eLegendPos = cssc2::LegendPosition_CUSTOM; eLegendExpand = cssc::ChartLegendExpansion_CUSTOM; } bManualLayout = !aLayoutConv.getAutoLayout(); commit a7c6dd2ab3f9232fc32a93ccd9a81bc6734709f7 Author: Miklos Vajna <vmik...@collabora.co.uk> AuthorDate: Mon Nov 5 21:07:42 2018 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Jun 12 10:34:24 2019 +0200 tdf#120515 ODT filter: relax layout requirement before export This reverts commit 343af46fc301a984929e071d477b8fb9f211e289 (ODT filter: make sure we have a layout before export, 2017-11-29) as it causes a performance problem with large documents (see bugreport). I added it initially for the EPUB export, but there this is no longer needed as commit 3ed8466b55ace15a28761e06b6bb76ebd8758106 (EPUB export, fixed layout: switch to a metafile-based approach, 2017-12-01) switched to the better metafile-based approach. (cherry picked from commit e83c1f0ef999bdedaf9a5d5903aa5423c40f6d95) Change-Id: Ie404e23db77b8ded1d29f42b6279a3cd06a574b5 Reviewed-on: https://gerrit.libreoffice.org/71943 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 428b90ed6bc9..7d6d88940005 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -126,11 +126,6 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) SwDoc *pDoc = getDoc(); - // Make sure the layout is available to have more stability in the output - // markup. - if (SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()) - pViewShell->CalcLayout(); - if( getExportFlags() & (SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES| SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT)) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits