filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 11 +-- i18nlangtag/source/languagetag/languagetag.cxx | 30 ++++++--- sd/source/ui/unoidl/unolayer.cxx | 9 ++ starmath/source/parse.cxx | 7 +- svgio/qa/cppunit/SvgImportTest.cxx | 68 ++++++++++++++++++--- svgio/qa/cppunit/data/tdf99115.svg | 40 ++++++++++++ svgio/source/svgreader/svgnode.cxx | 18 ++++- sw/qa/extras/layout/data/tdf127235.odt |binary sw/qa/extras/layout/layout.cxx | 9 ++ sw/qa/extras/ooxmlexport/data/tdf115719.docx |binary sw/qa/extras/ooxmlexport/data/tdf117988.docx |binary sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary sw/qa/extras/ooxmlimport/data/tdf124600.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 22 ++++++ sw/source/core/doc/doclay.cxx | 8 +- sw/source/core/doc/textboxhelper.cxx | 13 ++++ sw/source/core/text/txtfly.cxx | 21 +++++- sw/source/core/text/txtfrm.cxx | 3 writerfilter/source/dmapper/GraphicImport.cxx | 11 +++ writerfilter/source/filter/WriterFilter.cxx | 2 20 files changed, 232 insertions(+), 40 deletions(-)
New commits: commit 1bd742d6f8482467c5b306779efb3de2d54111a4 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Sep 17 17:08:02 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:58 2019 +0200 Related: tdf#124600 sw textbox: sync left/right margin of shape to textbox Writer TextFrames have a default left/right margin; sync from shape to textbox is needed to have correct layout when a DOCX shape has 0 left or right margin. The left margin of the shape was already correct. (The shape in the docx file was extended to have text.) (cherry picked from commit ff5f02b9282e19a2a8a68604c588e9487021b0b5) Change-Id: I832f1bc460f2553bd7f08252d3e21000b4906538 Reviewed-on: https://gerrit.libreoffice.org/80109 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx b/sw/qa/extras/ooxmlimport/data/tdf124600.docx index d5dfa313665e..16c4ceb2be5d 100644 Binary files a/sw/qa/extras/ooxmlimport/data/tdf124600.docx 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 88696be8543d..31e40b3d062e 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -144,6 +144,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124600, "tdf124600.docx") // i.e. the shape had an unexpected left margin, but not in Word. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xShape, "HoriOrientPosition")); + + // Make sure that "Shape 1 text" (anchored in the header) has the same left margin as the body + // text. + OUString aShapeTextLeft = parseDump("/root/page/header/txt/anchored/fly/infos/bounds", "left"); + OUString aBodyTextLeft = parseDump("/root/page/body/txt/infos/bounds", "left"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1701 + // - Actual : 1815 + // i.e. there was a >0 left margin on the text of the shape, resulting in incorrect horizontal + // position. + CPPUNIT_ASSERT_EQUAL(aBodyTextLeft, aShapeTextLeft); } DECLARE_OOXMLIMPORT_TEST(testTdf120548, "tdf120548.docx") diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index fedb6dfb7e2a..59ccce892de7 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -445,6 +445,19 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u break; } break; + case RES_LR_SPACE: + { + switch (nMemberID) + { + case MID_L_MARGIN: + aPropertyName = UNO_NAME_LEFT_MARGIN; + break; + case MID_R_MARGIN: + aPropertyName = UNO_NAME_RIGHT_MARGIN; + break; + } + break; + } case RES_VERT_ORIENT: switch (nMemberID) { commit 57dde667d9256192a83944a3dbc1fc83bc1e3a31 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Sep 17 11:30:26 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:39 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/80041 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> 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 000000000000..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 03a884a2cd3d..88696be8543d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -135,6 +135,17 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); } +DECLARE_OOXMLIMPORT_TEST(testTdf124600, "tdf124600.docx") +{ + uno::Reference<drawing::XShape> 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<sal_Int32>(0), + getProperty<sal_Int32>(xShape, "HoriOrientPosition")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf120548, "tdf120548.docx") { // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff0000; diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 1d5bcbf97e74..97cc3c78fe92 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -970,7 +970,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: @@ -1065,6 +1064,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; + } + } } } } commit 7f5a7ece456bb78a84948d5ceb97cb84b86949c2 Author: Eike Rathke <er...@redhat.com> AuthorDate: Wed Oct 2 12:41:07 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:32 2019 +0200 Resolves: tdf#127873 accept ',' comma group separator in number entities again Existing documents unwittingly may have used that as decimal separator in such locales (though it never was as this is always the en-US locale). "Regression" from commit 9336286a7ea5385541344f444e6f8702c85bdacb CommitDate: Fri Nov 30 22:15:22 2018 +0100 [API CHANGE] Resolves: tdf#42518 new KParseTokens::GROUP_SEPARATOR_IN_NUMBER Change-Id: I0ffc1b8ec7c1820fccd8277036c64093dddf82fe Reviewed-on: https://gerrit.libreoffice.org/80023 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 2caa9d7ddcff3f6e380c306b737e9b5e9cdaf4c2) Reviewed-on: https://gerrit.libreoffice.org/80045 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 3cd64af729db..90e356505cbf 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -376,8 +376,13 @@ void SmParser::NextToken() KParseTokens::IGNORE_LEADING_WS; // Continuing characters for numbers, may be any numeric or dot. + // tdf#127873: additionally accept ',' comma group separator as too many + // existing documents unwittingly may have used that as decimal separator + // in such locales (though it never was as this is always the en-US locale + // and the group separator is only parsed away). static const sal_Int32 coNumContFlags = - coNumStartFlags & ~KParseTokens::IGNORE_LEADING_WS; + (coNumStartFlags & ~KParseTokens::IGNORE_LEADING_WS) | + KParseTokens::GROUP_SEPARATOR_IN_NUMBER; sal_Int32 nBufLen = m_aBufferString.getLength(); ParseResult aRes; commit 6961ec67d5651f5cb57086ad24a95756c07d6d9c Author: Eike Rathke <er...@redhat.com> AuthorDate: Fri Sep 27 22:35:13 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:27 2019 +0200 Resolves: tdf#127786 cache Glibc locale string in LanguageTagImpl ... for non-simple @modifier strings that are constructed using liblangtag, as loading resource strings needs it over and over and over again. Change-Id: Ib6a74e5ddb44508aa41f101c200a508bfa4a13bd Reviewed-on: https://gerrit.libreoffice.org/79770 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins (cherry picked from commit 24c7c12224f1c1d66f335f6fe085595352137646) Reviewed-on: https://gerrit.libreoffice.org/79775 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> (cherry picked from commit 99782b52c3cc25a32661c382ca98a32f6ec87003) Reviewed-on: https://gerrit.libreoffice.org/79787 diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index c0e27492f912..ef34402d02de 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -252,11 +252,12 @@ private: mutable css::lang::Locale maLocale; mutable OUString maBcp47; - mutable OUString maCachedLanguage; ///< cache getLanguage() - mutable OUString maCachedScript; ///< cache getScript() - mutable OUString maCachedCountry; ///< cache getCountry() - mutable OUString maCachedVariants; ///< cache getVariants() - mutable lt_tag_t* mpImplLangtag; ///< liblangtag pointer + mutable OUString maCachedLanguage; ///< cache getLanguage() + mutable OUString maCachedScript; ///< cache getScript() + mutable OUString maCachedCountry; ///< cache getCountry() + mutable OUString maCachedVariants; ///< cache getVariants() + mutable OUString maCachedGlibcString; ///< cache getGlibcLocaleString() + mutable lt_tag_t* mpImplLangtag; ///< liblangtag pointer mutable LanguageType mnLangID; mutable LanguageTag::ScriptType meScriptType; mutable Decision meIsValid; @@ -271,6 +272,7 @@ private: mutable bool mbCachedScript : 1; mutable bool mbCachedCountry : 1; mutable bool mbCachedVariants : 1; + mutable bool mbCachedGlibcString : 1; OUString const & getBcp47() const; OUString const & getLanguage() const; @@ -384,7 +386,8 @@ LanguageTagImpl::LanguageTagImpl( const LanguageTag & rLanguageTag ) mbCachedLanguage( false), mbCachedScript( false), mbCachedCountry( false), - mbCachedVariants( false) + mbCachedVariants( false), + mbCachedGlibcString( false) { } @@ -397,6 +400,7 @@ LanguageTagImpl::LanguageTagImpl( const LanguageTagImpl & rLanguageTagImpl ) maCachedScript( rLanguageTagImpl.maCachedScript), maCachedCountry( rLanguageTagImpl.maCachedCountry), maCachedVariants( rLanguageTagImpl.maCachedVariants), + maCachedGlibcString( rLanguageTagImpl.maCachedGlibcString), mpImplLangtag( rLanguageTagImpl.mpImplLangtag ? lt_tag_copy( rLanguageTagImpl.mpImplLangtag) : nullptr), mnLangID( rLanguageTagImpl.mnLangID), @@ -412,7 +416,8 @@ LanguageTagImpl::LanguageTagImpl( const LanguageTagImpl & rLanguageTagImpl ) mbCachedLanguage( rLanguageTagImpl.mbCachedLanguage), mbCachedScript( rLanguageTagImpl.mbCachedScript), mbCachedCountry( rLanguageTagImpl.mbCachedCountry), - mbCachedVariants( rLanguageTagImpl.mbCachedVariants) + mbCachedVariants( rLanguageTagImpl.mbCachedVariants), + mbCachedGlibcString( rLanguageTagImpl.mbCachedGlibcString) { if (mpImplLangtag) theDataRef::get().init(); @@ -430,6 +435,7 @@ LanguageTagImpl& LanguageTagImpl::operator=( const LanguageTagImpl & rLanguageTa maCachedScript = rLanguageTagImpl.maCachedScript; maCachedCountry = rLanguageTagImpl.maCachedCountry; maCachedVariants = rLanguageTagImpl.maCachedVariants; + maCachedGlibcString = rLanguageTagImpl.maCachedGlibcString; lt_tag_t * oldTag = mpImplLangtag; mpImplLangtag = rLanguageTagImpl.mpImplLangtag ? lt_tag_copy( rLanguageTagImpl.mpImplLangtag) : nullptr; @@ -448,6 +454,7 @@ LanguageTagImpl& LanguageTagImpl::operator=( const LanguageTagImpl & rLanguageTa mbCachedScript = rLanguageTagImpl.mbCachedScript; mbCachedCountry = rLanguageTagImpl.mbCachedCountry; mbCachedVariants = rLanguageTagImpl.mbCachedVariants; + mbCachedGlibcString = rLanguageTagImpl.mbCachedGlibcString; if (mpImplLangtag && !oldTag) theDataRef::get().init(); return *this; @@ -1902,7 +1909,9 @@ OUString LanguageTag::getVariants() const OUString LanguageTagImpl::getGlibcLocaleString() const { - OUString sLocale; + if (mbCachedGlibcString) + return maCachedGlibcString; + if (!mpImplLangtag) { meIsLiblangtagNeeded = DECISION_YES; @@ -1913,11 +1922,12 @@ OUString LanguageTagImpl::getGlibcLocaleString() const char* pLang = lt_tag_convert_to_locale(mpImplLangtag, nullptr); if (pLang) { - sLocale = OUString::createFromAscii( pLang); + maCachedGlibcString = OUString::createFromAscii( pLang); + mbCachedGlibcString = true; free(pLang); } } - return sLocale; + return maCachedGlibcString; } OUString LanguageTag::getGlibcLocaleString( const OUString & rEncoding ) const commit 445c541d0e0ddd54eb022fbfe4ad01ea96bedb65 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Fri Sep 27 15:18:25 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:22 2019 +0200 filter: XHTML: make "calc-heading-digit" a little faster Exporting OpenDocument-v1.3-csd01-part3-schema.odt to XHTML fails with: runtime error: file share/xslt/export/xhtml/body.xsl line 1404 element variable xsltApplySequenceConstructor: A potential infinite template recursion was detected. You can adjust xsltMaxDepth (--maxdepth) in order to raise the maximum number of nested template calls and variables/params (currently set to 3000). Unfortunately the document contains this many headings, and the calc-heading-digit computes the value by recursively looking at every preceding heading in the document, without TCO apparently... Try to improve this by using XPath to filter early the headings that are effectively ignored in the 3rd xsl:when case anyway: the ones with a level lower than the one for which the number is requested; this limits the recursive calls to the number of headings on the same level. Change-Id: Iddf5a91664402a57a0138731ddc9cebb06b0a126 Reviewed-on: https://gerrit.libreoffice.org/79720 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 86cca6b40ced4031dec4b708ac67b5cbe70cddf9) Reviewed-on: https://gerrit.libreoffice.org/79841 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index c21840e1689e..63357d1e9b38 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -1401,9 +1401,10 @@ <xsl:param name="currentoutlineLevel"/> <xsl:param name="i" select="1"/> - <xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/> + <xsl:variable name="precedingHeading" select="preceding-sibling::text:h[@text:outline-level <= $currentoutlineLevel][$i]"/> + <xsl:variable name="precedingoutlineLevel" select="$precedingHeading/@text:outline-level"/> <!-- tdf#107696: if text:h has attribute "is-list-header" with "true" value, it mustn't be counted for numbering --> - <xsl:variable name="precedingoutlineLevel-is-list-header" select="preceding-sibling::text:h[$i][@text:is-list-header='true']/@text:outline-level"/> + <xsl:variable name="precedingoutlineLevel-is-list-header" select="$precedingHeading[@text:is-list-header='true']/@text:outline-level"/> <xsl:choose> <xsl:when test="($currentoutlineLevel = $precedingoutlineLevel) and (not($precedingoutlineLevel-is-list-header)) "> <xsl:call-template name="calc-heading-digit"> @@ -1421,11 +1422,7 @@ </xsl:call-template> </xsl:when> <xsl:when test="$currentoutlineLevel < $precedingoutlineLevel"> - <xsl:call-template name="calc-heading-digit"> - <xsl:with-param name="value" select="$value"/> - <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/> - <xsl:with-param name="i" select="$i + 1"/> - </xsl:call-template> + <xsl:message terminate="yes">this should not happen</xsl:message> </xsl:when> <xsl:otherwise> <xsl:value-of select="$value"/> commit e55c0e1239ff01b2c1917e6070f00970b1cf8e6e Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Fri Sep 27 14:12:39 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:13 2019 +0200 tdf#125585 write default layer status for OLE objects The layer status is taken from the active view, when saving the document. But embedded documents have no view. Error was, that for all layers value 'false' was written in that case. With this patch the defaults (visible, printable, not locked) (true, true, false) are written. Change-Id: I2388ce31cc208fba075083889ec1bb2f874ef482 Reviewed-on: https://gerrit.libreoffice.org/79701 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> (cherry picked from commit 12f9a9f341fd8f8a98f7cd98f296a8729d279e0d) Reviewed-on: https://gerrit.libreoffice.org/79786 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index 0a42ecdad7b3..2d0d7ab435ce 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -264,6 +264,15 @@ bool SdLayer::get( LayerAttribute what ) throw() case LOCKED: return pFrameView->GetLockedLayers().IsSet(pLayer->GetID()); } } + + // no view at all, e.g. Draw embedded as OLE in text document, ODF default values + switch(what) + { + case VISIBLE: return true; + case PRINTABLE: return true; + case LOCKED: return false; + } + } return false; //TODO: uno::Exception? } commit 953da95ce65d08ca556a2ab16a0bd989f8010288 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Tue Sep 24 19:39:29 2019 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:41:03 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 <justin_l...@sil.org> Tested-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit 202bee1a819de7b1e8c75dd863c4154f66419400) Reviewed-on: https://gerrit.libreoffice.org/79484 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> (cherry picked from commit b0c5bc47d0d170df1384dd48cee9291ce6044083) Reviewed-on: https://gerrit.libreoffice.org/79527 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 c23e96186921..277ebed24628 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -287,7 +287,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)); commit 37ab539d7332cc4f0fc8296a240a093f54e2eb56 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Sep 16 12:54:59 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:40:56 2019 +0200 tdf#99115: add Css selector '*' style only if the element... ... is on top of the hierarchy Otherwise, we add it for every element on the hierarchy Adapt unittest from https://bugs.documentfoundation.org/show_bug.cgi?id=100198 Provided by Sam Yygier Reviewed-on: https://gerrit.libreoffice.org/78997 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> (cherry picked from commit 4007ced54d611d1397387f7329a47de5efaca32f) Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Change-Id: I72c7ae08f3ce0194eff86697b202d5553810abeb Reviewed-on: https://gerrit.libreoffice.org/79018 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 8174c068d045..072f8c66abe2 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -62,6 +62,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void test47446b(); void testMaskText(); void testTdf99994(); + void testTdf99115(); void testTdf101237(); void testBehaviourWhenWidthAndHeightIsOrIsNotSet(); @@ -92,6 +93,7 @@ public: CPPUNIT_TEST(test47446b); CPPUNIT_TEST(testMaskText); CPPUNIT_TEST(testTdf99994); + CPPUNIT_TEST(testTdf99115); CPPUNIT_TEST(testTdf101237); CPPUNIT_TEST(testBehaviourWhenWidthAndHeightIsOrIsNotSet); CPPUNIT_TEST_SUITE_END(); @@ -527,15 +529,15 @@ void Test::testi125329() CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", "#c0c0c0"); // rect background color - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "height", "30"); // rect background height - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "width", "50"); // rect background width - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "minx", "15"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "miny", "15"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "maxx", "65"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "maxy", "45"); - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#008000"); // rect stroke color - assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "1"); // rect stroke width + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "color", "#c0c0c0"); // rect background color + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "height", "30"); // rect background height + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "width", "50"); // rect background width + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "minx", "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "miny", "15"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "maxx", "65"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "maxy", "45"); + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "color", "#008000"); // rect stroke color + assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "width", "1"); // rect stroke width } void Test::testMaskingPath07b() @@ -617,6 +619,54 @@ void Test::testTdf99994() assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans"); } +void Test::testTdf99115() +{ + //Check that styles are resolved correctly where there is a * css selector + Primitive2DSequence aSequenceTdf99115 = parseSvg("/svgio/qa/cppunit/data/tdf99115.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115.getLength())); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99115) ); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "red 1"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "red 2"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", "red 3"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", "blue 4"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", "blue 5"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", "blue 6"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", "green 7"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", "green 8"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", "green 9"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", "18"); +} + void Test::testTdf101237() { //Check that fill color, stroke color and stroke-width are inherited from use element diff --git a/svgio/qa/cppunit/data/tdf99115.svg b/svgio/qa/cppunit/data/tdf99115.svg new file mode 100644 index 000000000000..6d4b5e9c1b97 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf99115.svg @@ -0,0 +1,40 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="200 px" height="100 px"> +<style type="text/css" id="style1"> +* {font-size:18px;} +#tspan6 {fill:blue} +.c1 {fill:green} +.c2 {fill:red} +#tspan8 {fill:green} +#text9 {fill:green} +</style> +<text id="text1" style="" x="1" y="20" > + <tspan id="tspan1" fill="red">red 1</tspan> +</text> +<text id="text2" style="fill:red" x="1" y="40" > + <tspan id="tspan2">red 2</tspan> +</text> +<text id="text3" style="" x="1" y="60" > + <tspan id="tspan3" style="fill:red">red 3</tspan> +</text> + +<text id="text4" style="fill:red" x="60" y="20" > + <tspan id="tspan4" fill="blue">blue 4</tspan> +</text> +<text id="text5" x="60" y="40" > + <tspan id="tspan5" style="fill:blue" fill="red">blue 5</tspan> +</text> +<text id="text6" style="fill:red" x="60" y="60" > + <tspan id="tspan6">blue 6</tspan> +</text> + +<text id="text7" x="130" y="20" > + <tspan id="tspan7" class="c1" fill="blue">green 7</tspan> +</text> +<text id="text8" x="130" y="40" > + <tspan id="tspan8" class="c2" fill="red">green 8</tspan> +</text> +<text id="text9" x="130" y="60" class="c2"> + <tspan id="tspan9">green 9</tspan> +</text> + +</svg> diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 29afd66474ff..0c40f1643716 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -174,6 +174,7 @@ namespace svgio // - 'id' CssStyle // - 'class' CssStyle(s) // - type-dependent elements (e..g. 'rect' for all rect elements) + // - Css selector '*' // - local attributes (rOriginal) // - inherited attributes (up the hierarchy) // The first four will be collected in maCssStyleVector for the current element @@ -191,13 +192,20 @@ namespace svgio // check the hierarchy for concatenated patterns of Selectors fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *this, OUString()); - // #i125329# find Css selector '*', add as last element if found - const SvgStyleAttributes* pNew = getDocument().findGlobalCssStyleAttributes("*"); + // tdf#99115, Add css selector '*' style only if the element is on top of the hierarchy + // meaning its parent is <svg> + const SvgNode* pParent = this->getParent(); - if(pNew) + if(pParent && pParent->getType() == SVGTokenSvg) { - // add CssStyle for selector '*' if found - maCssStyleVector.push_back(pNew); + // #i125329# find Css selector '*', add as last element if found + const SvgStyleAttributes* pNew = getDocument().findGlobalCssStyleAttributes("*"); + + if(pNew) + { + // add CssStyle for selector '*' if found + maCssStyleVector.push_back(pNew); + } } //local attributes commit e2209ccf7cb97063d63d48990104f4d8ca3bcf98 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Mon Sep 23 17:38:33 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:40:51 2019 +0200 tdf#127652 sw_redlinehide: don't set invalid SwTextFrame offsets The obvious problem here is that if a deletion spans multiple text frames, the offset of the 2nd one must not be reduced lower than the start position of the deletion; apparently this fixes the subsequent crashes with stale text portions having now invalid indexes into the string. (regression from 0acde7514e666fc04805fd36503bd174162336ca) Change-Id: Iaf9e2c5ca06ed36dc0e8611891d19c22f7661d34 Reviewed-on: https://gerrit.libreoffice.org/79421 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 9ec2c77046901fdacca77753052b54c81e6bc82c) Reviewed-on: https://gerrit.libreoffice.org/79433 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 65288822e9bb..a74031e2a4ff 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1865,7 +1865,8 @@ static void lcl_ModifyOfst(SwTextFrame & rFrame, assert(nLen != TextFrameIndex(COMPLETE_STRING)); if (rFrame.IsFollow() && nPos < rFrame.GetOfst()) { - rFrame.ManipOfst( std::max(TextFrameIndex(0), op(rFrame.GetOfst(), nLen)) ); + rFrame.ManipOfst( std::max(nPos, op(rFrame.GetOfst(), nLen)) ); + assert(sal_Int32(rFrame.GetOfst()) <= rFrame.GetText().getLength()); } } commit e0a5f170b2a9d4b829e173c4c6619ec0527a609d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Sep 23 15:38:12 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:40:38 2019 +0200 Resolves: tdf#127695 IsGroupObject == true doesn't mean its a SdrObjGroup but that it has a SubList Change-Id: I473464de5c6bba5c36be1ad7cbd21a3158645d66 Reviewed-on: https://gerrit.libreoffice.org/79412 Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> Tested-by: Xisco Faulí <xiscofa...@libreoffice.org> (cherry picked from commit e6c07d2018d0b6be7492664fa22f70461b1422b8) Reviewed-on: https://gerrit.libreoffice.org/79428 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index fb7c6d29436a..b8c91b4965fa 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1305,10 +1305,12 @@ static void lcl_SetNumUsedBit(std::vector<sal_uInt8>& rSetFlags, size_t nFormatS // contents for name collision check if (rObj.IsGroupObject()) { - const SdrObjGroup &rGroupObj = static_cast<const SdrObjGroup&>(rObj); - for (size_t i = 0, nCount = rGroupObj.GetObjCount(); i < nCount; ++i) + const SdrObjList* pSub(rObj.GetSubList()); + assert(pSub && "IsGroupObject is implented as GetSubList != nullptr"); + const size_t nCount = pSub->GetObjCount(); + for (size_t i = 0; i < nCount; ++i) { - SdrObject* pObj = rGroupObj.GetObj(i); + SdrObject* pObj = pSub->GetObj(i); if (!pObj) continue; lcl_SetNumUsedBit(rSetFlags, nFormatSize, nNmLen, *pObj, rCmpName); commit 8f35d65bf3ad781bd38477a5770d5855322e0bf6 Author: Patrick Jaap <patrick.j...@tu-dresden.de> AuthorDate: Fri Sep 6 10:50:05 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Oct 4 15:40:28 2019 +0200 tdf#127235 break if object is larger than page We will always have an overlap if the object is larger than the whole page. Look for the next page style: if it is missing or the same as the current, we simply stop. Change-Id: I699d5146d215f17b4775dbcb32811fa5b6ebf60d Reviewed-on: https://gerrit.libreoffice.org/78696 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79104 diff --git a/sw/qa/extras/layout/data/tdf127235.odt b/sw/qa/extras/layout/data/tdf127235.odt new file mode 100644 index 000000000000..5b27c921cf17 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127235.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index f59b4b069ca4..001e6f5fdfa1 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -76,6 +76,7 @@ public: void testTdf122878(); void testTdf115094(); void testTdf118719(); + void testTdf127235(); void testTdf123651(); void testBtlrCell(); void testImageComment(); @@ -118,6 +119,7 @@ public: CPPUNIT_TEST(testTdf122878); CPPUNIT_TEST(testTdf115094); CPPUNIT_TEST(testTdf118719); + CPPUNIT_TEST(testTdf127235) CPPUNIT_TEST(testTdf123651); CPPUNIT_TEST(testBtlrCell); CPPUNIT_TEST(testImageComment); @@ -2743,6 +2745,13 @@ void SwLayoutWriter::testTdf118719() CPPUNIT_ASSERT_GREATER(nOther, nLast); } +void SwLayoutWriter::testTdf127235() +{ + SwDoc* pDoc = createDoc("tdf127235.odt"); + // This resulted in a layout loop. + pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); +} + void SwLayoutWriter::testTdf123651() { createDoc("tdf123651.docx"); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index e16cd878ce75..18bec6284a57 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -998,6 +998,24 @@ bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const { SwSwapIfSwapped swap(const_cast<SwTextFrame *>(m_pCurrFrame)); + // Optimization + SwRectFnSet aRectFnSet(m_pCurrFrame); + + // tdf#127235 stop if the area is larger than the page + if( aRectFnSet.GetHeight(pPage->getFrameArea()) < aRectFnSet.GetHeight(rRect)) + { + // get the doc model description + const SwPageDesc* pPageDesc = pPage->GetPageDesc(); + + // if there is no next page style or it is the same as the current + // => stop trying to place the frame (it would end in an infinite loop) + if( pPageDesc && + ( !pPageDesc->GetFollow() || pPageDesc->GetFollow() == pPageDesc) ) + { + return false; + } + } + bool bRet = false; // #i68520# const SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 ); @@ -1010,10 +1028,9 @@ bool SwTextFly::ForEach( const SwRect &rRect, SwRect* pRect, bool bAvoid ) const SwRect aRect( pAnchoredObj->GetObjRectWithSpaces() ); - // Optimization - SwRectFnSet aRectFnSet(m_pCurrFrame); if( aRectFnSet.GetLeft(aRect) > aRectFnSet.GetRight(rRect) ) break; + // #i68520# if ( mpCurrAnchoredObj != pAnchoredObj && aRect.IsOver( rRect ) ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits