[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|6 ++ writerfilter/source/dmapper/DomainMapper.cxx | 10 -- writerfilter/source/dmapper/DomainMapper.hxx |1 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 + writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 +++ 6 files changed, 19 insertions(+), 2 deletions(-) New commits: commit adbfe9ee7a79eb81e4591f4b8c15d92044c7a07c Author: Justin Luth AuthorDate: Tue Mar 23 12:18:43 2021 +0200 Commit: Miklos Vajna CommitDate: Fri Mar 26 16:56:58 2021 +0100 tdf#125936 writerfilter: treat escapement in numbering like styles deferCharacterProperties wasn't occurring in the numbering import (and so it was affecting the first run of the body text). But just like character styles, it would be better to just consider this auto-superscript instead of to defer it and calculate based on the fontsize - since that really isn't known until layout time, and so only works with direct formating. cherry-picked from 7.2's 2a7617653fb3d31e44e5cbcf8daf4b4c2a24e2c8 Change-Id: I9ce5a31c173089603316f4c3389e5f2e5dbe165a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112987 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113076 diff --git a/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx b/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx new file mode 100644 index ..eb856fb3b02e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 71e313d4c545..db0d3c4141e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -43,6 +43,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx" CPPUNIT_ASSERT_MESSAGE("Para3: ", getProperty(getParagraph(3), "NumberingStyleName").isEmpty()); } +DECLARE_OOXMLEXPORT_TEST(testTdf125936_numberingSuperscript, "tdf125936_numberingSuperscript.docx") +{ +// Without the fix, the first character run was superscripted. +CPPUNIT_ASSERT_EQUAL( sal_Int16(0), getProperty(getRun(getParagraph(1), 1, "A-570-108"), "CharEscapement") ); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc") { // Get the third paragraph's numbering style's 1st level's bullet size diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d7f14e534d48..703f23a762fa 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1766,7 +1766,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) // The spec says 0 is the same as the lack of the value, so don't parse that. if ( nIntValue ) { -if ( !IsStyleSheetImport() ) +if (!IsStyleSheetImport() && !IsNumberingImport()) m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); else { @@ -3615,10 +3615,11 @@ void DomainMapper::lcl_table(Id name, writerfilter::Reference::Pointer_t break; case NS_ooxml::LN_NUMBERING: { - +m_pImpl->SetNumberingImport(true); //the same for list tables ref->resolve( *m_pImpl->GetListTable() ); m_pImpl->GetListTable( )->CreateNumberingRules( ); +m_pImpl->SetNumberingImport(false); } break; case NS_ooxml::LN_THEMETABLE: @@ -3940,6 +3941,11 @@ bool DomainMapper::IsStyleSheetImport() const return m_pImpl->IsStyleSheetImport(); } +bool DomainMapper::IsNumberingImport() const +{ +return m_pImpl->IsNumberingImport(); +} + void DomainMapper::enableInteropGrabBag(const OUString& aName) { m_pImpl->m_aInteropGrabBagName = aName; diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index 179f06ccd77c..4f0741d2b77e 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -113,6 +113,7 @@ public: bool IsInHeaderFooter() const; bool IsInTable() const; bool IsStyleSheetImport() const; +bool IsNumberingImport() const; bool IsInShape() const; void hasControls( const bool bSet ) { mbHasControls = bSet; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index d0d5a9fa5b0d..036d4d4096a7 100644 ---
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf140597.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 13 + writerfilter/source/dmapper/TableManager.hxx | 11 ++- 3 files changed, 23 insertions(+), 1 deletion(-) New commits: commit 1247f2f3d8f343e0e809a1aec0ce0e20005caafd Author: László Németh AuthorDate: Tue Mar 9 11:11:10 2021 +0100 Commit: Xisco Fauli CommitDate: Thu Mar 11 21:48:59 2021 +0100 tdf#140597 DOCX import: fix missing tblPrEx border of first table cells, caused by the workaround for tdf#138612. Now property set of a new cell is a copy of the table exception property set of the table row, as needed for the import of the table style inheritance. Regression from commit f319d6b543c2367546bc80d138e56ed03731e265 (tdf#138612 DOCX import: fix lost part of split table cell). Change-Id: Iaf6637e757fbfeef7651a4300a7f65a23615f5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112247 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 53884e8fe92597e909e4fa5599192783c3d31a56) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112225 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf140597.docx b/sw/qa/extras/ooxmlexport/data/tdf140597.docx new file mode 100644 index ..36db7d9bea2b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf140597.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index e6645a0e819f..503d0069a3f7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -760,6 +760,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf138612, "tdf138612.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[2]/w:tcPr/w:vMerge", 0); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140597, "tdf140597.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + +// There were missing tblPrEx table exception borders +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:tcBorders/w:top"); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:tcBorders/w:start"); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[1]/w:tcPr/w:tcBorders/w:top"); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[1]/w:tcPr/w:tcBorders/w:start"); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:top"); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:start"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128646, "tdf128646.docx") { // The problem was that not hidden shapes anchored to empty hidden paragraphs were imported as hidden. diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index 5e18becab606..ec064b17ccfc 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -114,7 +114,14 @@ class TableManager : public virtual SvRefBase void resetCellProps() { -mpCellProps = getTableExceptionProps(); +// copy tblPrEx table exception properties, if they exist +if (getTableExceptionProps().is()) +{ +mpCellProps = new TablePropertyMap; +mpCellProps->InsertProps(getTableExceptionProps().get()); +} +else +mpCellProps.clear(); } void setCellProps(TablePropertyMapPtr pProps) @@ -149,6 +156,8 @@ class TableManager : public virtual SvRefBase void setTableExceptionProps(TablePropertyMapPtr pProps) { mpTableExceptionProps = pProps; +// set table exception properties of the first cell +resetCellProps(); } const TablePropertyMapPtr& getTableExceptionProps() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf140137.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |5 writerfilter/source/dmapper/DomainMapperTableManager.cxx | 18 ++- 3 files changed, 18 insertions(+), 5 deletions(-) New commits: commit 102ddaa04193a3303e4d3d3e2193048aad3dc16a Author: Aron Budea AuthorDate: Sun Feb 28 22:04:24 2021 +0100 Commit: Xisco Fauli CommitDate: Mon Mar 1 15:22:47 2021 +0100 tdf#140137 Don't throw exception when w:gridCol is missing "w" attr 2149e924cbc32c370128c5f87a4f55c50c99e6bd added a division-by-zero check, which caused Writer to throw an error on the bugdoc. Since the file could be loaded fine before, let's return to a working version, with the check included. The cause is the following in document.xml (originating from a non-MS generator): Word still splits such tables differently, but that difference was always there in Writer. Change-Id: I6d91a736f460394a76f035298a238c41da201cb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111723 Tested-by: Jenkins Reviewed-by: Caolán McNamara Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111736 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111741 diff --git a/sw/qa/extras/ooxmlexport/data/tdf140137.docx b/sw/qa/extras/ooxmlexport/data/tdf140137.docx new file mode 100644 index ..d03925e75e2c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf140137.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 04c4975056e4..1e28459cc0b0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -81,6 +81,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(8664), frameRect.Width); } +DECLARE_OOXMLEXPORT_TEST(testTdf140137, "tdf140137.docx") +{ +// Don't throw exception during load +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index a19b9395e192..84b959e4e6ba 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -726,17 +726,25 @@ void DomainMapperTableManager::endOfRowAction() size_t nWidthsBound = m_aGridBefore.back() + m_nCell.back() - 1; if (nWidthsBound) { -if (nFullWidthRelative == 0) -throw o3tl::divide_by_zero(); - ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); for( size_t nBorder = 0; nBorder < nWidthsBound; ++nBorder ) { -double fGridWidth = 0.; +double nRelPos, fGridWidth = 0.; for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount ) fGridWidth += (*pTableGrid)[nBorderGridIndex++]; -double nRelPos = (fGridWidth * 1) / nFullWidthRelative; +if (fGridWidth == 0.) +{ +// allow nFullWidthRelative here, with a sane 0.0 result +nRelPos = 0.; +} +else +{ +if (nFullWidthRelative == 0) +throw o3tl::divide_by_zero(); + +nRelPos = (fGridWidth * 1) / nFullWidthRelative; +} pSeparators[nBorder].Position = rtl::math::round(nRelPos + nLastRelPos); pSeparators[nBorder].IsVisible = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf138612.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 17 + writerfilter/source/dmapper/TablePropertiesHandler.hxx |3 --- 3 files changed, 17 insertions(+), 3 deletions(-) New commits: commit 17419824db9174d45dc41ed731aa227ede6f72c4 Author: László Németh AuthorDate: Fri Dec 4 20:47:04 2020 +0100 Commit: Xisco Fauli CommitDate: Mon Dec 7 16:49:30 2020 +0100 tdf#138612 DOCX import: fix lost part of split table cell by removing unnecessary rewriting of cell properties during import of w:tblPrEx. Regression from commit da8ea444b004a0be36964ae9a778f73e752b2673 (tdf#133455 DOCX import: fix table border regression) Change-Id: I93ce36991437644db439c8cf02e1a8503fbdfba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107239 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit f319d6b543c2367546bc80d138e56ed03731e265) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107304 (cherry picked from commit 2c4806d6b8d79c1b95a41b72d295888bca01d5d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107305 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf138612.docx b/sw/qa/extras/ooxmlexport/data/tdf138612.docx new file mode 100644 index ..dd116044b56e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf138612.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 43b404553741..e6645a0e819f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -743,6 +743,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133455, "tdf133455.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[11]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf138612, "tdf138612.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + +// Row 5 Col 1 - vertically merged cell +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[5]/w:tc[1]/w:tcPr/w:vMerge", "val", "restart"); +// Row 5 Col 2 - split cell +// This was w:vMerge="restart" +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[5]/w:tc[2]/w:tcPr/w:vMerge", 0); + +// Row 6 Col 1 - merged with cell in Row 5 Col 1 +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[1]/w:tcPr/w:vMerge", "val", "continue"); +// Row 6 Col 2 - split cell +// This was w:vMerge="continue" (merged with cell in Row 5 Col 2) +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[2]/w:tcPr/w:vMerge", 0); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128646, "tdf128646.docx") { // The problem was that not hidden shapes anchored to empty hidden paragraphs were imported as hidden. diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.hxx b/writerfilter/source/dmapper/TablePropertiesHandler.hxx index d35ad7f114f0..514adbe129fe 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.hxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.hxx @@ -77,10 +77,7 @@ private: void tableExceptionProps( TablePropertyMapPtr pProps ) { if ( m_pTableManager ) -{ m_pTableManager->tableExceptionProps( pProps ); -cellProps( pProps ); -} else m_pCurrentProperties->InsertProps(pProps.get()); }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf138210.rtf |binary sw/qa/extras/rtfexport/rtfexport5.cxx |9 +++ writerfilter/source/rtftok/rtfsdrimport.cxx | 74 +--- 3 files changed, 44 insertions(+), 39 deletions(-) New commits: commit 9db952d2e793577f44df7a4a5b98c19ea87c8db0 Author: Mark Hung AuthorDate: Sat Nov 14 19:37:31 2020 +0800 Commit: Xisco Fauli CommitDate: Mon Nov 23 10:26:13 2020 +0100 tdf#138210 check if CustomShapeGeometry exist first. CustomShapeGeometry does not exist for a text frame. Getting the property throws an Exception and cause a general IO error. Change-Id: I0e31780292d45211bfd1250d0d359c72def50583 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105834 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit 8c14adfa76956e76bac98330ce67f080c90af184) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106237 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/rtfexport/data/tdf138210.rtf b/sw/qa/extras/rtfexport/data/tdf138210.rtf new file mode 100755 index ..d91a87d901e6 Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf138210.rtf differ diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index e005ce674b92..25cd2ee423bb 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1253,6 +1254,14 @@ DECLARE_RTFEXPORT_TEST(testTdf129513, "tdf129513.rtf") CPPUNIT_ASSERT_EQUAL(OUString("In table"), xCell->getString()); } +DECLARE_RTFEXPORT_TEST(testTdf138210, "tdf138210.rtf") +{ +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 1ecde8a8a684..ef2c92afac4d 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -917,46 +917,43 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } // Creating CustomShapeGeometry property -std::vector aGeometry; -if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height) +if (bCustom && xPropertySet.is()) { -aViewBox.Width -= aViewBox.X; -aViewBox.Height -= aViewBox.Y; -aPropertyValue.Name = "ViewBox"; -aPropertyValue.Value <<= aViewBox; -aGeometry.push_back(aPropertyValue); -} -if (!aPath.empty()) -{ -aPropertyValue.Name = "Path"; -aPropertyValue.Value <<= comphelper::containerToSequence(aPath); -aGeometry.push_back(aPropertyValue); -} -if (!aGeometry.empty() && xPropertySet.is() && !m_bTextFrame) -xPropertySet->setPropertyValue("CustomShapeGeometry", - uno::Any(comphelper::containerToSequence(aGeometry))); +bool bChanged = false; +comphelper::SequenceAsHashMap aCustomShapeGeometry( +xPropertySet->getPropertyValue("CustomShapeGeometry")); -if (!aShapeText.isEmpty()) -{ -auto aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry") -.get>(); -auto aGeomPropVec -= comphelper::sequenceToContainer>(aGeomPropSeq); -uno::Sequence aPropertyValues(comphelper::InitPropertySequence({ -{ "TextPath", uno::makeAny(true) }, -})); -auto it = std::find_if( -aGeomPropVec.begin(), aGeomPropVec.end(), -[](const beans::PropertyValue& rValue) { return rValue.Name == "TextPath"; }); -if (it == aGeomPropVec.end()) -aGeomPropVec.push_back(comphelper::makePropertyValue("TextPath", aPropertyValues)); -else -it->Value <<= aPropertyValues; +if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height) +{ +aViewBox.Width -= aViewBox.X; +aViewBox.Height -= aViewBox.Y; +aCustomShapeGeometry["ViewBox"] <<= aViewBox; +bChanged = true; +} + +if (!aPath.empty()) +{ +aCustomShapeGeometry["Path"] <<= comphelper::containerToSequence(aPath); +bChanged = true; +} + +if (!aShapeText.isEmpty()) +{ +uno::Sequence aSequence(comphelper::InitPropertySequence({ +{ "TextPath", uno::makeAny(true) }, +})); +aCustomShapeGeometry["TextPath"] <<= aSequence; +xPropertySet->setPropertyValue("TextAutoGrowHeight",
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf137593.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |9 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 4c07b4e48f10349c5d1f3f7274b7cbbcbaa9d57b Author: László Németh AuthorDate: Mon Oct 26 15:31:30 2020 +0100 Commit: Xisco Fauli CommitDate: Tue Oct 27 15:21:21 2020 +0100 tdf#137593 DOCX import: fix para top margin in cells with shapes and text boxes. Auto top margin value of the first table cell paragraph is zero. Paragraphs of shapes and text boxes anchored to this cell paragraph don't matter here, so keep m_bFirstParagraphInCell=true in shapes and text box paragraphs to avoid extra top margin of the anchoring point. Regression from commit 5c6bce38a01b21403a603acd3148cf3bbb4c685f (tdf#104354 DOCX import: fix paragraph auto spacing in tables). Change-Id: I22c4ae230bc0192f06d3d155217887c471c67b67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104816 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 41e230e81b50235b5b86f883ef424a8ba5b42288) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104828 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf137593.docx b/sw/qa/extras/ooxmlexport/data/tdf137593.docx new file mode 100644 index ..8b63fd39a8f2 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137593.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 7317dc751bb9..ae47d4f28a9c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1524,6 +1524,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354_2, "tdf104354-2.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraphOfText(1, xCell5->getText()), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf137593, "tdf137593.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + +// zero auto spacing, if the first paragraph contains text boxes +// This was 280. +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:tc/w:p[1]/w:pPr/w:spacing", "before", "0"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx") { // A chart anchored to a footnote multiplied during import diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index dc45aabdb27d..12aa623de2b2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2036,7 +2036,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con m_bParaHadField = false; // don't overwrite m_bFirstParagraphInCell in table separator nodes -if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth) +// and in text boxes anchored to the first paragraph of table cells +if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && !IsInShape()) m_bFirstParagraphInCell = false; m_bParaAutoBefore = false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf137085.rtf | 10 ++ sw/qa/extras/rtfexport/rtfexport5.cxx | 16 writerfilter/source/rtftok/rtfdispatchvalue.cxx | 10 ++ 3 files changed, 36 insertions(+) New commits: commit 501975b1705a9724c91bcd13ec0de19d39551595 Author: Michael Stahl AuthorDate: Wed Oct 21 17:53:07 2020 +0200 Commit: Miklos Vajna CommitDate: Thu Oct 22 14:10:26 2020 +0200 tdf#137085 writerfilter: RTF import: \trpaddfl and \trpaddl are row... ...properties, not cell properties. What is supposed to happen here, afaict: 1. \trpaddfr3 either has an effect on the left margin too (despite being defined for right), or \trpaddfl3 is the default, 0 is not the default 2. \trgaph600 should be ignored if the \trpaddfl3 is in effect 3. \trpaddl0 should be in effect, overriding both the value from \trgaph600 and the built-in default of #define DEF_BORDER_DIST 190 CellMarginHandler::lcl_sprm() needs to distinguish between \trpaddfl0 and \trpaddfl3 cases, but its not possible currently because a) \trpaddfl is processed after \trgaph/\trpaddl, and b) both \trgaph and \trpaddl produce the same srpm-id. This fixes \trpaddl handling just enough to import the bugdoc properly, for more fixing a new sprm-id for \trgaph would be needed at least. At the other end, there is a line in DomainMapperTableHandler.cxx: m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf ) ... but nothing that would initialize the GAP_HALF there. That this bugdoc looked right before commit c2a5346b19c57f93f210b76c15cdba64f6871203 appears to be entirely accidental. Change-Id: I80dc34bdd5dadb7d7d7f5ec595907035d621a656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104638 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit fc872146845e4d77ff404d0929f28abf2d3a1c51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104604 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/rtfexport/data/tdf137085.rtf b/sw/qa/extras/rtfexport/data/tdf137085.rtf new file mode 100644 index ..6aed787ef8ad --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf137085.rtf @@ -0,0 +1,10 @@ +{\rtf1\ansi + +\trowd +\trgaph600\trpaddfr3\trpaddl0 +\cellx3000 +\cellx6000 +<- no padding here\cell +<- no padding here\cell +\row +} diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 25c0bdb788f3..e005ce674b92 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1004,6 +1004,22 @@ DECLARE_RTFEXPORT_TEST(testTdf74795, "tdf74795.rtf") getProperty(xCell, "LeftBorderDistance")); } +DECLARE_RTFEXPORT_TEST(testTdf137085, "tdf137085.rtf") +{ +uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY); +// \trpaddl0 overrides \trgaph600 (-1058 mm100) and built-in default of 190 +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xTable, "LeftMargin")); + +// the \trpaddl0 is applied to all cells +uno::Reference xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), + getProperty(xCell, "LeftBorderDistance")); + +xCell.set(xTable->getCellByName("B1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), + getProperty(xCell, "LeftBorderDistance")); +} + DECLARE_RTFEXPORT_TEST(testTdf77349, "tdf77349.rtf") { uno::Reference xImage(getShape(1), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index d6b0fc79b21a..b43e85a2352a 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -624,6 +624,11 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) default: break; } +putNestedAttribute(m_aStates.top().getTableRowSprms(), + NS_ooxml::LN_CT_TblPrBase_tblCellMar, nSprm, + new RTFValue(aAttributes)); +// tdf#74795 also set on current cell, and as default for table cells +// (why isn't this done by domainmapper?) putNestedAttribute(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, new RTFValue(aAttributes)); putNestedAttribute(m_aDefaultState.getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, @@ -655,6 +660,10 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) default: break; } +putNestedSprm(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblCellMar, +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf134784.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx| 11 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 ++- 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 2f40b190b22213a80aa11021f69619f1b72838be Author: László Németh AuthorDate: Tue Sep 15 16:13:34 2020 +0200 Commit: Xisco Fauli CommitDate: Thu Oct 1 10:33:46 2020 +0200 tdf#134784 DOCX import: fix shape paragraph margins based on bad style inheritance. Regression from commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58 (tdf#118521 DOCX import: fix paragraph margin from paragraph style), revealing the problematic m_sCurrentParaStyleName, see also commit 8920d865ee148518bf71f71ce1866b24cc17c07e for more information. Change-Id: Icc7f70452d946d56dc840d39545d850f74f97ebc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102774 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c04ee66c7cfeb725d637b0f9ec3e3b1f8776bfe9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103585 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf134784.docx b/sw/qa/extras/ooxmlexport/data/tdf134784.docx new file mode 100644 index ..2099db66e0f6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134784.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 087373aaf7e4..984564415989 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -790,6 +790,17 @@ DECLARE_OOXMLEXPORT_TEST(testMarginsFromStyle, "margins_from_style.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(600), getProperty(getParagraph(3), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf134784, "tdf134784.docx") +{ +uno::Reference textbox(getShape(1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(3, getParagraphs(textbox)); +uno::Reference xParagraph = getParagraphOfText(1, textbox); +CPPUNIT_ASSERT_EQUAL(sal_Int32(212), getProperty(xParagraph, "ParaBottomMargin")); + +// This wasn't zero (it was inherited from style of the previous paragraph in the main text) +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xParagraph, "ParaTopMargin")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, "tdf104348_contextMargin.docx") { // tdf#104348 shows that ContextMargin belongs with Top/Bottom handling diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0e9e87f6df46..dc45aabdb27d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -772,8 +772,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear() OUString DomainMapper_Impl::GetCurrentParaStyleName() { +OUString sName; // use saved currParaStyleName as a fallback, in case no particular para style name applied. -OUString sName = m_sCurrentParaStyleName; +// tdf#134784 except in the case of first paragraph of shapes to avoid bad fallback. +// TODO fix this "highly inaccurate" m_sCurrentParaStyleName +if ( !m_bIsFirstParaInShape ) +sName = m_sCurrentParaStyleName; + PropertyMapPtr pParaContext = GetTopContextOfType(CONTEXT_PARAGRAPH); if ( pParaContext && pParaContext->isSet(PROP_PARA_STYLE_NAME) ) pParaContext->getProperty(PROP_PARA_STYLE_NAME)->second >>= sName; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132483.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx| 14 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit e48eb426bbef20b9f5646d3fe3978a6f476be5cb Author: Bakos Attila AuthorDate: Fri Jul 10 12:42:11 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 15 10:22:56 2020 +0200 tdf#132483: DOCX import: fix OLE anchoring position The relative orientation of OLE objects was not copied from the replacement object to OLE, resulting bad position. Co-authored-by: Attila Bánhegyi (NISZ) Change-Id: If62124e5a40218a224e047efbe86a09606b44af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102565 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf132483.docx b/sw/qa/extras/ooxmlexport/data/tdf132483.docx new file mode 100644 index ..e4ebf4b78511 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132483.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index f17d9ad3f668..792e919394b7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -11,6 +11,7 @@ #include #include +#include char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/"; @@ -178,6 +179,19 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter, CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight); } +DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx") +{ +uno::Reference xOLEProps(getShape(1), uno::UNO_QUERY_THROW); +sal_Int16 nVRelPos = -1; +sal_Int16 nHRelPos = -1; +xOLEProps->getPropertyValue("VertOrientRelation") >>= nVRelPos; +xOLEProps->getPropertyValue("HoriOrientRelation") >>= nHRelPos; +CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted vertically", +text::RelOrientation::PAGE_FRAME , nVRelPos); +CPPUNIT_ASSERT_EQUAL_MESSAGE("The OLE is shifted horizontally", +text::RelOrientation::PAGE_FRAME , nHRelPos); +} + DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter, "tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx") { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0f468e43937e..3c6d165facb6 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2228,7 +2228,9 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, const std::share OUString("HoriOrient"), OUString("HoriOrientPosition"), OUString("VertOrient"), -OUString("VertOrientPosition") +OUString("VertOrientPosition"), +OUString("VertOrientRelation"), +OUString("HoriOrientRelation") }; for (const OUString & s : pProperties) xOLEProperties->setPropertyValue(s, xReplacementProperties->getPropertyValue(s)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/uiwriter/data3/tdf112342.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 17 + writerfilter/source/dmapper/DomainMapper.cxx |8 +++- 3 files changed, 24 insertions(+), 1 deletion(-) New commits: commit 75f291ff075c4e4106a1f652e8bab629e4edcff7 Author: Attila Bakos AuthorDate: Thu Jul 30 10:15:09 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 8 18:36:40 2020 +0200 tdf#112342 DOCX import: fix page break before image-only paragraphs Picture anchored to an empty paragraphs was moved to the previous page, because the deferred page wasn't handled here. Change-Id: I4a694dd443ca8b67c4addbcba3523bffecd21418 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99763 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit e520a4f988bf0ff81e75e37588182af92fed7631) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100945 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data3/tdf112342.docx b/sw/qa/extras/uiwriter/data3/tdf112342.docx new file mode 100644 index ..ab4c7ee07d4d Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf112342.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 34db982e195b..fe637456f517 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -55,6 +55,23 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf112342) +{ +load(DATA_DIRECTORY, "tdf112342.docx"); + +//Get the last para +uno::Reference xPara = getParagraph(3); +auto xCur = xPara->getText()->createTextCursor(); +//Go to the end of it +xCur->gotoEnd(false); +//And let's remove the last 2 chars (the last para with its char). +xCur->goLeft(2, true); +xCur->setString(""); + +//If the second paragraph on the second page, this will be passed. +CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break does not match", 2, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626) { load(DATA_DIRECTORY, "tdf126626.docx"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index beccdfdafc76..b9adb976c73b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2284,7 +2284,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { if ( m_pImpl->IsDiscardHeaderFooter() ) break; - +//tdf112342: Break before images as well, if there are page break +if (m_pImpl->isBreakDeferred(BreakType::PAGE_BREAK)) +{ +m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) +->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); +m_pImpl->clearDeferredBreak(PAGE_BREAK); +} writerfilter::Reference::Pointer_t pProperties = rSprm.getProps(); if( pProperties ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 16 +++ writerfilter/source/dmapper/GraphicImport.cxx | 17 +--- 3 files changed, 29 insertions(+), 4 deletions(-) New commits: commit 7739740ab36a933a134996427132c64dfddac49c Author: Szabolcs Toth AuthorDate: Thu Jun 18 15:58:32 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 8 12:36:38 2020 +0200 tdf#120760 DOCX shape import: fix Z-order with behindDoc DrawingML attribute relativeHeight contains z-indices for shape Z-order, but this depends on behindDoc, too. We can use z-index = relativeHeight - MAX_INT32 on shapes with behindDoc=true, as a simple workaround to get correct Z-order, because unsigned relativeHeight values stored in sal_Int32, and MIN_INT32 <= -MAX_INT32, and the temporary negative z-indices will converted by GraphicZOrderHelper. Note: this commit doesn't fix the old writerfilter implementation problem, that DOCX relativeHeight is an unsignedInt value according to W3C XML Schema, i.e. its maximal value is 4294967295 (MAX_UINT32), not 2147483647 (MAX_INT32). Co-authored-by: Balázs Regényi Change-Id: I54a72a95bc69b307b2835636fff376b0aa9bc45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96614 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 6479096dc2bd40215ff80273b4d27cadb2688cb1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100947 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx new file mode 100644 index ..77a6d48dd866 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index c2aaec5c64a9..08d4831d1b12 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1318,6 +1318,22 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf112287, "tdf112287.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx") +{ +// tdf#120760 Check that the Z-Order of the background is smaller than the front shape's. +xmlDocUniquePtr pXml = parseExport("word/header1.xml"); +if (!pXml) +return; + +// Get the Z-Order of the background image and of the shape in front of it. +sal_Int32 nBackground = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/w:drawing/wp:anchor", "relativeHeight").toInt32(); +sal_Int32 nFrontShape = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/mc:AlternateContent[2]" +"/mc:Choice/w:drawing/wp:anchor", "relativeHeight").toInt32(); + +// Assert that background is in the back. +CPPUNIT_ASSERT(nBackground < nFrontShape); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 27acbe045b25..372e9f40870a 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -208,6 +208,7 @@ public: bool bLayoutInCell; bool bAllowOverlap = true; bool bOpaque; +bool bBehindDoc; bool bContour; bool bContourOutside; WrapPolygon::Pointer_t mpWrapPolygon; @@ -273,6 +274,7 @@ public: ,nWrap(text::WrapTextMode_NONE) ,bLayoutInCell(true) ,bOpaque( !rDMapper.IsInHeaderFooter() ) +,bBehindDoc(false) ,bContour(false) ,bContourOutside(true) ,nLeftMargin(319) @@ -371,10 +373,15 @@ public: { if (zOrder >= 0) { +// tdf#120760 Send objects with behinddoc=true to the back. +sal_Int32 nZOrder = zOrder; +if (bBehindDoc && rDomainMapper.IsInHeaderFooter()) +nZOrder -= SAL_MAX_INT32; GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper(); bool bOldStyle = eGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE; - xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder, bOldStyle))); -pZOrderHelper->addItem(xGraphicObjectProperties, zOrder); + xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), +uno::makeAny(pZOrderHelper->findZOrder(nZOrder, bOldStyle))); +pZOrderHelper->addItem(xGraphicObjectProperties, nZOrder); } } @@ -609,8 +616,11 @@ void GraphicImport::lcl_attribute(Id nName, Value&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |2 +- sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |5 +++-- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |3 ++- writerfilter/source/dmapper/SdtHelper.cxx |9 + 4 files changed, 15 insertions(+), 4 deletions(-) New commits: commit 73b2bacf2f3f531896fc20aeecb51d433ecd5a9c Author: Serge Krot AuthorDate: Mon Jul 20 15:15:47 2020 +0200 Commit: Xisco Fauli CommitDate: Mon Aug 10 10:39:39 2020 +0200 tdf#134572 DOCX: Incorrect default value in dropdown text fields Change-Id: I3169e817c2f033d1525adc3b02ac3680ad220d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99074 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 89b6b2dbb728abea2186ff1ae158c0adb67d05be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100216 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 430749768862..1b9621b473b0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -1052,7 +1052,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf119809, "tdf119809.docx") CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown")); uno::Sequence aItems = getProperty< uno::Sequence >(aField, "Items"); -CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aItems.getLength()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aItems.getLength()); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 22d069a90864..c6cb3c351843 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -741,9 +741,10 @@ void Test::verifyComboBoxExport(bool aComboBoxAsDropDown) CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown")); uno::Sequence aItems = getProperty< uno::Sequence >(aField, "Items"); -CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aItems.getLength()); CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]); CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]); +CPPUNIT_ASSERT_EQUAL(OUString("Manolo"), aItems[2]); } else { @@ -767,7 +768,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx" xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito"); -assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "manolo"); +assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo"); // check imported control verifyComboBoxExport(getShapes() == 0); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 5f401b266bfc..5b09147a0ad2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -948,9 +948,10 @@ DECLARE_OOXMLEXPORT_TEST(testN779630, "n779630.docx") CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown")); uno::Sequence aItems = getProperty< uno::Sequence >(aField, "Items"); -CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aItems.getLength()); CPPUNIT_ASSERT_EQUAL(OUString("Yes"), aItems[0]); CPPUNIT_ASSERT_EQUAL(OUString("No"), aItems[1]); +CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), aItems[2]); } } diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 4e437ae0e562..60153d4c6126 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -90,6 +90,15 @@ void SdtHelper::createDropDownControl() m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.TextField.DropDown"), uno::UNO_QUERY); +const auto it = std::find_if( +m_aDropDownItems.begin(), m_aDropDownItems.end(), +[aDefaultText](const OUString& item) -> bool { return !item.compareTo(aDefaultText); }); + +if (m_aDropDownItems.end() == it) +{ +m_aDropDownItems.push_back(aDefaultText); +} + // set properties uno::Reference xPropertySet(xControlModel, uno::UNO_QUERY); xPropertySet->setPropertyValue("SelectedItem", uno::makeAny(aDefaultText)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf134648.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 12 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 ++ 3 files changed, 22 insertions(+) New commits: commit fc4dc18a218dc5d986569b5e6e8c1172a843da1a Author: László Németh AuthorDate: Mon Jul 20 14:05:30 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Jul 22 13:22:25 2020 +0200 tdf#134648 DOCX import: fix bottom auto margin of subitem If style based spacing was set to auto in the previous list item, style of the actual paragraph must be the same to guarantee the same auto setting. Regression from commit 9cca15204af9cc44a8a9528ccf2f36616fb70e69 (tdf#133052: DOCX import: fix top auto margin of subitems). Change-Id: I39d2bad03a659a407b52550768b010cfa716d363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99096 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 1c3eb7e329cd2eaeb83068907ba0c9a5b3ef7852) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99195 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf134648.docx b/sw/qa/extras/ooxmlexport/data/tdf134648.docx new file mode 100644 index ..36e856ca055a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134648.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 8847b6413a54..7317dc751bb9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -236,6 +236,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133052, "tdf133052.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[5]/w:pPr/w:spacing", "before", "0"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134648, "tdf134648.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + +// list item with direct top auto spacing +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "after", "240"); +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing", "1"); + +// This was spacing w:after=200, but bottom auto spacing of first list subitem is zero +assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", 0); +} + DECLARE_OOXMLEXPORT_TEST(testTdf129575_directBefore, "tdf129575-directBefore.docx") { uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b987b58d8f40..3f3ce4585b9f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1695,6 +1695,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con { return rValue.Name == "ParaTopMarginBeforeAutoSpacing"; }); +// if style based spacing was set to auto in the previous paragraph, style of the actual paragraph must be the same +if (bParaAutoBefore && !m_bParaAutoBefore && m_xPreviousParagraph->getPropertySetInfo()->hasPropertyByName("ParaStyleName")) +{ + auto itParaStyle = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) + { + return rValue.Name == "ParaStyleName"; + }); + bParaAutoBefore = itParaStyle != aProperties.end() && + m_xPreviousParagraph->getPropertyValue("ParaStyleName") == itParaStyle->Value; +} // There was a previous textnode and it had the same numbering. if (bParaAutoBefore) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf83309.docx |binary writerfilter/source/dmapper/NumberingManager.cxx |2 ++ 2 files changed, 2 insertions(+) New commits: commit 54b6a6a5c95ed51ce0cd709d9fd3e477ced5ce8f Author: Vasily Melenchuk AuthorDate: Thu Jun 25 11:42:02 2020 +0300 Commit: Xisco Fauli CommitDate: Wed Jul 8 10:39:15 2020 +0200 tdf#134260: docx import: allow default value for list tab position It looks like previously used as a testcase document is just a specific case with default values. All other readers (incl. Office 365) displaying that doc with default tab at zero position. Change-Id: I50fe00c7f87b6d790fbe6e2f32a306ac59060c72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97089 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 7221994b9b29659d3290e95eee92b1a3f80c2b7e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98331 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf83309.docx b/sw/qa/extras/ooxmlexport/data/tdf83309.docx index 8dfddb6ed201..e8f59bc81969 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf83309.docx and b/sw/qa/extras/ooxmlexport/data/tdf83309.docx differ diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index c96dbba8dcb8..11b851c7ee8c 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -231,6 +231,8 @@ uno::Sequence ListLevel::GetLevelProperties(bool bDefaults if (m_nTabstop.has_value()) aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, *m_nTabstop)); +else if (bDefaults) + aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, 0)); //TODO: handling of nFLegal? //TODO: nFNoRestart lower levels do not restart when higher levels are incremented, like: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 11 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx |3 +++ 2 files changed, 14 insertions(+) New commits: commit aea7fe41358c218a12dc34e4c0942360f0d5fde6 Author: László Németh AuthorDate: Wed Jul 1 18:14:39 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Thu Jul 2 23:45:21 2020 +0200 tdf#133735 DOCX: fix paragraph settings of nested tables First row of a nested tables lost its paragraph settings, by dropping the collected paragraph data of the unfinished row. Regression from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c (tdf#132514 DOCX import: fix lost table style with footer) Change-Id: I17d81d0906f424fe35237ac285e8ad27090bcab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97645 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 8b5be44b30119b67d7b3ca9c4140046976a1df59) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97790 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index f4c29f271bcd..13d6f679bbae 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -375,6 +375,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","1611"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133735, "fdo73389.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport(); + +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tr[2]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); +// This was 200 +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:spacing", "after", "0"); +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tr[1]/w:tc[3]/w:p/w:pPr/w:spacing", "after", "0"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf59274, "tdf59274.docx") { // Table with "auto" table width and incomplete grid: 11 columns, but only 4 gridCol elements. diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 915b317d40d5..a19b9395e192 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -580,6 +580,7 @@ void DomainMapperTableManager::endOfRowAction() IntVectorPtr pTmpCellWidths = m_aCellWidths.back(); sal_uInt32 nTmpCell = m_nCell.back(); sal_uInt32 nTmpGridBefore = m_aGridBefore.back(); +TableParagraphVectorPtr pTableParagraphs = getCurrentParagraphs(); // endLevel and startLevel are taking care of the non finished row // to carry it over to the next table @@ -598,6 +599,8 @@ void DomainMapperTableManager::endOfRowAction() m_aCellWidths.push_back(pTmpCellWidths); m_nCell.push_back(nTmpCell); m_aGridBefore.push_back(nTmpGridBefore); +m_aParagraphsToEndTable.pop( ); +m_aParagraphsToEndTable.push( pTableParagraphs ); } // save table style in the first row for comparison if ( m_nRow == 0 && pTablePropMap->isSet(META_PROP_TABLE_STYLE_NAME) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/uiwriter/data2/tdf76817.fodt| 77 sw/qa/extras/uiwriter/uiwriter2.cxx | 87 +++ writerfilter/source/dmapper/NumberingManager.cxx | 10 ++ 3 files changed, 172 insertions(+), 2 deletions(-) New commits: commit c850d7288650c37a3c569fd4891ecdf725b3a279 Author: László Németh AuthorDate: Tue Jun 16 18:52:56 2020 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 24 12:44:26 2020 +0200 tdf#76817 DOCX: fix round-tripped outline numbering Fix automatic chapter numbering in DOCX documents created by Writer. Follow-up of commit de1b634a151c198584dc152676183f519c50a2da (tdf#76817: DOCX import: fix custom chapter numbering). Change-Id: I331b7dcf67efdf63b376122ec4da0a2e85bea761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96529 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit d0cdeb78e9077320011ebe87cabd179b1029e1ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96509 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data2/tdf76817.fodt b/sw/qa/extras/uiwriter/data2/tdf76817.fodt new file mode 100644 index ..4b6decb1a82a --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf76817.fodt @@ -0,0 +1,77 @@ + +http://openoffice.org/2009/office; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Should be 1 + Should be 1.1 + Should be 2 + Should be 2.1 + + + diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 68470cecdc72..01d05d963b3c 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1225,6 +1225,93 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) getProperty(getParagraph(4), "ListLabelString")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_round_trip) +{ +load(DATA_DIRECTORY, "tdf76817.fodt"); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +// save it to DOCX +reload("Office Open XML Text", "tdf76817.docx"); +pTextDoc = dynamic_cast(mxComponent.get()); + +SwViewShell* pViewShell += pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); +pViewShell->Reformat(); + +CPPUNIT_ASSERT(pTextDoc); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(2), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(2), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty(getParagraph(2), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(4), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(4), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("2.1"), + getProperty(getParagraph(4), "ListLabelString")); + +// set Heading 2 style of paragraph 2 to Heading 1 + +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Down(/*bSelect=*/false); + +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::makeAny(OUString("Heading 1")) }, +{ "FamilyName", uno::makeAny(OUString("ParagraphStyles")) }, +}); +dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty(getParagraph(2), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(1), + getProperty(getParagraph(2), "OutlineLevel")); +// This was "1 Heading" instead of "2 Heading" +CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty(getParagraph(2), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(4), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(4), "OutlineLevel")); +// This was "2.1 Heading" +CPPUNIT_ASSERT_EQUAL(OUString("3.1"), + getProperty(getParagraph(4), "ListLabelString")); + +// set Heading 1 style of paragraph 3 to Heading 2 + +pWrtShell->Down(/*bSelect=*/false); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf108505.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 12 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 + 3 files changed, 21 insertions(+), 4 deletions(-) New commits: commit acfc23e9a4b24d5ca6d772cadcca77ab3c6d0196 Author: Gabor Kelemen AuthorDate: Sun Mar 22 22:59:05 2020 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Jun 24 12:05:17 2020 +0200 tdf#108505 DOCX: fix legacy dropdown fields direct font setting if it is at the beginning of the paragraph. See also commit 22ad4d69d771708f28a2d9e137cfd43ac846cf3a (tdf#121045 DOCX import: fix checkbox size in table). Change-Id: Ic4d4fc56cf031cc941c3f81930c6eba497090cba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91540 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit face27179d882cfbec368e2bed5f65276a5ce963) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96697 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/data/tdf108505.docx b/sw/qa/extras/ooxmlexport/data/tdf108505.docx new file mode 100644 index ..50ebc3770895 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf108505.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 99e1d29c93d8..781dfa872081 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1136,6 +1136,18 @@ DECLARE_OOXMLEXPORT_TEST(testLineWidthRounding, "tdf126363_LineWidthRounding.doc assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "57150"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, "tdf108505.docx") +{ +uno::Reference xParagraph = getParagraph(3); +uno::Reference xText += getRun(xParagraph, 1, "Wrong font when alone on the line"); + +// Without the fix in place this would have become Times New Roman +CPPUNIT_ASSERT_EQUAL( +OUString("Trebuchet MS"), +getProperty(xText, "CharFontName")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a059c623b4c9..861fcf678ab4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4870,7 +4870,7 @@ void DomainMapper_Impl::CloseFieldCommand() OUString const sFirstParam(vArguments.empty() ? OUString() : vArguments.front()); // apply font size to the form control -if (!m_aTextAppendStack.empty() && m_pLastCharacterContext && m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) ) +if (!m_aTextAppendStack.empty() && m_pLastCharacterContext && ( m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) || m_pLastCharacterContext->isSet(PROP_CHAR_FONT_NAME ))) { uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend; if (xTextAppend.is()) @@ -4880,9 +4880,14 @@ void DomainMapper_Impl::CloseFieldCommand() { xCrsr->gotoEnd(false); uno::Reference< beans::XPropertySet > xProp( xCrsr, uno::UNO_QUERY ); - xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT)->second); -if ( m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT_COMPLEX) ) - xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT_COMPLEX), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT_COMPLEX)->second); +if (m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT)) +{ + xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT)->second); +if (m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT_COMPLEX)) + xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT_COMPLEX), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT_COMPLEX)->second); +} +if (m_pLastCharacterContext->isSet(PROP_CHAR_FONT_NAME)) + xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), m_pLastCharacterContext->getProperty(PROP_CHAR_FONT_NAME)->second); } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133605.docx |binary sw/qa/extras/ooxmlexport/data/tdf133605_2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 51 +++ writerfilter/source/dmapper/NumberingManager.cxx | 23 -- writerfilter/source/dmapper/NumberingManager.hxx |2 5 files changed, 63 insertions(+), 13 deletions(-) New commits: commit c1d695d93125fbbd5999ee7f49a30a3360a90747 Author: Vasily Melenchuk AuthorDate: Sun Jun 14 14:47:57 2020 +0300 Commit: Vasily Melenchuk CommitDate: Wed Jun 17 09:21:53 2020 +0200 tdf#133605: docx import: use ilvl value for list level import Previous implementation was not aware about ilvl value which declares a level number it is defining. So LO was able correctly handle only lists were levels are defined in increasing order starting from zero. Same problem was also with override lists: if we just override only one some random level (for example ilvl=2 in bugdoc) it was applied to level 0. Change-Id: If1f466fcbae0c82a8601e5b638e541d75aab665c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96268 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 408f2a1c09a6563caf193384df8e1cac6e153fbb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96422 Reviewed-by: Vasily Melenchuk diff --git a/sw/qa/extras/ooxmlexport/data/tdf133605.docx b/sw/qa/extras/ooxmlexport/data/tdf133605.docx new file mode 100644 index ..d248d5e1a93b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133605.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx b/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx new file mode 100644 index ..8d3c5acba609 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133605_2.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index e2c5f0dbf9b6..99e1d29c93d8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -954,6 +954,57 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120394, "tdf120394.docx") } } +DECLARE_OOXMLEXPORT_TEST(testTdf133605, "tdf133605.docx") +{ +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(3), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(4), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(5), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(6), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(3), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty(xPara, "ListLabelString")); +} +} + +DECLARE_OOXMLEXPORT_TEST(testTdf133605_2, "tdf133605_2.docx") +{ +// About the same document as tdf133605.docx, but number definition has level definitions in random order +CPPUNIT_ASSERT_EQUAL(1, getPages()); +{ +uno::Reference xPara(getParagraph(3), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString(CHAR_ZWSP), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(4), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(1), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(5), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(2), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty(xPara, "ListLabelString")); +} +{ +uno::Reference xPara(getParagraph(6), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(static_cast(3), getProperty(xPara, "NumberingLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("(a)"), getProperty(xPara, "ListLabelString")); +} +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123757, "tdf123757.docx") { xmlDocUniquePtr pXml = parseExport("word/document.xml"); diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 309ca8f46d80..23ea3ebefbb7 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -366,11 +366,14 @@
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/uiwriter/data2/tdf76817.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 55 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 writerfilter/source/dmapper/NumberingManager.cxx |5 ++ writerfilter/source/dmapper/NumberingManager.hxx |5 ++ 5 files changed, 66 insertions(+), 1 deletion(-) New commits: commit eb90d729178b3acec3f0045b96e1011d57d57bb6 Author: László Németh AuthorDate: Fri Jun 12 13:14:51 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 16 13:42:37 2020 +0200 tdf#76817: DOCX import: fix custom chapter numbering When one of the parents of the default Heading style has got custom paragraph style instead of the default Heading 1 – Heading 10, apply direct numbering again to avoid bad or missing numbering. Change-Id: I7e94600b5ac2cbf593a95eda6c0d6cd9d731dd75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96199 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit de1b634a151c198584dc152676183f519c50a2da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96212 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/uiwriter/data2/tdf76817.docx b/sw/qa/extras/uiwriter/data2/tdf76817.docx new file mode 100644 index ..20478778a0d3 Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf76817.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 27ed40c0d265..68470cecdc72 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1225,6 +1225,61 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) getProperty(getParagraph(4), "ListLabelString")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817_custom_outline) +{ +load(DATA_DIRECTORY, "tdf76817.docx"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty(getParagraph(1), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(1), + getProperty(getParagraph(1), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty(getParagraph(1), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(2), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(2), "OutlineLevel")); +// This wasn't numbered +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty(getParagraph(2), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(4), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(4), "OutlineLevel")); +// This wasn't numbered +CPPUNIT_ASSERT_EQUAL(OUString("2.1"), + getProperty(getParagraph(4), "ListLabelString")); + +// set Heading 2 style of paragraph 2 to Heading 1 + +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Down(/*bSelect=*/false); + +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::makeAny(OUString("Heading 1")) }, +{ "FamilyName", uno::makeAny(OUString("ParagraphStyles")) }, +}); +dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), + getProperty(getParagraph(2), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(1), + getProperty(getParagraph(2), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty(getParagraph(2), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(4), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(4), "OutlineLevel")); +// This wasn't numbered +CPPUNIT_ASSERT_EQUAL(OUString("3.1"), + getProperty(getParagraph(4), "ListLabelString")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123102) { createDoc("tdf123102.odt"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0fee7eb801aa..a059c623b4c9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1404,7 +1404,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // Since LO7.0/tdf#131321 fixed the loss of numbering in styles, this OUGHT to be obsolete, // but now other new/critical LO7.0 code expects it, and perhaps some corner cases still need it as
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 15 +++- sw/qa/extras/uiwriter/data2/num-parent-style.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 78 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++- 4 files changed, 99 insertions(+), 8 deletions(-) New commits: commit 7ed62ccc2bc436001bbf033db22ec2f19c70fdf2 Author: László Németh AuthorDate: Fri Jun 12 11:11:16 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 16 13:41:23 2020 +0200 tdf#76817: DOCX import: fix chapter numbering Imported headings got also redundant custom direct numbering, resulting broken automatic chapter numbering: applying standard Heading styles on paragraphs using the associated toolbar menu, Manage Styles dialog window or Ctrl-1–Ctrl-4 shortcut keys, it didn't result continuous numbering. Co-authored-by: Justin Luth Change-Id: Ic1ba5070fa4c387ad527aec05234a4da90fab751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96198 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 2128d59ab91da853652305390d56b3287bcb67b1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96211 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index ac4bf4cd2053..5ff581743ccd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -771,9 +771,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOOxmlOutlineNumberTypes, "outline-number DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, "num-parent-style.docx") { -//reverting tdf#76817 hard-codes the numbering style on the paragraph, preventing RT of "Outline" style -//I think this unit test is wrong, but I will revert to its original claim. -CPPUNIT_ASSERT(getProperty(getParagraph(4), "NumberingStyleName").startsWith("WWNum")); +CPPUNIT_ASSERT_EQUAL(static_cast(1), +getProperty(getParagraph(1), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty(getParagraph(1), "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), +getProperty(getParagraph(2), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty(getParagraph(2), "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(static_cast(1), +getProperty(getParagraph(3), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty(getParagraph(3), "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), +getProperty(getParagraph(4), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("2.1"), getProperty(getParagraph(4), "ListLabelString")); } DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") diff --git a/sw/qa/extras/uiwriter/data2/num-parent-style.docx b/sw/qa/extras/uiwriter/data2/num-parent-style.docx new file mode 100644 index ..4b8c657afa3f Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/num-parent-style.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 99f573b139e6..27ed40c0d265 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1147,6 +1147,84 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf105413) getProperty(getParagraph(1), "ParaStyleName")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf76817) +{ +load(DATA_DIRECTORY, "num-parent-style.docx"); + +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(2), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(2), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("1.1"), + getProperty(getParagraph(2), "ListLabelString")); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), + getProperty(getParagraph(4), "ParaStyleName")); +CPPUNIT_ASSERT_EQUAL(static_cast(2), + getProperty(getParagraph(4), "OutlineLevel")); +CPPUNIT_ASSERT_EQUAL(OUString("2.1"), + getProperty(getParagraph(4), "ListLabelString")); + +// set Heading 2 style of paragraph 2 to Heading 1 + +SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); +pWrtShell->Down(/*bSelect=*/false); + +uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ +{ "Style", uno::makeAny(OUString("Heading 1")) }, +{ "FamilyName", uno::makeAny(OUString("ParagraphStyles")) }, +}); +dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + +CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133457.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |9 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 ++--- 3 files changed, 23 insertions(+), 3 deletions(-) New commits: commit 067f7548f4e4cebcfcbc38457201d1c112ad80c3 Author: Tibor Nagy AuthorDate: Thu May 28 13:47:30 2020 +0200 Commit: Xisco Fauli CommitDate: Fri Jun 12 18:39:54 2020 +0200 tdf#133457 DOCX import: fix frame position regression caused by commit f5636817e7677a3081263df9004940a7d5ac54af (tdf#112287 DOCX frame import: fix default vAnchor). Co-authored-by: Attila Bakos (NISZ) Change-Id: I6fe16ff274d6a2fa4a335c7790ecd0f01641a6fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95035 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5e8761ef902a8d5d6534b7c1803242bacff72be3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95977 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133457.docx b/sw/qa/extras/ooxmlexport/data/tdf133457.docx new file mode 100644 index ..8fb6730b0933 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133457.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 9e0d318f1021..877594f9f2f2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -961,6 +961,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf107119, "tdf107119.docx") CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL, getProperty(XPropsWrap, "Surround")); } +DECLARE_OOXMLEXPORT_TEST(testTdf133457, "tdf133457.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:pPr/w:framePr","vAnchor","text"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index abde5e06db47..7476f7d1ee56 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1167,10 +1167,21 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) pStyleProperties->IsyValid() ? pStyleProperties->Gety() : DEFAULT_VALUE)); //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11 - aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), sal_Int16( -rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ? +if (rAppendContext.pLastParagraphProperties->GetWrap() == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE && +pStyleProperties->GetWrap() == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE) +{ + aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), sal_Int16( +rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ? +rAppendContext.pLastParagraphProperties->GetvAnchor() : +pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::FRAME))); +} +else +{ + aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), sal_Int16( +rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ? rAppendContext.pLastParagraphProperties->GetvAnchor() : -pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::PAGE_PRINT_AREA ))); +pStyleProperties->GetvAnchor() >= 0 ? pStyleProperties->GetvAnchor() : text::RelOrientation::PAGE_PRINT_AREA))); +} aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), rAppendContext.pLastParagraphProperties->GetWrap() != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133455.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx| 17 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 39 +-- writerfilter/source/dmapper/TableManager.cxx | 16 ++ writerfilter/source/dmapper/TableManager.hxx | 33 writerfilter/source/dmapper/TablePropertiesHandler.cxx |4 - writerfilter/source/dmapper/TablePropertiesHandler.hxx | 11 7 files changed, 81 insertions(+), 39 deletions(-) New commits: commit c043b589c4b185dc4f78e52ef16e2600c121decb Author: László Németh AuthorDate: Thu Jun 4 13:32:53 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 9 12:07:41 2020 +0200 tdf#133455 DOCX import: fix table border regression caused by commit 8ffc1299ebf83450e67cf2a89304859e2558cd27 (tdf#95033 DOCX import: apply tblPrEx table border). Change-Id: Ief4da3bce3282b5dab1ce4dabb4e075efcc1abaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95504 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 3593dd550882783b5f776262e928fc058c4dbd9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95550 Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf133455.docx b/sw/qa/extras/ooxmlexport/data/tdf133455.docx new file mode 100644 index ..e852976995e6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133455.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 74e98cfb49da..c2aaec5c64a9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -726,6 +726,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95033, "tdf95033.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[9]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom[@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testTdf133455, "tdf133455.docx") +{ +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +//Not disabled table cell borders +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:start[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:end[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:tcBorders/w:start[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:tcBorders/w:end[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[11]/w:tc[1]/w:tcPr/w:tcBorders/w:start[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[11]/w:tc[1]/w:tcPr/w:tcBorders/w:end[@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[11]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:val = 'nil']", 0); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128646, "tdf128646.docx") { // The problem was that not hidden shapes anchored to empty hidden paragraphs were imported as hidden. diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index dd5a14b732eb..c32b33af10c4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -762,11 +762,6 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl pCellProperties[nRow].realloc( aRowOfCellsIterator->size() ); beans::PropertyValues* pSingleCellProperties = pCellProperties[nRow].getArray(); -static const PropertyIds pBorders[] = -{ -PROP_TOP_BORDER, PROP_LEFT_BORDER, PROP_BOTTOM_BORDER, PROP_RIGHT_BORDER -}; - while( aCellIterator != aCellIteratorEnd ) { PropertyMapPtr pAllCellProps( new PropertyMap ); @@ -823,33 +818,15 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl PropertyMapPtr pStyleProps = rInfo.pTableStyle->GetProperties( nCnfStyleMask ); // Check if we need to clean up some empty border definitions to match what Word does. -// Apply also possible tblPrEx borders on cells +static const PropertyIds pBorders[] = +{ +PROP_TOP_BORDER, PROP_LEFT_BORDER, PROP_BOTTOM_BORDER, PROP_RIGHT_BORDER +}; for (const PropertyIds& rBorder : pBorders) { std::optional oStyleCellBorder = pStyleProps->getProperty(rBorder);