[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf104162.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|8 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |8 3 files changed, 16 insertions(+) New commits: commit 24ed49a2547349634cc8fa2f0f65f52bfc7c3d63 Author: Miklos VajnaDate: Mon Dec 19 19:35:20 2016 +0100 tdf#104162 DOCX import: fix crash on in a comment table sw comments are handled by editeng, so tables in comments aren't imported. That means lcl_emptyRow() may get a row where the first cell's start is an empty reference, so handle that case. (cherry picked from commit 748b483d89dc7915471441cc30a1aa342363) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport9.cxx Change-Id: I43e286314143934c20e6cbbd656d32883b6b2efe Reviewed-on: https://gerrit.libreoffice.org/32223 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/33925 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf104162.docx b/sw/qa/extras/ooxmlexport/data/tdf104162.docx new file mode 100644 index 000..61b51c0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104162.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 3537092..62af271 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1194,6 +1194,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103544, "tdf103544.docx") CPPUNIT_ASSERT(xGraphic.is()); } +DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx") +{ +// This crashed: the comment field contained a table with a . +uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTextFields(xTextFieldsSupplier->getTextFields()); +CPPUNIT_ASSERT(xTextFields->hasElements()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 43ef3be..a2e0495 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -883,6 +883,14 @@ bool lcl_emptyRow(std::vector& rTableRanges, sal_Int32 nRow) return false; } +if (!rRowSeq[0][0].is()) +{ +// This can happen when we can't import the table, e.g. we're inside a +// comment. +SAL_WARN("writerfilter.dmapper", "rRowSeq[0][0] is an empty reference"); +return false; +} + uno::Reference xTextRangeCompare(rRowSeq[0][0]->getText(), uno::UNO_QUERY); try { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf96218.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 writerfilter/source/dmapper/DomainMapper.cxx |5 + writerfilter/source/dmapper/DomainMapper.hxx |1 + writerfilter/source/dmapper/GraphicImport.cxx |2 +- 5 files changed, 15 insertions(+), 1 deletion(-) New commits: commit a5f5312de639048dac65da292f2b2dcc330cee15 Author: Tamás ZolnaiDate: Wed Dec 21 01:23:11 2016 + tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position layoutInCell attribute should be ignored when we are not in a table. Reviewed-on: https://gerrit.libreoffice.org/32253 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit 36750bc977b3210b23b7822abd395b30a78af6f5) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27 Reviewed-on: https://gerrit.libreoffice.org/32266 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlimport/data/tdf96218.docx b/sw/qa/extras/ooxmlimport/data/tdf96218.docx new file mode 100644 index 000..a6a269f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96218.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 39ffc52..36e34cb 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3275,6 +3275,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx") // This was text::TextContentAnchorType_AS_CHARACTER, wasn't handled on import for the chart. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); } + +DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx") +{ +// Image had a bad position because layoutInCell attribute was not ignored +CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); +} + + 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 a46c6f6..789aebe 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3650,6 +3650,11 @@ bool DomainMapper::IsInHeaderFooter() const return m_pImpl->IsInHeaderFooter(); } +bool DomainMapper::IsInTable() const +{ +return m_pImpl->hasTableManager() && m_pImpl->getTableManager().isInCell(); +} + bool DomainMapper::IsStyleSheetImport() const { return m_pImpl->IsStyleSheetImport(); diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index 2abaf123..10220b9 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -114,6 +114,7 @@ public: css::uno::Reference PopPendingShape(); bool IsInHeaderFooter() const; +bool IsInTable() const; bool IsStyleSheetImport() const; /** @see DomainMapper_Impl::processDeferredCharacterProperties() diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 79b46c7..dedda68 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1262,7 +1262,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b } xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ), uno::makeAny(m_pImpl->nWrap)); -if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT ) +if( m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT ) xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ), 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-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf103651.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |9 + writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |6 ++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |1 + writerfilter/source/ooxml/model.xml |2 +- 5 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 282e2de90fe724958c82c76f449a19e8ccbfc017 Author: Mark HungDate: Sat Dec 3 23:06:23 2016 +0800 tdf#103651 check isForwardEvents() for symbols in comments Every time a comment is referred, the whole comment stream is parsed but only the referred comment is extracted. But the symbol is always processed so it is added to all the comments. Reviewed-on: https://gerrit.libreoffice.org/31584 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 3caf89200c8fa7b38d6c340b666ca6cc8c2eb766) Change-Id: I3264de2d011ff188ef64f6500ae426cde0106c16 Reviewed-on: https://gerrit.libreoffice.org/31758 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlexport/data/tdf103651.docx b/sw/qa/extras/ooxmlexport/data/tdf103651.docx new file mode 100755 index 000..de4c2d6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103651.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index d7c1f22..3537092 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -77,6 +77,15 @@ DECLARE_OOXMLEXPORT_TEST(testMSwordHang,"test_msword_hang.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r[2]/w:drawing/wp:inline", "distT", "0"); } +DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx") +{ +uno::Reference xTextField = getProperty< uno::Reference >(getRun(getParagraph(1), 1), "TextField"); +OUString sContent; +xTextField->getPropertyValue("Content") >>= sContent; +// Comment in the first paragraph should not have smiley ( 0xf04a ). +CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 0xf04a ) )); +} + DECLARE_OOXMLEXPORT_TEST(testGroupshapeThemeFont, "groupshape-theme-font.docx") { // Font was specified using a theme reference, which wasn't handled. diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index d804e1d..b91276c 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -551,6 +551,12 @@ void OOXMLFastContextHandler::tab() mpStream->utext(reinterpret_cast(), 1); } +void OOXMLFastContextHandler::symbol() +{ +if (isForwardEvents()) +sendPropertiesWithId(NS_ooxml::LN_EG_RunInnerContent_sym); +} + void OOXMLFastContextHandler::cr() { if (isForwardEvents()) diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index 60d423c..bd8d2e8 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -156,6 +156,7 @@ public: void ftnednsep(); void pgNum(); void tab(); +void symbol(); void cr(); void noBreakHyphen(); void softHyphen(); diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 3b6a03e..1f5aa82 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -17857,7 +17857,7 @@ - + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |5 + writerfilter/source/dmapper/StyleSheetTable.cxx | 13 - 2 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 5a61165b32dc356ca41117f101846d43929bc551 Author: Justin LuthDate: Fri Sep 9 23:32:11 2016 +0300 tdf#89315 writerfilter add missing parents to out-of-order styles Styles that inherit from a parent style, but were defined in style.xml before the parent, were losing their base style. Change-Id: Ic12876dddb1aa961cd8ef7579061cca30c320c71 Reviewed-on: https://gerrit.libreoffice.org/28785 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Signed-off-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/31466 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index c199d6f..699cc03 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -982,6 +982,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") xCursor->jumpToPage(2); OUString pageStyleName = getProperty(xCursor, "PageStyleName"); CPPUNIT_ASSERT(pageStyleName != "Standard"); + +// tdf89297 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("Pull quote"), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(6736947), getProperty(xStyle, "CharColor")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 30590cb..ae00da4 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -916,6 +916,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) xStyleFamilies->getByName("NumberingStyles") >>= xNumberingStyles; if(xCharStyles.is() && xParaStyles.is()) { +std::vector< ::std::pair > aMissingParent; std::vector aTableStylesVec; std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin(); while( aIt != m_pImpl->m_aStyleSheetEntries.end() ) @@ -928,7 +929,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) bool bInsert = false; uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : (bListStyle ? xNumberingStyles : xCharStyles); uno::Reference< style::XStyle > xStyle; -OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName ); +const OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName ); if(xStyles->hasByName( sConvertedStyleName )) { @@ -1148,6 +1149,10 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) // Numbering style got inserted earlier. if(bInsert && !bListStyle) { +const OUString sParentStyle = xStyle->getParentStyle(); +if( !sParentStyle.isEmpty() && !xStyles->hasByName( sParentStyle ) ) +aMissingParent.emplace_back( sParentStyle, xStyle ); + xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle) ); } @@ -1171,6 +1176,12 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) ++aIt; } +// Update the styles that were created before their parents +for( auto const & iter : aMissingParent ) +{ +iter.second->setParentStyle( iter.first ); +} + if (!aTableStylesVec.empty()) { // If we had any table styles, add a new document-level InteropGrabBag entry for them. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf82824.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx |5 + writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 +++- 3 files changed, 20 insertions(+), 1 deletion(-) New commits: commit d36587570890d3366222fc9cca8482275db85b3b Author: Miklos VajnaDate: Tue Nov 15 09:19:45 2016 +0100 tdf#82824 DOCX import: fix at-char embedded object handling The anchor type of embedded object was simply not handled, we always assumed that it's as-char. When it's at-char set the anchor type accordingly, and also set the usual 6 properties determining the position of the anchored object. (cherry picked from commit 10efab2b9a3cf7fc49655c90ba29db4512680c38) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I3f8bede33c6f1a0bdc4f4d4ea59c4fc805802291 Reviewed-on: https://gerrit.libreoffice.org/30965 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/ooxmlimport/data/tdf82824.docx b/sw/qa/extras/ooxmlimport/data/tdf82824.docx new file mode 100644 index 000..65e5d4b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf82824.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 13c8437..39ffc52 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3270,6 +3270,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103664, "tdf103664.docx") CPPUNIT_ASSERT_EQUAL(awt::CharSet::SYMBOL, getProperty(xRun, "CharFontCharSet")); } +DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx") +{ +// This was text::TextContentAnchorType_AS_CHARACTER, wasn't handled on import for the chart. +CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty(getShape(1), "AnchorType")); +} 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 08de96e..855c131 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4766,7 +4766,21 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties // Update the shape properties if it is embedded object. if(m_xEmbedded.is()){ -UpdateEmbeddedShapeProps(m_pGraphicImport->GetXShapeObject()); +uno::Reference xShape = m_pGraphicImport->GetXShapeObject(); +UpdateEmbeddedShapeProps(xShape); +if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR) +{ +uno::Reference xEmbeddedProps(m_xEmbedded, uno::UNO_QUERY); +text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_CHARACTER; +xEmbeddedProps->setPropertyValue("AnchorType", uno::makeAny(eAnchorType)); +uno::Reference xShapeProps(xShape, uno::UNO_QUERY); +xEmbeddedProps->setPropertyValue("HoriOrient", xShapeProps->getPropertyValue("HoriOrient")); +xEmbeddedProps->setPropertyValue("HoriOrientPosition", xShapeProps->getPropertyValue("HoriOrientPosition")); +xEmbeddedProps->setPropertyValue("HoriOrientRelation", xShapeProps->getPropertyValue("HoriOrientRelation")); +xEmbeddedProps->setPropertyValue("VertOrient", xShapeProps->getPropertyValue("VertOrient")); +xEmbeddedProps->setPropertyValue("VertOrientPosition", xShapeProps->getPropertyValue("VertOrientPosition")); +xEmbeddedProps->setPropertyValue("VertOrientRelation", xShapeProps->getPropertyValue("VertOrientRelation")); +} } //insert it into the document at the current cursor position OSL_ENSURE( xTextContent.is(), "DomainMapper_Impl::ImportGraphic"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf79329.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|8 +++ writerfilter/source/dmapper/DomainMapper.cxx | 12 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |7 -- writerfilter/source/dmapper/DomainMapperTableHandler.hxx |2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx|3 ++ writerfilter/source/dmapper/DomainMapper_Impl.hxx|4 +++ writerfilter/source/dmapper/TableManager.cxx | 10 +++-- writerfilter/source/dmapper/TableManager.hxx |3 ++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx| 16 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx|2 - writerfilter/source/ooxml/model.xml |2 + 12 files changed, 63 insertions(+), 6 deletions(-) New commits: commit d6e89673155c9cb536747c734b2de23f3d8484ef Author: Miklos VajnaDate: Tue Nov 8 09:11:33 2016 +0100 tdf#79329 DOCX import: fix missing outer table with floattable at cell start The bug document has a normal table, then its C1 cell starts with a nested table, which is floating. The problem is that converting the nested table to a textframe invalidates the start text range of the C1 cell in the outer table we store, so the conversion of the outer table from text to table fails. This never worked, so to avoid the regression just don't convert inner floating tables to textframes when they're anchored at the cell start. A more general fix in the future can be addressing the actual invalidation of the cell start/end text ranges, and then this specific fix will not be necessary anymore. (cherry picked from commit c1eebcdac9f2b289fd363399130c485ca5ff444c) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport9.cxx writerfilter/source/dmapper/DomainMapper.cxx Change-Id: I12cefa41977cf719b07b0fb3ef9ec423c17ef3b1 Reviewed-on: https://gerrit.libreoffice.org/30770 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/tdf79329.docx b/sw/qa/extras/ooxmlexport/data/tdf79329.docx new file mode 100644 index 000..142f295 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf79329.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 6babd92..c3b94a7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -59,6 +59,14 @@ DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx") "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[3]/wps:spPr[1]/a:custGeom[1]/a:pathLst[1]/a:path[1]/a:cubicBezTo[2]/a:pt[3]"); } +DECLARE_OOXMLEXPORT_TEST(testTdf79329, "tdf79329.docx") +{ +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); +// This was 1: only the inner, not the outer table was created. +CPPUNIT_ASSERT_EQUAL(static_cast(2), xTables->getCount()); +} + DECLARE_OOXMLEXPORT_TEST(testMSwordHang,"test_msword_hang.docx") { // fdo#74771: diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e309870..a46c6f6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2542,6 +2542,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; case NS_ooxml::LN_tblStart: +if (m_pImpl->hasTableManager()) +{ +bool bTableStartsAtCellStart = m_pImpl->m_nTableDepth > 0 && m_pImpl->m_nTableCellDepth > m_pImpl->m_nLastTableCellParagraphDepth + 1; + m_pImpl->getTableManager().setTableStartsAtCellStart(bTableStartsAtCellStart); +} /* * Hack for Importing Section Properties * LO is not able to import section properties if first element in the @@ -2559,6 +2564,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_tblEnd: m_pImpl->m_nTableDepth--; break; +case NS_ooxml::LN_tcStart: +m_pImpl->m_nTableCellDepth++; +break; +case NS_ooxml::LN_tcEnd: +m_pImpl->m_nTableCellDepth--; +m_pImpl->m_nLastTableCellParagraphDepth = 0; +break; case NS_ooxml::LN_glow_glow: case NS_ooxml::LN_shadow_shadow: case NS_ooxml::LN_reflection_reflection: diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 1769982..43ef3be 100644
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlimport/data/tdf103664.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 19 +++ writerfilter/source/dmapper/DomainMapper.cxx |2 ++ 3 files changed, 21 insertions(+) New commits: commit 99f2663d8752db9779b72215d79597f8538e061f Author: Tamás ZolnaiDate: Sat Nov 5 12:18:05 2016 + tdf#103664: FILEOPEN: DOCX: Wingdings symbols are imported as rectangles Reviewed-on: https://gerrit.libreoffice.org/30575 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 5ef66db91e87ef84724be22977acf4c9c472ad6b) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Ifd9ff26f2460e5570ec1b736308d48acdb3e56a8 Reviewed-on: https://gerrit.libreoffice.org/30587 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlimport/data/tdf103664.docx b/sw/qa/extras/ooxmlimport/data/tdf103664.docx new file mode 100644 index 000..4d299a6 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf103664.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 417af48..13c8437 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -81,6 +81,7 @@ #include #include #include +#include #include @@ -3251,6 +3252,24 @@ DECLARE_OOXMLIMPORT_TEST(testTdf100830, "tdf100830.docx") CPPUNIT_ASSERT_EQUAL(static_cast(30), getProperty(getShape(1), "FillTransparence")); } +DECLARE_OOXMLIMPORT_TEST(testTdf103664, "tdf103664.docx") +{ +// Wingdings symbols were displayed as rectangles +uno::Reference xPara(getParagraph(1)); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf020), xPara->getString()[0] ); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0fc), xPara->getString()[1] ); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf0dc), xPara->getString()[2] ); +CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xf081), xPara->getString()[3] ); + +uno::Reference xRun(getRun(xPara,1), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontName")); +CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontNameAsian")); +CPPUNIT_ASSERT_EQUAL(OUString("Wingdings"), getProperty(xRun, "CharFontNameComplex")); + +// Make sure these special characters are imported as symbols +CPPUNIT_ASSERT_EQUAL(awt::CharSet::SYMBOL, getProperty(xRun, "CharFontCharSet")); +} + 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 c39208b..e309870 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -2649,6 +2650,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) rContext->Insert(PROP_CHAR_FONT_NAME, aVal); rContext->Insert(PROP_CHAR_FONT_NAME_ASIAN, aVal); rContext->Insert(PROP_CHAR_FONT_NAME_COMPLEX, aVal); +rContext->Insert(PROP_CHAR_FONT_CHAR_SET, uno::makeAny(awt::CharSet::SYMBOL)); utext( reinterpret_cast < const sal_uInt8 * >( &(aSymbolData.cSymbol) ), 1 ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf95031.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|7 +++ writerfilter/source/dmapper/DomainMapper.cxx |6 ++ 3 files changed, 13 insertions(+) New commits: commit 806e323271982c8975ec2904219c6f136aa20eea Author: Miklos VajnaDate: Tue Oct 18 09:19:50 2016 +0200 tdf#95031 DOCX import: auto spacing inside numbering means no spacing The WW8 import has code for this in SwWW8ImplReader::AppendTextNode(), with lots of corner-cases. Not all of that is implemented here yet, but the bullet list in the bugdoc already looks correct now. (cherry picked from commit c486e875de7c8e845594f5043a37ee8800865782) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport9.cxx Change-Id: I9499bfa4d8d7fcc425d7b95e64987258c099f7f2 Reviewed-on: https://gerrit.libreoffice.org/30291 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/ooxmlexport/data/tdf95031.docx b/sw/qa/extras/ooxmlexport/data/tdf95031.docx new file mode 100644 index 000..ef082f7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf95031.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 42f6474..0e81597 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1137,6 +1137,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp/wps:spPr/a:prstGeom", "prst", "rect"); } +DECLARE_OOXMLEXPORT_TEST(testTdf95031, "tdf95031.docx") +{ +// This was 494, in-numbering paragraph's automating spacing was handled as visible spacing, while it should not. +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(2), "ParaBottomMargin")); +CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(3), "ParaTopMargin")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index af0ae0a..c39208b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -613,6 +613,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { +if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) +// Numbering is set -> auto space is 0. +default_spacing = 0; m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else @@ -635,6 +638,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { +if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) +// Numbering is set -> auto space is 0. +default_spacing = 0; m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf81345.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 12 writerfilter/source/dmapper/PropertyMap.cxx |7 +-- 3 files changed, 17 insertions(+), 2 deletions(-) New commits: commit 81cab3d5de9e05bde456f96356379a3b6033bc7f Author: Justin LuthDate: Wed Sep 7 19:26:30 2016 +0300 tdf#81345 docx import fix default page break regression "regression" from 4e653d15eff26aa5283d8ba20611893f4c573f57 If there are new style elements, then don't treat a default break in columns as a continuous break. This fixes both round-tripping, and initial import of columns and headers on this particular document. Since MS and LO treat sections so differently, it is a balancing act of what to change. Change-Id: I9c79bc1246108da6a5ebbf744acbcfcbb9d33d48 Reviewed-on: https://gerrit.libreoffice.org/28728 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3870c0555aa461268a6d056543f4545d562769ce) Reviewed-on: https://gerrit.libreoffice.org/28855 Tested-by: Yousuf Philips Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf81345.docx b/sw/qa/extras/ooxmlexport/data/tdf81345.docx new file mode 100644 index 000..4f18b1e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf81345.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 21e288b..f763598 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -959,6 +959,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1); } +DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") +{ +//Header wasn't replaced and columns were missing because no new style was created. +uno::Reference xModel(mxComponent, uno::UNO_QUERY); +uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); +uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + +xCursor->jumpToPage(2); +OUString pageStyleName = getProperty(xCursor, "PageStyleName"); +CPPUNIT_ASSERT(pageStyleName != "Standard"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 83e2934..5f4855f 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1137,9 +1137,12 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) } // depending on the break type no page styles should be created -// If the section type is missing, but we have columns, then this should be +// If the section type is missing, but we have columns without new style info, then this should be // handled as a continuous section break. -if(m_nBreakType == static_cast(NS_ooxml::LN_Value_ST_SectionMark_continuous) || (m_nBreakType == -1 && m_nColumnCount > 0)) +const bool bTreatAsContinuous = m_nBreakType == -1 +&& m_nColumnCount > 0 +&& (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage)); +if(m_nBreakType == static_cast(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous) { //todo: insert a section or access the already inserted section uno::Reference< beans::XPropertySet > xSection = ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf84684.rtf | 399 + sw/qa/extras/rtfimport/rtfimport.cxx | 14 writerfilter/source/dmapper/GraphicHelpers.cxx |2 writerfilter/source/rtftok/rtfsdrimport.cxx| 19 + writerfilter/source/rtftok/rtfsdrimport.hxx|2 5 files changed, 430 insertions(+), 6 deletions(-) New commits: commit b29110c74188b8245403bdc7e32dc9e65edb09e6 Author: Miklos VajnaDate: Tue Sep 20 09:13:21 2016 +0200 tdf#84684 RTF import: fix ZOrder of child shapes inside group shape Both ODF and OOXML's drawingML seem to just not write ZOrder for child shapes (instead they just describe them in a bottom-up order), but RTF does use dhgt, it seems. Given that ZOrder has different meaning inside and outside a group shape use a stack of GraphicZOrderHelpers to get the correct result. Change-Id: I68dbd9f0ae59a1759da14bf414dc1d277d1c927d (cherry picked from commit 5edebdf67720ac0867b088400e2b31806138dc25) Reviewed-on: https://gerrit.libreoffice.org/29091 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/rtfimport/data/tdf84684.rtf b/sw/qa/extras/rtfimport/data/tdf84684.rtf new file mode 100644 index 000..c9ce0a6 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf84684.rtf @@ -0,0 +1,399 @@ +{\rtf1\adeflang1054\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs1054 +\pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs28\alang1054 \ltrch\fcs0 +\fs22\lang1033\langfe2052\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid11950139 +{\shpgrp +{\*\shpinst\shpleft-780\shptop-825\shpright4800\shpbottom4785\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn groupLeft} +{\sv 0} +} +{\sp +{\sn groupTop} +{\sv 0} +} +{\sp +{\sn groupRight} +{\sv 3543300} +} +{\sp +{\sn groupBottom} +{\sv 3562350} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn rotation} +{\sv 0} +} +{\sp +{\sn wzName} +{\sv Group 6} +} +{\sp +{\sn dxWrapDistLeft} +{\sv 114300} +} +{\sp +{\sn dyWrapDistTop} +{\sv 0} +} +{\sp +{\sn dxWrapDistRight} +{\sv 114300} +} +{\sp +{\sn dyWrapDistBottom} +{\sv 0} +} +{\sp +{\sn lidRegroup} +{\sv 0} +} +{\sp +{\sn posh} +{\sv 0} +} +{\sp +{\sn posrelh} +{\sv 2} +} +{\sp +{\sn posv} +{\sv 0} +} +{\sp +{\sn posrelv} +{\sv 2} +} +{\sp +{\sn dhgt} +{\sv 251665408} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +{\sp +{\sn fAllowOverlap} +{\sv 1} +} +{\sp +{\sn fBehindDocument} +{\sv 0} +} +{\sp +{\sn fHidden} +{\sv 0} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +{\shp +{\*\shpinst\shplid1027 +{\sp +{\sn relLeft} +{\sv 0} +} +{\sp +{\sn relTop} +{\sv 0} +} +{\sp +{\sn relRight} +{\sv 3543300} +} +{\sp +{\sn relBottom} +{\sv 3562350} +} +{\sp +{\sn fRelFlipH} +{\sv 0} +} +{\sp +{\sn fRelFlipV} +{\sv 0} +} +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn anchorText} +{\sv 1} +} +{\sp +{\sn fRotateText} +{\sv 0} +} +{\sp +{\sn fFitShapeToText} +{\sv 0} +} +{\sp +{\sn fillColor} +{\sv 16777215} +} +{\sp +{\sn fFilled} +{\sv 1} +} +{\sp +{\sn lineColor} +{\sv 4697456} +} +{\sp +{\sn lineWidth} +{\sv 12700} +} +{\sp +{\sn fInsetPen} +{\sv 0} +} +{\sp +{\sn fLine} +{\sv 1} +} +{\sp +{\sn wzName} +{\sv Rectangle 1} +} +{\sp +{\sn dhgt} +{\sv 251659264} +} +{\sp +{\sn fHidden} +{\sv 0} +} +{\sp +{\sn fLayoutInCell} +{\sv 1} +} +} +} +{\shp +{\*\shpinst\shplid1028 +{\sp +{\sn relLeft} +{\sv 1028700} +} +{\sp +{\sn relTop} +{\sv 1457325} +} +{\sp +{\sn relRight} +{\sv 1462638} +} +{\sp +{\sn relBottom} +{\sv 1858956} +} +{\sp +{\sn fRelFlipH} +{\sv 0} +} +{\sp +{\sn fRelFlipV} +{\sv 0} +} +{\sp +{\sn shapeType} +{\sv 0} +} +{\sp +{\sn rotation} +{\sv 2696765} +} +{\sp +{\sn dxTextLeft} +{\sv 91440} +} +{\sp +{\sn dyTextTop} +{\sv 45720} +} +{\sp +{\sn dxTextRight} +{\sv 91440} +} +{\sp +{\sn dyTextBottom} +{\sv 45720} +} +{\sp +{\sn WrapText} +{\sv 0} +} +{\sp +{\sn anchorText} +{\sv 1} +} +{\sp +{\sn txflTextFlow} +{\sv 0} +} +{\sp +{\sn fRotateText} +{\sv 0} +} +{\sp +{\sn fFitShapeToText} +{\sv 0} +} +{\sp +{\sn geoLeft} +{\sv 0} +} +{\sp +{\sn geoTop} +{\sv 0} +} +{\sp +{\sn geoRight} +{\sv 433938} +} +{\sp +{\sn geoBottom} +{\sv 401631} +} +{\sp +{\sn shapePath} +{\sv 4} +} +{\sp +{\sn pVerticies} +{\sv 8;12;(433938,200816);(433938,311724);(336798,401632);(216969,401632);(97140,401632);(0,311724) +;(0,200816);(0,89908);(97140,0);(216969,0);(216969,200816);(433938,200816)} +} +{\sp +{\sn pSegmentInfo} +{\sv 2;8;16384;8193;8193;8193;1;1;24577;32768} +} +{\sp +{\sn pConnectionSites} +{\sv
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf44986.rtf | 35 +++ sw/qa/extras/rtfimport/rtfimport.cxx | 10 ++ writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 10 ++ writerfilter/source/rtftok/rtfdispatchvalue.cxx |3 + writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 - writerfilter/source/rtftok/rtfdocumentimpl.hxx |3 + 6 files changed, 68 insertions(+), 1 deletion(-) New commits: commit 246df61b34e1ff5b5d7ecf7e46f04bb677548c9a Author: Miklos VajnaDate: Tue Sep 6 08:16:37 2016 +0200 tdf#44986 RTF import: handle \trwWidthA by faking cells The DOCX import handles this at a tokenizer level, so let's do the same in the RTF case as well. (cherry picked from commit 0f2d5db38bac64b665c6e4a127bbbd63a7ed9af5) Change-Id: Id7ff43fa9e9bcd05b13d187623d39fb072758057 Reviewed-on: https://gerrit.libreoffice.org/28748 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/rtfimport/data/tdf44986.rtf b/sw/qa/extras/rtfimport/data/tdf44986.rtf new file mode 100644 index 000..d255e10 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf44986.rtf @@ -0,0 +1,35 @@ +{\rtf1 +\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\nooverflow\faroman\rin0\lin0\itap0\pararsid8937578 \rtlch\fcs1 +\af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7962097 before} +{\rtlch\fcs1 \ab\af0 \ltrch\fcs0 \b\insrsid11416584 +\par \ltrrow} +\trowd \irow0\irowband0\ltrrow\ts11\trgaph70\trleft-144\trkeep\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trwWidthA6237\trpaddl70\trpaddr70\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind-74\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrnone \clbrdrr\brdrs\brdrw15 +\cltxlrtb\clftsWidth3\clwWidth3405\clshdrawnil \cellx3261\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\nooverflow\faroman\rin0\lin0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 +{ +\rtlch\fcs1 \af4\afs16 \ltrch\fcs0 \fs16\loch\af4\hich\af4\dbch\af31505\insrsid15290907\charrsid14246932 \hich\af4\dbch\af31505\loch\f4 A1} +{\rtlch\fcs1 \af4 \ltrch\fcs0 \loch\af4\hich\af4\dbch\af31505\insrsid11416584\charrsid14246932 \cell +} +\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 +{\rtlch\fcs1 \af0 \ltrch\fcs0 +\insrsid11416584\charrsid14246932 \trowd \irow0\irowband0\ltrrow\ts11\trgaph70\trleft-144\trkeep\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trwWidthA6237\trpaddl70\trpaddr70\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind-74\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrnone \clbrdrr\brdrs\brdrw15 +\cltxlrtb\clftsWidth3\clwWidth3405\clshdrawnil \cellx3261\row \ltrrow} +\trowd \irow1\irowband1\lastrow \ltrrow\ts11\trgaph70\trleft-144\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 +\trftsWidth1\trftsWidthB3\trpaddl70\trpaddr70\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind-74\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrnone \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth9642\clshdrawnil +\cellx9498\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\nooverflow\faroman\rin0\lin0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 +{\rtlch\fcs1 \af1\afs16 \ltrch\fcs0 +\fs16\loch\af1\hich\af1\dbch\af31505\insrsid15290907\charrsid14246932 \hich\af1\dbch\af31505\loch\f1 A2} +{\rtlch\fcs1 \af1\afs16 \ltrch\fcs0 \fs16\loch\af1\hich\af1\dbch\af31505\insrsid11416584\charrsid14246932 \cell } +\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11416584\charrsid14246932 +\trowd \irow1\irowband1\lastrow \ltrrow\ts11\trgaph70\trleft-144\trbrdrt\brdrs\brdrw15 \trbrdrl\brdrs\brdrw15 \trbrdrb\brdrs\brdrw15 \trbrdrr\brdrs\brdrw15 +\trftsWidth1\trftsWidthB3\trpaddl70\trpaddr70\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind-74\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw15 \clbrdrl\brdrs\brdrw15 \clbrdrb\brdrnone \clbrdrr\brdrs\brdrw15 \cltxlrtb\clftsWidth3\clwWidth9642\clshdrawnil +\cellx9498\row } +\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\nooverflow\faroman\rin0\lin0\itap0\pararsid8937578
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf44986.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 + writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 19 ++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |4 +++ writerfilter/source/ooxml/factoryimpl_ns.py |2 - writerfilter/source/ooxml/model.xml | 12 --- 6 files changed, 43 insertions(+), 4 deletions(-) New commits: commit 0ba2229a57527e78f237119efa413f122c9ca74b Author: Miklos VajnaDate: Tue Aug 30 09:14:47 2016 +0200 Related: tdf#44986 DOCX import: handle w:gridAfter by faking cells This is similar to the w:gridBefore handling code introduced in commit cf33af732ed0d3d553bb74636e3b14c55d44c153 (handle w:gridBefore by faking cells (fdo#38414), 2014-04-23), except that the fake cells here are inserted after the real ones, not before. Change-Id: I4c03bd49e52016a58e0e002ae85dede6a96e5f55 Reviewed-on: https://gerrit.libreoffice.org/28487 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 1d1748d143ab4270a2ca1b5117852b1b1bb4c526) Reviewed-on: https://gerrit.libreoffice.org/28624 Reviewed-by: jan iversen Tested-by: jan iversen diff --git a/sw/qa/extras/ooxmlexport/data/tdf44986.docx b/sw/qa/extras/ooxmlexport/data/tdf44986.docx new file mode 100644 index 000..7859ab4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf44986.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index cb20af1..90cef9f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -821,6 +822,15 @@ DECLARE_OOXMLEXPORT_TEST(testTDF99434, "protectedform.docx") CPPUNIT_ASSERT(bProt); } +DECLARE_OOXMLEXPORT_TEST(testTdf44986, "tdf44986.docx") +{ +// Check that the table at the second paragraph. +uno::Reference xTable(getParagraphOrTable(2), uno::UNO_QUERY); +uno::Reference xTableRows(xTable->getRows(), uno::UNO_QUERY); +// Check the first row of the table, it should have two cells (one separator). +// This was 0: the first row had no separators, so it had only one cell, which was too wide. +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 5edac7a..645ade6 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -1331,6 +1331,14 @@ void OOXMLFastContextHandlerTextTableRow::startRow() void OOXMLFastContextHandlerTextTableRow::endRow() { +if (mpGridAfter) +{ +// Grid after is the same as grid before, the empty cells are just +// inserted after the real ones, not before. +handleGridBefore(mpGridAfter); +mpGridAfter = nullptr; +} + startParagraphGroup(); if (isForwardEvents()) @@ -1364,6 +1372,17 @@ void OOXMLFastContextHandlerTextTableRow::endRow() endParagraphGroup(); } +void OOXMLFastContextHandlerTextTableRow::handleGridAfter(const OOXMLValue::Pointer_t& rValue) +{ +if (OOXMLFastContextHandler* pTableRowProperties = getParent()) +{ +if (OOXMLFastContextHandler* pTableRow = pTableRowProperties->getParent()) +// Save the value into the table row context, so it can be handled +// right before the end of the row. +pTableRow->setGridAfter(rValue); +} +} + // Handle w:gridBefore here by faking necessary input that'll fake cells. I'm apparently // not insane enough to find out how to add cells in dmapper. void OOXMLFastContextHandlerTextTableRow::handleGridBefore( const OOXMLValue::Pointer_t& val ) diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index 34c118d..f713fcf 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -188,6 +188,8 @@ public: virtual void setDefaultStringValue(); void sendPropertyToParent(); +OOXMLFastContextHandler* getParent() const { return mpParent; } +void setGridAfter(const OOXMLValue::Pointer_t& pGridAfter) { mpGridAfter = pGridAfter; } protected: OOXMLFastContextHandler * mpParent; @@ -222,6 +224,7 @@ protected: const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() { return m_xContext;} bool inPositionV; +OOXMLValue::Pointer_t
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx| 17 ++ writerfilter/source/dmapper/PropertyMap.cxx |4 +- 3 files changed, 20 insertions(+), 1 deletion(-) New commits: commit 6f9cbfad8744646b5b1f79d5fbf1c1f9eb03519d Author: Justin LuthDate: Sat Jun 25 22:21:08 2016 +0300 tdf#90697 docx - don't change continuous break into page break As soon as you set PROP_PAGE_DESC_NAME, you are inserting that style as a page break. Setting a pagebreak via a continous break was first introduced in commit 50cb1667020494906afaacb68d4163d1eda527cf but the unittest for that commit no longer uses this code. I'm suggesting it be reverted. It really messes up round-tripping when continuous breaks are removed/replaced with hard page breaks. There are a few odd cases where the very first section needs to set the page break via the continuous break, so it hasn't been eliminated completely. Change-Id: I5b0e4bb7612ee9df47e5c49b8c2316dc001b5238 Reviewed-on: https://gerrit.libreoffice.org/26662 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/28252 Reviewed-by: Thorsten Behrens Reviewed-by: Justin Luth Reviewed-by: Oliver Specht diff --git a/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx new file mode 100644 index 000..b5e7ef0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf90697_complexBreaksHeaders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 20ee525..21e288b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -367,6 +368,22 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column"); } +DECLARE_OOXMLEXPORT_TEST(testTdf90697_complexBreaksHeaders,"tdf90697_complexBreaksHeaders.docx") +{ +// This is a complex document using many types of section breaks and re-defined headers. +// Paragraphs 44-47 were in two columns +uno::Reference xTextSection = getProperty< uno::Reference >(getParagraph(45), "TextSection"); +CPPUNIT_ASSERT(xTextSection.is()); +uno::Reference xTextColumns = getProperty< uno::Reference >(xTextSection, "TextColumns"); +CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount()); + +// after that, the section break should switch things back to one column. +xTextSection = getProperty< uno::Reference >(getParagraph(50), "TextSection"); +CPPUNIT_ASSERT(xTextSection.is()); +xTextColumns = getProperty< uno::Reference >(xTextSection, "TextColumns"); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount()); +} + DECLARE_OOXMLEXPORT_TEST(testIndentation, "test_indentation.docx") { // fdo#74141 :There was a problem that in style.xml and document.xml in tag "right" & "left" margin diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 31001c1..5bc56b8 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1154,7 +1154,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { try { - xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME), uno::makeAny(aName)); +if( m_bIsFirstSection ) + xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME), uno::makeAny(aName)); + uno::Reference xPageStyle (rDM_Impl.GetPageStyles()->getByName(aName), uno::UNO_QUERY_THROW); HandleMarginsHeaderFooter(rDM_Impl); if (rDM_Impl.IsNewDoc()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf97090.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 ++ writerfilter/source/dmapper/CellColorHandler.cxx |9 - writerfilter/source/dmapper/CellColorHandler.hxx |1 + 4 files changed, 27 insertions(+), 1 deletion(-) New commits: commit 834ae34d7f16f37078bf0065af8bff29f9d5c422 Author: Justin LuthDate: Fri Aug 5 20:21:13 2016 +0300 tdf#97090 writerfilter - don't fill_SOLID with auto color fixes a regression from 24077b2d52ab3d0fd0db5afb25d8b94b62386e3e seems to be the default "fill disabled" state, so don't force a solid white fill in that case. Change-Id: Ia421e52e228bbf0d3a2cd9af72e0a580042e5dcd Reviewed-on: https://gerrit.libreoffice.org/27915 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit 2a174c2f6fd58a31eb150b84de83e5ba1c4d3fed) Reviewed-on: https://gerrit.libreoffice.org/28155 diff --git a/sw/qa/extras/ooxmlexport/data/tdf97090.docx b/sw/qa/extras/ooxmlexport/data/tdf97090.docx new file mode 100644 index 000..3ba4027 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf97090.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4bb34ed..cb20af1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -718,6 +718,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf88583, "tdf88583.odt") CPPUNIT_ASSERT_EQUAL(static_cast(0x00cc00), getProperty(getParagraph(1), "FillColor")); } +DECLARE_OOXMLEXPORT_TEST(testTdf97090, "tdf97090.docx") +{ +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); +uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0x95B3D7), getProperty(xTable->getCellByName("A1"), "BackColor")); + +uno::Reference paraEnumAccess(xTable->getCellByName("A1"), uno::UNO_QUERY); +assert( paraEnumAccess.is() ); +uno::Reference paraEnum = paraEnumAccess->createEnumeration(); + +assert( paraEnum.is() ); +uno::Reference paragraphProperties(paraEnum->nextElement(), uno::UNO_QUERY); +assert( paragraphProperties.is() ); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty(paragraphProperties, "FillStyle")); +CPPUNIT_ASSERT_EQUAL(static_cast(0xff), getProperty(paragraphProperties, "FillColor")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf89791, "tdf89791.docx") { if (mbExported) diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx index 6845c8a..47d329d 100644 --- a/writerfilter/source/dmapper/CellColorHandler.cxx +++ b/writerfilter/source/dmapper/CellColorHandler.cxx @@ -37,6 +37,7 @@ LoggedProperties("CellColorHandler"), m_nShadingPattern( drawing::ShadingPattern::CLEAR ), m_nColor( 0x ), m_nFillColor( 0x ), +m_bAutoFillColor( true ), m_OutputFormat( Form ) { } @@ -110,6 +111,9 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal) createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true; if( nIntValue == OOXML_COLOR_AUTO ) nIntValue = 0xff; //fill color auto means white +else +m_bAutoFillColor = false; + m_nFillColor = nIntValue; break; case NS_ooxml::LN_CT_Shd_color: @@ -271,7 +275,10 @@ TablePropertyMapPtr CellColorHandler::getProperties() if (m_OutputFormat == Paragraph) { -pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_SOLID)); +// If brush style = clear and FillColor = COLOR_AUTO, then don't enable the fill style - just pre-select the default color +if (nWW8BrushStyle || !m_bAutoFillColor) +pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_SOLID)); + pPropertyMap->Insert(PROP_FILL_COLOR, uno::makeAny(nApplyColor)); } else diff --git a/writerfilter/source/dmapper/CellColorHandler.hxx b/writerfilter/source/dmapper/CellColorHandler.hxx index 98fe791..98c8aaf 100644 --- a/writerfilter/source/dmapper/CellColorHandler.hxx +++ b/writerfilter/source/dmapper/CellColorHandler.hxx @@ -37,6 +37,7 @@ private: sal_Int32 m_nShadingPattern; sal_Int32 m_nColor; sal_Int32 m_nFillColor; +bool m_bAutoFillColor; OutputFormat m_OutputFormat; OUString m_aInteropGrabBagName; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf78506.rtf| 24 sw/qa/extras/rtfimport/rtfimport.cxx| 17 + writerfilter/source/rtftok/rtfdispatchvalue.cxx |3 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 20 ++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++ 5 files changed, 64 insertions(+), 2 deletions(-) New commits: commit 100321e9b39687e8021763ee0aec95de856c497c Author: Miklos VajnaDate: Thu Aug 4 12:37:30 2016 +0200 tdf#78506 RTF import: fix handling of invalid \levelnumbers In case ';' is written in \u form in \levelnumbers, then Word ignores the whole \levelnumbers contents, do the same. (cherry picked from commit 428a1da60b88415e7db21353a42bed85b8b76ed9) Change-Id: I93ce5810af2b5ed703e804199c0b236d2c4c36b5 Reviewed-on: https://gerrit.libreoffice.org/27873 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/rtfimport/data/tdf78506.rtf b/sw/qa/extras/rtfimport/data/tdf78506.rtf new file mode 100644 index 000..2978734 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf78506.rtf @@ -0,0 +1,24 @@ +{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033 +{\*\listtable +{\list \listtemplateid700648999 \listhybrid +{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 +{\leveltext +{\uc1 \u2 ?} +{\uc1 \u0 ?} +{\uc1 \u46 ?} +{\uc1 \u59 ?} +} +{\levelnumbers \'01 +{\uc1 \u59 ?} +} +\li720 \lin720 \fi-360 } +{\listname ;} +\listid697112958 } +} +{\*\listoverridetable +{\listoverride \listid697112958 \listoverridecount0 \ls1 } +} +\pard \plain \ls1 +Test. +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 73096c8..1f2a7fb 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2661,6 +2661,23 @@ DECLARE_RTFIMPORT_TEST(testFlip, "flip.rtf") CPPUNIT_ASSERT(!aMap["MirroredY"].hasValue()); } +DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf") +{ +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; // 1sd level + +for (int i = 0; i < aProps.getLength(); ++i) +{ +const beans::PropertyValue& rProp = aProps[i]; + +if (rProp.Name == "Suffix") +// This was '0', invalid \levelnumbers wasn't ignored. +CPPUNIT_ASSERT_EQUAL(CHAR_ZWSP, rProp.Value.get().toChar()); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 4302f27..dfd9dff 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -627,6 +627,9 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { if (nParam != ';') m_aStates.top().aLevelNumbers.push_back(sal_Int32(nParam)); +else +// ';' in \u form is not considered valid. +m_aStates.top().bLevelNumbersValid = false; } else m_aUnicodeBuffer.append(static_cast(nParam)); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9dc5f79..8268a2f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2004,11 +2004,16 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::LEVELNUMBERS: -if (aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)) +{ +bool bNestedLevelNumbers = false; +if (m_aStates.size() > 1) +// Current destination is levelnumbers and parent destination is levelnumbers as well. +bNestedLevelNumbers = m_aStates[m_aStates.size() - 2].eDestination == Destination::LEVELNUMBERS; +if (!bNestedLevelNumbers && aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)) { RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val); -if (pValue) +if (pValue && aState.bLevelNumbersValid) { OUString aOrig = pValue->getString(); @@ -2029,8 +2034,12 @@ RTFError RTFDocumentImpl::popState()
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/flip.rtf| 96 + sw/qa/extras/rtfimport/data/tdf91684.rtf| 460 sw/qa/extras/rtfimport/rtfimport.cxx| 27 + writerfilter/source/rtftok/rtfsdrimport.cxx | 24 + 4 files changed, 606 insertions(+), 1 deletion(-) New commits: commit 6a10ad7145c0d77a8e9cf2481f2527a5c4d32173 Author: Miklos VajnaDate: Thu Jun 16 09:13:04 2016 +0200 tdf#91684 RTF import: handle fFlipH and fFlipV shape props Also: Related: tdf#91684 RTF import: fix scaling of group shape children It was assumed that the child size is in twips, but it's in relative coordinates. (cherry picked from commits c3acc06230169f141930945ebbff43b1a88dfdee and 63965d7dc571c7dce80737f9d57a7c5151da) Change-Id: I930f99647de00c2e43ef94b1ac0320daa440eae9 Reviewed-on: https://gerrit.libreoffice.org/26430 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/rtfimport/data/flip.rtf b/sw/qa/extras/rtfimport/data/flip.rtf new file mode 100644 index 000..84e9c2c --- /dev/null +++ b/sw/qa/extras/rtfimport/data/flip.rtf @@ -0,0 +1,96 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 +\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid12721412 +{\shp +{\*\shpinst\shpleft537\shptop201\shpright2361\shpbottom1136\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 6} +} +{\sp +{\sn fFlipH} +{\sv 1} +} +{\sp +{\sn fFlipV} +{\sv 1} +} +{\sp +{\sn wzName} +{\sv h-and-v} +} +} +{\shprslt +} +} +{\shp +{\*\shpinst\shpleft537\shptop1201\shpright2361\shpbottom2136\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 6} +} +{\sp +{\sn fFlipH} +{\sv 1} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn wzName} +{\sv h-only} +} +} +{\shprslt +} +} +{\shp +{\*\shpinst\shpleft537\shptop2201\shpright2361\shpbottom3136\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 6} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 1} +} +{\sp +{\sn wzName} +{\sv v-only} +} +} +{\shprslt +} +} +{\shp +{\*\shpinst\shpleft537\shptop3201\shpright2361\shpbottom4136\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 6} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn wzName} +{\sv neither-h-nor-v} +} +} +{\shprslt +} +} +} +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744 +\par } +} diff --git a/sw/qa/extras/rtfimport/data/tdf91684.rtf b/sw/qa/extras/rtfimport/data/tdf91684.rtf new file mode 100644 index 000..4ec9e26 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf91684.rtf @@ -0,0 +1,460 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +\pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +{\field\fldedit\fldlock +{\*\fldinst +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid8943332 SHAPE \\* MERGEFORMAT } +} +{\fldrslt +{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid8943332 +{\shpgrp +{\*\shpinst\shpleft0\shptop0\shpright780\shpbottom759\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplockanchor\shplid1026 +{\sp +{\sn groupLeft} +{\sv 8754} +} +{\sp +{\sn groupTop} +{\sv 11945} +} +{\sp +{\sn groupRight} +{\sv 11634} +} +{\sp +{\sn groupBottom} +{\sv 14804} +} +{\sp +{\sn rotation} +{\sv 0} +} +{\sp +{\sn fLockAgainstUngrouping} +{\sv 0} +} +{\sp +{\sn fLockRotation} +{\sv 0} +} +{\sp +{\sn fLockAspectRatio} +{\sv 0} +} +{\sp +{\sn fLockPosition} +{\sv 0} +} +{\sp +{\sn fLockAgainstSelect} +{\sv 0} +} +{\sp +{\sn fLockAgainstGrouping} +{\sv 0} +} +{\sp +{\sn wzName} +{\sv Group +450} +} +{\sp +{\sn lidRegroup} +{\sv 0} +} +{\sp +{\sn posh} +{\sv 0} +} +{\sp +{\sn posrelh} +{\sv 3} +} +{\sp +{\sn posv} +{\sv 0} +} +{\sp +{\sn posrelv} +{\sv 3} +} +{\sp +{\sn dhgt} +{\sv 0} +} +{\sp +{\sn fAllowOverlap} +{\sv 1} +} +{\sp +{\sn fBehindDocument} +{\sv 0} +} +{\sp +{\sn fHidden} +{\sv 0} +} +{\sp +{\sn fPseudoInline} +{\sv 1} +}
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf50821.rtf| 10 ++ sw/qa/extras/rtfimport/rtfimport.cxx|8 writerfilter/source/rtftok/rtfdispatchvalue.cxx |4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit 47a218c3f9d8f12dab9813abc820d54f1e77b6f8 Author: Miklos VajnaDate: Tue Jun 7 09:25:16 2016 +0200 tdf#50821 RTF import: fix handling of \trpaddf{b,l,r,t} The width type is an attribute, not an sprm; this resulted in zero cell margin in the table -> the text overlapped with the border shape. (cherry picked from commit 279f1a204f8c5b5121e9f1f9c431d17bdab1f5bd) Change-Id: I611feb084a16c76faf281d376e1a4a31e162f53d Reviewed-on: https://gerrit.libreoffice.org/26027 Tested-by: Jenkins Reviewed-by: Christian Lohmaier diff --git a/sw/qa/extras/rtfimport/data/tdf50821.rtf b/sw/qa/extras/rtfimport/data/tdf50821.rtf new file mode 100644 index 000..03f253d --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf50821.rtf @@ -0,0 +1,10 @@ +{\rtf1 +\pard\plain +before\par +\trowd \trpaddl108\trpaddfl3 \cellx10362\pard\plain\intbl +table +\cell\row +\pard\plain +end +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 390079c..17445cd 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2626,6 +2626,14 @@ DECLARE_RTFIMPORT_TEST(testTdf77349, "tdf77349.rtf") CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xImage->getName()); } +DECLARE_RTFIMPORT_TEST(testTdf50821, "tdf50821.rtf") +{ +uno::Reference xTable(getParagraphOrTable(2), uno::UNO_QUERY); +uno::Reference xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); +// This was 0, \trpaddfl was mishandled on import. +CPPUNIT_ASSERT_EQUAL(static_cast(191), getProperty(xCell, "LeftBorderDistance")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index b231ef4..03ed971 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -1313,8 +1313,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) default: break; } -putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared(aAttributes)); -putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared(aAttributes)); +putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared(aAttributes)); +putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared(aAttributes)); } break; case RTF_TRPADDB: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/qa writerfilter/source
sw/qa/extras/rtfimport/data/tdf77349.rtf |3 +++ sw/qa/extras/rtfimport/rtfimport.cxx |7 +++ writerfilter/source/dmapper/DomainMapper.cxx |7 +++ writerfilter/source/dmapper/DomainMapper.hxx |3 +++ writerfilter/source/dmapper/GraphicHelpers.cxx | 24 writerfilter/source/dmapper/GraphicHelpers.hxx | 11 +++ writerfilter/source/dmapper/GraphicImport.cxx | 11 ++- 7 files changed, 61 insertions(+), 5 deletions(-) New commits: commit 5823d676e99f7536fca2cee774e2f8d80588 Author: Miklos VajnaDate: Tue May 31 09:11:52 2016 +0200 tdf#77349 RTF import: automatically generate names for images if needed The DOC/ODT import can call SwDoc::SetAllUniqueFlyNames() at the end of the process to assign unique names to fly frames which lack a name. Add a similar (but much simpler) feature to the domain mapper to avoid empty image names in the DOCX/RTF import result, so it's easier to click on the items in Writer's navigator. (cherry picked from commit 526ed1f7dbd9150734edcb03727d49e1b1306f56) Change-Id: I432fc741f8d75d735e1dfe88daba50ba0797042d Reviewed-on: https://gerrit.libreoffice.org/25812 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sw/qa/extras/rtfimport/data/tdf77349.rtf b/sw/qa/extras/rtfimport/data/tdf77349.rtf new file mode 100644 index 000..1451b36 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf77349.rtf @@ -0,0 +1,3 @@ +{\rtf1 +{\pict \pngblip \picw-64 \pich-1061137057 \picwgoal0 \pichgoal0 47494638396110001000d5ffffc0c0c0555f00aafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b1818181010100909090606060303030021f9040102002c1000100684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a1e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b} +\par } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2af36e6..390079c 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2619,6 +2619,13 @@ DECLARE_RTFIMPORT_TEST(testTdf74795, "tdf74795.rtf") CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xCell, "LeftBorderDistance")); } +DECLARE_RTFIMPORT_TEST(testTdf77349, "tdf77349.rtf") +{ +uno::Reference xImage(getShape(1), uno::UNO_QUERY); +// This was empty: imported image wasn't named automatically. +CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xImage->getName()); +} + 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 5eb24e9..b7403ea 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3605,6 +3605,13 @@ GraphicZOrderHelper* DomainMapper::graphicZOrderHelper() return zOrderHelper.get(); } +GraphicNamingHelper& DomainMapper::GetGraphicNamingHelper() +{ +if (m_pGraphicNamingHelper.get() == nullptr) +m_pGraphicNamingHelper.reset(new GraphicNamingHelper()); +return *m_pGraphicNamingHelper; +} + uno::Reference DomainMapper::PopPendingShape() { return m_pImpl->PopPendingShape(); diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index fee11b1..2abaf123 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -62,6 +62,7 @@ class DomainMapper_Impl; class ListsManager; class StyleSheetTable; class GraphicZOrderHelper; +class GraphicNamingHelper; // different context types require different sprm handling (e.g. names) enum SprmType @@ -107,6 +108,7 @@ public: OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); std::shared_ptr< StyleSheetTable > GetStyleSheetTable( ); GraphicZOrderHelper* graphicZOrderHelper(); +GraphicNamingHelper& GetGraphicNamingHelper(); /// Return the first from the pending (not inserted to the document) shapes, if there are any. css::uno::Reference PopPendingShape(); @@ -169,6 +171,7 @@ private: static sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue); bool mbIsSplitPara; std::unique_ptr< GraphicZOrderHelper > zOrderHelper; +std::unique_ptr m_pGraphicNamingHelper; }; } // namespace