[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132185.docx |binary sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |9 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 - 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 8b56945587833f813f64bf69c5ebf497e79166ce Author: Mike Kaganski AuthorDate: Sun Apr 19 19:54:59 2020 +0300 Commit: Michael Stahl CommitDate: Mon Apr 20 10:44:28 2020 +0200 tdf#132185: field command does not necessarily end with space Change-Id: I5a5e54fb42e20855b75af7ab523465a032ab46e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92504 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92445 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf132185.docx b/sw/qa/extras/ooxmlexport/data/tdf132185.docx new file mode 100644 index ..955de5097945 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132185.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 94ca46896548..ae1647d16d27 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -694,6 +694,15 @@ DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, "tdf126792.odt" ) CPPUNIT_ASSERT_EQUAL(sal_Int32(25), vListEntries.getLength()); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/footer1.xml"); +// Since the default (without xml:space attribute) is to ignore leading and trailing spaces, +// " PAGE \\* roman " will get imported as "PAGE \\* roman". This is also valid, and must be +// treated accordingly. "roman" was ignored before the fix, exporting only " PAGE ". +assertXPathContent(pXmlDoc, "/w:ftr/w:p/w:r[2]/w:instrText", " PAGE \\* roman "); +} + 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 d4e97d18f598..d41648235355 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2685,7 +2685,14 @@ static sal_Int16 lcl_ParseNumberingType( const OUString& rCommand ) sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR; // The command looks like: " PAGE \* Arabic " -OUString sNumber = msfilter::util::findQuotedText(rCommand, "\\* ", ' '); +// tdf#132185: but may as well be "PAGE \* Arabic" +OUString sNumber; +constexpr OUStringLiteral rSeparator("\\* "); +if (sal_Int32 nStartIndex = rCommand.indexOf(rSeparator); nStartIndex >= 0) +{ +nStartIndex += rSeparator.getLength(); +sNumber = rCommand.getToken(0, ' ', nStartIndex); +} if( !sNumber.isEmpty() ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf130214.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |5 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++ 3 files changed, 11 insertions(+) New commits: commit d7d27ce1788fa6dab98639626fd3b856c0ae6b37 Author: Mike Kaganski AuthorDate: Tue Jan 28 13:22:56 2020 +0300 Commit: Xisco Faulí CommitDate: Tue Jan 28 23:43:25 2020 +0100 tdf#130214: workaround invalid state resulting from error on import Obviously the real error is somewhere else, which results in tdf#126435, and produces unexpected state with missing text append context on stack. This is just a hack to avoid crash. Change-Id: I420ac3b74f5efb9688dc764ac2ad0dcc974ba0e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87595 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit eca00082c78fddf79f247057227404738be8806c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87635 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlimport/data/tdf130214.docx b/sw/qa/extras/ooxmlimport/data/tdf130214.docx new file mode 100644 index ..4344e1c6e44e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf130214.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 2a250a898cf2..28d62e4811db 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -460,6 +460,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103345, "numbering-circle.docx") } } +DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx") +{ +// Currently this file imports with errors because of tdf#126435; it must not segfault on load +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 15c6ae130ecd..d4e97d18f598 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4221,6 +4221,12 @@ void DomainMapper_Impl::handleBibliography (const FieldContextPtr& pContext, const OUString & sTOCServiceName) { +if (m_aTextAppendStack.empty()) +{ +// tdf#130214: a workaround to avoid crash on import errors +SAL_WARN("writerfilter.dmapper", "no text append stack"); +return; +} // Create section before setting m_bStartTOC and m_bStartBibliography: finishing paragraph // inside StartIndexSectionChecked could do the wrong thing otherwise const auto xTOC = StartIndexSectionChecked(sTOCServiceName); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129353.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx| 28 +++ sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 29 +++ sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 12 - sw/qa/extras/rtfimport/rtfimport.cxx |2 writerfilter/source/dmapper/DomainMapper.cxx | 11 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 181 +- writerfilter/source/dmapper/DomainMapper_Impl.hxx |5 8 files changed, 190 insertions(+), 78 deletions(-) New commits: commit 3018dcbf12fe96e57fe52dc1b2d7a1235b480eef Author: Mike Kaganski AuthorDate: Fri Dec 13 09:36:39 2019 +0300 Commit: Andras Timar CommitDate: Thu Jan 9 12:15:39 2020 +0100 tdf#129353, tdf#129402: fix node creation on index import ToC, bibliography, and index sections import code changed to closely follow what Word does, make sure that pre-rendered entries don't get imported as standalone paragraphs outside of the index sections, and paragraph count is accurate (no missing or added paragraphs as much as possible). In Word, an index may start and end in the middle of a paragraph: Some text before index TOC ... First pre-rendered index entry ... Last pre-rendered index entry Some text after index However, normally it looks like either no runs precedig index, or no runs of pre-rendered contents will be present. When no Std elements are used, the typical situation is that there's a normal paragraph (possibly with some user text), which ends with index start marker, without any pre-rendered contents in the same paragraph; and all pre- rendered contents goes in following paragraphs. Such index normally ends with index end marker in the *first* run of a paragraph, which then might have normal text runs. When Stds are used, then no leading/trailing out-of-index runs in paragraphs with marks are usually present; and in this case, when paragraphs with index marks don't contain pre-rendered entries, they still are treated as part of the index. In Writer, indexes are node sections (and so cannot be inline with other paragraph contents). When there was some paragraph content already before the start-of-index mark, the paragraph is assumed to end before the index; in this case, when current element ends, importer decides if a separate starting paragraph is needed or not, depending on if there was some runs after the mark. When there was no text runs before the starting mark, then the paragraph is treated as leading paragraph of the index. This allows to not miss empty paragraphs before index; and not have two paragraphs where there was one in Word. Only in cases when user had manually typed text both in and outside of the index in the same paragraph in Word, we would have the paragraph split into two in Writer. For end marks, the behaviour depends on whether it's inside Std. When inside, the ending paragraph starting with index end mark is considered part of the index. For out-of-Std case, it's considered normal paragraph (and measures are taken to make sure it's not dropped even if empty, because sometimes such paragraphs don't have other content, and have section settings, which is usually treated by Writer as "drop this paragraph" sign). A special problem is multi-column index. It's wrapped into a continuous section by Word; and in Writer, we also wrap it into a section. It would be possibly useful to detect somehow if this section is part of index definition, and in this case, drop the section and put its properties into the Writer's index section. That would avoid an explicit section in the imported document. This is TODO, for someone who figures how to detect reliably if the section belongs to index definition. See comment in DomainMapper_Impl::appendTextSectionAfter. By the way, current export code is wrong, producing an index that is single-column in Word; this change doesn't touch that. Several existing tests needed to be fixed, which used to test wrong results. Change-Id: I9597c8ab13f31ded9abcc24054d3478d3e3a3b40 Reviewed-on: https://gerrit.libreoffice.org/85089 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85278 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86464 Reviewed-by: Andras
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf129513.rtf |4 sw/qa/extras/rtfexport/rtfexport5.cxx | 11 +++ writerfilter/source/rtftok/rtfdispatchflag.cxx |1 - 3 files changed, 15 insertions(+), 1 deletion(-) New commits: commit 1a4ede180585531f0bbabb877677b0e3b0319ee3 Author: Mike Kaganski AuthorDate: Fri Dec 20 16:07:00 2019 +0300 Commit: Xisco Faulí CommitDate: Thu Jan 9 10:01:48 2020 +0100 tdf#129513: drop incorrect and redundant erasure of paragraph sprm It was introduced in commit 2499397cb39330dabeb8b7b3e0d7eb6213a0d8f4 "avoid sending duplicated paragraph flags", and supposedly was meant to avoid having duplicating sprms in the collected properties, when new properties were pushed back at that time. Using specific sprm id was likely a mistake (nParam should have been used instead). Now the new sprm is added using RTFSprms::set with eOverwrite having default value of RTFOverwrite::YES, which takes care to avoid dupes, so the call to erase is redundant. This reverts commit 2499397cb39330dabeb8b7b3e0d7eb6213a0d8f4. Reviewed-on: https://gerrit.libreoffice.org/85602 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 989043b0644354b92fd17e4194897c2eb0935031) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85742 Reviewed-by: Xisco Faulí Signed-off-by: Xisco Fauli Change-Id: Ied19f6feb41bd17ef317812d4d295ca0542a5843 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86418 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/rtfexport/data/tdf129513.rtf b/sw/qa/extras/rtfexport/data/tdf129513.rtf new file mode 100644 index ..cc39953491d9 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf129513.rtf @@ -0,0 +1,4 @@ +{\rtf1 +\trowd\cellx2000\pard\intbl\pagebb +In table +\cell\row\pard\par } \ No newline at end of file diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 7c734c42a932..2143d5868cdd 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1143,6 +1143,17 @@ DECLARE_RTFEXPORT_TEST(testTdf116371, "tdf116371.odt") CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty(xShape, "RotateAngle"), 10); } +DECLARE_RTFEXPORT_TEST(testTdf129513, "tdf129513.rtf") +{ +// \pagebb after \intbl must not reset the "in table" flag +CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); +// Make sure the first paragraph is imported in table +uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getCellNames().getLength()); +uno::Reference xCell(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(OUString("In table"), xCell->getString()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 3ea7872d52a1..f495db2b82d5 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -435,7 +435,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(1); -m_aStates.top().getParagraphSprms().erase(NS_ooxml::LN_inTbl); m_aStates.top().getParagraphSprms().set(nParam, pValue); return RTFError::OK; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf115719b.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx| 12 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 -- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 15 +++ writerfilter/source/dmapper/GraphicImport.cxx |7 +++ writerfilter/source/dmapper/GraphicImport.hxx |1 + writerfilter/source/dmapper/PropertyMap.cxx | 13 +++-- 7 files changed, 50 insertions(+), 12 deletions(-) New commits: commit bb715bced83b78ea66836a2f553083948e666c11 Author: Miklos Vajna AuthorDate: Fri Dec 6 16:54:07 2019 +0100 Commit: Caolán McNamara CommitDate: Thu Dec 19 14:03:19 2019 +0100 Related: tdf#115719 DOCX import: fix increased spacing vs left-aligned objects Commit 8b73bafbc18acb4dd8911d2f2de8158d98eb6144 (tdf#115719 DOCX import: increase paragraph spacing for anchored objects, 2018-02-14) added an import-time tweak for a problem that has been confirmed to be a Word layout bug in the meantime (and the tweak makes Writer behave the same way if the document has been created by an affected Word version for layout compatiblity). Later, commit 4883da6fd25e4645a3b30cb58212a2f666dae75a (Related: tdf#124600 DOCX import: ignore left wrap on left-aligned shapes, 2018-02-14) fixed left spacing of anchored objects aligned to the left, to be in sync with what the DOC import does. This broke the previous fix in case the shapes are left-aligned. Fix the problem by tracking what is the in-file-format and logical left margin, so the final doc model has the value necessary for correct horizontal positioning and the importer has the value that's necessary for correct vertical positioning. (cherry picked from commit 814cb2433da6bd608e935fa5531d2a2b92867985) Conflicts: writerfilter/source/dmapper/PropertyMap.cxx Change-Id: I8f16cbe7bad40e243111c902bdc1ab0e8141d6b9 Reviewed-on: https://gerrit.libreoffice.org/85223 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719b.docx b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx new file mode 100644 index ..a632e3df0e7a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index df83dab157fb..45ab0c0a0eb9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -291,6 +291,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx") CPPUNIT_ASSERT_EQUAL(2, getPages()); } +DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx") +{ +// This is similar to testTdf115719, but here the left textbox is not aligned "from left, by +// 0cm" but simply aligned to left, which is a different codepath. + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2 +// - Actual : 1 +// i.e. the the textboxes did not appear on the 2nd page, but everything was on a single page. +CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf123243, "tdf123243.docx") { // Without the accompanying fix in place, this test would have failed with 'Expected: 1; Actual: diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index cb8f2e312fca..69e7a1301939 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1537,7 +1537,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // Remember what objects are anchored to this paragraph. // That list is only used for Word compat purposes, and // it is only relevant for body text. -AnchoredObjectInfo aInfo; +AnchoredObjectsInfo aInfo; aInfo.m_xParagraph = xTextRange; aInfo.m_aAnchoredObjects = rAppendContext.m_aAnchoredObjects; m_aAnchoredObjectAnchors.push_back(aInfo); @@ -5777,8 +5777,18 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties appendTextContent( xTextContent, uno::Sequence< beans::PropertyValue >() ); if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR && !m_aTextAppendStack.empty()) +{ // Remember this object is anchored to the current paragraph. - m_aTextAppendStack.top().m_aAnchoredObjects.push_back(xTextContent); +AnchoredObjectInfo aInfo; +aInfo.m_xAnchoredObject = xTextContent; +if (m_pGraphicImport) +{ +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf128611.rtf | 29 sw/qa/extras/rtfimport/rtfimport.cxx| 18 + writerfilter/source/rtftok/rtfsdrimport.cxx | 19 ++ 3 files changed, 66 insertions(+) New commits: commit 888498cfc8822401d79d8a5e56e1bf502172eff7 Author: Miklos Vajna AuthorDate: Wed Nov 27 17:14:13 2019 +0100 Commit: Mike Kaganski CommitDate: Tue Dec 3 11:05:11 2019 +0100 Related: tdf#128611 RTF import: handle vertical flip of line shapes UI uses SdrEditView::MirrorMarkedObjVertical() to flip a line shape vertically, handle it similarly at import time as well. Also note that this flips in-place, while the naive '*= -1' for the height would have an incorrect vertical position. (cherry picked from commit f9f421b7beaf117968c0dbfd84a2dad3dc85136a) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: I42b7feb5f799b99337ddec734dcf98dd1d553755 Reviewed-on: https://gerrit.libreoffice.org/84230 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/rtfimport/data/tdf128611.rtf b/sw/qa/extras/rtfimport/data/tdf128611.rtf new file mode 100644 index ..207252cd8d26 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf128611.rtf @@ -0,0 +1,29 @@ +{\rtf1 +\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1417 +\pard\plain +{\shp +{\*\shpinst\shpleft-5\shptop248\shpright8933\shpbottom1838\shpfhdr0\shpbxmargin\shpbxignore\shpbymargin\shpbyignore\shpwr0\shpwrk0\shpfblwtxt0\shpz0\shplid1028 +{\sp +{\sn shapeType} +{\sv 20} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 1} +} +{\sp +{\sn posrelh} +{\sv 3} +} +} +{\shprslt +{\*\do\dobxmargin\dobymargin\dodhgt8192 +\dpline\dpptx8938\dppty0\dpptx0\dppty1590\dpx-5\dpy9248\dpxsize8938\dpysize1590\dplinew15\dplinecor0\dplinecog0\dplinecob0} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 334b48c80809..6fa57b6de4ce 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -857,6 +857,24 @@ DECLARE_RTFIMPORT_TEST(testOleInline, "ole-inline.rtf") getProperty(getShape(1), "AnchorType")); } +DECLARE_RTFIMPORT_TEST(testTdf128611, "tdf128611.rtf") +{ +auto aPolyPolySequence += getProperty>>(getShape(1), "PolyPolygon"); +CPPUNIT_ASSERT(aPolyPolySequence.hasElements()); +uno::Sequence& rPolygon = aPolyPolySequence[0]; +CPPUNIT_ASSERT_GREATER(static_cast(1), rPolygon.getLength()); +sal_Int32 nY1 = rPolygon[0].Y; +sal_Int32 nY2 = rPolygon[1].Y; + +// Without the accompanying fix in place, this test would have failed with: +// - Expected greater than: 6242 +// - Actual : 3438 +// i.e. the vertical flip was missing, and the y1 > y2 assert failed, because the line pointed +// from top left to bottom right, not bottom left to top right. +CPPUNIT_ASSERT_GREATER(nY2, nY1); +} + DECLARE_RTFIMPORT_TEST(testFdo80742, "fdo80742.rtf") { uno::Reference xPropertySet( diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index b9e227439f4b..f543c5236659 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include + #include #include "rtfdocumentimpl.hxx" @@ -1036,6 +1039,22 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap "CustomShapeGeometry", uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList())); } +else if (SdrObject* pObject = GetSdrObjectFromXShape(xShape)) +{ +Point aRef1 = pObject->GetSnapRect().Center(); +Point aRef2(aRef1); +if (obFlipH == true) +{ +// Horizontal mirror means a vertical reference line. +aRef2.AdjustY(1); +} +if (obFlipV == true) +{ +// Vertical mirror means a horizontal reference line. +aRef2.AdjustX(1); +} +pObject->Mirror(aRef1, aRef2); +} } if (rShape.getHoriOrientRelation() != 0) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf124986.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 21 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) New commits: commit 0c4c7452671b137dc70c329a34ba271428caab9a Author: brinzing AuthorDate: Fri Nov 1 16:36:31 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Nov 15 13:51:31 2019 +0100 tdf#124986: docx: remove trailing quotation marks and spaces from set fields Change-Id: I6390344b72b0148cff8e0ed5150d7abfc9490a2a Reviewed-on: https://gerrit.libreoffice.org/81892 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit fea5c10e222b10d83e0081dc1d1b2e678689d250) Reviewed-on: https://gerrit.libreoffice.org/82629 diff --git a/sw/qa/extras/ooxmlexport/data/tdf124986.docx b/sw/qa/extras/ooxmlexport/data/tdf124986.docx new file mode 100755 index ..e5bb8f4966b8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124986.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 0d6d771b7362..51452864fe50 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -67,6 +67,27 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx") CPPUNIT_ASSERT_EQUAL(OUString("phone: \t1234567890"), aActual); } +DECLARE_OOXMLIMPORT_TEST(testTdf124986, "tdf124986.docx") +{ +// Load a document with SET fields, where the SET fields contain leading/trailing quotation marks and spaces. +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); +uno::Reference xFields(xFieldsAccess->createEnumeration()); + +while (xFields->hasMoreElements()) +{ +uno::Reference xServiceInfo(xFields->nextElement(), uno::UNO_QUERY); +uno::Reference xPropertySet(xServiceInfo, uno::UNO_QUERY); +OUString aValue; +if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression")) +{ +xPropertySet->getPropertyValue("Content") >>= aValue; +CPPUNIT_ASSERT_EQUAL(OUString("demo"), aValue); +} +} +} + DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx") { // Load a document with an IF field, where the IF field command contains a paragraph break. diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f6086a249fe0..a24eadd95aa0 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3450,9 +3450,13 @@ void DomainMapper_Impl::handleFieldSet sVariable = lcl_ExctractVariableAndHint(pContext->GetCommand(), sHint); // remove surrounding "" if exists -if( sHint.getLength() >= 2 && sHint.startsWith("\"") ) +if(sHint.getLength() >= 2) { -sHint = sHint.trim().copy(1, sHint.getLength() - 2); +OUString sTmp = sHint.trim(); +if (sTmp.startsWith("\"") && sTmp.endsWith("\"")) +{ +sHint = sTmp.copy(1, sTmp.getLength() - 2); +} } // determine field master name ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf124367.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 14 ++ sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|2 +- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|5 - sw/qa/extras/rtfexport/rtfexport5.cxx|2 +- sw/qa/extras/rtfimport/rtfimport.cxx |2 +- writerfilter/source/dmapper/DomainMapperTableManager.cxx |4 ++-- 7 files changed, 23 insertions(+), 6 deletions(-) New commits: commit 23d8c2b148f88575a9c971602d3a1bc71dabf0b1 Author: Bakos Attila AuthorDate: Tue Nov 5 15:30:22 2019 +0100 Commit: Miklos Vajna CommitDate: Wed Nov 13 09:33:07 2019 +0100 tdf#124367 DOCX import: fix rounding error in table cell widths Follow-up of commit 29cbbad64088354425c606f9eb6c267bdf7731dc (DOCX import: fix rounding error in table cell widths), its revert in commit e502463fa9a601963aa9f5a8783eb1318de36c13 (tdf#123104 DOCX import: fix lack of vertical merge due to rounding) and commit 44e44239de35c1548809c96e13bfa9d64c7ca441 (tdf#120315 DOCX import: fix cells merged vertically). Change-Id: Id85e8fd25dba26af77fe2fd3024db2ae834b5052 Reviewed-on: https://gerrit.libreoffice.org/82072 Reviewed-by: László Németh Tested-by: László Németh Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/82421 Reviewed-by: Miklos Vajna Tested-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf124367.docx b/sw/qa/extras/ooxmlexport/data/tdf124367.docx new file mode 100644 index ..0a1356dd0d2b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124367.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index a0a7f4169a1f..0d6d771b7362 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -108,6 +108,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx") assertXPath(pXmlSettings, "/w:settings/w:hyphenationZone", "val", "851"); } +DECLARE_OOXMLEXPORT_TEST(testTdf124367, "tdf124367.docx") +{ +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), +uno::UNO_QUERY); +uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); +uno::Reference xTableRows = xTextTable->getRows(); +// it was 2761 at the first import, and 2760 at the second import, due to incorrect rounding +CPPUNIT_ASSERT_EQUAL(static_cast(2762), + getProperty>( + xTableRows->getByIndex(2), "TableColumnSeparators")[0] + .Position); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index ac0cd45112fb..b26a8a737d4a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -271,7 +271,7 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx") xmlDocPtr pXmlDoc = parseExport("word/document.xml"); if (!pXmlDoc) return; -CPPUNIT_ASSERT_EQUAL(static_cast(6138), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32()); +CPPUNIT_ASSERT_EQUAL(static_cast(6137), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32()); // tdf#106572 - preventative test matching danger conditions, but imported OK anyway CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty(getParagraphOrTable(1), "PageDescName")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index f798ad98000e..4a033ec79df0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -883,7 +883,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx") uno::Reference xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // Was 9997, so the 4th column had ~zero width -CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position); +CPPUNIT_ASSERT_LESSEQUAL(2, (sal_Int16(7500) + - getProperty>( + xTableRows->getByIndex(0), "TableColumnSeparators")[2] + .Position)); } DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, "conditionalstyles-tbllook.docx") diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 7f11ece22fa8..7c734c42a932 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120315.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 18 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 ++--- 3 files changed, 21 insertions(+), 4 deletions(-) New commits: commit d99d2ad9f7a03663ed34008c8c3582f2999512d6 Author: Bakos Attila AuthorDate: Mon Oct 28 14:03:11 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Nov 8 09:23:09 2019 +0100 tdf#120315 DOCX import: fix cells merged vertically Due to rounding mistake cells weren't merged vertically, when their horizontal positions are different a little bit. Change-Id: I10623719a3759b35fcd04b154590b8ac6ec3ac45 Reviewed-on: https://gerrit.libreoffice.org/81604 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 44e44239de35c1548809c96e13bfa9d64c7ca441) Reviewed-on: https://gerrit.libreoffice.org/81992 Reviewed-by: Attila Bakos Tested-by: Xisco Faulí Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf120315.docx b/sw/qa/extras/ooxmlexport/data/tdf120315.docx new file mode 100644 index ..d3943ea0b291 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120315.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index d6294544c68e..a0a7f4169a1f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -14,6 +14,7 @@ #include #include +#include class Test : public SwModelTestBase { @@ -31,6 +32,23 @@ protected: }; +DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx") +{ +// tdf#120315 cells of the second column weren't vertically merged +// because their horizontal positions are different a little bit +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), +uno::UNO_QUERY); +uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); +uno::Reference xTableRows = xTextTable->getRows(); + CPPUNIT_ASSERT_EQUAL(getProperty>( + xTableRows->getByIndex(0), "TableColumnSeparators")[0] + .Position, + getProperty>( + xTableRows->getByIndex(1), "TableColumnSeparators")[2] + .Position); +} + DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults.docx") { uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 2c33628615be..368e4b59c411 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -641,7 +641,7 @@ void DomainMapperTableManager::endOfRowAction() } uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 ); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); -sal_Int16 nLastRelPos = 0; +double nLastRelPos = 0.0; sal_uInt32 nBorderGridIndex = m_nGridBefore; size_t nWidthsBound = m_nCell.back( ) - 1; @@ -657,10 +657,9 @@ void DomainMapperTableManager::endOfRowAction() for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount ) fGridWidth += (*pTableGrid)[nBorderGridIndex++]; -sal_Int16 nRelPos = -sal::static_int_cast< sal_Int16 >((fGridWidth * 1) / nFullWidthRelative); +double nRelPos = static_cast((fGridWidth * 1) / nFullWidthRelative); -pSeparators[nBorder].Position = nRelPos + nLastRelPos; +pSeparators[nBorder].Position = sal::static_int_cast< sal_Int16 >( nRelPos + nLastRelPos ); pSeparators[nBorder].IsVisible = true; nLastRelPos = nLastRelPos + nRelPos; ++aSpansIter; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf125038.docx |binary sw/qa/extras/ooxmlexport/data/tdf125038b.docx |binary sw/qa/extras/ooxmlexport/data/tdf125038c.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 42 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 165 -- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 13 + 6 files changed, 205 insertions(+), 15 deletions(-) New commits: commit 58d798ea44b9e2a57681e990a8acc747bc287c0b Author: Miklos Vajna AuthorDate: Mon Oct 28 16:58:41 2019 +0100 Commit: Tamás Zolnai CommitDate: Tue Nov 5 15:12:44 2019 +0100 tdf#125038 DOCX import: fix various issues with MERGEFIELD inside IF fields This is a combination of 4 commits. This is the 1st commit: Related: tdf#125038 DOCX import: fix unexpected MERGEFIELD result inside IF The problem is that DOCX supports nesting MERGEFIELD fields inside IF fields, while SwHiddenTextField only supports a single string as a condition. This means in case there are MERGEFIELD fields inside the IF field, those fields will be inserted to the doc model before the IF field, exposing their value, while Word only uses their value during the evaluation of the IF expression. Fix the problem by inspecting the parent field command before setting the MERGEFIELD result. (cherry picked from commit 7b0534cb70e96028c8525285c42a71415704cede) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.hxx This is commit #2: Related: tdf#125038 DOCX import: fix unexpected linebreak inside IF condition Writer body text is expected to only contain the result of the field. So in case both the field command and the field result contains a linebreak, we need to make sure that linebreaks are ignored in the field command for field types where the Writer field implementation expects a single string. With this, the number of paragraphs in the bugdoc is now correct. (cherry picked from commit 97f9af714ea1c46e498fa99f7ca34fc1708d38a6) This is commit #3: tdf#125038 DOCX import: fix lost MERGEFIELD result inside an IF field The problem here was that the IF field result didn't have a plain text string, rather it had a MERGEFIELD in it. Writer's conditional text field expects a plain text string, so just use the result of the MERGEFIELD for an IF parent. Do this in a generic way, it's likely that other parent-child field combinations want to do the same in the future. With this, all lost strings are fixed from the original bugdoc + all unexpected content is hidden in Writer as well. (cherry picked from commit d09336fbdceaafd9320466b660a2b32a07dcc16a) This is commit #4: tdf#125038 DOCX import: better support for linebreaks in IF fields IF fields can't contain linebreaks, so instead of just calling finishParagraph() and hoping it does something sane, explicitly handle them: remember the properties and perform the call only once the field is closed. (cherry picked from commit d40c2be38aaf56116f4dc7be9e78f4e9695407fc) Change-Id: I676aa2c83f12cb600829177a0eb25558822b1d94 Reviewed-on: https://gerrit.libreoffice.org/81982 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/sw/qa/extras/ooxmlexport/data/tdf125038.docx b/sw/qa/extras/ooxmlexport/data/tdf125038.docx new file mode 100644 index ..b4dd622f95e0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125038.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf125038b.docx b/sw/qa/extras/ooxmlexport/data/tdf125038b.docx new file mode 100644 index ..3aa189daded8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125038b.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf125038c.docx b/sw/qa/extras/ooxmlexport/data/tdf125038c.docx new file mode 100644 index ..10234b864627 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125038c.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index b06b342c7071..27317edd1615 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -39,6 +39,48 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty(xStyleProps, "CharHeight")); } +DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx") +{ +OUString aActual = getParagraph(1)->getString(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: phone:... +// - Actual : result1result2phone:... +// i.e. the result if the inner MERGEFIELD fields ended up in the body text. +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf127741.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx| 10 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 28 +++--- writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 -- 4 files changed, 24 insertions(+), 17 deletions(-) New commits: commit ccb38977541c304ff08ebe1a1b24c512ab670acf Author: Tünde Tóth AuthorDate: Tue Oct 8 13:58:44 2019 +0200 Commit: Xisco Faulí CommitDate: Tue Oct 22 13:44:16 2019 +0200 tdf#127741 DOCX import: format hyperlink with Default character style according to correct hyperlink handling, avoiding various editing and layout problems; "sticky" and not easily removable character style around the hyperlink and multiple blue hyperlink colors. Set also Visited/Unvisited link character styles when the style of the hyperlink is not the requested "Internet Link". Change-Id: I3d7ba8dd225c693cc9f521b37767cf1e1e09d7c0 Reviewed-on: https://gerrit.libreoffice.org/80449 Reviewed-by: László Németh Tested-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/80907 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf127741.docx b/sw/qa/extras/ooxmlexport/data/tdf127741.docx new file mode 100644 index ..1bedb9ade516 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127741.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 9a5c10f01748..8539548fc22c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -458,6 +458,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121663, "tdf121663.docx") assertXPath(pXmlDoc, "//w:lnNumType", "distance", "283"); } +DECLARE_OOXMLEXPORT_TEST(testTdf127741, "tdf127741.docx") +{ +uno::Reference xPara = getParagraph(1); +uno::Reference xRun(getRun(xPara,1), uno::UNO_QUERY); +OUString unVisitedStyleName = getProperty(xRun, "UnvisitedCharStyleName"); +CPPUNIT_ASSERT(unVisitedStyleName.equalsIgnoreAsciiCase("Internet Link")); +OUString visitedStyleName = getProperty(xRun, "VisitedCharStyleName"); +CPPUNIT_ASSERT(visitedStyleName.equalsIgnoreAsciiCase("Visited Internet Link")); +} + 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 d9e93f8a848b..a32991c6a4cc 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1678,15 +1678,6 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper } else { -if (IsOpenField() && GetTopFieldContext()->GetFieldId() == FIELD_HYPERLINK) -{ -// It is content of hyperlink field. We need to create and remember -// character style for later applying to hyperlink -PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(GetTopContext()->GetPropertyValues()); -OUString sHyperlinkStyleName = GetStyleSheetTable()->getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); - GetTopFieldContext()->SetHyperlinkStyle(sHyperlinkStyleName); -} - xTextRange = xTextAppend->appendTextPortion(rString, aValues); } } @@ -5241,11 +5232,20 @@ void DomainMapper_Impl::PopFieldContext() } else { -if (!pContext->GetHyperlinkStyle().isEmpty()) -{ - xCrsrProperties->setPropertyValue("VisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); - xCrsrProperties->setPropertyValue("UnvisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); -} +uno::Any aAny = xCrsrProperties->getPropertyValue("CharStyleName"); +OUString charStyle; +if (css::uno::fromAny(aAny, )) +{ +if(!charStyle.isEmpty() && charStyle.equalsIgnoreAsciiCase("Internet Link")) +{ + xCrsrProperties->setPropertyValue("CharStyleName", uno::makeAny(OUString("Default Style"))); +} +else +{ +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf127814.docx|binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |9 + writerfilter/source/dmapper/StyleSheetTable.cxx |5 + 3 files changed, 14 insertions(+) New commits: commit be9f9630a7a394521e56cc1247ce2463e15fa796 Author: László Németh AuthorDate: Tue Oct 8 13:25:10 2019 +0200 Commit: Michael Stahl CommitDate: Tue Oct 15 15:47:25 2019 +0200 tdf#127814 DOCX: fix default paragraph margin in table cells when the table is started on a new page. Undefined w:before in w:docDefaults/w:pPrDefault resulted 0.5 cm paragraph top margin instead of 0 cm. Change-Id: I94a2aa9e9c5fcee6443b74bb261c300c6a8e1303 Reviewed-on: https://gerrit.libreoffice.org/80445 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 88ddeed17d5a7caca407f892a094a3dcb0aff501) Reviewed-on: https://gerrit.libreoffice.org/80599 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf127814.docx b/sw/qa/extras/ooxmlexport/data/tdf127814.docx new file mode 100644 index ..10ed2348f166 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127814.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 2a2a82df7b74..a2dcf0fabfde 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -450,6 +450,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableFloatingMargins, "table-floating-margins.docx" assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); } +DECLARE_OOXMLEXPORT_TEST(testTdf127814, "tdf127814.docx") +{ +// Paragraph top margin was 0 in a table started on a new page +xmlDocPtr pXmlDoc = parseExport(); +if (!pXmlDoc) +return; +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "before", "0"); +} + DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx") { /* diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index a3fc9945e1c9..2c6de04a011a 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -689,6 +689,11 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_DocDefaults_pPrDefault: m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultParaProps ); resolveSprmProps( m_pImpl->m_rDMapper, rSprm ); +if ( nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault && m_pImpl->m_pDefaultParaProps.get() && +!m_pImpl->m_pDefaultParaProps->isSet( PROP_PARA_TOP_MARGIN ) ) +{ +m_pImpl->m_pDefaultParaProps->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( sal_Int32(0) ) ); +} m_pImpl->m_rDMapper.PopStyleSheetProperties(); applyDefaults( true ); m_pImpl->m_bHasImportedDefaultParaProps = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |9 + writerfilter/source/dmapper/DomainMapper.cxx|3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 2c2bc4f58233e88d59577a6fb49661955a7b50e2 Author: Justin Luth AuthorDate: Thu Oct 3 12:37:20 2019 +0300 Commit: Miklos Vajna CommitDate: Mon Oct 7 09:36:54 2019 +0200 related tdf#99602 writerfilter: deferredCharProps unhandled in Styles ...so don't add deferred properties during style import. Otherwise, the first paragraph picks up those attributes and applies them. Regression from 2012 - only affects subscript/superscript. Truly fixing this for Character Styles will be tricky, because it depends on the final fontsize - regardless of where it is set. So at the style level, the deferred property needs to be percentized based on SOMETHING, and then at appendText time the fontsize needs to be determined. If escapement is inherited from a style, then the escapement needs to be converted BACK into pointsize (based on style charsize), and then the final percentage can be calculated and directly applied. Yuck. I'm inclined to treat charstyle escapement like pre-2012, which just assigned default values and ignored the actual/given amount. Change-Id: I8e3783533ec18740e1c7d0b36c58b6c7e8ce107f Reviewed-on: https://gerrit.libreoffice.org/80178 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 8eb0d8daa526d1c53363954d4d8730cad55f1910) Reviewed-on: https://gerrit.libreoffice.org/80202 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx b/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx new file mode 100644 index ..6283b8de73ac Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f81a52e852c8..9a5c10f01748 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -101,6 +101,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement CPPUNIT_ASSERT_DOUBLES_EQUAL(33.f, getProperty(getRun(xPara, 2), "CharEscapement"), 20); } +DECLARE_OOXMLEXPORT_TEST(testTdf99602_subscript_charStyleSize, "tdf99602_subscript_charStyleSize.docx") +{ +uno::Reference xPara = getParagraph(1); +// The word "Base" should not be subscripted. +CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty(getRun(xPara, 1), "CharEscapement"), 0); +// The word "Subscript" should be 48pt, subscripted by 25% (12pt). +//CPPUNIT_ASSERT_DOUBLES_EQUAL( 25.f, getProperty(getRun(xPara, 2), "CharEscapement"), 1); +} + DECLARE_OOXMLEXPORT_TEST(testTdf124637_sectionMargin, "tdf124637_sectionMargin.docx") { uno::Reference xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index ffcc6f4d7064..22625bcfac17 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1702,7 +1702,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; case NS_ooxml::LN_EG_RPrBase_position: // The spec says 0 is the same as the lack of the value, so don't parse that. -if (nIntValue) +// FIXME: StyleSheets don't currently process deferredCharacterProperties - so position is lost in charStyles +if ( nIntValue && !IsStyleSheetImport() ) m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); break; case NS_ooxml::LN_EG_RPrBase_spacing: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf115719.docx |binary sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary sw/qa/extras/ooxmlimport/data/tdf124600.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 11 +++ writerfilter/source/dmapper/GraphicImport.cxx | 11 ++- 5 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 1d1f7bf0ffd04e16c2a64220e36aba95f3a519e5 Author: Miklos Vajna AuthorDate: Tue Sep 17 11:30:26 2019 +0200 Commit: Mike Kaganski CommitDate: Mon Sep 30 13:43:47 2019 +0200 Related: tdf#124600 DOCX import: ignore left wrap on left-aligned shapes The DOC import does the same in SwWW8ImplReader::AdjustLRWrapForWordMargins(). This fixes one sub-problem of the bugdoc, so now the shape anchored in the header has a correct position. This made it necessary to re-visit the tdf#115719 testcases, which are minimal reproducers. The original document had from-left alignment (instead of align-to-left), but this did not matter before. Bring the test documents closer to the original large document, so the tests still pass and don't depend on LO mis-handling the above mentioned left-aligned situation. (The interesting property of tdf115719.docx, where Word 2010 and Word 2013 handles the document differently is preserved after this change.) (cherry picked from commit 4883da6fd25e4645a3b30cb58212a2f666dae75a) Change-Id: I973c13df47b0867e2c4756f0c448495257b7c9d5 Reviewed-on: https://gerrit.libreoffice.org/79834 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719.docx b/sw/qa/extras/ooxmlexport/data/tdf115719.docx index f98f8b4a05dc..4eda09a98fa2 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf115719.docx and b/sw/qa/extras/ooxmlexport/data/tdf115719.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx index 8c552baf76c1..4cb13228443a 100644 Binary files a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx b/sw/qa/extras/ooxmlimport/data/tdf124600.docx new file mode 100644 index ..d5dfa313665e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124600.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 33c8a34d2a72..5af1a4021242 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -101,6 +101,17 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") getProperty(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); } +DECLARE_OOXMLIMPORT_TEST(testTdf124600, "tdf124600.docx") +{ +uno::Reference xShape = getShape(1); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 0 +// - Actual : 318 +// i.e. the shape had an unexpected left margin, but not in Word. +CPPUNIT_ASSERT_EQUAL(static_cast(0), + getProperty(xShape, "HoriOrientPosition")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf120548, "tdf120548.docx") { // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff; diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index d9458ba468c2..a9504a9785b4 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -976,7 +976,6 @@ void GraphicImport::ProcessShapeOptions(Value const & rValue) switch( m_pImpl->nShapeOptionType ) { case NS_ooxml::LN_CT_Anchor_distL: -//todo: changes have to be applied depending on the orientation, see SwWW8ImplReader::AdjustLRWrapForWordMargins() m_pImpl->nLeftMargin = nIntValue / 360; break; case NS_ooxml::LN_CT_Anchor_distT: @@ -1071,6 +1070,16 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) m_pImpl->nHoriRelation = pHandler->relation(); m_pImpl->nHoriOrient = pHandler->orientation(); m_pImpl->nLeftPosition = pHandler->position(); + +// Left adjustments: if horizontally aligned to left of margin, then remove the +// left wrapping. +if (m_pImpl->nHoriOrient == text::HoriOrientation::LEFT) +{ +if (m_pImpl->nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA) +{ +m_pImpl->nLeftMargin = 0; +} +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf117988.docx |binary writerfilter/source/filter/WriterFilter.cxx |2 +- 2 files changed, 1 insertion(+), 1 deletion(-) New commits: commit b0c5bc47d0d170df1384dd48cee9291ce6044083 Author: Justin Luth AuthorDate: Tue Sep 24 19:39:29 2019 +0300 Commit: Xisco Faulí CommitDate: Wed Sep 25 11:56:54 2019 +0200 Revert "tdf#117988 writerfilter: IgnoreTabsAndBlanksForLineCalculation" This reverts LO 6.2 commit 49ddaad2f3ba4e17e1e41e94824fb94468d2b680. tdf#127617 proves it simply was not the correct solution. I replaced the unit test document with one that clearly demonstrates that spaces/tabs should NOT be used in line height calculations. Example document tested with Office 2003, 2010, 2016. Change-Id: I2833384a017526d665adef0cae968bc4aef0dd94 Reviewed-on: https://gerrit.libreoffice.org/79473 Reviewed-by: Justin Luth Tested-by: Justin Luth (cherry picked from commit 202bee1a819de7b1e8c75dd863c4154f66419400) Reviewed-on: https://gerrit.libreoffice.org/79484 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf117988.docx b/sw/qa/extras/ooxmlexport/data/tdf117988.docx index 86f1672fa023..5c92f209a9ae 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf117988.docx and b/sw/qa/extras/ooxmlexport/data/tdf117988.docx differ diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 826c2a0a516b..b9a1cd8284fc 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -292,7 +292,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x xSettings->setPropertyValue("ConsiderTextWrapOnObjPos", uno::makeAny(true)); xSettings->setPropertyValue("UseFormerTextWrapping", uno::makeAny(false)); xSettings->setPropertyValue("TableRowKeep", uno::makeAny(true)); -xSettings->setPropertyValue("IgnoreTabsAndBlanksForLineCalculation", uno::makeAny(false)); +xSettings->setPropertyValue("IgnoreTabsAndBlanksForLineCalculation", uno::makeAny(true)); xSettings->setPropertyValue("InvertBorderSpacing", uno::makeAny(true)); xSettings->setPropertyValue("CollapseEmptyCellPara", uno::makeAny(true)); xSettings->setPropertyValue("TabOverflow", uno::makeAny(true)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf104167.docx|binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 13 + writerfilter/source/dmapper/StyleSheetTable.cxx |9 - 3 files changed, 13 insertions(+), 9 deletions(-) New commits: commit d7a27b4373a209cd9b5fd52792a22dd3f612acaa Author: Miklos Vajna AuthorDate: Mon Sep 23 21:02:54 2019 +0200 Commit: Mike Kaganski CommitDate: Tue Sep 24 15:39:19 2019 +0200 tdf#104167 DOCX import: don't map Heading1 to Heading 1 para style This is nominally a regression from commit c12a78e42e1cbaaf4ea021c82acbec5ea177b1f6 (writerfilter: reset properties of reused styles, 2014-06-04), which assumed that style names are unique. They are not unique for the bugdoc, as it has paragraph styles named 'heading 1' and 'Heading1', both mapped to 'Heading 1'. The mapping for the style name without a space was added in commit 1d2af74e226bf44e1a0f1e1981ca965cffeaa0b2 (INTEGRATION: CWS xmlfilter02 (1.27.12); FILE MERGED, 2008-01-10), in the "2007/11/22 14:53:43 os 1.27.12.9: Tab stops almost perfect now" part, sadly without any indication on why that would be a good idea. The binary DOC import never mapped Heading1 to Heading 1, so it doesn't have this problem. Fix the problem by removing this mapping, it leads to formatting loss when a document has both HeadingN and Heading N styles. (cherry picked from commit a283627036c9b1c56e4b765866b8fb8a26ec87ab) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport2.cxx Change-Id: I26dd999f5a536e079ac351ba5d40d20c83b99310 Reviewed-on: https://gerrit.libreoffice.org/79429 Reviewed-by: Xisco Faulí Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/ooxmlimport/data/tdf104167.docx b/sw/qa/extras/ooxmlimport/data/tdf104167.docx new file mode 100644 index ..3bd881ba02df Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf104167.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 3976c96cb8f5..33c8a34d2a72 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -18,6 +18,7 @@ #include #include #include +#include class Test : public SwModelTestBase { @@ -244,6 +245,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124398, "tdf124398.docx") CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.OLE2Shape"), xShape->getShapeType()); } +DECLARE_OOXMLIMPORT_TEST(testTdf104167, "tdf104167.docx") +{ +// Make sure that heading 1 paragraphs start on a new page. +uno::Any xStyle = getStyles("ParagraphStyles")->getByName("Heading 1"); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 4 +// - Actual : 0 +// i.e. the was lost on import. +CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, + getProperty(xStyle, "BreakType")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") { OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index d1af96db3f87..a3fc9945e1c9 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1263,15 +1263,6 @@ static const sal_Char* const aStyleNamePairs[] = "heading 7", "Heading 7", "heading 8", "Heading 8", "heading 9", "Heading 9", -"Heading1", "Heading 1", -"Heading2", "Heading 2", -"Heading3", "Heading 3", -"Heading4", "Heading 4", -"Heading5", "Heading 5", -"Heading6", "Heading 6", -"Heading7", "Heading 7", -"Heading8", "Heading 8", -"Heading9", "Heading 9", "Heading 1", "Heading 1", "Heading 2", "Heading 2", "Heading 3", "Heading 3", ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf119809.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 10 ++ writerfilter/source/dmapper/DomainMapper.cxx |5 +++-- writerfilter/source/dmapper/SdtHelper.cxx|3 +++ writerfilter/source/dmapper/SdtHelper.hxx|5 + 5 files changed, 21 insertions(+), 2 deletions(-) New commits: commit f4fb61e647fefc209038e3cfdf474041d9f6be8b Author: Tamás Zolnai AuthorDate: Fri Aug 23 17:24:40 2019 +0200 Commit: Caolán McNamara CommitDate: Thu Sep 5 11:05:21 2019 +0200 tdf#119809: FILESAVE DOCX The combo box ActiveX control is lost The problem was with the empty combobox. The implemenation before this commit imported a combobox only when the combobox had any item. Reviewed-on: https://gerrit.libreoffice.org/78024 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 3ceefe9abff98fc24ffb5e8e405f4999faddc351) Change-Id: I945098277d1ed34c65b43f0f6ad8eb361cf41b53 Reviewed-on: https://gerrit.libreoffice.org/78262 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/tdf119809.docx b/sw/qa/extras/ooxmlexport/data/tdf119809.docx new file mode 100644 index ..977938253108 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf119809.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 6a71a8e24747..27dd95db7fc6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -425,6 +425,16 @@ DECLARE_OOXMLEXPORT_TEST(tdf118169, "tdf118169.docx") CPPUNIT_ASSERT_EQUAL(OUString(u"őőő"), getProperty(xPropertySet, "Label")); } +DECLARE_OOXMLEXPORT_TEST(tdf119809, "tdf119809.docx") +{ +// Combobox without an item list lost during import +uno::Reference xControlShape(getShape(1), uno::UNO_QUERY); +uno::Reference xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); +uno::Reference xServiceInfo(xPropertySet, uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.ComboBox"))); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence >(xPropertySet, "StringItemList").getLength()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 47bd773cec2b..a6ad783afd20 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1017,7 +1017,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) else m_pImpl->setSdtEndDeferred(true); -if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty()) +if (m_pImpl->m_pSdtHelper->isInsideDropDownControl()) m_pImpl->m_pSdtHelper->createDropDownControl(); break; case NS_ooxml::LN_CT_SdtListItem_displayText: @@ -2413,6 +2413,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SdtPr_dropDownList: case NS_ooxml::LN_CT_SdtPr_comboBox: { +m_pImpl->m_pSdtHelper->setInsideDropDownControl(true); writerfilter::Reference::Pointer_t pProperties = rSprm.getProps(); if (pProperties.get() != nullptr) pProperties->resolve(*this); @@ -3225,7 +3226,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) } bool bNewLine = len == 1 && (sText[0] == 0x0d || sText[0] == 0x07); -if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty()) +if (m_pImpl->m_pSdtHelper->isInsideDropDownControl()) { if (bNewLine) // Dropdown control has single-line texts, so in case of newline, create the control. diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 0b870749313b..a193a4c37323 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -92,6 +92,7 @@ static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr& pStyleSheet, OUSt SdtHelper::SdtHelper(DomainMapper_Impl& rDM_Impl) : m_rDM_Impl(rDM_Impl) +, m_bInsideDropDownControl(false) , m_bHasElements(false) , m_bOutsideAParagraph(false) { @@ -101,6 +102,7 @@ SdtHelper::~SdtHelper() = default; void SdtHelper::createDropDownControl() { +assert(m_bInsideDropDownControl); OUString aDefaultText = m_aSdtTexts.makeStringAndClear(); uno::Reference xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.ComboBox"), uno::UNO_QUERY); uno::Reference xPropertySet(xControlModel, uno::UNO_QUERY); @@ -111,6 +113,7 @@ void SdtHelper::createDropDownControl()
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/numbering-circle.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 20 writerfilter/source/dmapper/ConversionHelper.cxx|2 +- 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 2ceed469b1f45aa94a2c10f7dc41c1e2378d60d2 Author: Samuel Mehrbrodt AuthorDate: Fri Aug 23 09:41:51 2019 +0200 Commit: Michael Stahl CommitDate: Wed Aug 28 18:32:05 2019 +0200 tdf#103345 Import decimalEnclosedCircle correctly Change-Id: I227d149d07ea0f7b2569e5df5a5589834374fac9 Reviewed-on: https://gerrit.libreoffice.org/77992 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt (cherry picked from commit 66576edf4e7ed26f09788fac348ea6b556ae1c47) Reviewed-on: https://gerrit.libreoffice.org/77999 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlimport/data/numbering-circle.docx b/sw/qa/extras/ooxmlimport/data/numbering-circle.docx new file mode 100644 index ..b8c1da3d6f87 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/numbering-circle.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 629c390de4ca..3976c96cb8f5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -372,6 +372,26 @@ DECLARE_OOXMLIMPORT_TEST(testTdf126114, "tdf126114.docx") CPPUNIT_ASSERT_EQUAL(7, getLength()); } +DECLARE_OOXMLIMPORT_TEST(testTdf103345, "numbering-circle.docx") +{ +uno::Reference xPropertySet( +getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); +uno::Reference xLevels( +xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); +uno::Sequence aProps; +xLevels->getByIndex(0) >>= aProps; // 1st level + +for (int i = 0; i < aProps.getLength(); ++i) +{ +if (aProps[i].Name == "NumberingType") +{ +CPPUNIT_ASSERT_EQUAL(style::NumberingType::CIRCLE_NUMBER, + aProps[i].Value.get()); +return; +} +} +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 7206a7fde18a..91624dae17dd 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -524,6 +524,7 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt) nRet = style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU; break; case NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese: +case NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircle: case NS_ooxml::LN_Value_ST_NumberFormat_ideographEnclosedCircle: nRet = style::NumberingType::CIRCLE_NUMBER; break; @@ -590,7 +591,6 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt) NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth = 91691; NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth = 91692; NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand = 91694; -NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircle = 91695; NS_ooxml::LN_Value_ST_NumberFormat_decimalZero = 91699; NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop = 91703; NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen = 91704; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf126723.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|5 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 19 ++- 3 files changed, 15 insertions(+), 9 deletions(-) New commits: commit 025f17c4247b1c4458192da177648c304a93b949 Author: Justin Luth AuthorDate: Fri Aug 9 11:42:47 2019 +0300 Commit: Michael Stahl CommitDate: Mon Aug 12 16:53:00 2019 +0200 tdf#126723 writerfilter::finishParagraph - me, not previous In LO 6.2 commit 480ac84f2f5049fb4337b36f12fd6796e005761b the existing m_xPreviousParagraph was conveniently used to apply the changed properties. I never did like that choice, but despite looking at it, I failed to see that it is set in an inside loop, which means that it was NOT NECESSARILY reset to the current paragaph. So I'm happy to have proof that we should not use m_xPreviousParagraph. Change-Id: I5c7f1b0f097711d65ae0d0be1f0fbc40c8b96e9d Reviewed-on: https://gerrit.libreoffice.org/77185 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: László Németh (cherry picked from commit d03c92b93d6ba1808a6641b4aa8cb4aae38058bf) Reviewed-on: https://gerrit.libreoffice.org/77218 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf126723.docx b/sw/qa/extras/ooxmlexport/data/tdf126723.docx new file mode 100644 index ..297ea322fa7d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126723.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f7d09f590363..3a16dc3d0f02 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -49,6 +49,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF2, "tdf121374_sectionHF2.doc") CPPUNIT_ASSERT( xHeaderText->getString().startsWith("virkamatka-anomus") ); } +DECLARE_OOXMLEXPORT_TEST(testTdf126723, "tdf126723.docx") +{ +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(2), "ParaLeftMargin")); +} + DECLARE_OOXMLEXPORT_TEST(testendingSectionProps, "endingSectionProps.docx") { uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 74591334637a..d9e93f8a848b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1497,39 +1497,40 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con CheckParaMarkerRedline( xParaEnd ); } +css::uno::Reference xParaProps(xTextRange, uno::UNO_QUERY); // tdf#118521 set paragraph top or bottom margin based on the paragraph style // if we already set the other margin with direct formatting -if (m_xPreviousParagraph) +if (xParaProps) { const bool bTopSet = pParaContext->isSet(PROP_PARA_TOP_MARGIN); const bool bBottomSet = pParaContext->isSet(PROP_PARA_BOTTOM_MARGIN); const bool bContextSet = pParaContext->isSet(PROP_PARA_CONTEXT_MARGIN); if ( !(bTopSet == bBottomSet && bBottomSet == bContextSet) ) { + if ( !bTopSet ) { uno::Any aMargin = GetPropertyFromStyleSheet(PROP_PARA_TOP_MARGIN); if ( aMargin != uno::Any() ) - m_xPreviousParagraph->setPropertyValue("ParaTopMargin", aMargin); +xParaProps->setPropertyValue("ParaTopMargin", aMargin); } if ( !bBottomSet ) { uno::Any aMargin = GetPropertyFromStyleSheet(PROP_PARA_BOTTOM_MARGIN); if ( aMargin != uno::Any() ) - m_xPreviousParagraph->setPropertyValue("ParaBottomMargin", aMargin); + xParaProps->setPropertyValue("ParaBottomMargin", aMargin); } if ( !bContextSet ) { uno::Any aMargin = GetPropertyFromStyleSheet(PROP_PARA_CONTEXT_MARGIN); if ( aMargin != uno::Any() ) - m_xPreviousParagraph->setPropertyValue("ParaContextMargin", aMargin); + xParaProps->setPropertyValue("ParaContextMargin", aMargin); } } } // Left, Right, and Hanging settings are also grouped. Ensure that all or none are set. -
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf126590.docx |binary sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 10 ++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit b165ac2ab54737a3cf0424584e97cc0b0f565a27 Author: Tünde Tóth AuthorDate: Tue Jul 30 09:29:24 2019 +0200 Commit: Miklos Vajna CommitDate: Mon Aug 12 10:01:36 2019 +0200 tdf#126590 DOCX import: fix absolute hyperlinks to documents Absolute links in DOCX documents created with Word didn't work. Change-Id: Ie23c9ded1c88752768b925ec26df3061beeddd8e Reviewed-on: https://gerrit.libreoffice.org/76581 Tested-by: Jenkins Reviewed-by: Miklos Vajna Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/77191 diff --git a/sw/qa/extras/ooxmlexport/data/tdf126590.docx b/sw/qa/extras/ooxmlexport/data/tdf126590.docx new file mode 100644 index ..147db4565275 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126590.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 146497c23957..129a1363f642 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -216,6 +216,16 @@ DECLARE_LINKS_EXPORT_TEST(testAbsoluteToAbsoluteExport, "absolute-link.docx", US CPPUNIT_ASSERT(sTarget.endsWith("test.docx")); } +DECLARE_LINKS_EXPORT_TEST(testTdf126590_export, "tdf126590.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) +{ +xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); +if (!pXmlDoc) +return; +// in the original file: Target="file:///C:\TEMP\test.docx" => invalid file URI +assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@TargetMode='External']", "Target", +"file:///C:/TEMP/test.docx"); +} + 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 fbfffe1b2317..74591334637a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4493,10 +4493,16 @@ void DomainMapper_Impl::CloseFieldCommand() if (!sURL.isEmpty()) { +if (sURL.startsWith("file:///")) +{ +// file:///absolute\path\to\file => invalid file URI (Writer cannot open) +// convert all blackslashes to slashes: +sURL = sURL.replace('\\', '/'); +} // Try to make absolute any relative URLs, except // for relative same-document URLs that only contain // a fragment part: -if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) { +else if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) { try { sURL = rtl::Uri::convertRelToAbs( m_aBaseUrl, sURL); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/rtfimport.cxx|2 +- writerfilter/source/dmapper/PropertyMap.cxx | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) New commits: commit c54d3e3f0800273e2e7e865a6f873f1635af43af Author: László Németh AuthorDate: Thu Aug 1 17:06:47 2019 +0200 Commit: Samuel Mehrbrodt CommitDate: Tue Aug 6 14:53:49 2019 +0200 tdf#123702 RTF/DOCX default 1" left/right page margins since MSO 2007: now 1440 twips = 2540 1/100 mm (it was 1800 twips = 3175 1/100 mm). Changing the default value fixes the layout of the documents based on RTF templates without explicit margins. Change-Id: I0395fb7cdd6ba176f266c8f0a9309ba48a047da3 Reviewed-on: https://gerrit.libreoffice.org/76812 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 2550b380e8f81528aa2dde5790c3b607c068ee1a) Reviewed-on: https://gerrit.libreoffice.org/76999 Reviewed-by: Samuel Mehrbrodt diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 45a54092454e..aa00c568f336 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -424,7 +424,7 @@ DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf") // the thin horizontal rule was imported as a big fat rectangle uno::Reference xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty(xShape, "RelativeWidth")); -CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(15238), xShape->getSize().Width, 10); +CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(16508), xShape->getSize().Width, 10); CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(53), xShape->getSize().Height, 10); #if 0 CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty(xShape, "VertOrient")); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index cf5f3b4d3381..cd59be0f11ef 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -385,8 +385,8 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection ) , m_nPageNumber( -1 ) , m_nPageNumberType( -1 ) , m_nBreakType( -1 ) -, m_nLeftMargin( 3175 ) // page left margin, default 0x708 (1800) twip -> 3175 1/100 mm -, m_nRightMargin( 3175 ) // page right margin, default 0x708 (1800) twip -> 3175 1/100 mm +, m_nLeftMargin( 2540 ) // page left margin, default 1 inch = 1440 twip -> 2540 1/100 mm +, m_nRightMargin( 2540 ) // page right margin, default 1 inch = 1440 twip -> 2540 1/100 mm , m_nTopMargin( 2540 ) , m_nBottomMargin( 2540 ) , m_nHeaderTop( 1270 )// 720 twip @@ -423,10 +423,10 @@ SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection ) Insert( PROP_HEIGHT, uno::makeAny( static_cast(aLetter.getHeight()) ) ); // page width, 1/100mm Insert( PROP_WIDTH, uno::makeAny( static_cast(aLetter.getWidth()) ) ); -// page left margin, default 0x708 (1800) twip -> 3175 1/100 mm -Insert( PROP_LEFT_MARGIN, uno::makeAny( sal_Int32(3175) ) ); -// page right margin, default 0x708 (1800) twip -> 3175 1/100 mm -Insert( PROP_RIGHT_MARGIN, uno::makeAny( sal_Int32(3175) ) ); +// page left margin, default 0x5a0 (1440) twip -> 2540 1/100 mm +Insert( PROP_LEFT_MARGIN, uno::makeAny( sal_Int32(2540) ) ); +// page right margin, default 0x5a0 (1440) twip -> 2540 1/100 mm +Insert( PROP_RIGHT_MARGIN, uno::makeAny( sal_Int32(2540) ) ); // page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm Insert( PROP_TOP_MARGIN, uno::makeAny( sal_Int32(2540) ) ); // page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/rtfexport/data/tdf126309.rtf|8 sw/qa/extras/rtfexport/rtfexport4.cxx|9 + writerfilter/source/dmapper/DomainMapper.cxx |5 - 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 8fad7ee194b8f049ea845bdf9654060111b4e841 Author: Miklos Vajna AuthorDate: Mon Aug 5 21:48:24 2019 +0200 Commit: Xisco Faulí CommitDate: Tue Aug 6 12:47:59 2019 +0200 tdf#126309 RTF import: fix not needed para adjust swap for bidi text Regression from commit 4ee2a882dddb395a816cd54004b634d57cfb2446 (tdf#86182 RTF import: fix handling of \rtlpar, 2015-04-17), now that we don't ignore \rtlpar, it turned out that dmapper should not do paragraph alignment left/right swapping for RTF. It seems this is needed for DOCX, but not for legacy DOC/RTF. See how SwWW8ImplReader::Read_Justify() doesn't do this, either, so this is one of those rare cases when dmapper has to know if the token stream is generated by the DOCX or the RTF tokenizers. (cherry picked from commit 600025475630c59c53a9086ba6d95124416725b3) Conflicts: sw/qa/extras/rtfexport/rtfexport4.cxx Change-Id: Ibd52e3dc9e782e1d985418085b82b2e2628bc1dd Reviewed-on: https://gerrit.libreoffice.org/77004 Tested-by: Xisco Faulí Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/rtfexport/data/tdf126309.rtf b/sw/qa/extras/rtfexport/data/tdf126309.rtf new file mode 100644 index ..513061e49875 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf126309.rtf @@ -0,0 +1,8 @@ +{\rtf1 +\pard\plain \rtlpar +\s33\qr \li0\ri0\sb240\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14905282 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1031\langfe1033\loch\af1\hich\af1\dbch\af13\cgrid\langnp1031\langfenp1033 +{ +\ltrch\fcs1 \alang1037 \rtlch\fcs0 \f1\fs20\lang1037\langnp1037\langfenp1037\insrsid7674863 1} +{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe1033\langnp1033\insrsid7674863\charrsid14905282 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index f26f558267b2..65b1ffbdce9a 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -129,6 +129,15 @@ DECLARE_RTFEXPORT_TEST(testBtlrCell, "btlr-cell.rtf") CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty(xC1, "WritingMode")); } +DECLARE_RTFIMPORT_TEST(testTdf126309, "tdf126309.rtf") +{ +// Without the accompanying fix in place, this test would have failed, as +// the paragraph was aligned to left, not right. +CPPUNIT_ASSERT_EQUAL( +style::ParagraphAdjust_RIGHT, + static_cast(getProperty(getParagraph(1), "ParaAdjust"))); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 195e360a671d..47bd773cec2b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1209,8 +1209,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) switch(nSprmId) { case NS_ooxml::LN_CT_PPrBase_jc: -handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, *m_pImpl )); +{ +bool bExchangeLeftRight = !IsRTFImport() && ExchangeLeftRight(rContext, *m_pImpl); +handleParaJustification(nIntValue, rContext, bExchangeLeftRight); break; +} case NS_ooxml::LN_CT_PPrBase_keepLines: rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue == 0)); break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |5 + writerfilter/source/dmapper/StyleSheetTable.cxx |8 +++- 2 files changed, 12 insertions(+), 1 deletion(-) New commits: commit 8b81a453b22611f25674f5e44ae411d78c2fcada Author: Justin Luth AuthorDate: Thu Aug 1 15:50:00 2019 +0300 Commit: Miklos Vajna CommitDate: Fri Aug 2 08:46:18 2019 +0200 tdf#126544 writerfilter: check parent style exists before assigning If you set the parent style to a style that is not yet created, then it silently fails, and thus inherits from nothing! Change-Id: Ibb85235643dd5b1eb9b0bd43f701580f24b2b7fa Reviewed-on: https://gerrit.libreoffice.org/76805 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit b47a8f091ad8f9048a6b7962e9cde5d04ea0d665) Reviewed-on: https://gerrit.libreoffice.org/76824 Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 5a2176aa8253..42d5d3f39c58 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -935,6 +935,11 @@ DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx") uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); xCursor->jumpToLastPage(); CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage()); + +// tdf126544 Styles were being added before their base/parent/inherited-from style existed, and so were using default settings. +uno::Reference xParaStyles(getStyles("ParagraphStyles")); +uno::Reference xStyle(xParaStyles->getByName("Heading 1"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL( OUString("Heading Base"), xStyle->getParentStyle() ); } DECLARE_OOXMLEXPORT_TEST(testcolumnbreak, "columnbreak.docx") diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index eef56e7db718..d1af96db3f87 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -984,7 +984,13 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier ); // Writer core doesn't support numbering styles having a parent style, it seems if (pParent.get() != nullptr && !bListStyle) -xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName )); +{ +const OUString sParentStyleName = ConvertStyleName( pParent->sStyleName ); +if ( !sParentStyleName.isEmpty() && !xStyles->hasByName( sParentStyleName ) ) +aMissingParent.emplace_back( sParentStyleName, xStyle ); +else +xStyle->setParentStyle( sParentStyleName ); +} } catch( const uno::RuntimeException& ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf126173.rtf | 85 ++ sw/qa/extras/rtfimport/rtfimport.cxx |7 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 3 files changed, 93 insertions(+), 1 deletion(-) New commits: commit 0e6fdee15df8928c33308b353a7b80de150aca6b Author: Miklos Vajna AuthorDate: Mon Jul 8 21:25:44 2019 +0200 Commit: Xisco Faulí CommitDate: Tue Jul 9 12:53:12 2019 +0200 tdf#126173 RTF import: fix lost SHAPE fields Commit 5a5d55a8a0f82406a8001015a723596f21d3562c (fdo#82860 RTF import: fix handling of SHAPE fields, 2014-10-15) already tried to handle this, but aCode is the shape command + its parameters (SHAPE \* MERGEFORMAT) for the bugdoc, while what we want is just the shape command. The field variable already contains a tokenized version, which was used previously only to decide if a field is unhandled or not. Reuse that for the shape comparison, so bugdoc's shape with parameters also appears. Change-Id: I7e044b94bcfab490c956b33c11dd6c69443939f5 Reviewed-on: https://gerrit.libreoffice.org/75243 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 9a15a75dfa7ab8c5d51c411e0e39d68d22b7587a) Reviewed-on: https://gerrit.libreoffice.org/75288 Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/rtfimport/data/tdf126173.rtf b/sw/qa/extras/rtfimport/data/tdf126173.rtf new file mode 100644 index ..f4990516c1d5 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf126173.rtf @@ -0,0 +1,85 @@ +{\rtf1 +\pard\plain +{\field\fldlock +{\*\fldinst +{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6882621 \hich\af31506\dbch\af31505\loch\f31506 SHAPE \\* MERGEFORMAT } +} +{\fldrslt +{ +\rtlch\fcs1 \af1 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid11561886 +{\shp +{\*\shpinst\shpleft0\shptop0\shpright2565\shpbottom1380\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplockanchor\shplid1026 +{\sp +{\sn shapeType} +{\sv 202} +} +{\sp +{\sn fillColor} +{\sv 16777215} +} +{\sp +{\sn fRecolorFillAsPicture} +{\sv 0} +} +{\sp +{\sn fUseShapeAnchor} +{\sv 0} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn lineWidth} +{\sv 6350} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp +{\sn wzName} +{\sv Text Box 1} +} +{\sp +{\sn posrelh} +{\sv 3} +} +{\sp +{\sn posrelv} +{\sv 3} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +{\sp +{\sn fAllowOverlap} +{\sv 1} +} +{\sp +{\sn fBehindDocument} +{\sv 0} +} +{\sp +{\sn fHidden} +{\sv 0} +} +{\sp +{\sn fPseudoInline} +{\sv 1} +} +{\shptxt +\ltrpar \pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0 +\fs22\lang1033\langfe2052\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 +{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid3175535 \hich\af31506\dbch\af31505\loch\f31506 test +\par } +} +} +} +} +{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6882621 +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 92ef3de21d9d..45a54092454e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -933,6 +933,13 @@ DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf") getProperty(xTextSections->getByIndex(0), "DontBalanceTextColumns")); } +DECLARE_RTFIMPORT_TEST(testTdf126173, "tdf126173.rtf") +{ +// Without the accompanying fix in place, this test would have failed, as the TextFrame was lost +// on import. +CPPUNIT_ASSERT(getShape(1).is()); +} + DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf") { // index mark was not imported diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 19bfff932e30..fbfffe1b2317 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4885,7 +4885,7 @@ void DomainMapper_Impl::CloseFieldCommand() */ OUString aCode( pContext->GetCommand().trim() ); // Don't waste resources on wrapping shapes inside a fieldmark. -if (aCode != "SHAPE" && m_xTextFactory.is() && !m_aTextAppendStack.empty()) +if (std::get<0>(field) != "SHAPE" && m_xTextFactory.is() && !m_aTextAppendStack.empty()) { xFieldInterface = m_xTextFactory->createInstance("com.sun.star.text.Fieldmark"); const uno::Reference xTextContent(xFieldInterface, uno::UNO_QUERY_THROW); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf126114.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |7 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +- 3 files changed, 8 insertions(+), 1 deletion(-) New commits: commit e48aa5f55fd80f3e50d642c86a89c7506e04c4f8 Author: Tamás Zolnai AuthorDate: Wed Jun 26 20:04:37 2019 +0200 Commit: Tamás Zolnai CommitDate: Thu Jun 27 16:28:39 2019 +0200 tdf#126114 - Form fields are displayed twice (double) We need to make sure that IsFieldResultAsString() returns true for drop-down field, to ignore the placeholder string. Change-Id: I127800bdff78eb68e000fdbfe433bc88181ac2c3 Reviewed-on: https://gerrit.libreoffice.org/74752 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 8e5982d799e23bee86404f3ccb3aaed524ae9675) Reviewed-on: https://gerrit.libreoffice.org/74796 diff --git a/sw/qa/extras/ooxmlimport/data/tdf126114.docx b/sw/qa/extras/ooxmlimport/data/tdf126114.docx new file mode 100644 index ..33e0395689c6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf126114.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 1c7282623b00..629c390de4ca 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -365,6 +365,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124670, "tdf124670.docx") paragraph->getString()); } +DECLARE_OOXMLIMPORT_TEST(testTdf126114, "tdf126114.docx") +{ +// The problem was that after the drop-down form field, also the placeholder string +// was imported as text. Beside the duplication of the field, it also caused a crash. +CPPUNIT_ASSERT_EQUAL(7, getLength()); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f03ee6f8271b..19bfff932e30 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4925,7 +4925,7 @@ bool DomainMapper_Impl::IsFieldResultAsString() OSL_ENSURE( pContext.get(), "no field context available"); if( pContext.get() ) { -bRet = pContext->GetTextField().is(); +bRet = pContext->GetTextField().is() || pContext->GetFieldId() == FIELD_FORMDROPDOWN; } return bRet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf70234.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|7 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 + 3 files changed, 8 insertions(+) New commits: commit fe317b8d0845657703803d51e16f01e529740ef0 Author: László Németh AuthorDate: Mon Jun 3 17:26:16 2019 +0200 Commit: Xisco Faulí CommitDate: Wed Jun 5 11:28:43 2019 +0200 tdf#70234 DOCX: import tracked deletion of fields Deleted fields in tracked changes, for example page number fields, imported as not deleted text fields. Change-Id: Id35c3ad7d293039fc8a2d0b564572dc459a25d0f Reviewed-on: https://gerrit.libreoffice.org/73397 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit d160bca0dcb80f1b517b79221d5c3a43bbad8639) Reviewed-on: https://gerrit.libreoffice.org/73457 diff --git a/sw/qa/extras/ooxmlexport/data/tdf70234.docx b/sw/qa/extras/ooxmlexport/data/tdf70234.docx new file mode 100644 index ..33ef99430bda Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf70234.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 70b6e79bc04d..f7e69073085c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -849,6 +849,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesEmptyParagraphsInADeletion, assertXPath(pXmlDoc, "/w:document/w:body/w:p[" + OString::number(i) + "]/w:pPr/w:rPr/w:del"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf70234, "tdf70234.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +// import fields with tracked deletion +assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:del/w:r/w:fldChar"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf118691, "tdf118691.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 eb852bf943d4..f03ee6f8271b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5195,6 +5195,7 @@ void DomainMapper_Impl::PopFieldContext() aMap.InsertProps(m_pLastCharacterContext); aMap.InsertProps(m_aFieldStack.top()->getProperties()); appendTextContent(xToInsert, aMap.GetPropertyValues()); +CheckRedline( xToInsert->getAnchor( ) ); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits